From 33ec37b141e896b47ed642923fd33b0c658ae9fb Mon Sep 17 00:00:00 2001 From: Amir Rajan Date: Fri, 11 Sep 2020 02:02:01 -0500 Subject: synced samples --- .../app/02_printing_to_the_console.txt | 31 +++ .../00_intermediate_ruby_primer/app/03_strings.txt | 15 ++ .../00_intermediate_ruby_primer/app/04_numbers.txt | 21 +++ .../app/05_booleans.txt | 32 ++++ .../app/06_conditionals.txt | 114 +++++++++++ .../00_intermediate_ruby_primer/app/07_looping.txt | 55 ++++++ .../app/08_functions.txt | 69 +++++++ .../app/09_powerful_arrays.txt | 210 +++++++++++++++++++++ .../00_intermediate_ruby_primer/app/main.rb | 3 + .../00_intermediate_ruby_primer/app/repl.rb | 0 .../license-for-sample.txt | 9 + 11 files changed, 559 insertions(+) create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/license-for-sample.txt (limited to 'samples/00_learn_ruby_optional/00_intermediate_ruby_primer') diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt new file mode 100644 index 0000000..dd86367 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt @@ -0,0 +1,31 @@ +# ==================================================================================== +# Commenting Code +# ==================================================================================== +# +# Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: +# +# I am commented code. And so are the lines above. +# +# I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's +# an entertaining read. Otherwise, go to the next txt file. +# +# Follow along by visiting: +# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 + +# ==================================================================================== +# Printing to the Console: +# ==================================================================================== +# +# Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text +# to repl.rb and save to see Hello World printed to the console. + +repl do + puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.' + puts '====' + puts '======' + puts '================================' + puts 'Hello World' + puts '================================' + puts '======' + puts '====' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt new file mode 100644 index 0000000..34ea252 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt @@ -0,0 +1,15 @@ +# ==================================================================================== +# Strings +# ==================================================================================== +# +# Here is how you work with strings in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: strings' + message = "Hello World" + puts "The value of message is: " + message + puts "Any value can be interpolated within a string using \#{}." + puts "Interpolated message: #{message}." + puts 'This #{message} is not interpolated because the string uses single quotes.' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt new file mode 100644 index 0000000..dfdf04d --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt @@ -0,0 +1,21 @@ +# ==================================================================================== +# Numerics +# ==================================================================================== +# +# Here is how you work with numbers in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: Fixnum and Floats' + a = 10 + puts "The value of a is: #{a}" + puts "a + 1 is: #{a + 1}" + puts "a / 3 is: #{a / 3}" + puts '' + + b = 10.12 + puts "The value of b is: #{b}" + puts "b + 1 is: #{b + 1}" + puts "b as an integer is: #{b.to_i}" + puts '' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt new file mode 100644 index 0000000..2a9060f --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt @@ -0,0 +1,32 @@ +# ==================================================================================== +# Booleans +# ==================================================================================== +# +# Here is how you work with numbers in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)' + puts "Anything that *isn't* false or nil is true." + + c = 30 + puts "The value of c is #{c}." + + if c + puts "This if statement ran because c is truthy." + end + + d = false + puts "The value if d is #{d}. The type for d is #{d.class}." + + if !d + puts "This if statement ran because d is falsey, using the not operator (!)." + end + + e = nil + puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}." + + if !e + puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}." + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt new file mode 100644 index 0000000..8a0c172 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt @@ -0,0 +1,114 @@ +# ==================================================================================== +# Conditionals +# ==================================================================================== +# +# Here is how you create conditionals in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts "* RUBY PRIMER: Conditionals" +end + +# ==================================================================================== +# if +# ==================================================================================== + +repl do + puts "** INFO: if statement" + i_am_one = 1 + if i_am_one + puts "This was printed because i_am_one is truthy." + end +end + +# ==================================================================================== +# if/else +# ==================================================================================== + +repl do + puts "** INFO: if/else statement" + i_am_false = false + if i_am_false + puts "This will NOT get printed because i_am_false is false." + else + puts "This was printed because i_am_false is false." + end +end + + +# ==================================================================================== +# if/elsif/else +# ==================================================================================== + +repl do + puts "** INFO: if/elsif/else statement" + i_am_false = false + i_am_true = true + if i_am_false + puts "This will NOT get printed because i_am_false is false." + elsif i_am_true + puts "This was printed because i_am_true is true." + else + puts "This will NOT get printed i_am_true was true." + end +end + +# ==================================================================================== +# case +# ==================================================================================== + +repl do + puts "** INFO case statement" + i_am_one = 1 # change this value to see different results + + case i_am_one + when 10 + puts "the value of i_am_one is 10" + when 9 + puts "the value of i_am_one is 9" + when 5 + puts "the value of i_am_one is 5" + when 1 + puts "the value of i_am_one is 1" + else + puts "Value wasn't cased." + end +end + +# ==================================================================================== +# comparison operators +# ==================================================================================== + +repl do + puts "** INFO: Different types of comparisons" + if 4 == 4 + puts "4 equals 4 (==)" + end + + if 4 != 3 + puts "4 does not equal 3 (!=)" + end + + if 3 < 4 + puts "3 is less than 4 (<)" + end + + if 4 > 3 + puts "4 is greater than 3 (>)" + end +end + +# ==================================================================================== +# and/or conditionals +# ==================================================================================== + +repl do + puts "** INFO: AND, OR operator (&&, ||)" + if (4 > 3) || (3 < 4) || false + puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)" + end + + if (4 > 3) && (3 < 4) + puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)" + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt new file mode 100644 index 0000000..03c3d28 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt @@ -0,0 +1,55 @@ +# ==================================================================================== +# Looping +# ==================================================================================== +# +# Looping looks a whole lot different than other languages. +# But it's pretty awesome when you get used to it. + +repl do + puts "* RUBY PRIMER: Loops" +end + +# ==================================================================================== +# times +# ==================================================================================== + +repl do + puts "** INFO: ~Numeric#times~ (for loop)" + 3.times do |i| + puts i + end +end + +# ==================================================================================== +# foreach +# ==================================================================================== + +repl do + puts "** INFO: ~Array#each~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char| + puts char + end + + puts "** INFO: ~Array#each_with_index~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char, i| + puts "index #{i}: #{char}" + end +end + +# ==================================================================================== +# ranges +# ==================================================================================== + +repl do + puts "** INFO: range block exclusive (three dots)" + (0...3).each do |i| + puts i + end + + puts "** INFO: range block inclusive (two dots)" + (0..3).each do |i| + puts i + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt new file mode 100644 index 0000000..9ad38de --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt @@ -0,0 +1,69 @@ +# ==================================================================================== +# Functions +# ==================================================================================== + +# The last statement of a function is implictly returned. Parenthesis for functions +# are optional as long as the statement can be envaluated disambiguously. + +repl do + puts "* RUBY PRIMER: Functions" +end + +# ==================================================================================== +# Functions single parameter +# ==================================================================================== + +repl do + puts "* INFO: Function with one parameter" + + # function definition + def add_one_to n + n + 1 + end + + # Parenthesis are optional in Ruby as long as the + # parsing is disambiguous. Here are a couple of variations. + # Generally speaking, don't put parenthesis is you don't have to. + + # Conventional Usage of Parenthesis. + puts add_one_to(3) + + # DragonRuby's recommended use of parenthesis (inner function has parenthesis). + puts (add_one_to 3) + + # Full parens. + puts(add_one_to(3)) + + # Outer function has parenthesis + puts(add_one_to 3) +end + +# ==================================================================================== +# Functions with default parameter values +# ==================================================================================== + +repl do + puts "* INFO: Function with default value" + def function_with_default_value v = 10 + v * 10 + end + + puts "Passing the argument three yields: #{function_with_default_value 3}" + puts "Passing no argument yields: #{function_with_default_value}" +end + +# ==================================================================================== +# Nil default parameter value and ||= operator. +# ==================================================================================== + +repl do + puts "* INFO: Using the OR EQUAL operator (||=)" + def function_with_nil_default_with_local a = nil + result = a + result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE" + "value is #{result}." + end + + puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}" + puts "Passing nil: #{function_with_nil_default_with_local}" +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt new file mode 100644 index 0000000..9904686 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt @@ -0,0 +1,210 @@ +# ==================================================================================== +# Arrays +# ==================================================================================== + +# Arrays are incredibly powerful in Ruby. Learn to use them well. + +repl do + puts "* RUBY PRIMER: ARRAYS" +end + +# ==================================================================================== +# Enumerable ranges and .to_a +# ==================================================================================== + +repl do + puts "** INFO: Create an array with the numbers 1 to 10." + one_to_ten = (1..10).to_a + puts one_to_ten +end + +# ==================================================================================== +# Finding elements +# ==================================================================================== + +repl do + puts "** INFO: Finding elements in an array using ~Array#find_all~." + puts "Create a new array that only contains even numbers from the previous array." + + one_to_ten = (1..10).to_a + evens = one_to_ten.find_all do |number| + number % 2 == 0 + end + + puts evens +end + +# ==================================================================================== +# Rejecting elements +# ==================================================================================== + +repl do + puts "** INFO: Removing elements in an array using ~Array#reject~." + puts "Create a new array that rejects odd numbers." + + one_to_ten = (1..10).to_a + also_even = one_to_ten.reject do |number| + number % 2 != 0 + end + + puts also_even +end + +# ==================================================================================== +# Array transform using the map function. +# ==================================================================================== + +repl do + puts "** INFO: Creating new derived values from an array using ~Array#map~." + puts "Create an array that doubles every number." + + one_to_ten = (1..10).to_a + doubled = one_to_ten.map do |number| + number * 2 + end + + puts doubled +end + +# ==================================================================================== +# Combining array functions. +# ==================================================================================== + +repl do + puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~." + puts "Create an array that selects only odd numbers and then multiply those by 10." + + one_to_ten = (1..10).to_a + odd_doubled = one_to_ten.find_all do |number| + number % 2 != 0 + end.map do |odd_number| + odd_number * 10 + end + + puts odd_doubled +end + +# ==================================================================================== +# Product function. +# ==================================================================================== + +repl do + puts "** INFO: Create all combinations of array values using ~Array#product~." + puts "All two-item pairs of numbers 1 to 10." + one_to_ten = (1..10).to_a + all_combinations = one_to_ten.product(one_to_ten) + puts all_combinations +end + +# ==================================================================================== +# Uniq and sort function. +# ==================================================================================== + +repl do + puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~." + puts "All uniq combinations of numbers regardless of order." + puts "For example: [1, 2] is the same as [2, 1]." + one_to_ten = (1..10).to_a + uniq_combinations = + one_to_ten.product(one_to_ten) + .map do |unsorted_number| + unsorted_number.sort + end.uniq + puts uniq_combinations +end + +# ==================================================================================== +# Example of an advanced array transform. +# ==================================================================================== + +repl do + puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~." + puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." + + one_to_hundred = (1..100).to_a + + triples = + one_to_hundred.product(one_to_hundred).map do |width, height| + [width, height, Math.sqrt(width ** 2 + height ** 2)] + end.find_all do |_, _, hypotenuse| + hypotenuse.to_i == hypotenuse + end.map do |triangle| + triangle.map(&:to_i) + end.uniq do |triangle| + triangle.sort + end.map do |width, height, hypotenuse| + [width, height, hypotenuse, (width * height) / 2] + end.sort_by do |_, _, _, area| + area + end + + triples.each do |width, height, hypotenuse, _| + puts "(#{width}, #{height}, #{hypotenuse})" + end +end + +# ==================================================================================== +# Example of an sorting. +# ==================================================================================== + +repl do + puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype." + + things_to_sort = [ + { type: :background, order: 1 }, + { type: :foreground, order: 1 }, + { type: :foreground, order: 2 } + ] + puts "*** Original array." + puts things_to_sort + + puts "*** Simple sort using key." + # For a simple sort, you can use sort_by + results = things_to_sort.sort_by do |hash| + hash[:order] + end + + puts results + + puts "*** Custom sort." + puts "**** Sorting process." + # for a more complicated sort, you can provide a block that returns + # -1, 0, 1 for a left and right operand + results = things_to_sort.sort do |l, r| + sort_result = 0 + puts "here is l: #{l}" + puts "here is r: #{r || "nil"}" + # if either value is nil/false return 0 + if !l || !r + sort_result = 0 + # if the type of "left" is background and the + # type of "right" is foreground, then return + # -1 (which means "left" is less than "right" + elsif l[:type] == :background && r[:type] == :foreground + sort_result = -1 + # if the type of "left" is foreground and the + # type of "right" is background, then return + # 1 (which means "left" is greater than "right" + elsif l[:type] == :foreground && r[:type] == :background + sort_result = 1 + # if "left" and "right"'s type are the same, then + # use the order as the tie breaker + elsif l[:order] < r[:order] + sort_result = -1 + elsif l[:order] > r[:order] + sort_result = 1 + # returning 0 means both values are equal + else + sort_result = 0 + end + sort_result + end.to_a + + puts "**** Sort result." + puts results +end + +# ==================================================================================== +# Api documention for Array that is worth commiting to memory because arrays are so +# awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html +# ==================================================================================== diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb new file mode 100644 index 0000000..96461aa --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb @@ -0,0 +1,3 @@ +def tick args + args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb new file mode 100644 index 0000000..e69de29 diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/license-for-sample.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/license-for-sample.txt @@ -0,0 +1,9 @@ +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. -- cgit v1.2.3 From 20d5b4057b44ffcf92478b2a8e9476ace2fdc0f5 Mon Sep 17 00:00:00 2001 From: Amir Rajan Date: Tue, 22 Sep 2020 06:27:46 -0500 Subject: synced with 1.22 --- docs/docs.css | 34 +- docs/docs.html | 11936 +- docs/docs.txt | 23816 ++-- docs/parse_log.txt | 131502 ++++++++++-------- docs/search_results.txt | 665 +- docs/todo/06-keyboard.md | 2 +- docs/todo/08-controllers.md | 2 +- dragon/console.rb | 71 +- dragon/console_menu.rb | 56 +- dragon/docs.rb | 84 +- dragon/easing.rb | 82 + dragon/geometry.rb | 4 - dragon/kernel_docs.rb | 8 +- dragon/log.rb | 6 +- dragon/numeric.rb | 5 - dragon/readme_docs.rb | 224 +- dragon/runtime_docs.rb | 17 + dragon/trace.rb | 6 +- .../app/01_printing.txt | 31 + .../app/02_printing_to_the_console.txt | 31 - .../00_intermediate_ruby_primer/app/02_strings.txt | 15 + .../00_intermediate_ruby_primer/app/03_numbers.txt | 21 + .../00_intermediate_ruby_primer/app/03_strings.txt | 15 - .../app/04_booleans.txt | 32 + .../00_intermediate_ruby_primer/app/04_numbers.txt | 21 - .../app/05_booleans.txt | 32 - .../app/05_conditionals.txt | 114 + .../app/06_conditionals.txt | 114 - .../00_intermediate_ruby_primer/app/06_looping.txt | 55 + .../app/07_functions.txt | 69 + .../00_intermediate_ruby_primer/app/07_looping.txt | 55 - .../00_intermediate_ruby_primer/app/08_arrays.txt | 210 + .../app/08_functions.txt | 69 - .../app/09_powerful_arrays.txt | 210 - .../01_animation_using_separate_pngs/app/main.rb | 131 + .../license-for-sample.txt | 9 + .../01_animation_using_separate_pngs/replay.txt | 162 + .../sprites/dragon_fly_0.png | Bin 0 -> 12896 bytes .../sprites/dragon_fly_1.png | Bin 0 -> 2964 bytes .../sprites/dragon_fly_2.png | Bin 0 -> 3047 bytes .../sprites/dragon_fly_3.png | Bin 0 -> 2655 bytes .../sprites/dragon_fly_4.png | Bin 0 -> 2725 bytes .../sprites/dragon_fly_5.png | Bin 0 -> 2655 bytes .../01_animation_using_seperate_pngs/app/main.rb | 131 - .../license-for-sample.txt | 9 - .../01_animation_using_seperate_pngs/replay.txt | 162 - .../sprites/dragon_fly_0.png | Bin 12896 -> 0 bytes .../sprites/dragon_fly_1.png | Bin 2964 -> 0 bytes .../sprites/dragon_fly_2.png | Bin 3047 -> 0 bytes .../sprites/dragon_fly_3.png | Bin 2655 -> 0 bytes .../sprites/dragon_fly_4.png | Bin 2725 -> 0 bytes .../sprites/dragon_fly_5.png | Bin 2655 -> 0 bytes .../04_box_collision_2/app/main.rb | 470 - .../04_box_collision_2/app/map.txt | 11 - .../04_box_collision_2/license-for-sample.txt | 9 - .../04_box_collision_2/replay.txt | 819 - .../04_box_collision_2/sprites/image1.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image10.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image11.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image12.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image13.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image14.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image15.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image16.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image17.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image18.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image19.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image2.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image20.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image3.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image4.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image5.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image6.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image7.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image8.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/image9.png | Bin 473 -> 0 bytes .../04_box_collision_2/sprites/player.png | Bin 744 -> 0 bytes .../04_jump_physics/app/main.rb | 196 - .../04_jump_physics/replay.txt | 124 - .../05_box_collision_2/app/main.rb | 470 + .../05_box_collision_2/app/map.txt | 11 + .../05_box_collision_2/license-for-sample.txt | 9 + .../05_box_collision_2/replay.txt | 819 + .../05_box_collision_2/sprites/image1.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image10.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image11.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image12.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image13.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image14.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image15.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image16.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image17.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image18.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image19.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image2.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image20.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image3.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image4.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image5.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image6.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image7.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image8.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/image9.png | Bin 0 -> 473 bytes .../05_box_collision_2/sprites/player.png | Bin 0 -> 744 bytes .../06_jump_physics/app/main.rb | 196 + .../06_jump_physics/replay.txt | 124 + samples/05_mouse/01_mouse_click/app/main.rb | 244 + .../05_mouse/01_mouse_click/license-for-sample.txt | 9 + samples/05_mouse/01_mouse_click/replay.txt | 870 + samples/05_mouse/02_mouse_move/app/main.rb | 296 + .../05_mouse/02_mouse_move/license-for-sample.txt | 9 + samples/05_mouse/02_mouse_move/replay.txt | 550 + .../05_mouse/02_mouse_move/sprites/player-0.png | Bin 0 -> 1499 bytes .../05_mouse/02_mouse_move/sprites/player-1.png | Bin 0 -> 1524 bytes .../05_mouse/02_mouse_move/sprites/player-2.png | Bin 0 -> 1528 bytes .../05_mouse/02_mouse_move/sprites/player-3.png | Bin 0 -> 1499 bytes .../05_mouse/02_mouse_move/sprites/player-4.png | Bin 0 -> 2118 bytes .../05_mouse/02_mouse_move/sprites/player-5.png | Bin 0 -> 2118 bytes samples/05_mouse/02_mouse_move/sprites/slash.png | Bin 0 -> 143 bytes .../05_mouse/02_mouse_move/sprites/zombie-0.png | Bin 0 -> 144 bytes .../05_mouse/02_mouse_move/sprites/zombie-1.png | Bin 0 -> 153 bytes .../05_mouse/02_mouse_move/sprites/zombie-2.png | Bin 0 -> 157 bytes .../05_mouse/02_mouse_move/sprites/zombie-3.png | Bin 0 -> 144 bytes .../05_mouse/02_mouse_move/sprites/zombie-4.png | Bin 0 -> 541 bytes .../05_mouse/02_mouse_move/sprites/zombie-5.png | Bin 0 -> 524 bytes samples/05_mouse/03_mouse_click/app/main.rb | 244 - .../05_mouse/03_mouse_click/license-for-sample.txt | 9 - samples/05_mouse/03_mouse_click/replay.txt | 870 - .../05_mouse/03_mouse_move_paint_app/app/main.rb | 240 + .../03_mouse_move_paint_app/license-for-sample.txt | 21 + .../05_mouse/03_mouse_move_paint_app/replay.txt | 238 + samples/05_mouse/04_coordinate_systems/app/main.rb | 80 + .../04_coordinate_systems/license-for-sample.txt | 9 + samples/05_mouse/04_coordinate_systems/replay.txt | 526 + samples/05_mouse/05_mouse_move/app/main.rb | 296 - .../05_mouse/05_mouse_move/license-for-sample.txt | 9 - samples/05_mouse/05_mouse_move/replay.txt | 550 - .../05_mouse/05_mouse_move/sprites/player-0.png | Bin 1499 -> 0 bytes .../05_mouse/05_mouse_move/sprites/player-1.png | Bin 1524 -> 0 bytes .../05_mouse/05_mouse_move/sprites/player-2.png | Bin 1528 -> 0 bytes .../05_mouse/05_mouse_move/sprites/player-3.png | Bin 1499 -> 0 bytes .../05_mouse/05_mouse_move/sprites/player-4.png | Bin 2118 -> 0 bytes .../05_mouse/05_mouse_move/sprites/player-5.png | Bin 2118 -> 0 bytes samples/05_mouse/05_mouse_move/sprites/slash.png | Bin 143 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-0.png | Bin 144 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-1.png | Bin 153 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-2.png | Bin 157 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-3.png | Bin 144 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-4.png | Bin 541 -> 0 bytes .../05_mouse/05_mouse_move/sprites/zombie-5.png | Bin 524 -> 0 bytes .../05_mouse/05_mouse_move_paint_app/app/main.rb | 240 - .../05_mouse_move_paint_app/license-for-sample.txt | 21 - .../05_mouse/05_mouse_move_paint_app/replay.txt | 238 - samples/05_mouse/06_coordinate_systems/app/main.rb | 80 - .../06_coordinate_systems/license-for-sample.txt | 9 - samples/05_mouse/06_coordinate_systems/replay.txt | 526 - samples/06_save_load/01_save_load_game/app/main.rb | 389 + .../01_save_load_game/license-for-sample.txt | 9 + samples/06_save_load/01_save_load_game/replay.txt | 1450 + samples/06_save_load/10_save_load_game/app/main.rb | 389 - .../10_save_load_game/license-for-sample.txt | 9 - samples/06_save_load/10_save_load_game/replay.txt | 1450 - .../05_render_primitives_as_hash/app/main.rb | 191 + .../05_render_primitives_as_hash/fonts/manaspc.ttf | Bin 0 -> 9556 bytes .../license-for-sample.txt | 9 + .../11_render_primitives_as_hash/app/main.rb | 191 - .../11_render_primitives_as_hash/fonts/manaspc.ttf | Bin 9556 -> 0 bytes .../license-for-sample.txt | 9 - .../01_easing_functions/app/main.rb | 132 - .../01_easing_functions/license-for-sample.txt | 9 - .../02_cubic_bezier/app/main.rb | 61 - .../03_easing_using_spline/app/main.rb | 18 - .../04_parametric_enemy_movement/app/main.rb | 213 - .../license-for-sample.txt | 9 - .../04_parametric_enemy_movement/replay.txt | 94 - .../01_easing_functions/app/main.rb | 132 + .../01_easing_functions/license-for-sample.txt | 9 + .../02_cubic_bezier/app/main.rb | 61 + .../03_easing_using_spline/app/main.rb | 18 + .../04_parametric_enemy_movement/app/main.rb | 213 + .../license-for-sample.txt | 9 + .../04_parametric_enemy_movement/replay.txt | 94 + samples/12_c_extensions/01_basics/.gitignore | 1 + samples/12_c_extensions/01_basics/app/ext.c | 4 + samples/12_c_extensions/01_basics/app/main.rb | 7 + .../01_basics/license-for-sample.txt | 9 + .../01_basics/metadata/game_metadata.txt | 5 + samples/12_c_extensions/01_basics/pre.bat | 4 + samples/12_c_extensions/01_basics/pre.sh | 10 + .../add_buttons_to_console/app/main.rb | 58 + .../choose_your_own_adventure/app/decision.rb | 37 - .../choose_your_own_adventure/app/main.rb | 132 - .../license-for-sample.txt | 9 - .../choose_your_own_adventure/replay.txt | 701 - .../return_of_serenity/app/lowrez_simulator.rb | 91 - .../return_of_serenity/app/main.rb | 423 - .../return_of_serenity/app/repl.rb | 1 - .../return_of_serenity/app/require.rb | 11 - .../return_of_serenity/app/storyline.rb | 146 - .../return_of_serenity/app/storyline_anka.rb | 127 - .../app/storyline_blinking_light.rb | 75 - .../return_of_serenity/app/storyline_day_one.rb | 206 - .../app/storyline_final_decision.rb | 136 - .../app/storyline_final_message.rb | 216 - .../app/storyline_serenity_alive.rb | 219 - .../app/storyline_serenity_bio.rb | 151 - .../app/storyline_serenity_introduction.rb | 95 - .../app/storyline_speed_of_light.rb | 104 - .../fonts/dragonruby-gtk-4x4.ttf | Bin 8820 -> 0 bytes .../return_of_serenity/fonts/manaspc.ttf | Bin 9556 -> 0 bytes .../return_of_serenity/license-for-sample.txt | 9 - .../return_of_serenity/replay.txt | 793 - .../return_of_serenity/sounds/music-loop.ogg | Bin 1362527 -> 0 bytes .../return_of_serenity/sounds/static-loop.ogg | Bin 465901 -> 0 bytes .../return_of_serenity/sprites/book.png | Bin 6561 -> 0 bytes .../return_of_serenity/sprites/decision.png | Bin 4845 -> 0 bytes .../return_of_serenity/sprites/dream.png | Bin 6661 -> 0 bytes .../return_of_serenity/sprites/front-of-home.png | Bin 6264 -> 0 bytes .../return_of_serenity/sprites/inside-home.png | Bin 7011 -> 0 bytes .../sprites/inside-observatory.png | Bin 6691 -> 0 bytes .../sprites/label-background.png | Bin 101 -> 0 bytes .../return_of_serenity/sprites/library.png | Bin 6347 -> 0 bytes .../return_of_serenity/sprites/mainframe.png | Bin 6257 -> 0 bytes .../sprites/mountain-pass-zoomed-out.png | Bin 8959 -> 0 bytes .../return_of_serenity/sprites/observatory.png | Bin 7728 -> 0 bytes .../return_of_serenity/sprites/outside-library.png | Bin 7036 -> 0 bytes .../sprites/path-to-observatory.png | Bin 7708 -> 0 bytes .../return_of_serenity/sprites/pc.png | Bin 6478 -> 0 bytes .../return_of_serenity/sprites/planets.png | Bin 7024 -> 0 bytes .../return_of_serenity/sprites/player-down.png | Bin 148 -> 0 bytes .../return_of_serenity/sprites/player-left.png | Bin 134 -> 0 bytes .../return_of_serenity/sprites/player-right.png | Bin 123 -> 0 bytes .../return_of_serenity/sprites/player-up.png | Bin 148 -> 0 bytes .../sprites/player-zoomed-out.png | Bin 104 -> 0 bytes .../return_of_serenity/sprites/serenity.png | Bin 6289 -> 0 bytes .../return_of_serenity/sprites/side-of-home.png | Bin 6851 -> 0 bytes .../return_of_serenity/sprites/square.png | Bin 101 -> 0 bytes .../return_of_serenity/sprites/todo.png | Bin 2694 -> 0 bytes .../sprites/tribute-game-over.png | Bin 7157 -> 0 bytes .../return_of_serenity/sprites/tribute.png | Bin 7160 -> 0 bytes .../the_little_probe/app/main.rb | 8 +- .../the_little_probe/data/level.txt | 1481 + .../the_little_probe/data/level_lava.txt | 235 + .../99_genre_platformer/the_little_probe/level.txt | 1481 - .../the_little_probe/level_lava.txt | 235 - .../roguelike_line_of_sight/app/constants.rb | 8 - .../roguelike_line_of_sight/app/legend.rb | 65 - .../roguelike_line_of_sight/app/main.rb | 97 - .../roguelike_line_of_sight/app/sprite_lookup.rb | 124 - .../roguelike_line_of_sight/license-for-sample.txt | 9 - .../sprites/simple-mood-16x16.png | Bin 14424 -> 0 bytes .../roguelike_starting_point/app/main.rb | 439 - .../license-for-sample.txt | 9 - .../roguelike_starting_point/replay.txt | 555 - .../choose_your_own_adventure/app/decision.rb | 37 + .../choose_your_own_adventure/app/main.rb | 132 + .../license-for-sample.txt | 9 + .../choose_your_own_adventure/replay.txt | 701 + .../return_of_serenity/app/lowrez_simulator.rb | 91 + .../return_of_serenity/app/main.rb | 473 + .../return_of_serenity/app/repl.rb | 1 + .../return_of_serenity/app/require.rb | 11 + .../return_of_serenity/app/storyline.rb | 146 + .../return_of_serenity/app/storyline_anka.rb | 127 + .../app/storyline_blinking_light.rb | 75 + .../return_of_serenity/app/storyline_day_one.rb | 206 + .../app/storyline_final_decision.rb | 136 + .../app/storyline_final_message.rb | 216 + .../app/storyline_serenity_alive.rb | 219 + .../app/storyline_serenity_bio.rb | 151 + .../app/storyline_serenity_introduction.rb | 95 + .../app/storyline_speed_of_light.rb | 104 + .../fonts/dragonruby-gtk-4x4.ttf | Bin 0 -> 8820 bytes .../return_of_serenity/fonts/manaspc.ttf | Bin 0 -> 9556 bytes .../return_of_serenity/license-for-sample.txt | 9 + .../return_of_serenity/replay.txt | 793 + .../return_of_serenity/sounds/music-loop.ogg | Bin 0 -> 1362527 bytes .../return_of_serenity/sounds/static-loop.ogg | Bin 0 -> 465901 bytes .../return_of_serenity/sprites/book.png | Bin 0 -> 6561 bytes .../return_of_serenity/sprites/decision.png | Bin 0 -> 4845 bytes .../return_of_serenity/sprites/dream.png | Bin 0 -> 6661 bytes .../return_of_serenity/sprites/front-of-home.png | Bin 0 -> 6264 bytes .../return_of_serenity/sprites/inside-home.png | Bin 0 -> 7011 bytes .../sprites/inside-observatory.png | Bin 0 -> 6691 bytes .../sprites/label-background.png | Bin 0 -> 101 bytes .../return_of_serenity/sprites/library.png | Bin 0 -> 6347 bytes .../return_of_serenity/sprites/mainframe.png | Bin 0 -> 6257 bytes .../sprites/mountain-pass-zoomed-out.png | Bin 0 -> 8959 bytes .../return_of_serenity/sprites/observatory.png | Bin 0 -> 7728 bytes .../return_of_serenity/sprites/outside-library.png | Bin 0 -> 7036 bytes .../sprites/path-to-observatory.png | Bin 0 -> 7708 bytes .../return_of_serenity/sprites/pc.png | Bin 0 -> 6478 bytes .../return_of_serenity/sprites/planets.png | Bin 0 -> 7024 bytes .../return_of_serenity/sprites/player-down.png | Bin 0 -> 148 bytes .../return_of_serenity/sprites/player-left.png | Bin 0 -> 134 bytes .../return_of_serenity/sprites/player-right.png | Bin 0 -> 123 bytes .../return_of_serenity/sprites/player-up.png | Bin 0 -> 148 bytes .../sprites/player-zoomed-out.png | Bin 0 -> 104 bytes .../return_of_serenity/sprites/serenity.png | Bin 0 -> 6289 bytes .../return_of_serenity/sprites/side-of-home.png | Bin 0 -> 6851 bytes .../return_of_serenity/sprites/square.png | Bin 0 -> 101 bytes .../return_of_serenity/sprites/todo.png | Bin 0 -> 2694 bytes .../sprites/tribute-game-over.png | Bin 0 -> 7157 bytes .../return_of_serenity/sprites/tribute.png | Bin 0 -> 7160 bytes .../roguelike_line_of_sight/app/constants.rb | 8 + .../roguelike_line_of_sight/app/legend.rb | 65 + .../roguelike_line_of_sight/app/main.rb | 97 + .../roguelike_line_of_sight/app/sprite_lookup.rb | 124 + .../roguelike_line_of_sight/license-for-sample.txt | 9 + .../sprites/simple-mood-16x16.png | Bin 0 -> 14424 bytes .../roguelike_starting_point/app/main.rb | 439 + .../license-for-sample.txt | 9 + .../roguelike_starting_point/replay.txt | 555 + .../hexagonal_grid/app/main.rb | 68 + .../hexagonal_grid/license-for-sample.txt | 9 + .../hexagonal_grid/replay.txt | 276 + .../hexagonal_grid/sprites/hexagon-black.png | Bin 0 -> 2602 bytes .../hexagonal_grid/sprites/hexagon-gray.png | Bin 0 -> 5184 bytes .../isometric_grid/app/main.rb | 262 + .../isometric_grid/license-for-sample.txt | 9 + .../isometric_grid/metadata/game_metadata.txt | 6 + .../isometric_grid/metadata/icon.png | Bin 0 -> 157056 bytes .../isometric_grid/replay.txt | 579 + .../isometric_grid/sprites/leftSide.png | Bin 0 -> 1888 bytes .../isometric_grid/sprites/mountain.png | Bin 0 -> 4155 bytes .../isometric_grid/sprites/ocean.png | Bin 0 -> 2339 bytes .../isometric_grid/sprites/rightSide.png | Bin 0 -> 1755 bytes .../isometric_grid/sprites/river.png | Bin 0 -> 4285 bytes .../isometric_grid/sprites/selectedTile.png | Bin 0 -> 2335 bytes .../isometric_grid/sprites/tile.png | Bin 0 -> 2341 bytes .../topdown_starting_point/app/main.rb | 108 + .../topdown_starting_point/license-for-sample.txt | 9 + .../topdown_starting_point/replay.txt | 187 + .../hexagonal_grid/app/main.rb | 68 - .../hexagonal_grid/license-for-sample.txt | 9 - .../hexagonal_grid/replay.txt | 276 - .../hexagonal_grid/sprites/hexagon-black.png | Bin 2602 -> 0 bytes .../hexagonal_grid/sprites/hexagon-gray.png | Bin 5184 -> 0 bytes .../isometric_grid/app/main.rb | 262 - .../isometric_grid/license-for-sample.txt | 9 - .../isometric_grid/metadata/game_metadata.txt | 6 - .../isometric_grid/metadata/icon.png | Bin 157056 -> 0 bytes .../isometric_grid/replay.txt | 579 - .../isometric_grid/sprites/leftSide.png | Bin 1888 -> 0 bytes .../isometric_grid/sprites/mountain.png | Bin 4155 -> 0 bytes .../isometric_grid/sprites/ocean.png | Bin 2339 -> 0 bytes .../isometric_grid/sprites/rightSide.png | Bin 1755 -> 0 bytes .../isometric_grid/sprites/river.png | Bin 4285 -> 0 bytes .../isometric_grid/sprites/selectedTile.png | Bin 2335 -> 0 bytes .../isometric_grid/sprites/tile.png | Bin 2341 -> 0 bytes .../topdown_starting_point/app/main.rb | 108 - .../topdown_starting_point/license-for-sample.txt | 9 - .../topdown_starting_point/replay.txt | 187 - 353 files changed, 110599 insertions(+), 90819 deletions(-) create mode 100644 dragon/easing.rb create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt create mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt delete mode 100644 samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/license-for-sample.txt create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/replay.txt create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_0.png create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_1.png create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_2.png create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_3.png create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_4.png create mode 100644 samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_5.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png delete mode 100644 samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/app/main.rb delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/app/map.txt delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/license-for-sample.txt delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/replay.txt delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image1.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image10.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image11.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image12.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image13.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image14.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image15.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image16.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image17.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image18.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image19.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image2.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image20.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image3.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image4.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image5.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image6.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image7.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image8.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/image9.png delete mode 100644 samples/04_physics_and_collisions/04_box_collision_2/sprites/player.png delete mode 100644 samples/04_physics_and_collisions/04_jump_physics/app/main.rb delete mode 100644 samples/04_physics_and_collisions/04_jump_physics/replay.txt create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/app/main.rb create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/app/map.txt create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/license-for-sample.txt create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/replay.txt create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image1.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image10.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image11.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image12.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image13.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image14.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image15.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image16.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image17.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image18.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image19.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image2.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image20.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image3.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image4.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image5.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image6.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image7.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image8.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/image9.png create mode 100644 samples/04_physics_and_collisions/05_box_collision_2/sprites/player.png create mode 100644 samples/04_physics_and_collisions/06_jump_physics/app/main.rb create mode 100644 samples/04_physics_and_collisions/06_jump_physics/replay.txt create mode 100644 samples/05_mouse/01_mouse_click/app/main.rb create mode 100644 samples/05_mouse/01_mouse_click/license-for-sample.txt create mode 100644 samples/05_mouse/01_mouse_click/replay.txt create mode 100644 samples/05_mouse/02_mouse_move/app/main.rb create mode 100644 samples/05_mouse/02_mouse_move/license-for-sample.txt create mode 100644 samples/05_mouse/02_mouse_move/replay.txt create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-0.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-1.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-2.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-3.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-4.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/player-5.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/slash.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-0.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-1.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-2.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-3.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-4.png create mode 100644 samples/05_mouse/02_mouse_move/sprites/zombie-5.png delete mode 100644 samples/05_mouse/03_mouse_click/app/main.rb delete mode 100644 samples/05_mouse/03_mouse_click/license-for-sample.txt delete mode 100644 samples/05_mouse/03_mouse_click/replay.txt create mode 100644 samples/05_mouse/03_mouse_move_paint_app/app/main.rb create mode 100644 samples/05_mouse/03_mouse_move_paint_app/license-for-sample.txt create mode 100644 samples/05_mouse/03_mouse_move_paint_app/replay.txt create mode 100644 samples/05_mouse/04_coordinate_systems/app/main.rb create mode 100644 samples/05_mouse/04_coordinate_systems/license-for-sample.txt create mode 100644 samples/05_mouse/04_coordinate_systems/replay.txt delete mode 100644 samples/05_mouse/05_mouse_move/app/main.rb delete mode 100644 samples/05_mouse/05_mouse_move/license-for-sample.txt delete mode 100644 samples/05_mouse/05_mouse_move/replay.txt delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-0.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-1.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-2.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-3.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-4.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/player-5.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/slash.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-0.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-1.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-2.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-3.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-4.png delete mode 100644 samples/05_mouse/05_mouse_move/sprites/zombie-5.png delete mode 100644 samples/05_mouse/05_mouse_move_paint_app/app/main.rb delete mode 100644 samples/05_mouse/05_mouse_move_paint_app/license-for-sample.txt delete mode 100644 samples/05_mouse/05_mouse_move_paint_app/replay.txt delete mode 100644 samples/05_mouse/06_coordinate_systems/app/main.rb delete mode 100644 samples/05_mouse/06_coordinate_systems/license-for-sample.txt delete mode 100644 samples/05_mouse/06_coordinate_systems/replay.txt create mode 100644 samples/06_save_load/01_save_load_game/app/main.rb create mode 100644 samples/06_save_load/01_save_load_game/license-for-sample.txt create mode 100644 samples/06_save_load/01_save_load_game/replay.txt delete mode 100644 samples/06_save_load/10_save_load_game/app/main.rb delete mode 100644 samples/06_save_load/10_save_load_game/license-for-sample.txt delete mode 100644 samples/06_save_load/10_save_load_game/replay.txt create mode 100644 samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb create mode 100644 samples/07_advanced_rendering/05_render_primitives_as_hash/fonts/manaspc.ttf create mode 100644 samples/07_advanced_rendering/05_render_primitives_as_hash/license-for-sample.txt delete mode 100644 samples/07_advanced_rendering/11_render_primitives_as_hash/app/main.rb delete mode 100644 samples/07_advanced_rendering/11_render_primitives_as_hash/fonts/manaspc.ttf delete mode 100644 samples/07_advanced_rendering/11_render_primitives_as_hash/license-for-sample.txt delete mode 100644 samples/08_lerping_easing_functions/01_easing_functions/app/main.rb delete mode 100644 samples/08_lerping_easing_functions/01_easing_functions/license-for-sample.txt delete mode 100644 samples/08_lerping_easing_functions/02_cubic_bezier/app/main.rb delete mode 100644 samples/08_lerping_easing_functions/03_easing_using_spline/app/main.rb delete mode 100644 samples/08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb delete mode 100644 samples/08_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt delete mode 100644 samples/08_lerping_easing_functions/04_parametric_enemy_movement/replay.txt create mode 100644 samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb create mode 100644 samples/08_tweening_lerping_easing_functions/01_easing_functions/license-for-sample.txt create mode 100644 samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb create mode 100644 samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb create mode 100644 samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb create mode 100644 samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt create mode 100644 samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/replay.txt create mode 100644 samples/12_c_extensions/01_basics/.gitignore create mode 100644 samples/12_c_extensions/01_basics/app/ext.c create mode 100644 samples/12_c_extensions/01_basics/app/main.rb create mode 100644 samples/12_c_extensions/01_basics/license-for-sample.txt create mode 100644 samples/12_c_extensions/01_basics/metadata/game_metadata.txt create mode 100644 samples/12_c_extensions/01_basics/pre.bat create mode 100755 samples/12_c_extensions/01_basics/pre.sh create mode 100644 samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb delete mode 100644 samples/99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb delete mode 100644 samples/99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb delete mode 100644 samples/99_genre_narrative_rpg/choose_your_own_adventure/license-for-sample.txt delete mode 100644 samples/99_genre_narrative_rpg/choose_your_own_adventure/replay.txt delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/main.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/repl.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/require.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/fonts/manaspc.ttf delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/license-for-sample.txt delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/replay.txt delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sounds/music-loop.ogg delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sounds/static-loop.ogg delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/book.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/decision.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/dream.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/front-of-home.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-home.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-observatory.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/label-background.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/library.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/mainframe.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/mountain-pass-zoomed-out.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/observatory.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/outside-library.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/path-to-observatory.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/pc.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/planets.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-down.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-left.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-right.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-up.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-zoomed-out.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/serenity.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/side-of-home.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/square.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/todo.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute-game-over.png delete mode 100644 samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute.png create mode 100644 samples/99_genre_platformer/the_little_probe/data/level.txt create mode 100644 samples/99_genre_platformer/the_little_probe/data/level_lava.txt delete mode 100644 samples/99_genre_platformer/the_little_probe/level.txt delete mode 100644 samples/99_genre_platformer/the_little_probe/level_lava.txt delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/app/constants.rb delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/app/legend.rb delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/app/main.rb delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/license-for-sample.txt delete mode 100644 samples/99_genre_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png delete mode 100644 samples/99_genre_roguelike/roguelike_starting_point/app/main.rb delete mode 100644 samples/99_genre_roguelike/roguelike_starting_point/license-for-sample.txt delete mode 100644 samples/99_genre_roguelike/roguelike_starting_point/replay.txt create mode 100644 samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb create mode 100644 samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb create mode 100644 samples/99_genre_rpg_narrative/choose_your_own_adventure/license-for-sample.txt create mode 100644 samples/99_genre_rpg_narrative/choose_your_own_adventure/replay.txt create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/fonts/manaspc.ttf create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/license-for-sample.txt create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/replay.txt create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sounds/music-loop.ogg create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sounds/static-loop.ogg create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/book.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/decision.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/dream.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/front-of-home.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-home.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-observatory.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/label-background.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/library.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/mainframe.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/mountain-pass-zoomed-out.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/observatory.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/outside-library.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/path-to-observatory.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/pc.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/planets.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-down.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-left.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-right.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-up.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-zoomed-out.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/serenity.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/side-of-home.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/square.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/todo.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute-game-over.png create mode 100644 samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute.png create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/license-for-sample.txt create mode 100644 samples/99_genre_rpg_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png create mode 100644 samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb create mode 100644 samples/99_genre_rpg_roguelike/roguelike_starting_point/license-for-sample.txt create mode 100644 samples/99_genre_rpg_roguelike/roguelike_starting_point/replay.txt create mode 100644 samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb create mode 100644 samples/99_genre_rpg_tactical/hexagonal_grid/license-for-sample.txt create mode 100644 samples/99_genre_rpg_tactical/hexagonal_grid/replay.txt create mode 100644 samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-black.png create mode 100644 samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-gray.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/app/main.rb create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/license-for-sample.txt create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/metadata/game_metadata.txt create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/metadata/icon.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/replay.txt create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/leftSide.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/mountain.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/ocean.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/rightSide.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/river.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/selectedTile.png create mode 100644 samples/99_genre_rpg_tactical/isometric_grid/sprites/tile.png create mode 100644 samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb create mode 100644 samples/99_genre_rpg_topdown/topdown_starting_point/license-for-sample.txt create mode 100644 samples/99_genre_rpg_topdown/topdown_starting_point/replay.txt delete mode 100644 samples/99_genre_tactical_rpg/hexagonal_grid/app/main.rb delete mode 100644 samples/99_genre_tactical_rpg/hexagonal_grid/license-for-sample.txt delete mode 100644 samples/99_genre_tactical_rpg/hexagonal_grid/replay.txt delete mode 100644 samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-black.png delete mode 100644 samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-gray.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/app/main.rb delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/license-for-sample.txt delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/metadata/game_metadata.txt delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/metadata/icon.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/replay.txt delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/leftSide.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/mountain.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/ocean.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/rightSide.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/river.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/selectedTile.png delete mode 100644 samples/99_genre_tactical_rpg/isometric_grid/sprites/tile.png delete mode 100644 samples/99_genre_topdown_rpg/topdown_starting_point/app/main.rb delete mode 100644 samples/99_genre_topdown_rpg/topdown_starting_point/license-for-sample.txt delete mode 100644 samples/99_genre_topdown_rpg/topdown_starting_point/replay.txt (limited to 'samples/00_learn_ruby_optional/00_intermediate_ruby_primer') diff --git a/docs/docs.css b/docs/docs.css index 25cc677..acbe0df 100644 --- a/docs/docs.css +++ b/docs/docs.css @@ -14,6 +14,7 @@ body { } a { + word-wrap: break-word; color: #0077CC; text-decoration: none; } @@ -46,7 +47,14 @@ h3 { border-bottom: solid 1px silver; } +h4 { + font-size: 14px; + border-bottom: solid 1px silver; +} + + img { + width: 100%; padding: 2px; max-width: 640px; max-height: 320px; @@ -84,7 +92,7 @@ hr:before { pre { border: solid 1px silver; padding: 10px; - font-size: 14px; + font-size: 12px; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; @@ -118,3 +126,27 @@ iframe { blockquote { font-style: italic; } + +#toc { + font-size: smaller; +} + +@media only screen and (min-width: 1280px) { + #content { + width: 720px; + max-width: 720px; + padding-left: 310px; + } + + #toc { + border: solid 1px silver; + padding: 10px; + padding-bottom: 30px; + position: fixed; + width: 400px; + height: 90%; + left: 10px; + top: 10px; + overflow-y: scroll; + } +} diff --git a/docs/docs.html b/docs/docs.html index ce8e1b6..b21caff 100644 --- a/docs/docs.html +++ b/docs/docs.html @@ -1,19 +1,20 @@ DragonRuby Game Toolkit Documentation - - +
-

Table Of Contents

+

Table Of Contents

-
+
  • Learn Ruby Optional - Beginner Ruby Primer - automation.rb
  • +
  • Learn Ruby Optional - Beginner Ruby Primer - main.rb
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - printing.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - strings.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - looping.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - functions.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - main.rb
  • +
  • Learn Ruby Optional - Intermediate Ruby Primer - repl.rb
  • +
  • Rendering Basics - Labels - main.rb
  • +
  • Rendering Basics - Lines - main.rb
  • +
  • Rendering Basics - Solids Borders - main.rb
  • +
  • Rendering Basics - Sprites - main.rb
  • +
  • Rendering Basics - Sounds - main.rb
  • +
  • Input Basics - Keyboard - main.rb
  • +
  • Input Basics - Mouse - main.rb
  • +
  • Input Basics - Mouse Point To Rect - main.rb
  • +
  • Input Basics - Mouse Rect To Rect - main.rb
  • +
  • Input Basics - Controller - main.rb
  • +
  • Rendering Sprites - Animation Using Separate Pngs - main.rb
  • +
  • Rendering Sprites - Animation Using Sprite Sheet - main.rb
  • +
  • Rendering Sprites - Animation States - main.rb
  • +
  • Rendering Sprites - Color And Rotation - main.rb
  • +
  • Physics And Collisions - Simple - main.rb
  • +
  • Physics And Collisions - Moving Objects - main.rb
  • +
  • Physics And Collisions - Entities - main.rb
  • +
  • Physics And Collisions - Box Collision - main.rb
  • +
  • Physics And Collisions - Box Collision 2 - main.rb
  • +
  • Physics And Collisions - Jump Physics - main.rb
  • +
  • Mouse - Mouse Click - main.rb
  • +
  • Mouse - Mouse Move - main.rb
  • +
  • Mouse - Mouse Move Paint App - main.rb
  • +
  • Mouse - Coordinate Systems - main.rb
  • +
  • Save Load - Save Load Game - main.rb
  • +
  • Advanced Rendering - Simple Render Targets - main.rb
  • +
  • Advanced Rendering - Render Targets With Alphas - main.rb
  • +
  • Advanced Rendering - Render Target Viewports - main.rb
  • +
  • Advanced Rendering - Render Primitive Hierarchies - main.rb
  • +
  • Advanced Rendering - Render Primitives As Hash - main.rb
  • +
  • Tweening Lerping Easing Functions - Easing Functions - main.rb
  • +
  • Tweening Lerping Easing Functions - Cubic Bezier - main.rb
  • +
  • Tweening Lerping Easing Functions - Easing Using Spline - main.rb
  • +
  • Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb
  • +
  • Performance - Sprites As Hash - main.rb
  • +
  • Performance - Sprites As Entities - main.rb
  • +
  • Performance - Sprites As Strict Entities - main.rb
  • +
  • Performance - Sprites As Classes - main.rb
  • +
  • Performance - Static Sprites As Classes - main.rb
  • +
  • Performance - Static Sprites As Classes With Custom Drawing - main.rb
  • +
  • Performance - Collision Limits - main.rb
  • +
  • Advanced Debugging - Trace Debugging - main.rb
  • +
  • Advanced Debugging - Trace Debugging Classes - main.rb
  • +
  • Advanced Debugging - Unit Tests - exception_raising_tests.rb
  • +
  • Advanced Debugging - Unit Tests - gen_docs.rb
  • +
  • Advanced Debugging - Unit Tests - geometry_tests.rb
  • +
  • Advanced Debugging - Unit Tests - http_tests.rb
  • +
  • Advanced Debugging - Unit Tests - object_to_primitive_tests.rb
  • +
  • Advanced Debugging - Unit Tests - parsing_tests.rb
  • +
  • Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb
  • +
  • Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb
  • +
  • Http - Retrieve Images - main.rb
  • +
  • 12 C Extensions - Basics - main.rb
  • +
  • 3d - 3d Cube - main.rb
  • +
  • Arcade - Dueling Starships - main.rb
  • +
  • arcade/flappy dragon/credits.txt
  • +
  • arcade/flappy dragon/main.rb
  • +
  • Arcade - Pong - main.rb
  • +
  • Arcade - Snakemoji - main.rb
  • +
  • Arcade - Solar System - main.rb
  • +
  • Crafting - Craft Game Starting Point - main.rb
  • +
  • Dev Tools - Add Buttons To Console - main.rb
  • +
  • Dev Tools - Animation Creator Starting Point - main.rb
  • +
  • Dev Tools - Tile Editor Starting Point - main.rb
  • +
  • Lowrez - Resolution 64x64 - lowrez.rb
  • +
  • Lowrez - Resolution 64x64 - main.rb
  • +
  • Platformer - Clepto Frog - main.rb
  • +
  • Platformer - Clepto Frog - map.rb
  • +
  • Platformer - Gorillas Basic - credits.txt
  • +
  • Platformer - Gorillas Basic - main.rb
  • +
  • Platformer - Gorillas Basic - repl.rb
  • +
  • Platformer - Gorillas Basic - tests.rb
  • +
  • Platformer - Gorillas Basic - Tests - building_generation_tests.rb
  • +
  • Platformer - The Little Probe - main.rb
  • +
  • Platformer - The Little Probe - Data - level.txt
  • +
  • Platformer - The Little Probe - Data - level_lava.txt
  • +
  • Rpg Narrative - Choose Your Own Adventure - decision.rb
  • +
  • Rpg Narrative - Choose Your Own Adventure - main.rb
  • +
  • Rpg Narrative - Return Of Serenity - lowrez_simulator.rb
  • +
  • Rpg Narrative - Return Of Serenity - main.rb
  • +
  • Rpg Narrative - Return Of Serenity - repl.rb
  • +
  • Rpg Narrative - Return Of Serenity - require.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_anka.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_day_one.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_final_decision.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_final_message.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb
  • +
  • Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb
  • +
  • Rpg Roguelike - Roguelike Line Of Sight - constants.rb
  • +
  • Rpg Roguelike - Roguelike Line Of Sight - legend.rb
  • +
  • Rpg Roguelike - Roguelike Line Of Sight - main.rb
  • +
  • Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb
  • +
  • Rpg Roguelike - Roguelike Starting Point - main.rb
  • +
  • Rpg Tactical - Hexagonal Grid - main.rb
  • +
  • Rpg Tactical - Isometric Grid - main.rb
  • +
  • Rpg Topdown - Topdown Starting Point - main.rb
  • +
  • args.rb
  • +
  • assert.rb
  • +
  • attr_gtk.rb
  • +
  • attr_sprite.rb
  • +
  • console.rb
  • +
  • console_color.rb
  • +
  • console_font_style.rb
  • +
  • console_menu.rb
  • +
  • console_prompt.rb
  • +
  • controller.rb
  • +
  • controller/config.rb
  • +
  • controller/keys.rb
  • +
  • directional_input_helper_methods.rb
  • +
  • easing.rb
  • +
  • geometry.rb
  • +
  • grid.rb
  • +
  • inputs.rb
  • +
  • log.rb
  • +
  • numeric.rb
  • +
  • runtime/framerate_diagnostics.rb
  • +
  • string.rb
  • +
  • tests.rb
  • +
  • trace.rb
  • +
    -

    DragonRuby Game Toolkit Live Docs

    +

    DragonRuby Game Toolkit Live Docs

    The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.

    @@ -416,76 +432,41 @@ Note that you can also run DragonRuby without X11 at all: if you run it from a v

    There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to args.output anymore.

    -

    IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!

    +

    IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this!

    Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.

    +

    Guided Samples

    +
      +
    1. samples/00_learn_ruby_optional: This directory contains sample apps that will help you learn the language.
    2. +
    3. samples/01_rendering_basics: This set of samples will show you how to render basic primitives such as labels, solids, borders, lines, sprites, and how to play sounds.
    4. +
    5. samples/02_input_basics: This set of samples show you how to accept input from the mouse, keyboard, and controllers.
    6. +
    7. samples/03_rendering_sprites: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet).
    8. +
    9. samples/04_physics_and_collision: This set of samples shows how to do various types of collisions and physics.
    10. +
    11. samples/05_mouse: This set of samples show more advanced usages of the mouse.
    12. +
    13. samples/06_save_load: This set of samples show how to save and load game data.
    14. +
    15. samples/07_advanced_rendering: This set of samples show how to programmatically render sprites using render targets.
    16. +
    17. samples/08_tweening_lerping_easing_functions: This set of samples show how to perform animations.
    18. +
    19. samples/09_performance: This set of samples show how to handle performance issues when a large number of sprites on the screen.
    20. +
    21. samples/10_advanced_debugging: This set of samples show how advanced debugging techniques and testing techniques.
    22. +
    23. samples/11_http: This set of samples show how use http.
    24. +
    +

    Sample Games

    +

    +There are samples that contain the path samples/99_*. The sample apps that are prefixed with 99_ show non-trivial implemementations for a real game: +

      -
    1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render solids, animated sprites, labels.
    2. -
    3. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.
    4. -
    5. 01_api_01_labels: Various ways to render labels.
    6. -
    7. 01_api_02_lines: Various ways to render lines.
    8. -
    9. 01_api_03_rects: Sample app shows various ways to render solids and borders.
    10. -
    11. 01_api_04_sprites: Sample app shows various ways to render sprites.
    12. -
    13. 01_api_05_keyboard: Hows how to get keyboard input from the user.
    14. -
    15. 01_api_06_mouse: Hows how to get mouse mouse position.
    16. -
    17. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.
    18. -
    19. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.
    20. -
    21. 01_api_10_controller: Interaction with a USB/Bluetooth controller.
    22. -
    23. 01_api_99_tech_demo: All the different render primitives along with using render_targets.
    24. -
    25. 02_collision_01_simple: Collision detection with dynamically moving bodies.
    26. -
    27. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.
    28. -
    29. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).
    30. -
    31. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.
    32. -
    33. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.
    34. -
    35. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.
    36. -
    37. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.
    38. -
    39. 04_sounds: How to play sounds and work with buttons.
    40. -
    41. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.
    42. -
    43. 05_mouse_move_paint_app: Represents a simple paint app.
    44. -
    45. 05_mouse_move_tile_editor: A starting point for a tile editor.
    46. -
    47. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.
    48. -
    49. 07_render_targets: Shows a powerful concept called render_targets. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).
    50. -
    51. 07_render_targets_advanced: Advanced usage of render_targets.
    52. -
    53. 08_platformer_collisions: Axis aligned collision along with platformer physics.
    54. -
    55. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.
    56. -
    57. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.
    58. -
    59. 09_controller_analog_usage_advanced_sprites: Extended properties of a sprite and how to change the rotation anchor point and render a subset/tile of a sprite.
    60. -
    61. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.
    62. -
    63. 10_save_load_game: Save and load game data.
    64. -
    65. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.
    66. -
    67. 11_hash_primitives: How primitives can be represented using a Hash.
    68. -
    69. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.
    70. -
    71. 12_top_down_area: How to render a top down map and how to manage collision of a player.
    72. -
    73. 13_01_easing_functions: How to use lerping functions to define animations/movement.
    74. -
    75. 13_02_cubic_bezier: How to create a bezier curve using lines.
    76. -
    77. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.
    78. -
    79. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.
    80. -
    81. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.
    82. -
    83. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using static output collections (which are updated by reference as opposed to by value).
    84. -
    85. 15_collision_limits: How many collisions can be processed across many primitives.
    86. -
    87. 18_moddable_game: How you can make a game where content is authored by the player (modding support).
    88. -
    89. 19_lowrez_jam: How to use render_targets to create a low resolution game.
    90. -
    91. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.
    92. -
    93. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.
    94. -
    95. 21_mailbox_usage: How to do interprocess communication.
    96. -
    97. 22_trace_debugging: Debugging techniques and tracing execution through your game.
    98. -
    99. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.
    100. -
    101. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.
    102. -
    103. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.
    104. -
    105. 24_http_example: How to make http requests.
    106. -
    107. 25_3d_experiment_01_square: How to create 3D objects.
    108. -
    109. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.
    110. -
    111. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.
    112. -
    113. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.
    114. -
    115. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.
    116. -
    117. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.
    118. -
    119. 99_sample_game_pong: Reference implementation of pong.
    120. -
    121. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.
    122. -
    123. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.
    124. -
    125. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.
    126. -
    127. 99_sample_snakemoji: Shows that Ruby supports coding with emojis.
    128. -
    129. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.
    130. +
    131. 3D Cube: Shows how to do faux 3D in DragonRuby.
    132. +
    133. Dueling Starships: A two player top-down versus game where each player controls a ship.
    134. +
    135. Flappy Dragon: DragonRuby's clone of Flappy Bird.
    136. +
    137. Pong: A simple implementation of the game Pong.
    138. +
    139. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun).
    140. +
    141. Solar System: A simulation of our solar system.
    142. +
    143. Crafting Starting Point: A starting point for those that want to build a crafting game.
    144. +
    145. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app.
    146. +
    147. LOWREZ: Sample apps that show how to render at different resolutions.
    148. +
    149. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs.
    150. +
    151. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers.

    Deploying To Itch.io

    @@ -513,11 +494,11 @@ Point your text editor at mygame/metadata/game_metadata.txt and make it look lik

    NOTE: Remove the # at the beginning of each line.

    -
    vid=bob
    -vtitle=Bob The Game Developer
    -meid=mygame
    -metitle=My Game
    -rsion=0.1
    +
    devid=bob
    +devtitle=Bob The Game Developer
    +gameid=mygame
    +gametitle=My Game
    +version=0.1
     

    The devid property is the username you use to log into Itch.io. The devtitle is your name or company name (it can contain spaces). The gameid is the Project URL value. The gametitle is the name of your game (it can contain spaces). The version can be any major.minor number format. @@ -526,7 +507,7 @@ The devid property is the username you use to log into Itch.io. The

    Open up the terminal and run this from the command line:

    -
    dragonruby-publish --only-package mygame
    +
    ./dragonruby-publish --only-package mygame
     

    (if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.) @@ -540,7 +521,7 @@ For the HTML version of your game after you upload it. Check the checkbox labele

    For subsequent updates you can use an automated deployment to Itch.io:

    -
    dragonruby-publish mygame
    +
    ./dragonruby-publish mygame
     

    DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it! @@ -548,11 +529,11 @@ DragonRuby will package _and publish_ your game to itch.io! Tell your friends to

    If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.

    -

    DragonRuby's Philosophy

    +

    DragonRuby's Philosophy

    The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.

    -

    Challenge The Status Quo

    +

    Challenge The Status Quo

    Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:

    @@ -564,14 +545,14 @@ But that's how we've always done it.

    It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.

    -

    Continuity of Design

    +

    Continuity of Design

    There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the (hopes that the investment will yield dividends "when you become successful"). This results in more "Enterprise TM" code upfront, and makes it more difficult to get started when you are new to programming.

    DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront).

    -

    Release Often And Soon

    +

    Release Often And Soon

    The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.

    @@ -586,29 +567,29 @@ Remember: Real artists ship.

    -

    Sustainable And Ethical Monetization

    +

    Sustainable And Ethical Monetization

    We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.

    Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.

    -

    Sustainable And Ethical Open Source

    +

    Sustainable And Ethical Open Source

    This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).

    So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.

    -

    People Over Entities

    +

    People Over Entities

    We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.

    -

    Building A Game Should Be Fun And Bring Happiness

    +

    Building A Game Should Be Fun And Bring Happiness

    We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.

    -

    Real World Application Drives Features

    +

    Real World Application Drives Features

    We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.

    @@ -903,11 +884,9 @@ Under DragonRuby LLP, we offer a number of products (with more on the way):

    • Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]()
    • + gaming platforms.
    • RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]()
    • -
    • Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()
    • + apps. http://rubymotion.com

    All of the products above leverage a shared core called DragonRuby. @@ -925,25 +904,25 @@ NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a ba

    The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.

    -

    Okay... so what is the difference between a language specification and a runtime?

    +

    Okay... so what is the difference between a language specification and a runtime?

    A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."

    But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.

    -

    Okay... what language specification does DragonRuby use then?

    +

    Okay... what language specification does DragonRuby use then?

    DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.

    -

    So... why another runtime?

    +

    So... why another runtime?

    The elevator pitch is:

    DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.

    -

    What does Multilevel Cross-platform mean?

    +

    What does Multilevel Cross-platform mean?

    There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):

    @@ -968,11 +947,71 @@ Levels 1 through 3 are fairly commonplace in many runtime implementations (with

    These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.

    -

    Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?

    +

    Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?

    DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.

    -

    Frequent Comments

    +

    How is DragonRuby different than MRI?

    +

    +DragonRuby supports a subset of MRI apis. Our target is to support all of mRuby's standard lib. There are challenges to this given the number of platforms we are trying to support (specifically console). +

    +

    Does DragonRuby support Gems?

    +

    +DragonRuby does not support gems because that requires the installation of MRI Ruby on the developer's machine (which is a non-starter given that we want DragonRuby to be a zero dependency runtime). While this seems easy for Mac and Linux, it is much harder on Windows and Raspberry Pi. mRuby has taken the approach of having a git repository for compatible gems and we will most likely follow suite: https://github.com/mruby/mgem-list. +

    +

    Does DragonRuby have a REPL/IRB?

    +

    +You can use DragonRuby's Console within the game to inspect object and execute small pieces of code. For more complex pieces of code create a file called repl.rb and put it in mygame/app/repl.rb: +

    +
      +
    • Any code you write in there will be executed when you change the file. You can organize different pieces of code using the repl method:
    • +
    +
    repl do
    +  puts "hello world"
    +  puts 1 + 1
    +end
    +
    +
      +
    • If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal).
    • +
    • All puts statements will also be saved to logs/log.txt. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can tail this file.
    • +
    +

    +4. To ignore code in repl.rb, instead of commenting it out, prefix repl with the letter x and it'll be ignored. +

    +
    xrepl do # <------- line is prefixed with an "x"
    +  puts "hello world"
    +  puts 1 + 1
    +end
    +
    +# This code will be executed when you save the file.
    +repl do
    +  puts "Hello"
    +end
    +
    +repl do
    +  puts "This code will also be executed."
    +end
    +
    +# use xrepl to "comment out" code
    +xrepl do
    +  puts "This code will not be executed because of the x infront of repl".
    +end
    +
    +

    Does DragonRuby support pry or have any other debugging facilities?

    +

    +pry is a gem that assumes you are using the MRI Runtime (which is incompatible with DragonRuby). Eventually DragonRuby will have a pry based experience that is compatible with a debugging infrastructure called LLDB. Take the time to read about LLDB as it shows the challenges in creating something that is compatible. +

    +

    +You can use DragonRuby's replay capabilities to troubleshoot: +

    +
      +
    1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).
    2. +
    3. Use ./dragonruby mygame --record to create a game play recording that you can use to find the exception (you can replay a recoding by executing ./dragonruby mygame --replay last_replay.txt or through the DragonRuby Console using $gtk.recording.start_replay "last_replay.txt".
    4. +
    5. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ./dragonruby . --eval some_ruby_file.rb --no-tick.
    6. +
    7. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to args.outputs.debug that will render on top of your game but will be ignored in a production release.
    8. +
    9. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago.
    10. +
    +

    Frequent Comments About Ruby as a Language Choice

    But Ruby is dead.

    Let's check the official source for the answer to this question: isrubydead.com: https://isrubydead.com/. @@ -1014,6 +1053,9 @@ If you have ideas on how we can do this, email us!

    If the reason above isn't sufficient, then definitely use something else.

    +

    +All this being said, we do have parts of the engine open sourced on GitHub: https://github.com/dragonruby/dragonruby-game-toolkit-contrib/ +

    DragonRuby is for pay. You should offer a free version.

    If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products. @@ -1057,11 +1099,15 @@ That won't happen if the development world stop asking for free stuff and non-tr

    But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.

    -

    GTK::Runtime

    +

    DOCS: GTK::Runtime

    The GTK::Runtime class is the core of DragonRuby. It is globally accessible via $gtk.

    -

    GTK::Runtime#calcstringbox

    +

    DOCS: GTK::Runtime#reset

    +

    +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +

    +

    DOCS: GTK::Runtime#calcstringbox

    This function returns the width and height of a string.

    @@ -1070,15 +1116,21 @@ This function returns the width and height of a string. args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" end
    -

    GTK::Runtime#reset

    +

    DOCS: GTK::Runtime#write_file

    -This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +This function takes in two parameters. The first paramter is the file path and assumes the the game directory is the root. The second parameter is the string that will be written. The method overwrites whatever is currently in the file. Use GTK::Runtime#append_file to append to the file as opposed to overwriting.

    -

    Array

    +
    def tick args
    +  if args.inputs.mouse.click
    +    args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at #{args.state.tick_count}."
    +  end
    +end
    +
    +

    DOCS: Array

    The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.

    -

    Array#map

    +

    DOCS: Array#map

    The function given a block returns a new Enumerable of values.

    @@ -1116,7 +1168,7 @@ Example of using Array#map in conjunction with args.state -

    Array#each

    +

    DOCS: Array#each

    The function, given a block, invokes the block for each item in the Array. Array#each is synonymous to foreach constructs in other languages.

    @@ -1153,7 +1205,7 @@ Example of using Array#each in conjunction with args.state -

    Array#reject_nil

    +

    DOCS: Array#reject_nil

    Returns an Enumerable rejecting items that are nil, this is an alias for Array#compact:

    @@ -1165,7 +1217,7 @@ Returns an Enumerable rejecting items that are nil, th # => [1, 4, false, :a] end
    -

    Array#reject_false

    +

    DOCS: Array#reject_false

    Returns an `Enumerable` rejecting items that are `nil` or `false`.

    @@ -1175,7 +1227,7 @@ Returns an `Enumerable` rejecting items that are `nil` or `false`. # => [1, 4, :a] end
    -

    Array#product

    +

    DOCS: Array#product

    Returns all combinations of values between two arrays.

    @@ -1195,7 +1247,7 @@ end # => [[0, :a], [0, :b], [1, :a], [1, :b]] end -

    Array#map_2d

    +

    DOCS: Array#map_2d

    Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.

    @@ -1221,11 +1273,11 @@ Assuming the array is an array of arrays, Given a block, each 2D array index inv puts occupied_tiles end -

    Array#include_any?

    +

    DOCS: Array#include_any?

    Given a collection of items, the function will return true if any of self's items exists in the collection of items passed in:

    -

    Array#any_intersect_rect?

    +

    DOCS: Array#any_intersect_rect?

    Assuming the array contains objects that respond to left, right, top, bottom, this method returns true if any of the elements within the array intersect the object being passed in. You are given an optional parameter called tolerance which informs how close to the other rectangles the elements need to be for it to be considered intersecting.

    @@ -1287,7 +1339,7 @@ The default tolerance is set to 0.1, which means that the primitive puts "" end -

    GTK::Outputs

    +

    DOCS: GTK::Outputs

    Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a tick method defined in mygame/app/main.rb

    @@ -1295,7 +1347,7 @@ Outputs is how you render primitives to the screen. The minimal setup for render # code goes here end -

    GTK::Outputs#solids

    +

    DOCS: GTK::Outputs#solids

    Add primitives to this collection to render a solid to the screen.

    @@ -1369,7 +1421,7 @@ def tick args args.outputs.solids << Square.new(10, 10, 32) end -

    GTK::Outputs#borders

    +

    DOCS: GTK::Outputs#borders

    Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.

    @@ -1392,7 +1444,7 @@ You have to use args.outputs.borders: args.outputs.borders << [100, 100, 160, 90] end -

    GTK::Mouse

    +

    DOCS: GTK::Mouse

    The mouse is accessible via args.inputs.mouse:

    @@ -1425,7 +1477,7 @@ The mouse has the following properties.
  • args.inputs.mouse.button_middle: Returns true if the middle mouse button is down.
  • args.inputs.mouse.button_bits: Gives the bits for each mouse button and its current state.
  • -

    GTK::MousePoint

    +

    DOCS: GTK::MousePoint

    The GTK::MousePoint has the following properties.

    @@ -1442,7 +1494,7 @@ The GTK::MousePoint has the following properties.
  • created_at: The tick (args.state.tick_count) that this structure was created.
  • global_created_at: The global tick (Kernel.global_tick_count) that this structure was created.
  • -

    GTK::OpenEntity

    +

    DOCS: GTK::OpenEntity

    GTK::OpenEntity is accessible within the DragonRuby's top level tick function via the args.state property.

    @@ -1468,7 +1520,7 @@ For example: ] end -

    GTK::OpenEntity#as_hash

    +

    DOCS: GTK::OpenEntity#as_hash

    Returns a reference to the GTK::OpenEntity as a Hash. This property is useful when you want to treat args.state as a Hash and invoke methods such as Hash#each.

    @@ -1491,7 +1543,7 @@ Example: end end -

    Numeric#frame_index

    +

    DOCS: Numeric#frame_index

    This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value self represents the moment the animation started.

    @@ -1554,7 +1606,7 @@ Example using named parameters: ] end -

    Numeric#elapsed_time

    +

    DOCS: Numeric#elapsed_time

    For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.

    @@ -1595,7 +1647,7 @@ And here is an example where the override parameter is passed in: end end -

    Numeric#elapsed?

    +

    DOCS: Numeric#elapsed?

    Returns true if Numeric#elapsed_time is greater than the number. An optional parameter can be passed into elapsed? which is added to the number before evaluating whether elapsed? is true.

    @@ -1659,7 +1711,7 @@ Example usage (with optional parameter): args.state.box_queue -= boxes_to_destroy end -

    Numeric#created?

    +

    DOCS: Numeric#created?

    Returns true if Numeric#elapsed_time == 0. Essentially communicating that number is equal to the current frame.

    @@ -1683,15 +1735,15 @@ Example usage: args.state.box_queue -= boxes_to_spawn_this_frame end -

    Kernel

    +

    DOCS: Kernel

    Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.

    -

    Kernel::tick_count

    +

    DOCS: Kernel::tick_count

    Returns the current tick of the game. This value is reset if you call $gtk.reset.

    -

    Kernel::global_tick_count

    +

    DOCS: Kernel::global_tick_count

    Returns the current tick of the application from the point it was started. This value is never reset.

    @@ -1699,8 +1751,9 @@ Returns the current tick of the application from the point it was started. This

    Follows is a source code listing for all files that have been open sourced. This code can be found in the ./samples directory and online at https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/.

    -

    00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb

    -
    # ==========================================================================
    +

    Learn Ruby Optional - Beginner Ruby Primer - automation.rb

    +
    # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb
    +# ==========================================================================
     #  _    _ ________     __  _      _____  _____ _______ ______ _   _ _ _ _ _
     # | |  | |  ____\ \   / / | |    |_   _|/ ____|__   __|  ____| \ | | | | | |
     # | |__| | |__   \ \_/ /  | |      | | | (___    | |  | |__  |  \| | | | | |
    @@ -1822,8 +1875,9 @@ $gtk.schedule_callback 400 do
     end
     
     
    -

    00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb

    -
    # ==========================================================================
    +

    Learn Ruby Optional - Beginner Ruby Primer - main.rb

    +
    # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb
    +# ==========================================================================
     #  _    _ ________     __  _      _____  _____ _______ ______ _   _ _ _ _ _
     # | |  | |  ____\ \   / / | |    |_   _|/ ____|__   __|  ____| \ | | | | | |
     # | |__| | |__   \ \_/ /  | |      | | | (___    | |  | |__  |  \| | | | | |
    @@ -2142,17 +2196,599 @@ def outputs
     end
     
     
    -

    00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb

    -
    def tick args
    +

    Learn Ruby Optional - Intermediate Ruby Primer - printing.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt
    +# ====================================================================================
    +# Commenting Code
    +# ====================================================================================
    +#
    +# Prefixing text with a pound sign (#) is how you comment code in Ruby. Example:
    +#
    +# I am commented code. And so are the lines above.
    +#
    +# I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's
    +# an entertaining read. Otherwise, go to the next txt file.
    +#
    +# Follow along by visiting:
    +# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4
    +
    +# ====================================================================================
    +#  Printing to the Console:
    +# ====================================================================================
    +#
    +# Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text
    +# to repl.rb and save to see Hello World printed to the console.
    +
    +repl do
    +  puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.'
    +  puts '===='
    +  puts '======'
    +  puts '================================'
    +  puts 'Hello World'
    +  puts '================================'
    +  puts '======'
    +  puts '===='
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - strings.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt
    +# ====================================================================================
    +#  Strings
    +# ====================================================================================
    +#
    +# Here is how you work with strings in Ruby. Take the text
    +# in this file and paste it into repl.rb and save:
    +
    +repl do
    +  puts '* RUBY PRIMER: strings'
    +  message = "Hello World"
    +  puts "The value of message is: " + message
    +  puts "Any value can be interpolated within a string using \#{}."
    +  puts "Interpolated message: #{message}."
    +  puts 'This #{message} is not interpolated because the string uses single quotes.'
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt
    +# ====================================================================================
    +#  Numerics
    +# ====================================================================================
    +#
    +# Here is how you work with numbers in Ruby. Take the text
    +# in this file and paste it into repl.rb and save:
    +
    +repl do
    +  puts '* RUBY PRIMER: Fixnum and Floats'
    +  a = 10
    +  puts "The value of a is: #{a}"
    +  puts "a + 1 is: #{a + 1}"
    +  puts "a / 3 is: #{a / 3}"
    +  puts ''
    +
    +  b = 10.12
    +  puts "The value of b is: #{b}"
    +  puts "b + 1 is: #{b + 1}"
    +  puts "b as an integer is: #{b.to_i}"
    +  puts ''
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt
    +# ====================================================================================
    +#  Booleans
    +# ====================================================================================
    +#
    +# Here is how you work with numbers in Ruby. Take the text
    +# in this file and paste it into repl.rb and save:
    +
    +repl do
    +  puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)'
    +  puts "Anything that *isn't* false or nil is true."
    +
    +  c = 30
    +  puts "The value of c is #{c}."
    +
    +  if c
    +    puts "This if statement ran because c is truthy."
    +  end
    +
    +  d = false
    +  puts "The value if d is #{d}. The type for d is #{d.class}."
    +
    +  if !d
    +    puts "This if statement ran because d is falsey, using the not operator (!)."
    +  end
    +
    +  e = nil
    +  puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}."
    +
    +  if !e
    +    puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}."
    +  end
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt
    +# ====================================================================================
    +#  Conditionals
    +# ====================================================================================
    +#
    +# Here is how you create conditionals in Ruby. Take the text
    +# in this file and paste it into repl.rb and save:
    +
    +repl do
    +  puts "* RUBY PRIMER: Conditionals"
    +end
    +
    +# ====================================================================================
    +#  if
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: if statement"
    +  i_am_one = 1
    +  if i_am_one
    +    puts "This was printed because i_am_one is truthy."
    +  end
    +end
    +
    +# ====================================================================================
    +#  if/else
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: if/else statement"
    +  i_am_false = false
    +  if i_am_false
    +    puts "This will NOT get printed because i_am_false is false."
    +  else
    +    puts "This was printed because i_am_false is false."
    +  end
    +end
    +
    +
    +# ====================================================================================
    +#  if/elsif/else
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: if/elsif/else statement"
    +  i_am_false = false
    +  i_am_true  = true
    +  if i_am_false
    +    puts "This will NOT get printed because i_am_false is false."
    +  elsif i_am_true
    +    puts "This was printed because i_am_true is true."
    +  else
    +    puts "This will NOT get printed i_am_true was true."
    +  end
    +end
    +
    +# ====================================================================================
    +#  case
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO case statement"
    +  i_am_one = 1 # change this value to see different results
    +
    +  case i_am_one
    +  when 10
    +    puts "the value of i_am_one is 10"
    +  when 9
    +    puts "the value of i_am_one is 9"
    +  when 5
    +    puts "the value of i_am_one is 5"
    +  when 1
    +    puts "the value of i_am_one is 1"
    +  else
    +    puts "Value wasn't cased."
    +  end
    +end
    +
    +# ====================================================================================
    +#  comparison operators
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Different types of comparisons"
    +  if 4 == 4
    +    puts "4 equals 4 (==)"
    +  end
    +
    +  if 4 != 3
    +    puts "4 does not equal 3 (!=)"
    +  end
    +
    +  if 3 < 4
    +    puts "3 is less than 4 (<)"
    +  end
    +
    +  if 4 > 3
    +    puts "4 is greater than 3 (>)"
    +  end
    +end
    +
    +# ====================================================================================
    +#  and/or conditionals
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: AND, OR operator (&&, ||)"
    +  if (4 > 3) || (3 < 4) || false
    +    puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)"
    +  end
    +
    +  if (4 > 3) && (3 < 4)
    +    puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)"
    +  end
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - looping.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt
    +# ====================================================================================
    +#  Looping
    +# ====================================================================================
    +#
    +# Looping looks a whole lot different than other languages.
    +# But it's pretty awesome when you get used to it.
    +
    +repl do
    +  puts "* RUBY PRIMER: Loops"
    +end
    +
    +# ====================================================================================
    +#  times
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: ~Numeric#times~ (for loop)"
    +  3.times do |i|
    +    puts i
    +  end
    +end
    +
    +# ====================================================================================
    +#  foreach
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: ~Array#each~ (for each loop)"
    +  array = ["a", "b", "c", "d"]
    +  array.each do |char|
    +    puts char
    +  end
    +
    +  puts "** INFO: ~Array#each_with_index~ (for each loop)"
    +  array = ["a", "b", "c", "d"]
    +  array.each do |char, i|
    +    puts "index #{i}: #{char}"
    +  end
    +end
    +
    +# ====================================================================================
    +#  ranges
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: range block exclusive (three dots)"
    +  (0...3).each do |i|
    +    puts i
    +  end
    +
    +  puts "** INFO: range block inclusive (two dots)"
    +  (0..3).each do |i|
    +    puts i
    +  end
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - functions.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt
    +# ====================================================================================
    +# Functions
    +# ====================================================================================
    +
    +# The last statement of a function is implictly returned. Parenthesis for functions
    +# are optional as long as the statement can be envaluated disambiguously.
    +
    +repl do
    +  puts "* RUBY PRIMER: Functions"
    +end
    +
    +# ====================================================================================
    +# Functions single parameter
    +# ====================================================================================
    +
    +repl do
    +  puts "* INFO: Function with one parameter"
    +
    +  # function definition
    +  def add_one_to n
    +    n + 1
    +  end
    +
    +  # Parenthesis are optional in Ruby as long as the
    +  # parsing is disambiguous. Here are a couple of variations.
    +  # Generally speaking, don't put parenthesis is you don't have to.
    +
    +  # Conventional Usage of Parenthesis.
    +  puts add_one_to(3)
    +
    +  # DragonRuby's recommended use of parenthesis (inner function has parenthesis).
    +  puts (add_one_to 3)
    +
    +  # Full parens.
    +  puts(add_one_to(3))
    +
    +  # Outer function has parenthesis
    +  puts(add_one_to 3)
    +end
    +
    +# ====================================================================================
    +# Functions with default parameter values
    +# ====================================================================================
    +
    +repl do
    +  puts "* INFO: Function with default value"
    +  def function_with_default_value v = 10
    +    v * 10
    +  end
    +
    +  puts "Passing the argument three yields: #{function_with_default_value 3}"
    +  puts "Passing no argument yields: #{function_with_default_value}"
    +end
    +
    +# ====================================================================================
    +# Nil default parameter value and ||= operator.
    +# ====================================================================================
    +
    +repl do
    +  puts "* INFO: Using the OR EQUAL operator (||=)"
    +  def function_with_nil_default_with_local a = nil
    +    result   = a
    +    result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE"
    +    "value is #{result}."
    +  end
    +
    +  puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}"
    +  puts "Passing nil: #{function_with_nil_default_with_local}"
    +end
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt
    +# ====================================================================================
    +# Arrays
    +# ====================================================================================
    +
    +# Arrays are incredibly powerful in Ruby. Learn to use them well.
    +
    +repl do
    +  puts "* RUBY PRIMER: ARRAYS"
    +end
    +
    +# ====================================================================================
    +# Enumerable ranges and .to_a
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Create an array with the numbers 1 to 10."
    +  one_to_ten = (1..10).to_a
    +  puts one_to_ten
    +end
    +
    +# ====================================================================================
    +# Finding elements
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Finding elements in an array using ~Array#find_all~."
    +  puts "Create a new array that only contains even numbers from the previous array."
    +
    +  one_to_ten = (1..10).to_a
    +  evens = one_to_ten.find_all do |number|
    +    number % 2 == 0
    +  end
    +
    +  puts evens
    +end
    +
    +# ====================================================================================
    +# Rejecting elements
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Removing elements in an array using ~Array#reject~."
    +  puts "Create a new array that rejects odd numbers."
    +
    +  one_to_ten = (1..10).to_a
    +  also_even = one_to_ten.reject do |number|
    +    number % 2 != 0
    +  end
    +
    +  puts also_even
    +end
    +
    +# ====================================================================================
    +# Array transform using the map function.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Creating new derived values from an array using ~Array#map~."
    +  puts "Create an array that doubles every number."
    +
    +  one_to_ten = (1..10).to_a
    +  doubled = one_to_ten.map do |number|
    +    number * 2
    +  end
    +
    +  puts doubled
    +end
    +
    +# ====================================================================================
    +# Combining array functions.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~."
    +  puts "Create an array that selects only odd numbers and then multiply those by 10."
    +
    +  one_to_ten = (1..10).to_a
    +  odd_doubled = one_to_ten.find_all do |number|
    +    number % 2 != 0
    +  end.map do |odd_number|
    +    odd_number * 10
    +  end
    +
    +  puts odd_doubled
    +end
    +
    +# ====================================================================================
    +# Product function.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Create all combinations of array values using ~Array#product~."
    +  puts "All two-item pairs of numbers 1 to 10."
    +  one_to_ten = (1..10).to_a
    +  all_combinations = one_to_ten.product(one_to_ten)
    +  puts all_combinations
    +end
    +
    +# ====================================================================================
    +# Uniq and sort function.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~."
    +  puts "All uniq combinations of numbers regardless of order."
    +  puts "For example: [1, 2] is the same as [2, 1]."
    +  one_to_ten = (1..10).to_a
    +  uniq_combinations =
    +    one_to_ten.product(one_to_ten)
    +              .map do |unsorted_number|
    +                unsorted_number.sort
    +              end.uniq
    +  puts uniq_combinations
    +end
    +
    +# ====================================================================================
    +# Example of an advanced array transform.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~."
    +  puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle."
    +
    +  one_to_hundred = (1..100).to_a
    +
    +  triples =
    +    one_to_hundred.product(one_to_hundred).map do |width, height|
    +                [width, height, Math.sqrt(width ** 2 + height ** 2)]
    +              end.find_all do |_, _, hypotenuse|
    +                hypotenuse.to_i == hypotenuse
    +              end.map do |triangle|
    +                triangle.map(&:to_i)
    +              end.uniq do |triangle|
    +                triangle.sort
    +              end.map do |width, height, hypotenuse|
    +                [width, height, hypotenuse, (width * height) / 2]
    +              end.sort_by do |_, _, _, area|
    +                area
    +              end
    +
    +  triples.each do |width, height, hypotenuse, _|
    +    puts "(#{width}, #{height}, #{hypotenuse})"
    +  end
    +end
    +
    +# ====================================================================================
    +# Example of an sorting.
    +# ====================================================================================
    +
    +repl do
    +  puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype."
    +
    +  things_to_sort = [
    +    { type: :background, order: 1 },
    +    { type: :foreground, order: 1 },
    +    { type: :foreground, order: 2 }
    +  ]
    +  puts "*** Original array."
    +  puts things_to_sort
    +
    +  puts "*** Simple sort using key."
    +  # For a simple sort, you can use sort_by
    +  results = things_to_sort.sort_by do |hash|
    +    hash[:order]
    +  end
    +
    +  puts results
    +
    +  puts "*** Custom sort."
    +  puts "**** Sorting process."
    +  # for a more complicated sort, you can provide a block that returns
    +  # -1, 0, 1 for a left and right operand
    +  results = things_to_sort.sort do |l, r|
    +    sort_result = 0
    +    puts "here is l: #{l}"
    +    puts "here is r: #{r || "nil"}"
    +    # if either value is nil/false return 0
    +    if !l || !r
    +      sort_result = 0
    +    # if the type of "left" is background and the
    +    # type of "right" is foreground, then return
    +    # -1 (which means "left" is less than "right"
    +    elsif l[:type] == :background && r[:type] == :foreground
    +      sort_result = -1
    +    # if the type of "left" is foreground and the
    +    # type of "right" is background, then return
    +    #  1 (which means "left" is greater than "right"
    +    elsif l[:type] == :foreground && r[:type] == :background
    +      sort_result = 1
    +    # if "left" and "right"'s type are the same, then
    +    # use the order as the tie breaker
    +    elsif l[:order] < r[:order]
    +      sort_result = -1
    +    elsif l[:order] > r[:order]
    +      sort_result = 1
    +    # returning 0 means both values are equal
    +    else
    +      sort_result = 0
    +    end
    +    sort_result
    +  end.to_a
    +
    +  puts "**** Sort result."
    +  puts results
    +end
    +
    +# ====================================================================================
    +# Api documention for Array that is worth commiting to memory because arrays are so
    +# awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html
    +# ====================================================================================
    +
    +
    +

    Learn Ruby Optional - Intermediate Ruby Primer - main.rb

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb
    +def tick args
       args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1]
     end
     
     
    -

    00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb

    -
    +

    Learn Ruby Optional - Intermediate Ruby Primer - repl.rb

    +
    # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb
    +
     
    -

    01_rendering_basics/01_labels/app/main.rb

    -
    =begin
    +

    Rendering Basics - Labels - main.rb

    +
    # ./samples/01_rendering_basics/01_labels/app/main.rb
    +=begin
     
     APIs listing that haven't been encountered in a previous sample apps:
     
    @@ -2253,8 +2889,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    01_rendering_basics/02_lines/app/main.rb

    -
    =begin
    +

    Rendering Basics - Lines - main.rb

    +
    # ./samples/01_rendering_basics/02_lines/app/main.rb
    +=begin
     
     APIs listing that haven't been encountered in a previous sample apps:
     
    @@ -2310,8 +2947,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    01_rendering_basics/03_solids_borders/app/main.rb

    -
    =begin
    +

    Rendering Basics - Solids Borders - main.rb

    +
    # ./samples/01_rendering_basics/03_solids_borders/app/main.rb
    +=begin
     
     APIs listing that haven't been encountered in a previous sample apps:
     
    @@ -2379,8 +3017,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    01_rendering_basics/04_sprites/app/main.rb

    -
    =begin
    +

    Rendering Basics - Sprites - main.rb

    +
    # ./samples/01_rendering_basics/04_sprites/app/main.rb
    +=begin
     
     APIs listing that haven't been encountered in a previous sample apps:
     
    @@ -2425,8 +3064,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    01_rendering_basics/05_sounds/app/main.rb

    -
    =begin
    +

    Rendering Basics - Sounds - main.rb

    +
    # ./samples/01_rendering_basics/05_sounds/app/main.rb
    +=begin
     
      APIs Listing that haven't been encountered in previous sample apps:
     
    @@ -2617,8 +3257,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    02_input_basics/01_keyboard/app/main.rb

    -
    =begin
    +

    Input Basics - Keyboard - main.rb

    +
    # ./samples/02_input_basics/01_keyboard/app/main.rb
    +=begin
     
     APIs listing that haven't been encountered in a previous sample apps:
     
    @@ -2790,8 +3431,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    02_input_basics/02_mouse/app/main.rb

    -
    =begin
    +

    Input Basics - Mouse - main.rb

    +
    # ./samples/02_input_basics/02_mouse/app/main.rb
    +=begin
     
     APIs that haven't been encountered in a previous sample apps:
     
    @@ -2880,8 +3522,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    02_input_basics/03_mouse_point_to_rect/app/main.rb

    -
    =begin
    +

    Input Basics - Mouse Point To Rect - main.rb

    +
    # ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb
    +=begin
     
     APIs that haven't been encountered in a previous sample apps:
     
    @@ -2973,8 +3616,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    02_input_basics/04_mouse_rect_to_rect/app/main.rb

    -
    =begin
    +

    Input Basics - Mouse Rect To Rect - main.rb

    +
    # ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb
    +=begin
     
     APIs that haven't been encountered in a previous sample apps:
     
    @@ -3073,8 +3717,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    02_input_basics/05_controller/app/main.rb

    -
    =begin
    +

    Input Basics - Controller - main.rb

    +
    # ./samples/02_input_basics/05_controller/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -3202,8 +3847,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb

    -
    =begin
    +

    Rendering Sprites - Animation Using Separate Pngs - main.rb

    +
    # ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb
    +=begin
     
      Reminders:
     
    @@ -3336,8 +3982,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb

    -
    def tick args
    +

    Rendering Sprites - Animation Using Sprite Sheet - main.rb

    +
    # ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb
    +def tick args
       args.state.player.x ||= 100
       args.state.player.y ||= 100
       args.state.player.w ||= 64
    @@ -3437,8 +4084,9 @@ def running_sprite args
     end
     
     
    -

    03_rendering_sprites/03_animation_states/app/main.rb

    -
    class Game
    +

    Rendering Sprites - Animation States - main.rb

    +
    # ./samples/03_rendering_sprites/03_animation_states/app/main.rb
    +class Game
       attr_gtk
     
       def defaults
    @@ -3623,8 +4271,9 @@ end
     $gtk.reset
     
     
    -

    03_rendering_sprites/04_color_and_rotation/app/main.rb

    -
    =begin
    +

    Rendering Sprites - Color And Rotation - main.rb

    +
    # ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb
    +=begin
      APIs listing that haven't been encountered in previous sample apps:
     
      - merge: Returns a hash containing the contents of two original hashes.
    @@ -3852,8 +4501,9 @@ def source_rect state
     end
     
     
    -

    04_physics_and_collisions/01_simple/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Simple - main.rb

    +
    # ./samples/04_physics_and_collisions/01_simple/app/main.rb
    +=begin
     
      Reminders:
      - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.
    @@ -3963,8 +4613,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    04_physics_and_collisions/02_moving_objects/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Moving Objects - main.rb

    +
    # ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -4266,8 +4917,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    04_physics_and_collisions/03_entities/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Entities - main.rb

    +
    # ./samples/04_physics_and_collisions/03_entities/app/main.rb
    +=begin
     
      Reminders:
     
    @@ -4420,8 +5072,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    04_physics_and_collisions/04_box_collision/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Box Collision - main.rb

    +
    # ./samples/04_physics_and_collisions/04_box_collision/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -4760,8 +5413,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    04_physics_and_collisions/04_box_collision_2/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Box Collision 2 - main.rb

    +
    # ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb
    +=begin
      APIs listing that haven't been encountered in previous sample apps:
     
      - times: Performs an action a specific number of times.
    @@ -4891,29 +5545,13 @@ class MetroidvaniaStarter
                             state.player_height,'sprites/player.png']
     
         # Outputs labels as primitives in top right of the screen
    -    outputs.primitives << [920, 700, 'Press 
    -    
    - - -s - - - - to access sprites.', 1, 0].label + outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label - outputs.primitives << [920, 580, 'Press - - - -e - - - - to export current map.', 1, 0].label + outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label # if the map is saved and less than 120 frames have passed, the label is displayed if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 @@ -5249,8 +5887,9 @@ def tick args end -

    04_physics_and_collisions/04_jump_physics/app/main.rb

    -
    =begin
    +

    Physics And Collisions - Jump Physics - main.rb

    +
    # ./samples/04_physics_and_collisions/06_jump_physics/app/main.rb
    +=begin
     
      Reminders:
     
    @@ -5448,8 +6087,9 @@ def tick args
     end
     
     
    -

    05_mouse/03_mouse_click/app/main.rb

    -
    =begin
    +

    Mouse - Mouse Click - main.rb

    +
    # ./samples/05_mouse/01_mouse_click/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -5695,8 +6335,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    05_mouse/05_mouse_move/app/main.rb

    -
    =begin
    +

    Mouse - Mouse Move - main.rb

    +
    # ./samples/05_mouse/02_mouse_move/app/main.rb
    +=begin
     
      Reminders:
     
    @@ -5994,8 +6635,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    05_mouse/05_mouse_move_paint_app/app/main.rb

    -
    =begin
    +

    Mouse - Mouse Move Paint App - main.rb

    +
    # ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -6237,8 +6879,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    05_mouse/06_coordinate_systems/app/main.rb

    -
    =begin
    +

    Mouse - Coordinate Systems - main.rb

    +
    # ./samples/05_mouse/04_coordinate_systems/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -6320,8 +6963,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    06_save_load/10_save_load_game/app/main.rb

    -
    =begin
    +

    Save Load - Save Load Game - main.rb

    +
    # ./samples/06_save_load/01_save_load_game/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -6712,8 +7356,9 @@ def tick args
     end
     
     
    -

    07_advanced_rendering/01_simple_render_targets/app/main.rb

    -
    def tick args
    +

    Advanced Rendering - Simple Render Targets - main.rb

    +
    # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb
    +def tick args
       # args.outputs.render_targets are really really powerful.
       # They essentially allow you to create a sprite programmatically and cache the result.
     
    @@ -6767,8 +7412,9 @@ end
     $gtk.reset
     
     
    -

    07_advanced_rendering/02_render_targets_with_alphas/app/main.rb

    -
    # This sample is meant to show you how to do that dripping transition thing
    +

    Advanced Rendering - Render Targets With Alphas - main.rb

    +
    # ./samples/07_advanced_rendering/02_render_targets_with_alphas/app/main.rb
    +# This sample is meant to show you how to do that dripping transition thing
     #  at the start of the original Doom. Most of this file is here to animate
     #  a scene to wipe away; the actual wipe effect is in the last 20 lines or
     #  so.
    @@ -6865,8 +7511,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    07_advanced_rendering/03_render_target_viewports/app/main.rb

    -
    =begin
    +

    Advanced Rendering - Render Target Viewports - main.rb

    +
    # ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -7336,8 +7983,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb

    -
    =begin
    +

    Advanced Rendering - Render Primitive Hierarchies - main.rb

    +
    # ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -7511,8 +8159,9 @@ def collection_of_sprites args
     end
     
     
    -

    07_advanced_rendering/11_render_primitives_as_hash/app/main.rb

    -
    =begin
    +

    Advanced Rendering - Render Primitives As Hash - main.rb

    +
    # ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb
    +=begin
     
      Reminders:
     
    @@ -7705,8 +8354,9 @@ def tick args
     end
     
     
    -

    08_lerping_easing_functions/01_easing_functions/app/main.rb

    -
    def tick args
    +

    Tweening Lerping Easing Functions - Easing Functions - main.rb

    +
    # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb
    +def tick args
       # STOP! Watch the following presentation first!!!!
       # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations
       # https://www.youtube.com/watch?v=mr5xkf6zSzk
    @@ -7840,8 +8490,9 @@ module Easing
     end
     
     
    -

    08_lerping_easing_functions/02_cubic_bezier/app/main.rb

    -
    def tick args
    +

    Tweening Lerping Easing Functions - Cubic Bezier - main.rb

    +
    # ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb
    +def tick args
       args.outputs.background_color = [33, 33, 33]
       args.outputs.lines << bezier(100, 100,
                                    100, 620,
    @@ -7904,8 +8555,9 @@ def pow n, to
     end
     
     
    -

    08_lerping_easing_functions/03_easing_using_spline/app/main.rb

    -
    def tick args
    +

    Tweening Lerping Easing Functions - Easing Using Spline - main.rb

    +
    # ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb
    +def tick args
       args.state.duration = 10.seconds
       args.state.spline = [
         [0.0, 0.33, 0.66, 1.0],
    @@ -7925,8 +8577,9 @@ end
     end
     
     
    -

    08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb

    -
    def new_star args
    +

    Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb

    +
    # ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb
    +def new_star args
       { x: 1280.randomize(:ratio),
         starting_y: 800,
         distance_to_travel: 900 + 100.randomize(:ratio),
    @@ -8141,8 +8794,9 @@ def tick args
     end
     
     
    -

    09_performance/01_sprites_as_hash/app/main.rb

    -
    # Sprites represented as Hashes using the queue ~args.outputs.sprites~
    +

    Performance - Sprites As Hash - main.rb

    +
    # ./samples/09_performance/01_sprites_as_hash/app/main.rb
    +# Sprites represented as Hashes using the queue ~args.outputs.sprites~
     # code up, but are the "slowest" to render.
     # The reason for this is the access of the key in the Hash and also
     # because the data args.outputs.sprites is cleared every tick.
    @@ -8207,8 +8861,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/02_sprites_as_entities/app/main.rb

    -
    # Sprites represented as Entities using the queue ~args.outputs.sprites~
    +

    Performance - Sprites As Entities - main.rb

    +
    # ./samples/09_performance/02_sprites_as_entities/app/main.rb
    +# Sprites represented as Entities using the queue ~args.outputs.sprites~
     # yields nicer access apis over Hashes, but require a bit more code upfront.
     # The hash sample has to use star[:s] to get the speed of the star, but
     # an entity can use .s instead.
    @@ -8274,8 +8929,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/03_sprites_as_strict_entities/app/main.rb

    -
    # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~
    +

    Performance - Sprites As Strict Entities - main.rb

    +
    # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb
    +# Sprites represented as StrictEntities using the queue ~args.outputs.sprites~
     # yields apis access similar to Entities, but all properties that can be set on the
     # entity must be predefined with a default value. Strict entities do not support the
     # addition of new properties after the fact. They are more performant than OpenEntities
    @@ -8345,8 +9001,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/04_sprites_as_classes/app/main.rb

    -
    # Sprites represented as Classes using the queue ~args.outputs.sprites~.
    +

    Performance - Sprites As Classes - main.rb

    +
    # ./samples/09_performance/04_sprites_as_classes/app/main.rb
    +# Sprites represented as Classes using the queue ~args.outputs.sprites~.
     # gives you full control of property declaration and method invocation.
     # They are more performant than OpenEntities and StrictEntities, but more code upfront.
     class Star
    @@ -8398,8 +9055,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/05_static_sprites_as_classes/app/main.rb

    -
    # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.
    +

    Performance - Static Sprites As Classes - main.rb

    +
    # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb
    +# Sprites represented as Classes using the queue ~args.outputs.static_sprites~.
     # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held
     # by reference. You get better performance, but you are mutating state of held objects
     # which is less functional/data oriented.
    @@ -8452,8 +9110,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb

    -
    # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.
    +

    Performance - Static Sprites As Classes With Custom Drawing - main.rb

    +
    # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb
    +# Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.
     # is the fastest approach. This is comparable to what other game engines set as the default behavior.
     # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing
     # functional/data-oriented practices.
    @@ -8527,8 +9186,9 @@ def reset_with count: count
     end
     
     
    -

    09_performance/07_collision_limits/app/main.rb

    -
    =begin
    +

    Performance - Collision Limits - main.rb

    +
    # ./samples/09_performance/07_collision_limits/app/main.rb
    +=begin
     
      Reminders:
      - find_all: Finds all elements of a collection that meet certain requirements.
    @@ -8585,8 +9245,9 @@ end
     $gtk.reset
     
     
    -

    10_advanced_debugging/01_trace_debugging/app/main.rb

    -
    class Game
    +

    Advanced Debugging - Trace Debugging - main.rb

    +
    # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb
    +class Game
       attr_gtk
     
       def method1 num
    @@ -8641,8 +9302,9 @@ def tick args
     end
     
     
    -

    10_advanced_debugging/02_trace_debugging_classes/app/main.rb

    -
    class Foobar
    +

    Advanced Debugging - Trace Debugging Classes - main.rb

    +
    # ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb
    +class Foobar
       def initialize
         trace! # Trace is added to the constructor.
       end
    @@ -8666,8 +9328,9 @@ def tick args
     end
     
     
    -

    10_advanced_debugging/03_unit_tests/exception_raising_tests.rb

    -
    begin :shared
    +

    Advanced Debugging - Unit Tests - exception_raising_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb
    +begin :shared
       class ExceptionalClass
         def initialize exception_to_throw = nil
           raise exception_to_throw if exception_to_throw
    @@ -8690,13 +9353,15 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/gen_docs.rb

    -
    # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick
    +

    Advanced Debugging - Unit Tests - gen_docs.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb
    +# sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick
     Kernel.export_docs!
     
     
    -

    10_advanced_debugging/03_unit_tests/geometry_tests.rb

    -
    begin :shared
    +

    Advanced Debugging - Unit Tests - geometry_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb
    +begin :shared
       def primitive_representations x, y, w, h
         [
           [x, y, w, h],
    @@ -8814,8 +9479,9 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/http_tests.rb

    -
    def try_assert_or_schedule args, assert
    +

    Advanced Debugging - Unit Tests - http_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb
    +def try_assert_or_schedule args, assert
       if $result[:complete]
         log_info "Request completed! Verifying."
         if $result[:http_response_code] != 200
    @@ -8841,8 +9507,9 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb

    -
    class PlayerSpriteForTest
    +

    Advanced Debugging - Unit Tests - object_to_primitive_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb
    +class PlayerSpriteForTest
     end
     
     def test_array_to_sprite args, assert
    @@ -8861,8 +9528,9 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/parsing_tests.rb

    -
    def test_parse_json args, assert
    +

    Advanced Debugging - Unit Tests - parsing_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb
    +def test_parse_json args, assert
       result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }'
       assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed."
     end
    @@ -8893,8 +9561,9 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb

    -
    def test_serialize args, assert
    +

    Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb
    +def test_serialize args, assert
       GTK::Entity.__reset_id__!
       args.state.player_one = "test"
       result = args.gtk.serialize_state args.state
    @@ -8982,8 +9651,9 @@ end
     $tests.start
     
     
    -

    10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb

    -
    MAX_CODE_GEN_LENGTH = 50
    +

    Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb

    +
    # ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb
    +MAX_CODE_GEN_LENGTH = 50
     
     # NOTE: This is experimental/advanced stuff.
     def needs_partitioning? target
    @@ -9092,8 +9762,9 @@ $gtk.log_level = :off
     $gtk.tests.start
     
     
    -

    11_http/01_retrieve_images/app/main.rb

    -
    def tick args
    +

    Http - Retrieve Images - main.rb

    +
    # ./samples/11_http/01_retrieve_images/app/main.rb
    +def tick args
       args.outputs.background_color = [0, 0, 0]
     
       # Show a warning at the start.
    @@ -9148,8 +9819,20 @@ $gtk.tests.start
     end
     
     
    -

    99_genre_3d/3d_cube/app/main.rb

    -
    STARTX             = 0.0
    +

    12 C Extensions - Basics - main.rb

    +
    # ./samples/12_c_extensions/01_basics/app/main.rb
    +$gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib")
    +include FFI::CExt
    +
    +def tick args
    +  args.outputs.labels << [460, 600, "square(42) = #{square(42)}"]
    +end
    +
    +
    +
    +

    3d - 3d Cube - main.rb

    +
    # ./samples/99_genre_3d/3d_cube/app/main.rb
    +STARTX             = 0.0
     STARTY             = 0.0
     ENDY               = 20.0
     ENDX               = 20.0
    @@ -9201,8 +9884,9 @@ end
     $gtk.reset
     
     
    -

    99_genre_arcade/dueling_starships/app/main.rb

    -
    class DuelingSpaceships
    +

    Arcade - Dueling Starships - main.rb

    +
    # ./samples/99_genre_arcade/dueling_starships/app/main.rb
    +class DuelingSpaceships
       attr_accessor :state, :inputs, :outputs, :grid
     
       def tick
    @@ -9569,8 +10253,16 @@ def tick args
     end
     
     
    -

    99_genre_arcade/flappy_dragon/app/main.rb

    -
    class FlappyDragon
    +

    arcade/flappy dragon/credits.txt

    +
    # ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt
    +code: Amir Rajan, https://twitter.com/amirrajan
    +graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel
    +
    +
    +
    +

    arcade/flappy dragon/main.rb

    +
    # ./samples/99_genre_arcade/flappy_dragon/app/main.rb
    +class FlappyDragon
       attr_accessor :grid, :inputs, :state, :outputs
     
       def tick
    @@ -9932,8 +10624,9 @@ def tick args
     end
     
     
    -

    99_genre_arcade/pong/app/main.rb

    -
    def tick args
    +

    Arcade - Pong - main.rb

    +
    # ./samples/99_genre_arcade/pong/app/main.rb
    +def tick args
       defaults args
       render args
       calc args
    @@ -10094,8 +10787,9 @@ begin :assets
     end
     
     
    -

    99_genre_arcade/snakemoji/app/main.rb

    -
    # coding: utf-8
    +

    Arcade - Snakemoji - main.rb

    +
    # ./samples/99_genre_arcade/snakemoji/app/main.rb
    +# coding: utf-8
     ################################
     #  So I was working on a snake game while
     #  learning DragonRuby, and at some point I had a thought
    @@ -10262,8 +10956,9 @@ def defaults 🎮
     end
     
     
    -

    99_genre_arcade/solar_system/app/main.rb

    -
    # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4
    +

    Arcade - Solar System - main.rb

    +
    # ./samples/99_genre_arcade/solar_system/app/main.rb
    +# Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4
     # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8
     
     def defaults args
    @@ -10373,8 +11068,9 @@ def r
     end
     
     
    -

    99_genre_crafting/craft_game_starting_point/app/main.rb

    -
    # ==================================================
    +

    Crafting - Craft Game Starting Point - main.rb

    +
    # ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb
    +# ==================================================
     # A NOTE TO JAM CRAFT PARTICIPANTS:
     # The comments and code in here are just as small piece of DragonRuby's capabilities.
     # Be sure to check out the rest of the sample apps. Start with README.txt and go from there!
    @@ -10799,8 +11495,71 @@ end
     $gtk.reset
     
     
    -

    99_genre_dev_tools/animation_creator_starting_point/app/main.rb

    -
    class OneBitLowrezPaint
    +

    Dev Tools - Add Buttons To Console - main.rb

    +
    # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb
    +# You can customize the buttons that show up in the Console.
    +class GTK::Console::Menu
    +  # STEP 1: Override the custom_buttons function.
    +  def custom_buttons
    +    [
    +      (button id: :yay,
    +              # row for button
    +              row: 3,
    +              # column for button
    +              col: 10,
    +              # text
    +              text: "I AM CUSTOM",
    +              # when clicked call the custom_button_clicked function
    +              method: :custom_button_clicked),
    +
    +      (button id: :yay,
    +              # row for button
    +              row: 3,
    +              # column for button
    +              col: 9,
    +              # text
    +              text: "CUSTOM ALSO",
    +              # when clicked call the custom_button_also_clicked function
    +              method: :custom_button_also_clicked)
    +    ]
    +  end
    +
    +  # STEP 2: Define the function that should be called.
    +  def custom_button_clicked
    +    log "* INFO: I AM CUSTOM was clicked!"
    +  end
    +
    +  def custom_button_also_clicked
    +    log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!"
    +
    +    all_buttons_as_string = $gtk.console.menu.buttons.map do |b|
    +      <<-S.strip
    +** id: #{b[:id]}
    +:PROPERTIES:
    +:id:     :#{b[:id]}
    +:method: :#{b[:method]}
    +:text:   #{b[:text]}
    +:END:
    +S
    +    end.join("\n")
    +
    +    log <<-S
    +* INFO: Here are all the buttons:
    +#{all_buttons_as_string}
    +S
    +  end
    +end
    +
    +def tick args
    +  args.outputs.labels << [args.grid.center.x, args.grid.center.y,
    +                          "Open the DragonRuby Console to see the custom menu items.",
    +                          0, 1]
    +end
    +
    +
    +

    Dev Tools - Animation Creator Starting Point - main.rb

    +
    # ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb
    +class OneBitLowrezPaint
       attr_gtk
     
       def tick
    @@ -11249,8 +12008,9 @@ end
     # $gtk.reset
     
     
    -

    99_genre_dev_tools/tile_editor_starting_point/app/main.rb

    -
    =begin
    +

    Dev Tools - Tile Editor Starting Point - main.rb

    +
    # ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -11643,8 +12403,9 @@ def tick_instructions args, text, y = 715
     end
     
     
    -

    99_genre_lowrez/resolution_64x64/app/lowrez.rb

    -
    # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)
    +

    Lowrez - Resolution 64x64 - lowrez.rb

    +
    # ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb
    +# 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
    @@ -11816,8 +12577,9 @@ module GTK
     end
     
     
    -

    99_genre_lowrez/resolution_64x64/app/main.rb

    -
    require 'app/lowrez.rb'
    +

    Lowrez - Resolution 64x64 - main.rb

    +
    # ./samples/99_genre_lowrez/resolution_64x64/app/main.rb
    +require 'app/lowrez.rb'
     
     def tick args
       # How to set the background color
    @@ -12432,3093 +13194,877 @@ end
     $gtk.reset
     
     
    -

    99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb

    -
    # Hey there! Welcome to Four Decisions. Here is how you
    -# create your decision tree. Remove =being and =end from the text to
    -# enable the game (just save the file). Change stuff and see what happens!
    -
    -def game
    -  {
    -    starting_decision: :stormy_night,
    -    decisions: {
    -      stormy_night: {
    -        description: 'It was a dark and stormy night. (storyline located in decision.rb)',
    -        option_one: {
    -          description: 'Go to sleep.',
    -          decision: :nap
    -        },
    -        option_two: {
    -          description: 'Watch a movie.',
    -          decision: :movie
    -        },
    -        option_three: {
    -          description: 'Go outside.',
    -          decision: :go_outside
    -        },
    -        option_four: {
    -          description: 'Get a snack.',
    -          decision: :get_a_snack
    -        }
    -      },
    -      nap: {
    -        description: 'You took a nap. The end.',
    -        option_one: {
    -          description: 'Start over.',
    -          decision: :stormy_night
    -        }
    -      }
    -    }
    -  }
    -end
    -
    -
    -

    99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb

    -
    =begin
    +

    Platformer - Clepto Frog - main.rb

    +
    # ./samples/99_genre_platformer/clepto_frog/app/main.rb
    +MAP_FILE_PATH = 'app/map.txt'
     
    - Reminders:
    -
    - - Hashes: Collection of unique keys and their corresponding values. The values can be found
    -   using their keys.
    +require 'app/map.rb'
     
    -   In this sample app, the decisions needed for the game are stored in a hash. In fact, the
    -   decision.rb file contains hashes inside of other hashes!
    +class CleptoFrog
    +  attr_gtk
     
    -   Each option is a key in the first hash, but also contains a hash (description and
    -   decision being its keys) as its value.
    -   Go into the decision.rb file and take a look before diving into the code below.
    +  def render_ending
    +    state.game_over_at ||= state.tick_count
     
    - - 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.
    +    outputs.labels << [640, 700, "Clepto Frog", 4, 1]
     
    - - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.
    -   For more information about the keyboard, go to mygame/documentation/06-keyboard.md.
    +    if state.tick_count >= (state.game_over_at + 120)
    +      outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",
    +                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]
    +    end
     
    - - 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.
    +    if state.tick_count >= (state.game_over_at + 240)
    +      outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",
    +                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]
    +    end
     
    -=end
    +    if state.tick_count >= (state.game_over_at + 360)
    +      outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",
    +                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]
    +    end
     
    -# This sample app provides users with a story and multiple decisions that they can choose to make.
    -# Users can make a decision using their keyboard, and the story will move forward based on user choices.
    +    outputs.sprites << [640 - 50, 360 - 50, 100, 100,
    +                        "sprites/square-green.png"]
     
    -# The decisions available to users are stored in the decision.rb file.
    -# We must have access to it for the game to function properly.
    -GAME_FILE = 'app/decision.rb' # found in app folder
    +    outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]
    +    outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]
     
    -require GAME_FILE # require used to load another file, import class/method definitions
    +    if state.tick_count >= (state.game_over_at + 550)
    +      restart_game
    +    end
    +  end
     
    -# Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.
    -# Otherwise, the game is run.
    -def tick args
    -  if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method
    -    args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown
    -    args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]
    -  elsif respond_to?(:game) # otherwise, if responds to game
    -    args.state.loaded = true
    -    tick_game args # calls tick_game method, runs game
    +  def restart_game
    +    state.world = nil
    +    state.x = nil
    +    state.y = nil
    +    state.dx = nil
    +    state.dy = nil
    +    state.stuff_score = 0
    +    state.stuff_time = 0
    +    state.intro_tick_count = nil
    +    defaults
    +    state.game_start_at = state.tick_count
    +    state.scene = :game
    +    state.game_over_at = nil
       end
     
    -  if args.state.tick_count.mod_zero? 60 # update every 60 frames
    -    t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file
    -    if t != args.state.mtime
    -      args.state.mtime = t
    -      require GAME_FILE # require used to load file
    -      args.state.game_definition = nil # game definition and decision are empty
    -      args.state.decision_id = nil
    +  def render_intro
    +    outputs.labels << [640, 700, "Clepto Frog", 4, 1]
    +    if state.tick_count >= 120
    +      outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",
    +                         4, 1, 0, 0, 0, 255 * 120.ease(60)]
         end
    -  end
    -end
     
    -# Runs methods needed for game to function properly
    -# Creates a rectangular border around the screen
    -def tick_game args
    -  defaults args
    -  args.borders << args.grid.rect
    -  render_decision args
    -  process_inputs args
    -end
    +    if state.tick_count >= 240
    +      outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",
    +                         4, 1, 0, 0, 0, 255 * 240.ease(60)]
    +    end
     
    -# Sets default values and uses decision.rb file to define game and decision_id
    -# variable using the starting decision
    -def defaults args
    -  args.state.game_definition ||= game
    -  args.state.decision_id ||= args.state.game_definition[:starting_decision]
    -end
    +    if state.tick_count >= 360
    +      outputs.labels << [640, 540, "\"Uh...\" - New Guy",
    +                         4, 1, 0, 0, 0, 255 * 360.ease(60)]
    +    end
     
    -# Outputs the possible decision descriptions the user can choose onto the screen
    -# as well as what key to press on their keyboard to make their decision
    -def render_decision args
    -  decision = current_decision args
    -  # text is either the value of decision's description key or warning that no description exists
    -  args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation
    +    if state.tick_count >= 480
    +      outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",
    +                         4, 1, 0, 0, 0, 255 * 480.ease(60)]
    +    end
     
    -  # All decisions are stored in a hash
    -  # The descriptions output onto the screen are the values for the description keys of the hash.
    -  if decision[:option_one]
    -    args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label
    -    args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision
    -  end
    +    if state.tick_count >= 600
    +      outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",
    +                         4, 1, 0, 0, 0, 255 * 600.ease(60)]
    +    end
     
    -  if decision[:option_two]
    -    args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description
    -    args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]
    -  end
    +    outputs.sprites << [640 - 50, 360 - 50, 100, 100,
    +                        "sprites/square-green.png"]
     
    -  if decision[:option_three]
    -    args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description
    -    args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]
    +    if state.tick_count == 800
    +      state.scene = :game
    +      state.game_start_at = state.tick_count
    +    end
       end
     
    -  if decision[:option_four]
    -    args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description
    -    args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]
    +  def tick
    +    defaults
    +    if state.scene == :intro && state.tick_count <= 800
    +      render_intro
    +    elsif state.scene == :ending
    +      render_ending
    +    else
    +      render
    +    end
    +    calc
    +    process_inputs
       end
    -end
    -
    -# Uses keyboard input from the user to make a decision
    -# Assigns the decision as the value of the decision_id variable
    -def process_inputs args
    -  decision = current_decision args # calls current_decision method
     
    -  if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists
    -    args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id
    -  end
    -
    -  if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists
    -    args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id
    +  def defaults
    +    state.scene ||= :intro
    +    state.stuff_score     ||= 0
    +    state.stuff_time      ||= 0
    +    state.stuff_best_time ||= nil
    +    state.camera_x ||= 0
    +    state.camera_y ||= 0
    +    state.target_camera_scale ||= 1
    +    state.camera_scale ||= 1
    +    state.tongue_length          ||= 100
    +    state.dev_action             ||= :collision_mode
    +    state.action                 ||= :aiming
    +    state.tongue_angle           ||= 90
    +    state.tile_size                = 64
    +    state.gravity                  = -0.1
    +    state.air                      = -0.01
    +    state.player_width             = 60
    +    state.player_height            = 60
    +    state.collision_tolerance      = 0.0
    +    state.previous_tile_size     ||= state.tile_size
    +    state.x                      ||= 2400
    +    state.y                      ||= 200
    +    state.dy                     ||= 0
    +    state.dx                     ||= 0
    +    attempt_load_world_from_file
    +    state.world_lookup           ||= { }
    +    state.world_collision_rects  ||= []
    +    state.mode                   ||= :creating
    +    state.select_menu            ||= [0, 720, 1280, 720]
    +    state.sprite_quantity        ||= 20
    +    state.sprite_coords          ||= []
    +    state.banner_coords          ||= [640, 680 + 720]
    +    state.sprite_selected        ||= 1
    +    state.map_saved_at           ||= 0
    +    state.intro_tick_count       ||= state.tick_count
    +    if state.sprite_coords == []
    +      count = 1
    +      temp_x = 165
    +      temp_y = 500 + 720
    +      state.sprite_quantity.times do
    +        state.sprite_coords += [[temp_x, temp_y, count]]
    +        temp_x += 100
    +        count += 1
    +        if temp_x > 1280 - (165 + 50)
    +          temp_x = 165
    +          temp_y -= 75
    +        end
    +      end
    +    end
       end
     
    -  if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists
    -    args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id
    +  def start_of_tongue x = nil, y = nil
    +    x ||= state.x
    +    y ||= state.y
    +    [
    +      x + state.player_width.half,
    +      y + state.player_height.half
    +    ]
       end
     
    -  if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists
    -    args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id
    +  def stage_definition
    +    outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']
       end
    -end
     
    -# Uses decision_id's value to keep track of current decision being made
    -def current_decision args
    -  args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty
    -end
    +  def render
    +    stage_definition
    +    start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]
    +    end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]
     
    -# Resets the game.
    -$gtk.reset
    +    if state.anchor_point
    +      anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]
    +      outputs.sprites << { x: start_of_tongue_render.x,
    +                           y: start_of_tongue_render.y,
    +                           w: vw(2),
    +                           h: args.geometry.distance(start_of_tongue_render, anchor_point_render),
    +                           path:  'sprites/square-pink.png',
    +                           angle_anchor_y: 0,
    +                           angle: state.tongue_angle - 90 }
    +    else
    +      outputs.sprites << { x: vx(start_of_tongue.x),
    +                           y: vy(start_of_tongue.y),
    +                           w: vw(2),
    +                           h: vh(state.tongue_length),
    +                           path:  'sprites/square-pink.png',
    +                           angle_anchor_y: 0,
    +                           angle: state.tongue_angle - 90 }
    +    end
     
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb

    -
    ###################################################################################
    -# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES
    -# THE 64x64 CANVAS.
    -###################################################################################
    +    outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }
     
    -TINY_RESOLUTION       = 64
    -TINY_SCALE            = 720.fdiv(TINY_RESOLUTION + 5)
    -CENTER_OFFSET         = 10
    -EMULATED_FONT_SIZE    = 20
    -EMULATED_FONT_X_ZERO  = 0
    -EMULATED_FONT_Y_ZERO  = 46
    +    if state.god_mode
    +      # SHOW HIDE COLLISIONS
    +      outputs.sprites << state.world.map do |x, y, w, h|
    +        x = vx(x)
    +        y = vy(y)
    +        if x > -80 && x < 1280 && y > -80 && y < 720
    +          {
    +            x: x,
    +            y: y,
    +            w: vw(w || state.tile_size),
    +            h: vh(h || state.tile_size),
    +            path: 'sprites/square-gray.png',
    +            a: 128
    +          }
    +        end
    +      end
    +    end
     
    -def tick args
    -  sprites = []
    -  labels = []
    -  borders = []
    -  solids = []
    -  mouse = emulate_lowrez_mouse args
    -  args.state.show_gridlines = false
    -  lowrez_tick args, sprites, labels, borders, solids, mouse
    -  render_gridlines_if_needed args
    -  render_mouse_crosshairs args, mouse
    -  emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
    -end
    +    render_player
    +    outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]
     
    -def emulate_lowrez_mouse args
    -  args.state.new_entity_strict(:lowrez_mouse) do |m|
    -    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
    -      m.click = [
    -        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
    -    else
    -      m.click = nil
    -      m.down = nil
    -    end
    +    # Label in top left of the screen
    +    outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid
    +    outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label
    +    outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label
     
    -    if args.mouse.up
    -      m.up = [
    -        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
    -    end
    -  end
    -end
    +    if state.god_mode
    +      if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120
    +        outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label
    +      end
     
    -def render_mouse_crosshairs args, mouse
    -  return unless args.state.show_gridlines
    -  args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]
    -end
     
    -def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
    -  args.render_target(:lowrez).solids  << [0, 0, 1280, 720]
    -  args.render_target(:lowrez).sprites << sprites
    -  args.render_target(:lowrez).borders << borders
    -  args.render_target(:lowrez).solids  << solids
    -  args.outputs.primitives << labels.map do |l|
    -    as_label = l.label
    -    l.text.each_char.each_with_index.map do |char, i|
    -      [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, 'fonts/dragonruby-gtk-4x4.ttf'].label
    +      # Creates sprite following mouse to help indicate which sprite you have selected
    +      outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,
    +                             state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite
         end
    +
    +    render_mini_map
    +    outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid
       end
     
    -  args.sprites    << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]
    -end
    +  def render_mini_map
    +    x, y = 1170, 10
    +    outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid
    +    outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid
    +    t_start = start_of_tongue
    +    t_end = end_of_tongue
    +    outputs.primitives << [
    +      x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),
    +      x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),
    +      255, 255, 255
    +    ].line
     
    -def render_gridlines_if_needed args
    -  if args.state.show_gridlines && args.static_lines.length == 0
    -    args.static_lines << 65.times.map do |i|
    -      [
    -        [CENTER_OFFSET + i * TINY_SCALE + 1,  0,
    -         CENTER_OFFSET + i * TINY_SCALE + 1,  720,                128, 128, 128],
    -        [CENTER_OFFSET + i * TINY_SCALE,      0,
    -         CENTER_OFFSET + i * TINY_SCALE,      720,                128, 128, 128],
    -        [CENTER_OFFSET,                       0 + i * TINY_SCALE,
    -         CENTER_OFFSET + 720,                 0 + i * TINY_SCALE, 128, 128, 128],
    -        [CENTER_OFFSET,                       1 + i * TINY_SCALE,
    -         CENTER_OFFSET + 720,                 1 + i * TINY_SCALE, 128, 128, 128]
    -      ]
    +    state.objects.each do |o|
    +      outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid
         end
    -  elsif !args.state.show_gridlines
    -    args.static_lines.clear
       end
    -end
     
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/main.rb

    -
    require 'app/require.rb'
    +  def calc_camera percentage_override = nil
    +    percentage = percentage_override || (0.2 * state.camera_scale)
    +    target_scale = state.target_camera_scale
    +    distance_scale = target_scale - state.camera_scale
    +    state.camera_scale += distance_scale * percentage
     
    -def defaults args
    -  args.outputs.background_color = [0, 0, 0]
    -  args.state.last_story_line_text ||= ""
    -  args.state.scene_history ||= []
    -  args.state.storyline_history ||= []
    -  args.state.word_delay ||= 8
    -  if args.state.tick_count == 0
    -    args.gtk.stop_music
    -    args.outputs.sounds << 'sounds/static-loop.ogg'
    +    target_x = state.x * state.target_camera_scale
    +    target_y = state.y * state.target_camera_scale
    +
    +    distance_x = target_x - (state.camera_x + 640)
    +    distance_y = target_y - (state.camera_y + 360)
    +    state.camera_x += distance_x * percentage if distance_x.abs > 1
    +    state.camera_y += distance_y * percentage if distance_y.abs > 1
    +    state.camera_x = 0 if state.camera_x < 0
    +    state.camera_y = 0 if state.camera_y < 0
       end
     
    -  if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at
    -    lines = args.state
    -                .storyline_history[-1]
    -                .gsub("-", "")
    -                .gsub("~", "")
    -                .wrapped_lines(55)
    +  def vx x
    +     (x * state.camera_scale) - state.camera_x
    +  end
     
    -    args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0)
    -  elsif !args.state.is_storyline_dialog_active
    -    args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50))
    +  def vy y
    +    (y * state.camera_scale) - state.camera_y
       end
     
    -  return if args.state.current_scene
    -  set_scene(args, day_one_beginning(args))
    -end
    -
    -def inputs_move_player args
    -  if args.state.scene_changed_at.elapsed_time > 5
    -    if args.keyboard.down  || args.keyboard.s || args.keyboard.j
    -      args.state.player.y -= 0.25
    -    elsif args.keyboard.up || args.keyboard.w || args.keyboard.k
    -      args.state.player.y += 0.25
    -    end
    -
    -    if args.keyboard.left     || args.keyboard.a  || args.keyboard.h
    -      args.state.player.x -= 0.25
    -    elsif args.keyboard.right || args.keyboard.d  || args.keyboard.l
    -      args.state.player.x += 0.25
    -    end
    -
    -    args.state.player.y = 60 if args.state.player.y > 63
    -    args.state.player.y =  0 if args.state.player.y < -3
    -    args.state.player.x = 60 if args.state.player.x > 63
    -    args.state.player.x =  0 if args.state.player.x < -3
    +  def vw w
    +    w * state.camera_scale
       end
    -end
    -
    -def null_or_empty? ary
    -  return true unless ary
    -  return true if ary.length == 0
    -  return false
    -end
     
    -def calc_storyline_hotspot args
    -  hotspots = args.state.storylines.find_all do |hs|
    -    args.state.player.inside_rect?(hs.shift_rect(-2, 0))
    +  def vh h
    +    h * state.camera_scale
       end
     
    -  if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot
    -    _, _, _, _, storyline = hotspots.first
    -    queue_storyline_text(args, storyline)
    -    args.state.inside_storyline_hotspot = true
    -  elsif null_or_empty?(hotspots)
    -    args.state.inside_storyline_hotspot = false
    +  def calc
    +    calc_camera
    +    calc_world_lookup
    +    calc_player
    +    calc_on_floor
    +    calc_score
       end
    -end
     
    -def calc_scenes args
    -  hotspots = args.state.scenes.find_all do |hs|
    -    args.state.player.inside_rect?(hs.shift_rect(-2, 0))
    +  def set_camera_scale v = nil
    +    return if v < 0.1
    +    state.target_camera_scale = v
       end
     
    -  if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot
    -    _, _, _, _, scene_method_or_hash = hotspots.first
    -    if scene_method_or_hash.is_a? Symbol
    -      set_scene(args, send(scene_method_or_hash, args))
    -      args.state.last_hotspot_scene = scene_method_or_hash
    -      args.state.scene_history << scene_method_or_hash
    -    else
    -      set_scene(args, scene_method_or_hash)
    +  def process_inputs_god_mode
    +    return unless state.god_mode
    +
    +    if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))
    +      set_camera_scale state.camera_scale + 0.1
    +    elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))
    +      set_camera_scale state.camera_scale - 0.1
    +    elsif inputs.keyboard.eight || inputs.keyboard.zero
    +      set_camera_scale 1
         end
    -    args.state.inside_scene_hotspot = true
    -  elsif null_or_empty?(hotspots)
    -    args.state.inside_scene_hotspot = false
    -  end
    -end
     
    -def null_or_whitespace? word
    -  return true if !word
    -  return true if word.strip.length == 0
    -  return false
    -end
    +    if input_up?
    +      state.y += 10
    +      state.dy = 0
    +    elsif input_down?
    +      state.y -= 10
    +      state.dy = 0
    +    end
     
    -def calc_storyline_presentation args
    -  return unless args.state.tick_count > args.state.next_storyline
    -  return unless args.state.scene_storyline_queue
    -  next_storyline = args.state.scene_storyline_queue.shift
    -  if null_or_whitespace? next_storyline
    -    args.state.storyline_queue_empty_at ||= args.state.tick_count
    -    args.state.is_storyline_dialog_active = false
    -    return
    +    if input_left?
    +      state.x -= 10
    +      state.dx = 0
    +    elsif input_right?
    +      state.x += 10
    +      state.dx = 0
    +    end
       end
    -  args.state.storyline_to_show = next_storyline
    -  args.state.is_storyline_dialog_active = true
    -  args.state.storyline_queue_empty_at = nil
    -  if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")
    -    args.state.next_storyline += 60
    -  elsif next_storyline.end_with?(",")
    -    args.state.next_storyline += 50
    -  elsif next_storyline.end_with?(":")
    -    args.state.next_storyline += 60
    -  else
    -    default_word_delay = 13 + args.state.word_delay - 8
    -    if next_storyline.gsub("-", "").gsub("~", "").length <= 4
    -      default_word_delay = 11 + args.state.word_delay - 8
    +
    +  def process_inputs
    +    if state.scene == :game
    +      process_inputs_player_movement
    +      process_inputs_god_mode
    +    elsif state.scene == :intro
    +      if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space
    +        if Kernel.tick_count < 600
    +          Kernel.tick_count = 600
    +        end
    +      end
         end
    -    number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length
    -    args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)
       end
    -end
     
    -def inputs_reload_current_scene args
    -  return
    -  if args.inputs.keyboard.key_down.r!
    -    reload_current_scene
    +  def input_up?
    +    inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k
       end
    -end
     
    -def inputs_dismiss_current_storyline args
    -  if args.inputs.keyboard.key_down.x!
    -    args.state.scene_storyline_queue.clear
    +  def input_up_released?
    +    inputs.keyboard.key_up.w ||
    +    inputs.keyboard.key_up.up ||
    +    inputs.keyboard.key_up.k
       end
    -end
     
    -def inputs_restart_game args
    -  if args.inputs.keyboard.exclamation_point
    -    args.gtk.reset_state
    +  def input_down?
    +    inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j
       end
    -end
     
    -def inputs_change_word_delay args
    -  if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign
    -    args.state.word_delay -= 2
    -    if args.state.word_delay < 0
    -      args.state.word_delay = 0
    -      # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"
    -    else
    -      # queue_storyline_text args, "Text speed INCREASED."
    -    end
    +  def input_down_released?
    +    inputs.keyboard.key_up.s ||
    +    inputs.keyboard.key_up.down ||
    +    inputs.keyboard.key_up.j
       end
     
    -  if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore
    -    args.state.word_delay += 2
    -    # queue_storyline_text args, "Text speed DECREASED."
    +  def input_left?
    +    inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h
       end
    -end
     
    -def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil
    -  texts.each_with_index.map do |t, i|
    -    [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]
    +  def input_right?
    +    inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l
       end
    -end
     
    -def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse
    -  # args.state.show_gridlines = true
    -  defaults args
    -  render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_solids << [0, 0, 64, 64, 0, 0, 0]
    -  calc_storyline_presentation args
    -  calc_scenes args
    -  calc_storyline_hotspot args
    -  inputs_move_player args
    -  inputs_print_mouse_rect args, lowrez_mouse
    -  inputs_reload_current_scene args
    -  inputs_dismiss_current_storyline args
    -  inputs_change_word_delay args
    -  inputs_restart_game args
    -  if !args.state.storyline_queue_empty_at
    -    args.outputs.labels << multiple_lines(args, 690, 80,
    -                                          ["Press \"X\" on the keyboard to dismiss dialog.",
    -                                           "Press \"+\" on the keyboard to INCREASE text speed.",
    -                                           "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255)
    +  def set_object path, w, h
    +    state.object = path
    +    state.object_w = w
    +    state.object_h = h
       end
    -end
     
    -def inputs_print_mouse_rect args, lowrez_mouse
    -  if lowrez_mouse.click
    -    if args.state.previous_mouse_click
    -      dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x
    -      dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y
    -      x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy
    +  def collision_mode
    +    state.dev_action = :collision_mode
    +  end
     
    -      if dx < 0 && dx < 0
    -        x = x + w
    -        w = w.abs
    -        y = y + h
    -        h = h.abs
    -      end
    +  def process_inputs_player_movement
    +    if inputs.keyboard.key_down.g
    +      state.god_mode = !state.god_mode
    +      puts state.god_mode
    +    end
     
    -      w += 1
    -      h += 1
    +    if inputs.keyboard.key_down.u && state.dev_action == :collision_mode
    +      state.world = state.world[0..-2]
    +      state.world_lookup = {}
    +    end
     
    -      puts [x, y, w, h]
    -      args.state.previous_mouse_click = nil
    -    else
    -      args.state.previous_mouse_click = lowrez_mouse.click
    -      square_x, square_y = lowrez_mouse.click
    -      puts [square_x, square_y]
    -      8.map_with_index do |i|
    -        puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1]
    -      end
    +    if inputs.keyboard.key_down.space && !state.anchor_point
    +      state.tongue_length = 0
    +      state.action = :shooting
    +      outputs.sounds << 'sounds/shooting.wav'
    +    elsif inputs.keyboard.key_down.space
    +      state.action = :aiming
    +      state.anchor_point  = nil
    +      state.tongue_length = 100
         end
     
    -  end
    -end
    +    if state.anchor_point
    +      if input_up?
    +        if state.tongue_length >= 105
    +          state.tongue_length -= 5
    +          state.dy += 0.8
    +        end
    +      elsif input_down?
    +        state.tongue_length += 5
    +        state.dy -= 0.8
    +      end
     
    -def try_centering! word
    -  word ||= ""
    -  just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")
    -  return word if just_word.strip.length == 0
    -  return word if just_word.include? "~"
    -  return "~#{word}" if just_word.length <= 2
    -  if just_word.length.mod_zero? 2
    -    center_index = just_word.length.idiv(2) - 1
    -  else
    -    center_index = (just_word.length - 1).idiv(2)
    -  end
    -  return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"
    -end
    -
    -def queue_storyline args, scene
    -  queue_storyline_text args, scene[:storyline]
    -end
    -
    -def queue_storyline_text args, text
    -  args.state.last_story_line_text = text
    -  args.state.storyline_history << text if text
    -  words = (text || "").split(" ")
    -  words = words.map { |w| try_centering! w }
    -  args.state.scene_storyline_queue = words
    -  if args.state.scene_storyline_queue.length != 0
    -    args.state.scene_storyline_queue.unshift "~$--"
    -    args.state.storyline_to_show = "~."
    -  else
    -    args.state.storyline_to_show = ""
    +      if input_left? && state.dx > 1
    +        state.dx *= 0.98
    +      elsif input_left? && state.dx < -1
    +        state.dx *= 1.03
    +      elsif input_left? && !state.on_floor
    +        state.dx -= 3
    +      elsif input_right? && state.dx > 1
    +        state.dx *= 1.03
    +      elsif input_right? && state.dx < -1
    +        state.dx *= 0.98
    +      elsif input_right? && !state.on_floor
    +        state.dx += 3
    +      end
    +    else
    +      if input_left?
    +        state.tongue_angle += 1.5
    +        state.tongue_angle = state.tongue_angle
    +      elsif input_right?
    +        state.tongue_angle -= 1.5
    +        state.tongue_angle = state.tongue_angle
    +      end
    +    end
       end
    -  args.state.scene_storyline_queue << ""
    -  args.state.next_storyline = args.state.tick_count
    -end
     
    -def set_scene args, scene
    -  args.state.current_scene = scene
    -  args.state.background = scene[:background] ||  'sprites/todo.png'
    -  args.state.scene_fade = scene[:fade] || 0
    -  args.state.scenes = (scene[:scenes] || []).reject { |s| !s }
    -  args.state.scene_render_override = scene[:render_override]
    -  args.state.storylines = (scene[:storylines] || []).reject { |s| !s }
    -  args.state.scene_changed_at = args.state.tick_count
    -  if scene[:player]
    -    args.state.player = scene[:player]
    +  def add_floors
    +    # floors
    +    state.world += [
    +      [0,       0, 10000, 40],
    +      [0,    1670, 3250, 60],
    +      [6691, 1653, 3290, 60],
    +      [1521, 3792, 7370, 60],
    +      [0, 5137, 3290, 60]
    +    ]
       end
    -  args.state.inside_scene_hotspot = false
    -  args.state.inside_storyline_hotspot = false
    -  queue_storyline args, scene
    -end
     
    -def replay_storyline_rect
    -  [26, -1, 7, 4]
    -end
    +  def attempt_load_world_from_file
    +    return if state.world
    +    # exported_world = gtk.read_file(MAP_FILE_PATH)
    +    state.world = []
    +    state.objects = []
     
    -def labels_for_word word
    -  left_side_of_word = ""
    -  center_letter = ""
    -  right_side_of_word = ""
    +    if $collisions
    +      $collisions.map do |x, y, w, h|
    +        state.world << [x, y, w, h]
    +      end
     
    -  if word[0] == "~"
    -    left_side_of_word = ""
    -    center_letter = word[1]
    -    right_side_of_word = word[2..-1]
    -  elsif word.length > 0
    -    left_side_of_word, right_side_of_word = word.split("~")
    -    center_letter = right_side_of_word[0]
    -    right_side_of_word = right_side_of_word[1..-1]
    +      add_floors
    +    # elsif exported_world
    +    #   exported_world.each_line.map do |l|
    +    #     tokens = l.strip.split(',')
    +    #     x    = tokens[0].to_i
    +    #     y    = tokens[1].to_i
    +    #     type = tokens[2].to_i
    +    #     if type == 1
    +    #       state.world << [x, y, state.tile_size, state.tile_size]
    +    #     elsif type == 2
    +    #       w, h, path = tokens[3..-1]
    +    #       state.objects << [x, y, w.to_i, h.to_i, path]
    +    #     end
    +    #   end
    +
    +    #   add_floors
    +    end
    +
    +    if $mugs
    +      $mugs.map do |x, y, w, h, path|
    +        state.objects << [x, y, w, h, path]
    +      end
    +    end
       end
     
    -  right_side_of_word = right_side_of_word.gsub("-", "")
    +  def calc_world_lookup
    +    if state.tile_size != state.previous_tile_size
    +      state.previous_tile_size = state.tile_size
    +      state.world_lookup = {}
    +    end
     
    -  {
    -    left:   [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],
    -    center: [29, 2, center_letter, 255, 0, 0],
    -    right:  [34, 2, right_side_of_word]
    -  }
    -end
    +    return if state.world_lookup.keys.length > 0
    +    return unless state.world.length > 0
     
    -def render_scenes args, lowrez_sprites
    -  lowrez_sprites << args.state.scenes.flat_map do |hs|
    -    hotspot_square args, hs.x, hs.y, hs.w, hs.h
    -  end
    -end
    +    # Searches through the world and finds the cordinates that exist
    +    state.world_lookup = {}
    +    state.world.each do |x, y, w, h|
    +      state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true
    +    end
    +
    +    # Assigns collision rects for every sprite drawn
    +    state.world_collision_rects =
    +      state.world_lookup
    +           .keys
    +           .map do |x, y, w, h|
    +             s = state.tile_size
    +             w ||= s
    +             h ||= s
    +             {
    +               args:       [x, y, w, h],
    +               left_right: [x,     y + 4, w,     h - 6],
    +               top:        [x + 4, y + 6, w - 8, h - 6],
    +               bottom:     [x + 1, y - 1, w - 2, h - 8],
    +             }
    +           end
     
    -def render_storylines args, lowrez_sprites
    -  lowrez_sprites << args.state.storylines.flat_map do |hs|
    -    hotspot_square args, hs.x, hs.y, hs.w, hs.h
       end
    -end
     
    -def adornments_alpha args, target_alpha = nil, minimum_alpha = nil
    -  return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at
    -  target_alpha ||= 255
    -  target_alpha * args.state.storyline_queue_empty_at.ease(60)
    -end
    +  def calc_pendulum
    +    return if !state.anchor_point
    +    target_x = state.anchor_point.x - start_of_tongue.x
    +    target_y = state.anchor_point.y -
    +               state.tongue_length - 5 - 20 - state.player_height
     
    -def hotspot_square args, x, y, w, h
    -  if w >= 3 && h >= 3
    -    [
    -      [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],
    -      [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],
    -      [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],
    -    ]
    -  else
    -    [
    -      [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],
    -    ]
    -  end
    -end
    +    diff_y = state.y - target_y
     
    -def render_storyline_dialog args, lowrez_labels, lowrez_sprites
    -  return unless args.state.is_storyline_dialog_active
    -  return unless args.state.storyline_to_show
    -  labels = labels_for_word args.state.storyline_to_show
    -  if true # high rez version
    -    scale = 8.88
    -    offset = 45
    -    size = 25
    -    args.outputs.labels << [offset + labels[:left].x.-(1) * scale,
    -                            labels[:left].y * TINY_SCALE + 55,
    -                            labels[:left].text, size, 0, 0, 0, 0, 255,
    -                            'fonts/manaspc.ttf']
    -    center_text = labels[:center].text
    -    center_text = "|" if center_text == "$"
    -    args.outputs.labels << [offset + labels[:center].x * scale,
    -                            labels[:center].y * TINY_SCALE + 55,
    -                            center_text, size, 0, 255, 0, 0, 255,
    -                            'fonts/manaspc.ttf']
    -    args.outputs.labels << [offset + labels[:right].x * scale,
    -                            labels[:right].y * TINY_SCALE + 55,
    -                            labels[:right].text, size, 0, 0, 0, 0, 255,
    -                            'fonts/manaspc.ttf']
    -  else
    -    lowrez_labels << labels[:left]
    -    lowrez_labels << labels[:center]
    -    lowrez_labels << labels[:right]
    -  end
    -  args.state.is_storyline_dialog_active = true
    -  render_player args, lowrez_sprites
    -  lowrez_sprites <<  [0, 0, 64, 8, 'sprites/label-background.png']
    -end
    +    if target_x > 0
    +      state.dx += 0.6
    +    elsif target_x < 0
    +      state.dx -= 0.6
    +    end
     
    -def render_player args, lowrez_sprites
    -  lowrez_sprites << player_md_down(args, *args.state.player)
    -end
    +    if diff_y > 0
    +      state.dy -= 0.1
    +    elsif diff_y < 0
    +      state.dy += 0.1
    +    end
     
    -def render_adornments args, lowrez_sprites
    -  render_scenes args, lowrez_sprites
    -  render_storylines args, lowrez_sprites
    -  return if args.state.is_storyline_dialog_active
    -  lowrez_sprites << player_md_down(args, *args.state.player)
    -end
    +    state.dx *= 0.99
     
    -def global_alpha_percentage args, max_alpha = 255
    -  return 255 unless args.state.scene_changed_at
    -  return 255 unless args.state.scene_fade
    -  return 255 unless args.state.scene_fade > 0
    -  return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)
    -end
    +    if state.dy.abs < 2
    +      state.dy *= 0.8
    +    else
    +      state.dy *= 0.90
    +    end
     
    -def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]
    -  if args.state.scene_render_override
    -    send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids
    +    if state.tongue_length && state.y
    +      state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)
    +    end
       end
    -  storyline_to_show = args.state.storyline_to_show || ""
    -  render_adornments args, lowrez_sprites
    -  render_storyline_dialog args, lowrez_labels, lowrez_sprites
     
    -  if args.state.background == 'sprites/tribute-game-over.png'
    -    lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]
    -    lowrez_labels << [9, 6, 'Return of', 255, 255, 255]
    -    lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]
    -    if !args.state.ended
    -      args.gtk.stop_music
    -      args.outputs.sounds << 'sounds/music-loop.ogg'
    -      args.state.ended = true
    -    end
    +  def calc_tongue_angle
    +    return unless state.anchor_point
    +    state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue
    +    state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)
    +    state.tongue_length = state.tongue_length.greater(100)
       end
    -end
     
    -def player_md_right args, x, y
    -  [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]
    -end
    +  def player_from_end_of_tongue
    +    p = state.tongue_angle.vector(state.tongue_length)
    +    derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]
    +    derived_start.x -= state.player_width.half
    +    derived_start.y -= state.player_height.half
    +    derived_start
    +  end
     
    -def player_md_left args, x, y
    -  [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]
    -end
    +  def end_of_tongue
    +    p = state.tongue_angle.vector(state.tongue_length)
    +    [start_of_tongue.x + p.x, start_of_tongue.y + p.y]
    +  end
     
    -def player_md_up args, x, y
    -  [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]
    -end
    +  def calc_shooting
    +    return unless state.action == :shooting
    +    state.tongue_length += 30
    +    potential_anchor = end_of_tongue
    +    if potential_anchor.x <= 0
    +      state.anchor_point = potential_anchor
    +      state.action = :anchored
    +      outputs.sounds << 'sounds/attached.wav'
    +    elsif potential_anchor.x >= 10000
    +      state.anchor_point = potential_anchor
    +      state.action = :anchored
    +      outputs.sounds << 'sounds/attached.wav'
    +    elsif potential_anchor.y <= 0
    +      state.anchor_point = potential_anchor
    +      state.action = :anchored
    +      outputs.sounds << 'sounds/attached.wav'
    +    elsif potential_anchor.y >= 5875
    +      state.anchor_point = potential_anchor
    +      state.action = :anchored
    +      outputs.sounds << 'sounds/attached.wav'
    +    else
    +      anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]
    +      collision = state.world_collision_rects.find_all do |v|
    +        [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)
    +      end.first
    +      if collision
    +        state.anchor_point = potential_anchor
    +        state.action = :anchored
    +      outputs.sounds << 'sounds/attached.wav'
    +      end
    +    end
    +  end
     
    -def player_md_down args, x, y
    -  [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]
    -end
    +  def calc_player
    +    calc_shooting
    +    if !state.god_mode
    +      state.dy += state.gravity  # Since acceleration is the change in velocity, the change in y (dy) increases every frame
    +      state.dx += state.dx * state.air
    +    end
    +    calc_pendulum
    +    calc_box_collision
    +    calc_edge_collision
    +    if !state.god_mode
    +      state.y  += state.dy
    +      state.x  += state.dx
    +    end
    +    calc_tongue_angle
    +  end
     
    -def player_sm args, x, y
    -  [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]
    -end
    +  def calc_box_collision
    +    return unless state.world_lookup.keys.length > 0
    +    collision_floor
    +    collision_left
    +    collision_right
    +    collision_ceiling
    +  end
     
    -def player_xs args, x, y
    -  [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]
    -end
    +  def calc_edge_collision
    +    # Ensures that player doesn't fall below the map
    +    if next_y < 0 && state.dy < 0
    +      state.y = 0
    +      state.dy = state.dy.abs * 0.8
    +      state.collision_on_y = true
    +    # Ensures player doesn't go insanely high
    +    elsif next_y > 5875 - state.tile_size && state.dy > 0
    +      state.y = 5875 - state.tile_size
    +      state.dy = state.dy.abs * 0.8 * -1
    +      state.collision_on_y = true
    +    end
     
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/repl.rb

    -
    puts $gtk.args.state.current_scene
    +    # Ensures that player remains in the horizontal range its supposed to
    +    if state.x >= 10000 - state.tile_size && state.dx > 0
    +      state.x = 10000 - state.tile_size
    +      state.dx = state.dx.abs * 0.8 * -1
    +      state.collision_on_x = true
    +    elsif state.x <= 0 && state.dx < 0
    +      state.x = 0
    +      state.dx = state.dx.abs * 0.8
    +      state.collision_on_x = true
    +    end
    +  end
     
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/require.rb

    -
    require 'app/lowrez_simulator.rb'
    -require 'app/storyline_day_one.rb'
    -require 'app/storyline_blinking_light.rb'
    -require 'app/storyline_serenity_introduction.rb'
    -require 'app/storyline_speed_of_light.rb'
    -require 'app/storyline_serenity_alive.rb'
    -require 'app/storyline_serenity_bio.rb'
    -require 'app/storyline_anka.rb'
    -require 'app/storyline_final_message.rb'
    -require 'app/storyline_final_decision.rb'
    -require 'app/storyline.rb'
    +  def next_y
    +    state.y + state.dy
    +  end
     
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline.rb

    -
    def hotspot_top
    -  [4, 61, 56, 3]
    -end
    +  def next_x
    +    if state.dx < 0
    +      return (state.x + state.dx) - (state.tile_size - state.player_width)
    +    else
    +      return (state.x + state.dx) + (state.tile_size - state.player_width)
    +    end
    +  end
     
    -def hotspot_bottom
    -  [4, 0, 56, 3]
    -end
    +  def collision_floor
    +    return unless state.dy <= 0
     
    -def hotspot_top_right
    -  [62, 35, 3, 25]
    -end
    +    player_rect = [state.x, next_y, state.tile_size, state.tile_size]
     
    -def hotspot_bottom_right
    -  [62, 0, 3, 25]
    -end
    +    # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)
    +    floor_collisions = state.world_collision_rects
    +                         .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }
    +                         .first
     
    -def storyline_history_include? args, text
    -  args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }
    -end
    +    return unless floor_collisions
    +    state.y = floor_collisions[:top].top
    +    state.dy = state.dy.abs * 0.8
    +  end
     
    -def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -end
    +  def collision_left
    +    return unless state.dx < 0
    +    player_rect = [next_x, state.y, state.tile_size, state.tile_size]
     
    -def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -end
    +    # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)
    +    left_side_collisions = state.world_collision_rects
    +                             .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
    +                             .first
     
    -def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -end
    +    return unless left_side_collisions
    +    state.x = left_side_collisions[:left_right].right
    +    state.dx = state.dy.abs * 0.8
    +    state.collision_on_x = true
    +  end
     
    -def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -end
    +  def collision_right
    +    return unless state.dx > 0
     
    -def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    -  lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -  lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    -end
    +    player_rect = [next_x, state.y, state.tile_size, state.tile_size]
    +    # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)
    +    right_side_collisions = state.world_collision_rects
    +                              .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
    +                              .first
     
    -def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []
    -  result_one_scene, result_one_label, result_one_text = context_result_one
    -  result_two_scene, result_two_label, result_two_text = context_result_two
    -  result_three_scene, result_three_label, result_three_text = context_result_three
    -  result_four_scene, result_four_label, result_four_text = context_result_four
    +    return unless right_side_collisions
    +    state.x = right_side_collisions[:left_right].left - state.tile_size
    +    state.dx = state.dx.abs * 0.8 * -1
    +    state.collision_on_x = true
    +  end
     
    -  top_level_hash = {
    -    background: 'sprites/decision.png',
    -    fade: 60,
    -    player: [20, 36],
    -    storylines: [ ],
    -    scenes: [ ]
    -  }
    +  def collision_ceiling
    +    return unless state.dy > 0
     
    -  confirmation_result_one_hash = {
    -    background: 'sprites/decision.png',
    -    scenes: [ ],
    -    storylines: [ ]
    -  }
    +    player_rect = [state.x, next_y, state.player_width, state.player_height]
     
    -  confirmation_result_two_hash = {
    -    background: 'sprites/decision.png',
    -    scenes: [ ],
    -    storylines: [ ]
    -  }
    +    # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)
    +    ceil_collisions = state.world_collision_rects
    +                        .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }
    +                        .first
     
    -  confirmation_result_three_hash = {
    -    background: 'sprites/decision.png',
    -    scenes: [ ],
    -    storylines: [ ]
    -  }
    +    return unless ceil_collisions
    +    state.y = ceil_collisions[:bottom].y - state.tile_size
    +    state.dy = state.dy.abs * 0.8 * -1
    +    state.collision_on_y = true
    +  end
     
    -  confirmation_result_four_hash = {
    -    background: 'sprites/decision.png',
    -    scenes: [ ],
    -    storylines: [ ]
    -  }
    -
    -  top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]
    -  top_level_hash[:storylines] << [20, 35, 4, 4, context_action]
    +  def to_coord point
    +    # Integer divides (idiv) point.x to turn into grid
    +    # Then, you can just multiply each integer by state.tile_size
    +    # later and huzzah. Grid coordinates
    +    [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]
    +  end
     
    -  confirmation_result_one_hash[:scenes]       << [20, 35, 4, 4, top_level_hash]
    -  confirmation_result_one_hash[:scenes]       << [60, 50, 4, 4, result_one_scene]
    -  confirmation_result_one_hash[:storylines]   << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]
    -  confirmation_result_one_hash[:scenes]       << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    -  confirmation_result_one_hash[:scenes]       << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    -  confirmation_result_one_hash[:scenes]       << [40, 20, 4, 4, confirmation_result_two_hash]
    +  def export_map
    +    export_string = state.world.map do |x, y|
    +      "#{x},#{y},1"
    +    end
    +    export_string += state.objects.map do |x, y, w, h, path|
    +      "#{x},#{y},2,#{w},#{h},#{path}"
    +    end
    +    gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))
    +    state.map_saved_at = state.tick_count
    +  end
     
    -  confirmation_result_two_hash[:scenes]       << [20, 35, 4, 4, top_level_hash]
    -  confirmation_result_two_hash[:scenes]       << [40, 50, 4, 4, confirmation_result_one_hash]
    -  confirmation_result_two_hash[:scenes]       << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    -  confirmation_result_two_hash[:scenes]       << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    -  confirmation_result_two_hash[:scenes]       << [60, 20, 4, 4, result_two_scene]
    -  confirmation_result_two_hash[:storylines]   << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]
    +  def inputs_export_stage
    +  end
     
    -  confirmation_result_three_hash[:scenes]     << [20, 35, 4, 4, top_level_hash]
    -  confirmation_result_three_hash[:scenes]     << [40, 50, 4, 4, confirmation_result_one_hash]
    -  confirmation_result_three_hash[:scenes]     << [40, 40, 4, 4, confirmation_result_four_hash]
    -  confirmation_result_three_hash[:scenes]     << [60, 30, 4, 4, result_three_scene]
    -  confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]
    -  confirmation_result_three_hash[:scenes]     << [40, 20, 4, 4, confirmation_result_two_hash]
    +  def calc_score
    +    return unless state.scene == :game
    +    player = [state.x, state.y, state.player_width, state.player_height]
    +    collected = state.objects.find_all { |s| s.intersect_rect? player }
    +    state.stuff_score += collected.length
    +    if collected.length > 0
    +      outputs.sounds << 'sounds/collectable.wav'
    +    end
    +    state.objects = state.objects.reject { |s| collected.include? s }
    +    state.stuff_time += 0.01
    +    if state.objects.length == 0
    +      if !state.stuff_best_time || state.stuff_time < state.stuff_best_time
    +        state.stuff_best_time = state.stuff_time
    +      end
    +      state.game_over_at = nil
    +      state.scene = :ending
    +    end
    +  end
     
    -  confirmation_result_four_hash[:scenes]      << [20, 35, 4, 4, top_level_hash]
    -  confirmation_result_four_hash[:scenes]      << [40, 50, 4, 4, confirmation_result_one_hash]
    -  confirmation_result_four_hash[:scenes]      << [60, 40, 4, 4, result_four_scene]
    -  confirmation_result_four_hash[:storylines]  << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]
    -  confirmation_result_four_hash[:scenes]      << [40, 30, 4, 4, confirmation_result_three_hash]
    -  confirmation_result_four_hash[:scenes]      << [40, 20, 4, 4, confirmation_result_two_hash]
    +  def calc_on_floor
    +    if state.action == :anchored
    +      state.on_floor = false
    +      state.on_floor_debounce = 30
    +    else
    +      state.on_floor_debounce ||= 30
     
    -  top_level_hash[:scenes]     << [40, 50, 4, 4, confirmation_result_one_hash]
    -  top_level_hash[:scenes]     << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    -  top_level_hash[:scenes]     << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    -  top_level_hash[:scenes]     << [40, 20, 4, 4, confirmation_result_two_hash]
    +      if state.dy.round != 0
    +        state.on_floor_debounce = 30
    +        state.on_floor = false
    +      else
    +        state.on_floor_debounce -= 1
    +      end
     
    -  top_level_hash
    -end
    +      if state.on_floor_debounce <= 0
    +        state.on_floor_debounce = 0
    +        state.on_floor = true
    +      end
    +    end
    +  end
     
    -def ship_control_hotspot offset_x, offset_y, a, b, c, d
    -  results = []
    -  results << [ 6 + offset_x, 0 + offset_y, 4, 4, a]  if a
    -  results << [ 1 + offset_x, 5 + offset_y, 4, 4, b]  if b
    -  results << [ 6 + offset_x, 5 + offset_y, 4, 4, c]  if c
    -  results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d
    -  results
    -end
    +  def render_player
    +    path = "sprites/square-green.png"
    +    angle = 0
    +    # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]
    +    if state.action == :idle
    +      # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]
    +      path = "sprites/square-green.png"
    +    elsif state.action == :aiming && !state.on_floor
    +      # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]
    +      angle = state.tongue_angle - 90
    +      path = "sprites/square-green.png"
    +    elsif state.action == :aiming # ON THE GROUND
    +      # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]
    +      path = "sprites/square-green.png"
    +    elsif state.action == :shooting && !state.on_floor
    +      # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]
    +      path = "sprites/square-green.png"
    +      angle = state.tongue_angle - 90
    +    elsif state.action == :shooting
    +      # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]
    +      path = "sprites/square-green.png"
    +    elsif state.action == :anchored
    +      # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]
    +      angle = state.tongue_angle - 90
    +      path = "sprites/square-green.png"
    +    end
     
    -def reload_current_scene
    -  if $gtk.args.state.last_hotspot_scene
    -    set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)
    -    tick $gtk.args
    -  elsif respond_to? :set_scene
    -    set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)
    -    tick $gtk.args
    +    outputs.sprites << [vx(state.x),
    +                        vy(state.y),
    +                        vw(state.player_width),
    +                        vh(state.player_height),
    +                        path,
    +                        angle]
       end
    -  $gtk.console.close
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb

    -
    def anka_inside_room args
    -  {
    -    background: 'sprites/inside-home.png',
    -    player: [34, 35],
    -    storylines: [
    -      [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],
    -    ],
    -    scenes: [
    -      [32, -1, 8, 3, :anka_observatory]
    -    ]
    -  }
    -end
     
    -def anka_observatory args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [51, 12],
    -    storylines: [
    -      [50, 10, 4, 4,   "Breathe, Hiro. Just see what's there... everything--- will- be okay."]
    -    ],
    -    scenes: [
    -      [30, 18, 5, 12, :anka_inside_mainframe]
    -    ],
    -    render_override: :blinking_light_inside_observatory_render
    -  }
    +  def render_player_old
    +    # Player
    +    if state.action == :aiming
    +      path = 'sprites\frg\idle\frog_idle.png'
    +      if state.dx > 2
    +	  #directional right sprite was here but i needa redo it
    +        path = 'sprites\frg\anchor\frog-anchor-0.png'
    +      #directional left sprite was here but i needa redo it
    +	  elsif state.dx < -2
    +        path = 'sprites\frg\anchor\frog-anchor-0.png'
    +      end
    +      outputs.sprites << [vx(state.x),
    +                          vy(state.y),
    +                          vw(state.player_width),
    +                          vh(state.player_height),
    +                          path,
    +                          (state.tongue_angle - 90)]
    +    elsif state.action == :anchored || state.action == :shooting
    +      outputs.sprites << [vx(state.x),
    +                          vy(state.y),
    +                          vw(state.player_width),
    +                          vw(state.player_height),
    +                          'sprites/animations_povfrog/frog_bwah_up.png',
    +                          (state.tongue_angle - 90)]
    +    end
    +  end
     end
     
    -def anka_inside_mainframe args
    -  {
    -    player: [32, 4],
    -    background: 'sprites/mainframe.png',
    -    fade: 60,
    -    storylines: [
    -      [22, 45, 17, 4, (anka_last_reply args)],
    -      [45, 45,  4, 4, (anka_current_reply args)],
    -    ],
    -    scenes: [
    -      [*hotspot_top_right, :reply_to_anka]
    -    ]
    -  }
    -end
     
    -def reply_to_anka args
    -  decision_graph anka_current_reply(args),
    -                 "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",
    -                 [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],
    -                 [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]
    -end
    +$game = CleptoFrog.new
     
    -def anka_last_reply args
    -  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    -    return "Buffer--: #{serenity_alive_firm_reply.quote}"
    -  else
    -    return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"
    +def tick args
    +  if args.state.scene == :game
    +    tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360
       end
    +  $game.args = args
    +  $game.tick
     end
     
    -def anka_reply_whole_truth
    -  "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."
    -end
    -
    -def anka_reply_half_truth
    -  "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."
    -end
    +def tick_instructions args, text, y = 715
    +  return if args.state.key_event_occurred
    +  if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space
    +    args.state.key_event_occurred = true
    +  end
     
    -def replied_with_whole_truth args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],
    -      [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],
    -    ]
    -  }
    -end
    -
    -def replied_with_half_truth args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],
    -      [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],
    -    ]
    -  }
    -end
    -
    -def anka_current_reply args
    -  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    -    return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."
    -  else
    -    return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."
    -  end
    -end
    -
    -def replied_to_anka_back_home args
    -  if args.state.scene_history.include? :replied_with_whole_truth
    -    return {
    -      fade: 60,
    -      background: 'sprites/inside-home.png',
    -      player: [34, 4],
    -      storylines: [
    -        [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],
    -      ],
    -      scenes: [
    -        [30, 38, 12, 13, :final_message_sad],
    -      ]
    -    }
    -  else
    -    return {
    -      fade: 60,
    -      background: 'sprites/inside-home.png',
    -      player: [34, 4],
    -      storylines: [
    -        [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],
    -      ],
    -      scenes: [
    -        [30, 38, 12, 13, :final_message_happy],
    -      ]
    -    }
    -  end
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb

    -
    def the_blinking_light args
    -  {
    -    fade: 60,
    -    background: 'sprites/side-of-home.png',
    -    player: [16, 13],
    -    scenes: [
    -      [52, 24, 11, 5, :blinking_light_mountain_pass],
    -    ],
    -    render_override: :blinking_light_side_of_home_render
    -  }
    -end
    -
    -def blinking_light_mountain_pass args
    -  {
    -    background: 'sprites/mountain-pass-zoomed-out.png',
    -    player: [4, 4],
    -    scenes: [
    -      [18, 47, 5, 5, :blinking_light_path_to_observatory]
    -    ],
    -    render_override: :blinking_light_mountain_pass_render
    -  }
    -end
    -
    -def blinking_light_path_to_observatory args
    -  {
    -    background: 'sprites/path-to-observatory.png',
    -    player: [60, 4],
    -    scenes: [
    -      [0, 26, 5, 5, :blinking_light_observatory]
    -    ],
    -    render_override: :blinking_light_path_to_observatory_render
    -  }
    -end
    -
    -def blinking_light_observatory args
    -  {
    -    background: 'sprites/observatory.png',
    -    player: [60, 2],
    -    scenes: [
    -      [28, 39, 4, 10, :blinking_light_inside_observatory]
    -    ],
    -    render_override: :blinking_light_observatory_render
    -  }
    -end
    -
    -def blinking_light_inside_observatory args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    player: [60, 2],
    -    storylines: [
    -      [50, 2, 4, 8,   "That's weird. I thought- this- mainframe-- was broken--."]
    -    ],
    -    scenes: [
    -      [30, 18, 5, 12, :blinking_light_inside_mainframe]
    -    ],
    -    render_override: :blinking_light_inside_observatory_render
    -  }
    -end
    -
    -def blinking_light_inside_mainframe args
    -  {
    -    background: 'sprites/mainframe.png',
    -    fade: 60,
    -    player: [30, 4],
    -    scenes: [
    -      [62, 32, 4, 32, :reply_to_introduction]
    -    ],
    -    storylines: [
    -      [43, 43,  8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],
    -      [30, 30,  4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],
    -      [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],
    -      [14, 20, 24, 4, "What the heck activated--- this thing- though?"]
    -    ]
    -  }
    +  args.outputs.debug << [0, y - 50, 1280, 60].solid
    +  args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label
    +  args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label
     end
     
     
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb

    -
    def day_one_beginning args
    -  {
    -    background: 'sprites/side-of-home.png',
    -    player: [16, 13],
    -    scenes: [
    -      [0, 0, 64, 2, :day_one_infront_of_home],
    -    ],
    -    storylines: [
    -      [35, 10, 6, 6,  "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]
    -    ]
    -  }
    -end
    -
    -def day_one_infront_of_home args
    -  {
    -    background: 'sprites/front-of-home.png',
    -    player: [56, 23],
    -    scenes: [
    -      [43, 34, 10, 16, :day_one_home],
    -      [62, 0,  3, 40, :day_one_beginning],
    -      [0, 4, 3, 20, :day_one_ceremony]
    -    ],
    -    storylines: [
    -      [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],
    -    ]
    -  }
    -end
    -
    -def day_one_home args
    -  {
    -    background: 'sprites/inside-home.png',
    -    player: [34, 3],
    -    scenes: [
    -      [28, 0, 12, 2, :day_one_infront_of_home]
    -    ],
    -    storylines: [
    -      [
    -        38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."
    -      ],
    -      [
    -        28, 7, 4, 7,
    -        "Ahhh. My reading- couch. It's so comfortable--."
    -      ],
    -      [
    -        38, 21, 4, 4,
    -        "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."
    -      ],
    -      [
    -        45, 37, 4, 8,
    -        "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."
    -      ],
    -      [
    -        32, 40, 8, 10,
    -        "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."
    -      ],
    -      [
    -        25, 21, 5, 12,
    -        "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."
    -      ]
    -    ]
    -  }
    -end
    -
    -def day_one_ceremony args
    -  {
    -    background: 'sprites/tribute.png',
    -    player: [57, 21],
    -    scenes: [
    -      [62, 0, 2, 40, :day_one_infront_of_home],
    -      [0, 24, 2, 40, :day_one_infront_of_library]
    -    ],
    -    storylines: [
    -      [53, 12, 3,  8,  "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],
    -      [45, 12, 3,  8,  "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],
    -      [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],
    -      [15, 12, 3,  8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],
    -    ]
    -  }
    -end
    -
    -def day_one_infront_of_library args
    -  {
    -    background: 'sprites/outside-library.png',
    -    player: [57, 21],
    -    scenes: [
    -      [62, 0, 2, 40, :day_one_ceremony],
    -      [49, 39, 6, 9, :day_one_library]
    -    ],
    -    storylines: [
    -      [50, 20, 4, 8,  "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]
    -    ]
    -  }
    -end
    -
    -def day_one_library args
    -  {
    -    background: 'sprites/library.png',
    -    player: [27, 4],
    -    scenes: [
    -      [0, 0, 64, 2, :end_day_one_infront_of_library]
    -    ],
    -    storylines: [
    -      [28, 22, 8, 4,  "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],
    -      [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]
    -    ]
    -  }
    -end
    -
    -def end_day_one_infront_of_library args
    -  {
    -    background: 'sprites/outside-library.png',
    -    player: [51, 33],
    -    scenes: [
    -      [49, 39, 6, 9, :day_one_library],
    -      [62, 0, 2, 40, :end_day_one_monument],
    -    ],
    -    storylines: [
    -      [50, 27, 4, 4, "It's getting late. Better get some sleep."]
    -    ]
    -  }
    -end
    -
    -def end_day_one_monument args
    -  {
    -    background: 'sprites/tribute.png',
    -    player: [2, 36],
    -    scenes: [
    -      [62, 0, 2, 40, :end_day_one_infront_of_home],
    -    ],
    -    storylines: [
    -      [50, 27, 4, 4, "It's getting late. Better get some sleep."],
    -    ]
    -  }
    -end
    -
    -def end_day_one_infront_of_home args
    -  {
    -    background: 'sprites/front-of-home.png',
    -    player: [1, 17],
    -    scenes: [
    -      [43, 34, 10, 16, :end_day_one_home],
    -    ],
    -    storylines: [
    -      [20, 10, 4, 4, "It's getting late. Better get some sleep."],
    -    ]
    -  }
    -end
    -
    -def end_day_one_home args
    -  {
    -    background: 'sprites/inside-home.png',
    -    player: [34, 3],
    -    scenes: [
    -      [32, 40, 8, 10, :end_day_one_dream],
    -    ],
    -    storylines: [
    -      [38, 4, 4, 4, "It's getting late. Better get some sleep."],
    -    ]
    -  }
    -end
    -
    -def end_day_one_dream args
    -  {
    -    background: 'sprites/dream.png',
    -    fade: 60,
    -    player: [4, 4],
    -    scenes: [
    -      [62, 0, 2, 64, :explaining_the_special_power]
    -    ],
    -    storylines: [
    -      [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],
    -      [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],
    -      [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]
    -    ]
    -  }
    -end
    -
    -def explaining_the_special_power args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    player: [32, 30],
    -    scenes: [
    -      [
    -        38, 21, 4, 4, :explaining_the_special_power_inside_computer
    -      ],
    -    ]
    -  }
    -end
    -
    -def explaining_the_special_power_inside_computer args
    -  {
    -    background: 'sprites/pc.png',
    -    fade: 60,
    -    player: [34, 4],
    -    scenes: [
    -      [0, 62, 64, 3, :the_blinking_light]
    -    ],
    -    storylines: [
    -      [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],
    -      [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],
    -      [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],
    -      [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]
    -    ]
    -  }
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb

    -
    def final_decision_side_of_home args
    -  {
    -    fade: 120,
    -    background: 'sprites/side-of-home.png',
    -    player: [16, 13],
    -    scenes: [
    -      [52, 24, 11, 5, :final_decision_mountain_pass],
    -    ],
    -    render_override: :blinking_light_side_of_home_render,
    -    storylines: [
    -      [28, 13, 8, 4,  "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]
    -    ]
    -  }
    -end
    -
    -def final_decision_mountain_pass args
    -  {
    -    background: 'sprites/mountain-pass-zoomed-out.png',
    -    player: [4, 4],
    -    scenes: [
    -      [18, 47, 5, 5, :final_decision_path_to_observatory]
    -    ],
    -    render_override: :blinking_light_mountain_pass_render
    -  }
    -end
    -
    -def final_decision_path_to_observatory args
    -  {
    -    background: 'sprites/path-to-observatory.png',
    -    player: [60, 4],
    -    scenes: [
    -      [0, 26, 5, 5, :final_decision_observatory]
    -    ],
    -    render_override: :blinking_light_path_to_observatory_render
    -  }
    -end
    -
    -def final_decision_observatory args
    -  {
    -    background: 'sprites/observatory.png',
    -    player: [60, 2],
    -    scenes: [
    -      [28, 39, 4, 10, :final_decision_inside_observatory]
    -    ],
    -    render_override: :blinking_light_observatory_render
    -  }
    -end
    -
    -def final_decision_inside_observatory args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    player: [60, 2],
    -    storylines: [],
    -    scenes: [
    -      [30, 18, 5, 12, :final_decision_inside_mainframe]
    -    ],
    -    render_override: :blinking_light_inside_observatory_render
    -  }
    -end
    -
    -def final_decision_inside_mainframe args
    -  {
    -    player: [32, 4],
    -    background: 'sprites/mainframe.png',
    -    storylines: [],
    -    scenes: [
    -      [*hotspot_top, :final_decision_ship_status],
    -    ]
    -  }
    -end
    -
    -def final_decision_ship_status args
    -  {
    -    background: 'sprites/serenity.png',
    -    fade: 60,
    -    player: [30, 10],
    -    scenes: [
    -      [*hotspot_top_right, :final_decision]
    -    ],
    -    storylines: [
    -      [30,  8, 4, 4, "????"],
    -      *final_decision_ship_status_shared(args)
    -    ]
    -  }
    -end
    -
    -def final_decision args
    -  decision_graph  "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",
    -                  "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",
    -                  [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],
    -                  [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],
    -                  [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],
    -                  [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]
    -end
    -
    -def final_decision_game_over_noone args
    -  {
    -    background: 'sprites/tribute-game-over.png',
    -    player: [53, 14],
    -    fade: 600
    -  }
    -end
    -
    -def final_decision_game_over_matthew args
    -  {
    -    background: 'sprites/tribute-game-over.png',
    -    player: [53, 14],
    -    fade: 600
    -  }
    -end
    -
    -def final_decision_game_over_anka args
    -  {
    -    background: 'sprites/tribute-game-over.png',
    -    player: [53, 14],
    -    fade: 600
    -  }
    -end
    -
    -def final_decision_game_over_sasha args
    -  {
    -    background: 'sprites/tribute-game-over.png',
    -    player: [53, 14],
    -    fade: 600
    -  }
    -end
    -
    -def final_decision_ship_status_shared args
    -  [
    -    *ship_control_hotspot(24, 22,
    -                           "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",
    -                           "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",
    -                           "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION.  WHAT?! NO!",
    -                           "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),
    -  ]
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb

    -
    def final_message_sad args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    player: [34, 35],
    -    storylines: [
    -      [34, 34, 4, 4, "Another-- sleepless-- night..."],
    -    ],
    -    scenes: [
    -      [32, -1, 8, 3, :final_message_observatory]
    -    ]
    -  }
    -end
    -
    -def final_message_happy args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    player: [34, 35],
    -    storylines: [
    -      [34, 34, 4, 4, "Oh man, I slept like rock!"],
    -    ],
    -    scenes: [
    -      [32, -1, 8, 3, :final_message_observatory]
    -    ]
    -  }
    -end
    -
    -def final_message_side_of_home args
    -  {
    -    fade: 60,
    -    background: 'sprites/side-of-home.png',
    -    player: [16, 13],
    -    scenes: [
    -      [52, 24, 11, 5, :final_message_mountain_pass],
    -    ],
    -    render_override: :blinking_light_side_of_home_render
    -  }
    -end
    -
    -def final_message_mountain_pass args
    -  {
    -    background: 'sprites/mountain-pass-zoomed-out.png',
    -    player: [4, 4],
    -    scenes: [
    -      [18, 47, 5, 5, :final_message_path_to_observatory],
    -    ],
    -    storylines: [
    -      [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]
    -    ],
    -    render_override: :blinking_light_mountain_pass_render
    -  }
    -end
    -
    -def final_message_path_to_observatory args
    -  {
    -    background: 'sprites/path-to-observatory.png',
    -    player: [60, 4],
    -    scenes: [
    -      [0, 26, 5, 5, :final_message_observatory]
    -    ],
    -    storylines: [
    -      [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]
    -    ],
    -    render_override: :blinking_light_path_to_observatory_render
    -  }
    -end
    -
    -def final_message_observatory args
    -  if args.state.scene_history.include? :replied_with_whole_truth
    -    return {
    -      background: 'sprites/inside-observatory.png',
    -      fade: 60,
    -      player: [51, 12],
    -      storylines: [
    -        [50, 10, 4, 4, "Here-- we- go..."]
    -      ],
    -      scenes: [
    -        [30, 18, 5, 12, :final_message_inside_mainframe]
    -      ],
    -      render_override: :blinking_light_inside_observatory_render
    -    }
    -  else
    -    return {
    -      background: 'sprites/inside-observatory.png',
    -      fade: 60,
    -      player: [51, 12],
    -      storylines: [
    -        [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]
    -      ],
    -      scenes: [
    -        [30, 18, 5, 12, :final_message_inside_mainframe]
    -      ],
    -      render_override: :blinking_light_inside_observatory_render
    -    }
    -  end
    -end
    -
    -def final_message_inside_mainframe args
    -  {
    -    player: [32, 4],
    -    background: 'sprites/mainframe.png',
    -    fade: 60,
    -    scenes: [[45, 45,  4, 4, :final_message_check_ship_status]]
    -  }
    -end
    -
    -def final_message_check_ship_status args
    -  {
    -    background: 'sprites/mainframe.png',
    -    storylines: [
    -      [45, 45, 4, 4, (final_message_current args)],
    -    ],
    -    scenes: [
    -      [*hotspot_top, :final_message_ship_status],
    -    ]
    -  }
    -end
    -
    -def final_message_ship_status args
    -  {
    -    background: 'sprites/serenity.png',
    -    fade: 60,
    -    player: [30, 10],
    -    scenes: [
    -      [30, 50, 4, 4, :final_message_ship_status_reviewed]
    -    ],
    -    storylines: [
    -      [30,  8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],
    -      *final_message_ship_status_shared(args)
    -    ]
    -  }
    -end
    -
    -def final_message_ship_status_reviewed args
    -  {
    -    background: 'sprites/serenity.png',
    -    fade: 60,
    -    scenes: [
    -      [*hotspot_bottom, :final_message_summary]
    -    ],
    -    storylines: [
    -      [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],
    -    ]
    -  }
    -end
    -
    -def final_message_ship_status_shared args
    -  [
    -    *ship_control_hotspot( 0, 50,
    -                           "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",
    -                           "Matthew's--- Chamber--: OCCUPIED----",
    -                           "Aanka's--- Chamber--: OCCUPIED----",
    -                           "Sasha's--- Chamber--: OCCUPIED----"),
    -    *ship_control_hotspot(12, 35,
    -                          "Life- Support--: Not-- Needed---",
    -                          "O2--- Production---: OFF---",
    -                          "CO2--- Scrubbers---: OFF---",
    -                          "H2O--- Production---: OFF---"),
    -    *ship_control_hotspot(24, 20,
    -                          "Navigation: Offline---",
    -                          "Sensor: OFF---",
    -                          "Heads- Up- Display: DAMAGED---",
    -                          "Arithmetic--- Unit: DAMAGED----"),
    -    *ship_control_hotspot(36, 35,
    -                          "COMM: Underpowered----",
    -                          "Text: ON---",
    -                          "Audio: SEGFAULT---",
    -                          "Video: DAMAGED---"),
    -    *ship_control_hotspot(48, 50,
    -                          "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",
    -                          "Engine I: ON---",
    -                          "Engine II: ON---",
    -                          "Engine III: ON---")
    -  ]
    -end
    -
    -def final_message_last_reply args
    -  if args.state.scene_history.include? :replied_with_whole_truth
    -    return "Buffer--: #{anka_reply_whole_truth.quote}"
    -  else
    -    return "Buffer--: #{anka_reply_half_truth.quote}"
    -  end
    -end
    -
    -def final_message_current args
    -  if args.state.scene_history.include? :replied_with_whole_truth
    -    return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."
    -  else
    -    return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"
    -  end
    -end
    -
    -def final_message_summary args
    -  if args.state.scene_history.include? :replied_with_whole_truth
    -    return {
    -      background: 'sprites/inside-observatory.png',
    -      fade: 60,
    -      player: [31, 11],
    -      scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],
    -      storylines: [
    -        [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],
    -      ]
    -    }
    -  else
    -    return {
    -      background: 'sprites/inside-observatory.png',
    -      fade: 60,
    -      player: [31, 11],
    -      scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],
    -      storylines: [
    -        [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],
    -      ]
    -    }
    -  end
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb

    -
    def serenity_alive_side_of_home args
    -  {
    -    fade: 60,
    -    background: 'sprites/side-of-home.png',
    -    player: [16, 13],
    -    scenes: [
    -      [52, 24, 11, 5, :serenity_alive_mountain_pass],
    -    ],
    -    render_override: :blinking_light_side_of_home_render
    -  }
    -end
    -
    -def serenity_alive_mountain_pass args
    -  {
    -    background: 'sprites/mountain-pass-zoomed-out.png',
    -    player: [4, 4],
    -    scenes: [
    -      [18, 47, 5, 5, :serenity_alive_path_to_observatory],
    -    ],
    -    storylines: [
    -      [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]
    -    ],
    -    render_override: :blinking_light_mountain_pass_render
    -  }
    -end
    -
    -def serenity_alive_path_to_observatory args
    -  {
    -    background: 'sprites/path-to-observatory.png',
    -    player: [60, 4],
    -    scenes: [
    -      [0, 26, 5, 5, :serenity_alive_observatory]
    -    ],
    -    storylines: [
    -      [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]
    -    ],
    -    render_override: :blinking_light_path_to_observatory_render
    -  }
    -end
    -
    -def serenity_alive_observatory args
    -  {
    -    background: 'sprites/observatory.png',
    -    player: [60, 2],
    -    scenes: [
    -      [28, 39, 4, 10, :serenity_alive_inside_observatory]
    -    ],
    -    render_override: :blinking_light_observatory_render
    -  }
    -end
    -
    -def serenity_alive_inside_observatory args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    player: [60, 2],
    -    storylines: [],
    -    scenes: [
    -      [30, 18, 5, 12, :serenity_alive_inside_mainframe]
    -    ],
    -    render_override: :blinking_light_inside_observatory_render
    -  }
    -end
    -
    -def serenity_alive_inside_mainframe args
    -  {
    -    background: 'sprites/mainframe.png',
    -    fade: 60,
    -    player: [30, 4],
    -    scenes: [
    -      [*hotspot_top, :serenity_alive_ship_status],
    -    ],
    -    storylines: [
    -      [22, 45, 17, 4, (serenity_alive_last_reply args)],
    -      [45, 45,  4, 4, (serenity_alive_current_message args)],
    -    ]
    -  }
    -end
    -
    -def serenity_alive_ship_status args
    -  {
    -    background: 'sprites/serenity.png',
    -    fade: 60,
    -    player: [30, 10],
    -    scenes: [
    -      [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]
    -    ],
    -    storylines: [
    -      [30,  8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],
    -      [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],
    -      *serenity_alive_shared_ship_status(args)
    -    ]
    -  }
    -end
    -
    -def serenity_alive_ship_status_reviewed args
    -  {
    -    background: 'sprites/serenity.png',
    -    fade: 60,
    -    scenes: [
    -      [*hotspot_bottom, :serenity_alive_time_to_reply]
    -    ],
    -    storylines: [
    -      [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],
    -    ]
    -  }
    -end
    -
    -def serenity_alive_time_to_reply args
    -  decision_graph serenity_alive_current_message(args),
    -                  "Okay... time to deliver the bad news...",
    -                  [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],
    -                  [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]
    -end
    -
    -def serenity_alive_shared_ship_status args
    -  [
    -    *ship_control_hotspot( 0, 50,
    -                           "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",
    -                           nil,
    -                           nil,
    -                           nil),
    -    *ship_control_hotspot(12, 35,
    -                          "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",
    -                          nil,
    -                          nil,
    -                          nil),
    -    *ship_control_hotspot(24, 20,
    -                          "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",
    -                          nil,
    -                          nil,
    -                          nil),
    -    *ship_control_hotspot(36, 35,
    -                          "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",
    -                          nil,
    -                          nil,
    -                          nil),
    -    *ship_control_hotspot(48, 50,
    -                          "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",
    -                          nil,
    -                          nil,
    -                          nil)
    -  ]
    -end
    -
    -def serenity_alive_firm_reply
    -  "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."
    -end
    -
    -def serenity_alive_sugarcoated_reply
    -  "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."
    -end
    -
    -def replied_to_serenity_alive_firmly args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [
    -      [*hotspot_bottom_right, :serenity_alive_path_from_observatory]
    -    ],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],
    -      *serenity_alive_reply_completed_shared_hotspots(args),
    -    ]
    -  }
    -end
    -
    -def replied_to_serenity_alive_kindly args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [
    -      [*hotspot_bottom_right, :serenity_alive_path_from_observatory]
    -    ],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],
    -      *serenity_alive_reply_completed_shared_hotspots(args),
    -    ]
    -  }
    -end
    -
    -def serenity_alive_path_from_observatory args
    -  {
    -    fade: 60,
    -    background: 'sprites/path-to-observatory.png',
    -    player: [4, 21],
    -    scenes: [
    -      [*hotspot_bottom_right, :serenity_bio_infront_of_home]
    -    ],
    -    storylines: [
    -      [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]
    -    ]
    -  }
    -end
    -
    -def serenity_alive_reply_completed_shared_hotspots args
    -  [
    -    [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],
    -    [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],
    -    [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]
    -  ]
    -end
    -
    -def serenity_alive_last_reply args
    -  if args.state.scene_history.include? :replied_to_introduction_seriously
    -    return "Buffer--: \"Hello, Who- is sending-- this message--?\""
    -  else
    -    return "Buffer--: \"New- phone. Who dis?\""
    -  end
    -end
    -
    -def serenity_alive_current_message args
    -  if args.state.scene_history.include? :replied_to_introduction_seriously
    -    "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote
    -  else
    -    "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote
    -  end
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb

    -
    def serenity_bio_infront_of_home args
    -  {
    -    fade: 60,
    -    background: 'sprites/front-of-home.png',
    -    player: [54, 23],
    -    scenes: [
    -      [44, 34, 8, 14, :serenity_bio_inside_home],
    -      [0, 3, 3, 22, :serenity_bio_library]
    -    ]
    -  }
    -end
    -
    -def serenity_bio_inside_home args
    -  {
    -    background: 'sprites/inside-home.png',
    -    player: [34, 4],
    -    storylines: [
    -      [34, 4, 4, 4, "I'm--- completely--- exhausted."],
    -    ],
    -    scenes: [
    -      [30, 38, 12, 13, :serenity_bio_restless_sleep],
    -      [32, 0, 8, 3, :serenity_bio_infront_of_home],
    -    ]
    -  }
    -end
    -
    -def serenity_bio_restless_sleep args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    storylines: [
    -      [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],
    -    ],
    -    scenes: [
    -      [32, 0, 8, 3, :serenity_bio_infront_of_home],
    -    ]
    -  }
    -end
    -
    -def serenity_bio_library args
    -  {
    -    background: 'sprites/library.png',
    -    fade: 60,
    -    player: [30, 7],
    -    scenes: [
    -      [21, 35, 3, 18, :serenity_bio_book]
    -    ]
    -  }
    -end
    -
    -def serenity_bio_book args
    -  {
    -    background: 'sprites/book.png',
    -    fade: 60,
    -    player: [6, 52],
    -    storylines: [
    -      [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],
    -
    -      [ 4, 38,  8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],
    -      [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],
    -
    -      [4,  26,  8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],
    -      [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],
    -
    -      [4,  14,  8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],
    -      [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],
    -    ],
    -    scenes: [
    -      [*hotspot_bottom, :serenity_bio_finally_to_bed]
    -    ]
    -  }
    -end
    -
    -def serenity_bio_finally_to_bed args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    player: [35, 3],
    -    storylines: [
    -      [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],
    -    ],
    -    scenes: [
    -      [32, 38, 10, 13, :bad_dream],
    -    ]
    -  }
    -end
    -
    -def bad_dream args
    -  {
    -    fade: 120,
    -    background: 'sprites/inside-home.png',
    -    player: [34, 35],
    -    storylines: [
    -      [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],
    -    ],
    -    scenes: [
    -      [32, -1, 8, 3, :bad_dream_observatory]
    -    ]
    -  }
    -end
    -
    -def bad_dream_observatory args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 120,
    -    player: [51, 12],
    -    storylines: [
    -      [50, 10, 4, 4,   "Breathe, Hiro. Just see what's there... everything--- will- be okay."]
    -    ],
    -    scenes: [
    -      [30, 18, 5, 12, :bad_dream_inside_mainframe]
    -    ],
    -    render_override: :blinking_light_inside_observatory_render
    -  }
    -end
    -
    -def bad_dream_inside_mainframe args
    -  {
    -    player: [32, 4],
    -    background: 'sprites/mainframe.png',
    -    fade: 120,
    -    storylines: [
    -      [22, 45, 17, 4, (bad_dream_last_reply args)],
    -    ],
    -    scenes: [
    -      [45, 45,  4, 4, :bad_dream_everyone_dead],
    -    ]
    -  }
    -end
    -
    -def bad_dream_everyone_dead args
    -  {
    -    background: 'sprites/mainframe.png',
    -    storylines: [
    -      [22, 45, 17, 4, (bad_dream_last_reply args)],
    -      [45, 45,  4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],
    -      [22,  5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],
    -    ],
    -    scenes: [
    -      [*hotspot_bottom, :anka_inside_room]
    -    ]
    -  }
    -end
    -
    -def bad_dream_last_reply args
    -  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    -    return "Buffer--: #{serenity_alive_firm_reply.quote}"
    -  else
    -    return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"
    -  end
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb

    -
    # decision_graph "Message from Sasha",
    -#                "I should reply.",
    -#                [:replied_to_introduction_seriously,  "Reply Seriously", "Who is this?"],
    -# [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]
    -def reply_to_introduction args
    -  decision_graph  "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",
    -                  "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",
    -                  [:replied_to_introduction_seriously,  "Serious Reply",  "Hello, Who- is sending-- this message--?"],
    -                  [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]
    -end
    -
    -def replied_to_introduction_seriously args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [
    -      *replied_to_introduction_shared_scenes(args)
    -    ],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],
    -      *replied_to_introduction_shared_storylines(args)
    -    ]
    -  }
    -end
    -
    -def replied_to_introduction_humorously args
    -  {
    -    background: 'sprites/inside-observatory.png',
    -    fade: 60,
    -    player: [32, 21],
    -    scenes: [
    -      *replied_to_introduction_shared_scenes(args)
    -    ],
    -    storylines: [
    -      [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],
    -      *replied_to_introduction_shared_storylines(args)
    -    ]
    -  }
    -end
    -
    -def replied_to_introduction_shared_storylines args
    -  [
    -    [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],
    -    [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],
    -    [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]
    -  ]
    -end
    -
    -def replied_to_introduction_shared_scenes args
    -  [[60, 0, 4, 32, :replied_to_introduction_observatory]]
    -end
    -
    -def replied_to_introduction_observatory args
    -  {
    -    background: 'sprites/observatory.png',
    -    player: [28, 39],
    -    scenes: [
    -      [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]
    -    ]
    -  }
    -end
    -
    -def replied_to_introduction_path_to_observatory args
    -  {
    -    background: 'sprites/path-to-observatory.png',
    -    player: [0, 26],
    -    scenes: [
    -      [60, 0, 4, 20, :replied_to_introduction_mountain_pass]
    -    ],
    -  }
    -end
    -
    -def replied_to_introduction_mountain_pass args
    -  {
    -    background: 'sprites/mountain-pass-zoomed-out.png',
    -    player: [21, 48],
    -    scenes: [
    -      [0, 0, 15, 4, :replied_to_introduction_side_of_home]
    -    ],
    -    storylines: [
    -      [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]
    -    ]
    -  }
    -end
    -
    -def replied_to_introduction_side_of_home args
    -  {
    -    background: 'sprites/side-of-home.png',
    -    player: [58, 29],
    -    scenes: [
    -      [2, 0, 61, 2, :speed_of_light_front_of_home]
    -    ],
    -  }
    -end
    -
    -
    -

    99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb

    -
    def speed_of_light_front_of_home args
    -  {
    -    background: 'sprites/front-of-home.png',
    -    player: [54, 23],
    -    scenes: [
    -      [44, 34, 8, 14, :speed_of_light_inside_home],
    -      [0, 3, 3, 22, :speed_of_light_outside_library]
    -    ]
    -  }
    -end
    -
    -def speed_of_light_inside_home args
    -  {
    -    background: 'sprites/inside-home.png',
    -    player: [35, 4],
    -    storylines: [
    -      [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]
    -    ],
    -    scenes: [
    -      [32, 0, 8, 3, :speed_of_light_front_of_home],
    -    ]
    -  }
    -end
    -
    -def speed_of_light_outside_library args
    -  {
    -    background: 'sprites/outside-library.png',
    -    player: [55, 19],
    -    scenes: [
    -      [49, 39, 6, 10, :speed_of_light_library],
    -      [61, 11, 3, 20, :speed_of_light_front_of_home]
    -    ]
    -  }
    -end
    -
    -def speed_of_light_library args
    -  {
    -    background: 'sprites/library.png',
    -    player: [30, 7],
    -    scenes: [
    -      [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]
    -    ]
    -  }
    -end
    -
    -def speed_of_light_celestial_bodies_diagram args
    -  {
    -    background: 'sprites/planets.png',
    -    fade: 60,
    -    player: [30, 3],
    -    scenes: [
    -      [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]
    -    ],
    -    storylines: [
    -      [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],
    -
    -      [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],
    -      [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],
    -      [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],
    -      [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],
    -      [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],
    -      [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],
    -      [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],
    -      [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],
    -      # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],
    -      [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],
    -    ]
    -  }
    -end
    -
    -def speed_of_light_distance_discovered args
    -  {
    -    background: 'sprites/planets.png',
    -    scenes: [
    -      [13, 0, 44, 3, :speed_of_light_end_of_day]
    -    ],
    -    storylines: [
    -      [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],
    -      [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],
    -      [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],
    -      [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],
    -      [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],
    -      [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],
    -      [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],
    -      [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],
    -      [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],
    -      [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],
    -    ]
    -  }
    -end
    -
    -def speed_of_light_end_of_day args
    -  {
    -    fade: 60,
    -    background: 'sprites/inside-home.png',
    -    player: [35, 0],
    -    storylines: [
    -      [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]
    -    ],
    -    scenes: [
    -      [31, 38, 10, 12, :serenity_alive_side_of_home]
    -    ]
    -  }
    -end
    -
    -
    -

    99_genre_platformer/clepto_frog/app/main.rb

    -
    MAP_FILE_PATH = 'app/map.txt'
    -
    -require 'app/map.rb'
    -
    -class CleptoFrog
    -  attr_gtk
    -
    -  def render_ending
    -    state.game_over_at ||= state.tick_count
    -
    -    outputs.labels << [640, 700, "Clepto Frog", 4, 1]
    -
    -    if state.tick_count >= (state.game_over_at + 120)
    -      outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",
    -                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]
    -    end
    -
    -    if state.tick_count >= (state.game_over_at + 240)
    -      outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",
    -                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]
    -    end
    -
    -    if state.tick_count >= (state.game_over_at + 360)
    -      outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",
    -                         4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]
    -    end
    -
    -    outputs.sprites << [640 - 50, 360 - 50, 100, 100,
    -                        "sprites/square-green.png"]
    -
    -    outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]
    -    outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]
    -
    -    if state.tick_count >= (state.game_over_at + 550)
    -      restart_game
    -    end
    -  end
    -
    -  def restart_game
    -    state.world = nil
    -    state.x = nil
    -    state.y = nil
    -    state.dx = nil
    -    state.dy = nil
    -    state.stuff_score = 0
    -    state.stuff_time = 0
    -    state.intro_tick_count = nil
    -    defaults
    -    state.game_start_at = state.tick_count
    -    state.scene = :game
    -    state.game_over_at = nil
    -  end
    -
    -  def render_intro
    -    outputs.labels << [640, 700, "Clepto Frog", 4, 1]
    -    if state.tick_count >= 120
    -      outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",
    -                         4, 1, 0, 0, 0, 255 * 120.ease(60)]
    -    end
    -
    -    if state.tick_count >= 240
    -      outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",
    -                         4, 1, 0, 0, 0, 255 * 240.ease(60)]
    -    end
    -
    -    if state.tick_count >= 360
    -      outputs.labels << [640, 540, "\"Uh...\" - New Guy",
    -                         4, 1, 0, 0, 0, 255 * 360.ease(60)]
    -    end
    -
    -    if state.tick_count >= 480
    -      outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",
    -                         4, 1, 0, 0, 0, 255 * 480.ease(60)]
    -    end
    -
    -    if state.tick_count >= 600
    -      outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",
    -                         4, 1, 0, 0, 0, 255 * 600.ease(60)]
    -    end
    -
    -    outputs.sprites << [640 - 50, 360 - 50, 100, 100,
    -                        "sprites/square-green.png"]
    -
    -    if state.tick_count == 800
    -      state.scene = :game
    -      state.game_start_at = state.tick_count
    -    end
    -  end
    -
    -  def tick
    -    defaults
    -    if state.scene == :intro && state.tick_count <= 800
    -      render_intro
    -    elsif state.scene == :ending
    -      render_ending
    -    else
    -      render
    -    end
    -    calc
    -    process_inputs
    -  end
    -
    -  def defaults
    -    state.scene ||= :intro
    -    state.stuff_score     ||= 0
    -    state.stuff_time      ||= 0
    -    state.stuff_best_time ||= nil
    -    state.camera_x ||= 0
    -    state.camera_y ||= 0
    -    state.target_camera_scale ||= 1
    -    state.camera_scale ||= 1
    -    state.tongue_length          ||= 100
    -    state.dev_action             ||= :collision_mode
    -    state.action                 ||= :aiming
    -    state.tongue_angle           ||= 90
    -    state.tile_size                = 64
    -    state.gravity                  = -0.1
    -    state.air                      = -0.01
    -    state.player_width             = 60
    -    state.player_height            = 60
    -    state.collision_tolerance      = 0.0
    -    state.previous_tile_size     ||= state.tile_size
    -    state.x                      ||= 2400
    -    state.y                      ||= 200
    -    state.dy                     ||= 0
    -    state.dx                     ||= 0
    -    attempt_load_world_from_file
    -    state.world_lookup           ||= { }
    -    state.world_collision_rects  ||= []
    -    state.mode                   ||= :creating
    -    state.select_menu            ||= [0, 720, 1280, 720]
    -    state.sprite_quantity        ||= 20
    -    state.sprite_coords          ||= []
    -    state.banner_coords          ||= [640, 680 + 720]
    -    state.sprite_selected        ||= 1
    -    state.map_saved_at           ||= 0
    -    state.intro_tick_count       ||= state.tick_count
    -    if state.sprite_coords == []
    -      count = 1
    -      temp_x = 165
    -      temp_y = 500 + 720
    -      state.sprite_quantity.times do
    -        state.sprite_coords += [[temp_x, temp_y, count]]
    -        temp_x += 100
    -        count += 1
    -        if temp_x > 1280 - (165 + 50)
    -          temp_x = 165
    -          temp_y -= 75
    -        end
    -      end
    -    end
    -  end
    -
    -  def start_of_tongue x = nil, y = nil
    -    x ||= state.x
    -    y ||= state.y
    -    [
    -      x + state.player_width.half,
    -      y + state.player_height.half
    -    ]
    -  end
    -
    -  def stage_definition
    -    outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']
    -  end
    -
    -  def render
    -    stage_definition
    -    start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]
    -    end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]
    -
    -    if state.anchor_point
    -      anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]
    -      outputs.sprites << { x: start_of_tongue_render.x,
    -                           y: start_of_tongue_render.y,
    -                           w: vw(2),
    -                           h: args.geometry.distance(start_of_tongue_render, anchor_point_render),
    -                           path:  'sprites/square-pink.png',
    -                           angle_anchor_y: 0,
    -                           angle: state.tongue_angle - 90 }
    -    else
    -      outputs.sprites << { x: vx(start_of_tongue.x),
    -                           y: vy(start_of_tongue.y),
    -                           w: vw(2),
    -                           h: vh(state.tongue_length),
    -                           path:  'sprites/square-pink.png',
    -                           angle_anchor_y: 0,
    -                           angle: state.tongue_angle - 90 }
    -    end
    -
    -    outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }
    -
    -    if state.god_mode
    -      # SHOW HIDE COLLISIONS
    -      outputs.sprites << state.world.map do |x, y, w, h|
    -        x = vx(x)
    -        y = vy(y)
    -        if x > -80 && x < 1280 && y > -80 && y < 720
    -          {
    -            x: x,
    -            y: y,
    -            w: vw(w || state.tile_size),
    -            h: vh(h || state.tile_size),
    -            path: 'sprites/square-gray.png',
    -            a: 128
    -          }
    -        end
    -      end
    -    end
    -
    -    render_player
    -    outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]
    -
    -    # Label in top left of the screen
    -    outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid
    -    outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label
    -    outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label
    -
    -    if state.god_mode
    -      if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120
    -        outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label
    -      end
    -
    -
    -      # Creates sprite following mouse to help indicate which sprite you have selected
    -      outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,
    -                             state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite
    -    end
    -
    -    render_mini_map
    -    outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid
    -  end
    -
    -  def render_mini_map
    -    x, y = 1170, 10
    -    outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid
    -    outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid
    -    t_start = start_of_tongue
    -    t_end = end_of_tongue
    -    outputs.primitives << [
    -      x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),
    -      x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),
    -      255, 255, 255
    -    ].line
    -
    -    state.objects.each do |o|
    -      outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid
    -    end
    -  end
    -
    -  def calc_camera percentage_override = nil
    -    percentage = percentage_override || (0.2 * state.camera_scale)
    -    target_scale = state.target_camera_scale
    -    distance_scale = target_scale - state.camera_scale
    -    state.camera_scale += distance_scale * percentage
    -
    -    target_x = state.x * state.target_camera_scale
    -    target_y = state.y * state.target_camera_scale
    -
    -    distance_x = target_x - (state.camera_x + 640)
    -    distance_y = target_y - (state.camera_y + 360)
    -    state.camera_x += distance_x * percentage if distance_x.abs > 1
    -    state.camera_y += distance_y * percentage if distance_y.abs > 1
    -    state.camera_x = 0 if state.camera_x < 0
    -    state.camera_y = 0 if state.camera_y < 0
    -  end
    -
    -  def vx x
    -     (x * state.camera_scale) - state.camera_x
    -  end
    -
    -  def vy y
    -    (y * state.camera_scale) - state.camera_y
    -  end
    -
    -  def vw w
    -    w * state.camera_scale
    -  end
    -
    -  def vh h
    -    h * state.camera_scale
    -  end
    -
    -  def calc
    -    calc_camera
    -    calc_world_lookup
    -    calc_player
    -    calc_on_floor
    -    calc_score
    -  end
    -
    -  def set_camera_scale v = nil
    -    return if v < 0.1
    -    state.target_camera_scale = v
    -  end
    -
    -  def process_inputs_god_mode
    -    return unless state.god_mode
    -
    -    if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))
    -      set_camera_scale state.camera_scale + 0.1
    -    elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))
    -      set_camera_scale state.camera_scale - 0.1
    -    elsif inputs.keyboard.eight || inputs.keyboard.zero
    -      set_camera_scale 1
    -    end
    -
    -    if input_up?
    -      state.y += 10
    -      state.dy = 0
    -    elsif input_down?
    -      state.y -= 10
    -      state.dy = 0
    -    end
    -
    -    if input_left?
    -      state.x -= 10
    -      state.dx = 0
    -    elsif input_right?
    -      state.x += 10
    -      state.dx = 0
    -    end
    -  end
    -
    -  def process_inputs
    -    if state.scene == :game
    -      process_inputs_player_movement
    -      process_inputs_god_mode
    -    elsif state.scene == :intro
    -      if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space
    -        if Kernel.tick_count < 600
    -          Kernel.tick_count = 600
    -        end
    -      end
    -    end
    -  end
    -
    -  def input_up?
    -    inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k
    -  end
    -
    -  def input_up_released?
    -    inputs.keyboard.key_up.w ||
    -    inputs.keyboard.key_up.up ||
    -    inputs.keyboard.key_up.k
    -  end
    -
    -  def input_down?
    -    inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j
    -  end
    -
    -  def input_down_released?
    -    inputs.keyboard.key_up.s ||
    -    inputs.keyboard.key_up.down ||
    -    inputs.keyboard.key_up.j
    -  end
    -
    -  def input_left?
    -    inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h
    -  end
    -
    -  def input_right?
    -    inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l
    -  end
    -
    -  def set_object path, w, h
    -    state.object = path
    -    state.object_w = w
    -    state.object_h = h
    -  end
    -
    -  def collision_mode
    -    state.dev_action = :collision_mode
    -  end
    -
    -  def process_inputs_player_movement
    -    if inputs.keyboard.key_down.g
    -      state.god_mode = !state.god_mode
    -      puts state.god_mode
    -    end
    -
    -    if inputs.keyboard.key_down.u && state.dev_action == :collision_mode
    -      state.world = state.world[0..-2]
    -      state.world_lookup = {}
    -    end
    -
    -    if inputs.keyboard.key_down.space && !state.anchor_point
    -      state.tongue_length = 0
    -      state.action = :shooting
    -      outputs.sounds << 'sounds/shooting.wav'
    -    elsif inputs.keyboard.key_down.space
    -      state.action = :aiming
    -      state.anchor_point  = nil
    -      state.tongue_length = 100
    -    end
    -
    -    if state.anchor_point
    -      if input_up?
    -        if state.tongue_length >= 105
    -          state.tongue_length -= 5
    -          state.dy += 0.8
    -        end
    -      elsif input_down?
    -        state.tongue_length += 5
    -        state.dy -= 0.8
    -      end
    -
    -      if input_left? && state.dx > 1
    -        state.dx *= 0.98
    -      elsif input_left? && state.dx < -1
    -        state.dx *= 1.03
    -      elsif input_left? && !state.on_floor
    -        state.dx -= 3
    -      elsif input_right? && state.dx > 1
    -        state.dx *= 1.03
    -      elsif input_right? && state.dx < -1
    -        state.dx *= 0.98
    -      elsif input_right? && !state.on_floor
    -        state.dx += 3
    -      end
    -    else
    -      if input_left?
    -        state.tongue_angle += 1.5
    -        state.tongue_angle = state.tongue_angle
    -      elsif input_right?
    -        state.tongue_angle -= 1.5
    -        state.tongue_angle = state.tongue_angle
    -      end
    -    end
    -  end
    -
    -  def add_floors
    -    # floors
    -    state.world += [
    -      [0,       0, 10000, 40],
    -      [0,    1670, 3250, 60],
    -      [6691, 1653, 3290, 60],
    -      [1521, 3792, 7370, 60],
    -      [0, 5137, 3290, 60]
    -    ]
    -  end
    -
    -  def attempt_load_world_from_file
    -    return if state.world
    -    # exported_world = gtk.read_file(MAP_FILE_PATH)
    -    state.world = []
    -    state.objects = []
    -
    -    if $collisions
    -      $collisions.map do |x, y, w, h|
    -        state.world << [x, y, w, h]
    -      end
    -
    -      add_floors
    -    # elsif exported_world
    -    #   exported_world.each_line.map do |l|
    -    #     tokens = l.strip.split(',')
    -    #     x    = tokens[0].to_i
    -    #     y    = tokens[1].to_i
    -    #     type = tokens[2].to_i
    -    #     if type == 1
    -    #       state.world << [x, y, state.tile_size, state.tile_size]
    -    #     elsif type == 2
    -    #       w, h, path = tokens[3..-1]
    -    #       state.objects << [x, y, w.to_i, h.to_i, path]
    -    #     end
    -    #   end
    -
    -    #   add_floors
    -    end
    -
    -    if $mugs
    -      $mugs.map do |x, y, w, h, path|
    -        state.objects << [x, y, w, h, path]
    -      end
    -    end
    -  end
    -
    -  def calc_world_lookup
    -    if state.tile_size != state.previous_tile_size
    -      state.previous_tile_size = state.tile_size
    -      state.world_lookup = {}
    -    end
    -
    -    return if state.world_lookup.keys.length > 0
    -    return unless state.world.length > 0
    -
    -    # Searches through the world and finds the cordinates that exist
    -    state.world_lookup = {}
    -    state.world.each do |x, y, w, h|
    -      state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true
    -    end
    -
    -    # Assigns collision rects for every sprite drawn
    -    state.world_collision_rects =
    -      state.world_lookup
    -           .keys
    -           .map do |x, y, w, h|
    -             s = state.tile_size
    -             w ||= s
    -             h ||= s
    -             {
    -               args:       [x, y, w, h],
    -               left_right: [x,     y + 4, w,     h - 6],
    -               top:        [x + 4, y + 6, w - 8, h - 6],
    -               bottom:     [x + 1, y - 1, w - 2, h - 8],
    -             }
    -           end
    -
    -  end
    -
    -  def calc_pendulum
    -    return if !state.anchor_point
    -    target_x = state.anchor_point.x - start_of_tongue.x
    -    target_y = state.anchor_point.y -
    -               state.tongue_length - 5 - 20 - state.player_height
    -
    -    diff_y = state.y - target_y
    -
    -    if target_x > 0
    -      state.dx += 0.6
    -    elsif target_x < 0
    -      state.dx -= 0.6
    -    end
    -
    -    if diff_y > 0
    -      state.dy -= 0.1
    -    elsif diff_y < 0
    -      state.dy += 0.1
    -    end
    -
    -    state.dx *= 0.99
    -
    -    if state.dy.abs < 2
    -      state.dy *= 0.8
    -    else
    -      state.dy *= 0.90
    -    end
    -
    -    if state.tongue_length && state.y
    -      state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)
    -    end
    -  end
    -
    -  def calc_tongue_angle
    -    return unless state.anchor_point
    -    state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue
    -    state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)
    -    state.tongue_length = state.tongue_length.greater(100)
    -  end
    -
    -  def player_from_end_of_tongue
    -    p = state.tongue_angle.vector(state.tongue_length)
    -    derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]
    -    derived_start.x -= state.player_width.half
    -    derived_start.y -= state.player_height.half
    -    derived_start
    -  end
    -
    -  def end_of_tongue
    -    p = state.tongue_angle.vector(state.tongue_length)
    -    [start_of_tongue.x + p.x, start_of_tongue.y + p.y]
    -  end
    -
    -  def calc_shooting
    -    return unless state.action == :shooting
    -    state.tongue_length += 30
    -    potential_anchor = end_of_tongue
    -    if potential_anchor.x <= 0
    -      state.anchor_point = potential_anchor
    -      state.action = :anchored
    -      outputs.sounds << 'sounds/attached.wav'
    -    elsif potential_anchor.x >= 10000
    -      state.anchor_point = potential_anchor
    -      state.action = :anchored
    -      outputs.sounds << 'sounds/attached.wav'
    -    elsif potential_anchor.y <= 0
    -      state.anchor_point = potential_anchor
    -      state.action = :anchored
    -      outputs.sounds << 'sounds/attached.wav'
    -    elsif potential_anchor.y >= 5875
    -      state.anchor_point = potential_anchor
    -      state.action = :anchored
    -      outputs.sounds << 'sounds/attached.wav'
    -    else
    -      anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]
    -      collision = state.world_collision_rects.find_all do |v|
    -        [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)
    -      end.first
    -      if collision
    -        state.anchor_point = potential_anchor
    -        state.action = :anchored
    -      outputs.sounds << 'sounds/attached.wav'
    -      end
    -    end
    -  end
    -
    -  def calc_player
    -    calc_shooting
    -    if !state.god_mode
    -      state.dy += state.gravity  # Since acceleration is the change in velocity, the change in y (dy) increases every frame
    -      state.dx += state.dx * state.air
    -    end
    -    calc_pendulum
    -    calc_box_collision
    -    calc_edge_collision
    -    if !state.god_mode
    -      state.y  += state.dy
    -      state.x  += state.dx
    -    end
    -    calc_tongue_angle
    -  end
    -
    -  def calc_box_collision
    -    return unless state.world_lookup.keys.length > 0
    -    collision_floor
    -    collision_left
    -    collision_right
    -    collision_ceiling
    -  end
    -
    -  def calc_edge_collision
    -    # Ensures that player doesn't fall below the map
    -    if next_y < 0 && state.dy < 0
    -      state.y = 0
    -      state.dy = state.dy.abs * 0.8
    -      state.collision_on_y = true
    -    # Ensures player doesn't go insanely high
    -    elsif next_y > 5875 - state.tile_size && state.dy > 0
    -      state.y = 5875 - state.tile_size
    -      state.dy = state.dy.abs * 0.8 * -1
    -      state.collision_on_y = true
    -    end
    -
    -    # Ensures that player remains in the horizontal range its supposed to
    -    if state.x >= 10000 - state.tile_size && state.dx > 0
    -      state.x = 10000 - state.tile_size
    -      state.dx = state.dx.abs * 0.8 * -1
    -      state.collision_on_x = true
    -    elsif state.x <= 0 && state.dx < 0
    -      state.x = 0
    -      state.dx = state.dx.abs * 0.8
    -      state.collision_on_x = true
    -    end
    -  end
    -
    -  def next_y
    -    state.y + state.dy
    -  end
    -
    -  def next_x
    -    if state.dx < 0
    -      return (state.x + state.dx) - (state.tile_size - state.player_width)
    -    else
    -      return (state.x + state.dx) + (state.tile_size - state.player_width)
    -    end
    -  end
    -
    -  def collision_floor
    -    return unless state.dy <= 0
    -
    -    player_rect = [state.x, next_y, state.tile_size, state.tile_size]
    -
    -    # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)
    -    floor_collisions = state.world_collision_rects
    -                         .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }
    -                         .first
    -
    -    return unless floor_collisions
    -    state.y = floor_collisions[:top].top
    -    state.dy = state.dy.abs * 0.8
    -  end
    -
    -  def collision_left
    -    return unless state.dx < 0
    -    player_rect = [next_x, state.y, state.tile_size, state.tile_size]
    -
    -    # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)
    -    left_side_collisions = state.world_collision_rects
    -                             .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
    -                             .first
    -
    -    return unless left_side_collisions
    -    state.x = left_side_collisions[:left_right].right
    -    state.dx = state.dy.abs * 0.8
    -    state.collision_on_x = true
    -  end
    -
    -  def collision_right
    -    return unless state.dx > 0
    -
    -    player_rect = [next_x, state.y, state.tile_size, state.tile_size]
    -    # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)
    -    right_side_collisions = state.world_collision_rects
    -                              .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
    -                              .first
    -
    -    return unless right_side_collisions
    -    state.x = right_side_collisions[:left_right].left - state.tile_size
    -    state.dx = state.dx.abs * 0.8 * -1
    -    state.collision_on_x = true
    -  end
    -
    -  def collision_ceiling
    -    return unless state.dy > 0
    -
    -    player_rect = [state.x, next_y, state.player_width, state.player_height]
    -
    -    # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)
    -    ceil_collisions = state.world_collision_rects
    -                        .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }
    -                        .first
    -
    -    return unless ceil_collisions
    -    state.y = ceil_collisions[:bottom].y - state.tile_size
    -    state.dy = state.dy.abs * 0.8 * -1
    -    state.collision_on_y = true
    -  end
    -
    -  def to_coord point
    -    # Integer divides (idiv) point.x to turn into grid
    -    # Then, you can just multiply each integer by state.tile_size
    -    # later and huzzah. Grid coordinates
    -    [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]
    -  end
    -
    -  def export_map
    -    export_string = state.world.map do |x, y|
    -      "#{x},#{y},1"
    -    end
    -    export_string += state.objects.map do |x, y, w, h, path|
    -      "#{x},#{y},2,#{w},#{h},#{path}"
    -    end
    -    gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))
    -    state.map_saved_at = state.tick_count
    -  end
    -
    -  def inputs_export_stage
    -  end
    -
    -  def calc_score
    -    return unless state.scene == :game
    -    player = [state.x, state.y, state.player_width, state.player_height]
    -    collected = state.objects.find_all { |s| s.intersect_rect? player }
    -    state.stuff_score += collected.length
    -    if collected.length > 0
    -      outputs.sounds << 'sounds/collectable.wav'
    -    end
    -    state.objects = state.objects.reject { |s| collected.include? s }
    -    state.stuff_time += 0.01
    -    if state.objects.length == 0
    -      if !state.stuff_best_time || state.stuff_time < state.stuff_best_time
    -        state.stuff_best_time = state.stuff_time
    -      end
    -      state.game_over_at = nil
    -      state.scene = :ending
    -    end
    -  end
    -
    -  def calc_on_floor
    -    if state.action == :anchored
    -      state.on_floor = false
    -      state.on_floor_debounce = 30
    -    else
    -      state.on_floor_debounce ||= 30
    -
    -      if state.dy.round != 0
    -        state.on_floor_debounce = 30
    -        state.on_floor = false
    -      else
    -        state.on_floor_debounce -= 1
    -      end
    -
    -      if state.on_floor_debounce <= 0
    -        state.on_floor_debounce = 0
    -        state.on_floor = true
    -      end
    -    end
    -  end
    -
    -  def render_player
    -    path = "sprites/square-green.png"
    -    angle = 0
    -    # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]
    -    if state.action == :idle
    -      # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]
    -      path = "sprites/square-green.png"
    -    elsif state.action == :aiming && !state.on_floor
    -      # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]
    -      angle = state.tongue_angle - 90
    -      path = "sprites/square-green.png"
    -    elsif state.action == :aiming # ON THE GROUND
    -      # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]
    -      path = "sprites/square-green.png"
    -    elsif state.action == :shooting && !state.on_floor
    -      # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]
    -      path = "sprites/square-green.png"
    -      angle = state.tongue_angle - 90
    -    elsif state.action == :shooting
    -      # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]
    -      path = "sprites/square-green.png"
    -    elsif state.action == :anchored
    -      # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]
    -      angle = state.tongue_angle - 90
    -      path = "sprites/square-green.png"
    -    end
    -
    -    outputs.sprites << [vx(state.x),
    -                        vy(state.y),
    -                        vw(state.player_width),
    -                        vh(state.player_height),
    -                        path,
    -                        angle]
    -  end
    -
    -  def render_player_old
    -    # Player
    -    if state.action == :aiming
    -      path = 'sprites\frg\idle\frog_idle.png'
    -      if state.dx > 2
    -	  #directional right sprite was here but i needa redo it
    -        path = 'sprites\frg\anchor\frog-anchor-0.png'
    -      #directional left sprite was here but i needa redo it
    -	  elsif state.dx < -2
    -        path = 'sprites\frg\anchor\frog-anchor-0.png'
    -      end
    -      outputs.sprites << [vx(state.x),
    -                          vy(state.y),
    -                          vw(state.player_width),
    -                          vh(state.player_height),
    -                          path,
    -                          (state.tongue_angle - 90)]
    -    elsif state.action == :anchored || state.action == :shooting
    -      outputs.sprites << [vx(state.x),
    -                          vy(state.y),
    -                          vw(state.player_width),
    -                          vw(state.player_height),
    -                          'sprites/animations_povfrog/frog_bwah_up.png',
    -                          (state.tongue_angle - 90)]
    -    end
    -  end
    -end
    -
    -
    -$game = CleptoFrog.new
    -
    -def tick args
    -  if args.state.scene == :game
    -    tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360
    -  end
    -  $game.args = args
    -  $game.tick
    -end
    -
    -def tick_instructions args, text, y = 715
    -  return if args.state.key_event_occurred
    -  if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space
    -    args.state.key_event_occurred = true
    -  end
    -
    -  args.outputs.debug << [0, y - 50, 1280, 60].solid
    -  args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label
    -  args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label
    -end
    -
    -
    -

    99_genre_platformer/clepto_frog/app/map.rb

    -
    $collisions = [
    +

    Platformer - Clepto Frog - map.rb

    +
    # ./samples/99_genre_platformer/clepto_frog/app/map.rb
    +$collisions = [
       [326, 463, 64, 64],
       [274, 462, 64, 64],
       [326, 413, 64, 64],
    @@ -16511,1353 +15057,5372 @@ end
       [39, 5217, 64, 64],
     ]
     
    -$mugs = [
    -  [85, 87, 39, 43, "sprites/square-orange.png"],
    -  [958, 1967, 39, 43, "sprites/square-orange.png"],
    -  [2537, 1734, 39, 43, "sprites/square-orange.png"],
    -  [3755, 2464, 39, 43, "sprites/square-orange.png"],
    -  [1548, 3273, 39, 43, "sprites/square-orange.png"],
    -  [2050, 220, 39, 43, "sprites/square-orange.png"],
    -  [854, 297, 39, 43, "sprites/square-orange.png"],
    -  [343, 526, 39, 43, "sprites/square-orange.png"],
    -  [3454, 772, 39, 43, "sprites/square-orange.png"],
    -  [5041, 298, 39, 43, "sprites/square-orange.png"],
    -  [6089, 300, 39, 43, "sprites/square-orange.png"],
    -  [6518, 295, 39, 43, "sprites/square-orange.png"],
    -  [7661, 47, 39, 43, "sprites/square-orange.png"],
    -  [9392, 1125, 39, 43, "sprites/square-orange.png"],
    -  [7298, 1152, 39, 43, "sprites/square-orange.png"],
    -  [5816, 1843, 39, 43, "sprites/square-orange.png"],
    -  [876, 3772, 39, 43, "sprites/square-orange.png"],
    -  [1029, 4667, 39, 43, "sprites/square-orange.png"],
    -  [823, 5324, 39, 43, "sprites/square-orange.png"],
    -  [3251, 5220, 39, 43, "sprites/square-orange.png"],
    -  [4747, 5282, 39, 43, "sprites/square-orange.png"],
    -  [9325, 5178, 39, 43, "sprites/square-orange.png"],
    -  [9635, 4298, 39, 43, "sprites/square-orange.png"],
    -  [7837, 4127, 39, 43, "sprites/square-orange.png"],
    -  [8651, 1971, 39, 43, "sprites/square-orange.png"],
    -  [6892, 2031, 39, 43, "sprites/square-orange.png"],
    -  [4626, 3882, 39, 43, "sprites/square-orange.png"],
    -  [4024, 4554, 39, 43, "sprites/square-orange.png"],
    -  [3925, 3337, 39, 43, "sprites/square-orange.png"],
    -  [5064, 1064, 39, 43, "sprites/square-orange.png"]
    -]
    +$mugs = [
    +  [85, 87, 39, 43, "sprites/square-orange.png"],
    +  [958, 1967, 39, 43, "sprites/square-orange.png"],
    +  [2537, 1734, 39, 43, "sprites/square-orange.png"],
    +  [3755, 2464, 39, 43, "sprites/square-orange.png"],
    +  [1548, 3273, 39, 43, "sprites/square-orange.png"],
    +  [2050, 220, 39, 43, "sprites/square-orange.png"],
    +  [854, 297, 39, 43, "sprites/square-orange.png"],
    +  [343, 526, 39, 43, "sprites/square-orange.png"],
    +  [3454, 772, 39, 43, "sprites/square-orange.png"],
    +  [5041, 298, 39, 43, "sprites/square-orange.png"],
    +  [6089, 300, 39, 43, "sprites/square-orange.png"],
    +  [6518, 295, 39, 43, "sprites/square-orange.png"],
    +  [7661, 47, 39, 43, "sprites/square-orange.png"],
    +  [9392, 1125, 39, 43, "sprites/square-orange.png"],
    +  [7298, 1152, 39, 43, "sprites/square-orange.png"],
    +  [5816, 1843, 39, 43, "sprites/square-orange.png"],
    +  [876, 3772, 39, 43, "sprites/square-orange.png"],
    +  [1029, 4667, 39, 43, "sprites/square-orange.png"],
    +  [823, 5324, 39, 43, "sprites/square-orange.png"],
    +  [3251, 5220, 39, 43, "sprites/square-orange.png"],
    +  [4747, 5282, 39, 43, "sprites/square-orange.png"],
    +  [9325, 5178, 39, 43, "sprites/square-orange.png"],
    +  [9635, 4298, 39, 43, "sprites/square-orange.png"],
    +  [7837, 4127, 39, 43, "sprites/square-orange.png"],
    +  [8651, 1971, 39, 43, "sprites/square-orange.png"],
    +  [6892, 2031, 39, 43, "sprites/square-orange.png"],
    +  [4626, 3882, 39, 43, "sprites/square-orange.png"],
    +  [4024, 4554, 39, 43, "sprites/square-orange.png"],
    +  [3925, 3337, 39, 43, "sprites/square-orange.png"],
    +  [5064, 1064, 39, 43, "sprites/square-orange.png"]
    +]
    +
    +
    +

    Platformer - Gorillas Basic - credits.txt

    +
    # ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt
    +code: Amir Rajan, https://twitter.com/amirrajan
    +graphics: Nick Culbertson, https://twitter.com/MobyPixel
    +
    +
    +
    +

    Platformer - Gorillas Basic - main.rb

    +
    # ./samples/99_genre_platformer/gorillas_basic/app/main.rb
    +class YouSoBasicGorillas
    +  attr_accessor :outputs, :grid, :state, :inputs
    +
    +  def tick
    +    defaults
    +    render
    +    calc
    +    process_inputs
    +  end
    +
    +  def defaults
    +    outputs.background_color = [33, 32, 87]
    +    state.building_spacing       = 1
    +    state.building_room_spacing  = 15
    +    state.building_room_width    = 10
    +    state.building_room_height   = 15
    +    state.building_heights       = [4, 4, 6, 8, 15, 20, 18]
    +    state.building_room_sizes    = [5, 4, 6, 7]
    +    state.gravity                = 0.25
    +    state.first_strike         ||= :player_1
    +    state.buildings            ||= []
    +    state.holes                ||= []
    +    state.player_1_score       ||= 0
    +    state.player_2_score       ||= 0
    +    state.wind                 ||= 0
    +  end
    +
    +  def render
    +    render_stage
    +    render_value_insertion
    +    render_gorillas
    +    render_holes
    +    render_banana
    +    render_game_over
    +    render_score
    +    render_wind
    +  end
    +
    +  def render_score
    +    outputs.primitives << [0, 0, 1280, 31, fancy_white].solid
    +    outputs.primitives << [1, 1, 1279, 29].solid
    +    outputs.labels << [  10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]
    +    outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]
    +  end
    +
    +  def render_wind
    +    outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid
    +    outputs.lines     <<  [640, 30, 640, 0, fancy_white]
    +  end
    +
    +  def render_game_over
    +    return unless state.over
    +    outputs.primitives << [grid.rect, 0, 0, 0, 200].solid
    +    outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label
    +    if state.winner == :player_1
    +      outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label
    +    else
    +      outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label
    +    end
    +  end
    +
    +  def render_stage
    +    return unless state.stage_generated
    +    return if state.stage_rendered
    +
    +    outputs.static_solids << [grid.rect, 33, 32, 87]
    +    outputs.static_solids << state.buildings.map(&:solids)
    +    state.stage_rendered = true
    +  end
    +
    +  def render_gorilla gorilla, id
    +    return unless gorilla
    +    if state.banana && state.banana.owner == gorilla
    +      animation_index  = state.banana.created_at.frame_index(3, 5, false)
    +    end
    +    if !animation_index
    +      outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]
    +    else
    +      outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]
    +    end
    +  end
    +
    +  def render_gorillas
    +    render_gorilla state.player_1, :left
    +    render_gorilla state.player_2, :right
    +  end
    +
    +  def render_value_insertion
    +    return if state.banana
    +    return if state.over
    +
    +    if    state.current_turn == :player_1_angle
    +      outputs.labels << [  10, 710, "Angle:    #{state.player_1_angle}_",    fancy_white]
    +    elsif state.current_turn == :player_1_velocity
    +      outputs.labels << [  10, 710, "Angle:    #{state.player_1_angle}",     fancy_white]
    +      outputs.labels << [  10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]
    +    elsif state.current_turn == :player_2_angle
    +      outputs.labels << [1120, 710, "Angle:    #{state.player_2_angle}_",    fancy_white]
    +    elsif state.current_turn == :player_2_velocity
    +      outputs.labels << [1120, 710, "Angle:    #{state.player_2_angle}",     fancy_white]
    +      outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]
    +    end
    +  end
    +
    +  def render_banana
    +    return unless state.banana
    +    rotation = state.tick_count.%(360) * 20
    +    rotation *= -1 if state.banana.dx > 0
    +    outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]
    +  end
    +
    +  def render_holes
    +    outputs.sprites << state.holes.map do |s|
    +      animation_index = s.created_at.frame_index(7, 3, false)
    +      if animation_index
    +        [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]
    +      else
    +        s.sprite
    +      end
    +    end
    +  end
    +
    +  def calc
    +    calc_generate_stage
    +    calc_current_turn
    +    calc_banana
    +  end
    +
    +  def calc_current_turn
    +    return if state.current_turn
    +
    +    state.current_turn = :player_1_angle
    +    state.current_turn = :player_2_angle if state.first_strike == :player_2
    +  end
    +
    +  def calc_generate_stage
    +    return if state.stage_generated
    +
    +    state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)
    +    8.numbers.inject(state.buildings) do |buildings, i|
    +      buildings <<
    +        building_prefab(state.building_spacing +
    +                        state.buildings.last.right,
    +                        *random_building_size)
    +    end
    +
    +    building_two = state.buildings[1]
    +    state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),
    +                               building_two.h)
    +
    +    building_nine = state.buildings[-3]
    +    state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),
    +                               building_nine.h)
    +    state.stage_generated = true
    +    state.wind = 1.randomize(:ratio, :sign)
    +  end
    +
    +  def new_player x, y
    +    state.new_entity(:gorilla) do |p|
    +      p.x = x - 25
    +      p.y = y
    +      p.solid = [p.x, p.y, 50, 50]
    +    end
    +  end
    +
    +  def calc_banana
    +    return unless state.banana
    +
    +    state.banana.x  += state.banana.dx
    +    state.banana.dx += state.wind.fdiv(50)
    +    state.banana.y  += state.banana.dy
    +    state.banana.dy -= state.gravity
    +    banana_collision = [state.banana.x, state.banana.y, 10, 10]
    +
    +    if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)
    +      state.over = true
    +      if state.banana.owner == state.player_2
    +        state.winner = :player_2
    +      else
    +        state.winner = :player_1
    +      end
    +
    +      state.player_2_score += 1
    +    elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)
    +      state.over = true
    +      if state.banana.owner == state.player_2
    +        state.winner = :player_1
    +      else
    +        state.winner = :player_2
    +      end
    +      state.player_1_score += 1
    +    end
    +
    +    if state.over
    +      place_hole
    +      return
    +    end
    +
    +    return if state.holes.any? do |h|
    +      h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]
    +    end
    +
    +    return unless state.banana.y < 0 || state.buildings.any? do |b|
    +      b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]
    +    end
    +
    +    place_hole
    +  end
    +
    +  def place_hole
    +    return unless state.banana
    +
    +    state.holes << state.new_entity(:banana) do |b|
    +      b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']
    +    end
    +
    +    state.banana = nil
    +  end
    +
    +  def process_inputs_main
    +    return if state.banana
    +    return if state.over
    +
    +    if inputs.keyboard.key_down.enter
    +      input_execute_turn
    +    elsif inputs.keyboard.key_down.backspace
    +      state.as_hash[state.current_turn] ||= ""
    +      state.as_hash[state.current_turn]   = state.as_hash[state.current_turn][0..-2]
    +    elsif inputs.keyboard.key_down.char
    +      state.as_hash[state.current_turn] ||= ""
    +      state.as_hash[state.current_turn]  += inputs.keyboard.key_down.char
    +    end
    +  end
    +
    +  def process_inputs_game_over
    +    return unless state.over
    +    return unless inputs.keyboard.key_down.truthy_keys.any?
    +    state.over = false
    +    outputs.static_solids.clear
    +    state.buildings.clear
    +    state.holes.clear
    +    state.stage_generated = false
    +    state.stage_rendered = false
    +    if state.first_strike == :player_1
    +      state.first_strike = :player_2
    +    else
    +      state.first_strike = :player_1
    +    end
    +  end
    +
    +  def process_inputs
    +    process_inputs_main
    +    process_inputs_game_over
    +  end
    +
    +  def input_execute_turn
    +    return if state.banana
    +
    +    if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)
    +      state.current_turn = :player_1_velocity
    +    elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)
    +      state.current_turn = :player_2_angle
    +      state.banana =
    +        new_banana(state.player_1,
    +                   state.player_1.x + 25,
    +                   state.player_1.y + 60,
    +                   state.player_1_angle,
    +                   state.player_1_velocity)
    +    elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)
    +      state.current_turn = :player_2_velocity
    +    elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)
    +      state.current_turn = :player_1_angle
    +      state.banana =
    +        new_banana(state.player_2,
    +                   state.player_2.x + 25,
    +                   state.player_2.y + 60,
    +                   180 - state.player_2_angle,
    +                   state.player_2_velocity)
    +    end
    +
    +    if state.banana
    +      state.player_1_angle = nil
    +      state.player_1_velocity = nil
    +      state.player_2_angle = nil
    +      state.player_2_velocity = nil
    +    end
    +  end
    +
    +  def random_building_size
    +    [state.building_heights.sample, state.building_room_sizes.sample]
    +  end
    +
    +  def int? v
    +    v.to_i.to_s == v.to_s
    +  end
    +
    +  def random_building_color
    +    [[ 99,   0, 107],
    +     [ 35,  64, 124],
    +     [ 35, 136, 162],
    +     ].sample
    +  end
    +
    +  def random_window_color
    +    [[ 88,  62, 104],
    +     [253, 224, 187]].sample
    +  end
    +
    +  def windows_for_building starting_x, floors, rooms
    +    floors.-(1).combinations(rooms - 1).map do |floor, room|
    +      [starting_x +
    +       state.building_room_width.*(room) +
    +       state.building_room_spacing.*(room + 1),
    +       state.building_room_height.*(floor) +
    +       state.building_room_spacing.*(floor + 1),
    +       state.building_room_width,
    +       state.building_room_height,
    +       random_window_color]
    +    end
    +  end
    +
    +  def building_prefab starting_x, floors, rooms
    +    state.new_entity(:building) do |b|
    +      b.x      = starting_x
    +      b.y      = 0
    +      b.w      = state.building_room_width.*(rooms) +
    +                 state.building_room_spacing.*(rooms + 1)
    +      b.h      = state.building_room_height.*(floors) +
    +                 state.building_room_spacing.*(floors + 1)
    +      b.right  = b.x + b.w
    +      b.rect   = [b.x, b.y, b.w, b.h]
    +      b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],
    +                  [b.x, b.y, b.w, b.h, random_building_color],
    +                  windows_for_building(b.x, floors, rooms)]
    +    end
    +  end
    +
    +  def parse_or_clear! game_prop
    +    if int? state.as_hash[game_prop]
    +      state.as_hash[game_prop] = state.as_hash[game_prop].to_i
    +      return true
    +    end
    +
    +    state.as_hash[game_prop] = nil
    +    return false
    +  end
    +
    +  def new_banana owner, x, y, angle, velocity
    +    state.new_entity(:banana) do |b|
    +      b.owner     = owner
    +      b.x         = x
    +      b.y         = y
    +      b.angle     = angle % 360
    +      b.velocity  = velocity / 5
    +      b.dx        = b.angle.vector_x(b.velocity)
    +      b.dy        = b.angle.vector_y(b.velocity)
    +    end
    +  end
    +
    +  def fancy_white
    +    [253, 252, 253]
    +  end
    +end
    +
    +$you_so_basic_gorillas = YouSoBasicGorillas.new
    +
    +def tick args
    +  $you_so_basic_gorillas.outputs = args.outputs
    +  $you_so_basic_gorillas.grid    = args.grid
    +  $you_so_basic_gorillas.state    = args.state
    +  $you_so_basic_gorillas.inputs  = args.inputs
    +  $you_so_basic_gorillas.tick
    +end
    +
    +
    +

    Platformer - Gorillas Basic - repl.rb

    +
    # ./samples/99_genre_platformer/gorillas_basic/app/repl.rb
    +begin
    +  if $gtk.args.state.current_turn == :player_1_angle
    +    $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"
    +    $you_so_basic_gorillas.input_execute_turn
    +    $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"
    +    $you_so_basic_gorillas.input_execute_turn
    +  elsif $gtk.args.state.current_turn == :player_2_angle
    +    $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"
    +    $you_so_basic_gorillas.input_execute_turn
    +    $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"
    +    $you_so_basic_gorillas.input_execute_turn
    +  else
    +    $you_so_basic_gorillas.input_execute_turn
    +  end
    +rescue Exception => e
    +  puts e
    +end
    +
    +
    +

    Platformer - Gorillas Basic - tests.rb

    +
    # ./samples/99_genre_platformer/gorillas_basic/app/tests.rb
    +$gtk.reset 100
    +$gtk.supress_framerate_warning = true
    +$gtk.require 'app/tests/building_generation_tests.rb'
    +$gtk.tests.start
    +
    +
    +

    Platformer - Gorillas Basic - Tests - building_generation_tests.rb

    +
    # ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb
    +def test_solids args, assert
    +  game = YouSoBasicGorillas.new
    +  game.outputs = args.outputs
    +  game.grid = args.grid
    +  game.state = args.state
    +  game.inputs = args.inputs
    +  game.tick
    +  assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"
    +  game.tick
    +  assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"
    +  number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)
    +  the_only_background = 1
    +  static_solids = args.outputs.static_solids.length
    +  assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"
    +end
    +
    +
    +

    Platformer - The Little Probe - main.rb

    +
    # ./samples/99_genre_platformer/the_little_probe/app/main.rb
    +class FallingCircle
    +  attr_gtk
    +
    +  def tick
    +    fiddle
    +    defaults
    +    render
    +    input
    +    calc
    +  end
    +
    +  def fiddle
    +    state.gravity     = -0.02
    +    circle.radius     = 15
    +    circle.elasticity = 0.4
    +    camera.follow_speed = 0.4 * 0.4
    +  end
    +
    +  def render
    +    render_stage_editor
    +    render_debug
    +    render_game
    +  end
    +
    +  def defaults
    +    if state.tick_count == 0
    +      outputs.sounds << "sounds/bg.ogg"
    +    end
    +
    +    state.storyline ||= [
    +      { text: "<- -> to aim, hold space to charge",                            distance_gate: 0 },
    +      { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },
    +      { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },
    +      { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.",   distance_gate: 0 },
    +      { text: "jupiter's sure is beautiful...",   distance_gate: 4000 },
    +      { text: "hmm, it seems there's some kind of anomoly in the sky",   distance_gate: 7000 },
    +      { text: "dancing lights, i'll call them whisps.",   distance_gate: 8000 },
    +      { text: "#todo... look i ran out of time -_-",   distance_gate: 9000 },
    +      { text: "there's never enough time",   distance_gate: 9000 },
    +      { text: "the game jam was fun though ^_^",   distance_gate: 10000 },
    +    ]
    +
    +    load_level force: args.state.tick_count == 0
    +    state.line_mode            ||= :terrain
    +
    +    state.sound_index          ||= 1
    +    circle.potential_lift      ||= 0
    +    circle.angle               ||= 90
    +    circle.check_point_at      ||= -1000
    +    circle.game_over_at        ||= -1000
    +    circle.x                   ||= -485
    +    circle.y                   ||= 12226
    +    circle.check_point_x       ||= circle.x
    +    circle.check_point_y       ||= circle.y
    +    circle.dy                  ||= 0
    +    circle.dx                  ||= 0
    +    circle.previous_dy         ||= 0
    +    circle.previous_dx         ||= 0
    +    circle.angle               ||= 0
    +    circle.after_images        ||= []
    +    circle.terrains_to_monitor ||= {}
    +    circle.impact_history      ||= []
    +
    +    camera.x                   ||= 0
    +    camera.y                   ||= 0
    +    camera.target_x            ||= 0
    +    camera.target_y            ||= 0
    +    state.snaps                ||= { }
    +    state.snap_number            = 10
    +
    +    args.state.storyline_x ||= -1000
    +    args.state.storyline_y ||= -1000
    +  end
    +
    +  def render_game
    +    outputs.background_color = [0, 0, 0]
    +    outputs.sprites << [-circle.x + 1100,
    +                        -circle.y - 100,
    +                        2416 * 4,
    +                        3574 * 4,
    +                        'sprites/jupiter.png']
    +    outputs.sprites << [-circle.x,
    +                        -circle.y,
    +                        2416 * 4,
    +                        3574 * 4,
    +                        'sprites/level.png']
    +    outputs.sprites << state.whisp_queue
    +    render_aiming_retical
    +    render_circle
    +    render_notification
    +  end
    +
    +  def render_notification
    +    toast_length = 500
    +    if circle.game_over_at.elapsed_time < toast_length
    +      label_text = "..."
    +    elsif circle.check_point_at.elapsed_time > toast_length
    +      args.state.current_storyline = nil
    +      return
    +    end
    +    if circle.check_point_at &&
    +       circle.check_point_at.elapsed_time == 1 &&
    +       !args.state.current_storyline
    +       if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]
    +         args.state.current_storyline = args.state.storyline.shift[:text]
    +         args.state.distance_traveled ||= 0
    +         args.state.storyline_x = circle.x
    +         args.state.storyline_y = circle.y
    +       end
    +      return unless args.state.current_storyline
    +    end
    +    label_text = args.state.current_storyline
    +    return unless label_text
    +    x = circle.x + camera.x
    +    y = circle.y + camera.y - 40
    +    w = 900
    +    h = 30
    +    outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid
    +    outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border
    +    outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]
    +  end
    +
    +  def render_aiming_retical
    +    outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,
    +                        state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,
    +                        10, 10, 'sprites/circle-orange.png']
    +    outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,
    +                        state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,
    +                        10, 10, 'sprites/circle-orange.png', 0, 128]
    +    if rand > 0.9
    +      outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,
    +                          state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,
    +                          10, 10, 'sprites/circle-white.png', 0, 128]
    +    end
    +  end
    +
    +  def render_circle
    +    outputs.sprites << circle.after_images.map do |ai|
    +      ai.merge(x: ai.x + state.camera.x - circle.radius,
    +               y: ai.y + state.camera.y - circle.radius,
    +               w: circle.radius * 2,
    +               h: circle.radius * 2,
    +               path: 'sprites/circle-white.png')
    +    end
    +
    +    outputs.sprites << [(circle.x - circle.radius) + state.camera.x,
    +                        (circle.y - circle.radius) + state.camera.y,
    +                        circle.radius * 2,
    +                        circle.radius * 2,
    +                        'sprites/probe.png']
    +  end
    +
    +  def render_debug
    +    return unless state.debug_mode
    +
    +    outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]
    +    outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]
    +
    +    args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|
    +      h[:x] += state.camera.x
    +      h[:y] += state.camera.y
    +      h[:x2] += state.camera.x
    +      h[:y2] += state.camera.y
    +    end
    +
    +    outputs.primitives << state.terrain.find_all do |t|
    +      circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)
    +    end.map do |t|
    +      [
    +        t.line.associate(r: 0, g: 255, b: 0) do |h|
    +          h.x  += state.camera.x
    +          h.y  += state.camera.y
    +          h.x2 += state.camera.x
    +          h.y2 += state.camera.y
    +          if circle.rect.intersect_rect? t[:rect]
    +            h[:r] = 255
    +            h[:g] = 0
    +          end
    +          h
    +        end,
    +        t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|
    +          h.x += state.camera.x
    +          h.y += state.camera.y
    +          h.b = 255 if line_near_rect? circle.rect, t
    +          h
    +        end
    +      ]
    +    end
    +
    +    outputs.primitives << state.lava.find_all do |t|
    +      circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)
    +    end.map do |t|
    +      [
    +        t.line.associate(r: 0, g: 0, b: 255) do |h|
    +          h.x  += state.camera.x
    +          h.y  += state.camera.y
    +          h.x2 += state.camera.x
    +          h.y2 += state.camera.y
    +          if circle.rect.intersect_rect? t[:rect]
    +            h[:r] = 255
    +            h[:b] = 0
    +          end
    +          h
    +        end,
    +        t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|
    +          h.x += state.camera.x
    +          h.y += state.camera.y
    +          h.b = 255 if line_near_rect? circle.rect, t
    +          h
    +        end
    +      ]
    +    end
    +
    +    if state.god_mode
    +      border = circle.rect.merge(x: circle.rect.x + state.camera.x,
    +                                 y: circle.rect.y + state.camera.y,
    +                                 g: 255)
    +    else
    +      border = circle.rect.merge(x: circle.rect.x + state.camera.x,
    +                                 y: circle.rect.y + state.camera.y,
    +                                 b: 255)
    +    end
    +
    +    outputs.borders << border
    +
    +    overlapping ||= {}
    +
    +    circle.impact_history.each do |h|
    +      label_mod = 300
    +      x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x
    +      y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y
    +      10.times do
    +        if overlapping[x] && overlapping[x][y]
    +          y -= 52
    +        else
    +          break
    +        end
    +      end
    +
    +      overlapping[x] ||= {}
    +      overlapping[x][y] ||= true
    +      outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid
    +      outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 10, y +  9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 10, y -  5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]
    +
    +      outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]
    +
    +      outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 200, y +  9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]
    +      outputs.labels << [x + 200, y -  5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]
    +    end
    +
    +    if circle.floor
    +      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]
    +      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]
    +      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y +  85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0]
    +      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y +  86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]
    +      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y +  70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]
    +      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y +  71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]
    +    end
    +  end
    +
    +  def render_stage_editor
    +    return unless state.god_mode
    +    return unless state.point_one
    +    args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]
    +  end
    +
    +  def trajectory body
    +    [body.x + body.dx,
    +     body.y + body.dy,
    +     body.x + body.dx * 1000,
    +     body.y + body.dy * 1000,
    +     0, 255, 255]
    +  end
    +
    +  def lengthen_line line, num
    +    line = normalize_line(line)
    +    slope = geometry.line_slope(line, replace_infinity: 10).abs
    +    if slope < 2
    +      [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash
    +    else
    +      [line.x, line.y, line.x2, line.y2].line.to_hash
    +    end
    +  end
    +
    +  def normalize_line line
    +    if line.x > line.x2
    +      x  = line.x2
    +      y  = line.y2
    +      x2 = line.x
    +      y2 = line.y
    +    else
    +      x  = line.x
    +      y  = line.y
    +      x2 = line.x2
    +      y2 = line.y2
    +    end
    +    [x, y, x2, y2]
    +  end
    +
    +  def rect_for_line line
    +    if line.x > line.x2
    +      x  = line.x2
    +      y  = line.y2
    +      x2 = line.x
    +      y2 = line.y
    +    else
    +      x  = line.x
    +      y  = line.y
    +      x2 = line.x2
    +      y2 = line.y2
    +    end
    +
    +    w = x2 - x
    +    h = y2 - y
    +
    +    if h < 0
    +      y += h
    +      h = h.abs
    +    end
    +
    +    if w < circle.radius
    +      x -= circle.radius
    +      w = circle.radius * 2
    +    end
    +
    +    if h < circle.radius
    +      y -= circle.radius
    +      h = circle.radius * 2
    +    end
    +
    +    { x: x, y: y, w: w, h: h }
    +  end
    +
    +  def snap_to_grid x, y, snaps
    +    snap_number = 10
    +    x = x.to_i
    +    y = y.to_i
    +
    +    x_floor = x.idiv(snap_number) * snap_number
    +    x_mod   = x % snap_number
    +    x_ceil  = (x.idiv(snap_number) + 1) * snap_number
    +
    +    y_floor = y.idiv(snap_number) * snap_number
    +    y_mod   = y % snap_number
    +    y_ceil  = (y.idiv(snap_number) + 1) * snap_number
    +
    +    if snaps[x_floor]
    +      x_result = x_floor
    +    elsif snaps[x_ceil]
    +      x_result = x_ceil
    +    elsif x_mod < snap_number.idiv(2)
    +      x_result = x_floor
    +    else
    +      x_result = x_ceil
    +    end
    +
    +    snaps[x_result] ||= {}
    +
    +    if snaps[x_result][y_floor]
    +      y_result = y_floor
    +    elsif snaps[x_result][y_ceil]
    +      y_result = y_ceil
    +    elsif y_mod < snap_number.idiv(2)
    +      y_result = y_floor
    +    else
    +      y_result = y_ceil
    +    end
    +
    +    snaps[x_result][y_result] = true
    +    return [x_result, y_result]
    +
    +  end
    +
    +  def snap_line line
    +    x, y, x2, y2 = line
    +  end
    +
    +  def string_to_line s
    +    x, y, x2, y2 = s.split(',').map(&:to_f)
    +
    +    if x > x2
    +      x2, x = x, x2
    +      y2, y = y, y2
    +    end
    +
    +    x, y = snap_to_grid x, y, state.snaps
    +    x2, y2 = snap_to_grid x2, y2, state.snaps
    +    [x, y, x2, y2].line.to_hash
    +  end
    +
    +  def load_lines file
    +    data = gtk.read_file(file) || ""
    +    data.each_line
    +        .reject { |l| l.strip.length == 0 }
    +        .map { |l| string_to_line l }
    +        .map { |h| h.merge(rect: rect_for_line(h))  }
    +  end
    +
    +  def load_terrain
    +    load_lines 'data/level.txt'
    +  end
    +
    +  def load_lava
    +    load_lines 'data/level_lava.txt'
    +  end
    +
    +  def load_level force: false
    +    if force
    +      state.snaps = {}
    +      state.terrain = load_terrain
    +      state.lava = load_lava
    +    else
    +      state.terrain ||= load_terrain
    +      state.lava ||= load_lava
    +    end
    +  end
    +
    +  def save_lines lines, file
    +    s = lines.map do |l|
    +      "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"
    +    end.join("\n")
    +    gtk.write_file(file, s)
    +  end
    +
    +  def save_level
    +    save_lines(state.terrain, 'level.txt')
    +    save_lines(state.lava, 'level_lava.txt')
    +    load_level force: true
    +  end
    +
    +  def line_near_rect? rect, terrain
    +    geometry.intersect_rect?(rect, terrain[:rect])
    +  end
    +
    +  def point_within_line? point, line
    +    return false if !point
    +    return false if !line
    +    return true
    +  end
    +
    +  def calc_impacts x, dx, y, dy, radius
    +    results = { }
    +    results[:x] = x
    +    results[:y] = y
    +    results[:dx] = x
    +    results[:dy] = y
    +    results[:point] = { x: x, y: y }
    +    results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }
    +    results[:trajectory] = trajectory(results)
    +    results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|
    +      {
    +        terrain: t,
    +        point: geometry.line_intersect(results[:trajectory], t),
    +        type: :terrain
    +      }
    +    end.reject { |t| !point_within_line? t[:point], t[:terrain] }
    +
    +    results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|
    +      {
    +        terrain: t,
    +        point: geometry.line_intersect(results[:trajectory], t),
    +        type: :lava
    +      }
    +    end.reject { |t| !point_within_line? t[:point], t[:terrain] }
    +
    +    results
    +  end
    +
    +  def calc_potential_impacts
    +    impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius
    +    circle.rect = impact_results[:rect]
    +    circle.trajectory = impact_results[:trajectory]
    +    circle.impacts = impact_results[:impacts]
    +  end
    +
    +  def calc_terrains_to_monitor
    +    circle.impact = nil
    +    circle.impacts.each do |i|
    +      circle.terrains_to_monitor[i[:terrain]] ||= {
    +        ray_start: geometry.ray_test(circle, i[:terrain]),
    +      }
    +
    +      circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])
    +      if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]
    +        if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)
    +          circle.impact = i
    +          circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]
    +        end
    +      end
    +    end
    +  end
    +
    +  def impact_result body, impact
    +    infinity_alias = 1000
    +    r = {
    +      body: {},
    +      terrain: {},
    +      impact: {}
    +    }
    +
    +    r[:body][:line] = body.trajectory.dup
    +    r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)
    +    r[:body][:slope_sign] = r[:body][:slope].sign
    +    r[:body][:x] = body.x
    +    r[:body][:y] = body.y
    +    r[:body][:dy] = body.dy
    +    r[:body][:dx] = body.dx
    +
    +    r[:terrain][:line] = impact[:terrain].dup
    +    r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)
    +    r[:terrain][:slope_sign] = r[:terrain][:slope].sign
    +
    +    r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)
    +    r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }
    +    r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]
    +    r[:impact][:ray] = body.ray_current
    +    r[:body][:new_on_floor] = body.on_floor
    +    r[:body][:new_floor] = r[:terrain][:line]
    +
    +    if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3
    +      play_sound
    +      r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1
    +      r[:body][:new_dx] = r[:body][:dx] * circle.elasticity
    +      r[:impact][:type] = :horizontal
    +      r[:body][:new_reason] = "-"
    +    elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3
    +      play_sound
    +      r[:body][:new_dy] = r[:body][:dy] * 1.1
    +      r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity
    +      r[:impact][:type] = :vertical
    +      r[:body][:new_reason] = "|"
    +    else
    +      play_sound
    +      r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity
    +      r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity
    +      r[:impact][:type] = :slanted
    +      r[:body][:new_reason] = "/"
    +    end
    +
    +    r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs
    +
    +    if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4
    +      r[:body][:new_dx] = 0
    +      r[:body][:new_dy] = 0
    +      r[:impact][:energy] = 0
    +      r[:body][:new_on_floor] = true
    +      r[:body][:new_floor] = r[:terrain][:line]
    +      r[:body][:new_reason] = "0"
    +    end
    +
    +    r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],
    +                                                y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },
    +                                              r[:terrain][:line])
    +
    +    if r[:impact][:ray_next] == r[:impact][:ray]
    +      r[:body][:new_dx] *= -1
    +      r[:body][:new_dy] *= -1
    +      r[:body][:new_reason] = "clip"
    +    end
    +
    +    r
    +  end
    +
    +  def game_over!
    +    circle.x = circle.check_point_x
    +    circle.y = circle.check_point_y
    +    circle.dx = 0
    +    circle.dy = 0
    +    circle.game_over_at = state.tick_count
    +  end
    +
    +  def not_game_over!
    +    impact_history_entry = impact_result circle, circle.impact
    +    circle.impact_history << impact_history_entry
    +    circle.x -= circle.dx * 1.1
    +    circle.y -= circle.dy * 1.1
    +    circle.dx = impact_history_entry[:body][:new_dx]
    +    circle.dy = impact_history_entry[:body][:new_dy]
    +    circle.on_floor = impact_history_entry[:body][:new_on_floor]
    +
    +    if circle.on_floor
    +      circle.check_point_at = state.tick_count
    +      circle.check_point_x = circle.x
    +      circle.check_point_y = circle.y
    +    end
    +
    +    circle.previous_floor = circle.floor || {}
    +    circle.floor = impact_history_entry[:body][:new_floor] || {}
    +    circle.floor_point = impact_history_entry[:impact][:point]
    +    if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)
    +      new_relative_x = if circle.dx > 0
    +                         :right
    +                       elsif circle.dx < 0
    +                         :left
    +                       else
    +                         nil
    +                       end
    +
    +      new_relative_y = if circle.dy > 0
    +                         :above
    +                       elsif circle.dy < 0
    +                         :below
    +                       else
    +                         nil
    +                       end
    +
    +      circle.floor_relative_x = new_relative_x
    +      circle.floor_relative_y = new_relative_y
    +    end
    +
    +    circle.impact = nil
    +    circle.terrains_to_monitor.clear
    +  end
    +
    +  def calc_physics
    +    if args.state.god_mode
    +      calc_potential_impacts
    +      calc_terrains_to_monitor
    +      return
    +    end
    +
    +    if circle.y < -700
    +      game_over
    +      return
    +    end
    +
    +    return if state.game_over
    +    return if circle.on_floor
    +    circle.previous_dy = circle.dy
    +    circle.previous_dx = circle.dx
    +    circle.x  += circle.dx
    +    circle.y  += circle.dy
    +    args.state.distance_traveled ||= 0
    +    args.state.distance_traveled += circle.dx.abs + circle.dy.abs
    +    circle.dy += state.gravity
    +    calc_potential_impacts
    +    calc_terrains_to_monitor
    +    return unless circle.impact
    +    if circle.impact && circle.impact[:type] == :lava
    +      game_over!
    +    else
    +      not_game_over!
    +    end
    +  end
    +
    +  def input_god_mode
    +    state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash
    +
    +    # toggle god mode
    +    if inputs.keyboard.key_down.g
    +      state.god_mode = !state.god_mode
    +      state.potential_lift = 0
    +      circle.floor = nil
    +      circle.floor_point = nil
    +      circle.floor_relative_x = nil
    +      circle.floor_relative_y = nil
    +      circle.impact = nil
    +      circle.terrains_to_monitor.clear
    +      return
    +    end
    +
    +    return unless state.god_mode
    +
    +    circle.x = circle.x.to_i
    +    circle.y = circle.y.to_i
    +
    +    # move god circle
    +    if inputs.keyboard.left || inputs.keyboard.a
    +      circle.x -= 20
    +    elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f
    +      circle.x += 20
    +    end
    +
    +    if inputs.keyboard.up || inputs.keyboard.w
    +      circle.y += 20
    +    elsif inputs.keyboard.down || inputs.keyboard.s
    +      circle.y -= 20
    +    end
    +
    +    # delete terrain
    +    if inputs.keyboard.key_down.x
    +      calc_terrains_to_monitor
    +      state.terrain = state.terrain.reject do |t|
    +        t[:rect].intersect_rect? circle.rect
    +      end
    +
    +      state.lava = state.lava.reject do |t|
    +        t[:rect].intersect_rect? circle.rect
    +      end
    +
    +      calc_potential_impacts
    +      save_level
    +    end
    +
    +    # change terrain type
    +    if inputs.keyboard.key_down.l
    +      if state.line_mode == :terrain
    +        state.line_mode = :lava
    +      else
    +        state.line_mode = :terrain
    +      end
    +    end
    +
    +    if inputs.mouse.click && !state.point_one
    +      state.point_one = inputs.mouse.click.point
    +    elsif inputs.mouse.click && state.point_one
    +      l = [*state.point_one, *inputs.mouse.click.point]
    +      l = [l.x  - state.camera.x,
    +           l.y  - state.camera.y,
    +           l.x2 - state.camera.x,
    +           l.y2 - state.camera.y].line.to_hash
    +      l[:rect] = rect_for_line l
    +      if state.line_mode == :terrain
    +        state.terrain << l
    +      else
    +        state.lava << l
    +      end
    +      save_level
    +      next_x = inputs.mouse.click.point.x - 640
    +      next_y = inputs.mouse.click.point.y - 360
    +      circle.x += next_x
    +      circle.y += next_y
    +      state.point_one = nil
    +    elsif inputs.keyboard.one
    +      state.point_one = [circle.x + camera.x, circle.y+ camera.y]
    +    end
    +
    +    # cancel chain lines
    +    if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one
    +      state.point_one = nil
    +    end
    +  end
    +
    +  def play_sound
    +    return if state.sound_debounce > 0
    +    state.sound_debounce = 5
    +    outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"
    +    state.sound_index += 1
    +    if state.sound_index > 21
    +      state.sound_index = 1
    +    end
    +  end
    +
    +  def input_game
    +    if inputs.keyboard.down || inputs.keyboard.space
    +      circle.potential_lift += 0.03
    +      circle.potential_lift = circle.potential_lift.lesser(10)
    +    elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space
    +      play_sound
    +      circle.dy += circle.angle.vector_y circle.potential_lift
    +      circle.dx += circle.angle.vector_x circle.potential_lift
    +
    +      if circle.on_floor
    +        if circle.floor_relative_y == :above
    +          circle.y += circle.potential_lift.abs * 2
    +        elsif circle.floor_relative_y == :below
    +          circle.y -= circle.potential_lift.abs * 2
    +        end
    +      end
    +
    +      circle.on_floor = false
    +      circle.potential_lift = 0
    +      circle.terrains_to_monitor.clear
    +      circle.impact_history.clear
    +      circle.impact = nil
    +      calc_physics
    +    end
    +
    +    # aim probe
    +    if inputs.keyboard.right || inputs.keyboard.a
    +      circle.angle -= 2
    +    elsif inputs.keyboard.left || inputs.keyboard.d
    +      circle.angle += 2
    +    end
    +  end
    +
    +  def input
    +    input_god_mode
    +    input_game
    +  end
    +
    +  def calc_camera
    +    state.camera.target_x = 640 - circle.x
    +    state.camera.target_y = 360 - circle.y
    +    xdiff = state.camera.target_x - state.camera.x
    +    ydiff = state.camera.target_y - state.camera.y
    +    state.camera.x += xdiff * camera.follow_speed
    +    state.camera.y += ydiff * camera.follow_speed
    +  end
    +
    +  def calc
    +    state.sound_debounce ||= 0
    +    state.sound_debounce -= 1
    +    state.sound_debounce = 0 if state.sound_debounce < 0
    +    if state.god_mode
    +      circle.dy *= 0.1
    +      circle.dx *= 0.1
    +    end
    +    calc_camera
    +    state.whisp_queue ||= []
    +    if state.tick_count.mod_zero?(4)
    +      state.whisp_queue << {
    +        x: -300,
    +        y: 1400 * rand,
    +        speed: 2.randomize(:ratio) + 3,
    +        w: 20,
    +        h: 20, path: 'sprites/whisp.png',
    +        a: 0,
    +        created_at: state.tick_count,
    +        angle: 0,
    +        r: 100,
    +        g: 128 + 128 * rand,
    +        b: 128 + 128 * rand
    +      }
    +    end
    +
    +    state.whisp_queue.each do |w|
    +      w.x += w[:speed] * 2
    +      w.x -= circle.dx * 0.3
    +      w.y -= w[:speed]
    +      w.y -= circle.dy * 0.3
    +      w.angle += w[:speed]
    +      w.a = w[:created_at].ease(30) * 255
    +    end
    +
    +    state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }
    +
    +    if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)
    +      circle.after_images << {
    +        x: circle.x,
    +        y: circle.y,
    +        w: circle.radius,
    +        h: circle.radius,
    +        a: 255,
    +        created_at: state.tick_count
    +      }
    +    end
    +
    +    circle.after_images.each do |ai|
    +      ai.a = ai[:created_at].ease(10, :flip) * 255
    +    end
    +
    +    circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }
    +    calc_physics
    +  end
    +
    +  def circle
    +    state.circle
    +  end
    +
    +  def camera
    +    state.camera
    +  end
    +
    +  def terrain
    +    state.terrain
    +  end
    +
    +  def lava
    +    state.lava
    +  end
    +end
    +
    +# $gtk.reset
    +
    +def tick args
    +  args.outputs.background_color = [0, 0, 0]
    +  if args.inputs.keyboard.r
    +    args.gtk.reset
    +    return
    +  end
    +  # uncomment the line below to slow down the game so you
    +  # can see each tick as it passes
    +  # args.gtk.slowmo! 30
    +  $game ||= FallingCircle.new
    +  $game.args = args
    +  $game.tick
    +end
    +
    +def reset
    +  $game = nil
    +end
    +
    +
    +

    Platformer - The Little Probe - Data - level.txt

    +
    # ./samples/99_genre_platformer/the_little_probe/data/level.txt
    +640,8840,1180,8840
    +-60,10220,0,9960
    +-60,10220,0,10500
    +0,10500,0,10780
    +0,10780,40,10900
    +500,10920,760,10960
    +300,10560,820,10600
    +420,10320,700,10300
    +820,10600,1500,10600
    +1500,10600,1940,10600
    +1940,10600,2380,10580
    +2380,10580,2800,10620
    +2240,11080,2480,11020
    +2000,11120,2240,11080
    +1760,11180,2000,11120
    +1620,11180,1760,11180
    +1500,11220,1620,11180
    +1180,11280,1340,11220
    +1040,11240,1180,11280
    +840,11280,1040,11240
    +640,11280,840,11280
    +500,11220,640,11280
    +420,11140,500,11220
    +240,11100,420,11140
    +100,11120,240,11100
    +0,11180,100,11120
    +-160,11220,0,11180
    +-260,11240,-160,11220
    +1340,11220,1500,11220
    +960,13300,1280,13060
    +1280,13060,1540,12860
    +1540,12860,1820,12700
    +1820,12700,2080,12520
    +2080,12520,2240,12400
    +2240,12400,2240,12240
    +2240,12240,2400,12080
    +2400,12080,2560,11920
    +2560,11920,2640,11740
    +2640,11740,2740,11580
    +2740,11580,2800,11400
    +2800,11400,2800,11240
    +2740,11140,2800,11240
    +2700,11040,2740,11140
    +2700,11040,2740,10960
    +2740,10960,2740,10920
    +2700,10900,2740,10920
    +2380,10900,2700,10900
    +2040,10920,2380,10900
    +1720,10940,2040,10920
    +1380,11000,1720,10940
    +1180,10980,1380,11000
    +900,10980,1180,10980
    +760,10960,900,10980
    +240,10960,500,10920
    +40,10900,240,10960
    +0,9700,0,9960
    +-60,9500,0,9700
    +-60,9420,-60,9500
    +-60,9420,-60,9340
    +-60,9340,-60,9280
    +-60,9120,-60,9280
    +-60,8940,-60,9120
    +-60,8940,-60,8780
    +-60,8780,0,8700
    +0,8700,40,8680
    +40,8680,240,8700
    +240,8700,360,8780
    +360,8780,640,8840
    +1420,8400,1540,8480
    +1540,8480,1680,8500
    +1680,8500,1940,8460
    +1180,8840,1280,8880
    +1280,8880,1340,8860
    +1340,8860,1720,8860
    +1720,8860,1820,8920
    +1820,8920,1820,9140
    +1820,9140,1820,9280
    +1820,9460,1820,9280
    +1760,9480,1820,9460
    +1640,9480,1760,9480
    +1540,9500,1640,9480
    +1340,9500,1540,9500
    +1100,9500,1340,9500
    +1040,9540,1100,9500
    +960,9540,1040,9540
    +300,9420,360,9460
    +240,9440,300,9420
    +180,9600,240,9440
    +120,9660,180,9600
    +100,9820,120,9660
    +100,9820,120,9860
    +120,9860,140,9900
    +140,9900,140,10000
    +140,10440,180,10540
    +100,10080,140,10000
    +100,10080,140,10100
    +140,10100,140,10440
    +180,10540,300,10560
    +2140,9560,2140,9640
    +2140,9720,2140,9640
    +1880,9780,2140,9720
    +1720,9780,1880,9780
    +1620,9740,1720,9780
    +1500,9780,1620,9740
    +1380,9780,1500,9780
    +1340,9820,1380,9780
    +1200,9820,1340,9820
    +1100,9780,1200,9820
    +900,9780,1100,9780
    +820,9720,900,9780
    +540,9720,820,9720
    +360,9840,540,9720
    +360,9840,360,9960
    +360,9960,360,10080
    +360,10140,360,10080
    +360,10140,360,10240
    +360,10240,420,10320
    +700,10300,820,10280
    +820,10280,820,10280
    +820,10280,900,10320
    +900,10320,1040,10300
    +1040,10300,1200,10320
    +1200,10320,1380,10280
    +1380,10280,1500,10300
    +1500,10300,1760,10300
    +2800,10620,2840,10600
    +2840,10600,2900,10600
    +2900,10600,3000,10620
    +3000,10620,3080,10620
    +3080,10620,3140,10600
    +3140,10540,3140,10600
    +3140,10540,3140,10460
    +3140,10460,3140,10360
    +3140,10360,3140,10260
    +3140,10260,3140,10140
    +3140,10140,3140,10000
    +3140,10000,3140,9860
    +3140,9860,3160,9720
    +3160,9720,3160,9580
    +3160,9580,3160,9440
    +3160,9300,3160,9440
    +3160,9300,3160,9140
    +3160,9140,3160,8980
    +3160,8980,3160,8820
    +3160,8820,3160,8680
    +3160,8680,3160,8520
    +1760,10300,1880,10300
    +660,9500,960,9540
    +640,9460,660,9500
    +360,9460,640,9460
    +-480,10760,-440,10880
    +-480,11020,-440,10880
    +-480,11160,-260,11240
    +-480,11020,-480,11160
    +-600,11420,-380,11320
    +-380,11320,-200,11340
    +-200,11340,0,11340
    +0,11340,180,11340
    +960,13420,960,13300
    +960,13420,960,13520
    +960,13520,1000,13560
    +1000,13560,1040,13540
    +1040,13540,1200,13440
    +1200,13440,1380,13380
    +1380,13380,1620,13300
    +1620,13300,1820,13220
    +1820,13220,2000,13200
    +2000,13200,2240,13200
    +2240,13200,2440,13160
    +2440,13160,2640,13040
    +-480,10760,-440,10620
    +-440,10620,-360,10560
    +-380,10460,-360,10560
    +-380,10460,-360,10300
    +-380,10140,-360,10300
    +-380,10140,-380,10040
    +-380,9880,-380,10040
    +-380,9720,-380,9880
    +-380,9720,-380,9540
    +-380,9360,-380,9540
    +-380,9180,-380,9360
    +-380,9180,-380,9000
    +-380,8840,-380,9000
    +-380,8840,-380,8760
    +-380,8760,-380,8620
    +-380,8620,-380,8520
    +-380,8520,-360,8400
    +-360,8400,-100,8400
    +-100,8400,-60,8420
    +-60,8420,240,8440
    +240,8440,240,8380
    +240,8380,500,8440
    +500,8440,760,8460
    +760,8460,1000,8400
    +1000,8400,1180,8420
    +1180,8420,1420,8400
    +1940,8460,2140,8420
    +2140,8420,2200,8520
    +2200,8680,2200,8520
    +2140,8840,2200,8680
    +2140,8840,2140,9020
    +2140,9100,2140,9020
    +2140,9200,2140,9100
    +2140,9200,2200,9320
    +2200,9320,2200,9440
    +2140,9560,2200,9440
    +1880,10300,2200,10280
    +2200,10280,2480,10260
    +2480,10260,2700,10240
    +2700,10240,2840,10180
    +2840,10180,2900,10060
    +2900,9860,2900,10060
    +2900,9640,2900,9860
    +2900,9640,2900,9500
    +2900,9460,2900,9500
    +2740,9460,2900,9460
    +2700,9460,2740,9460
    +2700,9360,2700,9460
    +2700,9320,2700,9360
    +2600,9320,2700,9320
    +2600,9260,2600,9320
    +2600,9200,2600,9260
    +2480,9120,2600,9200
    +2440,9080,2480,9120
    +2380,9080,2440,9080
    +2320,9060,2380,9080
    +2320,8860,2320,9060
    +2320,8860,2380,8840
    +2380,8840,2480,8860
    +2480,8860,2600,8840
    +2600,8840,2740,8840
    +2740,8840,2840,8800
    +2840,8800,2900,8700
    +2900,8600,2900,8700
    +2900,8480,2900,8600
    +2900,8380,2900,8480
    +2900,8380,2900,8260
    +2900,8260,2900,8140
    +2900,8140,2900,8020
    +2900,8020,2900,7900
    +2900,7820,2900,7900
    +2900,7820,2900,7740
    +2900,7660,2900,7740
    +2900,7560,2900,7660
    +2900,7460,2900,7560
    +2900,7460,2900,7360
    +2900,7260,2900,7360
    +2840,7160,2900,7260
    +2800,7080,2840,7160
    +2700,7100,2800,7080
    +2560,7120,2700,7100
    +2400,7100,2560,7120
    +2320,7100,2400,7100
    +2140,7100,2320,7100
    +2040,7080,2140,7100
    +1940,7080,2040,7080
    +1820,7140,1940,7080
    +1680,7140,1820,7140
    +1540,7140,1680,7140
    +1420,7220,1540,7140
    +1280,7220,1380,7220
    +1140,7200,1280,7220
    +1000,7220,1140,7200
    +760,7280,900,7320
    +540,7220,760,7280
    +300,7180,540,7220
    +180,7120,180,7160
    +40,7140,180,7120
    +-60,7160,40,7140
    +-200,7120,-60,7160
    +180,7160,300,7180
    +-260,7060,-200,7120
    +-260,6980,-260,7060
    +-260,6880,-260,6980
    +-260,6880,-260,6820
    +-260,6820,-200,6760
    +-200,6760,-100,6740
    +-100,6740,-60,6740
    +-60,6740,40,6740
    +40,6740,300,6800
    +300,6800,420,6760
    +420,6760,500,6740
    +500,6740,540,6760
    +540,6760,540,6760
    +540,6760,640,6780
    +640,6660,640,6780
    +580,6580,640,6660
    +580,6440,580,6580
    +580,6440,640,6320
    +640,6320,640,6180
    +580,6080,640,6180
    +580,6080,640,5960
    +640,5960,640,5840
    +640,5840,640,5700
    +640,5700,660,5560
    +660,5560,660,5440
    +660,5440,660,5300
    +660,5140,660,5300
    +660,5140,660,5000
    +660,5000,660,4880
    +660,4880,820,4860
    +820,4860,1000,4840
    +1000,4840,1100,4860
    +1100,4860,1280,4860
    +1280,4860,1420,4840
    +1420,4840,1580,4860
    +1580,4860,1720,4820
    +1720,4820,1880,4860
    +1880,4860,2000,4840
    +2000,4840,2140,4840
    +2140,4840,2320,4860
    +2320,4860,2440,4880
    +2440,4880,2600,4880
    +2600,4880,2800,4880
    +2800,4880,2900,4880
    +2900,4880,2900,4820
    +2900,4740,2900,4820
    +2800,4700,2900,4740
    +2520,4680,2800,4700
    +2240,4660,2520,4680
    +1940,4620,2240,4660
    +1820,4580,1940,4620
    +1820,4500,1820,4580
    +1820,4500,1880,4420
    +1880,4420,2000,4420
    +2000,4420,2200,4420
    +2200,4420,2400,4440
    +2400,4440,2600,4440
    +2600,4440,2840,4440
    +2840,4440,2900,4400
    +2740,4260,2900,4280
    +2600,4240,2740,4260
    +2480,4280,2600,4240
    +2320,4240,2480,4280
    +2140,4220,2320,4240
    +1940,4220,2140,4220
    +1880,4160,1940,4220
    +1880,4160,1880,4080
    +1880,4080,2040,4040
    +2040,4040,2240,4060
    +2240,4060,2400,4040
    +2400,4040,2600,4060
    +2600,4060,2740,4020
    +2740,4020,2840,3940
    +2840,3780,2840,3940
    +2740,3660,2840,3780
    +2700,3680,2740,3660
    +2520,3700,2700,3680
    +2380,3700,2520,3700
    +2200,3720,2380,3700
    +2040,3720,2200,3720
    +1880,3700,2040,3720
    +1820,3680,1880,3700
    +1760,3600,1820,3680
    +1760,3600,1820,3480
    +1820,3480,1880,3440
    +1880,3440,1960,3460
    +1960,3460,2140,3460
    +2140,3460,2380,3460
    +2380,3460,2640,3440
    +2640,3440,2900,3380
    +2840,3280,2900,3380
    +2840,3280,2900,3200
    +2900,3200,2900,3140
    +2840,3020,2900,3140
    +2800,2960,2840,3020
    +2700,3000,2800,2960
    +2600,2980,2700,3000
    +2380,3000,2600,2980
    +2140,3000,2380,3000
    +1880,3000,2140,3000
    +1720,3040,1880,3000
    +1640,2960,1720,3040
    +1500,2940,1640,2960
    +1340,3000,1500,2940
    +1240,3000,1340,3000
    +1140,3020,1240,3000
    +1040,3000,1140,3020
    +960,2960,1040,3000
    +900,2960,960,2960
    +840,2840,900,2960
    +700,2820,840,2840
    +540,2820,700,2820
    +420,2820,540,2820
    +180,2800,420,2820
    +60,2780,180,2800
    +-60,2800,60,2780
    +-160,2760,-60,2800
    +-260,2740,-160,2760
    +-300,2640,-260,2740
    +-360,2560,-300,2640
    +-380,2460,-360,2560
    +-380,2460,-300,2380
    +-300,2300,-300,2380
    +-300,2300,-300,2220
    +-300,2100,-300,2220
    +-300,2100,-300,2040
    +-300,2040,-160,2040
    +-160,2040,-60,2040
    +-60,2040,60,2040
    +60,2040,180,2040
    +180,2040,360,2040
    +360,2040,540,2040
    +540,2040,700,2080
    +660,2160,700,2080
    +660,2160,700,2260
    +660,2380,700,2260
    +500,2340,660,2380
    +360,2340,500,2340
    +240,2340,360,2340
    +40,2320,240,2340
    +-60,2320,40,2320
    +-100,2380,-60,2320
    +-100,2380,-100,2460
    +-100,2460,-100,2540
    +-100,2540,0,2560
    +0,2560,140,2600
    +140,2600,300,2600
    +300,2600,460,2600
    +460,2600,640,2600
    +640,2600,760,2580
    +760,2580,820,2560
    +820,2560,820,2500
    +820,2500,820,2400
    +820,2400,840,2320
    +840,2320,840,2240
    +820,2120,840,2240
    +820,2020,820,2120
    +820,1900,820,2020
    +760,1840,820,1900
    +640,1840,760,1840
    +500,1840,640,1840
    +300,1860,420,1880
    +180,1840,300,1860
    +420,1880,500,1840
    +0,1840,180,1840
    +-60,1860,0,1840
    +-160,1840,-60,1860
    +-200,1800,-160,1840
    +-260,1760,-200,1800
    +-260,1680,-260,1760
    +-260,1620,-260,1680
    +-260,1540,-260,1620
    +-260,1540,-260,1460
    +-300,1420,-260,1460
    +-300,1420,-300,1340
    +-300,1340,-260,1260
    +-260,1260,-260,1160
    +-260,1060,-260,1160
    +-260,1060,-260,960
    +-260,880,-260,960
    +-260,880,-260,780
    +-260,780,-260,680
    +-300,580,-260,680
    +-300,580,-300,480
    +-300,480,-260,400
    +-300,320,-260,400
    +-300,320,-300,240
    +-300,240,-200,220
    +-200,220,-200,160
    +-200,160,-100,140
    +-100,140,0,120
    +0,120,60,120
    +60,120,180,120
    +180,120,300,120
    +300,120,420,140
    +420,140,580,180
    +580,180,760,180
    +760,180,900,180
    +960,180,1100,180
    +1100,180,1340,200
    +1340,200,1580,200
    +1580,200,1720,180
    +1720,180,2000,140
    +2000,140,2240,140
    +2240,140,2480,140
    +2520,140,2800,160
    +2800,160,3000,160
    +3000,160,3140,160
    +3140,260,3140,160
    +3140,260,3140,380
    +3080,500,3140,380
    +3080,620,3080,500
    +3080,620,3080,740
    +3080,740,3080,840
    +3080,960,3080,840
    +3080,1080,3080,960
    +3080,1080,3080,1200
    +3080,1200,3080,1340
    +3080,1340,3080,1460
    +3080,1580,3080,1460
    +3080,1700,3080,1580
    +3080,1700,3080,1760
    +3080,1760,3200,1760
    +3200,1760,3320,1760
    +3320,1760,3520,1760
    +3520,1760,3680,1740
    +3680,1740,3780,1700
    +3780,1700,3840,1620
    +3840,1620,3840,1520
    +3840,1520,3840,1420
    +3840,1320,3840,1420
    +3840,1120,3840,1320
    +3840,1120,3840,940
    +3840,940,3840,760
    +3780,600,3840,760
    +3780,600,3780,440
    +3780,320,3780,440
    +3780,320,3780,160
    +3780,60,3780,160
    +3780,60,4020,60
    +4020,60,4260,40
    +4260,40,4500,40
    +4500,40,4740,40
    +4740,40,4840,20
    +4840,20,4880,80
    +4880,80,5080,40
    +5080,40,5280,20
    +5280,20,5500,0
    +5500,0,5720,0
    +5720,0,5940,60
    +5940,60,6240,60
    +6240,60,6540,20
    +6540,20,6840,20
    +6840,20,7040,0
    +7040,0,7140,0
    +7140,0,7400,20
    +7400,20,7680,0
    +7680,0,7940,0
    +7940,0,8200,-20
    +8200,-20,8360,20
    +8360,20,8560,-40
    +8560,-40,8760,0
    +8760,0,8880,40
    +8880,120,8880,40
    +8840,220,8840,120
    +8620,240,8840,220
    +8420,260,8620,240
    +8200,280,8420,260
    +7940,280,8200,280
    +7760,240,7940,280
    +7560,220,7760,240
    +7360,280,7560,220
    +7140,260,7360,280
    +6940,240,7140,260
    +6720,220,6940,240
    +6480,220,6720,220
    +6360,300,6480,220
    +6240,300,6360,300
    +6200,500,6240,300
    +6200,500,6360,540
    +6360,540,6540,520
    +6540,520,6720,480
    +6720,480,6880,460
    +6880,460,7080,500
    +7080,500,7320,500
    +7320,500,7680,500
    +7680,620,7680,500
    +7520,640,7680,620
    +7360,640,7520,640
    +7200,640,7360,640
    +7040,660,7200,640
    +6880,720,7040,660
    +6720,700,6880,720
    +6540,700,6720,700
    +6420,760,6540,700
    +6280,740,6420,760
    +6240,760,6280,740
    +6200,920,6240,760
    +6200,920,6360,960
    +6360,960,6540,960
    +6540,960,6720,960
    +6720,960,6760,980
    +6760,980,6880,940
    +6880,940,7080,940
    +7080,940,7280,940
    +7280,940,7520,920
    +7520,920,7760,900
    +7760,900,7980,860
    +7980,860,8100,880
    +8100,880,8280,900
    +8280,900,8500,820
    +8500,820,8700,820
    +8700,820,8760,840
    +8760,960,8760,840
    +8700,1040,8760,960
    +8560,1060,8700,1040
    +8460,1080,8560,1060
    +8360,1040,8460,1080
    +8280,1080,8360,1040
    +8160,1120,8280,1080
    +8040,1120,8160,1120
    +7940,1100,8040,1120
    +7800,1120,7940,1100
    +7680,1120,7800,1120
    +7520,1100,7680,1120
    +7360,1100,7520,1100
    +7200,1120,7360,1100
    +7040,1180,7200,1120
    +6880,1160,7040,1180
    +6720,1160,6880,1160
    +6540,1160,6720,1160
    +6360,1160,6540,1160
    +6200,1160,6360,1160
    +6040,1220,6200,1160
    +6040,1220,6040,1400
    +6040,1400,6200,1440
    +6200,1440,6320,1440
    +6320,1440,6440,1440
    +6600,1440,6760,1440
    +6760,1440,6940,1420
    +6440,1440,6600,1440
    +6940,1420,7280,1400
    +7280,1400,7560,1400
    +7560,1400,7760,1400
    +7760,1400,7940,1360
    +7940,1360,8100,1380
    +8100,1380,8280,1340
    +8280,1340,8460,1320
    +8660,1300,8760,1360
    +8460,1320,8660,1300
    +8760,1360,8800,1500
    +8800,1660,8800,1500
    +8800,1660,8800,1820
    +8700,1840,8800,1820
    +8620,1860,8700,1840
    +8560,1800,8620,1860
    +8560,1800,8620,1680
    +8500,1640,8620,1680
    +8420,1680,8500,1640
    +8280,1680,8420,1680
    +8160,1680,8280,1680
    +7900,1680,8160,1680
    +7680,1680,7900,1680
    +7400,1660,7680,1680
    +7140,1680,7400,1660
    +6880,1640,7140,1680
    +6040,1820,6320,1780
    +5900,1840,6040,1820
    +6640,1700,6880,1640
    +6320,1780,6640,1700
    +5840,2040,5900,1840
    +5840,2040,5840,2220
    +5840,2220,5840,2320
    +5840,2460,5840,2320
    +5840,2560,5840,2460
    +5840,2560,5960,2620
    +5960,2620,6200,2620
    +6200,2620,6380,2600
    +6380,2600,6600,2580
    +6600,2580,6800,2600
    +6800,2600,7040,2580
    +7040,2580,7280,2580
    +7280,2580,7480,2560
    +7760,2540,7980,2520
    +7980,2520,8160,2500
    +7480,2560,7760,2540
    +8160,2500,8160,2420
    +8160,2420,8160,2320
    +8160,2180,8160,2320
    +7980,2160,8160,2180
    +7800,2180,7980,2160
    +7600,2200,7800,2180
    +7400,2200,7600,2200
    +6960,2200,7200,2200
    +7200,2200,7400,2200
    +6720,2200,6960,2200
    +6540,2180,6720,2200
    +6320,2200,6540,2180
    +6240,2160,6320,2200
    +6240,2160,6240,2040
    +6240,2040,6240,1940
    +6240,1940,6440,1940
    +6440,1940,6720,1940
    +6720,1940,6940,1920
    +7520,1920,7760,1920
    +6940,1920,7280,1920
    +7280,1920,7520,1920
    +7760,1920,8100,1900
    +8100,1900,8420,1900
    +8420,1900,8460,1940
    +8460,2120,8460,1940
    +8460,2280,8460,2120
    +8460,2280,8560,2420
    +8560,2420,8660,2380
    +8660,2380,8800,2340
    +8800,2340,8840,2400
    +8840,2520,8840,2400
    +8800,2620,8840,2520
    +8800,2740,8800,2620
    +8800,2860,8800,2740
    +8800,2940,8800,2860
    +8760,2980,8800,2940
    +8660,2980,8760,2980
    +8620,2960,8660,2980
    +8560,2880,8620,2960
    +8560,2880,8560,2780
    +8500,2740,8560,2780
    +8420,2760,8500,2740
    +8420,2840,8420,2760
    +8420,2840,8420,2940
    +8420,3040,8420,2940
    +8420,3160,8420,3040
    +8420,3280,8420,3380
    +8420,3280,8420,3160
    +8420,3380,8620,3460
    +8620,3460,8760,3460
    +8760,3460,8840,3400
    +8840,3400,8960,3400
    +8960,3400,9000,3500
    +9000,3700,9000,3500
    +9000,3900,9000,3700
    +9000,4080,9000,3900
    +9000,4280,9000,4080
    +9000,4500,9000,4280
    +9000,4620,9000,4500
    +9000,4780,9000,4620
    +9000,4780,9000,4960
    +9000,5120,9000,4960
    +9000,5120,9000,5300
    +8960,5460,9000,5300
    +8920,5620,8960,5460
    +8920,5620,8920,5800
    +8920,5800,8920,5960
    +8920,5960,8920,6120
    +8920,6120,8960,6300
    +8960,6300,8960,6480
    +8960,6660,8960,6480
    +8960,6860,8960,6660
    +8960,7040,8960,6860
    +8920,7420,8920,7220
    +8920,7420,8960,7620
    +8960,7620,8960,7800
    +8960,7800,8960,8000
    +8960,8000,8960,8180
    +8960,8180,8960,8380
    +8960,8580,8960,8380
    +8920,8800,8960,8580
    +8880,9000,8920,8800
    +8840,9180,8880,9000
    +8800,9220,8840,9180
    +8800,9220,8840,9340
    +8760,9380,8840,9340
    +8560,9340,8760,9380
    +8360,9360,8560,9340
    +8160,9360,8360,9360
    +8040,9340,8160,9360
    +7860,9360,8040,9340
    +7680,9360,7860,9360
    +7520,9360,7680,9360
    +7420,9260,7520,9360
    +7400,9080,7420,9260
    +7400,9080,7420,8860
    +7420,8860,7440,8720
    +7440,8720,7480,8660
    +7480,8660,7520,8540
    +7520,8540,7600,8460
    +7600,8460,7800,8480
    +7800,8480,8040,8480
    +8040,8480,8280,8480
    +8280,8480,8500,8460
    +8500,8460,8620,8440
    +8620,8440,8660,8340
    +8660,8340,8660,8220
    +8660,8220,8700,8080
    +8700,8080,8700,7920
    +8700,7920,8700,7760
    +8700,7760,8700,7620
    +8700,7480,8700,7620
    +8700,7480,8700,7320
    +8700,7160,8700,7320
    +8920,7220,8960,7040
    +8660,7040,8700,7160
    +8660,7040,8700,6880
    +8660,6700,8700,6880
    +8660,6700,8700,6580
    +8700,6460,8700,6580
    +8700,6460,8700,6320
    +8700,6160,8700,6320
    +8700,6160,8760,6020
    +8760,6020,8760,5860
    +8760,5860,8760,5700
    +8760,5700,8760,5540
    +8760,5540,8760,5360
    +8760,5360,8760,5180
    +8760,5000,8760,5180
    +8700,4820,8760,5000
    +8560,4740,8700,4820
    +8420,4700,8560,4740
    +8280,4700,8420,4700
    +8100,4700,8280,4700
    +7980,4700,8100,4700
    +7820,4740,7980,4700
    +7800,4920,7820,4740
    +7800,4920,7900,4960
    +7900,4960,8060,4980
    +8060,4980,8220,5000
    +8220,5000,8420,5040
    +8420,5040,8460,5120
    +8460,5180,8460,5120
    +8360,5200,8460,5180
    +8360,5280,8360,5200
    +8160,5300,8360,5280
    +8040,5260,8160,5300
    +7860,5220,8040,5260
    +7720,5160,7860,5220
    +7640,5120,7720,5160
    +7480,5120,7640,5120
    +7240,5120,7480,5120
    +7000,5120,7240,5120
    +6800,5160,7000,5120
    +6640,5220,6800,5160
    +6600,5360,6640,5220
    +6600,5460,6600,5360
    +6480,5520,6600,5460
    +6240,5540,6480,5520
    +5980,5540,6240,5540
    +5740,5540,5980,5540
    +5500,5520,5740,5540
    +5400,5520,5500,5520
    +5280,5540,5400,5520
    +5080,5540,5280,5540
    +4940,5540,5080,5540
    +4760,5540,4940,5540
    +4600,5540,4760,5540
    +4440,5560,4600,5540
    +4040,5580,4120,5520
    +4260,5540,4440,5560
    +4120,5520,4260,5540
    +4020,5720,4040,5580
    +4020,5840,4020,5720
    +4020,5840,4080,5940
    +4080,5940,4120,6040
    +4120,6040,4200,6080
    +4200,6080,4340,6080
    +4340,6080,4500,6060
    +4500,6060,4700,6060
    +4700,6060,4880,6060
    +4880,6060,5080,6060
    +5080,6060,5280,6080
    +5280,6080,5440,6100
    +5440,6100,5660,6100
    +5660,6100,5900,6080
    +5900,6080,6120,6080
    +6120,6080,6360,6080
    +6360,6080,6480,6100
    +6480,6100,6540,6060
    +6540,6060,6720,6060
    +6720,6060,6940,6060
    +6940,6060,7140,6060
    +7400,6060,7600,6060
    +7140,6060,7400,6060
    +7600,6060,7800,6060
    +7800,6060,7860,6080
    +7860,6080,8060,6080
    +8060,6080,8220,6080
    +8220,6080,8320,6140
    +8320,6140,8360,6300
    +8320,6460,8360,6300
    +8320,6620,8320,6460
    +8320,6800,8320,6620
    +8320,6960,8320,6800
    +8320,6960,8360,7120
    +8320,7280,8360,7120
    +8320,7440,8320,7280
    +8320,7600,8320,7440
    +8100,7580,8220,7600
    +8220,7600,8320,7600
    +7900,7560,8100,7580
    +7680,7560,7900,7560
    +7480,7580,7680,7560
    +7280,7580,7480,7580
    +7080,7580,7280,7580
    +7000,7600,7080,7580
    +6880,7600,7000,7600
    +6800,7580,6880,7600
    +6640,7580,6800,7580
    +6540,7580,6640,7580
    +6380,7600,6540,7580
    +6280,7620,6380,7600
    +6240,7700,6280,7620
    +6240,7700,6240,7800
    +6240,7840,6240,7800
    +6080,7840,6240,7840
    +5960,7820,6080,7840
    +5660,7840,5800,7840
    +5500,7800,5660,7840
    +5440,7700,5500,7800
    +5800,7840,5960,7820
    +5440,7540,5440,7700
    +5440,7440,5440,7540
    +5440,7320,5440,7440
    +5400,7320,5440,7320
    +5340,7400,5400,7320
    +5340,7400,5340,7500
    +5340,7600,5340,7500
    +5340,7600,5340,7720
    +5340,7720,5340,7860
    +5340,7860,5340,7960
    +5340,7960,5440,8020
    +5440,8020,5560,8020
    +5560,8020,5720,8040
    +5720,8040,5900,8060
    +5900,8060,6080,8060
    +6080,8060,6240,8060
    +6720,8040,6840,8060
    +6240,8060,6480,8040
    +6480,8040,6720,8040
    +6840,8060,6940,8060
    +6940,8060,7080,8120
    +7080,8120,7140,8180
    +7140,8460,7140,8320
    +7140,8620,7140,8460
    +7140,8620,7140,8740
    +7140,8860,7140,8740
    +7140,8960,7140,8860
    +7140,8960,7200,9080
    +7140,9200,7200,9080
    +7140,9200,7200,9320
    +7200,9320,7200,9460
    +7200,9760,7200,9900
    +7200,9620,7200,9460
    +7200,9620,7200,9760
    +7200,9900,7200,10060
    +7200,10220,7200,10060
    +7200,10360,7200,10220
    +7140,10400,7200,10360
    +6880,10400,7140,10400
    +6640,10360,6880,10400
    +6420,10360,6640,10360
    +6160,10380,6420,10360
    +5940,10340,6160,10380
    +5720,10320,5940,10340
    +5500,10340,5720,10320
    +5280,10300,5500,10340
    +5080,10300,5280,10300
    +4840,10280,5080,10300
    +4700,10280,4840,10280
    +4540,10280,4700,10280
    +4360,10280,4540,10280
    +4200,10300,4360,10280
    +4040,10380,4200,10300
    +4020,10500,4040,10380
    +3980,10640,4020,10500
    +3980,10640,3980,10760
    +3980,10760,4020,10920
    +4020,10920,4080,11000
    +4080,11000,4340,11020
    +4340,11020,4600,11060
    +4600,11060,4840,11040
    +4840,11040,4880,10960
    +4880,10740,4880,10960
    +4880,10740,4880,10600
    +4880,10600,5080,10560
    +5080,10560,5340,10620
    +5340,10620,5660,10620
    +5660,10620,6040,10600
    +6040,10600,6120,10620
    +6120,10620,6240,10720
    +6240,10720,6420,10740
    +6420,10740,6640,10760
    +6640,10760,6880,10780
    +7140,10780,7400,10780
    +6880,10780,7140,10780
    +7400,10780,7680,10780
    +7680,10780,8100,10760
    +8100,10760,8460,10740
    +8460,10740,8700,10760
    +8800,10840,8800,10980
    +8700,10760,8800,10840
    +8760,11200,8800,10980
    +8760,11200,8760,11380
    +8760,11380,8800,11560
    +8760,11680,8800,11560
    +8760,11760,8760,11680
    +8760,11760,8760,11920
    +8760,11920,8800,12080
    +8800,12200,8800,12080
    +8700,12240,8800,12200
    +8560,12220,8700,12240
    +8360,12220,8560,12220
    +8160,12240,8360,12220
    +7720,12220,7980,12220
    +7980,12220,8160,12240
    +7400,12200,7720,12220
    +7200,12180,7400,12200
    +7000,12160,7200,12180
    +6800,12160,7000,12160
    +6280,12140,6380,12180
    +6120,12180,6280,12140
    +6540,12180,6800,12160
    +6380,12180,6540,12180
    +5900,12200,6120,12180
    +5620,12180,5900,12200
    +5340,12120,5620,12180
    +5140,12100,5340,12120
    +4980,12120,5140,12100
    +4840,12120,4980,12120
    +4700,12200,4840,12120
    +4700,12380,4700,12200
    +4740,12480,4940,12520
    +4700,12380,4740,12480
    +4940,12520,5160,12560
    +5160,12560,5340,12600
    +5340,12600,5400,12600
    +5400,12600,5500,12600
    +5500,12600,5620,12600
    +5620,12600,5720,12560
    +5720,12560,5800,12440
    +5800,12440,5900,12380
    +5900,12380,6120,12420
    +6120,12420,6380,12440
    +6380,12440,6600,12460
    +6720,12460,6840,12520
    +6840,12520,6960,12520
    +6600,12460,6720,12460
    +6960,12520,7040,12500
    +7040,12500,7140,12440
    +7200,12440,7360,12500
    +7360,12500,7600,12560
    +7600,12560,7860,12600
    +7860,12600,8060,12500
    +8100,12500,8200,12340
    +8200,12340,8360,12360
    +8360,12360,8560,12400
    +8560,12400,8660,12420
    +8660,12420,8840,12400
    +8840,12400,9000,12360
    +9000,12360,9000,12360
    +2900,4400,2900,4280
    +900,7320,1000,7220
    +2640,13040,2900,12920
    +2900,12920,3160,12840
    +3480,12760,3780,12620
    +3780,12620,4020,12460
    +4300,12360,4440,12260
    +4020,12460,4300,12360
    +3160,12840,3480,12760
    +4440,12080,4440,12260
    +4440,12080,4440,11880
    +4440,11880,4440,11720
    +4440,11720,4600,11720
    +4600,11720,4760,11740
    +4760,11740,4980,11760
    +4980,11760,5160,11760
    +5160,11760,5340,11780
    +6000,11860,6120,11820
    +5340,11780,5620,11820
    +5620,11820,6000,11860
    +6120,11820,6360,11820
    +6360,11820,6640,11860
    +6940,11920,7240,11940
    +7240,11940,7520,11960
    +7520,11960,7860,11960
    +7860,11960,8100,11920
    +8100,11920,8420,11940
    +8420,11940,8460,11960
    +8460,11960,8500,11860
    +8460,11760,8500,11860
    +8320,11720,8460,11760
    +8160,11720,8320,11720
    +7940,11720,8160,11720
    +7720,11700,7940,11720
    +7520,11680,7720,11700
    +7320,11680,7520,11680
    +7200,11620,7320,11680
    +7200,11620,7200,11500
    +7200,11500,7280,11440
    +7280,11440,7420,11440
    +7420,11440,7600,11440
    +7600,11440,7980,11460
    +7980,11460,8160,11460
    +8160,11460,8360,11460
    +8360,11460,8460,11400
    +8420,11060,8500,11200
    +8280,11040,8420,11060
    +8100,11060,8280,11040
    +8460,11400,8500,11200
    +7800,11060,8100,11060
    +7520,11060,7800,11060
    +7240,11060,7520,11060
    +6940,11040,7240,11060
    +6640,11000,6940,11040
    +6420,10980,6640,11000
    +6360,11060,6420,10980
    +6360,11180,6360,11060
    +6200,11280,6360,11180
    +5960,11300,6200,11280
    +5720,11280,5960,11300
    +5500,11280,5720,11280
    +4940,11300,5200,11280
    +4660,11260,4940,11300
    +4440,11280,4660,11260
    +4260,11280,4440,11280
    +4220,11220,4260,11280
    +4080,11280,4220,11220
    +3980,11420,4080,11280
    +3980,11420,4040,11620
    +4040,11620,4040,11820
    +3980,11960,4040,11820
    +3840,12000,3980,11960
    +3720,11940,3840,12000
    +3680,11800,3720,11940
    +3680,11580,3680,11800
    +3680,11360,3680,11580
    +3680,11360,3680,11260
    +3680,11080,3680,11260
    +3680,11080,3680,10880
    +3680,10700,3680,10880
    +3680,10700,3680,10620
    +3680,10480,3680,10620
    +3680,10480,3680,10300
    +3680,10300,3680,10100
    +3680,10100,3680,9940
    +3680,9940,3720,9860
    +3720,9860,3920,9900
    +3920,9900,4220,9880
    +4980,9940,5340,9960
    +4220,9880,4540,9900
    +4540,9900,4980,9940
    +5340,9960,5620,9960
    +5620,9960,5900,9960
    +5900,9960,6160,10000
    +6160,10000,6480,10000
    +6480,10000,6720,10000
    +6720,10000,6880,9860
    +6880,9860,6880,9520
    +6880,9520,6940,9340
    +6940,9120,6940,9340
    +6940,9120,6940,8920
    +6940,8700,6940,8920
    +6880,8500,6940,8700
    +6880,8320,6880,8500
    +7140,8320,7140,8180
    +6760,8260,6880,8320
    +6540,8240,6760,8260
    +6420,8180,6540,8240
    +6280,8240,6420,8180
    +6160,8300,6280,8240
    +6120,8400,6160,8300
    +6080,8520,6120,8400
    +5840,8480,6080,8520
    +5620,8500,5840,8480
    +5500,8500,5620,8500
    +5340,8560,5500,8500
    +5160,8540,5340,8560
    +4620,8520,4880,8520
    +4360,8480,4620,8520
    +4880,8520,5160,8540
    +4140,8440,4360,8480
    +3920,8460,4140,8440
    +3720,8380,3920,8460
    +3680,8160,3720,8380
    +3680,8160,3720,7940
    +3720,7720,3720,7940
    +3680,7580,3720,7720
    +3680,7580,3720,7440
    +3720,7440,3720,7300
    +3720,7160,3720,7300
    +3720,7160,3720,7020
    +3720,7020,3780,6900
    +3780,6900,4080,6940
    +4080,6940,4340,6980
    +4340,6980,4600,6980
    +4600,6980,4880,6980
    +4880,6980,5160,6980
    +5160,6980,5400,7000
    +5400,7000,5560,7020
    +5560,7020,5660,7080
    +5660,7080,5660,7280
    +5660,7280,5660,7440
    +5660,7440,5740,7520
    +5740,7520,5740,7600
    +5740,7600,5900,7600
    +5900,7600,6040,7540
    +6040,7540,6040,7320
    +6040,7320,6120,7200
    +6120,7200,6120,7040
    +6120,7040,6240,7000
    +6240,7000,6480,7060
    +6480,7060,6800,7060
    +6800,7060,7080,7080
    +7080,7080,7320,7100
    +7940,7100,7980,6920
    +7860,6860,7980,6920
    +7640,6860,7860,6860
    +7400,6840,7640,6860
    +7320,7100,7560,7120
    +7560,7120,7760,7120
    +7760,7120,7940,7100
    +7200,6820,7400,6840
    +7040,6820,7200,6820
    +6600,6840,6840,6840
    +6380,6800,6600,6840
    +6120,6800,6380,6800
    +5900,6840,6120,6800
    +5620,6820,5900,6840
    +5400,6800,5620,6820
    +5140,6800,5400,6800
    +4880,6780,5140,6800
    +4600,6760,4880,6780
    +4340,6760,4600,6760
    +4080,6760,4340,6760
    +3840,6740,4080,6760
    +3680,6720,3840,6740
    +3680,6720,3680,6560
    +3680,6560,3720,6400
    +3720,6400,3720,6200
    +3720,6200,3780,6000
    +3720,5780,3780,6000
    +3720,5580,3720,5780
    +3720,5360,3720,5580
    +3720,5360,3840,5240
    +3840,5240,4200,5260
    +4200,5260,4600,5280
    +4600,5280,4880,5280
    +4880,5280,5140,5200
    +5140,5200,5220,5100
    +5220,5100,5280,4900
    +5280,4900,5340,4840
    +5340,4840,5720,4880
    +6120,4880,6480,4860
    +6880,4840,7200,4860
    +6480,4860,6880,4840
    +7200,4860,7320,4860
    +7320,4860,7360,4740
    +7360,4600,7440,4520
    +7360,4600,7360,4740
    +7440,4520,7640,4520
    +7640,4520,7800,4480
    +7800,4480,7800,4280
    +7800,4280,7800,4040
    +7800,4040,7800,3780
    +7800,3560,7800,3780
    +7800,3560,7860,3440
    +7860,3440,8060,3460
    +8060,3460,8160,3340
    +8160,3340,8160,3140
    +8160,3140,8160,2960
    +8000,2900,8160,2960
    +7860,2900,8000,2900
    +7640,2940,7860,2900
    +7400,2980,7640,2940
    +7100,2980,7400,2980
    +6840,3000,7100,2980
    +5620,2980,5840,2980
    +5840,2980,6500,3000
    +6500,3000,6840,3000
    +5560,2780,5620,2980
    +5560,2780,5560,2580
    +5560,2580,5560,2380
    +5560,2140,5560,2380
    +5560,2140,5560,1900
    +5560,1900,5620,1660
    +5620,1660,5660,1460
    +5660,1460,5660,1300
    +5500,1260,5660,1300
    +5340,1260,5500,1260
    +4600,1220,4840,1240
    +4440,1220,4600,1220
    +4440,1080,4440,1220
    +4440,1080,4600,1020
    +5080,1260,5340,1260
    +4840,1240,5080,1260
    +4600,1020,4940,1020
    +4940,1020,5220,1020
    +5220,1020,5560,960
    +5560,960,5660,860
    +5660,740,5660,860
    +5280,740,5660,740
    +4940,780,5280,740
    +4660,760,4940,780
    +4500,700,4660,760
    +4500,520,4500,700
    +4500,520,4700,460
    +4700,460,5080,440
    +5440,420,5740,420
    +5080,440,5440,420
    +5740,420,5840,360
    +5800,280,5840,360
    +5560,280,5800,280
    +4980,300,5280,320
    +4360,320,4660,300
    +4200,360,4360,320
    +5280,320,5560,280
    +4660,300,4980,300
    +4140,480,4200,360
    +4140,480,4140,640
    +4140,640,4200,780
    +4200,780,4200,980
    +4200,980,4220,1180
    +4220,1400,4220,1180
    +4220,1400,4260,1540
    +4260,1540,4500,1540
    +4500,1540,4700,1520
    +4700,1520,4980,1540
    +5280,1560,5400,1560
    +4980,1540,5280,1560
    +5400,1560,5400,1700
    +5400,1780,5400,1700
    +5340,1900,5400,1780
    +5340,2020,5340,1900
    +5340,2220,5340,2020
    +5340,2220,5340,2420
    +5340,2420,5340,2520
    +5080,2600,5220,2580
    +5220,2580,5340,2520
    +4900,2580,5080,2600
    +4700,2540,4900,2580
    +4500,2540,4700,2540
    +4220,2580,4340,2540
    +4200,2700,4220,2580
    +4340,2540,4500,2540
    +3980,2740,4200,2700
    +3840,2740,3980,2740
    +3780,2640,3840,2740
    +3780,2640,3780,2460
    +3780,2280,3780,2460
    +3620,2020,3780,2100
    +3780,2280,3780,2100
    +3360,2040,3620,2020
    +3080,2040,3360,2040
    +2840,2020,3080,2040
    +2740,1940,2840,2020
    +2740,1940,2800,1800
    +2800,1640,2800,1800
    +2800,1640,2800,1460
    +2800,1300,2800,1460
    +2700,1180,2800,1300
    +2480,1140,2700,1180
    +1580,1200,1720,1200
    +2240,1180,2480,1140
    +1960,1180,2240,1180
    +1720,1200,1960,1180
    +1500,1320,1580,1200
    +1500,1440,1500,1320
    +1500,1440,1760,1480
    +1760,1480,1940,1480
    +1940,1480,2140,1500
    +2140,1500,2320,1520
    +2400,1560,2400,1700
    +2280,1820,2380,1780
    +2320,1520,2400,1560
    +2380,1780,2400,1700
    +2080,1840,2280,1820
    +1720,1820,2080,1840
    +1420,1800,1720,1820
    +1280,1800,1420,1800
    +1240,1720,1280,1800
    +1240,1720,1240,1600
    +1240,1600,1280,1480
    +1280,1340,1280,1480
    +1180,1280,1280,1340
    +1000,1280,1180,1280
    +760,1280,1000,1280
    +360,1240,540,1260
    +180,1220,360,1240
    +540,1260,760,1280
    +180,1080,180,1220
    +180,1080,180,1000
    +180,1000,360,940
    +360,940,540,960
    +540,960,820,980
    +1100,980,1200,920
    +820,980,1100,980
    +6640,11860,6940,11920
    +5200,11280,5500,11280
    +4120,7330,4120,7230
    +4120,7230,4660,7250
    +4660,7250,4940,7250
    +4940,7250,5050,7340
    +5010,7400,5050,7340
    +4680,7380,5010,7400
    +4380,7370,4680,7380
    +4120,7330,4360,7370
    +4120,7670,4120,7760
    +4120,7670,4280,7650
    +4280,7650,4540,7660
    +4550,7660,4820,7680
    +4820,7680,4900,7730
    +4880,7800,4900,7730
    +4620,7820,4880,7800
    +4360,7790,4620,7820
    +4120,7760,4360,7790
    +6840,6840,7040,6820
    +5720,4880,6120,4880
    +1200,920,1340,810
    +1340,810,1520,790
    +1520,790,1770,800
    +2400,790,2600,750
    +2600,750,2640,520
    +2520,470,2640,520
    +2140,470,2520,470
    +1760,800,2090,800
    +2080,800,2400,790
    +1760,450,2140,470
    +1420,450,1760,450
    +1180,440,1420,450
    +900,480,1180,440
    +640,450,900,480
    +360,440,620,450
    +120,430,360,440
    +0,520,120,430
    +-20,780,0,520
    +-20,780,-20,1020
    +-20,1020,-20,1150
    +-20,1150,0,1300
    +0,1470,60,1530
    +0,1300,0,1470
    +60,1530,360,1530
    +360,1530,660,1520
    +660,1520,980,1520
    +980,1520,1040,1520
    +1040,1520,1070,1560
    +1070,1770,1070,1560
    +1070,1770,1100,2010
    +1070,2230,1100,2010
    +1070,2240,1180,2340
    +1180,2340,1580,2340
    +1580,2340,1940,2350
    +1940,2350,2440,2350
    +2440,2350,2560,2380
    +2560,2380,2600,2540
    +2810,2640,3140,2680
    +2600,2540,2810,2640
    +3140,2680,3230,2780
    +3230,2780,3260,2970
    +3230,3220,3260,2970
    +3200,3470,3230,3220
    +3200,3480,3210,3760
    +3210,3760,3210,4040
    +3200,4040,3230,4310
    +3210,4530,3230,4310
    +3210,4530,3230,4730
    +3230,4960,3230,4730
    +3230,4960,3260,5190
    +3170,5330,3260,5190
    +2920,5330,3170,5330
    +2660,5360,2920,5330
    +2420,5330,2660,5360
    +2200,5280,2400,5330
    +2020,5280,2200,5280
    +1840,5260,2020,5280
    +1660,5280,1840,5260
    +1500,5300,1660,5280
    +1360,5270,1500,5300
    +1200,5290,1340,5270
    +1070,5400,1200,5290
    +1040,5630,1070,5400
    +1000,5900,1040,5630
    +980,6170,1000,5900
    +980,6280,980,6170
    +980,6540,980,6280
    +980,6540,1040,6720
    +1040,6720,1360,6730
    +1360,6730,1760,6710
    +2110,6720,2420,6730
    +1760,6710,2110,6720
    +2420,6730,2640,6720
    +2640,6720,2970,6720
    +2970,6720,3160,6700
    +3160,6700,3240,6710
    +3240,6710,3260,6890
    +3260,7020,3260,6890
    +3230,7180,3260,7020
    +3230,7350,3230,7180
    +3210,7510,3230,7350
    +3210,7510,3210,7690
    +3210,7870,3210,7690
    +3210,7870,3210,7980
    +3200,8120,3210,7980
    +3200,8330,3200,8120
    +3160,8520,3200,8330
    +2460,11100,2480,11020
    +2200,11180,2460,11100
    +1260,11350,1600,11320
    +600,11430,930,11400
    +180,11340,620,11430
    +1600,11320,1910,11280
    +1910,11280,2200,11180
    +923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157
    +
    +

    Platformer - The Little Probe - Data - level_lava.txt

    +
    # ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt
    +100,10740,500,10780
    +500,10780,960,10760
    +960,10760,1340,10760
    +1380,10760,1820,10780
    +1820,10780,2240,10780
    +2280,10780,2740,10740
    +2740,10740,3000,10780
    +3000,10780,3140,11020
    +-520,8820,-480,9160
    +-520,8480,-520,8820
    +-520,8480,-480,8180
    +-480,8180,-200,8120
    +-200,8120,100,8220
    +100,8220,420,8240
    +420,8240,760,8260
    +760,8260,1140,8280
    +1140,8280,1500,8200
    +1500,8200,1880,8240
    +1880,8240,2240,8260
    +2240,8260,2320,8480
    +2320,8480,2380,8680
    +2240,8860,2380,8680
    +2240,9080,2240,8860
    +2240,9080,2320,9260
    +2320,9260,2480,9440
    +2480,9440,2600,9640
    +2480,9840,2600,9640
    +2400,10020,2480,9840
    +2240,10080,2400,10020
    +1960,10080,2240,10080
    +1720,10080,1960,10080
    +1460,10080,1720,10080
    +1180,10080,1420,10080
    +900,10080,1180,10080
    +640,10080,900,10080
    +640,10080,640,9900
    +60,10520,100,10740
    +40,10240,60,10520
    +40,10240,40,9960
    +40,9960,40,9680
    +40,9680,40,9360
    +40,9360,60,9080
    +60,9080,100,8860
    +100,8860,460,9040
    +460,9040,760,9220
    +760,9220,1140,9220
    +1140,9220,1720,9200
    +-660,11580,-600,11420
    +-660,11800,-660,11580
    +-660,12000,-660,11800
    +-660,12000,-600,12220
    +-600,12220,-600,12440
    +-600,12440,-600,12640
    +-600,11240,-260,11280
    +-260,11280,100,11240
    +9000,12360,9020,12400
    +9020,12620,9020,12400
    +9020,12840,9020,12620
    +9020,13060,9020,12840
    +9020,13060,9020,13240
    +9020,13240,9020,13420
    +9020,13420,9020,13600
    +9020,13600,9020,13780
    +8880,13900,9020,13780
    +8560,13800,8880,13900
    +8220,13780,8560,13800
    +7860,13760,8220,13780
    +7640,13780,7860,13760
    +7360,13800,7640,13780
    +7100,13800,7360,13800
    +6540,13760,6800,13780
    +6800,13780,7100,13800
    +6280,13760,6540,13760
    +5760,13760,6280,13760
    +5220,13780,5760,13760
    +4700,13760,5220,13780
    +4200,13740,4700,13760
    +3680,13720,4200,13740
    +3140,13700,3680,13720
    +2600,13680,3140,13700
    +2040,13940,2600,13680
    +1640,13940,2040,13940
    +1200,13960,1640,13940
    +840,14000,1200,13960
    +300,13960,840,14000
    +-200,13900,300,13960
    +-600,12840,-600,12640
    +-600,13140,-600,12840
    +-600,13140,-600,13420
    +-600,13700,-600,13420
    +-600,13700,-600,13820
    +-600,13820,-200,13900
    +-600,11240,-560,11000
    +-560,11000,-480,10840
    +-520,10660,-480,10840
    +-520,10660,-520,10480
    +-520,10480,-520,10300
    +-520,10260,-480,10080
    +-480,9880,-440,10060
    +-520,9680,-480,9880
    +-520,9680,-480,9400
    +-480,9400,-480,9160
    +1820,9880,2140,9800
    +1540,9880,1820,9880
    +1200,9920,1500,9880
    +900,9880,1200,9920
    +640,9900,840,9880
    +2380,8760,2800,8760
    +2800,8760,2840,8660
    +2840,8660,2840,8420
    +2840,8160,2840,8420
    +2800,7900,2840,8160
    +2800,7900,2800,7720
    +2800,7540,2800,7720
    +2800,7540,2800,7360
    +2700,7220,2800,7360
    +2400,7220,2700,7220
    +2080,7240,2400,7220
    +1760,7320,2080,7240
    +1380,7360,1720,7320
    +1040,7400,1340,7360
    +640,7400,1000,7420
    +300,7380,640,7400
    +0,7300,240,7380
    +-300,7180,-60,7300
    +-380,6860,-360,7180
    +-380,6880,-360,6700
    +-360,6700,-260,6540
    +-260,6540,0,6520
    +0,6520,240,6640
    +240,6640,460,6640
    +460,6640,500,6480
    +500,6260,500,6480
    +460,6060,500,6260
    +460,5860,460,6060
    +460,5860,500,5640
    +500,5640,540,5440
    +540,5440,580,5220
    +580,5220,580,5000
    +580,4960,580,4740
    +580,4740,960,4700
    +960,4700,1140,4760
    +1140,4760,1420,4740
    +1420,4740,1720,4700
    +1720,4700,2000,4740
    +2000,4740,2380,4760
    +2380,4760,2700,4800
    +1720,4600,1760,4300
    +1760,4300,2200,4340
    +2200,4340,2560,4340
    +2560,4340,2740,4340
    +2160,12580,2440,12400
    +1820,12840,2160,12580
    +1500,13080,1820,12840
    +1140,13340,1500,13080
    +1140,13340,1580,13220
    +2110,13080,2520,13000
    +2520,13000,2900,12800
    +1580,13220,2110,13080
    +2900,12800,3200,12680
    +3200,12680,3440,12640
    +3440,12640,3720,12460
    +3720,12460,4040,12320
    +4040,12320,4360,12200
    +4360,11940,4380,12180
    +4360,11700,4360,11940
    +4360,11700,4540,11500
    +4540,11500,4880,11540
    +6000,11660,6280,11640
    +5440,11600,5720,11610
    +5720,11610,6000,11660
    +6280,11640,6760,11720
    +6760,11720,7060,11780
    +7060,11780,7360,11810
    +7360,11810,7640,11840
    +7640,11840,8000,11830
    +8000,11830,8320,11850
    +8320,11850,8390,11800
    +8330,11760,8390,11800
    +8160,11760,8330,11760
    +7910,11750,8160,11760
    +7660,11740,7900,11750
    +7400,11730,7660,11740
    +7160,11680,7400,11730
    +7080,11570,7160,11680
    +7080,11570,7100,11350
    +7100,11350,7440,11280
    +7440,11280,7940,11280
    +7960,11280,8360,11280
    +5840,11540,6650,11170
    +4880,11540,5440,11600
    +3410,11830,3420,11300
    +3410,11260,3520,10920
    +3520,10590,3520,10920
    +3520,10590,3540,10260
    +3520,9900,3540,10240
    +3520,9900,3640,9590
    +3640,9570,4120,9590
    +4140,9590,4600,9680
    +4620,9680,5030,9730
    +5120,9750,5520,9800
    +5620,9820,6080,9800
    +6130,9810,6580,9820
    +6640,9820,6800,9700
    +6780,9400,6800,9700
    +6780,9400,6840,9140
    +6820,8860,6840,9120
    +6780,8600,6820,8830
    +6720,8350,6780,8570
    +6480,8340,6720,8320
    +6260,8400,6480,8340
    +6050,8580,6240,8400
    +5760,8630,6040,8590
    +5520,8690,5740,8630
    +5120,8690,5450,8700
    +4570,8670,5080,8690
    +4020,8610,4540,8670
    +3540,8480,4020,8610
    +3520,8230,3520,8480
    +3520,7930,3520,8230
    +3520,7930,3540,7630
    +3480,7320,3540,7610
    +3480,7280,3500,7010
    +3500,6980,3680,6850
    +3680,6850,4220,6840
    +4230,6840,4760,6850
    +4780,6850,5310,6860
    +5310,6860,5720,6940
    +5720,6940,5880,7250
    +5880,7250,5900,7520
    +100,11240,440,11300
    +440,11300,760,11330
    +1480,11280,1840,11230
    +2200,11130,2360,11090
    +1840,11230,2200,11130
    +
    +

    Rpg Narrative - Choose Your Own Adventure - decision.rb

    +
    # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb
    +# Hey there! Welcome to Four Decisions. Here is how you
    +# create your decision tree. Remove =being and =end from the text to
    +# enable the game (just save the file). Change stuff and see what happens!
    +
    +def game
    +  {
    +    starting_decision: :stormy_night,
    +    decisions: {
    +      stormy_night: {
    +        description: 'It was a dark and stormy night. (storyline located in decision.rb)',
    +        option_one: {
    +          description: 'Go to sleep.',
    +          decision: :nap
    +        },
    +        option_two: {
    +          description: 'Watch a movie.',
    +          decision: :movie
    +        },
    +        option_three: {
    +          description: 'Go outside.',
    +          decision: :go_outside
    +        },
    +        option_four: {
    +          description: 'Get a snack.',
    +          decision: :get_a_snack
    +        }
    +      },
    +      nap: {
    +        description: 'You took a nap. The end.',
    +        option_one: {
    +          description: 'Start over.',
    +          decision: :stormy_night
    +        }
    +      }
    +    }
    +  }
    +end
    +
    +
    +

    Rpg Narrative - Choose Your Own Adventure - main.rb

    +
    # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb
    +=begin
    +
    + Reminders:
    +
    + - Hashes: Collection of unique keys and their corresponding values. The values can be found
    +   using their keys.
    +
    +   In this sample app, the decisions needed for the game are stored in a hash. In fact, the
    +   decision.rb file contains hashes inside of other hashes!
    +
    +   Each option is a key in the first hash, but also contains a hash (description and
    +   decision being its keys) as its value.
    +   Go into the decision.rb file and take a look before diving into the code below.
    +
    + - 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.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.
    +   For more information about the keyboard, go to mygame/documentation/06-keyboard.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.
    +
    +=end
    +
    +# This sample app provides users with a story and multiple decisions that they can choose to make.
    +# Users can make a decision using their keyboard, and the story will move forward based on user choices.
    +
    +# The decisions available to users are stored in the decision.rb file.
    +# We must have access to it for the game to function properly.
    +GAME_FILE = 'app/decision.rb' # found in app folder
    +
    +require GAME_FILE # require used to load another file, import class/method definitions
    +
    +# Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.
    +# Otherwise, the game is run.
    +def tick args
    +  if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method
    +    args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown
    +    args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]
    +  elsif respond_to?(:game) # otherwise, if responds to game
    +    args.state.loaded = true
    +    tick_game args # calls tick_game method, runs game
    +  end
    +
    +  if args.state.tick_count.mod_zero? 60 # update every 60 frames
    +    t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file
    +    if t != args.state.mtime
    +      args.state.mtime = t
    +      require GAME_FILE # require used to load file
    +      args.state.game_definition = nil # game definition and decision are empty
    +      args.state.decision_id = nil
    +    end
    +  end
    +end
    +
    +# Runs methods needed for game to function properly
    +# Creates a rectangular border around the screen
    +def tick_game args
    +  defaults args
    +  args.borders << args.grid.rect
    +  render_decision args
    +  process_inputs args
    +end
    +
    +# Sets default values and uses decision.rb file to define game and decision_id
    +# variable using the starting decision
    +def defaults args
    +  args.state.game_definition ||= game
    +  args.state.decision_id ||= args.state.game_definition[:starting_decision]
    +end
    +
    +# Outputs the possible decision descriptions the user can choose onto the screen
    +# as well as what key to press on their keyboard to make their decision
    +def render_decision args
    +  decision = current_decision args
    +  # text is either the value of decision's description key or warning that no description exists
    +  args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation
    +
    +  # All decisions are stored in a hash
    +  # The descriptions output onto the screen are the values for the description keys of the hash.
    +  if decision[:option_one]
    +    args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label
    +    args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision
    +  end
    +
    +  if decision[:option_two]
    +    args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description
    +    args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]
    +  end
    +
    +  if decision[:option_three]
    +    args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description
    +    args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]
    +  end
    +
    +  if decision[:option_four]
    +    args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description
    +    args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]
    +  end
    +end
    +
    +# Uses keyboard input from the user to make a decision
    +# Assigns the decision as the value of the decision_id variable
    +def process_inputs args
    +  decision = current_decision args # calls current_decision method
    +
    +  if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists
    +    args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id
    +  end
    +
    +  if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists
    +    args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id
    +  end
    +
    +  if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists
    +    args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id
    +  end
    +
    +  if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists
    +    args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id
    +  end
    +end
    +
    +# Uses decision_id's value to keep track of current decision being made
    +def current_decision args
    +  args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty
    +end
    +
    +# Resets the game.
    +$gtk.reset
     
     
    -

    99_genre_platformer/gorillas_basic/app/main.rb

    -
    class YouSoBasicGorillas
    -  attr_accessor :outputs, :grid, :state, :inputs
    +

    Rpg Narrative - Return Of Serenity - lowrez_simulator.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb
    +###################################################################################
    +# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES
    +# THE 64x64 CANVAS.
    +###################################################################################
     
    -  def tick
    -    defaults
    -    render
    -    calc
    -    process_inputs
    +TINY_RESOLUTION       = 64
    +TINY_SCALE            = 720.fdiv(TINY_RESOLUTION + 5)
    +CENTER_OFFSET         = 10
    +EMULATED_FONT_SIZE    = 20
    +EMULATED_FONT_X_ZERO  = 0
    +EMULATED_FONT_Y_ZERO  = 46
    +
    +def tick args
    +  sprites = []
    +  labels = []
    +  borders = []
    +  solids = []
    +  mouse = emulate_lowrez_mouse args
    +  args.state.show_gridlines = false
    +  lowrez_tick args, sprites, labels, borders, solids, mouse
    +  render_gridlines_if_needed args
    +  render_mouse_crosshairs args, mouse
    +  emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
    +end
    +
    +def emulate_lowrez_mouse args
    +  args.state.new_entity_strict(:lowrez_mouse) do |m|
    +    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
    +      m.click = [
    +        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
    +    else
    +      m.click = nil
    +      m.down = nil
    +    end
    +
    +    if args.mouse.up
    +      m.up = [
    +        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
    +    end
       end
    +end
     
    -  def defaults
    -    outputs.background_color = [33, 32, 87]
    -    state.building_spacing       = 1
    -    state.building_room_spacing  = 15
    -    state.building_room_width    = 10
    -    state.building_room_height   = 15
    -    state.building_heights       = [4, 4, 6, 8, 15, 20, 18]
    -    state.building_room_sizes    = [5, 4, 6, 7]
    -    state.gravity                = 0.25
    -    state.first_strike         ||= :player_1
    -    state.buildings            ||= []
    -    state.holes                ||= []
    -    state.player_1_score       ||= 0
    -    state.player_2_score       ||= 0
    -    state.wind                 ||= 0
    +def render_mouse_crosshairs args, mouse
    +  return unless args.state.show_gridlines
    +  args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]
    +end
    +
    +def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
    +  args.render_target(:lowrez).solids  << [0, 0, 1280, 720]
    +  args.render_target(:lowrez).sprites << sprites
    +  args.render_target(:lowrez).borders << borders
    +  args.render_target(:lowrez).solids  << solids
    +  args.outputs.primitives << labels.map do |l|
    +    as_label = l.label
    +    l.text.each_char.each_with_index.map do |char, i|
    +      [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, 'fonts/dragonruby-gtk-4x4.ttf'].label
    +    end
       end
     
    -  def render
    -    render_stage
    -    render_value_insertion
    -    render_gorillas
    -    render_holes
    -    render_banana
    -    render_game_over
    -    render_score
    -    render_wind
    +  args.sprites    << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]
    +end
    +
    +def render_gridlines_if_needed args
    +  if args.state.show_gridlines && args.static_lines.length == 0
    +    args.static_lines << 65.times.map do |i|
    +      [
    +        [CENTER_OFFSET + i * TINY_SCALE + 1,  0,
    +         CENTER_OFFSET + i * TINY_SCALE + 1,  720,                128, 128, 128],
    +        [CENTER_OFFSET + i * TINY_SCALE,      0,
    +         CENTER_OFFSET + i * TINY_SCALE,      720,                128, 128, 128],
    +        [CENTER_OFFSET,                       0 + i * TINY_SCALE,
    +         CENTER_OFFSET + 720,                 0 + i * TINY_SCALE, 128, 128, 128],
    +        [CENTER_OFFSET,                       1 + i * TINY_SCALE,
    +         CENTER_OFFSET + 720,                 1 + i * TINY_SCALE, 128, 128, 128]
    +      ]
    +    end
    +  elsif !args.state.show_gridlines
    +    args.static_lines.clear
    +  end
    +end
    +
    +
    +

    Rpg Narrative - Return Of Serenity - main.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb
    +require 'app/require.rb'
    +
    +def defaults args
    +  args.outputs.background_color = [0, 0, 0]
    +  args.state.last_story_line_text ||= ""
    +  args.state.scene_history ||= []
    +  args.state.storyline_history ||= []
    +  args.state.word_delay ||= 8
    +  if args.state.tick_count == 0
    +    args.gtk.stop_music
    +    args.outputs.sounds << 'sounds/static-loop.ogg'
    +  end
    +
    +  if args.state.last_story_line_text
    +    lines = args.state
    +                .last_story_line_text
    +                .gsub("-", "")
    +                .gsub("~", "")
    +                .wrapped_lines(50)
    +
    +    args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }
    +  elsif args.state.storyline_history[-1]
    +    lines = args.state
    +                .storyline_history[-1]
    +                .gsub("-", "")
    +                .gsub("~", "")
    +                .wrapped_lines(50)
    +
    +    args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }
    +  end
    +
    +  return if args.state.current_scene
    +  set_scene(args, day_one_beginning(args))
    +end
    +
    +def inputs_move_player args
    +  if args.state.scene_changed_at.elapsed_time > 5
    +    if args.keyboard.down  || args.keyboard.s || args.keyboard.j
    +      args.state.player.y -= 0.25
    +    elsif args.keyboard.up || args.keyboard.w || args.keyboard.k
    +      args.state.player.y += 0.25
    +    end
    +
    +    if args.keyboard.left     || args.keyboard.a  || args.keyboard.h
    +      args.state.player.x -= 0.25
    +    elsif args.keyboard.right || args.keyboard.d  || args.keyboard.l
    +      args.state.player.x += 0.25
    +    end
    +
    +    args.state.player.y = 60 if args.state.player.y > 63
    +    args.state.player.y =  0 if args.state.player.y < -3
    +    args.state.player.x = 60 if args.state.player.x > 63
    +    args.state.player.x =  0 if args.state.player.x < -3
    +  end
    +end
    +
    +def null_or_empty? ary
    +  return true unless ary
    +  return true if ary.length == 0
    +  return false
    +end
    +
    +def calc_storyline_hotspot args
    +  hotspots = args.state.storylines.find_all do |hs|
    +    args.state.player.inside_rect?(hs.shift_rect(-2, 0))
       end
     
    -  def render_score
    -    outputs.primitives << [0, 0, 1280, 31, fancy_white].solid
    -    outputs.primitives << [1, 1, 1279, 29].solid
    -    outputs.labels << [  10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]
    -    outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]
    +  if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot
    +    _, _, _, _, storyline = hotspots.first
    +    queue_storyline_text(args, storyline)
    +    args.state.inside_storyline_hotspot = true
    +  elsif null_or_empty?(hotspots)
    +    args.state.inside_storyline_hotspot = false
    +
    +    args.state.storyline_queue_empty_at ||= args.state.tick_count
    +    args.state.is_storyline_dialog_active = false
    +    args.state.scene_storyline_queue.clear
       end
    +end
     
    -  def render_wind
    -    outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid
    -    outputs.lines     <<  [640, 30, 640, 0, fancy_white]
    +def calc_scenes args
    +  hotspots = args.state.scenes.find_all do |hs|
    +    args.state.player.inside_rect?(hs.shift_rect(-2, 0))
       end
     
    -  def render_game_over
    -    return unless state.over
    -    outputs.primitives << [grid.rect, 0, 0, 0, 200].solid
    -    outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label
    -    if state.winner == :player_1
    -      outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label
    +  if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot
    +    _, _, _, _, scene_method_or_hash = hotspots.first
    +    if scene_method_or_hash.is_a? Symbol
    +      set_scene(args, send(scene_method_or_hash, args))
    +      args.state.last_hotspot_scene = scene_method_or_hash
    +      args.state.scene_history << scene_method_or_hash
         else
    -      outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label
    +      set_scene(args, scene_method_or_hash)
         end
    +    args.state.inside_scene_hotspot = true
    +  elsif null_or_empty?(hotspots)
    +    args.state.inside_scene_hotspot = false
       end
    +end
     
    -  def render_stage
    -    return unless state.stage_generated
    -    return if state.stage_rendered
    +def null_or_whitespace? word
    +  return true if !word
    +  return true if word.strip.length == 0
    +  return false
    +end
     
    -    outputs.static_solids << [grid.rect, 33, 32, 87]
    -    outputs.static_solids << state.buildings.map(&:solids)
    -    state.stage_rendered = true
    +def calc_storyline_presentation args
    +  return unless args.state.tick_count > args.state.next_storyline
    +  return unless args.state.scene_storyline_queue
    +  next_storyline = args.state.scene_storyline_queue.shift
    +  if null_or_whitespace? next_storyline
    +    args.state.storyline_queue_empty_at ||= args.state.tick_count
    +    args.state.is_storyline_dialog_active = false
    +    return
       end
    -
    -  def render_gorilla gorilla, id
    -    return unless gorilla
    -    if state.banana && state.banana.owner == gorilla
    -      animation_index  = state.banana.created_at.frame_index(3, 5, false)
    -    end
    -    if !animation_index
    -      outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]
    -    else
    -      outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]
    +  args.state.storyline_to_show = next_storyline
    +  args.state.is_storyline_dialog_active = true
    +  args.state.storyline_queue_empty_at = nil
    +  if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")
    +    args.state.next_storyline += 60
    +  elsif next_storyline.end_with?(",")
    +    args.state.next_storyline += 50
    +  elsif next_storyline.end_with?(":")
    +    args.state.next_storyline += 60
    +  else
    +    default_word_delay = 13 + args.state.word_delay - 8
    +    if next_storyline.gsub("-", "").gsub("~", "").length <= 4
    +      default_word_delay = 11 + args.state.word_delay - 8
         end
    +    number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length
    +    args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)
       end
    +end
     
    -  def render_gorillas
    -    render_gorilla state.player_1, :left
    -    render_gorilla state.player_2, :right
    +def inputs_reload_current_scene args
    +  return
    +  if args.inputs.keyboard.key_down.r!
    +    reload_current_scene
       end
    +end
     
    -  def render_value_insertion
    -    return if state.banana
    -    return if state.over
    -
    -    if    state.current_turn == :player_1_angle
    -      outputs.labels << [  10, 710, "Angle:    #{state.player_1_angle}_",    fancy_white]
    -    elsif state.current_turn == :player_1_velocity
    -      outputs.labels << [  10, 710, "Angle:    #{state.player_1_angle}",     fancy_white]
    -      outputs.labels << [  10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]
    -    elsif state.current_turn == :player_2_angle
    -      outputs.labels << [1120, 710, "Angle:    #{state.player_2_angle}_",    fancy_white]
    -    elsif state.current_turn == :player_2_velocity
    -      outputs.labels << [1120, 710, "Angle:    #{state.player_2_angle}",     fancy_white]
    -      outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]
    -    end
    +def inputs_dismiss_current_storyline args
    +  if args.inputs.keyboard.key_down.x!
    +    args.state.scene_storyline_queue.clear
       end
    +end
     
    -  def render_banana
    -    return unless state.banana
    -    rotation = state.tick_count.%(360) * 20
    -    rotation *= -1 if state.banana.dx > 0
    -    outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]
    +def inputs_restart_game args
    +  if args.inputs.keyboard.exclamation_point
    +    args.gtk.reset_state
       end
    +end
     
    -  def render_holes
    -    outputs.sprites << state.holes.map do |s|
    -      animation_index = s.created_at.frame_index(7, 3, false)
    -      if animation_index
    -        [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]
    -      else
    -        s.sprite
    -      end
    +def inputs_change_word_delay args
    +  if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign
    +    args.state.word_delay -= 2
    +    if args.state.word_delay < 0
    +      args.state.word_delay = 0
    +      # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"
    +    else
    +      # queue_storyline_text args, "Text speed INCREASED."
         end
       end
     
    -  def calc
    -    calc_generate_stage
    -    calc_current_turn
    -    calc_banana
    +  if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore
    +    args.state.word_delay += 2
    +    # queue_storyline_text args, "Text speed DECREASED."
       end
    +end
     
    -  def calc_current_turn
    -    return if state.current_turn
    -
    -    state.current_turn = :player_1_angle
    -    state.current_turn = :player_2_angle if state.first_strike == :player_2
    +def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil
    +  texts.each_with_index.map do |t, i|
    +    [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]
       end
    +end
     
    -  def calc_generate_stage
    -    return if state.stage_generated
    +def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse
    +  # args.state.show_gridlines = true
    +  defaults args
    +  render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  render_controller args, lowrez_borders
    +  lowrez_solids << [0, 0, 64, 64, 0, 0, 0]
    +  calc_storyline_presentation args
    +  calc_scenes args
    +  calc_storyline_hotspot args
    +  inputs_move_player args
    +  inputs_print_mouse_rect args, lowrez_mouse
    +  inputs_reload_current_scene args
    +  inputs_dismiss_current_storyline args
    +  inputs_change_word_delay args
    +  inputs_restart_game args
    +end
     
    -    state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)
    -    8.numbers.inject(state.buildings) do |buildings, i|
    -      buildings <<
    -        building_prefab(state.building_spacing +
    -                        state.buildings.last.right,
    -                        *random_building_size)
    +def render_controller args, lowrez_borders
    +  args.state.up_button    = [85, 40, 15, 15, 255, 255, 255]
    +  args.state.down_button  = [85, 20, 15, 15, 255, 255, 255]
    +  args.state.left_button  = [65, 20, 15, 15, 255, 255, 255]
    +  args.state.right_button = [105, 20, 15, 15, 255, 255, 255]
    +  lowrez_borders << args.state.up_button
    +  lowrez_borders << args.state.down_button
    +  lowrez_borders << args.state.left_button
    +  lowrez_borders << args.state.right_button
    +end
    +
    +def inputs_print_mouse_rect args, lowrez_mouse
    +  if lowrez_mouse.up
    +    args.state.mouse_held = false
    +  elsif lowrez_mouse.click
    +    mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]
    +    if args.state.up_button.intersect_rect? mouse_rect
    +      args.state.player.y += 1
         end
     
    -    building_two = state.buildings[1]
    -    state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),
    -                               building_two.h)
    +    if args.state.down_button.intersect_rect? mouse_rect
    +      args.state.player.y -= 1
    +    end
     
    -    building_nine = state.buildings[-3]
    -    state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),
    -                               building_nine.h)
    -    state.stage_generated = true
    -    state.wind = 1.randomize(:ratio, :sign)
    -  end
    +    if args.state.left_button.intersect_rect? mouse_rect
    +      args.state.player.x -= 1
    +    end
     
    -  def new_player x, y
    -    state.new_entity(:gorilla) do |p|
    -      p.x = x - 25
    -      p.y = y
    -      p.solid = [p.x, p.y, 50, 50]
    +    if args.state.right_button.intersect_rect? mouse_rect
    +      args.state.player.x += 1
    +    end
    +    args.state.mouse_held = true
    +  elsif args.state.mouse_held
    +    mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]
    +    if args.state.up_button.intersect_rect? mouse_rect
    +      args.state.player.y += 0.25
         end
    -  end
     
    -  def calc_banana
    -    return unless state.banana
    +    if args.state.down_button.intersect_rect? mouse_rect
    +      args.state.player.y -= 0.25
    +    end
     
    -    state.banana.x  += state.banana.dx
    -    state.banana.dx += state.wind.fdiv(50)
    -    state.banana.y  += state.banana.dy
    -    state.banana.dy -= state.gravity
    -    banana_collision = [state.banana.x, state.banana.y, 10, 10]
    +    if args.state.left_button.intersect_rect? mouse_rect
    +      args.state.player.x -= 0.25
    +    end
     
    -    if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)
    -      state.over = true
    -      if state.banana.owner == state.player_2
    -        state.winner = :player_2
    -      else
    -        state.winner = :player_1
    -      end
    +    if args.state.right_button.intersect_rect? mouse_rect
    +      args.state.player.x += 0.25
    +    end
    +  end
     
    -      state.player_2_score += 1
    -    elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)
    -      state.over = true
    -      if state.banana.owner == state.player_2
    -        state.winner = :player_1
    -      else
    -        state.winner = :player_2
    +  if lowrez_mouse.click
    +    dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x
    +    dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y
    +    x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy
    +    puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}"
    +    if args.state.previous_mouse_click
    +
    +      if dx < 0 && dx < 0
    +        x = x + w
    +        w = w.abs
    +        y = y + h
    +        h = h.abs
           end
    -      state.player_1_score += 1
    -    end
     
    -    if state.over
    -      place_hole
    -      return
    +      w += 1
    +      h += 1
    +
    +      args.state.previous_mouse_click = nil
    +    else
    +      args.state.previous_mouse_click = lowrez_mouse.click
    +      square_x, square_y = lowrez_mouse.click
         end
    +  end
    +end
    +
    +def try_centering! word
    +  word ||= ""
    +  just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")
    +  return word if just_word.strip.length == 0
    +  return word if just_word.include? "~"
    +  return "~#{word}" if just_word.length <= 2
    +  if just_word.length.mod_zero? 2
    +    center_index = just_word.length.idiv(2) - 1
    +  else
    +    center_index = (just_word.length - 1).idiv(2)
    +  end
    +  return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"
    +end
     
    -    return if state.holes.any? do |h|
    -      h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]
    -    end
    +def queue_storyline args, scene
    +  queue_storyline_text args, scene[:storyline]
    +end
     
    -    return unless state.banana.y < 0 || state.buildings.any? do |b|
    -      b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]
    -    end
    +def queue_storyline_text args, text
    +  args.state.last_story_line_text = text
    +  args.state.storyline_history << text if text
    +  words = (text || "").split(" ")
    +  words = words.map { |w| try_centering! w }
    +  args.state.scene_storyline_queue = words
    +  if args.state.scene_storyline_queue.length != 0
    +    args.state.scene_storyline_queue.unshift "~$--"
    +    args.state.storyline_to_show = "~."
    +  else
    +    args.state.storyline_to_show = ""
    +  end
    +  args.state.scene_storyline_queue << ""
    +  args.state.next_storyline = args.state.tick_count
    +end
     
    -    place_hole
    +def set_scene args, scene
    +  args.state.current_scene = scene
    +  args.state.background = scene[:background] ||  'sprites/todo.png'
    +  args.state.scene_fade = scene[:fade] || 0
    +  args.state.scenes = (scene[:scenes] || []).reject { |s| !s }
    +  args.state.scene_render_override = scene[:render_override]
    +  args.state.storylines = (scene[:storylines] || []).reject { |s| !s }
    +  args.state.scene_changed_at = args.state.tick_count
    +  if scene[:player]
    +    args.state.player = scene[:player]
       end
    +  args.state.inside_scene_hotspot = false
    +  args.state.inside_storyline_hotspot = false
    +  queue_storyline args, scene
    +end
     
    -  def place_hole
    -    return unless state.banana
    +def replay_storyline_rect
    +  [26, -1, 7, 4]
    +end
     
    -    state.holes << state.new_entity(:banana) do |b|
    -      b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']
    -    end
    +def labels_for_word word
    +  left_side_of_word = ""
    +  center_letter = ""
    +  right_side_of_word = ""
     
    -    state.banana = nil
    +  if word[0] == "~"
    +    left_side_of_word = ""
    +    center_letter = word[1]
    +    right_side_of_word = word[2..-1]
    +  elsif word.length > 0
    +    left_side_of_word, right_side_of_word = word.split("~")
    +    center_letter = right_side_of_word[0]
    +    right_side_of_word = right_side_of_word[1..-1]
       end
     
    -  def process_inputs_main
    -    return if state.banana
    -    return if state.over
    +  right_side_of_word = right_side_of_word.gsub("-", "")
     
    -    if inputs.keyboard.key_down.enter
    -      input_execute_turn
    -    elsif inputs.keyboard.key_down.backspace
    -      state.as_hash[state.current_turn] ||= ""
    -      state.as_hash[state.current_turn]   = state.as_hash[state.current_turn][0..-2]
    -    elsif inputs.keyboard.key_down.char
    -      state.as_hash[state.current_turn] ||= ""
    -      state.as_hash[state.current_turn]  += inputs.keyboard.key_down.char
    -    end
    -  end
    +  {
    +    left:   [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],
    +    center: [29, 2, center_letter, 255, 0, 0],
    +    right:  [34, 2, right_side_of_word]
    +  }
    +end
     
    -  def process_inputs_game_over
    -    return unless state.over
    -    return unless inputs.keyboard.key_down.truthy_keys.any?
    -    state.over = false
    -    outputs.static_solids.clear
    -    state.buildings.clear
    -    state.holes.clear
    -    state.stage_generated = false
    -    state.stage_rendered = false
    -    if state.first_strike == :player_1
    -      state.first_strike = :player_2
    -    else
    -      state.first_strike = :player_1
    -    end
    +def render_scenes args, lowrez_sprites
    +  lowrez_sprites << args.state.scenes.flat_map do |hs|
    +    hotspot_square args, hs.x, hs.y, hs.w, hs.h
       end
    +end
     
    -  def process_inputs
    -    process_inputs_main
    -    process_inputs_game_over
    +def render_storylines args, lowrez_sprites
    +  lowrez_sprites << args.state.storylines.flat_map do |hs|
    +    hotspot_square args, hs.x, hs.y, hs.w, hs.h
       end
    +end
     
    -  def input_execute_turn
    -    return if state.banana
    -
    -    if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)
    -      state.current_turn = :player_1_velocity
    -    elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)
    -      state.current_turn = :player_2_angle
    -      state.banana =
    -        new_banana(state.player_1,
    -                   state.player_1.x + 25,
    -                   state.player_1.y + 60,
    -                   state.player_1_angle,
    -                   state.player_1_velocity)
    -    elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)
    -      state.current_turn = :player_2_velocity
    -    elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)
    -      state.current_turn = :player_1_angle
    -      state.banana =
    -        new_banana(state.player_2,
    -                   state.player_2.x + 25,
    -                   state.player_2.y + 60,
    -                   180 - state.player_2_angle,
    -                   state.player_2_velocity)
    -    end
    +def adornments_alpha args, target_alpha = nil, minimum_alpha = nil
    +  return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at
    +  target_alpha ||= 255
    +  target_alpha * args.state.storyline_queue_empty_at.ease(60)
    +end
     
    -    if state.banana
    -      state.player_1_angle = nil
    -      state.player_1_velocity = nil
    -      state.player_2_angle = nil
    -      state.player_2_velocity = nil
    -    end
    +def hotspot_square args, x, y, w, h
    +  if w >= 3 && h >= 3
    +    [
    +      [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],
    +      [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],
    +      [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],
    +    ]
    +  else
    +    [
    +      [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],
    +    ]
       end
    +end
     
    -  def random_building_size
    -    [state.building_heights.sample, state.building_room_sizes.sample]
    +def render_storyline_dialog args, lowrez_labels, lowrez_sprites
    +  return unless args.state.is_storyline_dialog_active
    +  return unless args.state.storyline_to_show
    +  labels = labels_for_word args.state.storyline_to_show
    +  if true # high rez version
    +    scale = 8.88
    +    offset = 45
    +    size = 25
    +    args.outputs.labels << [offset + labels[:left].x.-(1) * scale,
    +                            labels[:left].y * TINY_SCALE + 55,
    +                            labels[:left].text, size, 0, 0, 0, 0, 255,
    +                            'fonts/manaspc.ttf']
    +    center_text = labels[:center].text
    +    center_text = "|" if center_text == "$"
    +    args.outputs.labels << [offset + labels[:center].x * scale,
    +                            labels[:center].y * TINY_SCALE + 55,
    +                            center_text, size, 0, 255, 0, 0, 255,
    +                            'fonts/manaspc.ttf']
    +    args.outputs.labels << [offset + labels[:right].x * scale,
    +                            labels[:right].y * TINY_SCALE + 55,
    +                            labels[:right].text, size, 0, 0, 0, 0, 255,
    +                            'fonts/manaspc.ttf']
    +  else
    +    lowrez_labels << labels[:left]
    +    lowrez_labels << labels[:center]
    +    lowrez_labels << labels[:right]
       end
    +  args.state.is_storyline_dialog_active = true
    +  render_player args, lowrez_sprites
    +  lowrez_sprites <<  [0, 0, 64, 8, 'sprites/label-background.png']
    +end
     
    -  def int? v
    -    v.to_i.to_s == v.to_s
    -  end
    +def render_player args, lowrez_sprites
    +  lowrez_sprites << player_md_down(args, *args.state.player)
    +end
     
    -  def random_building_color
    -    [[ 99,   0, 107],
    -     [ 35,  64, 124],
    -     [ 35, 136, 162],
    -     ].sample
    -  end
    +def render_adornments args, lowrez_sprites
    +  render_scenes args, lowrez_sprites
    +  render_storylines args, lowrez_sprites
    +  return if args.state.is_storyline_dialog_active
    +  lowrez_sprites << player_md_down(args, *args.state.player)
    +end
     
    -  def random_window_color
    -    [[ 88,  62, 104],
    -     [253, 224, 187]].sample
    -  end
    +def global_alpha_percentage args, max_alpha = 255
    +  return 255 unless args.state.scene_changed_at
    +  return 255 unless args.state.scene_fade
    +  return 255 unless args.state.scene_fade > 0
    +  return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)
    +end
     
    -  def windows_for_building starting_x, floors, rooms
    -    floors.-(1).combinations(rooms - 1).map do |floor, room|
    -      [starting_x +
    -       state.building_room_width.*(room) +
    -       state.building_room_spacing.*(room + 1),
    -       state.building_room_height.*(floor) +
    -       state.building_room_spacing.*(floor + 1),
    -       state.building_room_width,
    -       state.building_room_height,
    -       random_window_color]
    -    end
    +def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]
    +  if args.state.scene_render_override
    +    send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids
       end
    +  storyline_to_show = args.state.storyline_to_show || ""
    +  render_adornments args, lowrez_sprites
    +  render_storyline_dialog args, lowrez_labels, lowrez_sprites
     
    -  def building_prefab starting_x, floors, rooms
    -    state.new_entity(:building) do |b|
    -      b.x      = starting_x
    -      b.y      = 0
    -      b.w      = state.building_room_width.*(rooms) +
    -                 state.building_room_spacing.*(rooms + 1)
    -      b.h      = state.building_room_height.*(floors) +
    -                 state.building_room_spacing.*(floors + 1)
    -      b.right  = b.x + b.w
    -      b.rect   = [b.x, b.y, b.w, b.h]
    -      b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],
    -                  [b.x, b.y, b.w, b.h, random_building_color],
    -                  windows_for_building(b.x, floors, rooms)]
    +  if args.state.background == 'sprites/tribute-game-over.png'
    +    lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]
    +    lowrez_labels << [9, 6, 'Return of', 255, 255, 255]
    +    lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]
    +    if !args.state.ended
    +      args.gtk.stop_music
    +      args.outputs.sounds << 'sounds/music-loop.ogg'
    +      args.state.ended = true
         end
       end
    +end
     
    -  def parse_or_clear! game_prop
    -    if int? state.as_hash[game_prop]
    -      state.as_hash[game_prop] = state.as_hash[game_prop].to_i
    -      return true
    -    end
    +def player_md_right args, x, y
    +  [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]
    +end
     
    -    state.as_hash[game_prop] = nil
    -    return false
    -  end
    +def player_md_left args, x, y
    +  [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]
    +end
     
    -  def new_banana owner, x, y, angle, velocity
    -    state.new_entity(:banana) do |b|
    -      b.owner     = owner
    -      b.x         = x
    -      b.y         = y
    -      b.angle     = angle % 360
    -      b.velocity  = velocity / 5
    -      b.dx        = b.angle.vector_x(b.velocity)
    -      b.dy        = b.angle.vector_y(b.velocity)
    -    end
    -  end
    +def player_md_up args, x, y
    +  [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]
    +end
     
    -  def fancy_white
    -    [253, 252, 253]
    -  end
    +def player_md_down args, x, y
    +  [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]
     end
     
    -$you_so_basic_gorillas = YouSoBasicGorillas.new
    +def player_sm args, x, y
    +  [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]
    +end
     
    -def tick args
    -  $you_so_basic_gorillas.outputs = args.outputs
    -  $you_so_basic_gorillas.grid    = args.grid
    -  $you_so_basic_gorillas.state    = args.state
    -  $you_so_basic_gorillas.inputs  = args.inputs
    -  $you_so_basic_gorillas.tick
    +def player_xs args, x, y
    +  [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]
     end
     
     
    -

    99_genre_platformer/gorillas_basic/app/repl.rb

    -
    begin
    -  if $gtk.args.state.current_turn == :player_1_angle
    -    $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"
    -    $you_so_basic_gorillas.input_execute_turn
    -    $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"
    -    $you_so_basic_gorillas.input_execute_turn
    -  elsif $gtk.args.state.current_turn == :player_2_angle
    -    $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"
    -    $you_so_basic_gorillas.input_execute_turn
    -    $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"
    -    $you_so_basic_gorillas.input_execute_turn
    -  else
    -    $you_so_basic_gorillas.input_execute_turn
    -  end
    -rescue Exception => e
    -  puts e
    -end
    +

    Rpg Narrative - Return Of Serenity - repl.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb
    +puts $gtk.args.state.current_scene
     
     
    -

    99_genre_platformer/gorillas_basic/app/tests.rb

    -
    $gtk.reset 100
    -$gtk.supress_framerate_warning = true
    -$gtk.require 'app/tests/building_generation_tests.rb'
    -$gtk.tests.start
    +

    Rpg Narrative - Return Of Serenity - require.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb
    +require 'app/lowrez_simulator.rb'
    +require 'app/storyline_day_one.rb'
    +require 'app/storyline_blinking_light.rb'
    +require 'app/storyline_serenity_introduction.rb'
    +require 'app/storyline_speed_of_light.rb'
    +require 'app/storyline_serenity_alive.rb'
    +require 'app/storyline_serenity_bio.rb'
    +require 'app/storyline_anka.rb'
    +require 'app/storyline_final_message.rb'
    +require 'app/storyline_final_decision.rb'
    +require 'app/storyline.rb'
     
     
    -

    99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb

    -
    def test_solids args, assert
    -  game = YouSoBasicGorillas.new
    -  game.outputs = args.outputs
    -  game.grid = args.grid
    -  game.state = args.state
    -  game.inputs = args.inputs
    -  game.tick
    -  assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"
    -  game.tick
    -  assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"
    -  number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)
    -  the_only_background = 1
    -  static_solids = args.outputs.static_solids.length
    -  assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"
    +

    Rpg Narrative - Return Of Serenity - storyline.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb
    +def hotspot_top
    +  [4, 61, 56, 3]
     end
     
    -
    -

    99_genre_platformer/the_little_probe/app/main.rb

    -
    class FallingCircle
    -  attr_gtk
    +def hotspot_bottom
    +  [4, 0, 56, 3]
    +end
     
    -  def tick
    -    fiddle
    -    defaults
    -    render
    -    input
    -    calc
    -  end
    +def hotspot_top_right
    +  [62, 35, 3, 25]
    +end
     
    -  def fiddle
    -    state.gravity     = -0.02
    -    circle.radius     = 15
    -    circle.elasticity = 0.4
    -    camera.follow_speed = 0.4 * 0.4
    -  end
    +def hotspot_bottom_right
    +  [62, 0, 3, 25]
    +end
     
    -  def render
    -    render_stage_editor
    -    render_debug
    -    render_game
    -  end
    +def storyline_history_include? args, text
    +  args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }
    +end
     
    -  def defaults
    -    if state.tick_count == 0
    -      outputs.sounds << "sounds/bg.ogg"
    -    end
    +def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +end
     
    -    state.storyline ||= [
    -      { text: "<- -> to aim, hold space to charge",                            distance_gate: 0 },
    -      { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },
    -      { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },
    -      { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.",   distance_gate: 0 },
    -      { text: "jupiter's sure is beautiful...",   distance_gate: 4000 },
    -      { text: "hmm, it seems there's some kind of anomoly in the sky",   distance_gate: 7000 },
    -      { text: "dancing lights, i'll call them whisps.",   distance_gate: 8000 },
    -      { text: "#todo... look i ran out of time -_-",   distance_gate: 9000 },
    -      { text: "there's never enough time",   distance_gate: 9000 },
    -      { text: "the game jam was fun though ^_^",   distance_gate: 10000 },
    -    ]
    +def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +end
     
    -    load_level force: args.state.tick_count == 0
    -    state.line_mode            ||= :terrain
    +def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +end
     
    -    state.sound_index          ||= 1
    -    circle.potential_lift      ||= 0
    -    circle.angle               ||= 90
    -    circle.check_point_at      ||= -1000
    -    circle.game_over_at        ||= -1000
    -    circle.x                   ||= -485
    -    circle.y                   ||= 12226
    -    circle.check_point_x       ||= circle.x
    -    circle.check_point_y       ||= circle.y
    -    circle.dy                  ||= 0
    -    circle.dx                  ||= 0
    -    circle.previous_dy         ||= 0
    -    circle.previous_dx         ||= 0
    -    circle.angle               ||= 0
    -    circle.after_images        ||= []
    -    circle.terrains_to_monitor ||= {}
    -    circle.impact_history      ||= []
    +def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +end
     
    -    camera.x                   ||= 0
    -    camera.y                   ||= 0
    -    camera.target_x            ||= 0
    -    camera.target_y            ||= 0
    -    state.snaps                ||= { }
    -    state.snap_number            = 10
    +def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids
    +  lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0,  50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +  lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]
    +end
     
    -    args.state.storyline_x ||= -1000
    -    args.state.storyline_y ||= -1000
    -  end
    +def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []
    +  result_one_scene, result_one_label, result_one_text = context_result_one
    +  result_two_scene, result_two_label, result_two_text = context_result_two
    +  result_three_scene, result_three_label, result_three_text = context_result_three
    +  result_four_scene, result_four_label, result_four_text = context_result_four
     
    -  def render_game
    -    outputs.background_color = [0, 0, 0]
    -    outputs.sprites << [-circle.x + 1100,
    -                        -circle.y - 100,
    -                        2416 * 4,
    -                        3574 * 4,
    -                        'sprites/jupiter.png']
    -    outputs.sprites << [-circle.x,
    -                        -circle.y,
    -                        2416 * 4,
    -                        3574 * 4,
    -                        'sprites/level.png']
    -    outputs.sprites << state.whisp_queue
    -    render_aiming_retical
    -    render_circle
    -    render_notification
    -  end
    +  top_level_hash = {
    +    background: 'sprites/decision.png',
    +    fade: 60,
    +    player: [20, 36],
    +    storylines: [ ],
    +    scenes: [ ]
    +  }
     
    -  def render_notification
    -    toast_length = 500
    -    if circle.game_over_at.elapsed_time < toast_length
    -      label_text = "..."
    -    elsif circle.check_point_at.elapsed_time > toast_length
    -      args.state.current_storyline = nil
    -      return
    -    end
    -    if circle.check_point_at &&
    -       circle.check_point_at.elapsed_time == 1 &&
    -       !args.state.current_storyline
    -       if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]
    -         args.state.current_storyline = args.state.storyline.shift[:text]
    -         args.state.distance_traveled ||= 0
    -         args.state.storyline_x = circle.x
    -         args.state.storyline_y = circle.y
    -       end
    -      return unless args.state.current_storyline
    -    end
    -    label_text = args.state.current_storyline
    -    return unless label_text
    -    x = circle.x + camera.x
    -    y = circle.y + camera.y - 40
    -    w = 900
    -    h = 30
    -    outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid
    -    outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border
    -    outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]
    -  end
    +  confirmation_result_one_hash = {
    +    background: 'sprites/decision.png',
    +    scenes: [ ],
    +    storylines: [ ]
    +  }
    +
    +  confirmation_result_two_hash = {
    +    background: 'sprites/decision.png',
    +    scenes: [ ],
    +    storylines: [ ]
    +  }
     
    -  def render_aiming_retical
    -    outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,
    -                        state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,
    -                        10, 10, 'sprites/circle-orange.png']
    -    outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,
    -                        state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,
    -                        10, 10, 'sprites/circle-orange.png', 0, 128]
    -    if rand > 0.9
    -      outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,
    -                          state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,
    -                          10, 10, 'sprites/circle-white.png', 0, 128]
    -    end
    -  end
    +  confirmation_result_three_hash = {
    +    background: 'sprites/decision.png',
    +    scenes: [ ],
    +    storylines: [ ]
    +  }
     
    -  def render_circle
    -    outputs.sprites << circle.after_images.map do |ai|
    -      ai.merge(x: ai.x + state.camera.x - circle.radius,
    -               y: ai.y + state.camera.y - circle.radius,
    -               w: circle.radius * 2,
    -               h: circle.radius * 2,
    -               path: 'sprites/circle-white.png')
    -    end
    +  confirmation_result_four_hash = {
    +    background: 'sprites/decision.png',
    +    scenes: [ ],
    +    storylines: [ ]
    +  }
     
    -    outputs.sprites << [(circle.x - circle.radius) + state.camera.x,
    -                        (circle.y - circle.radius) + state.camera.y,
    -                        circle.radius * 2,
    -                        circle.radius * 2,
    -                        'sprites/probe.png']
    -  end
    +  top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]
    +  top_level_hash[:storylines] << [20, 35, 4, 4, context_action]
     
    -  def render_debug
    -    return unless state.debug_mode
    +  confirmation_result_one_hash[:scenes]       << [20, 35, 4, 4, top_level_hash]
    +  confirmation_result_one_hash[:scenes]       << [60, 50, 4, 4, result_one_scene]
    +  confirmation_result_one_hash[:storylines]   << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]
    +  confirmation_result_one_hash[:scenes]       << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    +  confirmation_result_one_hash[:scenes]       << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    +  confirmation_result_one_hash[:scenes]       << [40, 20, 4, 4, confirmation_result_two_hash]
     
    -    outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]
    -    outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]
    +  confirmation_result_two_hash[:scenes]       << [20, 35, 4, 4, top_level_hash]
    +  confirmation_result_two_hash[:scenes]       << [40, 50, 4, 4, confirmation_result_one_hash]
    +  confirmation_result_two_hash[:scenes]       << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    +  confirmation_result_two_hash[:scenes]       << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    +  confirmation_result_two_hash[:scenes]       << [60, 20, 4, 4, result_two_scene]
    +  confirmation_result_two_hash[:storylines]   << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]
     
    -    args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|
    -      h[:x] += state.camera.x
    -      h[:y] += state.camera.y
    -      h[:x2] += state.camera.x
    -      h[:y2] += state.camera.y
    -    end
    +  confirmation_result_three_hash[:scenes]     << [20, 35, 4, 4, top_level_hash]
    +  confirmation_result_three_hash[:scenes]     << [40, 50, 4, 4, confirmation_result_one_hash]
    +  confirmation_result_three_hash[:scenes]     << [40, 40, 4, 4, confirmation_result_four_hash]
    +  confirmation_result_three_hash[:scenes]     << [60, 30, 4, 4, result_three_scene]
    +  confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]
    +  confirmation_result_three_hash[:scenes]     << [40, 20, 4, 4, confirmation_result_two_hash]
     
    -    outputs.primitives << state.terrain.find_all do |t|
    -      circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)
    -    end.map do |t|
    -      [
    -        t.line.associate(r: 0, g: 255, b: 0) do |h|
    -          h.x  += state.camera.x
    -          h.y  += state.camera.y
    -          h.x2 += state.camera.x
    -          h.y2 += state.camera.y
    -          if circle.rect.intersect_rect? t[:rect]
    -            h[:r] = 255
    -            h[:g] = 0
    -          end
    -          h
    -        end,
    -        t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|
    -          h.x += state.camera.x
    -          h.y += state.camera.y
    -          h.b = 255 if line_near_rect? circle.rect, t
    -          h
    -        end
    -      ]
    -    end
    +  confirmation_result_four_hash[:scenes]      << [20, 35, 4, 4, top_level_hash]
    +  confirmation_result_four_hash[:scenes]      << [40, 50, 4, 4, confirmation_result_one_hash]
    +  confirmation_result_four_hash[:scenes]      << [60, 40, 4, 4, result_four_scene]
    +  confirmation_result_four_hash[:storylines]  << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]
    +  confirmation_result_four_hash[:scenes]      << [40, 30, 4, 4, confirmation_result_three_hash]
    +  confirmation_result_four_hash[:scenes]      << [40, 20, 4, 4, confirmation_result_two_hash]
     
    -    outputs.primitives << state.lava.find_all do |t|
    -      circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)
    -    end.map do |t|
    -      [
    -        t.line.associate(r: 0, g: 0, b: 255) do |h|
    -          h.x  += state.camera.x
    -          h.y  += state.camera.y
    -          h.x2 += state.camera.x
    -          h.y2 += state.camera.y
    -          if circle.rect.intersect_rect? t[:rect]
    -            h[:r] = 255
    -            h[:b] = 0
    -          end
    -          h
    -        end,
    -        t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|
    -          h.x += state.camera.x
    -          h.y += state.camera.y
    -          h.b = 255 if line_near_rect? circle.rect, t
    -          h
    -        end
    -      ]
    -    end
    +  top_level_hash[:scenes]     << [40, 50, 4, 4, confirmation_result_one_hash]
    +  top_level_hash[:scenes]     << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene
    +  top_level_hash[:scenes]     << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene
    +  top_level_hash[:scenes]     << [40, 20, 4, 4, confirmation_result_two_hash]
     
    -    if state.god_mode
    -      border = circle.rect.merge(x: circle.rect.x + state.camera.x,
    -                                 y: circle.rect.y + state.camera.y,
    -                                 g: 255)
    -    else
    -      border = circle.rect.merge(x: circle.rect.x + state.camera.x,
    -                                 y: circle.rect.y + state.camera.y,
    -                                 b: 255)
    -    end
    +  top_level_hash
    +end
     
    -    outputs.borders << border
    +def ship_control_hotspot offset_x, offset_y, a, b, c, d
    +  results = []
    +  results << [ 6 + offset_x, 0 + offset_y, 4, 4, a]  if a
    +  results << [ 1 + offset_x, 5 + offset_y, 4, 4, b]  if b
    +  results << [ 6 + offset_x, 5 + offset_y, 4, 4, c]  if c
    +  results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d
    +  results
    +end
     
    -    overlapping ||= {}
    +def reload_current_scene
    +  if $gtk.args.state.last_hotspot_scene
    +    set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)
    +    tick $gtk.args
    +  elsif respond_to? :set_scene
    +    set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)
    +    tick $gtk.args
    +  end
    +  $gtk.console.close
    +end
     
    -    circle.impact_history.each do |h|
    -      label_mod = 300
    -      x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x
    -      y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y
    -      10.times do
    -        if overlapping[x] && overlapping[x][y]
    -          y -= 52
    -        else
    -          break
    -        end
    -      end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_anka.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb
    +def anka_inside_room args
    +  {
    +    background: 'sprites/inside-home.png',
    +    player: [34, 35],
    +    storylines: [
    +      [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],
    +    ],
    +    scenes: [
    +      [32, -1, 8, 3, :anka_observatory]
    +    ]
    +  }
    +end
     
    -      overlapping[x] ||= {}
    -      overlapping[x][y] ||= true
    -      outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid
    -      outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 10, y +  9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 10, y -  5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]
    +def anka_observatory args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [51, 12],
    +    storylines: [
    +      [50, 10, 4, 4,   "Breathe, Hiro. Just see what's there... everything--- will- be okay."]
    +    ],
    +    scenes: [
    +      [30, 18, 5, 12, :anka_inside_mainframe]
    +    ],
    +    render_override: :blinking_light_inside_observatory_render
    +  }
    +end
     
    -      outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]
    +def anka_inside_mainframe args
    +  {
    +    player: [32, 4],
    +    background: 'sprites/mainframe.png',
    +    fade: 60,
    +    storylines: [
    +      [22, 45, 17, 4, (anka_last_reply args)],
    +      [45, 45,  4, 4, (anka_current_reply args)],
    +    ],
    +    scenes: [
    +      [*hotspot_top_right, :reply_to_anka]
    +    ]
    +  }
    +end
     
    -      outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 200, y +  9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]
    -      outputs.labels << [x + 200, y -  5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]
    -    end
    +def reply_to_anka args
    +  decision_graph anka_current_reply(args),
    +                 "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",
    +                 [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],
    +                 [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]
    +end
    +
    +def anka_last_reply args
    +  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    +    return "Buffer--: #{serenity_alive_firm_reply.quote}"
    +  else
    +    return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"
    +  end
    +end
    +
    +def anka_reply_whole_truth
    +  "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."
    +end
    +
    +def anka_reply_half_truth
    +  "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."
    +end
    +
    +def replied_with_whole_truth args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],
    +      [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],
    +    ]
    +  }
    +end
     
    -    if circle.floor
    -      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]
    -      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]
    -      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y +  85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0]
    -      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y +  86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]
    -      outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y +  70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]
    -      outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y +  71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]
    -    end
    -  end
    +def replied_with_half_truth args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],
    +      [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],
    +    ]
    +  }
    +end
     
    -  def render_stage_editor
    -    return unless state.god_mode
    -    return unless state.point_one
    -    args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]
    +def anka_current_reply args
    +  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    +    return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."
    +  else
    +    return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."
       end
    +end
     
    -  def trajectory body
    -    [body.x + body.dx,
    -     body.y + body.dy,
    -     body.x + body.dx * 1000,
    -     body.y + body.dy * 1000,
    -     0, 255, 255]
    +def replied_to_anka_back_home args
    +  if args.state.scene_history.include? :replied_with_whole_truth
    +    return {
    +      fade: 60,
    +      background: 'sprites/inside-home.png',
    +      player: [34, 4],
    +      storylines: [
    +        [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],
    +      ],
    +      scenes: [
    +        [30, 38, 12, 13, :final_message_sad],
    +      ]
    +    }
    +  else
    +    return {
    +      fade: 60,
    +      background: 'sprites/inside-home.png',
    +      player: [34, 4],
    +      storylines: [
    +        [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],
    +      ],
    +      scenes: [
    +        [30, 38, 12, 13, :final_message_happy],
    +      ]
    +    }
       end
    +end
     
    -  def lengthen_line line, num
    -    line = normalize_line(line)
    -    slope = geometry.line_slope(line, replace_infinity: 10).abs
    -    if slope < 2
    -      [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash
    -    else
    -      [line.x, line.y, line.x2, line.y2].line.to_hash
    -    end
    -  end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb
    +def the_blinking_light args
    +  {
    +    fade: 60,
    +    background: 'sprites/side-of-home.png',
    +    player: [16, 13],
    +    scenes: [
    +      [52, 24, 11, 5, :blinking_light_mountain_pass],
    +    ],
    +    render_override: :blinking_light_side_of_home_render
    +  }
    +end
     
    -  def normalize_line line
    -    if line.x > line.x2
    -      x  = line.x2
    -      y  = line.y2
    -      x2 = line.x
    -      y2 = line.y
    -    else
    -      x  = line.x
    -      y  = line.y
    -      x2 = line.x2
    -      y2 = line.y2
    -    end
    -    [x, y, x2, y2]
    -  end
    +def blinking_light_mountain_pass args
    +  {
    +    background: 'sprites/mountain-pass-zoomed-out.png',
    +    player: [4, 4],
    +    scenes: [
    +      [18, 47, 5, 5, :blinking_light_path_to_observatory]
    +    ],
    +    render_override: :blinking_light_mountain_pass_render
    +  }
    +end
     
    -  def rect_for_line line
    -    if line.x > line.x2
    -      x  = line.x2
    -      y  = line.y2
    -      x2 = line.x
    -      y2 = line.y
    -    else
    -      x  = line.x
    -      y  = line.y
    -      x2 = line.x2
    -      y2 = line.y2
    -    end
    +def blinking_light_path_to_observatory args
    +  {
    +    background: 'sprites/path-to-observatory.png',
    +    player: [60, 4],
    +    scenes: [
    +      [0, 26, 5, 5, :blinking_light_observatory]
    +    ],
    +    render_override: :blinking_light_path_to_observatory_render
    +  }
    +end
     
    -    w = x2 - x
    -    h = y2 - y
    +def blinking_light_observatory args
    +  {
    +    background: 'sprites/observatory.png',
    +    player: [60, 2],
    +    scenes: [
    +      [28, 39, 4, 10, :blinking_light_inside_observatory]
    +    ],
    +    render_override: :blinking_light_observatory_render
    +  }
    +end
     
    -    if h < 0
    -      y += h
    -      h = h.abs
    -    end
    +def blinking_light_inside_observatory args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    player: [60, 2],
    +    storylines: [
    +      [50, 2, 4, 8,   "That's weird. I thought- this- mainframe-- was broken--."]
    +    ],
    +    scenes: [
    +      [30, 18, 5, 12, :blinking_light_inside_mainframe]
    +    ],
    +    render_override: :blinking_light_inside_observatory_render
    +  }
    +end
     
    -    if w < circle.radius
    -      x -= circle.radius
    -      w = circle.radius * 2
    -    end
    +def blinking_light_inside_mainframe args
    +  {
    +    background: 'sprites/mainframe.png',
    +    fade: 60,
    +    player: [30, 4],
    +    scenes: [
    +      [62, 32, 4, 32, :reply_to_introduction]
    +    ],
    +    storylines: [
    +      [43, 43,  8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],
    +      [30, 30,  4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],
    +      [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],
    +      [14, 20, 24, 4, "What the heck activated--- this thing- though?"]
    +    ]
    +  }
    +end
     
    -    if h < circle.radius
    -      y -= circle.radius
    -      h = circle.radius * 2
    -    end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_day_one.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb
    +def day_one_beginning args
    +  {
    +    background: 'sprites/side-of-home.png',
    +    player: [16, 13],
    +    scenes: [
    +      [0, 0, 64, 2, :day_one_infront_of_home],
    +    ],
    +    storylines: [
    +      [35, 10, 6, 6,  "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]
    +    ]
    +  }
    +end
     
    -    { x: x, y: y, w: w, h: h }
    -  end
    +def day_one_infront_of_home args
    +  {
    +    background: 'sprites/front-of-home.png',
    +    player: [56, 23],
    +    scenes: [
    +      [43, 34, 10, 16, :day_one_home],
    +      [62, 0,  3, 40, :day_one_beginning],
    +      [0, 4, 3, 20, :day_one_ceremony]
    +    ],
    +    storylines: [
    +      [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],
    +    ]
    +  }
    +end
     
    -  def snap_to_grid x, y, snaps
    -    snap_number = 10
    -    x = x.to_i
    -    y = y.to_i
    +def day_one_home args
    +  {
    +    background: 'sprites/inside-home.png',
    +    player: [34, 3],
    +    scenes: [
    +      [28, 0, 12, 2, :day_one_infront_of_home]
    +    ],
    +    storylines: [
    +      [
    +        38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."
    +      ],
    +      [
    +        28, 7, 4, 7,
    +        "Ahhh. My reading- couch. It's so comfortable--."
    +      ],
    +      [
    +        38, 21, 4, 4,
    +        "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."
    +      ],
    +      [
    +        45, 37, 4, 8,
    +        "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."
    +      ],
    +      [
    +        32, 40, 8, 10,
    +        "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."
    +      ],
    +      [
    +        25, 21, 5, 12,
    +        "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."
    +      ]
    +    ]
    +  }
    +end
     
    -    x_floor = x.idiv(snap_number) * snap_number
    -    x_mod   = x % snap_number
    -    x_ceil  = (x.idiv(snap_number) + 1) * snap_number
    +def day_one_ceremony args
    +  {
    +    background: 'sprites/tribute.png',
    +    player: [57, 21],
    +    scenes: [
    +      [62, 0, 2, 40, :day_one_infront_of_home],
    +      [0, 24, 2, 40, :day_one_infront_of_library]
    +    ],
    +    storylines: [
    +      [53, 12, 3,  8,  "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],
    +      [45, 12, 3,  8,  "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],
    +      [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],
    +      [15, 12, 3,  8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],
    +    ]
    +  }
    +end
     
    -    y_floor = y.idiv(snap_number) * snap_number
    -    y_mod   = y % snap_number
    -    y_ceil  = (y.idiv(snap_number) + 1) * snap_number
    +def day_one_infront_of_library args
    +  {
    +    background: 'sprites/outside-library.png',
    +    player: [57, 21],
    +    scenes: [
    +      [62, 0, 2, 40, :day_one_ceremony],
    +      [49, 39, 6, 9, :day_one_library]
    +    ],
    +    storylines: [
    +      [50, 20, 4, 8,  "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]
    +    ]
    +  }
    +end
     
    -    if snaps[x_floor]
    -      x_result = x_floor
    -    elsif snaps[x_ceil]
    -      x_result = x_ceil
    -    elsif x_mod < snap_number.idiv(2)
    -      x_result = x_floor
    -    else
    -      x_result = x_ceil
    -    end
    +def day_one_library args
    +  {
    +    background: 'sprites/library.png',
    +    player: [27, 4],
    +    scenes: [
    +      [0, 0, 64, 2, :end_day_one_infront_of_library]
    +    ],
    +    storylines: [
    +      [28, 22, 8, 4,  "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],
    +      [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]
    +    ]
    +  }
    +end
     
    -    snaps[x_result] ||= {}
    +def end_day_one_infront_of_library args
    +  {
    +    background: 'sprites/outside-library.png',
    +    player: [51, 33],
    +    scenes: [
    +      [49, 39, 6, 9, :day_one_library],
    +      [62, 0, 2, 40, :end_day_one_monument],
    +    ],
    +    storylines: [
    +      [50, 27, 4, 4, "It's getting late. Better get some sleep."]
    +    ]
    +  }
    +end
     
    -    if snaps[x_result][y_floor]
    -      y_result = y_floor
    -    elsif snaps[x_result][y_ceil]
    -      y_result = y_ceil
    -    elsif y_mod < snap_number.idiv(2)
    -      y_result = y_floor
    -    else
    -      y_result = y_ceil
    -    end
    +def end_day_one_monument args
    +  {
    +    background: 'sprites/tribute.png',
    +    player: [2, 36],
    +    scenes: [
    +      [62, 0, 2, 40, :end_day_one_infront_of_home],
    +    ],
    +    storylines: [
    +      [50, 27, 4, 4, "It's getting late. Better get some sleep."],
    +    ]
    +  }
    +end
     
    -    snaps[x_result][y_result] = true
    -    return [x_result, y_result]
    +def end_day_one_infront_of_home args
    +  {
    +    background: 'sprites/front-of-home.png',
    +    player: [1, 17],
    +    scenes: [
    +      [43, 34, 10, 16, :end_day_one_home],
    +    ],
    +    storylines: [
    +      [20, 10, 4, 4, "It's getting late. Better get some sleep."],
    +    ]
    +  }
    +end
     
    -  end
    +def end_day_one_home args
    +  {
    +    background: 'sprites/inside-home.png',
    +    player: [34, 3],
    +    scenes: [
    +      [32, 40, 8, 10, :end_day_one_dream],
    +    ],
    +    storylines: [
    +      [38, 4, 4, 4, "It's getting late. Better get some sleep."],
    +    ]
    +  }
    +end
     
    -  def snap_line line
    -    x, y, x2, y2 = line
    -  end
    +def end_day_one_dream args
    +  {
    +    background: 'sprites/dream.png',
    +    fade: 60,
    +    player: [4, 4],
    +    scenes: [
    +      [62, 0, 2, 64, :explaining_the_special_power]
    +    ],
    +    storylines: [
    +      [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],
    +      [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],
    +      [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]
    +    ]
    +  }
    +end
     
    -  def string_to_line s
    -    x, y, x2, y2 = s.split(',').map(&:to_f)
    +def explaining_the_special_power args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    player: [32, 30],
    +    scenes: [
    +      [
    +        38, 21, 4, 4, :explaining_the_special_power_inside_computer
    +      ],
    +    ]
    +  }
    +end
     
    -    if x > x2
    -      x2, x = x, x2
    -      y2, y = y, y2
    -    end
    +def explaining_the_special_power_inside_computer args
    +  {
    +    background: 'sprites/pc.png',
    +    fade: 60,
    +    player: [34, 4],
    +    scenes: [
    +      [0, 62, 64, 3, :the_blinking_light]
    +    ],
    +    storylines: [
    +      [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],
    +      [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],
    +      [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],
    +      [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]
    +    ]
    +  }
    +end
     
    -    x, y = snap_to_grid x, y, state.snaps
    -    x2, y2 = snap_to_grid x2, y2, state.snaps
    -    [x, y, x2, y2].line.to_hash
    -  end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_final_decision.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb
    +def final_decision_side_of_home args
    +  {
    +    fade: 120,
    +    background: 'sprites/side-of-home.png',
    +    player: [16, 13],
    +    scenes: [
    +      [52, 24, 11, 5, :final_decision_mountain_pass],
    +    ],
    +    render_override: :blinking_light_side_of_home_render,
    +    storylines: [
    +      [28, 13, 8, 4,  "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]
    +    ]
    +  }
    +end
     
    -  def load_lines file
    -    data = gtk.read_file(file) || ""
    -    data.each_line
    -        .reject { |l| l.strip.length == 0 }
    -        .map { |l| string_to_line l }
    -        .map { |h| h.merge(rect: rect_for_line(h))  }
    -  end
    +def final_decision_mountain_pass args
    +  {
    +    background: 'sprites/mountain-pass-zoomed-out.png',
    +    player: [4, 4],
    +    scenes: [
    +      [18, 47, 5, 5, :final_decision_path_to_observatory]
    +    ],
    +    render_override: :blinking_light_mountain_pass_render
    +  }
    +end
     
    -  def load_terrain
    -    load_lines 'level.txt'
    -  end
    +def final_decision_path_to_observatory args
    +  {
    +    background: 'sprites/path-to-observatory.png',
    +    player: [60, 4],
    +    scenes: [
    +      [0, 26, 5, 5, :final_decision_observatory]
    +    ],
    +    render_override: :blinking_light_path_to_observatory_render
    +  }
    +end
     
    -  def load_lava
    -    load_lines 'level_lava.txt'
    -  end
    +def final_decision_observatory args
    +  {
    +    background: 'sprites/observatory.png',
    +    player: [60, 2],
    +    scenes: [
    +      [28, 39, 4, 10, :final_decision_inside_observatory]
    +    ],
    +    render_override: :blinking_light_observatory_render
    +  }
    +end
     
    -  def load_level force: false
    -    if force
    -      state.snaps = {}
    -      state.terrain = load_terrain
    -      state.lava = load_lava
    -    else
    -      state.terrain ||= load_terrain
    -      state.lava ||= load_lava
    -    end
    -  end
    +def final_decision_inside_observatory args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    player: [60, 2],
    +    storylines: [],
    +    scenes: [
    +      [30, 18, 5, 12, :final_decision_inside_mainframe]
    +    ],
    +    render_override: :blinking_light_inside_observatory_render
    +  }
    +end
     
    -  def save_lines lines, file
    -    s = lines.map do |l|
    -      "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"
    -    end.join("\n")
    -    gtk.write_file(file, s)
    -  end
    +def final_decision_inside_mainframe args
    +  {
    +    player: [32, 4],
    +    background: 'sprites/mainframe.png',
    +    storylines: [],
    +    scenes: [
    +      [*hotspot_top, :final_decision_ship_status],
    +    ]
    +  }
    +end
     
    -  def save_level
    -    save_lines(state.terrain, 'level.txt')
    -    save_lines(state.lava, 'level_lava.txt')
    -    load_level force: true
    -  end
    +def final_decision_ship_status args
    +  {
    +    background: 'sprites/serenity.png',
    +    fade: 60,
    +    player: [30, 10],
    +    scenes: [
    +      [*hotspot_top_right, :final_decision]
    +    ],
    +    storylines: [
    +      [30,  8, 4, 4, "????"],
    +      *final_decision_ship_status_shared(args)
    +    ]
    +  }
    +end
     
    -  def line_near_rect? rect, terrain
    -    geometry.intersect_rect?(rect, terrain[:rect])
    -  end
    +def final_decision args
    +  decision_graph  "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",
    +                  "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",
    +                  [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],
    +                  [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],
    +                  [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],
    +                  [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]
    +end
     
    -  def point_within_line? point, line
    -    return false if !point
    -    return false if !line
    -    return true
    -  end
    +def final_decision_game_over_noone args
    +  {
    +    background: 'sprites/tribute-game-over.png',
    +    player: [53, 14],
    +    fade: 600
    +  }
    +end
     
    -  def calc_impacts x, dx, y, dy, radius
    -    results = { }
    -    results[:x] = x
    -    results[:y] = y
    -    results[:dx] = x
    -    results[:dy] = y
    -    results[:point] = { x: x, y: y }
    -    results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }
    -    results[:trajectory] = trajectory(results)
    -    results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|
    -      {
    -        terrain: t,
    -        point: geometry.line_intersect(results[:trajectory], t),
    -        type: :terrain
    -      }
    -    end.reject { |t| !point_within_line? t[:point], t[:terrain] }
    +def final_decision_game_over_matthew args
    +  {
    +    background: 'sprites/tribute-game-over.png',
    +    player: [53, 14],
    +    fade: 600
    +  }
    +end
     
    -    results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|
    -      {
    -        terrain: t,
    -        point: geometry.line_intersect(results[:trajectory], t),
    -        type: :lava
    -      }
    -    end.reject { |t| !point_within_line? t[:point], t[:terrain] }
    +def final_decision_game_over_anka args
    +  {
    +    background: 'sprites/tribute-game-over.png',
    +    player: [53, 14],
    +    fade: 600
    +  }
    +end
     
    -    results
    -  end
    +def final_decision_game_over_sasha args
    +  {
    +    background: 'sprites/tribute-game-over.png',
    +    player: [53, 14],
    +    fade: 600
    +  }
    +end
     
    -  def calc_potential_impacts
    -    impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius
    -    circle.rect = impact_results[:rect]
    -    circle.trajectory = impact_results[:trajectory]
    -    circle.impacts = impact_results[:impacts]
    -  end
    +def final_decision_ship_status_shared args
    +  [
    +    *ship_control_hotspot(24, 22,
    +                           "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",
    +                           "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",
    +                           "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION.  WHAT?! NO!",
    +                           "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),
    +  ]
    +end
     
    -  def calc_terrains_to_monitor
    -    circle.impact = nil
    -    circle.impacts.each do |i|
    -      circle.terrains_to_monitor[i[:terrain]] ||= {
    -        ray_start: geometry.ray_test(circle, i[:terrain]),
    -      }
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_final_message.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb
    +def final_message_sad args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    player: [34, 35],
    +    storylines: [
    +      [34, 34, 4, 4, "Another-- sleepless-- night..."],
    +    ],
    +    scenes: [
    +      [32, -1, 8, 3, :final_message_observatory]
    +    ]
    +  }
    +end
     
    -      circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])
    -      if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]
    -        if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)
    -          circle.impact = i
    -          circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]
    -        end
    -      end
    -    end
    -  end
    +def final_message_happy args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    player: [34, 35],
    +    storylines: [
    +      [34, 34, 4, 4, "Oh man, I slept like rock!"],
    +    ],
    +    scenes: [
    +      [32, -1, 8, 3, :final_message_observatory]
    +    ]
    +  }
    +end
     
    -  def impact_result body, impact
    -    infinity_alias = 1000
    -    r = {
    -      body: {},
    -      terrain: {},
    -      impact: {}
    -    }
    +def final_message_side_of_home args
    +  {
    +    fade: 60,
    +    background: 'sprites/side-of-home.png',
    +    player: [16, 13],
    +    scenes: [
    +      [52, 24, 11, 5, :final_message_mountain_pass],
    +    ],
    +    render_override: :blinking_light_side_of_home_render
    +  }
    +end
     
    -    r[:body][:line] = body.trajectory.dup
    -    r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)
    -    r[:body][:slope_sign] = r[:body][:slope].sign
    -    r[:body][:x] = body.x
    -    r[:body][:y] = body.y
    -    r[:body][:dy] = body.dy
    -    r[:body][:dx] = body.dx
    +def final_message_mountain_pass args
    +  {
    +    background: 'sprites/mountain-pass-zoomed-out.png',
    +    player: [4, 4],
    +    scenes: [
    +      [18, 47, 5, 5, :final_message_path_to_observatory],
    +    ],
    +    storylines: [
    +      [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]
    +    ],
    +    render_override: :blinking_light_mountain_pass_render
    +  }
    +end
     
    -    r[:terrain][:line] = impact[:terrain].dup
    -    r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)
    -    r[:terrain][:slope_sign] = r[:terrain][:slope].sign
    +def final_message_path_to_observatory args
    +  {
    +    background: 'sprites/path-to-observatory.png',
    +    player: [60, 4],
    +    scenes: [
    +      [0, 26, 5, 5, :final_message_observatory]
    +    ],
    +    storylines: [
    +      [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]
    +    ],
    +    render_override: :blinking_light_path_to_observatory_render
    +  }
    +end
     
    -    r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)
    -    r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }
    -    r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]
    -    r[:impact][:ray] = body.ray_current
    -    r[:body][:new_on_floor] = body.on_floor
    -    r[:body][:new_floor] = r[:terrain][:line]
    +def final_message_observatory args
    +  if args.state.scene_history.include? :replied_with_whole_truth
    +    return {
    +      background: 'sprites/inside-observatory.png',
    +      fade: 60,
    +      player: [51, 12],
    +      storylines: [
    +        [50, 10, 4, 4, "Here-- we- go..."]
    +      ],
    +      scenes: [
    +        [30, 18, 5, 12, :final_message_inside_mainframe]
    +      ],
    +      render_override: :blinking_light_inside_observatory_render
    +    }
    +  else
    +    return {
    +      background: 'sprites/inside-observatory.png',
    +      fade: 60,
    +      player: [51, 12],
    +      storylines: [
    +        [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]
    +      ],
    +      scenes: [
    +        [30, 18, 5, 12, :final_message_inside_mainframe]
    +      ],
    +      render_override: :blinking_light_inside_observatory_render
    +    }
    +  end
    +end
     
    -    if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3
    -      play_sound
    -      r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1
    -      r[:body][:new_dx] = r[:body][:dx] * circle.elasticity
    -      r[:impact][:type] = :horizontal
    -      r[:body][:new_reason] = "-"
    -    elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3
    -      play_sound
    -      r[:body][:new_dy] = r[:body][:dy] * 1.1
    -      r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity
    -      r[:impact][:type] = :vertical
    -      r[:body][:new_reason] = "|"
    -    else
    -      play_sound
    -      r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity
    -      r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity
    -      r[:impact][:type] = :slanted
    -      r[:body][:new_reason] = "/"
    -    end
    +def final_message_inside_mainframe args
    +  {
    +    player: [32, 4],
    +    background: 'sprites/mainframe.png',
    +    fade: 60,
    +    scenes: [[45, 45,  4, 4, :final_message_check_ship_status]]
    +  }
    +end
     
    -    r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs
    +def final_message_check_ship_status args
    +  {
    +    background: 'sprites/mainframe.png',
    +    storylines: [
    +      [45, 45, 4, 4, (final_message_current args)],
    +    ],
    +    scenes: [
    +      [*hotspot_top, :final_message_ship_status],
    +    ]
    +  }
    +end
     
    -    if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4
    -      r[:body][:new_dx] = 0
    -      r[:body][:new_dy] = 0
    -      r[:impact][:energy] = 0
    -      r[:body][:new_on_floor] = true
    -      r[:body][:new_floor] = r[:terrain][:line]
    -      r[:body][:new_reason] = "0"
    -    end
    +def final_message_ship_status args
    +  {
    +    background: 'sprites/serenity.png',
    +    fade: 60,
    +    player: [30, 10],
    +    scenes: [
    +      [30, 50, 4, 4, :final_message_ship_status_reviewed]
    +    ],
    +    storylines: [
    +      [30,  8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],
    +      *final_message_ship_status_shared(args)
    +    ]
    +  }
    +end
     
    -    r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],
    -                                                y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },
    -                                              r[:terrain][:line])
    +def final_message_ship_status_reviewed args
    +  {
    +    background: 'sprites/serenity.png',
    +    fade: 60,
    +    scenes: [
    +      [*hotspot_bottom, :final_message_summary]
    +    ],
    +    storylines: [
    +      [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],
    +    ]
    +  }
    +end
     
    -    if r[:impact][:ray_next] == r[:impact][:ray]
    -      r[:body][:new_dx] *= -1
    -      r[:body][:new_dy] *= -1
    -      r[:body][:new_reason] = "clip"
    -    end
    +def final_message_ship_status_shared args
    +  [
    +    *ship_control_hotspot( 0, 50,
    +                           "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",
    +                           "Matthew's--- Chamber--: OCCUPIED----",
    +                           "Aanka's--- Chamber--: OCCUPIED----",
    +                           "Sasha's--- Chamber--: OCCUPIED----"),
    +    *ship_control_hotspot(12, 35,
    +                          "Life- Support--: Not-- Needed---",
    +                          "O2--- Production---: OFF---",
    +                          "CO2--- Scrubbers---: OFF---",
    +                          "H2O--- Production---: OFF---"),
    +    *ship_control_hotspot(24, 20,
    +                          "Navigation: Offline---",
    +                          "Sensor: OFF---",
    +                          "Heads- Up- Display: DAMAGED---",
    +                          "Arithmetic--- Unit: DAMAGED----"),
    +    *ship_control_hotspot(36, 35,
    +                          "COMM: Underpowered----",
    +                          "Text: ON---",
    +                          "Audio: SEGFAULT---",
    +                          "Video: DAMAGED---"),
    +    *ship_control_hotspot(48, 50,
    +                          "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",
    +                          "Engine I: ON---",
    +                          "Engine II: ON---",
    +                          "Engine III: ON---")
    +  ]
    +end
     
    -    r
    +def final_message_last_reply args
    +  if args.state.scene_history.include? :replied_with_whole_truth
    +    return "Buffer--: #{anka_reply_whole_truth.quote}"
    +  else
    +    return "Buffer--: #{anka_reply_half_truth.quote}"
       end
    +end
     
    -  def game_over!
    -    circle.x = circle.check_point_x
    -    circle.y = circle.check_point_y
    -    circle.dx = 0
    -    circle.dy = 0
    -    circle.game_over_at = state.tick_count
    +def final_message_current args
    +  if args.state.scene_history.include? :replied_with_whole_truth
    +    return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."
    +  else
    +    return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"
       end
    +end
     
    -  def not_game_over!
    -    impact_history_entry = impact_result circle, circle.impact
    -    circle.impact_history << impact_history_entry
    -    circle.x -= circle.dx * 1.1
    -    circle.y -= circle.dy * 1.1
    -    circle.dx = impact_history_entry[:body][:new_dx]
    -    circle.dy = impact_history_entry[:body][:new_dy]
    -    circle.on_floor = impact_history_entry[:body][:new_on_floor]
    +def final_message_summary args
    +  if args.state.scene_history.include? :replied_with_whole_truth
    +    return {
    +      background: 'sprites/inside-observatory.png',
    +      fade: 60,
    +      player: [31, 11],
    +      scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],
    +      storylines: [
    +        [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],
    +      ]
    +    }
    +  else
    +    return {
    +      background: 'sprites/inside-observatory.png',
    +      fade: 60,
    +      player: [31, 11],
    +      scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],
    +      storylines: [
    +        [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],
    +      ]
    +    }
    +  end
    +end
     
    -    if circle.on_floor
    -      circle.check_point_at = state.tick_count
    -      circle.check_point_x = circle.x
    -      circle.check_point_y = circle.y
    -    end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb
    +def serenity_alive_side_of_home args
    +  {
    +    fade: 60,
    +    background: 'sprites/side-of-home.png',
    +    player: [16, 13],
    +    scenes: [
    +      [52, 24, 11, 5, :serenity_alive_mountain_pass],
    +    ],
    +    render_override: :blinking_light_side_of_home_render
    +  }
    +end
     
    -    circle.previous_floor = circle.floor || {}
    -    circle.floor = impact_history_entry[:body][:new_floor] || {}
    -    circle.floor_point = impact_history_entry[:impact][:point]
    -    if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)
    -      new_relative_x = if circle.dx > 0
    -                         :right
    -                       elsif circle.dx < 0
    -                         :left
    -                       else
    -                         nil
    -                       end
    +def serenity_alive_mountain_pass args
    +  {
    +    background: 'sprites/mountain-pass-zoomed-out.png',
    +    player: [4, 4],
    +    scenes: [
    +      [18, 47, 5, 5, :serenity_alive_path_to_observatory],
    +    ],
    +    storylines: [
    +      [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]
    +    ],
    +    render_override: :blinking_light_mountain_pass_render
    +  }
    +end
     
    -      new_relative_y = if circle.dy > 0
    -                         :above
    -                       elsif circle.dy < 0
    -                         :below
    -                       else
    -                         nil
    -                       end
    +def serenity_alive_path_to_observatory args
    +  {
    +    background: 'sprites/path-to-observatory.png',
    +    player: [60, 4],
    +    scenes: [
    +      [0, 26, 5, 5, :serenity_alive_observatory]
    +    ],
    +    storylines: [
    +      [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]
    +    ],
    +    render_override: :blinking_light_path_to_observatory_render
    +  }
    +end
     
    -      circle.floor_relative_x = new_relative_x
    -      circle.floor_relative_y = new_relative_y
    -    end
    +def serenity_alive_observatory args
    +  {
    +    background: 'sprites/observatory.png',
    +    player: [60, 2],
    +    scenes: [
    +      [28, 39, 4, 10, :serenity_alive_inside_observatory]
    +    ],
    +    render_override: :blinking_light_observatory_render
    +  }
    +end
     
    -    circle.impact = nil
    -    circle.terrains_to_monitor.clear
    -  end
    +def serenity_alive_inside_observatory args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    player: [60, 2],
    +    storylines: [],
    +    scenes: [
    +      [30, 18, 5, 12, :serenity_alive_inside_mainframe]
    +    ],
    +    render_override: :blinking_light_inside_observatory_render
    +  }
    +end
    +
    +def serenity_alive_inside_mainframe args
    +  {
    +    background: 'sprites/mainframe.png',
    +    fade: 60,
    +    player: [30, 4],
    +    scenes: [
    +      [*hotspot_top, :serenity_alive_ship_status],
    +    ],
    +    storylines: [
    +      [22, 45, 17, 4, (serenity_alive_last_reply args)],
    +      [45, 45,  4, 4, (serenity_alive_current_message args)],
    +    ]
    +  }
    +end
    +
    +def serenity_alive_ship_status args
    +  {
    +    background: 'sprites/serenity.png',
    +    fade: 60,
    +    player: [30, 10],
    +    scenes: [
    +      [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]
    +    ],
    +    storylines: [
    +      [30,  8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],
    +      [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],
    +      *serenity_alive_shared_ship_status(args)
    +    ]
    +  }
    +end
     
    -  def calc_physics
    -    if args.state.god_mode
    -      calc_potential_impacts
    -      calc_terrains_to_monitor
    -      return
    -    end
    +def serenity_alive_ship_status_reviewed args
    +  {
    +    background: 'sprites/serenity.png',
    +    fade: 60,
    +    scenes: [
    +      [*hotspot_bottom, :serenity_alive_time_to_reply]
    +    ],
    +    storylines: [
    +      [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],
    +    ]
    +  }
    +end
     
    -    if circle.y < -700
    -      game_over
    -      return
    -    end
    +def serenity_alive_time_to_reply args
    +  decision_graph serenity_alive_current_message(args),
    +                  "Okay... time to deliver the bad news...",
    +                  [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],
    +                  [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]
    +end
     
    -    return if state.game_over
    -    return if circle.on_floor
    -    circle.previous_dy = circle.dy
    -    circle.previous_dx = circle.dx
    -    circle.x  += circle.dx
    -    circle.y  += circle.dy
    -    args.state.distance_traveled ||= 0
    -    args.state.distance_traveled += circle.dx.abs + circle.dy.abs
    -    circle.dy += state.gravity
    -    calc_potential_impacts
    -    calc_terrains_to_monitor
    -    return unless circle.impact
    -    if circle.impact && circle.impact[:type] == :lava
    -      game_over!
    -    else
    -      not_game_over!
    -    end
    -  end
    +def serenity_alive_shared_ship_status args
    +  [
    +    *ship_control_hotspot( 0, 50,
    +                           "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",
    +                           nil,
    +                           nil,
    +                           nil),
    +    *ship_control_hotspot(12, 35,
    +                          "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",
    +                          nil,
    +                          nil,
    +                          nil),
    +    *ship_control_hotspot(24, 20,
    +                          "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",
    +                          nil,
    +                          nil,
    +                          nil),
    +    *ship_control_hotspot(36, 35,
    +                          "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",
    +                          nil,
    +                          nil,
    +                          nil),
    +    *ship_control_hotspot(48, 50,
    +                          "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",
    +                          nil,
    +                          nil,
    +                          nil)
    +  ]
    +end
     
    -  def input_god_mode
    -    state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash
    +def serenity_alive_firm_reply
    +  "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."
    +end
     
    -    # toggle god mode
    -    if inputs.keyboard.key_down.g
    -      state.god_mode = !state.god_mode
    -      state.potential_lift = 0
    -      circle.floor = nil
    -      circle.floor_point = nil
    -      circle.floor_relative_x = nil
    -      circle.floor_relative_y = nil
    -      circle.impact = nil
    -      circle.terrains_to_monitor.clear
    -      return
    -    end
    +def serenity_alive_sugarcoated_reply
    +  "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."
    +end
     
    -    return unless state.god_mode
    +def replied_to_serenity_alive_firmly args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [
    +      [*hotspot_bottom_right, :serenity_alive_path_from_observatory]
    +    ],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],
    +      *serenity_alive_reply_completed_shared_hotspots(args),
    +    ]
    +  }
    +end
     
    -    circle.x = circle.x.to_i
    -    circle.y = circle.y.to_i
    +def replied_to_serenity_alive_kindly args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [
    +      [*hotspot_bottom_right, :serenity_alive_path_from_observatory]
    +    ],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],
    +      *serenity_alive_reply_completed_shared_hotspots(args),
    +    ]
    +  }
    +end
     
    -    # move god circle
    -    if inputs.keyboard.left || inputs.keyboard.a
    -      circle.x -= 20
    -    elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f
    -      circle.x += 20
    -    end
    +def serenity_alive_path_from_observatory args
    +  {
    +    fade: 60,
    +    background: 'sprites/path-to-observatory.png',
    +    player: [4, 21],
    +    scenes: [
    +      [*hotspot_bottom_right, :serenity_bio_infront_of_home]
    +    ],
    +    storylines: [
    +      [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]
    +    ]
    +  }
    +end
     
    -    if inputs.keyboard.up || inputs.keyboard.w
    -      circle.y += 20
    -    elsif inputs.keyboard.down || inputs.keyboard.s
    -      circle.y -= 20
    -    end
    +def serenity_alive_reply_completed_shared_hotspots args
    +  [
    +    [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],
    +    [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],
    +    [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]
    +  ]
    +end
     
    -    # delete terrain
    -    if inputs.keyboard.key_down.x
    -      calc_terrains_to_monitor
    -      state.terrain = state.terrain.reject do |t|
    -        t[:rect].intersect_rect? circle.rect
    -      end
    +def serenity_alive_last_reply args
    +  if args.state.scene_history.include? :replied_to_introduction_seriously
    +    return "Buffer--: \"Hello, Who- is sending-- this message--?\""
    +  else
    +    return "Buffer--: \"New- phone. Who dis?\""
    +  end
    +end
     
    -      state.lava = state.lava.reject do |t|
    -        t[:rect].intersect_rect? circle.rect
    -      end
    +def serenity_alive_current_message args
    +  if args.state.scene_history.include? :replied_to_introduction_seriously
    +    "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote
    +  else
    +    "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote
    +  end
    +end
     
    -      calc_potential_impacts
    -      save_level
    -    end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb
    +def serenity_bio_infront_of_home args
    +  {
    +    fade: 60,
    +    background: 'sprites/front-of-home.png',
    +    player: [54, 23],
    +    scenes: [
    +      [44, 34, 8, 14, :serenity_bio_inside_home],
    +      [0, 3, 3, 22, :serenity_bio_library]
    +    ]
    +  }
    +end
     
    -    # change terrain type
    -    if inputs.keyboard.key_down.l
    -      if state.line_mode == :terrain
    -        state.line_mode = :lava
    -      else
    -        state.line_mode = :terrain
    -      end
    -    end
    +def serenity_bio_inside_home args
    +  {
    +    background: 'sprites/inside-home.png',
    +    player: [34, 4],
    +    storylines: [
    +      [34, 4, 4, 4, "I'm--- completely--- exhausted."],
    +    ],
    +    scenes: [
    +      [30, 38, 12, 13, :serenity_bio_restless_sleep],
    +      [32, 0, 8, 3, :serenity_bio_infront_of_home],
    +    ]
    +  }
    +end
     
    -    if inputs.mouse.click && !state.point_one
    -      state.point_one = inputs.mouse.click.point
    -    elsif inputs.mouse.click && state.point_one
    -      l = [*state.point_one, *inputs.mouse.click.point]
    -      l = [l.x  - state.camera.x,
    -           l.y  - state.camera.y,
    -           l.x2 - state.camera.x,
    -           l.y2 - state.camera.y].line.to_hash
    -      l[:rect] = rect_for_line l
    -      if state.line_mode == :terrain
    -        state.terrain << l
    -      else
    -        state.lava << l
    -      end
    -      save_level
    -      next_x = inputs.mouse.click.point.x - 640
    -      next_y = inputs.mouse.click.point.y - 360
    -      circle.x += next_x
    -      circle.y += next_y
    -      state.point_one = nil
    -    elsif inputs.keyboard.one
    -      state.point_one = [circle.x + camera.x, circle.y+ camera.y]
    -    end
    +def serenity_bio_restless_sleep args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    storylines: [
    +      [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],
    +    ],
    +    scenes: [
    +      [32, 0, 8, 3, :serenity_bio_infront_of_home],
    +    ]
    +  }
    +end
    +
    +def serenity_bio_library args
    +  {
    +    background: 'sprites/library.png',
    +    fade: 60,
    +    player: [30, 7],
    +    scenes: [
    +      [21, 35, 3, 18, :serenity_bio_book]
    +    ]
    +  }
    +end
     
    -    # cancel chain lines
    -    if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one
    -      state.point_one = nil
    -    end
    -  end
    +def serenity_bio_book args
    +  {
    +    background: 'sprites/book.png',
    +    fade: 60,
    +    player: [6, 52],
    +    storylines: [
    +      [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],
     
    -  def play_sound
    -    return if state.sound_debounce > 0
    -    state.sound_debounce = 5
    -    outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"
    -    state.sound_index += 1
    -    if state.sound_index > 21
    -      state.sound_index = 1
    -    end
    -  end
    +      [ 4, 38,  8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],
    +      [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],
     
    -  def input_game
    -    if inputs.keyboard.down || inputs.keyboard.space
    -      circle.potential_lift += 0.03
    -      circle.potential_lift = circle.potential_lift.lesser(10)
    -    elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space
    -      play_sound
    -      circle.dy += circle.angle.vector_y circle.potential_lift
    -      circle.dx += circle.angle.vector_x circle.potential_lift
    +      [4,  26,  8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],
    +      [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],
     
    -      if circle.on_floor
    -        if circle.floor_relative_y == :above
    -          circle.y += circle.potential_lift.abs * 2
    -        elsif circle.floor_relative_y == :below
    -          circle.y -= circle.potential_lift.abs * 2
    -        end
    -      end
    +      [4,  14,  8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],
    +      [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],
    +    ],
    +    scenes: [
    +      [*hotspot_bottom, :serenity_bio_finally_to_bed]
    +    ]
    +  }
    +end
     
    -      circle.on_floor = false
    -      circle.potential_lift = 0
    -      circle.terrains_to_monitor.clear
    -      circle.impact_history.clear
    -      circle.impact = nil
    -      calc_physics
    -    end
    +def serenity_bio_finally_to_bed args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    player: [35, 3],
    +    storylines: [
    +      [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],
    +    ],
    +    scenes: [
    +      [32, 38, 10, 13, :bad_dream],
    +    ]
    +  }
    +end
     
    -    # aim probe
    -    if inputs.keyboard.right || inputs.keyboard.a
    -      circle.angle -= 2
    -    elsif inputs.keyboard.left || inputs.keyboard.d
    -      circle.angle += 2
    -    end
    -  end
    +def bad_dream args
    +  {
    +    fade: 120,
    +    background: 'sprites/inside-home.png',
    +    player: [34, 35],
    +    storylines: [
    +      [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],
    +    ],
    +    scenes: [
    +      [32, -1, 8, 3, :bad_dream_observatory]
    +    ]
    +  }
    +end
     
    -  def input
    -    input_god_mode
    -    input_game
    -  end
    +def bad_dream_observatory args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 120,
    +    player: [51, 12],
    +    storylines: [
    +      [50, 10, 4, 4,   "Breathe, Hiro. Just see what's there... everything--- will- be okay."]
    +    ],
    +    scenes: [
    +      [30, 18, 5, 12, :bad_dream_inside_mainframe]
    +    ],
    +    render_override: :blinking_light_inside_observatory_render
    +  }
    +end
     
    -  def calc_camera
    -    state.camera.target_x = 640 - circle.x
    -    state.camera.target_y = 360 - circle.y
    -    xdiff = state.camera.target_x - state.camera.x
    -    ydiff = state.camera.target_y - state.camera.y
    -    state.camera.x += xdiff * camera.follow_speed
    -    state.camera.y += ydiff * camera.follow_speed
    +def bad_dream_inside_mainframe args
    +  {
    +    player: [32, 4],
    +    background: 'sprites/mainframe.png',
    +    fade: 120,
    +    storylines: [
    +      [22, 45, 17, 4, (bad_dream_last_reply args)],
    +    ],
    +    scenes: [
    +      [45, 45,  4, 4, :bad_dream_everyone_dead],
    +    ]
    +  }
    +end
    +
    +def bad_dream_everyone_dead args
    +  {
    +    background: 'sprites/mainframe.png',
    +    storylines: [
    +      [22, 45, 17, 4, (bad_dream_last_reply args)],
    +      [45, 45,  4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],
    +      [22,  5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],
    +    ],
    +    scenes: [
    +      [*hotspot_bottom, :anka_inside_room]
    +    ]
    +  }
    +end
    +
    +def bad_dream_last_reply args
    +  if args.state.scene_history.include? :replied_to_serenity_alive_firmly
    +    return "Buffer--: #{serenity_alive_firm_reply.quote}"
    +  else
    +    return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"
       end
    +end
     
    -  def calc
    -    state.sound_debounce ||= 0
    -    state.sound_debounce -= 1
    -    state.sound_debounce = 0 if state.sound_debounce < 0
    -    if state.god_mode
    -      circle.dy *= 0.1
    -      circle.dx *= 0.1
    -    end
    -    calc_camera
    -    state.whisp_queue ||= []
    -    if state.tick_count.mod_zero?(4)
    -      state.whisp_queue << {
    -        x: -300,
    -        y: 1400 * rand,
    -        speed: 2.randomize(:ratio) + 3,
    -        w: 20,
    -        h: 20, path: 'sprites/whisp.png',
    -        a: 0,
    -        created_at: state.tick_count,
    -        angle: 0,
    -        r: 100,
    -        g: 128 + 128 * rand,
    -        b: 128 + 128 * rand
    -      }
    -    end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb
    +# decision_graph "Message from Sasha",
    +#                "I should reply.",
    +#                [:replied_to_introduction_seriously,  "Reply Seriously", "Who is this?"],
    +# [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]
    +def reply_to_introduction args
    +  decision_graph  "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",
    +                  "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",
    +                  [:replied_to_introduction_seriously,  "Serious Reply",  "Hello, Who- is sending-- this message--?"],
    +                  [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]
    +end
     
    -    state.whisp_queue.each do |w|
    -      w.x += w[:speed] * 2
    -      w.x -= circle.dx * 0.3
    -      w.y -= w[:speed]
    -      w.y -= circle.dy * 0.3
    -      w.angle += w[:speed]
    -      w.a = w[:created_at].ease(30) * 255
    -    end
    +def replied_to_introduction_seriously args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [
    +      *replied_to_introduction_shared_scenes(args)
    +    ],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],
    +      *replied_to_introduction_shared_storylines(args)
    +    ]
    +  }
    +end
     
    -    state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }
    +def replied_to_introduction_humorously args
    +  {
    +    background: 'sprites/inside-observatory.png',
    +    fade: 60,
    +    player: [32, 21],
    +    scenes: [
    +      *replied_to_introduction_shared_scenes(args)
    +    ],
    +    storylines: [
    +      [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],
    +      *replied_to_introduction_shared_storylines(args)
    +    ]
    +  }
    +end
     
    -    if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)
    -      circle.after_images << {
    -        x: circle.x,
    -        y: circle.y,
    -        w: circle.radius,
    -        h: circle.radius,
    -        a: 255,
    -        created_at: state.tick_count
    -      }
    -    end
    +def replied_to_introduction_shared_storylines args
    +  [
    +    [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],
    +    [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],
    +    [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]
    +  ]
    +end
    +
    +def replied_to_introduction_shared_scenes args
    +  [[60, 0, 4, 32, :replied_to_introduction_observatory]]
    +end
    +
    +def replied_to_introduction_observatory args
    +  {
    +    background: 'sprites/observatory.png',
    +    player: [28, 39],
    +    scenes: [
    +      [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]
    +    ]
    +  }
    +end
    +
    +def replied_to_introduction_path_to_observatory args
    +  {
    +    background: 'sprites/path-to-observatory.png',
    +    player: [0, 26],
    +    scenes: [
    +      [60, 0, 4, 20, :replied_to_introduction_mountain_pass]
    +    ],
    +  }
    +end
     
    -    circle.after_images.each do |ai|
    -      ai.a = ai[:created_at].ease(10, :flip) * 255
    -    end
    +def replied_to_introduction_mountain_pass args
    +  {
    +    background: 'sprites/mountain-pass-zoomed-out.png',
    +    player: [21, 48],
    +    scenes: [
    +      [0, 0, 15, 4, :replied_to_introduction_side_of_home]
    +    ],
    +    storylines: [
    +      [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]
    +    ]
    +  }
    +end
     
    -    circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }
    -    calc_physics
    -  end
    +def replied_to_introduction_side_of_home args
    +  {
    +    background: 'sprites/side-of-home.png',
    +    player: [58, 29],
    +    scenes: [
    +      [2, 0, 61, 2, :speed_of_light_front_of_home]
    +    ],
    +  }
    +end
     
    -  def circle
    -    state.circle
    -  end
    +
    +

    Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb

    +
    # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb
    +def speed_of_light_front_of_home args
    +  {
    +    background: 'sprites/front-of-home.png',
    +    player: [54, 23],
    +    scenes: [
    +      [44, 34, 8, 14, :speed_of_light_inside_home],
    +      [0, 3, 3, 22, :speed_of_light_outside_library]
    +    ]
    +  }
    +end
     
    -  def camera
    -    state.camera
    -  end
    +def speed_of_light_inside_home args
    +  {
    +    background: 'sprites/inside-home.png',
    +    player: [35, 4],
    +    storylines: [
    +      [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]
    +    ],
    +    scenes: [
    +      [32, 0, 8, 3, :speed_of_light_front_of_home],
    +    ]
    +  }
    +end
     
    -  def terrain
    -    state.terrain
    -  end
    +def speed_of_light_outside_library args
    +  {
    +    background: 'sprites/outside-library.png',
    +    player: [55, 19],
    +    scenes: [
    +      [49, 39, 6, 10, :speed_of_light_library],
    +      [61, 11, 3, 20, :speed_of_light_front_of_home]
    +    ]
    +  }
    +end
     
    -  def lava
    -    state.lava
    -  end
    +def speed_of_light_library args
    +  {
    +    background: 'sprites/library.png',
    +    player: [30, 7],
    +    scenes: [
    +      [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]
    +    ]
    +  }
     end
     
    -# $gtk.reset
    +def speed_of_light_celestial_bodies_diagram args
    +  {
    +    background: 'sprites/planets.png',
    +    fade: 60,
    +    player: [30, 3],
    +    scenes: [
    +      [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]
    +    ],
    +    storylines: [
    +      [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],
     
    -def tick args
    -  args.outputs.background_color = [0, 0, 0]
    -  if args.inputs.keyboard.r
    -    args.gtk.reset
    -    return
    -  end
    -  # uncomment the line below to slow down the game so you
    -  # can see each tick as it passes
    -  # args.gtk.slowmo! 30
    -  $game ||= FallingCircle.new
    -  $game.args = args
    -  $game.tick
    +      [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],
    +      [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],
    +      [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],
    +      [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],
    +      [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],
    +      [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],
    +      [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],
    +      [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],
    +      # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],
    +      [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],
    +    ]
    +  }
     end
     
    -def reset
    -  $game = nil
    +def speed_of_light_distance_discovered args
    +  {
    +    background: 'sprites/planets.png',
    +    scenes: [
    +      [13, 0, 44, 3, :speed_of_light_end_of_day]
    +    ],
    +    storylines: [
    +      [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],
    +      [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],
    +      [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],
    +      [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],
    +      [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],
    +      [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],
    +      [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],
    +      [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],
    +      [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],
    +      [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],
    +    ]
    +  }
    +end
    +
    +def speed_of_light_end_of_day args
    +  {
    +    fade: 60,
    +    background: 'sprites/inside-home.png',
    +    player: [35, 0],
    +    storylines: [
    +      [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]
    +    ],
    +    scenes: [
    +      [31, 38, 10, 12, :serenity_alive_side_of_home]
    +    ]
    +  }
     end
     
     
    -

    99_genre_roguelike/roguelike_line_of_sight/app/constants.rb

    -
    SHOW_LEGEND = true
    +

    Rpg Roguelike - Roguelike Line Of Sight - constants.rb

    +
    # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb
    +SHOW_LEGEND = true
     SOURCE_TILE_SIZE = 16
     DESTINATION_TILE_SIZE = 16
     TILE_SHEET_SIZE = 256
    @@ -17867,8 +20432,9 @@ TILE_B = 0
     TILE_A = 255
     
     
    -

    99_genre_roguelike/roguelike_line_of_sight/app/legend.rb

    -
    def tick_legend args
    +

    Rpg Roguelike - Roguelike Line Of Sight - legend.rb

    +
    # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb
    +def tick_legend args
       return unless SHOW_LEGEND
     
       legend_padding = 16
    @@ -17935,8 +20501,9 @@ TILE_A = 255
     end
     
     
    -

    99_genre_roguelike/roguelike_line_of_sight/app/main.rb

    -
    require 'app/constants.rb'
    +

    Rpg Roguelike - Roguelike Line Of Sight - main.rb

    +
    # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb
    +require 'app/constants.rb'
     require 'app/sprite_lookup.rb'
     require 'app/legend.rb'
     
    @@ -18035,8 +20602,9 @@ def tile_in_game x, y, tile_key
     end
     
     
    -

    99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb

    -
    def sprite_lookup
    +

    Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb

    +
    # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb
    +def sprite_lookup
       {
         0 => [3, 0],
         1 => [3, 1],
    @@ -18162,8 +20730,9 @@ end
     $gtk.args.state.reserved.sprite_lookup = sprite_lookup
     
     
    -

    99_genre_roguelike/roguelike_starting_point/app/main.rb

    -
    =begin
    +

    Rpg Roguelike - Roguelike Starting Point - main.rb

    +
    # ./samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -18604,8 +21173,9 @@ def tick args
     end
     
     
    -

    99_genre_tactical_rpg/hexagonal_grid/app/main.rb

    -
    class HexagonTileGame
    +

    Rpg Tactical - Hexagonal Grid - main.rb

    +
    # ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb
    +class HexagonTileGame
       attr_gtk
     
       def defaults
    @@ -18675,8 +21245,9 @@ end
     $gtk.reset
     
     
    -

    99_genre_tactical_rpg/isometric_grid/app/main.rb

    -
    class Isometric
    +

    Rpg Tactical - Isometric Grid - main.rb

    +
    # ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb
    +class Isometric
         attr_accessor :grid, :inputs, :state, :outputs
     
         def tick
    @@ -18812,25 +21383,9 @@ $gtk.reset
         def renderLabels
             #Labels
             outputs.labels << [50, 680, 'Click to delete!',             5, 0, 255, 255, 255, 255] if state.mode == :delete
    -        outputs.labels << [50, 640, 'Press 
    -    
    -  
    -
    -i
    -    
    -  
    -
    - for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete
    +        outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete
             outputs.labels << [50, 680, 'Click to insert!',             5, 0, 255, 255, 255, 255] if state.mode == :insert
    -        outputs.labels << [50, 640, 'Press 
    -    
    -  
    -
    -d
    -    
    -  
    -
    - for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert
    +        outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert
         end
     
         def calc
    @@ -18956,8 +21511,9 @@ def tick args
     end
     
     
    -

    99_genre_topdown_rpg/topdown_starting_point/app/main.rb

    -
    =begin
    +

    Rpg Topdown - Topdown Starting Point - main.rb

    +
    # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb
    +=begin
     
      APIs listing that haven't been encountered in previous sample apps:
     
    @@ -19067,8 +21623,9 @@ def move_player args, *vector
     end
     
     
    -

    ./dragon/args.rb

    -
    # coding: utf-8
    +

    args.rb

    +
    # ./dragon/args.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # args.rb has been released under MIT (*only this file*).
    @@ -19266,8 +21823,9 @@ module GTK
     end
     
     
    -

    ./dragon/assert.rb

    -
    # coding: utf-8
    +

    assert.rb

    +
    # ./dragon/assert.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # assert.rb has been released under MIT (*only this file*).
    @@ -19397,8 +21955,9 @@ end
     end
     
     
    -

    ./dragon/attr_gtk.rb

    -
    # coding: utf-8
    +

    attr_gtk.rb

    +
    # ./dragon/attr_gtk.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # attr_gtk.rb has been released under MIT (*only this file*).
    @@ -19441,8 +22000,9 @@ module AttrGTK
     end
     
     
    -

    ./dragon/attr_sprite.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    attr_sprite.rb

    +
    # ./dragon/attr_sprite.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # attr_sprite.rb has been released under MIT (*only this file*).
     
    @@ -19500,8 +22060,9 @@ module AttrSprite
     end
     
     
    -

    ./dragon/console.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    console.rb

    +
    # ./dragon/console.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # console.rb has been released under MIT (*only this file*).
     
    @@ -19795,18 +22356,17 @@ S
                 @last_command_errored = false
               rescue Exception => e
                 string_e = "#{e}"
    +            puts "* EXCEPTION: #{e}"
    +            log  "* EXCEPTION: #{e}"
                 @last_command_errored = true
                 if (string_e.include? "wrong number of arguments")
                   method_name = (string_e.split ":")[0].gsub "'", ""
    -              results = Kernel.docs_search method_name
    -              if !results.include "* DOCS: No results found."
    +              results = (Kernel.docs_search method_name).strip
    +              if !results.include? "* DOCS: No results found."
                     puts results
                     log results
                   end
                 end
    -
    -            puts "#{e}"
    -            log "#{e}"
               end
             end
           end
    @@ -19818,6 +22378,10 @@ S
             (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control)
         end
     
    +    def scroll_to_bottom
    +      @log_offset = 0
    +    end
    +
         def scroll_up_full
           @log_offset += lines_on_one_page
           @log_offset = @log.size if @log_offset > @log.size
    @@ -20013,63 +22577,6 @@ S
           render_log_offset args
         end
     
    -    def tick_help args
    -      tick_help_debounce args
    -      alpha_rate = 20
    -      @render_help_target_alpha  ||= 255
    -      @render_help_current_alpha ||= 255
    -      @render_help_target_alpha  += 4 if @render_help_current_alpha == @render_help_target_alpha
    -      @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20)
    -
    -      @render_help_target_alpha  = @render_help_target_alpha.clamp(-255, 255)
    -      @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255)
    -
    -      [
    -        "* Prompt Commands:                   ",
    -        "You can type any of the following    ",
    -        "commands in the command prompt.      ",
    -        "** docs: Provides API docs.          ",
    -        "** $gtk: Accesses the global runtime.",
    -        "* Shortcut Keys:                     ",
    -        "** full page up:   ctrl + b          ",
    -        "** full page down: ctrl + f          ",
    -        "** half page up:   ctrl + u          ",
    -        "** half page down: ctrl + d          ",
    -        "** clear prompt:   ctrl + g          ",
    -        "** up arrow:       next command      ",
    -        "** down arrow:     prev command      ",
    -      ].each_with_index do |s, i|
    -        args.outputs.reserved << [args.grid.right - 10,
    -                                  top - 100 - line_height_px * i * 0.8,
    -                                  s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label
    -      end
    -    end
    -
    -    def tick_help_debounce args
    -      hide_log_alpha = -255
    -      if hidden?
    -        @render_help_current_alpha = -255
    -      end
    -
    -      if prompt.last_input_str_changed
    -        @render_help_target_alpha = hide_log_alpha
    -      end
    -
    -      if args.inputs.mouse.moved
    -        @render_help_target_alpha = hide_log_alpha
    -      end
    -
    -      if args.inputs.mouse.wheel
    -        @render_help_target_alpha = hide_log_alpha
    -      end
    -
    -      if @render_help_last_log_invocation_count != @log_invocation_count
    -        @render_help_target_alpha = hide_log_alpha
    -      end
    -
    -      @render_help_last_log_invocation_count = @log_invocation_count
    -    end
    -
         def render_log_offset args
           return if @log_offset <= 0
           args.outputs.reserved << font_style.label(
    @@ -20126,7 +22633,6 @@ S
             process_inputs args
             return unless should_tick?
             calc args
    -        tick_help args
             prompt.tick
             menu.tick args
           rescue Exception => e
    @@ -20285,8 +22791,9 @@ S
     end
     
     
    -

    ./dragon/console_color.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    console_color.rb

    +
    # ./dragon/console_color.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # console_color.rb has been released under MIT (*only this file*).
     
    @@ -20318,8 +22825,9 @@ module GTK
     end
     
     
    -

    ./dragon/console_font_style.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    console_font_style.rb

    +
    # ./dragon/console_font_style.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # console_font_style.rb has been released under MIT (*only this file*).
     
    @@ -20361,14 +22869,17 @@ module GTK
     end
     
     
    -

    ./dragon/console_menu.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    console_menu.rb

    +
    # ./dragon/console_menu.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # console_menu.rb has been released under MIT (*only this file*).
     
     module GTK
       class Console
         class Menu
    +      attr_accessor :buttons
    +
           def initialize console
             @console = console
           end
    @@ -20402,28 +22913,63 @@ module GTK
             @console.hide
           end
     
    +      def hide_menu_clicked
    +        @menu_shown = :hidden
    +      end
    +
           def framerate_diagnostics_clicked
    +        @console.scroll_to_bottom
             $gtk.framerate_diagnostics
           end
     
    +      def itch_wizard_clicked
    +        @console.scroll_to_bottom
    +        $wizards.itch.start
    +      end
    +
    +      def docs_clicked
    +        @console.scroll_to_bottom
    +        log Kernel.docs_classes
    +      end
    +
    +      def scroll_end_clicked
    +        @console.scroll_to_bottom
    +      end
    +
    +      def custom_buttons
    +        []
    +      end
    +
           def tick args
             return unless @console.visible?
     
             @menu_shown ||= :hidden
     
    -        if @menu_shown == :hidden
    +        if $gtk.production
    +          @buttons = [
    +            (button id: :record,      row: 0, col:   9, text: "record gameplay",       method: :record_clicked),
    +            (button id: :replay,      row: 0, col:  10, text: "start replay",          method: :replay_clicked),
    +          ]
    +        elsif @menu_shown == :hidden
               @buttons = [
                 (button id: :show_menu,       row: 0, col: 10, text: "show menu", method: :show_menu_clicked),
               ]
             else
               @buttons = [
    -            (button id: :record,      row: 0, col:  4, text: "framerate diagnostics",   method: :framerate_diagnostics_clicked),
    -            (button id: :record,      row: 0, col:  5, text: "record",      method: :record_clicked),
    -            (button id: :replay,      row: 0, col:  6, text: "replay",      method: :replay_clicked),
    -            (button id: :reset,       row: 0, col:  7, text: "reset",       method: :reset_clicked),
    -            (button id: :scroll_up,   row: 0, col:  8, text: "scroll up",   method: :scroll_up_clicked),
    -            (button id: :scroll_down, row: 0, col:  9, text: "scroll down", method: :scroll_down_clicked),
    -            (button id: :close,       row: 0, col: 10, text: "close",       method: :close_clicked),
    +            (button id: :scroll_up,   row: 0, col:  6, text: "scroll up",             method: :scroll_up_clicked),
    +            (button id: :scroll_down, row: 0, col:  7, text: "scroll down",           method: :scroll_down_clicked),
    +            (button id: :scroll_down, row: 0, col:  8, text: "scroll end",            method: :scroll_end_clicked),
    +            (button id: :close,       row: 0, col:  9, text: "close console",         method: :close_clicked),
    +            (button id: :hide,        row: 0, col: 10, text: "hide menu",             method: :hide_menu_clicked),
    +
    +            (button id: :record,      row: 1, col:  7, text: "record gameplay",       method: :record_clicked),
    +            (button id: :replay,      row: 1, col:  8, text: "start replay",          method: :replay_clicked),
    +            (button id: :record,      row: 1, col:  9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked),
    +            (button id: :reset,       row: 1, col: 10, text: "reset game",            method: :reset_clicked),
    +
    +            (button id: :reset,       row: 2, col: 10, text: "docs",                  method: :docs_clicked),
    +            (button id: :reset,       row: 2, col:  9, text: "itch wizard",           method: :itch_wizard_clicked),
    +            *custom_buttons
               ]
             end
     
    @@ -20456,10 +23002,11 @@ module GTK
             {
               id: id,
               rect: (rect_for_layout row, col),
    +          text: text,
               method: method
             }.let do |entity|
               primitives = []
    -          primitives << entity[:rect].merge(a: 80).solid
    +          primitives << entity[:rect].merge(a: 164).solid
               primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border
               primitives << text.wrapped_lines(5)
                                 .map_with_index do |l, i|
    @@ -20484,8 +23031,9 @@ module GTK
     end
     
     
    -

    ./dragon/console_prompt.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    console_prompt.rb

    +
    # ./dragon/console_prompt.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # console_prompt.rb has been released under MIT (*only this file*).
     
    @@ -20657,8 +23205,9 @@ S
     end
     
     
    -

    ./dragon/controller.rb

    -
    # coding: utf-8
    +

    controller.rb

    +
    # ./dragon/controller.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # controller.rb has been released under MIT (*only this file*).
    @@ -20782,8 +23331,9 @@ end
     
     
     
    -

    ./dragon/controller/config.rb

    -
    # coding: utf-8
    +

    controller/config.rb

    +
    # ./dragon/controller/config.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # controller/config.rb has been released under MIT (*only this file*).
    @@ -21184,8 +23734,9 @@ module GTK
     end
     
     
    -

    ./dragon/controller/keys.rb

    -
    # coding: utf-8
    +

    controller/keys.rb

    +
    # ./dragon/controller/keys.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # controller/keys.rb has been released under MIT (*only this file*).
    @@ -21238,8 +23789,9 @@ module GTK
     end
     
     
    -

    ./dragon/directional_input_helper_methods.rb

    -
    # coding: utf-8
    +

    directional_input_helper_methods.rb

    +
    # ./dragon/directional_input_helper_methods.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # directional_input_helper_methods.rb has been released under MIT (*only this file*).
    @@ -21333,8 +23885,95 @@ S
     end
     
     
    -

    ./dragon/geometry.rb

    -
    # coding: utf-8
    +

    easing.rb

    +
    # ./dragon/easing.rb
    +# coding: utf-8
    +# Copyright 2019 DragonRuby LLC
    +# MIT License
    +# easing.rb has been released under MIT (*only this file*).
    +
    +module GTK
    +  module Easing
    +    def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions
    +      definitions.flatten!
    +      definitions = [:identity] if definitions.length == 0
    +      duration = end_tick - start_tick
    +      elapsed  = current_tick - start_tick
    +      y = elapsed.percentage_of(duration).cap_min_max(0, 1)
    +
    +      definitions.map do |definition|
    +        y = Easing.exec_definition(definition, start_tick, duration, y)
    +      end
    +
    +      y
    +    end
    +
    +    def self.ease_spline_extended start_tick, current_tick, end_tick, spline
    +      duration = end_tick - start_tick
    +      t = (current_tick - start_tick).fdiv duration
    +      time_allocation_per_curve = 1.fdiv(spline.length)
    +      curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t|
    +        [spline_t.to_i, spline_t - spline_t.to_i]
    +      end
    +      Geometry.cubic_bezier curve_t, *spline[curve_index]
    +    end
    +
    +    def self.initial_value *definitions
    +      definitions.flatten!
    +      return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0
    +    end
    +
    +    def self.final_value *definitions
    +      definitions.flatten!
    +      return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0
    +    end
    +
    +    def self.exec_definition definition, start_tick, duration, x
    +      if definition.is_a? Symbol
    +        return Easing.send(definition, x).cap_min_max(0, 1)
    +      elsif definition.is_a? Proc
    +        return definition.call(x, start_tick, duration).cap_min_max(0, 1)
    +      end
    +
    +      raise <<-S
    +* ERROR:
    +I don't know how to execute easing function with definition #{definition}.
    +
    +S
    +    end
    +
    +    def self.identity x
    +      x
    +    end
    +
    +    def self.flip x
    +      1 - x
    +    end
    +
    +    def self.quad x
    +      x * x
    +    end
    +
    +    def self.cube x
    +      x * x * x
    +    end
    +
    +    def self.quart x
    +      x * x * x * x * x
    +    end
    +
    +    def self.quint x
    +      x * x * x * x * x * x
    +    end
    +  end
    +end
    +
    +Easing = GTK::Easing
    +
    +
    +

    geometry.rb

    +
    # ./dragon/geometry.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # geometry.rb has been released under MIT (*only this file*).
    @@ -21705,8 +24344,9 @@ S
     end # module GTK
     
     
    -

    ./dragon/grid.rb

    -
    # coding: utf-8
    +

    grid.rb

    +
    # ./dragon/grid.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # grid.rb has been released under MIT (*only this file*).
    @@ -21897,8 +24537,9 @@ module GTK
     end
     
     
    -

    ./dragon/inputs.rb

    -
    # coding: utf-8
    +

    inputs.rb

    +
    # ./dragon/inputs.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # inputs.rb has been released under MIT (*only this file*).
    @@ -21971,7 +24612,7 @@ module GTK
               "2" => '@', "3" => '#', "4" => '$', "5" => '%',
               "6" => '^', "7" => '&', "8" => '*', "9" => '(',
               "0" => ')', ";" => ":", "=" => "+", "[" => "{",
    -          "]" => "}", '\'=> "|", '/' => "?", '.' => ">",
    +          "]" => "}", '\\'=> "|", '/' => "?", '.' => ">",
               ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C',
               'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G',
               'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K',
    @@ -22052,7 +24693,7 @@ module GTK
             "+"  => [:plus],
             "@"  => [:at],
             "/"  => [:forward_slash],
    -        "\" => [:back_slash],
    +        "\\" => [:back_slash],
             "*"  => [:asterisk],
             "<"  => [:less_than],
             ">"  => [:greater_than],
    @@ -22567,8 +25208,9 @@ module GTK
     end
     
     
    -

    ./dragon/log.rb

    -
    # coding: utf-8
    +

    log.rb

    +
    # ./dragon/log.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # log.rb has been released under MIT (*only this file*).
    @@ -22597,19 +25239,19 @@ module GTK
       class Log
         def self.write_to_log_and_puts *args
           return if $gtk.production
    -      $gtk.append_file 'logs/log.txt', args.join("\n") + "\n"
    +      $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n"
           args.each { |obj| $gtk.log obj, self }
         end
     
         def self.write_to_log_and_print *args
           return if $gtk.production
    -      $gtk.append_file 'logs/log.txt', args.join("\n")
    +      $gtk.append_file_root 'logs/log.txt', args.join("\n")
           Object.print(*args)
         end
     
         def self.puts_important *args
           return if $gtk.production
    -      $gtk.append_file 'logs/log.txt', args.join("\n")
    +      $gtk.append_file_root 'logs/log.txt', args.join("\n")
           $gtk.notify! "Important notification occurred."
           args.each { |obj| $gtk.log obj }
         end
    @@ -22834,8 +25476,9 @@ class Object
     end
     
     
    -

    ./dragon/numeric.rb

    -
    # coding: utf-8
    +

    numeric.rb

    +
    # ./dragon/numeric.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # numeric.rb has been released under MIT (*only this file*).
    @@ -23479,8 +26122,9 @@ class Integer
     end
     
     
    -

    ./dragon/runtime/framerate_diagnostics.rb

    -
    # Copyright 2019 DragonRuby LLC
    +

    runtime/framerate_diagnostics.rb

    +
    # ./dragon/runtime/framerate_diagnostics.rb
    +# Copyright 2019 DragonRuby LLC
     # MIT License
     # framerate_diagnostics.rb has been released under MIT (*only this file*).
     
    @@ -23647,8 +26291,9 @@ If this warning is getting annoying put the following in your tick method:
     end
     
     
    -

    ./dragon/string.rb

    -
    # coding: utf-8
    +

    string.rb

    +
    # ./dragon/string.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # string.rb has been released under MIT (*only this file*).
    @@ -23751,8 +26396,9 @@ S
     end
     
     
    -

    ./dragon/tests.rb

    -
    # coding: utf-8
    +

    tests.rb

    +
    # ./dragon/tests.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # tests.rb has been released under MIT (*only this file*).
    @@ -23893,8 +26539,9 @@ S
     end
     
     
    -

    ./dragon/trace.rb

    -
    # coding: utf-8
    +

    trace.rb

    +
    # ./dragon/trace.rb
    +# coding: utf-8
     # Copyright 2019 DragonRuby LLC
     # MIT License
     # trace.rb has been released under MIT (*only this file*).
    @@ -23961,7 +26608,7 @@ module GTK
           @traced_classes.clear
           $trace_enabled = false
           if !$gtk.production
    -        $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"
    +        $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"
           end
         end
     
    @@ -23983,9 +26630,9 @@ module GTK
           if $trace_puts.length > 0
             text = $trace_puts.join("")
             if pad_with_newline
    -          $gtk.append_file 'logs/trace.txt', "\n" + text.strip
    +          $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip
             else
    -          $gtk.append_file 'logs/trace.txt', text.strip
    +          $gtk.append_file_root 'logs/trace.txt', text.strip
             end
           end
           $trace_puts.clear
    @@ -24047,7 +26694,6 @@ module GTK
     end
     
     
    - diff --git a/docs/docs.txt b/docs/docs.txt index 7276894..a3a240e 100644 --- a/docs/docs.txt +++ b/docs/docs.txt @@ -310,79 +310,43 @@ around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore. -** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! +* IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this! Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app. -1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. -2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. -3. 01_api_01_labels: Various ways to render ~label~s. -4. 01_api_02_lines: Various ways to render ~line~s. -5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. -6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. -7. 01_api_05_keyboard: Hows how to get keyboard input from the user. -8. 01_api_06_mouse: Hows how to get mouse mouse position. -9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. -10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. -11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. -12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. -13. 02_collision_01_simple: Collision detection with dynamically moving bodies. -14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. -15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). -16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. -17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. -18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. -19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. -20. 04_sounds: How to play sounds and work with buttons. -21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. -22. 05_mouse_move_paint_app: Represents a simple paint app. -23. 05_mouse_move_tile_editor: A starting point for a tile editor. -24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. -25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). -26. 07_render_targets_advanced: Advanced usage of ~render_target~s. -27. 08_platformer_collisions: Axis aligned collision along with platformer physics. -28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. -29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. -30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. -31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. -32. 10_save_load_game: Save and load game data. -33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. -34. 11_hash_primitives: How primitives can be represented using a ~Hash~. -35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. -36. 12_top_down_area: How to render a top down map and how to manage collision of a player. -37. 13_01_easing_functions: How to use lerping functions to define animations/movement. -38. 13_02_cubic_bezier: How to create a bezier curve using lines. -39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. -40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. -41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. -42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). -43. 15_collision_limits: How many collisions can be processed across many primitives. -44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). -45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. -46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. -47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. -48. 21_mailbox_usage: How to do interprocess communication. -49. 22_trace_debugging: Debugging techniques and tracing execution through your game. -50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. -51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. -52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. -53. 24_http_example: How to make http requests. -54. 25_3d_experiment_01_square: How to create 3D objects. -55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. -56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. -57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. -58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. -59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. -60. 99_sample_game_pong: Reference implementation of pong. -61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. -62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. -63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. -64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. -65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. - +** Guided Samples + +1. ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language. +2. ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~. +3. ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~. +4. ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet). +4. ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics. +5. ~samples/05_mouse~: This set of samples show more advanced usages of the mouse. +6. ~samples/06_save_load~: This set of samples show how to save and load game data. +7. ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets. +8. ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations. +9. ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen. +10. ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques. +11. ~samples/11_http~: This set of samples show how use http. + +** Sample Games + +There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game: + +1. 3D Cube: Shows how to do faux 3D in DragonRuby. +2. Dueling Starships: A two player top-down versus game where each player controls a ship. +3. Flappy Dragon: DragonRuby's clone of Flappy Bird. +4. Pong: A simple implementation of the game Pong. +5. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun). +6. Solar System: A simulation of our solar system. +7. Crafting Starting Point: A starting point for those that want to build a crafting game. +8. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app. +9. LOWREZ: Sample apps that show how to render at different resolutions. +10. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs. +11. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers. * Deploying To Itch.io @@ -412,11 +376,11 @@ make it look like this: NOTE: Remove the ~#~ at the beginning of each line. #+begin_src -devid=bob -devtitle=Bob The Game Developer -gameid=mygame -gametitle=My Game -version=0.1 + devid=bob + devtitle=Bob The Game Developer + gameid=mygame + gametitle=My Game + version=0.1 #+end_src The ~devid~ property is the username you use to log into Itch.io. @@ -430,7 +394,7 @@ The ~version~ can be any ~major.minor~ number format. Open up the terminal and run this from the command line: #+begin_src -./dragonruby-publish --only-package mygame + ./dragonruby-publish --only-package mygame #+end_src (if you're on Windows, don't put the "./" on the front. That's a Mac and @@ -445,7 +409,7 @@ For the HTML version of your game after you upload it. Check the checkbox labele For subsequent updates you can use an automated deployment to Itch.io: #+begin_src -./dragonruby-publish mygame + ./dragonruby-publish mygame #+end_src DragonRuby will package _and publish_ your game to itch.io! Tell your @@ -454,7 +418,7 @@ friends to go to your game's very own webpage and buy it! If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you. -** DragonRuby's Philosophy +* DragonRuby's Philosophy The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, @@ -462,7 +426,7 @@ there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. -*** Challenge The Status Quo +** Challenge The Status Quo Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker @@ -476,7 +440,7 @@ It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us. -*** Continuity of Design +** Continuity of Design There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the @@ -491,7 +455,7 @@ render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront). -*** Release Often And Soon +** Release Often And Soon The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and @@ -508,7 +472,7 @@ Remember: Real artists ship. #+end_quote -*** Sustainable And Ethical Monetization +** Sustainable And Ethical Monetization We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or @@ -518,7 +482,7 @@ Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it. -*** Sustainable And Ethical Open Source +** Sustainable And Ethical Open Source This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense @@ -529,7 +493,7 @@ still trying to figure out the best solution). So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir. -*** People Over Entities +** People Over Entities We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not @@ -537,13 +501,13 @@ insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby. -*** Building A Game Should Be Fun And Bring Happiness +** Building A Game Should Be Fun And Bring Happiness We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine. -*** Real World Application Drives Features +** Real World Application Drives Features We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and @@ -880,11 +844,9 @@ Under DragonRuby LLP, we offer a number of products (with more on the way): - Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]() + gaming platforms. - RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]() -- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() + apps. [[http://rubymotion.com]] All of the products above leverage a shared core called DragonRuby. @@ -903,7 +865,7 @@ identifier huh? The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. -*** Okay... so what is the difference between a language specification and a runtime? +**** Okay... so what is the difference between a language specification and a runtime? A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language @@ -912,13 +874,13 @@ specification implemented via the CRuby/MRI Runtime." But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby. -*** Okay... what language specification does DragonRuby use then? +**** Okay... what language specification does DragonRuby use then? DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries. -*** So... why another runtime? +**** So... why another runtime? The elevator pitch is: @@ -927,7 +889,7 @@ within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. -*** What does Multilevel Cross-platform mean? +**** What does Multilevel Cross-platform mean? There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a @@ -964,13 +926,87 @@ implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane. -*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? +**** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. -** Frequent Comments +*** How is DragonRuby different than MRI? + +DragonRuby supports a subset of MRI apis. Our target is to support all +of mRuby's standard lib. There are challenges to this given the number +of platforms we are trying to support (specifically console). + +**** Does DragonRuby support Gems? + +DragonRuby does not support gems because that requires the +installation of MRI Ruby on the developer's machine (which is a +non-starter given that we want DragonRuby to be a zero dependency +runtime). While this seems easy for Mac and Linux, it is much harder +on Windows and Raspberry Pi. mRuby has taken the approach of having a +git repository for compatible gems and we will most likely follow +suite: [[https://github.com/mruby/mgem-list]]. + +**** Does DragonRuby have a REPL/IRB? + +You can use DragonRuby's Console within the game to inspect object and +execute small pieces of code. For more complex pieces of code create a +file called ~repl.rb~ and put it in ~mygame/app/repl.rb~: + +- Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method: + +#+begin_src ruby + repl do + puts "hello world" + puts 1 + 1 + end +#+end_src + +- If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal). + +- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. + +4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored. + +#+begin_src ruby + xrepl do # <------- line is prefixed with an "x" + puts "hello world" + puts 1 + 1 + end + + # This code will be executed when you save the file. + repl do + puts "Hello" + end + + repl do + puts "This code will also be executed." + end + + # use xrepl to "comment out" code + xrepl do + puts "This code will not be executed because of the x infront of repl". + end +#+end_src + +**** Does DragonRuby support ~pry~ or have any other debugging facilities? + +~pry~ is a gem that assumes you are using the MRI Runtime (which is +incompatible with DragonRuby). Eventually DragonRuby will have a pry +based experience that is compatible with a debugging infrastructure +called LLDB. Take the time to read about LLDB as it shows the +challenges in creating something that is compatible. + +You can use DragonRuby's replay capabilities to troubleshoot: + +1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added). +2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. +3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~. +4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release. +5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago. + +** Frequent Comments About Ruby as a Language Choice *** But Ruby is dead. @@ -1022,6 +1058,8 @@ If you have ideas on how we can do this, email us! If the reason above isn't sufficient, then definitely use something else. +All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]] + *** DragonRuby is for pay. You should offer a free version. If you can afford to pay for DragonRuby, you should (and will). We don't go @@ -1084,6 +1122,9 @@ under a permissive license. * DOCS: ~GTK::Runtime~ The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~. +* DOCS: ~GTK::Runtime#reset~ +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. + * DOCS: ~GTK::Runtime#calcstringbox~ This function returns the width and height of a string. @@ -1094,8 +1135,18 @@ This function returns the width and height of a string. end #+end_src -* DOCS: ~GTK::Runtime#reset~ -This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +* DOCS: ~GTK::Runtime#write_file~ +This function takes in two parameters. The first paramter is the file path and assumes the the game +directory is the root. The second parameter is the string that will be written. The method overwrites whatever +is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting. + +#+begin_src ruby + def tick args + if args.inputs.mouse.click + args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at #{args.state.tick_count}." + end + end +#+end_src * DOCS: ~Array~ @@ -1804,8 +1855,9 @@ Returns the current tick of the application from the point it was started. This * Open Source Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]]. -* 00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb +* Learn Ruby Optional - Beginner Ruby Primer - automation.rb #+begin_src ruby + # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb # ========================================================================== # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | | @@ -1929,8 +1981,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb +* Learn Ruby Optional - Beginner Ruby Primer - main.rb #+begin_src ruby + # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb # ========================================================================== # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | | @@ -2251,477 +2304,703 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - printing.txt #+begin_src ruby - def tick args - args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt + # ==================================================================================== + # Commenting Code + # ==================================================================================== + # + # Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: + # + # I am commented code. And so are the lines above. + # + # I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's + # an entertaining read. Otherwise, go to the next txt file. + # + # Follow along by visiting: + # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 + + # ==================================================================================== + # Printing to the Console: + # ==================================================================================== + # + # Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text + # to repl.rb and save to see Hello World printed to the console. + + repl do + puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.' + puts '====' + puts '======' + puts '================================' + puts 'Hello World' + puts '================================' + puts '======' + puts '====' end #+end_src -* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb +* Learn Ruby Optional - Intermediate Ruby Primer - strings.txt #+begin_src ruby + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt + # ==================================================================================== + # Strings + # ==================================================================================== + # + # Here is how you work with strings in Ruby. Take the text + # in this file and paste it into repl.rb and save: + + repl do + puts '* RUBY PRIMER: strings' + message = "Hello World" + puts "The value of message is: " + message + puts "Any value can be interpolated within a string using \#{}." + puts "Interpolated message: #{message}." + puts 'This #{message} is not interpolated because the string uses single quotes.' + end #+end_src -* 01_rendering_basics/01_labels/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt #+begin_src ruby - =begin + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt + # ==================================================================================== + # Numerics + # ==================================================================================== + # + # Here is how you work with numbers in Ruby. Take the text + # in this file and paste it into repl.rb and save: - APIs listing that haven't been encountered in a previous sample apps: + repl do + puts '* RUBY PRIMER: Fixnum and Floats' + a = 10 + puts "The value of a is: #{a}" + puts "a + 1 is: #{a + 1}" + puts "a / 3 is: #{a / 3}" + puts '' - - args.outputs.labels: An array. Values in this array generate labels - the screen. - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). - - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction - by adding or subracting. + b = 10.12 + puts "The value of b is: #{b}" + puts "b + 1 is: #{b + 1}" + puts "b as an integer is: #{b.to_i}" + puts '' + end + +#+end_src + +* Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt +#+begin_src ruby + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt + # ==================================================================================== + # Booleans + # ==================================================================================== + # + # Here is how you work with numbers in Ruby. Take the text + # in this file and paste it into repl.rb and save: - =end + repl do + puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)' + puts "Anything that *isn't* false or nil is true." - # Labels are used to represent text elements in DragonRuby + c = 30 + puts "The value of c is #{c}." - # An example of creating a label is: - # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] + if c + puts "This if statement ran because c is truthy." + end - # The code above does the following: - # 1. GET the place where labels go: args.outputs.labels - # 2. Request a new LABEL be ADDED: << - # 3. The DEFINITION of a SOLID is the ARRAY: - # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] - # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + d = false + puts "The value if d is #{d}. The type for d is #{d.class}." + if !d + puts "This if statement ran because d is falsey, using the not operator (!)." + end - # The tick method is called by DragonRuby every frame - # args contains all the information regarding the game. - def tick args - tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays." - # Here are some examples of simple labels, with the minimum number of parameters - # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font - args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"] + e = nil + puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}." - args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."] - args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."] - args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."] - args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."] + if !e + puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}." + end + end + +#+end_src + +* Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt +#+begin_src ruby + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt + # ==================================================================================== + # Conditionals + # ==================================================================================== + # + # Here is how you create conditionals in Ruby. Take the text + # in this file and paste it into repl.rb and save: - # Demonstration of the Size Parameter - args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2] - args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1] - args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0] - args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1] - args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2] + repl do + puts "* RUBY PRIMER: Conditionals" + end - # Demonstration of the Align Parameter - args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2] - args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1] - args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0] + # ==================================================================================== + # if + # ==================================================================================== - # Demonstration of the RGBA parameters - args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0] - args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0] - args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255] - args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128] + repl do + puts "** INFO: if statement" + i_am_one = 1 + if i_am_one + puts "This was printed because i_am_one is truthy." + end + end - # Demonstration of the Font parameter - # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is - args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ] - args.outputs.primitives << { x: 690 + 150, - y: 330 - 50, - text: "Custom font (Hash)", - size_enum: 0, - alignment_enum: 1, - r: 125, - g: 0, - b: 200, - a: 255, - font: "manaspc.ttf" }.label + # ==================================================================================== + # if/else + # ==================================================================================== - # Primitives can hold anything, and can be given a label in the following forms - args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label + repl do + puts "** INFO: if/else statement" + i_am_false = false + if i_am_false + puts "This will NOT get printed because i_am_false is false." + else + puts "This was printed because i_am_false is false." + end + end - args.outputs.primitives << { x: 690 + 150, - y: 330 - 110, - text: "Custom font (.primitives Hash)", - size_enum: 0, - alignment_enum: 1, - r: 125, - g: 0, - b: 200, - a: 255, - font: "manaspc.ttf" }.label + + # ==================================================================================== + # if/elsif/else + # ==================================================================================== + + repl do + puts "** INFO: if/elsif/else statement" + i_am_false = false + i_am_true = true + if i_am_false + puts "This will NOT get printed because i_am_false is false." + elsif i_am_true + puts "This was printed because i_am_true is true." + else + puts "This will NOT get printed i_am_true was true." + end end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + # ==================================================================================== + # case + # ==================================================================================== + + repl do + puts "** INFO case statement" + i_am_one = 1 # change this value to see different results + + case i_am_one + when 10 + puts "the value of i_am_one is 10" + when 9 + puts "the value of i_am_one is 9" + when 5 + puts "the value of i_am_one is 5" + when 1 + puts "the value of i_am_one is 1" + else + puts "Value wasn't cased." end + end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + # ==================================================================================== + # comparison operators + # ==================================================================================== + + repl do + puts "** INFO: Different types of comparisons" + if 4 == 4 + puts "4 equals 4 (==)" + end + + if 4 != 3 + puts "4 does not equal 3 (!=)" + end + + if 3 < 4 + puts "3 is less than 4 (<)" + end + + if 4 > 3 + puts "4 is greater than 3 (>)" + end + end + + # ==================================================================================== + # and/or conditionals + # ==================================================================================== + + repl do + puts "** INFO: AND, OR operator (&&, ||)" + if (4 > 3) || (3 < 4) || false + puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)" + end + + if (4 > 3) && (3 < 4) + puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)" + end end #+end_src -* 01_rendering_basics/02_lines/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - looping.txt #+begin_src ruby - =begin - - APIs listing that haven't been encountered in a previous sample apps: - - - args.outputs.lines: An array. Values in this array generate lines on - the screen. - - args.state.tick_count: This property contains an integer value that - represents the current frame. GTK renders at 60 FPS. A value of 0 - for args.state.tick_count represents the initial load of the game. - - =end - - # The parameters required for lines are: - # 1. The initial point (x, y) - # 2. The end point (x2, y2) - # 3. The rgba values for the color and transparency (r, g, b, a) + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt + # ==================================================================================== + # Looping + # ==================================================================================== + # + # Looping looks a whole lot different than other languages. + # But it's pretty awesome when you get used to it. - # An example of creating a line would be: - # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255] + repl do + puts "* RUBY PRIMER: Loops" + end - # This would create a line from (100, 100) to (300, 300) - # The RGB code (255, 0, 255) would determine its color, a purple - # It would have an Alpha value of 255, making it completely opaque + # ==================================================================================== + # times + # ==================================================================================== - def tick args - tick_instructions args, "Sample app shows how to create lines." + repl do + puts "** INFO: ~Numeric#times~ (for loop)" + 3.times do |i| + puts i + end + end - args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"] + # ==================================================================================== + # foreach + # ==================================================================================== - # Some simple lines - args.outputs.lines << [380, 450, 675, 450] - args.outputs.lines << [380, 410, 875, 410] + repl do + puts "** INFO: ~Array#each~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char| + puts char + end - # These examples utilize args.state.tick_count to change the length of the lines over time - # args.state.tick_count is the ticks that have occurred in the game - # This is accomplished by making either the starting or ending point based on the args.state.tick_count - args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255] - args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255] - args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255] + puts "** INFO: ~Array#each_with_index~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char, i| + puts "index #{i}: #{char}" + end end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + # ==================================================================================== + # ranges + # ==================================================================================== + + repl do + puts "** INFO: range block exclusive (three dots)" + (0...3).each do |i| + puts i end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + puts "** INFO: range block inclusive (two dots)" + (0..3).each do |i| + puts i + end end #+end_src -* 01_rendering_basics/03_solids_borders/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - functions.txt #+begin_src ruby - =begin + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt + # ==================================================================================== + # Functions + # ==================================================================================== - APIs listing that haven't been encountered in a previous sample apps: + # The last statement of a function is implictly returned. Parenthesis for functions + # are optional as long as the statement can be envaluated disambiguously. - - args.outputs.solids: An array. Values in this array generate - solid/filled rectangles on the screen. + repl do + puts "* RUBY PRIMER: Functions" + end - =end + # ==================================================================================== + # Functions single parameter + # ==================================================================================== - # Rects are outputted in DragonRuby as rectangles - # If filled in, they are solids - # If hollow, they are borders + repl do + puts "* INFO: Function with one parameter" - # Solids are added to args.outputs.solids - # Borders are added to args.outputs.borders + # function definition + def add_one_to n + n + 1 + end - # The parameters required for rects are: - # 1. The upper right corner (x, y) - # 2. The width (w) - # 3. The height (h) - # 4. The rgba values for the color and transparency (r, g, b, a) + # Parenthesis are optional in Ruby as long as the + # parsing is disambiguous. Here are a couple of variations. + # Generally speaking, don't put parenthesis is you don't have to. - # Here is an example of a rect definition: - # [100, 100, 400, 500, 0, 255, 0, 180] + # Conventional Usage of Parenthesis. + puts add_one_to(3) - # The example would create a rect from (100, 100) - # Extending 400 pixels across the x axis - # and 500 pixels across the y axis - # The rect would be green (0, 255, 0) - # and mostly opaque with some transparency (180) + # DragonRuby's recommended use of parenthesis (inner function has parenthesis). + puts (add_one_to 3) - # Whether the rect would be filled or not depends on if - # it is added to args.outputs.solids or args.outputs.borders + # Full parens. + puts(add_one_to(3)) + # Outer function has parenthesis + puts(add_one_to 3) + end - def tick args - tick_instructions args, "Sample app shows how to create solid squares." - args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"] - args.outputs.solids << [470, 520, 50, 50] - args.outputs.solids << [530, 520, 50, 50, 0, 0, 0] - args.outputs.solids << [590, 520, 50, 50, 255, 0, 0] - args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128] - args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] + # ==================================================================================== + # Functions with default parameter values + # ==================================================================================== + repl do + puts "* INFO: Function with default value" + def function_with_default_value v = 10 + v * 10 + end - args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"] - args.outputs.borders << [470, 320, 50, 50] - args.outputs.borders << [530, 320, 50, 50, 0, 0, 0] - args.outputs.borders << [590, 320, 50, 50, 255, 0, 0] - args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128] - args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] + puts "Passing the argument three yields: #{function_with_default_value 3}" + puts "Passing no argument yields: #{function_with_default_value}" end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + # ==================================================================================== + # Nil default parameter value and ||= operator. + # ==================================================================================== + + repl do + puts "* INFO: Using the OR EQUAL operator (||=)" + def function_with_nil_default_with_local a = nil + result = a + result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE" + "value is #{result}." end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}" + puts "Passing nil: #{function_with_nil_default_with_local}" end #+end_src -* 01_rendering_basics/04_sprites/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt #+begin_src ruby - =begin - - APIs listing that haven't been encountered in a previous sample apps: + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt + # ==================================================================================== + # Arrays + # ==================================================================================== - - args.outputs.sprites: An array. Values in this array generate - sprites on the screen. The location of the sprite is assumed to - be under the mygame/ directory (the exception being dragonruby.png). + # Arrays are incredibly powerful in Ruby. Learn to use them well. - =end + repl do + puts "* RUBY PRIMER: ARRAYS" + end + # ==================================================================================== + # Enumerable ranges and .to_a + # ==================================================================================== - # For all other display outputs, Sprites are your solution - # Sprites import images and display them with a certain rectangular area - # The image can be of any usual format and should be located within the folder, - # similar to additional fonts. + repl do + puts "** INFO: Create an array with the numbers 1 to 10." + one_to_ten = (1..10).to_a + puts one_to_ten + end - # Sprites have the following parameters - # Rectangular area (x, y, width, height) - # The image (path) - # Rotation (angle) - # Alpha (a) + # ==================================================================================== + # Finding elements + # ==================================================================================== - def tick args - tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it." - args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"] - args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png'] - args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360] - args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255] - end + repl do + puts "** INFO: Finding elements in an array using ~Array#find_all~." + puts "Create a new array that only contains even numbers from the previous array." - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + one_to_ten = (1..10).to_a + evens = one_to_ten.find_all do |number| + number % 2 == 0 end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + puts evens end - -#+end_src - -* 01_rendering_basics/05_sounds/app/main.rb -#+begin_src ruby - =begin - - APIs Listing that haven't been encountered in previous sample apps: - - sample: Chooses random element from array. - In this sample app, the target note is set by taking a sample from the collection - of available notes. + # ==================================================================================== + # Rejecting elements + # ==================================================================================== - Reminders: - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + repl do + puts "** INFO: Removing elements in an array using ~Array#reject~." + puts "Create a new array that rejects odd numbers." - - 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. + one_to_ten = (1..10).to_a + also_even = one_to_ten.reject do |number| + number % 2 != 0 + end - - 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. + puts also_even + end - - 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. + # ==================================================================================== + # Array transform using the map function. + # ==================================================================================== - - reject: Removes elements from a collection if they meet certain requirements. + repl do + puts "** INFO: Creating new derived values from an array using ~Array#map~." + puts "Create an array that doubles every number." - - first: Returns the first element of an array. + one_to_ten = (1..10).to_a + doubled = one_to_ten.map do |number| + number * 2 + end - - inside_rect: Returns true or false depending on if the point is inside the rect. + puts doubled + end - - to_sym: Returns symbol corresponding to string. Will create a symbol if it does - not already exist. + # ==================================================================================== + # Combining array functions. + # ==================================================================================== - =end + repl do + puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~." + puts "Create an array that selects only odd numbers and then multiply those by 10." - # This sample app allows users to test their musical skills by matching the piano sound that plays in each - # level to the correct note. + one_to_ten = (1..10).to_a + odd_doubled = one_to_ten.find_all do |number| + number % 2 != 0 + end.map do |odd_number| + odd_number * 10 + end - # Runs all the methods necessary for the game to function properly. - def tick args - defaults args - render args - calc args - input_mouse args - tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\"" + puts odd_doubled end - # Sets default values and creates empty collections - # Initialization happens in the first frame only - def defaults _ - _.state.notes ||= [] - _.state.click_feedbacks ||= [] - _.state.current_level ||= 1 - _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet + # ==================================================================================== + # Product function. + # ==================================================================================== + + repl do + puts "** INFO: Create all combinations of array values using ~Array#product~." + puts "All two-item pairs of numbers 1 to 10." + one_to_ten = (1..10).to_a + all_combinations = one_to_ten.product(one_to_ten) + puts all_combinations end - # Uses a label to display current level, and shows the score - # Creates a button to play the sample note, and displays the available notes that could be a potential match - def render _ + # ==================================================================================== + # Uniq and sort function. + # ==================================================================================== - # grid.w_half positions the label in the horizontal center of the screen. - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0] + repl do + puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~." + puts "All uniq combinations of numbers regardless of order." + puts "For example: [1, 2] is the same as [2, 1]." + one_to_ten = (1..10).to_a + uniq_combinations = + one_to_ten.product(one_to_ten) + .map do |unsorted_number| + unsorted_number.sort + end.uniq + puts uniq_combinations + end + + # ==================================================================================== + # Example of an advanced array transform. + # ==================================================================================== - render_score _ # shows score on screen + repl do + puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~." + puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." + + one_to_hundred = (1..100).to_a + + triples = + one_to_hundred.product(one_to_hundred).map do |width, height| + [width, height, Math.sqrt(width ** 2 + height ** 2)] + end.find_all do |_, _, hypotenuse| + hypotenuse.to_i == hypotenuse + end.map do |triangle| + triangle.map(&:to_i) + end.uniq do |triangle| + triangle.sort + end.map do |width, height, hypotenuse| + [width, height, hypotenuse, (width * height) / 2] + end.sort_by do |_, _, _, area| + area + end - if _.state.game_over # if game is over, a "play again" button is shown - # Calculations ensure that Play Again label is displayed in center of border - # Remove calculations from y parameters and see what happens to border and label placement - _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title - _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label - _.outputs.borders << _.state.play_again_border # outputs border - else # otherwise, if game is not over - # Calculations ensure that label appears in center of border - _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title - _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label - _.outputs.borders << _.state.play_note_border # outputs border + triples.each do |width, height, hypotenuse, _| + puts "(#{width}, #{height}, #{hypotenuse})" end + end - return if _.state.game_over # return if game is over - - _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label + # ==================================================================================== + # Example of an sorting. + # ==================================================================================== - # Shows all of the available notes that can be potential matches. - available_notes.each_with_index do |note, i| - _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border) - _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border - _.outputs.borders << _.state.notes[i].border - end + repl do + puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype." - # Shows whether or not the user is correct by filling the screen with either red or green - _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid } - end + things_to_sort = [ + { type: :background, order: 1 }, + { type: :foreground, order: 1 }, + { type: :foreground, order: 2 } + ] + puts "*** Original array." + puts things_to_sort + + puts "*** Simple sort using key." + # For a simple sort, you can use sort_by + results = things_to_sort.sort_by do |hash| + hash[:order] + end + + puts results + + puts "*** Custom sort." + puts "**** Sorting process." + # for a more complicated sort, you can provide a block that returns + # -1, 0, 1 for a left and right operand + results = things_to_sort.sort do |l, r| + sort_result = 0 + puts "here is l: #{l}" + puts "here is r: #{r || "nil"}" + # if either value is nil/false return 0 + if !l || !r + sort_result = 0 + # if the type of "left" is background and the + # type of "right" is foreground, then return + # -1 (which means "left" is less than "right" + elsif l[:type] == :background && r[:type] == :foreground + sort_result = -1 + # if the type of "left" is foreground and the + # type of "right" is background, then return + # 1 (which means "left" is greater than "right" + elsif l[:type] == :foreground && r[:type] == :background + sort_result = 1 + # if "left" and "right"'s type are the same, then + # use the order as the tie breaker + elsif l[:order] < r[:order] + sort_result = -1 + elsif l[:order] > r[:order] + sort_result = 1 + # returning 0 means both values are equal + else + sort_result = 0 + end + sort_result + end.to_a - # Shows the score (number of times the user guesses wrong) onto the screen using labels. - def render_score _ - if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0] - else # otherwise, number of times the user has guessed wrong is shown - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation - end + puts "**** Sort result." + puts results end - # Sets the target note for the level and performs calculations on click_feedbacks. - def calc _ - _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note - _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely - # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection - _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 } + # ==================================================================================== + # Api documention for Array that is worth commiting to memory because arrays are so + # awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html + # ==================================================================================== + +#+end_src + +* Learn Ruby Optional - Intermediate Ruby Primer - main.rb +#+begin_src ruby + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb + def tick args + args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] end + +#+end_src + +* Learn Ruby Optional - Intermediate Ruby Primer - repl.rb +#+begin_src ruby + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb + +#+end_src + +* Rendering Basics - Labels - main.rb +#+begin_src ruby + # ./samples/01_rendering_basics/01_labels/app/main.rb + =begin - # Uses input from the user to play the target note, as well as the other notes that could be a potential match. - def input_mouse _ - return unless _.inputs.mouse.click # return unless the mouse is clicked + APIs listing that haven't been encountered in a previous sample apps: - # finds button that was clicked by user - button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements - _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of - end.reject {|b| !_.state.meta(b)}.first # reject, return first element + - args.outputs.labels: An array. Values in this array generate labels + the screen. + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction + by adding or subracting. - return unless button_clicked # return unless button_clicked as a value (a button was clicked) + =end - queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked - button_clicked.x, - button_clicked.y, - button_clicked.w, - button_clicked.h, - 150, 100, 200 # sets color of button to shade of purple + # Labels are used to represent text elements in DragonRuby - if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed - _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output - elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed - _.state.target_note = nil # no target note - _.state.current_level = 1 # starts at level 1 again - _.state.times_wrong = 0 # starts off with 0 wrong guesses - _.state.game_over = false # the game is not over (because it has just been restarted) - else # otherwise if neither of those buttons were pressed - _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played - if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note - _.state.target_note = nil # target note is emptied + # An example of creating a label is: + # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] - if _.state.current_level < 9 # if game hasn't reached level 9 - _.state.current_level += 1 # game goes to next level - else # otherwise, if game has reached level 9 - _.state.game_over = true # the game is over - end + # The code above does the following: + # 1. GET the place where labels go: args.outputs.labels + # 2. Request a new LABEL be ADDED: << + # 3. The DEFINITION of a SOLID is the ARRAY: + # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] + # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly - else # otherwise, if clicked note is not target note - _.state.times_wrong += 1 # increments times user guessed wrong - queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong - end - end - end - # Creates a collection of all of the available notes as symbols - def available_notes - [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4] - end + # The tick method is called by DragonRuby every frame + # args contains all the information regarding the game. + def tick args + tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays." + # Here are some examples of simple labels, with the minimum number of parameters + # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font + args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"] - # Creates buttons for each note, and sets a label (the note's name) and border for each note's button. - def piano_button _, note, position - _.state.new_entity(:button) do |b| # declares button as new entity - b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition - b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border - end - end + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."] + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."] + args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."] + args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."] - # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong - # If a button is clicked, the inside of button is purple (see input_mouse method) - # If correct note is clicked, screen turns green - # If incorrect note is clicked, screen turns red (again, see input_mouse method) - def queue_click_feedback _, x, y, w, h, *color - _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity - c.solid = [x, y, w, h, *color, 255] # sets color - end + # Demonstration of the Size Parameter + args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2] + args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1] + args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0] + args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1] + args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2] + + # Demonstration of the Align Parameter + args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2] + args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1] + args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0] + + # Demonstration of the RGBA parameters + args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0] + args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0] + args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255] + args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128] + + # Demonstration of the Font parameter + # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is + args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ] + args.outputs.primitives << { x: 690 + 150, + y: 330 - 50, + text: "Custom font (Hash)", + size_enum: 0, + alignment_enum: 1, + r: 125, + g: 0, + b: 200, + a: 255, + font: "manaspc.ttf" }.label + + # Primitives can hold anything, and can be given a label in the following forms + args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label + + args.outputs.primitives << { x: 690 + 150, + y: 330 - 110, + text: "Custom font (.primitives Hash)", + size_enum: 0, + alignment_enum: 1, + r: 125, + g: 0, + b: 200, + a: 255, + font: "manaspc.ttf" }.label end def tick_instructions args, text, y = 715 @@ -2740,165 +3019,50 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 02_input_basics/01_keyboard/app/main.rb +* Rendering Basics - Lines - main.rb #+begin_src ruby + # ./samples/01_rendering_basics/02_lines/app/main.rb =begin APIs listing that haven't been encountered in a previous sample apps: - - args.inputs.keyboard.key_up.KEY: The value of the properties will be set - to the frame that the key_up event occurred (the frame correlates - to args.state.tick_count). Otherwise the value will be nil. For a - full listing of keys, take a look at mygame/documentation/06-keyboard.md. - - args.state.PROPERTY: The state property on args is a dynamic - structure. You can define ANY property here with ANY type of - arbitrary nesting. Properties defined on args.state will be retained - across frames. If you attempt access a property that doesn't exist - on args.state, it will simply return nil (no exception will be thrown). + - args.outputs.lines: An array. Values in this array generate lines on + the screen. + - args.state.tick_count: This property contains an integer value that + represents the current frame. GTK renders at 60 FPS. A value of 0 + for args.state.tick_count represents the initial load of the game. =end - # Along with outputs, inputs are also an essential part of video game development - # DragonRuby can take input from keyboards, mouse, and controllers. - # This sample app will cover keyboard input. + # The parameters required for lines are: + # 1. The initial point (x, y) + # 2. The end point (x2, y2) + # 3. The rgba values for the color and transparency (r, g, b, a) - # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed - # This will work with the other keys as well + # An example of creating a line would be: + # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255] + # This would create a line from (100, 100) to (300, 300) + # The RGB code (255, 0, 255) would determine its color, a purple + # It would have an Alpha value of 255, making it completely opaque def tick args - tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 - # Notice how small_font accounts for all the remaining parameters - args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] - args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] - args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] - - # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key - if args.inputs.keyboard.key_up.h - args.state.h_pressed_at = args.state.tick_count - end - - # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false - args.state.h_pressed_at ||= false - - if args.state.h_pressed_at - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] - else - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] - end - - tick_help_text args - end - - def small_font - # This method provides some values for the construction of labels - # Specifically, Size, Alignment, & RGBA - # This makes it so that custom parameters don't have to be repeatedly typed. - # Additionally "small_font" provides programmers with more information than some numbers - [-2, 0, 0, 0, 0, 255] - end - - def row_to_px args, row_number - # This takes a row_number and converts it to pixels DragonRuby understands. - # Row 0 starts 5 units below the top of the grid - # Each row afterward is 20 units lower - args.grid.top.shift_down(5).shift_down(20 * row_number) - end - - # Don't worry about understanding the code within this method just yet. - # This method shows you the help text within the game. - def tick_help_text args - return unless args.state.h_pressed_at - - args.state.key_value_history ||= {} - args.state.key_down_value_history ||= {} - args.state.key_held_value_history ||= {} - args.state.key_up_value_history ||= {} - - if (args.inputs.keyboard.key_down.truthy_keys.length > 0 || - args.inputs.keyboard.key_held.truthy_keys.length > 0 || - args.inputs.keyboard.key_up.truthy_keys.length > 0) - args.state.help_available = true - args.state.no_activity_debounce = nil - else - args.state.no_activity_debounce ||= 5.seconds - args.state.no_activity_debounce -= 1 - if args.state.no_activity_debounce <= 0 - args.state.help_available = false - args.state.key_value_history = {} - args.state.key_down_value_history = {} - args.state.key_held_value_history = {} - args.state.key_up_value_history = {} - end - end - - args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] - - if !args.state.help_available - args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] - return - end - - args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] - args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] - args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] - args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] - - fill_history args, :key_value_history, :down_or_held, nil - fill_history args, :key_down_value_history, :down, :key_down - fill_history args, :key_held_value_history, :held, :key_held - fill_history args, :key_up_value_history, :up, :key_up - - render_help_labels args, :key_value_history, :down_or_held, nil, 10 - render_help_labels args, :key_down_value_history, :down, :key_down, 330 - render_help_labels args, :key_held_value_history, :held, :key_held, 650 - render_help_labels args, :key_up_value_history, :up, :key_up, 990 - end + tick_instructions args, "Sample app shows how to create lines." - def fill_history args, history_key, state_key, keyboard_method - fill_single_history args, history_key, state_key, keyboard_method, :raw_key - fill_single_history args, history_key, state_key, keyboard_method, :char - args.inputs.keyboard.keys[state_key].each do |key_name| - fill_single_history args, history_key, state_key, keyboard_method, key_name - end - end + args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"] - def fill_single_history args, history_key, state_key, keyboard_method, key_name - current_value = args.inputs.keyboard.send(key_name) - if keyboard_method - current_value = args.inputs.keyboard.send(keyboard_method).send(key_name) - end - args.state.as_hash[history_key][key_name] ||= [] - args.state.as_hash[history_key][key_name] << current_value - args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse - end + # Some simple lines + args.outputs.lines << [380, 450, 675, 450] + args.outputs.lines << [380, 410, 875, 410] - def render_help_labels args, history_key, state_key, keyboard_method, x - idx = 8 - args.outputs.labels << args.state - .as_hash[history_key] - .keys - .reverse - .map - .with_index do |k, i| - v = args.state.as_hash[history_key][k] - current_value = args.inputs.keyboard.send(k) - if keyboard_method - current_value = args.inputs.keyboard.send(keyboard_method).send(k) - end - idx += 2 - [ - [x, row_to_px(args, idx - 2), - " .#{k} is #{current_value || "nil"}", - small_font], - [x, row_to_px(args, idx - 1), - " was #{v}", - small_font] - ] - end + # These examples utilize args.state.tick_count to change the length of the lines over time + # args.state.tick_count is the ticks that have occurred in the game + # This is accomplished by making either the starting or ending point based on the args.state.tick_count + args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255] + args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255] + args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255] end - def tick_instructions args, text, y = 715 return if args.state.key_event_occurred if args.inputs.mouse.click || @@ -2915,80 +3079,60 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 02_input_basics/02_mouse/app/main.rb +* Rendering Basics - Solids Borders - main.rb #+begin_src ruby + # ./samples/01_rendering_basics/03_solids_borders/app/main.rb =begin - APIs that haven't been encountered in a previous sample apps: + APIs listing that haven't been encountered in a previous sample apps: - - args.inputs.mouse.click: This property will be set if the mouse was clicked. - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. - - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed - since the click event. + - args.outputs.solids: An array. Values in this array generate + solid/filled rectangles on the screen. - Reminder: + =end - - args.state.PROPERTY: The state property on args is a dynamic - structure. You can define ANY property here with ANY type of - arbitrary nesting. Properties defined on args.state will be retained - across frames. If you attempt access a property that doesn't exist - on args.state, it will simply return nil (no exception will be thrown). - - =end + # Rects are outputted in DragonRuby as rectangles + # If filled in, they are solids + # If hollow, they are borders - # This code demonstrates DragonRuby mouse input + # Solids are added to args.outputs.solids + # Borders are added to args.outputs.borders - # To see if the a mouse click occurred - # Use args.inputs.mouse.click - # Which returns a boolean + # The parameters required for rects are: + # 1. The upper right corner (x, y) + # 2. The width (w) + # 3. The height (h) + # 4. The rgba values for the color and transparency (r, g, b, a) - # To see where a mouse click occurred - # Use args.inputs.mouse.click.point.x AND - # args.inputs.mouse.click.point.y + # Here is an example of a rect definition: + # [100, 100, 400, 500, 0, 255, 0, 180] - # To see which frame the click occurred - # Use args.inputs.mouse.click.created_at + # The example would create a rect from (100, 100) + # Extending 400 pixels across the x axis + # and 500 pixels across the y axis + # The rect would be green (0, 255, 0) + # and mostly opaque with some transparency (180) - # To see how many frames its been since the click occurred - # Use args.inputs.mouse.click.creat_at_elapsed + # Whether the rect would be filled or not depends on if + # it is added to args.outputs.solids or args.outputs.borders - # Saving the click in args.state can be quite useful def tick args - tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time." - x = 460 - - args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse") - - if args.inputs.mouse.click - args.state.last_mouse_click = args.inputs.mouse.click - end - - if args.state.last_mouse_click - click = args.state.last_mouse_click - args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}") - args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago") - args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}") - else - args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.") - args.outputs.labels << small_label(args, x, 13, "Please click mouse.") - end - end - - def small_label args, x, row, message - # This method effectively combines the row_to_px and small_font methods - # It changes the given row value to a DragonRuby pixel value - # and adds the customization parameters - [x, row_to_px(args, row), message, small_font] - end + tick_instructions args, "Sample app shows how to create solid squares." + args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"] + args.outputs.solids << [470, 520, 50, 50] + args.outputs.solids << [530, 520, 50, 50, 0, 0, 0] + args.outputs.solids << [590, 520, 50, 50, 255, 0, 0] + args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128] + args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] - def small_font - [-2, 0, 0, 0, 0, 255] - end - def row_to_px args, row_number - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"] + args.outputs.borders << [470, 320, 50, 50] + args.outputs.borders << [530, 320, 50, 50, 0, 0, 0] + args.outputs.borders << [590, 320, 50, 50, 255, 0, 0] + args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128] + args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] end def tick_instructions args, text, y = 715 @@ -3007,83 +3151,37 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 02_input_basics/03_mouse_point_to_rect/app/main.rb +* Rendering Basics - Sprites - main.rb #+begin_src ruby + # ./samples/01_rendering_basics/04_sprites/app/main.rb =begin - APIs that haven't been encountered in a previous sample apps: - - - args.outputus.borders: An array. Values in this array will be rendered as - unfilled rectangles on the screen. - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array - with at least four values is considered a rect. The inside_rect? function returns true - or false depending on if the point is inside the rect. - - ``` - # Point: x: 100, y: 100 - # Rect: x: 0, y: 0, w: 500, h: 500 - # Result: true - - [100, 100].inside_rect? [0, 0, 500, 500] - ``` - - ``` - # Point: x: 100, y: 100 - # Rect: x: 300, y: 300, w: 100, h: 100 - # Result: false - - [100, 100].inside_rect? [300, 300, 100, 100] - ``` + APIs listing that haven't been encountered in a previous sample apps: - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. - - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed - since the click event. + - args.outputs.sprites: An array. Values in this array generate + sprites on the screen. The location of the sprite is assumed to + be under the mygame/ directory (the exception being dragonruby.png). =end - # To determine whether a point is in a rect - # Use point.inside_rect? rect - - # This is useful to determine if a click occurred in a rect - - def tick args - tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." - - x = 460 - - args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") - - box = [785, 370, 50, 50, 0, 0, 170] - args.outputs.borders << box - - # Saves the most recent click into args.state - # Unlike the other components of args, - # args.state does not reset every tick. - if args.inputs.mouse.click - args.state.last_mouse_click = args.inputs.mouse.click - end - - if args.state.last_mouse_click - if args.state.last_mouse_click.point.inside_rect? box - args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") - else - args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") - end - else - args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") - end - end - def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] - end + # For all other display outputs, Sprites are your solution + # Sprites import images and display them with a certain rectangular area + # The image can be of any usual format and should be located within the folder, + # similar to additional fonts. - def small_font - [-2, 0, 0, 0, 0, 255] - end + # Sprites have the following parameters + # Rectangular area (x, y, width, height) + # The image (path) + # Rotation (angle) + # Alpha (a) - def row_to_px args, row_number - args.grid.top.shift_down(5).shift_down(20 * row_number) + def tick args + tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it." + args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"] + args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png'] + args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360] + args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255] end def tick_instructions args, text, y = 715 @@ -3102,221 +3200,183 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 02_input_basics/04_mouse_rect_to_rect/app/main.rb +* Rendering Basics - Sounds - main.rb #+begin_src ruby + # ./samples/01_rendering_basics/05_sounds/app/main.rb =begin - APIs that haven't been encountered in a previous sample apps: + APIs Listing that haven't been encountered in previous sample apps: - - args.outputs.borders: An array. Values in this array will be rendered as - unfilled rectangles on the screen. - - ARRAY#intersect_rect?: An array with at least four values is - considered a rect. The intersect_rect? function returns true - or false depending on if the two rectangles intersect. + - sample: Chooses random element from array. + In this sample app, the target note is set by taking a sample from the collection + of available notes. - ``` - # Rect One: x: 100, y: 100, w: 100, h: 100 - # Rect Two: x: 0, y: 0, w: 500, h: 500 - # Result: true + Reminders: + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). - [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500] - ``` + - 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. - ``` - # Rect One: x: 100, y: 100, w: 10, h: 10 - # Rect Two: x: 500, y: 500, w: 10, h: 10 - # Result: false + - 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. - [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10] - ``` + - 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. - =end + - reject: Removes elements from a collection if they meet certain requirements. - # Similarly, whether rects intersect can be found through - # rect1.intersect_rect? rect2 + - first: Returns the first element of an array. - def tick args - tick_instructions args, "Sample app shows how to determine if two rectangles intersect." - x = 460 + - inside_rect: Returns true or false depending on if the point is inside the rect. - args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen") - # red_box = [460, 250, 355, 90, 170, 0, 0] - # args.outputs.borders << red_box + - to_sym: Returns symbol corresponding to string. Will create a symbol if it does + not already exist. - # args.state.box_collision_one and args.state.box_collision_two - # Are given values of a solid when they should be rendered - # They are stored in game so that they do not get reset every tick - if args.inputs.mouse.click - if !args.state.box_collision_one - args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] - elsif !args.state.box_collision_two - args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] - else - args.state.box_collision_one = nil - args.state.box_collision_two = nil - end - end + =end - if args.state.box_collision_one - args.outputs.solids << args.state.box_collision_one - end + # This sample app allows users to test their musical skills by matching the piano sound that plays in each + # level to the correct note. - if args.state.box_collision_two - args.outputs.solids << args.state.box_collision_two - end + # Runs all the methods necessary for the game to function properly. + def tick args + defaults args + render args + calc args + input_mouse args + tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\"" + end - if args.state.box_collision_one && args.state.box_collision_two - if args.state.box_collision_one.intersect_rect? args.state.box_collision_two - args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.') - else - args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.') - end - else - args.outputs.labels << small_label(args, x, 4, '--') - end + # Sets default values and creates empty collections + # Initialization happens in the first frame only + def defaults _ + _.state.notes ||= [] + _.state.click_feedbacks ||= [] + _.state.current_level ||= 1 + _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet end - def small_label args, x, row, message - [x, row_to_px(args, row), message, small_font] - end + # Uses a label to display current level, and shows the score + # Creates a button to play the sample note, and displays the available notes that could be a potential match + def render _ - def small_font - [-2, 0, 0, 0, 0, 255] - end + # grid.w_half positions the label in the horizontal center of the screen. + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0] - def row_to_px args, row_number - args.grid.top.shift_down(5).shift_down(20 * row_number) - end + render_score _ # shows score on screen - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + if _.state.game_over # if game is over, a "play again" button is shown + # Calculations ensure that Play Again label is displayed in center of border + # Remove calculations from y parameters and see what happens to border and label placement + _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label + _.outputs.borders << _.state.play_again_border # outputs border + else # otherwise, if game is not over + # Calculations ensure that label appears in center of border + _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label + _.outputs.borders << _.state.play_note_border # outputs border end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label - end - -#+end_src - -* 02_input_basics/05_controller/app/main.rb -#+begin_src ruby - =begin - - APIs listing that haven't been encountered in previous sample apps: - - - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key - is being held down on the controller. - If there is more than one controller being used, they can be differentiated by - using names like controller_one and controller_two. - - For a full listing of buttons, take a look at mygame/documentation/08-controllers.md. - - Reminder: - - - args.state.PROPERTY: The state property on args is a dynamic - structure. You can define ANY property here with ANY type of - arbitrary nesting. Properties defined on args.state will be retained - across frames. If you attempt to access a property that doesn't exist - on args.state, it will simply return nil (no exception will be thrown). - - In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller. - The parameters of a button are: - 1. the position (x, y) - 2. the input key held on the controller - 3. the text or name of the button - - =end - - # This sample app provides a visual demonstration of a standard controller, including - # the placement and function of all buttons. + return if _.state.game_over # return if game is over - class ControllerDemo - attr_accessor :inputs, :state, :outputs + _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label - # Calls the methods necessary for the app to run successfully. - def tick - process_inputs - render + # Shows all of the available notes that can be potential matches. + available_notes.each_with_index do |note, i| + _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border) + _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border + _.outputs.borders << _.state.notes[i].border end - # Starts with an empty collection of buttons. - # Adds buttons that are on the controller to the collection. - def process_inputs - state.buttons = [] - - state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] - state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] + # Shows whether or not the user is correct by filling the screen with either red or green + _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid } + end - state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] - state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] + # Shows the score (number of times the user guesses wrong) onto the screen using labels. + def render_score _ + if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0] + else # otherwise, number of times the user has guessed wrong is shown + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation + end + end - state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] - state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] + # Sets the target note for the level and performs calculations on click_feedbacks. + def calc _ + _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note + _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely + # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection + _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 } + end - state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] - state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] - state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] - state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] + # Uses input from the user to play the target note, as well as the other notes that could be a potential match. + def input_mouse _ + return unless _.inputs.mouse.click # return unless the mouse is clicked - state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] - state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] - state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] - state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] + # finds button that was clicked by user + button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements + _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of + end.reject {|b| !_.state.meta(b)}.first # reject, return first element - state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, - 100 + inputs.controller_one.left_analog_y_perc * 100, - inputs.controller_one.key_held.l3, - "L3"] + return unless button_clicked # return unless button_clicked as a value (a button was clicked) - state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, - 100 + inputs.controller_one.right_analog_y_perc * 100, - inputs.controller_one.key_held.r3, - "R3"] - end + queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked + button_clicked.x, + button_clicked.y, + button_clicked.w, + button_clicked.h, + 150, 100, 200 # sets color of button to shade of purple - # Gives each button a square shape. - # If the button is being pressed or held (which means it is considered active), - # the square is filled in. Otherwise, the button simply has a border. - def render - state.buttons.each do |x, y, active, text| - rect = [x, y, 75, 75] + if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed + _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output + elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed + _.state.target_note = nil # no target note + _.state.current_level = 1 # starts at level 1 again + _.state.times_wrong = 0 # starts off with 0 wrong guesses + _.state.game_over = false # the game is not over (because it has just been restarted) + else # otherwise if neither of those buttons were pressed + _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played + if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note + _.state.target_note = nil # target note is emptied - if active # if button is pressed - outputs.solids << rect # rect is output as solid (filled in) - else - outputs.borders << rect # otherwise, output as border + if _.state.current_level < 9 # if game hasn't reached level 9 + _.state.current_level += 1 # game goes to next level + else # otherwise, if game has reached level 9 + _.state.game_over = true # the game is over end - # Outputs the text of each button using labels. - outputs.labels << [x, y + 95, text] # add 95 to place label above button + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly + else # otherwise, if clicked note is not target note + _.state.times_wrong += 1 # increments times user guessed wrong + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong end - - outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] - outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] - outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] - outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] end end - $controller_demo = ControllerDemo.new + # Creates a collection of all of the available notes as symbols + def available_notes + [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4] + end - def tick args - tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller." - $controller_demo.inputs = args.inputs - $controller_demo.state = args.state - $controller_demo.outputs = args.outputs - $controller_demo.tick + # Creates buttons for each note, and sets a label (the note's name) and border for each note's button. + def piano_button _, note, position + _.state.new_entity(:button) do |b| # declares button as new entity + b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition + b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border + end end - # Resets the app. - def r - $gtk.reset + # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong + # If a button is clicked, the inside of button is purple (see input_mouse method) + # If correct note is clicked, screen turns green + # If incorrect note is clicked, screen turns red (again, see input_mouse method) + def queue_click_feedback _, x, y, w, h, *color + _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity + c.solid = [x, y, w, h, *color, 255] # sets color + end end def tick_instructions args, text, y = 715 @@ -3335,126 +3395,166 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb +* Input Basics - Keyboard - main.rb #+begin_src ruby + # ./samples/02_input_basics/01_keyboard/app/main.rb =begin - Reminders: - - - 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. - - In this sample app, we're using string interpolation to iterate through images in the - sprites folder using their image path names. + APIs listing that haven't been encountered in a previous sample apps: - - args.outputs.sprites: An array. Values in this array generate sprites on the screen. - The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] - For more information about sprites, go to mygame/documentation/05-sprites.md. + - args.inputs.keyboard.key_up.KEY: The value of the properties will be set + to the frame that the key_up event occurred (the frame correlates + to args.state.tick_count). Otherwise the value will be nil. For a + full listing of keys, take a look at mygame/documentation/06-keyboard.md. + - args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). - - args.outputs.labels: An array. Values in the array generate labels on the screen. - 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. + =end - - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. - Stores the frame that key was pressed on. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + # Along with outputs, inputs are also an essential part of video game development + # DragonRuby can take input from keyboards, mouse, and controllers. + # This sample app will cover keyboard input. - =end + # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed + # This will work with the other keys as well - # This sample app demonstrates how sprite animations work. - # There are two sprites that animate forever and one sprite - # that *only* animates when you press the "f" key on the keyboard. - # This is the entry point to your game. The `tick` method - # executes at 60 frames per second. There are two methods - # in this tick "entry point": `looping_animation`, and the - # second method is `one_time_animation`. def tick args - looping_animation args - one_time_animation args - end + tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 + # Notice how small_font accounts for all the remaining parameters + args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] + args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] + args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] - # This function shows how to animate a sprite that loops forever. - def looping_animation args - # Here we define a few local variables that will be sent - # into the magic function that gives us the correct sprite image - # over time. There are four things we need in order to figure - # out which sprite to show. - - # 1. When to start the animation. - start_looping_at = 0 - - # 2. The number of pngs that represent the full animation. - number_of_sprites = 6 - - # 3. How long to show each png. - number_of_frames_to_show_each_sprite = 4 + # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key + if args.inputs.keyboard.key_up.h + args.state.h_pressed_at = args.state.tick_count + end - # 4. Whether the animation should loop once, or forever. - does_sprite_loop = true + # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false + args.state.h_pressed_at ||= false - # With the variables defined above, we can get a number - # which represents the sprite to show by calling the `frame_index` function. - # In this case the number will be between 0, and 5 (you can see the sprites - # in the ./sprites directory). - sprite_index = start_looping_at.frame_index number_of_sprites, - number_of_frames_to_show_each_sprite, - does_sprite_loop + if args.state.h_pressed_at + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] + else + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] + end - # Now that we have `sprite_index, we can present the correct file. - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + tick_help_text args + end - # Try changing the numbers below to see how the animation changes: - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] + def small_font + # This method provides some values for the construction of labels + # Specifically, Size, Alignment, & RGBA + # This makes it so that custom parameters don't have to be repeatedly typed. + # Additionally "small_font" provides programmers with more information than some numbers + [-2, 0, 0, 0, 0, 255] end - # This function shows how to animate a sprite that executes - # only once when the "f" key is pressed. - def one_time_animation args - # This is just a label the shows instructions within the game. - args.outputs.labels << [220, 350, "(press f to animate)"] + def row_to_px args, row_number + # This takes a row_number and converts it to pixels DragonRuby understands. + # Row 0 starts 5 units below the top of the grid + # Each row afterward is 20 units lower + args.grid.top.shift_down(5).shift_down(20 * row_number) + end - # If "f" is pressed on the keyboard... - if args.inputs.keyboard.key_down.f - # Print the frame that "f" was pressed on. - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + # Don't worry about understanding the code within this method just yet. + # This method shows you the help text within the game. + def tick_help_text args + return unless args.state.h_pressed_at - # And MOST IMPORTANTLY set the point it time to start the animation, - # equal to "now" which is represented as args.state.tick_count. + args.state.key_value_history ||= {} + args.state.key_down_value_history ||= {} + args.state.key_held_value_history ||= {} + args.state.key_up_value_history ||= {} - # Also IMPORTANT, you'll notice that the value of when to start looping - # is stored in `args.state`. This construct's values are retained across - # executions of the `tick` method. - args.state.start_looping_at = args.state.tick_count + if (args.inputs.keyboard.key_down.truthy_keys.length > 0 || + args.inputs.keyboard.key_held.truthy_keys.length > 0 || + args.inputs.keyboard.key_up.truthy_keys.length > 0) + args.state.help_available = true + args.state.no_activity_debounce = nil + else + args.state.no_activity_debounce ||= 5.seconds + args.state.no_activity_debounce -= 1 + if args.state.no_activity_debounce <= 0 + args.state.help_available = false + args.state.key_value_history = {} + args.state.key_down_value_history = {} + args.state.key_held_value_history = {} + args.state.key_up_value_history = {} + end end - # These are the same local variables that were defined - # for the `looping_animation` function. - number_of_sprites = 6 - number_of_frames_to_show_each_sprite = 4 + args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] - # Except this sprite does not loop again. If the animation time has passed, - # then the frame_index function returns nil. - does_sprite_loop = false + if !args.state.help_available + args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] + return + end - sprite_index = args.state - .start_looping_at - .frame_index number_of_sprites, - number_of_frames_to_show_each_sprite, - does_sprite_loop + args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] + args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] + args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] + args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] - # This line sets the frame index to zero, if - # the animation duration has passed (frame_index returned nil). + fill_history args, :key_value_history, :down_or_held, nil + fill_history args, :key_down_value_history, :down, :key_down + fill_history args, :key_held_value_history, :held, :key_held + fill_history args, :key_up_value_history, :up, :key_up - # Remeber: we are not looping forever here. - sprite_index ||= 0 + render_help_labels args, :key_value_history, :down_or_held, nil, 10 + render_help_labels args, :key_down_value_history, :down, :key_down, 330 + render_help_labels args, :key_held_value_history, :held, :key_held, 650 + render_help_labels args, :key_up_value_history, :up, :key_up, 990 + end - # Present the sprite. - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + def fill_history args, history_key, state_key, keyboard_method + fill_single_history args, history_key, state_key, keyboard_method, :raw_key + fill_single_history args, history_key, state_key, keyboard_method, :char + args.inputs.keyboard.keys[state_key].each do |key_name| + fill_single_history args, history_key, state_key, keyboard_method, key_name + end + end - tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." + def fill_single_history args, history_key, state_key, keyboard_method, key_name + current_value = args.inputs.keyboard.send(key_name) + if keyboard_method + current_value = args.inputs.keyboard.send(keyboard_method).send(key_name) + end + args.state.as_hash[history_key][key_name] ||= [] + args.state.as_hash[history_key][key_name] << current_value + args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse + end + + def render_help_labels args, history_key, state_key, keyboard_method, x + idx = 8 + args.outputs.labels << args.state + .as_hash[history_key] + .keys + .reverse + .map + .with_index do |k, i| + v = args.state.as_hash[history_key][k] + current_value = args.inputs.keyboard.send(k) + if keyboard_method + current_value = args.inputs.keyboard.send(keyboard_method).send(k) + end + idx += 2 + [ + [x, row_to_px(args, idx - 2), + " .#{k} is #{current_value || "nil"}", + small_font], + [x, row_to_px(args, idx - 1), + " was #{v}", + small_font] + ] + end end + def tick_instructions args, text, y = 715 return if args.state.key_event_occurred if args.inputs.mouse.click || @@ -3471,623 +3571,412 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb +* Input Basics - Mouse - main.rb #+begin_src ruby - def tick args - args.state.player.x ||= 100 - args.state.player.y ||= 100 - args.state.player.w ||= 64 - args.state.player.h ||= 64 - args.state.player.direction ||= 1 + # ./samples/02_input_basics/02_mouse/app/main.rb + =begin - args.state.player.is_moving = false + APIs that haven't been encountered in a previous sample apps: - # get the keyboard input and set player properties - if args.inputs.keyboard.right - args.state.player.x += 3 - args.state.player.direction = 1 - args.state.player.started_running_at ||= args.state.tick_count - elsif args.inputs.keyboard.left - args.state.player.x -= 3 - args.state.player.direction = -1 - args.state.player.started_running_at ||= args.state.tick_count - end + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed + since the click event. - if args.inputs.keyboard.up - args.state.player.y += 1 - args.state.player.started_running_at ||= args.state.tick_count - elsif args.inputs.keyboard.down - args.state.player.y -= 1 - args.state.player.started_running_at ||= args.state.tick_count - end + Reminder: - # if no arrow keys are being pressed, set the player as not moving - if !args.inputs.keyboard.directional_vector - args.state.player.started_running_at = nil - end + - args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). - # wrap player around the stage - if args.state.player.x > 1280 - args.state.player.x = -64 - args.state.player.started_running_at ||= args.state.tick_count - elsif args.state.player.x < -64 - args.state.player.x = 1280 - args.state.player.started_running_at ||= args.state.tick_count - end + =end - if args.state.player.y > 720 - args.state.player.y = -64 - args.state.player.started_running_at ||= args.state.tick_count - elsif args.state.player.y < -64 - args.state.player.y = 720 - args.state.player.started_running_at ||= args.state.tick_count - end + # This code demonstrates DragonRuby mouse input - # render player as standing or running - if args.state.player.started_running_at - args.outputs.sprites << running_sprite(args) - else - args.outputs.sprites << standing_sprite(args) - end - args.outputs.labels << [30, 700, "Use arrow keys to move around."] - end + # To see if the a mouse click occurred + # Use args.inputs.mouse.click + # Which returns a boolean - def standing_sprite args - { - x: args.state.player.x, - y: args.state.player.y, - w: args.state.player.w, - h: args.state.player.h, - path: "sprites/horizontal-stand.png", - flip_horizontally: args.state.player.direction > 0 - } - end + # To see where a mouse click occurred + # Use args.inputs.mouse.click.point.x AND + # args.inputs.mouse.click.point.y - def running_sprite args - if !args.state.player.started_running_at - tile_index = 0 - else - how_many_frames_in_sprite_sheet = 6 - how_many_ticks_to_hold_each_frame = 3 - should_the_index_repeat = true - tile_index = args.state - .player - .started_running_at - .frame_index(how_many_frames_in_sprite_sheet, - how_many_ticks_to_hold_each_frame, - should_the_index_repeat) + # To see which frame the click occurred + # Use args.inputs.mouse.click.created_at + + # To see how many frames its been since the click occurred + # Use args.inputs.mouse.click.creat_at_elapsed + + # Saving the click in args.state can be quite useful + + def tick args + tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time." + x = 460 + + args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse") + + if args.inputs.mouse.click + args.state.last_mouse_click = args.inputs.mouse.click end - { - x: args.state.player.x, - y: args.state.player.y, - w: args.state.player.w, - h: args.state.player.h, - path: 'sprites/horizontal-run.png', - tile_x: 0 + (tile_index * args.state.player.w), - tile_y: 0, - tile_w: args.state.player.w, - tile_h: args.state.player.h, - flip_horizontally: args.state.player.direction > 0, - } + if args.state.last_mouse_click + click = args.state.last_mouse_click + args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}") + args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago") + args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}") + else + args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.") + args.outputs.labels << small_label(args, x, 13, "Please click mouse.") + end + end + + def small_label args, x, row, message + # This method effectively combines the row_to_px and small_font methods + # It changes the given row value to a DragonRuby pixel value + # and adds the customization parameters + [x, row_to_px(args, row), message, small_font] + end + + def small_font + [-2, 0, 0, 0, 0, 255] + end + + def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) + end + + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end #+end_src -* 03_rendering_sprites/03_animation_states/app/main.rb +* Input Basics - Mouse Point To Rect - main.rb #+begin_src ruby - class Game - attr_gtk + # ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb + =begin - def defaults - state.show_debug_layer = true if state.tick_count == 0 - player.tile_size = 64 - player.speed = 3 - player.slash_frames = 15 - player.x ||= 50 - player.y ||= 400 - player.dir_x ||= 1 - player.dir_y ||= -1 - player.is_moving ||= false - state.watch_list ||= {} - state.enemies ||= [] - end + APIs that haven't been encountered in a previous sample apps: - def add_enemy - state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } - end + - args.outputus.borders: An array. Values in this array will be rendered as + unfilled rectangles on the screen. + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. - def sprite_horizontal_run - tile_index = 0.frame_index(6, 3, true) - tile_index = 0 if !player.is_moving + ``` + # Point: x: 100, y: 100 + # Rect: x: 0, y: 0, w: 500, h: 500 + # Result: true - { - x: player.x, - y: player.y, - w: player.tile_size, - h: player.tile_size, - path: 'sprites/horizontal-run.png', - tile_x: 0 + (tile_index * player.tile_size), - tile_y: 0, - tile_w: player.tile_size, - tile_h: player.tile_size, - flip_horizontally: player.dir_x > 0, - # a: 40 - } - end + [100, 100].inside_rect? [0, 0, 500, 500] + ``` - def sprite_horizontal_stand - { - x: player.x, - y: player.y, - w: player.tile_size, - h: player.tile_size, - path: 'sprites/horizontal-stand.png', - flip_horizontally: player.dir_x > 0, - # a: 40 - } - end + ``` + # Point: x: 100, y: 100 + # Rect: x: 300, y: 300, w: 100, h: 100 + # Result: false - def sprite_horizontal_slash - tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 + [100, 100].inside_rect? [300, 300, 100, 100] + ``` - { - x: player.x - 41.25, - y: player.y - 41.25, - w: 165, - h: 165, - path: 'sprites/horizontal-slash.png', - tile_x: 0 + (tile_index * 128), - tile_y: 0, - tile_w: 128, - tile_h: 128, - flip_horizontally: player.dir_x > 0 - } - end + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed + since the click event. - def render_player - if player.slash_at - outputs.sprites << sprite_horizontal_slash - elsif player.is_moving - outputs.sprites << sprite_horizontal_run - else - outputs.sprites << sprite_horizontal_stand - end - end + =end - def render_enemies - outputs.borders << state.enemies - end + # To determine whether a point is in a rect + # Use point.inside_rect? rect - def render_debug_layer - return if !state.show_debug_layer - outputs.labels << state.watch_list.map.with_index do |(k, v), i| - [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] - end + # This is useful to determine if a click occurred in a rect - outputs.borders << player.slash_collision_rect - end + def tick args + tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." - def slash_initiate? - # buffalo usb controller has a button and b button swapped lol - inputs.controller_one.key_down.a || inputs.keyboard.key_down.j - end + x = 460 - def input - # player movement - if slash_complete? && (vector = inputs.directional_vector) - player.x += vector.x * player.speed - player.y += vector.y * player.speed - end - player.slash_at = slash_initiate? if slash_initiate? - end + args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") - def calc_movement - # movement - if vector = inputs.directional_vector - state.debug_label = vector - player.dir_x = vector.x - player.dir_y = vector.y - player.is_moving = true - else - state.debug_label = vector - player.is_moving = false - end + box = [785, 370, 50, 50, 0, 0, 170] + args.outputs.borders << box + + # Saves the most recent click into args.state + # Unlike the other components of args, + # args.state does not reset every tick. + if args.inputs.mouse.click + args.state.last_mouse_click = args.inputs.mouse.click end - def calc_slash - # re-calc the location of the swords collision box - if player.dir_x.positive? - player.slash_collision_rect = [player.x + player.tile_size, - player.y + player.tile_size.half - 10, - 40, 20] + if args.state.last_mouse_click + if args.state.last_mouse_click.point.inside_rect? box + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") else - player.slash_collision_rect = [player.x - 32 - 8, - player.y + player.tile_size.half - 10, - 40, 20] + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") end + else + args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") + end + end - # recalc sword's slash state - player.slash_at = nil if slash_complete? + def small_label args, x, row, message + [x, row_to_px(args, row), message, small_font] + end - # determine collision if the sword is at it's point of damaging - return unless slash_can_damage? + def small_font + [-2, 0, 0, 0, 0, 255] + end - state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } - end + def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) + end - def slash_complete? - !player.slash_at || player.slash_at.elapsed?(player.slash_frames) + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true end - def slash_can_damage? - # damage occurs half way into the slash animation - return false if slash_complete? - return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count - return true + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + +* Input Basics - Mouse Rect To Rect - main.rb +#+begin_src ruby + # ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb + =begin + + APIs that haven't been encountered in a previous sample apps: + + - args.outputs.borders: An array. Values in this array will be rendered as + unfilled rectangles on the screen. + - ARRAY#intersect_rect?: An array with at least four values is + considered a rect. The intersect_rect? function returns true + or false depending on if the two rectangles intersect. + + ``` + # Rect One: x: 100, y: 100, w: 100, h: 100 + # Rect Two: x: 0, y: 0, w: 500, h: 500 + # Result: true + + [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500] + ``` + + ``` + # Rect One: x: 100, y: 100, w: 10, h: 10 + # Rect Two: x: 500, y: 500, w: 10, h: 10 + # Result: false + + [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10] + ``` + + =end + + # Similarly, whether rects intersect can be found through + # rect1.intersect_rect? rect2 + + def tick args + tick_instructions args, "Sample app shows how to determine if two rectangles intersect." + x = 460 + + args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen") + # red_box = [460, 250, 355, 90, 170, 0, 0] + # args.outputs.borders << red_box + + # args.state.box_collision_one and args.state.box_collision_two + # Are given values of a solid when they should be rendered + # They are stored in game so that they do not get reset every tick + if args.inputs.mouse.click + if !args.state.box_collision_one + args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] + elsif !args.state.box_collision_two + args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] + else + args.state.box_collision_one = nil + args.state.box_collision_two = nil + end end - def calc - # generate an enemy if there aren't any on the screen - add_enemy if state.enemies.length == 0 - calc_movement - calc_slash + if args.state.box_collision_one + args.outputs.solids << args.state.box_collision_one end - # source is at http://github.com/amirrajan/dragonruby-link-to-the-past - def tick - defaults - render_enemies - render_player - outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] - outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] - render_debug_layer - input - calc + if args.state.box_collision_two + args.outputs.solids << args.state.box_collision_two end - def player - state.player + if args.state.box_collision_one && args.state.box_collision_two + if args.state.box_collision_one.intersect_rect? args.state.box_collision_two + args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.') + else + args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.') + end + else + args.outputs.labels << small_label(args, x, 4, '--') end end - $game = Game.new + def small_label args, x, row, message + [x, row_to_px(args, row), message, small_font] + end - def tick args - $game.args = args - $game.tick + def small_font + [-2, 0, 0, 0, 0, 255] end - $gtk.reset + def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) + end + + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end #+end_src -* 03_rendering_sprites/04_color_and_rotation/app/main.rb +* Input Basics - Controller - main.rb #+begin_src ruby + # ./samples/02_input_basics/05_controller/app/main.rb =begin + APIs listing that haven't been encountered in previous sample apps: - - merge: Returns a hash containing the contents of two original hashes. - Merge does not allow duplicate keys, so the value of a repeated key - will be overwritten. + - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key + is being held down on the controller. + If there is more than one controller being used, they can be differentiated by + using names like controller_one and controller_two. - For example, if we had two hashes - h1 = { "a" => 1, "b" => 2} - h2 = { "b" => 3, "c" => 3} - and we called the command - h1.merge(h2) - the result would the following hash - { "a" => 1, "b" => 3, "c" => 3}. + For a full listing of buttons, take a look at mygame/documentation/08-controllers.md. - Reminders: + Reminder: - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. - In this sample app, we're using a hash to create a sprite. + - args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt to access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). - - args.outputs.sprites: An array. The values generate a sprite. - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] - Before continuing with this sample app, it is HIGHLY recommended that you look - at mygame/documentation/05-sprites.md. + In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller. + The parameters of a button are: + 1. the position (x, y) + 2. the input key held on the controller + 3. the text or name of the button - - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + =end - - args.inputs.controller_one: Takes input from the controller based on what key is pressed. - For more information about the controller, go to mygame/documentation/08-controllers.md. + # This sample app provides a visual demonstration of a standard controller, including + # the placement and function of all buttons. - - num1.lesser(num2): Finds the lower value of the given options. + class ControllerDemo + attr_accessor :inputs, :state, :outputs - =end + # Calls the methods necessary for the app to run successfully. + def tick + process_inputs + render + end - # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, - # and also can be moved in different directions through keyboard input from the user. + # Starts with an empty collection of buttons. + # Adds buttons that are on the controller to the collection. + def process_inputs + state.buttons = [] - # Calls the methods necessary for the game to run successfully. - def tick args - default args - render args.grid, args.outputs, args.state - calc args.state - process_inputs args - end + state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] + state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] - # Sets default values for the car sprite - # Initialization ||= only happens in the first frame - def default args - args.state.sprite.width = 19 - args.state.sprite.height = 10 - args.state.sprite.scale = 4 - args.state.max_speed = 5 - args.state.x ||= 100 - args.state.y ||= 100 - args.state.speed ||= 1 - args.state.angle ||= 0 - end + state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] + state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] - # Outputs sprite onto screen - def render grid, outputs, state - outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background - outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite - 'sprites/86.png', # image path of car - state.angle, - opacity, # transparency - saturation, - source_rect(state), # sprite sub division/tile (tile x, y, w, h) - false, false, # don't flip sprites - rotation_anchor] + state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] + state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] - # also look at the create_sprite helper method - # - # For example: - # - # dest = destination_rect(state) - # source = source_rect(state), - # outputs.sprites << create_sprite( - # 'sprites/86.png', - # x: dest.x, - # y: dest.y, - # w: dest.w, - # h: dest.h, - # angle: state.angle, - # source_x: source.x, - # source_y: source.y, - # source_w: source.w, - # source_h: source.h, - # flip_h: false, - # flip_v: false, - # rotation_anchor_x: 0.7, - # rotation_anchor_y: 0.5 - # ) - end + state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] + state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] + state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] + state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] - # Creates sprite by setting values inside of a hash - def create_sprite path, options = {} - options = { + state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] + state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] + state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] + state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] - # dest x, y, w, h - x: 0, - y: 0, - w: 100, - h: 100, + state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, + 100 + inputs.controller_one.left_analog_y_perc * 100, + inputs.controller_one.key_held.l3, + "L3"] - # angle, rotation - angle: 0, - rotation_anchor_x: 0.5, - rotation_anchor_y: 0.5, - - # color saturation (red, green, blue), transparency - r: 255, - g: 255, - b: 255, - a: 255, - - # source x, y, width, height - source_x: 0, - source_y: 0, - source_w: -1, - source_h: -1, - - # flip horiztonally, flip vertically - flip_h: false, - flip_v: false, - - }.merge options - - [ - options[:x], options[:y], options[:w], options[:h], # dest rect keys - path, - options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha - options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys - options[:flip_h], options[:flip_v], # flip - options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor - ] # hash keys contain corresponding values - end - - # Calls the calc_pos and calc_wrap methods. - def calc state - calc_pos state - calc_wrap state - end - - # Changes sprite's position on screen - # Vectors have magnitude and direction, so the incremented x and y values give the car direction - def calc_pos state - state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed - state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed - state.speed *= 1.1 # scales speed up - state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) - end - - # The screen's dimensions are 1280x720. If the car goes out of scope, - # it loops back around on the screen. - def calc_wrap state - - # car returns to left side of screen if it disappears on right side of screen - # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger - state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 - - # car wraps around to right side of screen if it disappears on the left side - state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 - - # car wraps around to bottom of screen if it disappears at the top of the screen - # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) - state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope - - # car wraps around to top of screen if it disappears at the bottom of the screen - state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 - end - - # Changes angle of sprite based on user input from keyboard or controller - def process_inputs args - - # NOTE: increasing the angle doesn't mean that the car will continue to go - # in a specific direction. The angle is increasing, which means that if the - # left key was kept in the "down" state, the change in the angle would cause - # the car to go in a counter-clockwise direction and form a circle (360 degrees) - if args.inputs.keyboard.key_held.left # if left key is pressed - args.state.angle += 2 # car's angle is incremented by 2 - - # The same applies to decreasing the angle. If the right key was kept in the - # "down" state, the decreasing angle would cause the car to go in a clockwise - # direction and form a circle (360 degrees) - elsif args.inputs.keyboard.key_held.right # if right key is pressed - args.state.angle -= 2 # car's angle is decremented by 2 - - # Input from a controller can also change the angle of the car - elsif args.inputs.controller_one.left_analog_x_perc != 0 - args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 + state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, + 100 + inputs.controller_one.right_analog_y_perc * 100, + inputs.controller_one.key_held.r3, + "R3"] end - end - - # A sprite's center of rotation can be altered - # Increasing either of these numbers would dramatically increase the - # car's drift when it turns! - def rotation_anchor - [0.7, 0.5] - end - - # Sets opacity value of sprite to 255 so that it is not transparent at all - # Change it to 0 and you won't be able to see the car sprite on the screen - def opacity - 255 - end - - # Sets the color of the sprite to white. - def saturation - [255, 255, 255] - end - - # Sets definition of destination_rect (used to define the car sprite) - def destination_rect state - [state.x, state.y, - state.sprite.width * state.sprite.scale, # multiplies by 4 to set size - state.sprite.height * state.sprite.scale] - end - - # Portion of a sprite (a tile) - # Sub division of sprite is denoted as a rectangle directly related to original size of .png - # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) - def source_rect state - [0, 0, state.sprite.width, state.sprite.height] - end - -#+end_src - -* 04_physics_and_collisions/01_simple/app/main.rb -#+begin_src ruby - =begin - - Reminders: - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - - - args.outputs.solids: An array. The values generate a solid. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - - =end - - # This sample app shows collisions between two boxes. - # Runs methods needed for game to run properly. - def tick args - tick_instructions args, "Sample app shows how to move a square over time and determine collision." - defaults args - render args - calc args - end + # Gives each button a square shape. + # If the button is being pressed or held (which means it is considered active), + # the square is filled in. Otherwise, the button simply has a border. + def render + state.buttons.each do |x, y, active, text| + rect = [x, y, 75, 75] - # Sets default values. - def defaults args - # These values represent the moving box. - args.state.moving_box_speed = 10 - args.state.moving_box_size = 100 - args.state.moving_box_dx ||= 1 - args.state.moving_box_dy ||= 1 - args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height + if active # if button is pressed + outputs.solids << rect # rect is output as solid (filled in) + else + outputs.borders << rect # otherwise, output as border + end - # These values represent the center box. - args.state.center_box ||= [540, 260, 200, 200, 180] - args.state.center_box_collision ||= false # initially no collision - end + # Outputs the text of each button using labels. + outputs.labels << [x, y + 95, text] # add 95 to place label above button + end - def render args - # If the game state denotes that a collision has occured, - # render a solid square, otherwise render a border instead. - if args.state.center_box_collision - args.outputs.solids << args.state.center_box - else - args.outputs.borders << args.state.center_box + outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] + outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] + outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] + outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] end - - # Then render the moving box. - args.outputs.solids << args.state.moving_box - end - - # Generally in a pipeline for a game engine, you have rendering, - # game simulation (calculation), and input processing. - # This fuction represents the game simulation. - def calc args - position_moving_box args - determine_collision_center_box args end - # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed, - # and adding it to the current position. - # dx and dy are positive if the box is moving right and up, respectively - # dx and dy are negative if the box is moving left and down, respectively - def position_moving_box args - args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed - args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed - - # 1280x720 are the virtual pixels you work with (essentially 720p). - screen_width = 1280 - screen_height = 720 - - # Position of the box is denoted by the bottom left hand corner, in - # that case, we have to subtract the width of the box so that it stays - # in the scene (you can try deleting the subtraction to see how it - # impacts the box's movement). - if args.state.moving_box.x > screen_width - args.state.moving_box_size - args.state.moving_box_dx = -1 # moves left - elsif args.state.moving_box.x < 0 - args.state.moving_box_dx = 1 # moves right - end + $controller_demo = ControllerDemo.new - # Here, we're making sure the moving box remains within the vertical scope of the screen - if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high - args.state.moving_box_dy = -1 # moves down - elsif args.state.moving_box.y < 0 # if the box moves too low - args.state.moving_box_dy = 1 # moves up - end + def tick args + tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller." + $controller_demo.inputs = args.inputs + $controller_demo.state = args.state + $controller_demo.outputs = args.outputs + $controller_demo.tick end - def determine_collision_center_box args - # Collision is handled by the engine. You simply have to call the - # `intersect_rect?` function. - if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect - args.state.center_box_collision = true # then a collision happened - else - args.state.center_box_collision = false # otherwise, no collision happened - end + # Resets the app. + def r + $gtk.reset end def tick_instructions args, text, y = 715 @@ -4106,791 +3995,764 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 04_physics_and_collisions/02_moving_objects/app/main.rb +* Rendering Sprites - Animation Using Separate Pngs - main.rb #+begin_src ruby + # ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb =begin - APIs listing that haven't been encountered in previous sample apps: + Reminders: - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. + - 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. - For example, if we have a "numbers" hash that stores numbers in English as the - key and numbers in Spanish as the value, we'd have a hash that looks like this... - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } - and on it goes. + In this sample app, we're using string interpolation to iterate through images in the + sprites folder using their image path names. - Now if we wanted to find the corresponding value of the "one" key, we could say - puts numbers["one"] - which would print "uno" to the console. + - args.outputs.sprites: An array. Values in this array generate sprites on the screen. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. - - num1.greater(num2): Returns the greater value. - For example, if we have the command - puts 4.greater(3) - the number 4 would be printed to the console since it has a greater value than 3. - Similar to lesser, which returns the lesser value. - - - num1.lesser(num2): Finds the lower value of the given options. - For example, in the statement - a = 4.lesser(3) - 3 has a lower value than 4, which means that the value of a would be set to 3, - but if the statement had been - a = 4.lesser(5) - 4 has a lower value than 5, which means that the value of a would be set to 4. + - args.outputs.labels: An array. Values in the array generate labels on the screen. + 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. - - reject: Removes elements from a collection if they meet certain requirements. - For example, you can derive an array of odd numbers from an original array of - numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). + - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. + Stores the frame that key was pressed on. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - - find_all: Finds all values that satisfy specific requirements. - For example, you can find all elements of a collection that are divisible by 2 - or find all objects that have intersected with another object. + =end - - abs: Returns the absolute value. - For example, the command - (-30).abs - would return 30 as a result. + # This sample app demonstrates how sprite animations work. + # There are two sprites that animate forever and one sprite + # that *only* animates when you press the "f" key on the keyboard. - - map: Ruby method used to transform data; used in arrays, hashes, and collections. - Can be used to perform an action on every element of a collection, such as multiplying - each element by 2 or declaring every element as a new entity. + # This is the entry point to your game. The `tick` method + # executes at 60 frames per second. There are two methods + # in this tick "entry point": `looping_animation`, and the + # second method is `one_time_animation`. + def tick args + looping_animation args + one_time_animation args + end - Reminders: + # This function shows how to animate a sprite that loops forever. + def looping_animation args + # Here we define a few local variables that will be sent + # into the magic function that gives us the correct sprite image + # over time. There are four things we need in order to figure + # out which sprite to show. - - args.inputs.keyboard.KEY: Determines if a key has been pressed. - For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md. + # 1. When to start the animation. + start_looping_at = 0 - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + # 2. The number of pngs that represent the full animation. + number_of_sprites = 6 - - 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. + # 3. How long to show each png. + number_of_frames_to_show_each_sprite = 4 - =end + # 4. Whether the animation should loop once, or forever. + does_sprite_loop = true - # Calls methods needed for game to run properly - def tick args - tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." - defaults args - render args - calc args - input args - end + # With the variables defined above, we can get a number + # which represents the sprite to show by calling the `frame_index` function. + # In this case the number will be between 0, and 5 (you can see the sprites + # in the ./sprites directory). + sprite_index = start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop - # sets default values and creates empty collections - # initialization only happens in the first frame - def defaults args - fiddle args - args.state.enemy.hammers ||= [] - args.state.enemy.hammer_queue ||= [] - args.state.tick_count = args.state.tick_count - args.state.bridge_top = 128 - args.state.player.x ||= 0 # initializes player's properties - args.state.player.y ||= args.state.bridge_top - args.state.player.w ||= 64 - args.state.player.h ||= 64 - args.state.player.dy ||= 0 - args.state.player.dx ||= 0 - args.state.enemy.x ||= 800 # initializes enemy's properties - args.state.enemy.y ||= 0 - args.state.enemy.w ||= 128 - args.state.enemy.h ||= 128 - args.state.enemy.dy ||= 0 - args.state.enemy.dx ||= 0 - args.state.game_over_at ||= 0 - end + # Now that we have `sprite_index, we can present the correct file. + args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] - # sets enemy, player, hammer values - def fiddle args - args.state.gravity = -0.3 - args.state.enemy_jump_power = 10 # sets enemy values - args.state.enemy_jump_interval = 60 - args.state.hammer_throw_interval = 40 # sets hammer values - args.state.hammer_launch_power_default = 5 - args.state.hammer_launch_power_near = 2 - args.state.hammer_launch_power_far = 7 - args.state.hammer_upward_launch_power = 15 - args.state.max_hammers_per_volley = 10 - args.state.gap_between_hammers = 10 - args.state.player_jump_power = 10 # sets player values - args.state.player_jump_power_duration = 10 - args.state.player_max_run_speed = 10 - args.state.player_speed_slowdown_rate = 0.9 - args.state.player_acceleration = 1 - args.state.hammer_size = 32 + # Try changing the numbers below to see how the animation changes: + args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] end - # outputs objects onto the screen - def render args - args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge - # sets x by multiplying 64 to index to find pixel value (places all squares side by side) - # subtracts 64 from bridge_top because position is denoted by bottom left corner - [i * 64, args.state.bridge_top - 64, 64, 64] - end + # This function shows how to animate a sprite that executes + # only once when the "f" key is pressed. + def one_time_animation args + # This is just a label the shows instructions within the game. + args.outputs.labels << [220, 350, "(press f to animate)"] - args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0] - args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box) - args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box) - args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen - end + # If "f" is pressed on the keyboard... + if args.inputs.keyboard.key_down.f + # Print the frame that "f" was pressed on. + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" - # Performs calculations to move objects on the screen - def calc args + # And MOST IMPORTANTLY set the point it time to start the animation, + # equal to "now" which is represented as args.state.tick_count. - # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. - args.state.player.x += args.state.player.dx - args.state.player.y += args.state.player.dy + # Also IMPORTANT, you'll notice that the value of when to start looping + # is stored in `args.state`. This construct's values are retained across + # executions of the `tick` method. + args.state.start_looping_at = args.state.tick_count + end - # Since acceleration is the change in velocity, the change in y (dy) increases every frame - args.state.player.dy += args.state.gravity + # These are the same local variables that were defined + # for the `looping_animation` function. + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 - # player's y position is either current y position or y position of top of - # bridge, whichever has a greater value - # ensures that the player never goes below the bridge - args.state.player.y = args.state.player.y.greater(args.state.bridge_top) + # Except this sprite does not loop again. If the animation time has passed, + # then the frame_index function returns nil. + does_sprite_loop = false - # player's x position is either the current x position or 0, whichever has a greater value - # ensures that the player doesn't go too far left (out of the screen's scope) - args.state.player.x = args.state.player.x.greater(0) + sprite_index = args.state + .start_looping_at + .frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop - # player is not falling if it is located on the top of the bridge - args.state.player.falling = false if args.state.player.y == args.state.bridge_top - args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player + # This line sets the frame index to zero, if + # the animation duration has passed (frame_index returned nil). - args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx - args.state.enemy.y += args.state.enemy.dy # same with y and dy + # Remeber: we are not looping forever here. + sprite_index ||= 0 - # ensures that the enemy never goes below the bridge - args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) + # Present the sprite. + args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] - # ensures that the enemy never goes too far left (outside the screen's scope) - args.state.enemy.x = args.state.enemy.x.greater(0) + tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." + end - # objects that go up must come down because of gravity - args.state.enemy.dy += args.state.gravity + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end - args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + +* Rendering Sprites - Animation Using Sprite Sheet - main.rb +#+begin_src ruby + # ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb + def tick args + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.direction ||= 1 - #sets definition of enemy - args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w] + args.state.player.is_moving = false - if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge - args.state.enemy.dy = 0 # there is no change in y + # get the keyboard input and set player properties + if args.inputs.keyboard.right + args.state.player.x += 3 + args.state.player.direction = 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.left + args.state.player.x -= 3 + args.state.player.direction = -1 + args.state.player.started_running_at ||= args.state.tick_count end - # if 60 frames have passed and the enemy is not moving vertically - if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0 - args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up + if args.inputs.keyboard.up + args.state.player.y += 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.down + args.state.player.y -= 1 + args.state.player.started_running_at ||= args.state.tick_count end - # if 40 frames have passed or 5 frames have passed since the game ended - if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5 - # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded) - # that is why we're adding 1, to include the max possibility - volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations) + # if no arrow keys are being pressed, set the player as not moving + if !args.inputs.keyboard.directional_vector + args.state.player.started_running_at = nil + end - # if the horizontal distance between the player and enemy is less than 128 pixels - if (args.state.player.x - args.state.enemy.x).abs < 128 - # the change in x won't be that great since the enemy and player are closer to each other - volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1 - end + # wrap player around the stage + if args.state.player.x > 1280 + args.state.player.x = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.x < -64 + args.state.player.x = 1280 + args.state.player.started_running_at ||= args.state.tick_count + end - # if the horizontal distance between the player and enemy is greater than 300 pixels - if (args.state.player.x - args.state.enemy.x).abs > 300 - # change in x will be more drastic since player and enemy are so far apart - volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change - end + if args.state.player.y > 720 + args.state.player.y = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.y < -64 + args.state.player.y = 720 + args.state.player.started_running_at ||= args.state.tick_count + end - (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i| - args.state.enemy.hammer_queue << { # stores hammer values in a hash - x: args.state.enemy.x, - w: args.state.hammer_size, - h: args.state.hammer_size, - dx: volley_dx, # change in horizontal position - # multiplication operator takes precedence over addition operator - throw_at: args.state.tick_count + i * args.state.gap_between_hammers - } - end + # render player as standing or running + if args.state.player.started_running_at + args.outputs.sprites << running_sprite(args) + else + args.outputs.sprites << standing_sprite(args) end + args.outputs.labels << [30, 700, "Use arrow keys to move around."] + end - # add elements from hammer_queue collection to the hammers collection by - # finding all hammers that were thrown before the current frame (have already been thrown) - args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h| - h[:throw_at] < args.state.tick_count + def standing_sprite args + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: "sprites/horizontal-stand.png", + flip_horizontally: args.state.player.direction > 0 + } + end + + def running_sprite args + if !args.state.player.started_running_at + tile_index = 0 + else + how_many_frames_in_sprite_sheet = 6 + how_many_ticks_to_hold_each_frame = 3 + should_the_index_repeat = true + tile_index = args.state + .player + .started_running_at + .frame_index(how_many_frames_in_sprite_sheet, + how_many_ticks_to_hold_each_frame, + should_the_index_repeat) end - args.state.enemy.hammers.each do |h| # sets values for all hammers in collection - h[:y] ||= args.state.enemy.y + 130 - h[:dy] ||= args.state.hammer_upward_launch_power - h[:dy] += args.state.gravity # acceleration is change in gravity - h[:x] += h[:dx] # incremented by change in position - h[:y] += h[:dy] - h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * args.state.player.w), + tile_y: 0, + tile_w: args.state.player.w, + tile_h: args.state.player.h, + flip_horizontally: args.state.player.direction > 0, + } + end + +#+end_src + +* Rendering Sprites - Animation States - main.rb +#+begin_src ruby + # ./samples/03_rendering_sprites/03_animation_states/app/main.rb + class Game + attr_gtk + + def defaults + state.show_debug_layer = true if state.tick_count == 0 + player.tile_size = 64 + player.speed = 3 + player.slash_frames = 15 + player.x ||= 50 + player.y ||= 400 + player.dir_x ||= 1 + player.dir_y ||= -1 + player.is_moving ||= false + state.watch_list ||= {} + state.enemies ||= [] end - # reject hammers that have been thrown before current frame (have already been thrown) - args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h| - h[:throw_at] < args.state.tick_count + def add_enemy + state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } end - # any hammers with a y position less than 0 are rejected from the hammers collection - # since they have gone too far down (outside the scope's screen) - args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 } + def sprite_horizontal_run + tile_index = 0.frame_index(6, 3, true) + tile_index = 0 if !player.is_moving - # if there are any hammers that intersect with (or hit) the player, - # the reset_player method is called (so the game can start over) - if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) } - reset_player args + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * player.tile_size), + tile_y: 0, + tile_w: player.tile_size, + tile_h: player.tile_size, + flip_horizontally: player.dir_x > 0, + # a: 40 + } end - # if the enemy's rect intersects with (or hits) the player, - # the reset_player method is called (so the game can start over) - if args.state.enemy.rect.intersect_rect? args.state.player.rect - reset_player args + def sprite_horizontal_stand + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-stand.png', + flip_horizontally: player.dir_x > 0, + # a: 40 + } end - end - # Resets the player by changing its properties back to the values they had at initialization - def reset_player args - args.state.player.x = 0 - args.state.player.y = args.state.bridge_top - args.state.player.dy = 0 - args.state.player.dx = 0 - args.state.enemy.hammers.clear # empties hammer collection - args.state.enemy.hammer_queue.clear # empties hammer_queue - args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) - end + def sprite_horizontal_slash + tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 - # Processes input from the user to move the player - def input args - if args.inputs.keyboard.space # if the user presses the space bar - args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame + { + x: player.x - 41.25, + y: player.y - 41.25, + w: 165, + h: 165, + path: 'sprites/horizontal-slash.png', + tile_x: 0 + (tile_index * 128), + tile_y: 0, + tile_w: 128, + tile_h: 128, + flip_horizontally: player.dir_x > 0 + } + end - # if the time that has passed since the jump is less than the player's jump duration and - # the player is not falling - if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling - args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump + def render_player + if player.slash_at + outputs.sprites << sprite_horizontal_slash + elsif player.is_moving + outputs.sprites << sprite_horizontal_run + else + outputs.sprites << sprite_horizontal_stand end end - # if the space bar is in the "up" state (or not being pressed down) - if args.inputs.keyboard.key_up.space - args.state.player.jumped_at = nil # jumped_at is empty - args.state.player.falling = true # the player is falling + def render_enemies + outputs.borders << state.enemies end - if args.inputs.keyboard.left # if left key is pressed - args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left) - # dx is either set to current dx or the negative max run speed (which would be -10), - # whichever has a greater value - args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed) - elsif args.inputs.keyboard.right # if right key is pressed - args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right) - # dx is either set to current dx or max run speed (which would be 10), - # whichever has a lesser value - args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed) - else - args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down + def render_debug_layer + return if !state.show_debug_layer + outputs.labels << state.watch_list.map.with_index do |(k, v), i| + [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] + end + + outputs.borders << player.slash_collision_rect end - end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.space || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + def slash_initiate? + # buffalo usb controller has a button and b button swapped lol + inputs.controller_one.key_down.a || inputs.keyboard.key_down.j end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label - end - -#+end_src - -* 04_physics_and_collisions/03_entities/app/main.rb -#+begin_src ruby - =begin + def input + # player movement + if slash_complete? && (vector = inputs.directional_vector) + player.x += vector.x * player.speed + player.y += vector.y * player.speed + end + player.slash_at = slash_initiate? if slash_initiate? + end - Reminders: + def calc_movement + # movement + if vector = inputs.directional_vector + state.debug_label = vector + player.dir_x = vector.x + player.dir_y = vector.y + player.is_moving = true + else + state.debug_label = vector + player.is_moving = false + end + end - - map: Ruby method used to transform data; used in arrays, hashes, and collections. - Can be used to perform an action on every element of a collection, such as multiplying - each element by 2 or declaring every element as a new entity. - - - reject: Removes elements from a collection if they meet certain requirements. - For example, you can derive an array of odd numbers from an original array of - numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). - - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - In this sample app, new_entity is used to define the properties of enemies and bullets. - (Remember, you can use state to define ANY property and it will be retained across frames.) - - - args.outputs.labels: An array. The values generate a label on the screen. - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - - =end - - # This sample app shows enemies that contain an id value and the time they were created. - # These enemies can be removed by shooting at them with bullets. + def calc_slash + # re-calc the location of the swords collision box + if player.dir_x.positive? + player.slash_collision_rect = [player.x + player.tile_size, + player.y + player.tile_size.half - 10, + 40, 20] + else + player.slash_collision_rect = [player.x - 32 - 8, + player.y + player.tile_size.half - 10, + 40, 20] + end - # Calls all methods necessary for the game to function properly. - def tick args - tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet." - defaults args - render args - calc args - process_inputs args - end + # recalc sword's slash state + player.slash_at = nil if slash_complete? - # Sets default values - # Enemies and bullets start off as empty collections - def defaults args - args.state.enemies ||= [] - args.state.bullets ||= [] - end + # determine collision if the sword is at it's point of damaging + return unless slash_can_damage? - # Provides each enemy in enemies collection with rectangular border, - # as well as a label showing id and when they were created - def render args - # When you're calling a method that takes no arguments, you can use this & syntax on map. - # Numbers are being added to x and y in order to keep the text within the enemy's borders. - args.outputs.borders << args.state.enemies.map(&:rect) - args.outputs.labels << args.state.enemies.flat_map do |enemy| - [ - [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0], - [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created - ] + state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } end - # Outputs bullets in bullets collection as rectangular solids - args.outputs.solids << args.state.bullets.map(&:rect) - end - - # Calls all methods necessary for performing calculations - def calc args - add_new_enemies_if_needed args - move_bullets args - calculate_collisions args - remove_bullets_of_screen args - end - - # Adds enemies to the enemies collection and sets their values - def add_new_enemies_if_needed args - return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added - return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added - - args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total - args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity - e.x = 640 + 500 * rand # each enemy is given random position on screen - e.y = 600 * rand + 50 - e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect - end + def slash_complete? + !player.slash_at || player.slash_at.elapsed?(player.slash_frames) end - end - - # Moves bullets across screen - # Sets definition of the bullets - def move_bullets args - args.state.bullets.each do |bullet| # perform action on each bullet in collection - bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen) - # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out - # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to - # see what happens to the bullet's movement. - bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign) - bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect + def slash_can_damage? + # damage occurs half way into the slash animation + return false if slash_complete? + return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count + return true end - end - # Determines if a bullet hits an enemy - def calculate_collisions args - args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections - args.state.enemies.each do |enemy| - # if bullet has not exploded yet and the bullet hits an enemy - if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect) - bullet.exploded = true # bullet explodes - enemy.dead = true # enemy is killed - end - end + def calc + # generate an enemy if there aren't any on the screen + add_enemy if state.enemies.length == 0 + calc_movement + calc_slash end - # All exploded bullets are rejected or removed from the bullets collection - # and any dead enemy is rejected from the enemies collection. - args.state.bullets = args.state.bullets.reject(&:exploded) - args.state.enemies = args.state.enemies.reject(&:dead) - end - - # Bullets are rejected from bullets collection once their position exceeds the width of screen - def remove_bullets_of_screen args - args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280 - end - - # Calls fire_bullet method - def process_inputs args - fire_bullet args - end + # source is at http://github.com/amirrajan/dragonruby-link-to-the-past + def tick + defaults + render_enemies + render_player + outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] + outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] + render_debug_layer + input + calc + end - # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection - def fire_bullet args - return unless args.inputs.mouse.click # return unless mouse is clicked - args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity - bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked - bullet.x = 0 # starts on the left side of the screen - bullet.size = 10 - bullet.speed = 10 * rand + 2 # speed of a bullet is randomized - bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set + def player + state.player end end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.space || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end + $game = Game.new - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + def tick args + $game.args = args + $game.tick end + + $gtk.reset #+end_src -* 04_physics_and_collisions/04_box_collision/app/main.rb +* Rendering Sprites - Color And Rotation - main.rb #+begin_src ruby + # ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb =begin - APIs listing that haven't been encountered in previous sample apps: - - first: Returns the first element of the array. - For example, if we have an array - numbers = [1, 2, 3, 4, 5] - and we call first by saying - numbers.first - the number 1 will be returned because it is the first element of the numbers array. + - merge: Returns a hash containing the contents of two original hashes. + Merge does not allow duplicate keys, so the value of a repeated key + will be overwritten. - - num1.idiv(num2): Divides two numbers and returns an integer. - For example, - 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer. - 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal. + For example, if we had two hashes + h1 = { "a" => 1, "b" => 2} + h2 = { "b" => 3, "c" => 3} + and we called the command + h1.merge(h2) + the result would the following hash + { "a" => 1, "b" => 3, "c" => 3}. Reminders: - - find_all: Finds all values that satisfy specific requirements. - - - ARRAY#intersect_rect?: An array with at least four values is - considered a rect. The intersect_rect? function returns true - or false depending on if the two rectangles intersect. + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + In this sample app, we're using a hash to create a sprite. - - reject: Removes elements from a collection if they meet certain requirements. + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + Before continuing with this sample app, it is HIGHLY recommended that you look + at mygame/documentation/05-sprites.md. - =end + - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - # This sample app allows users to create tiles and place them anywhere on the screen as obstacles. - # The player can then move and maneuver around them. + - args.inputs.controller_one: Takes input from the controller based on what key is pressed. + For more information about the controller, go to mygame/documentation/08-controllers.md. - class PoorManPlatformerPhysics - attr_accessor :grid, :inputs, :state, :outputs + - num1.lesser(num2): Finds the lower value of the given options. - # Calls all methods necessary for the app to run successfully. - def tick - defaults - render - calc - process_inputs - end + =end - # Sets default values for variables. - # The ||= sign means that the variable will only be set to the value following the = sign if the value has - # not already been set before. Intialization happens only in the first frame. - def defaults - state.tile_size = 64 - state.gravity = -0.2 - state.previous_tile_size ||= state.tile_size - state.x ||= 0 - state.y ||= 800 - state.dy ||= 0 - state.dx ||= 0 - state.world ||= [] - state.world_lookup ||= {} - state.world_collision_rects ||= [] - end + # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, + # and also can be moved in different directions through keyboard input from the user. - # Outputs solids and borders of different colors for the world and collision_rects collections. - def render + # Calls the methods necessary for the game to run successfully. + def tick args + default args + render args.grid, args.outputs, args.state + calc args.state + process_inputs args + end - # Sets a black background on the screen (Comment this line out and the background will become white.) - # Also note that black is the default color for when no color is assigned. - outputs.solids << grid.rect - - # The position, size, and color (white) are set for borders given to the world collection. - # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters. - outputs.borders << state.world.map do |x, y| - [x * state.tile_size, - y * state.tile_size, - state.tile_size, - state.tile_size, 255, 255, 255] - end + # Sets default values for the car sprite + # Initialization ||= only happens in the first frame + def default args + args.state.sprite.width = 19 + args.state.sprite.height = 10 + args.state.sprite.scale = 4 + args.state.max_speed = 5 + args.state.x ||= 100 + args.state.y ||= 100 + args.state.speed ||= 1 + args.state.angle ||= 0 + end - # The top, bottom, and sides of the borders for collision_rects are different colors. - outputs.borders << state.world_collision_rects.map do |e| - [ - [e[:top], 0, 170, 0], # top is a shade of green - [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue - [e[:left_right], 170, 0, 0], # left and right are a shade of red - ] - end + # Outputs sprite onto screen + def render grid, outputs, state + outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background + outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite + 'sprites/86.png', # image path of car + state.angle, + opacity, # transparency + saturation, + source_rect(state), # sprite sub division/tile (tile x, y, w, h) + false, false, # don't flip sprites + rotation_anchor] - # Sets the position, size, and color (a shade of green) of the borders of only the player's - # box and outputs it. If you change the 180 to 0, the player's box will be black and you - # won't be able to see it (because it will match the black background). - outputs.borders << [state.x, - state.y, - state.tile_size, - state.tile_size, 0, 180, 0] - end + # also look at the create_sprite helper method + # + # For example: + # + # dest = destination_rect(state) + # source = source_rect(state), + # outputs.sprites << create_sprite( + # 'sprites/86.png', + # x: dest.x, + # y: dest.y, + # w: dest.w, + # h: dest.h, + # angle: state.angle, + # source_x: source.x, + # source_y: source.y, + # source_w: source.w, + # source_h: source.h, + # flip_h: false, + # flip_v: false, + # rotation_anchor_x: 0.7, + # rotation_anchor_y: 0.5 + # ) + end - # Calls methods needed to perform calculations. - def calc - calc_world_lookup - calc_player - end + # Creates sprite by setting values inside of a hash + def create_sprite path, options = {} + options = { - # Performs calculations on world_lookup and sets values. - def calc_world_lookup + # dest x, y, w, h + x: 0, + y: 0, + w: 100, + h: 100, - # If the tile size isn't equal to the previous tile size, - # the previous tile size is set to the tile size, - # and world_lookup hash is set to empty. - if state.tile_size != state.previous_tile_size - state.previous_tile_size = state.tile_size - state.world_lookup = {} # empty hash - end + # angle, rotation + angle: 0, + rotation_anchor_x: 0.5, + rotation_anchor_y: 0.5, - # return if the world_lookup hash has keys (or, in other words, is not empty) - # return unless the world collection has values inside of it (or is not empty) - return if state.world_lookup.keys.length > 0 - return unless state.world.length > 0 + # color saturation (red, green, blue), transparency + r: 255, + g: 255, + b: 255, + a: 255, - # Starts with an empty hash for world_lookup. - # Searches through the world and finds the coordinates that exist. - state.world_lookup = {} - state.world.each { |x, y| state.world_lookup[[x, y]] = true } + # source x, y, width, height + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, - # Assigns world_collision_rects for every sprite drawn. - state.world_collision_rects = - state.world_lookup - .keys - .map do |coord_x, coord_y| - s = state.tile_size - # multiply by tile size so the grid coordinates; sets pixel value - # don't forget that position is denoted by bottom left corner - # set x = coord_x or y = coord_y and see what happens! - x = s * coord_x - y = s * coord_y - { - # The values added to x, y, and s position the world_collision_rects so they all appear - # stacked (on top of world rects) but don't directly overlap. - # Remove these added values and mess around with the rect placement! - args: [coord_x, coord_y], - left_right: [x, y + 4, s, s - 6], # hash keys and values - top: [x + 4, y + 6, s - 8, s - 6], - bottom: [x + 1, y - 1, s - 2, s - 8], - } - end - end + # flip horiztonally, flip vertically + flip_h: false, + flip_v: false, - # Performs calculations to change the x and y values of the player's box. - def calc_player + }.merge options - # Since acceleration is the change in velocity, the change in y (dy) increases every frame. - # What goes up must come down because of gravity. - state.dy += state.gravity + [ + options[:x], options[:y], options[:w], options[:h], # dest rect keys + path, + options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha + options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys + options[:flip_h], options[:flip_v], # flip + options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor + ] # hash keys contain corresponding values + end - # Calls the calc_box_collision and calc_edge_collision methods. - calc_box_collision - calc_edge_collision + # Calls the calc_pos and calc_wrap methods. + def calc state + calc_pos state + calc_wrap state + end - # Since velocity is the change in position, the change in y increases by dy. Same with x and dx. - state.y += state.dy - state.x += state.dx + # Changes sprite's position on screen + # Vectors have magnitude and direction, so the incremented x and y values give the car direction + def calc_pos state + state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed + state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed + state.speed *= 1.1 # scales speed up + state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) + end - # Scales dx down. - state.dx *= 0.8 - end + # The screen's dimensions are 1280x720. If the car goes out of scope, + # it loops back around on the screen. + def calc_wrap state - # Calls methods needed to determine collisions between player and world_collision rects. - def calc_box_collision - return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key - collision_floor! - collision_left! - collision_right! - collision_ceiling! - end + # car returns to left side of screen if it disappears on right side of screen + # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger + state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 - # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. - def collision_floor! - return unless state.dy <= 0 # return unless player is going down or is as far down as possible - player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player + # car wraps around to right side of screen if it disappears on the left side + state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 - # Goes through world_collision_rects to find all intersections between the bottom of player's rect and - # the top of a world_collision_rect (hence the "-0.1" above) - floor_collisions = state.world_collision_rects - .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) } - .first + # car wraps around to bottom of screen if it disappears at the top of the screen + # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) + state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope - return unless floor_collisions # return unless collision occurred - state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect - state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked - end + # car wraps around to top of screen if it disappears at the bottom of the screen + state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 + end - # Finds collisions between the player's left side and the right side of a world_collision_rect. - def collision_left! - return unless state.dx < 0 # return unless player is moving left - player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size] + # Changes angle of sprite based on user input from keyboard or controller + def process_inputs args - # Goes through world_collision_rects to find all intersections beween the player's left side and the - # right side of a world_collision_rect. - left_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } - .first + # NOTE: increasing the angle doesn't mean that the car will continue to go + # in a specific direction. The angle is increasing, which means that if the + # left key was kept in the "down" state, the change in the angle would cause + # the car to go in a counter-clockwise direction and form a circle (360 degrees) + if args.inputs.keyboard.key_held.left # if left key is pressed + args.state.angle += 2 # car's angle is incremented by 2 - return unless left_side_collisions # return unless collision occurred + # The same applies to decreasing the angle. If the right key was kept in the + # "down" state, the decreasing angle would cause the car to go in a clockwise + # direction and form a circle (360 degrees) + elsif args.inputs.keyboard.key_held.right # if right key is pressed + args.state.angle -= 2 # car's angle is decremented by 2 - # player's x is set to the value of the x of the collided rect's right side - state.x = left_side_collisions[:left_right].right - state.dx = 0 # player isn't moving left because its path is blocked + # Input from a controller can also change the angle of the car + elsif args.inputs.controller_one.left_analog_x_perc != 0 + args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 end + end - # Finds collisions between the right side of the player and the left side of a world_collision_rect. - def collision_right! - return unless state.dx > 0 # return unless player is moving right - player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size] + # A sprite's center of rotation can be altered + # Increasing either of these numbers would dramatically increase the + # car's drift when it turns! + def rotation_anchor + [0.7, 0.5] + end - # Goes through world_collision_rects to find all intersections between the player's right side - # and the left side of a world_collision_rect (hence the "+0.1" above) - right_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } - .first - - return unless right_side_collisions # return unless collision occurred + # Sets opacity value of sprite to 255 so that it is not transparent at all + # Change it to 0 and you won't be able to see the car sprite on the screen + def opacity + 255 + end - # player's x is set to the value of the collided rect's left, minus the size of a rect - # tile size is subtracted because player's position is denoted by bottom left corner - state.x = right_side_collisions[:left_right].left - state.tile_size - state.dx = 0 # player isn't moving right because its path is blocked - end + # Sets the color of the sprite to white. + def saturation + [255, 255, 255] + end - # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. - def collision_ceiling! - return unless state.dy > 0 # return unless player is moving up - player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size] + # Sets definition of destination_rect (used to define the car sprite) + def destination_rect state + [state.x, state.y, + state.sprite.width * state.sprite.scale, # multiplies by 4 to set size + state.sprite.height * state.sprite.scale] + end - # Goes through world_collision_rects to find intersections between the bottom of a - # world_collision_rect and the top of the player's rect (hence the "+0.1" above) - ceil_collisions = state.world_collision_rects - .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) } - .first + # Portion of a sprite (a tile) + # Sub division of sprite is denoted as a rectangle directly related to original size of .png + # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) + def source_rect state + [0, 0, state.sprite.width, state.sprite.height] + end + +#+end_src + +* Physics And Collisions - Simple - main.rb +#+begin_src ruby + # ./samples/04_physics_and_collisions/01_simple/app/main.rb + =begin - return unless ceil_collisions # return unless collision occurred + Reminders: + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - # player's y is set to the bottom y of the rect it collided with, minus the size of a rect - state.y = ceil_collisions[:bottom].y - state.tile_size - state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked - end + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - # Makes sure the player remains within the screen's dimensions. - def calc_edge_collision + =end - #Ensures that the player doesn't fall below the map. - if state.y < 0 - state.y = 0 - state.dy = 0 + # This sample app shows collisions between two boxes. - #Ensures that the player doesn't go too high. - # Position of player is denoted by bottom left hand corner, which is why we have to subtract the - # size of the player's box (so it remains visible on the screen) - elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen - state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen - state.dy = 0 - end + # Runs methods needed for game to run properly. + def tick args + tick_instructions args, "Sample app shows how to move a square over time and determine collision." + defaults args + render args + calc args + end - # Ensures that the player remains in the horizontal range that it is supposed to. - if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right - state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen - state.dx = 0 - elsif state.x <= 0 && state.dx < 0 # if player moves too far left - state.x = 0 # player will remain as left as possible while remaining on screen - state.dx = 0 - end - end + # Sets default values. + def defaults args + # These values represent the moving box. + args.state.moving_box_speed = 10 + args.state.moving_box_size = 100 + args.state.moving_box_dx ||= 1 + args.state.moving_box_dy ||= 1 + args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height - # Processes input from the user on the keyboard. - def process_inputs - if inputs.mouse.down - state.world_lookup = {} - x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + # These values represent the center box. + args.state.center_box ||= [540, 260, 200, 200, 180] + args.state.center_box_collision ||= false # initially no collision + end - if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate - state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space - else - state.world << [x, y] # If no duplicates, adds to world collection - end - end + def render args + # If the game state denotes that a collision has occured, + # render a solid square, otherwise render a border instead. + if args.state.center_box_collision + args.outputs.solids << args.state.center_box + else + args.outputs.borders << args.state.center_box + end - # Sets dx to 0 if the player lets go of arrow keys. - if inputs.keyboard.key_up.right - state.dx = 0 - elsif inputs.keyboard.key_up.left - state.dx = 0 - end + # Then render the moving box. + args.outputs.solids << args.state.moving_box + end - # Sets dx to 3 in whatever direction the player chooses. - if inputs.keyboard.key_held.right # if right key is pressed - state.dx = 3 - elsif inputs.keyboard.key_held.left # if left key is pressed - state.dx = -3 - end + # Generally in a pipeline for a game engine, you have rendering, + # game simulation (calculation), and input processing. + # This fuction represents the game simulation. + def calc args + position_moving_box args + determine_collision_center_box args + end - #Sets dy to 5 to make the player ~fly~ when they press the space bar - if inputs.keyboard.key_held.space - state.dy = 5 - end - end + # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed, + # and adding it to the current position. + # dx and dy are positive if the box is moving right and up, respectively + # dx and dy are negative if the box is moving left and down, respectively + def position_moving_box args + args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed + args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed - def to_coord point + # 1280x720 are the virtual pixels you work with (essentially 720p). + screen_width = 1280 + screen_height = 720 - # Integer divides (idiv) point.x to turn into grid - # Then, you can just multiply each integer by state.tile_size later so the grid coordinates. - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + # Position of the box is denoted by the bottom left hand corner, in + # that case, we have to subtract the width of the box so that it stays + # in the scene (you can try deleting the subtraction to see how it + # impacts the box's movement). + if args.state.moving_box.x > screen_width - args.state.moving_box_size + args.state.moving_box_dx = -1 # moves left + elsif args.state.moving_box.x < 0 + args.state.moving_box_dx = 1 # moves right end - # Represents the tolerance for a collision between the player's rect and another rect. - def collision_tollerance - 0.0 + # Here, we're making sure the moving box remains within the vertical scope of the screen + if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high + args.state.moving_box_dy = -1 # moves down + elsif args.state.moving_box.y < 0 # if the box moves too low + args.state.moving_box_dy = 1 # moves up end end - $platformer_physics = PoorManPlatformerPhysics.new - - def tick args - $platformer_physics.grid = args.grid - $platformer_physics.inputs = args.inputs - $platformer_physics.state = args.state - $platformer_physics.outputs = args.outputs - $platformer_physics.tick - tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump." + def determine_collision_center_box args + # Collision is handled by the engine. You simply have to call the + # `intersect_rect?` function. + if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect + args.state.center_box_collision = true # then a collision happened + else + args.state.center_box_collision = false # otherwise, no collision happened + end end def tick_instructions args, text, y = 715 @@ -4909,913 +4771,794 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 04_physics_and_collisions/04_box_collision_2/app/main.rb +* Physics And Collisions - Moving Objects - main.rb #+begin_src ruby + # ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb =begin + APIs listing that haven't been encountered in previous sample apps: - - times: Performs an action a specific number of times. - For example, if we said - 5.times puts "Hello DragonRuby", - then we'd see the words "Hello DragonRuby" printed on the console 5 times. + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. - - split: Divides a string into substrings based on a delimiter. - For example, if we had a command - "DragonRuby is awesome".split(" ") - then the result would be - ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. - - join: Opposite of split; converts each element of array to a string separated by delimiter. - For example, if we had a command - ["DragonRuby","is","awesome"].join(" ") - then the result would be - "DragonRuby is awesome". + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. - Reminders: + - num1.greater(num2): Returns the greater value. + For example, if we have the command + puts 4.greater(3) + the number 4 would be printed to the console since it has a greater value than 3. + Similar to lesser, which returns the lesser value. - - to_s: Returns a string representation of an object. - For example, if we had - 500.to_s - the string "500" would be returned. - Similar to to_i, which returns an integer representation of an object. + - num1.lesser(num2): Finds the lower value of the given options. + For example, in the statement + a = 4.lesser(3) + 3 has a lower value than 4, which means that the value of a would be set to 3, + but if the statement had been + a = 4.lesser(5) + 4 has a lower value than 5, which means that the value of a would be set to 4. - - elapsed_time: How many frames have passed since the click event. + - reject: Removes elements from a collection if they meet certain requirements. + For example, you can derive an array of odd numbers from an original array of + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). - - args.outputs.labels: An array. Values in the array generate labels on the screen. - The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. + - find_all: Finds all values that satisfy specific requirements. + For example, you can find all elements of a collection that are divisible by 2 + or find all objects that have intersected with another object. - - inputs.mouse.down: Determines whether or not the mouse is being pressed down. - The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). + - abs: Returns the absolute value. + For example, the command + (-30).abs + would return 30 as a result. - - first: Returns the first element of the array. + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. - - num1.idiv(num2): Divides two numbers and returns an integer. + Reminders: - - find_all: Finds all values that satisfy specific requirements. + - args.inputs.keyboard.KEY: Determines if a key has been pressed. + For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md. - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. - - - reject: Removes elements from a collection if they meet certain requirements. + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - - 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.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. =end - MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map + # Calls methods needed for game to run properly + def tick args + tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." + defaults args + render args + calc args + input args + end - class MetroidvaniaStarter - attr_accessor :grid, :inputs, :state, :outputs, :gtk + # sets default values and creates empty collections + # initialization only happens in the first frame + def defaults args + fiddle args + args.state.enemy.hammers ||= [] + args.state.enemy.hammer_queue ||= [] + args.state.tick_count = args.state.tick_count + args.state.bridge_top = 128 + args.state.player.x ||= 0 # initializes player's properties + args.state.player.y ||= args.state.bridge_top + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.dy ||= 0 + args.state.player.dx ||= 0 + args.state.enemy.x ||= 800 # initializes enemy's properties + args.state.enemy.y ||= 0 + args.state.enemy.w ||= 128 + args.state.enemy.h ||= 128 + args.state.enemy.dy ||= 0 + args.state.enemy.dx ||= 0 + args.state.game_over_at ||= 0 + end - # Calls methods needed to run the game properly. - def tick - defaults - render - calc - process_inputs + # sets enemy, player, hammer values + def fiddle args + args.state.gravity = -0.3 + args.state.enemy_jump_power = 10 # sets enemy values + args.state.enemy_jump_interval = 60 + args.state.hammer_throw_interval = 40 # sets hammer values + args.state.hammer_launch_power_default = 5 + args.state.hammer_launch_power_near = 2 + args.state.hammer_launch_power_far = 7 + args.state.hammer_upward_launch_power = 15 + args.state.max_hammers_per_volley = 10 + args.state.gap_between_hammers = 10 + args.state.player_jump_power = 10 # sets player values + args.state.player_jump_power_duration = 10 + args.state.player_max_run_speed = 10 + args.state.player_speed_slowdown_rate = 0.9 + args.state.player_acceleration = 1 + args.state.hammer_size = 32 + end + + # outputs objects onto the screen + def render args + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge + # sets x by multiplying 64 to index to find pixel value (places all squares side by side) + # subtracts 64 from bridge_top because position is denoted by bottom left corner + [i * 64, args.state.bridge_top - 64, 64, 64] end - # Sets all the default variables. - # '||' states that initialization occurs only in the first frame. - def defaults - state.tile_size = 64 - state.gravity = -0.2 - state.player_width = 60 - state.player_height = 64 - state.collision_tolerance = 0.0 - state.previous_tile_size ||= state.tile_size - state.x ||= 0 - state.y ||= 800 - state.dy ||= 0 - state.dx ||= 0 - attempt_load_world_from_file - state.world_lookup ||= { } - state.world_collision_rects ||= [] - state.mode ||= :creating # alternates between :creating and :selecting for sprite selection - state.select_menu ||= [0, 720, 1280, 720] - #=======================================IMPORTANT=======================================# - # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. - # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. - #=======================================================================================# - state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES - state.sprite_coords ||= [] - state.banner_coords ||= [640, 680 + 720] - state.sprite_selected ||= 1 - state.map_saved_at ||= 0 + args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0] + args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box) + args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box) + args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen + end - # Sets all the cordinate values for the sprite selection screen into a grid - # Displayed when 's' is pressed by player to access sprites - if state.sprite_coords == [] # if sprite_coords is an empty array - count = 1 - temp_x = 165 # sets a starting x and y position for display - temp_y = 500 + 720 - state.sprite_quantity.times do # for the number of sprites you have - state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array - temp_x += 100 # increment temp_x - count += 1 # increment count - if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen - temp_x = 165 # a new row of sprites starts - temp_y -= 75 # new row of sprites starts 75 units lower than the previous row - end - end - end - end + # Performs calculations to move objects on the screen + def calc args - # Places sprites - def render + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. + args.state.player.x += args.state.player.dx + args.state.player.y += args.state.player.dy - # Sets the x, y, width, height, and image path for each sprite in the world collection. - outputs.sprites << state.world.map do |x, y, sprite| - [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location - y * state.tile_size, - state.tile_size, - state.tile_size, - 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path - end + # Since acceleration is the change in velocity, the change in y (dy) increases every frame + args.state.player.dy += args.state.gravity - # Outputs sprite for the player by setting x, y, width, height, and image path - outputs.sprites << [state.x, - state.y, - state.player_width, - state.player_height,'sprites/player.png'] + # player's y position is either current y position or y position of top of + # bridge, whichever has a greater value + # ensures that the player never goes below the bridge + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) - # Outputs labels as primitives in top right of the screen - outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label - outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label + # player's x position is either the current x position or 0, whichever has a greater value + # ensures that the player doesn't go too far left (out of the screen's scope) + args.state.player.x = args.state.player.x.greater(0) - outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label - outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label + # player is not falling if it is located on the top of the bridge + args.state.player.falling = false if args.state.player.y == args.state.bridge_top + args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player - outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label + args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx + args.state.enemy.y += args.state.enemy.dy # same with y and dy - # if the map is saved and less than 120 frames have passed, the label is displayed - if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 - outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label - end + # ensures that the enemy never goes below the bridge + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) - # If player hits 's', following appears - if state.mode == :selecting - # White background for sprite selection - outputs.primitives << [state.select_menu, 255, 255, 255].solid + # ensures that the enemy never goes too far left (outside the screen's scope) + args.state.enemy.x = args.state.enemy.x.greater(0) - # Select tile label at the top of the screen - outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label + # objects that go up must come down because of gravity + args.state.enemy.dy += args.state.gravity - # Places sprites in locations calculated in the defaults function - outputs.primitives << state.sprite_coords.map do |x, y, order| - [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite - end - end + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) - # Creates sprite following mouse to help indicate which sprite you have selected - # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon - outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, - 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite - end + #sets definition of enemy + args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w] - # Calls methods that perform calculations - def calc - calc_in_game - calc_sprite_selection + if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge + args.state.enemy.dy = 0 # there is no change in y end - # Calls methods that perform calculations (if in creating mode) - def calc_in_game - return unless state.mode == :creating - calc_world_lookup - calc_player + # if 60 frames have passed and the enemy is not moving vertically + if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0 + args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up end - def calc_world_lookup - # If the tile size isn't equal to the previous tile size, - # the previous tile size is set to the tile size, - # and world_lookup hash is set to empty. - if state.tile_size != state.previous_tile_size - state.previous_tile_size = state.tile_size - state.world_lookup = {} + # if 40 frames have passed or 5 frames have passed since the game ended + if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5 + # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded) + # that is why we're adding 1, to include the max possibility + volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations) + + # if the horizontal distance between the player and enemy is less than 128 pixels + if (args.state.player.x - args.state.enemy.x).abs < 128 + # the change in x won't be that great since the enemy and player are closer to each other + volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1 end - # return if world_lookup is not empty or if world is empty - return if state.world_lookup.keys.length > 0 - return unless state.world.length > 0 + # if the horizontal distance between the player and enemy is greater than 300 pixels + if (args.state.player.x - args.state.enemy.x).abs > 300 + # change in x will be more drastic since player and enemy are so far apart + volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change + end - # Searches through the world and finds the coordinates that exist - state.world_lookup = {} - state.world.each { |x, y| state.world_lookup[[x, y]] = true } + (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i| + args.state.enemy.hammer_queue << { # stores hammer values in a hash + x: args.state.enemy.x, + w: args.state.hammer_size, + h: args.state.hammer_size, + dx: volley_dx, # change in horizontal position + # multiplication operator takes precedence over addition operator + throw_at: args.state.tick_count + i * args.state.gap_between_hammers + } + end + end - # Assigns collision rects for every sprite drawn - state.world_collision_rects = - state.world_lookup - .keys - .map do |coord_x, coord_y| - s = state.tile_size - # Multiplying by s (the size of a tile) ensures that the rect is - # placed exactly where you want it to be placed (causes grid to coordinate) - # How many pixels horizontally across and vertically up and down - x = s * coord_x - y = s * coord_y - { - args: [coord_x, coord_y], - left_right: [x, y + 4, s, s - 6], # hash keys and values - top: [x + 4, y + 6, s - 8, s - 6], - bottom: [x + 1, y - 1, s - 2, s - 8], - } - end + # add elements from hammer_queue collection to the hammers collection by + # finding all hammers that were thrown before the current frame (have already been thrown) + args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h| + h[:throw_at] < args.state.tick_count end - # Calculates movement of player and calls methods that perform collision calculations - def calc_player - state.dy += state.gravity # what goes up must come down because of gravity - calc_box_collision - calc_edge_collision - state.y += state.dy # Since velocity is the change in position, the change in y increases by dy - state.x += state.dx # Ditto line above but dx and x - state.dx *= 0.8 # Scales dx down + args.state.enemy.hammers.each do |h| # sets values for all hammers in collection + h[:y] ||= args.state.enemy.y + 130 + h[:dy] ||= args.state.hammer_upward_launch_power + h[:dy] += args.state.gravity # acceleration is change in gravity + h[:x] += h[:dx] # incremented by change in position + h[:y] += h[:dy] + h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect end - # Calls methods that determine whether the player collides with any world_collision_rects. - def calc_box_collision - return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key - collision_floor - collision_left - collision_right - collision_ceiling + # reject hammers that have been thrown before current frame (have already been thrown) + args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h| + h[:throw_at] < args.state.tick_count end - # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. - def collision_floor - return unless state.dy <= 0 # return unless player is going down or is as far down as possible - player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player - - # Runs through all the sprites on the field and finds all intersections between player's - # bottom and the top of a rect. - floor_collisions = state.world_collision_rects - .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } - .first + # any hammers with a y position less than 0 are rejected from the hammers collection + # since they have gone too far down (outside the scope's screen) + args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 } - return unless floor_collisions # performs following changes if a collision has occurred - state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top - state.dy = 0 # no change in y because the player's path is blocked + # if there are any hammers that intersect with (or hit) the player, + # the reset_player method is called (so the game can start over) + if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) } + reset_player args end - # Finds collisions between the player's left side and the right side of a world_collision_rect. - def collision_left - return unless state.dx < 0 # return unless player is moving left - player_rect = [next_x, state.y, state.tile_size, state.tile_size] - - # Runs through all the sprites on the field and finds all intersections between the player's left side - # and the right side of a rect. - left_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless left_side_collisions # return unless collision occurred - state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side - state.dx = 0 # no change in x because the player's path is blocked + # if the enemy's rect intersects with (or hits) the player, + # the reset_player method is called (so the game can start over) + if args.state.enemy.rect.intersect_rect? args.state.player.rect + reset_player args end + end - # Finds collisions between the right side of the player and the left side of a world_collision_rect. - def collision_right - return unless state.dx > 0 # return unless player is moving right - player_rect = [next_x, state.y, state.tile_size, state.tile_size] + # Resets the player by changing its properties back to the values they had at initialization + def reset_player args + args.state.player.x = 0 + args.state.player.y = args.state.bridge_top + args.state.player.dy = 0 + args.state.player.dx = 0 + args.state.enemy.hammers.clear # empties hammer collection + args.state.enemy.hammer_queue.clear # empties hammer_queue + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) + end - # Runs through all the sprites on the field and finds all intersections between the player's - # right side and the left side of a rect. - right_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } - .first + # Processes input from the user to move the player + def input args + if args.inputs.keyboard.space # if the user presses the space bar + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame - return unless right_side_collisions # return unless collision occurred - state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) - state.dx = 0 # no change in x because the player's path is blocked + # if the time that has passed since the jump is less than the player's jump duration and + # the player is not falling + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump + end end - # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. - def collision_ceiling - return unless state.dy > 0 # return unless player is moving up - player_rect = [state.x, next_y, state.player_width, state.player_height] - - # Runs through all the sprites on the field and finds all intersections between the player's top - # and the bottom of a rect. - ceil_collisions = state.world_collision_rects - .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless ceil_collisions # return unless collision occurred - state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) - state.dy = 0 # no change in y because the player's path is blocked + # if the space bar is in the "up" state (or not being pressed down) + if args.inputs.keyboard.key_up.space + args.state.player.jumped_at = nil # jumped_at is empty + args.state.player.falling = true # the player is falling end - # Makes sure the player remains within the screen's dimensions. - def calc_edge_collision - # Ensures that player doesn't fall below the map - if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope - state.y = 0 # 0 is the lowest the player can be while staying on the screen - state.dy = 0 - # Ensures player doesn't go insanely high - elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope - state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen - state.dy = 0 - end + if args.inputs.keyboard.left # if left key is pressed + args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left) + # dx is either set to current dx or the negative max run speed (which would be -10), + # whichever has a greater value + args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed) + elsif args.inputs.keyboard.right # if right key is pressed + args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right) + # dx is either set to current dx or max run speed (which would be 10), + # whichever has a lesser value + args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed) + else + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down + end + end - # Ensures that player remains in the horizontal range its supposed to - if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right - state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope - state.dx = 0 - elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left - state.x = 0 # farthest left the player can be while remaining in the screen's scope - state.dx = 0 - end + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true end - def calc_sprite_selection - # Does the transition to bring down the select sprite screen - if state.mode == :selecting && state.select_menu.y != 0 - state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) - state.banner_coords.y = 680 # sets y position of Select Sprite banner - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| - [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) - end - end + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + +* Physics And Collisions - Entities - main.rb +#+begin_src ruby + # ./samples/04_physics_and_collisions/03_entities/app/main.rb + =begin - # Does the transition to leave the select sprite screen - if state.mode == :creating && state.select_menu.y != 720 - state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) - state.banner_coords.y = 1000 # sets y position of Select Sprite banner - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| - [x, y + 720, w, h] # sets definition of all elements in collection - end - end - end + Reminders: - def process_inputs - # If the state.mode is back and if the menu has retreated back up - # call methods that process user inputs - if state.mode == :creating - process_inputs_player_movement - process_inputs_place_tile - end + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. - # For each sprite_coordinate added, check what sprite was selected - if state.mode == :selecting - state.sprite_coords.map do |x, y, order| # goes through all sprites in collection - # checks that a specific sprite was pressed based on x, y position - if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true - inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and - inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right - inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y - inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up - state.sprite_selected = order # sprite is chosen - end - end - end + - reject: Removes elements from a collection if they meet certain requirements. + For example, you can derive an array of odd numbers from an original array of + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). - inputs_export_stage - process_inputs_show_available_sprites - end + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to define the properties of enemies and bullets. + (Remember, you can use state to define ANY property and it will be retained across frames.) - # Moves the player based on the keys they press on their keyboard - def process_inputs_player_movement - # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) - if inputs.keyboard.key_up.right - state.dx = 0 - elsif inputs.keyboard.key_up.left - state.dx = 0 - end + - args.outputs.labels: An array. The values generate a label on the screen. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys - if inputs.keyboard.key_held.right - state.dx = 3 - elsif inputs.keyboard.key_held.left - state.dx = -3 - end + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard - if inputs.keyboard.key_held.space - state.dy = 5 - end - end + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - # Adds tile in the place the user holds down the mouse - def process_inputs_place_tile - if inputs.mouse.down # if mouse is pressed - state.world_lookup = {} - x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + =end - # Checks if any coordinates duplicate (already exist in world) - if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } - #erases existing tile space by rejecting them from world - state.world = state.world.reject do |existing_x, existing_y, n| - existing_x == x && existing_y == y - end - else - state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite - end - end - end + # This sample app shows enemies that contain an id value and the time they were created. + # These enemies can be removed by shooting at them with bullets. - # Stores/exports world collection's info (coordinates, sprite number) into a file - def inputs_export_stage - if inputs.keyboard.key_down.e # if "e" is pressed - export_string = state.world.map do |x, y, sprite_number| # stores world info in a string - "#{x},#{y},#{sprite_number}" # using string interpolation - end - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file - state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved - end - end + # Calls all methods necessary for the game to function properly. + def tick args + tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet." + defaults args + render args + calc args + process_inputs args + end - def process_inputs_show_available_sprites - # Based on keyboard input, the entity (:creating and :selecting) switch - if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating - state.mode = :selecting # will change to selecting - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off - elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting - state.mode = :creating # will change to creating - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off - end + # Sets default values + # Enemies and bullets start off as empty collections + def defaults args + args.state.enemies ||= [] + args.state.bullets ||= [] + end + + # Provides each enemy in enemies collection with rectangular border, + # as well as a label showing id and when they were created + def render args + # When you're calling a method that takes no arguments, you can use this & syntax on map. + # Numbers are being added to x and y in order to keep the text within the enemy's borders. + args.outputs.borders << args.state.enemies.map(&:rect) + args.outputs.labels << args.state.enemies.flat_map do |enemy| + [ + [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0], + [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created + ] end - # Loads the world collection by reading from the map.txt file in the app folder - def attempt_load_world_from_file - return if state.world # return if the world collection is already populated - state.world ||= [] # initialized as an empty collection - exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code - return unless exported_world # return unless the file read was successful - state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world - l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, - # calling to_i (converts to integers) on each element + # Outputs bullets in bullets collection as rectangular solids + args.outputs.solids << args.state.bullets.map(&:rect) + end + + # Calls all methods necessary for performing calculations + def calc args + add_new_enemies_if_needed args + move_bullets args + calculate_collisions args + remove_bullets_of_screen args + end + + # Adds enemies to the enemies collection and sets their values + def add_new_enemies_if_needed args + return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added + return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added + + args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total + args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity + e.x = 640 + 500 * rand # each enemy is given random position on screen + e.y = 600 * rand + 50 + e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect end end + end - # Adds the change in y to y to determine the next y position of the player. - def next_y - state.y + state.dy + # Moves bullets across screen + # Sets definition of the bullets + def move_bullets args + args.state.bullets.each do |bullet| # perform action on each bullet in collection + bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen) + + # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out + # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to + # see what happens to the bullet's movement. + bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign) + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect end + end - # Determines next x position of player - def next_x - if state.dx < 0 # if the player moves left - return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) - else - return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) + # Determines if a bullet hits an enemy + def calculate_collisions args + args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections + args.state.enemies.each do |enemy| + # if bullet has not exploded yet and the bullet hits an enemy + if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect) + bullet.exploded = true # bullet explodes + enemy.dead = true # enemy is killed + end end end - def to_coord point - # Integer divides (idiv) point.x to turn into grid - # Then, you can just multiply each integer by state.tile_size - # later and huzzah. Grid coordinates - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + # All exploded bullets are rejected or removed from the bullets collection + # and any dead enemy is rejected from the enemies collection. + args.state.bullets = args.state.bullets.reject(&:exploded) + args.state.enemies = args.state.enemies.reject(&:dead) + end + + # Bullets are rejected from bullets collection once their position exceeds the width of screen + def remove_bullets_of_screen args + args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280 + end + + # Calls fire_bullet method + def process_inputs args + fire_bullet args + end + + # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection + def fire_bullet args + return unless args.inputs.mouse.click # return unless mouse is clicked + args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity + bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked + bullet.x = 0 # starts on the left side of the screen + bullet.size = 10 + bullet.speed = 10 * rand + 2 # speed of a bullet is randomized + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set end end - $metroidvania_starter = MetroidvaniaStarter.new + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end - def tick args - $metroidvania_starter.grid = args.grid - $metroidvania_starter.inputs = args.inputs - $metroidvania_starter.state = args.state - $metroidvania_starter.outputs = args.outputs - $metroidvania_starter.gtk = args.gtk - $metroidvania_starter.tick + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end #+end_src -* 04_physics_and_collisions/04_jump_physics/app/main.rb +* Physics And Collisions - Box Collision - main.rb #+begin_src ruby + # ./samples/04_physics_and_collisions/04_box_collision/app/main.rb =begin - Reminders: - - - 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.) + APIs listing that haven't been encountered in previous sample apps: - - args.outputs.solids: An array. The values generate a solid. - The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + - first: Returns the first element of the array. + For example, if we have an array + numbers = [1, 2, 3, 4, 5] + and we call first by saying + numbers.first + the number 1 will be returned because it is the first element of the numbers array. - - num1.greater(num2): Returns the greater value. + - num1.idiv(num2): Divides two numbers and returns an integer. + For example, + 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer. + 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal. - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. + Reminders: - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + - find_all: Finds all values that satisfy specific requirements. - =end + - ARRAY#intersect_rect?: An array with at least four values is + considered a rect. The intersect_rect? function returns true + or false depending on if the two rectangles intersect. - # This sample app is a game that requires the user to jump from one platform to the next. - # As the player successfully clears platforms, they become smaller and move faster. + - reject: Removes elements from a collection if they meet certain requirements. - class VerticalPlatformer - attr_gtk + =end - # declares vertical platformer as new entity - def s - state.vertical_platformer ||= state.new_entity(:vertical_platformer) - state.vertical_platformer - end + # This sample app allows users to create tiles and place them anywhere on the screen as obstacles. + # The player can then move and maneuver around them. - # creates a new platform using a hash - def new_platform hash - s.new_entity_strict(:platform, hash) # platform key - end + class PoorManPlatformerPhysics + attr_accessor :grid, :inputs, :state, :outputs - # calls methods needed for game to run properly + # Calls all methods necessary for the app to run successfully. def tick defaults render calc - input + process_inputs end - # Sets default values + # Sets default values for variables. + # The ||= sign means that the variable will only be set to the value following the = sign if the value has + # not already been set before. Intialization happens only in the first frame. def defaults - s.platforms ||= [ # initializes platforms collection with two platforms using hashes - new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), - new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher - ] - - s.tick_count = args.state.tick_count - s.gravity = -0.3 # what goes up must come down because of gravity - s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared - s.player.x ||= 0 # sets player values - s.player.y ||= 100 - s.player.w ||= 64 - s.player.h ||= 64 - s.player.dy ||= 0 # change in position - s.player.dx ||= 0 - s.player_jump_power = 15 - s.player_jump_power_duration = 10 - s.player_max_run_speed = 5 - s.player_speed_slowdown_rate = 0.9 - s.player_acceleration = 1 - s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) + state.tile_size = 64 + state.gravity = -0.2 + state.previous_tile_size ||= state.tile_size + state.x ||= 0 + state.y ||= 800 + state.dy ||= 0 + state.dx ||= 0 + state.world ||= [] + state.world_lookup ||= {} + state.world_collision_rects ||= [] end - # Outputs objects onto the screen + # Outputs solids and borders of different colors for the world and collision_rects collections. def render - outputs.solids << s.platforms.map do |p| # outputs platforms onto screen - [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center - # don't forget, position of platform is denoted by bottom left hand corner - end - - # outputs player using hash - outputs.solids << { - x: s.player.x + 300, # player positioned on top of platform - y: s.player.y - s.camera[:y], - w: s.player.w, - h: s.player.h, - r: 100, # color saturation - g: 100, - b: 200 - } - end - - # Performs calculations - def calc - s.platforms.each do |p| # for each platform in the collection - p.rect = [p.x, p.y, p.w, p.h] # set the definition - end - - # sets player point by adding half the player's width to the player's x - s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! - # search the platforms collection to find if the player's point is inside the rect of a platform - collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } + # Sets a black background on the screen (Comment this line out and the background will become white.) + # Also note that black is the default color for when no color is assigned. + outputs.solids << grid.rect - # if collision occurred and player is moving down (or not moving vertically at all) - if collision && s.player.dy <= 0 - s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform - s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically - if !s.player.platform - s.player.dx = 0 # no horizontal movement - end - # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x - s.player.x += collision.dx * collision.speed - s.player.platform = collision # player is on the platform that it collided with (or landed on) - if s.player.falling # if player is falling - s.player.dx = 0 # no horizontal movement - end - s.player.falling = false - s.player.jumped_at = nil - else - s.player.platform = nil # player is not on a platform - s.player.y += s.player.dy # velocity is the change in position - s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down + # The position, size, and color (white) are set for borders given to the world collection. + # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters. + outputs.borders << state.world.map do |x, y| + [x * state.tile_size, + y * state.tile_size, + state.tile_size, + state.tile_size, 255, 255, 255] end - s.platforms.each do |p| # for each platform in the collection - p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) - # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) - if p.x < -300 # if platform goes too far left - p.dx *= -1 # dx is scaled down - p.x = -300 # as far left as possible within scope - elsif p.x > (1000 - p.w) # if platform's x is greater than 300 - p.dx *= -1 - p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) - end + # The top, bottom, and sides of the borders for collision_rects are different colors. + outputs.borders << state.world_collision_rects.map do |e| + [ + [e[:top], 0, 170, 0], # top is a shade of green + [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue + [e[:left_right], 170, 0, 0], # left and right are a shade of red + ] end - delta = (s.player.y - s.camera[:y] - 100) # used to position camera view - - if delta > -200 - s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards - s.player.x += s.player.dx # velocity is change in position; change in x increases by dx + # Sets the position, size, and color (a shade of green) of the borders of only the player's + # box and outputs it. If you change the 180 to 0, the player's box will be black and you + # won't be able to see it (because it will match the black background). + outputs.borders << [state.x, + state.y, + state.tile_size, + state.tile_size, 0, 180, 0] + end - # searches platform collection to find platforms located more than 300 pixels above the player - has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } - if !has_platforms # if there are no platforms 300 pixels above the player - width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous - s.player.platforms_cleared += 1 # player successfully cleared another platform - last_platform = s.platforms[-1] # platform just cleared becomes last platform - # another platform is created 300 pixels above the last platform, and this - # new platform has a smaller width and moves faster than all previous platforms - s.platforms << new_platform(x: (700 - width) * rand, # random x position - y: last_platform.y + 300, - w: width, - h: 32, - dx: 1.randomize(:sign), # random change in x - speed: 2 * s.player.platforms_cleared, - rect: nil) - end - else - s.as_hash.clear # otherwise clear the hash (no new platform is necessary) - end + # Calls methods needed to perform calculations. + def calc + calc_world_lookup + calc_player end - # Takes input from the user to move the player - def input - if inputs.keyboard.space # if the space bar is pressed - s.player.jumped_at ||= s.tick_count # set to current frame + # Performs calculations on world_lookup and sets values. + def calc_world_lookup - # if the time that has passed since the jump is less than the duration of a jump (10 frames) - # and the player is not falling - if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling - s.player.dy = s.player_jump_power # player jumps up - end + # If the tile size isn't equal to the previous tile size, + # the previous tile size is set to the tile size, + # and world_lookup hash is set to empty. + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} # empty hash end - if inputs.keyboard.key_up.space # if space bar is in "up" state - s.player.falling = true # player is falling - end + # return if the world_lookup hash has keys (or, in other words, is not empty) + # return unless the world collection has values inside of it (or is not empty) + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 - if inputs.keyboard.left # if left key is pressed - s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration - s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater - elsif inputs.keyboard.right # if right key is pressed - s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration - s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser - else - s.player.dx *= s.player_speed_slowdown_rate # scales dx down - end - end - end + # Starts with an empty hash for world_lookup. + # Searches through the world and finds the coordinates that exist. + state.world_lookup = {} + state.world.each { |x, y| state.world_lookup[[x, y]] = true } - $game = VerticalPlatformer.new + # Assigns world_collision_rects for every sprite drawn. + state.world_collision_rects = + state.world_lookup + .keys + .map do |coord_x, coord_y| + s = state.tile_size + # multiply by tile size so the grid coordinates; sets pixel value + # don't forget that position is denoted by bottom left corner + # set x = coord_x or y = coord_y and see what happens! + x = s * coord_x + y = s * coord_y + { + # The values added to x, y, and s position the world_collision_rects so they all appear + # stacked (on top of world rects) but don't directly overlap. + # Remove these added values and mess around with the rect placement! + args: [coord_x, coord_y], + left_right: [x, y + 4, s, s - 6], # hash keys and values + top: [x + 4, y + 6, s - 8, s - 6], + bottom: [x + 1, y - 1, s - 2, s - 8], + } + end + end - def tick args - $game.args = args - $game.tick - end - -#+end_src - -* 05_mouse/03_mouse_click/app/main.rb -#+begin_src ruby - =begin + # Performs calculations to change the x and y values of the player's box. + def calc_player - APIs listing that haven't been encountered in previous sample apps: + # Since acceleration is the change in velocity, the change in y (dy) increases every frame. + # What goes up must come down because of gravity. + state.dy += state.gravity - - product: Returns an array of all combinations of elements from all arrays. + # Calls the calc_box_collision and calc_edge_collision methods. + calc_box_collision + calc_edge_collision - For example, [1,2].product([1,2]) would return the following array... - [[1,1], [1,2], [2,1], [2,2]] - More than two arrays can be given to product and it will still work, - such as [1,2].product([1,2],[3,4]). What would product return in this case? + # Since velocity is the change in position, the change in y increases by dy. Same with x and dx. + state.y += state.dy + state.x += state.dx - Answer: - [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] + # Scales dx down. + state.dx *= 0.8 + end - - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + # Calls methods needed to determine collisions between player and world_collision rects. + def calc_box_collision + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key + collision_floor! + collision_left! + collision_right! + collision_ceiling! + end - - yield: Allows you to call a method with a code block and yield to that block. + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. + def collision_floor! + return unless state.dy <= 0 # return unless player is going down or is as far down as possible + player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player - Reminders: + # Goes through world_collision_rects to find all intersections between the bottom of player's rect and + # the top of a world_collision_rect (hence the "-0.1" above) + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) } + .first - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + return unless floor_collisions # return unless collision occurred + state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect + state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked + end - - 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. + # Finds collisions between the player's left side and the right side of a world_collision_rect. + def collision_left! + return unless state.dx < 0 # return unless player is moving left + player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size] - - args.inputs.mouse.click: This property will be set if the mouse was clicked. + # Goes through world_collision_rects to find all intersections beween the player's left side and the + # right side of a world_collision_rect. + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } + .first - - Ternary operator (?): Will evaluate a statement (just like an if statement) - and perform an action if the result is true or another action if it is false. + return unless left_side_collisions # return unless collision occurred - - reject: Removes elements from a collection if they meet certain requirements. + # player's x is set to the value of the x of the collided rect's right side + state.x = left_side_collisions[:left_right].right + state.dx = 0 # player isn't moving left because its path is blocked + end - - args.outputs.borders: An array. The values generate a border. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + # Finds collisions between the right side of the player and the left side of a world_collision_rect. + def collision_right! + return unless state.dx > 0 # return unless player is moving right + player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size] - - 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. - - =end - - # This sample app is a classic game of Tic Tac Toe. + # Goes through world_collision_rects to find all intersections between the player's right side + # and the left side of a world_collision_rect (hence the "+0.1" above) + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } + .first - class TicTacToe - attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk + return unless right_side_collisions # return unless collision occurred - # Starts the game with player x's turn and creates an array (to_a) for space combinations. - # Calls methods necessary for the game to run properly. - def tick - state.current_turn ||= :x - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a - render_board - input_board + # player's x is set to the value of the collided rect's left, minus the size of a rect + # tile size is subtracted because player's position is denoted by bottom left corner + state.x = right_side_collisions[:left_right].left - state.tile_size + state.dx = 0 # player isn't moving right because its path is blocked end - # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. - def render_board - square_size = 80 - - # Positions the game's board in the center of the screen. - # Try removing what follows grid.w_half or grid.h_half and see how the position changes! - board_left = grid.w_half - square_size * 1.5 - board_top = grid.h_half - square_size * 1.5 + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. + def collision_ceiling! + return unless state.dy > 0 # return unless player is moving up + player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size] - # At first glance, the add(1) looks pretty trivial. But if you remove it, - # you'll see that the positioning of the board would be skewed without it! - # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares - # due to the change in board placement. - outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces - space.border ||= [ - board_left + x.add(1) * square_size, # space.border is initialized using this definition - board_top + y.add(1) * square_size, - square_size, - square_size - ] - end + # Goes through world_collision_rects to find intersections between the bottom of a + # world_collision_rect and the top of the player's rect (hence the "+0.1" above) + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) } + .first - # Again, the calculations ensure that the piece is placed in the center of the grid square. - # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. - outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board - label board_left + x.add(1) * square_size + square_size.fdiv(2), - board_top + y.add(1) * square_size + square_size - 20, - space.piece # text of label, either "x" or "o" - end + return unless ceil_collisions # return unless collision occurred - # Uses a label to output whether x or o won, or if a draw occurred. - # If the game is ongoing, a label shows whose turn it currently is. - outputs.labels << if state.x_won - label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top - elsif state.o_won - label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally - elsif state.draw - label grid.w_half, grid.top - 80, "a draw" - else # if no one won and the game is ongoing - label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" - end + # player's y is set to the bottom y of the rect it collided with, minus the size of a rect + state.y = ceil_collisions[:bottom].y - state.tile_size + state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked end - # Calls the methods responsible for handling user input and determining the winner. - # Does nothing unless the mouse is clicked. - def input_board - return unless inputs.mouse.click - input_place_piece - input_restart_game - determine_winner - end + # Makes sure the player remains within the screen's dimensions. + def calc_edge_collision - # Handles user input for placing pieces on the board. - def input_place_piece - return if state.game_over + #Ensures that the player doesn't fall below the map. + if state.y < 0 + state.y = 0 + state.dy = 0 - # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already - # have a piece in it. - __, __, space = all_spaces.find do |__, __, space| - inputs.mouse.click.point.inside_rect?(space.border) && !space.piece + #Ensures that the player doesn't go too high. + # Position of player is denoted by bottom left hand corner, which is why we have to subtract the + # size of the player's box (so it remains visible on the screen) + elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen + state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen + state.dy = 0 end - # The piece that goes into the space belongs to the player whose turn it currently is. - return unless space - space.piece = state.current_turn - - # This ternary operator statement allows us to change the current player's turn. - # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. - state.current_turn = state.current_turn == :x ? :o : :x - end - - # Resets the game. - def input_restart_game - return unless state.game_over - gtk.reset - end - - # Checks if x or o won the game. - # If neither player wins and all nine squares are filled, a draw happens. - # Once a player is chosen as the winner or a draw happens, the game is over. - def determine_winner - state.x_won = won? :x # evaluates to either true or false (boolean values) - state.o_won = won? :o - state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won - state.game_over = state.x_won || state.o_won || state.draw + # Ensures that the player remains in the horizontal range that it is supposed to. + if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right + state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen + state.dx = 0 + elsif state.x <= 0 && state.dx < 0 # if player moves too far left + state.x = 0 # player will remain as left as possible while remaining on screen + state.dx = 0 + end end - # Determines if a player won by checking if there is a horizontal match or vertical match. - # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. - def won? piece - # performs action on all space combinations - won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| - - # Checks if the 3 grid spaces with the same y value (or same row) and - # x values that are next to each other have pieces that belong to the same player. - # Remember, the value of piece is equal to the current turn (which is the player). - horizontal_match = state.spaces[xs[0]][y].piece == piece && - state.spaces[xs[1]][y].piece == piece && - state.spaces[xs[2]][y].piece == piece - - # Checks if the 3 grid spaces with the same x value (or same column) and - # y values that are next to each other have pieces that belong to the same player. - # The && represents an "and" statement: if even one part of the statement is false, - # the entire statement evaluates to false. - vertical_match = state.spaces[y][xs[0]].piece == piece && - state.spaces[y][xs[1]].piece == piece && - state.spaces[y][xs[2]].piece == piece + # Processes input from the user on the keyboard. + def process_inputs + if inputs.mouse.down + state.world_lookup = {} + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid - horizontal_match || vertical_match # if either is true, true is returned + if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate + state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space + else + state.world << [x, y] # If no duplicates, adds to world collection + end end - # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. - # Is added to won regardless of whether the statement is true or false. - won << (state.spaces[-1][-1].piece == piece && # bottom left - state.spaces[ 0][ 0].piece == piece && # center - state.spaces[ 1][ 1].piece == piece) # top right - - # Sees if there is a diagonal match, starting at the bottom right and ending at the top left - # and is added to won. - won << (state.spaces[ 1][-1].piece == piece && # bottom right - state.spaces[ 0][ 0].piece == piece && # center - state.spaces[-1][ 1].piece == piece) # top left + # Sets dx to 0 if the player lets go of arrow keys. + if inputs.keyboard.key_up.right + state.dx = 0 + elsif inputs.keyboard.key_up.left + state.dx = 0 + end - # Any false statements (meaning false diagonal matches) are rejected from won - won.reject_false.any? - end + # Sets dx to 3 in whatever direction the player chooses. + if inputs.keyboard.key_held.right # if right key is pressed + state.dx = 3 + elsif inputs.keyboard.key_held.left # if left key is pressed + state.dx = -3 + end - # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. - # The ! before a statement means "not". For example, we are rejecting any space combinations that do - # NOT have pieces in them. - def filled_spaces - state.space_combinations - .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them - .map do |x, y| - if block_given? - yield x, y, state.spaces[x][y] - else - [x, y, state.spaces[x][y]] # sets definition of space - end + #Sets dy to 5 to make the player ~fly~ when they press the space bar + if inputs.keyboard.key_held.space + state.dy = 5 end end - # Defines all spaces on the board. - def all_spaces - if !block_given? - state.space_combinations.map do |x, y| - [x, y, state.spaces[x][y]] # sets definition of space - end - else # if a block is given (block_given? is true) - state.space_combinations.map do |x, y| - yield x, y, state.spaces[x][y] # yield if a block is given - end - end + def to_coord point + + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size later so the grid coordinates. + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] end - # Sets values for a label, such as the position, value, size, alignment, and color. - def label x, y, value - [x, y + 10, value, 20, 1, 0, 0, 0] + # Represents the tolerance for a collision between the player's rect and another rect. + def collision_tollerance + 0.0 end end - $tic_tac_toe = TicTacToe.new + $platformer_physics = PoorManPlatformerPhysics.new def tick args - $tic_tac_toe._ = args - $tic_tac_toe.state = args.state - $tic_tac_toe.outputs = args.outputs - $tic_tac_toe.inputs = args.inputs - $tic_tac_toe.grid = args.grid - $tic_tac_toe.gtk = args.gtk - $tic_tac_toe.tick - tick_instructions args, "Sample app shows how to work with mouse clicks." + $platformer_physics.grid = args.grid + $platformer_physics.inputs = args.inputs + $platformer_physics.state = args.state + $platformer_physics.outputs = args.outputs + $platformer_physics.tick + tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump." end def tick_instructions args, text, y = 715 @@ -5834,1068 +5577,1218 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 05_mouse/05_mouse_move/app/main.rb +* Physics And Collisions - Box Collision 2 - main.rb #+begin_src ruby + # ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb =begin + APIs listing that haven't been encountered in previous sample apps: - Reminders: + - times: Performs an action a specific number of times. + For example, if we said + 5.times puts "Hello DragonRuby", + then we'd see the words "Hello DragonRuby" printed on the console 5 times. - - num1.greater(num2): Returns the greater value. - For example, if we have the command - puts 4.greater(3) - the number 4 would be printed to the console since it has a greater value than 3. - Similar to lesser, which returns the lesser value. + - split: Divides a string into substrings based on a delimiter. + For example, if we had a command + "DragonRuby is awesome".split(" ") + then the result would be + ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. - - find_all: Finds all elements of a collection that meet certain requirements. - For example, in this sample app, we're using find_all to find all zombies that have intersected - or hit the player's sprite since these zombies have been killed. + - join: Opposite of split; converts each element of array to a string separated by delimiter. + For example, if we had a command + ["DragonRuby","is","awesome"].join(" ") + then the result would be + "DragonRuby is awesome". - - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. - Stores the frame the "down" event occurred. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + Reminders: - - args.outputs.sprites: An array. The values generate a sprite. - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] - For more information about sprites, go to mygame/documentation/05-sprites.md. + - to_s: Returns a string representation of an object. + For example, if we had + 500.to_s + the string "500" would be returned. + Similar to to_i, which returns an integer representation of an object. - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - When we want to create a new object, we can 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.) + - elapsed_time: How many frames have passed since the click event. - - 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.outputs.labels: An array. Values in the array generate labels on the screen. + The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. - - map: Ruby method used to transform data; used in arrays, hashes, and collections. - Can be used to perform an action on every element of a collection, such as multiplying - each element by 2 or declaring every element as a new entity. + - inputs.mouse.down: Determines whether or not the mouse is being pressed down. + The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). - - sample: Chooses a random element from the array. + - first: Returns the first element of the array. - - reject: Removes elements that meet certain requirements. - In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also - rejecting zombies that were killed more than 30 frames ago. + - num1.idiv(num2): Divides two numbers and returns an integer. + + - find_all: Finds all values that satisfy specific requirements. + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + + - reject: Removes elements from a collection if they meet certain requirements. + + - 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. =end - # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal - # is to kill the zombies as fast as possible! + MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map - class ProtectThePuppiesFromTheZombies - attr_accessor :grid, :inputs, :state, :outputs + class MetroidvaniaStarter + attr_accessor :grid, :inputs, :state, :outputs, :gtk - # Calls the methods necessary for the game to run properly. + # Calls methods needed to run the game properly. def tick defaults render calc - input + process_inputs end - # Sets default values for the zombies and for the player. - # Initialization happens only in the first frame. + # Sets all the default variables. + # '||' states that initialization occurs only in the first frame. def defaults - state.flash_at ||= 0 - state.zombie_min_spawn_rate ||= 60 - state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate - state.zombies ||= [] - state.killed_zombies ||= [] + state.tile_size = 64 + state.gravity = -0.2 + state.player_width = 60 + state.player_height = 64 + state.collision_tolerance = 0.0 + state.previous_tile_size ||= state.tile_size + state.x ||= 0 + state.y ||= 800 + state.dy ||= 0 + state.dx ||= 0 + attempt_load_world_from_file + state.world_lookup ||= { } + state.world_collision_rects ||= [] + state.mode ||= :creating # alternates between :creating and :selecting for sprite selection + state.select_menu ||= [0, 720, 1280, 720] + #=======================================IMPORTANT=======================================# + # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. + # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. + #=======================================================================================# + state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES + state.sprite_coords ||= [] + state.banner_coords ||= [640, 680 + 720] + state.sprite_selected ||= 1 + state.map_saved_at ||= 0 - # Declares player as a new entity and sets its properties. - # The player begins the game in the center of the screen, not moving in any direction. - state.player ||= state.new_entity(:player, { x: 640, - y: 360, - attack_angle: 0, - dx: 0, - dy: 0 }) + # Sets all the cordinate values for the sprite selection screen into a grid + # Displayed when 's' is pressed by player to access sprites + if state.sprite_coords == [] # if sprite_coords is an empty array + count = 1 + temp_x = 165 # sets a starting x and y position for display + temp_y = 500 + 720 + state.sprite_quantity.times do # for the number of sprites you have + state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array + temp_x += 100 # increment temp_x + count += 1 # increment count + if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen + temp_x = 165 # a new row of sprites starts + temp_y -= 75 # new row of sprites starts 75 units lower than the previous row + end + end + end end - # Outputs a gray background. - # Calls the methods needed to output the player, zombies, etc onto the screen. + # Places sprites def render - outputs.solids << [grid.rect, 100, 100, 100] - render_zombies - render_killed_zombies - render_player - render_flash - end - # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. - def render_zombies - outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection - z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method - z.sprite + # Sets the x, y, width, height, and image path for each sprite in the world collection. + outputs.sprites << state.world.map do |x, y, sprite| + [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location + y * state.tile_size, + state.tile_size, + state.tile_size, + 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path end - end - # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. - def render_killed_zombies - outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection - z.sprite = [z.x, - z.y, - 4 * 3, - 8 * 3, - animation_sprite(z, z.death_at), # calls animation_sprite method - 0, # angle - 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die - # change the value of 30 and see what happens when a zombie is killed + # Outputs sprite for the player by setting x, y, width, height, and image path + outputs.sprites << [state.x, + state.y, + state.player_width, + state.player_height,'sprites/player.png'] - # Sets values to output the slash over the zombie's sprite when a zombie is killed. - # The slash is tilted 45 degrees from the angle of the player's attack. - # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions - # the slash over the killed zombie's sprite. - [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] - end - end + # Outputs labels as primitives in top right of the screen + outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label + outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label - # Outputs the player sprite using the images in the sprites folder. - def render_player - state.player_sprite = [state.player.x, - state.player.y, - 4 * 3, - 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation - outputs.sprites << state.player_sprite + outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label + outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label - # Outputs a small red square that previews the angles that the player can attack in. - # It can be moved in a perfect circle around the player to show possible movements. - # Change the 60 in the parenthesis and see what happens to the movement of the red square. - outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), - state.player.y + state.player.attack_angle.vector_y(60), - 3, 3, 255, 0, 0] - end + outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label - # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. - def render_flash - return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. - # Transparency gradually changes (or eases) during the 10 frames of flash. - outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid - end + # if the map is saved and less than 120 frames have passed, the label is displayed + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 + outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label + end - # Calls all methods necessary for performing calculations. - def calc - calc_spawn_zombie - calc_move_zombies - calc_player - calc_kill_zombie - end + # If player hits 's', following appears + if state.mode == :selecting + # White background for sprite selection + outputs.primitives << [state.select_menu, 255, 255, 255].solid - # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. - def calc_spawn_zombie - if state.zombie_spawn_countdown > 0 - state.zombie_spawn_countdown -= 1 - return - end + # Select tile label at the top of the screen + outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label - # New zombies are created, positioned on the screen, and added to the zombies collection. - state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity - if rand > 0.5 - z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) - z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) - # the possible values exceed the screen's scope so zombies appear to be coming from far away - else - z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) - z.y = grid.rect.w.randomize(:ratio) # random y position on screen + # Places sprites in locations calculated in the defaults function + outputs.primitives << state.sprite_coords.map do |x, y, order| + [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite end end - # Calls random_spawn_countdown method (determines how fast new zombies appear) - state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate - state.zombie_min_spawn_rate -= 1 - # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater - state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) + # Creates sprite following mouse to help indicate which sprite you have selected + # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon + outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, + 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite end - # Moves all zombies towards the center of the screen. - # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. - def calc_move_zombies - state.zombies.each do |z| # for each zombie in the collection - z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 - z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center - end - state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center + # Calls methods that perform calculations + def calc + calc_in_game + calc_sprite_selection end - # Calculates the position and movement of the player on the screen. - def calc_player - state.player.x += state.player.dx # changes x based on dx (change in x) - state.player.y += state.player.dy # changes y based on dy (change in y) - - state.player.dx *= 0.9 # scales dx down - state.player.dy *= 0.9 # scales dy down - - # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. - # This ensures that the player remains within the screen's scope. - state.player.x = state.player.x.lesser(1280).greater(0) - state.player.y = state.player.y.lesser(720).greater(0) # same with player's y - end - - # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection - # and added to the killed_zombies collection since any zombie that intersects with the player is killed. - def calc_kill_zombie - - # Find all zombies that intersect with the player. They are considered killed. - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } - state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection - state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies - - if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame - state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed - # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) - end - - # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. - # Death_at stores the frame a zombie was killed. - killed_this_frame.each do |z| - z.death_at = state.tick_count - end - - # Zombies are rejected from the killed_zombies collection depending on when they were killed. - # They are rejected if more than 30 frames have passed since their death. - state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } + # Calls methods that perform calculations (if in creating mode) + def calc_in_game + return unless state.mode == :creating + calc_world_lookup + calc_player end - # Uses input from the user to move the player around the screen. - def input - - # If the "a" key or left key is pressed, the x position of the player decreases. - # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. - if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left - state.player.x -= 5 - elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right - state.player.x += 5 - end - - # If the "w" or up key is pressed, the y position of the player increases. - # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. - if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up - state.player.y += 5 - elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down - state.player.y -= 5 + def calc_world_lookup + # If the tile size isn't equal to the previous tile size, + # the previous tile size is set to the tile size, + # and world_lookup hash is set to empty. + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} end - # Sets the attack angle so the player can move and attack in the precise direction it wants to go. - # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). - # Attack angle also contributes to the position of red square. - if inputs.mouse.moved - state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] - end + # return if world_lookup is not empty or if world is empty + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 - if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 - state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] - state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set - state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position - state.player.dy = state.player.attack_angle.vector_y(25) - end - end + # Searches through the world and finds the coordinates that exist + state.world_lookup = {} + state.world.each { |x, y| state.world_lookup[[x, y]] = true } - # Sets the zombie spawn's countdown to a random number. - # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) - def random_spawn_countdown minimum - 10.randomize(:ratio, :sign).to_i + 60 + # Assigns collision rects for every sprite drawn + state.world_collision_rects = + state.world_lookup + .keys + .map do |coord_x, coord_y| + s = state.tile_size + # Multiplying by s (the size of a tile) ensures that the rect is + # placed exactly where you want it to be placed (causes grid to coordinate) + # How many pixels horizontally across and vertically up and down + x = s * coord_x + y = s * coord_y + { + args: [coord_x, coord_y], + left_right: [x, y + 4, s, s - 6], # hash keys and values + top: [x + 4, y + 6, s - 8, s - 6], + bottom: [x + 1, y - 1, s - 2, s - 8], + } + end end - # Helps to iterate through the images in the sprites folder by setting the animation index. - # 3 frames is how long to show an image, and 6 is how many images to flip through. - def animation_index at - at.idiv(3).mod(6) + # Calculates movement of player and calls methods that perform collision calculations + def calc_player + state.dy += state.gravity # what goes up must come down because of gravity + calc_box_collision + calc_edge_collision + state.y += state.dy # Since velocity is the change in position, the change in y increases by dy + state.x += state.dx # Ditto line above but dx and x + state.dx *= 0.8 # Scales dx down end - # Animates the zombies by using the animation index to go through the images in the sprites folder. - def animation_sprite zombie, at = nil - at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created - index = animation_index at - "sprites/zombie-#{index}.png" # string interpolation to iterate through images + # Calls methods that determine whether the player collides with any world_collision_rects. + def calc_box_collision + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key + collision_floor + collision_left + collision_right + collision_ceiling end - end - $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. + def collision_floor + return unless state.dy <= 0 # return unless player is going down or is as far down as possible + player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player - def tick args - $protect_the_puppies_from_the_zombies.grid = args.grid - $protect_the_puppies_from_the_zombies.inputs = args.inputs - $protect_the_puppies_from_the_zombies.state = args.state - $protect_the_puppies_from_the_zombies.outputs = args.outputs - $protect_the_puppies_from_the_zombies.tick - tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." - end + # Runs through all the sprites on the field and finds all intersections between player's + # bottom and the top of a rect. + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } + .first - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + return unless floor_collisions # performs following changes if a collision has occurred + state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top + state.dy = 0 # no change in y because the player's path is blocked end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label - end - -#+end_src - -* 05_mouse/05_mouse_move_paint_app/app/main.rb -#+begin_src ruby - =begin + # Finds collisions between the player's left side and the right side of a world_collision_rect. + def collision_left + return unless state.dx < 0 # return unless player is moving left + player_rect = [next_x, state.y, state.tile_size, state.tile_size] - APIs listing that haven't been encountered in previous sample apps: + # Runs through all the sprites on the field and finds all intersections between the player's left side + # and the right side of a rect. + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first - - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. + return unless left_side_collisions # return unless collision occurred + state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side + state.dx = 0 # no change in x because the player's path is blocked + end - For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... - puts a.floor() - which would print out 13. - (There is also a ceil method, which returns an integer number greater than or equal to the original - with no decimal. If we had called ceil on the variable a, the result would have been 14.) + # Finds collisions between the right side of the player and the left side of a world_collision_rect. + def collision_right + return unless state.dx > 0 # return unless player is moving right + player_rect = [next_x, state.y, state.tile_size, state.tile_size] - Reminders: + # Runs through all the sprites on the field and finds all intersections between the player's + # right side and the left side of a rect. + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. + return unless right_side_collisions # return unless collision occurred + state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) + state.dx = 0 # no change in x because the player's path is blocked + end - For example, if we have a "numbers" hash that stores numbers in English as the - key and numbers in Spanish as the value, we'd have a hash that looks like this... - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } - and on it goes. + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. + def collision_ceiling + return unless state.dy > 0 # return unless player is moving up + player_rect = [state.x, next_y, state.player_width, state.player_height] - Now if we wanted to find the corresponding value of the "one" key, we could say - puts numbers["one"] - which would print "uno" to the console. + # Runs through all the sprites on the field and finds all intersections between the player's top + # and the bottom of a rect. + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } + .first - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - In this sample app, new_entity is used to create a new button that clears the grid. - (Remember, you can use state to define ANY property and it will be retained across frames.) + return unless ceil_collisions # return unless collision occurred + state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) + state.dy = 0 # no change in y because the player's path is blocked + end - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + # Makes sure the player remains within the screen's dimensions. + def calc_edge_collision + # Ensures that player doesn't fall below the map + if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope + state.y = 0 # 0 is the lowest the player can be while staying on the screen + state.dy = 0 + # Ensures player doesn't go insanely high + elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope + state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen + state.dy = 0 + end - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + # Ensures that player remains in the horizontal range its supposed to + if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right + state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope + state.dx = 0 + elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left + state.x = 0 # farthest left the player can be while remaining in the screen's scope + state.dx = 0 + end + end - - args.outputs.labels: An array. The values in the array generate a label. - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. + def calc_sprite_selection + # Does the transition to bring down the select sprite screen + if state.mode == :selecting && state.select_menu.y != 0 + state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) + state.banner_coords.y = 680 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) + end + end - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. - - =end - - # This sample app shows an empty grid that the user can paint on. - # To paint, the user must keep their mouse presssed and drag it around the grid. - # The "clear" button allows users to clear the grid so they can start over. - - class PaintApp - attr_accessor :inputs, :state, :outputs, :grid, :args - - # Runs methods necessary for the game to function properly. - def tick - print_title - add_grid - check_click - draw_buttons - end - - # Prints the title onto the screen by using a label. - # Also separates the title from the grid with a line as a horizontal separator. - def print_title - args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] - outputs.lines << horizontal_separator(660, 0, 1280) - end - - # Sets the starting position, ending position, and color for the horizontal separator. - # The starting and ending positions have the same y values. - def horizontal_separator y, x, x2 - [x, y, x2, y, 150, 150, 150] - end - - # Sets the starting position, ending position, and color for the vertical separator. - # The starting and ending positions have the same x values. - def vertical_separator x, y, y2 - [x, y, x, y2, 150, 150, 150] - end - - # Outputs a border and a grid containing empty squares onto the screen. - def add_grid - - # Sets the x, y, height, and width of the grid. - # There are 31 horizontal lines and 31 vertical lines in the grid. - # Feel free to count them yourself before continuing! - x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center - lines_h = 31 - lines_v = 31 - - # Sets values for the grid's border, grid lines, and filled squares. - # The filled_squares variable is initially set to an empty array. - state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border - state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method - state.filled_squares ||= [] # there are no filled squares until the user fills them in - - # Outputs the grid lines, border, and filled squares onto the screen. - outputs.lines.concat state.grid_lines - outputs.borders << state.grid_border - outputs.solids << state.filled_squares + # Does the transition to leave the select sprite screen + if state.mode == :creating && state.select_menu.y != 720 + state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) + state.banner_coords.y = 1000 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y + 720, w, h] # sets definition of all elements in collection + end + end end - # Draws the grid by adding in vertical and horizontal separators. - def draw_grid x, y, h, w, lines_h, lines_v - - # The grid starts off empty. - grid = [] - - # Calculates the placement and adds horizontal lines or separators into the grid. - curr_y = y # start at the bottom of the box - dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid - lines_h.times do - curr_y += dist_y # increment curr_y by the distance between the horizontal lines - grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid + def process_inputs + # If the state.mode is back and if the menu has retreated back up + # call methods that process user inputs + if state.mode == :creating + process_inputs_player_movement + process_inputs_place_tile end - # Calculates the placement and adds vertical lines or separators into the grid. - curr_x = x # now start at the left of the box - dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid - lines_v.times do - curr_x += dist_x # increment curr_x by the distance between the vertical lines - grid << vertical_separator(curr_x, y + 1, y + h) # add separator + # For each sprite_coordinate added, check what sprite was selected + if state.mode == :selecting + state.sprite_coords.map do |x, y, order| # goes through all sprites in collection + # checks that a specific sprite was pressed based on x, y position + if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true + inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and + inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right + inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y + inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up + state.sprite_selected = order # sprite is chosen + end + end end - # paint_grid uses a hash to assign values to keys. - state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, - "lines_v" => lines_v, "dist_x" => dist_x, - "dist_y" => dist_y } - - return grid + inputs_export_stage + process_inputs_show_available_sprites end - # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. - # If the mouse is up, the user cannot drag the mouse. - def check_click - if inputs.mouse.down #is mouse up or down? - state.mouse_held = true # mouse is being held down - elsif inputs.mouse.up # if mouse is up - state.mouse_held = false # mouse is not being held down or dragged - state.mouse_dragging = false + # Moves the player based on the keys they press on their keyboard + def process_inputs_player_movement + # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) + if inputs.keyboard.key_up.right + state.dx = 0 + elsif inputs.keyboard.key_up.left + state.dx = 0 end - if state.mouse_held && # mouse needs to be down - !inputs.mouse.click && # must not be first click - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" - state.mouse_dragging = true + # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys + if inputs.keyboard.key_held.right + state.dx = 3 + elsif inputs.keyboard.key_held.left + state.dx = -3 end - # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) - search_lines(inputs.mouse.click.point, :click) - - # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) - search_lines(inputs.mouse.position, :drag) + # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard + if inputs.keyboard.key_held.space + state.dy = 5 end end - # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. - def search_lines (point, input_type) - point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash - point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash - - # Remove code following the .floor and see what happens when you try to fill in grid squares - point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] - point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] - - point.x += state.paint_grid["x"] - point.y += state.paint_grid["y"] - - # Sets definition of a grid box, meaning its x, y, width, and height. - # Floor is called on the point.x and point.y variables. - # Ceil method is called on values of the distance hash keys, setting the width and height of a box. - grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] + # Adds tile in the place the user holds down the mouse + def process_inputs_place_tile + if inputs.mouse.down # if mouse is pressed + state.world_lookup = {} + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid - if input_type == :click # if user clicks their mouse - if state.filled_squares.include? grid_box # if grid box is already filled in - state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + # Checks if any coordinates duplicate (already exist in world) + if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } + #erases existing tile space by rejecting them from world + state.world = state.world.reject do |existing_x, existing_y, n| + existing_x == x && existing_y == y + end else - state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares - end - elsif input_type == :drag # if user drags mouse - unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in - state.filled_squares << grid_box # the box is filled in and added to filled_squares + state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite end end end - # Creates and outputs a "Clear" button on the screen using a label and a border. - # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. - def draw_buttons - x, y, w, h = 390, 50, 240, 50 - state.clear_button ||= state.new_entity(:button_with_fade) + # Stores/exports world collection's info (coordinates, sprite number) into a file + def inputs_export_stage + if inputs.keyboard.key_down.e # if "e" is pressed + export_string = state.world.map do |x, y, sprite_number| # stores world info in a string + "#{x},#{y},#{sprite_number}" # using string interpolation + end + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file + state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved + end + end - # The x and y positions are set to display the label in the center of the button. - # Try changing the first two parameters to simply x, y and see what happens to the text placement! - state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border - state.clear_button.border ||= [x, y, w, h] + def process_inputs_show_available_sprites + # Based on keyboard input, the entity (:creating and :selecting) switch + if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating + state.mode = :selecting # will change to selecting + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting + state.mode = :creating # will change to creating + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + end + end - # If the mouse is clicked inside the borders of the clear button, - # the filled_squares collection is emptied and the squares are cleared. - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) - state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred - state.filled_squares.clear - inputs.mouse.previous_click = nil + # Loads the world collection by reading from the map.txt file in the app folder + def attempt_load_world_from_file + return if state.world # return if the world collection is already populated + state.world ||= [] # initialized as an empty collection + exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code + return unless exported_world # return unless the file read was successful + state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world + l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, + # calling to_i (converts to integers) on each element end + end - outputs.labels << state.clear_button.label - outputs.borders << state.clear_button.border + # Adds the change in y to y to determine the next y position of the player. + def next_y + state.y + state.dy + end - # When the clear button is clicked, the color of the button changes - # and the transparency changes, as well. If you change the time from - # 0.25.seconds to 1.25.seconds or more, the change will last longer. - if state.clear_button.clicked_at - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + # Determines next x position of player + def next_x + if state.dx < 0 # if the player moves left + return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) + else + return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) end end + + def to_coord point + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size + # later and huzzah. Grid coordinates + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + end end - $paint_app = PaintApp.new + $metroidvania_starter = MetroidvaniaStarter.new def tick args - $paint_app.inputs = args.inputs - $paint_app.state = args.state - $paint_app.grid = args.grid - $paint_app.args = args - $paint_app.outputs = args.outputs - $paint_app.tick - tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." - end - - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + $metroidvania_starter.grid = args.grid + $metroidvania_starter.inputs = args.inputs + $metroidvania_starter.state = args.state + $metroidvania_starter.outputs = args.outputs + $metroidvania_starter.gtk = args.gtk + $metroidvania_starter.tick end #+end_src -* 05_mouse/06_coordinate_systems/app/main.rb +* Physics And Collisions - Jump Physics - main.rb #+begin_src ruby + # ./samples/04_physics_and_collisions/06_jump_physics/app/main.rb =begin - APIs listing that haven't been encountered in previous sample apps: + Reminders: - - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. - Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for - position to know the mouse's coordinates. - For more information about the mouse, go to mygame/documentation/07-mouse.md. + - 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.) - Reminders: + - args.outputs.solids: An array. The values generate a solid. + The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - - args.inputs.mouse.click: This property will be set if the mouse was clicked. + - num1.greater(num2): Returns the greater value. - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. - - 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. + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. - In this sample app, string interpolation is used to show the current position of the mouse - in a label. + =end - - args.outputs.labels: An array that generates a label. - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. + # This sample app is a game that requires the user to jump from one platform to the next. + # As the player successfully clears platforms, they become smaller and move faster. - - args.outputs.solids: An array that generates a solid. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + class VerticalPlatformer + attr_gtk - - args.outputs.lines: An array that generates a line. - The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] - For more information about lines, go to mygame/documentation/04-lines.md. + # declares vertical platformer as new entity + def s + state.vertical_platformer ||= state.new_entity(:vertical_platformer) + state.vertical_platformer + end - =end + # creates a new platform using a hash + def new_platform hash + s.new_entity_strict(:platform, hash) # platform key + end - # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the - # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or - # four quadrants by pressing the button. + # calls methods needed for game to run properly + def tick + defaults + render + calc + input + end - def tick args + # Sets default values + def defaults + s.platforms ||= [ # initializes platforms collection with two platforms using hashes + new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), + new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher + ] - # The addition and subtraction in the first two parameters of the label and solid - # ensure that the outputs don't overlap each other. Try removing them and see what happens. - pos = args.inputs.mouse.position # stores coordinates of mouse's position - args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates - args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering + s.tick_count = args.state.tick_count + s.gravity = -0.3 # what goes up must come down because of gravity + s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared + s.player.x ||= 0 # sets player values + s.player.y ||= 100 + s.player.w ||= 64 + s.player.h ||= 64 + s.player.dy ||= 0 # change in position + s.player.dx ||= 0 + s.player_jump_power = 15 + s.player_jump_power_duration = 10 + s.player_max_run_speed = 5 + s.player_speed_slowdown_rate = 0.9 + s.player_acceleration = 1 + s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) + end - button = [0, 0, 370, 50] # sets definition of toggle button - args.outputs.borders << button # outputs button as border (not filled in) - args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button - args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants - args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants + # Outputs objects onto the screen + def render + outputs.solids << s.platforms.map do |p| # outputs platforms onto screen + [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center + # don't forget, position of platform is denoted by bottom left hand corner + end - if args.inputs.mouse.click # if the user clicks the mouse - pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) - if pos.inside_rect? button # if the click occurred inside the button - if args.grid.name == :bottom_left # if the grid shows bottom left as origin - args.grid.origin_center! # origin will be shown in center - else - args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin + # outputs player using hash + outputs.solids << { + x: s.player.x + 300, # player positioned on top of platform + y: s.player.y - s.camera[:y], + w: s.player.w, + h: s.player.h, + r: 100, # color saturation + g: 100, + b: 200 + } + end + + # Performs calculations + def calc + s.platforms.each do |p| # for each platform in the collection + p.rect = [p.x, p.y, p.w, p.h] # set the definition + end + + # sets player point by adding half the player's width to the player's x + s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! + + # search the platforms collection to find if the player's point is inside the rect of a platform + collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } + + # if collision occurred and player is moving down (or not moving vertically at all) + if collision && s.player.dy <= 0 + s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform + s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically + if !s.player.platform + s.player.dx = 0 # no horizontal movement + end + # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x + s.player.x += collision.dx * collision.speed + s.player.platform = collision # player is on the platform that it collided with (or landed on) + if s.player.falling # if player is falling + s.player.dx = 0 # no horizontal movement + end + s.player.falling = false + s.player.jumped_at = nil + else + s.player.platform = nil # player is not on a platform + s.player.y += s.player.dy # velocity is the change in position + s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down + end + + s.platforms.each do |p| # for each platform in the collection + p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) + # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) + if p.x < -300 # if platform goes too far left + p.dx *= -1 # dx is scaled down + p.x = -300 # as far left as possible within scope + elsif p.x > (1000 - p.w) # if platform's x is greater than 300 + p.dx *= -1 + p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) + end + end + + delta = (s.player.y - s.camera[:y] - 100) # used to position camera view + + if delta > -200 + s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards + s.player.x += s.player.dx # velocity is change in position; change in x increases by dx + + # searches platform collection to find platforms located more than 300 pixels above the player + has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } + if !has_platforms # if there are no platforms 300 pixels above the player + width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous + s.player.platforms_cleared += 1 # player successfully cleared another platform + last_platform = s.platforms[-1] # platform just cleared becomes last platform + # another platform is created 300 pixels above the last platform, and this + # new platform has a smaller width and moves faster than all previous platforms + s.platforms << new_platform(x: (700 - width) * rand, # random x position + y: last_platform.y + 300, + w: width, + h: 32, + dx: 1.randomize(:sign), # random change in x + speed: 2 * s.player.platforms_cleared, + rect: nil) end + else + s.as_hash.clear # otherwise clear the hash (no new platform is necessary) end end - tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." - end + # Takes input from the user to move the player + def input + if inputs.keyboard.space # if the space bar is pressed + s.player.jumped_at ||= s.tick_count # set to current frame - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + # if the time that has passed since the jump is less than the duration of a jump (10 frames) + # and the player is not falling + if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling + s.player.dy = s.player_jump_power # player jumps up + end + end + + if inputs.keyboard.key_up.space # if space bar is in "up" state + s.player.falling = true # player is falling + end + + if inputs.keyboard.left # if left key is pressed + s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration + s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater + elsif inputs.keyboard.right # if right key is pressed + s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration + s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser + else + s.player.dx *= s.player_speed_slowdown_rate # scales dx down + end end + end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + $game = VerticalPlatformer.new + + def tick args + $game.args = args + $game.tick end #+end_src -* 06_save_load/10_save_load_game/app/main.rb +* Mouse - Mouse Click - main.rb #+begin_src ruby + # ./samples/05_mouse/01_mouse_click/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: - - 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. - - In this sample app, we're using symbols for our buttons. We have buttons that - light fires, save, load, etc. Each of these buttons has a distinct symbol like - :light_fire, :save_game, :load_game, etc. + - product: Returns an array of all combinations of elements from all arrays. - - to_sym: Returns the symbol corresponding to the given string; creates the symbol - if it does not already exist. - For example, - 'car'.to_sym - would return the symbol :car. + For example, [1,2].product([1,2]) would return the following array... + [[1,1], [1,2], [2,1], [2,2]] + More than two arrays can be given to product and it will still work, + such as [1,2].product([1,2],[3,4]). What would product return in this case? - - last: Returns the last element of an array. + Answer: + [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] - Reminders: + - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 - - num1.lesser(num2): finds the lower value of the given options. - For example, in the statement - a = 4.lesser(3) - 3 has a lower value than 4, which means that the value of a would be set to 3, - but if the statement had been - a = 4.lesser(5) - 4 has a lower value than 5, which means that the value of a would be set to 4. + - yield: Allows you to call a method with a code block and yield to that block. - - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + Reminders: - - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + + - 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.outputs.labels: An array. Values generate a label. - Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information, go to mygame/documentation/02-labels.md. + - args.inputs.mouse.click: This property will be set if the mouse was clicked. - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array - with at least four values is considered a rect. The inside_rect? function returns true - or false depending on if the point is inside the rect. + - Ternary operator (?): Will evaluate a statement (just like an if statement) + and perform an action if the result is true or another action if it is false. + + - reject: Removes elements from a collection if they meet certain requirements. + + - args.outputs.borders: An array. The values generate a border. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + + - 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. =end - # This code allows users to perform different tasks, such as saving and loading the game. - # Users also have options to reset the game and light a fire. + # This sample app is a classic game of Tic Tac Toe. - class TextedBasedGame + class TicTacToe + attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk - # Contains methods needed for game to run properly. - # Increments tick count by 1 each time it runs (60 times in a single second) + # Starts the game with player x's turn and creates an array (to_a) for space combinations. + # Calls methods necessary for the game to run properly. def tick - default - show_intro - state.engine_tick_count += 1 - tick_fire + state.current_turn ||= :x + state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + render_board + input_board end - # Sets default values. - # The ||= ensures that a variable's value is only set to the value following the = sign - # if the value has not already been set before. Intialization happens only in the first frame. - def default - state.engine_tick_count ||= 0 - state.active_module ||= :room - state.fire_progress ||= 0 - state.fire_ready_in ||= 10 - state.previous_fire ||= :dead - state.fire ||= :dead - end + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. + def render_board + square_size = 80 - def show_intro - return unless state.engine_tick_count == 0 # return unless the game just started - set_story_line "awake." # calls set_story_line method, sets to "awake" - end + # Positions the game's board in the center of the screen. + # Try removing what follows grid.w_half or grid.h_half and see how the position changes! + board_left = grid.w_half - square_size * 1.5 + board_top = grid.h_half - square_size * 1.5 - # Sets story line. - def set_story_line story_line - state.story_line = story_line # story line set to value of parameter - state.active_module = :alert # active module set to alert - end + # At first glance, the add(1) looks pretty trivial. But if you remove it, + # you'll see that the positioning of the board would be skewed without it! + # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares + # due to the change in board placement. + outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces + space.border ||= [ + board_left + x.add(1) * square_size, # space.border is initialized using this definition + board_top + y.add(1) * square_size, + square_size, + square_size + ] + end - # Clears story line. - def clear_storyline - state.active_module = :none # active module set to none - state.story_line = nil # story line is cleared, set to nil (or empty) + # Again, the calculations ensure that the piece is placed in the center of the grid square. + # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. + outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board + label board_left + x.add(1) * square_size + square_size.fdiv(2), + board_top + y.add(1) * square_size + square_size - 20, + space.piece # text of label, either "x" or "o" + end + + # Uses a label to output whether x or o won, or if a draw occurred. + # If the game is ongoing, a label shows whose turn it currently is. + outputs.labels << if state.x_won + label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top + elsif state.o_won + label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally + elsif state.draw + label grid.w_half, grid.top - 80, "a draw" + else # if no one won and the game is ongoing + label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" + end end - # Determines fire progress (how close the fire is to being ready to light). - def tick_fire - return if state.active_module == :alert # return if active module is alert - state.fire_progress += 1 # increment fire progress - # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. - state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) + # Calls the methods responsible for handling user input and determining the winner. + # Does nothing unless the mouse is clicked. + def input_board + return unless inputs.mouse.click + input_place_piece + input_restart_game + determine_winner end - # Sets the value of fire (whether it is dead or roaring), and the story line - def light_fire - return unless fire_ready? # returns unless the fire is ready to be lit - state.fire = :roaring # fire is lit, set to roaring - state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit - if state.fire != state.previous_fire - set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation - state.previous_fire = state.fire + # Handles user input for placing pieces on the board. + def input_place_piece + return if state.game_over + + # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already + # have a piece in it. + __, __, space = all_spaces.find do |__, __, space| + inputs.mouse.click.point.inside_rect?(space.border) && !space.piece end - end - # Checks if the fire is ready to be lit. Returns a boolean value. - def fire_ready? - # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), - # the fire is ready to be lit. - state.fire_progress == state.fire_ready_in - end + # The piece that goes into the space belongs to the player whose turn it currently is. + return unless space + space.piece = state.current_turn - # Divides the value of the fire_progress variable by 10 to determine how close the user is to - # being able to light a fire. - def light_fire_progress - state.fire_progress.fdiv(10) # float division + # This ternary operator statement allows us to change the current player's turn. + # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. + state.current_turn = state.current_turn == :x ? :o : :x end - # Defines fire as the state.fire variable. - def fire - state.fire + # Resets the game. + def input_restart_game + return unless state.game_over + gtk.reset end - # Sets the title of the room. - def room_title - return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead - return "a room that is lit" # room is lit if the fire is not dead + # Checks if x or o won the game. + # If neither player wins and all nine squares are filled, a draw happens. + # Once a player is chosen as the winner or a draw happens, the game is over. + def determine_winner + state.x_won = won? :x # evaluates to either true or false (boolean values) + state.o_won = won? :o + state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won + state.game_over = state.x_won || state.o_won || state.draw end - # Sets the active_module to room. - def go_to_room - state.active_module = :room - end + # Determines if a player won by checking if there is a horizontal match or vertical match. + # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. + def won? piece + # performs action on all space combinations + won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| - # Defines active_module as the state.active_module variable. - def active_module - state.active_module - end + # Checks if the 3 grid spaces with the same y value (or same row) and + # x values that are next to each other have pieces that belong to the same player. + # Remember, the value of piece is equal to the current turn (which is the player). + horizontal_match = state.spaces[xs[0]][y].piece == piece && + state.spaces[xs[1]][y].piece == piece && + state.spaces[xs[2]][y].piece == piece - # Defines story_line as the state.story_line variable. - def story_line - state.story_line - end + # Checks if the 3 grid spaces with the same x value (or same column) and + # y values that are next to each other have pieces that belong to the same player. + # The && represents an "and" statement: if even one part of the statement is false, + # the entire statement evaluates to false. + vertical_match = state.spaces[y][xs[0]].piece == piece && + state.spaces[y][xs[1]].piece == piece && + state.spaces[y][xs[2]].piece == piece - # Update every 60 frames (or every second) - def should_tick? - state.tick_count.mod_zero?(60) - end + horizontal_match || vertical_match # if either is true, true is returned + end - # Sets the value of the game state provider. - def initialize game_state_provider - @game_state_provider = game_state_provider - end + # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. + # Is added to won regardless of whether the statement is true or false. + won << (state.spaces[-1][-1].piece == piece && # bottom left + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[ 1][ 1].piece == piece) # top right - # Defines the game state. - # Any variable prefixed with an @ symbol is an instance variable. - def state - @game_state_provider.state - end + # Sees if there is a diagonal match, starting at the bottom right and ending at the top left + # and is added to won. + won << (state.spaces[ 1][-1].piece == piece && # bottom right + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[-1][ 1].piece == piece) # top left - # Saves the state of the game in a text file called game_state.txt. - def save - $gtk.serialize_state('game_state.txt', state) + # Any false statements (meaning false diagonal matches) are rejected from won + won.reject_false.any? end - # Loads the game state from the game_state.txt text file. - # If the load is unsuccessful, the user is informed since the story line indicates the failure. - def load - parsed_state = $gtk.deserialize_state('game_state.txt') - if !parsed_state - set_story_line "no game to load. press save first." - else - $gtk.args.state = parsed_state + # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. + # The ! before a statement means "not". For example, we are rejecting any space combinations that do + # NOT have pieces in them. + def filled_spaces + state.space_combinations + .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them + .map do |x, y| + if block_given? + yield x, y, state.spaces[x][y] + else + [x, y, state.spaces[x][y]] # sets definition of space + end end end - # Resets the game. - def reset - $gtk.reset + # Defines all spaces on the board. + def all_spaces + if !block_given? + state.space_combinations.map do |x, y| + [x, y, state.spaces[x][y]] # sets definition of space + end + else # if a block is given (block_given? is true) + state.space_combinations.map do |x, y| + yield x, y, state.spaces[x][y] # yield if a block is given + end + end end - end - class TextedBasedGamePresenter - attr_accessor :state, :outputs, :inputs - - # Creates empty collection called highlights. - # Calls methods necessary to run the game. - def tick - state.layout.highlights ||= [] - game.tick if game.should_tick? - render - process_input + # Sets values for a label, such as the position, value, size, alignment, and color. + def label x, y, value + [x, y + 10, value, 20, 1, 0, 0, 0] end + end - # Outputs a label of the tick count (passage of time) and calls all render methods. - def render - outputs.labels << [10, 30, state.tick_count] - render_alert - render_room - render_highlights - end + $tic_tac_toe = TicTacToe.new - # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. - def render_alert - return unless game.active_module == :alert + def tick args + $tic_tac_toe._ = args + $tic_tac_toe.state = args.state + $tic_tac_toe.outputs = args.outputs + $tic_tac_toe.inputs = args.inputs + $tic_tac_toe.grid = args.grid + $tic_tac_toe.gtk = args.gtk + $tic_tac_toe.tick + tick_instructions args, "Sample app shows how to work with mouse clicks." + end - outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label - outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true end - def render_room - return unless game.active_module == :room - outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + +* Mouse - Mouse Move - main.rb +#+begin_src ruby + # ./samples/05_mouse/02_mouse_move/app/main.rb + =begin - # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value - # that positions it 60 pixels lower than the previous output. + Reminders: - # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) - outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) - outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button - outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button - outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button - outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen - end + - num1.greater(num2): Returns the greater value. + For example, if we have the command + puts 4.greater(3) + the number 4 would be printed to the console since it has a greater value than 3. + Similar to lesser, which returns the lesser value. - # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. - def render_highlights - state.layout.highlights.each do |h| # for each highlight in the collection - h.lifetime -= 1 # decrease the value of its lifetime - end + - find_all: Finds all elements of a collection that meet certain requirements. + For example, in this sample app, we're using find_all to find all zombies that have intersected + or hit the player's sprite since these zombies have been killed. - outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection - [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight - # transparency changes; divide lifetime by max_lifetime, multiply result by 255 - end + - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. + Stores the frame the "down" event occurred. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - # reject highlights from collection that have no remaining lifetime - state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } - end + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. - # Checks whether or not a button was clicked. - # Returns a boolean value. - def process_input - button = button_clicked? # calls button_clicked? method - end + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + When we want to create a new object, we can 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.) - # Returns a boolean value. - # Finds the button that was clicked from the button list and determines what method to call. - # Adds a highlight to the highlights collection. - def button_clicked? - return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click - button = @button_list.find do |k, v| # goes through button_list to find button clicked - click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? - end - return unless button # return unless a button was clicked - method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) - if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) - border = button[1][:primitives].last # sets border definition using value of last key in button list hash + - 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. - # declares each highlight as a new entity, sets properties - state.layout.highlights << state.new_entity(:highlight) do |h| - h.x = border.x - h.y = border.y - h.w = border.w - h.h = border.h - h.max_lifetime = 10 - h.lifetime = h.max_lifetime - h.color = [120, 120, 180] # sets color to shade of purple - end + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. - self.send method_to_call # invoke method identified by symbol - else # otherwise, if self doesn't respond to given method - border = button[1][:primitives].last # sets border definition using value of last key in hash + - sample: Chooses a random element from the array. - # declares each highlight as a new entity, sets properties - state.layout.highlights << state.new_entity(:highlight) do |h| - h.x = border.x - h.y = border.y - h.w = border.w - h.h = border.h - h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true - h.lifetime = h.max_lifetime - h.color = [120, 80, 80] # sets color to dark color - end + - reject: Removes elements that meet certain requirements. + In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also + rejecting zombies that were killed more than 30 frames ago. - # instructions for users on how to add the missing method_to_call to the code - puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" - puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." - puts "" - puts "```" - puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" - puts "" - puts " def #{method_to_call}" - puts " puts 'Yay that worked!'" - puts " end" - puts "" - puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." - puts "```" - puts "" - end - end + =end - # Returns the position of the mouse when it is clicked. - def click_pos - return nil unless inputs.mouse.click # returns nil unless the mouse was clicked - return inputs.mouse.click.point # returns location of mouse click (coordinates) - end + # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal + # is to kill the zombies as fast as possible! - # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) - def button id, x, y, text - @button_list[id] ||= { # assigns values to hash keys - id: id, - text: text, - primitives: [ - [x + 10, y + 30, text, 2, 0].label, # positions label inside border - [x, y, 300, 50].border, # sets definition of border - ] - } + class ProtectThePuppiesFromTheZombies + attr_accessor :grid, :inputs, :state, :outputs - @button_list[id][:primitives] # returns label and border for buttons + # Calls the methods necessary for the game to run properly. + def tick + defaults + render + calc + input end - # Creates a progress bar (used for lighting the fire) and sets its values. - def progress_bar id, x, y, text, percentage - @button_list[id] = { # assigns values to hash keys - id: id, - text: text, - primitives: [ - [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) - [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border - [x, y, 300, 50].border, # sets definition of border - ] - } - - # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by - # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. - @button_list[id][:primitives][0][2] = 300 * percentage - @button_list[id][:primitives] - end + # Sets default values for the zombies and for the player. + # Initialization happens only in the first frame. + def defaults + state.flash_at ||= 0 + state.zombie_min_spawn_rate ||= 60 + state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate + state.zombies ||= [] + state.killed_zombies ||= [] - # Defines the game. - def game - @game + # Declares player as a new entity and sets its properties. + # The player begins the game in the center of the screen, not moving in any direction. + state.player ||= state.new_entity(:player, { x: 640, + y: 360, + attack_angle: 0, + dx: 0, + dy: 0 }) end - # Initalizes the game and creates an empty list of buttons. - def initialize - @game = TextedBasedGame.new self - @button_list ||= {} + # Outputs a gray background. + # Calls the methods needed to output the player, zombies, etc onto the screen. + def render + outputs.solids << [grid.rect, 100, 100, 100] + render_zombies + render_killed_zombies + render_player + render_flash end - # Clears the storyline and takes the user to the room. - def alert_dismiss_clicked - game.clear_storyline - game.go_to_room + # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. + def render_zombies + outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection + z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method + z.sprite + end end - # Lights the fire when the user clicks the "light fire" option. - def light_fire_clicked - game.light_fire + # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. + def render_killed_zombies + outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection + z.sprite = [z.x, + z.y, + 4 * 3, + 8 * 3, + animation_sprite(z, z.death_at), # calls animation_sprite method + 0, # angle + 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die + # change the value of 30 and see what happens when a zombie is killed + + # Sets values to output the slash over the zombie's sprite when a zombie is killed. + # The slash is tilted 45 degrees from the angle of the player's attack. + # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions + # the slash over the killed zombie's sprite. + [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] + end end - # Saves the game when the user clicks the "save" option. - def save_game_clicked - game.save + # Outputs the player sprite using the images in the sprites folder. + def render_player + state.player_sprite = [state.player.x, + state.player.y, + 4 * 3, + 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation + outputs.sprites << state.player_sprite + + # Outputs a small red square that previews the angles that the player can attack in. + # It can be moved in a perfect circle around the player to show possible movements. + # Change the 60 in the parenthesis and see what happens to the movement of the red square. + outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), + state.player.y + state.player.attack_angle.vector_y(60), + 3, 3, 255, 0, 0] end - # Resets the game when the user clicks the "reset" option. - def reset_game_clicked - game.reset + # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. + def render_flash + return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. + # Transparency gradually changes (or eases) during the 10 frames of flash. + outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid end - # Loads the game when the user clicks the "load" option. - def load_game_clicked - game.load + # Calls all methods necessary for performing calculations. + def calc + calc_spawn_zombie + calc_move_zombies + calc_player + calc_kill_zombie end - end - $text_based_rpg = TextedBasedGamePresenter.new + # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. + def calc_spawn_zombie + if state.zombie_spawn_countdown > 0 + state.zombie_spawn_countdown -= 1 + return + end - def tick args - $text_based_rpg.state = args.state - $text_based_rpg.outputs = args.outputs - $text_based_rpg.inputs = args.inputs - $text_based_rpg.tick - end - -#+end_src - -* 07_advanced_rendering/01_simple_render_targets/app/main.rb -#+begin_src ruby - def tick args - # args.outputs.render_targets are really really powerful. - # They essentially allow you to create a sprite programmatically and cache the result. + # New zombies are created, positioned on the screen, and added to the zombies collection. + state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity + if rand > 0.5 + z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) + z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) + # the possible values exceed the screen's scope so zombies appear to be coming from far away + else + z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) + z.y = grid.rect.w.randomize(:ratio) # random y position on screen + end + end - # Create a render_target of a :block and a :gradient on tick zero. - if args.state.tick_count == 0 - args.render_target(:block).solids << [0, 0, 1280, 100] + # Calls random_spawn_countdown method (determines how fast new zombies appear) + state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate + state.zombie_min_spawn_rate -= 1 + # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater + state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) + end - # The gradient is actually just a collection of black solids with increasing - # opacities. - args.render_target(:gradient).solids << 90.map_with_index do |x| - 50.map_with_index do |y| - [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255] - end + # Moves all zombies towards the center of the screen. + # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. + def calc_move_zombies + state.zombies.each do |z| # for each zombie in the collection + z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 + z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center end + state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center end - # Take the :block render_target and present it horizontally centered. - # Use a subsection of the render_targetd specified by source_x, - # source_y, source_w, source_h. - args.outputs.sprites << { x: 0, - y: 310, - w: 1280, - h: 100, - path: :block, - source_x: 0, - source_y: 0, - source_w: 1280, - source_h: 100 } + # Calculates the position and movement of the player on the screen. + def calc_player + state.player.x += state.player.dx # changes x based on dx (change in x) + state.player.y += state.player.dy # changes y based on dy (change in y) - # After rendering :block, render gradient on top of :block. - args.outputs.sprites << [0, 0, 1280, 720, :gradient] + state.player.dx *= 0.9 # scales dx down + state.player.dy *= 0.9 # scales dy down - args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255] - tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)." + # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. + # This ensures that the player remains within the screen's scope. + state.player.x = state.player.x.lesser(1280).greater(0) + state.player.y = state.player.y.lesser(720).greater(0) # same with player's y + end + + # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection + # and added to the killed_zombies collection since any zombie that intersects with the player is killed. + def calc_kill_zombie + + # Find all zombies that intersect with the player. They are considered killed. + killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection + state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies + + if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame + state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed + # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) + end + + # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. + # Death_at stores the frame a zombie was killed. + killed_this_frame.each do |z| + z.death_at = state.tick_count + end + + # Zombies are rejected from the killed_zombies collection depending on when they were killed. + # They are rejected if more than 30 frames have passed since their death. + state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } + end + + # Uses input from the user to move the player around the screen. + def input + + # If the "a" key or left key is pressed, the x position of the player decreases. + # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. + if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left + state.player.x -= 5 + elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right + state.player.x += 5 + end + + # If the "w" or up key is pressed, the y position of the player increases. + # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. + if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up + state.player.y += 5 + elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down + state.player.y -= 5 + end + + # Sets the attack angle so the player can move and attack in the precise direction it wants to go. + # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). + # Attack angle also contributes to the position of red square. + if inputs.mouse.moved + state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] + end + + if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 + state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] + state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set + state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position + state.player.dy = state.player.attack_angle.vector_y(25) + end + end + + # Sets the zombie spawn's countdown to a random number. + # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) + def random_spawn_countdown minimum + 10.randomize(:ratio, :sign).to_i + 60 + end + + # Helps to iterate through the images in the sprites folder by setting the animation index. + # 3 frames is how long to show an image, and 6 is how many images to flip through. + def animation_index at + at.idiv(3).mod(6) + end + + # Animates the zombies by using the animation index to go through the images in the sprites folder. + def animation_sprite zombie, at = nil + at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created + index = animation_index at + "sprites/zombie-#{index}.png" # string interpolation to iterate through images + end + end + + $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new + + def tick args + $protect_the_puppies_from_the_zombies.grid = args.grid + $protect_the_puppies_from_the_zombies.inputs = args.inputs + $protect_the_puppies_from_the_zombies.state = args.state + $protect_the_puppies_from_the_zombies.outputs = args.outputs + $protect_the_puppies_from_the_zombies.tick + tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." end def tick_instructions args, text, y = 715 @@ -6911,93 +6804,237 @@ Follows is a source code listing for all files that have been open sourced. This args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end - - $gtk.reset #+end_src -* 07_advanced_rendering/02_render_targets_with_alphas/app/main.rb +* Mouse - Mouse Move Paint App - main.rb #+begin_src ruby - # This sample is meant to show you how to do that dripping transition thing - # at the start of the original Doom. Most of this file is here to animate - # a scene to wipe away; the actual wipe effect is in the last 20 lines or - # so. + # ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb + =begin - $gtk.reset # reset all game state if reloaded. + APIs listing that haven't been encountered in previous sample apps: - def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance - numblocks = 10 + - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. - for i in 1..numblocks do - angle = ((360 / numblocks) * i) + angleoffset - radians = angle * (Math::PI / 180) - x = (xoffset + (distance * Math.cos(radians))).round - y = (yoffset + (distance * Math.sin(radians))).round - pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ] + For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... + puts a.floor() + which would print out 13. + (There is also a ceil method, which returns an integer number greater than or equal to the original + with no decimal. If we had called ceil on the variable a, the result would have been 14.) + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to create a new button that clears the grid. + (Remember, you can use state to define ANY property and it will be retained across frames.) + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + + - args.outputs.labels: An array. The values in the array generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + + =end + + # This sample app shows an empty grid that the user can paint on. + # To paint, the user must keep their mouse presssed and drag it around the grid. + # The "clear" button allows users to clear the grid so they can start over. + + class PaintApp + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Runs methods necessary for the game to function properly. + def tick + print_title + add_grid + check_click + draw_buttons end - end - def draw_scene args, pass - pass.solids << [0, 360, 1280, 360, 0, 0, 200] - pass.solids << [0, 0, 1280, 360, 0, 127, 0] + # Prints the title onto the screen by using a label. + # Also separates the title from the grid with a line as a horizontal separator. + def print_title + args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] + outputs.lines << horizontal_separator(660, 0, 1280) + end - blocksize = 100 - angleoffset = args.state.tick_count * 2.5 - centerx = (1280 - blocksize) / 2 - centery = (720 - blocksize) / 2 + # Sets the starting position, ending position, and color for the horizontal separator. + # The starting and ending positions have the same y values. + def horizontal_separator y, x, x2 + [x, y, x2, y, 150, 150, 150] + end - circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500 - circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325 - circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200 - circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100 - end + # Sets the starting position, ending position, and color for the vertical separator. + # The starting and ending positions have the same x values. + def vertical_separator x, y, y2 + [x, y, x, y2, 150, 150, 150] + end - def tick args - segments = 160 + # Outputs a border and a grid containing empty squares onto the screen. + def add_grid - # On the first tick, initialize some stuff. - if !args.state.yoffsets - args.state.baseyoff = 0 - args.state.yoffsets = [] - for i in 0..segments do - args.state.yoffsets << rand * 100 + # Sets the x, y, height, and width of the grid. + # There are 31 horizontal lines and 31 vertical lines in the grid. + # Feel free to count them yourself before continuing! + x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center + lines_h = 31 + lines_v = 31 + + # Sets values for the grid's border, grid lines, and filled squares. + # The filled_squares variable is initially set to an empty array. + state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border + state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method + state.filled_squares ||= [] # there are no filled squares until the user fills them in + + # Outputs the grid lines, border, and filled squares onto the screen. + outputs.lines.concat state.grid_lines + outputs.borders << state.grid_border + outputs.solids << state.filled_squares + end + + # Draws the grid by adding in vertical and horizontal separators. + def draw_grid x, y, h, w, lines_h, lines_v + + # The grid starts off empty. + grid = [] + + # Calculates the placement and adds horizontal lines or separators into the grid. + curr_y = y # start at the bottom of the box + dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid + lines_h.times do + curr_y += dist_y # increment curr_y by the distance between the horizontal lines + grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid + end + + # Calculates the placement and adds vertical lines or separators into the grid. + curr_x = x # now start at the left of the box + dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid + lines_v.times do + curr_x += dist_x # increment curr_x by the distance between the vertical lines + grid << vertical_separator(curr_x, y + 1, y + h) # add separator end + + # paint_grid uses a hash to assign values to keys. + state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, + "lines_v" => lines_v, "dist_x" => dist_x, + "dist_y" => dist_y } + + return grid end - # Just draw some random stuff for a few seconds. - args.state.static_debounce ||= 60 * 2.5 - if args.state.static_debounce > 0 - last_frame = args.state.static_debounce == 1 - target = last_frame ? args.render_target(:last_frame) : args.outputs - draw_scene args, target - args.state.static_debounce -= 1 - return unless last_frame + # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. + # If the mouse is up, the user cannot drag the mouse. + def check_click + if inputs.mouse.down #is mouse up or down? + state.mouse_held = true # mouse is being held down + elsif inputs.mouse.up # if mouse is up + state.mouse_held = false # mouse is not being held down or dragged + state.mouse_dragging = false + end + + if state.mouse_held && # mouse needs to be down + !inputs.mouse.click && # must not be first click + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" + state.mouse_dragging = true + end + + # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click.point, :click) + + # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) + search_lines(inputs.mouse.position, :drag) + end end - # build up the wipe... + # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. + def search_lines (point, input_type) + point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash + point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash - # this is the thing we're wiping to. - args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ] + # Remove code following the .floor and see what happens when you try to fill in grid squares + point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] + point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] - return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding + point.x += state.paint_grid["x"] + point.y += state.paint_grid["y"] - segmentw = 1280 / segments + # Sets definition of a grid box, meaning its x, y, width, and height. + # Floor is called on the point.x and point.y variables. + # Ceil method is called on values of the distance hash keys, setting the width and height of a box. + grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] - x = 0 - for i in 0..segments do - yoffset = 0 - if args.state.yoffsets[i] < args.state.baseyoff - yoffset = args.state.baseyoff - args.state.yoffsets[i] + if input_type == :click # if user clicks their mouse + if state.filled_squares.include? grid_box # if grid box is already filled in + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + else + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares + end + elsif input_type == :drag # if user drags mouse + unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in + state.filled_squares << grid_box # the box is filled in and added to filled_squares + end end + end - # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment. - args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ] - x += segmentw + # Creates and outputs a "Clear" button on the screen using a label and a border. + # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. + def draw_buttons + x, y, w, h = 390, 50, 240, 50 + state.clear_button ||= state.new_entity(:button_with_fade) + + # The x and y positions are set to display the label in the center of the button. + # Try changing the first two parameters to simply x, y and see what happens to the text placement! + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border + state.clear_button.border ||= [x, y, w, h] + + # If the mouse is clicked inside the borders of the clear button, + # the filled_squares collection is emptied and the squares are cleared. + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred + state.filled_squares.clear + inputs.mouse.previous_click = nil + end + + outputs.labels << state.clear_button.label + outputs.borders << state.clear_button.border + + # When the clear button is clicked, the color of the button changes + # and the transparency changes, as well. If you change the time from + # 0.25.seconds to 1.25.seconds or more, the change will last longer. + if state.clear_button.clicked_at + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + end end + end - args.state.baseyoff += 4 + $paint_app = PaintApp.new - tick_instructions args, "Sample app shows an advanced usage of render_target." + def tick args + $paint_app.inputs = args.inputs + $paint_app.state = args.state + $paint_app.grid = args.grid + $paint_app.args = args + $paint_app.outputs = args.outputs + $paint_app.tick + tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." end def tick_instructions args, text, y = 715 @@ -7016,7913 +7053,6426 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 07_advanced_rendering/03_render_target_viewports/app/main.rb +* Mouse - Coordinate Systems - main.rb #+begin_src ruby + # ./samples/05_mouse/04_coordinate_systems/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: - - 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.) - - If you have a solar system and you're creating args.state.sun and setting its image path to an - image in the sprites folder, you would do the following: - (See samples/99_sample_nddnug_workshop for more details.) - - args.state.sun ||= args.state.new_entity(:sun) do |s| - s.path = 'sprites/sun.png' - end - - - 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. - - For example, if we have a variable - name = "Ruby" - then the line - puts "How are you, #{name}?" - would print "How are you, Ruby?" to the console. - (Remember, string interpolation only works with double quotes!) - - - Ternary operator (?): Similar to if statement; first evalulates whether a statement is - true or false, and then executes a command depending on that result. - For example, if we had a variable - grade = 75 - and used the ternary operator in the command - pass_or_fail = grade > 65 ? "pass" : "fail" - then the value of pass_or_fail would be "pass" since grade's value was greater than 65. + - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. + Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for + position to know the mouse's coordinates. + For more information about the mouse, go to mygame/documentation/07-mouse.md. Reminders: - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). - - - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction - by adding or subracting. - - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array - with at least four values is considered a rect. The inside_rect? function returns true - or false depending on if the point is inside the rect. + - args.inputs.mouse.click: This property will be set if the mouse was clicked. - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - - args.inputs.mouse.click: This property will be set if the mouse was clicked. - For more information about the mouse, go to mygame/documentation/07-mouse.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.inputs.keyboard.key_up.KEY: The value of the properties will be set - to the frame that the key_up event occurred (the frame correlates - to args.state.tick_count). - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + In this sample app, string interpolation is used to show the current position of the mouse + in a label. - - args.state.labels: - The parameters for a label are - 1. the position (x, y) - 2. the text - 3. the size - 4. the alignment - 5. the color (red, green, and blue saturations) - 6. the alpha (or transparency) + - args.outputs.labels: An array that generates a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] For more information about labels, go to mygame/documentation/02-labels.md. - - args.state.lines: - The parameters for a line are - 1. the starting position (x, y) - 2. the ending position (x2, y2) - 3. the color (red, green, and blue saturations) - 4. the alpha (or transparency) - For more information about lines, go to mygame/documentation/04-lines.md. + - args.outputs.solids: An array that generates a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - - args.state.solids (and args.state.borders): - The parameters for a solid (or border) are - 1. the position (x, y) - 2. the width (w) - 3. the height (h) - 4. the color (r, g, b) - 5. the alpha (or transparency) - For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + - args.outputs.lines: An array that generates a line. + The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] + For more information about lines, go to mygame/documentation/04-lines.md. - - args.state.sprites: - The parameters for a sprite are - 1. the position (x, y) - 2. the width (w) - 3. the height (h) - 4. the image path - 5. the angle - 6. the alpha (or transparency) - For more information about sprites, go to mygame/documentation/05-sprites.md. =end - # This sample app shows different objects that can be used when making games, such as labels, - # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used. - - # Also note that state.tick_count refers to the passage of time, or current frame. + # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the + # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or + # four quadrants by pressing the button. - class TechDemo - attr_accessor :inputs, :state, :outputs, :grid, :args + def tick args - # Calls all methods necessary for the app to run properly. - def tick - labels_tech_demo - lines_tech_demo - solids_tech_demo - borders_tech_demo - sprites_tech_demo - keyboards_tech_demo - controller_tech_demo - mouse_tech_demo - point_to_rect_tech_demo - rect_to_rect_tech_demo - button_tech_demo - export_game_state_demo - window_state_demo - render_seperators - end + # The addition and subtraction in the first two parameters of the label and solid + # ensure that the outputs don't overlap each other. Try removing them and see what happens. + pos = args.inputs.mouse.position # stores coordinates of mouse's position + args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates + args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering - # Shows output of different kinds of labels on the screen - def labels_tech_demo - outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."] - outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."] - outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"] - outputs.labels << [ 5, 660, "Smaller label.", -2] - outputs.labels << [ 5, 630, "Small label.", -1] - outputs.labels << [ 5, 600, "Medium label.", 0] - outputs.labels << [ 5, 570, "Large label.", 1] - outputs.labels << [ 5, 540, "Larger label.", 2] - outputs.labels << [300, 660, "Left aligned.", 0, 2] - outputs.labels << [300, 640, "Center aligned.", 0, 1] - outputs.labels << [300, 620, "Right aligned.", 0, 0] - outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0] - outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0] - outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255] - outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128] - end + button = [0, 0, 370, 50] # sets definition of toggle button + args.outputs.borders << button # outputs button as border (not filled in) + args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button + args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants + args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants - # Shows output of lines on the screen - def lines_tech_demo - outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"] - outputs.lines << [5, 450, 100, 450] - outputs.lines << [5, 430, 300, 430] - outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes - outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes - outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes + if args.inputs.mouse.click # if the user clicks the mouse + pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) + if pos.inside_rect? button # if the click occurred inside the button + if args.grid.name == :bottom_left # if the grid shows bottom left as origin + args.grid.origin_center! # origin will be shown in center + else + args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin + end + end end - # Shows output of different kinds of solids on the screen - def solids_tech_demo - outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"] - outputs.solids << [ 10, 270, 50, 50] - outputs.solids << [ 70, 270, 50, 50, 0, 0, 0] - outputs.solids << [130, 270, 50, 50, 255, 0, 0] - outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128] - outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes - end + tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." + end - # Shows output of different kinds of borders on the screen - # The parameters for a border are the same as the parameters for a solid - def borders_tech_demo - outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"] - outputs.borders << [ 10, 180, 50, 50] - outputs.borders << [ 70, 180, 50, 50, 0, 0, 0] - outputs.borders << [130, 180, 50, 50, 255, 0, 0] - outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128] - outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true end - # Shows output of different kinds of sprites on the screen - def sprites_tech_demo - outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"] - outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png'] - outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes - outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes - end + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end + +#+end_src + +* Save Load - Save Load Game - main.rb +#+begin_src ruby + # ./samples/06_save_load/01_save_load_game/app/main.rb + =begin - # Holds size, alignment, color (black), and alpha (transparency) parameters - # Using small_font as a parameter accounts for all remaining parameters - # so they don't have to be repeatedly typed - def small_font - [-2, 0, 0, 0, 0, 255] - end + APIs listing that haven't been encountered in previous sample apps: - # Sets position of each row - # Converts given row value to pixels that DragonRuby understands - def row_to_px row_number + - 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. - # Row 0 starts 5 units below the top of the grid. - # Each row afterward is 20 units lower. - grid.top.shift_down(5).shift_down(20 * row_number) - end + In this sample app, we're using symbols for our buttons. We have buttons that + light fires, save, load, etc. Each of these buttons has a distinct symbol like + :light_fire, :save_game, :load_game, etc. - # Uses labels to output current game time (passage of time), and whether or not "h" was pressed - # If "h" is pressed, the frame is output when the key_up event occurred - def keyboards_tech_demo - outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font] - outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font] - outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font] + - to_sym: Returns the symbol corresponding to the given string; creates the symbol + if it does not already exist. + For example, + 'car'.to_sym + would return the symbol :car. - if inputs.keyboard.key_up.h # if "h" key_up event occurs - state.h_pressed_at = state.tick_count # frame it occurred is stored - end + - last: Returns the last element of an array. - # h_pressed_at is initially set to false, and changes once the user presses the "h" key. - state.h_pressed_at ||= false + Reminders: - if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false) - outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font] - else # otherwise, label says "h" was never pressed - outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font] - end + - num1.lesser(num2): finds the lower value of the given options. + For example, in the statement + a = 4.lesser(3) + 3 has a lower value than 4, which means that the value of a would be set to 3, + but if the statement had been + a = 4.lesser(5) + 4 has a lower value than 5, which means that the value of a would be set to 4. - # border around keyboard input demo section - outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)] - end - - # Sets definition for a small label - # Makes it easier to position labels in respect to the position of other labels - def small_label x, row, message - [x, row_to_px(row), message, small_font] - end + - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 - # Uses small labels to show whether the "a" button on the controller is down, held, or up. - # y value of each small label is set by calling the row_to_px method - def controller_tech_demo - x = 460 - outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one") - outputs.labels << small_label(x, 7, "Current state of the \"a\" button.") - outputs.labels << small_label(x, 8, "Check console window for more info.") + - 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. - if inputs.controller_one.key_down.a # if "a" is in "down" state - outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}") - puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred - elsif inputs.controller_one.key_held.a # if "a" is held down - outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}") - elsif inputs.controller_one.key_up.a # if "a" is in up state - outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}") - puts "\"a\" key up at #{inputs.controller_one.key_up.a}" - else # if no event has occurred - outputs.labels << small_label(x, 9, "\"a\" button state is nil.") - end + - args.outputs.labels: An array. Values generate a label. + Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information, go to mygame/documentation/02-labels.md. - # border around controller input demo section - outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)] - end + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. - # Outputs when the mouse was clicked, as well as the coordinates on the screen - # of where the click occurred - def mouse_tech_demo - x = 460 + =end - outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse") + # This code allows users to perform different tasks, such as saving and loading the game. + # Users also have options to reset the game and light a fire. - if inputs.mouse.click # if click has a value and is not nil - state.last_mouse_click = inputs.mouse.click # coordinates of click are stored - end + class TextedBasedGame - if state.last_mouse_click # if mouse is clicked (has coordinates as value) - # outputs the time (frame) the click occurred, as well as how many frames have passed since the event - outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}") - # outputs coordinates of click - outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}") - else # otherwise if the mouse has not been clicked - outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.") - outputs.labels << small_label(x, 13, "Please click mouse.") - end + # Contains methods needed for game to run properly. + # Increments tick count by 1 each time it runs (60 times in a single second) + def tick + default + show_intro + state.engine_tick_count += 1 + tick_fire end - # Outputs whether a mouse click occurred inside or outside of a box - def point_to_rect_tech_demo - x = 460 - - outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->") - - box = [765, 370, 50, 50, 0, 0, 170] # blue box - outputs.borders << box - - if state.last_mouse_click # if the mouse was clicked - if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box - outputs.labels << small_label(x, 16, "Mouse click happened inside the box.") - else # otherwise, if mouse was clicked outside the box - outputs.labels << small_label(x, 16, "Mouse click happened outside the box.") - end - else # otherwise, if was not clicked at all - outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked - end - - # border around mouse input demo section - outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)] + # Sets default values. + # The ||= ensures that a variable's value is only set to the value following the = sign + # if the value has not already been set before. Intialization happens only in the first frame. + def default + state.engine_tick_count ||= 0 + state.active_module ||= :room + state.fire_progress ||= 0 + state.fire_ready_in ||= 10 + state.previous_fire ||= :dead + state.fire ||= :dead end - # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output - # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not - # they intersect. - def rect_to_rect_tech_demo - x = 460 - - outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions - red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box - outputs.borders << red_box # output as a border (not filled in) + def show_intro + return unless state.engine_tick_count == 0 # return unless the game just started + set_story_line "awake." # calls set_story_line method, sets to "awake" + end - # If the mouse is clicked inside the red box, two collision boxes are created. - if inputs.mouse.click - if inputs.mouse.click.point.inside_rect? red_box - if !state.box_collision_one # if the collision_one box does not yet have a definition - # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box. - # You can try deleting the subtraction to see how it impacts the box placement. - state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition - elsif !state.box_collision_two # if collision_two does not yet have a definition - state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition - else - state.box_collision_one = nil # both boxes are empty - state.box_collision_two = nil - end - end - end + # Sets story line. + def set_story_line story_line + state.story_line = story_line # story line set to value of parameter + state.active_module = :alert # active module set to alert + end - # If collision boxes exist, they are output onto screen inside the red box as solids - if state.box_collision_one - outputs.solids << state.box_collision_one - end + # Clears story line. + def clear_storyline + state.active_module = :none # active module set to none + state.story_line = nil # story line is cleared, set to nil (or empty) + end - if state.box_collision_two - outputs.solids << state.box_collision_two - end + # Determines fire progress (how close the fire is to being ready to light). + def tick_fire + return if state.active_module == :alert # return if active module is alert + state.fire_progress += 1 # increment fire progress + # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. + state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) + end - # Outputs whether or not the two collision boxes intersect. - if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty) - if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect - outputs.labels << small_label(x, 23.5, 'The boxes intersect.') - else # otherwise, if the two boxes do not intersect - outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.') - end - else - outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output + # Sets the value of fire (whether it is dead or roaring), and the story line + def light_fire + return unless fire_ready? # returns unless the fire is ready to be lit + state.fire = :roaring # fire is lit, set to roaring + state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit + if state.fire != state.previous_fire + set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation + state.previous_fire = state.fire end end - # Creates a button and outputs it onto the screen using labels and borders. - # If the button is clicked, the color changes to make it look faded. - def button_tech_demo - x, y, w, h = 460, 160, 300, 50 - state.button ||= state.new_entity(:button_with_fade) + # Checks if the fire is ready to be lit. Returns a boolean value. + def fire_ready? + # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), + # the fire is ready to be lit. + state.fire_progress == state.fire_ready_in + end - # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders. - state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1] - state.button.border ||= [x, y, w, h] + # Divides the value of the fire_progress variable by 10 to determine how close the user is to + # being able to light a fire. + def light_fire_progress + state.fire_progress.fdiv(10) # float division + end - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border - state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred - end + # Defines fire as the state.fire variable. + def fire + state.fire + end - outputs.labels << state.button.label - outputs.borders << state.button.border + # Sets the title of the room. + def room_title + return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead + return "a room that is lit" # room is lit if the fire is not dead + end - if state.button.clicked_at # if button was clicked (variable has a value and is not nil) + # Sets the active_module to room. + def go_to_room + state.active_module = :room + end - # The appearance of the button changes for 0.25 seconds after the time the button is clicked at. - # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes. - # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal. - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)] - end + # Defines active_module as the state.active_module variable. + def active_module + state.active_module end - # Creates a new button by declaring it as a new entity, and sets values. - def new_button_prefab x, y, message - w, h = 300, 50 - button = state.new_entity(:button_with_fade) - button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders - button.border = [x, y, w, h] # sets border definition - button + # Defines story_line as the state.story_line variable. + def story_line + state.story_line end - # If the mouse has been clicked and the click's location is inside of the button's border, that means - # that the button has been clicked. This method returns a boolean value. - def button_clicked? button - inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border) + # Update every 60 frames (or every second) + def should_tick? + state.tick_count.mod_zero?(60) end - # Determines if button was clicked, and changes its appearance if it is clicked - def tick_button_prefab button - outputs.labels << button.label # outputs button's label and border - outputs.borders << button.border + # Sets the value of the game state provider. + def initialize game_state_provider + @game_state_provider = game_state_provider + end - if button_clicked? button # if button is clicked - button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked - end + # Defines the game state. + # Any variable prefixed with an @ symbol is an instance variable. + def state + @game_state_provider.state + end - if button.clicked_at # if clicked_at has a frame value and is not nil - # button is output; color changes and transparency changes for 0.25 seconds after click occurs - outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h, - 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds - end + # Saves the state of the game in a text file called game_state.txt. + def save + $gtk.serialize_state('game_state.txt', state) end - # Exports the app's game state if the export button is clicked. - def export_game_state_demo - state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state") - tick_button_prefab(state.export_game_state_button) # calls method to output button - if button_clicked? state.export_game_state_button # if the export button is clicked - args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs + # Loads the game state from the game_state.txt text file. + # If the load is unsuccessful, the user is informed since the story line indicates the failure. + def load + parsed_state = $gtk.deserialize_state('game_state.txt') + if !parsed_state + set_story_line "no game to load. press save first." + else + $gtk.args.state = parsed_state end end - # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window. - def window_state_demo - m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement) - k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N' - outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font] + # Resets the game. + def reset + $gtk.reset end + end - #Sets values for the horizontal separator (divides demo sections) - def horizontal_seperator y, x, x2 - [x, y, x2, y, 150, 150, 150] - end + class TextedBasedGamePresenter + attr_accessor :state, :outputs, :inputs - #Sets the values for the vertical separator (divides demo sections) - def vertical_seperator x, y, y2 - [x, y, x, y2, 150, 150, 150] + # Creates empty collection called highlights. + # Calls methods necessary to run the game. + def tick + state.layout.highlights ||= [] + game.tick if game.should_tick? + render + process_input end - # Outputs vertical and horizontal separators onto the screen to separate each demo section. - def render_seperators - outputs.lines << horizontal_seperator(505, grid.left, 445) - outputs.lines << horizontal_seperator(353, grid.left, 445) - outputs.lines << horizontal_seperator(264, grid.left, 445) - outputs.lines << horizontal_seperator(174, grid.left, 445) - - outputs.lines << vertical_seperator(445, grid.top, grid.bottom) + # Outputs a label of the tick count (passage of time) and calls all render methods. + def render + outputs.labels << [10, 30, state.tick_count] + render_alert + render_room + render_highlights + end - outputs.lines << horizontal_seperator(690, 445, 820) - outputs.lines << horizontal_seperator(426, 445, 820) + # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. + def render_alert + return unless game.active_module == :alert - outputs.lines << vertical_seperator(820, grid.top, grid.bottom) + outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label + outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line end - end - $tech_demo = TechDemo.new + def render_room + return unless game.active_module == :room + outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen - def tick args - $tech_demo.inputs = args.inputs - $tech_demo.state = args.state - $tech_demo.grid = args.grid - $tech_demo.args = args - $tech_demo.outputs = args.render_target(:mini_map) - $tech_demo.tick - args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]] - args.outputs.sprites << [0, 0, 1280, 720, :mini_map] - args.outputs.sprites << [830, 300, 675, 379, :mini_map] - tick_instructions args, "Sample app shows all the rendering apis available." - end + # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value + # that positions it 60 pixels lower than the previous output. - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true + # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) + outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) + outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button + outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button + outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button + outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen end - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label - end - -#+end_src - -* 07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb -#+begin_src ruby - =begin + # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. + def render_highlights + state.layout.highlights.each do |h| # for each highlight in the collection + h.lifetime -= 1 # decrease the value of its lifetime + end - APIs listing that haven't been encountered in previous sample apps: + outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection + [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight + # transparency changes; divide lifetime by max_lifetime, multiply result by 255 + end - - Nested array: An array whose individual elements are also arrays; useful for - storing groups of similar data. Also called multidimensional arrays. + # reject highlights from collection that have no remaining lifetime + state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } + end - In this sample app, we see nested arrays being used in object definitions. - Notice the parameters for solids, listed below. Parameters 1-3 set the - definition for the rect, and parameter 4 sets the definition of the color. + # Checks whether or not a button was clicked. + # Returns a boolean value. + def process_input + button = button_clicked? # calls button_clicked? method + end - Instead of having a solid definition that looks like this, - [X, Y, W, H, R, G, B] - we can separate it into two separate array definitions in one, like this - [[X, Y, W, H], [R, G, B]] - and both options work fine in defining our solid (or any object). + # Returns a boolean value. + # Finds the button that was clicked from the button list and determines what method to call. + # Adds a highlight to the highlights collection. + def button_clicked? + return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click + button = @button_list.find do |k, v| # goes through button_list to find button clicked + click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? + end + return unless button # return unless a button was clicked + method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) + if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) + border = button[1][:primitives].last # sets border definition using value of last key in button list hash - - Collections: Lists of data; useful for organizing large amounts of data. - One element of a collection could be an array (which itself contains many elements). - For example, a collection that stores two solid objects would look like this: - [ - [100, 100, 50, 50, 0, 0, 0], - [100, 150, 50, 50, 255, 255, 255] - ] - If this collection was added to args.outputs.solids, two solids would be output - next to each other, one black and one white. - Nested arrays can be used in collections, as you will see in this sample app. + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 10 + h.lifetime = h.max_lifetime + h.color = [120, 120, 180] # sets color to shade of purple + end - Reminders: + self.send method_to_call # invoke method identified by symbol + else # otherwise, if self doesn't respond to given method + border = button[1][:primitives].last # sets border definition using value of last key in hash - - args.outputs.solids: An array. The values generate a solid. - The parameters for a solid are - 1. The position on the screen (x, y) - 2. The width (w) - 3. The height (h) - 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black) - NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS! + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true + h.lifetime = h.max_lifetime + h.color = [120, 80, 80] # sets color to dark color + end - Here is an example of a (red) border or solid definition: - [100, 100, 400, 500, 255, 0, 0] - It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders. - For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + # instructions for users on how to add the missing method_to_call to the code + puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" + puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." + puts "" + puts "```" + puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" + puts "" + puts " def #{method_to_call}" + puts " puts 'Yay that worked!'" + puts " end" + puts "" + puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." + puts "```" + puts "" + end + end - - args.outputs.sprites: An array. The values generate a sprite. - The parameters for sprites are - 1. The position on the screen (x, y) - 2. The width (w) - 3. The height (h) - 4. The image path (p) + # Returns the position of the mouse when it is clicked. + def click_pos + return nil unless inputs.mouse.click # returns nil unless the mouse was clicked + return inputs.mouse.click.point # returns location of mouse click (coordinates) + end - Here is an example of a sprite definition: - [100, 100, 400, 500, 'sprites/dragonruby.png'] - For more information about sprites, go to mygame/documentation/05-sprites.md. + # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) + def button id, x, y, text + @button_list[id] ||= { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x + 10, y + 30, text, 2, 0].label, # positions label inside border + [x, y, 300, 50].border, # sets definition of border + ] + } - =end + @button_list[id][:primitives] # returns label and border for buttons + end - # This code demonstrates the creation and output of objects like sprites, borders, and solids - # If filled in, they are solids - # If hollow, they are borders - # If images, they are sprites + # Creates a progress bar (used for lighting the fire) and sets its values. + def progress_bar id, x, y, text, percentage + @button_list[id] = { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) + [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border + [x, y, 300, 50].border, # sets definition of border + ] + } - # Solids are added to args.outputs.solids - # Borders are added to args.outputs.borders - # Sprites are added to args.outputs.sprites + # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by + # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. + @button_list[id][:primitives][0][2] = 300 * percentage + @button_list[id][:primitives] + end - # The tick method runs 60 frames every second. - # Your game is going to happen under this one function. - def tick args - border_as_solid_and_solid_as_border args - sprite_as_border_or_solids args - collection_of_borders_and_solids args - collection_of_sprites args - end + # Defines the game. + def game + @game + end - # Shows a border being output onto the screen as a border and a solid - # Also shows how colors can be set - def border_as_solid_and_solid_as_border args - border = [0, 0, 50, 50] - args.outputs.borders << border - args.outputs.solids << border + # Initalizes the game and creates an empty list of buttons. + def initialize + @game = TextedBasedGame.new self + @button_list ||= {} + end - # Red, green, blue saturations (last three parameters) can be any number between 0 and 255 - border_with_color = [0, 100, 50, 50, 255, 0, 0] - args.outputs.borders << border_with_color - args.outputs.solids << border_with_color + # Clears the storyline and takes the user to the room. + def alert_dismiss_clicked + game.clear_storyline + game.go_to_room + end - border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color - args.outputs.borders << border_with_nested_color - args.outputs.solids << border_with_nested_color + # Lights the fire when the user clicks the "light fire" option. + def light_fire_clicked + game.light_fire + end - border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect - args.outputs.borders << border_with_nested_rect - args.outputs.solids << border_with_nested_rect + # Saves the game when the user clicks the "save" option. + def save_game_clicked + game.save + end - border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color - args.outputs.borders << border_with_nested_color_and_rect - args.outputs.solids << border_with_nested_color_and_rect - end + # Resets the game when the user clicks the "reset" option. + def reset_game_clicked + game.reset + end - # Shows a sprite output onto the screen as a sprite, border, and solid - # Demonstrates that all three outputs appear differently on screen - def sprite_as_border_or_solids args - sprite = [100, 0, 50, 50, 'sprites/ship.png'] - args.outputs.sprites << sprite + # Loads the game when the user clicks the "load" option. + def load_game_clicked + game.load + end + end - # Sprite_as_border variable has same parameters (excluding position) as above object, - # but will appear differently on screen because it is added to args.outputs.borders - sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png'] - args.outputs.borders << sprite_as_border + $text_based_rpg = TextedBasedGamePresenter.new - # Sprite_as_solid variable has same parameters (excluding position) as above object, - # but will appear differently on screen because it is added to args.outputs.solids - sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png'] - args.outputs.solids << sprite_as_solid + def tick args + $text_based_rpg.state = args.state + $text_based_rpg.outputs = args.outputs + $text_based_rpg.inputs = args.inputs + $text_based_rpg.tick end + +#+end_src + +* Advanced Rendering - Simple Render Targets - main.rb +#+begin_src ruby + # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb + def tick args + # args.outputs.render_targets are really really powerful. + # They essentially allow you to create a sprite programmatically and cache the result. - # Holds and outputs a collection of borders and a collection of solids - # Collections are created by using arrays to hold parameters of each individual object - def collection_of_borders_and_solids args - collection_borders = [ - [ - [200, 0, 50, 50], # black border - [200, 100, 50, 50, 255, 0, 0], # red border - [200, 200, 50, 50, [0, 255, 0]], # nested color - ], - [[200, 300, 50, 50], 0, 0, 255], # nested rect - [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color - ] - - args.outputs.borders << collection_borders + # Create a render_target of a :block and a :gradient on tick zero. + if args.state.tick_count == 0 + args.render_target(:block).solids << [0, 0, 1280, 100] - collection_solids = [ - [ - [[300, 300, 50, 50], 0, 0, 255], # nested rect - [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color - ], - [300, 0, 50, 50], - [300, 100, 50, 50, 255, 0, 0], - [300, 200, 50, 50, [0, 255, 0]], # nested color - ] + # The gradient is actually just a collection of black solids with increasing + # opacities. + args.render_target(:gradient).solids << 90.map_with_index do |x| + 50.map_with_index do |y| + [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255] + end + end + end - args.outputs.solids << collection_solids - end + # Take the :block render_target and present it horizontally centered. + # Use a subsection of the render_targetd specified by source_x, + # source_y, source_w, source_h. + args.outputs.sprites << { x: 0, + y: 310, + w: 1280, + h: 100, + path: :block, + source_x: 0, + source_y: 0, + source_w: 1280, + source_h: 100 } - # Holds and outputs a collection of sprites by adding it to args.outputs.sprites - # Also outputs a collection with same parameters (excluding position) by adding - # it to args.outputs.solids and another to args.outputs.borders - def collection_of_sprites args - sprites_collection = [ - [ - [400, 0, 50, 50, 'sprites/ship.png'], - [400, 100, 50, 50, 'sprites/ship.png'], - ], - [400, 200, 50, 50, 'sprites/ship.png'] - ] + # After rendering :block, render gradient on top of :block. + args.outputs.sprites << [0, 0, 1280, 720, :gradient] - args.outputs.sprites << sprites_collection + args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255] + tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)." + end - args.outputs.solids << [ - [500, 0, 50, 50, 'sprites/ship.png'], - [500, 100, 50, 50, 'sprites/ship.png'], - [[[500, 200, 50, 50, 'sprites/ship.png']]] - ] + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end - args.outputs.borders << [ - [ - [600, 0, 50, 50, 'sprites/ship.png'], - [600, 100, 50, 50, 'sprites/ship.png'], - ], - [600, 200, 50, 50, 'sprites/ship.png'] - ] + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end + + $gtk.reset #+end_src -* 07_advanced_rendering/11_render_primitives_as_hash/app/main.rb +* Advanced Rendering - Render Targets With Alphas - main.rb #+begin_src ruby - =begin + # ./samples/07_advanced_rendering/02_render_targets_with_alphas/app/main.rb + # This sample is meant to show you how to do that dripping transition thing + # at the start of the original Doom. Most of this file is here to animate + # a scene to wipe away; the actual wipe effect is in the last 20 lines or + # so. - Reminders: + $gtk.reset # reset all game state if reloaded. - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. + def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance + numblocks = 10 - For example, if we have a "numbers" hash that stores numbers in English as the - key and numbers in Spanish as the value, we'd have a hash that looks like this... - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } - and on it goes. + for i in 1..numblocks do + angle = ((360 / numblocks) * i) + angleoffset + radians = angle * (Math::PI / 180) + x = (xoffset + (distance * Math.cos(radians))).round + y = (yoffset + (distance * Math.sin(radians))).round + pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ] + end + end - Now if we wanted to find the corresponding value of the "one" key, we could say - puts numbers["one"] - which would print "uno" to the console. + def draw_scene args, pass + pass.solids << [0, 360, 1280, 360, 0, 0, 200] + pass.solids << [0, 0, 1280, 360, 0, 127, 0] - - args.outputs.sprites: An array. The values generate a sprite. - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] - For more information about sprites, go to mygame/documentation/05-sprites.md. + blocksize = 100 + angleoffset = args.state.tick_count * 2.5 + centerx = (1280 - blocksize) / 2 + centery = (720 - blocksize) / 2 - - 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. + circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100 + end - - args.outputs.solids: An array. The values generate a solid. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + def tick args + segments = 160 - - args.outputs.borders: An array. The values generate a border. - The parameters are the same as a solid. - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + # On the first tick, initialize some stuff. + if !args.state.yoffsets + args.state.baseyoff = 0 + args.state.yoffsets = [] + for i in 0..segments do + args.state.yoffsets << rand * 100 + end + end - - args.outputs.lines: An array. The values generate a line. - The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] - For more information about labels, go to mygame/documentation/02-labels.md. + # Just draw some random stuff for a few seconds. + args.state.static_debounce ||= 60 * 2.5 + if args.state.static_debounce > 0 + last_frame = args.state.static_debounce == 1 + target = last_frame ? args.render_target(:last_frame) : args.outputs + draw_scene args, target + args.state.static_debounce -= 1 + return unless last_frame + end - =end + # build up the wipe... - # This sample app demonstrates how hashes can be used to output different kinds of objects. + # this is the thing we're wiping to. + args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ] - def tick args - args.state.angle ||= 0 # initializes angle to 0 - args.state.angle += 1 # increments angle by 1 every frame (60 times a second) + return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding - # Outputs sprite using a hash - args.outputs.sprites << { - x: 30, # sprite position - y: 550, - w: 128, # sprite size - h: 101, - path: "dragonruby.png", # image path - angle: args.state.angle, # angle - a: 255, # alpha (transparency) - r: 255, # color saturation - g: 255, - b: 255, - tile_x: 0, # sprite sub division/tile - tile_y: 0, - tile_w: -1, - tile_h: -1, - flip_vertically: false, # don't flip sprite - flip_horizontally: false, - angle_anchor_x: 0.5, # rotation center set to middle - angle_anchor_y: 0.5 - } - - # Outputs label using a hash - args.outputs.labels << { - x: 200, # label position - y: 550, - text: "dragonruby", # label text - size_enum: 2, - alignment_enum: 1, - r: 155, # color saturation - g: 50, - b: 50, - a: 255, # transparency - font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly - } - - # Outputs solid using a hash - # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] - args.outputs.solids << { - x: 400, # position - y: 550, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - } - - # Outputs border using a hash - # Same parameters as a solid - args.outputs.borders << { - x: 600, - y: 550, - w: 160, - h: 90, - r: 120, - g: 50, - b: 50, - a: 255 - } + segmentw = 1280 / segments - # Outputs line using a hash - args.outputs.lines << { - x: 900, # starting position - y: 550, - x2: 1200, # ending position - y2: 550, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - } + x = 0 + for i in 0..segments do + yoffset = 0 + if args.state.yoffsets[i] < args.state.baseyoff + yoffset = args.state.baseyoff - args.state.yoffsets[i] + end - # Outputs sprite as a primitive using a hash - args.outputs.primitives << { - x: 30, # position - y: 200, - w: 128, # size - h: 101, - path: "dragonruby.png", # image path - angle: args.state.angle, # angle - a: 255, # transparency - r: 255, # color saturation - g: 255, - b: 255, - tile_x: 0, # sprite sub division/tile - tile_y: 0, - tile_w: -1, - tile_h: -1, - flip_vertically: false, # don't flip - flip_horizontally: false, - angle_anchor_x: 0.5, # rotation center set to middle - angle_anchor_y: 0.5 - }.sprite + # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment. + args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ] + x += segmentw + end - # Outputs label as primitive using a hash - args.outputs.primitives << { - x: 200, # position - y: 200, - text: "dragonruby", # text - size: 2, - alignment: 1, - r: 155, # color saturation - g: 50, - b: 50, - a: 255, # transparency - font: "fonts/manaspc.ttf" # font style - }.label + args.state.baseyoff += 4 - # Outputs solid as primitive using a hash - args.outputs.primitives << { - x: 400, # position - y: 200, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.solid + tick_instructions args, "Sample app shows an advanced usage of render_target." + end - # Outputs border as primitive using a hash - # Same parameters as solid - args.outputs.primitives << { - x: 600, # position - y: 200, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.border + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end - # Outputs line as primitive using a hash - args.outputs.primitives << { - x: 900, # starting position - y: 200, - x2: 1200, # ending position - y2: 200, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.line + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end #+end_src -* 08_lerping_easing_functions/01_easing_functions/app/main.rb +* Advanced Rendering - Render Target Viewports - main.rb #+begin_src ruby - def tick args - # STOP! Watch the following presentation first!!!! - # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations - # https://www.youtube.com/watch?v=mr5xkf6zSzk + # ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb + =begin - # You've watched the talk, yes? YES??? + APIs listing that haven't been encountered in previous sample apps: - # define starting and ending points of properties to animate - args.state.target_x = 1180 - args.state.target_y = 620 - args.state.target_w = 100 - args.state.target_h = 100 - args.state.starting_x = 0 - args.state.starting_y = 0 - args.state.starting_w = 300 - args.state.starting_h = 300 + - 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.) - # define start time and duration of animation - args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) - args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) + If you have a solar system and you're creating args.state.sun and setting its image path to an + image in the sprites folder, you would do the following: + (See samples/99_sample_nddnug_workshop for more details.) - # define type of animations - # Here are all the options you have for values you can put in the array: - # :identity, :quad, :cube, :quart, :quint, :flip + args.state.sun ||= args.state.new_entity(:sun) do |s| + s.path = 'sprites/sun.png' + end - # Linear is defined as: - # [:identity] - # - # Smooth start variations are: - # [:quad] - # [:cube] - # [:quart] - # [:quint] + - 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. - # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: - # [:flip, :identity] - # [:flip, :quad, :flip] - # [:flip, :cube, :flip] - # [:flip, :quart, :flip] - # [:flip, :quint, :flip] + For example, if we have a variable + name = "Ruby" + then the line + puts "How are you, #{name}?" + would print "How are you, Ruby?" to the console. + (Remember, string interpolation only works with double quotes!) - # You can also do custom definitions. See the bottom of the file details - # on how to do that. I've defined a couple for you: - # [:smoothest_start] - # [:smoothest_stop] + - Ternary operator (?): Similar to if statement; first evalulates whether a statement is + true or false, and then executes a command depending on that result. + For example, if we had a variable + grade = 75 + and used the ternary operator in the command + pass_or_fail = grade > 65 ? "pass" : "fail" + then the value of pass_or_fail would be "pass" since grade's value was greater than 65. - # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS - args.state.animation_type = [:identity] - # args.state.animation_type = [:quad] - # args.state.animation_type = [:cube] - # args.state.animation_type = [:quart] - # args.state.animation_type = [:quint] - # args.state.animation_type = [:flip, :identity] - # args.state.animation_type = [:flip, :quad, :flip] - # args.state.animation_type = [:flip, :cube, :flip] - # args.state.animation_type = [:flip, :quart, :flip] - # args.state.animation_type = [:flip, :quint, :flip] - # args.state.animation_type = [:smoothest_start] - # args.state.animation_type = [:smoothest_stop] + Reminders: - # THIS IS WHERE THE MAGIC HAPPENS! - # Numeric#ease - progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). - # Numeric#ease needs to called: - # 1. On the number that represents the point in time you want to start, and takes two parameters: - # a. The first parameter is how long the animation should take. - # b. The second parameter represents the functions that need to be called. - # - # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, - # and I want to animation to start fast and end slow, I would do: - # (60 * 3).ease(60 * 10, :flip, :quint, :flip) + - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction + by adding or subracting. - # initial value delta to the final value - calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress - calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress - calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress - calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. - args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. - # count down - count_down = args.state.start_animate_at - args.state.tick_count - if count_down > 0 - args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] - args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] - elsif progress >= 1 - args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] - if args.inputs.click - $gtk.reset - end - end - end + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + For more information about the mouse, go to mygame/documentation/07-mouse.md. - # $gtk.reset + - args.inputs.keyboard.key_up.KEY: The value of the properties will be set + to the frame that the key_up event occurred (the frame correlates + to args.state.tick_count). + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - # you can make own variations of animations using this - module Easing - # you have access to all the built in functions: identity, flip, quad, cube, quart, quint - def self.smoothest_start x - quad(quint(x)) - end + - args.state.labels: + The parameters for a label are + 1. the position (x, y) + 2. the text + 3. the size + 4. the alignment + 5. the color (red, green, and blue saturations) + 6. the alpha (or transparency) + For more information about labels, go to mygame/documentation/02-labels.md. - def self.smoothest_stop x - flip(quad(quint(flip(x)))) + - args.state.lines: + The parameters for a line are + 1. the starting position (x, y) + 2. the ending position (x2, y2) + 3. the color (red, green, and blue saturations) + 4. the alpha (or transparency) + For more information about lines, go to mygame/documentation/04-lines.md. + + - args.state.solids (and args.state.borders): + The parameters for a solid (or border) are + 1. the position (x, y) + 2. the width (w) + 3. the height (h) + 4. the color (r, g, b) + 5. the alpha (or transparency) + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.state.sprites: + The parameters for a sprite are + 1. the position (x, y) + 2. the width (w) + 3. the height (h) + 4. the image path + 5. the angle + 6. the alpha (or transparency) + For more information about sprites, go to mygame/documentation/05-sprites.md. + =end + + # This sample app shows different objects that can be used when making games, such as labels, + # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used. + + # Also note that state.tick_count refers to the passage of time, or current frame. + + class TechDemo + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Calls all methods necessary for the app to run properly. + def tick + labels_tech_demo + lines_tech_demo + solids_tech_demo + borders_tech_demo + sprites_tech_demo + keyboards_tech_demo + controller_tech_demo + mouse_tech_demo + point_to_rect_tech_demo + rect_to_rect_tech_demo + button_tech_demo + export_game_state_demo + window_state_demo + render_seperators end - # this is the source for the existing easing functions - def self.identity x - x + # Shows output of different kinds of labels on the screen + def labels_tech_demo + outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."] + outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."] + outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"] + outputs.labels << [ 5, 660, "Smaller label.", -2] + outputs.labels << [ 5, 630, "Small label.", -1] + outputs.labels << [ 5, 600, "Medium label.", 0] + outputs.labels << [ 5, 570, "Large label.", 1] + outputs.labels << [ 5, 540, "Larger label.", 2] + outputs.labels << [300, 660, "Left aligned.", 0, 2] + outputs.labels << [300, 640, "Center aligned.", 0, 1] + outputs.labels << [300, 620, "Right aligned.", 0, 0] + outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0] + outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0] + outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255] + outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128] end - def self.flip x - 1 - x + # Shows output of lines on the screen + def lines_tech_demo + outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"] + outputs.lines << [5, 450, 100, 450] + outputs.lines << [5, 430, 300, 430] + outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes + outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes + outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes end - def self.quad x - x * x + # Shows output of different kinds of solids on the screen + def solids_tech_demo + outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"] + outputs.solids << [ 10, 270, 50, 50] + outputs.solids << [ 70, 270, 50, 50, 0, 0, 0] + outputs.solids << [130, 270, 50, 50, 255, 0, 0] + outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128] + outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes end - def self.cube x - x * x * x + # Shows output of different kinds of borders on the screen + # The parameters for a border are the same as the parameters for a solid + def borders_tech_demo + outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"] + outputs.borders << [ 10, 180, 50, 50] + outputs.borders << [ 70, 180, 50, 50, 0, 0, 0] + outputs.borders << [130, 180, 50, 50, 255, 0, 0] + outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128] + outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes end - def self.quart x - x * x * x * x * x + # Shows output of different kinds of sprites on the screen + def sprites_tech_demo + outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"] + outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png'] + outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes + outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes end - def self.quint x - x * x * x * x * x * x + # Holds size, alignment, color (black), and alpha (transparency) parameters + # Using small_font as a parameter accounts for all remaining parameters + # so they don't have to be repeatedly typed + def small_font + [-2, 0, 0, 0, 0, 255] end - end - -#+end_src - -* 08_lerping_easing_functions/02_cubic_bezier/app/main.rb -#+begin_src ruby - def tick args - args.outputs.background_color = [33, 33, 33] - args.outputs.lines << bezier(100, 100, - 100, 620, - 1180, 620, - 1180, 100, - 0) - args.outputs.lines << bezier(100, 100, - 100, 620, - 1180, 620, - 1180, 100, - 20) - end + # Sets position of each row + # Converts given row value to pixels that DragonRuby understands + def row_to_px row_number + # Row 0 starts 5 units below the top of the grid. + # Each row afterward is 20 units lower. + grid.top.shift_down(5).shift_down(20 * row_number) + end - def bezier x1, y1, x2, y2, x3, y3, x4, y4, step - step ||= 0 - color = [200, 200, 200] - points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step + # Uses labels to output current game time (passage of time), and whether or not "h" was pressed + # If "h" is pressed, the frame is output when the key_up event occurred + def keyboards_tech_demo + outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font] + outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font] + outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font] - points.each_cons(2).map do |p1, p2| - [p1, p2, color] - end - end + if inputs.keyboard.key_up.h # if "h" key_up event occurs + state.h_pressed_at = state.tick_count # frame it occurred is stored + end - def points_for_bezier p1, p2, p3, p4, step - points = [] - if step == 0 - [p1, p2, p3, p4] - else - t_step = 1.fdiv(step + 1) - t = 0 - t += t_step - points = [] - while t < 1 - points << [ - b_for_t(p1.x, p2.x, p3.x, p4.x, t), - b_for_t(p1.y, p2.y, p3.y, p4.y, t), - ] - t += t_step + # h_pressed_at is initially set to false, and changes once the user presses the "h" key. + state.h_pressed_at ||= false + + if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false) + outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font] + else # otherwise, label says "h" was never pressed + outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font] end - [ - p1, - *points, - p4 - ] + # border around keyboard input demo section + outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)] end - end - def b_for_t v0, v1, v2, v3, t - pow(1 - t, 3) * v0 + - 3 * pow(1 - t, 2) * t * v1 + - 3 * (1 - t) * pow(t, 2) * v2 + - pow(t, 3) * v3 - end + # Sets definition for a small label + # Makes it easier to position labels in respect to the position of other labels + def small_label x, row, message + [x, row_to_px(row), message, small_font] + end - def pow n, to - n ** to - end - -#+end_src - -* 08_lerping_easing_functions/03_easing_using_spline/app/main.rb -#+begin_src ruby - def tick args - args.state.duration = 10.seconds - args.state.spline = [ - [0.0, 0.33, 0.66, 1.0], - [1.0, 1.0, 1.0, 1.0], - [1.0, 0.66, 0.33, 0.0], - ] - - args.state.simulation_tick = args.state.tick_count % args.state.duration - progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline - args.outputs.borders << args.grid.rect - args.outputs.solids << [20 + 1240 * progress, - 20 + 680 * progress, - 20, 20].anchor_rect(0.5, 0.5) - args.outputs.labels << [10, - 710, - "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] - end - -#+end_src - -* 08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb -#+begin_src ruby - def new_star args - { x: 1280.randomize(:ratio), - starting_y: 800, - distance_to_travel: 900 + 100.randomize(:ratio), - duration: 100.randomize(:ratio) + 60, - created_at: args.state.tick_count, - max_alpha: 128.randomize(:ratio) + 128, - b: 255.randomize(:ratio), - g: 200.randomize(:ratio), - w: 1.randomize(:ratio) + 1, - h: 1.randomize(:ratio) + 1 } - end + # Uses small labels to show whether the "a" button on the controller is down, held, or up. + # y value of each small label is set by calling the row_to_px method + def controller_tech_demo + x = 460 + outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one") + outputs.labels << small_label(x, 7, "Current state of the \"a\" button.") + outputs.labels << small_label(x, 8, "Check console window for more info.") - def new_enemy args - { x: 1280.randomize(:ratio), - starting_y: 800, - distance_to_travel: -900, - duration: 60.randomize(:ratio) + 180, - created_at: args.state.tick_count, - w: 32, - h: 32, - fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } - end + if inputs.controller_one.key_down.a # if "a" is in "down" state + outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}") + puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred + elsif inputs.controller_one.key_held.a # if "a" is held down + outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}") + elsif inputs.controller_one.key_up.a # if "a" is in up state + outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}") + puts "\"a\" key up at #{inputs.controller_one.key_up.a}" + else # if no event has occurred + outputs.labels << small_label(x, 9, "\"a\" button state is nil.") + end - def new_bullet args, starting_x, starting_y, enemy_speed - { x: starting_x, - starting_y: starting_y, - distance_to_travel: -900, - created_at: args.state.tick_count, - duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, - w: 5, - h: 5 } - end + # border around controller input demo section + outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)] + end - def new_player_bullet args, starting_x, starting_y, player_speed - { x: starting_x, - starting_y: starting_y, - distance_to_travel: 900, - created_at: args.state.tick_count, - duration: 900 / (player_speed + 2.0), - w: 5, - h: 5 } - end + # Outputs when the mouse was clicked, as well as the coordinates on the screen + # of where the click occurred + def mouse_tech_demo + x = 460 - def defaults args - args.outputs.background_color = [0, 0, 0] - args.state.score ||= 0 - args.state.stars ||= [] - args.state.enemies ||= [] - args.state.bullets ||= [] - args.state.player_bullets ||= [] - args.state.max_stars = 50 - args.state.max_enemies = 10 - args.state.player.x ||= 640 - args.state.player.y ||= 100 - args.state.player.w ||= 32 - args.state.player.h ||= 32 + outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse") - if args.state.tick_count == 0 - args.state.stars.clear - args.state.max_stars.times do - s = new_star args - s[:created_at] += s[:duration].randomize(:ratio) - args.state.stars << s + if inputs.mouse.click # if click has a value and is not nil + state.last_mouse_click = inputs.mouse.click # coordinates of click are stored end - end - if args.state.tick_count == 0 - args.state.enemies.clear - args.state.max_enemies.times do - s = new_enemy args - s[:created_at] += s[:duration].randomize(:ratio) - args.state.enemies << s + if state.last_mouse_click # if mouse is clicked (has coordinates as value) + # outputs the time (frame) the click occurred, as well as how many frames have passed since the event + outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}") + # outputs coordinates of click + outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}") + else # otherwise if the mouse has not been clicked + outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.") + outputs.labels << small_label(x, 13, "Please click mouse.") end end - end - - def input args - if args.inputs.keyboard.left - args.state.player.x -= 5 - elsif args.inputs.keyboard.right - args.state.player.x += 5 - end - if args.inputs.keyboard.up - args.state.player.y += 5 - elsif args.inputs.keyboard.down - args.state.player.y -= 5 - end + # Outputs whether a mouse click occurred inside or outside of a box + def point_to_rect_tech_demo + x = 460 - if args.inputs.keyboard.key_down.space - args.state.player_bullets << new_player_bullet(args, - args.state.player.x + args.state.player.w.half, - args.state.player.y + args.state.player.h, 5) - end + outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->") - args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) - args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) - end + box = [765, 370, 50, 50, 0, 0, 170] # blue box + outputs.borders << box - def completed? entity - (entity[:created_at] + entity[:duration]).elapsed_time > 0 - end + if state.last_mouse_click # if the mouse was clicked + if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box + outputs.labels << small_label(x, 16, "Mouse click happened inside the box.") + else # otherwise, if mouse was clicked outside the box + outputs.labels << small_label(x, 16, "Mouse click happened outside the box.") + end + else # otherwise, if was not clicked at all + outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked + end - def calc_stars args - if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 - stars_to_add.times { args.state.stars << new_star(args) } + # border around mouse input demo section + outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)] end - args.state.stars = args.state.stars.reject { |s| completed? s } - end - def move_enemies args - if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 - enemies_to_add.times { args.state.enemies << new_enemy(args) } - end + # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output + # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not + # they intersect. + def rect_to_rect_tech_demo + x = 460 - args.state.enemies = args.state.enemies.reject { |s| completed? s } - end + outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions + red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box + outputs.borders << red_box # output as a border (not filled in) - def move_bullets args - args.state.enemies.each do |e| - if args.state.tick_count.mod_zero?(e[:fire_rate]) - args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) + # If the mouse is clicked inside the red box, two collision boxes are created. + if inputs.mouse.click + if inputs.mouse.click.point.inside_rect? red_box + if !state.box_collision_one # if the collision_one box does not yet have a definition + # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box. + # You can try deleting the subtraction to see how it impacts the box placement. + state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition + elsif !state.box_collision_two # if collision_two does not yet have a definition + state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition + else + state.box_collision_one = nil # both boxes are empty + state.box_collision_two = nil + end + end end - end - - args.state.bullets = args.state.bullets.reject { |s| completed? s } - args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } - end - def intersect? entity_one, entity_two - entity_one.merge(y: current_y(entity_one)) - .intersect_rect? entity_two.merge(y: current_y(entity_two)) - end + # If collision boxes exist, they are output onto screen inside the red box as solids + if state.box_collision_one + outputs.solids << state.box_collision_one + end - def kill args - bullets_hitting_enemies = [] - dead_bullets = [] - dead_enemies = [] + if state.box_collision_two + outputs.solids << state.box_collision_two + end - args.state.player_bullets.each do |b| - args.state.enemies.each do |e| - if intersect? b, e - dead_bullets << b - dead_enemies << e + # Outputs whether or not the two collision boxes intersect. + if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty) + if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect + outputs.labels << small_label(x, 23.5, 'The boxes intersect.') + else # otherwise, if the two boxes do not intersect + outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.') end + else + outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output end end - args.state.score += dead_enemies.length - - args.state.player_bullets.reject! { |b| dead_bullets.include? b } - args.state.enemies.reject! { |e| dead_enemies.include? e } + # Creates a button and outputs it onto the screen using labels and borders. + # If the button is clicked, the color changes to make it look faded. + def button_tech_demo + x, y, w, h = 460, 160, 300, 50 + state.button ||= state.new_entity(:button_with_fade) - dead = args.state.bullets.any? do |b| - [args.state.player.x, - args.state.player.y, - args.state.player.w, - args.state.player.h].intersect_rect? b.merge(y: current_y(b)) - end - return unless dead - args.gtk.reset - defaults args - end + # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders. + state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1] + state.button.border ||= [x, y, w, h] - def calc args - calc_stars args - move_enemies args - move_bullets args - kill args - end + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border + state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred + end - def current_y entity - entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) - end + outputs.labels << state.button.label + outputs.borders << state.button.border - def render args - args.outputs.solids << args.state.stars.map do |s| - [s[:x], - current_y(s), - s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] - end + if state.button.clicked_at # if button was clicked (variable has a value and is not nil) - args.outputs.borders << args.state.enemies.map do |s| - [s[:x], - current_y(s), - s[:w], s[:h], 255, 0, 0] + # The appearance of the button changes for 0.25 seconds after the time the button is clicked at. + # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes. + # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal. + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)] + end end - args.outputs.borders << args.state.bullets.map do |b| - [b[:x], - current_y(b), - b[:w], b[:h], 255, 0, 0] + # Creates a new button by declaring it as a new entity, and sets values. + def new_button_prefab x, y, message + w, h = 300, 50 + button = state.new_entity(:button_with_fade) + button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders + button.border = [x, y, w, h] # sets border definition + button end - args.outputs.borders << args.state.player_bullets.map do |b| - [b[:x], - current_y(b), - b[:w], b[:h], 255, 255, 255] + # If the mouse has been clicked and the click's location is inside of the button's border, that means + # that the button has been clicked. This method returns a boolean value. + def button_clicked? button + inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border) end - args.borders << [args.state.player.x, - args.state.player.y, - args.state.player.w, - args.state.player.h, 255, 255, 255] - end - - def tick args - defaults args - input args - calc args - render args - end - -#+end_src - -* 09_performance/01_sprites_as_hash/app/main.rb -#+begin_src ruby - # Sprites represented as Hashes using the queue ~args.outputs.sprites~ - # code up, but are the "slowest" to render. - # The reason for this is the access of the key in the Hash and also - # because the data args.outputs.sprites is cleared every tick. - def random_x args - (args.grid.w.randomize :ratio) * -1 - end - - def random_y args - (args.grid.h.randomize :ratio) * -1 - end - - def random_speed - 1 + (4.randomize :ratio) - end + # Determines if button was clicked, and changes its appearance if it is clicked + def tick_button_prefab button + outputs.labels << button.label # outputs button's label and border + outputs.borders << button.border - def new_star args - { - x: (random_x args), - y: (random_y args), - w: 4, h: 4, path: 'sprites/tiny-star.png', - s: random_speed - } - end + if button_clicked? button # if button is clicked + button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked + end - def move_star args, star - star.x += star[:s] - star.y += star[:s] - if star.x > args.grid.w || star.y > args.grid.h - star.x = (random_x args) - star.y = (random_y args) - star[:s] = random_speed + if button.clicked_at # if clicked_at has a frame value and is not nil + # button is output; color changes and transparency changes for 0.25 seconds after click occurs + outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h, + 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds + end end - end - - def tick args - args.state.star_count ||= 0 - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." - args.gtk.console.set_command "reset_with count: 100" + # Exports the app's game state if the export button is clicked. + def export_game_state_demo + state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state") + tick_button_prefab(state.export_game_state_button) # calls method to output button + if button_clicked? state.export_game_state_button # if the export button is clicked + args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs + end end - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| new_star args } + # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window. + def window_state_demo + m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement) + k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N' + outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font] end - # update - args.state.stars.each { |s| move_star args, s } - - # render - args.outputs.sprites << args.state.stars - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives - end + #Sets values for the horizontal separator (divides demo sections) + def horizontal_seperator y, x, x2 + [x, y, x2, y, 150, 150, 150] + end - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count - end - -#+end_src - -* 09_performance/02_sprites_as_entities/app/main.rb -#+begin_src ruby - # Sprites represented as Entities using the queue ~args.outputs.sprites~ - # yields nicer access apis over Hashes, but require a bit more code upfront. - # The hash sample has to use star[:s] to get the speed of the star, but - # an entity can use .s instead. - def random_x args - (args.grid.w.randomize :ratio) * -1 - end + #Sets the values for the vertical separator (divides demo sections) + def vertical_seperator x, y, y2 + [x, y, x, y2, 150, 150, 150] + end - def random_y args - (args.grid.h.randomize :ratio) * -1 - end + # Outputs vertical and horizontal separators onto the screen to separate each demo section. + def render_seperators + outputs.lines << horizontal_seperator(505, grid.left, 445) + outputs.lines << horizontal_seperator(353, grid.left, 445) + outputs.lines << horizontal_seperator(264, grid.left, 445) + outputs.lines << horizontal_seperator(174, grid.left, 445) - def random_speed - 1 + (4.randomize :ratio) - end + outputs.lines << vertical_seperator(445, grid.top, grid.bottom) - def new_star args - args.state.new_entity :star, { - x: (random_x args), - y: (random_y args), - w: 4, h: 4, - path: 'sprites/tiny-star.png', - s: random_speed - } - end + outputs.lines << horizontal_seperator(690, 445, 820) + outputs.lines << horizontal_seperator(426, 445, 820) - def move_star args, star - star.x += star.s - star.y += star.s - if star.x > args.grid.w || star.y > args.grid.h - star.x = (random_x args) - star.y = (random_y args) - star.s = random_speed + outputs.lines << vertical_seperator(820, grid.top, grid.bottom) end end - def tick args - args.state.star_count ||= 0 + $tech_demo = TechDemo.new - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." - args.gtk.console.set_command "reset_with count: 100" - end + def tick args + $tech_demo.inputs = args.inputs + $tech_demo.state = args.state + $tech_demo.grid = args.grid + $tech_demo.args = args + $tech_demo.outputs = args.render_target(:mini_map) + $tech_demo.tick + args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]] + args.outputs.sprites << [0, 0, 1280, 720, :mini_map] + args.outputs.sprites << [830, 300, 675, 379, :mini_map] + tick_instructions args, "Sample app shows all the rendering apis available." + end - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| new_star args } + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true end - # update - args.state.stars.each { |s| move_star args, s } - - # render - args.outputs.sprites << args.state.stars - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives - end - - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end #+end_src -* 09_performance/03_sprites_as_strict_entities/app/main.rb +* Advanced Rendering - Render Primitive Hierarchies - main.rb #+begin_src ruby - # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ - # yields apis access similar to Entities, but all properties that can be set on the - # entity must be predefined with a default value. Strict entities do not support the - # addition of new properties after the fact. They are more performant than OpenEntities - # because of this constraint. - def random_x args - (args.grid.w.randomize :ratio) * -1 - end - - def random_y args - (args.grid.h.randomize :ratio) * -1 - end + # ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb + =begin - def random_speed - 1 + (4.randomize :ratio) - end + APIs listing that haven't been encountered in previous sample apps: - def new_star args - args.state.new_entity_strict(:star, - x: (random_x args), - y: (random_y args), - w: 4, h: 4, - path: 'sprites/tiny-star.png', - s: random_speed) do |entity| - # invoke attr_sprite so that it responds to - # all properties that are required to render a sprite - entity.attr_sprite - end - end + - Nested array: An array whose individual elements are also arrays; useful for + storing groups of similar data. Also called multidimensional arrays. - def move_star args, star - star.x += star.s - star.y += star.s - if star.x > args.grid.w || star.y > args.grid.h - star.x = (random_x args) - star.y = (random_y args) - star.s = random_speed - end - end + In this sample app, we see nested arrays being used in object definitions. + Notice the parameters for solids, listed below. Parameters 1-3 set the + definition for the rect, and parameter 4 sets the definition of the color. - def tick args - args.state.star_count ||= 0 + Instead of having a solid definition that looks like this, + [X, Y, W, H, R, G, B] + we can separate it into two separate array definitions in one, like this + [[X, Y, W, H], [R, G, B]] + and both options work fine in defining our solid (or any object). - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - puts "* INFO - Please specify the number of sprites to render." - args.gtk.console.set_command "reset_with count: 100" - end + - Collections: Lists of data; useful for organizing large amounts of data. + One element of a collection could be an array (which itself contains many elements). + For example, a collection that stores two solid objects would look like this: + [ + [100, 100, 50, 50, 0, 0, 0], + [100, 150, 50, 50, 255, 255, 255] + ] + If this collection was added to args.outputs.solids, two solids would be output + next to each other, one black and one white. + Nested arrays can be used in collections, as you will see in this sample app. - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| new_star args } - end + Reminders: - # update - args.state.stars.each { |s| move_star args, s } + - args.outputs.solids: An array. The values generate a solid. + The parameters for a solid are + 1. The position on the screen (x, y) + 2. The width (w) + 3. The height (h) + 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black) + NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS! - # render - args.outputs.sprites << args.state.stars - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives - end + Here is an example of a (red) border or solid definition: + [100, 100, 400, 500, 255, 0, 0] + It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders. + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count - end - -#+end_src - -* 09_performance/04_sprites_as_classes/app/main.rb -#+begin_src ruby - # Sprites represented as Classes using the queue ~args.outputs.sprites~. - # gives you full control of property declaration and method invocation. - # They are more performant than OpenEntities and StrictEntities, but more code upfront. - class Star - attr_sprite + - args.outputs.sprites: An array. The values generate a sprite. + The parameters for sprites are + 1. The position on the screen (x, y) + 2. The width (w) + 3. The height (h) + 4. The image path (p) - def initialize grid - @grid = grid - @x = (rand @grid.w) * -1 - @y = (rand @grid.h) * -1 - @w = 4 - @h = 4 - @s = 1 + (4.randomize :ratio) - @path = 'sprites/tiny-star.png' - end + Here is an example of a sprite definition: + [100, 100, 400, 500, 'sprites/dragonruby.png'] + For more information about sprites, go to mygame/documentation/05-sprites.md. - def move - @x += @s - @y += @s - @x = (rand @grid.w) * -1 if @x > @grid.right - @y = (rand @grid.h) * -1 if @y > @grid.top - end - end + =end - # calls methods needed for game to run properly + # This code demonstrates the creation and output of objects like sprites, borders, and solids + # If filled in, they are solids + # If hollow, they are borders + # If images, they are sprites + + # Solids are added to args.outputs.solids + # Borders are added to args.outputs.borders + # Sprites are added to args.outputs.sprites + + # The tick method runs 60 frames every second. + # Your game is going to happen under this one function. def tick args - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - args.gtk.console.set_command "reset_with count: 100" - end + border_as_solid_and_solid_as_border args + sprite_as_border_or_solids args + collection_of_borders_and_solids args + collection_of_sprites args + end - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } - end + # Shows a border being output onto the screen as a border and a solid + # Also shows how colors can be set + def border_as_solid_and_solid_as_border args + border = [0, 0, 50, 50] + args.outputs.borders << border + args.outputs.solids << border - # update - args.state.stars.each(&:move) + # Red, green, blue saturations (last three parameters) can be any number between 0 and 255 + border_with_color = [0, 100, 50, 50, 255, 0, 0] + args.outputs.borders << border_with_color + args.outputs.solids << border_with_color - # render - args.outputs.sprites << args.state.stars - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives - end + border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color + args.outputs.borders << border_with_nested_color + args.outputs.solids << border_with_nested_color - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count + border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect + args.outputs.borders << border_with_nested_rect + args.outputs.solids << border_with_nested_rect + + border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color + args.outputs.borders << border_with_nested_color_and_rect + args.outputs.solids << border_with_nested_color_and_rect end - -#+end_src - -* 09_performance/05_static_sprites_as_classes/app/main.rb -#+begin_src ruby - # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. - # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held - # by reference. You get better performance, but you are mutating state of held objects - # which is less functional/data oriented. - class Star - attr_sprite - def initialize grid - @grid = grid - @x = (rand @grid.w) * -1 - @y = (rand @grid.h) * -1 - @w = 4 - @h = 4 - @s = 1 + (4.randomize :ratio) - @path = 'sprites/tiny-star.png' - end + # Shows a sprite output onto the screen as a sprite, border, and solid + # Demonstrates that all three outputs appear differently on screen + def sprite_as_border_or_solids args + sprite = [100, 0, 50, 50, 'sprites/ship.png'] + args.outputs.sprites << sprite - def move - @x += @s - @y += @s - @x = (rand @grid.w) * -1 if @x > @grid.right - @y = (rand @grid.h) * -1 if @y > @grid.top - end + # Sprite_as_border variable has same parameters (excluding position) as above object, + # but will appear differently on screen because it is added to args.outputs.borders + sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png'] + args.outputs.borders << sprite_as_border + + # Sprite_as_solid variable has same parameters (excluding position) as above object, + # but will appear differently on screen because it is added to args.outputs.solids + sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png'] + args.outputs.solids << sprite_as_solid end - # calls methods needed for game to run properly - def tick args - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - args.gtk.console.set_command "reset_with count: 100" - end + # Holds and outputs a collection of borders and a collection of solids + # Collections are created by using arrays to hold parameters of each individual object + def collection_of_borders_and_solids args + collection_borders = [ + [ + [200, 0, 50, 50], # black border + [200, 100, 50, 50, 255, 0, 0], # red border + [200, 200, 50, 50, [0, 255, 0]], # nested color + ], + [[200, 300, 50, 50], 0, 0, 255], # nested rect + [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color + ] - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } - end + args.outputs.borders << collection_borders - # update - args.state.stars.each(&:move) + collection_solids = [ + [ + [[300, 300, 50, 50], 0, 0, 255], # nested rect + [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color + ], + [300, 0, 50, 50], + [300, 100, 50, 50, 255, 0, 0], + [300, 200, 50, 50, [0, 255, 0]], # nested color + ] - # render - args.outputs.sprites << args.state.stars - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives + args.outputs.solids << collection_solids end - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count - end - -#+end_src - -* 09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb -#+begin_src ruby - # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. - # is the fastest approach. This is comparable to what other game engines set as the default behavior. - # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing - # functional/data-oriented practices. - class Star - def initialize grid - @grid = grid - @x = (rand @grid.w) * -1 - @y = (rand @grid.h) * -1 - @w = 4 - @h = 4 - @s = 1 + (4.randomize :ratio) - @path = 'sprites/tiny-star.png' - end - - def move - @x += @s - @y += @s - @x = (rand @grid.w) * -1 if @x > @grid.right - @y = (rand @grid.h) * -1 if @y > @grid.top - end - - # if the object that is in args.outputs.sprites (or static_sprites) - # respond_to? :draw_override, then the method is invoked giving you - # access to the class used to draw to the canvas. - def draw_override ffi_draw - # first move then draw - move - - # The argument order for ffi.draw_sprite is: - # x, y, w, h, path - ffi_draw.draw_sprite @x, @y, @w, @h, @path - - # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value): - # x, y, w, h, path, - # angle, alpha - - # The argument order for ffi_draw.draw_sprite_3 is: - # x, y, w, h, - # path, - # angle, - # alpha, red_saturation, green_saturation, blue_saturation - # flip_horizontally, flip_vertically, - # tile_x, tile_y, tile_w, tile_h - # angle_anchor_x, angle_anchor_y, - # source_x, source_y, source_w, source_h - end - end - - # calls methods needed for game to run properly - def tick args - # sets console command when sample app initially opens - if Kernel.global_tick_count == 0 - args.gtk.console.set_command "reset_with count: 100" - end + # Holds and outputs a collection of sprites by adding it to args.outputs.sprites + # Also outputs a collection with same parameters (excluding position) by adding + # it to args.outputs.solids and another to args.outputs.borders + def collection_of_sprites args + sprites_collection = [ + [ + [400, 0, 50, 50, 'sprites/ship.png'], + [400, 100, 50, 50, 'sprites/ship.png'], + ], + [400, 200, 50, 50, 'sprites/ship.png'] + ] - # init - if args.state.tick_count == 0 - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } - args.outputs.static_sprites << args.state.stars - end + args.outputs.sprites << sprites_collection - # render framerate - args.outputs.background_color = [0, 0, 0] - args.outputs.primitives << args.gtk.current_framerate_primitives - end + args.outputs.solids << [ + [500, 0, 50, 50, 'sprites/ship.png'], + [500, 100, 50, 50, 'sprites/ship.png'], + [[[500, 200, 50, 50, 'sprites/ship.png']]] + ] - # resets game, and assigns star count given by user - def reset_with count: count - $gtk.reset - $gtk.args.state.star_count = count + args.outputs.borders << [ + [ + [600, 0, 50, 50, 'sprites/ship.png'], + [600, 100, 50, 50, 'sprites/ship.png'], + ], + [600, 200, 50, 50, 'sprites/ship.png'] + ] end #+end_src -* 09_performance/07_collision_limits/app/main.rb +* Advanced Rendering - Render Primitives As Hash - main.rb #+begin_src ruby + # ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb =begin Reminders: - - find_all: Finds all elements of a collection that meet certain requirements. - In this sample app, we're finding all bodies that intersect with the center body. - - 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. + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. - 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. - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. - - =end + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - # This code demonstrates moving objects that loop around once they exceed the scope of the screen, - # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies". + - args.outputs.borders: An array. The values generate a border. + The parameters are the same as a solid. + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. - def body_count num - $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection - end + - args.outputs.lines: An array. The values generate a line. + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] + For more information about labels, go to mygame/documentation/02-labels.md. - def tick args + =end - # Center body's values are set using an array - # Map is used to set values of 2000 other bodies - # All bodies that intersect with center body are stored in collisions collection - args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center - args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen + # This sample app demonstrates how hashes can be used to output different kinds of objects. - # finds all bodies that intersect with center body, stores them in collisions - collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body } + def tick args + args.state.angle ||= 0 # initializes angle to 0 + args.state.angle += 1 # increments angle by 1 every frame (60 times a second) - args.borders << args.state.center_body # outputs center body as a black border + # Outputs sprite using a hash + args.outputs.sprites << { + x: 30, # sprite position + y: 550, + w: 128, # sprite size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # alpha (transparency) + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip sprite + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + } - # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes - args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid - args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well + # Outputs label using a hash + args.outputs.labels << { + x: 200, # label position + y: 550, + text: "dragonruby", # label text + size_enum: 2, + alignment_enum: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly + } - args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner + # Outputs solid using a hash + # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + args.outputs.solids << { + x: 400, # position + y: 550, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } - # Bodies are returned to bottom left corner if positions exceed scope of screen - args.state.other_bodies.each do |b| # for each body in the other_bodies collection - b.x += 5 # x and y are both incremented by 5 - b.y += 5 - b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right) - b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up) - end - end + # Outputs border using a hash + # Same parameters as a solid + args.outputs.borders << { + x: 600, + y: 550, + w: 160, + h: 90, + r: 120, + g: 50, + b: 50, + a: 255 + } - # Resets the game. - $gtk.reset - -#+end_src - -* 10_advanced_debugging/01_trace_debugging/app/main.rb -#+begin_src ruby - class Game - attr_gtk + # Outputs line using a hash + args.outputs.lines << { + x: 900, # starting position + y: 550, + x2: 1200, # ending position + y2: 550, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } - def method1 num - method2 num - end + # Outputs sprite as a primitive using a hash + args.outputs.primitives << { + x: 30, # position + y: 200, + w: 128, # size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # transparency + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + }.sprite - def method2 num - method3 num - end - - def method3 num - method4 num - end - - def method4 num - if num == 1 - puts "UNLUCKY #{num}." - state.unlucky_count += 1 - if state.unlucky_count > 3 - raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." - end - else - puts "LUCKY #{num}." - end - end + # Outputs label as primitive using a hash + args.outputs.primitives << { + x: 200, # position + y: 200, + text: "dragonruby", # text + size: 2, + alignment: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style + }.label - def tick - state.roll_history ||= [] - state.roll_history << rand(20) + 1 - state.countdown ||= 600 - state.countdown -= 1 - state.unlucky_count ||= 0 - outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] - if state.countdown > 0 - outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] - else - state.attempts ||= 0 - state.attempts += 1 - outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] - end - return if state.countdown > 0 - method1 state.roll_history[-1] - end - end + # Outputs solid as primitive using a hash + args.outputs.primitives << { + x: 400, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.solid - $game = Game.new + # Outputs border as primitive using a hash + # Same parameters as solid + args.outputs.primitives << { + x: 600, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.border - def tick args - trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT - $game.args = args - $game.tick + # Outputs line as primitive using a hash + args.outputs.primitives << { + x: 900, # starting position + y: 200, + x2: 1200, # ending position + y2: 200, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.line end #+end_src -* 10_advanced_debugging/02_trace_debugging_classes/app/main.rb +* Tweening Lerping Easing Functions - Easing Functions - main.rb #+begin_src ruby - class Foobar - def initialize - trace! # Trace is added to the constructor. - end + # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb + def tick args + # STOP! Watch the following presentation first!!!! + # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations + # https://www.youtube.com/watch?v=mr5xkf6zSzk - def clicky args - return unless args.inputs.mouse.click - try_rand rand - end + # You've watched the talk, yes? YES??? - def try_rand num - return if num < 0.9 - raise "Exception finally occurred. Take a look at logs/trace.txt #{num}." - end - end + # define starting and ending points of properties to animate + args.state.target_x = 1180 + args.state.target_y = 620 + args.state.target_w = 100 + args.state.target_h = 100 + args.state.starting_x = 0 + args.state.starting_y = 0 + args.state.starting_w = 300 + args.state.starting_h = 300 - def tick args - args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1] - args.state.foobar = Foobar.new if args.tick_count - return unless args.state.foobar - args.state.foobar.clicky args - end - -#+end_src - -* 10_advanced_debugging/03_unit_tests/exception_raising_tests.rb -#+begin_src ruby - begin :shared - class ExceptionalClass - def initialize exception_to_throw = nil - raise exception_to_throw if exception_to_throw - end - end - end + # define start time and duration of animation + args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) + args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) - def test_exception_in_newing_object args, assert - begin - ExceptionalClass.new TypeError - raise "Exception wasn't thrown!" - rescue Exception => e - assert.equal! e.class, TypeError, "Exceptions within constructor should be retained." - end - end + # define type of animations + # Here are all the options you have for values you can put in the array: + # :identity, :quad, :cube, :quart, :quint, :flip - puts "running tests" - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start - -#+end_src - -* 10_advanced_debugging/03_unit_tests/gen_docs.rb -#+begin_src ruby - # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick - Kernel.export_docs! - -#+end_src - -* 10_advanced_debugging/03_unit_tests/geometry_tests.rb -#+begin_src ruby - begin :shared - def primitive_representations x, y, w, h - [ - [x, y, w, h], - { x: x, y: y, w: w, h: h }, - RectForTest.new(x, y, w, h) - ] - end + # Linear is defined as: + # [:identity] + # + # Smooth start variations are: + # [:quad] + # [:cube] + # [:quart] + # [:quint] - class RectForTest - attr_sprite + # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: + # [:flip, :identity] + # [:flip, :quad, :flip] + # [:flip, :cube, :flip] + # [:flip, :quart, :flip] + # [:flip, :quint, :flip] - def initialize x, y, w, h - @x = x - @y = y - @w = w - @h = h - end + # You can also do custom definitions. See the bottom of the file details + # on how to do that. I've defined a couple for you: + # [:smoothest_start] + # [:smoothest_stop] - def to_s - "RectForTest: #{[x, y, w, h]}" + # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS + args.state.animation_type = [:identity] + # args.state.animation_type = [:quad] + # args.state.animation_type = [:cube] + # args.state.animation_type = [:quart] + # args.state.animation_type = [:quint] + # args.state.animation_type = [:flip, :identity] + # args.state.animation_type = [:flip, :quad, :flip] + # args.state.animation_type = [:flip, :cube, :flip] + # args.state.animation_type = [:flip, :quart, :flip] + # args.state.animation_type = [:flip, :quint, :flip] + # args.state.animation_type = [:smoothest_start] + # args.state.animation_type = [:smoothest_stop] + + # THIS IS WHERE THE MAGIC HAPPENS! + # Numeric#ease + progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) + + # Numeric#ease needs to called: + # 1. On the number that represents the point in time you want to start, and takes two parameters: + # a. The first parameter is how long the animation should take. + # b. The second parameter represents the functions that need to be called. + # + # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, + # and I want to animation to start fast and end slow, I would do: + # (60 * 3).ease(60 * 10, :flip, :quint, :flip) + + # initial value delta to the final value + calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress + calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress + calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress + calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress + + args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] + + # count down + count_down = args.state.start_animate_at - args.state.tick_count + if count_down > 0 + args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] + args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] + elsif progress >= 1 + args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] + if args.inputs.click + $gtk.reset end end end - begin :intersect_rect? - def test_intersect_rect_point args, assert - assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect." + # $gtk.reset + + # you can make own variations of animations using this + module Easing + # you have access to all the built in functions: identity, flip, quad, cube, quart, quint + def self.smoothest_start x + quad(quint(x)) end - def test_intersect_rect args, assert - intersecting = primitive_representations(0, 0, 100, 100) + - primitive_representations(20, 20, 20, 20) + def self.smoothest_stop x + flip(quad(quint(flip(x)))) + end - intersecting.product(intersecting).each do |rect_one, rect_two| - assert.true! rect_one.intersect_rect?(rect_two), - "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)." - end - - not_intersecting = [ - [ 0, 0, 5, 5], - { x: 10, y: 10, w: 5, h: 5 }, - RectForTest.new(20, 20, 5, 5) - ] - - not_intersecting.product(not_intersecting) - .reject { |rect_one, rect_two| rect_one == rect_two } - .each do |rect_one, rect_two| - assert.false! rect_one.intersect_rect?(rect_two), - "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)." - end + # this is the source for the existing easing functions + def self.identity x + x end - end - begin :inside_rect? - def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil - assert.true! inner.inside_rect?(outer) == expected, - "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})." + def self.flip x + 1 - x end - def test_inside_rect args, assert - outer_rects = primitive_representations(0, 0, 10, 10) - inner_rects = primitive_representations(1, 1, 5, 5) - primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5)) - .each do |outer, inner| - assert_inside_rect outer: outer, inner: inner, - expected: true, assert: assert - end + def self.quad x + x * x end - end - - begin :angle_to - def test_angle_to args, assert - origins = primitive_representations(0, 0, 0, 0) - rights = primitive_representations(1, 0, 0, 0) - aboves = primitive_representations(0, 1, 0, 0) - - origins.product(aboves).each do |origin, above| - assert.equal! origin.angle_to(above), 90, - "A point directly above should be 90 degrees." - - assert.equal! above.angle_from(origin), 90, - "A point coming from above should be 90 degrees." - end - origins.product(rights).each do |origin, right| - assert.equal! origin.angle_to(right) % 360, 0, - "A point directly to the right should be 0 degrees." + def self.cube x + x * x * x + end - assert.equal! right.angle_from(origin) % 360, 0, - "A point coming from the right should be 0 degrees." + def self.quart x + x * x * x * x * x + end - end + def self.quint x + x * x * x * x * x * x end end + +#+end_src + +* Tweening Lerping Easing Functions - Cubic Bezier - main.rb +#+begin_src ruby + # ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb + def tick args + args.outputs.background_color = [33, 33, 33] + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 0) - begin :scale_rect - def test_scale_rect args, assert - assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5), - [25.0, 25.0, 50.0, 50.0] + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 20) + end - assert.equal! [0, 0, 100, 100].scale_rect(0.5), - [0.0, 0.0, 50.0, 50.0] - assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5), - [25.0, 25.0, 50.0, 50.0] + def bezier x1, y1, x2, y2, x3, y3, x4, y4, step + step ||= 0 + color = [200, 200, 200] + points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step - assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0), - [0.0, 0.0, 50.0, 50.0] + points.each_cons(2).map do |p1, p2| + [p1, p2, color] end end - puts "running tests" - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start - -#+end_src - -* 10_advanced_debugging/03_unit_tests/http_tests.rb -#+begin_src ruby - def try_assert_or_schedule args, assert - if $result[:complete] - log_info "Request completed! Verifying." - if $result[:http_response_code] != 200 - log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200." - exit - end - log_info ":try_assert_or_schedule succeeded!" + def points_for_bezier p1, p2, p3, p4, step + points = [] + if step == 0 + [p1, p2, p3, p4] else - args.gtk.schedule_callback Kernel.tick_count + 10 do - try_assert_or_schedule args, assert + t_step = 1.fdiv(step + 1) + t = 0 + t += t_step + points = [] + while t < 1 + points << [ + b_for_t(p1.x, p2.x, p3.x, p4.x, t), + b_for_t(p1.y, p2.y, p3.y, p4.y, t), + ] + t += t_step end + + [ + p1, + *points, + p4 + ] end end - def test_http args, assert - $result = $gtk.http_get 'http://dragonruby.org' - try_assert_or_schedule args, assert + def b_for_t v0, v1, v2, v3, t + pow(1 - t, 3) * v0 + + 3 * pow(1 - t, 2) * t * v1 + + 3 * (1 - t) * pow(t, 2) * v2 + + pow(t, 3) * v3 end - puts "running tests" - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start + def pow n, to + n ** to + end #+end_src -* 10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb +* Tweening Lerping Easing Functions - Easing Using Spline - main.rb #+begin_src ruby - class PlayerSpriteForTest - end - - def test_array_to_sprite args, assert - array = [[0, 0, 100, 100, "test.png"]].sprites - puts "No exception was thrown. Sweet!" - end + # ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb + def tick args + args.state.duration = 10.seconds + args.state.spline = [ + [0.0, 0.33, 0.66, 1.0], + [1.0, 1.0, 1.0, 1.0], + [1.0, 0.66, 0.33, 0.0], + ] - def test_class_to_sprite args, assert - array = [PlayerSprite.new].sprites - assert.true! array.first.is_a?(PlayerSprite) - puts "No exception was thrown. Sweet!" + args.state.simulation_tick = args.state.tick_count % args.state.duration + progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline + args.outputs.borders << args.grid.rect + args.outputs.solids << [20 + 1240 * progress, + 20 + 680 * progress, + 20, 20].anchor_rect(0.5, 0.5) + args.outputs.labels << [10, + 710, + "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] end - - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start #+end_src -* 10_advanced_debugging/03_unit_tests/parsing_tests.rb +* Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb #+begin_src ruby - def test_parse_json args, assert - result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' - assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed." + # ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb + def new_star args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: 900 + 100.randomize(:ratio), + duration: 100.randomize(:ratio) + 60, + created_at: args.state.tick_count, + max_alpha: 128.randomize(:ratio) + 128, + b: 255.randomize(:ratio), + g: 200.randomize(:ratio), + w: 1.randomize(:ratio) + 1, + h: 1.randomize(:ratio) + 1 } end - def test_parse_xml args, assert - result = args.gtk.parse_xml <<-S - - John Doe - - S - - expected = {:type=>:element, - :name=>nil, - :children=>[{:type=>:element, - :name=>"Person", - :children=>[{:type=>:element, - :name=>"Name", - :children=>[{:type=>:content, - :data=>"John Doe"}]}], - :attributes=>{"id"=>"100"}}]} - - assert.equal! result, expected, "Parsing xml failed." + def new_enemy args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: -900, + duration: 60.randomize(:ratio) + 180, + created_at: args.state.tick_count, + w: 32, + h: 32, + fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } end - puts "running tests" - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start - -#+end_src - -* 10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb -#+begin_src ruby - def test_serialize args, assert - GTK::Entity.__reset_id__! - args.state.player_one = "test" - result = args.gtk.serialize_state args.state - assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" - - GTK::Entity.__reset_id__! - args.gtk.write_file 'state.txt', '' - result = args.gtk.serialize_state 'state.txt', args.state - assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" + def new_bullet args, starting_x, starting_y, enemy_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: -900, + created_at: args.state.tick_count, + duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, + w: 5, + h: 5 } end - def test_deserialize args, assert - GTK::Entity.__reset_id__! - result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' - assert.equal! result.player_one, "test" - - GTK::Entity.__reset_id__! - args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' - result = args.gtk.deserialize_state 'state.txt' - assert.equal! result.player_one, "test" + def new_player_bullet args, starting_x, starting_y, player_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: 900, + created_at: args.state.tick_count, + duration: 900 / (player_speed + 2.0), + w: 5, + h: 5 } end - def test_very_large_serialization args, assert - GTK::Entity.__reset_id__! - size = 3000 - size.map_with_index do |i| - args.state.send("k#{i}=".to_sym, i) + def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.score ||= 0 + args.state.stars ||= [] + args.state.enemies ||= [] + args.state.bullets ||= [] + args.state.player_bullets ||= [] + args.state.max_stars = 50 + args.state.max_enemies = 10 + args.state.player.x ||= 640 + args.state.player.y ||= 100 + args.state.player.w ||= 32 + args.state.player.h ||= 32 + + if args.state.tick_count == 0 + args.state.stars.clear + args.state.max_stars.times do + s = new_star args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.stars << s + end end - result = args.gtk.serialize_state args.state - assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly") + if args.state.tick_count == 0 + args.state.enemies.clear + args.state.max_enemies.times do + s = new_enemy args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.enemies << s + end + end end - def test_strict_entity_serialization args, assert - GTK::Entity.__reset_id__! - args.state.player_one = args.state.new_entity(:player, name: "Ryu") - args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken") - - serialized_state = args.gtk.serialize_state args.state - assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}' + def input args + if args.inputs.keyboard.left + args.state.player.x -= 5 + elsif args.inputs.keyboard.right + args.state.player.x += 5 + end - deserialize_state = args.gtk.deserialize_state serialized_state + if args.inputs.keyboard.up + args.state.player.y += 5 + elsif args.inputs.keyboard.down + args.state.player.y -= 5 + end - assert.equal! args.state.player_one.name, deserialize_state.player_one.name - assert.true! args.state.player_one.is_a? GTK::OpenEntity + if args.inputs.keyboard.key_down.space + args.state.player_bullets << new_player_bullet(args, + args.state.player.x + args.state.player.w.half, + args.state.player.y + args.state.player.h, 5) + end - assert.equal! args.state.player_two.name, deserialize_state.player_two.name - assert.true! args.state.player_two.is_a? GTK::StrictEntity + args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) + args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) end - def test_strict_entity_serialization_with_nil args, assert - GTK::Entity.__reset_id__! - args.state.player_one = args.state.new_entity(:player, name: "Ryu") - args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) - - serialized_state = args.gtk.serialize_state args.state - assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}' - - deserialized_state = args.gtk.deserialize_state serialized_state - - assert.equal! args.state.player_one.name, deserialized_state.player_one.name - assert.true! args.state.player_one.is_a? GTK::OpenEntity - - assert.equal! args.state.player_two.name, deserialized_state.player_two.name - assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type - assert.equal! deserialized_state.player_two.blood_type, nil - assert.true! args.state.player_two.is_a? GTK::StrictEntity - - deserialized_state.player_two.blood_type = :O - assert.equal! deserialized_state.player_two.blood_type, :O + def completed? entity + (entity[:created_at] + entity[:duration]).elapsed_time > 0 end - def test_multiple_strict_entities args, assert - GTK::Entity.__reset_id__! - args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu") - args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean') - - serialized_state = args.gtk.serialize_state args.state - deserialized_state = args.gtk.deserialize_state serialized_state - - assert.equal! deserialized_state.player.name, "Ryu" - assert.equal! deserialized_state.enemy.other_property, "extra mean" + def calc_stars args + if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 + stars_to_add.times { args.state.stars << new_star(args) } + end + args.state.stars = args.state.stars.reject { |s| completed? s } end - $tests.start - -#+end_src - -* 10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb -#+begin_src ruby - MAX_CODE_GEN_LENGTH = 50 + def move_enemies args + if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 + enemies_to_add.times { args.state.enemies << new_enemy(args) } + end - # NOTE: This is experimental/advanced stuff. - def needs_partitioning? target - target[:value].to_s.length > MAX_CODE_GEN_LENGTH + args.state.enemies = args.state.enemies.reject { |s| completed? s } end - def partition target - return [] unless needs_partitioning? target - if target[:value].is_a? GTK::OpenEntity - target[:value] = target[:value].hash + def move_bullets args + args.state.enemies.each do |e| + if args.state.tick_count.mod_zero?(e[:fire_rate]) + args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) + end end - results = [] - idx = 0 - left, right = target[:value].partition do - idx += 1 - idx.even? - end - left, right = Hash[left], Hash[right] - left = { value: left } - right = { value: right} - [left, right] + args.state.bullets = args.state.bullets.reject { |s| completed? s } + args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } end - def add_partition target, path, aggregate, final_result - partitions = partition target - partitions.each do |part| - if needs_partitioning? part - if part[:value].keys.length == 1 - first_key = part[:value].keys[0] - new_part = { value: part[:value][first_key] } - path.push first_key - add_partition new_part, path, aggregate, final_result - path.pop - else - add_partition part, path, aggregate, final_result + def intersect? entity_one, entity_two + entity_one.merge(y: current_y(entity_one)) + .intersect_rect? entity_two.merge(y: current_y(entity_two)) + end + + def kill args + bullets_hitting_enemies = [] + dead_bullets = [] + dead_enemies = [] + + args.state.player_bullets.each do |b| + args.state.enemies.each do |e| + if intersect? b, e + dead_bullets << b + dead_enemies << e end - else - final_result << { value: { __path__: [*path] } } - final_result << { value: part[:value] } end end - end - def state_to_string state - parts_queue = [] - final_queue = [] - add_partition({ value: state.hash }, - [], - parts_queue, - final_queue) - final_queue.reject {|i| i[:value].keys.length == 0}.map do |i| - i[:value].to_s - end.join("\n#==================================================#\n") - end + args.state.score += dead_enemies.length - def state_from_string string - Kernel.eval("$load_data = {}") - lines = string.split("\n#==================================================#\n") - lines.each do |l| - puts "todo: #{l}" + args.state.player_bullets.reject! { |b| dead_bullets.include? b } + args.state.enemies.reject! { |e| dead_enemies.include? e } + + dead = args.state.bullets.any? do |b| + [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h].intersect_rect? b.merge(y: current_y(b)) end + return unless dead + args.gtk.reset + defaults args + end - GTK::OpenEntity.parse_from_hash $load_data + def calc args + calc_stars args + move_enemies args + move_bullets args + kill args end - def test_save_and_load args, assert - args.state.item_1.name = "Jane" - string = state_to_string args.state - state = state_from_string string - assert.equal! args.state.item_1.name, state.item_1.name + def current_y entity + entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) end - def test_save_and_load_big args, assert - size = 1000 - size.map_with_index do |i| - args.state.send("k#{i}=".to_sym, i) + def render args + args.outputs.solids << args.state.stars.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] end - string = state_to_string args.state - state = state_from_string string - size.map_with_index do |i| - assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym) - assert.equal! args.state.send("k#{i}".to_sym), i - assert.equal! state.send("k#{i}".to_sym), i + args.outputs.borders << args.state.enemies.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 255, 0, 0] end - end - - def test_save_and_load_big_nested args, assert - args.state.player_one.friend.nested_hash.k0 = 0 - args.state.player_one.friend.nested_hash.k1 = 1 - args.state.player_one.friend.nested_hash.k2 = 2 - args.state.player_one.friend.nested_hash.k3 = 3 - args.state.player_one.friend.nested_hash.k4 = 4 - args.state.player_one.friend.nested_hash.k5 = 5 - args.state.player_one.friend.nested_hash.k6 = 6 - args.state.player_one.friend.nested_hash.k7 = 7 - args.state.player_one.friend.nested_hash.k8 = 8 - args.state.player_one.friend.nested_hash.k9 = 9 - string = state_to_string args.state - state = state_from_string string - end - $gtk.reset 100 - $gtk.log_level = :off - $gtk.tests.start + args.outputs.borders << args.state.bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 0, 0] + end + + args.outputs.borders << args.state.player_bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 255, 255] + end + + args.borders << [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h, 255, 255, 255] + end + + def tick args + defaults args + input args + calc args + render args + end #+end_src -* 11_http/01_retrieve_images/app/main.rb +* Performance - Sprites As Hash - main.rb #+begin_src ruby - def tick args - args.outputs.background_color = [0, 0, 0] + # ./samples/09_performance/01_sprites_as_hash/app/main.rb + # Sprites represented as Hashes using the queue ~args.outputs.sprites~ + # code up, but are the "slowest" to render. + # The reason for this is the access of the key in the Hash and also + # because the data args.outputs.sprites is cleared every tick. + def random_x args + (args.grid.w.randomize :ratio) * -1 + end - # Show a warning at the start. - args.state.warning_debounce ||= 11 * 60 - if args.state.warning_debounce > 0 - args.state.warning_debounce -= 1 - args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] - args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255] - args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255] - return + def random_y args + (args.grid.h.randomize :ratio) * -1 + end + + def random_speed + 1 + (4.randomize :ratio) + end + + def new_star args + { + x: (random_x args), + y: (random_y args), + w: 4, h: 4, path: 'sprites/tiny-star.png', + s: random_speed + } + end + + def move_star args, star + star.x += star[:s] + star.y += star[:s] + if star.x > args.grid.w || star.y > args.grid.h + star.x = (random_x args) + star.y = (random_y args) + star[:s] = random_speed end + end - args.state.download_debounce ||= 0 # start immediately, reset to non zero later. - args.state.photos ||= [] + def tick args + args.state.star_count ||= 0 - # Put a little pause between each download. - if args.state.download.nil? - if args.state.download_debounce > 0 - args.state.download_debounce -= 1 - else - args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg' - end + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + puts "* INFO - Please specify the number of sprites to render." + args.gtk.console.set_command "reset_with count: 100" end - if !args.state.download.nil? - if args.state.download[:complete] - if args.state.download[:http_response_code] == 200 - fname = "sprites/#{args.state.photos.length}.jpg" - $gtk.write_file fname, args.state.download[:response_data] - args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ] - end - args.state.download = nil - args.state.download_debounce = (rand(3) + 2) * 60 - end + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| new_star args } end - # draw any downloaded photos... - args.state.photos.each { |i| - args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite - } + # update + args.state.stars.each { |s| move_star args, s } - # Draw a download progress bar... - args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid - if !args.state.download.nil? - br = args.state.download[:response_read] - total = args.state.download[:response_total] - if total != 0 - pct = br.to_f / total.to_f - args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid - end - end + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end + + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count end #+end_src -* 99_genre_3d/3d_cube/app/main.rb +* Performance - Sprites As Entities - main.rb #+begin_src ruby - STARTX = 0.0 - STARTY = 0.0 - ENDY = 20.0 - ENDX = 20.0 - SPINPOINT = 10 - SPINDURATION = 400 - POINTSIZE = 8 - BOXDEPTH = 40 - YAW = 1 - DISTANCE = 10 + # ./samples/09_performance/02_sprites_as_entities/app/main.rb + # Sprites represented as Entities using the queue ~args.outputs.sprites~ + # yields nicer access apis over Hashes, but require a bit more code upfront. + # The hash sample has to use star[:s] to get the speed of the star, but + # an entity can use .s instead. + def random_x args + (args.grid.w.randomize :ratio) * -1 + end - def tick args - args.outputs.background_color = [0, 0, 0] - a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION) - s = Math.sin(a) - c = Math.cos(a) - x = STARTX - y = STARTY - offset_x = (1280 - (ENDX - STARTX)) / 2 - offset_y = (360 - (ENDY - STARTY)) / 2 + def random_y args + (args.grid.h.randomize :ratio) * -1 + end - srand(1) - while y < ENDY do - while x < ENDX do - if (y == STARTY || - y == (ENDY / 0.5) * 2 || - y == (ENDY / 0.5) * 2 + 0.5 || - y == ENDY - 0.5 || - x == STARTX || - x == ENDX - 0.5) - z = rand(BOXDEPTH) - z *= Math.sin(a / 2) - x -= SPINPOINT - u = (x * c) - (z * s) - v = (x * s) + (z * c) - k = DISTANCE.fdiv(100) + (v / 500 * YAW) - u = u / k - v = y / k - w = POINTSIZE / 10 / k - args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'} - x += SPINPOINT - end - x += 0.5 - end - y += 0.5 - x = STARTX - end + def random_speed + 1 + (4.randomize :ratio) end - $gtk.reset - -#+end_src - -* 99_genre_arcade/dueling_starships/app/main.rb -#+begin_src ruby - class DuelingSpaceships - attr_accessor :state, :inputs, :outputs, :grid + def new_star args + args.state.new_entity :star, { + x: (random_x args), + y: (random_y args), + w: 4, h: 4, + path: 'sprites/tiny-star.png', + s: random_speed + } + end - def tick - defaults - render - calc - input + def move_star args, star + star.x += star.s + star.y += star.s + if star.x > args.grid.w || star.y > args.grid.h + star.x = (random_x args) + star.y = (random_y args) + star.s = random_speed end + end - def defaults - outputs.background_color = [0, 0, 0] - state.ship_blue ||= new_blue_ship - state.ship_red ||= new_red_ship - state.flames ||= [] - state.bullets ||= [] - state.ship_blue_score ||= 0 - state.ship_red_score ||= 0 - state.stars ||= 100.map do - [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio), - grid.h_half.randomize(:sign, :ratio)), - 128 + 128.randomize(:ratio), 255, 255] - end - end + def tick args + args.state.star_count ||= 0 - def default_ship x, y, angle, sprite_path, bullet_sprite_path, color - state.new_entity(:ship, - { x: x, - y: y, - dy: 0, - dx: 0, - damage: 0, - dead: false, - angle: angle, - max_alpha: 255, - sprite_path: sprite_path, - bullet_sprite_path: bullet_sprite_path, - color: color }) + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + puts "* INFO - Please specify the number of sprites to render." + args.gtk.console.set_command "reset_with count: 100" end - def new_red_ship - default_ship(400, 250.randomize(:sign, :ratio), - 180, 'sprites/ship_red.png', 'sprites/red_bullet.png', - [255, 90, 90]) + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| new_star args } end - def new_blue_ship - default_ship(-400, 250.randomize(:sign, :ratio), - 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png', - [110, 140, 255]) - end + # update + args.state.stars.each { |s| move_star args, s } - def render - render_instructions - render_score - render_universe - render_flames - render_ships - render_bullets - end + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end - def render_ships - update_ship_outputs(state.ship_blue) - update_ship_outputs(state.ship_red) - outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite] - outputs.labels << [state.ship_blue.label, state.ship_red.label] - end + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +* Performance - Sprites As Strict Entities - main.rb +#+begin_src ruby + # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb + # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ + # yields apis access similar to Entities, but all properties that can be set on the + # entity must be predefined with a default value. Strict entities do not support the + # addition of new properties after the fact. They are more performant than OpenEntities + # because of this constraint. + def random_x args + (args.grid.w.randomize :ratio) * -1 + end - def render_instructions - return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 || - state.ship_red.dx > 0 || state.ship_red.dy > 0 || - state.flames.length > 0 + def random_y args + (args.grid.h.randomize :ratio) * -1 + end - outputs.labels << [grid.left.shift_right(30), - grid.bottom.shift_up(30), - "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.", - 0, 0, 255, 255, 255] - end + def random_speed + 1 + (4.randomize :ratio) + end - def calc - calc_thrusts - calc_ships - calc_bullets - calc_winner + def new_star args + args.state.new_entity_strict(:star, + x: (random_x args), + y: (random_y args), + w: 4, h: 4, + path: 'sprites/tiny-star.png', + s: random_speed) do |entity| + # invoke attr_sprite so that it responds to + # all properties that are required to render a sprite + entity.attr_sprite end + end - def input - input_accelerate - input_turn - input_bullets_and_mines + def move_star args, star + star.x += star.s + star.y += star.s + if star.x > args.grid.w || star.y > args.grid.h + star.x = (random_x args) + star.y = (random_y args) + star.s = random_speed end + end - def render_score - outputs.labels << [grid.left.shift_right(80), - grid.top.shift_down(40), - state.ship_blue_score, 30, 1, state.ship_blue.color] + def tick args + args.state.star_count ||= 0 - outputs.labels << [grid.right.shift_left(80), - grid.top.shift_down(40), - state.ship_red_score, 30, 1, state.ship_red.color] + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + puts "* INFO - Please specify the number of sprites to render." + args.gtk.console.set_command "reset_with count: 100" end - def render_universe - return if outputs.static_solids.any? - outputs.static_solids << grid.rect - outputs.static_solids << state.stars + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| new_star args } end - def apply_round_finished_alpha entity - return entity unless state.round_finished_debounce - entity.a *= state.round_finished_debounce.percentage_of(2.seconds) - return entity - end + # update + args.state.stars.each { |s| move_star args, s } - def update_ship_outputs ship, sprite_size = 66 - ship.sprite = - apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y), - ship.sprite_path, - ship.angle, - ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite - ship.label = - apply_round_finished_alpha [ship.x, - ship.y + 100, - "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label - end + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end - def render_flames sprite_size = 6 - outputs.sprites << state.flames.map do |p| - apply_round_finished_alpha [sprite_size.to_square(p.x, p.y), - 'sprites/flame.png', 0, - p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite - end + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +* Performance - Sprites As Classes - main.rb +#+begin_src ruby + # ./samples/09_performance/04_sprites_as_classes/app/main.rb + # Sprites represented as Classes using the queue ~args.outputs.sprites~. + # gives you full control of property declaration and method invocation. + # They are more performant than OpenEntities and StrictEntities, but more code upfront. + class Star + attr_sprite + + def initialize grid + @grid = grid + @x = (rand @grid.w) * -1 + @y = (rand @grid.h) * -1 + @w = 4 + @h = 4 + @s = 1 + (4.randomize :ratio) + @path = 'sprites/tiny-star.png' end - def render_bullets sprite_size = 10 - outputs.sprites << state.bullets.map do |b| - apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y), - b.owner.bullet_sprite_path, - 0, b.max_alpha].sprite - end + def move + @x += @s + @y += @s + @x = (rand @grid.w) * -1 if @x > @grid.right + @y = (rand @grid.h) * -1 if @y > @grid.top end + end - def wrap_location! location - location.x = grid.left if location.x > grid.right - location.x = grid.right if location.x < grid.left - location.y = grid.top if location.y < grid.bottom - location.y = grid.bottom if location.y > grid.top - location + # calls methods needed for game to run properly + def tick args + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + args.gtk.console.set_command "reset_with count: 100" end - def calc_thrusts - state.flames = - state.flames - .reject(&:old?) - .map do |p| - p.speed *= 0.9 - p.y += p.angle.vector_y(p.speed) - p.x += p.angle.vector_x(p.speed) - wrap_location! p - end + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } end - def all_ships - [state.ship_blue, state.ship_red] + # update + args.state.stars.each(&:move) + + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end + + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +* Performance - Static Sprites As Classes - main.rb +#+begin_src ruby + # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb + # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. + # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held + # by reference. You get better performance, but you are mutating state of held objects + # which is less functional/data oriented. + class Star + attr_sprite + + def initialize grid + @grid = grid + @x = (rand @grid.w) * -1 + @y = (rand @grid.h) * -1 + @w = 4 + @h = 4 + @s = 1 + (4.randomize :ratio) + @path = 'sprites/tiny-star.png' end - def alive_ships - all_ships.reject { |s| s.dead } + def move + @x += @s + @y += @s + @x = (rand @grid.w) * -1 if @x > @grid.right + @y = (rand @grid.h) * -1 if @y > @grid.top end + end - def calc_bullet bullet - bullet.y += bullet.angle.vector_y(bullet.speed) - bullet.x += bullet.angle.vector_x(bullet.speed) - wrap_location! bullet - explode_bullet! bullet if bullet.old? - return if bullet.exploded - return if state.round_finished - alive_ships.each do |s| - if s != bullet.owner && - s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y)) - explode_bullet! bullet, 10, 5, 30 - s.damage += 1 - end - end + # calls methods needed for game to run properly + def tick args + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + args.gtk.console.set_command "reset_with count: 100" end - def calc_bullets - state.bullets.each { |b| calc_bullet b } - state.bullets.reject! { |b| b.exploded } + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } end - def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255 - flame_count.times do - state.flames << state.new_entity(type, - { angle: 360.randomize(:ratio), - speed: max_speed.randomize(:ratio), - lifetime: lifetime, - x: entity.x, - y: entity.y, - max_alpha: max_alpha }) - end - end + # update + args.state.stars.each(&:move) - def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10 - bullet.exploded = true - create_explosion! :bullet_explosion, - bullet, - flame_override, - max_speed, - lifetime, - bullet.max_alpha - end + # render + args.outputs.sprites << args.state.stars + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end - def calc_ship ship - ship.x += ship.dx - ship.y += ship.dy - wrap_location! ship + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +* Performance - Static Sprites As Classes With Custom Drawing - main.rb +#+begin_src ruby + # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb + # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. + # is the fastest approach. This is comparable to what other game engines set as the default behavior. + # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing + # functional/data-oriented practices. + class Star + def initialize grid + @grid = grid + @x = (rand @grid.w) * -1 + @y = (rand @grid.h) * -1 + @w = 4 + @h = 4 + @s = 1 + (4.randomize :ratio) + @path = 'sprites/tiny-star.png' end - def calc_ships - all_ships.each { |s| calc_ship s } - return if all_ships.any? { |s| s.dead } - return if state.round_finished - return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite) - state.ship_blue.damage = 5 - state.ship_red.damage = 5 + def move + @x += @s + @y += @s + @x = (rand @grid.w) * -1 if @x > @grid.right + @y = (rand @grid.h) * -1 if @y > @grid.top end - def create_thruster_flames! ship - state.flames << state.new_entity(:ship_thruster, - { angle: ship.angle + 180 + 60.randomize(:sign, :ratio), - speed: 5.randomize(:ratio), - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), - lifetime: 30, - x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio), - y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) }) - end + # if the object that is in args.outputs.sprites (or static_sprites) + # respond_to? :draw_override, then the method is invoked giving you + # access to the class used to draw to the canvas. + def draw_override ffi_draw + # first move then draw + move - def input_accelerate_ship should_move_ship, ship - return if ship.dead + # The argument order for ffi.draw_sprite is: + # x, y, w, h, path + ffi_draw.draw_sprite @x, @y, @w, @h, @path - should_move_ship &&= (ship.dx + ship.dy).abs < 5 + # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value): + # x, y, w, h, path, + # angle, alpha - if should_move_ship - create_thruster_flames! ship - ship.dx += ship.angle.vector_x 0.050 - ship.dy += ship.angle.vector_y 0.050 - else - ship.dx *= 0.99 - ship.dy *= 0.99 - end + # The argument order for ffi_draw.draw_sprite_3 is: + # x, y, w, h, + # path, + # angle, + # alpha, red_saturation, green_saturation, blue_saturation + # flip_horizontally, flip_vertically, + # tile_x, tile_y, tile_w, tile_h + # angle_anchor_x, angle_anchor_y, + # source_x, source_y, source_w, source_h end + end - def input_accelerate - input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue - input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red + # calls methods needed for game to run properly + def tick args + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + args.gtk.console.set_command "reset_with count: 100" end - def input_turn_ship direction, ship - ship.angle -= 3 * direction + # init + if args.state.tick_count == 0 + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } + args.outputs.static_sprites << args.state.stars end - def input_turn - input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue - input_turn_ship inputs.controller_two.left_right, state.ship_red - end + # render framerate + args.outputs.background_color = [0, 0, 0] + args.outputs.primitives << args.gtk.current_framerate_primitives + end - def input_bullet create_bullet, ship - return unless create_bullet - return if ship.dead + # resets game, and assigns star count given by user + def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count + end + +#+end_src + +* Performance - Collision Limits - main.rb +#+begin_src ruby + # ./samples/09_performance/07_collision_limits/app/main.rb + =begin - state.bullets << state.new_entity(:ship_bullet, - { owner: ship, - angle: ship.angle, - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), - speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y), - lifetime: 120, - sprite_size: 10, - x: ship.x + ship.angle.vector_x * 32, - y: ship.y + ship.angle.vector_y * 32 }) - end + Reminders: + - find_all: Finds all elements of a collection that meet certain requirements. + In this sample app, we're finding all bodies that intersect with the center body. - def input_mine create_mine, ship - return unless create_mine - return if ship.dead + - 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. - state.bullets << state.new_entity(:ship_bullet, - { owner: ship, - angle: 360.randomize(:sign, :ratio), - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), - speed: 0.02, - sprite_size: 10, - lifetime: 600, - x: ship.x + ship.angle.vector_x * -50, - y: ship.y + ship.angle.vector_y * -50 }) - end + - 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. - def input_bullets_and_mines - return if state.bullets.length > 100 + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. - [ - [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space, - inputs.controller_one.key_down.b || inputs.keyboard.key_down.down, - state.ship_blue], - [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red] - ].each do |a_held, b_down, ship| - input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship) - input_mine(b_down, ship) - end - end + =end - def calc_kill_ships - alive_ships.find_all { |s| s.damage >= 5 }.each do |s| - s.dead = true - create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha - end - end + # This code demonstrates moving objects that loop around once they exceed the scope of the screen, + # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies". - def calc_score - return if state.round_finished - return if alive_ships.length > 1 + def body_count num + $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection + end - if alive_ships.first == state.ship_red - state.ship_red_score += 1 - elsif alive_ships.first == state.ship_blue - state.ship_blue_score += 1 - end + def tick args - state.round_finished = true - end + # Center body's values are set using an array + # Map is used to set values of 2000 other bodies + # All bodies that intersect with center body are stored in collisions collection + args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center + args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen - def calc_reset_ships - return unless state.round_finished - state.round_finished_debounce ||= 2.seconds - state.round_finished_debounce -= 1 - return if state.round_finished_debounce > 0 - start_new_round! - end + # finds all bodies that intersect with center body, stores them in collisions + collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body } - def start_new_round! - state.ship_blue = new_blue_ship - state.ship_red = new_red_ship - state.round_finished = false - state.round_finished_debounce = nil - state.flames.clear - state.bullets.clear - end + args.borders << args.state.center_body # outputs center body as a black border - def calc_winner - calc_kill_ships - calc_score - calc_reset_ships + # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes + args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid + args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well + + args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner + + # Bodies are returned to bottom left corner if positions exceed scope of screen + args.state.other_bodies.each do |b| # for each body in the other_bodies collection + b.x += 5 # x and y are both incremented by 5 + b.y += 5 + b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right) + b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up) end end - $dueling_spaceship = DuelingSpaceships.new - - def tick args - args.grid.origin_center! - $dueling_spaceship.inputs = args.inputs - $dueling_spaceship.outputs = args.outputs - $dueling_spaceship.state = args.state - $dueling_spaceship.grid = args.grid - $dueling_spaceship.tick - end + # Resets the game. + $gtk.reset #+end_src -* 99_genre_arcade/flappy_dragon/app/main.rb +* Advanced Debugging - Trace Debugging - main.rb #+begin_src ruby - class FlappyDragon - attr_accessor :grid, :inputs, :state, :outputs + # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb + class Game + attr_gtk - def tick - defaults - render - calc - process_inputs + def method1 num + method2 num end - def defaults - state.flap_power = 11 - state.gravity = 0.9 - state.ceiling = 600 - state.ceiling_flap_power = 6 - state.wall_countdown_length = 100 - state.wall_gap_size = 100 - state.wall_countdown ||= 0 - state.hi_score ||= 0 - state.score ||= 0 - state.walls ||= [] - state.x ||= 50 - state.y ||= 500 - state.dy ||= 0 - state.scene ||= :menu - state.scene_at ||= 0 - state.difficulty ||= :normal - state.new_difficulty ||= :normal - state.countdown ||= 4.seconds - state.flash_at ||= 0 + def method2 num + method3 num end - def render - outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1 - render_score - render_menu - render_game + def method3 num + method4 num end - def render_score - outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label - outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label - outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + def method4 num + if num == 1 + puts "UNLUCKY #{num}." + state.unlucky_count += 1 + if state.unlucky_count > 3 + raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." + end + else + puts "LUCKY #{num}." + end end - def render_menu - return unless state.scene == :menu - render_overlay + def tick + state.roll_history ||= [] + state.roll_history << rand(20) + 1 + state.countdown ||= 600 + state.countdown -= 1 + state.unlucky_count ||= 0 + outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] + if state.countdown > 0 + outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] + else + state.attempts ||= 0 + state.attempts += 1 + outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] + end + return if state.countdown > 0 + method1 state.roll_history[-1] + end + end - outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] - outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] - outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] - outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] - outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] - outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] - outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + $game = Game.new - outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] - outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] - outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] - outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + def tick args + trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT + $game.args = args + $game.tick + end + +#+end_src + +* Advanced Debugging - Trace Debugging Classes - main.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb + class Foobar + def initialize + trace! # Trace is added to the constructor. end - def render_overlay - outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + def clicky args + return unless args.inputs.mouse.click + try_rand rand end - def render_game - render_game_over - render_background - render_walls - render_dragon - render_flash + def try_rand num + return if num < 0.9 + raise "Exception finally occurred. Take a look at logs/trace.txt #{num}." end + end - def render_game_over - return unless state.scene == :game - outputs.labels << [638, 358, score_text, 20, 1] - outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] - outputs.labels << [638, 428, countdown_text, 20, 1] - outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + def tick args + args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1] + args.state.foobar = Foobar.new if args.tick_count + return unless args.state.foobar + args.state.foobar.clicky args + end + +#+end_src + +* Advanced Debugging - Unit Tests - exception_raising_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb + begin :shared + class ExceptionalClass + def initialize exception_to_throw = nil + raise exception_to_throw if exception_to_throw + end end + end - def render_background - outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] - - scroll_point_at = state.tick_count - scroll_point_at = state.scene_at if state.scene == :menu - scroll_point_at = state.death_at if state.countdown > 0 - scroll_point_at ||= 0 - - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25) - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50) - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) + def test_exception_in_newing_object args, assert + begin + ExceptionalClass.new TypeError + raise "Exception wasn't thrown!" + rescue Exception => e + assert.equal! e.class, TypeError, "Exceptions within constructor should be retained." end + end - def render_walls - state.walls.each do |w| - w.sprites = [ - [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], - [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] - ] - end - outputs.sprites << state.walls.map(&:sprites) + puts "running tests" + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start + +#+end_src + +* Advanced Debugging - Unit Tests - gen_docs.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb + # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick + Kernel.export_docs! + +#+end_src + +* Advanced Debugging - Unit Tests - geometry_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb + begin :shared + def primitive_representations x, y, w, h + [ + [x, y, w, h], + { x: x, y: y, w: w, h: h }, + RectForTest.new(x, y, w, h) + ] end - def render_dragon - state.show_death = true if state.countdown == 3.seconds - - render_debug_hitbox false + class RectForTest + attr_sprite - if state.show_death == false || !state.death_at - animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at - sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] - else - sprite_name = "sprites/dragon_die.png" - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] - sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds - state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 - state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction - state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6) + def initialize x, y, w, h + @x = x + @y = y + @w = w + @h = h end - outputs.sprites << state.dragon_sprite + def to_s + "RectForTest: #{[x, y, w, h]}" + end end + end - def render_debug_hitbox show - return unless show - outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite - outputs.borders << state.walls.flat_map do |w| - w.sprites.map { |s| [s.rect, 255, 0, 0] } - end + begin :intersect_rect? + def test_intersect_rect_point args, assert + assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect." end - def render_flash - return unless state.flash_at + def test_intersect_rect args, assert + intersecting = primitive_representations(0, 0, 100, 100) + + primitive_representations(20, 20, 20, 20) - outputs.primitives << [grid.rect, - white, - 255 * state.flash_at.ease(20, :flip)].solid + intersecting.product(intersecting).each do |rect_one, rect_two| + assert.true! rect_one.intersect_rect?(rect_two), + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)." + end - state.flash_at = 0 if state.flash_at.elapsed_time > 20 - end + not_intersecting = [ + [ 0, 0, 5, 5], + { x: 10, y: 10, w: 5, h: 5 }, + RectForTest.new(20, 20, 5, 5) + ] - def calc - return unless state.scene == :game - reset_game if state.countdown == 1 - state.countdown -= 1 and return if state.countdown > 0 - calc_walls - calc_flap - calc_game_over + not_intersecting.product(not_intersecting) + .reject { |rect_one, rect_two| rect_one == rect_two } + .each do |rect_one, rect_two| + assert.false! rect_one.intersect_rect?(rect_two), + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)." + end end + end - def calc_walls - state.walls.each { |w| w.x -= 8 } - - walls_count_before_removal = state.walls.length - - state.walls.reject! { |w| w.x < -100 } - - state.score += 1 if state.walls.count < walls_count_before_removal - - state.wall_countdown -= 1 and return if state.wall_countdown > 0 - - state.walls << state.new_entity(:wall) do |w| - w.x = grid.right - w.opening = grid.top - .randomize(:ratio) - .greater(200) - .lesser(520) - w.bottom_height = w.opening - state.wall_gap_size - w.top_y = w.opening + state.wall_gap_size - end - - state.wall_countdown = state.wall_countdown_length - end - - def calc_flap - state.y += state.dy - state.dy = state.dy.lesser state.flap_power - state.dy -= state.gravity - return if state.y < state.ceiling - state.y = state.ceiling - state.dy = state.dy.lesser state.ceiling_flap_power - end - - def calc_game_over - return unless game_over? - - state.death_at = state.tick_count - state.death_from = state.walls.first - state.death_fall_direction = -1 - state.death_fall_direction = 1 if state.x > state.death_from.x - outputs.sounds << "sounds/hit-sound.wav" - begin_countdown - end - - def process_inputs - process_inputs_menu - process_inputs_game + begin :inside_rect? + def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil + assert.true! inner.inside_rect?(outer) == expected, + "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})." end - def process_inputs_menu - return unless state.scene == :menu - - changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select - if inputs.mouse.click - p = inputs.mouse.click.point - if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800) - changediff = true - end - end - - if changediff - case state.new_difficulty - when :easy - state.new_difficulty = :normal - when :normal - state.new_difficulty = :hard - when :hard - state.new_difficulty = :flappy - when :flappy - state.new_difficulty = :easy - end - end - - if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a - state.difficulty = state.new_difficulty - change_to_scene :game - reset_game false - state.hi_score = 0 - begin_countdown - end - - if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b - state.new_difficulty = state.difficulty - change_to_scene :game + def test_inside_rect args, assert + outer_rects = primitive_representations(0, 0, 10, 10) + inner_rects = primitive_representations(1, 1, 5, 5) + primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5)) + .each do |outer, inner| + assert_inside_rect outer: outer, inner: inner, + expected: true, assert: assert end end + end - def process_inputs_game - return unless state.scene == :game + begin :angle_to + def test_angle_to args, assert + origins = primitive_representations(0, 0, 0, 0) + rights = primitive_representations(1, 0, 0, 0) + aboves = primitive_representations(0, 1, 0, 0) - clicked_menu = false - if inputs.mouse.click - p = inputs.mouse.click.point - clicked_menu = (p.y >= 620) && (p.x < 275) - end + origins.product(aboves).each do |origin, above| + assert.equal! origin.angle_to(above), 90, + "A point directly above should be 90 degrees." - if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start - change_to_scene :menu - elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0 - state.dy = 0 - state.dy += state.flap_power - state.flapped_at = state.tick_count - outputs.sounds << "sounds/fly-sound.wav" + assert.equal! above.angle_from(origin), 90, + "A point coming from above should be 90 degrees." end - end - - def scrolling_background at, path, rate, y = 0 - [ - [ 0 - at.*(rate) % 1440, y, 1440, 720, path], - [1440 - at.*(rate) % 1440, y, 1440, 720, path] - ] - end - - def white - [255, 255, 255] - end - - def large_white_typeset - [5, 0, 255, 255, 255] - end - - def at_beginning? - state.walls.count == 0 - end - - def dragon_collision_box - state.dragon_sprite - .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) - .rect_shift_right(10) - .rect_shift_up(state.dy * 2) - end - def game_over? - return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning? + origins.product(rights).each do |origin, right| + assert.equal! origin.angle_to(right) % 360, 0, + "A point directly to the right should be 0 degrees." - state.walls - .flat_map { |w| w.sprites } - .any? do |s| - s.intersect_rect?(dragon_collision_box) - end - end + assert.equal! right.angle_from(origin) % 360, 0, + "A point coming from the right should be 0 degrees." - def collision_forgiveness - case state.difficulty - when :easy - 0.9 - when :normal - 0.7 - when :hard - 0.5 - when :flappy - 0.3 - else - 0.9 end end + end - def countdown_text - state.countdown ||= -1 - return "" if state.countdown == 0 - return "GO!" if state.countdown.idiv(60) == 0 - return "GAME OVER" if state.death_at - return "READY?" - end + begin :scale_rect + def test_scale_rect args, assert + assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5), + [25.0, 25.0, 50.0, 50.0] - def begin_countdown - state.countdown = 4.seconds - end + assert.equal! [0, 0, 100, 100].scale_rect(0.5), + [0.0, 0.0, 50.0, 50.0] - def score_text - return "" unless state.countdown > 1.seconds - return "" unless state.death_at - return "SCORE: 0 (LOL)" if state.score == 0 - return "HI SCORE: #{state.score}" if state.score == state.hi_score - return "SCORE: #{state.score}" - end + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5), + [25.0, 25.0, 50.0, 50.0] - def reset_game set_flash = true - state.flash_at = state.tick_count if set_flash - state.walls = [] - state.y = 500 - state.dy = 0 - state.hi_score = state.hi_score.greater(state.score) - state.score = 0 - state.wall_countdown = state.wall_countdown_length.fdiv(2) - state.show_death = false - state.death_at = nil + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0), + [0.0, 0.0, 50.0, 50.0] end + end - def change_to_scene scene - state.scene = scene - state.scene_at = state.tick_count - inputs.keyboard.clear - inputs.controller_one.clear + puts "running tests" + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start + +#+end_src + +* Advanced Debugging - Unit Tests - http_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb + def try_assert_or_schedule args, assert + if $result[:complete] + log_info "Request completed! Verifying." + if $result[:http_response_code] != 200 + log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200." + exit + end + log_info ":try_assert_or_schedule succeeded!" + else + args.gtk.schedule_callback Kernel.tick_count + 10 do + try_assert_or_schedule args, assert + end end end - $flappy_dragon = FlappyDragon.new - - def tick args - $flappy_dragon.grid = args.grid - $flappy_dragon.inputs = args.inputs - $flappy_dragon.state = args.state - $flappy_dragon.outputs = args.outputs - $flappy_dragon.tick + def test_http args, assert + $result = $gtk.http_get 'http://dragonruby.org' + try_assert_or_schedule args, assert end + + puts "running tests" + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start #+end_src -* 99_genre_arcade/pong/app/main.rb +* Advanced Debugging - Unit Tests - object_to_primitive_tests.rb #+begin_src ruby - def tick args - defaults args - render args - calc args - input args + # ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb + class PlayerSpriteForTest end - def defaults args - args.state.ball.debounce ||= 3 * 60 - args.state.ball.size ||= 10 - args.state.ball.size_half ||= args.state.ball.size / 2 - args.state.ball.x ||= 640 - args.state.ball.y ||= 360 - args.state.ball.dx ||= 5.randomize(:sign) - args.state.ball.dy ||= 5.randomize(:sign) - args.state.left_paddle.y ||= 360 - args.state.right_paddle.y ||= 360 - args.state.paddle.h ||= 120 - args.state.paddle.w ||= 10 - args.state.left_paddle.score ||= 0 - args.state.right_paddle.score ||= 0 + def test_array_to_sprite args, assert + array = [[0, 0, 100, 100, "test.png"]].sprites + puts "No exception was thrown. Sweet!" end - def render args - render_center_line args - render_scores args - render_countdown args - render_ball args - render_paddles args - render_instructions args + def test_class_to_sprite args, assert + array = [PlayerSprite.new].sprites + assert.true! array.first.is_a?(PlayerSprite) + puts "No exception was thrown. Sweet!" end - begin :render_methods - def render_center_line args - args.outputs.lines << [640, 0, 640, 720] - end + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start + +#+end_src + +* Advanced Debugging - Unit Tests - parsing_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb + def test_parse_json args, assert + result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' + assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed." + end - def render_scores args - args.outputs.labels << [ - [320, 650, args.state.left_paddle.score, 10, 1], - [960, 650, args.state.right_paddle.score, 10, 1] - ] - end + def test_parse_xml args, assert + result = args.gtk.parse_xml <<-S + + John Doe + + S - def render_countdown args - return unless args.state.ball.debounce > 0 - args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1] - end + expected = {:type=>:element, + :name=>nil, + :children=>[{:type=>:element, + :name=>"Person", + :children=>[{:type=>:element, + :name=>"Name", + :children=>[{:type=>:content, + :data=>"John Doe"}]}], + :attributes=>{"id"=>"100"}}]} - def render_ball args - args.outputs.solids << solid_ball(args) - end + assert.equal! result, expected, "Parsing xml failed." + end - def render_paddles args - args.outputs.solids << solid_left_paddle(args) - args.outputs.solids << solid_right_paddle(args) - end + puts "running tests" + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start + +#+end_src + +* Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb +#+begin_src ruby + # ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb + def test_serialize args, assert + GTK::Entity.__reset_id__! + args.state.player_one = "test" + result = args.gtk.serialize_state args.state + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" - def render_instructions args - args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1] - args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1] - end + GTK::Entity.__reset_id__! + args.gtk.write_file 'state.txt', '' + result = args.gtk.serialize_state 'state.txt', args.state + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" end - def calc args - args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0 - calc_move_ball args - calc_collision_with_left_paddle args - calc_collision_with_right_paddle args - calc_collision_with_walls args + def test_deserialize args, assert + GTK::Entity.__reset_id__! + result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' + assert.equal! result.player_one, "test" + + GTK::Entity.__reset_id__! + args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' + result = args.gtk.deserialize_state 'state.txt' + assert.equal! result.player_one, "test" end - begin :calc_methods - def calc_move_ball args - args.state.ball.x += args.state.ball.dx - args.state.ball.y += args.state.ball.dy + def test_very_large_serialization args, assert + GTK::Entity.__reset_id__! + size = 3000 + size.map_with_index do |i| + args.state.send("k#{i}=".to_sym, i) end - def calc_collision_with_left_paddle args - if solid_left_paddle(args).intersect_rect? solid_ball(args) - args.state.ball.dx *= -1 - elsif args.state.ball.x < 0 - args.state.right_paddle.score += 1 - calc_reset_round args - end - end + result = args.gtk.serialize_state args.state + assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly") + end - def calc_collision_with_right_paddle args - if solid_right_paddle(args).intersect_rect? solid_ball(args) - args.state.ball.dx *= -1 - elsif args.state.ball.x > 1280 - args.state.left_paddle.score += 1 - calc_reset_round args - end - end + def test_strict_entity_serialization args, assert + GTK::Entity.__reset_id__! + args.state.player_one = args.state.new_entity(:player, name: "Ryu") + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken") - def calc_collision_with_walls args - if args.state.ball.y + args.state.ball.size_half > 720 - args.state.ball.y = 720 - args.state.ball.size_half - args.state.ball.dy *= -1 - elsif args.state.ball.y - args.state.ball.size_half < 0 - args.state.ball.y = args.state.ball.size_half - args.state.ball.dy *= -1 - end - end + serialized_state = args.gtk.serialize_state args.state + assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}' - def calc_reset_round args - args.state.ball.x = 640 - args.state.ball.y = 360 - args.state.ball.dx = 5.randomize(:sign) - args.state.ball.dy = 5.randomize(:sign) - args.state.ball.debounce = 3 * 60 - end - end + deserialize_state = args.gtk.deserialize_state serialized_state - def input args - input_left_paddle args - input_right_paddle args + assert.equal! args.state.player_one.name, deserialize_state.player_one.name + assert.true! args.state.player_one.is_a? GTK::OpenEntity + + assert.equal! args.state.player_two.name, deserialize_state.player_two.name + assert.true! args.state.player_two.is_a? GTK::StrictEntity end - begin :input_methods - def input_left_paddle args - if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s - args.state.left_paddle.y -= 40 - elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w - args.state.left_paddle.y += 40 - end - end + def test_strict_entity_serialization_with_nil args, assert + GTK::Entity.__reset_id__! + args.state.player_one = args.state.new_entity(:player, name: "Ryu") + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) - def input_right_paddle args - if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l - args.state.right_paddle.y -= 40 - elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o - args.state.right_paddle.y += 40 - end - end - end + serialized_state = args.gtk.serialize_state args.state + assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}' - begin :assets - def solid_ball args - centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size - end + deserialized_state = args.gtk.deserialize_state serialized_state - def solid_left_paddle args - centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h - end + assert.equal! args.state.player_one.name, deserialized_state.player_one.name + assert.true! args.state.player_one.is_a? GTK::OpenEntity - def solid_right_paddle args - centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h - end + assert.equal! args.state.player_two.name, deserialized_state.player_two.name + assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type + assert.equal! deserialized_state.player_two.blood_type, nil + assert.true! args.state.player_two.is_a? GTK::StrictEntity - def centered_rect x, y, w, h - [x - w / 2, y - h / 2, w, h] - end + deserialized_state.player_two.blood_type = :O + assert.equal! deserialized_state.player_two.blood_type, :O + end - def centered_rect_vertically x, y, w, h - [x, y - h / 2, w, h] - end + def test_multiple_strict_entities args, assert + GTK::Entity.__reset_id__! + args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu") + args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean') + + serialized_state = args.gtk.serialize_state args.state + deserialized_state = args.gtk.deserialize_state serialized_state + + assert.equal! deserialized_state.player.name, "Ryu" + assert.equal! deserialized_state.enemy.other_property, "extra mean" end + + $tests.start #+end_src -* 99_genre_arcade/snakemoji/app/main.rb +* Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb #+begin_src ruby - # coding: utf-8 - ################################ - # So I was working on a snake game while - # learning DragonRuby, and at some point I had a thought - # what if I use "😀" as a function name, surely it wont work right...? - # RIGHT....? - # BUT IT DID, IT WORKED - # it all went downhill from then - # Created by Anton K. (ai Doge) - # https://gist.github.com/scorp200 - #############LICENSE############ - # Feel free to use this anywhere and however you want - # You can sell this to EA for $1,000,000 if you want, its completely free. - # Just rememeber you are helping this... thing... to spread... - # ALSO! I am not liable for any mental, physical or financial damage caused. - #############LICENSE############ + # ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb + MAX_CODE_GEN_LENGTH = 50 + # NOTE: This is experimental/advanced stuff. + def needs_partitioning? target + target[:value].to_s.length > MAX_CODE_GEN_LENGTH + end - class Array - #Helper function - def move! vector - self.x += vector.x - self.y += vector.y - return self + def partition target + return [] unless needs_partitioning? target + if target[:value].is_a? GTK::OpenEntity + target[:value] = target[:value].hash end - #Helper function to draw snake body - def draw! 🎮, 📺, color - translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color] + results = [] + idx = 0 + left, right = target[:value].partition do + idx += 1 + idx.even? end + left, right = Hash[left], Hash[right] + left = { value: left } + right = { value: right} + [left, right] + end - #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is ** - #I kept trying different combinations of symbols, when suddenly... - def 😀 value - self.map {|d| d * value} + def add_partition target, path, aggregate, final_result + partitions = partition target + partitions.each do |part| + if needs_partitioning? part + if part[:value].keys.length == 1 + first_key = part[:value].keys[0] + new_part = { value: part[:value][first_key] } + path.push first_key + add_partition new_part, path, aggregate, final_result + path.pop + else + add_partition part, path, aggregate, final_result + end + else + final_result << { value: { __path__: [*path] } } + final_result << { value: part[:value] } + end end end - #Draw stuff with an offset - def translate output_collection, ⛓, what - what.x += ⛓.x - what.y += ⛓.y - output_collection << what + def state_to_string state + parts_queue = [] + final_queue = [] + add_partition({ value: state.hash }, + [], + parts_queue, + final_queue) + final_queue.reject {|i| i[:value].keys.length == 0}.map do |i| + i[:value].to_s + end.join("\n#==================================================#\n") end - BLUE = [33, 150, 243] - RED = [244, 67, 54] - GOLD = [255, 193, 7] - LAST = 0 + def state_from_string string + Kernel.eval("$load_data = {}") + lines = string.split("\n#==================================================#\n") + lines.each do |l| + puts "todo: #{l}" + end - def tick args - defaults args.state - render args.state, args.outputs - input args.state, args.inputs - update args.state + GTK::OpenEntity.parse_from_hash $load_data end - def update 🎮 - #Update every 10 frames - if 🎮.tick_count.mod_zero? 10 - #Add new snake body piece at head's location - 🎮.🐍 << [*🎮.🤖] - #Assign Next Direction to Direction - 🎮.🚗 = *🎮.🚦 - - #Trim the snake a bit if its longer than current size - if 🎮.🐍.length > 🎮.🛒 - 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1] - end - - #Move the head in the Direction - 🎮.🤖.move! 🎮.🚗 - - #If Head is outside the playing field, or inside snake's body restart game - if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖} - LAST = 🎮.💰 - 🎮.as_hash.clear - return - end + def test_save_and_load args, assert + args.state.item_1.name = "Jane" + string = state_to_string args.state + state = state_from_string string + assert.equal! args.state.item_1.name, state.item_1.name + end - #If head lands on food add size and score - if 🎮.🤖 == 🎮.🍎 - 🎮.🛒 += 1 - 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5 - spawn_🍎 🎮 - puts 🎮.🍎 - end + def test_save_and_load_big args, assert + size = 1000 + size.map_with_index do |i| + args.state.send("k#{i}=".to_sym, i) end - #Every second remove 1 point - if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60) - 🎮.💰 -= 1 + string = state_to_string args.state + state = state_from_string string + size.map_with_index do |i| + assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym) + assert.equal! args.state.send("k#{i}".to_sym), i + assert.equal! state.send("k#{i}".to_sym), i end end - def spawn_🍎 🎮 - #Food - 🎮.🍎 ||= [*🎮.🤖] - #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body - while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do - 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)] - end + def test_save_and_load_big_nested args, assert + args.state.player_one.friend.nested_hash.k0 = 0 + args.state.player_one.friend.nested_hash.k1 = 1 + args.state.player_one.friend.nested_hash.k2 = 2 + args.state.player_one.friend.nested_hash.k3 = 3 + args.state.player_one.friend.nested_hash.k4 = 4 + args.state.player_one.friend.nested_hash.k5 = 5 + args.state.player_one.friend.nested_hash.k6 = 6 + args.state.player_one.friend.nested_hash.k7 = 7 + args.state.player_one.friend.nested_hash.k8 = 8 + args.state.player_one.friend.nested_hash.k9 = 9 + string = state_to_string args.state + state = state_from_string string end - def render 🎮, 📺 - #Paint the background black - 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255] - #Draw a border for the playing field - translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255] + $gtk.reset 100 + $gtk.log_level = :off + $gtk.tests.start + +#+end_src + +* Http - Retrieve Images - main.rb +#+begin_src ruby + # ./samples/11_http/01_retrieve_images/app/main.rb + def tick args + args.outputs.background_color = [0, 0, 0] - #Draw the snake's body - 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end - #Draw the head - 🎮.🤖.draw! 🎮, 📺, BLUE - #Draw the food - 🎮.🍎.draw! 🎮, 📺, RED + # Show a warning at the start. + args.state.warning_debounce ||= 11 * 60 + if args.state.warning_debounce > 0 + args.state.warning_debounce -= 1 + args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] + args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255] + args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255] + return + end - #Draw current score - translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD] - #Draw your last score, if any - translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0] - #Draw starting message, only if Direction is 0 - translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0] - end + args.state.download_debounce ||= 0 # start immediately, reset to non zero later. + args.state.photos ||= [] - def input 🎮, 🕹 - #Left and Right keyboard input, only change if X direction is 0 - if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0 - 🎮.🚦 = [-1, 0] - elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0 - 🎮.🚦 = [1, 0] + # Put a little pause between each download. + if args.state.download.nil? + if args.state.download_debounce > 0 + args.state.download_debounce -= 1 + else + args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg' + end end - #Up and Down keyboard input, only change if Y direction is 0 - if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0 - 🎮.🚦 = [0, 1] - elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0 - 🎮.🚦 = [0, -1] + if !args.state.download.nil? + if args.state.download[:complete] + if args.state.download[:http_response_code] == 200 + fname = "sprites/#{args.state.photos.length}.jpg" + $gtk.write_file fname, args.state.download[:response_data] + args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ] + end + args.state.download = nil + args.state.download_debounce = (rand(3) + 2) * 60 + end end - end - def defaults 🎮 - #Playing field size - 🎮.🗺 ||= [20, 20] - #Scale for drawing, screen height / Field height - 🎮.⚖️ ||= 720 / 🎮.🗺.y - #Offset, offset all rendering to the center of the screen - 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0] - #Padding, make the snake body slightly smaller than the scale - 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i - #Snake Size - 🎮.🛒 ||= 3 - #Snake head, the only part we are actually controlling - 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2] - #Snake body map, follows the head - 🎮.🐍 ||= [] - #Direction the head moves to - 🎮.🚗 ||= [0, 0] - #Next_Direction, during input check only change this variable and then when game updates asign this to Direction - 🎮.🚦 ||= [*🎮.🚗] - #Your score - 🎮.💰 ||= 0 - #Spawns Food randomly - spawn_🍎(🎮) unless 🎮.🍎? + # draw any downloaded photos... + args.state.photos.each { |i| + args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite + } + + # Draw a download progress bar... + args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid + if !args.state.download.nil? + br = args.state.download[:response_read] + total = args.state.download[:response_total] + if total != 0 + pct = br.to_f / total.to_f + args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid + end + end end #+end_src -* 99_genre_arcade/solar_system/app/main.rb +* 12 C Extensions - Basics - main.rb #+begin_src ruby - # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 - # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 - - def defaults args - args.outputs.background_color = [0, 0, 0] - args.state.x ||= 640 - args.state.y ||= 360 - args.state.stars ||= 100.map do - [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand] - end + # ./samples/12_c_extensions/01_basics/app/main.rb + $gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib") + include FFI::CExt - args.state.sun ||= args.state.new_entity(:sun) do |s| - s.s = 100 - s.path = 'sprites/sun.png' - end - - args.state.planets = [ - [:mercury, 65, 5, 88], - [:venus, 100, 10, 225], - [:earth, 120, 10, 365], - [:mars, 140, 8, 687], - [:jupiter, 280, 30, 365 * 11.8], - [:saturn, 350, 20, 365 * 29.5], - [:uranus, 400, 15, 365 * 84], - [:neptune, 440, 15, 365 * 164.8], - [:pluto, 480, 5, 365 * 247.8], - ].map do |name, distance, size, year_in_days| - args.state.new_entity(name) do |p| - p.path = "sprites/#{name}.png" - p.distance = distance * 0.7 - p.s = size * 0.7 - p.year_in_days = year_in_days - end - end - - args.state.ship ||= args.state.new_entity(:ship) do |s| - s.x = 1280 * rand - s.y = 720 * rand - s.angle = 0 - end + def tick args + args.outputs.labels << [460, 600, "square(42) = #{square(42)}"] end - def to_sprite args, entity - x = 0 - y = 0 + +#+end_src + +* 3d - 3d Cube - main.rb +#+begin_src ruby + # ./samples/99_genre_3d/3d_cube/app/main.rb + STARTX = 0.0 + STARTY = 0.0 + ENDY = 20.0 + ENDX = 20.0 + SPINPOINT = 10 + SPINDURATION = 400 + POINTSIZE = 8 + BOXDEPTH = 40 + YAW = 1 + DISTANCE = 10 - if entity.year_in_days - day = args.state.tick_count - day_in_year = day % entity.year_in_days - entity.random_start_day ||= day_in_year * rand - percentage_of_year = day_in_year.fdiv(entity.year_in_days) - angle = 365 * percentage_of_year - x = angle.vector_x(entity.distance) - y = angle.vector_y(entity.distance) - end + def tick args + args.outputs.background_color = [0, 0, 0] + a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION) + s = Math.sin(a) + c = Math.cos(a) + x = STARTX + y = STARTY + offset_x = (1280 - (ENDX - STARTX)) / 2 + offset_y = (360 - (ENDY - STARTY)) / 2 - [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path] + srand(1) + while y < ENDY do + while x < ENDX do + if (y == STARTY || + y == (ENDY / 0.5) * 2 || + y == (ENDY / 0.5) * 2 + 0.5 || + y == ENDY - 0.5 || + x == STARTX || + x == ENDX - 0.5) + z = rand(BOXDEPTH) + z *= Math.sin(a / 2) + x -= SPINPOINT + u = (x * c) - (z * s) + v = (x * s) + (z * c) + k = DISTANCE.fdiv(100) + (v / 500 * YAW) + u = u / k + v = y / k + w = POINTSIZE / 10 / k + args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'} + x += SPINPOINT + end + x += 0.5 + end + y += 0.5 + x = STARTX + end end - def render args - args.outputs.solids << [0, 0, 1280, 720] + $gtk.reset + +#+end_src + +* Arcade - Dueling Starships - main.rb +#+begin_src ruby + # ./samples/99_genre_arcade/dueling_starships/app/main.rb + class DuelingSpaceships + attr_accessor :state, :inputs, :outputs, :grid - args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b| - [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b] + def tick + defaults + render + calc + input end - args.outputs.sprites << to_sprite(args, args.state.sun) - args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p } - args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle] - end + def defaults + outputs.background_color = [0, 0, 0] + state.ship_blue ||= new_blue_ship + state.ship_red ||= new_red_ship + state.flames ||= [] + state.bullets ||= [] + state.ship_blue_score ||= 0 + state.ship_red_score ||= 0 + state.stars ||= 100.map do + [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio), + grid.h_half.randomize(:sign, :ratio)), + 128 + 128.randomize(:ratio), 255, 255] + end + end - def calc args - args.state.stars = args.state.stars.map do |x, y, speed, r, g, b| - x += speed - y += speed - x = 0 if x > 1280 - y = 0 if y > 720 - [x, y, speed, r, g, b] + def default_ship x, y, angle, sprite_path, bullet_sprite_path, color + state.new_entity(:ship, + { x: x, + y: y, + dy: 0, + dx: 0, + damage: 0, + dead: false, + angle: angle, + max_alpha: 255, + sprite_path: sprite_path, + bullet_sprite_path: bullet_sprite_path, + color: color }) end - if args.state.tick_count == 0 - args.outputs.sounds << 'sounds/bg.ogg' + def new_red_ship + default_ship(400, 250.randomize(:sign, :ratio), + 180, 'sprites/ship_red.png', 'sprites/red_bullet.png', + [255, 90, 90]) end - end - def process_inputs args - if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left - args.state.ship.angle += 1 - elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right - args.state.ship.angle -= 1 + def new_blue_ship + default_ship(-400, 250.randomize(:sign, :ratio), + 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png', + [110, 140, 255]) end - if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a - args.state.ship.x += args.state.ship.angle.x_vector - args.state.ship.y += args.state.ship.angle.y_vector + def render + render_instructions + render_score + render_universe + render_flames + render_ships + render_bullets end - end - def tick args - defaults args - render args - calc args - process_inputs args - end + def render_ships + update_ship_outputs(state.ship_blue) + update_ship_outputs(state.ship_red) + outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite] + outputs.labels << [state.ship_blue.label, state.ship_red.label] + end - def r - $gtk.reset - end - -#+end_src - -* 99_genre_crafting/craft_game_starting_point/app/main.rb -#+begin_src ruby - # ================================================== - # A NOTE TO JAM CRAFT PARTICIPANTS: - # The comments and code in here are just as small piece of DragonRuby's capabilities. - # Be sure to check out the rest of the sample apps. Start with README.txt and go from there! - # ================================================== + def render_instructions + return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 || + state.ship_red.dx > 0 || state.ship_red.dy > 0 || + state.flames.length > 0 - # def tick args is the entry point into your game. This function is called at - # a fixed update time of 60hz (60 fps). - def tick args - # The defaults function intitializes the game. - defaults args + outputs.labels << [grid.left.shift_right(30), + grid.bottom.shift_up(30), + "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.", + 0, 0, 255, 255, 255] + end - # After the game is initialized, render it. - render args + def calc + calc_thrusts + calc_ships + calc_bullets + calc_winner + end - # After rendering the player should be able to respond to input. - input args + def input + input_accelerate + input_turn + input_bullets_and_mines + end - # After responding to input, the game performs any additional calculations. - calc args - end + def render_score + outputs.labels << [grid.left.shift_right(80), + grid.top.shift_down(40), + state.ship_blue_score, 30, 1, state.ship_blue.color] - def defaults args - # hide the mouse cursor for this game, we are going to render our own cursor - if args.state.tick_count == 0 - args.gtk.hide_cursor + outputs.labels << [grid.right.shift_left(80), + grid.top.shift_down(40), + state.ship_red_score, 30, 1, state.ship_red.color] end - args.state.click_ripples ||= [] + def render_universe + return if outputs.static_solids.any? + outputs.static_solids << grid.rect + outputs.static_solids << state.stars + end - # everything is on a 1280x720 virtual canvas, so you can - # hardcode locations + def apply_round_finished_alpha entity + return entity unless state.round_finished_debounce + entity.a *= state.round_finished_debounce.percentage_of(2.seconds) + return entity + end - # define the borders for where the inventory is located - # args.state is a data structure that accepts any arbitrary parameters - # so you can create an object graph without having to create any classes. + def update_ship_outputs ship, sprite_size = 66 + ship.sprite = + apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y), + ship.sprite_path, + ship.angle, + ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite + ship.label = + apply_round_finished_alpha [ship.x, + ship.y + 100, + "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label + end - # Bottom left is 0, 0. Top right is 1280, 720. - # The inventory area is at the top of the screen - # the number 80 is the size of all the sprites, so that is what is being - # used to decide the with and height - args.state.sprite_size = 80 + def render_flames sprite_size = 6 + outputs.sprites << state.flames.map do |p| + apply_round_finished_alpha [sprite_size.to_square(p.x, p.y), + 'sprites/flame.png', 0, + p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite + end + end - args.state.inventory_border.w = args.state.sprite_size * 10 - args.state.inventory_border.h = args.state.sprite_size * 3 - args.state.inventory_border.x = 10 - args.state.inventory_border.y = 710 - args.state.inventory_border.h + def render_bullets sprite_size = 10 + outputs.sprites << state.bullets.map do |b| + apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y), + b.owner.bullet_sprite_path, + 0, b.max_alpha].sprite + end + end - # define the borders for where the crafting area is located - # the crafting area is below the inventory area - # the number 80 is the size of all the sprites, so that is what is being - # used to decide the with and height - args.state.craft_border.x = 10 - args.state.craft_border.y = 220 - args.state.craft_border.w = args.state.sprite_size * 3 - args.state.craft_border.h = args.state.sprite_size * 3 + def wrap_location! location + location.x = grid.left if location.x > grid.right + location.x = grid.right if location.x < grid.left + location.y = grid.top if location.y < grid.bottom + location.y = grid.bottom if location.y > grid.top + location + end - # define the area where results are located - # the crafting result is to the right of the craft area - args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size - args.state.result_border.y = 220 + args.state.sprite_size - args.state.result_border.w = args.state.sprite_size - args.state.result_border.h = args.state.sprite_size + def calc_thrusts + state.flames = + state.flames + .reject(&:old?) + .map do |p| + p.speed *= 0.9 + p.y += p.angle.vector_y(p.speed) + p.x += p.angle.vector_x(p.speed) + wrap_location! p + end + end - # initialize items for the first time if they are nil - # you start with 15 wood, 1 chest, and 5 plank - # Ruby has built in syntax for dictionaries (they look a lot like json objects). - # Ruby also has a special type called a Symbol denoted with a : followed by a word. - # Symbols are nice because they remove the need for magic strings. - if !args.state.items - args.state.items = [ - { - id: :wood, # :wood is a Symbol, this is better than using "wood" for the id - quantity: 15, - path: 'sprites/wood.png', - location: :inventory, - ordinal_x: 0, ordinal_y: 0 - }, - { - id: :chest, - quantity: 1, - path: 'sprites/chest.png', - location: :inventory, - ordinal_x: 1, ordinal_y: 0 - }, - { - id: :plank, - quantity: 5, - path: 'sprites/plank.png', - location: :inventory, - ordinal_x: 2, ordinal_y: 0 - }, - ] + def all_ships + [state.ship_blue, state.ship_red] + end - # after initializing the oridinal positions, derive the pixel - # locations assuming that the width and height are 80 - args.state.items.each { |item| set_inventory_position args, item } + def alive_ships + all_ships.reject { |s| s.dead } end - # define all the oridinal positions of the inventory slots - if !args.state.inventory_area - args.state.inventory_area = [ - { ordinal_x: 0, ordinal_y: 0 }, - { ordinal_x: 1, ordinal_y: 0 }, - { ordinal_x: 2, ordinal_y: 0 }, - { ordinal_x: 3, ordinal_y: 0 }, - { ordinal_x: 4, ordinal_y: 0 }, - { ordinal_x: 5, ordinal_y: 0 }, - { ordinal_x: 6, ordinal_y: 0 }, - { ordinal_x: 7, ordinal_y: 0 }, - { ordinal_x: 8, ordinal_y: 0 }, - { ordinal_x: 9, ordinal_y: 0 }, - { ordinal_x: 0, ordinal_y: 1 }, - { ordinal_x: 1, ordinal_y: 1 }, - { ordinal_x: 2, ordinal_y: 1 }, - { ordinal_x: 3, ordinal_y: 1 }, - { ordinal_x: 4, ordinal_y: 1 }, - { ordinal_x: 5, ordinal_y: 1 }, - { ordinal_x: 6, ordinal_y: 1 }, - { ordinal_x: 7, ordinal_y: 1 }, - { ordinal_x: 8, ordinal_y: 1 }, - { ordinal_x: 9, ordinal_y: 1 }, - { ordinal_x: 0, ordinal_y: 2 }, - { ordinal_x: 1, ordinal_y: 2 }, - { ordinal_x: 2, ordinal_y: 2 }, - { ordinal_x: 3, ordinal_y: 2 }, - { ordinal_x: 4, ordinal_y: 2 }, - { ordinal_x: 5, ordinal_y: 2 }, - { ordinal_x: 6, ordinal_y: 2 }, - { ordinal_x: 7, ordinal_y: 2 }, - { ordinal_x: 8, ordinal_y: 2 }, - { ordinal_x: 9, ordinal_y: 2 }, - ] + def calc_bullet bullet + bullet.y += bullet.angle.vector_y(bullet.speed) + bullet.x += bullet.angle.vector_x(bullet.speed) + wrap_location! bullet + explode_bullet! bullet if bullet.old? + return if bullet.exploded + return if state.round_finished + alive_ships.each do |s| + if s != bullet.owner && + s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y)) + explode_bullet! bullet, 10, 5, 30 + s.damage += 1 + end + end + end - # after initializing the oridinal positions, derive the pixel - # locations assuming that the width and height are 80 - args.state.inventory_area.each { |i| set_inventory_position args, i } + def calc_bullets + state.bullets.each { |b| calc_bullet b } + state.bullets.reject! { |b| b.exploded } + end - # if you want to see the result you can use the Ruby function called "puts". - # Uncomment this line to see the value. - # puts args.state.inventory_area + def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255 + flame_count.times do + state.flames << state.new_entity(type, + { angle: 360.randomize(:ratio), + speed: max_speed.randomize(:ratio), + lifetime: lifetime, + x: entity.x, + y: entity.y, + max_alpha: max_alpha }) + end + end - # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt. - # To bring up DragonRuby's Console, press the ~ key within the game. + def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10 + bullet.exploded = true + create_explosion! :bullet_explosion, + bullet, + flame_override, + max_speed, + lifetime, + bullet.max_alpha end - # define all the oridinal positions of the craft slots - if !args.state.craft_area - args.state.craft_area = [ - { ordinal_x: 0, ordinal_y: 0 }, - { ordinal_x: 0, ordinal_y: 1 }, - { ordinal_x: 0, ordinal_y: 2 }, - { ordinal_x: 1, ordinal_y: 0 }, - { ordinal_x: 1, ordinal_y: 1 }, - { ordinal_x: 1, ordinal_y: 2 }, - { ordinal_x: 2, ordinal_y: 0 }, - { ordinal_x: 2, ordinal_y: 1 }, - { ordinal_x: 2, ordinal_y: 2 }, - ] + def calc_ship ship + ship.x += ship.dx + ship.y += ship.dy + wrap_location! ship + end - # after initializing the oridinal positions, derive the pixel - # locations assuming that the width and height are 80 - args.state.craft_area.each { |c| set_craft_position args, c } + def calc_ships + all_ships.each { |s| calc_ship s } + return if all_ships.any? { |s| s.dead } + return if state.round_finished + return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite) + state.ship_blue.damage = 5 + state.ship_red.damage = 5 end - end + def create_thruster_flames! ship + state.flames << state.new_entity(:ship_thruster, + { angle: ship.angle + 180 + 60.randomize(:sign, :ratio), + speed: 5.randomize(:ratio), + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + lifetime: 30, + x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio), + y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) }) + end - def render args - # for the results area, create a sprite that show its boundaries - args.outputs.primitives << { x: args.state.result_border.x, - y: args.state.result_border.y, - w: args.state.result_border.w, - h: args.state.result_border.h, - path: 'sprites/border-black.png' } + def input_accelerate_ship should_move_ship, ship + return if ship.dead - # for each inventory spot, create a sprite - # args.outputs.primitives is how DragonRuby performs a render. - # Adding a single hash or multiple hashes to this array will tell - # DragonRuby to render those primitives on that frame. + should_move_ship &&= (ship.dx + ship.dy).abs < 5 - # The .map function on Array is used instead of any kind of looping. - # .map returns a new object for every object within an Array. - args.outputs.primitives << args.state.inventory_area.map do |a| - { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } + if should_move_ship + create_thruster_flames! ship + ship.dx += ship.angle.vector_x 0.050 + ship.dy += ship.angle.vector_y 0.050 + else + ship.dx *= 0.99 + ship.dy *= 0.99 + end end - # for each craft spot, create a sprite - args.outputs.primitives << args.state.craft_area.map do |a| - { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } + def input_accelerate + input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue + input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red end - # after the borders have been rendered, render the - # items within those slots (and allow for highlighting) - # if an item isn't currently being held - allow_inventory_highlighting = !args.state.held_item - - # go through each item and render them - # use Array's find_all method to remove any items that are currently being held - args.state.items.find_all { |item| item[:location] != :held }.map do |item| - # if an item is currently being held, don't render it in it's spot within the - # inventory or craft area (this is handled via the find_all method). + def input_turn_ship direction, ship + ship.angle -= 3 * direction + end - # the item_prefab returns a hash containing all the visual components of an item. - # the main sprite, the black background, the quantity text, and a hover indication - # if the mouse is currently hovering over the item. - args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse) + def input_turn + input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue + input_turn_ship inputs.controller_two.left_right, state.ship_red end - # The last thing we want to render is the item currently being held. - args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse) + def input_bullet create_bullet, ship + return unless create_bullet + return if ship.dead - args.outputs.primitives << args.state.click_ripples + state.bullets << state.new_entity(:ship_bullet, + { owner: ship, + angle: ship.angle, + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y), + lifetime: 120, + sprite_size: 10, + x: ship.x + ship.angle.vector_x * 32, + y: ship.y + ship.angle.vector_y * 32 }) + end - # render a mouse cursor since we have the OS cursor hidden - args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } - end + def input_mine create_mine, ship + return unless create_mine + return if ship.dead - # Alrighty! This is where all the fun happens - def input args - # if the mouse is clicked and not item is currently being held - # args.state.held_item is nil when the game starts. - # If the player clicks, the property args.inputs.mouse.click will - # be a non nil value, we don't want to process any of the code here - # if the mouse hasn't been clicked - return if !args.inputs.mouse.click + state.bullets << state.new_entity(:ship_bullet, + { owner: ship, + angle: 360.randomize(:sign, :ratio), + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + speed: 0.02, + sprite_size: 10, + lifetime: 600, + x: ship.x + ship.angle.vector_x * -50, + y: ship.y + ship.angle.vector_y * -50 }) + end - # if a click occurred, add a ripple to the ripple queue - args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } + def input_bullets_and_mines + return if state.bullets.length > 100 - # if the mouse has been clicked, and no item is currently held... - if !args.state.held_item - # see if any of the items intersect the pointer using the inside_rect? method - # the find method will either return the first object that returns true - # for the match clause, or it'll return nil if nothing matches the match clause - found = args.state.items.find do |item| - # for each item in args.state.items, run the following boolean check - args.inputs.mouse.click.point.inside_rect?(item) + [ + [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space, + inputs.controller_one.key_down.b || inputs.keyboard.key_down.down, + state.ship_blue], + [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red] + ].each do |a_held, b_down, ship| + input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship) + input_mine(b_down, ship) end + end - # if an item intersects the mouse pointer, then set the item's location to :held and - # set args.state.held_item to the item for later reference - if found - args.state.held_item = found - found[:location] = :held + def calc_kill_ships + alive_ships.find_all { |s| s.damage >= 5 }.each do |s| + s.dead = true + create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha end + end - # if the mouse is clicked and an item is currently beign held.... - elsif args.state.held_item - # determine if a slot within the craft area was clicked - craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } - - # also determine if a slot within the inventory area was clicked - inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } - - # if the click was within a craft area - if craft_area - # check to see if an item is already there and ignore the click if an item is found - # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal - # position - item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y] - - # if an item *doesn't* exist in the craft area - if !item_already_there - # if the quantity they are currently holding is greater than 1 - if args.state.held_item[:quantity] > 1 - # remove one item (creating a seperate item of the same type), and place it - # at the oridinal position and location of the craft area - # the .merge method on Hash creates a new Hash, but updates any values - # passed as arguments to merge - new_item = args.state.held_item.merge(quantity: 1, - location: :craft, - ordinal_x: craft_area[:ordinal_x], - ordinal_y: craft_area[:ordinal_y]) - - # after the item is crated, place it into the args.state.items collection - args.state.items << new_item - - # then subtract one from the held item - args.state.held_item[:quantity] -= 1 - - # if the craft area is available and there is only one item being held - elsif args.state.held_item[:quantity] == 1 - # instead of creating any new items just set the location of the held item - # to the oridinal position of the craft area, and then nil out the - # held item state so that a new item can be picked up - args.state.held_item[:location] = :craft - args.state.held_item[:ordinal_x] = craft_area[:ordinal_x] - args.state.held_item[:ordinal_y] = craft_area[:ordinal_y] - args.state.held_item = nil - end - end - - # if the selected area is an inventory area (as opposed to within the craft area) - elsif inventory_area - - # check to see if there is already an item in that inventory slot - # the item_at_inventory_slot helper method returns an item or nil - item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y] - - # if there is already an item there, and the item types/id match - if item_already_there && item_already_there[:id] == args.state.held_item[:id] - # then merge the item quantities - held_quantity = args.state.held_item[:quantity] - item_already_there[:quantity] += held_quantity - - # remove the item being held from the items collection (since it's quantity is now 0) - args.state.items.reject! { |i| i[:location] == :held } - - # nil out the held_item so a new item can be picked up - args.state.held_item = nil - - # if there currently isn't an item there, then put the held item in the slot - elsif !item_already_there - args.state.held_item[:location] = :inventory - args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x] - args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y] + def calc_score + return if state.round_finished + return if alive_ships.length > 1 - # nil out the held_item so a new item can be picked up - args.state.held_item = nil - end + if alive_ships.first == state.ship_red + state.ship_red_score += 1 + elsif alive_ships.first == state.ship_blue + state.ship_blue_score += 1 end + + state.round_finished = true end - end - # the calc method is executed after input - def calc args - # make sure that the real position of the inventory - # items are updated every frame to ensure that they - # are placed correctly given their location and oridinal positions - # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place) - args.state.items.each do |item| - # based on the location of the item, invoke the correct pixel conversion method - if item[:location] == :inventory - set_inventory_position args, item - elsif item[:location] == :craft - set_craft_position args, item - elsif item[:location] == :held - # if the item is held, center the item around the mouse pointer - args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half - args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half - end + def calc_reset_ships + return unless state.round_finished + state.round_finished_debounce ||= 2.seconds + state.round_finished_debounce -= 1 + return if state.round_finished_debounce > 0 + start_new_round! end - # for each hash/sprite in the click ripples queue, - # expand its size by 20 percent and decrease its alpha - # by 10. - args.state.click_ripples.each do |ripple| - delta_w = ripple.w * 1.2 - ripple.w - delta_h = ripple.h * 1.2 - ripple.h - ripple.x -= delta_w.half - ripple.y -= delta_h.half - ripple.w += delta_w - ripple.h += delta_h - ripple.a -= 10 + def start_new_round! + state.ship_blue = new_blue_ship + state.ship_red = new_red_ship + state.round_finished = false + state.round_finished_debounce = nil + state.flames.clear + state.bullets.clear end - # remove any items from the collection where the alpha value is less than equal to - # zero using the reject! method (reject with an exclamation point at the end changes the - # array value in place, while reject without the exclamation point returns a new array). - args.state.click_ripples.reject! { |ripple| ripple.a <= 0 } + def calc_winner + calc_kill_ships + calc_score + calc_reset_ships + end end - # helper function for finding an item at a craft slot - def item_at_craft_slot args, ordinal_x, ordinal_y - args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } - end + $dueling_spaceship = DuelingSpaceships.new - # helper function for finding an item at an inventory slot - def item_at_inventory_slot args, ordinal_x, ordinal_y - args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } + def tick args + args.grid.origin_center! + $dueling_spaceship.inputs = args.inputs + $dueling_spaceship.outputs = args.outputs + $dueling_spaceship.state = args.state + $dueling_spaceship.grid = args.grid + $dueling_spaceship.tick end + +#+end_src + +* arcade/flappy dragon/credits.txt +#+begin_src ruby + # ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt + code: Amir Rajan, https://twitter.com/amirrajan + graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel - # helper function that creates a visual representation of an item - def item_prefab args, item, should_highlight, mouse - return nil unless item + +#+end_src + +* arcade/flappy dragon/main.rb +#+begin_src ruby + # ./samples/99_genre_arcade/flappy_dragon/app/main.rb + class FlappyDragon + attr_accessor :grid, :inputs, :state, :outputs - overlay = nil + def tick + defaults + render + calc + process_inputs + end - x = item.x - y = item.y - w = item.w - h = item.h - - if should_highlight && mouse.point.inside_rect?(item) - overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, } + def defaults + state.flap_power = 11 + state.gravity = 0.9 + state.ceiling = 600 + state.ceiling_flap_power = 6 + state.wall_countdown_length = 100 + state.wall_gap_size = 100 + state.wall_countdown ||= 0 + state.hi_score ||= 0 + state.score ||= 0 + state.walls ||= [] + state.x ||= 50 + state.y ||= 500 + state.dy ||= 0 + state.scene ||= :menu + state.scene_at ||= 0 + state.difficulty ||= :normal + state.new_difficulty ||= :normal + state.countdown ||= 4.seconds + state.flash_at ||= 0 end - [ - # sprites are hashes with a path property, this is the main sprite - { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], }, - - # this represents the black area in the bottom right corner of the main sprite so that the - # quantity is visible - { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property - - # labels are hashes with a text property - { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, }, - - # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered) - overlay - ] - end + def render + outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1 + render_score + render_menu + render_game + end - # helper function for deriving the position of an item within inventory - def set_inventory_position args, item - item.x = args.state.inventory_border.x + item[:ordinal_x] * 80 - item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 - item.w = 80 - item.h = 80 - end + def render_score + outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label + outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label + outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + end - # helper function for deriving the position of an item within the craft area - def set_craft_position args, item - item.x = args.state.craft_border.x + item[:ordinal_x] * 80 - item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 - item.w = 80 - item.h = 80 - end + def render_menu + return unless state.scene == :menu + render_overlay - # Any lines outside of a function will be executed when the file is reloaded. - # So every time you save main.rb, the game will be reset. - # Comment out the line below if you don't want this to happen. - $gtk.reset - -#+end_src - -* 99_genre_dev_tools/animation_creator_starting_point/app/main.rb -#+begin_src ruby - class OneBitLowrezPaint - attr_gtk + outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] + outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] + outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] + outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] + outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] + outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] + outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] - def tick - outputs.background_color = [0, 0, 0] - defaults - render_instructions - render_canvas - render_buttons_frame_selection - render_animation_frame_thumbnails - render_animation - input_mouse_click - input_keyboard - calc_auto_export - calc_buttons_frame_selection - calc_animation_frames - process_queue_create_sprite - process_queue_reset_sprite - process_queue_update_rt_animation_frame + outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] + outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] + outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] + outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] end - def defaults - state.animation_frames_per_second = 12 - queues.create_sprite ||= [] - queues.reset_sprite ||= [] - queues.update_rt_animation_frame ||= [] + def render_overlay + outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + end - if !state.animation_frames - state.animation_frames ||= [] - add_animation_frame_to_end - end + def render_game + render_game_over + render_background + render_walls + render_dragon + render_flash + end - state.last_mouse_down ||= 0 - state.last_mouse_up ||= 0 + def render_game_over + return unless state.scene == :game + outputs.labels << [638, 358, score_text, 20, 1] + outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] + outputs.labels << [638, 428, countdown_text, 20, 1] + outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + end - state.buttons_frame_selection.left = 10 - state.buttons_frame_selection.top = grid.top - 10 - state.buttons_frame_selection.size = 20 + def render_background + outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] - defaults_canvas_sprite + scroll_point_at = state.tick_count + scroll_point_at = state.scene_at if state.scene == :menu + scroll_point_at = state.death_at if state.countdown > 0 + scroll_point_at ||= 0 - state.edit_mode ||= :drawing + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25) + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50) + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) end - def defaults_canvas_sprite - rt_canvas.size = 16 - rt_canvas.zoom = 30 - rt_canvas.width = rt_canvas.size * rt_canvas.zoom - rt_canvas.height = rt_canvas.size * rt_canvas.zoom - rt_canvas.sprite = { x: 0, - y: 0, - w: rt_canvas.width, - h: rt_canvas.height, - path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720) - - return unless state.tick_count == 1 - - outputs[:rt_canvas].width = rt_canvas.width - outputs[:rt_canvas].height = rt_canvas.height - outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x| - (rt_canvas.size + 1).map_with_index do |y| - path = 'sprites/square-white.png' - path = 'sprites/square-blue.png' if x == 7 || x == 8 - { x: x * rt_canvas.zoom, - y: y * rt_canvas.zoom, - w: rt_canvas.zoom, - h: rt_canvas.zoom, - path: path, - a: 50 } - end + def render_walls + state.walls.each do |w| + w.sprites = [ + [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], + [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] + ] end + outputs.sprites << state.walls.map(&:sprites) end - def render_instructions - instructions = <<-S - * Instructions: - - All data is stored in the ~canvas~ directory. - - Hold ~d~ to set the edit mode to erase. - - Release ~d~ to set the edit mode drawing. - - Press ~a~ to added a frame to the end. - - Press ~b~ to select the previous frame. - - Press ~f~ to select the next frame. - - Press ~c~ to copy a frame. - - Press ~v~ to paste a copied frame into the selected frame. - - Press ~x~ to delete the currently selected frame. - - Press ~w~ to save the canvas and export all sprites. - - Press ~l~ to load the canvas. - S + def render_dragon + state.show_death = true if state.countdown == 3.seconds - instructions.strip.each_line.with_index do |l, i| - outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}", - r: 180, g: 180, b: 180, size_enum: -3 } + render_debug_hitbox false + + if state.show_death == false || !state.death_at + animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at + sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + else + sprite_name = "sprites/dragon_die.png" + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds + state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 + state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction + state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6) end + + outputs.sprites << state.dragon_sprite end - def render_canvas - return if state.tick_count.zero? - outputs.sprites << rt_canvas.sprite + def render_debug_hitbox show + return unless show + outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite + outputs.borders << state.walls.flat_map do |w| + w.sprites.map { |s| [s.rect, 255, 0, 0] } + end end - def render_buttons_frame_selection - args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i| - label = { x: b.x + state.buttons_frame_selection.size.half, - y: b.y, - text: "#{i + 1}", r: 180, g: 180, b: 180, - size_enum: -4, alignment_enum: 1 }.label + def render_flash + return unless state.flash_at - selection_border = b.merge(r: 40, g: 40, b: 40).border + outputs.primitives << [grid.rect, + white, + 255 * state.flash_at.ease(20, :flip)].solid - if i == state.animation_frames_selected_index - selection_border = b.merge(r: 40, g: 230, b: 200).border - end + state.flash_at = 0 if state.flash_at.elapsed_time > 20 + end - [selection_border, label] - end + def calc + return unless state.scene == :game + reset_game if state.countdown == 1 + state.countdown -= 1 and return if state.countdown > 0 + calc_walls + calc_flap + calc_game_over end - def render_animation_frame_thumbnails - return if state.tick_count.zero? + def calc_walls + state.walls.each { |w| w.x -= 8 } - outputs[:current_animation_frame].width = rt_canvas.size - outputs[:current_animation_frame].height = rt_canvas.size - outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i| - { x: f.x, - y: f.y, - w: 1, - h: 1, r: 255, g: 255, b: 255 } - end - - outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame) - - state.animation_frames.map_with_index do |animation_frame, animation_frame_index| - outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect] - .merge(path: animation_frame[:rt_name]) - end - end + walls_count_before_removal = state.walls.length - def render_animation - sprite_index = 0.frame_index count: state.animation_frames.length, - hold_for: 60 / state.animation_frames_per_second, - repeat: true + state.walls.reject! { |w| w.x < -100 } - args.outputs.sprites << { x: 700 - 8, - y: 120, - w: 16, - h: 16, - path: (sprite_path sprite_index) } + state.score += 1 if state.walls.count < walls_count_before_removal - args.outputs.sprites << { x: 700 - 16, - y: 230, - w: 32, - h: 32, - path: (sprite_path sprite_index) } + state.wall_countdown -= 1 and return if state.wall_countdown > 0 - args.outputs.sprites << { x: 700 - 32, - y: 360, - w: 64, - h: 64, - path: (sprite_path sprite_index) } + state.walls << state.new_entity(:wall) do |w| + w.x = grid.right + w.opening = grid.top + .randomize(:ratio) + .greater(200) + .lesser(520) + w.bottom_height = w.opening - state.wall_gap_size + w.top_y = w.opening + state.wall_gap_size + end - args.outputs.sprites << { x: 700 - 64, - y: 520, - w: 128, - h: 128, - path: (sprite_path sprite_index) } + state.wall_countdown = state.wall_countdown_length end - def input_mouse_click - if inputs.mouse.up - state.last_mouse_up = state.tick_count - elsif inputs.mouse.moved && user_is_editing? - edit_current_animation_frame inputs.mouse.point - end - - return unless inputs.mouse.click + def calc_flap + state.y += state.dy + state.dy = state.dy.lesser state.flap_power + state.dy -= state.gravity + return if state.y < state.ceiling + state.y = state.ceiling + state.dy = state.dy.lesser state.ceiling_flap_power + end - clicked_frame_button = state.buttons_frame_selection.items.find do |b| - inputs.mouse.point.inside_rect? b - end + def calc_game_over + return unless game_over? - if (clicked_frame_button) - state.animation_frames_selected_index = clicked_frame_button[:index] - end + state.death_at = state.tick_count + state.death_from = state.walls.first + state.death_fall_direction = -1 + state.death_fall_direction = 1 if state.x > state.death_from.x + outputs.sounds << "sounds/hit-sound.wav" + begin_countdown + end - if (inputs.mouse.point.inside_rect? rt_canvas.sprite) - state.last_mouse_down = state.tick_count - edit_current_animation_frame inputs.mouse.point - end + def process_inputs + process_inputs_menu + process_inputs_game end - def input_keyboard - # w to save - if inputs.keyboard.key_down.w - t = Time.now - state.save_description = "Time: #{t} (#{t.to_i})" - gtk.serialize_state 'canvas/state.txt', state - gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state - animation_frames.each_with_index do |animation_frame, i| - queues.update_rt_animation_frame << { index: i, - at: state.tick_count + i, - queue_sprite_creation: true } - queues.create_sprite << { index: i, - at: state.tick_count + animation_frames.length + i, - path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" } - end - gtk.notify! "Canvas saved." - end + def process_inputs_menu + return unless state.scene == :menu - # l to load - if inputs.keyboard.key_down.l - args.state = gtk.deserialize_state 'canvas/state.txt' - animation_frames.each_with_index do |a, i| - queues.update_rt_animation_frame << { index: i, - at: state.tick_count + i, - queue_sprite_creation: true } + changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select + if inputs.mouse.click + p = inputs.mouse.click.point + if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800) + changediff = true end - gtk.notify! "Canvas loaded." - end - - # d to go into delete mode, release to paint - if inputs.keyboard.key_held.d - state.edit_mode = :erasing - gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1) - elsif inputs.keyboard.key_up.d - state.edit_mode = :drawing - gtk.notify! "Drawing." end - # a to add a frame to the end - if inputs.keyboard.key_down.a - queues.create_sprite << { index: state.animation_frames_selected_index, - at: state.tick_count } - queues.create_sprite << { index: state.animation_frames_selected_index + 1, - at: state.tick_count } - add_animation_frame_to_end - gtk.notify! "Frame added to end." + if changediff + case state.new_difficulty + when :easy + state.new_difficulty = :normal + when :normal + state.new_difficulty = :hard + when :hard + state.new_difficulty = :flappy + when :flappy + state.new_difficulty = :easy + end end - # c or t to copy - if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t) - state.clipboard = [selected_animation_frame[:pixels]].flatten - gtk.notify! "Current frame copied." + if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a + state.difficulty = state.new_difficulty + change_to_scene :game + reset_game false + state.hi_score = 0 + begin_countdown end - # v or q to paste - if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard - selected_animation_frame[:pixels] = [state.clipboard].flatten - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, - at: state.tick_count, - queue_sprite_creation: true } - gtk.notify! "Pasted." + if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b + state.new_difficulty = state.difficulty + change_to_scene :game end + end - # f to go forward/next frame - if (inputs.keyboard.key_down.f) - if (state.animation_frames_selected_index == (state.animation_frames.length - 1)) - state.animation_frames_selected_index = 0 - else - state.animation_frames_selected_index += 1 - end - gtk.notify! "Next frame." - end + def process_inputs_game + return unless state.scene == :game - # b to go back/previous frame - if (inputs.keyboard.key_down.b) - if (state.animation_frames_selected_index == 0) - state.animation_frames_selected_index = state.animation_frames.length - 1 - else - state.animation_frames_selected_index -= 1 - end - gtk.notify! "Previous frame." + clicked_menu = false + if inputs.mouse.click + p = inputs.mouse.click.point + clicked_menu = (p.y >= 620) && (p.x < 275) end - # x to delete frame - if (inputs.keyboard.key_down.x) && animation_frames.length > 1 - state.clipboard = selected_animation_frame[:pixels] - state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index } - if state.animation_frames_selected_index >= state.animation_frames.length - state.animation_frames_selected_index = state.animation_frames.length - 1 - end - gtk.notify! "Frame deleted." + if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start + change_to_scene :menu + elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0 + state.dy = 0 + state.dy += state.flap_power + state.flapped_at = state.tick_count + outputs.sounds << "sounds/fly-sound.wav" end end - def calc_auto_export - return if user_is_editing? - return if state.last_mouse_up.elapsed_time != 30 - # auto export current animation frame if there is no editing for 30 ticks - queues.create_sprite << { index: state.animation_frames_selected_index, - at: state.tick_count } + def scrolling_background at, path, rate, y = 0 + [ + [ 0 - at.*(rate) % 1440, y, 1440, 720, path], + [1440 - at.*(rate) % 1440, y, 1440, 720, path] + ] end - def calc_buttons_frame_selection - state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i| - { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size, - y: state.buttons_frame_selection.top - state.buttons_frame_selection.size, - inner_rect: { - x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size, - y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2), - w: 16, - h: 16, - }, - w: state.buttons_frame_selection.size, - h: state.buttons_frame_selection.size, - index: i } - end + def white + [255, 255, 255] end - def calc_animation_frames - animation_frames.each_with_index do |animation_frame, i| - animation_frame[:index] = i - animation_frame[:rt_name] = "animation_frame_#{i}" - end + def large_white_typeset + [5, 0, 255, 255, 255] end - def process_queue_create_sprite - sprites_to_create = queues.create_sprite - .find_all { |h| h[:at].elapsed? } - - queues.create_sprite = queues.create_sprite - sprites_to_create - - sprites_to_create.each do |h| - export_animation_frame h[:index], h[:path_override] - end + def at_beginning? + state.walls.count == 0 end - def process_queue_reset_sprite - sprites_to_reset = queues.reset_sprite - .find_all { |h| h[:at].elapsed? } - - queues.reset_sprite -= sprites_to_reset - - sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) } + def dragon_collision_box + state.dragon_sprite + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) + .rect_shift_right(10) + .rect_shift_up(state.dy * 2) end - def process_queue_update_rt_animation_frame - animation_frames_to_update = queues.update_rt_animation_frame - .find_all { |h| h[:at].elapsed? } - - queues.update_rt_animation_frame -= animation_frames_to_update + def game_over? + return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning? - animation_frames_to_update.each do |h| - update_animation_frame_render_target animation_frames[h[:index]] + state.walls + .flat_map { |w| w.sprites } + .any? do |s| + s.intersect_rect?(dragon_collision_box) + end + end - if h[:queue_sprite_creation] - queues.create_sprite << { index: h[:index], - at: state.tick_count + 1 } - end + def collision_forgiveness + case state.difficulty + when :easy + 0.9 + when :normal + 0.7 + when :hard + 0.5 + when :flappy + 0.3 + else + 0.9 end end - def update_animation_frame_render_target animation_frame - return if !animation_frame - - outputs[animation_frame[:rt_name]].width = state.rt_canvas.size - outputs[animation_frame[:rt_name]].height = state.rt_canvas.size - outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f| - { x: f.x, - y: f.y, - w: 1, - h: 1, r: 255, g: 255, b: 255 } - end + def countdown_text + state.countdown ||= -1 + return "" if state.countdown == 0 + return "GO!" if state.countdown.idiv(60) == 0 + return "GAME OVER" if state.death_at + return "READY?" end - def animation_frames - state.animation_frames + def begin_countdown + state.countdown = 4.seconds end - def add_animation_frame_to_end - animation_frames << { - index: animation_frames.length, - pixels: [], - rt_name: "animation_frame_#{animation_frames.length}" - } + def score_text + return "" unless state.countdown > 1.seconds + return "" unless state.death_at + return "SCORE: 0 (LOL)" if state.score == 0 + return "HI SCORE: #{state.score}" if state.score == state.hi_score + return "SCORE: #{state.score}" + end - state.animation_frames_selected_index = (animation_frames.length - 1) - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, - at: state.tick_count, - queue_sprite_creation: true } + def reset_game set_flash = true + state.flash_at = state.tick_count if set_flash + state.walls = [] + state.y = 500 + state.dy = 0 + state.hi_score = state.hi_score.greater(state.score) + state.score = 0 + state.wall_countdown = state.wall_countdown_length.fdiv(2) + state.show_death = false + state.death_at = nil end - def sprite_path i - "canvas/sprite-#{i}.png" + def change_to_scene scene + state.scene = scene + state.scene_at = state.tick_count + inputs.keyboard.clear + inputs.controller_one.clear end + end - def export_animation_frame i, path_override = nil - return if !state.animation_frames[i] + $flappy_dragon = FlappyDragon.new - outputs.screenshots << state.buttons_frame_selection - .items[i][:inner_rect] - .merge(path: path_override || (sprite_path i)) + def tick args + $flappy_dragon.grid = args.grid + $flappy_dragon.inputs = args.inputs + $flappy_dragon.state = args.state + $flappy_dragon.outputs = args.outputs + $flappy_dragon.tick + end + +#+end_src + +* Arcade - Pong - main.rb +#+begin_src ruby + # ./samples/99_genre_arcade/pong/app/main.rb + def tick args + defaults args + render args + calc args + input args + end - outputs.screenshots << state.buttons_frame_selection - .items[i][:inner_rect] - .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png") + def defaults args + args.state.ball.debounce ||= 3 * 60 + args.state.ball.size ||= 10 + args.state.ball.size_half ||= args.state.ball.size / 2 + args.state.ball.x ||= 640 + args.state.ball.y ||= 360 + args.state.ball.dx ||= 5.randomize(:sign) + args.state.ball.dy ||= 5.randomize(:sign) + args.state.left_paddle.y ||= 360 + args.state.right_paddle.y ||= 360 + args.state.paddle.h ||= 120 + args.state.paddle.w ||= 10 + args.state.left_paddle.score ||= 0 + args.state.right_paddle.score ||= 0 + end - queues.reset_sprite << { index: i, at: state.tick_count } - end + def render args + render_center_line args + render_scores args + render_countdown args + render_ball args + render_paddles args + render_instructions args + end - def selected_animation_frame - state.animation_frames[state.animation_frames_selected_index] + begin :render_methods + def render_center_line args + args.outputs.lines << [640, 0, 640, 720] end - def edit_current_animation_frame point - draw_area_point = (to_draw_area point) - if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point) - selected_animation_frame[:pixels] << draw_area_point - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, - at: state.tick_count, - queue_sprite_creation: !user_is_editing? } - elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point) - selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point } - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, - at: state.tick_count, - queue_sprite_creation: !user_is_editing? } - end + def render_scores args + args.outputs.labels << [ + [320, 650, args.state.left_paddle.score, 10, 1], + [960, 650, args.state.right_paddle.score, 10, 1] + ] end - def user_is_editing? - state.last_mouse_down > state.last_mouse_up + def render_countdown args + return unless args.state.ball.debounce > 0 + args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1] end - def to_draw_area point - x, y = point - x -= rt_canvas.sprite.x - y -= rt_canvas.sprite.y - { x: x.idiv(rt_canvas.zoom), - y: y.idiv(rt_canvas.zoom) } + def render_ball args + args.outputs.solids << solid_ball(args) end - def rt_canvas - state.rt_canvas ||= state.new_entity(:rt_canvas) + def render_paddles args + args.outputs.solids << solid_left_paddle(args) + args.outputs.solids << solid_right_paddle(args) end - def queues - state.queues ||= state.new_entity(:queues) + def render_instructions args + args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1] + args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1] end end - $game = OneBitLowrezPaint.new - - def tick args - $game.args = args - $game.tick + def calc args + args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0 + calc_move_ball args + calc_collision_with_left_paddle args + calc_collision_with_right_paddle args + calc_collision_with_walls args end - # $gtk.reset - -#+end_src - -* 99_genre_dev_tools/tile_editor_starting_point/app/main.rb -#+begin_src ruby - =begin - - APIs listing that haven't been encountered in previous sample apps: - - - to_s: Returns a string representation of an object. - For example, if we had - 500.to_s - the string "500" would be returned. - Similar to to_i, which returns an integer representation of an object. + begin :calc_methods + def calc_move_ball args + args.state.ball.x += args.state.ball.dx + args.state.ball.y += args.state.ball.dy + end - - Ceil: Returns an integer number greater than or equal to the original - with no decimal. + def calc_collision_with_left_paddle args + if solid_left_paddle(args).intersect_rect? solid_ball(args) + args.state.ball.dx *= -1 + elsif args.state.ball.x < 0 + args.state.right_paddle.score += 1 + calc_reset_round args + end + end - Reminders: + def calc_collision_with_right_paddle args + if solid_right_paddle(args).intersect_rect? solid_ball(args) + args.state.ball.dx *= -1 + elsif args.state.ball.x > 1280 + args.state.left_paddle.score += 1 + calc_reset_round args + end + end - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect. + def calc_collision_with_walls args + if args.state.ball.y + args.state.ball.size_half > 720 + args.state.ball.y = 720 - args.state.ball.size_half + args.state.ball.dy *= -1 + elsif args.state.ball.y - args.state.ball.size_half < 0 + args.state.ball.y = args.state.ball.size_half + args.state.ball.dy *= -1 + end + end - - 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. + def calc_reset_round args + args.state.ball.x = 640 + args.state.ball.y = 360 + args.state.ball.dx = 5.randomize(:sign) + args.state.ball.dy = 5.randomize(:sign) + args.state.ball.debounce = 3 * 60 + end + end - - args.outputs.lines: An array. The values generate a line. - The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] - For more information about lines, go to mygame/documentation/04-lines.md. + def input args + input_left_paddle args + input_right_paddle args + end - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - In this sample app, new_entity is used to create a new button that clears the grid. - (Remember, you can use state to define ANY property and it will be retained across frames.) + begin :input_methods + def input_left_paddle args + if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s + args.state.left_paddle.y -= 40 + elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w + args.state.left_paddle.y += 40 + end + end - =end + def input_right_paddle args + if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l + args.state.right_paddle.y -= 40 + elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o + args.state.right_paddle.y += 40 + end + end + end - # This sample app shows an empty grid that the user can paint in. There are different image tiles that - # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes. + begin :assets + def solid_ball args + centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size + end - class TileEditor - attr_accessor :inputs, :state, :outputs, :grid, :args + def solid_left_paddle args + centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h + end - # Runs all the methods necessary for the game to function properly. - def tick - defaults - render - check_click - draw_buttons + def solid_right_paddle args + centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h end - # Sets default values - # Initialization only happens in the first frame - # NOTE: The values of some of these variables may seem confusingly large at first. - # The gridSize is 1600 but it seems a lot smaller on the screen, for example. - # But keep in mind that by using the "W", "A", "S", and "D" keys, you can - # move the grid's view in all four directions for more grid spaces. - def defaults - state.tileCords ||= [] - state.tileQuantity ||= 6 - state.tileSize ||= 50 - state.tileSelected ||= 1 - state.tempX ||= 50 - state.tempY ||= 500 - state.speed ||= 4 - state.centerX ||= 4000 - state.centerY ||= 4000 - state.originalCenter ||= [state.centerX, state.centerY] - state.gridSize ||= 1600 - state.lineQuantity ||= 50 - state.increment ||= state.gridSize / state.lineQuantity - state.gridX ||= [] - state.gridY ||= [] - state.filled_squares ||= [] - state.grid_border ||= [390, 140, 500, 500] + def centered_rect x, y, w, h + [x - w / 2, y - h / 2, w, h] + end - get_grid unless state.tempX == 0 # calls get_grid in the first frame only - determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame - state.tempX = 0 # sets tempX to 0; the two methods aren't called again + def centered_rect_vertically x, y, w, h + [x, y - h / 2, w, h] end + end + +#+end_src + +* Arcade - Snakemoji - main.rb +#+begin_src ruby + # ./samples/99_genre_arcade/snakemoji/app/main.rb + # coding: utf-8 + ################################ + # So I was working on a snake game while + # learning DragonRuby, and at some point I had a thought + # what if I use "😀" as a function name, surely it wont work right...? + # RIGHT....? + # BUT IT DID, IT WORKED + # it all went downhill from then + # Created by Anton K. (ai Doge) + # https://gist.github.com/scorp200 + #############LICENSE############ + # Feel free to use this anywhere and however you want + # You can sell this to EA for $1,000,000 if you want, its completely free. + # Just rememeber you are helping this... thing... to spread... + # ALSO! I am not liable for any mental, physical or financial damage caused. + #############LICENSE############ - # Calculates the placement of lines or separators in the grid - def get_grid - curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid - deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid - (state.lineQuantity + 2).times do - state.gridX << curr_x # adds curr_x to gridX collection - curr_x += deltaX # increment curr_x by the distance between vertical lines - end - curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid - deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid - (state.lineQuantity + 2).times do - state.gridY << curr_y # adds curr_y to gridY collection - curr_y += deltaY # increments curr_y to distance between horizontal lines - end + class Array + #Helper function + def move! vector + self.x += vector.x + self.y += vector.y + return self end - # Determines coordinate positions of patterned tiles (on the left side of the grid) - def determineTileCords - state.tempCounter ||= 1 # initializes tempCounter to 1 - state.tileQuantity.times do # there are 6 different kinds of tiles - state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection - state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles - state.tempCounter += 1 # increments tempCounter - if state.tempX > 200 # if tempX exceeds 200 pixels - state.tempX = 50 # a new row of patterned tiles begins - state.tempY -= 75 # the new row is 75 pixels lower than the previous row - end - end + #Helper function to draw snake body + def draw! 🎮, 📺, color + translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color] end - # Outputs objects (grid, tiles, etc) onto the screen - def render - outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder - |x, y, order| - [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"] - end - outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background - add_grid # outputs grid - print_title # outputs title and current tile pattern + #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is ** + #I kept trying different combinations of symbols, when suddenly... + def 😀 value + self.map {|d| d * value} end + end - # Creates a grid by outputting vertical and horizontal grid lines onto the screen. - # Outputs sprites for the filled_squares collection onto the screen. - def add_grid - - # Outputs the grid's border. - outputs.borders << state.grid_border - temp = 0 + #Draw stuff with an offset + def translate output_collection, ⛓, what + what.x += ⛓.x + what.y += ⛓.y + output_collection << what + end - # Before looking at the code that outputs the vertical and horizontal lines in the - # grid, take note of the fact that: - # grid_border[1] refers to the border's bottom line (running horizontally), - # grid_border[2] refers to the border's top line (running (horizontally), - # grid_border[0] refers to the border's left line (running vertically), - # and grid_border[3] refers to the border's right line (running vertically). + BLUE = [33, 150, 243] + RED = [244, 67, 54] + GOLD = [255, 193, 7] + LAST = 0 - # [2] - # ---------- - # | | - # [0] | | [3] - # | | - # ---------- - # [1] + def tick args + defaults args.state + render args.state, args.outputs + input args.state, args.inputs + update args.state + end - # Calculates the positions and outputs the x grid lines in the color gray. - state.gridX.map do # perform an action on all elements of the gridX collection - |x| - temp += 1 # increment temp + def update 🎮 + #Update every 10 frames + if 🎮.tick_count.mod_zero? 10 + #Add new snake body piece at head's location + 🎮.🐍 << [*🎮.🤖] + #Assign Next Direction to Direction + 🎮.🚗 = *🎮.🚦 - # if x's value is greater than (or equal to) the x value of the border's left side - # and less than (or equal to) the x value of the border's right side - if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2) - delta = state.centerX - 640 - # vertical lines have the same starting and ending x positions - # starting y and ending y positions lead from the bottom of the border to the top of the border - outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it - end + #Trim the snake a bit if its longer than current size + if 🎮.🐍.length > 🎮.🛒 + 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1] end - temp = 0 - # Calculates the positions and outputs the y grid lines in the color gray. - state.gridY.map do # perform an action on all elements of the gridY collection - |y| - temp += 1 # increment temp + #Move the head in the Direction + 🎮.🤖.move! 🎮.🚗 - # if y's value is greater than (or equal to) the y value of the border's bottom side - # and less than (or equal to) the y value of the border's top side - if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) - delta = state.centerY - 393 - # horizontal lines have the same starting and ending y positions - # starting x and ending x positions lead from the left side of the border to the right side of the border - outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it - end + #If Head is outside the playing field, or inside snake's body restart game + if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖} + LAST = 🎮.💰 + 🎮.as_hash.clear + return end - # Sets values and outputs sprites for the filled_squares collection. - state.filled_squares.map do # perform an action on every element of the filled_squares collection - |x, y, w, h, sprite| - # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side - # and less than (or equal to) the x value of the border's right side - # and y's value is greater than (or equal to) the y value of the border's bottom side - # and less than (or equal to) the y value of 25 pixels above the border's top side - # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or - # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D") - if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) && - y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25 - # calculations done to place sprites in grid spaces that are meant to filled in - # mess around with the x and y values and see how the sprite placement changes - outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite] - end - end + #If head lands on food add size and score + if 🎮.🤖 == 🎮.🍎 + 🎮.🛒 += 1 + 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5 + spawn_🍎 🎮 + puts 🎮.🍎 + end + end - # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background) - # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner - # state.increment subtracted in y parameter to avoid covering the title label - outputs.primitives << [state.grid_border[0] - state.increment, - state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), - 255, 255, 255].solid + #Every second remove 1 point + if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60) + 🎮.💰 -= 1 + end + end - # outputs a white solid along the right side of the grid - # state.increment subtracted from y parameter to avoid covering title label - outputs.primitives << [state.grid_border[0] + state.grid_border[2], - state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), - 255, 255, 255].solid + def spawn_🍎 🎮 + #Food + 🎮.🍎 ||= [*🎮.🤖] + #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body + while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do + 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)] + end + end - # outputs a white solid along the bottom of the grid - # state.increment subtracted from y parameter to avoid covering last row of grid boxes - outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment, - state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + def render 🎮, 📺 + #Paint the background black + 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255] + #Draw a border for the playing field + translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255] - # outputs a white solid along the top of the grid - outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3], - state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + #Draw the snake's body + 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end + #Draw the head + 🎮.🤖.draw! 🎮, 📺, BLUE + #Draw the food + 🎮.🍎.draw! 🎮, 📺, RED + + #Draw current score + translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD] + #Draw your last score, if any + translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0] + #Draw starting message, only if Direction is 0 + translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0] + end + def input 🎮, 🕹 + #Left and Right keyboard input, only change if X direction is 0 + if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0 + 🎮.🚦 = [-1, 0] + elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0 + 🎮.🚦 = [1, 0] end - # Outputs title and current tile pattern - def print_title - outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label - outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator - outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label - outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile + #Up and Down keyboard input, only change if Y direction is 0 + if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0 + 🎮.🚦 = [0, 1] + elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0 + 🎮.🚦 = [0, -1] end + end - # Sets the starting position, ending position, and color for the horizontal separator. - def horizontal_separator y, x, x2 - [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y + def defaults 🎮 + #Playing field size + 🎮.🗺 ||= [20, 20] + #Scale for drawing, screen height / Field height + 🎮.⚖️ ||= 720 / 🎮.🗺.y + #Offset, offset all rendering to the center of the screen + 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0] + #Padding, make the snake body slightly smaller than the scale + 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i + #Snake Size + 🎮.🛒 ||= 3 + #Snake head, the only part we are actually controlling + 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2] + #Snake body map, follows the head + 🎮.🐍 ||= [] + #Direction the head moves to + 🎮.🚗 ||= [0, 0] + #Next_Direction, during input check only change this variable and then when game updates asign this to Direction + 🎮.🚦 ||= [*🎮.🚗] + #Your score + 🎮.💰 ||= 0 + #Spawns Food randomly + spawn_🍎(🎮) unless 🎮.🍎? + end + +#+end_src + +* Arcade - Solar System - main.rb +#+begin_src ruby + # ./samples/99_genre_arcade/solar_system/app/main.rb + # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 + # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 + + def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.x ||= 640 + args.state.y ||= 360 + args.state.stars ||= 100.map do + [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand] end - # Checks if the mouse is being clicked or dragged - def check_click - if inputs.keyboard.key_down.r # if the "r" key is pressed down - $dragon.reset - end + args.state.sun ||= args.state.new_entity(:sun) do |s| + s.s = 100 + s.path = 'sprites/sun.png' + end - if inputs.mouse.down #is mouse up or down? - state.mouse_held = true - if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders - state.tileCords.map do # perform action on all elements of tileCords collection - |x, y, order| - # if mouse's x position is greater than (or equal to) the starting x position of a tile - # and the mouse's x position is also less than (or equal to) the ending x position of that tile, - # and the mouse's y position is greater than (or equal to) the starting y position of that tile, - # and the mouse's y position is also less than (or equal to) the ending y position of that tile, - # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE) - if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize && - inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize - state.tileSelected = order # that tile is selected - end - end - end - elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state - state.mouse_held = false # mouse is not held down or dragged - state.mouse_dragging = false + args.state.planets = [ + [:mercury, 65, 5, 88], + [:venus, 100, 10, 225], + [:earth, 120, 10, 365], + [:mars, 140, 8, 687], + [:jupiter, 280, 30, 365 * 11.8], + [:saturn, 350, 20, 365 * 29.5], + [:uranus, 400, 15, 365 * 84], + [:neptune, 440, 15, 365 * 164.8], + [:pluto, 480, 5, 365 * 247.8], + ].map do |name, distance, size, year_in_days| + args.state.new_entity(name) do |p| + p.path = "sprites/#{name}.png" + p.distance = distance * 0.7 + p.s = size * 0.7 + p.year_in_days = year_in_days end + end - if state.mouse_held && # mouse needs to be down - !inputs.mouse.click && # must not be first click - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 || - (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag" - state.mouse_dragging = true - end + args.state.ship ||= args.state.new_entity(:ship) do |s| + s.x = 1280 * rand + s.y = 720 * rand + s.angle = 0 + end + end - # if mouse is clicked inside grid's border, search_lines method is called with click input type - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) - search_lines(inputs.mouse.click.point, :click) + def to_sprite args, entity + x = 0 + y = 0 - # if mouse is dragged inside grid's border, search_lines method is called with drag input type - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) - search_lines(inputs.mouse.position, :drag) - end + if entity.year_in_days + day = args.state.tick_count + day_in_year = day % entity.year_in_days + entity.random_start_day ||= day_in_year * rand + percentage_of_year = day_in_year.fdiv(entity.year_in_days) + angle = 365 * percentage_of_year + x = angle.vector_x(entity.distance) + y = angle.vector_y(entity.distance) + end - # Changes grid's position on screen by moving it up, down, left, or right. + [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path] + end - # centerX is incremented by speed if the "d" key is pressed and if that sum is less than - # the original left side of the center plus half the grid, minus half the top border of grid. - # MOVES GRID RIGHT (increasing x) - state.centerX += state.speed if inputs.keyboard.key_held.d && - (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2) - # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than - # the original left side of the center minus half the grid, plus half the top border of grid. - # MOVES GRID LEFT (decreasing x) - state.centerX -= state.speed if inputs.keyboard.key_held.a && - (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2) - # centerY is incremented by speed if the "w" key is pressed and if that sum is less than - # the original bottom of the center plus half the grid, minus half the right border of grid. - # MOVES GRID UP (increasing y) - state.centerY += state.speed if inputs.keyboard.key_held.w && - (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2) - # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than - # the original bottom of the center minus half the grid, plus half the right border of grid. - # MOVES GRID DOWN (decreasing y) - state.centerY -= state.speed if inputs.keyboard.key_held.s && - (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2) + def render args + args.outputs.solids << [0, 0, 1280, 720] + + args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b| + [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b] end - # Performs calculations on the gridX and gridY collections, and sets values. - # Sets the definition of a grid box, including the image that it is filled with. - def search_lines (point, input_type) - point.x += state.centerX - 630 # increments x and y - point.y += state.centerY - 360 - findX = 0 - findY = 0 - increment = state.gridSize / state.lineQuantity # divides grid by number of separators + args.outputs.sprites << to_sprite(args, args.state.sun) + args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p } + args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle] + end - state.gridX.map do # perform an action on every element of collection - |x| - # findX increments x by 10 if point.x is less than that sum and findX is currently 0 - findX = x + 10 if point.x < (x + 10) && findX == 0 - end + def calc args + args.state.stars = args.state.stars.map do |x, y, speed, r, g, b| + x += speed + y += speed + x = 0 if x > 1280 + y = 0 if y > 720 + [x, y, speed, r, g, b] + end - state.gridY.map do - |y| - # findY is set to y if point.y is less than that value and findY is currently 0 - findY = y if point.y < (y) && findY == 0 - end - # position of a box is denoted by bottom left corner, which is why the increment is being subtracted - grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil, - "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition - - if input_type == :click # if user clicks their mouse - if state.filled_squares.include? grid_box # if grid box is already filled in - state.filled_squares.delete grid_box # box is cleared and removed from filled_squares - else - state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares - end - elsif input_type == :drag # if user drags mouse - unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in - state.filled_squares << grid_box # box is filled in and added to filled_squares - end - end + if args.state.tick_count == 0 + args.outputs.sounds << 'sounds/bg.ogg' end + end - # Creates a "Clear" button using labels and borders. - def draw_buttons - x, y, w, h = 390, 50, 240, 50 - state.clear_button ||= state.new_entity(:button_with_fade) - - # x and y positions are set to display "Clear" label in center of the button - # Try changing first two parameters to simply x, y and see what happens to the text placement - state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] - state.clear_button.border ||= [x, y, w, h] # definition of button's border - - # If the mouse is clicked inside the borders of the clear button - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) - state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click - state.filled_squares.clear # filled squares collection is emptied (squares are cleared) - inputs.mouse.previous_click = nil # no previous click - end - - outputs.labels << state.clear_button.label # outputs clear button - outputs.borders << state.clear_button.border + def process_inputs args + if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left + args.state.ship.angle += 1 + elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right + args.state.ship.angle -= 1 + end - # When the clear button is clicked, the color of the button changes - # and the transparency changes, as well. If you change the time from - # 0.25.seconds to 1.25.seconds or more, the change will last longer. - if state.clear_button.clicked_at - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] - end + if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a + args.state.ship.x += args.state.ship.angle.x_vector + args.state.ship.y += args.state.ship.angle.y_vector end end - $tile_editor = TileEditor.new - def tick args - $tile_editor.inputs = args.inputs - $tile_editor.grid = args.grid - $tile_editor.args = args - $tile_editor.outputs = args.outputs - $tile_editor.state = args.state - $tile_editor.tick - tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around." + defaults args + render args + calc args + process_inputs args end - def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + def r + $gtk.reset end #+end_src -* 99_genre_lowrez/resolution_64x64/app/lowrez.rb +* Crafting - Craft Game Starting Point - main.rb #+begin_src ruby - # 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. + # ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb + # ================================================== + # A NOTE TO JAM CRAFT PARTICIPANTS: + # The comments and code in here are just as small piece of DragonRuby's capabilities. + # Be sure to check out the rest of the sample apps. Start with README.txt and go from 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 + # def tick args is the entry point into your game. This function is called at + # a fixed update time of 60hz (60 fps). + def tick args + # The defaults function intitializes the game. + defaults args - LOWREZ_FONT_XL = -1 - LOWREZ_FONT_XL_HEIGHT = 20 + # After the game is initialized, render it. + render args - LOWREZ_FONT_LG = -3.5 - LOWREZ_FONT_LG_HEIGHT = 15 + # After rendering the player should be able to respond to input. + input args - LOWREZ_FONT_MD = -6 - LOWREZ_FONT_MD_HEIGHT = 10 + # After responding to input, the game performs any additional calculations. + calc args + end - LOWREZ_FONT_SM = -8.5 - LOWREZ_FONT_SM_HEIGHT = 5 + def defaults args + # hide the mouse cursor for this game, we are going to render our own cursor + if args.state.tick_count == 0 + args.gtk.hide_cursor + end - LOWREZ_FONT_PATH = 'fonts/lowrez.ttf' + args.state.click_ripples ||= [] + # everything is on a 1280x720 virtual canvas, so you can + # hardcode locations - class LowrezOutputs - attr_accessor :width, :height + # define the borders for where the inventory is located + # args.state is a data structure that accepts any arbitrary parameters + # so you can create an object graph without having to create any classes. - def initialize args - @args = args - @background_color ||= [0, 0, 0] - @args.outputs.background_color = @background_color - end + # Bottom left is 0, 0. Top right is 1280, 720. + # The inventory area is at the top of the screen + # the number 80 is the size of all the sprites, so that is what is being + # used to decide the with and height + args.state.sprite_size = 80 - def background_color - @background_color ||= [0, 0, 0] - end + args.state.inventory_border.w = args.state.sprite_size * 10 + args.state.inventory_border.h = args.state.sprite_size * 3 + args.state.inventory_border.x = 10 + args.state.inventory_border.y = 710 - args.state.inventory_border.h - def background_color= opts - @background_color = opts - @args.outputs.background_color = @background_color + # define the borders for where the crafting area is located + # the crafting area is below the inventory area + # the number 80 is the size of all the sprites, so that is what is being + # used to decide the with and height + args.state.craft_border.x = 10 + args.state.craft_border.y = 220 + args.state.craft_border.w = args.state.sprite_size * 3 + args.state.craft_border.h = args.state.sprite_size * 3 - outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color] - end + # define the area where results are located + # the crafting result is to the right of the craft area + args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size + args.state.result_border.y = 220 + args.state.sprite_size + args.state.result_border.w = args.state.sprite_size + args.state.result_border.h = args.state.sprite_size - def outputs_lowrez - return @args.outputs if @args.state.tick_count <= 0 - return @args.outputs[:lowrez] - end + # initialize items for the first time if they are nil + # you start with 15 wood, 1 chest, and 5 plank + # Ruby has built in syntax for dictionaries (they look a lot like json objects). + # Ruby also has a special type called a Symbol denoted with a : followed by a word. + # Symbols are nice because they remove the need for magic strings. + if !args.state.items + args.state.items = [ + { + id: :wood, # :wood is a Symbol, this is better than using "wood" for the id + quantity: 15, + path: 'sprites/wood.png', + location: :inventory, + ordinal_x: 0, ordinal_y: 0 + }, + { + id: :chest, + quantity: 1, + path: 'sprites/chest.png', + location: :inventory, + ordinal_x: 1, ordinal_y: 0 + }, + { + id: :plank, + quantity: 5, + path: 'sprites/plank.png', + location: :inventory, + ordinal_x: 2, ordinal_y: 0 + }, + ] - def solids - outputs_lowrez.solids + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.items.each { |item| set_inventory_position args, item } end - def borders - outputs_lowrez.borders - end + # define all the oridinal positions of the inventory slots + if !args.state.inventory_area + args.state.inventory_area = [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 3, ordinal_y: 0 }, + { ordinal_x: 4, ordinal_y: 0 }, + { ordinal_x: 5, ordinal_y: 0 }, + { ordinal_x: 6, ordinal_y: 0 }, + { ordinal_x: 7, ordinal_y: 0 }, + { ordinal_x: 8, ordinal_y: 0 }, + { ordinal_x: 9, ordinal_y: 0 }, + { ordinal_x: 0, ordinal_y: 1 }, + { ordinal_x: 1, ordinal_y: 1 }, + { ordinal_x: 2, ordinal_y: 1 }, + { ordinal_x: 3, ordinal_y: 1 }, + { ordinal_x: 4, ordinal_y: 1 }, + { ordinal_x: 5, ordinal_y: 1 }, + { ordinal_x: 6, ordinal_y: 1 }, + { ordinal_x: 7, ordinal_y: 1 }, + { ordinal_x: 8, ordinal_y: 1 }, + { ordinal_x: 9, ordinal_y: 1 }, + { ordinal_x: 0, ordinal_y: 2 }, + { ordinal_x: 1, ordinal_y: 2 }, + { ordinal_x: 2, ordinal_y: 2 }, + { ordinal_x: 3, ordinal_y: 2 }, + { ordinal_x: 4, ordinal_y: 2 }, + { ordinal_x: 5, ordinal_y: 2 }, + { ordinal_x: 6, ordinal_y: 2 }, + { ordinal_x: 7, ordinal_y: 2 }, + { ordinal_x: 8, ordinal_y: 2 }, + { ordinal_x: 9, ordinal_y: 2 }, + ] - def sprites - outputs_lowrez.sprites - end + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.inventory_area.each { |i| set_inventory_position args, i } - def labels - outputs_lowrez.labels + # if you want to see the result you can use the Ruby function called "puts". + # Uncomment this line to see the value. + # puts args.state.inventory_area + + # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt. + # To bring up DragonRuby's Console, press the ~ key within the game. 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: LOWREZ_FONT_PATH - } - end - - def lines - outputs_lowrez.lines - end - - def primitives - outputs_lowrez.primitives - end + # define all the oridinal positions of the craft slots + if !args.state.craft_area + args.state.craft_area = [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 0, ordinal_y: 1 }, + { ordinal_x: 0, ordinal_y: 2 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 1 }, + { ordinal_x: 1, ordinal_y: 2 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 1 }, + { ordinal_x: 2, ordinal_y: 2 }, + ] - def click - return nil unless @args.inputs.mouse.click - mouse + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.craft_area.each { |c| set_craft_position args, c } end + end - def mouse_click - click - end - def mouse_down - @args.inputs.mouse.down - end + def render args + # for the results area, create a sprite that show its boundaries + args.outputs.primitives << { x: args.state.result_border.x, + y: args.state.result_border.y, + w: args.state.result_border.w, + h: args.state.result_border.h, + path: 'sprites/border-black.png' } - def mouse_up - @args.inputs.mouse.up - end + # for each inventory spot, create a sprite + # args.outputs.primitives is how DragonRuby performs a render. + # Adding a single hash or multiple hashes to this array will tell + # DragonRuby to render those primitives on that frame. - def mouse - [ - ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)), - ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM)) - ] + # The .map function on Array is used instead of any kind of looping. + # .map returns a new object for every object within an Array. + args.outputs.primitives << args.state.inventory_area.map do |a| + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } end - def mouse_position - mouse + # for each craft spot, create a sprite + args.outputs.primitives << args.state.craft_area.map do |a| + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } end - def keyboard - @args.inputs.keyboard - end - end + # after the borders have been rendered, render the + # items within those slots (and allow for highlighting) + # if an item isn't currently being held + allow_inventory_highlighting = !args.state.held_item - class GTK::Args - def init_lowrez - return if @lowrez - @lowrez = LowrezOutputs.new self - end + # go through each item and render them + # use Array's find_all method to remove any items that are currently being held + args.state.items.find_all { |item| item[:location] != :held }.map do |item| + # if an item is currently being held, don't render it in it's spot within the + # inventory or craft area (this is handled via the find_all method). - def lowrez - @lowrez + # the item_prefab returns a hash containing all the visual components of an item. + # the main sprite, the black background, the quantity text, and a hover indication + # if the mouse is currently hovering over the item. + args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse) end - end - module GTK - class Runtime - alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) + # The last thing we want to render is the item currently being held. + args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse) - def tick_core - @args.init_lowrez - __original_tick_core__ + args.outputs.primitives << args.state.click_ripples - return if @args.state.tick_count <= 0 + # render a mouse cursor since we have the OS cursor hidden + args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } + end - @args.render_target(:lowrez) - .labels - .each do |l| - l.y += 1 - end + # Alrighty! This is where all the fun happens + def input args + # if the mouse is clicked and not item is currently being held + # args.state.held_item is nil when the game starts. + # If the player clicks, the property args.inputs.mouse.click will + # be a non nil value, we don't want to process any of the code here + # if the mouse hasn't been clicked + return if !args.inputs.mouse.click - @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 + # if a click occurred, add a ripple to the ripple queue + args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } - @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 } + # if the mouse has been clicked, and no item is currently held... + if !args.state.held_item + # see if any of the items intersect the pointer using the inside_rect? method + # the find method will either return the first object that returns true + # for the match clause, or it'll return nil if nothing matches the match clause + found = args.state.items.find do |item| + # for each item in args.state.items, run the following boolean check + args.inputs.mouse.click.point.inside_rect?(item) end - end - end - -#+end_src - -* 99_genre_lowrez/resolution_64x64/app/main.rb -#+begin_src ruby - require 'app/lowrez.rb' - def tick args - # How to set the background color - args.lowrez.background_color = [255, 255, 255] + # if an item intersects the mouse pointer, then set the item's location to :held and + # set args.state.held_item to the item for later reference + if found + args.state.held_item = found + found[:location] = :held + end - # ==== 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]]. + # if the mouse is clicked and an item is currently beign held.... + elsif args.state.held_item + # determine if a slot within the craft area was clicked + craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } - # Commenting and uncommenting code: - # - Add a "#" infront of lines to comment out code - # - Remove the "#" infront of lines to comment out code + # also determine if a slot within the inventory area was clicked + inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } - # Invoke the hello_world subroutine/method - hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method. - # ======================================================================= + # if the click was within a craft area + if craft_area + # check to see if an item is already there and ignore the click if an item is found + # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal + # position + item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y] + # if an item *doesn't* exist in the craft area + if !item_already_there + # if the quantity they are currently holding is greater than 1 + if args.state.held_item[:quantity] > 1 + # remove one item (creating a seperate item of the same type), and place it + # at the oridinal position and location of the craft area + # the .merge method on Hash creates a new Hash, but updates any values + # passed as arguments to merge + new_item = args.state.held_item.merge(quantity: 1, + location: :craft, + ordinal_x: craft_area[:ordinal_x], + ordinal_y: craft_area[:ordinal_y]) - # ==== 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. + # after the item is crated, place it into the args.state.items collection + args.state.items << new_item - # 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 - # ======================================================================= + # then subtract one from the held item + args.state.held_item[:quantity] -= 1 + # if the craft area is available and there is only one item being held + elsif args.state.held_item[:quantity] == 1 + # instead of creating any new items just set the location of the held item + # to the oridinal position of the craft area, and then nil out the + # held item state so that a new item can be picked up + args.state.held_item[:location] = :craft + args.state.held_item[:ordinal_x] = craft_area[:ordinal_x] + args.state.held_item[:ordinal_y] = craft_area[:ordinal_y] + args.state.held_item = nil + end + end - # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================ - # Remove the "#" at the beginning of the line below - # how_to_render_solids args - # ======================================================================= + # if the selected area is an inventory area (as opposed to within the craft area) + elsif inventory_area + # check to see if there is already an item in that inventory slot + # the item_at_inventory_slot helper method returns an item or nil + item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y] - # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ======================== - # Remove the "#" at the beginning of the line below - # how_to_render_borders args - # ======================================================================= + # if there is already an item there, and the item types/id match + if item_already_there && item_already_there[:id] == args.state.held_item[:id] + # then merge the item quantities + held_quantity = args.state.held_item[:quantity] + item_already_there[:quantity] += held_quantity + # remove the item being held from the items collection (since it's quantity is now 0) + args.state.items.reject! { |i| i[:location] == :held } - # ==== HOW TO RENDER A LINE ============================================= - # Remove the "#" at the beginning of the line below - # how_to_render_lines args - # ======================================================================= + # nil out the held_item so a new item can be picked up + args.state.held_item = nil + # if there currently isn't an item there, then put the held item in the slot + elsif !item_already_there + args.state.held_item[:location] = :inventory + args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x] + args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y] - # == 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 - # ======================================================================= + # nil out the held_item so a new item can be picked up + args.state.held_item = nil + end + end + end + end + # the calc method is executed after input + def calc args + # make sure that the real position of the inventory + # items are updated every frame to ensure that they + # are placed correctly given their location and oridinal positions + # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place) + args.state.items.each do |item| + # based on the location of the item, invoke the correct pixel conversion method + if item[:location] == :inventory + set_inventory_position args, item + elsif item[:location] == :craft + set_craft_position args, item + elsif item[:location] == :held + # if the item is held, center the item around the mouse pointer + args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half + args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half + end + end - # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== - # Remove the "#" at the beginning of the line below - # how_to_animate_a_sprite args - # ======================================================================= + # for each hash/sprite in the click ripples queue, + # expand its size by 20 percent and decrease its alpha + # by 10. + args.state.click_ripples.each do |ripple| + delta_w = ripple.w * 1.2 - ripple.w + delta_h = ripple.h * 1.2 - ripple.h + ripple.x -= delta_w.half + ripple.y -= delta_h.half + ripple.w += delta_w + ripple.h += delta_h + ripple.a -= 10 + end + # remove any items from the collection where the alpha value is less than equal to + # zero using the reject! method (reject with an exclamation point at the end changes the + # array value in place, while reject without the exclamation point returns a new array). + args.state.click_ripples.reject! { |ripple| ripple.a <= 0 } + end - # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =========================== - # Remove the "#" at the beginning of the line below - # how_to_animate_a_sprite_sheet args - # ======================================================================= + # helper function for finding an item at a craft slot + def item_at_craft_slot args, ordinal_x, ordinal_y + args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } + end + # helper function for finding an item at an inventory slot + def item_at_inventory_slot args, ordinal_x, ordinal_y + args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } + end - # ==== HOW TO DETERMINE COLLISION ============================================= - # Remove the "#" at the beginning of the line below - # how_to_determine_collision args - # ======================================================================= + # helper function that creates a visual representation of an item + def item_prefab args, item, should_highlight, mouse + return nil unless item + overlay = nil - # ==== HOW TO CREATE BUTTONS ================================================== - # Remove the "#" at the beginning of the line below - # how_to_create_buttons args - # ======================================================================= + x = item.x + y = item.y + w = item.w + h = item.h + if should_highlight && mouse.point.inside_rect?(item) + overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, } + end - # ==== The line below renders a debug grid, mouse information, and current tick - render_debug args - end + [ + # sprites are hashes with a path property, this is the main sprite + { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], }, - def hello_world args - args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 } + # this represents the black area in the bottom right corner of the main sprite so that the + # quantity is visible + { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property - 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: LOWREZ_FONT_PATH - } + # labels are hashes with a text property + { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, }, - 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 - } + # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered) + overlay + ] end + # helper function for deriving the position of an item within inventory + def set_inventory_position args, item + item.x = args.state.inventory_border.x + item[:ordinal_x] * 80 + item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 + item.w = 80 + item.h = 80 + end - # ======================================================================= - # ==== HOW TO RENDER A LABEL ============================================ - # ======================================================================= - def how_to_render_a_label args - # NOTE: Text is aligned from the TOP LEFT corner + # helper function for deriving the position of an item within the craft area + def set_craft_position args, item + item.x = args.state.craft_border.x + item[:ordinal_x] * 80 + item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 + item.w = 80 + item.h = 80 + end - # 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: LOWREZ_FONT_PATH } + # Any lines outside of a function will be executed when the file is reloaded. + # So every time you save main.rb, the game will be reset. + # Comment out the line below if you don't want this to happen. + $gtk.reset + +#+end_src + +* Dev Tools - Add Buttons To Console - main.rb +#+begin_src ruby + # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb + # You can customize the buttons that show up in the Console. + class GTK::Console::Menu + # STEP 1: Override the custom_buttons function. + def custom_buttons + [ + (button id: :yay, + # row for button + row: 3, + # column for button + col: 10, + # text + text: "I AM CUSTOM", + # when clicked call the custom_button_clicked function + method: :custom_button_clicked), + + (button id: :yay, + # row for button + row: 3, + # column for button + col: 9, + # text + text: "CUSTOM ALSO", + # when clicked call the custom_button_also_clicked function + method: :custom_button_also_clicked) + ] + end - # 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: LOWREZ_FONT_PATH } + # STEP 2: Define the function that should be called. + def custom_button_clicked + log "* INFO: I AM CUSTOM was clicked!" + end - # 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: LOWREZ_FONT_PATH } + def custom_button_also_clicked + log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!" - # 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: LOWREZ_FONT_PATH } + all_buttons_as_string = $gtk.console.menu.buttons.map do |b| + <<-S.strip + ** id: #{b[:id]} + :PROPERTIES: + :id: :#{b[:id]} + :method: :#{b[:method]} + :text: #{b[:text]} + :END: + S + end.join("\n") - # 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") + log <<-S + * INFO: Here are all the buttons: + #{all_buttons_as_string} + S + end + end - # Example 2 - args.lowrez.labels << args.lowrez - .default_label - .merge(x: 31, - text: "Default", - r: 128, - g: 128, - b: 128) + def tick args + args.outputs.labels << [args.grid.center.x, args.grid.center.y, + "Open the DragonRuby Console to see the custom menu items.", + 0, 1] end + +#+end_src + +* Dev Tools - Animation Creator Starting Point - main.rb +#+begin_src ruby + # ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb + class OneBitLowrezPaint + attr_gtk - ## # ============================================================================= - ## # ==== 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 } + def tick + outputs.background_color = [0, 0, 0] + defaults + render_instructions + render_canvas + render_buttons_frame_selection + render_animation_frame_thumbnails + render_animation + input_mouse_click + input_keyboard + calc_auto_export + calc_buttons_frame_selection + calc_animation_frames + process_queue_create_sprite + process_queue_reset_sprite + process_queue_update_rt_animation_frame + end - # 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 } + def defaults + state.animation_frames_per_second = 12 + queues.create_sprite ||= [] + queues.reset_sprite ||= [] + queues.update_rt_animation_frame ||= [] - # 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 } + if !state.animation_frames + state.animation_frames ||= [] + add_animation_frame_to_end + end - # Render a red square at 6, 6 with a width and height of 4 - args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 } - end + state.last_mouse_down ||= 0 + state.last_mouse_up ||= 0 - ## # ============================================================================= - ## # ==== 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 } + state.buttons_frame_selection.left = 10 + state.buttons_frame_selection.top = grid.top - 10 + state.buttons_frame_selection.size = 20 - # 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 } + defaults_canvas_sprite - # 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 + state.edit_mode ||= :drawing + 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 } + def defaults_canvas_sprite + rt_canvas.size = 16 + rt_canvas.zoom = 30 + rt_canvas.width = rt_canvas.size * rt_canvas.zoom + rt_canvas.height = rt_canvas.size * rt_canvas.zoom + rt_canvas.sprite = { x: 0, + y: 0, + w: rt_canvas.width, + h: rt_canvas.height, + path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720) - # 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 + return unless state.tick_count == 1 - ## # ============================================================================= - ## # == 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' - } + outputs[:rt_canvas].width = rt_canvas.width + outputs[:rt_canvas].height = rt_canvas.height + outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x| + (rt_canvas.size + 1).map_with_index do |y| + path = 'sprites/square-white.png' + path = 'sprites/square-blue.png' if x == 7 || x == 8 + { x: x * rt_canvas.zoom, + y: y * rt_canvas.zoom, + w: rt_canvas.zoom, + h: rt_canvas.zoom, + path: path, + a: 50 } + end + end end - # Given an array of positions create sprites - positions = [ - { x: 10, y: 42 }, - { x: 15, y: 45 }, - { x: 22, y: 33 }, - ] + def render_instructions + instructions = <<-S + * Instructions: + - All data is stored in the ~canvas~ directory. + - Hold ~d~ to set the edit mode to erase. + - Release ~d~ to set the edit mode drawing. + - Press ~a~ to added a frame to the end. + - Press ~b~ to select the previous frame. + - Press ~f~ to select the next frame. + - Press ~c~ to copy a frame. + - Press ~v~ to paste a copied frame into the selected frame. + - Press ~x~ to delete the currently selected frame. + - Press ~w~ to save the canvas and export all sprites. + - Press ~l~ to load the canvas. + S - 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) + instructions.strip.each_line.with_index do |l, i| + outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}", + r: 180, g: 180, b: 180, size_enum: -3 } + end 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 + def render_canvas + return if state.tick_count.zero? + outputs.sprites << rt_canvas.sprite + end - # 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? + def render_buttons_frame_selection + args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i| + label = { x: b.x + state.buttons_frame_selection.size.half, + y: b.y, + text: "#{i + 1}", r: 180, g: 180, b: 180, + size_enum: -4, alignment_enum: 1 }.label - # 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) + selection_border = b.merge(r: 40, g: 40, b: 40).border - args.lowrez.labels << args.lowrez - .default_label - .merge(x: 32, - y: 32, - text: "Count Down: #{countdown_in_seconds}", - alignment_enum: 1) - end + if i == state.animation_frames_selected_index + selection_border = b.merge(r: 40, g: 230, b: 200).border + 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 + [selection_border, label] + end + 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 + def render_animation_frame_thumbnails + return if state.tick_count.zero? - # 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? + outputs[:current_animation_frame].width = rt_canvas.size + outputs[:current_animation_frame].height = rt_canvas.size + outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i| + { x: f.x, + y: f.y, + w: 1, + h: 1, r: 255, g: 255, b: 255 } + end - # 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) + outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame) - args.lowrez.labels << args.lowrez - .default_label - .merge(x: 32, - y: 32, - text: "Count Down: #{countdown_in_seconds}", - alignment_enum: 1) + state.animation_frames.map_with_index do |animation_frame, animation_frame_index| + outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect] + .merge(path: animation_frame[:rt_name]) + end 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) + def render_animation + sprite_index = 0.frame_index count: state.animation_frames.length, + hold_for: 60 / state.animation_frames_per_second, + repeat: true - args.lowrez.labels << args.lowrez - .default_label - .merge(x: 32, - y: 50, text: "Or Click", - alignment_enum: 1) + args.outputs.sprites << { x: 700 - 8, + y: 120, + w: 16, + h: 16, + path: (sprite_path sprite_index) } - # set the initial values for x and y using ||= ("or equal operator") - args.state.ship.x ||= 0 - args.state.ship.y ||= 0 + args.outputs.sprites << { x: 700 - 16, + y: 230, + w: 32, + h: 32, + path: (sprite_path sprite_index) } - # 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 + args.outputs.sprites << { x: 700 - 32, + y: 360, + w: 64, + h: 64, + path: (sprite_path sprite_index) } - # if a or left arrow is pressed/held, decrement the ships x position - if args.lowrez.keyboard.left - args.state.ship.x -= 1 + args.outputs.sprites << { x: 700 - 64, + y: 520, + w: 128, + h: 128, + path: (sprite_path sprite_index) } 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 + def input_mouse_click + if inputs.mouse.up + state.last_mouse_up = state.tick_count + elsif inputs.mouse.moved && user_is_editing? + edit_current_animation_frame inputs.mouse.point + 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) + return unless inputs.mouse.click - # 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 + clicked_frame_button = state.buttons_frame_selection.items.find do |b| + inputs.mouse.point.inside_rect? b 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 (clicked_frame_button) + state.animation_frames_selected_index = clicked_frame_button[:index] + 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) + if (inputs.mouse.point.inside_rect? rt_canvas.sprite) + state.last_mouse_down = state.tick_count + edit_current_animation_frame inputs.mouse.point + end 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) + def input_keyboard + # w to save + if inputs.keyboard.key_down.w + t = Time.now + state.save_description = "Time: #{t} (#{t.to_i})" + gtk.serialize_state 'canvas/state.txt', state + gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state + animation_frames.each_with_index do |animation_frame, i| + queues.update_rt_animation_frame << { index: i, + at: state.tick_count + i, + queue_sprite_creation: true } + queues.create_sprite << { index: i, + at: state.tick_count + animation_frames.length + i, + path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" } + end + gtk.notify! "Canvas saved." 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 } + # l to load + if inputs.keyboard.key_down.l + args.state = gtk.deserialize_state 'canvas/state.txt' + animation_frames.each_with_index do |a, i| + queues.update_rt_animation_frame << { index: i, + at: state.tick_count + i, + queue_sprite_creation: true } + end + gtk.notify! "Canvas loaded." + end - # 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) + # d to go into delete mode, release to paint + if inputs.keyboard.key_held.d + state.edit_mode = :erasing + gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1) + elsif inputs.keyboard.key_up.d + state.edit_mode = :drawing + gtk.notify! "Drawing." + end + # a to add a frame to the end + if inputs.keyboard.key_down.a + queues.create_sprite << { index: state.animation_frames_selected_index, + at: state.tick_count } + queues.create_sprite << { index: state.animation_frames_selected_index + 1, + at: state.tick_count } + add_animation_frame_to_end + gtk.notify! "Frame added to end." + end - # 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") + # c or t to copy + if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t) + state.clipboard = [selected_animation_frame[:pixels]].flatten + gtk.notify! "Current frame copied." + end - # Creates button two using a border and a label - args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20) + # v or q to paste + if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard + selected_animation_frame[:pixels] = [state.clipboard].flatten + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: true } + gtk.notify! "Pasted." + end - 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") + # f to go forward/next frame + if (inputs.keyboard.key_down.f) + if (state.animation_frames_selected_index == (state.animation_frames.length - 1)) + state.animation_frames_selected_index = 0 + else + state.animation_frames_selected_index += 1 + end + gtk.notify! "Next frame." + end - # Initialize the state variable that tracks which button was clicked to "" (empty stringI - args.state.last_button_clicked ||= "--" + # b to go back/previous frame + if (inputs.keyboard.key_down.b) + if (state.animation_frames_selected_index == 0) + state.animation_frames_selected_index = state.animation_frames.length - 1 + else + state.animation_frames_selected_index -= 1 + end + gtk.notify! "Previous frame." + end - # 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 = "--" + # x to delete frame + if (inputs.keyboard.key_down.x) && animation_frames.length > 1 + state.clipboard = selected_animation_frame[:pixels] + state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index } + if state.animation_frames_selected_index >= state.animation_frames.length + state.animation_frames_selected_index = state.animation_frames.length - 1 + end + gtk.notify! "Frame deleted." 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 + def calc_auto_export + return if user_is_editing? + return if state.last_mouse_up.elapsed_time != 30 + # auto export current animation frame if there is no editing for 30 ticks + queues.create_sprite << { index: state.animation_frames_selected_index, + at: state.tick_count } + end - 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 + def calc_buttons_frame_selection + state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i| + { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size, + y: state.buttons_frame_selection.top - state.buttons_frame_selection.size, + inner_rect: { + x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size, + y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2), + w: 16, + h: 16, + }, + w: state.buttons_frame_selection.size, + h: state.buttons_frame_selection.size, + index: i } 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 + def calc_animation_frames + animation_frames.each_with_index do |animation_frame, i| + animation_frame[:index] = i + animation_frame[:rt_name] = "animation_frame_#{i}" + end 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 + def process_queue_create_sprite + sprites_to_create = queues.create_sprite + .find_all { |h| h[:at].elapsed? } - $gtk.reset - -#+end_src - -* 99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb -#+begin_src ruby - # Hey there! Welcome to Four Decisions. Here is how you - # create your decision tree. Remove =being and =end from the text to - # enable the game (just save the file). Change stuff and see what happens! + queues.create_sprite = queues.create_sprite - sprites_to_create - def game - { - starting_decision: :stormy_night, - decisions: { - stormy_night: { - description: 'It was a dark and stormy night. (storyline located in decision.rb)', - option_one: { - description: 'Go to sleep.', - decision: :nap - }, - option_two: { - description: 'Watch a movie.', - decision: :movie - }, - option_three: { - description: 'Go outside.', - decision: :go_outside - }, - option_four: { - description: 'Get a snack.', - decision: :get_a_snack - } - }, - nap: { - description: 'You took a nap. The end.', - option_one: { - description: 'Start over.', - decision: :stormy_night - } - } - } - } - end - -#+end_src - -* 99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb -#+begin_src ruby - =begin + sprites_to_create.each do |h| + export_animation_frame h[:index], h[:path_override] + end + end - Reminders: + def process_queue_reset_sprite + sprites_to_reset = queues.reset_sprite + .find_all { |h| h[:at].elapsed? } - - Hashes: Collection of unique keys and their corresponding values. The values can be found - using their keys. + queues.reset_sprite -= sprites_to_reset - In this sample app, the decisions needed for the game are stored in a hash. In fact, the - decision.rb file contains hashes inside of other hashes! + sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) } + end - Each option is a key in the first hash, but also contains a hash (description and - decision being its keys) as its value. - Go into the decision.rb file and take a look before diving into the code below. + def process_queue_update_rt_animation_frame + animation_frames_to_update = queues.update_rt_animation_frame + .find_all { |h| h[:at].elapsed? } - - 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. + queues.update_rt_animation_frame -= animation_frames_to_update - - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + animation_frames_to_update.each do |h| + update_animation_frame_render_target animation_frames[h[:index]] - - 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. + if h[:queue_sprite_creation] + queues.create_sprite << { index: h[:index], + at: state.tick_count + 1 } + end + end + end - =end + def update_animation_frame_render_target animation_frame + return if !animation_frame - # This sample app provides users with a story and multiple decisions that they can choose to make. - # Users can make a decision using their keyboard, and the story will move forward based on user choices. + outputs[animation_frame[:rt_name]].width = state.rt_canvas.size + outputs[animation_frame[:rt_name]].height = state.rt_canvas.size + outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f| + { x: f.x, + y: f.y, + w: 1, + h: 1, r: 255, g: 255, b: 255 } + end + end - # The decisions available to users are stored in the decision.rb file. - # We must have access to it for the game to function properly. - GAME_FILE = 'app/decision.rb' # found in app folder + def animation_frames + state.animation_frames + end - require GAME_FILE # require used to load another file, import class/method definitions + def add_animation_frame_to_end + animation_frames << { + index: animation_frames.length, + pixels: [], + rt_name: "animation_frame_#{animation_frames.length}" + } - # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. - # Otherwise, the game is run. - def tick args - if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method - args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown - args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] - elsif respond_to?(:game) # otherwise, if responds to game - args.state.loaded = true - tick_game args # calls tick_game method, runs game + state.animation_frames_selected_index = (animation_frames.length - 1) + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: true } end - if args.state.tick_count.mod_zero? 60 # update every 60 frames - t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file - if t != args.state.mtime - args.state.mtime = t - require GAME_FILE # require used to load file - args.state.game_definition = nil # game definition and decision are empty - args.state.decision_id = nil - end + def sprite_path i + "canvas/sprite-#{i}.png" end - end - # Runs methods needed for game to function properly - # Creates a rectangular border around the screen - def tick_game args - defaults args - args.borders << args.grid.rect - render_decision args - process_inputs args - end + def export_animation_frame i, path_override = nil + return if !state.animation_frames[i] - # Sets default values and uses decision.rb file to define game and decision_id - # variable using the starting decision - def defaults args - args.state.game_definition ||= game - args.state.decision_id ||= args.state.game_definition[:starting_decision] - end + outputs.screenshots << state.buttons_frame_selection + .items[i][:inner_rect] + .merge(path: path_override || (sprite_path i)) - # Outputs the possible decision descriptions the user can choose onto the screen - # as well as what key to press on their keyboard to make their decision - def render_decision args - decision = current_decision args - # text is either the value of decision's description key or warning that no description exists - args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation + outputs.screenshots << state.buttons_frame_selection + .items[i][:inner_rect] + .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png") - # All decisions are stored in a hash - # The descriptions output onto the screen are the values for the description keys of the hash. - if decision[:option_one] - args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label - args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision + queues.reset_sprite << { index: i, at: state.tick_count } end - if decision[:option_two] - args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description - args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] + def selected_animation_frame + state.animation_frames[state.animation_frames_selected_index] end - if decision[:option_three] - args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description - args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] - end - - if decision[:option_four] - args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description - args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] + def edit_current_animation_frame point + draw_area_point = (to_draw_area point) + if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point) + selected_animation_frame[:pixels] << draw_area_point + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: !user_is_editing? } + elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point) + selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point } + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: !user_is_editing? } + end end - end - - # Uses keyboard input from the user to make a decision - # Assigns the decision as the value of the decision_id variable - def process_inputs args - decision = current_decision args # calls current_decision method - if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists - args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id + def user_is_editing? + state.last_mouse_down > state.last_mouse_up end - if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists - args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id + def to_draw_area point + x, y = point + x -= rt_canvas.sprite.x + y -= rt_canvas.sprite.y + { x: x.idiv(rt_canvas.zoom), + y: y.idiv(rt_canvas.zoom) } end - if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists - args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id + def rt_canvas + state.rt_canvas ||= state.new_entity(:rt_canvas) end - if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists - args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id + def queues + state.queues ||= state.new_entity(:queues) end end - # Uses decision_id's value to keep track of current decision being made - def current_decision args - args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty + $game = OneBitLowrezPaint.new + + def tick args + $game.args = args + $game.tick end - # Resets the game. - $gtk.reset + # $gtk.reset #+end_src -* 99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb +* Dev Tools - Tile Editor Starting Point - main.rb #+begin_src ruby - ################################################################################### - # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES - # THE 64x64 CANVAS. - ################################################################################### - - TINY_RESOLUTION = 64 - TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) - CENTER_OFFSET = 10 - EMULATED_FONT_SIZE = 20 - EMULATED_FONT_X_ZERO = 0 - EMULATED_FONT_Y_ZERO = 46 + # ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb + =begin - def tick args - sprites = [] - labels = [] - borders = [] - solids = [] - mouse = emulate_lowrez_mouse args - args.state.show_gridlines = false - lowrez_tick args, sprites, labels, borders, solids, mouse - render_gridlines_if_needed args - render_mouse_crosshairs args, mouse - emulate_lowrez_scene args, sprites, labels, borders, solids, mouse - end + APIs listing that haven't been encountered in previous sample apps: - def emulate_lowrez_mouse args - args.state.new_entity_strict(:lowrez_mouse) do |m| - 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 - m.click = [ - 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 - else - m.click = nil - m.down = nil - end + - to_s: Returns a string representation of an object. + For example, if we had + 500.to_s + the string "500" would be returned. + Similar to to_i, which returns an integer representation of an object. - if args.mouse.up - m.up = [ - 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 - end - end - end + - Ceil: Returns an integer number greater than or equal to the original + with no decimal. - def render_mouse_crosshairs args, mouse - return unless args.state.show_gridlines - args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] - end + Reminders: - def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse - args.render_target(:lowrez).solids << [0, 0, 1280, 720] - args.render_target(:lowrez).sprites << sprites - args.render_target(:lowrez).borders << borders - args.render_target(:lowrez).solids << solids - args.outputs.primitives << labels.map do |l| - as_label = l.label - l.text.each_char.each_with_index.map do |char, i| - [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, 'fonts/dragonruby-gtk-4x4.ttf'].label - end - end + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect. - args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] - end + - 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. - def render_gridlines_if_needed args - if args.state.show_gridlines && args.static_lines.length == 0 - args.static_lines << 65.times.map do |i| - [ - [CENTER_OFFSET + i * TINY_SCALE + 1, 0, - CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], - [CENTER_OFFSET + i * TINY_SCALE, 0, - CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], - [CENTER_OFFSET, 0 + i * TINY_SCALE, - CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], - [CENTER_OFFSET, 1 + i * TINY_SCALE, - CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] - ] - end - elsif !args.state.show_gridlines - args.static_lines.clear - end - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/main.rb -#+begin_src ruby - require 'app/require.rb' + - 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. - def defaults args - args.outputs.background_color = [0, 0, 0] - args.state.last_story_line_text ||= "" - args.state.scene_history ||= [] - args.state.storyline_history ||= [] - args.state.word_delay ||= 8 - if args.state.tick_count == 0 - args.gtk.stop_music - args.outputs.sounds << 'sounds/static-loop.ogg' - end + - 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. - if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at - lines = args.state - .storyline_history[-1] - .gsub("-", "") - .gsub("~", "") - .wrapped_lines(55) + - args.outputs.lines: An array. The values generate a line. + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] + For more information about lines, go to mygame/documentation/04-lines.md. - args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0) - elsif !args.state.is_storyline_dialog_active - args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50)) - end + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to create a new button that clears the grid. + (Remember, you can use state to define ANY property and it will be retained across frames.) - return if args.state.current_scene - set_scene(args, day_one_beginning(args)) - end + =end - def inputs_move_player args - if args.state.scene_changed_at.elapsed_time > 5 - if args.keyboard.down || args.keyboard.s || args.keyboard.j - args.state.player.y -= 0.25 - elsif args.keyboard.up || args.keyboard.w || args.keyboard.k - args.state.player.y += 0.25 - end + # This sample app shows an empty grid that the user can paint in. There are different image tiles that + # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes. - if args.keyboard.left || args.keyboard.a || args.keyboard.h - args.state.player.x -= 0.25 - elsif args.keyboard.right || args.keyboard.d || args.keyboard.l - args.state.player.x += 0.25 - end + class TileEditor + attr_accessor :inputs, :state, :outputs, :grid, :args - args.state.player.y = 60 if args.state.player.y > 63 - args.state.player.y = 0 if args.state.player.y < -3 - args.state.player.x = 60 if args.state.player.x > 63 - args.state.player.x = 0 if args.state.player.x < -3 + # Runs all the methods necessary for the game to function properly. + def tick + defaults + render + check_click + draw_buttons end - end - def null_or_empty? ary - return true unless ary - return true if ary.length == 0 - return false - end + # Sets default values + # Initialization only happens in the first frame + # NOTE: The values of some of these variables may seem confusingly large at first. + # The gridSize is 1600 but it seems a lot smaller on the screen, for example. + # But keep in mind that by using the "W", "A", "S", and "D" keys, you can + # move the grid's view in all four directions for more grid spaces. + def defaults + state.tileCords ||= [] + state.tileQuantity ||= 6 + state.tileSize ||= 50 + state.tileSelected ||= 1 + state.tempX ||= 50 + state.tempY ||= 500 + state.speed ||= 4 + state.centerX ||= 4000 + state.centerY ||= 4000 + state.originalCenter ||= [state.centerX, state.centerY] + state.gridSize ||= 1600 + state.lineQuantity ||= 50 + state.increment ||= state.gridSize / state.lineQuantity + state.gridX ||= [] + state.gridY ||= [] + state.filled_squares ||= [] + state.grid_border ||= [390, 140, 500, 500] - def calc_storyline_hotspot args - hotspots = args.state.storylines.find_all do |hs| - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + get_grid unless state.tempX == 0 # calls get_grid in the first frame only + determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame + state.tempX = 0 # sets tempX to 0; the two methods aren't called again end - if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot - _, _, _, _, storyline = hotspots.first - queue_storyline_text(args, storyline) - args.state.inside_storyline_hotspot = true - elsif null_or_empty?(hotspots) - args.state.inside_storyline_hotspot = false - end - end + # Calculates the placement of lines or separators in the grid + def get_grid + curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid + deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid + (state.lineQuantity + 2).times do + state.gridX << curr_x # adds curr_x to gridX collection + curr_x += deltaX # increment curr_x by the distance between vertical lines + end - def calc_scenes args - hotspots = args.state.scenes.find_all do |hs| - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid + deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid + (state.lineQuantity + 2).times do + state.gridY << curr_y # adds curr_y to gridY collection + curr_y += deltaY # increments curr_y to distance between horizontal lines + end end - if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot - _, _, _, _, scene_method_or_hash = hotspots.first - if scene_method_or_hash.is_a? Symbol - set_scene(args, send(scene_method_or_hash, args)) - args.state.last_hotspot_scene = scene_method_or_hash - args.state.scene_history << scene_method_or_hash - else - set_scene(args, scene_method_or_hash) + # Determines coordinate positions of patterned tiles (on the left side of the grid) + def determineTileCords + state.tempCounter ||= 1 # initializes tempCounter to 1 + state.tileQuantity.times do # there are 6 different kinds of tiles + state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection + state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles + state.tempCounter += 1 # increments tempCounter + if state.tempX > 200 # if tempX exceeds 200 pixels + state.tempX = 50 # a new row of patterned tiles begins + state.tempY -= 75 # the new row is 75 pixels lower than the previous row + end end - args.state.inside_scene_hotspot = true - elsif null_or_empty?(hotspots) - args.state.inside_scene_hotspot = false end - end - - def null_or_whitespace? word - return true if !word - return true if word.strip.length == 0 - return false - end - def calc_storyline_presentation args - return unless args.state.tick_count > args.state.next_storyline - return unless args.state.scene_storyline_queue - next_storyline = args.state.scene_storyline_queue.shift - if null_or_whitespace? next_storyline - args.state.storyline_queue_empty_at ||= args.state.tick_count - args.state.is_storyline_dialog_active = false - return - end - args.state.storyline_to_show = next_storyline - args.state.is_storyline_dialog_active = true - args.state.storyline_queue_empty_at = nil - if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") - args.state.next_storyline += 60 - elsif next_storyline.end_with?(",") - args.state.next_storyline += 50 - elsif next_storyline.end_with?(":") - args.state.next_storyline += 60 - else - default_word_delay = 13 + args.state.word_delay - 8 - if next_storyline.gsub("-", "").gsub("~", "").length <= 4 - default_word_delay = 11 + args.state.word_delay - 8 + # Outputs objects (grid, tiles, etc) onto the screen + def render + outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder + |x, y, order| + [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"] end - number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length - args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) + outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background + add_grid # outputs grid + print_title # outputs title and current tile pattern end - end - def inputs_reload_current_scene args - return - if args.inputs.keyboard.key_down.r! - reload_current_scene - end - end + # Creates a grid by outputting vertical and horizontal grid lines onto the screen. + # Outputs sprites for the filled_squares collection onto the screen. + def add_grid - def inputs_dismiss_current_storyline args - if args.inputs.keyboard.key_down.x! - args.state.scene_storyline_queue.clear - end - end + # Outputs the grid's border. + outputs.borders << state.grid_border + temp = 0 - def inputs_restart_game args - if args.inputs.keyboard.exclamation_point - args.gtk.reset_state - end - end + # Before looking at the code that outputs the vertical and horizontal lines in the + # grid, take note of the fact that: + # grid_border[1] refers to the border's bottom line (running horizontally), + # grid_border[2] refers to the border's top line (running (horizontally), + # grid_border[0] refers to the border's left line (running vertically), + # and grid_border[3] refers to the border's right line (running vertically). - def inputs_change_word_delay args - if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign - args.state.word_delay -= 2 - if args.state.word_delay < 0 - args.state.word_delay = 0 - # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" - else - # queue_storyline_text args, "Text speed INCREASED." - end - end + # [2] + # ---------- + # | | + # [0] | | [3] + # | | + # ---------- + # [1] - if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore - args.state.word_delay += 2 - # queue_storyline_text args, "Text speed DECREASED." - end - end + # Calculates the positions and outputs the x grid lines in the color gray. + state.gridX.map do # perform an action on all elements of the gridX collection + |x| + temp += 1 # increment temp - def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil - texts.each_with_index.map do |t, i| - [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] - end - end + # if x's value is greater than (or equal to) the x value of the border's left side + # and less than (or equal to) the x value of the border's right side + if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2) + delta = state.centerX - 640 + # vertical lines have the same starting and ending x positions + # starting y and ending y positions lead from the bottom of the border to the top of the border + outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it + end + end + temp = 0 - def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse - # args.state.show_gridlines = true - defaults args - render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_solids << [0, 0, 64, 64, 0, 0, 0] - calc_storyline_presentation args - calc_scenes args - calc_storyline_hotspot args - inputs_move_player args - inputs_print_mouse_rect args, lowrez_mouse - inputs_reload_current_scene args - inputs_dismiss_current_storyline args - inputs_change_word_delay args - inputs_restart_game args - if !args.state.storyline_queue_empty_at - args.outputs.labels << multiple_lines(args, 690, 80, - ["Press \"X\" on the keyboard to dismiss dialog.", - "Press \"+\" on the keyboard to INCREASE text speed.", - "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255) - end - end + # Calculates the positions and outputs the y grid lines in the color gray. + state.gridY.map do # perform an action on all elements of the gridY collection + |y| + temp += 1 # increment temp - def inputs_print_mouse_rect args, lowrez_mouse - if lowrez_mouse.click - if args.state.previous_mouse_click - dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x - dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y - x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy + # if y's value is greater than (or equal to) the y value of the border's bottom side + # and less than (or equal to) the y value of the border's top side + if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + delta = state.centerY - 393 + # horizontal lines have the same starting and ending y positions + # starting x and ending x positions lead from the left side of the border to the right side of the border + outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it + end + end - if dx < 0 && dx < 0 - x = x + w - w = w.abs - y = y + h - h = h.abs + # Sets values and outputs sprites for the filled_squares collection. + state.filled_squares.map do # perform an action on every element of the filled_squares collection + |x, y, w, h, sprite| + # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side + # and less than (or equal to) the x value of the border's right side + # and y's value is greater than (or equal to) the y value of the border's bottom side + # and less than (or equal to) the y value of 25 pixels above the border's top side + # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or + # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D") + if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) && + y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25 + # calculations done to place sprites in grid spaces that are meant to filled in + # mess around with the x and y values and see how the sprite placement changes + outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite] + end end - w += 1 - h += 1 + # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background) + # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner + # state.increment subtracted in y parameter to avoid covering the title label + outputs.primitives << [state.grid_border[0] - state.increment, + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), + 255, 255, 255].solid - puts [x, y, w, h] - args.state.previous_mouse_click = nil - else - args.state.previous_mouse_click = lowrez_mouse.click - square_x, square_y = lowrez_mouse.click - puts [square_x, square_y] - 8.map_with_index do |i| - puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1] - end - end + # outputs a white solid along the right side of the grid + # state.increment subtracted from y parameter to avoid covering title label + outputs.primitives << [state.grid_border[0] + state.grid_border[2], + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), + 255, 255, 255].solid - end - end + # outputs a white solid along the bottom of the grid + # state.increment subtracted from y parameter to avoid covering last row of grid boxes + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment, + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + + # outputs a white solid along the top of the grid + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3], + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid - def try_centering! word - word ||= "" - just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") - return word if just_word.strip.length == 0 - return word if just_word.include? "~" - return "~#{word}" if just_word.length <= 2 - if just_word.length.mod_zero? 2 - center_index = just_word.length.idiv(2) - 1 - else - center_index = (just_word.length - 1).idiv(2) end - return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" - end - def queue_storyline args, scene - queue_storyline_text args, scene[:storyline] - end + # Outputs title and current tile pattern + def print_title + outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label + outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator + outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label + outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile + end - def queue_storyline_text args, text - args.state.last_story_line_text = text - args.state.storyline_history << text if text - words = (text || "").split(" ") - words = words.map { |w| try_centering! w } - args.state.scene_storyline_queue = words - if args.state.scene_storyline_queue.length != 0 - args.state.scene_storyline_queue.unshift "~$--" - args.state.storyline_to_show = "~." - else - args.state.storyline_to_show = "" + # Sets the starting position, ending position, and color for the horizontal separator. + def horizontal_separator y, x, x2 + [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y end - args.state.scene_storyline_queue << "" - args.state.next_storyline = args.state.tick_count - end - def set_scene args, scene - args.state.current_scene = scene - args.state.background = scene[:background] || 'sprites/todo.png' - args.state.scene_fade = scene[:fade] || 0 - args.state.scenes = (scene[:scenes] || []).reject { |s| !s } - args.state.scene_render_override = scene[:render_override] - args.state.storylines = (scene[:storylines] || []).reject { |s| !s } - args.state.scene_changed_at = args.state.tick_count - if scene[:player] - args.state.player = scene[:player] - end - args.state.inside_scene_hotspot = false - args.state.inside_storyline_hotspot = false - queue_storyline args, scene - end + # Checks if the mouse is being clicked or dragged + def check_click + if inputs.keyboard.key_down.r # if the "r" key is pressed down + $dragon.reset + end - def replay_storyline_rect - [26, -1, 7, 4] - end + if inputs.mouse.down #is mouse up or down? + state.mouse_held = true + if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders + state.tileCords.map do # perform action on all elements of tileCords collection + |x, y, order| + # if mouse's x position is greater than (or equal to) the starting x position of a tile + # and the mouse's x position is also less than (or equal to) the ending x position of that tile, + # and the mouse's y position is greater than (or equal to) the starting y position of that tile, + # and the mouse's y position is also less than (or equal to) the ending y position of that tile, + # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE) + if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize && + inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize + state.tileSelected = order # that tile is selected + end + end + end + elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state + state.mouse_held = false # mouse is not held down or dragged + state.mouse_dragging = false + end - def labels_for_word word - left_side_of_word = "" - center_letter = "" - right_side_of_word = "" + if state.mouse_held && # mouse needs to be down + !inputs.mouse.click && # must not be first click + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 || + (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag" + state.mouse_dragging = true + end - if word[0] == "~" - left_side_of_word = "" - center_letter = word[1] - right_side_of_word = word[2..-1] - elsif word.length > 0 - left_side_of_word, right_side_of_word = word.split("~") - center_letter = right_side_of_word[0] - right_side_of_word = right_side_of_word[1..-1] - end + # if mouse is clicked inside grid's border, search_lines method is called with click input type + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click.point, :click) - right_side_of_word = right_side_of_word.gsub("-", "") + # if mouse is dragged inside grid's border, search_lines method is called with drag input type + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) + search_lines(inputs.mouse.position, :drag) + end - { - left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], - center: [29, 2, center_letter, 255, 0, 0], - right: [34, 2, right_side_of_word] - } - end + # Changes grid's position on screen by moving it up, down, left, or right. - def render_scenes args, lowrez_sprites - lowrez_sprites << args.state.scenes.flat_map do |hs| - hotspot_square args, hs.x, hs.y, hs.w, hs.h + # centerX is incremented by speed if the "d" key is pressed and if that sum is less than + # the original left side of the center plus half the grid, minus half the top border of grid. + # MOVES GRID RIGHT (increasing x) + state.centerX += state.speed if inputs.keyboard.key_held.d && + (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2) + # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than + # the original left side of the center minus half the grid, plus half the top border of grid. + # MOVES GRID LEFT (decreasing x) + state.centerX -= state.speed if inputs.keyboard.key_held.a && + (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2) + # centerY is incremented by speed if the "w" key is pressed and if that sum is less than + # the original bottom of the center plus half the grid, minus half the right border of grid. + # MOVES GRID UP (increasing y) + state.centerY += state.speed if inputs.keyboard.key_held.w && + (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2) + # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than + # the original bottom of the center minus half the grid, plus half the right border of grid. + # MOVES GRID DOWN (decreasing y) + state.centerY -= state.speed if inputs.keyboard.key_held.s && + (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2) end - end - def render_storylines args, lowrez_sprites - lowrez_sprites << args.state.storylines.flat_map do |hs| - hotspot_square args, hs.x, hs.y, hs.w, hs.h - end - end + # Performs calculations on the gridX and gridY collections, and sets values. + # Sets the definition of a grid box, including the image that it is filled with. + def search_lines (point, input_type) + point.x += state.centerX - 630 # increments x and y + point.y += state.centerY - 360 + findX = 0 + findY = 0 + increment = state.gridSize / state.lineQuantity # divides grid by number of separators - def adornments_alpha args, target_alpha = nil, minimum_alpha = nil - return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at - target_alpha ||= 255 - target_alpha * args.state.storyline_queue_empty_at.ease(60) - end + state.gridX.map do # perform an action on every element of collection + |x| + # findX increments x by 10 if point.x is less than that sum and findX is currently 0 + findX = x + 10 if point.x < (x + 10) && findX == 0 + end - def hotspot_square args, x, y, w, h - if w >= 3 && h >= 3 - [ - [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], - [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], - [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], - ] - else - [ - [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], - ] - end - end + state.gridY.map do + |y| + # findY is set to y if point.y is less than that value and findY is currently 0 + findY = y if point.y < (y) && findY == 0 + end + # position of a box is denoted by bottom left corner, which is why the increment is being subtracted + grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil, + "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition - def render_storyline_dialog args, lowrez_labels, lowrez_sprites - return unless args.state.is_storyline_dialog_active - return unless args.state.storyline_to_show - labels = labels_for_word args.state.storyline_to_show - if true # high rez version - scale = 8.88 - offset = 45 - size = 25 - args.outputs.labels << [offset + labels[:left].x.-(1) * scale, - labels[:left].y * TINY_SCALE + 55, - labels[:left].text, size, 0, 0, 0, 0, 255, - 'fonts/manaspc.ttf'] - center_text = labels[:center].text - center_text = "|" if center_text == "$" - args.outputs.labels << [offset + labels[:center].x * scale, - labels[:center].y * TINY_SCALE + 55, - center_text, size, 0, 255, 0, 0, 255, - 'fonts/manaspc.ttf'] - args.outputs.labels << [offset + labels[:right].x * scale, - labels[:right].y * TINY_SCALE + 55, - labels[:right].text, size, 0, 0, 0, 0, 255, - 'fonts/manaspc.ttf'] - else - lowrez_labels << labels[:left] - lowrez_labels << labels[:center] - lowrez_labels << labels[:right] + if input_type == :click # if user clicks their mouse + if state.filled_squares.include? grid_box # if grid box is already filled in + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + else + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares + end + elsif input_type == :drag # if user drags mouse + unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in + state.filled_squares << grid_box # box is filled in and added to filled_squares + end + end end - args.state.is_storyline_dialog_active = true - render_player args, lowrez_sprites - lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] - end - def render_player args, lowrez_sprites - lowrez_sprites << player_md_down(args, *args.state.player) - end + # Creates a "Clear" button using labels and borders. + def draw_buttons + x, y, w, h = 390, 50, 240, 50 + state.clear_button ||= state.new_entity(:button_with_fade) - def render_adornments args, lowrez_sprites - render_scenes args, lowrez_sprites - render_storylines args, lowrez_sprites - return if args.state.is_storyline_dialog_active - lowrez_sprites << player_md_down(args, *args.state.player) - end + # x and y positions are set to display "Clear" label in center of the button + # Try changing first two parameters to simply x, y and see what happens to the text placement + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] + state.clear_button.border ||= [x, y, w, h] # definition of button's border - def global_alpha_percentage args, max_alpha = 255 - return 255 unless args.state.scene_changed_at - return 255 unless args.state.scene_fade - return 255 unless args.state.scene_fade > 0 - return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) - end + # If the mouse is clicked inside the borders of the clear button + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click + state.filled_squares.clear # filled squares collection is emptied (squares are cleared) + inputs.mouse.previous_click = nil # no previous click + end - def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] - if args.state.scene_render_override - send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids - end - storyline_to_show = args.state.storyline_to_show || "" - render_adornments args, lowrez_sprites - render_storyline_dialog args, lowrez_labels, lowrez_sprites + outputs.labels << state.clear_button.label # outputs clear button + outputs.borders << state.clear_button.border - if args.state.background == 'sprites/tribute-game-over.png' - lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] - lowrez_labels << [9, 6, 'Return of', 255, 255, 255] - lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] - if !args.state.ended - args.gtk.stop_music - args.outputs.sounds << 'sounds/music-loop.ogg' - args.state.ended = true + # When the clear button is clicked, the color of the button changes + # and the transparency changes, as well. If you change the time from + # 0.25.seconds to 1.25.seconds or more, the change will last longer. + if state.clear_button.clicked_at + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] end end end - def player_md_right args, x, y - [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] - end - - def player_md_left args, x, y - [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] - end - - def player_md_up args, x, y - [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] - end + $tile_editor = TileEditor.new - def player_md_down args, x, y - [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] + def tick args + $tile_editor.inputs = args.inputs + $tile_editor.grid = args.grid + $tile_editor.args = args + $tile_editor.outputs = args.outputs + $tile_editor.state = args.state + $tile_editor.tick + tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around." end - def player_sm args, x, y - [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] - end + def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end - def player_xs args, x, y - [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label end #+end_src -* 99_genre_narrative_rpg/return_of_serenity/app/repl.rb -#+begin_src ruby - puts $gtk.args.state.current_scene - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/require.rb -#+begin_src ruby - require 'app/lowrez_simulator.rb' - require 'app/storyline_day_one.rb' - require 'app/storyline_blinking_light.rb' - require 'app/storyline_serenity_introduction.rb' - require 'app/storyline_speed_of_light.rb' - require 'app/storyline_serenity_alive.rb' - require 'app/storyline_serenity_bio.rb' - require 'app/storyline_anka.rb' - require 'app/storyline_final_message.rb' - require 'app/storyline_final_decision.rb' - require 'app/storyline.rb' - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline.rb +* Lowrez - Resolution 64x64 - lowrez.rb #+begin_src ruby - def hotspot_top - [4, 61, 56, 3] - end + # ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb + # 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. - def hotspot_bottom - [4, 0, 56, 3] - end + 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 - def hotspot_top_right - [62, 35, 3, 25] - end + LOWREZ_FONT_XL = -1 + LOWREZ_FONT_XL_HEIGHT = 20 - def hotspot_bottom_right - [62, 0, 3, 25] - end + LOWREZ_FONT_LG = -3.5 + LOWREZ_FONT_LG_HEIGHT = 15 - def storyline_history_include? args, text - args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } - end + LOWREZ_FONT_MD = -6 + LOWREZ_FONT_MD_HEIGHT = 10 - def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - end + LOWREZ_FONT_SM = -8.5 + LOWREZ_FONT_SM_HEIGHT = 5 - def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - end + LOWREZ_FONT_PATH = 'fonts/lowrez.ttf' - def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - end - def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - end + class LowrezOutputs + attr_accessor :width, :height - def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - end + def initialize args + @args = args + @background_color ||= [0, 0, 0] + @args.outputs.background_color = @background_color + end - def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] - result_one_scene, result_one_label, result_one_text = context_result_one - result_two_scene, result_two_label, result_two_text = context_result_two - result_three_scene, result_three_label, result_three_text = context_result_three - result_four_scene, result_four_label, result_four_text = context_result_four + def background_color + @background_color ||= [0, 0, 0] + end - top_level_hash = { - background: 'sprites/decision.png', - fade: 60, - player: [20, 36], - storylines: [ ], - scenes: [ ] - } + def background_color= opts + @background_color = opts + @args.outputs.background_color = @background_color - confirmation_result_one_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } + outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color] + end - confirmation_result_two_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } + def outputs_lowrez + return @args.outputs if @args.state.tick_count <= 0 + return @args.outputs[:lowrez] + end - confirmation_result_three_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } + def solids + outputs_lowrez.solids + end - confirmation_result_four_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } + def borders + outputs_lowrez.borders + end - top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] - top_level_hash[:storylines] << [20, 35, 4, 4, context_action] + def sprites + outputs_lowrez.sprites + end - confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] - confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] - confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + def labels + outputs_lowrez.labels + end - confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] - confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] + 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: LOWREZ_FONT_PATH + } + end - confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] - confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] - confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] - confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + def lines + outputs_lowrez.lines + end - confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] - confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] - confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] - confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + def primitives + outputs_lowrez.primitives + end - top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + def click + return nil unless @args.inputs.mouse.click + mouse + end - top_level_hash - end + def mouse_click + click + end - def ship_control_hotspot offset_x, offset_y, a, b, c, d - results = [] - results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a - results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b - results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c - results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d - results - end + def mouse_down + @args.inputs.mouse.down + end - def reload_current_scene - if $gtk.args.state.last_hotspot_scene - set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) - tick $gtk.args - elsif respond_to? :set_scene - set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) - tick $gtk.args + def mouse_up + @args.inputs.mouse.up end - $gtk.console.close - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb -#+begin_src ruby - def anka_inside_room args - { - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], - ], - scenes: [ - [32, -1, 8, 3, :anka_observatory] + + def mouse + [ + ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)), + ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM)) ] - } - end + end - def anka_observatory args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] - ], - scenes: [ - [30, 18, 5, 12, :anka_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - end + def mouse_position + mouse + end - def anka_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 60, - storylines: [ - [22, 45, 17, 4, (anka_last_reply args)], - [45, 45, 4, 4, (anka_current_reply args)], - ], - scenes: [ - [*hotspot_top_right, :reply_to_anka] - ] - } + def keyboard + @args.inputs.keyboard + end end - def reply_to_anka args - decision_graph anka_current_reply(args), - "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", - [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], - [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] - end + class GTK::Args + def init_lowrez + return if @lowrez + @lowrez = LowrezOutputs.new self + end - def anka_last_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Buffer--: #{serenity_alive_firm_reply.quote}" - else - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + def lowrez + @lowrez end end - def anka_reply_whole_truth - "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." - end + module GTK + class Runtime + alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) - def anka_reply_half_truth - "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." - end + def tick_core + @args.init_lowrez + __original_tick_core__ - def replied_with_whole_truth args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], - [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], - ] - } - end + return if @args.state.tick_count <= 0 - def replied_with_half_truth args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], - [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], - ] - } - end + @args.render_target(:lowrez) + .labels + .each do |l| + l.y += 1 + end - def anka_current_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." - else - return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." - end - 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 - def replied_to_anka_back_home args - if args.state.scene_history.include? :replied_with_whole_truth - return { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], - ], - scenes: [ - [30, 38, 12, 13, :final_message_sad], - ] - } - else - return { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], - ], - scenes: [ - [30, 38, 12, 13, :final_message_happy], - ] - } + @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 #+end_src -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb +* Lowrez - Resolution 64x64 - main.rb #+begin_src ruby - def the_blinking_light args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :blinking_light_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } - end + # ./samples/99_genre_lowrez/resolution_64x64/app/main.rb + require 'app/lowrez.rb' - def blinking_light_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :blinking_light_path_to_observatory] - ], - render_override: :blinking_light_mountain_pass_render - } - end + def tick args + # How to set the background color + args.lowrez.background_color = [255, 255, 255] - def blinking_light_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :blinking_light_observatory] - ], - render_override: :blinking_light_path_to_observatory_render - } - end + # ==== 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]]. - def blinking_light_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :blinking_light_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } - end + # Commenting and uncommenting code: + # - Add a "#" infront of lines to comment out code + # - Remove the "#" infront of lines to comment out code - def blinking_light_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [ - [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] - ], - scenes: [ - [30, 18, 5, 12, :blinking_light_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - end + # Invoke the hello_world subroutine/method + hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method. + # ======================================================================= - def blinking_light_inside_mainframe args - { - background: 'sprites/mainframe.png', - fade: 60, - player: [30, 4], - scenes: [ - [62, 32, 4, 32, :reply_to_introduction] - ], - storylines: [ - [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], - [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], - [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], - [14, 20, 24, 4, "What the heck activated--- this thing- though?"] - ] - } - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb -#+begin_src ruby - def day_one_beginning args - { - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [0, 0, 64, 2, :day_one_infront_of_home], - ], - storylines: [ - [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] - ] - } - end - def day_one_infront_of_home args - { - background: 'sprites/front-of-home.png', - player: [56, 23], - scenes: [ - [43, 34, 10, 16, :day_one_home], - [62, 0, 3, 40, :day_one_beginning], - [0, 4, 3, 20, :day_one_ceremony] - ], - storylines: [ - [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], - ] - } - end + # ==== 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. - def day_one_home args - { - background: 'sprites/inside-home.png', - player: [34, 3], - scenes: [ - [28, 0, 12, 2, :day_one_infront_of_home] - ], - storylines: [ - [ - 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." - ], - [ - 28, 7, 4, 7, - "Ahhh. My reading- couch. It's so comfortable--." - ], - [ - 38, 21, 4, 4, - "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." - ], - [ - 45, 37, 4, 8, - "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." - ], - [ - 32, 40, 8, 10, - "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." - ], - [ - 25, 21, 5, 12, - "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." - ] - ] - } - end + # 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 + # ======================================================================= - def day_one_ceremony args - { - background: 'sprites/tribute.png', - player: [57, 21], - scenes: [ - [62, 0, 2, 40, :day_one_infront_of_home], - [0, 24, 2, 40, :day_one_infront_of_library] - ], - storylines: [ - [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], - [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], - [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], - [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], - ] - } - end - def day_one_infront_of_library args - { - background: 'sprites/outside-library.png', - player: [57, 21], - scenes: [ - [62, 0, 2, 40, :day_one_ceremony], - [49, 39, 6, 9, :day_one_library] - ], - storylines: [ - [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] - ] - } - end + # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================ + # Remove the "#" at the beginning of the line below + # how_to_render_solids args + # ======================================================================= - def day_one_library args - { - background: 'sprites/library.png', - player: [27, 4], - scenes: [ - [0, 0, 64, 2, :end_day_one_infront_of_library] - ], - storylines: [ - [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], - [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] - ] - } - end - def end_day_one_infront_of_library args - { - background: 'sprites/outside-library.png', - player: [51, 33], - scenes: [ - [49, 39, 6, 9, :day_one_library], - [62, 0, 2, 40, :end_day_one_monument], - ], - storylines: [ - [50, 27, 4, 4, "It's getting late. Better get some sleep."] - ] - } - end + # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ======================== + # Remove the "#" at the beginning of the line below + # how_to_render_borders args + # ======================================================================= - def end_day_one_monument args - { - background: 'sprites/tribute.png', - player: [2, 36], - scenes: [ - [62, 0, 2, 40, :end_day_one_infront_of_home], - ], - storylines: [ - [50, 27, 4, 4, "It's getting late. Better get some sleep."], - ] - } - end - def end_day_one_infront_of_home args - { - background: 'sprites/front-of-home.png', - player: [1, 17], - scenes: [ - [43, 34, 10, 16, :end_day_one_home], - ], - storylines: [ - [20, 10, 4, 4, "It's getting late. Better get some sleep."], - ] - } - end + # ==== HOW TO RENDER A LINE ============================================= + # Remove the "#" at the beginning of the line below + # how_to_render_lines args + # ======================================================================= - def end_day_one_home args - { - background: 'sprites/inside-home.png', - player: [34, 3], - scenes: [ - [32, 40, 8, 10, :end_day_one_dream], - ], - storylines: [ - [38, 4, 4, 4, "It's getting late. Better get some sleep."], - ] - } + + # == 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 end_day_one_dream args - { - background: 'sprites/dream.png', - fade: 60, - player: [4, 4], - scenes: [ - [62, 0, 2, 64, :explaining_the_special_power] - ], - storylines: [ - [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], - [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], - [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] - ] + 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: LOWREZ_FONT_PATH } - end - def explaining_the_special_power args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [32, 30], - scenes: [ - [ - 38, 21, 4, 4, :explaining_the_special_power_inside_computer - ], - ] + 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 - def explaining_the_special_power_inside_computer args - { - background: 'sprites/pc.png', - fade: 60, - player: [34, 4], - scenes: [ - [0, 62, 64, 3, :the_blinking_light] - ], - storylines: [ - [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], - [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], - [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], - [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] - ] - } - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb -#+begin_src ruby - def final_decision_side_of_home args - { - fade: 120, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :final_decision_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render, - storylines: [ - [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] - ] - } - end - def final_decision_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :final_decision_path_to_observatory] - ], - render_override: :blinking_light_mountain_pass_render - } - end + # ======================================================================= + # ==== HOW TO RENDER A LABEL ============================================ + # ======================================================================= + def how_to_render_a_label args + # NOTE: Text is aligned from the TOP LEFT corner - def final_decision_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :final_decision_observatory] - ], - render_override: :blinking_light_path_to_observatory_render - } - end + # 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: LOWREZ_FONT_PATH } - def final_decision_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :final_decision_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } - end + # 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: LOWREZ_FONT_PATH } - def final_decision_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [], - scenes: [ - [30, 18, 5, 12, :final_decision_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - end + # 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: LOWREZ_FONT_PATH } - def final_decision_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - storylines: [], - scenes: [ - [*hotspot_top, :final_decision_ship_status], - ] - } - end + # 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: LOWREZ_FONT_PATH } - def final_decision_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [*hotspot_top_right, :final_decision] - ], - storylines: [ - [30, 8, 4, 4, "????"], - *final_decision_ship_status_shared(args) - ] - } - end + # 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") - def final_decision args - decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", - "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", - [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], - [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], - [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], - [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] + # Example 2 + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 31, + text: "Default", + r: 128, + g: 128, + b: 128) end - def final_decision_game_over_noone args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } - 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 } - def final_decision_game_over_matthew args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } - end + # 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 } - def final_decision_game_over_anka args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } - end + # 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 } - def final_decision_game_over_sasha args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } + # Render a red square at 6, 6 with a width and height of 4 + args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 } end - def final_decision_ship_status_shared args - [ - *ship_control_hotspot(24, 22, - "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", - "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", - "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", - "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), - ] - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb -#+begin_src ruby - def final_message_sad args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Another-- sleepless-- night..."], - ], - scenes: [ - [32, -1, 8, 3, :final_message_observatory] - ] - } - 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 } - def final_message_happy args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Oh man, I slept like rock!"], - ], - scenes: [ - [32, -1, 8, 3, :final_message_observatory] - ] - } + # 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 - def final_message_side_of_home args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :final_message_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } + ## # ============================================================================= + ## # ==== 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 - def final_message_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :final_message_path_to_observatory], - ], - storylines: [ - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] - ], - render_override: :blinking_light_mountain_pass_render - } - end - - def final_message_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :final_message_observatory] - ], - storylines: [ - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] - ], - render_override: :blinking_light_path_to_observatory_render - } - end - - def final_message_observatory args - if args.state.scene_history.include? :replied_with_whole_truth - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Here-- we- go..."] - ], - scenes: [ - [30, 18, 5, 12, :final_message_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - else - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] - ], - scenes: [ - [30, 18, 5, 12, :final_message_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render + ## # ============================================================================= + ## # == 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 - end - - def final_message_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 60, - scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] - } - end - def final_message_check_ship_status args - { - background: 'sprites/mainframe.png', - storylines: [ - [45, 45, 4, 4, (final_message_current args)], - ], - scenes: [ - [*hotspot_top, :final_message_ship_status], - ] - } - end + # Given an array of positions create sprites + positions = [ + { x: 10, y: 42 }, + { x: 15, y: 45 }, + { x: 22, y: 33 }, + ] - def final_message_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [30, 50, 4, 4, :final_message_ship_status_reviewed] - ], - storylines: [ - [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], - *final_message_ship_status_shared(args) - ] - } + 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 - def final_message_ship_status_reviewed args - { - background: 'sprites/serenity.png', - fade: 60, - scenes: [ - [*hotspot_bottom, :final_message_summary] - ], - storylines: [ - [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], - ] - } - 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 - def final_message_ship_status_shared args - [ - *ship_control_hotspot( 0, 50, - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", - "Matthew's--- Chamber--: OCCUPIED----", - "Aanka's--- Chamber--: OCCUPIED----", - "Sasha's--- Chamber--: OCCUPIED----"), - *ship_control_hotspot(12, 35, - "Life- Support--: Not-- Needed---", - "O2--- Production---: OFF---", - "CO2--- Scrubbers---: OFF---", - "H2O--- Production---: OFF---"), - *ship_control_hotspot(24, 20, - "Navigation: Offline---", - "Sensor: OFF---", - "Heads- Up- Display: DAMAGED---", - "Arithmetic--- Unit: DAMAGED----"), - *ship_control_hotspot(36, 35, - "COMM: Underpowered----", - "Text: ON---", - "Audio: SEGFAULT---", - "Video: DAMAGED---"), - *ship_control_hotspot(48, 50, - "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", - "Engine I: ON---", - "Engine II: ON---", - "Engine III: ON---") - ] - end + # 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? - def final_message_last_reply args - if args.state.scene_history.include? :replied_with_whole_truth - return "Buffer--: #{anka_reply_whole_truth.quote}" + # 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 - return "Buffer--: #{anka_reply_half_truth.quote}" - end - end + # if the sprite_index is nil, render a countdown instead + countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) - def final_message_current args - if args.state.scene_history.include? :replied_with_whole_truth - return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." - else - return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" + 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 - def final_message_summary args - if args.state.scene_history.include? :replied_with_whole_truth - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [31, 11], - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], - storylines: [ - [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], - ] + ## # ============================================================================= + ## # ==== 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 - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [31, 11], - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], - storylines: [ - [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], - ] - } + # 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 - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb -#+begin_src ruby - def serenity_alive_side_of_home args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :serenity_alive_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } - end - - def serenity_alive_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :serenity_alive_path_to_observatory], - ], - storylines: [ - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] - ], - render_override: :blinking_light_mountain_pass_render - } - end - - def serenity_alive_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :serenity_alive_observatory] - ], - storylines: [ - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] - ], - render_override: :blinking_light_path_to_observatory_render - } - end - def serenity_alive_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :serenity_alive_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } + # 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 - def serenity_alive_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [], - scenes: [ - [30, 18, 5, 12, :serenity_alive_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - 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) - def serenity_alive_inside_mainframe args - { - background: 'sprites/mainframe.png', - fade: 60, - player: [30, 4], - scenes: [ - [*hotspot_top, :serenity_alive_ship_status], - ], - storylines: [ - [22, 45, 17, 4, (serenity_alive_last_reply args)], - [45, 45, 4, 4, (serenity_alive_current_message args)], - ] - } - end + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 56, text: "Use WASD", + alignment_enum: 1) - def serenity_alive_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] - ], - storylines: [ - [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], - [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], - *serenity_alive_shared_ship_status(args) - ] - } - end + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 50, text: "Or Click", + alignment_enum: 1) - def serenity_alive_ship_status_reviewed args - { - background: 'sprites/serenity.png', - fade: 60, - scenes: [ - [*hotspot_bottom, :serenity_alive_time_to_reply] - ], - storylines: [ - [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], - ] - } - end + # set the initial values for x and y using ||= ("or equal operator") + args.state.ship.x ||= 0 + args.state.ship.y ||= 0 - def serenity_alive_time_to_reply args - decision_graph serenity_alive_current_message(args), - "Okay... time to deliver the bad news...", - [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], - [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] - end + # 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 - def serenity_alive_shared_ship_status args - [ - *ship_control_hotspot( 0, 50, - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", - nil, - nil, - nil), - *ship_control_hotspot(12, 35, - "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", - nil, - nil, - nil), - *ship_control_hotspot(24, 20, - "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", - nil, - nil, - nil), - *ship_control_hotspot(36, 35, - "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", - nil, - nil, - nil), - *ship_control_hotspot(48, 50, - "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", - nil, - nil, - nil) - ] - 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 - def serenity_alive_firm_reply - "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." - 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 - def serenity_alive_sugarcoated_reply - "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." - 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 - def replied_to_serenity_alive_firmly args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], - *serenity_alive_reply_completed_shared_hotspots(args), - ] - } - 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 - def replied_to_serenity_alive_kindly args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], - *serenity_alive_reply_completed_shared_hotspots(args), - ] + # 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 - def serenity_alive_path_from_observatory args - { - fade: 60, - background: 'sprites/path-to-observatory.png', - player: [4, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_bio_infront_of_home] - ], - storylines: [ - [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] - ] - } - 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) - def serenity_alive_reply_completed_shared_hotspots args - [ - [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], - [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], - [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] - ] - end + # 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 - def serenity_alive_last_reply args - if args.state.scene_history.include? :replied_to_introduction_seriously - return "Buffer--: \"Hello, Who- is sending-- this message--?\"" - else - return "Buffer--: \"New- phone. Who dis?\"" + # 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 - end - def serenity_alive_current_message args - if args.state.scene_history.include? :replied_to_introduction_seriously - "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote - else - "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote + 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 - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb -#+begin_src ruby - def serenity_bio_infront_of_home args - { - fade: 60, - background: 'sprites/front-of-home.png', - player: [54, 23], - scenes: [ - [44, 34, 8, 14, :serenity_bio_inside_home], - [0, 3, 3, 22, :serenity_bio_library] - ] - } - end - def serenity_bio_inside_home args - { - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I'm--- completely--- exhausted."], - ], - scenes: [ - [30, 38, 12, 13, :serenity_bio_restless_sleep], - [32, 0, 8, 3, :serenity_bio_infront_of_home], - ] - } + # 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 - def serenity_bio_restless_sleep args - { - fade: 60, - background: 'sprites/inside-home.png', - storylines: [ - [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], - ], - scenes: [ - [32, 0, 8, 3, :serenity_bio_infront_of_home], - ] - } - 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 } - def serenity_bio_library args - { - background: 'sprites/library.png', - fade: 60, - player: [30, 7], - scenes: [ - [21, 35, 3, 18, :serenity_bio_book] - ] - } - end + # 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) - def serenity_bio_book args - { - background: 'sprites/book.png', - fade: 60, - player: [6, 52], - storylines: [ - [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], - [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], - [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], + # 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") - [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], - [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], + # Creates button two using a border and a label + args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20) - [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], - [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], - ], - scenes: [ - [*hotspot_bottom, :serenity_bio_finally_to_bed] - ] - } - end + 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") - def serenity_bio_finally_to_bed args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [35, 3], - storylines: [ - [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], - ], - scenes: [ - [32, 38, 10, 13, :bad_dream], - ] - } - end + # Initialize the state variable that tracks which button was clicked to "" (empty stringI + args.state.last_button_clicked ||= "--" - def bad_dream args - { - fade: 120, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], - ], - scenes: [ - [32, -1, 8, 3, :bad_dream_observatory] - ] - } - end + # 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 - def bad_dream_observatory args - { - background: 'sprites/inside-observatory.png', - fade: 120, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] - ], - scenes: [ - [30, 18, 5, 12, :bad_dream_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } + # 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 bad_dream_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 120, - storylines: [ - [22, 45, 17, 4, (bad_dream_last_reply args)], - ], - scenes: [ - [45, 45, 4, 4, :bad_dream_everyone_dead], - ] - } - end - def bad_dream_everyone_dead args - { - background: 'sprites/mainframe.png', - storylines: [ - [22, 45, 17, 4, (bad_dream_last_reply args)], - [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], - [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], - ], - scenes: [ - [*hotspot_bottom, :anka_inside_room] - ] - } - 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 - def bad_dream_last_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Buffer--: #{serenity_alive_firm_reply.quote}" - else - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + 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 - end - -#+end_src - -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb -#+begin_src ruby - # decision_graph "Message from Sasha", - # "I should reply.", - # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], - # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] - def reply_to_introduction args - decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", - "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", - [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], - [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] - end - def replied_to_introduction_seriously args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - *replied_to_introduction_shared_scenes(args) - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], - *replied_to_introduction_shared_storylines(args) - ] - } - end + args.state.grid_rendered = true - def replied_to_introduction_humorously args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - *replied_to_introduction_shared_scenes(args) - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], - *replied_to_introduction_shared_storylines(args) - ] - } - end + 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 } - def replied_to_introduction_shared_storylines args - [ - [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], - [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], - [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] + 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"}", ] - end - - def replied_to_introduction_shared_scenes args - [[60, 0, 4, 32, :replied_to_introduction_observatory]] - end - - def replied_to_introduction_observatory args - { - background: 'sprites/observatory.png', - player: [28, 39], - scenes: [ - [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] - ] - } - end - def replied_to_introduction_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [0, 26], - scenes: [ - [60, 0, 4, 20, :replied_to_introduction_mountain_pass] - ], - } - end + 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 - def replied_to_introduction_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [21, 48], - scenes: [ - [0, 0, 15, 4, :replied_to_introduction_side_of_home] - ], - storylines: [ - [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] - ] - } + 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 - def replied_to_introduction_side_of_home args - { - background: 'sprites/side-of-home.png', - player: [58, 29], - scenes: [ - [2, 0, 61, 2, :speed_of_light_front_of_home] - ], - } - end + $gtk.reset #+end_src -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb +* Platformer - Clepto Frog - main.rb #+begin_src ruby - def speed_of_light_front_of_home args - { - background: 'sprites/front-of-home.png', - player: [54, 23], - scenes: [ - [44, 34, 8, 14, :speed_of_light_inside_home], - [0, 3, 3, 22, :speed_of_light_outside_library] - ] - } - end + # ./samples/99_genre_platformer/clepto_frog/app/main.rb + MAP_FILE_PATH = 'app/map.txt' - def speed_of_light_inside_home args - { - background: 'sprites/inside-home.png', - player: [35, 4], - storylines: [ - [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] - ], - scenes: [ - [32, 0, 8, 3, :speed_of_light_front_of_home], - ] - } - end + require 'app/map.rb' - def speed_of_light_outside_library args - { - background: 'sprites/outside-library.png', - player: [55, 19], - scenes: [ - [49, 39, 6, 10, :speed_of_light_library], - [61, 11, 3, 20, :speed_of_light_front_of_home] - ] - } - end + class CleptoFrog + attr_gtk - def speed_of_light_library args - { - background: 'sprites/library.png', - player: [30, 7], - scenes: [ - [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] - ] - } - end + def render_ending + state.game_over_at ||= state.tick_count - def speed_of_light_celestial_bodies_diagram args - { - background: 'sprites/planets.png', - fade: 60, - player: [30, 3], - scenes: [ - [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] - ], - storylines: [ - [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], + outputs.labels << [640, 700, "Clepto Frog", 4, 1] - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], - # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], - ] - } - end - - def speed_of_light_distance_discovered args - { - background: 'sprites/planets.png', - scenes: [ - [13, 0, 44, 3, :speed_of_light_end_of_day] - ], - storylines: [ - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], - [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], - ] - } - end - - def speed_of_light_end_of_day args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [35, 0], - storylines: [ - [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] - ], - scenes: [ - [31, 38, 10, 12, :serenity_alive_side_of_home] - ] - } - end - -#+end_src - -* 99_genre_platformer/clepto_frog/app/main.rb -#+begin_src ruby - MAP_FILE_PATH = 'app/map.txt' - - require 'app/map.rb' - - class CleptoFrog - attr_gtk - - def render_ending - state.game_over_at ||= state.tick_count - - outputs.labels << [640, 700, "Clepto Frog", 4, 1] - - if state.tick_count >= (state.game_over_at + 120) - outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] - end + if state.tick_count >= (state.game_over_at + 120) + outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] + end if state.tick_count >= (state.game_over_at + 240) outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", @@ -15774,8 +14324,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/clepto_frog/app/map.rb +* Platformer - Clepto Frog - map.rb #+begin_src ruby + # ./samples/99_genre_platformer/clepto_frog/app/map.rb $collisions = [ [326, 463, 64, 64], [274, 462, 64, 64], @@ -16804,8 +15355,18 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/gorillas_basic/app/main.rb +* Platformer - Gorillas Basic - credits.txt +#+begin_src ruby + # ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt + code: Amir Rajan, https://twitter.com/amirrajan + graphics: Nick Culbertson, https://twitter.com/MobyPixel + + +#+end_src + +* Platformer - Gorillas Basic - main.rb #+begin_src ruby + # ./samples/99_genre_platformer/gorillas_basic/app/main.rb class YouSoBasicGorillas attr_accessor :outputs, :grid, :state, :inputs @@ -17182,8 +15743,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/gorillas_basic/app/repl.rb +* Platformer - Gorillas Basic - repl.rb #+begin_src ruby + # ./samples/99_genre_platformer/gorillas_basic/app/repl.rb begin if $gtk.args.state.current_turn == :player_1_angle $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}" @@ -17204,8 +15766,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/gorillas_basic/app/tests.rb +* Platformer - Gorillas Basic - tests.rb #+begin_src ruby + # ./samples/99_genre_platformer/gorillas_basic/app/tests.rb $gtk.reset 100 $gtk.supress_framerate_warning = true $gtk.require 'app/tests/building_generation_tests.rb' @@ -17213,8 +15776,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb +* Platformer - Gorillas Basic - Tests - building_generation_tests.rb #+begin_src ruby + # ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb def test_solids args, assert game = YouSoBasicGorillas.new game.outputs = args.outputs @@ -17233,8 +15797,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_platformer/the_little_probe/app/main.rb +* Platformer - The Little Probe - main.rb #+begin_src ruby + # ./samples/99_genre_platformer/the_little_probe/app/main.rb class FallingCircle attr_gtk @@ -17493,8 +16058,8 @@ Follows is a source code listing for all files that have been open sourced. This if circle.floor outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0] outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255] - outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0] - outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0] + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0] outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255] end @@ -17639,11 +16204,11 @@ Follows is a source code listing for all files that have been open sourced. This end def load_terrain - load_lines 'level.txt' + load_lines 'data/level.txt' end def load_lava - load_lines 'level_lava.txt' + load_lines 'data/level_lava.txt' end def load_level force: false @@ -18065,68 +16630,4111 @@ Follows is a source code listing for all files that have been open sourced. This w.a = w[:created_at].ease(30) * 255 end - state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 } + state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 } + + if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0) + circle.after_images << { + x: circle.x, + y: circle.y, + w: circle.radius, + h: circle.radius, + a: 255, + created_at: state.tick_count + } + end + + circle.after_images.each do |ai| + ai.a = ai[:created_at].ease(10, :flip) * 255 + end + + circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 } + calc_physics + end + + def circle + state.circle + end + + def camera + state.camera + end + + def terrain + state.terrain + end + + def lava + state.lava + end + end + + # $gtk.reset + + def tick args + args.outputs.background_color = [0, 0, 0] + if args.inputs.keyboard.r + args.gtk.reset + return + end + # uncomment the line below to slow down the game so you + # can see each tick as it passes + # args.gtk.slowmo! 30 + $game ||= FallingCircle.new + $game.args = args + $game.tick + end + + def reset + $game = nil + end + +#+end_src + +* Platformer - The Little Probe - Data - level.txt +#+begin_src ruby + # ./samples/99_genre_platformer/the_little_probe/data/level.txt + 640,8840,1180,8840 + -60,10220,0,9960 + -60,10220,0,10500 + 0,10500,0,10780 + 0,10780,40,10900 + 500,10920,760,10960 + 300,10560,820,10600 + 420,10320,700,10300 + 820,10600,1500,10600 + 1500,10600,1940,10600 + 1940,10600,2380,10580 + 2380,10580,2800,10620 + 2240,11080,2480,11020 + 2000,11120,2240,11080 + 1760,11180,2000,11120 + 1620,11180,1760,11180 + 1500,11220,1620,11180 + 1180,11280,1340,11220 + 1040,11240,1180,11280 + 840,11280,1040,11240 + 640,11280,840,11280 + 500,11220,640,11280 + 420,11140,500,11220 + 240,11100,420,11140 + 100,11120,240,11100 + 0,11180,100,11120 + -160,11220,0,11180 + -260,11240,-160,11220 + 1340,11220,1500,11220 + 960,13300,1280,13060 + 1280,13060,1540,12860 + 1540,12860,1820,12700 + 1820,12700,2080,12520 + 2080,12520,2240,12400 + 2240,12400,2240,12240 + 2240,12240,2400,12080 + 2400,12080,2560,11920 + 2560,11920,2640,11740 + 2640,11740,2740,11580 + 2740,11580,2800,11400 + 2800,11400,2800,11240 + 2740,11140,2800,11240 + 2700,11040,2740,11140 + 2700,11040,2740,10960 + 2740,10960,2740,10920 + 2700,10900,2740,10920 + 2380,10900,2700,10900 + 2040,10920,2380,10900 + 1720,10940,2040,10920 + 1380,11000,1720,10940 + 1180,10980,1380,11000 + 900,10980,1180,10980 + 760,10960,900,10980 + 240,10960,500,10920 + 40,10900,240,10960 + 0,9700,0,9960 + -60,9500,0,9700 + -60,9420,-60,9500 + -60,9420,-60,9340 + -60,9340,-60,9280 + -60,9120,-60,9280 + -60,8940,-60,9120 + -60,8940,-60,8780 + -60,8780,0,8700 + 0,8700,40,8680 + 40,8680,240,8700 + 240,8700,360,8780 + 360,8780,640,8840 + 1420,8400,1540,8480 + 1540,8480,1680,8500 + 1680,8500,1940,8460 + 1180,8840,1280,8880 + 1280,8880,1340,8860 + 1340,8860,1720,8860 + 1720,8860,1820,8920 + 1820,8920,1820,9140 + 1820,9140,1820,9280 + 1820,9460,1820,9280 + 1760,9480,1820,9460 + 1640,9480,1760,9480 + 1540,9500,1640,9480 + 1340,9500,1540,9500 + 1100,9500,1340,9500 + 1040,9540,1100,9500 + 960,9540,1040,9540 + 300,9420,360,9460 + 240,9440,300,9420 + 180,9600,240,9440 + 120,9660,180,9600 + 100,9820,120,9660 + 100,9820,120,9860 + 120,9860,140,9900 + 140,9900,140,10000 + 140,10440,180,10540 + 100,10080,140,10000 + 100,10080,140,10100 + 140,10100,140,10440 + 180,10540,300,10560 + 2140,9560,2140,9640 + 2140,9720,2140,9640 + 1880,9780,2140,9720 + 1720,9780,1880,9780 + 1620,9740,1720,9780 + 1500,9780,1620,9740 + 1380,9780,1500,9780 + 1340,9820,1380,9780 + 1200,9820,1340,9820 + 1100,9780,1200,9820 + 900,9780,1100,9780 + 820,9720,900,9780 + 540,9720,820,9720 + 360,9840,540,9720 + 360,9840,360,9960 + 360,9960,360,10080 + 360,10140,360,10080 + 360,10140,360,10240 + 360,10240,420,10320 + 700,10300,820,10280 + 820,10280,820,10280 + 820,10280,900,10320 + 900,10320,1040,10300 + 1040,10300,1200,10320 + 1200,10320,1380,10280 + 1380,10280,1500,10300 + 1500,10300,1760,10300 + 2800,10620,2840,10600 + 2840,10600,2900,10600 + 2900,10600,3000,10620 + 3000,10620,3080,10620 + 3080,10620,3140,10600 + 3140,10540,3140,10600 + 3140,10540,3140,10460 + 3140,10460,3140,10360 + 3140,10360,3140,10260 + 3140,10260,3140,10140 + 3140,10140,3140,10000 + 3140,10000,3140,9860 + 3140,9860,3160,9720 + 3160,9720,3160,9580 + 3160,9580,3160,9440 + 3160,9300,3160,9440 + 3160,9300,3160,9140 + 3160,9140,3160,8980 + 3160,8980,3160,8820 + 3160,8820,3160,8680 + 3160,8680,3160,8520 + 1760,10300,1880,10300 + 660,9500,960,9540 + 640,9460,660,9500 + 360,9460,640,9460 + -480,10760,-440,10880 + -480,11020,-440,10880 + -480,11160,-260,11240 + -480,11020,-480,11160 + -600,11420,-380,11320 + -380,11320,-200,11340 + -200,11340,0,11340 + 0,11340,180,11340 + 960,13420,960,13300 + 960,13420,960,13520 + 960,13520,1000,13560 + 1000,13560,1040,13540 + 1040,13540,1200,13440 + 1200,13440,1380,13380 + 1380,13380,1620,13300 + 1620,13300,1820,13220 + 1820,13220,2000,13200 + 2000,13200,2240,13200 + 2240,13200,2440,13160 + 2440,13160,2640,13040 + -480,10760,-440,10620 + -440,10620,-360,10560 + -380,10460,-360,10560 + -380,10460,-360,10300 + -380,10140,-360,10300 + -380,10140,-380,10040 + -380,9880,-380,10040 + -380,9720,-380,9880 + -380,9720,-380,9540 + -380,9360,-380,9540 + -380,9180,-380,9360 + -380,9180,-380,9000 + -380,8840,-380,9000 + -380,8840,-380,8760 + -380,8760,-380,8620 + -380,8620,-380,8520 + -380,8520,-360,8400 + -360,8400,-100,8400 + -100,8400,-60,8420 + -60,8420,240,8440 + 240,8440,240,8380 + 240,8380,500,8440 + 500,8440,760,8460 + 760,8460,1000,8400 + 1000,8400,1180,8420 + 1180,8420,1420,8400 + 1940,8460,2140,8420 + 2140,8420,2200,8520 + 2200,8680,2200,8520 + 2140,8840,2200,8680 + 2140,8840,2140,9020 + 2140,9100,2140,9020 + 2140,9200,2140,9100 + 2140,9200,2200,9320 + 2200,9320,2200,9440 + 2140,9560,2200,9440 + 1880,10300,2200,10280 + 2200,10280,2480,10260 + 2480,10260,2700,10240 + 2700,10240,2840,10180 + 2840,10180,2900,10060 + 2900,9860,2900,10060 + 2900,9640,2900,9860 + 2900,9640,2900,9500 + 2900,9460,2900,9500 + 2740,9460,2900,9460 + 2700,9460,2740,9460 + 2700,9360,2700,9460 + 2700,9320,2700,9360 + 2600,9320,2700,9320 + 2600,9260,2600,9320 + 2600,9200,2600,9260 + 2480,9120,2600,9200 + 2440,9080,2480,9120 + 2380,9080,2440,9080 + 2320,9060,2380,9080 + 2320,8860,2320,9060 + 2320,8860,2380,8840 + 2380,8840,2480,8860 + 2480,8860,2600,8840 + 2600,8840,2740,8840 + 2740,8840,2840,8800 + 2840,8800,2900,8700 + 2900,8600,2900,8700 + 2900,8480,2900,8600 + 2900,8380,2900,8480 + 2900,8380,2900,8260 + 2900,8260,2900,8140 + 2900,8140,2900,8020 + 2900,8020,2900,7900 + 2900,7820,2900,7900 + 2900,7820,2900,7740 + 2900,7660,2900,7740 + 2900,7560,2900,7660 + 2900,7460,2900,7560 + 2900,7460,2900,7360 + 2900,7260,2900,7360 + 2840,7160,2900,7260 + 2800,7080,2840,7160 + 2700,7100,2800,7080 + 2560,7120,2700,7100 + 2400,7100,2560,7120 + 2320,7100,2400,7100 + 2140,7100,2320,7100 + 2040,7080,2140,7100 + 1940,7080,2040,7080 + 1820,7140,1940,7080 + 1680,7140,1820,7140 + 1540,7140,1680,7140 + 1420,7220,1540,7140 + 1280,7220,1380,7220 + 1140,7200,1280,7220 + 1000,7220,1140,7200 + 760,7280,900,7320 + 540,7220,760,7280 + 300,7180,540,7220 + 180,7120,180,7160 + 40,7140,180,7120 + -60,7160,40,7140 + -200,7120,-60,7160 + 180,7160,300,7180 + -260,7060,-200,7120 + -260,6980,-260,7060 + -260,6880,-260,6980 + -260,6880,-260,6820 + -260,6820,-200,6760 + -200,6760,-100,6740 + -100,6740,-60,6740 + -60,6740,40,6740 + 40,6740,300,6800 + 300,6800,420,6760 + 420,6760,500,6740 + 500,6740,540,6760 + 540,6760,540,6760 + 540,6760,640,6780 + 640,6660,640,6780 + 580,6580,640,6660 + 580,6440,580,6580 + 580,6440,640,6320 + 640,6320,640,6180 + 580,6080,640,6180 + 580,6080,640,5960 + 640,5960,640,5840 + 640,5840,640,5700 + 640,5700,660,5560 + 660,5560,660,5440 + 660,5440,660,5300 + 660,5140,660,5300 + 660,5140,660,5000 + 660,5000,660,4880 + 660,4880,820,4860 + 820,4860,1000,4840 + 1000,4840,1100,4860 + 1100,4860,1280,4860 + 1280,4860,1420,4840 + 1420,4840,1580,4860 + 1580,4860,1720,4820 + 1720,4820,1880,4860 + 1880,4860,2000,4840 + 2000,4840,2140,4840 + 2140,4840,2320,4860 + 2320,4860,2440,4880 + 2440,4880,2600,4880 + 2600,4880,2800,4880 + 2800,4880,2900,4880 + 2900,4880,2900,4820 + 2900,4740,2900,4820 + 2800,4700,2900,4740 + 2520,4680,2800,4700 + 2240,4660,2520,4680 + 1940,4620,2240,4660 + 1820,4580,1940,4620 + 1820,4500,1820,4580 + 1820,4500,1880,4420 + 1880,4420,2000,4420 + 2000,4420,2200,4420 + 2200,4420,2400,4440 + 2400,4440,2600,4440 + 2600,4440,2840,4440 + 2840,4440,2900,4400 + 2740,4260,2900,4280 + 2600,4240,2740,4260 + 2480,4280,2600,4240 + 2320,4240,2480,4280 + 2140,4220,2320,4240 + 1940,4220,2140,4220 + 1880,4160,1940,4220 + 1880,4160,1880,4080 + 1880,4080,2040,4040 + 2040,4040,2240,4060 + 2240,4060,2400,4040 + 2400,4040,2600,4060 + 2600,4060,2740,4020 + 2740,4020,2840,3940 + 2840,3780,2840,3940 + 2740,3660,2840,3780 + 2700,3680,2740,3660 + 2520,3700,2700,3680 + 2380,3700,2520,3700 + 2200,3720,2380,3700 + 2040,3720,2200,3720 + 1880,3700,2040,3720 + 1820,3680,1880,3700 + 1760,3600,1820,3680 + 1760,3600,1820,3480 + 1820,3480,1880,3440 + 1880,3440,1960,3460 + 1960,3460,2140,3460 + 2140,3460,2380,3460 + 2380,3460,2640,3440 + 2640,3440,2900,3380 + 2840,3280,2900,3380 + 2840,3280,2900,3200 + 2900,3200,2900,3140 + 2840,3020,2900,3140 + 2800,2960,2840,3020 + 2700,3000,2800,2960 + 2600,2980,2700,3000 + 2380,3000,2600,2980 + 2140,3000,2380,3000 + 1880,3000,2140,3000 + 1720,3040,1880,3000 + 1640,2960,1720,3040 + 1500,2940,1640,2960 + 1340,3000,1500,2940 + 1240,3000,1340,3000 + 1140,3020,1240,3000 + 1040,3000,1140,3020 + 960,2960,1040,3000 + 900,2960,960,2960 + 840,2840,900,2960 + 700,2820,840,2840 + 540,2820,700,2820 + 420,2820,540,2820 + 180,2800,420,2820 + 60,2780,180,2800 + -60,2800,60,2780 + -160,2760,-60,2800 + -260,2740,-160,2760 + -300,2640,-260,2740 + -360,2560,-300,2640 + -380,2460,-360,2560 + -380,2460,-300,2380 + -300,2300,-300,2380 + -300,2300,-300,2220 + -300,2100,-300,2220 + -300,2100,-300,2040 + -300,2040,-160,2040 + -160,2040,-60,2040 + -60,2040,60,2040 + 60,2040,180,2040 + 180,2040,360,2040 + 360,2040,540,2040 + 540,2040,700,2080 + 660,2160,700,2080 + 660,2160,700,2260 + 660,2380,700,2260 + 500,2340,660,2380 + 360,2340,500,2340 + 240,2340,360,2340 + 40,2320,240,2340 + -60,2320,40,2320 + -100,2380,-60,2320 + -100,2380,-100,2460 + -100,2460,-100,2540 + -100,2540,0,2560 + 0,2560,140,2600 + 140,2600,300,2600 + 300,2600,460,2600 + 460,2600,640,2600 + 640,2600,760,2580 + 760,2580,820,2560 + 820,2560,820,2500 + 820,2500,820,2400 + 820,2400,840,2320 + 840,2320,840,2240 + 820,2120,840,2240 + 820,2020,820,2120 + 820,1900,820,2020 + 760,1840,820,1900 + 640,1840,760,1840 + 500,1840,640,1840 + 300,1860,420,1880 + 180,1840,300,1860 + 420,1880,500,1840 + 0,1840,180,1840 + -60,1860,0,1840 + -160,1840,-60,1860 + -200,1800,-160,1840 + -260,1760,-200,1800 + -260,1680,-260,1760 + -260,1620,-260,1680 + -260,1540,-260,1620 + -260,1540,-260,1460 + -300,1420,-260,1460 + -300,1420,-300,1340 + -300,1340,-260,1260 + -260,1260,-260,1160 + -260,1060,-260,1160 + -260,1060,-260,960 + -260,880,-260,960 + -260,880,-260,780 + -260,780,-260,680 + -300,580,-260,680 + -300,580,-300,480 + -300,480,-260,400 + -300,320,-260,400 + -300,320,-300,240 + -300,240,-200,220 + -200,220,-200,160 + -200,160,-100,140 + -100,140,0,120 + 0,120,60,120 + 60,120,180,120 + 180,120,300,120 + 300,120,420,140 + 420,140,580,180 + 580,180,760,180 + 760,180,900,180 + 960,180,1100,180 + 1100,180,1340,200 + 1340,200,1580,200 + 1580,200,1720,180 + 1720,180,2000,140 + 2000,140,2240,140 + 2240,140,2480,140 + 2520,140,2800,160 + 2800,160,3000,160 + 3000,160,3140,160 + 3140,260,3140,160 + 3140,260,3140,380 + 3080,500,3140,380 + 3080,620,3080,500 + 3080,620,3080,740 + 3080,740,3080,840 + 3080,960,3080,840 + 3080,1080,3080,960 + 3080,1080,3080,1200 + 3080,1200,3080,1340 + 3080,1340,3080,1460 + 3080,1580,3080,1460 + 3080,1700,3080,1580 + 3080,1700,3080,1760 + 3080,1760,3200,1760 + 3200,1760,3320,1760 + 3320,1760,3520,1760 + 3520,1760,3680,1740 + 3680,1740,3780,1700 + 3780,1700,3840,1620 + 3840,1620,3840,1520 + 3840,1520,3840,1420 + 3840,1320,3840,1420 + 3840,1120,3840,1320 + 3840,1120,3840,940 + 3840,940,3840,760 + 3780,600,3840,760 + 3780,600,3780,440 + 3780,320,3780,440 + 3780,320,3780,160 + 3780,60,3780,160 + 3780,60,4020,60 + 4020,60,4260,40 + 4260,40,4500,40 + 4500,40,4740,40 + 4740,40,4840,20 + 4840,20,4880,80 + 4880,80,5080,40 + 5080,40,5280,20 + 5280,20,5500,0 + 5500,0,5720,0 + 5720,0,5940,60 + 5940,60,6240,60 + 6240,60,6540,20 + 6540,20,6840,20 + 6840,20,7040,0 + 7040,0,7140,0 + 7140,0,7400,20 + 7400,20,7680,0 + 7680,0,7940,0 + 7940,0,8200,-20 + 8200,-20,8360,20 + 8360,20,8560,-40 + 8560,-40,8760,0 + 8760,0,8880,40 + 8880,120,8880,40 + 8840,220,8840,120 + 8620,240,8840,220 + 8420,260,8620,240 + 8200,280,8420,260 + 7940,280,8200,280 + 7760,240,7940,280 + 7560,220,7760,240 + 7360,280,7560,220 + 7140,260,7360,280 + 6940,240,7140,260 + 6720,220,6940,240 + 6480,220,6720,220 + 6360,300,6480,220 + 6240,300,6360,300 + 6200,500,6240,300 + 6200,500,6360,540 + 6360,540,6540,520 + 6540,520,6720,480 + 6720,480,6880,460 + 6880,460,7080,500 + 7080,500,7320,500 + 7320,500,7680,500 + 7680,620,7680,500 + 7520,640,7680,620 + 7360,640,7520,640 + 7200,640,7360,640 + 7040,660,7200,640 + 6880,720,7040,660 + 6720,700,6880,720 + 6540,700,6720,700 + 6420,760,6540,700 + 6280,740,6420,760 + 6240,760,6280,740 + 6200,920,6240,760 + 6200,920,6360,960 + 6360,960,6540,960 + 6540,960,6720,960 + 6720,960,6760,980 + 6760,980,6880,940 + 6880,940,7080,940 + 7080,940,7280,940 + 7280,940,7520,920 + 7520,920,7760,900 + 7760,900,7980,860 + 7980,860,8100,880 + 8100,880,8280,900 + 8280,900,8500,820 + 8500,820,8700,820 + 8700,820,8760,840 + 8760,960,8760,840 + 8700,1040,8760,960 + 8560,1060,8700,1040 + 8460,1080,8560,1060 + 8360,1040,8460,1080 + 8280,1080,8360,1040 + 8160,1120,8280,1080 + 8040,1120,8160,1120 + 7940,1100,8040,1120 + 7800,1120,7940,1100 + 7680,1120,7800,1120 + 7520,1100,7680,1120 + 7360,1100,7520,1100 + 7200,1120,7360,1100 + 7040,1180,7200,1120 + 6880,1160,7040,1180 + 6720,1160,6880,1160 + 6540,1160,6720,1160 + 6360,1160,6540,1160 + 6200,1160,6360,1160 + 6040,1220,6200,1160 + 6040,1220,6040,1400 + 6040,1400,6200,1440 + 6200,1440,6320,1440 + 6320,1440,6440,1440 + 6600,1440,6760,1440 + 6760,1440,6940,1420 + 6440,1440,6600,1440 + 6940,1420,7280,1400 + 7280,1400,7560,1400 + 7560,1400,7760,1400 + 7760,1400,7940,1360 + 7940,1360,8100,1380 + 8100,1380,8280,1340 + 8280,1340,8460,1320 + 8660,1300,8760,1360 + 8460,1320,8660,1300 + 8760,1360,8800,1500 + 8800,1660,8800,1500 + 8800,1660,8800,1820 + 8700,1840,8800,1820 + 8620,1860,8700,1840 + 8560,1800,8620,1860 + 8560,1800,8620,1680 + 8500,1640,8620,1680 + 8420,1680,8500,1640 + 8280,1680,8420,1680 + 8160,1680,8280,1680 + 7900,1680,8160,1680 + 7680,1680,7900,1680 + 7400,1660,7680,1680 + 7140,1680,7400,1660 + 6880,1640,7140,1680 + 6040,1820,6320,1780 + 5900,1840,6040,1820 + 6640,1700,6880,1640 + 6320,1780,6640,1700 + 5840,2040,5900,1840 + 5840,2040,5840,2220 + 5840,2220,5840,2320 + 5840,2460,5840,2320 + 5840,2560,5840,2460 + 5840,2560,5960,2620 + 5960,2620,6200,2620 + 6200,2620,6380,2600 + 6380,2600,6600,2580 + 6600,2580,6800,2600 + 6800,2600,7040,2580 + 7040,2580,7280,2580 + 7280,2580,7480,2560 + 7760,2540,7980,2520 + 7980,2520,8160,2500 + 7480,2560,7760,2540 + 8160,2500,8160,2420 + 8160,2420,8160,2320 + 8160,2180,8160,2320 + 7980,2160,8160,2180 + 7800,2180,7980,2160 + 7600,2200,7800,2180 + 7400,2200,7600,2200 + 6960,2200,7200,2200 + 7200,2200,7400,2200 + 6720,2200,6960,2200 + 6540,2180,6720,2200 + 6320,2200,6540,2180 + 6240,2160,6320,2200 + 6240,2160,6240,2040 + 6240,2040,6240,1940 + 6240,1940,6440,1940 + 6440,1940,6720,1940 + 6720,1940,6940,1920 + 7520,1920,7760,1920 + 6940,1920,7280,1920 + 7280,1920,7520,1920 + 7760,1920,8100,1900 + 8100,1900,8420,1900 + 8420,1900,8460,1940 + 8460,2120,8460,1940 + 8460,2280,8460,2120 + 8460,2280,8560,2420 + 8560,2420,8660,2380 + 8660,2380,8800,2340 + 8800,2340,8840,2400 + 8840,2520,8840,2400 + 8800,2620,8840,2520 + 8800,2740,8800,2620 + 8800,2860,8800,2740 + 8800,2940,8800,2860 + 8760,2980,8800,2940 + 8660,2980,8760,2980 + 8620,2960,8660,2980 + 8560,2880,8620,2960 + 8560,2880,8560,2780 + 8500,2740,8560,2780 + 8420,2760,8500,2740 + 8420,2840,8420,2760 + 8420,2840,8420,2940 + 8420,3040,8420,2940 + 8420,3160,8420,3040 + 8420,3280,8420,3380 + 8420,3280,8420,3160 + 8420,3380,8620,3460 + 8620,3460,8760,3460 + 8760,3460,8840,3400 + 8840,3400,8960,3400 + 8960,3400,9000,3500 + 9000,3700,9000,3500 + 9000,3900,9000,3700 + 9000,4080,9000,3900 + 9000,4280,9000,4080 + 9000,4500,9000,4280 + 9000,4620,9000,4500 + 9000,4780,9000,4620 + 9000,4780,9000,4960 + 9000,5120,9000,4960 + 9000,5120,9000,5300 + 8960,5460,9000,5300 + 8920,5620,8960,5460 + 8920,5620,8920,5800 + 8920,5800,8920,5960 + 8920,5960,8920,6120 + 8920,6120,8960,6300 + 8960,6300,8960,6480 + 8960,6660,8960,6480 + 8960,6860,8960,6660 + 8960,7040,8960,6860 + 8920,7420,8920,7220 + 8920,7420,8960,7620 + 8960,7620,8960,7800 + 8960,7800,8960,8000 + 8960,8000,8960,8180 + 8960,8180,8960,8380 + 8960,8580,8960,8380 + 8920,8800,8960,8580 + 8880,9000,8920,8800 + 8840,9180,8880,9000 + 8800,9220,8840,9180 + 8800,9220,8840,9340 + 8760,9380,8840,9340 + 8560,9340,8760,9380 + 8360,9360,8560,9340 + 8160,9360,8360,9360 + 8040,9340,8160,9360 + 7860,9360,8040,9340 + 7680,9360,7860,9360 + 7520,9360,7680,9360 + 7420,9260,7520,9360 + 7400,9080,7420,9260 + 7400,9080,7420,8860 + 7420,8860,7440,8720 + 7440,8720,7480,8660 + 7480,8660,7520,8540 + 7520,8540,7600,8460 + 7600,8460,7800,8480 + 7800,8480,8040,8480 + 8040,8480,8280,8480 + 8280,8480,8500,8460 + 8500,8460,8620,8440 + 8620,8440,8660,8340 + 8660,8340,8660,8220 + 8660,8220,8700,8080 + 8700,8080,8700,7920 + 8700,7920,8700,7760 + 8700,7760,8700,7620 + 8700,7480,8700,7620 + 8700,7480,8700,7320 + 8700,7160,8700,7320 + 8920,7220,8960,7040 + 8660,7040,8700,7160 + 8660,7040,8700,6880 + 8660,6700,8700,6880 + 8660,6700,8700,6580 + 8700,6460,8700,6580 + 8700,6460,8700,6320 + 8700,6160,8700,6320 + 8700,6160,8760,6020 + 8760,6020,8760,5860 + 8760,5860,8760,5700 + 8760,5700,8760,5540 + 8760,5540,8760,5360 + 8760,5360,8760,5180 + 8760,5000,8760,5180 + 8700,4820,8760,5000 + 8560,4740,8700,4820 + 8420,4700,8560,4740 + 8280,4700,8420,4700 + 8100,4700,8280,4700 + 7980,4700,8100,4700 + 7820,4740,7980,4700 + 7800,4920,7820,4740 + 7800,4920,7900,4960 + 7900,4960,8060,4980 + 8060,4980,8220,5000 + 8220,5000,8420,5040 + 8420,5040,8460,5120 + 8460,5180,8460,5120 + 8360,5200,8460,5180 + 8360,5280,8360,5200 + 8160,5300,8360,5280 + 8040,5260,8160,5300 + 7860,5220,8040,5260 + 7720,5160,7860,5220 + 7640,5120,7720,5160 + 7480,5120,7640,5120 + 7240,5120,7480,5120 + 7000,5120,7240,5120 + 6800,5160,7000,5120 + 6640,5220,6800,5160 + 6600,5360,6640,5220 + 6600,5460,6600,5360 + 6480,5520,6600,5460 + 6240,5540,6480,5520 + 5980,5540,6240,5540 + 5740,5540,5980,5540 + 5500,5520,5740,5540 + 5400,5520,5500,5520 + 5280,5540,5400,5520 + 5080,5540,5280,5540 + 4940,5540,5080,5540 + 4760,5540,4940,5540 + 4600,5540,4760,5540 + 4440,5560,4600,5540 + 4040,5580,4120,5520 + 4260,5540,4440,5560 + 4120,5520,4260,5540 + 4020,5720,4040,5580 + 4020,5840,4020,5720 + 4020,5840,4080,5940 + 4080,5940,4120,6040 + 4120,6040,4200,6080 + 4200,6080,4340,6080 + 4340,6080,4500,6060 + 4500,6060,4700,6060 + 4700,6060,4880,6060 + 4880,6060,5080,6060 + 5080,6060,5280,6080 + 5280,6080,5440,6100 + 5440,6100,5660,6100 + 5660,6100,5900,6080 + 5900,6080,6120,6080 + 6120,6080,6360,6080 + 6360,6080,6480,6100 + 6480,6100,6540,6060 + 6540,6060,6720,6060 + 6720,6060,6940,6060 + 6940,6060,7140,6060 + 7400,6060,7600,6060 + 7140,6060,7400,6060 + 7600,6060,7800,6060 + 7800,6060,7860,6080 + 7860,6080,8060,6080 + 8060,6080,8220,6080 + 8220,6080,8320,6140 + 8320,6140,8360,6300 + 8320,6460,8360,6300 + 8320,6620,8320,6460 + 8320,6800,8320,6620 + 8320,6960,8320,6800 + 8320,6960,8360,7120 + 8320,7280,8360,7120 + 8320,7440,8320,7280 + 8320,7600,8320,7440 + 8100,7580,8220,7600 + 8220,7600,8320,7600 + 7900,7560,8100,7580 + 7680,7560,7900,7560 + 7480,7580,7680,7560 + 7280,7580,7480,7580 + 7080,7580,7280,7580 + 7000,7600,7080,7580 + 6880,7600,7000,7600 + 6800,7580,6880,7600 + 6640,7580,6800,7580 + 6540,7580,6640,7580 + 6380,7600,6540,7580 + 6280,7620,6380,7600 + 6240,7700,6280,7620 + 6240,7700,6240,7800 + 6240,7840,6240,7800 + 6080,7840,6240,7840 + 5960,7820,6080,7840 + 5660,7840,5800,7840 + 5500,7800,5660,7840 + 5440,7700,5500,7800 + 5800,7840,5960,7820 + 5440,7540,5440,7700 + 5440,7440,5440,7540 + 5440,7320,5440,7440 + 5400,7320,5440,7320 + 5340,7400,5400,7320 + 5340,7400,5340,7500 + 5340,7600,5340,7500 + 5340,7600,5340,7720 + 5340,7720,5340,7860 + 5340,7860,5340,7960 + 5340,7960,5440,8020 + 5440,8020,5560,8020 + 5560,8020,5720,8040 + 5720,8040,5900,8060 + 5900,8060,6080,8060 + 6080,8060,6240,8060 + 6720,8040,6840,8060 + 6240,8060,6480,8040 + 6480,8040,6720,8040 + 6840,8060,6940,8060 + 6940,8060,7080,8120 + 7080,8120,7140,8180 + 7140,8460,7140,8320 + 7140,8620,7140,8460 + 7140,8620,7140,8740 + 7140,8860,7140,8740 + 7140,8960,7140,8860 + 7140,8960,7200,9080 + 7140,9200,7200,9080 + 7140,9200,7200,9320 + 7200,9320,7200,9460 + 7200,9760,7200,9900 + 7200,9620,7200,9460 + 7200,9620,7200,9760 + 7200,9900,7200,10060 + 7200,10220,7200,10060 + 7200,10360,7200,10220 + 7140,10400,7200,10360 + 6880,10400,7140,10400 + 6640,10360,6880,10400 + 6420,10360,6640,10360 + 6160,10380,6420,10360 + 5940,10340,6160,10380 + 5720,10320,5940,10340 + 5500,10340,5720,10320 + 5280,10300,5500,10340 + 5080,10300,5280,10300 + 4840,10280,5080,10300 + 4700,10280,4840,10280 + 4540,10280,4700,10280 + 4360,10280,4540,10280 + 4200,10300,4360,10280 + 4040,10380,4200,10300 + 4020,10500,4040,10380 + 3980,10640,4020,10500 + 3980,10640,3980,10760 + 3980,10760,4020,10920 + 4020,10920,4080,11000 + 4080,11000,4340,11020 + 4340,11020,4600,11060 + 4600,11060,4840,11040 + 4840,11040,4880,10960 + 4880,10740,4880,10960 + 4880,10740,4880,10600 + 4880,10600,5080,10560 + 5080,10560,5340,10620 + 5340,10620,5660,10620 + 5660,10620,6040,10600 + 6040,10600,6120,10620 + 6120,10620,6240,10720 + 6240,10720,6420,10740 + 6420,10740,6640,10760 + 6640,10760,6880,10780 + 7140,10780,7400,10780 + 6880,10780,7140,10780 + 7400,10780,7680,10780 + 7680,10780,8100,10760 + 8100,10760,8460,10740 + 8460,10740,8700,10760 + 8800,10840,8800,10980 + 8700,10760,8800,10840 + 8760,11200,8800,10980 + 8760,11200,8760,11380 + 8760,11380,8800,11560 + 8760,11680,8800,11560 + 8760,11760,8760,11680 + 8760,11760,8760,11920 + 8760,11920,8800,12080 + 8800,12200,8800,12080 + 8700,12240,8800,12200 + 8560,12220,8700,12240 + 8360,12220,8560,12220 + 8160,12240,8360,12220 + 7720,12220,7980,12220 + 7980,12220,8160,12240 + 7400,12200,7720,12220 + 7200,12180,7400,12200 + 7000,12160,7200,12180 + 6800,12160,7000,12160 + 6280,12140,6380,12180 + 6120,12180,6280,12140 + 6540,12180,6800,12160 + 6380,12180,6540,12180 + 5900,12200,6120,12180 + 5620,12180,5900,12200 + 5340,12120,5620,12180 + 5140,12100,5340,12120 + 4980,12120,5140,12100 + 4840,12120,4980,12120 + 4700,12200,4840,12120 + 4700,12380,4700,12200 + 4740,12480,4940,12520 + 4700,12380,4740,12480 + 4940,12520,5160,12560 + 5160,12560,5340,12600 + 5340,12600,5400,12600 + 5400,12600,5500,12600 + 5500,12600,5620,12600 + 5620,12600,5720,12560 + 5720,12560,5800,12440 + 5800,12440,5900,12380 + 5900,12380,6120,12420 + 6120,12420,6380,12440 + 6380,12440,6600,12460 + 6720,12460,6840,12520 + 6840,12520,6960,12520 + 6600,12460,6720,12460 + 6960,12520,7040,12500 + 7040,12500,7140,12440 + 7200,12440,7360,12500 + 7360,12500,7600,12560 + 7600,12560,7860,12600 + 7860,12600,8060,12500 + 8100,12500,8200,12340 + 8200,12340,8360,12360 + 8360,12360,8560,12400 + 8560,12400,8660,12420 + 8660,12420,8840,12400 + 8840,12400,9000,12360 + 9000,12360,9000,12360 + 2900,4400,2900,4280 + 900,7320,1000,7220 + 2640,13040,2900,12920 + 2900,12920,3160,12840 + 3480,12760,3780,12620 + 3780,12620,4020,12460 + 4300,12360,4440,12260 + 4020,12460,4300,12360 + 3160,12840,3480,12760 + 4440,12080,4440,12260 + 4440,12080,4440,11880 + 4440,11880,4440,11720 + 4440,11720,4600,11720 + 4600,11720,4760,11740 + 4760,11740,4980,11760 + 4980,11760,5160,11760 + 5160,11760,5340,11780 + 6000,11860,6120,11820 + 5340,11780,5620,11820 + 5620,11820,6000,11860 + 6120,11820,6360,11820 + 6360,11820,6640,11860 + 6940,11920,7240,11940 + 7240,11940,7520,11960 + 7520,11960,7860,11960 + 7860,11960,8100,11920 + 8100,11920,8420,11940 + 8420,11940,8460,11960 + 8460,11960,8500,11860 + 8460,11760,8500,11860 + 8320,11720,8460,11760 + 8160,11720,8320,11720 + 7940,11720,8160,11720 + 7720,11700,7940,11720 + 7520,11680,7720,11700 + 7320,11680,7520,11680 + 7200,11620,7320,11680 + 7200,11620,7200,11500 + 7200,11500,7280,11440 + 7280,11440,7420,11440 + 7420,11440,7600,11440 + 7600,11440,7980,11460 + 7980,11460,8160,11460 + 8160,11460,8360,11460 + 8360,11460,8460,11400 + 8420,11060,8500,11200 + 8280,11040,8420,11060 + 8100,11060,8280,11040 + 8460,11400,8500,11200 + 7800,11060,8100,11060 + 7520,11060,7800,11060 + 7240,11060,7520,11060 + 6940,11040,7240,11060 + 6640,11000,6940,11040 + 6420,10980,6640,11000 + 6360,11060,6420,10980 + 6360,11180,6360,11060 + 6200,11280,6360,11180 + 5960,11300,6200,11280 + 5720,11280,5960,11300 + 5500,11280,5720,11280 + 4940,11300,5200,11280 + 4660,11260,4940,11300 + 4440,11280,4660,11260 + 4260,11280,4440,11280 + 4220,11220,4260,11280 + 4080,11280,4220,11220 + 3980,11420,4080,11280 + 3980,11420,4040,11620 + 4040,11620,4040,11820 + 3980,11960,4040,11820 + 3840,12000,3980,11960 + 3720,11940,3840,12000 + 3680,11800,3720,11940 + 3680,11580,3680,11800 + 3680,11360,3680,11580 + 3680,11360,3680,11260 + 3680,11080,3680,11260 + 3680,11080,3680,10880 + 3680,10700,3680,10880 + 3680,10700,3680,10620 + 3680,10480,3680,10620 + 3680,10480,3680,10300 + 3680,10300,3680,10100 + 3680,10100,3680,9940 + 3680,9940,3720,9860 + 3720,9860,3920,9900 + 3920,9900,4220,9880 + 4980,9940,5340,9960 + 4220,9880,4540,9900 + 4540,9900,4980,9940 + 5340,9960,5620,9960 + 5620,9960,5900,9960 + 5900,9960,6160,10000 + 6160,10000,6480,10000 + 6480,10000,6720,10000 + 6720,10000,6880,9860 + 6880,9860,6880,9520 + 6880,9520,6940,9340 + 6940,9120,6940,9340 + 6940,9120,6940,8920 + 6940,8700,6940,8920 + 6880,8500,6940,8700 + 6880,8320,6880,8500 + 7140,8320,7140,8180 + 6760,8260,6880,8320 + 6540,8240,6760,8260 + 6420,8180,6540,8240 + 6280,8240,6420,8180 + 6160,8300,6280,8240 + 6120,8400,6160,8300 + 6080,8520,6120,8400 + 5840,8480,6080,8520 + 5620,8500,5840,8480 + 5500,8500,5620,8500 + 5340,8560,5500,8500 + 5160,8540,5340,8560 + 4620,8520,4880,8520 + 4360,8480,4620,8520 + 4880,8520,5160,8540 + 4140,8440,4360,8480 + 3920,8460,4140,8440 + 3720,8380,3920,8460 + 3680,8160,3720,8380 + 3680,8160,3720,7940 + 3720,7720,3720,7940 + 3680,7580,3720,7720 + 3680,7580,3720,7440 + 3720,7440,3720,7300 + 3720,7160,3720,7300 + 3720,7160,3720,7020 + 3720,7020,3780,6900 + 3780,6900,4080,6940 + 4080,6940,4340,6980 + 4340,6980,4600,6980 + 4600,6980,4880,6980 + 4880,6980,5160,6980 + 5160,6980,5400,7000 + 5400,7000,5560,7020 + 5560,7020,5660,7080 + 5660,7080,5660,7280 + 5660,7280,5660,7440 + 5660,7440,5740,7520 + 5740,7520,5740,7600 + 5740,7600,5900,7600 + 5900,7600,6040,7540 + 6040,7540,6040,7320 + 6040,7320,6120,7200 + 6120,7200,6120,7040 + 6120,7040,6240,7000 + 6240,7000,6480,7060 + 6480,7060,6800,7060 + 6800,7060,7080,7080 + 7080,7080,7320,7100 + 7940,7100,7980,6920 + 7860,6860,7980,6920 + 7640,6860,7860,6860 + 7400,6840,7640,6860 + 7320,7100,7560,7120 + 7560,7120,7760,7120 + 7760,7120,7940,7100 + 7200,6820,7400,6840 + 7040,6820,7200,6820 + 6600,6840,6840,6840 + 6380,6800,6600,6840 + 6120,6800,6380,6800 + 5900,6840,6120,6800 + 5620,6820,5900,6840 + 5400,6800,5620,6820 + 5140,6800,5400,6800 + 4880,6780,5140,6800 + 4600,6760,4880,6780 + 4340,6760,4600,6760 + 4080,6760,4340,6760 + 3840,6740,4080,6760 + 3680,6720,3840,6740 + 3680,6720,3680,6560 + 3680,6560,3720,6400 + 3720,6400,3720,6200 + 3720,6200,3780,6000 + 3720,5780,3780,6000 + 3720,5580,3720,5780 + 3720,5360,3720,5580 + 3720,5360,3840,5240 + 3840,5240,4200,5260 + 4200,5260,4600,5280 + 4600,5280,4880,5280 + 4880,5280,5140,5200 + 5140,5200,5220,5100 + 5220,5100,5280,4900 + 5280,4900,5340,4840 + 5340,4840,5720,4880 + 6120,4880,6480,4860 + 6880,4840,7200,4860 + 6480,4860,6880,4840 + 7200,4860,7320,4860 + 7320,4860,7360,4740 + 7360,4600,7440,4520 + 7360,4600,7360,4740 + 7440,4520,7640,4520 + 7640,4520,7800,4480 + 7800,4480,7800,4280 + 7800,4280,7800,4040 + 7800,4040,7800,3780 + 7800,3560,7800,3780 + 7800,3560,7860,3440 + 7860,3440,8060,3460 + 8060,3460,8160,3340 + 8160,3340,8160,3140 + 8160,3140,8160,2960 + 8000,2900,8160,2960 + 7860,2900,8000,2900 + 7640,2940,7860,2900 + 7400,2980,7640,2940 + 7100,2980,7400,2980 + 6840,3000,7100,2980 + 5620,2980,5840,2980 + 5840,2980,6500,3000 + 6500,3000,6840,3000 + 5560,2780,5620,2980 + 5560,2780,5560,2580 + 5560,2580,5560,2380 + 5560,2140,5560,2380 + 5560,2140,5560,1900 + 5560,1900,5620,1660 + 5620,1660,5660,1460 + 5660,1460,5660,1300 + 5500,1260,5660,1300 + 5340,1260,5500,1260 + 4600,1220,4840,1240 + 4440,1220,4600,1220 + 4440,1080,4440,1220 + 4440,1080,4600,1020 + 5080,1260,5340,1260 + 4840,1240,5080,1260 + 4600,1020,4940,1020 + 4940,1020,5220,1020 + 5220,1020,5560,960 + 5560,960,5660,860 + 5660,740,5660,860 + 5280,740,5660,740 + 4940,780,5280,740 + 4660,760,4940,780 + 4500,700,4660,760 + 4500,520,4500,700 + 4500,520,4700,460 + 4700,460,5080,440 + 5440,420,5740,420 + 5080,440,5440,420 + 5740,420,5840,360 + 5800,280,5840,360 + 5560,280,5800,280 + 4980,300,5280,320 + 4360,320,4660,300 + 4200,360,4360,320 + 5280,320,5560,280 + 4660,300,4980,300 + 4140,480,4200,360 + 4140,480,4140,640 + 4140,640,4200,780 + 4200,780,4200,980 + 4200,980,4220,1180 + 4220,1400,4220,1180 + 4220,1400,4260,1540 + 4260,1540,4500,1540 + 4500,1540,4700,1520 + 4700,1520,4980,1540 + 5280,1560,5400,1560 + 4980,1540,5280,1560 + 5400,1560,5400,1700 + 5400,1780,5400,1700 + 5340,1900,5400,1780 + 5340,2020,5340,1900 + 5340,2220,5340,2020 + 5340,2220,5340,2420 + 5340,2420,5340,2520 + 5080,2600,5220,2580 + 5220,2580,5340,2520 + 4900,2580,5080,2600 + 4700,2540,4900,2580 + 4500,2540,4700,2540 + 4220,2580,4340,2540 + 4200,2700,4220,2580 + 4340,2540,4500,2540 + 3980,2740,4200,2700 + 3840,2740,3980,2740 + 3780,2640,3840,2740 + 3780,2640,3780,2460 + 3780,2280,3780,2460 + 3620,2020,3780,2100 + 3780,2280,3780,2100 + 3360,2040,3620,2020 + 3080,2040,3360,2040 + 2840,2020,3080,2040 + 2740,1940,2840,2020 + 2740,1940,2800,1800 + 2800,1640,2800,1800 + 2800,1640,2800,1460 + 2800,1300,2800,1460 + 2700,1180,2800,1300 + 2480,1140,2700,1180 + 1580,1200,1720,1200 + 2240,1180,2480,1140 + 1960,1180,2240,1180 + 1720,1200,1960,1180 + 1500,1320,1580,1200 + 1500,1440,1500,1320 + 1500,1440,1760,1480 + 1760,1480,1940,1480 + 1940,1480,2140,1500 + 2140,1500,2320,1520 + 2400,1560,2400,1700 + 2280,1820,2380,1780 + 2320,1520,2400,1560 + 2380,1780,2400,1700 + 2080,1840,2280,1820 + 1720,1820,2080,1840 + 1420,1800,1720,1820 + 1280,1800,1420,1800 + 1240,1720,1280,1800 + 1240,1720,1240,1600 + 1240,1600,1280,1480 + 1280,1340,1280,1480 + 1180,1280,1280,1340 + 1000,1280,1180,1280 + 760,1280,1000,1280 + 360,1240,540,1260 + 180,1220,360,1240 + 540,1260,760,1280 + 180,1080,180,1220 + 180,1080,180,1000 + 180,1000,360,940 + 360,940,540,960 + 540,960,820,980 + 1100,980,1200,920 + 820,980,1100,980 + 6640,11860,6940,11920 + 5200,11280,5500,11280 + 4120,7330,4120,7230 + 4120,7230,4660,7250 + 4660,7250,4940,7250 + 4940,7250,5050,7340 + 5010,7400,5050,7340 + 4680,7380,5010,7400 + 4380,7370,4680,7380 + 4120,7330,4360,7370 + 4120,7670,4120,7760 + 4120,7670,4280,7650 + 4280,7650,4540,7660 + 4550,7660,4820,7680 + 4820,7680,4900,7730 + 4880,7800,4900,7730 + 4620,7820,4880,7800 + 4360,7790,4620,7820 + 4120,7760,4360,7790 + 6840,6840,7040,6820 + 5720,4880,6120,4880 + 1200,920,1340,810 + 1340,810,1520,790 + 1520,790,1770,800 + 2400,790,2600,750 + 2600,750,2640,520 + 2520,470,2640,520 + 2140,470,2520,470 + 1760,800,2090,800 + 2080,800,2400,790 + 1760,450,2140,470 + 1420,450,1760,450 + 1180,440,1420,450 + 900,480,1180,440 + 640,450,900,480 + 360,440,620,450 + 120,430,360,440 + 0,520,120,430 + -20,780,0,520 + -20,780,-20,1020 + -20,1020,-20,1150 + -20,1150,0,1300 + 0,1470,60,1530 + 0,1300,0,1470 + 60,1530,360,1530 + 360,1530,660,1520 + 660,1520,980,1520 + 980,1520,1040,1520 + 1040,1520,1070,1560 + 1070,1770,1070,1560 + 1070,1770,1100,2010 + 1070,2230,1100,2010 + 1070,2240,1180,2340 + 1180,2340,1580,2340 + 1580,2340,1940,2350 + 1940,2350,2440,2350 + 2440,2350,2560,2380 + 2560,2380,2600,2540 + 2810,2640,3140,2680 + 2600,2540,2810,2640 + 3140,2680,3230,2780 + 3230,2780,3260,2970 + 3230,3220,3260,2970 + 3200,3470,3230,3220 + 3200,3480,3210,3760 + 3210,3760,3210,4040 + 3200,4040,3230,4310 + 3210,4530,3230,4310 + 3210,4530,3230,4730 + 3230,4960,3230,4730 + 3230,4960,3260,5190 + 3170,5330,3260,5190 + 2920,5330,3170,5330 + 2660,5360,2920,5330 + 2420,5330,2660,5360 + 2200,5280,2400,5330 + 2020,5280,2200,5280 + 1840,5260,2020,5280 + 1660,5280,1840,5260 + 1500,5300,1660,5280 + 1360,5270,1500,5300 + 1200,5290,1340,5270 + 1070,5400,1200,5290 + 1040,5630,1070,5400 + 1000,5900,1040,5630 + 980,6170,1000,5900 + 980,6280,980,6170 + 980,6540,980,6280 + 980,6540,1040,6720 + 1040,6720,1360,6730 + 1360,6730,1760,6710 + 2110,6720,2420,6730 + 1760,6710,2110,6720 + 2420,6730,2640,6720 + 2640,6720,2970,6720 + 2970,6720,3160,6700 + 3160,6700,3240,6710 + 3240,6710,3260,6890 + 3260,7020,3260,6890 + 3230,7180,3260,7020 + 3230,7350,3230,7180 + 3210,7510,3230,7350 + 3210,7510,3210,7690 + 3210,7870,3210,7690 + 3210,7870,3210,7980 + 3200,8120,3210,7980 + 3200,8330,3200,8120 + 3160,8520,3200,8330 + 2460,11100,2480,11020 + 2200,11180,2460,11100 + 1260,11350,1600,11320 + 600,11430,930,11400 + 180,11340,620,11430 + 1600,11320,1910,11280 + 1910,11280,2200,11180 + 923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157 +#+end_src + +* Platformer - The Little Probe - Data - level_lava.txt +#+begin_src ruby + # ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt + 100,10740,500,10780 + 500,10780,960,10760 + 960,10760,1340,10760 + 1380,10760,1820,10780 + 1820,10780,2240,10780 + 2280,10780,2740,10740 + 2740,10740,3000,10780 + 3000,10780,3140,11020 + -520,8820,-480,9160 + -520,8480,-520,8820 + -520,8480,-480,8180 + -480,8180,-200,8120 + -200,8120,100,8220 + 100,8220,420,8240 + 420,8240,760,8260 + 760,8260,1140,8280 + 1140,8280,1500,8200 + 1500,8200,1880,8240 + 1880,8240,2240,8260 + 2240,8260,2320,8480 + 2320,8480,2380,8680 + 2240,8860,2380,8680 + 2240,9080,2240,8860 + 2240,9080,2320,9260 + 2320,9260,2480,9440 + 2480,9440,2600,9640 + 2480,9840,2600,9640 + 2400,10020,2480,9840 + 2240,10080,2400,10020 + 1960,10080,2240,10080 + 1720,10080,1960,10080 + 1460,10080,1720,10080 + 1180,10080,1420,10080 + 900,10080,1180,10080 + 640,10080,900,10080 + 640,10080,640,9900 + 60,10520,100,10740 + 40,10240,60,10520 + 40,10240,40,9960 + 40,9960,40,9680 + 40,9680,40,9360 + 40,9360,60,9080 + 60,9080,100,8860 + 100,8860,460,9040 + 460,9040,760,9220 + 760,9220,1140,9220 + 1140,9220,1720,9200 + -660,11580,-600,11420 + -660,11800,-660,11580 + -660,12000,-660,11800 + -660,12000,-600,12220 + -600,12220,-600,12440 + -600,12440,-600,12640 + -600,11240,-260,11280 + -260,11280,100,11240 + 9000,12360,9020,12400 + 9020,12620,9020,12400 + 9020,12840,9020,12620 + 9020,13060,9020,12840 + 9020,13060,9020,13240 + 9020,13240,9020,13420 + 9020,13420,9020,13600 + 9020,13600,9020,13780 + 8880,13900,9020,13780 + 8560,13800,8880,13900 + 8220,13780,8560,13800 + 7860,13760,8220,13780 + 7640,13780,7860,13760 + 7360,13800,7640,13780 + 7100,13800,7360,13800 + 6540,13760,6800,13780 + 6800,13780,7100,13800 + 6280,13760,6540,13760 + 5760,13760,6280,13760 + 5220,13780,5760,13760 + 4700,13760,5220,13780 + 4200,13740,4700,13760 + 3680,13720,4200,13740 + 3140,13700,3680,13720 + 2600,13680,3140,13700 + 2040,13940,2600,13680 + 1640,13940,2040,13940 + 1200,13960,1640,13940 + 840,14000,1200,13960 + 300,13960,840,14000 + -200,13900,300,13960 + -600,12840,-600,12640 + -600,13140,-600,12840 + -600,13140,-600,13420 + -600,13700,-600,13420 + -600,13700,-600,13820 + -600,13820,-200,13900 + -600,11240,-560,11000 + -560,11000,-480,10840 + -520,10660,-480,10840 + -520,10660,-520,10480 + -520,10480,-520,10300 + -520,10260,-480,10080 + -480,9880,-440,10060 + -520,9680,-480,9880 + -520,9680,-480,9400 + -480,9400,-480,9160 + 1820,9880,2140,9800 + 1540,9880,1820,9880 + 1200,9920,1500,9880 + 900,9880,1200,9920 + 640,9900,840,9880 + 2380,8760,2800,8760 + 2800,8760,2840,8660 + 2840,8660,2840,8420 + 2840,8160,2840,8420 + 2800,7900,2840,8160 + 2800,7900,2800,7720 + 2800,7540,2800,7720 + 2800,7540,2800,7360 + 2700,7220,2800,7360 + 2400,7220,2700,7220 + 2080,7240,2400,7220 + 1760,7320,2080,7240 + 1380,7360,1720,7320 + 1040,7400,1340,7360 + 640,7400,1000,7420 + 300,7380,640,7400 + 0,7300,240,7380 + -300,7180,-60,7300 + -380,6860,-360,7180 + -380,6880,-360,6700 + -360,6700,-260,6540 + -260,6540,0,6520 + 0,6520,240,6640 + 240,6640,460,6640 + 460,6640,500,6480 + 500,6260,500,6480 + 460,6060,500,6260 + 460,5860,460,6060 + 460,5860,500,5640 + 500,5640,540,5440 + 540,5440,580,5220 + 580,5220,580,5000 + 580,4960,580,4740 + 580,4740,960,4700 + 960,4700,1140,4760 + 1140,4760,1420,4740 + 1420,4740,1720,4700 + 1720,4700,2000,4740 + 2000,4740,2380,4760 + 2380,4760,2700,4800 + 1720,4600,1760,4300 + 1760,4300,2200,4340 + 2200,4340,2560,4340 + 2560,4340,2740,4340 + 2160,12580,2440,12400 + 1820,12840,2160,12580 + 1500,13080,1820,12840 + 1140,13340,1500,13080 + 1140,13340,1580,13220 + 2110,13080,2520,13000 + 2520,13000,2900,12800 + 1580,13220,2110,13080 + 2900,12800,3200,12680 + 3200,12680,3440,12640 + 3440,12640,3720,12460 + 3720,12460,4040,12320 + 4040,12320,4360,12200 + 4360,11940,4380,12180 + 4360,11700,4360,11940 + 4360,11700,4540,11500 + 4540,11500,4880,11540 + 6000,11660,6280,11640 + 5440,11600,5720,11610 + 5720,11610,6000,11660 + 6280,11640,6760,11720 + 6760,11720,7060,11780 + 7060,11780,7360,11810 + 7360,11810,7640,11840 + 7640,11840,8000,11830 + 8000,11830,8320,11850 + 8320,11850,8390,11800 + 8330,11760,8390,11800 + 8160,11760,8330,11760 + 7910,11750,8160,11760 + 7660,11740,7900,11750 + 7400,11730,7660,11740 + 7160,11680,7400,11730 + 7080,11570,7160,11680 + 7080,11570,7100,11350 + 7100,11350,7440,11280 + 7440,11280,7940,11280 + 7960,11280,8360,11280 + 5840,11540,6650,11170 + 4880,11540,5440,11600 + 3410,11830,3420,11300 + 3410,11260,3520,10920 + 3520,10590,3520,10920 + 3520,10590,3540,10260 + 3520,9900,3540,10240 + 3520,9900,3640,9590 + 3640,9570,4120,9590 + 4140,9590,4600,9680 + 4620,9680,5030,9730 + 5120,9750,5520,9800 + 5620,9820,6080,9800 + 6130,9810,6580,9820 + 6640,9820,6800,9700 + 6780,9400,6800,9700 + 6780,9400,6840,9140 + 6820,8860,6840,9120 + 6780,8600,6820,8830 + 6720,8350,6780,8570 + 6480,8340,6720,8320 + 6260,8400,6480,8340 + 6050,8580,6240,8400 + 5760,8630,6040,8590 + 5520,8690,5740,8630 + 5120,8690,5450,8700 + 4570,8670,5080,8690 + 4020,8610,4540,8670 + 3540,8480,4020,8610 + 3520,8230,3520,8480 + 3520,7930,3520,8230 + 3520,7930,3540,7630 + 3480,7320,3540,7610 + 3480,7280,3500,7010 + 3500,6980,3680,6850 + 3680,6850,4220,6840 + 4230,6840,4760,6850 + 4780,6850,5310,6860 + 5310,6860,5720,6940 + 5720,6940,5880,7250 + 5880,7250,5900,7520 + 100,11240,440,11300 + 440,11300,760,11330 + 1480,11280,1840,11230 + 2200,11130,2360,11090 + 1840,11230,2200,11130 +#+end_src + +* Rpg Narrative - Choose Your Own Adventure - decision.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb + # Hey there! Welcome to Four Decisions. Here is how you + # create your decision tree. Remove =being and =end from the text to + # enable the game (just save the file). Change stuff and see what happens! + + def game + { + starting_decision: :stormy_night, + decisions: { + stormy_night: { + description: 'It was a dark and stormy night. (storyline located in decision.rb)', + option_one: { + description: 'Go to sleep.', + decision: :nap + }, + option_two: { + description: 'Watch a movie.', + decision: :movie + }, + option_three: { + description: 'Go outside.', + decision: :go_outside + }, + option_four: { + description: 'Get a snack.', + decision: :get_a_snack + } + }, + nap: { + description: 'You took a nap. The end.', + option_one: { + description: 'Start over.', + decision: :stormy_night + } + } + } + } + end + +#+end_src + +* Rpg Narrative - Choose Your Own Adventure - main.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb + =begin + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The values can be found + using their keys. + + In this sample app, the decisions needed for the game are stored in a hash. In fact, the + decision.rb file contains hashes inside of other hashes! + + Each option is a key in the first hash, but also contains a hash (description and + decision being its keys) as its value. + Go into the decision.rb file and take a look before diving into the code below. + + - 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.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. + For more information about the keyboard, go to mygame/documentation/06-keyboard.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. + + =end + + # This sample app provides users with a story and multiple decisions that they can choose to make. + # Users can make a decision using their keyboard, and the story will move forward based on user choices. + + # The decisions available to users are stored in the decision.rb file. + # We must have access to it for the game to function properly. + GAME_FILE = 'app/decision.rb' # found in app folder + + require GAME_FILE # require used to load another file, import class/method definitions + + # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. + # Otherwise, the game is run. + def tick args + if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method + args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown + args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] + elsif respond_to?(:game) # otherwise, if responds to game + args.state.loaded = true + tick_game args # calls tick_game method, runs game + end + + if args.state.tick_count.mod_zero? 60 # update every 60 frames + t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file + if t != args.state.mtime + args.state.mtime = t + require GAME_FILE # require used to load file + args.state.game_definition = nil # game definition and decision are empty + args.state.decision_id = nil + end + end + end + + # Runs methods needed for game to function properly + # Creates a rectangular border around the screen + def tick_game args + defaults args + args.borders << args.grid.rect + render_decision args + process_inputs args + end + + # Sets default values and uses decision.rb file to define game and decision_id + # variable using the starting decision + def defaults args + args.state.game_definition ||= game + args.state.decision_id ||= args.state.game_definition[:starting_decision] + end + + # Outputs the possible decision descriptions the user can choose onto the screen + # as well as what key to press on their keyboard to make their decision + def render_decision args + decision = current_decision args + # text is either the value of decision's description key or warning that no description exists + args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation + + # All decisions are stored in a hash + # The descriptions output onto the screen are the values for the description keys of the hash. + if decision[:option_one] + args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label + args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision + end + + if decision[:option_two] + args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description + args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] + end + + if decision[:option_three] + args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description + args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] + end + + if decision[:option_four] + args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description + args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] + end + end + + # Uses keyboard input from the user to make a decision + # Assigns the decision as the value of the decision_id variable + def process_inputs args + decision = current_decision args # calls current_decision method + + if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists + args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id + end + + if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists + args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id + end + + if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists + args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id + end + + if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists + args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id + end + end + + # Uses decision_id's value to keep track of current decision being made + def current_decision args + args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty + end + + # Resets the game. + $gtk.reset + +#+end_src + +* Rpg Narrative - Return Of Serenity - lowrez_simulator.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb + ################################################################################### + # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES + # THE 64x64 CANVAS. + ################################################################################### + + TINY_RESOLUTION = 64 + TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) + CENTER_OFFSET = 10 + EMULATED_FONT_SIZE = 20 + EMULATED_FONT_X_ZERO = 0 + EMULATED_FONT_Y_ZERO = 46 + + def tick args + sprites = [] + labels = [] + borders = [] + solids = [] + mouse = emulate_lowrez_mouse args + args.state.show_gridlines = false + lowrez_tick args, sprites, labels, borders, solids, mouse + render_gridlines_if_needed args + render_mouse_crosshairs args, mouse + emulate_lowrez_scene args, sprites, labels, borders, solids, mouse + end + + def emulate_lowrez_mouse args + args.state.new_entity_strict(:lowrez_mouse) do |m| + 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 + m.click = [ + 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 + else + m.click = nil + m.down = nil + end + + if args.mouse.up + m.up = [ + 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 + end + end + end + + def render_mouse_crosshairs args, mouse + return unless args.state.show_gridlines + args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] + end + + def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse + args.render_target(:lowrez).solids << [0, 0, 1280, 720] + args.render_target(:lowrez).sprites << sprites + args.render_target(:lowrez).borders << borders + args.render_target(:lowrez).solids << solids + args.outputs.primitives << labels.map do |l| + as_label = l.label + l.text.each_char.each_with_index.map do |char, i| + [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, 'fonts/dragonruby-gtk-4x4.ttf'].label + end + end + + args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] + end + + def render_gridlines_if_needed args + if args.state.show_gridlines && args.static_lines.length == 0 + args.static_lines << 65.times.map do |i| + [ + [CENTER_OFFSET + i * TINY_SCALE + 1, 0, + CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], + [CENTER_OFFSET + i * TINY_SCALE, 0, + CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], + [CENTER_OFFSET, 0 + i * TINY_SCALE, + CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], + [CENTER_OFFSET, 1 + i * TINY_SCALE, + CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] + ] + end + elsif !args.state.show_gridlines + args.static_lines.clear + end + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - main.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb + require 'app/require.rb' + + def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.last_story_line_text ||= "" + args.state.scene_history ||= [] + args.state.storyline_history ||= [] + args.state.word_delay ||= 8 + if args.state.tick_count == 0 + args.gtk.stop_music + args.outputs.sounds << 'sounds/static-loop.ogg' + end + + if args.state.last_story_line_text + lines = args.state + .last_story_line_text + .gsub("-", "") + .gsub("~", "") + .wrapped_lines(50) + + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } + elsif args.state.storyline_history[-1] + lines = args.state + .storyline_history[-1] + .gsub("-", "") + .gsub("~", "") + .wrapped_lines(50) + + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } + end + + return if args.state.current_scene + set_scene(args, day_one_beginning(args)) + end + + def inputs_move_player args + if args.state.scene_changed_at.elapsed_time > 5 + if args.keyboard.down || args.keyboard.s || args.keyboard.j + args.state.player.y -= 0.25 + elsif args.keyboard.up || args.keyboard.w || args.keyboard.k + args.state.player.y += 0.25 + end + + if args.keyboard.left || args.keyboard.a || args.keyboard.h + args.state.player.x -= 0.25 + elsif args.keyboard.right || args.keyboard.d || args.keyboard.l + args.state.player.x += 0.25 + end + + args.state.player.y = 60 if args.state.player.y > 63 + args.state.player.y = 0 if args.state.player.y < -3 + args.state.player.x = 60 if args.state.player.x > 63 + args.state.player.x = 0 if args.state.player.x < -3 + end + end + + def null_or_empty? ary + return true unless ary + return true if ary.length == 0 + return false + end + + def calc_storyline_hotspot args + hotspots = args.state.storylines.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot + _, _, _, _, storyline = hotspots.first + queue_storyline_text(args, storyline) + args.state.inside_storyline_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_storyline_hotspot = false + + args.state.storyline_queue_empty_at ||= args.state.tick_count + args.state.is_storyline_dialog_active = false + args.state.scene_storyline_queue.clear + end + end + + def calc_scenes args + hotspots = args.state.scenes.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot + _, _, _, _, scene_method_or_hash = hotspots.first + if scene_method_or_hash.is_a? Symbol + set_scene(args, send(scene_method_or_hash, args)) + args.state.last_hotspot_scene = scene_method_or_hash + args.state.scene_history << scene_method_or_hash + else + set_scene(args, scene_method_or_hash) + end + args.state.inside_scene_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_scene_hotspot = false + end + end + + def null_or_whitespace? word + return true if !word + return true if word.strip.length == 0 + return false + end + + def calc_storyline_presentation args + return unless args.state.tick_count > args.state.next_storyline + return unless args.state.scene_storyline_queue + next_storyline = args.state.scene_storyline_queue.shift + if null_or_whitespace? next_storyline + args.state.storyline_queue_empty_at ||= args.state.tick_count + args.state.is_storyline_dialog_active = false + return + end + args.state.storyline_to_show = next_storyline + args.state.is_storyline_dialog_active = true + args.state.storyline_queue_empty_at = nil + if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") + args.state.next_storyline += 60 + elsif next_storyline.end_with?(",") + args.state.next_storyline += 50 + elsif next_storyline.end_with?(":") + args.state.next_storyline += 60 + else + default_word_delay = 13 + args.state.word_delay - 8 + if next_storyline.gsub("-", "").gsub("~", "").length <= 4 + default_word_delay = 11 + args.state.word_delay - 8 + end + number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length + args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) + end + end + + def inputs_reload_current_scene args + return + if args.inputs.keyboard.key_down.r! + reload_current_scene + end + end + + def inputs_dismiss_current_storyline args + if args.inputs.keyboard.key_down.x! + args.state.scene_storyline_queue.clear + end + end + + def inputs_restart_game args + if args.inputs.keyboard.exclamation_point + args.gtk.reset_state + end + end + + def inputs_change_word_delay args + if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign + args.state.word_delay -= 2 + if args.state.word_delay < 0 + args.state.word_delay = 0 + # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" + else + # queue_storyline_text args, "Text speed INCREASED." + end + end + + if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore + args.state.word_delay += 2 + # queue_storyline_text args, "Text speed DECREASED." + end + end + + def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil + texts.each_with_index.map do |t, i| + [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] + end + end + + def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse + # args.state.show_gridlines = true + defaults args + render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + render_controller args, lowrez_borders + lowrez_solids << [0, 0, 64, 64, 0, 0, 0] + calc_storyline_presentation args + calc_scenes args + calc_storyline_hotspot args + inputs_move_player args + inputs_print_mouse_rect args, lowrez_mouse + inputs_reload_current_scene args + inputs_dismiss_current_storyline args + inputs_change_word_delay args + inputs_restart_game args + end + + def render_controller args, lowrez_borders + args.state.up_button = [85, 40, 15, 15, 255, 255, 255] + args.state.down_button = [85, 20, 15, 15, 255, 255, 255] + args.state.left_button = [65, 20, 15, 15, 255, 255, 255] + args.state.right_button = [105, 20, 15, 15, 255, 255, 255] + lowrez_borders << args.state.up_button + lowrez_borders << args.state.down_button + lowrez_borders << args.state.left_button + lowrez_borders << args.state.right_button + end + + def inputs_print_mouse_rect args, lowrez_mouse + if lowrez_mouse.up + args.state.mouse_held = false + elsif lowrez_mouse.click + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] + if args.state.up_button.intersect_rect? mouse_rect + args.state.player.y += 1 + end + + if args.state.down_button.intersect_rect? mouse_rect + args.state.player.y -= 1 + end + + if args.state.left_button.intersect_rect? mouse_rect + args.state.player.x -= 1 + end + + if args.state.right_button.intersect_rect? mouse_rect + args.state.player.x += 1 + end + args.state.mouse_held = true + elsif args.state.mouse_held + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] + if args.state.up_button.intersect_rect? mouse_rect + args.state.player.y += 0.25 + end + + if args.state.down_button.intersect_rect? mouse_rect + args.state.player.y -= 0.25 + end + + if args.state.left_button.intersect_rect? mouse_rect + args.state.player.x -= 0.25 + end + + if args.state.right_button.intersect_rect? mouse_rect + args.state.player.x += 0.25 + end + end + + if lowrez_mouse.click + dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x + dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y + x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy + puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}" + if args.state.previous_mouse_click + + if dx < 0 && dx < 0 + x = x + w + w = w.abs + y = y + h + h = h.abs + end + + w += 1 + h += 1 + + args.state.previous_mouse_click = nil + else + args.state.previous_mouse_click = lowrez_mouse.click + square_x, square_y = lowrez_mouse.click + end + end + end + + def try_centering! word + word ||= "" + just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") + return word if just_word.strip.length == 0 + return word if just_word.include? "~" + return "~#{word}" if just_word.length <= 2 + if just_word.length.mod_zero? 2 + center_index = just_word.length.idiv(2) - 1 + else + center_index = (just_word.length - 1).idiv(2) + end + return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" + end + + def queue_storyline args, scene + queue_storyline_text args, scene[:storyline] + end + + def queue_storyline_text args, text + args.state.last_story_line_text = text + args.state.storyline_history << text if text + words = (text || "").split(" ") + words = words.map { |w| try_centering! w } + args.state.scene_storyline_queue = words + if args.state.scene_storyline_queue.length != 0 + args.state.scene_storyline_queue.unshift "~$--" + args.state.storyline_to_show = "~." + else + args.state.storyline_to_show = "" + end + args.state.scene_storyline_queue << "" + args.state.next_storyline = args.state.tick_count + end + + def set_scene args, scene + args.state.current_scene = scene + args.state.background = scene[:background] || 'sprites/todo.png' + args.state.scene_fade = scene[:fade] || 0 + args.state.scenes = (scene[:scenes] || []).reject { |s| !s } + args.state.scene_render_override = scene[:render_override] + args.state.storylines = (scene[:storylines] || []).reject { |s| !s } + args.state.scene_changed_at = args.state.tick_count + if scene[:player] + args.state.player = scene[:player] + end + args.state.inside_scene_hotspot = false + args.state.inside_storyline_hotspot = false + queue_storyline args, scene + end + + def replay_storyline_rect + [26, -1, 7, 4] + end + + def labels_for_word word + left_side_of_word = "" + center_letter = "" + right_side_of_word = "" + + if word[0] == "~" + left_side_of_word = "" + center_letter = word[1] + right_side_of_word = word[2..-1] + elsif word.length > 0 + left_side_of_word, right_side_of_word = word.split("~") + center_letter = right_side_of_word[0] + right_side_of_word = right_side_of_word[1..-1] + end + + right_side_of_word = right_side_of_word.gsub("-", "") + + { + left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], + center: [29, 2, center_letter, 255, 0, 0], + right: [34, 2, right_side_of_word] + } + end + + def render_scenes args, lowrez_sprites + lowrez_sprites << args.state.scenes.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end + end + + def render_storylines args, lowrez_sprites + lowrez_sprites << args.state.storylines.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end + end + + def adornments_alpha args, target_alpha = nil, minimum_alpha = nil + return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at + target_alpha ||= 255 + target_alpha * args.state.storyline_queue_empty_at.ease(60) + end + + def hotspot_square args, x, y, w, h + if w >= 3 && h >= 3 + [ + [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], + [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], + [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], + ] + else + [ + [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], + ] + end + end + + def render_storyline_dialog args, lowrez_labels, lowrez_sprites + return unless args.state.is_storyline_dialog_active + return unless args.state.storyline_to_show + labels = labels_for_word args.state.storyline_to_show + if true # high rez version + scale = 8.88 + offset = 45 + size = 25 + args.outputs.labels << [offset + labels[:left].x.-(1) * scale, + labels[:left].y * TINY_SCALE + 55, + labels[:left].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + center_text = labels[:center].text + center_text = "|" if center_text == "$" + args.outputs.labels << [offset + labels[:center].x * scale, + labels[:center].y * TINY_SCALE + 55, + center_text, size, 0, 255, 0, 0, 255, + 'fonts/manaspc.ttf'] + args.outputs.labels << [offset + labels[:right].x * scale, + labels[:right].y * TINY_SCALE + 55, + labels[:right].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + else + lowrez_labels << labels[:left] + lowrez_labels << labels[:center] + lowrez_labels << labels[:right] + end + args.state.is_storyline_dialog_active = true + render_player args, lowrez_sprites + lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] + end + + def render_player args, lowrez_sprites + lowrez_sprites << player_md_down(args, *args.state.player) + end + + def render_adornments args, lowrez_sprites + render_scenes args, lowrez_sprites + render_storylines args, lowrez_sprites + return if args.state.is_storyline_dialog_active + lowrez_sprites << player_md_down(args, *args.state.player) + end + + def global_alpha_percentage args, max_alpha = 255 + return 255 unless args.state.scene_changed_at + return 255 unless args.state.scene_fade + return 255 unless args.state.scene_fade > 0 + return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) + end + + def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] + if args.state.scene_render_override + send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids + end + storyline_to_show = args.state.storyline_to_show || "" + render_adornments args, lowrez_sprites + render_storyline_dialog args, lowrez_labels, lowrez_sprites + + if args.state.background == 'sprites/tribute-game-over.png' + lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] + lowrez_labels << [9, 6, 'Return of', 255, 255, 255] + lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] + if !args.state.ended + args.gtk.stop_music + args.outputs.sounds << 'sounds/music-loop.ogg' + args.state.ended = true + end + end + end + + def player_md_right args, x, y + [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] + end + + def player_md_left args, x, y + [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] + end + + def player_md_up args, x, y + [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] + end + + def player_md_down args, x, y + [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] + end + + def player_sm args, x, y + [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] + end + + def player_xs args, x, y + [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - repl.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb + puts $gtk.args.state.current_scene + +#+end_src + +* Rpg Narrative - Return Of Serenity - require.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb + require 'app/lowrez_simulator.rb' + require 'app/storyline_day_one.rb' + require 'app/storyline_blinking_light.rb' + require 'app/storyline_serenity_introduction.rb' + require 'app/storyline_speed_of_light.rb' + require 'app/storyline_serenity_alive.rb' + require 'app/storyline_serenity_bio.rb' + require 'app/storyline_anka.rb' + require 'app/storyline_final_message.rb' + require 'app/storyline_final_decision.rb' + require 'app/storyline.rb' + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb + def hotspot_top + [4, 61, 56, 3] + end + + def hotspot_bottom + [4, 0, 56, 3] + end + + def hotspot_top_right + [62, 35, 3, 25] + end + + def hotspot_bottom_right + [62, 0, 3, 25] + end + + def storyline_history_include? args, text + args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } + end + + def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + end + + def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + end + + def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + end + + def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + end + + def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + end + + def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] + result_one_scene, result_one_label, result_one_text = context_result_one + result_two_scene, result_two_label, result_two_text = context_result_two + result_three_scene, result_three_label, result_three_text = context_result_three + result_four_scene, result_four_label, result_four_text = context_result_four + + top_level_hash = { + background: 'sprites/decision.png', + fade: 60, + player: [20, 36], + storylines: [ ], + scenes: [ ] + } + + confirmation_result_one_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_two_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_three_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_four_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] + top_level_hash[:storylines] << [20, 35, 4, 4, context_action] + + confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] + confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] + confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] + confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] + + confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] + confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] + confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] + confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] + confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] + confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] + confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash + end + + def ship_control_hotspot offset_x, offset_y, a, b, c, d + results = [] + results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a + results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b + results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c + results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d + results + end + + def reload_current_scene + if $gtk.args.state.last_hotspot_scene + set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) + tick $gtk.args + elsif respond_to? :set_scene + set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) + tick $gtk.args + end + $gtk.console.close + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_anka.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb + def anka_inside_room args + { + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], + ], + scenes: [ + [32, -1, 8, 3, :anka_observatory] + ] + } + end + + def anka_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :anka_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + + def anka_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + storylines: [ + [22, 45, 17, 4, (anka_last_reply args)], + [45, 45, 4, 4, (anka_current_reply args)], + ], + scenes: [ + [*hotspot_top_right, :reply_to_anka] + ] + } + end + + def reply_to_anka args + decision_graph anka_current_reply(args), + "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", + [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], + [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] + end + + def anka_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end + end + + def anka_reply_whole_truth + "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." + end + + def anka_reply_half_truth + "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." + end + + def replied_with_whole_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], + ] + } + end + + def replied_with_half_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], + ] + } + end + + def anka_current_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + else + return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + end + end + + def replied_to_anka_back_home args + if args.state.scene_history.include? :replied_with_whole_truth + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_sad], + ] + } + else + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_happy], + ] + } + end + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb + def the_blinking_light args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :blinking_light_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } + end + + def blinking_light_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :blinking_light_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } + end + + def blinking_light_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :blinking_light_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } + end + + def blinking_light_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :blinking_light_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } + end + + def blinking_light_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [ + [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] + ], + scenes: [ + [30, 18, 5, 12, :blinking_light_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + + def blinking_light_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [62, 32, 4, 32, :reply_to_introduction] + ], + storylines: [ + [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], + [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], + [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], + [14, 20, 24, 4, "What the heck activated--- this thing- though?"] + ] + } + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_day_one.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb + def day_one_beginning args + { + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [0, 0, 64, 2, :day_one_infront_of_home], + ], + storylines: [ + [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] + ] + } + end + + def day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [56, 23], + scenes: [ + [43, 34, 10, 16, :day_one_home], + [62, 0, 3, 40, :day_one_beginning], + [0, 4, 3, 20, :day_one_ceremony] + ], + storylines: [ + [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], + ] + } + end + + def day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [28, 0, 12, 2, :day_one_infront_of_home] + ], + storylines: [ + [ + 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." + ], + [ + 28, 7, 4, 7, + "Ahhh. My reading- couch. It's so comfortable--." + ], + [ + 38, 21, 4, 4, + "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." + ], + [ + 45, 37, 4, 8, + "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." + ], + [ + 32, 40, 8, 10, + "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." + ], + [ + 25, 21, 5, 12, + "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." + ] + ] + } + end + + def day_one_ceremony args + { + background: 'sprites/tribute.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_infront_of_home], + [0, 24, 2, 40, :day_one_infront_of_library] + ], + storylines: [ + [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], + [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], + [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], + [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], + ] + } + end + + def day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_ceremony], + [49, 39, 6, 9, :day_one_library] + ], + storylines: [ + [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] + ] + } + end + + def day_one_library args + { + background: 'sprites/library.png', + player: [27, 4], + scenes: [ + [0, 0, 64, 2, :end_day_one_infront_of_library] + ], + storylines: [ + [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], + [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] + ] + } + end + + def end_day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [51, 33], + scenes: [ + [49, 39, 6, 9, :day_one_library], + [62, 0, 2, 40, :end_day_one_monument], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."] + ] + } + end + + def end_day_one_monument args + { + background: 'sprites/tribute.png', + player: [2, 36], + scenes: [ + [62, 0, 2, 40, :end_day_one_infront_of_home], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."], + ] + } + end + + def end_day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [1, 17], + scenes: [ + [43, 34, 10, 16, :end_day_one_home], + ], + storylines: [ + [20, 10, 4, 4, "It's getting late. Better get some sleep."], + ] + } + end + + def end_day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [32, 40, 8, 10, :end_day_one_dream], + ], + storylines: [ + [38, 4, 4, 4, "It's getting late. Better get some sleep."], + ] + } + end + + def end_day_one_dream args + { + background: 'sprites/dream.png', + fade: 60, + player: [4, 4], + scenes: [ + [62, 0, 2, 64, :explaining_the_special_power] + ], + storylines: [ + [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], + [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], + [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] + ] + } + end + + def explaining_the_special_power args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [32, 30], + scenes: [ + [ + 38, 21, 4, 4, :explaining_the_special_power_inside_computer + ], + ] + } + end + + def explaining_the_special_power_inside_computer args + { + background: 'sprites/pc.png', + fade: 60, + player: [34, 4], + scenes: [ + [0, 62, 64, 3, :the_blinking_light] + ], + storylines: [ + [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], + [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], + [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], + [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] + ] + } + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_final_decision.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb + def final_decision_side_of_home args + { + fade: 120, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_decision_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render, + storylines: [ + [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] + ] + } + end + + def final_decision_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_decision_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } + end + + def final_decision_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_decision_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } + end + + def final_decision_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :final_decision_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } + end + + def final_decision_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :final_decision_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + + def final_decision_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + storylines: [], + scenes: [ + [*hotspot_top, :final_decision_ship_status], + ] + } + end + + def final_decision_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [*hotspot_top_right, :final_decision] + ], + storylines: [ + [30, 8, 4, 4, "????"], + *final_decision_ship_status_shared(args) + ] + } + end + + def final_decision args + decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", + "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", + [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], + [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], + [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], + [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] + end + + def final_decision_game_over_noone args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } + end + + def final_decision_game_over_matthew args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } + end + + def final_decision_game_over_anka args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } + end + + def final_decision_game_over_sasha args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } + end + + def final_decision_ship_status_shared args + [ + *ship_control_hotspot(24, 22, + "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", + "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), + ] + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_final_message.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb + def final_message_sad args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Another-- sleepless-- night..."], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } + end + + def final_message_happy args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Oh man, I slept like rock!"], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } + end + + def final_message_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_message_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } + end + + def final_message_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_message_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } + end + + def final_message_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_message_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } + end + + def final_message_observatory args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Here-- we- go..."] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + end + + def final_message_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] + } + end + + def final_message_check_ship_status args + { + background: 'sprites/mainframe.png', + storylines: [ + [45, 45, 4, 4, (final_message_current args)], + ], + scenes: [ + [*hotspot_top, :final_message_ship_status], + ] + } + end + + def final_message_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :final_message_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], + *final_message_ship_status_shared(args) + ] + } + end + + def final_message_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :final_message_summary] + ], + storylines: [ + [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], + ] + } + end + + def final_message_ship_status_shared args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", + "Matthew's--- Chamber--: OCCUPIED----", + "Aanka's--- Chamber--: OCCUPIED----", + "Sasha's--- Chamber--: OCCUPIED----"), + *ship_control_hotspot(12, 35, + "Life- Support--: Not-- Needed---", + "O2--- Production---: OFF---", + "CO2--- Scrubbers---: OFF---", + "H2O--- Production---: OFF---"), + *ship_control_hotspot(24, 20, + "Navigation: Offline---", + "Sensor: OFF---", + "Heads- Up- Display: DAMAGED---", + "Arithmetic--- Unit: DAMAGED----"), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----", + "Text: ON---", + "Audio: SEGFAULT---", + "Video: DAMAGED---"), + *ship_control_hotspot(48, 50, + "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", + "Engine I: ON---", + "Engine II: ON---", + "Engine III: ON---") + ] + end + + def final_message_last_reply args + if args.state.scene_history.include? :replied_with_whole_truth + return "Buffer--: #{anka_reply_whole_truth.quote}" + else + return "Buffer--: #{anka_reply_half_truth.quote}" + end + end + + def final_message_current args + if args.state.scene_history.include? :replied_with_whole_truth + return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." + else + return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" + end + end + + def final_message_summary args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], + ] + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], + ] + } + end + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb + def serenity_alive_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :serenity_alive_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } + end + + def serenity_alive_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :serenity_alive_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } + end + + def serenity_alive_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :serenity_alive_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } + end + + def serenity_alive_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :serenity_alive_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } + end + + def serenity_alive_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :serenity_alive_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + + def serenity_alive_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [*hotspot_top, :serenity_alive_ship_status], + ], + storylines: [ + [22, 45, 17, 4, (serenity_alive_last_reply args)], + [45, 45, 4, 4, (serenity_alive_current_message args)], + ] + } + end + + def serenity_alive_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], + [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], + *serenity_alive_shared_ship_status(args) + ] + } + end + + def serenity_alive_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :serenity_alive_time_to_reply] + ], + storylines: [ + [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], + ] + } + end + + def serenity_alive_time_to_reply args + decision_graph serenity_alive_current_message(args), + "Okay... time to deliver the bad news...", + [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], + [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] + end + + def serenity_alive_shared_ship_status args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", + nil, + nil, + nil), + *ship_control_hotspot(12, 35, + "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", + nil, + nil, + nil), + *ship_control_hotspot(24, 20, + "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", + nil, + nil, + nil), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", + nil, + nil, + nil), + *ship_control_hotspot(48, 50, + "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", + nil, + nil, + nil) + ] + end + + def serenity_alive_firm_reply + "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." + end + + def serenity_alive_sugarcoated_reply + "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." + end + + def replied_to_serenity_alive_firmly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } + end + + def replied_to_serenity_alive_kindly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } + end + + def serenity_alive_path_from_observatory args + { + fade: 60, + background: 'sprites/path-to-observatory.png', + player: [4, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_bio_infront_of_home] + ], + storylines: [ + [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] + ] + } + end + + def serenity_alive_reply_completed_shared_hotspots args + [ + [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], + [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], + [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] + ] + end + + def serenity_alive_last_reply args + if args.state.scene_history.include? :replied_to_introduction_seriously + return "Buffer--: \"Hello, Who- is sending-- this message--?\"" + else + return "Buffer--: \"New- phone. Who dis?\"" + end + end + + def serenity_alive_current_message args + if args.state.scene_history.include? :replied_to_introduction_seriously + "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote + else + "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote + end + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb + def serenity_bio_infront_of_home args + { + fade: 60, + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :serenity_bio_inside_home], + [0, 3, 3, 22, :serenity_bio_library] + ] + } + end + + def serenity_bio_inside_home args + { + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I'm--- completely--- exhausted."], + ], + scenes: [ + [30, 38, 12, 13, :serenity_bio_restless_sleep], + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } + end + + def serenity_bio_restless_sleep args + { + fade: 60, + background: 'sprites/inside-home.png', + storylines: [ + [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], + ], + scenes: [ + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } + end + + def serenity_bio_library args + { + background: 'sprites/library.png', + fade: 60, + player: [30, 7], + scenes: [ + [21, 35, 3, 18, :serenity_bio_book] + ] + } + end + + def serenity_bio_book args + { + background: 'sprites/book.png', + fade: 60, + player: [6, 52], + storylines: [ + [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], + + [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], + [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], + + [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], + [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], + + [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], + [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], + ], + scenes: [ + [*hotspot_bottom, :serenity_bio_finally_to_bed] + ] + } + end + + def serenity_bio_finally_to_bed args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 3], + storylines: [ + [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], + ], + scenes: [ + [32, 38, 10, 13, :bad_dream], + ] + } + end + + def bad_dream args + { + fade: 120, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], + ], + scenes: [ + [32, -1, 8, 3, :bad_dream_observatory] + ] + } + end + + def bad_dream_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 120, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :bad_dream_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end + + def bad_dream_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 120, + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + ], + scenes: [ + [45, 45, 4, 4, :bad_dream_everyone_dead], + ] + } + end + + def bad_dream_everyone_dead args + { + background: 'sprites/mainframe.png', + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], + [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], + ], + scenes: [ + [*hotspot_bottom, :anka_inside_room] + ] + } + end + + def bad_dream_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb + # decision_graph "Message from Sasha", + # "I should reply.", + # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], + # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] + def reply_to_introduction args + decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", + "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", + [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], + [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] + end + + def replied_to_introduction_seriously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], + *replied_to_introduction_shared_storylines(args) + ] + } + end + + def replied_to_introduction_humorously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], + *replied_to_introduction_shared_storylines(args) + ] + } + end + + def replied_to_introduction_shared_storylines args + [ + [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], + [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], + [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] + ] + end + + def replied_to_introduction_shared_scenes args + [[60, 0, 4, 32, :replied_to_introduction_observatory]] + end + + def replied_to_introduction_observatory args + { + background: 'sprites/observatory.png', + player: [28, 39], + scenes: [ + [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] + ] + } + end + + def replied_to_introduction_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [0, 26], + scenes: [ + [60, 0, 4, 20, :replied_to_introduction_mountain_pass] + ], + } + end - if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0) - circle.after_images << { - x: circle.x, - y: circle.y, - w: circle.radius, - h: circle.radius, - a: 255, - created_at: state.tick_count - } - end + def replied_to_introduction_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [21, 48], + scenes: [ + [0, 0, 15, 4, :replied_to_introduction_side_of_home] + ], + storylines: [ + [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] + ] + } + end - circle.after_images.each do |ai| - ai.a = ai[:created_at].ease(10, :flip) * 255 - end + def replied_to_introduction_side_of_home args + { + background: 'sprites/side-of-home.png', + player: [58, 29], + scenes: [ + [2, 0, 61, 2, :speed_of_light_front_of_home] + ], + } + end + +#+end_src + +* Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb +#+begin_src ruby + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb + def speed_of_light_front_of_home args + { + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :speed_of_light_inside_home], + [0, 3, 3, 22, :speed_of_light_outside_library] + ] + } + end - circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 } - calc_physics - end + def speed_of_light_inside_home args + { + background: 'sprites/inside-home.png', + player: [35, 4], + storylines: [ + [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] + ], + scenes: [ + [32, 0, 8, 3, :speed_of_light_front_of_home], + ] + } + end - def circle - state.circle - end + def speed_of_light_outside_library args + { + background: 'sprites/outside-library.png', + player: [55, 19], + scenes: [ + [49, 39, 6, 10, :speed_of_light_library], + [61, 11, 3, 20, :speed_of_light_front_of_home] + ] + } + end - def camera - state.camera - end + def speed_of_light_library args + { + background: 'sprites/library.png', + player: [30, 7], + scenes: [ + [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] + ] + } + end - def terrain - state.terrain - end + def speed_of_light_celestial_bodies_diagram args + { + background: 'sprites/planets.png', + fade: 60, + player: [30, 3], + scenes: [ + [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] + ], + storylines: [ + [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], - def lava - state.lava - end + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], + ] + } end - # $gtk.reset - - def tick args - args.outputs.background_color = [0, 0, 0] - if args.inputs.keyboard.r - args.gtk.reset - return - end - # uncomment the line below to slow down the game so you - # can see each tick as it passes - # args.gtk.slowmo! 30 - $game ||= FallingCircle.new - $game.args = args - $game.tick + def speed_of_light_distance_discovered args + { + background: 'sprites/planets.png', + scenes: [ + [13, 0, 44, 3, :speed_of_light_end_of_day] + ], + storylines: [ + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], + ] + } end - def reset - $game = nil + def speed_of_light_end_of_day args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 0], + storylines: [ + [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] + ], + scenes: [ + [31, 38, 10, 12, :serenity_alive_side_of_home] + ] + } end #+end_src -* 99_genre_roguelike/roguelike_line_of_sight/app/constants.rb +* Rpg Roguelike - Roguelike Line Of Sight - constants.rb #+begin_src ruby + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb SHOW_LEGEND = true SOURCE_TILE_SIZE = 16 DESTINATION_TILE_SIZE = 16 @@ -18138,8 +20746,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_roguelike/roguelike_line_of_sight/app/legend.rb +* Rpg Roguelike - Roguelike Line Of Sight - legend.rb #+begin_src ruby + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb def tick_legend args return unless SHOW_LEGEND @@ -18208,8 +20817,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_roguelike/roguelike_line_of_sight/app/main.rb +* Rpg Roguelike - Roguelike Line Of Sight - main.rb #+begin_src ruby + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb require 'app/constants.rb' require 'app/sprite_lookup.rb' require 'app/legend.rb' @@ -18310,8 +20920,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb +* Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb #+begin_src ruby + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb def sprite_lookup { 0 => [3, 0], @@ -18439,8 +21050,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_roguelike/roguelike_starting_point/app/main.rb +* Rpg Roguelike - Roguelike Starting Point - main.rb #+begin_src ruby + # ./samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: @@ -18883,8 +21495,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_tactical_rpg/hexagonal_grid/app/main.rb +* Rpg Tactical - Hexagonal Grid - main.rb #+begin_src ruby + # ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb class HexagonTileGame attr_gtk @@ -18956,8 +21569,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_tactical_rpg/isometric_grid/app/main.rb +* Rpg Tactical - Isometric Grid - main.rb #+begin_src ruby + # ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb class Isometric attr_accessor :grid, :inputs, :state, :outputs @@ -19223,8 +21837,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* 99_genre_topdown_rpg/topdown_starting_point/app/main.rb +* Rpg Topdown - Topdown Starting Point - main.rb #+begin_src ruby + # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb =begin APIs listing that haven't been encountered in previous sample apps: @@ -19336,8 +21951,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/args.rb +* args.rb #+begin_src ruby + # ./dragon/args.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -19537,8 +22153,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/assert.rb +* assert.rb #+begin_src ruby + # ./dragon/assert.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -19670,8 +22287,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/attr_gtk.rb +* attr_gtk.rb #+begin_src ruby + # ./dragon/attr_gtk.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -19716,8 +22334,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/attr_sprite.rb +* attr_sprite.rb #+begin_src ruby + # ./dragon/attr_sprite.rb # Copyright 2019 DragonRuby LLC # MIT License # attr_sprite.rb has been released under MIT (*only this file*). @@ -19777,8 +22396,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/console.rb +* console.rb #+begin_src ruby + # ./dragon/console.rb # Copyright 2019 DragonRuby LLC # MIT License # console.rb has been released under MIT (*only this file*). @@ -20073,18 +22693,17 @@ Follows is a source code listing for all files that have been open sourced. This @last_command_errored = false rescue Exception => e string_e = "#{e}" + puts "* EXCEPTION: #{e}" + log "* EXCEPTION: #{e}" @last_command_errored = true if (string_e.include? "wrong number of arguments") method_name = (string_e.split ":")[0].gsub "'", "" - results = Kernel.docs_search method_name - if !results.include "* DOCS: No results found." + results = (Kernel.docs_search method_name).strip + if !results.include? "* DOCS: No results found." puts results log results end end - - puts "#{e}" - log "#{e}" end end end @@ -20096,6 +22715,10 @@ Follows is a source code listing for all files that have been open sourced. This (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control) end + def scroll_to_bottom + @log_offset = 0 + end + def scroll_up_full @log_offset += lines_on_one_page @log_offset = @log.size if @log_offset > @log.size @@ -20291,63 +22914,6 @@ Follows is a source code listing for all files that have been open sourced. This render_log_offset args end - def tick_help args - tick_help_debounce args - alpha_rate = 20 - @render_help_target_alpha ||= 255 - @render_help_current_alpha ||= 255 - @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha - @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20) - - @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255) - @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255) - - [ - "* Prompt Commands: ", - "You can type any of the following ", - "commands in the command prompt. ", - "** docs: Provides API docs. ", - "** $gtk: Accesses the global runtime.", - "* Shortcut Keys: ", - "** full page up: ctrl + b ", - "** full page down: ctrl + f ", - "** half page up: ctrl + u ", - "** half page down: ctrl + d ", - "** clear prompt: ctrl + g ", - "** up arrow: next command ", - "** down arrow: prev command ", - ].each_with_index do |s, i| - args.outputs.reserved << [args.grid.right - 10, - top - 100 - line_height_px * i * 0.8, - s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label - end - end - - def tick_help_debounce args - hide_log_alpha = -255 - if hidden? - @render_help_current_alpha = -255 - end - - if prompt.last_input_str_changed - @render_help_target_alpha = hide_log_alpha - end - - if args.inputs.mouse.moved - @render_help_target_alpha = hide_log_alpha - end - - if args.inputs.mouse.wheel - @render_help_target_alpha = hide_log_alpha - end - - if @render_help_last_log_invocation_count != @log_invocation_count - @render_help_target_alpha = hide_log_alpha - end - - @render_help_last_log_invocation_count = @log_invocation_count - end - def render_log_offset args return if @log_offset <= 0 args.outputs.reserved << font_style.label( @@ -20404,7 +22970,6 @@ Follows is a source code listing for all files that have been open sourced. This process_inputs args return unless should_tick? calc args - tick_help args prompt.tick menu.tick args rescue Exception => e @@ -20564,8 +23129,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/console_color.rb +* console_color.rb #+begin_src ruby + # ./dragon/console_color.rb # Copyright 2019 DragonRuby LLC # MIT License # console_color.rb has been released under MIT (*only this file*). @@ -20599,8 +23165,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/console_font_style.rb +* console_font_style.rb #+begin_src ruby + # ./dragon/console_font_style.rb # Copyright 2019 DragonRuby LLC # MIT License # console_font_style.rb has been released under MIT (*only this file*). @@ -20644,8 +23211,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/console_menu.rb +* console_menu.rb #+begin_src ruby + # ./dragon/console_menu.rb # Copyright 2019 DragonRuby LLC # MIT License # console_menu.rb has been released under MIT (*only this file*). @@ -20653,6 +23221,8 @@ Follows is a source code listing for all files that have been open sourced. This module GTK class Console class Menu + attr_accessor :buttons + def initialize console @console = console end @@ -20686,28 +23256,63 @@ Follows is a source code listing for all files that have been open sourced. This @console.hide end + def hide_menu_clicked + @menu_shown = :hidden + end + def framerate_diagnostics_clicked + @console.scroll_to_bottom $gtk.framerate_diagnostics end + def itch_wizard_clicked + @console.scroll_to_bottom + $wizards.itch.start + end + + def docs_clicked + @console.scroll_to_bottom + log Kernel.docs_classes + end + + def scroll_end_clicked + @console.scroll_to_bottom + end + + def custom_buttons + [] + end + def tick args return unless @console.visible? @menu_shown ||= :hidden - if @menu_shown == :hidden + if $gtk.production + @buttons = [ + (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked), + (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), + ] + elsif @menu_shown == :hidden @buttons = [ (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked), ] else @buttons = [ - (button id: :record, row: 0, col: 4, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), - (button id: :record, row: 0, col: 5, text: "record", method: :record_clicked), - (button id: :replay, row: 0, col: 6, text: "replay", method: :replay_clicked), - (button id: :reset, row: 0, col: 7, text: "reset", method: :reset_clicked), - (button id: :scroll_up, row: 0, col: 8, text: "scroll up", method: :scroll_up_clicked), - (button id: :scroll_down, row: 0, col: 9, text: "scroll down", method: :scroll_down_clicked), - (button id: :close, row: 0, col: 10, text: "close", method: :close_clicked), + (button id: :scroll_up, row: 0, col: 6, text: "scroll up", method: :scroll_up_clicked), + (button id: :scroll_down, row: 0, col: 7, text: "scroll down", method: :scroll_down_clicked), + (button id: :scroll_down, row: 0, col: 8, text: "scroll end", method: :scroll_end_clicked), + (button id: :close, row: 0, col: 9, text: "close console", method: :close_clicked), + (button id: :hide, row: 0, col: 10, text: "hide menu", method: :hide_menu_clicked), + + (button id: :record, row: 1, col: 7, text: "record gameplay", method: :record_clicked), + (button id: :replay, row: 1, col: 8, text: "start replay", method: :replay_clicked), + (button id: :record, row: 1, col: 9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), + (button id: :reset, row: 1, col: 10, text: "reset game", method: :reset_clicked), + + (button id: :reset, row: 2, col: 10, text: "docs", method: :docs_clicked), + (button id: :reset, row: 2, col: 9, text: "itch wizard", method: :itch_wizard_clicked), + *custom_buttons ] end @@ -20740,10 +23345,11 @@ Follows is a source code listing for all files that have been open sourced. This { id: id, rect: (rect_for_layout row, col), + text: text, method: method }.let do |entity| primitives = [] - primitives << entity[:rect].merge(a: 80).solid + primitives << entity[:rect].merge(a: 164).solid primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border primitives << text.wrapped_lines(5) .map_with_index do |l, i| @@ -20769,8 +23375,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/console_prompt.rb +* console_prompt.rb #+begin_src ruby + # ./dragon/console_prompt.rb # Copyright 2019 DragonRuby LLC # MIT License # console_prompt.rb has been released under MIT (*only this file*). @@ -20944,8 +23551,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/controller.rb +* controller.rb #+begin_src ruby + # ./dragon/controller.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -21071,8 +23679,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/controller/config.rb +* controller/config.rb #+begin_src ruby + # ./dragon/controller/config.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -21475,8 +24084,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/controller/keys.rb +* controller/keys.rb #+begin_src ruby + # ./dragon/controller/keys.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -21531,8 +24141,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/directional_input_helper_methods.rb +* directional_input_helper_methods.rb #+begin_src ruby + # ./dragon/directional_input_helper_methods.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -21628,8 +24239,97 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/geometry.rb +* easing.rb +#+begin_src ruby + # ./dragon/easing.rb + # coding: utf-8 + # Copyright 2019 DragonRuby LLC + # MIT License + # easing.rb has been released under MIT (*only this file*). + + module GTK + module Easing + def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions + definitions.flatten! + definitions = [:identity] if definitions.length == 0 + duration = end_tick - start_tick + elapsed = current_tick - start_tick + y = elapsed.percentage_of(duration).cap_min_max(0, 1) + + definitions.map do |definition| + y = Easing.exec_definition(definition, start_tick, duration, y) + end + + y + end + + def self.ease_spline_extended start_tick, current_tick, end_tick, spline + duration = end_tick - start_tick + t = (current_tick - start_tick).fdiv duration + time_allocation_per_curve = 1.fdiv(spline.length) + curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t| + [spline_t.to_i, spline_t - spline_t.to_i] + end + Geometry.cubic_bezier curve_t, *spline[curve_index] + end + + def self.initial_value *definitions + definitions.flatten! + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0 + end + + def self.final_value *definitions + definitions.flatten! + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0 + end + + def self.exec_definition definition, start_tick, duration, x + if definition.is_a? Symbol + return Easing.send(definition, x).cap_min_max(0, 1) + elsif definition.is_a? Proc + return definition.call(x, start_tick, duration).cap_min_max(0, 1) + end + + raise <<-S + * ERROR: + I don't know how to execute easing function with definition #{definition}. + + S + end + + def self.identity x + x + end + + def self.flip x + 1 - x + end + + def self.quad x + x * x + end + + def self.cube x + x * x * x + end + + def self.quart x + x * x * x * x * x + end + + def self.quint x + x * x * x * x * x * x + end + end + end + + Easing = GTK::Easing + +#+end_src + +* geometry.rb #+begin_src ruby + # ./dragon/geometry.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -22002,8 +24702,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/grid.rb +* grid.rb #+begin_src ruby + # ./dragon/grid.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -22196,8 +24897,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/inputs.rb +* inputs.rb #+begin_src ruby + # ./dragon/inputs.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -22868,8 +25570,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/log.rb +* log.rb #+begin_src ruby + # ./dragon/log.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -22899,19 +25602,19 @@ Follows is a source code listing for all files that have been open sourced. This class Log def self.write_to_log_and_puts *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + "\n" + $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n" args.each { |obj| $gtk.log obj, self } end def self.write_to_log_and_print *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + $gtk.append_file_root 'logs/log.txt', args.join("\n") Object.print(*args) end def self.puts_important *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + $gtk.append_file_root 'logs/log.txt', args.join("\n") $gtk.notify! "Important notification occurred." args.each { |obj| $gtk.log obj } end @@ -23137,8 +25840,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/numeric.rb +* numeric.rb #+begin_src ruby + # ./dragon/numeric.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -23784,8 +26488,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/runtime/framerate_diagnostics.rb +* runtime/framerate_diagnostics.rb #+begin_src ruby + # ./dragon/runtime/framerate_diagnostics.rb # Copyright 2019 DragonRuby LLC # MIT License # framerate_diagnostics.rb has been released under MIT (*only this file*). @@ -23954,8 +26659,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/string.rb +* string.rb #+begin_src ruby + # ./dragon/string.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -24060,8 +26766,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/tests.rb +* tests.rb #+begin_src ruby + # ./dragon/tests.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -24204,8 +26911,9 @@ Follows is a source code listing for all files that have been open sourced. This #+end_src -* ./dragon/trace.rb +* trace.rb #+begin_src ruby + # ./dragon/trace.rb # coding: utf-8 # Copyright 2019 DragonRuby LLC # MIT License @@ -24273,7 +26981,7 @@ Follows is a source code listing for all files that have been open sourced. This @traced_classes.clear $trace_enabled = false if !$gtk.production - $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" + $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" end end @@ -24295,9 +27003,9 @@ Follows is a source code listing for all files that have been open sourced. This if $trace_puts.length > 0 text = $trace_puts.join("") if pad_with_newline - $gtk.append_file 'logs/trace.txt', "\n" + text.strip + $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip else - $gtk.append_file 'logs/trace.txt', text.strip + $gtk.append_file_root 'logs/trace.txt', text.strip end end $trace_puts.clear diff --git a/docs/parse_log.txt b/docs/parse_log.txt index d04aef5..763949f 100644 --- a/docs/parse_log.txt +++ b/docs/parse_log.txt @@ -869,12 +869,12 @@ Note that you can also run DragonRuby without X11 at all: if you run it from a v - End of paragraph detected. *** True Line Result There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore. -** Processing line: ~** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ +** Processing line: ~* IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this!~ - Header detected. *** True Line Result *** True Line Result -** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! +* IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this! ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -887,274 +887,131 @@ There is a lot more you can do with DragonRuby, but now you've already got just - End of paragraph detected. *** True Line Result Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app. -** Processing line: ~1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ -- Line was identified as a start of a list. +** Processing line: ~** Guided Samples~ +- Header detected. *** True Line Result -** Processing line: ~2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ -- Line was identified as a continuation of a list. -*** True Line Result -1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. -** Processing line: ~3. 01_api_01_labels: Various ways to render ~label~s.~ -- Line was identified as a continuation of a list. -*** True Line Result -2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. -** Processing line: ~4. 01_api_02_lines: Various ways to render ~line~s.~ -- Line was identified as a continuation of a list. -*** True Line Result -3. 01_api_01_labels: Various ways to render ~label~s. -** Processing line: ~5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ -- Line was identified as a continuation of a list. -*** True Line Result -4. 01_api_02_lines: Various ways to render ~line~s. -** Processing line: ~6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ -- Line was identified as a continuation of a list. -*** True Line Result -5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. -** Processing line: ~7. 01_api_05_keyboard: Hows how to get keyboard input from the user.~ -- Line was identified as a continuation of a list. -*** True Line Result -6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. -** Processing line: ~8. 01_api_06_mouse: Hows how to get mouse mouse position.~ -- Line was identified as a continuation of a list. -*** True Line Result -7. 01_api_05_keyboard: Hows how to get keyboard input from the user. -** Processing line: ~9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ -- Line was identified as a continuation of a list. -*** True Line Result -8. 01_api_06_mouse: Hows how to get mouse mouse position. -** Processing line: ~10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ -- Line was identified as a continuation of a list. -*** True Line Result -9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. -** Processing line: ~11. 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ -- Line was identified as a continuation of a list. -*** True Line Result -10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. -** Processing line: ~12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ -- Line was identified as a continuation of a list. -*** True Line Result -11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. -** Processing line: ~13. 02_collision_01_simple: Collision detection with dynamically moving bodies.~ -- Line was identified as a continuation of a list. -*** True Line Result -12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. -** Processing line: ~14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ -- Line was identified as a continuation of a list. -*** True Line Result -13. 02_collision_01_simple: Collision detection with dynamically moving bodies. -** Processing line: ~15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ -- Line was identified as a continuation of a list. -*** True Line Result -14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. -** Processing line: ~16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ -- Line was identified as a continuation of a list. -*** True Line Result -15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). -** Processing line: ~17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ -- Line was identified as a continuation of a list. -*** True Line Result -16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. -** Processing line: ~18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ -- Line was identified as a continuation of a list. -*** True Line Result -17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. -** Processing line: ~19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ -- Line was identified as a continuation of a list. -*** True Line Result -18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. -** Processing line: ~20. 04_sounds: How to play sounds and work with buttons.~ -- Line was identified as a continuation of a list. -*** True Line Result -19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. -** Processing line: ~21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ -- Line was identified as a continuation of a list. -*** True Line Result -20. 04_sounds: How to play sounds and work with buttons. -** Processing line: ~22. 05_mouse_move_paint_app: Represents a simple paint app.~ -- Line was identified as a continuation of a list. -*** True Line Result -21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. -** Processing line: ~23. 05_mouse_move_tile_editor: A starting point for a tile editor.~ -- Line was identified as a continuation of a list. -*** True Line Result -22. 05_mouse_move_paint_app: Represents a simple paint app. -** Processing line: ~24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ -- Line was identified as a continuation of a list. -*** True Line Result -23. 05_mouse_move_tile_editor: A starting point for a tile editor. -** Processing line: ~25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ -- Line was identified as a continuation of a list. -*** True Line Result -24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. -** Processing line: ~26. 07_render_targets_advanced: Advanced usage of ~render_target~s.~ -- Line was identified as a continuation of a list. -*** True Line Result -25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). -** Processing line: ~27. 08_platformer_collisions: Axis aligned collision along with platformer physics.~ -- Line was identified as a continuation of a list. -*** True Line Result -26. 07_render_targets_advanced: Advanced usage of ~render_target~s. -** Processing line: ~28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ -- Line was identified as a continuation of a list. -*** True Line Result -27. 08_platformer_collisions: Axis aligned collision along with platformer physics. -** Processing line: ~29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ -- Line was identified as a continuation of a list. -*** True Line Result -28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. -** Processing line: ~30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ -- Line was identified as a continuation of a list. -*** True Line Result -29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. -** Processing line: ~31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ -- Line was identified as a continuation of a list. -*** True Line Result -30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. -** Processing line: ~32. 10_save_load_game: Save and load game data.~ -- Line was identified as a continuation of a list. -*** True Line Result -31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. -** Processing line: ~33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ -- Line was identified as a continuation of a list. -*** True Line Result -32. 10_save_load_game: Save and load game data. -** Processing line: ~34. 11_hash_primitives: How primitives can be represented using a ~Hash~.~ -- Line was identified as a continuation of a list. -*** True Line Result -33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. -** Processing line: ~35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ -- Line was identified as a continuation of a list. -*** True Line Result -34. 11_hash_primitives: How primitives can be represented using a ~Hash~. -** Processing line: ~36. 12_top_down_area: How to render a top down map and how to manage collision of a player.~ -- Line was identified as a continuation of a list. *** True Line Result -35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. -** Processing line: ~37. 13_01_easing_functions: How to use lerping functions to define animations/movement.~ -- Line was identified as a continuation of a list. +** Guided Samples +** Processing line: ~~ +- End of paragraph detected. *** True Line Result -36. 12_top_down_area: How to render a top down map and how to manage collision of a player. -** Processing line: ~38. 13_02_cubic_bezier: How to create a bezier curve using lines.~ -- Line was identified as a continuation of a list. + +** Processing line: ~1. ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language.~ +- Line was identified as a start of a list. *** True Line Result -37. 13_01_easing_functions: How to use lerping functions to define animations/movement. -** Processing line: ~39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ + +** Processing line: ~2. ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~.~ - Line was identified as a continuation of a list. *** True Line Result -38. 13_02_cubic_bezier: How to create a bezier curve using lines. -** Processing line: ~40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ +1. ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language. +** Processing line: ~3. ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~.~ - Line was identified as a continuation of a list. *** True Line Result -39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. -** Processing line: ~41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ +2. ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~. +** Processing line: ~4. ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet).~ - Line was identified as a continuation of a list. *** True Line Result -40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. -** Processing line: ~42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ +3. ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~. +** Processing line: ~4. ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics.~ - Line was identified as a continuation of a list. *** True Line Result -41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. -** Processing line: ~43. 15_collision_limits: How many collisions can be processed across many primitives.~ +4. ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet). +** Processing line: ~5. ~samples/05_mouse~: This set of samples show more advanced usages of the mouse.~ - Line was identified as a continuation of a list. *** True Line Result -42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). -** Processing line: ~44. 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ +4. ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics. +** Processing line: ~6. ~samples/06_save_load~: This set of samples show how to save and load game data.~ - Line was identified as a continuation of a list. *** True Line Result -43. 15_collision_limits: How many collisions can be processed across many primitives. -** Processing line: ~45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ +5. ~samples/05_mouse~: This set of samples show more advanced usages of the mouse. +** Processing line: ~7. ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets.~ - Line was identified as a continuation of a list. *** True Line Result -44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). -** Processing line: ~46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ +6. ~samples/06_save_load~: This set of samples show how to save and load game data. +** Processing line: ~8. ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations.~ - Line was identified as a continuation of a list. *** True Line Result -45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. -** Processing line: ~47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ +7. ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets. +** Processing line: ~9. ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen.~ - Line was identified as a continuation of a list. *** True Line Result -46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. -** Processing line: ~48. 21_mailbox_usage: How to do interprocess communication.~ +8. ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations. +** Processing line: ~10. ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques.~ - Line was identified as a continuation of a list. *** True Line Result -47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. -** Processing line: ~49. 22_trace_debugging: Debugging techniques and tracing execution through your game.~ +9. ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen. +** Processing line: ~11. ~samples/11_http~: This set of samples show how use http.~ - Line was identified as a continuation of a list. *** True Line Result -48. 21_mailbox_usage: How to do interprocess communication. -** Processing line: ~50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ -- Line was identified as a continuation of a list. +10. ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques. +** Processing line: ~~ +- End of paragraph detected. *** True Line Result -49. 22_trace_debugging: Debugging techniques and tracing execution through your game. -** Processing line: ~51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ -- Line was identified as a continuation of a list. +11. ~samples/11_http~: This set of samples show how use http. +** Processing line: ~** Sample Games~ +- Header detected. *** True Line Result -50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. -** Processing line: ~52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ -- Line was identified as a continuation of a list. + *** True Line Result -51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. -** Processing line: ~53. 24_http_example: How to make http requests.~ -- Line was identified as a continuation of a list. +** Sample Games +** Processing line: ~~ +- End of paragraph detected. *** True Line Result -52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. -** Processing line: ~54. 25_3d_experiment_01_square: How to create 3D objects.~ -- Line was identified as a continuation of a list. + +** Processing line: ~There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game:~ +** Processing line: ~~ +- End of paragraph detected. *** True Line Result -53. 24_http_example: How to make http requests. -** Processing line: ~55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ -- Line was identified as a continuation of a list. +There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game: +** Processing line: ~1. 3D Cube: Shows how to do faux 3D in DragonRuby.~ +- Line was identified as a start of a list. *** True Line Result -54. 25_3d_experiment_01_square: How to create 3D objects. -** Processing line: ~56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ + +** Processing line: ~2. Dueling Starships: A two player top-down versus game where each player controls a ship.~ - Line was identified as a continuation of a list. *** True Line Result -55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. -** Processing line: ~57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ +1. 3D Cube: Shows how to do faux 3D in DragonRuby. +** Processing line: ~3. Flappy Dragon: DragonRuby's clone of Flappy Bird.~ - Line was identified as a continuation of a list. *** True Line Result -56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. -** Processing line: ~58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ +2. Dueling Starships: A two player top-down versus game where each player controls a ship. +** Processing line: ~4. Pong: A simple implementation of the game Pong.~ - Line was identified as a continuation of a list. *** True Line Result -57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. -** Processing line: ~59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ +3. Flappy Dragon: DragonRuby's clone of Flappy Bird. +** Processing line: ~5. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun).~ - Line was identified as a continuation of a list. *** True Line Result -58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. -** Processing line: ~60. 99_sample_game_pong: Reference implementation of pong.~ +4. Pong: A simple implementation of the game Pong. +** Processing line: ~6. Solar System: A simulation of our solar system.~ - Line was identified as a continuation of a list. *** True Line Result -59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. -** Processing line: ~61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ +5. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun). +** Processing line: ~7. Crafting Starting Point: A starting point for those that want to build a crafting game.~ - Line was identified as a continuation of a list. *** True Line Result -60. 99_sample_game_pong: Reference implementation of pong. -** Processing line: ~62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ +6. Solar System: A simulation of our solar system. +** Processing line: ~8. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app.~ - Line was identified as a continuation of a list. *** True Line Result -61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. -** Processing line: ~63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ +7. Crafting Starting Point: A starting point for those that want to build a crafting game. +** Processing line: ~9. LOWREZ: Sample apps that show how to render at different resolutions.~ - Line was identified as a continuation of a list. *** True Line Result -62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. -** Processing line: ~64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ +8. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app. +** Processing line: ~10. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs.~ - Line was identified as a continuation of a list. *** True Line Result -63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. -** Processing line: ~65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ +9. LOWREZ: Sample apps that show how to render at different resolutions. +** Processing line: ~11. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers.~ - Line was identified as a continuation of a list. *** True Line Result -64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. +10. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs. ** Processing line: ~~ - End of paragraph detected. *** True Line Result -65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - +11. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers. ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1249,26 +1106,26 @@ NOTE: Remove the ~#~ at the beginning of each line. *** True Line Result #+begin_src -** Processing line: ~devid=bob~ +** Processing line: ~ devid=bob~ - Inside source: true *** True Line Result -devid=bob -** Processing line: ~devtitle=Bob The Game Developer~ + devid=bob +** Processing line: ~ devtitle=Bob The Game Developer~ - Inside source: true *** True Line Result -devtitle=Bob The Game Developer -** Processing line: ~gameid=mygame~ + devtitle=Bob The Game Developer +** Processing line: ~ gameid=mygame~ - Inside source: true *** True Line Result -gameid=mygame -** Processing line: ~gametitle=My Game~ + gameid=mygame +** Processing line: ~ gametitle=My Game~ - Inside source: true *** True Line Result -gametitle=My Game -** Processing line: ~version=0.1~ + gametitle=My Game +** Processing line: ~ version=0.1~ - Inside source: true *** True Line Result -version=0.1 + version=0.1 ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -1307,10 +1164,10 @@ Open up the terminal and run this from the command line: *** True Line Result #+begin_src -** Processing line: ~./dragonruby-publish --only-package mygame~ +** Processing line: ~ ./dragonruby-publish --only-package mygame~ - Inside source: true *** True Line Result -./dragonruby-publish --only-package mygame + ./dragonruby-publish --only-package mygame ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -1348,10 +1205,10 @@ For subsequent updates you can use an automated deployment to Itch.io: *** True Line Result #+begin_src -** Processing line: ~./dragonruby-publish mygame~ +** Processing line: ~ ./dragonruby-publish mygame~ - Inside source: true *** True Line Result -./dragonruby-publish mygame + ./dragonruby-publish mygame ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -1372,12 +1229,12 @@ DragonRuby will package _and publish_ your game to itch.io! Tell your friends to - End of paragraph detected. *** True Line Result If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you. -** Processing line: ~** DragonRuby's Philosophy~ +** Processing line: ~* DragonRuby's Philosophy~ - Header detected. *** True Line Result *** True Line Result -** DragonRuby's Philosophy +* DragonRuby's Philosophy ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1391,12 +1248,12 @@ If you make changes to your game, just re-run dragonruby-publish and it'll updat - End of paragraph detected. *** True Line Result The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. -** Processing line: ~*** Challenge The Status Quo~ +** Processing line: ~** Challenge The Status Quo~ - Header detected. *** True Line Result *** True Line Result -*** Challenge The Status Quo +** Challenge The Status Quo ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1432,12 +1289,12 @@ But that's how we've always done it. - End of paragraph detected. *** True Line Result It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us. -** Processing line: ~*** Continuity of Design~ +** Processing line: ~** Continuity of Design~ - Header detected. *** True Line Result *** True Line Result -*** Continuity of Design +** Continuity of Design ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1461,12 +1318,12 @@ There is a programming idiom in software called "the pit of success". The term n - End of paragraph detected. *** True Line Result DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront). -** Processing line: ~*** Release Often And Soon~ +** Processing line: ~** Release Often And Soon~ - Header detected. *** True Line Result *** True Line Result -*** Release Often And Soon +** Release Often And Soon ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1508,12 +1365,12 @@ Real artists ship. - End of paragraph detected. *** True Line Result -** Processing line: ~*** Sustainable And Ethical Monetization~ +** Processing line: ~** Sustainable And Ethical Monetization~ - Header detected. *** True Line Result *** True Line Result -*** Sustainable And Ethical Monetization +** Sustainable And Ethical Monetization ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1532,12 +1389,12 @@ We all aspire to put food on the table doing what we love. Whether it is buildin - End of paragraph detected. *** True Line Result Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it. -** Processing line: ~*** Sustainable And Ethical Open Source~ +** Processing line: ~** Sustainable And Ethical Open Source~ - Header detected. *** True Line Result *** True Line Result -*** Sustainable And Ethical Open Source +** Sustainable And Ethical Open Source ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1557,12 +1414,12 @@ This goes hand in hand with sustainable and ethical monetization. The current st - End of paragraph detected. *** True Line Result So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir. -** Processing line: ~*** People Over Entities~ +** Processing line: ~** People Over Entities~ - Header detected. *** True Line Result *** True Line Result -*** People Over Entities +** People Over Entities ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1576,12 +1433,12 @@ So, don't be "that guy" in the Discord that says "DragonRuby should be free and - End of paragraph detected. *** True Line Result We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby. -** Processing line: ~*** Building A Game Should Be Fun And Bring Happiness~ +** Processing line: ~** Building A Game Should Be Fun And Bring Happiness~ - Header detected. *** True Line Result *** True Line Result -*** Building A Game Should Be Fun And Bring Happiness +** Building A Game Should Be Fun And Bring Happiness ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -1593,12 +1450,12 @@ We prioritize the endorsement of real people over faceless entities. This game e - End of paragraph detected. *** True Line Result We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine. -** Processing line: ~*** Real World Application Drives Features~ +** Processing line: ~** Real World Application Drives Features~ - Header detected. *** True Line Result *** True Line Result -*** Real World Application Drives Features +** Real World Application Drives Features ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -2850,24 +2707,18 @@ Under DragonRuby LLP, we offer a number of products (with more on the way): - Line was identified as a list. *** True Line Result -** Processing line: ~ gaming platforms. [Home Page]() [FAQ Page]()~ +** Processing line: ~ gaming platforms.~ ** Processing line: ~- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile~ - Line was identified as a list. *** True Line Result - Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]() -** Processing line: ~ apps. [Home Page]() [FAQ Page]()~ -** Processing line: ~- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby~ -- Line was identified as a list. -*** True Line Result -- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]() -** Processing line: ~ environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ + gaming platforms. +** Processing line: ~ apps. [[http://rubymotion.com]]~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() +- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [[http://rubymotion.com]] ** Processing line: ~All of the products above leverage a shared core called DragonRuby.~ ** Processing line: ~~ - End of paragraph detected. @@ -2908,12 +2759,12 @@ NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a ba - End of paragraph detected. *** True Line Result The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. -** Processing line: ~*** Okay... so what is the difference between a language specification and a runtime?~ +** Processing line: ~**** Okay... so what is the difference between a language specification and a runtime?~ - Header detected. *** True Line Result *** True Line Result -*** Okay... so what is the difference between a language specification and a runtime? +**** Okay... so what is the difference between a language specification and a runtime? ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -2931,12 +2782,12 @@ A runtime is an _implementation_ of a language specification. When people say "R - End of paragraph detected. *** True Line Result But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby. -** Processing line: ~*** Okay... what language specification does DragonRuby use then?~ +** Processing line: ~**** Okay... what language specification does DragonRuby use then?~ - Header detected. *** True Line Result *** True Line Result -*** Okay... what language specification does DragonRuby use then? +**** Okay... what language specification does DragonRuby use then? ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -2948,12 +2799,12 @@ But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichok - End of paragraph detected. *** True Line Result DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries. -** Processing line: ~*** So... why another runtime?~ +** Processing line: ~**** So... why another runtime?~ - Header detected. *** True Line Result *** True Line Result -*** So... why another runtime? +**** So... why another runtime? ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -2971,12 +2822,12 @@ The elevator pitch is: - End of paragraph detected. *** True Line Result DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. -** Processing line: ~*** What does Multilevel Cross-platform mean?~ +** Processing line: ~**** What does Multilevel Cross-platform mean?~ - Header detected. *** True Line Result *** True Line Result -*** What does Multilevel Cross-platform mean? +**** What does Multilevel Cross-platform mean? ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -3060,12 +2911,12 @@ Levels 1 through 3 are fairly commonplace in many runtime implementations (with - End of paragraph detected. *** True Line Result These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane. -** Processing line: ~*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +** Processing line: ~**** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ - Header detected. *** True Line Result *** True Line Result -*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? +**** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -3077,12 +2928,260 @@ These levels allow us to stay up to date with open source implementations of Rub - End of paragraph detected. *** True Line Result DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. -** Processing line: ~** Frequent Comments~ +** Processing line: ~*** How is DragonRuby different than MRI?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** How is DragonRuby different than MRI? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby supports a subset of MRI apis. Our target is to support all~ +** Processing line: ~of mRuby's standard lib. There are challenges to this given the number~ +** Processing line: ~of platforms we are trying to support (specifically console).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby supports a subset of MRI apis. Our target is to support all of mRuby's standard lib. There are challenges to this given the number of platforms we are trying to support (specifically console). +** Processing line: ~**** Does DragonRuby support Gems?~ +- Header detected. +*** True Line Result + +*** True Line Result +**** Does DragonRuby support Gems? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby does not support gems because that requires the~ +** Processing line: ~installation of MRI Ruby on the developer's machine (which is a~ +** Processing line: ~non-starter given that we want DragonRuby to be a zero dependency~ +** Processing line: ~runtime). While this seems easy for Mac and Linux, it is much harder~ +** Processing line: ~on Windows and Raspberry Pi. mRuby has taken the approach of having a~ +** Processing line: ~git repository for compatible gems and we will most likely follow~ +** Processing line: ~suite: [[https://github.com/mruby/mgem-list]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby does not support gems because that requires the installation of MRI Ruby on the developer's machine (which is a non-starter given that we want DragonRuby to be a zero dependency runtime). While this seems easy for Mac and Linux, it is much harder on Windows and Raspberry Pi. mRuby has taken the approach of having a git repository for compatible gems and we will most likely follow suite: [[https://github.com/mruby/mgem-list]]. +** Processing line: ~**** Does DragonRuby have a REPL/IRB?~ +- Header detected. +*** True Line Result + +*** True Line Result +**** Does DragonRuby have a REPL/IRB? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can use DragonRuby's Console within the game to inspect object and~ +** Processing line: ~execute small pieces of code. For more complex pieces of code create a~ +** Processing line: ~file called ~repl.rb~ and put it in ~mygame/app/repl.rb~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can use DragonRuby's Console within the game to inspect object and execute small pieces of code. For more complex pieces of code create a file called ~repl.rb~ and put it in ~mygame/app/repl.rb~: +** Processing line: ~- Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method:~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ puts "hello world"~ +- Inside source: true +*** True Line Result + puts "hello world" +** Processing line: ~ puts 1 + 1~ +- Inside source: true +*** True Line Result + puts 1 + 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~- If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal).~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal). +** Processing line: ~- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. +** Processing line: ~4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ xrepl do # <------- line is prefixed with an "x"~ +- Inside source: true +*** True Line Result + xrepl do # <------- line is prefixed with an "x" +** Processing line: ~ puts "hello world"~ +- Inside source: true +*** True Line Result + puts "hello world" +** Processing line: ~ puts 1 + 1~ +- Inside source: true +*** True Line Result + puts 1 + 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # This code will be executed when you save the file.~ +- Inside source: true +*** True Line Result + # This code will be executed when you save the file. +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ puts "Hello"~ +- Inside source: true +*** True Line Result + puts "Hello" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ puts "This code will also be executed."~ +- Inside source: true +*** True Line Result + puts "This code will also be executed." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # use xrepl to "comment out" code~ +- Inside source: true +*** True Line Result + # use xrepl to "comment out" code +** Processing line: ~ xrepl do~ +- Inside source: true +*** True Line Result + xrepl do +** Processing line: ~ puts "This code will not be executed because of the x infront of repl".~ +- Inside source: true +*** True Line Result + puts "This code will not be executed because of the x infront of repl". +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~**** Does DragonRuby support ~pry~ or have any other debugging facilities?~ +- Header detected. +*** True Line Result + +*** True Line Result +**** Does DragonRuby support ~pry~ or have any other debugging facilities? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~pry~ is a gem that assumes you are using the MRI Runtime (which is~ +** Processing line: ~incompatible with DragonRuby). Eventually DragonRuby will have a pry~ +** Processing line: ~based experience that is compatible with a debugging infrastructure~ +** Processing line: ~called LLDB. Take the time to read about LLDB as it shows the~ +** Processing line: ~challenges in creating something that is compatible.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~pry~ is a gem that assumes you are using the MRI Runtime (which is incompatible with DragonRuby). Eventually DragonRuby will have a pry based experience that is compatible with a debugging infrastructure called LLDB. Take the time to read about LLDB as it shows the challenges in creating something that is compatible. +** Processing line: ~You can use DragonRuby's replay capabilities to troubleshoot:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can use DragonRuby's replay capabilities to troubleshoot: +** Processing line: ~1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +- Line was identified as a continuation of a list. +*** True Line Result +1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added). +** Processing line: ~3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~.~ +- Line was identified as a continuation of a list. +*** True Line Result +2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. +** Processing line: ~4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release.~ +- Line was identified as a continuation of a list. +*** True Line Result +3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~. +** Processing line: ~5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago.~ +- Line was identified as a continuation of a list. +*** True Line Result +4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago. +** Processing line: ~** Frequent Comments About Ruby as a Language Choice~ - Header detected. *** True Line Result *** True Line Result -** Frequent Comments +** Frequent Comments About Ruby as a Language Choice ** Processing line: ~~ - End of paragraph detected. *** True Line Result @@ -3213,6 +3312,11 @@ If you have ideas on how we can do this, email us! - End of paragraph detected. *** True Line Result If the reason above isn't sufficient, then definitely use something else. +** Processing line: ~All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]]~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]] ** Processing line: ~*** DragonRuby is for pay. You should offer a free version.~ - Header detected. *** True Line Result @@ -3365,6 +3469,17 @@ But, in the event that sad day comes, our partnership bylaws state that _all_ Dr - End of paragraph detected. *** True Line Result The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~. +** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Runtime#reset~ +** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. ** Processing line: ~* DOCS: ~GTK::Runtime#calcstringbox~~ - Header detected. *** True Line Result @@ -3406,17 +3521,53 @@ This function returns the width and height of a string. - End of paragraph detected. *** True Line Result -** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ +** Processing line: ~* DOCS: ~GTK::Runtime#write_file~~ - Header detected. *** True Line Result *** True Line Result -* DOCS: ~GTK::Runtime#reset~ -** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +* DOCS: ~GTK::Runtime#write_file~ +** Processing line: ~This function takes in two parameters. The first paramter is the file path and assumes the the game~ +** Processing line: ~directory is the root. The second parameter is the string that will be written. The method overwrites whatever~ +** Processing line: ~is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting.~ ** Processing line: ~~ - End of paragraph detected. *** True Line Result -This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +This function takes in two parameters. The first paramter is the file path and assumes the the game directory is the root. The second parameter is the string that will be written. The method overwrites whatever is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at #{args.state.tick_count}."~ +- Inside source: true +*** True Line Result + args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at #{args.state.tick_count}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + ** Processing line: ~* DOCS: ~Array~~ - Header detected. *** True Line Result @@ -6089,18 +6240,22 @@ Returns the current tick of the application from the point it was started. This *** True Line Result * Open Source ** Processing line: ~Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ -** Processing line: ~* 00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb~ +** Processing line: ~* Learn Ruby Optional - Beginner Ruby Primer - automation.rb~ - Header detected. *** True Line Result Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]]. *** True Line Result -* 00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb +* Learn Ruby Optional - Beginner Ruby Primer - automation.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb~ +- Inside source: true +*** True Line Result + # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb ** Processing line: ~ # ==========================================================================~ - Inside source: true *** True Line Result @@ -6593,18 +6748,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Beginner Ruby Primer - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb +* Learn Ruby Optional - Beginner Ruby Primer - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb ** Processing line: ~ # ==========================================================================~ - Inside source: true *** True Line Result @@ -7885,470 +8044,342 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - printing.txt~ - Header detected. *** True Line Result *** True Line Result -* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - printing.txt ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def tick args~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1]~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] -** Processing line: ~ end~ + # ==================================================================================== +** Processing line: ~ # Commenting Code~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Commenting Code +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 01_rendering_basics/01_labels/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 01_rendering_basics/01_labels/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + # ==================================================================================== +** Processing line: ~ #~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # +** Processing line: ~ # Prefixing text with a pound sign (#) is how you comment code in Ruby. Example:~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ + # Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: +** Processing line: ~ #~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in a previous sample apps: -** Processing line: ~~ + # +** Processing line: ~ # I am commented code. And so are the lines above.~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.labels: An array. Values in this array generate labels~ + # I am commented code. And so are the lines above. +** Processing line: ~ #~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. Values in this array generate labels -** Processing line: ~ the screen.~ + # +** Processing line: ~ # I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's~ - Inside source: true *** True Line Result - the screen. -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ + # I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's +** Processing line: ~ # an entertaining read. Otherwise, go to the next txt file.~ - Inside source: true *** True Line Result - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ + # an entertaining read. Otherwise, go to the next txt file. +** Processing line: ~ #~ - Inside source: true *** True Line Result - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). -** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ + # +** Processing line: ~ # Follow along by visiting:~ - Inside source: true *** True Line Result - - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction -** Processing line: ~ by adding or subracting.~ + # Follow along by visiting: +** Processing line: ~ # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4~ - Inside source: true *** True Line Result - by adding or subracting. + # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + # ==================================================================================== +** Processing line: ~ # Printing to the Console:~ - Inside source: true *** True Line Result - -** Processing line: ~ # Labels are used to represent text elements in DragonRuby~ + # Printing to the Console: +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Labels are used to represent text elements in DragonRuby -** Processing line: ~~ + # ==================================================================================== +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ # An example of creating a label is:~ + # +** Processing line: ~ # Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text~ - Inside source: true *** True Line Result - # An example of creating a label is: -** Processing line: ~ # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ + # Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text +** Processing line: ~ # to repl.rb and save to see Hello World printed to the console.~ - Inside source: true *** True Line Result - # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] + # to repl.rb and save to see Hello World printed to the console. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The code above does the following:~ -- Inside source: true -*** True Line Result - # The code above does the following: -** Processing line: ~ # 1. GET the place where labels go: args.outputs.labels~ -- Inside source: true -*** True Line Result - # 1. GET the place where labels go: args.outputs.labels -** Processing line: ~ # 2. Request a new LABEL be ADDED: <<~ -- Inside source: true -*** True Line Result - # 2. Request a new LABEL be ADDED: << -** Processing line: ~ # 3. The DEFINITION of a SOLID is the ARRAY:~ -- Inside source: true -*** True Line Result - # 3. The DEFINITION of a SOLID is the ARRAY: -** Processing line: ~ # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ -- Inside source: true -*** True Line Result - # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] -** Processing line: ~ # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~~ + repl do +** Processing line: ~ puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.'~ - Inside source: true *** True Line Result - -** Processing line: ~~ + puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.' +** Processing line: ~ puts '===='~ - Inside source: true *** True Line Result - -** Processing line: ~ # The tick method is called by DragonRuby every frame~ + puts '====' +** Processing line: ~ puts '======'~ - Inside source: true *** True Line Result - # The tick method is called by DragonRuby every frame -** Processing line: ~ # args contains all the information regarding the game.~ + puts '======' +** Processing line: ~ puts '================================'~ - Inside source: true *** True Line Result - # args contains all the information regarding the game. -** Processing line: ~ def tick args~ + puts '================================' +** Processing line: ~ puts 'Hello World'~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays."~ + puts 'Hello World' +** Processing line: ~ puts '================================'~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays." -** Processing line: ~ # Here are some examples of simple labels, with the minimum number of parameters~ + puts '================================' +** Processing line: ~ puts '======'~ - Inside source: true *** True Line Result - # Here are some examples of simple labels, with the minimum number of parameters -** Processing line: ~ # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font~ + puts '======' +** Processing line: ~ puts '===='~ - Inside source: true *** True Line Result - # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font -** Processing line: ~ args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"]~ + puts '====' +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."] -** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."] -** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."] -** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."]~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."] +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # Demonstration of the Size Parameter~ -- Inside source: true -*** True Line Result - # Demonstration of the Size Parameter -** Processing line: ~ args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2] -** Processing line: ~ args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1] -** Processing line: ~ args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0] -** Processing line: ~ args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1] -** Processing line: ~ args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2] -** Processing line: ~~ -- Inside source: true +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - strings.txt~ +- Header detected. *** True Line Result -** Processing line: ~ # Demonstration of the Align Parameter~ -- Inside source: true *** True Line Result - # Demonstration of the Align Parameter -** Processing line: ~ args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2]~ -- Inside source: true +* Learn Ruby Optional - Intermediate Ruby Primer - strings.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2] -** Processing line: ~ args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1]~ -- Inside source: true + *** True Line Result - args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1] -** Processing line: ~ args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0]~ +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt~ - Inside source: true *** True Line Result - args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0] -** Processing line: ~~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ # Demonstration of the RGBA parameters~ + # ==================================================================================== +** Processing line: ~ # Strings~ - Inside source: true *** True Line Result - # Demonstration of the RGBA parameters -** Processing line: ~ args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0]~ + # Strings +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0] -** Processing line: ~ args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0]~ + # ==================================================================================== +** Processing line: ~ #~ - Inside source: true *** True Line Result - args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0] -** Processing line: ~ args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255]~ + # +** Processing line: ~ # Here is how you work with strings in Ruby. Take the text~ - Inside source: true *** True Line Result - args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255] -** Processing line: ~ args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128]~ + # Here is how you work with strings in Ruby. Take the text +** Processing line: ~ # in this file and paste it into repl.rb and save:~ - Inside source: true *** True Line Result - args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128] + # in this file and paste it into repl.rb and save: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Demonstration of the Font parameter~ -- Inside source: true -*** True Line Result - # Demonstration of the Font parameter -** Processing line: ~ # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is~ -- Inside source: true -*** True Line Result - # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is -** Processing line: ~ args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ]~ -- Inside source: true -*** True Line Result - args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ] -** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ -- Inside source: true -*** True Line Result - args.outputs.primitives << { x: 690 + 150, -** Processing line: ~ y: 330 - 50,~ -- Inside source: true -*** True Line Result - y: 330 - 50, -** Processing line: ~ text: "Custom font (Hash)",~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - text: "Custom font (Hash)", -** Processing line: ~ size_enum: 0,~ + repl do +** Processing line: ~ puts '* RUBY PRIMER: strings'~ - Inside source: true *** True Line Result - size_enum: 0, -** Processing line: ~ alignment_enum: 1,~ + puts '* RUBY PRIMER: strings' +** Processing line: ~ message = "Hello World"~ - Inside source: true *** True Line Result - alignment_enum: 1, -** Processing line: ~ r: 125,~ + message = "Hello World" +** Processing line: ~ puts "The value of message is: " + message~ - Inside source: true *** True Line Result - r: 125, -** Processing line: ~ g: 0,~ + puts "The value of message is: " + message +** Processing line: ~ puts "Any value can be interpolated within a string using \#{}."~ - Inside source: true *** True Line Result - g: 0, -** Processing line: ~ b: 200,~ + puts "Any value can be interpolated within a string using \#{}." +** Processing line: ~ puts "Interpolated message: #{message}."~ - Inside source: true *** True Line Result - b: 200, -** Processing line: ~ a: 255,~ + puts "Interpolated message: #{message}." +** Processing line: ~ puts 'This #{message} is not interpolated because the string uses single quotes.'~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ font: "manaspc.ttf" }.label~ + puts 'This #{message} is not interpolated because the string uses single quotes.' +** Processing line: ~ end~ - Inside source: true *** True Line Result - font: "manaspc.ttf" }.label + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Primitives can hold anything, and can be given a label in the following forms~ -- Inside source: true -*** True Line Result - # Primitives can hold anything, and can be given a label in the following forms -** Processing line: ~ args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ -- Inside source: true +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt~ +- Header detected. *** True Line Result - args.outputs.primitives << { x: 690 + 150, -** Processing line: ~ y: 330 - 110,~ -- Inside source: true + *** True Line Result - y: 330 - 110, -** Processing line: ~ text: "Custom font (.primitives Hash)",~ -- Inside source: true +* Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - text: "Custom font (.primitives Hash)", -** Processing line: ~ size_enum: 0,~ -- Inside source: true + *** True Line Result - size_enum: 0, -** Processing line: ~ alignment_enum: 1,~ +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt~ - Inside source: true *** True Line Result - alignment_enum: 1, -** Processing line: ~ r: 125,~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - r: 125, -** Processing line: ~ g: 0,~ + # ==================================================================================== +** Processing line: ~ # Numerics~ - Inside source: true *** True Line Result - g: 0, -** Processing line: ~ b: 200,~ + # Numerics +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - b: 200, -** Processing line: ~ a: 255,~ + # ==================================================================================== +** Processing line: ~ #~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ font: "manaspc.ttf" }.label~ + # +** Processing line: ~ # Here is how you work with numbers in Ruby. Take the text~ - Inside source: true *** True Line Result - font: "manaspc.ttf" }.label -** Processing line: ~ end~ + # Here is how you work with numbers in Ruby. Take the text +** Processing line: ~ # in this file and paste it into repl.rb and save:~ - Inside source: true *** True Line Result - end + # in this file and paste it into repl.rb and save: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ -- Inside source: true -*** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + repl do +** Processing line: ~ puts '* RUBY PRIMER: Fixnum and Floats'~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + puts '* RUBY PRIMER: Fixnum and Floats' +** Processing line: ~ a = 10~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + a = 10 +** Processing line: ~ puts "The value of a is: #{a}"~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + puts "The value of a is: #{a}" +** Processing line: ~ puts "a + 1 is: #{a + 1}"~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + puts "a + 1 is: #{a + 1}" +** Processing line: ~ puts "a / 3 is: #{a / 3}"~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + puts "a / 3 is: #{a / 3}" +** Processing line: ~ puts ''~ - Inside source: true *** True Line Result - end + puts '' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ b = 10.12~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + b = 10.12 +** Processing line: ~ puts "The value of b is: #{b}"~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + puts "The value of b is: #{b}" +** Processing line: ~ puts "b + 1 is: #{b + 1}"~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + puts "b + 1 is: #{b + 1}" +** Processing line: ~ puts "b as an integer is: #{b.to_i}"~ +- Inside source: true +*** True Line Result + puts "b as an integer is: #{b.to_i}" +** Processing line: ~ puts ''~ +- Inside source: true +*** True Line Result + puts '' ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8365,174 +8396,262 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 01_rendering_basics/02_lines/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt~ - Header detected. *** True Line Result *** True Line Result -* 01_rendering_basics/02_lines/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ + # ==================================================================================== +** Processing line: ~ # Booleans~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in a previous sample apps: + # Booleans +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # Here is how you work with numbers in Ruby. Take the text~ +- Inside source: true +*** True Line Result + # Here is how you work with numbers in Ruby. Take the text +** Processing line: ~ # in this file and paste it into repl.rb and save:~ +- Inside source: true +*** True Line Result + # in this file and paste it into repl.rb and save: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.lines: An array. Values in this array generate lines on~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - - args.outputs.lines: An array. Values in this array generate lines on -** Processing line: ~ the screen.~ + repl do +** Processing line: ~ puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)'~ - Inside source: true *** True Line Result - the screen. -** Processing line: ~ - args.state.tick_count: This property contains an integer value that~ + puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)' +** Processing line: ~ puts "Anything that *isn't* false or nil is true."~ - Inside source: true *** True Line Result - - args.state.tick_count: This property contains an integer value that -** Processing line: ~ represents the current frame. GTK renders at 60 FPS. A value of 0~ + puts "Anything that *isn't* false or nil is true." +** Processing line: ~~ - Inside source: true *** True Line Result - represents the current frame. GTK renders at 60 FPS. A value of 0 -** Processing line: ~ for args.state.tick_count represents the initial load of the game.~ + +** Processing line: ~ c = 30~ - Inside source: true *** True Line Result - for args.state.tick_count represents the initial load of the game. + c = 30 +** Processing line: ~ puts "The value of c is #{c}."~ +- Inside source: true +*** True Line Result + puts "The value of c is #{c}." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ if c~ - Inside source: true *** True Line Result - =end + if c +** Processing line: ~ puts "This if statement ran because c is truthy."~ +- Inside source: true +*** True Line Result + puts "This if statement ran because c is truthy." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The parameters required for lines are:~ +** Processing line: ~ d = false~ - Inside source: true *** True Line Result - # The parameters required for lines are: -** Processing line: ~ # 1. The initial point (x, y)~ + d = false +** Processing line: ~ puts "The value if d is #{d}. The type for d is #{d.class}."~ - Inside source: true *** True Line Result - # 1. The initial point (x, y) -** Processing line: ~ # 2. The end point (x2, y2)~ + puts "The value if d is #{d}. The type for d is #{d.class}." +** Processing line: ~~ - Inside source: true *** True Line Result - # 2. The end point (x2, y2) -** Processing line: ~ # 3. The rgba values for the color and transparency (r, g, b, a)~ + +** Processing line: ~ if !d~ - Inside source: true *** True Line Result - # 3. The rgba values for the color and transparency (r, g, b, a) + if !d +** Processing line: ~ puts "This if statement ran because d is falsey, using the not operator (!)."~ +- Inside source: true +*** True Line Result + puts "This if statement ran because d is falsey, using the not operator (!)." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # An example of creating a line would be:~ +** Processing line: ~ e = nil~ - Inside source: true *** True Line Result - # An example of creating a line would be: -** Processing line: ~ # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255]~ + e = nil +** Processing line: ~ puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}."~ - Inside source: true *** True Line Result - # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255] + puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This would create a line from (100, 100) to (300, 300)~ +** Processing line: ~ if !e~ - Inside source: true *** True Line Result - # This would create a line from (100, 100) to (300, 300) -** Processing line: ~ # The RGB code (255, 0, 255) would determine its color, a purple~ + if !e +** Processing line: ~ puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}."~ - Inside source: true *** True Line Result - # The RGB code (255, 0, 255) would determine its color, a purple -** Processing line: ~ # It would have an Alpha value of 255, making it completely opaque~ + puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # It would have an Alpha value of 255, making it completely opaque + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt~ +- Header detected. +*** True Line Result + +*** True Line Result +* Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to create lines."~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to create lines." + # ==================================================================================== +** Processing line: ~ # Conditionals~ +- Inside source: true +*** True Line Result + # Conditionals +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # Here is how you create conditionals in Ruby. Take the text~ +- Inside source: true +*** True Line Result + # Here is how you create conditionals in Ruby. Take the text +** Processing line: ~ # in this file and paste it into repl.rb and save:~ +- Inside source: true +*** True Line Result + # in this file and paste it into repl.rb and save: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"]~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"] + repl do +** Processing line: ~ puts "* RUBY PRIMER: Conditionals"~ +- Inside source: true +*** True Line Result + puts "* RUBY PRIMER: Conditionals" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Some simple lines~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Some simple lines -** Processing line: ~ args.outputs.lines << [380, 450, 675, 450]~ + # ==================================================================================== +** Processing line: ~ # if~ - Inside source: true *** True Line Result - args.outputs.lines << [380, 450, 675, 450] -** Processing line: ~ args.outputs.lines << [380, 410, 875, 410]~ + # if +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.outputs.lines << [380, 410, 875, 410] + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # These examples utilize args.state.tick_count to change the length of the lines over time~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # These examples utilize args.state.tick_count to change the length of the lines over time -** Processing line: ~ # args.state.tick_count is the ticks that have occurred in the game~ + repl do +** Processing line: ~ puts "** INFO: if statement"~ - Inside source: true *** True Line Result - # args.state.tick_count is the ticks that have occurred in the game -** Processing line: ~ # This is accomplished by making either the starting or ending point based on the args.state.tick_count~ + puts "** INFO: if statement" +** Processing line: ~ i_am_one = 1~ - Inside source: true *** True Line Result - # This is accomplished by making either the starting or ending point based on the args.state.tick_count -** Processing line: ~ args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255]~ + i_am_one = 1 +** Processing line: ~ if i_am_one~ - Inside source: true *** True Line Result - args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255] -** Processing line: ~ args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255]~ + if i_am_one +** Processing line: ~ puts "This was printed because i_am_one is truthy."~ - Inside source: true *** True Line Result - args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255] -** Processing line: ~ args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255]~ + puts "This was printed because i_am_one is truthy." +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255] + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8541,54 +8660,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + # ==================================================================================== +** Processing line: ~ # if/else~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + # if/else +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + repl do +** Processing line: ~ puts "** INFO: if/else statement"~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + puts "** INFO: if/else statement" +** Processing line: ~ i_am_false = false~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + i_am_false = false +** Processing line: ~ if i_am_false~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if i_am_false +** Processing line: ~ puts "This will NOT get printed because i_am_false is false."~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + puts "This will NOT get printed because i_am_false is false." +** Processing line: ~ else~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + else +** Processing line: ~ puts "This was printed because i_am_false is false."~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + puts "This was printed because i_am_false is false." +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8597,230 +8716,250 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src ** Processing line: ~~ -- End of paragraph detected. +- Inside source: true *** True Line Result -** Processing line: ~* 01_rendering_basics/03_solids_borders/app/main.rb~ -- Header detected. +** Processing line: ~ # ====================================================================================~ +- Inside source: true *** True Line Result - + # ==================================================================================== +** Processing line: ~ # if/elsif/else~ +- Inside source: true *** True Line Result -* 01_rendering_basics/03_solids_borders/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + # if/elsif/else +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ repl do~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + repl do +** Processing line: ~ puts "** INFO: if/elsif/else statement"~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + puts "** INFO: if/elsif/else statement" +** Processing line: ~ i_am_false = false~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ + i_am_false = false +** Processing line: ~ i_am_true = true~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in a previous sample apps: -** Processing line: ~~ + i_am_true = true +** Processing line: ~ if i_am_false~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.solids: An array. Values in this array generate~ + if i_am_false +** Processing line: ~ puts "This will NOT get printed because i_am_false is false."~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. Values in this array generate -** Processing line: ~ solid/filled rectangles on the screen.~ + puts "This will NOT get printed because i_am_false is false." +** Processing line: ~ elsif i_am_true~ - Inside source: true *** True Line Result - solid/filled rectangles on the screen. -** Processing line: ~~ + elsif i_am_true +** Processing line: ~ puts "This was printed because i_am_true is true."~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + puts "This was printed because i_am_true is true." +** Processing line: ~ else~ - Inside source: true *** True Line Result - =end + else +** Processing line: ~ puts "This will NOT get printed i_am_true was true."~ +- Inside source: true +*** True Line Result + puts "This will NOT get printed i_am_true was true." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Rects are outputted in DragonRuby as rectangles~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Rects are outputted in DragonRuby as rectangles -** Processing line: ~ # If filled in, they are solids~ + # ==================================================================================== +** Processing line: ~ # case~ - Inside source: true *** True Line Result - # If filled in, they are solids -** Processing line: ~ # If hollow, they are borders~ + # case +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # If hollow, they are borders + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Solids are added to args.outputs.solids~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # Solids are added to args.outputs.solids -** Processing line: ~ # Borders are added to args.outputs.borders~ + repl do +** Processing line: ~ puts "** INFO case statement"~ - Inside source: true *** True Line Result - # Borders are added to args.outputs.borders -** Processing line: ~~ + puts "** INFO case statement" +** Processing line: ~ i_am_one = 1 # change this value to see different results~ - Inside source: true *** True Line Result - -** Processing line: ~ # The parameters required for rects are:~ + i_am_one = 1 # change this value to see different results +** Processing line: ~~ - Inside source: true *** True Line Result - # The parameters required for rects are: -** Processing line: ~ # 1. The upper right corner (x, y)~ + +** Processing line: ~ case i_am_one~ - Inside source: true *** True Line Result - # 1. The upper right corner (x, y) -** Processing line: ~ # 2. The width (w)~ + case i_am_one +** Processing line: ~ when 10~ - Inside source: true *** True Line Result - # 2. The width (w) -** Processing line: ~ # 3. The height (h)~ + when 10 +** Processing line: ~ puts "the value of i_am_one is 10"~ - Inside source: true *** True Line Result - # 3. The height (h) -** Processing line: ~ # 4. The rgba values for the color and transparency (r, g, b, a)~ + puts "the value of i_am_one is 10" +** Processing line: ~ when 9~ - Inside source: true *** True Line Result - # 4. The rgba values for the color and transparency (r, g, b, a) -** Processing line: ~~ + when 9 +** Processing line: ~ puts "the value of i_am_one is 9"~ - Inside source: true *** True Line Result - -** Processing line: ~ # Here is an example of a rect definition:~ + puts "the value of i_am_one is 9" +** Processing line: ~ when 5~ - Inside source: true *** True Line Result - # Here is an example of a rect definition: -** Processing line: ~ # [100, 100, 400, 500, 0, 255, 0, 180]~ + when 5 +** Processing line: ~ puts "the value of i_am_one is 5"~ - Inside source: true *** True Line Result - # [100, 100, 400, 500, 0, 255, 0, 180] -** Processing line: ~~ + puts "the value of i_am_one is 5" +** Processing line: ~ when 1~ - Inside source: true *** True Line Result - -** Processing line: ~ # The example would create a rect from (100, 100)~ + when 1 +** Processing line: ~ puts "the value of i_am_one is 1"~ - Inside source: true *** True Line Result - # The example would create a rect from (100, 100) -** Processing line: ~ # Extending 400 pixels across the x axis~ + puts "the value of i_am_one is 1" +** Processing line: ~ else~ - Inside source: true *** True Line Result - # Extending 400 pixels across the x axis -** Processing line: ~ # and 500 pixels across the y axis~ + else +** Processing line: ~ puts "Value wasn't cased."~ - Inside source: true *** True Line Result - # and 500 pixels across the y axis -** Processing line: ~ # The rect would be green (0, 255, 0)~ + puts "Value wasn't cased." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # The rect would be green (0, 255, 0) -** Processing line: ~ # and mostly opaque with some transparency (180)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # and mostly opaque with some transparency (180) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Whether the rect would be filled or not depends on if~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Whether the rect would be filled or not depends on if -** Processing line: ~ # it is added to args.outputs.solids or args.outputs.borders~ + # ==================================================================================== +** Processing line: ~ # comparison operators~ - Inside source: true *** True Line Result - # it is added to args.outputs.solids or args.outputs.borders -** Processing line: ~~ + # comparison operators +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to create solid squares."~ + repl do +** Processing line: ~ puts "** INFO: Different types of comparisons"~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to create solid squares." -** Processing line: ~ args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"]~ + puts "** INFO: Different types of comparisons" +** Processing line: ~ if 4 == 4~ - Inside source: true *** True Line Result - args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"] -** Processing line: ~ args.outputs.solids << [470, 520, 50, 50]~ + if 4 == 4 +** Processing line: ~ puts "4 equals 4 (==)"~ - Inside source: true *** True Line Result - args.outputs.solids << [470, 520, 50, 50] -** Processing line: ~ args.outputs.solids << [530, 520, 50, 50, 0, 0, 0]~ + puts "4 equals 4 (==)" +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.solids << [530, 520, 50, 50, 0, 0, 0] -** Processing line: ~ args.outputs.solids << [590, 520, 50, 50, 255, 0, 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.solids << [590, 520, 50, 50, 255, 0, 0] -** Processing line: ~ args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128]~ + +** Processing line: ~ if 4 != 3~ - Inside source: true *** True Line Result - args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128] -** Processing line: ~ args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ + if 4 != 3 +** Processing line: ~ puts "4 does not equal 3 (!=)"~ - Inside source: true *** True Line Result - args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] -** Processing line: ~~ + puts "4 does not equal 3 (!=)" +** Processing line: ~ end~ - Inside source: true *** True Line Result - + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"]~ +** Processing line: ~ if 3 < 4~ - Inside source: true *** True Line Result - args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"] -** Processing line: ~ args.outputs.borders << [470, 320, 50, 50]~ + if 3 < 4 +** Processing line: ~ puts "3 is less than 4 (<)"~ - Inside source: true *** True Line Result - args.outputs.borders << [470, 320, 50, 50] -** Processing line: ~ args.outputs.borders << [530, 320, 50, 50, 0, 0, 0]~ + puts "3 is less than 4 (<)" +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.borders << [530, 320, 50, 50, 0, 0, 0] -** Processing line: ~ args.outputs.borders << [590, 320, 50, 50, 255, 0, 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.borders << [590, 320, 50, 50, 255, 0, 0] -** Processing line: ~ args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128]~ + +** Processing line: ~ if 4 > 3~ - Inside source: true *** True Line Result - args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128] -** Processing line: ~ args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ + if 4 > 3 +** Processing line: ~ puts "4 is greater than 3 (>)"~ - Inside source: true *** True Line Result - args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] + puts "4 is greater than 3 (>)" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8829,34 +8968,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + # ==================================================================================== +** Processing line: ~ # and/or conditionals~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + # and/or conditionals +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + repl do +** Processing line: ~ puts "** INFO: AND, OR operator (&&, ||)"~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + puts "** INFO: AND, OR operator (&&, ||)" +** Processing line: ~ if (4 > 3) || (3 < 4) || false~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + if (4 > 3) || (3 < 4) || false +** Processing line: ~ puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)"~ +- Inside source: true +*** True Line Result + puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8865,18 +9008,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ if (4 > 3) && (3 < 4)~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + if (4 > 3) && (3 < 4) +** Processing line: ~ puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)"~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)" +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -8893,130 +9036,174 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 01_rendering_basics/04_sprites/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - looping.txt~ - Header detected. *** True Line Result *** True Line Result -* 01_rendering_basics/04_sprites/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - looping.txt ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ + # ==================================================================================== +** Processing line: ~ # Looping~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in a previous sample apps: -** Processing line: ~~ + # Looping +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate~ + # ==================================================================================== +** Processing line: ~ #~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. Values in this array generate -** Processing line: ~ sprites on the screen. The location of the sprite is assumed to~ + # +** Processing line: ~ # Looping looks a whole lot different than other languages.~ - Inside source: true *** True Line Result - sprites on the screen. The location of the sprite is assumed to -** Processing line: ~ be under the mygame/ directory (the exception being dragonruby.png).~ + # Looping looks a whole lot different than other languages. +** Processing line: ~ # But it's pretty awesome when you get used to it.~ - Inside source: true *** True Line Result - be under the mygame/ directory (the exception being dragonruby.png). + # But it's pretty awesome when you get used to it. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - =end + repl do +** Processing line: ~ puts "* RUBY PRIMER: Loops"~ +- Inside source: true +*** True Line Result + puts "* RUBY PRIMER: Loops" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== +** Processing line: ~ # times~ +- Inside source: true +*** True Line Result + # times +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # For all other display outputs, Sprites are your solution~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # For all other display outputs, Sprites are your solution -** Processing line: ~ # Sprites import images and display them with a certain rectangular area~ + repl do +** Processing line: ~ puts "** INFO: ~Numeric#times~ (for loop)"~ - Inside source: true *** True Line Result - # Sprites import images and display them with a certain rectangular area -** Processing line: ~ # The image can be of any usual format and should be located within the folder,~ + puts "** INFO: ~Numeric#times~ (for loop)" +** Processing line: ~ 3.times do |i|~ - Inside source: true *** True Line Result - # The image can be of any usual format and should be located within the folder, -** Processing line: ~ # similar to additional fonts.~ + 3.times do |i| +** Processing line: ~ puts i~ - Inside source: true *** True Line Result - # similar to additional fonts. -** Processing line: ~~ + puts i +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sprites have the following parameters~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Sprites have the following parameters -** Processing line: ~ # Rectangular area (x, y, width, height)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Rectangular area (x, y, width, height) -** Processing line: ~ # The image (path)~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # The image (path) -** Processing line: ~ # Rotation (angle)~ + # ==================================================================================== +** Processing line: ~ # foreach~ - Inside source: true *** True Line Result - # Rotation (angle) -** Processing line: ~ # Alpha (a)~ + # foreach +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Alpha (a) + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it."~ + repl do +** Processing line: ~ puts "** INFO: ~Array#each~ (for each loop)"~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it." -** Processing line: ~ args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"]~ + puts "** INFO: ~Array#each~ (for each loop)" +** Processing line: ~ array = ["a", "b", "c", "d"]~ - Inside source: true *** True Line Result - args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"] -** Processing line: ~ args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png']~ + array = ["a", "b", "c", "d"] +** Processing line: ~ array.each do |char|~ - Inside source: true *** True Line Result - args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png'] -** Processing line: ~ args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360]~ + array.each do |char| +** Processing line: ~ puts char~ - Inside source: true *** True Line Result - args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360] -** Processing line: ~ args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255]~ + puts char +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255] + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ puts "** INFO: ~Array#each_with_index~ (for each loop)"~ +- Inside source: true +*** True Line Result + puts "** INFO: ~Array#each_with_index~ (for each loop)" +** Processing line: ~ array = ["a", "b", "c", "d"]~ +- Inside source: true +*** True Line Result + array = ["a", "b", "c", "d"] +** Processing line: ~ array.each do |char, i|~ +- Inside source: true +*** True Line Result + array.each do |char, i| +** Processing line: ~ puts "index #{i}: #{char}"~ +- Inside source: true +*** True Line Result + puts "index #{i}: #{char}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9025,34 +9212,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + # ==================================================================================== +** Processing line: ~ # ranges~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + # ranges +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + repl do +** Processing line: ~ puts "** INFO: range block exclusive (three dots)"~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + puts "** INFO: range block exclusive (three dots)" +** Processing line: ~ (0...3).each do |i|~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + (0...3).each do |i| +** Processing line: ~ puts i~ +- Inside source: true +*** True Line Result + puts i ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9061,18 +9252,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ puts "** INFO: range block inclusive (two dots)"~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + puts "** INFO: range block inclusive (two dots)" +** Processing line: ~ (0..3).each do |i|~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + (0..3).each do |i| +** Processing line: ~ puts i~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + puts i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9089,230 +9284,230 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 01_rendering_basics/05_sounds/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - functions.txt~ - Header detected. *** True Line Result *** True Line Result -* 01_rendering_basics/05_sounds/app/main.rb +* Learn Ruby Optional - Intermediate Ruby Primer - functions.txt ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs Listing that haven't been encountered in previous sample apps:~ + # ==================================================================================== +** Processing line: ~ # Functions~ - Inside source: true *** True Line Result - APIs Listing that haven't been encountered in previous sample apps: -** Processing line: ~~ + # Functions +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ - sample: Chooses random element from array.~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - - sample: Chooses random element from array. -** Processing line: ~ In this sample app, the target note is set by taking a sample from the collection~ + +** Processing line: ~ # The last statement of a function is implictly returned. Parenthesis for functions~ - Inside source: true *** True Line Result - In this sample app, the target note is set by taking a sample from the collection -** Processing line: ~ of available notes.~ + # The last statement of a function is implictly returned. Parenthesis for functions +** Processing line: ~ # are optional as long as the statement can be envaluated disambiguously.~ - Inside source: true *** True Line Result - of available notes. + # are optional as long as the statement can be envaluated disambiguously. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ + repl do +** Processing line: ~ puts "* RUBY PRIMER: Functions"~ - Inside source: true *** True Line Result - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ + puts "* RUBY PRIMER: Functions" +** Processing line: ~ end~ - Inside source: true *** True Line Result - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ + # ==================================================================================== +** Processing line: ~ # Functions single parameter~ - Inside source: true *** True Line Result - For example, if we want to create a new button, we would declare it as a new entity and -** Processing line: ~ then define its properties.~ + # Functions single parameter +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - then define its properties. + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + repl do +** Processing line: ~ puts "* INFO: Function with one parameter"~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + puts "* INFO: Function with one parameter" ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ # function definition~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # function definition +** Processing line: ~ def add_one_to n~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ -- Inside source: true -*** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + def add_one_to n +** Processing line: ~ n + 1~ - Inside source: true *** True Line Result - -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ + n + 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - first: Returns the first element of an array.~ +** Processing line: ~ # Parenthesis are optional in Ruby as long as the~ - Inside source: true *** True Line Result - - first: Returns the first element of an array. -** Processing line: ~~ + # Parenthesis are optional in Ruby as long as the +** Processing line: ~ # parsing is disambiguous. Here are a couple of variations.~ - Inside source: true *** True Line Result - -** Processing line: ~ - inside_rect: Returns true or false depending on if the point is inside the rect.~ + # parsing is disambiguous. Here are a couple of variations. +** Processing line: ~ # Generally speaking, don't put parenthesis is you don't have to.~ - Inside source: true *** True Line Result - - inside_rect: Returns true or false depending on if the point is inside the rect. + # Generally speaking, don't put parenthesis is you don't have to. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - to_sym: Returns symbol corresponding to string. Will create a symbol if it does~ +** Processing line: ~ # Conventional Usage of Parenthesis.~ - Inside source: true *** True Line Result - - to_sym: Returns symbol corresponding to string. Will create a symbol if it does -** Processing line: ~ not already exist.~ + # Conventional Usage of Parenthesis. +** Processing line: ~ puts add_one_to(3)~ - Inside source: true *** True Line Result - not already exist. + puts add_one_to(3) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ # DragonRuby's recommended use of parenthesis (inner function has parenthesis).~ - Inside source: true *** True Line Result - =end + # DragonRuby's recommended use of parenthesis (inner function has parenthesis). +** Processing line: ~ puts (add_one_to 3)~ +- Inside source: true +*** True Line Result + puts (add_one_to 3) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app allows users to test their musical skills by matching the piano sound that plays in each~ +** Processing line: ~ # Full parens.~ - Inside source: true *** True Line Result - # This sample app allows users to test their musical skills by matching the piano sound that plays in each -** Processing line: ~ # level to the correct note.~ + # Full parens. +** Processing line: ~ puts(add_one_to(3))~ - Inside source: true *** True Line Result - # level to the correct note. + puts(add_one_to(3)) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ -- Inside source: true -*** True Line Result - # Runs all the methods necessary for the game to function properly. -** Processing line: ~ def tick args~ +** Processing line: ~ # Outer function has parenthesis~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ defaults args~ + # Outer function has parenthesis +** Processing line: ~ puts(add_one_to 3)~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render args~ + puts(add_one_to 3) +** Processing line: ~ end~ - Inside source: true *** True Line Result - render args -** Processing line: ~ calc args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ input_mouse args~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - input_mouse args -** Processing line: ~ tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\""~ + # ==================================================================================== +** Processing line: ~ # Functions with default parameter values~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\"" -** Processing line: ~ end~ + # Functions with default parameter values +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - end + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values and creates empty collections~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # Sets default values and creates empty collections -** Processing line: ~ # Initialization happens in the first frame only~ + repl do +** Processing line: ~ puts "* INFO: Function with default value"~ - Inside source: true *** True Line Result - # Initialization happens in the first frame only -** Processing line: ~ def defaults _~ + puts "* INFO: Function with default value" +** Processing line: ~ def function_with_default_value v = 10~ - Inside source: true *** True Line Result - def defaults _ -** Processing line: ~ _.state.notes ||= []~ + def function_with_default_value v = 10 +** Processing line: ~ v * 10~ - Inside source: true *** True Line Result - _.state.notes ||= [] -** Processing line: ~ _.state.click_feedbacks ||= []~ + v * 10 +** Processing line: ~ end~ - Inside source: true *** True Line Result - _.state.click_feedbacks ||= [] -** Processing line: ~ _.state.current_level ||= 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - _.state.current_level ||= 1 -** Processing line: ~ _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet~ + +** Processing line: ~ puts "Passing the argument three yields: #{function_with_default_value 3}"~ - Inside source: true *** True Line Result - _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet + puts "Passing the argument three yields: #{function_with_default_value 3}" +** Processing line: ~ puts "Passing no argument yields: #{function_with_default_value}"~ +- Inside source: true +*** True Line Result + puts "Passing no argument yields: #{function_with_default_value}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9321,146 +9516,166 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Uses a label to display current level, and shows the score~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Uses a label to display current level, and shows the score -** Processing line: ~ # Creates a button to play the sample note, and displays the available notes that could be a potential match~ + # ==================================================================================== +** Processing line: ~ # Nil default parameter value and ||= operator.~ - Inside source: true *** True Line Result - # Creates a button to play the sample note, and displays the available notes that could be a potential match -** Processing line: ~ def render _~ + # Nil default parameter value and ||= operator. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def render _ + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # grid.w_half positions the label in the horizontal center of the screen.~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # grid.w_half positions the label in the horizontal center of the screen. -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0]~ + repl do +** Processing line: ~ puts "* INFO: Using the OR EQUAL operator (||=)"~ - Inside source: true *** True Line Result - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0] -** Processing line: ~~ + puts "* INFO: Using the OR EQUAL operator (||=)" +** Processing line: ~ def function_with_nil_default_with_local a = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ render_score _ # shows score on screen~ + def function_with_nil_default_with_local a = nil +** Processing line: ~ result = a~ - Inside source: true *** True Line Result - render_score _ # shows score on screen -** Processing line: ~~ + result = a +** Processing line: ~ result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE"~ - Inside source: true *** True Line Result - -** Processing line: ~ if _.state.game_over # if game is over, a "play again" button is shown~ + result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE" +** Processing line: ~ "value is #{result}."~ - Inside source: true *** True Line Result - if _.state.game_over # if game is over, a "play again" button is shown -** Processing line: ~ # Calculations ensure that Play Again label is displayed in center of border~ + "value is #{result}." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Calculations ensure that Play Again label is displayed in center of border -** Processing line: ~ # Remove calculations from y parameters and see what happens to border and label placement~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Remove calculations from y parameters and see what happens to border and label placement -** Processing line: ~ _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title~ + +** Processing line: ~ puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}"~ - Inside source: true *** True Line Result - _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label~ + puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}" +** Processing line: ~ puts "Passing nil: #{function_with_nil_default_with_local}"~ - Inside source: true *** True Line Result - _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label -** Processing line: ~ _.outputs.borders << _.state.play_again_border # outputs border~ + puts "Passing nil: #{function_with_nil_default_with_local}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - _.outputs.borders << _.state.play_again_border # outputs border -** Processing line: ~ else # otherwise, if game is not over~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else # otherwise, if game is not over -** Processing line: ~ # Calculations ensure that label appears in center of border~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - # Calculations ensure that label appears in center of border -** Processing line: ~ _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label~ -- Inside source: true + +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt~ +- Header detected. *** True Line Result - _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label -** Processing line: ~ _.outputs.borders << _.state.play_note_border # outputs border~ + +*** True Line Result +* Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt~ - Inside source: true *** True Line Result - _.outputs.borders << _.state.play_note_border # outputs border -** Processing line: ~ end~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ==================================================================================== +** Processing line: ~ # Arrays~ - Inside source: true *** True Line Result - -** Processing line: ~ return if _.state.game_over # return if game is over~ + # Arrays +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - return if _.state.game_over # return if game is over + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label~ +** Processing line: ~ # Arrays are incredibly powerful in Ruby. Learn to use them well.~ - Inside source: true *** True Line Result - _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label + # Arrays are incredibly powerful in Ruby. Learn to use them well. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Shows all of the available notes that can be potential matches.~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # Shows all of the available notes that can be potential matches. -** Processing line: ~ available_notes.each_with_index do |note, i|~ + repl do +** Processing line: ~ puts "* RUBY PRIMER: ARRAYS"~ - Inside source: true *** True Line Result - available_notes.each_with_index do |note, i| -** Processing line: ~ _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border)~ + puts "* RUBY PRIMER: ARRAYS" +** Processing line: ~ end~ - Inside source: true *** True Line Result - _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border) -** Processing line: ~ _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border -** Processing line: ~ _.outputs.borders << _.state.notes[i].border~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - _.outputs.borders << _.state.notes[i].border -** Processing line: ~ end~ + # ==================================================================================== +** Processing line: ~ # Enumerable ranges and .to_a~ - Inside source: true *** True Line Result - end + # Enumerable ranges and .to_a +** Processing line: ~ # ====================================================================================~ +- Inside source: true +*** True Line Result + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Shows whether or not the user is correct by filling the screen with either red or green~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # Shows whether or not the user is correct by filling the screen with either red or green -** Processing line: ~ _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid }~ + repl do +** Processing line: ~ puts "** INFO: Create an array with the numbers 1 to 10."~ - Inside source: true *** True Line Result - _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid } + puts "** INFO: Create an array with the numbers 1 to 10." +** Processing line: ~ one_to_ten = (1..10).to_a~ +- Inside source: true +*** True Line Result + one_to_ten = (1..10).to_a +** Processing line: ~ puts one_to_ten~ +- Inside source: true +*** True Line Result + puts one_to_ten ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9469,66 +9684,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows the score (number of times the user guesses wrong) onto the screen using labels.~ -- Inside source: true -*** True Line Result - # Shows the score (number of times the user guesses wrong) onto the screen using labels. -** Processing line: ~ def render_score _~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def render_score _ -** Processing line: ~ if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par~ + # ==================================================================================== +** Processing line: ~ # Finding elements~ - Inside source: true *** True Line Result - if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0]~ + # Finding elements +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0] -** Processing line: ~ else # otherwise, number of times the user has guessed wrong is shown~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - else # otherwise, number of times the user has guessed wrong is shown -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation -** Processing line: ~ end~ + repl do +** Processing line: ~ puts "** INFO: Finding elements in an array using ~Array#find_all~."~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + puts "** INFO: Finding elements in an array using ~Array#find_all~." +** Processing line: ~ puts "Create a new array that only contains even numbers from the previous array."~ - Inside source: true *** True Line Result - end + puts "Create a new array that only contains even numbers from the previous array." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the target note for the level and performs calculations on click_feedbacks.~ +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - # Sets the target note for the level and performs calculations on click_feedbacks. -** Processing line: ~ def calc _~ + one_to_ten = (1..10).to_a +** Processing line: ~ evens = one_to_ten.find_all do |number|~ - Inside source: true *** True Line Result - def calc _ -** Processing line: ~ _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note~ + evens = one_to_ten.find_all do |number| +** Processing line: ~ number % 2 == 0~ - Inside source: true *** True Line Result - _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note -** Processing line: ~ _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely~ + number % 2 == 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely -** Processing line: ~ # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection -** Processing line: ~ _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 }~ + +** Processing line: ~ puts evens~ - Inside source: true *** True Line Result - _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 } + puts evens ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9537,174 +9748,198 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Uses input from the user to play the target note, as well as the other notes that could be a potential match.~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Uses input from the user to play the target note, as well as the other notes that could be a potential match. -** Processing line: ~ def input_mouse _~ + # ==================================================================================== +** Processing line: ~ # Rejecting elements~ - Inside source: true *** True Line Result - def input_mouse _ -** Processing line: ~ return unless _.inputs.mouse.click # return unless the mouse is clicked~ + # Rejecting elements +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - return unless _.inputs.mouse.click # return unless the mouse is clicked + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # finds button that was clicked by user~ -- Inside source: true -*** True Line Result - # finds button that was clicked by user -** Processing line: ~ button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements -** Processing line: ~ _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of~ + repl do +** Processing line: ~ puts "** INFO: Removing elements in an array using ~Array#reject~."~ - Inside source: true *** True Line Result - _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of -** Processing line: ~ end.reject {|b| !_.state.meta(b)}.first # reject, return first element~ + puts "** INFO: Removing elements in an array using ~Array#reject~." +** Processing line: ~ puts "Create a new array that rejects odd numbers."~ - Inside source: true *** True Line Result - end.reject {|b| !_.state.meta(b)}.first # reject, return first element + puts "Create a new array that rejects odd numbers." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return unless button_clicked # return unless button_clicked as a value (a button was clicked)~ +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - return unless button_clicked # return unless button_clicked as a value (a button was clicked) + one_to_ten = (1..10).to_a +** Processing line: ~ also_even = one_to_ten.reject do |number|~ +- Inside source: true +*** True Line Result + also_even = one_to_ten.reject do |number| +** Processing line: ~ number % 2 != 0~ +- Inside source: true +*** True Line Result + number % 2 != 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked~ +** Processing line: ~ puts also_even~ - Inside source: true *** True Line Result - queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked -** Processing line: ~ button_clicked.x,~ + puts also_even +** Processing line: ~ end~ - Inside source: true *** True Line Result - button_clicked.x, -** Processing line: ~ button_clicked.y,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - button_clicked.y, -** Processing line: ~ button_clicked.w,~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - button_clicked.w, -** Processing line: ~ button_clicked.h,~ + # ==================================================================================== +** Processing line: ~ # Array transform using the map function.~ - Inside source: true *** True Line Result - button_clicked.h, -** Processing line: ~ 150, 100, 200 # sets color of button to shade of purple~ + # Array transform using the map function. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - 150, 100, 200 # sets color of button to shade of purple + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed -** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output~ + repl do +** Processing line: ~ puts "** INFO: Creating new derived values from an array using ~Array#map~."~ - Inside source: true *** True Line Result - _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output -** Processing line: ~ elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed~ + puts "** INFO: Creating new derived values from an array using ~Array#map~." +** Processing line: ~ puts "Create an array that doubles every number."~ - Inside source: true *** True Line Result - elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed -** Processing line: ~ _.state.target_note = nil # no target note~ + puts "Create an array that doubles every number." +** Processing line: ~~ - Inside source: true *** True Line Result - _.state.target_note = nil # no target note -** Processing line: ~ _.state.current_level = 1 # starts at level 1 again~ + +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - _.state.current_level = 1 # starts at level 1 again -** Processing line: ~ _.state.times_wrong = 0 # starts off with 0 wrong guesses~ + one_to_ten = (1..10).to_a +** Processing line: ~ doubled = one_to_ten.map do |number|~ - Inside source: true *** True Line Result - _.state.times_wrong = 0 # starts off with 0 wrong guesses -** Processing line: ~ _.state.game_over = false # the game is not over (because it has just been restarted)~ + doubled = one_to_ten.map do |number| +** Processing line: ~ number * 2~ - Inside source: true *** True Line Result - _.state.game_over = false # the game is not over (because it has just been restarted) -** Processing line: ~ else # otherwise if neither of those buttons were pressed~ + number * 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - else # otherwise if neither of those buttons were pressed -** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played -** Processing line: ~ if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note~ + +** Processing line: ~ puts doubled~ - Inside source: true *** True Line Result - if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note -** Processing line: ~ _.state.target_note = nil # target note is emptied~ + puts doubled +** Processing line: ~ end~ - Inside source: true *** True Line Result - _.state.target_note = nil # target note is emptied + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if _.state.current_level < 9 # if game hasn't reached level 9~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - if _.state.current_level < 9 # if game hasn't reached level 9 -** Processing line: ~ _.state.current_level += 1 # game goes to next level~ + # ==================================================================================== +** Processing line: ~ # Combining array functions.~ - Inside source: true *** True Line Result - _.state.current_level += 1 # game goes to next level -** Processing line: ~ else # otherwise, if game has reached level 9~ + # Combining array functions. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - else # otherwise, if game has reached level 9 -** Processing line: ~ _.state.game_over = true # the game is over~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - _.state.game_over = true # the game is over -** Processing line: ~ end~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - end + repl do +** Processing line: ~ puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~."~ +- Inside source: true +*** True Line Result + puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~." +** Processing line: ~ puts "Create an array that selects only odd numbers and then multiply those by 10."~ +- Inside source: true +*** True Line Result + puts "Create an array that selects only odd numbers and then multiply those by 10." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly~ +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly -** Processing line: ~ else # otherwise, if clicked note is not target note~ + one_to_ten = (1..10).to_a +** Processing line: ~ odd_doubled = one_to_ten.find_all do |number|~ - Inside source: true *** True Line Result - else # otherwise, if clicked note is not target note -** Processing line: ~ _.state.times_wrong += 1 # increments times user guessed wrong~ + odd_doubled = one_to_ten.find_all do |number| +** Processing line: ~ number % 2 != 0~ - Inside source: true *** True Line Result - _.state.times_wrong += 1 # increments times user guessed wrong -** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong~ + number % 2 != 0 +** Processing line: ~ end.map do |odd_number|~ - Inside source: true *** True Line Result - queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong -** Processing line: ~ end~ + end.map do |odd_number| +** Processing line: ~ odd_number * 10~ - Inside source: true *** True Line Result - end + odd_number * 10 ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ puts odd_doubled~ +- Inside source: true +*** True Line Result + puts odd_doubled ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9713,50 +9948,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates a collection of all of the available notes as symbols~ -- Inside source: true -*** True Line Result - # Creates a collection of all of the available notes as symbols -** Processing line: ~ def available_notes~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - def available_notes -** Processing line: ~ [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]~ + # ==================================================================================== +** Processing line: ~ # Product function.~ - Inside source: true *** True Line Result - [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4] -** Processing line: ~ end~ + # Product function. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - end + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates buttons for each note, and sets a label (the note's name) and border for each note's button.~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # Creates buttons for each note, and sets a label (the note's name) and border for each note's button. -** Processing line: ~ def piano_button _, note, position~ + repl do +** Processing line: ~ puts "** INFO: Create all combinations of array values using ~Array#product~."~ - Inside source: true *** True Line Result - def piano_button _, note, position -** Processing line: ~ _.state.new_entity(:button) do |b| # declares button as new entity~ + puts "** INFO: Create all combinations of array values using ~Array#product~." +** Processing line: ~ puts "All two-item pairs of numbers 1 to 10."~ - Inside source: true *** True Line Result - _.state.new_entity(:button) do |b| # declares button as new entity -** Processing line: ~ b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition~ + puts "All two-item pairs of numbers 1 to 10." +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition -** Processing line: ~ b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border~ + one_to_ten = (1..10).to_a +** Processing line: ~ all_combinations = one_to_ten.product(one_to_ten)~ - Inside source: true *** True Line Result - b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border -** Processing line: ~ end~ + all_combinations = one_to_ten.product(one_to_ten) +** Processing line: ~ puts all_combinations~ - Inside source: true *** True Line Result - end + puts all_combinations ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -9765,258 +9996,270 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong -** Processing line: ~ # If a button is clicked, the inside of button is purple (see input_mouse method)~ + # ==================================================================================== +** Processing line: ~ # Uniq and sort function.~ - Inside source: true *** True Line Result - # If a button is clicked, the inside of button is purple (see input_mouse method) -** Processing line: ~ # If correct note is clicked, screen turns green~ + # Uniq and sort function. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # If correct note is clicked, screen turns green -** Processing line: ~ # If incorrect note is clicked, screen turns red (again, see input_mouse method)~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - # If incorrect note is clicked, screen turns red (again, see input_mouse method) -** Processing line: ~ def queue_click_feedback _, x, y, w, h, *color~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - def queue_click_feedback _, x, y, w, h, *color -** Processing line: ~ _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity~ + repl do +** Processing line: ~ puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~."~ - Inside source: true *** True Line Result - _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity -** Processing line: ~ c.solid = [x, y, w, h, *color, 255] # sets color~ + puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~." +** Processing line: ~ puts "All uniq combinations of numbers regardless of order."~ - Inside source: true *** True Line Result - c.solid = [x, y, w, h, *color, 255] # sets color -** Processing line: ~ end~ + puts "All uniq combinations of numbers regardless of order." +** Processing line: ~ puts "For example: [1, 2] is the same as [2, 1]."~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + puts "For example: [1, 2] is the same as [2, 1]." +** Processing line: ~ one_to_ten = (1..10).to_a~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + one_to_ten = (1..10).to_a +** Processing line: ~ uniq_combinations =~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_instructions args, text, y = 715~ + uniq_combinations = +** Processing line: ~ one_to_ten.product(one_to_ten)~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + one_to_ten.product(one_to_ten) +** Processing line: ~ .map do |unsorted_number|~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + .map do |unsorted_number| +** Processing line: ~ unsorted_number.sort~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + unsorted_number.sort +** Processing line: ~ end.uniq~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + end.uniq +** Processing line: ~ puts uniq_combinations~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + puts uniq_combinations +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ==================================================================================== +** Processing line: ~ # Example of an advanced array transform.~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + # Example of an advanced array transform. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + repl do +** Processing line: ~ puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~."~ - Inside source: true *** True Line Result - end + puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~." +** Processing line: ~ puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle."~ +- Inside source: true +*** True Line Result + puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ one_to_hundred = (1..100).to_a~ +- Inside source: true *** True Line Result -#+end_src + one_to_hundred = (1..100).to_a ** Processing line: ~~ -- End of paragraph detected. +- Inside source: true *** True Line Result -** Processing line: ~* 02_input_basics/01_keyboard/app/main.rb~ -- Header detected. +** Processing line: ~ triples =~ +- Inside source: true *** True Line Result - + triples = +** Processing line: ~ one_to_hundred.product(one_to_hundred).map do |width, height|~ +- Inside source: true *** True Line Result -* 02_input_basics/01_keyboard/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + one_to_hundred.product(one_to_hundred).map do |width, height| +** Processing line: ~ [width, height, Math.sqrt(width ** 2 + height ** 2)]~ +- Inside source: true *** True Line Result - + [width, height, Math.sqrt(width ** 2 + height ** 2)] +** Processing line: ~ end.find_all do |_, _, hypotenuse|~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + end.find_all do |_, _, hypotenuse| +** Processing line: ~ hypotenuse.to_i == hypotenuse~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + hypotenuse.to_i == hypotenuse +** Processing line: ~ end.map do |triangle|~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ + end.map do |triangle| +** Processing line: ~ triangle.map(&:to_i)~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in a previous sample apps: -** Processing line: ~~ + triangle.map(&:to_i) +** Processing line: ~ end.uniq do |triangle|~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ + end.uniq do |triangle| +** Processing line: ~ triangle.sort~ - Inside source: true *** True Line Result - - args.inputs.keyboard.key_up.KEY: The value of the properties will be set -** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ + triangle.sort +** Processing line: ~ end.map do |width, height, hypotenuse|~ - Inside source: true *** True Line Result - to the frame that the key_up event occurred (the frame correlates -** Processing line: ~ to args.state.tick_count). Otherwise the value will be nil. For a~ + end.map do |width, height, hypotenuse| +** Processing line: ~ [width, height, hypotenuse, (width * height) / 2]~ - Inside source: true *** True Line Result - to args.state.tick_count). Otherwise the value will be nil. For a -** Processing line: ~ full listing of keys, take a look at mygame/documentation/06-keyboard.md.~ + [width, height, hypotenuse, (width * height) / 2] +** Processing line: ~ end.sort_by do |_, _, _, area|~ - Inside source: true *** True Line Result - full listing of keys, take a look at mygame/documentation/06-keyboard.md. -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ + end.sort_by do |_, _, _, area| +** Processing line: ~ area~ - Inside source: true *** True Line Result - - args.state.PROPERTY: The state property on args is a dynamic -** Processing line: ~ structure. You can define ANY property here with ANY type of~ + area +** Processing line: ~ end~ - Inside source: true *** True Line Result - structure. You can define ANY property here with ANY type of -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - arbitrary nesting. Properties defined on args.state will be retained -** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ + +** Processing line: ~ triples.each do |width, height, hypotenuse, _|~ - Inside source: true *** True Line Result - across frames. If you attempt access a property that doesn't exist -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ + triples.each do |width, height, hypotenuse, _| +** Processing line: ~ puts "(#{width}, #{height}, #{hypotenuse})"~ - Inside source: true *** True Line Result - on args.state, it will simply return nil (no exception will be thrown). -** Processing line: ~~ + puts "(#{width}, #{height}, #{hypotenuse})" +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - =end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Along with outputs, inputs are also an essential part of video game development~ +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # Along with outputs, inputs are also an essential part of video game development -** Processing line: ~ # DragonRuby can take input from keyboards, mouse, and controllers.~ + # ==================================================================================== +** Processing line: ~ # Example of an sorting.~ - Inside source: true *** True Line Result - # DragonRuby can take input from keyboards, mouse, and controllers. -** Processing line: ~ # This sample app will cover keyboard input.~ + # Example of an sorting. +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - # This sample app will cover keyboard input. + # ==================================================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed~ +** Processing line: ~ repl do~ - Inside source: true *** True Line Result - # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed -** Processing line: ~ # This will work with the other keys as well~ + repl do +** Processing line: ~ puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype."~ - Inside source: true *** True Line Result - # This will work with the other keys as well + puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ things_to_sort = [~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + things_to_sort = [ +** Processing line: ~ { type: :background, order: 1 },~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360~ + { type: :background, order: 1 }, +** Processing line: ~ { type: :foreground, order: 1 },~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 -** Processing line: ~ # Notice how small_font accounts for all the remaining parameters~ + { type: :foreground, order: 1 }, +** Processing line: ~ { type: :foreground, order: 2 }~ - Inside source: true *** True Line Result - # Notice how small_font accounts for all the remaining parameters -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ + { type: :foreground, order: 2 } +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ + ] +** Processing line: ~ puts "*** Original array."~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ + puts "*** Original array." +** Processing line: ~ puts things_to_sort~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] + puts things_to_sort ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key~ +** Processing line: ~ puts "*** Simple sort using key."~ - Inside source: true *** True Line Result - # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key -** Processing line: ~ if args.inputs.keyboard.key_up.h~ + puts "*** Simple sort using key." +** Processing line: ~ # For a simple sort, you can use sort_by~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_up.h -** Processing line: ~ args.state.h_pressed_at = args.state.tick_count~ + # For a simple sort, you can use sort_by +** Processing line: ~ results = things_to_sort.sort_by do |hash|~ - Inside source: true *** True Line Result - args.state.h_pressed_at = args.state.tick_count + results = things_to_sort.sort_by do |hash| +** Processing line: ~ hash[:order]~ +- Inside source: true +*** True Line Result + hash[:order] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -10025,486 +10268,618 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false~ -- Inside source: true -*** True Line Result - # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false -** Processing line: ~ args.state.h_pressed_at ||= false~ +** Processing line: ~ puts results~ - Inside source: true *** True Line Result - args.state.h_pressed_at ||= false + puts results ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.h_pressed_at~ +** Processing line: ~ puts "*** Custom sort."~ - Inside source: true *** True Line Result - if args.state.h_pressed_at -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ + puts "*** Custom sort." +** Processing line: ~ puts "**** Sorting process."~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] -** Processing line: ~ else~ + puts "**** Sorting process." +** Processing line: ~ # for a more complicated sort, you can provide a block that returns~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ + # for a more complicated sort, you can provide a block that returns +** Processing line: ~ # -1, 0, 1 for a left and right operand~ - Inside source: true *** True Line Result - args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] -** Processing line: ~ end~ + # -1, 0, 1 for a left and right operand +** Processing line: ~ results = things_to_sort.sort do |l, r|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + results = things_to_sort.sort do |l, r| +** Processing line: ~ sort_result = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ tick_help_text args~ + sort_result = 0 +** Processing line: ~ puts "here is l: #{l}"~ - Inside source: true *** True Line Result - tick_help_text args -** Processing line: ~ end~ + puts "here is l: #{l}" +** Processing line: ~ puts "here is r: #{r || "nil"}"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + puts "here is r: #{r || "nil"}" +** Processing line: ~ # if either value is nil/false return 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def small_font~ + # if either value is nil/false return 0 +** Processing line: ~ if !l || !r~ - Inside source: true *** True Line Result - def small_font -** Processing line: ~ # This method provides some values for the construction of labels~ + if !l || !r +** Processing line: ~ sort_result = 0~ - Inside source: true *** True Line Result - # This method provides some values for the construction of labels -** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ + sort_result = 0 +** Processing line: ~ # if the type of "left" is background and the~ - Inside source: true *** True Line Result - # Specifically, Size, Alignment, & RGBA -** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ + # if the type of "left" is background and the +** Processing line: ~ # type of "right" is foreground, then return~ - Inside source: true *** True Line Result - # This makes it so that custom parameters don't have to be repeatedly typed. -** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ + # type of "right" is foreground, then return +** Processing line: ~ # -1 (which means "left" is less than "right"~ - Inside source: true *** True Line Result - # Additionally "small_font" provides programmers with more information than some numbers -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ + # -1 (which means "left" is less than "right" +** Processing line: ~ elsif l[:type] == :background && r[:type] == :foreground~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ + elsif l[:type] == :background && r[:type] == :foreground +** Processing line: ~ sort_result = -1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + sort_result = -1 +** Processing line: ~ # if the type of "left" is foreground and the~ - Inside source: true *** True Line Result - -** Processing line: ~ def row_to_px args, row_number~ + # if the type of "left" is foreground and the +** Processing line: ~ # type of "right" is background, then return~ - Inside source: true *** True Line Result - def row_to_px args, row_number -** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ + # type of "right" is background, then return +** Processing line: ~ # 1 (which means "left" is greater than "right"~ - Inside source: true *** True Line Result - # This takes a row_number and converts it to pixels DragonRuby understands. -** Processing line: ~ # Row 0 starts 5 units below the top of the grid~ + # 1 (which means "left" is greater than "right" +** Processing line: ~ elsif l[:type] == :foreground && r[:type] == :background~ - Inside source: true *** True Line Result - # Row 0 starts 5 units below the top of the grid -** Processing line: ~ # Each row afterward is 20 units lower~ + elsif l[:type] == :foreground && r[:type] == :background +** Processing line: ~ sort_result = 1~ - Inside source: true *** True Line Result - # Each row afterward is 20 units lower -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ + sort_result = 1 +** Processing line: ~ # if "left" and "right"'s type are the same, then~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) -** Processing line: ~ end~ + # if "left" and "right"'s type are the same, then +** Processing line: ~ # use the order as the tie breaker~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # use the order as the tie breaker +** Processing line: ~ elsif l[:order] < r[:order]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Don't worry about understanding the code within this method just yet.~ + elsif l[:order] < r[:order] +** Processing line: ~ sort_result = -1~ - Inside source: true *** True Line Result - # Don't worry about understanding the code within this method just yet. -** Processing line: ~ # This method shows you the help text within the game.~ + sort_result = -1 +** Processing line: ~ elsif l[:order] > r[:order]~ - Inside source: true *** True Line Result - # This method shows you the help text within the game. -** Processing line: ~ def tick_help_text args~ + elsif l[:order] > r[:order] +** Processing line: ~ sort_result = 1~ - Inside source: true *** True Line Result - def tick_help_text args -** Processing line: ~ return unless args.state.h_pressed_at~ + sort_result = 1 +** Processing line: ~ # returning 0 means both values are equal~ - Inside source: true *** True Line Result - return unless args.state.h_pressed_at -** Processing line: ~~ + # returning 0 means both values are equal +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.key_value_history ||= {}~ + else +** Processing line: ~ sort_result = 0~ - Inside source: true *** True Line Result - args.state.key_value_history ||= {} -** Processing line: ~ args.state.key_down_value_history ||= {}~ + sort_result = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.key_down_value_history ||= {} -** Processing line: ~ args.state.key_held_value_history ||= {}~ + end +** Processing line: ~ sort_result~ - Inside source: true *** True Line Result - args.state.key_held_value_history ||= {} -** Processing line: ~ args.state.key_up_value_history ||= {}~ + sort_result +** Processing line: ~ end.to_a~ - Inside source: true *** True Line Result - args.state.key_up_value_history ||= {} + end.to_a ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if (args.inputs.keyboard.key_down.truthy_keys.length > 0 ||~ +** Processing line: ~ puts "**** Sort result."~ - Inside source: true *** True Line Result - if (args.inputs.keyboard.key_down.truthy_keys.length > 0 || -** Processing line: ~ args.inputs.keyboard.key_held.truthy_keys.length > 0 ||~ + puts "**** Sort result." +** Processing line: ~ puts results~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_held.truthy_keys.length > 0 || -** Processing line: ~ args.inputs.keyboard.key_up.truthy_keys.length > 0)~ + puts results +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_up.truthy_keys.length > 0) -** Processing line: ~ args.state.help_available = true~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.help_available = true -** Processing line: ~ args.state.no_activity_debounce = nil~ + +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.state.no_activity_debounce = nil -** Processing line: ~ else~ + # ==================================================================================== +** Processing line: ~ # Api documention for Array that is worth commiting to memory because arrays are so~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.no_activity_debounce ||= 5.seconds~ + # Api documention for Array that is worth commiting to memory because arrays are so +** Processing line: ~ # awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html~ - Inside source: true *** True Line Result - args.state.no_activity_debounce ||= 5.seconds -** Processing line: ~ args.state.no_activity_debounce -= 1~ + # awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html +** Processing line: ~ # ====================================================================================~ - Inside source: true *** True Line Result - args.state.no_activity_debounce -= 1 -** Processing line: ~ if args.state.no_activity_debounce <= 0~ + # ==================================================================================== +** Processing line: ~~ - Inside source: true *** True Line Result - if args.state.no_activity_debounce <= 0 -** Processing line: ~ args.state.help_available = false~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Learn Ruby Optional - Intermediate Ruby Primer - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb~ - Inside source: true *** True Line Result - args.state.help_available = false -** Processing line: ~ args.state.key_value_history = {}~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.state.key_value_history = {} -** Processing line: ~ args.state.key_down_value_history = {}~ + def tick args +** Processing line: ~ args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1]~ - Inside source: true *** True Line Result - args.state.key_down_value_history = {} -** Processing line: ~ args.state.key_held_value_history = {}~ + args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.key_held_value_history = {} -** Processing line: ~ args.state.key_up_value_history = {}~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.key_up_value_history = {} -** Processing line: ~ end~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - repl.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Learn Ruby Optional - Intermediate Ruby Primer - repl.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rendering Basics - Labels - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rendering Basics - Labels - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/01_rendering_basics/01_labels/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/01_rendering_basics/01_labels/app/main.rb +** Processing line: ~ =begin~ +- Inside source: true +*** True Line Result + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] + APIs listing that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !args.state.help_available~ +** Processing line: ~ - args.outputs.labels: An array. Values in this array generate labels~ - Inside source: true *** True Line Result - if !args.state.help_available -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font]~ + - args.outputs.labels: An array. Values in this array generate labels +** Processing line: ~ the screen.~ - Inside source: true *** True Line Result - args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] -** Processing line: ~ return~ + the screen. +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ - Inside source: true *** True Line Result - end + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). +** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ +- Inside source: true +*** True Line Result + - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction +** Processing line: ~ by adding or subracting.~ +- Inside source: true +*** True Line Result + by adding or subracting. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] -** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] -** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ + +** Processing line: ~ # Labels are used to represent text elements in DragonRuby~ - Inside source: true *** True Line Result - args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] -** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ + # Labels are used to represent text elements in DragonRuby +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] + +** Processing line: ~ # An example of creating a label is:~ +- Inside source: true +*** True Line Result + # An example of creating a label is: +** Processing line: ~ # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ +- Inside source: true +*** True Line Result + # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ fill_history args, :key_value_history, :down_or_held, nil~ +** Processing line: ~ # The code above does the following:~ - Inside source: true *** True Line Result - fill_history args, :key_value_history, :down_or_held, nil -** Processing line: ~ fill_history args, :key_down_value_history, :down, :key_down~ + # The code above does the following: +** Processing line: ~ # 1. GET the place where labels go: args.outputs.labels~ - Inside source: true *** True Line Result - fill_history args, :key_down_value_history, :down, :key_down -** Processing line: ~ fill_history args, :key_held_value_history, :held, :key_held~ + # 1. GET the place where labels go: args.outputs.labels +** Processing line: ~ # 2. Request a new LABEL be ADDED: <<~ - Inside source: true *** True Line Result - fill_history args, :key_held_value_history, :held, :key_held -** Processing line: ~ fill_history args, :key_up_value_history, :up, :key_up~ + # 2. Request a new LABEL be ADDED: << +** Processing line: ~ # 3. The DEFINITION of a SOLID is the ARRAY:~ - Inside source: true *** True Line Result - fill_history args, :key_up_value_history, :up, :key_up + # 3. The DEFINITION of a SOLID is the ARRAY: +** Processing line: ~ # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ +- Inside source: true +*** True Line Result + # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] +** Processing line: ~ # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +- Inside source: true +*** True Line Result + # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ render_help_labels args, :key_value_history, :down_or_held, nil, 10~ +** Processing line: ~~ - Inside source: true *** True Line Result - render_help_labels args, :key_value_history, :down_or_held, nil, 10 -** Processing line: ~ render_help_labels args, :key_down_value_history, :down, :key_down, 330~ + +** Processing line: ~ # The tick method is called by DragonRuby every frame~ - Inside source: true *** True Line Result - render_help_labels args, :key_down_value_history, :down, :key_down, 330 -** Processing line: ~ render_help_labels args, :key_held_value_history, :held, :key_held, 650~ + # The tick method is called by DragonRuby every frame +** Processing line: ~ # args contains all the information regarding the game.~ - Inside source: true *** True Line Result - render_help_labels args, :key_held_value_history, :held, :key_held, 650 -** Processing line: ~ render_help_labels args, :key_up_value_history, :up, :key_up, 990~ + # args contains all the information regarding the game. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - render_help_labels args, :key_up_value_history, :up, :key_up, 990 -** Processing line: ~ end~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays."~ - Inside source: true *** True Line Result - end + tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays." +** Processing line: ~ # Here are some examples of simple labels, with the minimum number of parameters~ +- Inside source: true +*** True Line Result + # Here are some examples of simple labels, with the minimum number of parameters +** Processing line: ~ # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font~ +- Inside source: true +*** True Line Result + # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font +** Processing line: ~ args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def fill_history args, history_key, state_key, keyboard_method~ +** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."]~ - Inside source: true *** True Line Result - def fill_history args, history_key, state_key, keyboard_method -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :raw_key~ + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."] +** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ - Inside source: true *** True Line Result - fill_single_history args, history_key, state_key, keyboard_method, :raw_key -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :char~ + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."] +** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."]~ - Inside source: true *** True Line Result - fill_single_history args, history_key, state_key, keyboard_method, :char -** Processing line: ~ args.inputs.keyboard.keys[state_key].each do |key_name|~ + args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."] +** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."]~ - Inside source: true *** True Line Result - args.inputs.keyboard.keys[state_key].each do |key_name| -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, key_name~ + args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."] +** Processing line: ~~ - Inside source: true *** True Line Result - fill_single_history args, history_key, state_key, keyboard_method, key_name -** Processing line: ~ end~ + +** Processing line: ~ # Demonstration of the Size Parameter~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Demonstration of the Size Parameter +** Processing line: ~ args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2]~ - Inside source: true *** True Line Result - end + args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2] +** Processing line: ~ args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1] +** Processing line: ~ args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0] +** Processing line: ~ args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1] +** Processing line: ~ args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def fill_single_history args, history_key, state_key, keyboard_method, key_name~ +** Processing line: ~ # Demonstration of the Align Parameter~ - Inside source: true *** True Line Result - def fill_single_history args, history_key, state_key, keyboard_method, key_name -** Processing line: ~ current_value = args.inputs.keyboard.send(key_name)~ + # Demonstration of the Align Parameter +** Processing line: ~ args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2]~ - Inside source: true *** True Line Result - current_value = args.inputs.keyboard.send(key_name) -** Processing line: ~ if keyboard_method~ + args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2] +** Processing line: ~ args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1]~ - Inside source: true *** True Line Result - if keyboard_method -** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(key_name)~ + args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1] +** Processing line: ~ args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0]~ - Inside source: true *** True Line Result - current_value = args.inputs.keyboard.send(keyboard_method).send(key_name) -** Processing line: ~ end~ + args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0] +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.as_hash[history_key][key_name] ||= []~ + +** Processing line: ~ # Demonstration of the RGBA parameters~ - Inside source: true *** True Line Result - args.state.as_hash[history_key][key_name] ||= [] -** Processing line: ~ args.state.as_hash[history_key][key_name] << current_value~ + # Demonstration of the RGBA parameters +** Processing line: ~ args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0]~ - Inside source: true *** True Line Result - args.state.as_hash[history_key][key_name] << current_value -** Processing line: ~ args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse~ + args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0] +** Processing line: ~ args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0]~ - Inside source: true *** True Line Result - args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse -** Processing line: ~ end~ + args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0] +** Processing line: ~ args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - end + args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255] +** Processing line: ~ args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_help_labels args, history_key, state_key, keyboard_method, x~ +** Processing line: ~ # Demonstration of the Font parameter~ - Inside source: true *** True Line Result - def render_help_labels args, history_key, state_key, keyboard_method, x -** Processing line: ~ idx = 8~ + # Demonstration of the Font parameter +** Processing line: ~ # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is~ - Inside source: true *** True Line Result - idx = 8 -** Processing line: ~ args.outputs.labels << args.state~ + # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is +** Processing line: ~ args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ]~ - Inside source: true *** True Line Result - args.outputs.labels << args.state -** Processing line: ~ .as_hash[history_key]~ + args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ] +** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ - Inside source: true *** True Line Result - .as_hash[history_key] -** Processing line: ~ .keys~ + args.outputs.primitives << { x: 690 + 150, +** Processing line: ~ y: 330 - 50,~ - Inside source: true *** True Line Result - .keys -** Processing line: ~ .reverse~ + y: 330 - 50, +** Processing line: ~ text: "Custom font (Hash)",~ - Inside source: true *** True Line Result - .reverse -** Processing line: ~ .map~ + text: "Custom font (Hash)", +** Processing line: ~ size_enum: 0,~ - Inside source: true *** True Line Result - .map -** Processing line: ~ .with_index do |k, i|~ + size_enum: 0, +** Processing line: ~ alignment_enum: 1,~ - Inside source: true *** True Line Result - .with_index do |k, i| -** Processing line: ~ v = args.state.as_hash[history_key][k]~ + alignment_enum: 1, +** Processing line: ~ r: 125,~ - Inside source: true *** True Line Result - v = args.state.as_hash[history_key][k] -** Processing line: ~ current_value = args.inputs.keyboard.send(k)~ + r: 125, +** Processing line: ~ g: 0,~ - Inside source: true *** True Line Result - current_value = args.inputs.keyboard.send(k) -** Processing line: ~ if keyboard_method~ + g: 0, +** Processing line: ~ b: 200,~ - Inside source: true *** True Line Result - if keyboard_method -** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(k)~ + b: 200, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - current_value = args.inputs.keyboard.send(keyboard_method).send(k) -** Processing line: ~ end~ + a: 255, +** Processing line: ~ font: "manaspc.ttf" }.label~ - Inside source: true *** True Line Result - end -** Processing line: ~ idx += 2~ + font: "manaspc.ttf" }.label +** Processing line: ~~ - Inside source: true *** True Line Result - idx += 2 -** Processing line: ~ [~ + +** Processing line: ~ # Primitives can hold anything, and can be given a label in the following forms~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [x, row_to_px(args, idx - 2),~ + # Primitives can hold anything, and can be given a label in the following forms +** Processing line: ~ args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label~ - Inside source: true *** True Line Result - [x, row_to_px(args, idx - 2), -** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ + args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label +** Processing line: ~~ - Inside source: true *** True Line Result - " .#{k} is #{current_value || "nil"}", -** Processing line: ~ small_font],~ + +** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ - Inside source: true *** True Line Result - small_font], -** Processing line: ~ [x, row_to_px(args, idx - 1),~ + args.outputs.primitives << { x: 690 + 150, +** Processing line: ~ y: 330 - 110,~ - Inside source: true *** True Line Result - [x, row_to_px(args, idx - 1), -** Processing line: ~ " was #{v}",~ + y: 330 - 110, +** Processing line: ~ text: "Custom font (.primitives Hash)",~ - Inside source: true *** True Line Result - " was #{v}", -** Processing line: ~ small_font]~ + text: "Custom font (.primitives Hash)", +** Processing line: ~ size_enum: 0,~ - Inside source: true *** True Line Result - small_font] -** Processing line: ~ ]~ + size_enum: 0, +** Processing line: ~ alignment_enum: 1,~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + alignment_enum: 1, +** Processing line: ~ r: 125,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + r: 125, +** Processing line: ~ g: 0,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 0, +** Processing line: ~ b: 200,~ - Inside source: true *** True Line Result - + b: 200, +** Processing line: ~ a: 255,~ +- Inside source: true +*** True Line Result + a: 255, +** Processing line: ~ font: "manaspc.ttf" }.label~ +- Inside source: true +*** True Line Result + font: "manaspc.ttf" }.label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -10573,18 +10948,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 02_input_basics/02_mouse/app/main.rb~ +** Processing line: ~* Rendering Basics - Lines - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 02_input_basics/02_mouse/app/main.rb +* Rendering Basics - Lines - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/01_rendering_basics/02_lines/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/01_rendering_basics/02_lines/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -10593,146 +10972,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - APIs that haven't been encountered in a previous sample apps: + APIs listing that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ - args.outputs.lines: An array. Values in this array generate lines on~ - Inside source: true *** True Line Result - - args.inputs.mouse.click: This property will be set if the mouse was clicked. -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ + - args.outputs.lines: An array. Values in this array generate lines on +** Processing line: ~ the screen.~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ + the screen. +** Processing line: ~ - args.state.tick_count: This property contains an integer value that~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. -** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ + - args.state.tick_count: This property contains an integer value that +** Processing line: ~ represents the current frame. GTK renders at 60 FPS. A value of 0~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed -** Processing line: ~ since the click event.~ + represents the current frame. GTK renders at 60 FPS. A value of 0 +** Processing line: ~ for args.state.tick_count represents the initial load of the game.~ - Inside source: true *** True Line Result - since the click event. + for args.state.tick_count represents the initial load of the game. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminder:~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - Reminder: + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ +** Processing line: ~ # The parameters required for lines are:~ - Inside source: true *** True Line Result - - args.state.PROPERTY: The state property on args is a dynamic -** Processing line: ~ structure. You can define ANY property here with ANY type of~ + # The parameters required for lines are: +** Processing line: ~ # 1. The initial point (x, y)~ - Inside source: true *** True Line Result - structure. You can define ANY property here with ANY type of -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ -- Inside source: true -*** True Line Result - arbitrary nesting. Properties defined on args.state will be retained -** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ -- Inside source: true -*** True Line Result - across frames. If you attempt access a property that doesn't exist -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ -- Inside source: true -*** True Line Result - on args.state, it will simply return nil (no exception will be thrown). -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ =end~ -- Inside source: true -*** True Line Result - =end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # This code demonstrates DragonRuby mouse input~ -- Inside source: true -*** True Line Result - # This code demonstrates DragonRuby mouse input -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # To see if the a mouse click occurred~ -- Inside source: true -*** True Line Result - # To see if the a mouse click occurred -** Processing line: ~ # Use args.inputs.mouse.click~ -- Inside source: true -*** True Line Result - # Use args.inputs.mouse.click -** Processing line: ~ # Which returns a boolean~ -- Inside source: true -*** True Line Result - # Which returns a boolean -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # To see where a mouse click occurred~ -- Inside source: true -*** True Line Result - # To see where a mouse click occurred -** Processing line: ~ # Use args.inputs.mouse.click.point.x AND~ + # 1. The initial point (x, y) +** Processing line: ~ # 2. The end point (x2, y2)~ - Inside source: true *** True Line Result - # Use args.inputs.mouse.click.point.x AND -** Processing line: ~ # args.inputs.mouse.click.point.y~ + # 2. The end point (x2, y2) +** Processing line: ~ # 3. The rgba values for the color and transparency (r, g, b, a)~ - Inside source: true *** True Line Result - # args.inputs.mouse.click.point.y + # 3. The rgba values for the color and transparency (r, g, b, a) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # To see which frame the click occurred~ +** Processing line: ~ # An example of creating a line would be:~ - Inside source: true *** True Line Result - # To see which frame the click occurred -** Processing line: ~ # Use args.inputs.mouse.click.created_at~ + # An example of creating a line would be: +** Processing line: ~ # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255]~ - Inside source: true *** True Line Result - # Use args.inputs.mouse.click.created_at + # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # To see how many frames its been since the click occurred~ -- Inside source: true -*** True Line Result - # To see how many frames its been since the click occurred -** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ +** Processing line: ~ # This would create a line from (100, 100) to (300, 300)~ - Inside source: true *** True Line Result - # Use args.inputs.mouse.click.creat_at_elapsed -** Processing line: ~~ + # This would create a line from (100, 100) to (300, 300) +** Processing line: ~ # The RGB code (255, 0, 255) would determine its color, a purple~ - Inside source: true *** True Line Result - -** Processing line: ~ # Saving the click in args.state can be quite useful~ + # The RGB code (255, 0, 255) would determine its color, a purple +** Processing line: ~ # It would have an Alpha value of 255, making it completely opaque~ - Inside source: true *** True Line Result - # Saving the click in args.state can be quite useful + # It would have an Alpha value of 255, making it completely opaque ** Processing line: ~~ - Inside source: true *** True Line Result @@ -10741,138 +11064,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time."~ -- Inside source: true -*** True Line Result - tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time." -** Processing line: ~ x = 460~ -- Inside source: true -*** True Line Result - x = 460 -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse") -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if args.inputs.mouse.click~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.click -** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ -- Inside source: true -*** True Line Result - args.state.last_mouse_click = args.inputs.mouse.click -** Processing line: ~ end~ +** Processing line: ~ tick_instructions args, "Sample app shows how to create lines."~ - Inside source: true *** True Line Result - end + tick_instructions args, "Sample app shows how to create lines." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.last_mouse_click~ -- Inside source: true -*** True Line Result - if args.state.last_mouse_click -** Processing line: ~ click = args.state.last_mouse_click~ -- Inside source: true -*** True Line Result - click = args.state.last_mouse_click -** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}") -** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago") -** Processing line: ~ args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}") -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.") -** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Please click mouse.")~ -- Inside source: true -*** True Line Result - args.outputs.labels << small_label(args, x, 13, "Please click mouse.") -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ +** Processing line: ~ args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"]~ - Inside source: true *** True Line Result - end + args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_label args, x, row, message~ -- Inside source: true -*** True Line Result - def small_label args, x, row, message -** Processing line: ~ # This method effectively combines the row_to_px and small_font methods~ -- Inside source: true -*** True Line Result - # This method effectively combines the row_to_px and small_font methods -** Processing line: ~ # It changes the given row value to a DragonRuby pixel value~ -- Inside source: true -*** True Line Result - # It changes the given row value to a DragonRuby pixel value -** Processing line: ~ # and adds the customization parameters~ +** Processing line: ~ # Some simple lines~ - Inside source: true *** True Line Result - # and adds the customization parameters -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ + # Some simple lines +** Processing line: ~ args.outputs.lines << [380, 450, 675, 450]~ - Inside source: true *** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ + args.outputs.lines << [380, 450, 675, 450] +** Processing line: ~ args.outputs.lines << [380, 410, 875, 410]~ - Inside source: true *** True Line Result - end + args.outputs.lines << [380, 410, 875, 410] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_font~ +** Processing line: ~ # These examples utilize args.state.tick_count to change the length of the lines over time~ - Inside source: true *** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ + # These examples utilize args.state.tick_count to change the length of the lines over time +** Processing line: ~ # args.state.tick_count is the ticks that have occurred in the game~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ + # args.state.tick_count is the ticks that have occurred in the game +** Processing line: ~ # This is accomplished by making either the starting or ending point based on the args.state.tick_count~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # This is accomplished by making either the starting or ending point based on the args.state.tick_count +** Processing line: ~ args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255]~ - Inside source: true *** True Line Result - -** Processing line: ~ def row_to_px args, row_number~ + args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255] +** Processing line: ~ args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - def row_to_px args, row_number -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ + args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255] +** Processing line: ~ args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -10945,318 +11192,226 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 02_input_basics/03_mouse_point_to_rect/app/main.rb~ +** Processing line: ~* Rendering Basics - Solids Borders - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 02_input_basics/03_mouse_point_to_rect/app/main.rb +* Rendering Basics - Solids Borders - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ -- Inside source: true -*** True Line Result - =begin -** Processing line: ~~ +** Processing line: ~ # ./samples/01_rendering_basics/03_solids_borders/app/main.rb~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ + # ./samples/01_rendering_basics/03_solids_borders/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - APIs that haven't been encountered in a previous sample apps: + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputus.borders: An array. Values in this array will be rendered as~ -- Inside source: true -*** True Line Result - - args.outputus.borders: An array. Values in this array will be rendered as -** Processing line: ~ unfilled rectangles on the screen.~ -- Inside source: true -*** True Line Result - unfilled rectangles on the screen. -** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ -- Inside source: true -*** True Line Result - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array -** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ -- Inside source: true -*** True Line Result - with at least four values is considered a rect. The inside_rect? function returns true -** Processing line: ~ or false depending on if the point is inside the rect.~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - or false depending on if the point is inside the rect. + APIs listing that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ```~ -- Inside source: true -*** True Line Result - ``` -** Processing line: ~ # Point: x: 100, y: 100~ -- Inside source: true -*** True Line Result - # Point: x: 100, y: 100 -** Processing line: ~ # Rect: x: 0, y: 0, w: 500, h: 500~ +** Processing line: ~ - args.outputs.solids: An array. Values in this array generate~ - Inside source: true *** True Line Result - # Rect: x: 0, y: 0, w: 500, h: 500 -** Processing line: ~ # Result: true~ + - args.outputs.solids: An array. Values in this array generate +** Processing line: ~ solid/filled rectangles on the screen.~ - Inside source: true *** True Line Result - # Result: true + solid/filled rectangles on the screen. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [100, 100].inside_rect? [0, 0, 500, 500]~ -- Inside source: true -*** True Line Result - [100, 100].inside_rect? [0, 0, 500, 500] -** Processing line: ~ ```~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - ``` + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ```~ -- Inside source: true -*** True Line Result - ``` -** Processing line: ~ # Point: x: 100, y: 100~ +** Processing line: ~ # Rects are outputted in DragonRuby as rectangles~ - Inside source: true *** True Line Result - # Point: x: 100, y: 100 -** Processing line: ~ # Rect: x: 300, y: 300, w: 100, h: 100~ + # Rects are outputted in DragonRuby as rectangles +** Processing line: ~ # If filled in, they are solids~ - Inside source: true *** True Line Result - # Rect: x: 300, y: 300, w: 100, h: 100 -** Processing line: ~ # Result: false~ + # If filled in, they are solids +** Processing line: ~ # If hollow, they are borders~ - Inside source: true *** True Line Result - # Result: false + # If hollow, they are borders ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [100, 100].inside_rect? [300, 300, 100, 100]~ +** Processing line: ~ # Solids are added to args.outputs.solids~ - Inside source: true *** True Line Result - [100, 100].inside_rect? [300, 300, 100, 100] -** Processing line: ~ ```~ + # Solids are added to args.outputs.solids +** Processing line: ~ # Borders are added to args.outputs.borders~ - Inside source: true *** True Line Result - ``` + # Borders are added to args.outputs.borders ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ +** Processing line: ~ # The parameters required for rects are:~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. -** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ + # The parameters required for rects are: +** Processing line: ~ # 1. The upper right corner (x, y)~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed -** Processing line: ~ since the click event.~ + # 1. The upper right corner (x, y) +** Processing line: ~ # 2. The width (w)~ - Inside source: true *** True Line Result - since the click event. -** Processing line: ~~ + # 2. The width (w) +** Processing line: ~ # 3. The height (h)~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + # 3. The height (h) +** Processing line: ~ # 4. The rgba values for the color and transparency (r, g, b, a)~ - Inside source: true *** True Line Result - =end + # 4. The rgba values for the color and transparency (r, g, b, a) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # To determine whether a point is in a rect~ -- Inside source: true -*** True Line Result - # To determine whether a point is in a rect -** Processing line: ~ # Use point.inside_rect? rect~ -- Inside source: true -*** True Line Result - # Use point.inside_rect? rect -** Processing line: ~~ +** Processing line: ~ # Here is an example of a rect definition:~ - Inside source: true *** True Line Result - -** Processing line: ~ # This is useful to determine if a click occurred in a rect~ + # Here is an example of a rect definition: +** Processing line: ~ # [100, 100, 400, 500, 0, 255, 0, 180]~ - Inside source: true *** True Line Result - # This is useful to determine if a click occurred in a rect + # [100, 100, 400, 500, 0, 255, 0, 180] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle."~ +** Processing line: ~ # The example would create a rect from (100, 100)~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." -** Processing line: ~~ + # The example would create a rect from (100, 100) +** Processing line: ~ # Extending 400 pixels across the x axis~ - Inside source: true *** True Line Result - -** Processing line: ~ x = 460~ + # Extending 400 pixels across the x axis +** Processing line: ~ # and 500 pixels across the y axis~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~~ + # and 500 pixels across the y axis +** Processing line: ~ # The rect would be green (0, 255, 0)~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->")~ + # The rect would be green (0, 255, 0) +** Processing line: ~ # and mostly opaque with some transparency (180)~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") + # and mostly opaque with some transparency (180) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ +** Processing line: ~ # Whether the rect would be filled or not depends on if~ - Inside source: true *** True Line Result - box = [785, 370, 50, 50, 0, 0, 170] -** Processing line: ~ args.outputs.borders << box~ + # Whether the rect would be filled or not depends on if +** Processing line: ~ # it is added to args.outputs.solids or args.outputs.borders~ - Inside source: true *** True Line Result - args.outputs.borders << box + # it is added to args.outputs.solids or args.outputs.borders ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Saves the most recent click into args.state~ -- Inside source: true -*** True Line Result - # Saves the most recent click into args.state -** Processing line: ~ # Unlike the other components of args,~ -- Inside source: true -*** True Line Result - # Unlike the other components of args, -** Processing line: ~ # args.state does not reset every tick.~ -- Inside source: true -*** True Line Result - # args.state does not reset every tick. -** Processing line: ~ if args.inputs.mouse.click~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.click -** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ -- Inside source: true -*** True Line Result - args.state.last_mouse_click = args.inputs.mouse.click -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.last_mouse_click~ -- Inside source: true -*** True Line Result - if args.state.last_mouse_click -** Processing line: ~ if args.state.last_mouse_click.point.inside_rect? box~ -- Inside source: true -*** True Line Result - if args.state.last_mouse_click.point.inside_rect? box -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.")~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") -** Processing line: ~ else~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to create solid squares."~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.")~ + tick_instructions args, "Sample app shows how to create solid squares." +** Processing line: ~ args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"]~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") -** Processing line: ~ end~ + args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"] +** Processing line: ~ args.outputs.solids << [470, 520, 50, 50]~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + args.outputs.solids << [470, 520, 50, 50] +** Processing line: ~ args.outputs.solids << [530, 520, 50, 50, 0, 0, 0]~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.")~ + args.outputs.solids << [530, 520, 50, 50, 0, 0, 0] +** Processing line: ~ args.outputs.solids << [590, 520, 50, 50, 255, 0, 0]~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") -** Processing line: ~ end~ + args.outputs.solids << [590, 520, 50, 50, 255, 0, 0] +** Processing line: ~ args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128] +** Processing line: ~ args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ - Inside source: true *** True Line Result - end + args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_label args, x, row, message~ -- Inside source: true -*** True Line Result - def small_label args, x, row, message -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -- Inside source: true -*** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_font~ +** Processing line: ~ args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"]~ - Inside source: true *** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ + args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"] +** Processing line: ~ args.outputs.borders << [470, 320, 50, 50]~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ + args.outputs.borders << [470, 320, 50, 50] +** Processing line: ~ args.outputs.borders << [530, 320, 50, 50, 0, 0, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.outputs.borders << [530, 320, 50, 50, 0, 0, 0] +** Processing line: ~ args.outputs.borders << [590, 320, 50, 50, 255, 0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ def row_to_px args, row_number~ + args.outputs.borders << [590, 320, 50, 50, 255, 0, 0] +** Processing line: ~ args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128]~ - Inside source: true *** True Line Result - def row_to_px args, row_number -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ + args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128] +** Processing line: ~ args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) + args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -11329,18 +11484,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 02_input_basics/04_mouse_rect_to_rect/app/main.rb~ +** Processing line: ~* Rendering Basics - Sprites - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 02_input_basics/04_mouse_rect_to_rect/app/main.rb +* Rendering Basics - Sprites - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/01_rendering_basics/04_sprites/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/01_rendering_basics/04_sprites/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -11349,382 +11508,374 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - APIs that haven't been encountered in a previous sample apps: + APIs listing that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.borders: An array. Values in this array will be rendered as~ +** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate~ - Inside source: true *** True Line Result - - args.outputs.borders: An array. Values in this array will be rendered as -** Processing line: ~ unfilled rectangles on the screen.~ + - args.outputs.sprites: An array. Values in this array generate +** Processing line: ~ sprites on the screen. The location of the sprite is assumed to~ - Inside source: true *** True Line Result - unfilled rectangles on the screen. -** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ + sprites on the screen. The location of the sprite is assumed to +** Processing line: ~ be under the mygame/ directory (the exception being dragonruby.png).~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: An array with at least four values is -** Processing line: ~ considered a rect. The intersect_rect? function returns true~ + be under the mygame/ directory (the exception being dragonruby.png). +** Processing line: ~~ - Inside source: true *** True Line Result - considered a rect. The intersect_rect? function returns true -** Processing line: ~ or false depending on if the two rectangles intersect.~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - or false depending on if the two rectangles intersect. + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ```~ +** Processing line: ~~ - Inside source: true *** True Line Result - ``` -** Processing line: ~ # Rect One: x: 100, y: 100, w: 100, h: 100~ + +** Processing line: ~ # For all other display outputs, Sprites are your solution~ - Inside source: true *** True Line Result - # Rect One: x: 100, y: 100, w: 100, h: 100 -** Processing line: ~ # Rect Two: x: 0, y: 0, w: 500, h: 500~ + # For all other display outputs, Sprites are your solution +** Processing line: ~ # Sprites import images and display them with a certain rectangular area~ - Inside source: true *** True Line Result - # Rect Two: x: 0, y: 0, w: 500, h: 500 -** Processing line: ~ # Result: true~ + # Sprites import images and display them with a certain rectangular area +** Processing line: ~ # The image can be of any usual format and should be located within the folder,~ - Inside source: true *** True Line Result - # Result: true + # The image can be of any usual format and should be located within the folder, +** Processing line: ~ # similar to additional fonts.~ +- Inside source: true +*** True Line Result + # similar to additional fonts. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500]~ +** Processing line: ~ # Sprites have the following parameters~ - Inside source: true *** True Line Result - [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500] -** Processing line: ~ ```~ + # Sprites have the following parameters +** Processing line: ~ # Rectangular area (x, y, width, height)~ - Inside source: true *** True Line Result - ``` -** Processing line: ~~ + # Rectangular area (x, y, width, height) +** Processing line: ~ # The image (path)~ - Inside source: true *** True Line Result - -** Processing line: ~ ```~ + # The image (path) +** Processing line: ~ # Rotation (angle)~ - Inside source: true *** True Line Result - ``` -** Processing line: ~ # Rect One: x: 100, y: 100, w: 10, h: 10~ -- Inside source: true -*** True Line Result - # Rect One: x: 100, y: 100, w: 10, h: 10 -** Processing line: ~ # Rect Two: x: 500, y: 500, w: 10, h: 10~ -- Inside source: true -*** True Line Result - # Rect Two: x: 500, y: 500, w: 10, h: 10 -** Processing line: ~ # Result: false~ + # Rotation (angle) +** Processing line: ~ # Alpha (a)~ - Inside source: true *** True Line Result - # Result: false + # Alpha (a) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10]~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10] -** Processing line: ~ ```~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it."~ - Inside source: true *** True Line Result - ``` -** Processing line: ~~ + tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it." +** Processing line: ~ args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"]~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"] +** Processing line: ~ args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png']~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png'] +** Processing line: ~ args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Similarly, whether rects intersect can be found through~ + args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360] +** Processing line: ~ args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255]~ - Inside source: true *** True Line Result - # Similarly, whether rects intersect can be found through -** Processing line: ~ # rect1.intersect_rect? rect2~ + args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # rect1.intersect_rect? rect2 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to determine if two rectangles intersect."~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to determine if two rectangles intersect." -** Processing line: ~ x = 460~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen")~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen") -** Processing line: ~ # red_box = [460, 250, 355, 90, 170, 0, 0]~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - # red_box = [460, 250, 355, 90, 170, 0, 0] -** Processing line: ~ # args.outputs.borders << red_box~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - # args.outputs.borders << red_box + args.state.key_event_occurred = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # args.state.box_collision_one and args.state.box_collision_two~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # args.state.box_collision_one and args.state.box_collision_two -** Processing line: ~ # Are given values of a solid when they should be rendered~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # Are given values of a solid when they should be rendered -** Processing line: ~ # They are stored in game so that they do not get reset every tick~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # They are stored in game so that they do not get reset every tick -** Processing line: ~ if args.inputs.mouse.click~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.inputs.mouse.click -** Processing line: ~ if !args.state.box_collision_one~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if !args.state.box_collision_one -** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] -** Processing line: ~ elsif !args.state.box_collision_two~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - elsif !args.state.box_collision_two -** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ -- Inside source: true + +** Processing line: ~* Rendering Basics - Sounds - main.rb~ +- Header detected. *** True Line Result - args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] -** Processing line: ~ else~ -- Inside source: true + *** True Line Result - else -** Processing line: ~ args.state.box_collision_one = nil~ -- Inside source: true +* Rendering Basics - Sounds - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - args.state.box_collision_one = nil -** Processing line: ~ args.state.box_collision_two = nil~ -- Inside source: true + *** True Line Result - args.state.box_collision_two = nil -** Processing line: ~ end~ +#+begin_src ruby +** Processing line: ~ # ./samples/01_rendering_basics/05_sounds/app/main.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # ./samples/01_rendering_basics/05_sounds/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.box_collision_one~ -- Inside source: true -*** True Line Result - if args.state.box_collision_one -** Processing line: ~ args.outputs.solids << args.state.box_collision_one~ -- Inside source: true -*** True Line Result - args.outputs.solids << args.state.box_collision_one -** Processing line: ~ end~ +** Processing line: ~ APIs Listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - end + APIs Listing that haven't been encountered in previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.box_collision_two~ +** Processing line: ~ - sample: Chooses random element from array.~ - Inside source: true *** True Line Result - if args.state.box_collision_two -** Processing line: ~ args.outputs.solids << args.state.box_collision_two~ + - sample: Chooses random element from array. +** Processing line: ~ In this sample app, the target note is set by taking a sample from the collection~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.box_collision_two -** Processing line: ~ end~ + In this sample app, the target note is set by taking a sample from the collection +** Processing line: ~ of available notes.~ - Inside source: true *** True Line Result - end + of available notes. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.box_collision_one && args.state.box_collision_two~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - if args.state.box_collision_one && args.state.box_collision_two -** Processing line: ~ if args.state.box_collision_one.intersect_rect? args.state.box_collision_two~ + Reminders: +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ - Inside source: true *** True Line Result - if args.state.box_collision_one.intersect_rect? args.state.box_collision_two -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.')~ + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.') -** Processing line: ~ else~ + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.')~ + +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.') -** Processing line: ~ end~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + For example, if we want to create a new button, we would declare it as a new entity and +** Processing line: ~ then define its properties.~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, '--')~ + then define its properties. +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << small_label(args, x, 4, '--') -** Processing line: ~ end~ + +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - end + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_label args, x, row, message~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - def small_label args, x, row, message -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - [x, row_to_px(args, row), message, small_font] -** Processing line: ~ end~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def small_font~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ - Inside source: true *** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ + - reject: Removes elements from a collection if they meet certain requirements. +** Processing line: ~~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ + +** Processing line: ~ - first: Returns the first element of an array.~ - Inside source: true *** True Line Result - end + - first: Returns the first element of an array. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ - inside_rect: Returns true or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - def row_to_px args, row_number -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ + - inside_rect: Returns true or false depending on if the point is inside the rect. +** Processing line: ~~ - Inside source: true *** True Line Result - args.grid.top.shift_down(5).shift_down(20 * row_number) -** Processing line: ~ end~ + +** Processing line: ~ - to_sym: Returns symbol corresponding to string. Will create a symbol if it does~ - Inside source: true *** True Line Result - end + - to_sym: Returns symbol corresponding to string. Will create a symbol if it does +** Processing line: ~ not already exist.~ +- Inside source: true +*** True Line Result + not already exist. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + +** Processing line: ~ # This sample app allows users to test their musical skills by matching the piano sound that plays in each~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + # This sample app allows users to test their musical skills by matching the piano sound that plays in each +** Processing line: ~ # level to the correct note.~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + # level to the correct note. +** Processing line: ~~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + +** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + # Runs all the methods necessary for the game to function properly. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + def tick args +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + calc args +** Processing line: ~ input_mouse args~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + input_mouse args +** Processing line: ~ tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\""~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\"" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -11733,174 +11884,166 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. +** Processing line: ~ # Sets default values and creates empty collections~ +- Inside source: true *** True Line Result - -** Processing line: ~* 02_input_basics/05_controller/app/main.rb~ -- Header detected. + # Sets default values and creates empty collections +** Processing line: ~ # Initialization happens in the first frame only~ +- Inside source: true *** True Line Result - + # Initialization happens in the first frame only +** Processing line: ~ def defaults _~ +- Inside source: true *** True Line Result -* 02_input_basics/05_controller/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + def defaults _ +** Processing line: ~ _.state.notes ||= []~ +- Inside source: true *** True Line Result - + _.state.notes ||= [] +** Processing line: ~ _.state.click_feedbacks ||= []~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + _.state.click_feedbacks ||= [] +** Processing line: ~ _.state.current_level ||= 1~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + _.state.current_level ||= 1 +** Processing line: ~ _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet +** Processing line: ~ end~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key~ -- Inside source: true -*** True Line Result - - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key -** Processing line: ~ is being held down on the controller.~ +** Processing line: ~ # Uses a label to display current level, and shows the score~ - Inside source: true *** True Line Result - is being held down on the controller. -** Processing line: ~ If there is more than one controller being used, they can be differentiated by~ + # Uses a label to display current level, and shows the score +** Processing line: ~ # Creates a button to play the sample note, and displays the available notes that could be a potential match~ - Inside source: true *** True Line Result - If there is more than one controller being used, they can be differentiated by -** Processing line: ~ using names like controller_one and controller_two.~ + # Creates a button to play the sample note, and displays the available notes that could be a potential match +** Processing line: ~ def render _~ - Inside source: true *** True Line Result - using names like controller_one and controller_two. + def render _ ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For a full listing of buttons, take a look at mygame/documentation/08-controllers.md.~ +** Processing line: ~ # grid.w_half positions the label in the horizontal center of the screen.~ - Inside source: true *** True Line Result - For a full listing of buttons, take a look at mygame/documentation/08-controllers.md. + # grid.w_half positions the label in the horizontal center of the screen. +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0]~ +- Inside source: true +*** True Line Result + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminder:~ +** Processing line: ~ render_score _ # shows score on screen~ - Inside source: true *** True Line Result - Reminder: + render_score _ # shows score on screen ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ -- Inside source: true -*** True Line Result - - args.state.PROPERTY: The state property on args is a dynamic -** Processing line: ~ structure. You can define ANY property here with ANY type of~ +** Processing line: ~ if _.state.game_over # if game is over, a "play again" button is shown~ - Inside source: true *** True Line Result - structure. You can define ANY property here with ANY type of -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ + if _.state.game_over # if game is over, a "play again" button is shown +** Processing line: ~ # Calculations ensure that Play Again label is displayed in center of border~ - Inside source: true *** True Line Result - arbitrary nesting. Properties defined on args.state will be retained -** Processing line: ~ across frames. If you attempt to access a property that doesn't exist~ + # Calculations ensure that Play Again label is displayed in center of border +** Processing line: ~ # Remove calculations from y parameters and see what happens to border and label placement~ - Inside source: true *** True Line Result - across frames. If you attempt to access a property that doesn't exist -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ + # Remove calculations from y parameters and see what happens to border and label placement +** Processing line: ~ _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title~ - Inside source: true *** True Line Result - on args.state, it will simply return nil (no exception will be thrown). -** Processing line: ~~ + _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label~ - Inside source: true *** True Line Result - -** Processing line: ~ In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller.~ + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label +** Processing line: ~ _.outputs.borders << _.state.play_again_border # outputs border~ - Inside source: true *** True Line Result - In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller. -** Processing line: ~ The parameters of a button are:~ + _.outputs.borders << _.state.play_again_border # outputs border +** Processing line: ~ else # otherwise, if game is not over~ - Inside source: true *** True Line Result - The parameters of a button are: -** Processing line: ~ 1. the position (x, y)~ + else # otherwise, if game is not over +** Processing line: ~ # Calculations ensure that label appears in center of border~ - Inside source: true *** True Line Result - 1. the position (x, y) -** Processing line: ~ 2. the input key held on the controller~ + # Calculations ensure that label appears in center of border +** Processing line: ~ _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title~ - Inside source: true *** True Line Result - 2. the input key held on the controller -** Processing line: ~ 3. the text or name of the button~ + _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label~ - Inside source: true *** True Line Result - 3. the text or name of the button -** Processing line: ~~ + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label +** Processing line: ~ _.outputs.borders << _.state.play_note_border # outputs border~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + _.outputs.borders << _.state.play_note_border # outputs border +** Processing line: ~ end~ - Inside source: true *** True Line Result - =end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app provides a visual demonstration of a standard controller, including~ -- Inside source: true -*** True Line Result - # This sample app provides a visual demonstration of a standard controller, including -** Processing line: ~ # the placement and function of all buttons.~ +** Processing line: ~ return if _.state.game_over # return if game is over~ - Inside source: true *** True Line Result - # the placement and function of all buttons. + return if _.state.game_over # return if game is over ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class ControllerDemo~ -- Inside source: true -*** True Line Result - class ControllerDemo -** Processing line: ~ attr_accessor :inputs, :state, :outputs~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label~ - Inside source: true *** True Line Result - attr_accessor :inputs, :state, :outputs + _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls the methods necessary for the app to run successfully.~ +** Processing line: ~ # Shows all of the available notes that can be potential matches.~ - Inside source: true *** True Line Result - # Calls the methods necessary for the app to run successfully. -** Processing line: ~ def tick~ + # Shows all of the available notes that can be potential matches. +** Processing line: ~ available_notes.each_with_index do |note, i|~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ process_inputs~ + available_notes.each_with_index do |note, i| +** Processing line: ~ _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border)~ - Inside source: true *** True Line Result - process_inputs -** Processing line: ~ render~ + _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border) +** Processing line: ~ _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border~ - Inside source: true *** True Line Result - render + _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border +** Processing line: ~ _.outputs.borders << _.state.notes[i].border~ +- Inside source: true +*** True Line Result + _.outputs.borders << _.state.notes[i].border ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -11909,230 +12052,254 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Starts with an empty collection of buttons.~ -- Inside source: true -*** True Line Result - # Starts with an empty collection of buttons. -** Processing line: ~ # Adds buttons that are on the controller to the collection.~ +** Processing line: ~ # Shows whether or not the user is correct by filling the screen with either red or green~ - Inside source: true *** True Line Result - # Adds buttons that are on the controller to the collection. -** Processing line: ~ def process_inputs~ + # Shows whether or not the user is correct by filling the screen with either red or green +** Processing line: ~ _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid }~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ state.buttons = []~ + _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid } +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.buttons = [] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ +** Processing line: ~ # Shows the score (number of times the user guesses wrong) onto the screen using labels.~ - Inside source: true *** True Line Result - state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] -** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ + # Shows the score (number of times the user guesses wrong) onto the screen using labels. +** Processing line: ~ def render_score _~ - Inside source: true *** True Line Result - state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] -** Processing line: ~~ + def render_score _ +** Processing line: ~ if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ + if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0]~ - Inside source: true *** True Line Result - state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] -** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0] +** Processing line: ~ else # otherwise, number of times the user has guessed wrong is shown~ - Inside source: true *** True Line Result - state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] -** Processing line: ~~ + else # otherwise, number of times the user has guessed wrong is shown +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] -** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ +** Processing line: ~ # Sets the target note for the level and performs calculations on click_feedbacks.~ - Inside source: true *** True Line Result - state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] -** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ + # Sets the target note for the level and performs calculations on click_feedbacks. +** Processing line: ~ def calc _~ - Inside source: true *** True Line Result - state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] -** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ + def calc _ +** Processing line: ~ _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note~ - Inside source: true *** True Line Result - state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] -** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ + _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note +** Processing line: ~ _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely~ - Inside source: true *** True Line Result - state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] -** Processing line: ~~ + _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely +** Processing line: ~ # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ + # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection +** Processing line: ~ _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 }~ - Inside source: true *** True Line Result - state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] -** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ + _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] -** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] -** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ + +** Processing line: ~ # Uses input from the user to play the target note, as well as the other notes that could be a potential match.~ - Inside source: true *** True Line Result - state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] + # Uses input from the user to play the target note, as well as the other notes that could be a potential match. +** Processing line: ~ def input_mouse _~ +- Inside source: true +*** True Line Result + def input_mouse _ +** Processing line: ~ return unless _.inputs.mouse.click # return unless the mouse is clicked~ +- Inside source: true +*** True Line Result + return unless _.inputs.mouse.click # return unless the mouse is clicked ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ +** Processing line: ~ # finds button that was clicked by user~ - Inside source: true *** True Line Result - state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, -** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ + # finds button that was clicked by user +** Processing line: ~ button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements~ - Inside source: true *** True Line Result - 100 + inputs.controller_one.left_analog_y_perc * 100, -** Processing line: ~ inputs.controller_one.key_held.l3,~ + button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements +** Processing line: ~ _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of~ - Inside source: true *** True Line Result - inputs.controller_one.key_held.l3, -** Processing line: ~ "L3"]~ + _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of +** Processing line: ~ end.reject {|b| !_.state.meta(b)}.first # reject, return first element~ - Inside source: true *** True Line Result - "L3"] + end.reject {|b| !_.state.meta(b)}.first # reject, return first element ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ +** Processing line: ~ return unless button_clicked # return unless button_clicked as a value (a button was clicked)~ - Inside source: true *** True Line Result - state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, -** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ + return unless button_clicked # return unless button_clicked as a value (a button was clicked) +** Processing line: ~~ - Inside source: true *** True Line Result - 100 + inputs.controller_one.right_analog_y_perc * 100, -** Processing line: ~ inputs.controller_one.key_held.r3,~ + +** Processing line: ~ queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked~ - Inside source: true *** True Line Result - inputs.controller_one.key_held.r3, -** Processing line: ~ "R3"]~ + queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked +** Processing line: ~ button_clicked.x,~ - Inside source: true *** True Line Result - "R3"] -** Processing line: ~ end~ + button_clicked.x, +** Processing line: ~ button_clicked.y,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + button_clicked.y, +** Processing line: ~ button_clicked.w,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Gives each button a square shape.~ + button_clicked.w, +** Processing line: ~ button_clicked.h,~ - Inside source: true *** True Line Result - # Gives each button a square shape. -** Processing line: ~ # If the button is being pressed or held (which means it is considered active),~ + button_clicked.h, +** Processing line: ~ 150, 100, 200 # sets color of button to shade of purple~ - Inside source: true *** True Line Result - # If the button is being pressed or held (which means it is considered active), -** Processing line: ~ # the square is filled in. Otherwise, the button simply has a border.~ + 150, 100, 200 # sets color of button to shade of purple +** Processing line: ~~ - Inside source: true *** True Line Result - # the square is filled in. Otherwise, the button simply has a border. -** Processing line: ~ def render~ + +** Processing line: ~ if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed~ - Inside source: true *** True Line Result - def render -** Processing line: ~ state.buttons.each do |x, y, active, text|~ + if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed +** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output~ - Inside source: true *** True Line Result - state.buttons.each do |x, y, active, text| -** Processing line: ~ rect = [x, y, 75, 75]~ + _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output +** Processing line: ~ elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed~ - Inside source: true *** True Line Result - rect = [x, y, 75, 75] -** Processing line: ~~ + elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed +** Processing line: ~ _.state.target_note = nil # no target note~ - Inside source: true *** True Line Result - -** Processing line: ~ if active # if button is pressed~ + _.state.target_note = nil # no target note +** Processing line: ~ _.state.current_level = 1 # starts at level 1 again~ - Inside source: true *** True Line Result - if active # if button is pressed -** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ + _.state.current_level = 1 # starts at level 1 again +** Processing line: ~ _.state.times_wrong = 0 # starts off with 0 wrong guesses~ - Inside source: true *** True Line Result - outputs.solids << rect # rect is output as solid (filled in) -** Processing line: ~ else~ + _.state.times_wrong = 0 # starts off with 0 wrong guesses +** Processing line: ~ _.state.game_over = false # the game is not over (because it has just been restarted)~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.borders << rect # otherwise, output as border~ + _.state.game_over = false # the game is not over (because it has just been restarted) +** Processing line: ~ else # otherwise if neither of those buttons were pressed~ - Inside source: true *** True Line Result - outputs.borders << rect # otherwise, output as border -** Processing line: ~ end~ + else # otherwise if neither of those buttons were pressed +** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played~ - Inside source: true *** True Line Result - end + _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played +** Processing line: ~ if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note~ +- Inside source: true +*** True Line Result + if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note +** Processing line: ~ _.state.target_note = nil # target note is emptied~ +- Inside source: true +*** True Line Result + _.state.target_note = nil # target note is emptied ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs the text of each button using labels.~ +** Processing line: ~ if _.state.current_level < 9 # if game hasn't reached level 9~ - Inside source: true *** True Line Result - # Outputs the text of each button using labels. -** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ + if _.state.current_level < 9 # if game hasn't reached level 9 +** Processing line: ~ _.state.current_level += 1 # game goes to next level~ - Inside source: true *** True Line Result - outputs.labels << [x, y + 95, text] # add 95 to place label above button -** Processing line: ~ end~ + _.state.current_level += 1 # game goes to next level +** Processing line: ~ else # otherwise, if game has reached level 9~ - Inside source: true *** True Line Result - end + else # otherwise, if game has reached level 9 +** Processing line: ~ _.state.game_over = true # the game is over~ +- Inside source: true +*** True Line Result + _.state.game_over = true # the game is over +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ +** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly~ - Inside source: true *** True Line Result - outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] -** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly +** Processing line: ~ else # otherwise, if clicked note is not target note~ - Inside source: true *** True Line Result - outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] -** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ + else # otherwise, if clicked note is not target note +** Processing line: ~ _.state.times_wrong += 1 # increments times user guessed wrong~ - Inside source: true *** True Line Result - outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] -** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ + _.state.times_wrong += 1 # increments times user guessed wrong +** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong~ - Inside source: true *** True Line Result - outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12145,38 +12312,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $controller_demo = ControllerDemo.new~ +** Processing line: ~ # Creates a collection of all of the available notes as symbols~ - Inside source: true *** True Line Result - $controller_demo = ControllerDemo.new + # Creates a collection of all of the available notes as symbols +** Processing line: ~ def available_notes~ +- Inside source: true +*** True Line Result + def available_notes +** Processing line: ~ [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]~ +- Inside source: true +*** True Line Result + [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ # Creates buttons for each note, and sets a label (the note's name) and border for each note's button.~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller."~ + # Creates buttons for each note, and sets a label (the note's name) and border for each note's button. +** Processing line: ~ def piano_button _, note, position~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller." -** Processing line: ~ $controller_demo.inputs = args.inputs~ + def piano_button _, note, position +** Processing line: ~ _.state.new_entity(:button) do |b| # declares button as new entity~ - Inside source: true *** True Line Result - $controller_demo.inputs = args.inputs -** Processing line: ~ $controller_demo.state = args.state~ + _.state.new_entity(:button) do |b| # declares button as new entity +** Processing line: ~ b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition~ - Inside source: true *** True Line Result - $controller_demo.state = args.state -** Processing line: ~ $controller_demo.outputs = args.outputs~ + b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition +** Processing line: ~ b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border~ - Inside source: true *** True Line Result - $controller_demo.outputs = args.outputs -** Processing line: ~ $controller_demo.tick~ + b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border +** Processing line: ~ end~ - Inside source: true *** True Line Result - $controller_demo.tick + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12185,18 +12364,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Resets the app.~ +** Processing line: ~ # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong~ - Inside source: true *** True Line Result - # Resets the app. -** Processing line: ~ def r~ + # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong +** Processing line: ~ # If a button is clicked, the inside of button is purple (see input_mouse method)~ - Inside source: true *** True Line Result - def r -** Processing line: ~ $gtk.reset~ + # If a button is clicked, the inside of button is purple (see input_mouse method) +** Processing line: ~ # If correct note is clicked, screen turns green~ - Inside source: true *** True Line Result - $gtk.reset + # If correct note is clicked, screen turns green +** Processing line: ~ # If incorrect note is clicked, screen turns red (again, see input_mouse method)~ +- Inside source: true +*** True Line Result + # If incorrect note is clicked, screen turns red (again, see input_mouse method) +** Processing line: ~ def queue_click_feedback _, x, y, w, h, *color~ +- Inside source: true +*** True Line Result + def queue_click_feedback _, x, y, w, h, *color +** Processing line: ~ _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity~ +- Inside source: true +*** True Line Result + _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity +** Processing line: ~ c.solid = [x, y, w, h, *color, 255] # sets color~ +- Inside source: true +*** True Line Result + c.solid = [x, y, w, h, *color, 255] # sets color +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12269,102 +12468,74 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb~ +** Processing line: ~* Input Basics - Keyboard - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb +* Input Basics - Keyboard - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ -- Inside source: true -*** True Line Result - =begin -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ Reminders:~ -- Inside source: true -*** True Line Result - Reminders: -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ # ./samples/02_input_basics/01_keyboard/app/main.rb~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + # ./samples/02_input_basics/01_keyboard/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ In this sample app, we're using string interpolation to iterate through images in the~ -- Inside source: true -*** True Line Result - In this sample app, we're using string interpolation to iterate through images in the -** Processing line: ~ sprites folder using their image path names.~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - sprites folder using their image path names. + APIs listing that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate sprites on the screen.~ -- Inside source: true -*** True Line Result - - args.outputs.sprites: An array. Values in this array generate sprites on the screen. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ -- Inside source: true -*** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. -** Processing line: ~~ + - args.inputs.keyboard.key_up.KEY: The value of the properties will be set +** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ + to the frame that the key_up event occurred (the frame correlates +** Processing line: ~ to args.state.tick_count). Otherwise the value will be nil. For a~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. Values in the array generate labels on the screen. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + to args.state.tick_count). Otherwise the value will be nil. For a +** Processing line: ~ full listing of keys, take a look at mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + full listing of keys, take a look at mygame/documentation/06-keyboard.md. +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + - args.state.PROPERTY: The state property on args is a dynamic +** Processing line: ~ structure. You can define ANY property here with ANY type of~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed.~ + structure. You can define ANY property here with ANY type of +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ - Inside source: true *** True Line Result - - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. -** Processing line: ~ Stores the frame that key was pressed on.~ + arbitrary nesting. Properties defined on args.state will be retained +** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ - Inside source: true *** True Line Result - Stores the frame that key was pressed on. -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ + across frames. If you attempt access a property that doesn't exist +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ - Inside source: true *** True Line Result - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + on args.state, it will simply return nil (no exception will be thrown). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -12377,186 +12548,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # This sample app demonstrates how sprite animations work.~ +** Processing line: ~ # Along with outputs, inputs are also an essential part of video game development~ - Inside source: true *** True Line Result - # This sample app demonstrates how sprite animations work. -** Processing line: ~ # There are two sprites that animate forever and one sprite~ + # Along with outputs, inputs are also an essential part of video game development +** Processing line: ~ # DragonRuby can take input from keyboards, mouse, and controllers.~ - Inside source: true *** True Line Result - # There are two sprites that animate forever and one sprite -** Processing line: ~ # that *only* animates when you press the "f" key on the keyboard.~ + # DragonRuby can take input from keyboards, mouse, and controllers. +** Processing line: ~ # This sample app will cover keyboard input.~ - Inside source: true *** True Line Result - # that *only* animates when you press the "f" key on the keyboard. + # This sample app will cover keyboard input. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This is the entry point to your game. The `tick` method~ +** Processing line: ~ # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed~ - Inside source: true *** True Line Result - # This is the entry point to your game. The `tick` method -** Processing line: ~ # executes at 60 frames per second. There are two methods~ + # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed +** Processing line: ~ # This will work with the other keys as well~ - Inside source: true *** True Line Result - # executes at 60 frames per second. There are two methods -** Processing line: ~ # in this tick "entry point": `looping_animation`, and the~ + # This will work with the other keys as well +** Processing line: ~~ - Inside source: true *** True Line Result - # in this tick "entry point": `looping_animation`, and the -** Processing line: ~ # second method is `one_time_animation`.~ + +** Processing line: ~~ - Inside source: true *** True Line Result - # second method is `one_time_animation`. + ** Processing line: ~ def tick args~ - Inside source: true *** True Line Result def tick args -** Processing line: ~ looping_animation args~ +** Processing line: ~ tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360~ - Inside source: true *** True Line Result - looping_animation args -** Processing line: ~ one_time_animation args~ + tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 +** Processing line: ~ # Notice how small_font accounts for all the remaining parameters~ - Inside source: true *** True Line Result - one_time_animation args -** Processing line: ~ end~ + # Notice how small_font accounts for all the remaining parameters +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ - Inside source: true *** True Line Result - -** Processing line: ~ # This function shows how to animate a sprite that loops forever.~ + args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ - Inside source: true *** True Line Result - # This function shows how to animate a sprite that loops forever. -** Processing line: ~ def looping_animation args~ + args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] +** Processing line: ~~ - Inside source: true *** True Line Result - def looping_animation args -** Processing line: ~ # Here we define a few local variables that will be sent~ + +** Processing line: ~ # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key~ - Inside source: true *** True Line Result - # Here we define a few local variables that will be sent -** Processing line: ~ # into the magic function that gives us the correct sprite image~ + # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key +** Processing line: ~ if args.inputs.keyboard.key_up.h~ - Inside source: true *** True Line Result - # into the magic function that gives us the correct sprite image -** Processing line: ~ # over time. There are four things we need in order to figure~ + if args.inputs.keyboard.key_up.h +** Processing line: ~ args.state.h_pressed_at = args.state.tick_count~ - Inside source: true *** True Line Result - # over time. There are four things we need in order to figure -** Processing line: ~ # out which sprite to show.~ + args.state.h_pressed_at = args.state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - # out which sprite to show. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # 1. When to start the animation.~ +** Processing line: ~ # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false~ - Inside source: true *** True Line Result - # 1. When to start the animation. -** Processing line: ~ start_looping_at = 0~ + # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false +** Processing line: ~ args.state.h_pressed_at ||= false~ - Inside source: true *** True Line Result - start_looping_at = 0 + args.state.h_pressed_at ||= false ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # 2. The number of pngs that represent the full animation.~ +** Processing line: ~ if args.state.h_pressed_at~ - Inside source: true *** True Line Result - # 2. The number of pngs that represent the full animation. -** Processing line: ~ number_of_sprites = 6~ + if args.state.h_pressed_at +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ - Inside source: true *** True Line Result - number_of_sprites = 6 -** Processing line: ~~ + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # 3. How long to show each png.~ + else +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ - Inside source: true *** True Line Result - # 3. How long to show each png. -** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - number_of_frames_to_show_each_sprite = 4 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # 4. Whether the animation should loop once, or forever.~ +** Processing line: ~ tick_help_text args~ - Inside source: true *** True Line Result - # 4. Whether the animation should loop once, or forever. -** Processing line: ~ does_sprite_loop = true~ + tick_help_text args +** Processing line: ~ end~ - Inside source: true *** True Line Result - does_sprite_loop = true + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # With the variables defined above, we can get a number~ +** Processing line: ~ def small_font~ - Inside source: true *** True Line Result - # With the variables defined above, we can get a number -** Processing line: ~ # which represents the sprite to show by calling the `frame_index` function.~ + def small_font +** Processing line: ~ # This method provides some values for the construction of labels~ - Inside source: true *** True Line Result - # which represents the sprite to show by calling the `frame_index` function. -** Processing line: ~ # In this case the number will be between 0, and 5 (you can see the sprites~ + # This method provides some values for the construction of labels +** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ - Inside source: true *** True Line Result - # In this case the number will be between 0, and 5 (you can see the sprites -** Processing line: ~ # in the ./sprites directory).~ + # Specifically, Size, Alignment, & RGBA +** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ - Inside source: true *** True Line Result - # in the ./sprites directory). -** Processing line: ~ sprite_index = start_looping_at.frame_index number_of_sprites,~ + # This makes it so that custom parameters don't have to be repeatedly typed. +** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ - Inside source: true *** True Line Result - sprite_index = start_looping_at.frame_index number_of_sprites, -** Processing line: ~ number_of_frames_to_show_each_sprite,~ + # Additionally "small_font" provides programmers with more information than some numbers +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - number_of_frames_to_show_each_sprite, -** Processing line: ~ does_sprite_loop~ + [-2, 0, 0, 0, 0, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - does_sprite_loop + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Now that we have `sprite_index, we can present the correct file.~ +** Processing line: ~ def row_to_px args, row_number~ - Inside source: true *** True Line Result - # Now that we have `sprite_index, we can present the correct file. -** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ + def row_to_px args, row_number +** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] -** Processing line: ~~ + # This takes a row_number and converts it to pixels DragonRuby understands. +** Processing line: ~ # Row 0 starts 5 units below the top of the grid~ - Inside source: true *** True Line Result - -** Processing line: ~ # Try changing the numbers below to see how the animation changes:~ + # Row 0 starts 5 units below the top of the grid +** Processing line: ~ # Each row afterward is 20 units lower~ - Inside source: true *** True Line Result - # Try changing the numbers below to see how the animation changes: -** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ + # Each row afterward is 20 units lower +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] + args.grid.top.shift_down(5).shift_down(20 * row_number) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12565,78 +12736,106 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # This function shows how to animate a sprite that executes~ -- Inside source: true -*** True Line Result - # This function shows how to animate a sprite that executes -** Processing line: ~ # only once when the "f" key is pressed.~ +** Processing line: ~ # Don't worry about understanding the code within this method just yet.~ - Inside source: true *** True Line Result - # only once when the "f" key is pressed. -** Processing line: ~ def one_time_animation args~ + # Don't worry about understanding the code within this method just yet. +** Processing line: ~ # This method shows you the help text within the game.~ - Inside source: true *** True Line Result - def one_time_animation args -** Processing line: ~ # This is just a label the shows instructions within the game.~ + # This method shows you the help text within the game. +** Processing line: ~ def tick_help_text args~ - Inside source: true *** True Line Result - # This is just a label the shows instructions within the game. -** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ + def tick_help_text args +** Processing line: ~ return unless args.state.h_pressed_at~ - Inside source: true *** True Line Result - args.outputs.labels << [220, 350, "(press f to animate)"] + return unless args.state.h_pressed_at ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If "f" is pressed on the keyboard...~ +** Processing line: ~ args.state.key_value_history ||= {}~ - Inside source: true *** True Line Result - # If "f" is pressed on the keyboard... -** Processing line: ~ if args.inputs.keyboard.key_down.f~ + args.state.key_value_history ||= {} +** Processing line: ~ args.state.key_down_value_history ||= {}~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.f -** Processing line: ~ # Print the frame that "f" was pressed on.~ + args.state.key_down_value_history ||= {} +** Processing line: ~ args.state.key_held_value_history ||= {}~ - Inside source: true *** True Line Result - # Print the frame that "f" was pressed on. -** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ + args.state.key_held_value_history ||= {} +** Processing line: ~ args.state.key_up_value_history ||= {}~ - Inside source: true *** True Line Result - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + args.state.key_up_value_history ||= {} ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # And MOST IMPORTANTLY set the point it time to start the animation,~ +** Processing line: ~ if (args.inputs.keyboard.key_down.truthy_keys.length > 0 ||~ - Inside source: true *** True Line Result - # And MOST IMPORTANTLY set the point it time to start the animation, -** Processing line: ~ # equal to "now" which is represented as args.state.tick_count.~ + if (args.inputs.keyboard.key_down.truthy_keys.length > 0 || +** Processing line: ~ args.inputs.keyboard.key_held.truthy_keys.length > 0 ||~ - Inside source: true *** True Line Result - # equal to "now" which is represented as args.state.tick_count. -** Processing line: ~~ + args.inputs.keyboard.key_held.truthy_keys.length > 0 || +** Processing line: ~ args.inputs.keyboard.key_up.truthy_keys.length > 0)~ - Inside source: true *** True Line Result - -** Processing line: ~ # Also IMPORTANT, you'll notice that the value of when to start looping~ + args.inputs.keyboard.key_up.truthy_keys.length > 0) +** Processing line: ~ args.state.help_available = true~ - Inside source: true *** True Line Result - # Also IMPORTANT, you'll notice that the value of when to start looping -** Processing line: ~ # is stored in `args.state`. This construct's values are retained across~ + args.state.help_available = true +** Processing line: ~ args.state.no_activity_debounce = nil~ - Inside source: true *** True Line Result - # is stored in `args.state`. This construct's values are retained across -** Processing line: ~ # executions of the `tick` method.~ + args.state.no_activity_debounce = nil +** Processing line: ~ else~ - Inside source: true *** True Line Result - # executions of the `tick` method. -** Processing line: ~ args.state.start_looping_at = args.state.tick_count~ + else +** Processing line: ~ args.state.no_activity_debounce ||= 5.seconds~ - Inside source: true *** True Line Result - args.state.start_looping_at = args.state.tick_count + args.state.no_activity_debounce ||= 5.seconds +** Processing line: ~ args.state.no_activity_debounce -= 1~ +- Inside source: true +*** True Line Result + args.state.no_activity_debounce -= 1 +** Processing line: ~ if args.state.no_activity_debounce <= 0~ +- Inside source: true +*** True Line Result + if args.state.no_activity_debounce <= 0 +** Processing line: ~ args.state.help_available = false~ +- Inside source: true +*** True Line Result + args.state.help_available = false +** Processing line: ~ args.state.key_value_history = {}~ +- Inside source: true +*** True Line Result + args.state.key_value_history = {} +** Processing line: ~ args.state.key_down_value_history = {}~ +- Inside source: true +*** True Line Result + args.state.key_down_value_history = {} +** Processing line: ~ args.state.key_held_value_history = {}~ +- Inside source: true +*** True Line Result + args.state.key_held_value_history = {} +** Processing line: ~ args.state.key_up_value_history = {}~ +- Inside source: true +*** True Line Result + args.state.key_up_value_history = {} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12645,106 +12844,262 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # These are the same local variables that were defined~ +** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ - Inside source: true *** True Line Result - # These are the same local variables that were defined -** Processing line: ~ # for the `looping_animation` function.~ + args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] +** Processing line: ~~ - Inside source: true *** True Line Result - # for the `looping_animation` function. -** Processing line: ~ number_of_sprites = 6~ + +** Processing line: ~ if !args.state.help_available~ - Inside source: true *** True Line Result - number_of_sprites = 6 -** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ + if !args.state.help_available +** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font]~ - Inside source: true *** True Line Result - number_of_frames_to_show_each_sprite = 4 + args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Except this sprite does not loop again. If the animation time has passed,~ +** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ - Inside source: true *** True Line Result - # Except this sprite does not loop again. If the animation time has passed, -** Processing line: ~ # then the frame_index function returns nil.~ + args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] +** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ - Inside source: true *** True Line Result - # then the frame_index function returns nil. -** Processing line: ~ does_sprite_loop = false~ + args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] +** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ - Inside source: true *** True Line Result - does_sprite_loop = false -** Processing line: ~~ + args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] +** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ - Inside source: true *** True Line Result - -** Processing line: ~ sprite_index = args.state~ + args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] +** Processing line: ~~ - Inside source: true *** True Line Result - sprite_index = args.state -** Processing line: ~ .start_looping_at~ + +** Processing line: ~ fill_history args, :key_value_history, :down_or_held, nil~ - Inside source: true *** True Line Result - .start_looping_at -** Processing line: ~ .frame_index number_of_sprites,~ + fill_history args, :key_value_history, :down_or_held, nil +** Processing line: ~ fill_history args, :key_down_value_history, :down, :key_down~ - Inside source: true *** True Line Result - .frame_index number_of_sprites, -** Processing line: ~ number_of_frames_to_show_each_sprite,~ + fill_history args, :key_down_value_history, :down, :key_down +** Processing line: ~ fill_history args, :key_held_value_history, :held, :key_held~ - Inside source: true *** True Line Result - number_of_frames_to_show_each_sprite, -** Processing line: ~ does_sprite_loop~ + fill_history args, :key_held_value_history, :held, :key_held +** Processing line: ~ fill_history args, :key_up_value_history, :up, :key_up~ - Inside source: true *** True Line Result - does_sprite_loop + fill_history args, :key_up_value_history, :up, :key_up ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This line sets the frame index to zero, if~ +** Processing line: ~ render_help_labels args, :key_value_history, :down_or_held, nil, 10~ - Inside source: true *** True Line Result - # This line sets the frame index to zero, if -** Processing line: ~ # the animation duration has passed (frame_index returned nil).~ + render_help_labels args, :key_value_history, :down_or_held, nil, 10 +** Processing line: ~ render_help_labels args, :key_down_value_history, :down, :key_down, 330~ - Inside source: true *** True Line Result - # the animation duration has passed (frame_index returned nil). + render_help_labels args, :key_down_value_history, :down, :key_down, 330 +** Processing line: ~ render_help_labels args, :key_held_value_history, :held, :key_held, 650~ +- Inside source: true +*** True Line Result + render_help_labels args, :key_held_value_history, :held, :key_held, 650 +** Processing line: ~ render_help_labels args, :key_up_value_history, :up, :key_up, 990~ +- Inside source: true +*** True Line Result + render_help_labels args, :key_up_value_history, :up, :key_up, 990 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Remeber: we are not looping forever here.~ +** Processing line: ~ def fill_history args, history_key, state_key, keyboard_method~ - Inside source: true *** True Line Result - # Remeber: we are not looping forever here. -** Processing line: ~ sprite_index ||= 0~ + def fill_history args, history_key, state_key, keyboard_method +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :raw_key~ - Inside source: true *** True Line Result - sprite_index ||= 0 + fill_single_history args, history_key, state_key, keyboard_method, :raw_key +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :char~ +- Inside source: true +*** True Line Result + fill_single_history args, history_key, state_key, keyboard_method, :char +** Processing line: ~ args.inputs.keyboard.keys[state_key].each do |key_name|~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.keys[state_key].each do |key_name| +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, key_name~ +- Inside source: true +*** True Line Result + fill_single_history args, history_key, state_key, keyboard_method, key_name +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Present the sprite.~ +** Processing line: ~ def fill_single_history args, history_key, state_key, keyboard_method, key_name~ - Inside source: true *** True Line Result - # Present the sprite. -** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ + def fill_single_history args, history_key, state_key, keyboard_method, key_name +** Processing line: ~ current_value = args.inputs.keyboard.send(key_name)~ - Inside source: true *** True Line Result - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + current_value = args.inputs.keyboard.send(key_name) +** Processing line: ~ if keyboard_method~ +- Inside source: true +*** True Line Result + if keyboard_method +** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(key_name)~ +- Inside source: true +*** True Line Result + current_value = args.inputs.keyboard.send(keyboard_method).send(key_name) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ args.state.as_hash[history_key][key_name] ||= []~ +- Inside source: true +*** True Line Result + args.state.as_hash[history_key][key_name] ||= [] +** Processing line: ~ args.state.as_hash[history_key][key_name] << current_value~ +- Inside source: true +*** True Line Result + args.state.as_hash[history_key][key_name] << current_value +** Processing line: ~ args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse~ +- Inside source: true +*** True Line Result + args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time."~ +** Processing line: ~ def render_help_labels args, history_key, state_key, keyboard_method, x~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." + def render_help_labels args, history_key, state_key, keyboard_method, x +** Processing line: ~ idx = 8~ +- Inside source: true +*** True Line Result + idx = 8 +** Processing line: ~ args.outputs.labels << args.state~ +- Inside source: true +*** True Line Result + args.outputs.labels << args.state +** Processing line: ~ .as_hash[history_key]~ +- Inside source: true +*** True Line Result + .as_hash[history_key] +** Processing line: ~ .keys~ +- Inside source: true +*** True Line Result + .keys +** Processing line: ~ .reverse~ +- Inside source: true +*** True Line Result + .reverse +** Processing line: ~ .map~ +- Inside source: true +*** True Line Result + .map +** Processing line: ~ .with_index do |k, i|~ +- Inside source: true +*** True Line Result + .with_index do |k, i| +** Processing line: ~ v = args.state.as_hash[history_key][k]~ +- Inside source: true +*** True Line Result + v = args.state.as_hash[history_key][k] +** Processing line: ~ current_value = args.inputs.keyboard.send(k)~ +- Inside source: true +*** True Line Result + current_value = args.inputs.keyboard.send(k) +** Processing line: ~ if keyboard_method~ +- Inside source: true +*** True Line Result + if keyboard_method +** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(k)~ +- Inside source: true +*** True Line Result + current_value = args.inputs.keyboard.send(keyboard_method).send(k) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ idx += 2~ +- Inside source: true +*** True Line Result + idx += 2 +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ [x, row_to_px(args, idx - 2),~ +- Inside source: true +*** True Line Result + [x, row_to_px(args, idx - 2), +** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ +- Inside source: true +*** True Line Result + " .#{k} is #{current_value || "nil"}", +** Processing line: ~ small_font],~ +- Inside source: true +*** True Line Result + small_font], +** Processing line: ~ [x, row_to_px(args, idx - 1),~ +- Inside source: true +*** True Line Result + [x, row_to_px(args, idx - 1), +** Processing line: ~ " was #{v}",~ +- Inside source: true +*** True Line Result + " was #{v}", +** Processing line: ~ small_font]~ +- Inside source: true +*** True Line Result + small_font] +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -12753,6 +13108,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result @@ -12817,210 +13176,206 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb~ +** Processing line: ~* Input Basics - Mouse - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb +* Input Basics - Mouse - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ args.state.player.x ||= 100~ -- Inside source: true -*** True Line Result - args.state.player.x ||= 100 -** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ # ./samples/02_input_basics/02_mouse/app/main.rb~ - Inside source: true *** True Line Result - args.state.player.y ||= 100 -** Processing line: ~ args.state.player.w ||= 64~ + # ./samples/02_input_basics/02_mouse/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - args.state.player.w ||= 64 -** Processing line: ~ args.state.player.h ||= 64~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.h ||= 64 -** Processing line: ~ args.state.player.direction ||= 1~ + +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - args.state.player.direction ||= 1 + APIs that haven't been encountered in a previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.player.is_moving = false~ +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ - Inside source: true *** True Line Result - args.state.player.is_moving = false -** Processing line: ~~ + - args.inputs.mouse.click: This property will be set if the mouse was clicked. +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ - Inside source: true *** True Line Result - -** Processing line: ~ # get the keyboard input and set player properties~ + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ - Inside source: true *** True Line Result - # get the keyboard input and set player properties -** Processing line: ~ if args.inputs.keyboard.right~ + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. +** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ - Inside source: true *** True Line Result - if args.inputs.keyboard.right -** Processing line: ~ args.state.player.x += 3~ + - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed +** Processing line: ~ since the click event.~ - Inside source: true *** True Line Result - args.state.player.x += 3 -** Processing line: ~ args.state.player.direction = 1~ + since the click event. +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.direction = 1 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + +** Processing line: ~ Reminder:~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ elsif args.inputs.keyboard.left~ + Reminder: +** Processing line: ~~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.left -** Processing line: ~ args.state.player.x -= 3~ + +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ - Inside source: true *** True Line Result - args.state.player.x -= 3 -** Processing line: ~ args.state.player.direction = -1~ + - args.state.PROPERTY: The state property on args is a dynamic +** Processing line: ~ structure. You can define ANY property here with ANY type of~ - Inside source: true *** True Line Result - args.state.player.direction = -1 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + structure. You can define ANY property here with ANY type of +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ end~ + arbitrary nesting. Properties defined on args.state will be retained +** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ - Inside source: true *** True Line Result - end + across frames. If you attempt access a property that doesn't exist +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ +- Inside source: true +*** True Line Result + on args.state, it will simply return nil (no exception will be thrown). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.up~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - if args.inputs.keyboard.up -** Processing line: ~ args.state.player.y += 1~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.y += 1 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + +** Processing line: ~ # This code demonstrates DragonRuby mouse input~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ elsif args.inputs.keyboard.down~ + # This code demonstrates DragonRuby mouse input +** Processing line: ~~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.down -** Processing line: ~ args.state.player.y -= 1~ + +** Processing line: ~ # To see if the a mouse click occurred~ - Inside source: true *** True Line Result - args.state.player.y -= 1 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + # To see if the a mouse click occurred +** Processing line: ~ # Use args.inputs.mouse.click~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ end~ + # Use args.inputs.mouse.click +** Processing line: ~ # Which returns a boolean~ - Inside source: true *** True Line Result - end + # Which returns a boolean ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if no arrow keys are being pressed, set the player as not moving~ -- Inside source: true -*** True Line Result - # if no arrow keys are being pressed, set the player as not moving -** Processing line: ~ if !args.inputs.keyboard.directional_vector~ +** Processing line: ~ # To see where a mouse click occurred~ - Inside source: true *** True Line Result - if !args.inputs.keyboard.directional_vector -** Processing line: ~ args.state.player.started_running_at = nil~ + # To see where a mouse click occurred +** Processing line: ~ # Use args.inputs.mouse.click.point.x AND~ - Inside source: true *** True Line Result - args.state.player.started_running_at = nil -** Processing line: ~ end~ + # Use args.inputs.mouse.click.point.x AND +** Processing line: ~ # args.inputs.mouse.click.point.y~ - Inside source: true *** True Line Result - end + # args.inputs.mouse.click.point.y ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # wrap player around the stage~ -- Inside source: true -*** True Line Result - # wrap player around the stage -** Processing line: ~ if args.state.player.x > 1280~ +** Processing line: ~ # To see which frame the click occurred~ - Inside source: true *** True Line Result - if args.state.player.x > 1280 -** Processing line: ~ args.state.player.x = -64~ + # To see which frame the click occurred +** Processing line: ~ # Use args.inputs.mouse.click.created_at~ - Inside source: true *** True Line Result - args.state.player.x = -64 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + # Use args.inputs.mouse.click.created_at +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ elsif args.state.player.x < -64~ + +** Processing line: ~ # To see how many frames its been since the click occurred~ - Inside source: true *** True Line Result - elsif args.state.player.x < -64 -** Processing line: ~ args.state.player.x = 1280~ + # To see how many frames its been since the click occurred +** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ - Inside source: true *** True Line Result - args.state.player.x = 1280 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + # Use args.inputs.mouse.click.creat_at_elapsed +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ end~ + +** Processing line: ~ # Saving the click in args.state can be quite useful~ - Inside source: true *** True Line Result - end + # Saving the click in args.state can be quite useful ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.player.y > 720~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - if args.state.player.y > 720 -** Processing line: ~ args.state.player.y = -64~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time."~ - Inside source: true *** True Line Result - args.state.player.y = -64 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time." +** Processing line: ~ x = 460~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count -** Processing line: ~ elsif args.state.player.y < -64~ + x = 460 +** Processing line: ~~ - Inside source: true *** True Line Result - elsif args.state.player.y < -64 -** Processing line: ~ args.state.player.y = 720~ + +** Processing line: ~ args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse")~ - Inside source: true *** True Line Result - args.state.player.y = 720 -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ + args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse") +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.started_running_at ||= args.state.tick_count + +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + args.state.last_mouse_click = args.inputs.mouse.click ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13029,34 +13384,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # render player as standing or running~ +** Processing line: ~ if args.state.last_mouse_click~ - Inside source: true *** True Line Result - # render player as standing or running -** Processing line: ~ if args.state.player.started_running_at~ + if args.state.last_mouse_click +** Processing line: ~ click = args.state.last_mouse_click~ - Inside source: true *** True Line Result - if args.state.player.started_running_at -** Processing line: ~ args.outputs.sprites << running_sprite(args)~ + click = args.state.last_mouse_click +** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}")~ - Inside source: true *** True Line Result - args.outputs.sprites << running_sprite(args) + args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}") +** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago")~ +- Inside source: true +*** True Line Result + args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago") +** Processing line: ~ args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}")~ +- Inside source: true +*** True Line Result + args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}") ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ args.outputs.sprites << standing_sprite(args)~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.")~ - Inside source: true *** True Line Result - args.outputs.sprites << standing_sprite(args) -** Processing line: ~ end~ + args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.") +** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Please click mouse.")~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.outputs.labels << [30, 700, "Use arrow keys to move around."]~ + args.outputs.labels << small_label(args, x, 13, "Please click mouse.") +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.labels << [30, 700, "Use arrow keys to move around."] + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13065,42 +13428,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def standing_sprite args~ +** Processing line: ~ def small_label args, x, row, message~ - Inside source: true *** True Line Result - def standing_sprite args -** Processing line: ~ {~ + def small_label args, x, row, message +** Processing line: ~ # This method effectively combines the row_to_px and small_font methods~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: args.state.player.x,~ + # This method effectively combines the row_to_px and small_font methods +** Processing line: ~ # It changes the given row value to a DragonRuby pixel value~ - Inside source: true *** True Line Result - x: args.state.player.x, -** Processing line: ~ y: args.state.player.y,~ + # It changes the given row value to a DragonRuby pixel value +** Processing line: ~ # and adds the customization parameters~ - Inside source: true *** True Line Result - y: args.state.player.y, -** Processing line: ~ w: args.state.player.w,~ + # and adds the customization parameters +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ - Inside source: true *** True Line Result - w: args.state.player.w, -** Processing line: ~ h: args.state.player.h,~ + [x, row_to_px(args, row), message, small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: args.state.player.h, -** Processing line: ~ path: "sprites/horizontal-stand.png",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - path: "sprites/horizontal-stand.png", -** Processing line: ~ flip_horizontally: args.state.player.direction > 0~ + +** Processing line: ~ def small_font~ - Inside source: true *** True Line Result - flip_horizontally: args.state.player.direction > 0 -** Processing line: ~ }~ + def small_font +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - } + [-2, 0, 0, 0, 0, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13109,58 +13472,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def running_sprite args~ -- Inside source: true -*** True Line Result - def running_sprite args -** Processing line: ~ if !args.state.player.started_running_at~ -- Inside source: true -*** True Line Result - if !args.state.player.started_running_at -** Processing line: ~ tile_index = 0~ +** Processing line: ~ def row_to_px args, row_number~ - Inside source: true *** True Line Result - tile_index = 0 -** Processing line: ~ else~ + def row_to_px args, row_number +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ - Inside source: true *** True Line Result - else -** Processing line: ~ how_many_frames_in_sprite_sheet = 6~ + args.grid.top.shift_down(5).shift_down(20 * row_number) +** Processing line: ~ end~ - Inside source: true *** True Line Result - how_many_frames_in_sprite_sheet = 6 -** Processing line: ~ how_many_ticks_to_hold_each_frame = 3~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - how_many_ticks_to_hold_each_frame = 3 -** Processing line: ~ should_the_index_repeat = true~ + +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - should_the_index_repeat = true -** Processing line: ~ tile_index = args.state~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - tile_index = args.state -** Processing line: ~ .player~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - .player -** Processing line: ~ .started_running_at~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - .started_running_at -** Processing line: ~ .frame_index(how_many_frames_in_sprite_sheet,~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - .frame_index(how_many_frames_in_sprite_sheet, -** Processing line: ~ how_many_ticks_to_hold_each_frame,~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - how_many_ticks_to_hold_each_frame, -** Processing line: ~ should_the_index_repeat)~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - should_the_index_repeat) + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13169,54 +13524,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ x: args.state.player.x,~ -- Inside source: true -*** True Line Result - x: args.state.player.x, -** Processing line: ~ y: args.state.player.y,~ -- Inside source: true -*** True Line Result - y: args.state.player.y, -** Processing line: ~ w: args.state.player.w,~ -- Inside source: true -*** True Line Result - w: args.state.player.w, -** Processing line: ~ h: args.state.player.h,~ -- Inside source: true -*** True Line Result - h: args.state.player.h, -** Processing line: ~ path: 'sprites/horizontal-run.png',~ -- Inside source: true -*** True Line Result - path: 'sprites/horizontal-run.png', -** Processing line: ~ tile_x: 0 + (tile_index * args.state.player.w),~ -- Inside source: true -*** True Line Result - tile_x: 0 + (tile_index * args.state.player.w), -** Processing line: ~ tile_y: 0,~ -- Inside source: true -*** True Line Result - tile_y: 0, -** Processing line: ~ tile_w: args.state.player.w,~ -- Inside source: true -*** True Line Result - tile_w: args.state.player.w, -** Processing line: ~ tile_h: args.state.player.h,~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - tile_h: args.state.player.h, -** Processing line: ~ flip_horizontally: args.state.player.direction > 0,~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - flip_horizontally: args.state.player.direction > 0, -** Processing line: ~ }~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - } + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13233,378 +13552,358 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 03_rendering_sprites/03_animation_states/app/main.rb~ +** Processing line: ~* Input Basics - Mouse Point To Rect - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 03_rendering_sprites/03_animation_states/app/main.rb +* Input Basics - Mouse Point To Rect - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ class Game~ +** Processing line: ~ # ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb~ - Inside source: true *** True Line Result - class Game -** Processing line: ~ attr_gtk~ + # ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - attr_gtk + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults~ -- Inside source: true -*** True Line Result - def defaults -** Processing line: ~ state.show_debug_layer = true if state.tick_count == 0~ +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - state.show_debug_layer = true if state.tick_count == 0 -** Processing line: ~ player.tile_size = 64~ + APIs that haven't been encountered in a previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - player.tile_size = 64 -** Processing line: ~ player.speed = 3~ + +** Processing line: ~ - args.outputus.borders: An array. Values in this array will be rendered as~ - Inside source: true *** True Line Result - player.speed = 3 -** Processing line: ~ player.slash_frames = 15~ + - args.outputus.borders: An array. Values in this array will be rendered as +** Processing line: ~ unfilled rectangles on the screen.~ - Inside source: true *** True Line Result - player.slash_frames = 15 -** Processing line: ~ player.x ||= 50~ + unfilled rectangles on the screen. +** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ - Inside source: true *** True Line Result - player.x ||= 50 -** Processing line: ~ player.y ||= 400~ + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array +** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ - Inside source: true *** True Line Result - player.y ||= 400 -** Processing line: ~ player.dir_x ||= 1~ + with at least four values is considered a rect. The inside_rect? function returns true +** Processing line: ~ or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - player.dir_x ||= 1 -** Processing line: ~ player.dir_y ||= -1~ + or false depending on if the point is inside the rect. +** Processing line: ~~ - Inside source: true *** True Line Result - player.dir_y ||= -1 -** Processing line: ~ player.is_moving ||= false~ + +** Processing line: ~ ```~ - Inside source: true *** True Line Result - player.is_moving ||= false -** Processing line: ~ state.watch_list ||= {}~ + ``` +** Processing line: ~ # Point: x: 100, y: 100~ - Inside source: true *** True Line Result - state.watch_list ||= {} -** Processing line: ~ state.enemies ||= []~ + # Point: x: 100, y: 100 +** Processing line: ~ # Rect: x: 0, y: 0, w: 500, h: 500~ - Inside source: true *** True Line Result - state.enemies ||= [] -** Processing line: ~ end~ + # Rect: x: 0, y: 0, w: 500, h: 500 +** Processing line: ~ # Result: true~ - Inside source: true *** True Line Result - end + # Result: true ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def add_enemy~ -- Inside source: true -*** True Line Result - def add_enemy -** Processing line: ~ state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 }~ +** Processing line: ~ [100, 100].inside_rect? [0, 0, 500, 500]~ - Inside source: true *** True Line Result - state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } -** Processing line: ~ end~ + [100, 100].inside_rect? [0, 0, 500, 500] +** Processing line: ~ ```~ - Inside source: true *** True Line Result - end + ``` ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def sprite_horizontal_run~ -- Inside source: true -*** True Line Result - def sprite_horizontal_run -** Processing line: ~ tile_index = 0.frame_index(6, 3, true)~ -- Inside source: true -*** True Line Result - tile_index = 0.frame_index(6, 3, true) -** Processing line: ~ tile_index = 0 if !player.is_moving~ +** Processing line: ~ ```~ - Inside source: true *** True Line Result - tile_index = 0 if !player.is_moving -** Processing line: ~~ + ``` +** Processing line: ~ # Point: x: 100, y: 100~ - Inside source: true *** True Line Result - -** Processing line: ~ {~ + # Point: x: 100, y: 100 +** Processing line: ~ # Rect: x: 300, y: 300, w: 100, h: 100~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: player.x,~ + # Rect: x: 300, y: 300, w: 100, h: 100 +** Processing line: ~ # Result: false~ - Inside source: true *** True Line Result - x: player.x, -** Processing line: ~ y: player.y,~ + # Result: false +** Processing line: ~~ - Inside source: true *** True Line Result - y: player.y, -** Processing line: ~ w: player.tile_size,~ + +** Processing line: ~ [100, 100].inside_rect? [300, 300, 100, 100]~ - Inside source: true *** True Line Result - w: player.tile_size, -** Processing line: ~ h: player.tile_size,~ + [100, 100].inside_rect? [300, 300, 100, 100] +** Processing line: ~ ```~ - Inside source: true *** True Line Result - h: player.tile_size, -** Processing line: ~ path: 'sprites/horizontal-run.png',~ + ``` +** Processing line: ~~ - Inside source: true *** True Line Result - path: 'sprites/horizontal-run.png', -** Processing line: ~ tile_x: 0 + (tile_index * player.tile_size),~ + +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ - Inside source: true *** True Line Result - tile_x: 0 + (tile_index * player.tile_size), -** Processing line: ~ tile_y: 0,~ + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. +** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ - Inside source: true *** True Line Result - tile_y: 0, -** Processing line: ~ tile_w: player.tile_size,~ + - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed +** Processing line: ~ since the click event.~ - Inside source: true *** True Line Result - tile_w: player.tile_size, -** Processing line: ~ tile_h: player.tile_size,~ + since the click event. +** Processing line: ~~ - Inside source: true *** True Line Result - tile_h: player.tile_size, -** Processing line: ~ flip_horizontally: player.dir_x > 0,~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - flip_horizontally: player.dir_x > 0, -** Processing line: ~ # a: 40~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - # a: 40 -** Processing line: ~ }~ + +** Processing line: ~ # To determine whether a point is in a rect~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + # To determine whether a point is in a rect +** Processing line: ~ # Use point.inside_rect? rect~ - Inside source: true *** True Line Result - end + # Use point.inside_rect? rect ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def sprite_horizontal_stand~ +** Processing line: ~ # This is useful to determine if a click occurred in a rect~ - Inside source: true *** True Line Result - def sprite_horizontal_stand -** Processing line: ~ {~ + # This is useful to determine if a click occurred in a rect +** Processing line: ~~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: player.x,~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - x: player.x, -** Processing line: ~ y: player.y,~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle."~ - Inside source: true *** True Line Result - y: player.y, -** Processing line: ~ w: player.tile_size,~ + tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." +** Processing line: ~~ - Inside source: true *** True Line Result - w: player.tile_size, -** Processing line: ~ h: player.tile_size,~ + +** Processing line: ~ x = 460~ - Inside source: true *** True Line Result - h: player.tile_size, -** Processing line: ~ path: 'sprites/horizontal-stand.png',~ + x = 460 +** Processing line: ~~ - Inside source: true *** True Line Result - path: 'sprites/horizontal-stand.png', -** Processing line: ~ flip_horizontally: player.dir_x > 0,~ + +** Processing line: ~ args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->")~ - Inside source: true *** True Line Result - flip_horizontally: player.dir_x > 0, -** Processing line: ~ # a: 40~ + args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") +** Processing line: ~~ - Inside source: true *** True Line Result - # a: 40 -** Processing line: ~ }~ + +** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + box = [785, 370, 50, 50, 0, 0, 170] +** Processing line: ~ args.outputs.borders << box~ - Inside source: true *** True Line Result - end + args.outputs.borders << box ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def sprite_horizontal_slash~ +** Processing line: ~ # Saves the most recent click into args.state~ - Inside source: true *** True Line Result - def sprite_horizontal_slash -** Processing line: ~ tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0~ + # Saves the most recent click into args.state +** Processing line: ~ # Unlike the other components of args,~ - Inside source: true *** True Line Result - tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 -** Processing line: ~~ + # Unlike the other components of args, +** Processing line: ~ # args.state does not reset every tick.~ - Inside source: true *** True Line Result - -** Processing line: ~ {~ + # args.state does not reset every tick. +** Processing line: ~ if args.inputs.mouse.click~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: player.x - 41.25,~ + if args.inputs.mouse.click +** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ - Inside source: true *** True Line Result - x: player.x - 41.25, -** Processing line: ~ y: player.y - 41.25,~ + args.state.last_mouse_click = args.inputs.mouse.click +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: player.y - 41.25, -** Processing line: ~ w: 165,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - w: 165, -** Processing line: ~ h: 165,~ + +** Processing line: ~ if args.state.last_mouse_click~ - Inside source: true *** True Line Result - h: 165, -** Processing line: ~ path: 'sprites/horizontal-slash.png',~ + if args.state.last_mouse_click +** Processing line: ~ if args.state.last_mouse_click.point.inside_rect? box~ - Inside source: true *** True Line Result - path: 'sprites/horizontal-slash.png', -** Processing line: ~ tile_x: 0 + (tile_index * 128),~ + if args.state.last_mouse_click.point.inside_rect? box +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.")~ - Inside source: true *** True Line Result - tile_x: 0 + (tile_index * 128), -** Processing line: ~ tile_y: 0,~ + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") +** Processing line: ~ else~ - Inside source: true *** True Line Result - tile_y: 0, -** Processing line: ~ tile_w: 128,~ + else +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.")~ - Inside source: true *** True Line Result - tile_w: 128, -** Processing line: ~ tile_h: 128,~ + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") +** Processing line: ~ end~ - Inside source: true *** True Line Result - tile_h: 128, -** Processing line: ~ flip_horizontally: player.dir_x > 0~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - flip_horizontally: player.dir_x > 0 -** Processing line: ~ }~ + else +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.")~ - Inside source: true *** True Line Result - } + args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_player~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - def render_player -** Processing line: ~ if player.slash_at~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if player.slash_at -** Processing line: ~ outputs.sprites << sprite_horizontal_slash~ + +** Processing line: ~ def small_label args, x, row, message~ - Inside source: true *** True Line Result - outputs.sprites << sprite_horizontal_slash -** Processing line: ~ elsif player.is_moving~ + def small_label args, x, row, message +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ - Inside source: true *** True Line Result - elsif player.is_moving -** Processing line: ~ outputs.sprites << sprite_horizontal_run~ + [x, row_to_px(args, row), message, small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.sprites << sprite_horizontal_run -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.sprites << sprite_horizontal_stand~ + +** Processing line: ~ def small_font~ - Inside source: true *** True Line Result - outputs.sprites << sprite_horizontal_stand -** Processing line: ~ end~ + def small_font +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [-2, 0, 0, 0, 0, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_enemies~ +** Processing line: ~ def row_to_px args, row_number~ - Inside source: true *** True Line Result - def render_enemies -** Processing line: ~ outputs.borders << state.enemies~ + def row_to_px args, row_number +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ - Inside source: true *** True Line Result - outputs.borders << state.enemies -** Processing line: ~ end~ + args.grid.top.shift_down(5).shift_down(20 * row_number) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_debug_layer~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - def render_debug_layer -** Processing line: ~ return if !state.show_debug_layer~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - return if !state.show_debug_layer -** Processing line: ~ outputs.labels << state.watch_list.map.with_index do |(k, v), i|~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - outputs.labels << state.watch_list.map.with_index do |(k, v), i| -** Processing line: ~ [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"]~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] -** Processing line: ~ end~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.borders << player.slash_collision_rect~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - outputs.borders << player.slash_collision_rect + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13613,262 +13912,270 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def slash_initiate?~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - def slash_initiate? -** Processing line: ~ # buffalo usb controller has a button and b button swapped lol~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # buffalo usb controller has a button and b button swapped lol -** Processing line: ~ inputs.controller_one.key_down.a || inputs.keyboard.key_down.j~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - inputs.controller_one.key_down.a || inputs.keyboard.key_down.j -** Processing line: ~ end~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def input -** Processing line: ~ # player movement~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - # player movement -** Processing line: ~ if slash_complete? && (vector = inputs.directional_vector)~ -- Inside source: true + +** Processing line: ~* Input Basics - Mouse Rect To Rect - main.rb~ +- Header detected. *** True Line Result - if slash_complete? && (vector = inputs.directional_vector) -** Processing line: ~ player.x += vector.x * player.speed~ -- Inside source: true + *** True Line Result - player.x += vector.x * player.speed -** Processing line: ~ player.y += vector.y * player.speed~ -- Inside source: true +* Input Basics - Mouse Rect To Rect - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - player.y += vector.y * player.speed -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~ player.slash_at = slash_initiate? if slash_initiate?~ +#+begin_src ruby +** Processing line: ~ # ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb~ - Inside source: true *** True Line Result - player.slash_at = slash_initiate? if slash_initiate? -** Processing line: ~ end~ + # ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_movement~ +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ - Inside source: true *** True Line Result - def calc_movement -** Processing line: ~ # movement~ + APIs that haven't been encountered in a previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - # movement -** Processing line: ~ if vector = inputs.directional_vector~ + +** Processing line: ~ - args.outputs.borders: An array. Values in this array will be rendered as~ - Inside source: true *** True Line Result - if vector = inputs.directional_vector -** Processing line: ~ state.debug_label = vector~ + - args.outputs.borders: An array. Values in this array will be rendered as +** Processing line: ~ unfilled rectangles on the screen.~ - Inside source: true *** True Line Result - state.debug_label = vector -** Processing line: ~ player.dir_x = vector.x~ + unfilled rectangles on the screen. +** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ - Inside source: true *** True Line Result - player.dir_x = vector.x -** Processing line: ~ player.dir_y = vector.y~ + - ARRAY#intersect_rect?: An array with at least four values is +** Processing line: ~ considered a rect. The intersect_rect? function returns true~ - Inside source: true *** True Line Result - player.dir_y = vector.y -** Processing line: ~ player.is_moving = true~ + considered a rect. The intersect_rect? function returns true +** Processing line: ~ or false depending on if the two rectangles intersect.~ - Inside source: true *** True Line Result - player.is_moving = true -** Processing line: ~ else~ + or false depending on if the two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.debug_label = vector~ + +** Processing line: ~ ```~ - Inside source: true *** True Line Result - state.debug_label = vector -** Processing line: ~ player.is_moving = false~ + ``` +** Processing line: ~ # Rect One: x: 100, y: 100, w: 100, h: 100~ - Inside source: true *** True Line Result - player.is_moving = false -** Processing line: ~ end~ + # Rect One: x: 100, y: 100, w: 100, h: 100 +** Processing line: ~ # Rect Two: x: 0, y: 0, w: 500, h: 500~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Rect Two: x: 0, y: 0, w: 500, h: 500 +** Processing line: ~ # Result: true~ - Inside source: true *** True Line Result - end + # Result: true ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_slash~ +** Processing line: ~ [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500]~ - Inside source: true *** True Line Result - def calc_slash -** Processing line: ~ # re-calc the location of the swords collision box~ + [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500] +** Processing line: ~ ```~ - Inside source: true *** True Line Result - # re-calc the location of the swords collision box -** Processing line: ~ if player.dir_x.positive?~ + ``` +** Processing line: ~~ - Inside source: true *** True Line Result - if player.dir_x.positive? -** Processing line: ~ player.slash_collision_rect = [player.x + player.tile_size,~ + +** Processing line: ~ ```~ - Inside source: true *** True Line Result - player.slash_collision_rect = [player.x + player.tile_size, -** Processing line: ~ player.y + player.tile_size.half - 10,~ + ``` +** Processing line: ~ # Rect One: x: 100, y: 100, w: 10, h: 10~ - Inside source: true *** True Line Result - player.y + player.tile_size.half - 10, -** Processing line: ~ 40, 20]~ + # Rect One: x: 100, y: 100, w: 10, h: 10 +** Processing line: ~ # Rect Two: x: 500, y: 500, w: 10, h: 10~ - Inside source: true *** True Line Result - 40, 20] -** Processing line: ~ else~ + # Rect Two: x: 500, y: 500, w: 10, h: 10 +** Processing line: ~ # Result: false~ - Inside source: true *** True Line Result - else -** Processing line: ~ player.slash_collision_rect = [player.x - 32 - 8,~ + # Result: false +** Processing line: ~~ - Inside source: true *** True Line Result - player.slash_collision_rect = [player.x - 32 - 8, -** Processing line: ~ player.y + player.tile_size.half - 10,~ + +** Processing line: ~ [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10]~ - Inside source: true *** True Line Result - player.y + player.tile_size.half - 10, -** Processing line: ~ 40, 20]~ + [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10] +** Processing line: ~ ```~ - Inside source: true *** True Line Result - 40, 20] -** Processing line: ~ end~ + ``` +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ =end~ +- Inside source: true +*** True Line Result + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # recalc sword's slash state~ +** Processing line: ~ # Similarly, whether rects intersect can be found through~ - Inside source: true *** True Line Result - # recalc sword's slash state -** Processing line: ~ player.slash_at = nil if slash_complete?~ + # Similarly, whether rects intersect can be found through +** Processing line: ~ # rect1.intersect_rect? rect2~ - Inside source: true *** True Line Result - player.slash_at = nil if slash_complete? + # rect1.intersect_rect? rect2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # determine collision if the sword is at it's point of damaging~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # determine collision if the sword is at it's point of damaging -** Processing line: ~ return unless slash_can_damage?~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to determine if two rectangles intersect."~ - Inside source: true *** True Line Result - return unless slash_can_damage? + tick_instructions args, "Sample app shows how to determine if two rectangles intersect." +** Processing line: ~ x = 460~ +- Inside source: true +*** True Line Result + x = 460 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect }~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen")~ - Inside source: true *** True Line Result - state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } -** Processing line: ~ end~ + args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen") +** Processing line: ~ # red_box = [460, 250, 355, 90, 170, 0, 0]~ - Inside source: true *** True Line Result - end + # red_box = [460, 250, 355, 90, 170, 0, 0] +** Processing line: ~ # args.outputs.borders << red_box~ +- Inside source: true +*** True Line Result + # args.outputs.borders << red_box ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def slash_complete?~ +** Processing line: ~ # args.state.box_collision_one and args.state.box_collision_two~ - Inside source: true *** True Line Result - def slash_complete? -** Processing line: ~ !player.slash_at || player.slash_at.elapsed?(player.slash_frames)~ + # args.state.box_collision_one and args.state.box_collision_two +** Processing line: ~ # Are given values of a solid when they should be rendered~ - Inside source: true *** True Line Result - !player.slash_at || player.slash_at.elapsed?(player.slash_frames) -** Processing line: ~ end~ + # Are given values of a solid when they should be rendered +** Processing line: ~ # They are stored in game so that they do not get reset every tick~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # They are stored in game so that they do not get reset every tick +** Processing line: ~ if args.inputs.mouse.click~ - Inside source: true *** True Line Result - -** Processing line: ~ def slash_can_damage?~ + if args.inputs.mouse.click +** Processing line: ~ if !args.state.box_collision_one~ - Inside source: true *** True Line Result - def slash_can_damage? -** Processing line: ~ # damage occurs half way into the slash animation~ + if !args.state.box_collision_one +** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ - Inside source: true *** True Line Result - # damage occurs half way into the slash animation -** Processing line: ~ return false if slash_complete?~ + args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] +** Processing line: ~ elsif !args.state.box_collision_two~ - Inside source: true *** True Line Result - return false if slash_complete? -** Processing line: ~ return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count~ + elsif !args.state.box_collision_two +** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ - Inside source: true *** True Line Result - return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count -** Processing line: ~ return true~ + args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] +** Processing line: ~ else~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + else +** Processing line: ~ args.state.box_collision_one = nil~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.box_collision_one = nil +** Processing line: ~ args.state.box_collision_two = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc~ + args.state.box_collision_two = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ # generate an enemy if there aren't any on the screen~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # generate an enemy if there aren't any on the screen -** Processing line: ~ add_enemy if state.enemies.length == 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - add_enemy if state.enemies.length == 0 -** Processing line: ~ calc_movement~ + +** Processing line: ~ if args.state.box_collision_one~ - Inside source: true *** True Line Result - calc_movement -** Processing line: ~ calc_slash~ + if args.state.box_collision_one +** Processing line: ~ args.outputs.solids << args.state.box_collision_one~ - Inside source: true *** True Line Result - calc_slash + args.outputs.solids << args.state.box_collision_one ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13877,66 +14184,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # source is at http://github.com/amirrajan/dragonruby-link-to-the-past~ +** Processing line: ~ if args.state.box_collision_two~ - Inside source: true *** True Line Result - # source is at http://github.com/amirrajan/dragonruby-link-to-the-past -** Processing line: ~ def tick~ + if args.state.box_collision_two +** Processing line: ~ args.outputs.solids << args.state.box_collision_two~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + args.outputs.solids << args.state.box_collision_two +** Processing line: ~ end~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render_enemies~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - render_enemies -** Processing line: ~ render_player~ + +** Processing line: ~ if args.state.box_collision_one && args.state.box_collision_two~ - Inside source: true *** True Line Result - render_player -** Processing line: ~ outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."]~ + if args.state.box_collision_one && args.state.box_collision_two +** Processing line: ~ if args.state.box_collision_one.intersect_rect? args.state.box_collision_two~ - Inside source: true *** True Line Result - outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] -** Processing line: ~ outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."]~ + if args.state.box_collision_one.intersect_rect? args.state.box_collision_two +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.')~ - Inside source: true *** True Line Result - outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] -** Processing line: ~ render_debug_layer~ + args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.') +** Processing line: ~ else~ - Inside source: true *** True Line Result - render_debug_layer -** Processing line: ~ input~ + else +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.')~ - Inside source: true *** True Line Result - input -** Processing line: ~ calc~ + args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.') +** Processing line: ~ end~ - Inside source: true *** True Line Result - calc + end +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, '--')~ +- Inside source: true +*** True Line Result + args.outputs.labels << small_label(args, x, 4, '--') ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def player~ +** Processing line: ~ def small_label args, x, row, message~ - Inside source: true *** True Line Result - def player -** Processing line: ~ state.player~ + def small_label args, x, row, message +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ - Inside source: true *** True Line Result - state.player -** Processing line: ~ end~ + [x, row_to_px(args, row), message, small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def small_font~ +- Inside source: true +*** True Line Result + def small_font +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +- Inside source: true +*** True Line Result + [-2, 0, 0, 0, 0, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -13945,38 +14276,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $game = Game.new~ +** Processing line: ~ def row_to_px args, row_number~ - Inside source: true *** True Line Result - $game = Game.new + def row_to_px args, row_number +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +- Inside source: true +*** True Line Result + args.grid.top.shift_down(5).shift_down(20 * row_number) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $game.args = args~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - end + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - $gtk.reset + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -13989,22 +14356,30 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 03_rendering_sprites/04_color_and_rotation/app/main.rb~ +** Processing line: ~* Input Basics - Controller - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 03_rendering_sprites/04_color_and_rotation/app/main.rb +* Input Basics - Controller - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/02_input_basics/05_controller/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/02_input_basics/05_controller/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result =begin +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result @@ -14013,370 +14388,374 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ - merge: Returns a hash containing the contents of two original hashes.~ +** Processing line: ~ - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key~ - Inside source: true *** True Line Result - - merge: Returns a hash containing the contents of two original hashes. -** Processing line: ~ Merge does not allow duplicate keys, so the value of a repeated key~ + - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key +** Processing line: ~ is being held down on the controller.~ - Inside source: true *** True Line Result - Merge does not allow duplicate keys, so the value of a repeated key -** Processing line: ~ will be overwritten.~ + is being held down on the controller. +** Processing line: ~ If there is more than one controller being used, they can be differentiated by~ - Inside source: true *** True Line Result - will be overwritten. + If there is more than one controller being used, they can be differentiated by +** Processing line: ~ using names like controller_one and controller_two.~ +- Inside source: true +*** True Line Result + using names like controller_one and controller_two. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For example, if we had two hashes~ +** Processing line: ~ For a full listing of buttons, take a look at mygame/documentation/08-controllers.md.~ - Inside source: true *** True Line Result - For example, if we had two hashes -** Processing line: ~ h1 = { "a" => 1, "b" => 2}~ + For a full listing of buttons, take a look at mygame/documentation/08-controllers.md. +** Processing line: ~~ - Inside source: true *** True Line Result - h1 = { "a" => 1, "b" => 2} -** Processing line: ~ h2 = { "b" => 3, "c" => 3}~ + +** Processing line: ~ Reminder:~ - Inside source: true *** True Line Result - h2 = { "b" => 3, "c" => 3} -** Processing line: ~ and we called the command~ + Reminder: +** Processing line: ~~ - Inside source: true *** True Line Result - and we called the command -** Processing line: ~ h1.merge(h2)~ + +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ - Inside source: true *** True Line Result - h1.merge(h2) -** Processing line: ~ the result would the following hash~ + - args.state.PROPERTY: The state property on args is a dynamic +** Processing line: ~ structure. You can define ANY property here with ANY type of~ - Inside source: true *** True Line Result - the result would the following hash -** Processing line: ~ { "a" => 1, "b" => 3, "c" => 3}.~ + structure. You can define ANY property here with ANY type of +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ - Inside source: true *** True Line Result - { "a" => 1, "b" => 3, "c" => 3}. -** Processing line: ~~ + arbitrary nesting. Properties defined on args.state will be retained +** Processing line: ~ across frames. If you attempt to access a property that doesn't exist~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + across frames. If you attempt to access a property that doesn't exist +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ - Inside source: true *** True Line Result - Reminders: + on args.state, it will simply return nil (no exception will be thrown). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ -- Inside source: true -*** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The value can be found -** Processing line: ~ using their keys.~ +** Processing line: ~ In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller.~ - Inside source: true *** True Line Result - using their keys. -** Processing line: ~ In this sample app, we're using a hash to create a sprite.~ + In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller. +** Processing line: ~ The parameters of a button are:~ - Inside source: true *** True Line Result - In this sample app, we're using a hash to create a sprite. -** Processing line: ~~ + The parameters of a button are: +** Processing line: ~ 1. the position (x, y)~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ + 1. the position (x, y) +** Processing line: ~ 2. the input key held on the controller~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. The values generate a sprite. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ + 2. the input key held on the controller +** Processing line: ~ 3. the text or name of the button~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] -** Processing line: ~ Before continuing with this sample app, it is HIGHLY recommended that you look~ + 3. the text or name of the button +** Processing line: ~~ - Inside source: true *** True Line Result - Before continuing with this sample app, it is HIGHLY recommended that you look -** Processing line: ~ at mygame/documentation/05-sprites.md.~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - at mygame/documentation/05-sprites.md. + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed.~ +** Processing line: ~ # This sample app provides a visual demonstration of a standard controller, including~ - Inside source: true *** True Line Result - - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ + # This sample app provides a visual demonstration of a standard controller, including +** Processing line: ~ # the placement and function of all buttons.~ - Inside source: true *** True Line Result - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + # the placement and function of all buttons. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.controller_one: Takes input from the controller based on what key is pressed.~ +** Processing line: ~ class ControllerDemo~ - Inside source: true *** True Line Result - - args.inputs.controller_one: Takes input from the controller based on what key is pressed. -** Processing line: ~ For more information about the controller, go to mygame/documentation/08-controllers.md.~ + class ControllerDemo +** Processing line: ~ attr_accessor :inputs, :state, :outputs~ - Inside source: true *** True Line Result - For more information about the controller, go to mygame/documentation/08-controllers.md. + attr_accessor :inputs, :state, :outputs ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ -- Inside source: true -*** True Line Result - - num1.lesser(num2): Finds the lower value of the given options. -** Processing line: ~~ +** Processing line: ~ # Calls the methods necessary for the app to run successfully.~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + # Calls the methods necessary for the app to run successfully. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + def tick +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - -** Processing line: ~ # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen,~ + process_inputs +** Processing line: ~ render~ - Inside source: true *** True Line Result - # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, -** Processing line: ~ # and also can be moved in different directions through keyboard input from the user.~ + render +** Processing line: ~ end~ - Inside source: true *** True Line Result - # and also can be moved in different directions through keyboard input from the user. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls the methods necessary for the game to run successfully.~ +** Processing line: ~ # Starts with an empty collection of buttons.~ - Inside source: true *** True Line Result - # Calls the methods necessary for the game to run successfully. -** Processing line: ~ def tick args~ + # Starts with an empty collection of buttons. +** Processing line: ~ # Adds buttons that are on the controller to the collection.~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ default args~ + # Adds buttons that are on the controller to the collection. +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - default args -** Processing line: ~ render args.grid, args.outputs, args.state~ + def process_inputs +** Processing line: ~ state.buttons = []~ - Inside source: true *** True Line Result - render args.grid, args.outputs, args.state -** Processing line: ~ calc args.state~ + state.buttons = [] +** Processing line: ~~ - Inside source: true *** True Line Result - calc args.state -** Processing line: ~ process_inputs args~ + +** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ - Inside source: true *** True Line Result - process_inputs args -** Processing line: ~ end~ + state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] +** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ - Inside source: true *** True Line Result - end + state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values for the car sprite~ -- Inside source: true -*** True Line Result - # Sets default values for the car sprite -** Processing line: ~ # Initialization ||= only happens in the first frame~ -- Inside source: true -*** True Line Result - # Initialization ||= only happens in the first frame -** Processing line: ~ def default args~ +** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ - Inside source: true *** True Line Result - def default args -** Processing line: ~ args.state.sprite.width = 19~ + state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] +** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ - Inside source: true *** True Line Result - args.state.sprite.width = 19 -** Processing line: ~ args.state.sprite.height = 10~ + state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.sprite.height = 10 -** Processing line: ~ args.state.sprite.scale = 4~ + +** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ - Inside source: true *** True Line Result - args.state.sprite.scale = 4 -** Processing line: ~ args.state.max_speed = 5~ + state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] +** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ - Inside source: true *** True Line Result - args.state.max_speed = 5 -** Processing line: ~ args.state.x ||= 100~ + state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.x ||= 100 -** Processing line: ~ args.state.y ||= 100~ + +** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ - Inside source: true *** True Line Result - args.state.y ||= 100 -** Processing line: ~ args.state.speed ||= 1~ + state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] +** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ - Inside source: true *** True Line Result - args.state.speed ||= 1 -** Processing line: ~ args.state.angle ||= 0~ + state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] +** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ - Inside source: true *** True Line Result - args.state.angle ||= 0 -** Processing line: ~ end~ + state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] +** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ - Inside source: true *** True Line Result - end + state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs sprite onto screen~ +** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ - Inside source: true *** True Line Result - # Outputs sprite onto screen -** Processing line: ~ def render grid, outputs, state~ + state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] +** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ - Inside source: true *** True Line Result - def render grid, outputs, state -** Processing line: ~ outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background~ + state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] +** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ - Inside source: true *** True Line Result - outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background -** Processing line: ~ outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite~ + state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] +** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ - Inside source: true *** True Line Result - outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite -** Processing line: ~ 'sprites/86.png', # image path of car~ + state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] +** Processing line: ~~ - Inside source: true *** True Line Result - 'sprites/86.png', # image path of car -** Processing line: ~ state.angle,~ + +** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ - Inside source: true *** True Line Result - state.angle, -** Processing line: ~ opacity, # transparency~ + state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, +** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ - Inside source: true *** True Line Result - opacity, # transparency -** Processing line: ~ saturation,~ + 100 + inputs.controller_one.left_analog_y_perc * 100, +** Processing line: ~ inputs.controller_one.key_held.l3,~ - Inside source: true *** True Line Result - saturation, -** Processing line: ~ source_rect(state), # sprite sub division/tile (tile x, y, w, h)~ + inputs.controller_one.key_held.l3, +** Processing line: ~ "L3"]~ - Inside source: true *** True Line Result - source_rect(state), # sprite sub division/tile (tile x, y, w, h) -** Processing line: ~ false, false, # don't flip sprites~ + "L3"] +** Processing line: ~~ - Inside source: true *** True Line Result - false, false, # don't flip sprites -** Processing line: ~ rotation_anchor]~ + +** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ - Inside source: true *** True Line Result - rotation_anchor] + state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, +** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ +- Inside source: true +*** True Line Result + 100 + inputs.controller_one.right_analog_y_perc * 100, +** Processing line: ~ inputs.controller_one.key_held.r3,~ +- Inside source: true +*** True Line Result + inputs.controller_one.key_held.r3, +** Processing line: ~ "R3"]~ +- Inside source: true +*** True Line Result + "R3"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # also look at the create_sprite helper method~ +** Processing line: ~ # Gives each button a square shape.~ - Inside source: true *** True Line Result - # also look at the create_sprite helper method -** Processing line: ~ #~ + # Gives each button a square shape. +** Processing line: ~ # If the button is being pressed or held (which means it is considered active),~ - Inside source: true *** True Line Result - # -** Processing line: ~ # For example:~ + # If the button is being pressed or held (which means it is considered active), +** Processing line: ~ # the square is filled in. Otherwise, the button simply has a border.~ - Inside source: true *** True Line Result - # For example: -** Processing line: ~ #~ + # the square is filled in. Otherwise, the button simply has a border. +** Processing line: ~ def render~ - Inside source: true *** True Line Result - # -** Processing line: ~ # dest = destination_rect(state)~ + def render +** Processing line: ~ state.buttons.each do |x, y, active, text|~ - Inside source: true *** True Line Result - # dest = destination_rect(state) -** Processing line: ~ # source = source_rect(state),~ + state.buttons.each do |x, y, active, text| +** Processing line: ~ rect = [x, y, 75, 75]~ - Inside source: true *** True Line Result - # source = source_rect(state), -** Processing line: ~ # outputs.sprites << create_sprite(~ + rect = [x, y, 75, 75] +** Processing line: ~~ - Inside source: true *** True Line Result - # outputs.sprites << create_sprite( -** Processing line: ~ # 'sprites/86.png',~ + +** Processing line: ~ if active # if button is pressed~ - Inside source: true *** True Line Result - # 'sprites/86.png', -** Processing line: ~ # x: dest.x,~ + if active # if button is pressed +** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ - Inside source: true *** True Line Result - # x: dest.x, -** Processing line: ~ # y: dest.y,~ + outputs.solids << rect # rect is output as solid (filled in) +** Processing line: ~ else~ - Inside source: true *** True Line Result - # y: dest.y, -** Processing line: ~ # w: dest.w,~ + else +** Processing line: ~ outputs.borders << rect # otherwise, output as border~ - Inside source: true *** True Line Result - # w: dest.w, -** Processing line: ~ # h: dest.h,~ + outputs.borders << rect # otherwise, output as border +** Processing line: ~ end~ - Inside source: true *** True Line Result - # h: dest.h, -** Processing line: ~ # angle: state.angle,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # angle: state.angle, -** Processing line: ~ # source_x: source.x,~ + +** Processing line: ~ # Outputs the text of each button using labels.~ - Inside source: true *** True Line Result - # source_x: source.x, -** Processing line: ~ # source_y: source.y,~ + # Outputs the text of each button using labels. +** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ - Inside source: true *** True Line Result - # source_y: source.y, -** Processing line: ~ # source_w: source.w,~ + outputs.labels << [x, y + 95, text] # add 95 to place label above button +** Processing line: ~ end~ - Inside source: true *** True Line Result - # source_w: source.w, -** Processing line: ~ # source_h: source.h,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # source_h: source.h, -** Processing line: ~ # flip_h: false,~ + +** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ - Inside source: true *** True Line Result - # flip_h: false, -** Processing line: ~ # flip_v: false,~ + outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] +** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ - Inside source: true *** True Line Result - # flip_v: false, -** Processing line: ~ # rotation_anchor_x: 0.7,~ + outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] +** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ - Inside source: true *** True Line Result - # rotation_anchor_x: 0.7, -** Processing line: ~ # rotation_anchor_y: 0.5~ + outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] +** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ - Inside source: true *** True Line Result - # rotation_anchor_y: 0.5 -** Processing line: ~ # )~ + outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ) + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -14385,306 +14764,286 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates sprite by setting values inside of a hash~ +** Processing line: ~ $controller_demo = ControllerDemo.new~ - Inside source: true *** True Line Result - # Creates sprite by setting values inside of a hash -** Processing line: ~ def create_sprite path, options = {}~ + $controller_demo = ControllerDemo.new +** Processing line: ~~ - Inside source: true *** True Line Result - def create_sprite path, options = {} -** Processing line: ~ options = {~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - options = { -** Processing line: ~~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller."~ - Inside source: true *** True Line Result - -** Processing line: ~ # dest x, y, w, h~ + tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller." +** Processing line: ~ $controller_demo.inputs = args.inputs~ - Inside source: true *** True Line Result - # dest x, y, w, h -** Processing line: ~ x: 0,~ + $controller_demo.inputs = args.inputs +** Processing line: ~ $controller_demo.state = args.state~ - Inside source: true *** True Line Result - x: 0, -** Processing line: ~ y: 0,~ + $controller_demo.state = args.state +** Processing line: ~ $controller_demo.outputs = args.outputs~ - Inside source: true *** True Line Result - y: 0, -** Processing line: ~ w: 100,~ + $controller_demo.outputs = args.outputs +** Processing line: ~ $controller_demo.tick~ - Inside source: true *** True Line Result - w: 100, -** Processing line: ~ h: 100,~ + $controller_demo.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: 100, + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # angle, rotation~ +** Processing line: ~ # Resets the app.~ - Inside source: true *** True Line Result - # angle, rotation -** Processing line: ~ angle: 0,~ + # Resets the app. +** Processing line: ~ def r~ - Inside source: true *** True Line Result - angle: 0, -** Processing line: ~ rotation_anchor_x: 0.5,~ + def r +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - rotation_anchor_x: 0.5, -** Processing line: ~ rotation_anchor_y: 0.5,~ + $gtk.reset +** Processing line: ~ end~ - Inside source: true *** True Line Result - rotation_anchor_y: 0.5, + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # color saturation (red, green, blue), transparency~ -- Inside source: true -*** True Line Result - # color saturation (red, green, blue), transparency -** Processing line: ~ r: 255,~ -- Inside source: true -*** True Line Result - r: 255, -** Processing line: ~ g: 255,~ -- Inside source: true -*** True Line Result - g: 255, -** Processing line: ~ b: 255,~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ a: 255,~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - -** Processing line: ~ # source x, y, width, height~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - # source x, y, width, height -** Processing line: ~ source_x: 0,~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - source_x: 0, -** Processing line: ~ source_y: 0,~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - source_y: 0, -** Processing line: ~ source_w: -1,~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - source_w: -1, -** Processing line: ~ source_h: -1,~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - source_h: -1, + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # flip horiztonally, flip vertically~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # flip horiztonally, flip vertically -** Processing line: ~ flip_h: false,~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - flip_h: false, -** Processing line: ~ flip_v: false,~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - flip_v: false, + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ }.merge options~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - }.merge options +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ [~ -- Inside source: true -*** True Line Result - [ -** Processing line: ~ options[:x], options[:y], options[:w], options[:h], # dest rect keys~ -- Inside source: true +** Processing line: ~* Rendering Sprites - Animation Using Separate Pngs - main.rb~ +- Header detected. *** True Line Result - options[:x], options[:y], options[:w], options[:h], # dest rect keys -** Processing line: ~ path,~ -- Inside source: true + *** True Line Result - path, -** Processing line: ~ options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha~ -- Inside source: true +* Rendering Sprites - Animation Using Separate Pngs - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha -** Processing line: ~ options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys~ -- Inside source: true + *** True Line Result - options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys -** Processing line: ~ options[:flip_h], options[:flip_v], # flip~ +#+begin_src ruby +** Processing line: ~ # ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb~ - Inside source: true *** True Line Result - options[:flip_h], options[:flip_v], # flip -** Processing line: ~ options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor~ + # ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor -** Processing line: ~ ] # hash keys contain corresponding values~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - ] # hash keys contain corresponding values -** Processing line: ~ end~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - end + Reminders: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls the calc_pos and calc_wrap methods.~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - # Calls the calc_pos and calc_wrap methods. -** Processing line: ~ def calc state~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - def calc state -** Processing line: ~ calc_pos state~ + as Ruby code, and the placeholder is replaced with its corresponding value or result. +** Processing line: ~~ - Inside source: true *** True Line Result - calc_pos state -** Processing line: ~ calc_wrap state~ + +** Processing line: ~ In this sample app, we're using string interpolation to iterate through images in the~ - Inside source: true *** True Line Result - calc_wrap state -** Processing line: ~ end~ + In this sample app, we're using string interpolation to iterate through images in the +** Processing line: ~ sprites folder using their image path names.~ - Inside source: true *** True Line Result - end + sprites folder using their image path names. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Changes sprite's position on screen~ -- Inside source: true -*** True Line Result - # Changes sprite's position on screen -** Processing line: ~ # Vectors have magnitude and direction, so the incremented x and y values give the car direction~ +** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate sprites on the screen.~ - Inside source: true *** True Line Result - # Vectors have magnitude and direction, so the incremented x and y values give the car direction -** Processing line: ~ def calc_pos state~ + - args.outputs.sprites: An array. Values in this array generate sprites on the screen. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ - Inside source: true *** True Line Result - def calc_pos state -** Processing line: ~ state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed~ + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ - Inside source: true *** True Line Result - state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed -** Processing line: ~ state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed~ + For more information about sprites, go to mygame/documentation/05-sprites.md. +** Processing line: ~~ - Inside source: true *** True Line Result - state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed -** Processing line: ~ state.speed *= 1.1 # scales speed up~ + +** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ - Inside source: true *** True Line Result - state.speed *= 1.1 # scales speed up -** Processing line: ~ state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed)~ + - args.outputs.labels: An array. Values in the array generate labels on the screen. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) -** Processing line: ~ end~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The screen's dimensions are 1280x720. If the car goes out of scope,~ +** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed.~ - Inside source: true *** True Line Result - # The screen's dimensions are 1280x720. If the car goes out of scope, -** Processing line: ~ # it loops back around on the screen.~ + - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. +** Processing line: ~ Stores the frame that key was pressed on.~ - Inside source: true *** True Line Result - # it loops back around on the screen. -** Processing line: ~ def calc_wrap state~ + Stores the frame that key was pressed on. +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - def calc_wrap state + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # car returns to left side of screen if it disappears on right side of screen~ -- Inside source: true -*** True Line Result - # car returns to left side of screen if it disappears on right side of screen -** Processing line: ~ # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger~ -- Inside source: true -*** True Line Result - # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger -** Processing line: ~ state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # car wraps around to right side of screen if it disappears on the left side~ +** Processing line: ~ # This sample app demonstrates how sprite animations work.~ - Inside source: true *** True Line Result - # car wraps around to right side of screen if it disappears on the left side -** Processing line: ~ state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0~ + # This sample app demonstrates how sprite animations work. +** Processing line: ~ # There are two sprites that animate forever and one sprite~ - Inside source: true *** True Line Result - state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 + # There are two sprites that animate forever and one sprite +** Processing line: ~ # that *only* animates when you press the "f" key on the keyboard.~ +- Inside source: true +*** True Line Result + # that *only* animates when you press the "f" key on the keyboard. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # car wraps around to bottom of screen if it disappears at the top of the screen~ +** Processing line: ~ # This is the entry point to your game. The `tick` method~ - Inside source: true *** True Line Result - # car wraps around to bottom of screen if it disappears at the top of the screen -** Processing line: ~ # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!)~ + # This is the entry point to your game. The `tick` method +** Processing line: ~ # executes at 60 frames per second. There are two methods~ - Inside source: true *** True Line Result - # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) -** Processing line: ~ state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope~ + # executes at 60 frames per second. There are two methods +** Processing line: ~ # in this tick "entry point": `looping_animation`, and the~ - Inside source: true *** True Line Result - state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope -** Processing line: ~~ + # in this tick "entry point": `looping_animation`, and the +** Processing line: ~ # second method is `one_time_animation`.~ - Inside source: true *** True Line Result - -** Processing line: ~ # car wraps around to top of screen if it disappears at the bottom of the screen~ + # second method is `one_time_animation`. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # car wraps around to top of screen if it disappears at the bottom of the screen -** Processing line: ~ state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0~ + def tick args +** Processing line: ~ looping_animation args~ - Inside source: true *** True Line Result - state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 + looping_animation args +** Processing line: ~ one_time_animation args~ +- Inside source: true +*** True Line Result + one_time_animation args ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -14693,138 +15052,134 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Changes angle of sprite based on user input from keyboard or controller~ +** Processing line: ~ # This function shows how to animate a sprite that loops forever.~ - Inside source: true *** True Line Result - # Changes angle of sprite based on user input from keyboard or controller -** Processing line: ~ def process_inputs args~ + # This function shows how to animate a sprite that loops forever. +** Processing line: ~ def looping_animation args~ - Inside source: true *** True Line Result - def process_inputs args -** Processing line: ~~ + def looping_animation args +** Processing line: ~ # Here we define a few local variables that will be sent~ - Inside source: true *** True Line Result - -** Processing line: ~ # NOTE: increasing the angle doesn't mean that the car will continue to go~ + # Here we define a few local variables that will be sent +** Processing line: ~ # into the magic function that gives us the correct sprite image~ - Inside source: true *** True Line Result - # NOTE: increasing the angle doesn't mean that the car will continue to go -** Processing line: ~ # in a specific direction. The angle is increasing, which means that if the~ + # into the magic function that gives us the correct sprite image +** Processing line: ~ # over time. There are four things we need in order to figure~ - Inside source: true *** True Line Result - # in a specific direction. The angle is increasing, which means that if the -** Processing line: ~ # left key was kept in the "down" state, the change in the angle would cause~ + # over time. There are four things we need in order to figure +** Processing line: ~ # out which sprite to show.~ - Inside source: true *** True Line Result - # left key was kept in the "down" state, the change in the angle would cause -** Processing line: ~ # the car to go in a counter-clockwise direction and form a circle (360 degrees)~ + # out which sprite to show. +** Processing line: ~~ - Inside source: true *** True Line Result - # the car to go in a counter-clockwise direction and form a circle (360 degrees) -** Processing line: ~ if args.inputs.keyboard.key_held.left # if left key is pressed~ + +** Processing line: ~ # 1. When to start the animation.~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_held.left # if left key is pressed -** Processing line: ~ args.state.angle += 2 # car's angle is incremented by 2~ + # 1. When to start the animation. +** Processing line: ~ start_looping_at = 0~ - Inside source: true *** True Line Result - args.state.angle += 2 # car's angle is incremented by 2 + start_looping_at = 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The same applies to decreasing the angle. If the right key was kept in the~ +** Processing line: ~ # 2. The number of pngs that represent the full animation.~ - Inside source: true *** True Line Result - # The same applies to decreasing the angle. If the right key was kept in the -** Processing line: ~ # "down" state, the decreasing angle would cause the car to go in a clockwise~ + # 2. The number of pngs that represent the full animation. +** Processing line: ~ number_of_sprites = 6~ - Inside source: true *** True Line Result - # "down" state, the decreasing angle would cause the car to go in a clockwise -** Processing line: ~ # direction and form a circle (360 degrees)~ + number_of_sprites = 6 +** Processing line: ~~ - Inside source: true *** True Line Result - # direction and form a circle (360 degrees) -** Processing line: ~ elsif args.inputs.keyboard.key_held.right # if right key is pressed~ + +** Processing line: ~ # 3. How long to show each png.~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_held.right # if right key is pressed -** Processing line: ~ args.state.angle -= 2 # car's angle is decremented by 2~ + # 3. How long to show each png. +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ - Inside source: true *** True Line Result - args.state.angle -= 2 # car's angle is decremented by 2 + number_of_frames_to_show_each_sprite = 4 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Input from a controller can also change the angle of the car~ +** Processing line: ~ # 4. Whether the animation should loop once, or forever.~ - Inside source: true *** True Line Result - # Input from a controller can also change the angle of the car -** Processing line: ~ elsif args.inputs.controller_one.left_analog_x_perc != 0~ + # 4. Whether the animation should loop once, or forever. +** Processing line: ~ does_sprite_loop = true~ - Inside source: true *** True Line Result - elsif args.inputs.controller_one.left_analog_x_perc != 0 -** Processing line: ~ args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1~ + does_sprite_loop = true +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 -** Processing line: ~ end~ + +** Processing line: ~ # With the variables defined above, we can get a number~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # With the variables defined above, we can get a number +** Processing line: ~ # which represents the sprite to show by calling the `frame_index` function.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # which represents the sprite to show by calling the `frame_index` function. +** Processing line: ~ # In this case the number will be between 0, and 5 (you can see the sprites~ - Inside source: true *** True Line Result - -** Processing line: ~ # A sprite's center of rotation can be altered~ + # In this case the number will be between 0, and 5 (you can see the sprites +** Processing line: ~ # in the ./sprites directory).~ - Inside source: true *** True Line Result - # A sprite's center of rotation can be altered -** Processing line: ~ # Increasing either of these numbers would dramatically increase the~ + # in the ./sprites directory). +** Processing line: ~ sprite_index = start_looping_at.frame_index number_of_sprites,~ - Inside source: true *** True Line Result - # Increasing either of these numbers would dramatically increase the -** Processing line: ~ # car's drift when it turns!~ + sprite_index = start_looping_at.frame_index number_of_sprites, +** Processing line: ~ number_of_frames_to_show_each_sprite,~ - Inside source: true *** True Line Result - # car's drift when it turns! -** Processing line: ~ def rotation_anchor~ -- Inside source: true -*** True Line Result - def rotation_anchor -** Processing line: ~ [0.7, 0.5]~ -- Inside source: true -*** True Line Result - [0.7, 0.5] -** Processing line: ~ end~ + number_of_frames_to_show_each_sprite, +** Processing line: ~ does_sprite_loop~ - Inside source: true *** True Line Result - end + does_sprite_loop ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets opacity value of sprite to 255 so that it is not transparent at all~ +** Processing line: ~ # Now that we have `sprite_index, we can present the correct file.~ - Inside source: true *** True Line Result - # Sets opacity value of sprite to 255 so that it is not transparent at all -** Processing line: ~ # Change it to 0 and you won't be able to see the car sprite on the screen~ + # Now that we have `sprite_index, we can present the correct file. +** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ - Inside source: true *** True Line Result - # Change it to 0 and you won't be able to see the car sprite on the screen -** Processing line: ~ def opacity~ + args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] +** Processing line: ~~ - Inside source: true *** True Line Result - def opacity -** Processing line: ~ 255~ + +** Processing line: ~ # Try changing the numbers below to see how the animation changes:~ - Inside source: true *** True Line Result - 255 + # Try changing the numbers below to see how the animation changes: +** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -14833,174 +15188,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets the color of the sprite to white.~ -- Inside source: true -*** True Line Result - # Sets the color of the sprite to white. -** Processing line: ~ def saturation~ +** Processing line: ~ # This function shows how to animate a sprite that executes~ - Inside source: true *** True Line Result - def saturation -** Processing line: ~ [255, 255, 255]~ + # This function shows how to animate a sprite that executes +** Processing line: ~ # only once when the "f" key is pressed.~ - Inside source: true *** True Line Result - [255, 255, 255] -** Processing line: ~ end~ + # only once when the "f" key is pressed. +** Processing line: ~ def one_time_animation args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def one_time_animation args +** Processing line: ~ # This is just a label the shows instructions within the game.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets definition of destination_rect (used to define the car sprite)~ + # This is just a label the shows instructions within the game. +** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ - Inside source: true *** True Line Result - # Sets definition of destination_rect (used to define the car sprite) -** Processing line: ~ def destination_rect state~ + args.outputs.labels << [220, 350, "(press f to animate)"] +** Processing line: ~~ - Inside source: true *** True Line Result - def destination_rect state -** Processing line: ~ [state.x, state.y,~ + +** Processing line: ~ # If "f" is pressed on the keyboard...~ - Inside source: true *** True Line Result - [state.x, state.y, -** Processing line: ~ state.sprite.width * state.sprite.scale, # multiplies by 4 to set size~ + # If "f" is pressed on the keyboard... +** Processing line: ~ if args.inputs.keyboard.key_down.f~ - Inside source: true *** True Line Result - state.sprite.width * state.sprite.scale, # multiplies by 4 to set size -** Processing line: ~ state.sprite.height * state.sprite.scale]~ + if args.inputs.keyboard.key_down.f +** Processing line: ~ # Print the frame that "f" was pressed on.~ - Inside source: true *** True Line Result - state.sprite.height * state.sprite.scale] -** Processing line: ~ end~ + # Print the frame that "f" was pressed on. +** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ - Inside source: true *** True Line Result - end + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Portion of a sprite (a tile)~ +** Processing line: ~ # And MOST IMPORTANTLY set the point it time to start the animation,~ - Inside source: true *** True Line Result - # Portion of a sprite (a tile) -** Processing line: ~ # Sub division of sprite is denoted as a rectangle directly related to original size of .png~ + # And MOST IMPORTANTLY set the point it time to start the animation, +** Processing line: ~ # equal to "now" which is represented as args.state.tick_count.~ - Inside source: true *** True Line Result - # Sub division of sprite is denoted as a rectangle directly related to original size of .png -** Processing line: ~ # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height)~ + # equal to "now" which is represented as args.state.tick_count. +** Processing line: ~~ - Inside source: true *** True Line Result - # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) -** Processing line: ~ def source_rect state~ + +** Processing line: ~ # Also IMPORTANT, you'll notice that the value of when to start looping~ - Inside source: true *** True Line Result - def source_rect state -** Processing line: ~ [0, 0, state.sprite.width, state.sprite.height]~ + # Also IMPORTANT, you'll notice that the value of when to start looping +** Processing line: ~ # is stored in `args.state`. This construct's values are retained across~ - Inside source: true *** True Line Result - [0, 0, state.sprite.width, state.sprite.height] -** Processing line: ~ end~ + # is stored in `args.state`. This construct's values are retained across +** Processing line: ~ # executions of the `tick` method.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # executions of the `tick` method. +** Processing line: ~ args.state.start_looping_at = args.state.tick_count~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + args.state.start_looping_at = args.state.tick_count +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 04_physics_and_collisions/01_simple/app/main.rb~ -- Header detected. +- Inside source: true *** True Line Result +** Processing line: ~ # These are the same local variables that were defined~ +- Inside source: true *** True Line Result -* 04_physics_and_collisions/01_simple/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + # These are the same local variables that were defined +** Processing line: ~ # for the `looping_animation` function.~ +- Inside source: true *** True Line Result - + # for the `looping_animation` function. +** Processing line: ~ number_of_sprites = 6~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + number_of_sprites = 6 +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ - Inside source: true *** True Line Result - =begin + number_of_frames_to_show_each_sprite = 4 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ # Except this sprite does not loop again. If the animation time has passed,~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ + # Except this sprite does not loop again. If the animation time has passed, +** Processing line: ~ # then the frame_index function returns nil.~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + # then the frame_index function returns nil. +** Processing line: ~ does_sprite_loop = false~ +- Inside source: true +*** True Line Result + does_sprite_loop = false ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ sprite_index = args.state~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ + sprite_index = args.state +** Processing line: ~ .start_looping_at~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~~ + .start_looping_at +** Processing line: ~ .frame_index number_of_sprites,~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + .frame_index number_of_sprites, +** Processing line: ~ number_of_frames_to_show_each_sprite,~ - Inside source: true *** True Line Result - =end + number_of_frames_to_show_each_sprite, +** Processing line: ~ does_sprite_loop~ +- Inside source: true +*** True Line Result + does_sprite_loop ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows collisions between two boxes.~ +** Processing line: ~ # This line sets the frame index to zero, if~ - Inside source: true *** True Line Result - # This sample app shows collisions between two boxes. + # This line sets the frame index to zero, if +** Processing line: ~ # the animation duration has passed (frame_index returned nil).~ +- Inside source: true +*** True Line Result + # the animation duration has passed (frame_index returned nil). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs methods needed for game to run properly.~ +** Processing line: ~ # Remeber: we are not looping forever here.~ - Inside source: true *** True Line Result - # Runs methods needed for game to run properly. -** Processing line: ~ def tick args~ + # Remeber: we are not looping forever here. +** Processing line: ~ sprite_index ||= 0~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to move a square over time and determine collision."~ + sprite_index ||= 0 +** Processing line: ~~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to move a square over time and determine collision." -** Processing line: ~ defaults args~ + +** Processing line: ~ # Present the sprite.~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render args~ + # Present the sprite. +** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ - Inside source: true *** True Line Result - render args -** Processing line: ~ calc args~ + args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] +** Processing line: ~~ - Inside source: true *** True Line Result - calc args + +** Processing line: ~ tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time."~ +- Inside source: true +*** True Line Result + tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -15009,54 +15376,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values.~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # Sets default values. -** Processing line: ~ def defaults args~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ # These values represent the moving box.~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - # These values represent the moving box. -** Processing line: ~ args.state.moving_box_speed = 10~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - args.state.moving_box_speed = 10 -** Processing line: ~ args.state.moving_box_size = 100~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - args.state.moving_box_size = 100 -** Processing line: ~ args.state.moving_box_dx ||= 1~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - args.state.moving_box_dx ||= 1 -** Processing line: ~ args.state.moving_box_dy ||= 1~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - args.state.moving_box_dy ||= 1 -** Processing line: ~ args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # These values represent the center box.~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # These values represent the center box. -** Processing line: ~ args.state.center_box ||= [540, 260, 200, 200, 180]~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - args.state.center_box ||= [540, 260, 200, 200, 180] -** Processing line: ~ args.state.center_box_collision ||= false # initially no collision~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - args.state.center_box_collision ||= false # initially no collision + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -15065,170 +15432,190 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render args~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def render args -** Processing line: ~ # If the game state denotes that a collision has occured,~ +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rendering Sprites - Animation Using Sprite Sheet - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rendering Sprites - Animation Using Sprite Sheet - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb~ - Inside source: true *** True Line Result - # If the game state denotes that a collision has occured, -** Processing line: ~ # render a solid square, otherwise render a border instead.~ + # ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # render a solid square, otherwise render a border instead. -** Processing line: ~ if args.state.center_box_collision~ + def tick args +** Processing line: ~ args.state.player.x ||= 100~ - Inside source: true *** True Line Result - if args.state.center_box_collision -** Processing line: ~ args.outputs.solids << args.state.center_box~ + args.state.player.x ||= 100 +** Processing line: ~ args.state.player.y ||= 100~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.center_box -** Processing line: ~ else~ + args.state.player.y ||= 100 +** Processing line: ~ args.state.player.w ||= 64~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.borders << args.state.center_box~ + args.state.player.w ||= 64 +** Processing line: ~ args.state.player.h ||= 64~ - Inside source: true *** True Line Result - args.outputs.borders << args.state.center_box -** Processing line: ~ end~ + args.state.player.h ||= 64 +** Processing line: ~ args.state.player.direction ||= 1~ - Inside source: true *** True Line Result - end + args.state.player.direction ||= 1 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Then render the moving box.~ +** Processing line: ~ args.state.player.is_moving = false~ - Inside source: true *** True Line Result - # Then render the moving box. -** Processing line: ~ args.outputs.solids << args.state.moving_box~ + args.state.player.is_moving = false +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.moving_box -** Processing line: ~ end~ + +** Processing line: ~ # get the keyboard input and set player properties~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # get the keyboard input and set player properties +** Processing line: ~ if args.inputs.keyboard.right~ - Inside source: true *** True Line Result - -** Processing line: ~ # Generally in a pipeline for a game engine, you have rendering,~ + if args.inputs.keyboard.right +** Processing line: ~ args.state.player.x += 3~ - Inside source: true *** True Line Result - # Generally in a pipeline for a game engine, you have rendering, -** Processing line: ~ # game simulation (calculation), and input processing.~ + args.state.player.x += 3 +** Processing line: ~ args.state.player.direction = 1~ - Inside source: true *** True Line Result - # game simulation (calculation), and input processing. -** Processing line: ~ # This fuction represents the game simulation.~ + args.state.player.direction = 1 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - # This fuction represents the game simulation. -** Processing line: ~ def calc args~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ elsif args.inputs.keyboard.left~ - Inside source: true *** True Line Result - def calc args -** Processing line: ~ position_moving_box args~ + elsif args.inputs.keyboard.left +** Processing line: ~ args.state.player.x -= 3~ - Inside source: true *** True Line Result - position_moving_box args -** Processing line: ~ determine_collision_center_box args~ + args.state.player.x -= 3 +** Processing line: ~ args.state.player.direction = -1~ - Inside source: true *** True Line Result - determine_collision_center_box args -** Processing line: ~ end~ + args.state.player.direction = -1 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - end + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed,~ +** Processing line: ~ if args.inputs.keyboard.up~ - Inside source: true *** True Line Result - # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed, -** Processing line: ~ # and adding it to the current position.~ + if args.inputs.keyboard.up +** Processing line: ~ args.state.player.y += 1~ - Inside source: true *** True Line Result - # and adding it to the current position. -** Processing line: ~ # dx and dy are positive if the box is moving right and up, respectively~ + args.state.player.y += 1 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - # dx and dy are positive if the box is moving right and up, respectively -** Processing line: ~ # dx and dy are negative if the box is moving left and down, respectively~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ elsif args.inputs.keyboard.down~ - Inside source: true *** True Line Result - # dx and dy are negative if the box is moving left and down, respectively -** Processing line: ~ def position_moving_box args~ + elsif args.inputs.keyboard.down +** Processing line: ~ args.state.player.y -= 1~ - Inside source: true *** True Line Result - def position_moving_box args -** Processing line: ~ args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed~ + args.state.player.y -= 1 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed -** Processing line: ~ args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # 1280x720 are the virtual pixels you work with (essentially 720p).~ +** Processing line: ~ # if no arrow keys are being pressed, set the player as not moving~ - Inside source: true *** True Line Result - # 1280x720 are the virtual pixels you work with (essentially 720p). -** Processing line: ~ screen_width = 1280~ + # if no arrow keys are being pressed, set the player as not moving +** Processing line: ~ if !args.inputs.keyboard.directional_vector~ - Inside source: true *** True Line Result - screen_width = 1280 -** Processing line: ~ screen_height = 720~ + if !args.inputs.keyboard.directional_vector +** Processing line: ~ args.state.player.started_running_at = nil~ - Inside source: true *** True Line Result - screen_height = 720 -** Processing line: ~~ + args.state.player.started_running_at = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Position of the box is denoted by the bottom left hand corner, in~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Position of the box is denoted by the bottom left hand corner, in -** Processing line: ~ # that case, we have to subtract the width of the box so that it stays~ + +** Processing line: ~ # wrap player around the stage~ - Inside source: true *** True Line Result - # that case, we have to subtract the width of the box so that it stays -** Processing line: ~ # in the scene (you can try deleting the subtraction to see how it~ + # wrap player around the stage +** Processing line: ~ if args.state.player.x > 1280~ - Inside source: true *** True Line Result - # in the scene (you can try deleting the subtraction to see how it -** Processing line: ~ # impacts the box's movement).~ + if args.state.player.x > 1280 +** Processing line: ~ args.state.player.x = -64~ - Inside source: true *** True Line Result - # impacts the box's movement). -** Processing line: ~ if args.state.moving_box.x > screen_width - args.state.moving_box_size~ + args.state.player.x = -64 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - if args.state.moving_box.x > screen_width - args.state.moving_box_size -** Processing line: ~ args.state.moving_box_dx = -1 # moves left~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ elsif args.state.player.x < -64~ - Inside source: true *** True Line Result - args.state.moving_box_dx = -1 # moves left -** Processing line: ~ elsif args.state.moving_box.x < 0~ + elsif args.state.player.x < -64 +** Processing line: ~ args.state.player.x = 1280~ - Inside source: true *** True Line Result - elsif args.state.moving_box.x < 0 -** Processing line: ~ args.state.moving_box_dx = 1 # moves right~ + args.state.player.x = 1280 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - args.state.moving_box_dx = 1 # moves right + args.state.player.started_running_at ||= args.state.tick_count ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -15237,70 +15624,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Here, we're making sure the moving box remains within the vertical scope of the screen~ +** Processing line: ~ if args.state.player.y > 720~ - Inside source: true *** True Line Result - # Here, we're making sure the moving box remains within the vertical scope of the screen -** Processing line: ~ if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high~ + if args.state.player.y > 720 +** Processing line: ~ args.state.player.y = -64~ - Inside source: true *** True Line Result - if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high -** Processing line: ~ args.state.moving_box_dy = -1 # moves down~ + args.state.player.y = -64 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - args.state.moving_box_dy = -1 # moves down -** Processing line: ~ elsif args.state.moving_box.y < 0 # if the box moves too low~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ elsif args.state.player.y < -64~ - Inside source: true *** True Line Result - elsif args.state.moving_box.y < 0 # if the box moves too low -** Processing line: ~ args.state.moving_box_dy = 1 # moves up~ + elsif args.state.player.y < -64 +** Processing line: ~ args.state.player.y = 720~ - Inside source: true *** True Line Result - args.state.moving_box_dy = 1 # moves up -** Processing line: ~ end~ + args.state.player.y = 720 +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.player.started_running_at ||= args.state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def determine_collision_center_box args~ -- Inside source: true -*** True Line Result - def determine_collision_center_box args -** Processing line: ~ # Collision is handled by the engine. You simply have to call the~ -- Inside source: true -*** True Line Result - # Collision is handled by the engine. You simply have to call the -** Processing line: ~ # `intersect_rect?` function.~ +** Processing line: ~ # render player as standing or running~ - Inside source: true *** True Line Result - # `intersect_rect?` function. -** Processing line: ~ if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect~ + # render player as standing or running +** Processing line: ~ if args.state.player.started_running_at~ - Inside source: true *** True Line Result - if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect -** Processing line: ~ args.state.center_box_collision = true # then a collision happened~ + if args.state.player.started_running_at +** Processing line: ~ args.outputs.sprites << running_sprite(args)~ - Inside source: true *** True Line Result - args.state.center_box_collision = true # then a collision happened + args.outputs.sprites << running_sprite(args) ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ args.state.center_box_collision = false # otherwise, no collision happened~ +** Processing line: ~ args.outputs.sprites << standing_sprite(args)~ - Inside source: true *** True Line Result - args.state.center_box_collision = false # otherwise, no collision happened + args.outputs.sprites << standing_sprite(args) ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ args.outputs.labels << [30, 700, "Use arrow keys to move around."]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [30, 700, "Use arrow keys to move around."] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -15309,554 +15692,514 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ def standing_sprite args~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + def standing_sprite args +** Processing line: ~ {~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + { +** Processing line: ~ x: args.state.player.x,~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + x: args.state.player.x, +** Processing line: ~ y: args.state.player.y,~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + y: args.state.player.y, +** Processing line: ~ w: args.state.player.w,~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + w: args.state.player.w, +** Processing line: ~ h: args.state.player.h,~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + h: args.state.player.h, +** Processing line: ~ path: "sprites/horizontal-stand.png",~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + path: "sprites/horizontal-stand.png", +** Processing line: ~ flip_horizontally: args.state.player.direction > 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + flip_horizontally: args.state.player.direction > 0 +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + end +** Processing line: ~~ - Inside source: true -*** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -- Inside source: true -*** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 04_physics_and_collisions/02_moving_objects/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 04_physics_and_collisions/02_moving_objects/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ -- Inside source: true -*** True Line Result - =begin -** Processing line: ~~ +** Processing line: ~ def running_sprite args~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + def running_sprite args +** Processing line: ~ if !args.state.player.started_running_at~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: -** Processing line: ~~ + if !args.state.player.started_running_at +** Processing line: ~ tile_index = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ + tile_index = 0 +** Processing line: ~ else~ - Inside source: true *** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The value can be found -** Processing line: ~ using their keys.~ + else +** Processing line: ~ how_many_frames_in_sprite_sheet = 6~ - Inside source: true *** True Line Result - using their keys. -** Processing line: ~~ + how_many_frames_in_sprite_sheet = 6 +** Processing line: ~ how_many_ticks_to_hold_each_frame = 3~ - Inside source: true *** True Line Result - -** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ + how_many_ticks_to_hold_each_frame = 3 +** Processing line: ~ should_the_index_repeat = true~ - Inside source: true *** True Line Result - For example, if we have a "numbers" hash that stores numbers in English as the -** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ + should_the_index_repeat = true +** Processing line: ~ tile_index = args.state~ - Inside source: true *** True Line Result - key and numbers in Spanish as the value, we'd have a hash that looks like this... -** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ + tile_index = args.state +** Processing line: ~ .player~ - Inside source: true *** True Line Result - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } -** Processing line: ~ and on it goes.~ + .player +** Processing line: ~ .started_running_at~ - Inside source: true *** True Line Result - and on it goes. -** Processing line: ~~ + .started_running_at +** Processing line: ~ .frame_index(how_many_frames_in_sprite_sheet,~ - Inside source: true *** True Line Result - -** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ + .frame_index(how_many_frames_in_sprite_sheet, +** Processing line: ~ how_many_ticks_to_hold_each_frame,~ - Inside source: true *** True Line Result - Now if we wanted to find the corresponding value of the "one" key, we could say -** Processing line: ~ puts numbers["one"]~ + how_many_ticks_to_hold_each_frame, +** Processing line: ~ should_the_index_repeat)~ - Inside source: true *** True Line Result - puts numbers["one"] -** Processing line: ~ which would print "uno" to the console.~ + should_the_index_repeat) +** Processing line: ~ end~ - Inside source: true *** True Line Result - which would print "uno" to the console. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ +** Processing line: ~ {~ - Inside source: true *** True Line Result - - num1.greater(num2): Returns the greater value. -** Processing line: ~ For example, if we have the command~ + { +** Processing line: ~ x: args.state.player.x,~ - Inside source: true *** True Line Result - For example, if we have the command -** Processing line: ~ puts 4.greater(3)~ + x: args.state.player.x, +** Processing line: ~ y: args.state.player.y,~ - Inside source: true *** True Line Result - puts 4.greater(3) -** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ + y: args.state.player.y, +** Processing line: ~ w: args.state.player.w,~ - Inside source: true *** True Line Result - the number 4 would be printed to the console since it has a greater value than 3. -** Processing line: ~ Similar to lesser, which returns the lesser value.~ + w: args.state.player.w, +** Processing line: ~ h: args.state.player.h,~ - Inside source: true *** True Line Result - Similar to lesser, which returns the lesser value. -** Processing line: ~~ + h: args.state.player.h, +** Processing line: ~ path: 'sprites/horizontal-run.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ + path: 'sprites/horizontal-run.png', +** Processing line: ~ tile_x: 0 + (tile_index * args.state.player.w),~ - Inside source: true *** True Line Result - - num1.lesser(num2): Finds the lower value of the given options. -** Processing line: ~ For example, in the statement~ + tile_x: 0 + (tile_index * args.state.player.w), +** Processing line: ~ tile_y: 0,~ - Inside source: true *** True Line Result - For example, in the statement -** Processing line: ~ a = 4.lesser(3)~ + tile_y: 0, +** Processing line: ~ tile_w: args.state.player.w,~ - Inside source: true *** True Line Result - a = 4.lesser(3) -** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ + tile_w: args.state.player.w, +** Processing line: ~ tile_h: args.state.player.h,~ - Inside source: true *** True Line Result - 3 has a lower value than 4, which means that the value of a would be set to 3, -** Processing line: ~ but if the statement had been~ + tile_h: args.state.player.h, +** Processing line: ~ flip_horizontally: args.state.player.direction > 0,~ - Inside source: true *** True Line Result - but if the statement had been -** Processing line: ~ a = 4.lesser(5)~ + flip_horizontally: args.state.player.direction > 0, +** Processing line: ~ }~ - Inside source: true *** True Line Result - a = 4.lesser(5) -** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - 4 has a lower value than 5, which means that the value of a would be set to 4. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. -** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - For example, you can derive an array of odd numbers from an original array of -** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ -- Inside source: true + +** Processing line: ~* Rendering Sprites - Animation States - main.rb~ +- Header detected. *** True Line Result - numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Rendering Sprites - Animation States - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/03_rendering_sprites/03_animation_states/app/main.rb~ - Inside source: true *** True Line Result - - find_all: Finds all values that satisfy specific requirements. -** Processing line: ~ For example, you can find all elements of a collection that are divisible by 2~ + # ./samples/03_rendering_sprites/03_animation_states/app/main.rb +** Processing line: ~ class Game~ - Inside source: true *** True Line Result - For example, you can find all elements of a collection that are divisible by 2 -** Processing line: ~ or find all objects that have intersected with another object.~ + class Game +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - or find all objects that have intersected with another object. + attr_gtk ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - abs: Returns the absolute value.~ -- Inside source: true -*** True Line Result - - abs: Returns the absolute value. -** Processing line: ~ For example, the command~ -- Inside source: true -*** True Line Result - For example, the command -** Processing line: ~ (-30).abs~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - (-30).abs -** Processing line: ~ would return 30 as a result.~ + def defaults +** Processing line: ~ state.show_debug_layer = true if state.tick_count == 0~ - Inside source: true *** True Line Result - would return 30 as a result. -** Processing line: ~~ + state.show_debug_layer = true if state.tick_count == 0 +** Processing line: ~ player.tile_size = 64~ - Inside source: true *** True Line Result - -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ + player.tile_size = 64 +** Processing line: ~ player.speed = 3~ - Inside source: true *** True Line Result - - map: Ruby method used to transform data; used in arrays, hashes, and collections. -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ + player.speed = 3 +** Processing line: ~ player.slash_frames = 15~ - Inside source: true *** True Line Result - Can be used to perform an action on every element of a collection, such as multiplying -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ + player.slash_frames = 15 +** Processing line: ~ player.x ||= 50~ - Inside source: true *** True Line Result - each element by 2 or declaring every element as a new entity. -** Processing line: ~~ + player.x ||= 50 +** Processing line: ~ player.y ||= 400~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + player.y ||= 400 +** Processing line: ~ player.dir_x ||= 1~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + player.dir_x ||= 1 +** Processing line: ~ player.dir_y ||= -1~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.keyboard.KEY: Determines if a key has been pressed.~ + player.dir_y ||= -1 +** Processing line: ~ player.is_moving ||= false~ - Inside source: true *** True Line Result - - args.inputs.keyboard.KEY: Determines if a key has been pressed. -** Processing line: ~ For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md.~ + player.is_moving ||= false +** Processing line: ~ state.watch_list ||= {}~ - Inside source: true *** True Line Result - For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md. -** Processing line: ~~ + state.watch_list ||= {} +** Processing line: ~ state.enemies ||= []~ - Inside source: true *** True Line Result - -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ + state.enemies ||= [] +** Processing line: ~ end~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ def add_enemy~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ + def add_enemy +** Processing line: ~ state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 }~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ + state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ def sprite_horizontal_run~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + def sprite_horizontal_run +** Processing line: ~ tile_index = 0.frame_index(6, 3, true)~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calls methods needed for game to run properly~ + tile_index = 0.frame_index(6, 3, true) +** Processing line: ~ tile_index = 0 if !player.is_moving~ - Inside source: true *** True Line Result - # Calls methods needed for game to run properly -** Processing line: ~ def tick args~ + tile_index = 0 if !player.is_moving +** Processing line: ~~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ + +** Processing line: ~ {~ - Inside source: true *** True Line Result - tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." -** Processing line: ~ defaults args~ + { +** Processing line: ~ x: player.x,~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render args~ + x: player.x, +** Processing line: ~ y: player.y,~ - Inside source: true *** True Line Result - render args -** Processing line: ~ calc args~ + y: player.y, +** Processing line: ~ w: player.tile_size,~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ input args~ + w: player.tile_size, +** Processing line: ~ h: player.tile_size,~ - Inside source: true *** True Line Result - input args -** Processing line: ~ end~ + h: player.tile_size, +** Processing line: ~ path: 'sprites/horizontal-run.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + path: 'sprites/horizontal-run.png', +** Processing line: ~ tile_x: 0 + (tile_index * player.tile_size),~ - Inside source: true *** True Line Result - -** Processing line: ~ # sets default values and creates empty collections~ + tile_x: 0 + (tile_index * player.tile_size), +** Processing line: ~ tile_y: 0,~ - Inside source: true *** True Line Result - # sets default values and creates empty collections -** Processing line: ~ # initialization only happens in the first frame~ + tile_y: 0, +** Processing line: ~ tile_w: player.tile_size,~ - Inside source: true *** True Line Result - # initialization only happens in the first frame -** Processing line: ~ def defaults args~ + tile_w: player.tile_size, +** Processing line: ~ tile_h: player.tile_size,~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ fiddle args~ + tile_h: player.tile_size, +** Processing line: ~ flip_horizontally: player.dir_x > 0,~ - Inside source: true *** True Line Result - fiddle args -** Processing line: ~ args.state.enemy.hammers ||= []~ + flip_horizontally: player.dir_x > 0, +** Processing line: ~ # a: 40~ - Inside source: true *** True Line Result - args.state.enemy.hammers ||= [] -** Processing line: ~ args.state.enemy.hammer_queue ||= []~ + # a: 40 +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.enemy.hammer_queue ||= [] -** Processing line: ~ args.state.tick_count = args.state.tick_count~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.tick_count = args.state.tick_count -** Processing line: ~ args.state.bridge_top = 128~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.bridge_top = 128 -** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ + +** Processing line: ~ def sprite_horizontal_stand~ - Inside source: true *** True Line Result - args.state.player.x ||= 0 # initializes player's properties -** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ + def sprite_horizontal_stand +** Processing line: ~ {~ - Inside source: true *** True Line Result - args.state.player.y ||= args.state.bridge_top -** Processing line: ~ args.state.player.w ||= 64~ + { +** Processing line: ~ x: player.x,~ - Inside source: true *** True Line Result - args.state.player.w ||= 64 -** Processing line: ~ args.state.player.h ||= 64~ + x: player.x, +** Processing line: ~ y: player.y,~ - Inside source: true *** True Line Result - args.state.player.h ||= 64 -** Processing line: ~ args.state.player.dy ||= 0~ + y: player.y, +** Processing line: ~ w: player.tile_size,~ - Inside source: true *** True Line Result - args.state.player.dy ||= 0 -** Processing line: ~ args.state.player.dx ||= 0~ + w: player.tile_size, +** Processing line: ~ h: player.tile_size,~ - Inside source: true *** True Line Result - args.state.player.dx ||= 0 -** Processing line: ~ args.state.enemy.x ||= 800 # initializes enemy's properties~ + h: player.tile_size, +** Processing line: ~ path: 'sprites/horizontal-stand.png',~ - Inside source: true *** True Line Result - args.state.enemy.x ||= 800 # initializes enemy's properties -** Processing line: ~ args.state.enemy.y ||= 0~ + path: 'sprites/horizontal-stand.png', +** Processing line: ~ flip_horizontally: player.dir_x > 0,~ - Inside source: true *** True Line Result - args.state.enemy.y ||= 0 -** Processing line: ~ args.state.enemy.w ||= 128~ + flip_horizontally: player.dir_x > 0, +** Processing line: ~ # a: 40~ - Inside source: true *** True Line Result - args.state.enemy.w ||= 128 -** Processing line: ~ args.state.enemy.h ||= 128~ + # a: 40 +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.enemy.h ||= 128 -** Processing line: ~ args.state.enemy.dy ||= 0~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.enemy.dy ||= 0 -** Processing line: ~ args.state.enemy.dx ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.enemy.dx ||= 0 -** Processing line: ~ args.state.game_over_at ||= 0~ + +** Processing line: ~ def sprite_horizontal_slash~ - Inside source: true *** True Line Result - args.state.game_over_at ||= 0 -** Processing line: ~ end~ + def sprite_horizontal_slash +** Processing line: ~ tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0~ - Inside source: true *** True Line Result - end + tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # sets enemy, player, hammer values~ +** Processing line: ~ {~ - Inside source: true *** True Line Result - # sets enemy, player, hammer values -** Processing line: ~ def fiddle args~ + { +** Processing line: ~ x: player.x - 41.25,~ - Inside source: true *** True Line Result - def fiddle args -** Processing line: ~ args.state.gravity = -0.3~ + x: player.x - 41.25, +** Processing line: ~ y: player.y - 41.25,~ - Inside source: true *** True Line Result - args.state.gravity = -0.3 -** Processing line: ~ args.state.enemy_jump_power = 10 # sets enemy values~ + y: player.y - 41.25, +** Processing line: ~ w: 165,~ - Inside source: true *** True Line Result - args.state.enemy_jump_power = 10 # sets enemy values -** Processing line: ~ args.state.enemy_jump_interval = 60~ + w: 165, +** Processing line: ~ h: 165,~ - Inside source: true *** True Line Result - args.state.enemy_jump_interval = 60 -** Processing line: ~ args.state.hammer_throw_interval = 40 # sets hammer values~ + h: 165, +** Processing line: ~ path: 'sprites/horizontal-slash.png',~ - Inside source: true *** True Line Result - args.state.hammer_throw_interval = 40 # sets hammer values -** Processing line: ~ args.state.hammer_launch_power_default = 5~ + path: 'sprites/horizontal-slash.png', +** Processing line: ~ tile_x: 0 + (tile_index * 128),~ - Inside source: true *** True Line Result - args.state.hammer_launch_power_default = 5 -** Processing line: ~ args.state.hammer_launch_power_near = 2~ + tile_x: 0 + (tile_index * 128), +** Processing line: ~ tile_y: 0,~ - Inside source: true *** True Line Result - args.state.hammer_launch_power_near = 2 -** Processing line: ~ args.state.hammer_launch_power_far = 7~ + tile_y: 0, +** Processing line: ~ tile_w: 128,~ - Inside source: true *** True Line Result - args.state.hammer_launch_power_far = 7 -** Processing line: ~ args.state.hammer_upward_launch_power = 15~ + tile_w: 128, +** Processing line: ~ tile_h: 128,~ - Inside source: true *** True Line Result - args.state.hammer_upward_launch_power = 15 -** Processing line: ~ args.state.max_hammers_per_volley = 10~ + tile_h: 128, +** Processing line: ~ flip_horizontally: player.dir_x > 0~ - Inside source: true *** True Line Result - args.state.max_hammers_per_volley = 10 -** Processing line: ~ args.state.gap_between_hammers = 10~ + flip_horizontally: player.dir_x > 0 +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.gap_between_hammers = 10 -** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.player_jump_power = 10 # sets player values -** Processing line: ~ args.state.player_jump_power_duration = 10~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player_jump_power_duration = 10 -** Processing line: ~ args.state.player_max_run_speed = 10~ + +** Processing line: ~ def render_player~ - Inside source: true *** True Line Result - args.state.player_max_run_speed = 10 -** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ + def render_player +** Processing line: ~ if player.slash_at~ - Inside source: true *** True Line Result - args.state.player_speed_slowdown_rate = 0.9 -** Processing line: ~ args.state.player_acceleration = 1~ + if player.slash_at +** Processing line: ~ outputs.sprites << sprite_horizontal_slash~ - Inside source: true *** True Line Result - args.state.player_acceleration = 1 -** Processing line: ~ args.state.hammer_size = 32~ + outputs.sprites << sprite_horizontal_slash +** Processing line: ~ elsif player.is_moving~ - Inside source: true *** True Line Result - args.state.hammer_size = 32 -** Processing line: ~ end~ + elsif player.is_moving +** Processing line: ~ outputs.sprites << sprite_horizontal_run~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.sprites << sprite_horizontal_run +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # outputs objects onto the screen~ + else +** Processing line: ~ outputs.sprites << sprite_horizontal_stand~ - Inside source: true *** True Line Result - # outputs objects onto the screen -** Processing line: ~ def render args~ + outputs.sprites << sprite_horizontal_stand +** Processing line: ~ end~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge -** Processing line: ~ # sets x by multiplying 64 to index to find pixel value (places all squares side by side)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # sets x by multiplying 64 to index to find pixel value (places all squares side by side) -** Processing line: ~ # subtracts 64 from bridge_top because position is denoted by bottom left corner~ + +** Processing line: ~ def render_enemies~ - Inside source: true *** True Line Result - # subtracts 64 from bridge_top because position is denoted by bottom left corner -** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ + def render_enemies +** Processing line: ~ outputs.borders << state.enemies~ - Inside source: true *** True Line Result - [i * 64, args.state.bridge_top - 64, 64, 64] + outputs.borders << state.enemies ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -15865,338 +16208,346 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0]~ +** Processing line: ~ def render_debug_layer~ - Inside source: true *** True Line Result - args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0] -** Processing line: ~ args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box)~ + def render_debug_layer +** Processing line: ~ return if !state.show_debug_layer~ - Inside source: true *** True Line Result - args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box) -** Processing line: ~ args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box)~ + return if !state.show_debug_layer +** Processing line: ~ outputs.labels << state.watch_list.map.with_index do |(k, v), i|~ - Inside source: true *** True Line Result - args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box) -** Processing line: ~ args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen~ + outputs.labels << state.watch_list.map.with_index do |(k, v), i| +** Processing line: ~ [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"]~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen -** Processing line: ~ end~ + [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Performs calculations to move objects on the screen~ +** Processing line: ~ outputs.borders << player.slash_collision_rect~ - Inside source: true *** True Line Result - # Performs calculations to move objects on the screen -** Processing line: ~ def calc args~ + outputs.borders << player.slash_collision_rect +** Processing line: ~ end~ - Inside source: true *** True Line Result - def calc args + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ -- Inside source: true -*** True Line Result - # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. -** Processing line: ~ args.state.player.x += args.state.player.dx~ -- Inside source: true -*** True Line Result - args.state.player.x += args.state.player.dx -** Processing line: ~ args.state.player.y += args.state.player.dy~ +** Processing line: ~ def slash_initiate?~ - Inside source: true *** True Line Result - args.state.player.y += args.state.player.dy -** Processing line: ~~ + def slash_initiate? +** Processing line: ~ # buffalo usb controller has a button and b button swapped lol~ - Inside source: true *** True Line Result - -** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ + # buffalo usb controller has a button and b button swapped lol +** Processing line: ~ inputs.controller_one.key_down.a || inputs.keyboard.key_down.j~ - Inside source: true *** True Line Result - # Since acceleration is the change in velocity, the change in y (dy) increases every frame -** Processing line: ~ args.state.player.dy += args.state.gravity~ + inputs.controller_one.key_down.a || inputs.keyboard.key_down.j +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.player.dy += args.state.gravity + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # player's y position is either current y position or y position of top of~ +** Processing line: ~ def input~ - Inside source: true *** True Line Result - # player's y position is either current y position or y position of top of -** Processing line: ~ # bridge, whichever has a greater value~ + def input +** Processing line: ~ # player movement~ - Inside source: true *** True Line Result - # bridge, whichever has a greater value -** Processing line: ~ # ensures that the player never goes below the bridge~ + # player movement +** Processing line: ~ if slash_complete? && (vector = inputs.directional_vector)~ - Inside source: true *** True Line Result - # ensures that the player never goes below the bridge -** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ + if slash_complete? && (vector = inputs.directional_vector) +** Processing line: ~ player.x += vector.x * player.speed~ - Inside source: true *** True Line Result - args.state.player.y = args.state.player.y.greater(args.state.bridge_top) -** Processing line: ~~ + player.x += vector.x * player.speed +** Processing line: ~ player.y += vector.y * player.speed~ - Inside source: true *** True Line Result - -** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ + player.y += vector.y * player.speed +** Processing line: ~ end~ - Inside source: true *** True Line Result - # player's x position is either the current x position or 0, whichever has a greater value -** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ + end +** Processing line: ~ player.slash_at = slash_initiate? if slash_initiate?~ - Inside source: true *** True Line Result - # ensures that the player doesn't go too far left (out of the screen's scope) -** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ + player.slash_at = slash_initiate? if slash_initiate? +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.player.x = args.state.player.x.greater(0) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # player is not falling if it is located on the top of the bridge~ +** Processing line: ~ def calc_movement~ - Inside source: true *** True Line Result - # player is not falling if it is located on the top of the bridge -** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ + def calc_movement +** Processing line: ~ # movement~ - Inside source: true *** True Line Result - args.state.player.falling = false if args.state.player.y == args.state.bridge_top -** Processing line: ~ args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ + # movement +** Processing line: ~ if vector = inputs.directional_vector~ - Inside source: true *** True Line Result - args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player -** Processing line: ~~ + if vector = inputs.directional_vector +** Processing line: ~ state.debug_label = vector~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx~ + state.debug_label = vector +** Processing line: ~ player.dir_x = vector.x~ - Inside source: true *** True Line Result - args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx -** Processing line: ~ args.state.enemy.y += args.state.enemy.dy # same with y and dy~ + player.dir_x = vector.x +** Processing line: ~ player.dir_y = vector.y~ - Inside source: true *** True Line Result - args.state.enemy.y += args.state.enemy.dy # same with y and dy -** Processing line: ~~ + player.dir_y = vector.y +** Processing line: ~ player.is_moving = true~ - Inside source: true *** True Line Result - -** Processing line: ~ # ensures that the enemy never goes below the bridge~ + player.is_moving = true +** Processing line: ~ else~ - Inside source: true *** True Line Result - # ensures that the enemy never goes below the bridge -** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ + else +** Processing line: ~ state.debug_label = vector~ - Inside source: true *** True Line Result - args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) -** Processing line: ~~ + state.debug_label = vector +** Processing line: ~ player.is_moving = false~ - Inside source: true *** True Line Result - -** Processing line: ~ # ensures that the enemy never goes too far left (outside the screen's scope)~ + player.is_moving = false +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ensures that the enemy never goes too far left (outside the screen's scope) -** Processing line: ~ args.state.enemy.x = args.state.enemy.x.greater(0)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.enemy.x = args.state.enemy.x.greater(0) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # objects that go up must come down because of gravity~ +** Processing line: ~ def calc_slash~ - Inside source: true *** True Line Result - # objects that go up must come down because of gravity -** Processing line: ~ args.state.enemy.dy += args.state.gravity~ + def calc_slash +** Processing line: ~ # re-calc the location of the swords collision box~ - Inside source: true *** True Line Result - args.state.enemy.dy += args.state.gravity -** Processing line: ~~ + # re-calc the location of the swords collision box +** Processing line: ~ if player.dir_x.positive?~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ + if player.dir_x.positive? +** Processing line: ~ player.slash_collision_rect = [player.x + player.tile_size,~ - Inside source: true *** True Line Result - args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) -** Processing line: ~~ + player.slash_collision_rect = [player.x + player.tile_size, +** Processing line: ~ player.y + player.tile_size.half - 10,~ - Inside source: true *** True Line Result - -** Processing line: ~ #sets definition of enemy~ + player.y + player.tile_size.half - 10, +** Processing line: ~ 40, 20]~ - Inside source: true *** True Line Result - #sets definition of enemy -** Processing line: ~ args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w]~ + 40, 20] +** Processing line: ~ else~ - Inside source: true *** True Line Result - args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w] -** Processing line: ~~ + else +** Processing line: ~ player.slash_collision_rect = [player.x - 32 - 8,~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge~ + player.slash_collision_rect = [player.x - 32 - 8, +** Processing line: ~ player.y + player.tile_size.half - 10,~ - Inside source: true *** True Line Result - if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge -** Processing line: ~ args.state.enemy.dy = 0 # there is no change in y~ + player.y + player.tile_size.half - 10, +** Processing line: ~ 40, 20]~ - Inside source: true *** True Line Result - args.state.enemy.dy = 0 # there is no change in y -** Processing line: ~ end~ + 40, 20] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if 60 frames have passed and the enemy is not moving vertically~ +** Processing line: ~ # recalc sword's slash state~ - Inside source: true *** True Line Result - # if 60 frames have passed and the enemy is not moving vertically -** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0~ + # recalc sword's slash state +** Processing line: ~ player.slash_at = nil if slash_complete?~ - Inside source: true *** True Line Result - if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0 -** Processing line: ~ args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up~ + player.slash_at = nil if slash_complete? +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up -** Processing line: ~ end~ + +** Processing line: ~ # determine collision if the sword is at it's point of damaging~ - Inside source: true *** True Line Result - end + # determine collision if the sword is at it's point of damaging +** Processing line: ~ return unless slash_can_damage?~ +- Inside source: true +*** True Line Result + return unless slash_can_damage? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if 40 frames have passed or 5 frames have passed since the game ended~ +** Processing line: ~ state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect }~ - Inside source: true *** True Line Result - # if 40 frames have passed or 5 frames have passed since the game ended -** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5~ + state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5 -** Processing line: ~ # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded) -** Processing line: ~ # that is why we're adding 1, to include the max possibility~ + +** Processing line: ~ def slash_complete?~ - Inside source: true *** True Line Result - # that is why we're adding 1, to include the max possibility -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations)~ + def slash_complete? +** Processing line: ~ !player.slash_at || player.slash_at.elapsed?(player.slash_frames)~ - Inside source: true *** True Line Result - volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations) + !player.slash_at || player.slash_at.elapsed?(player.slash_frames) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the horizontal distance between the player and enemy is less than 128 pixels~ +** Processing line: ~ def slash_can_damage?~ - Inside source: true *** True Line Result - # if the horizontal distance between the player and enemy is less than 128 pixels -** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs < 128~ + def slash_can_damage? +** Processing line: ~ # damage occurs half way into the slash animation~ - Inside source: true *** True Line Result - if (args.state.player.x - args.state.enemy.x).abs < 128 -** Processing line: ~ # the change in x won't be that great since the enemy and player are closer to each other~ + # damage occurs half way into the slash animation +** Processing line: ~ return false if slash_complete?~ - Inside source: true *** True Line Result - # the change in x won't be that great since the enemy and player are closer to each other -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1~ + return false if slash_complete? +** Processing line: ~ return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count~ - Inside source: true *** True Line Result - volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1 -** Processing line: ~ end~ + return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count +** Processing line: ~ return true~ - Inside source: true *** True Line Result - end + return true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the horizontal distance between the player and enemy is greater than 300 pixels~ +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - # if the horizontal distance between the player and enemy is greater than 300 pixels -** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs > 300~ + def calc +** Processing line: ~ # generate an enemy if there aren't any on the screen~ - Inside source: true *** True Line Result - if (args.state.player.x - args.state.enemy.x).abs > 300 -** Processing line: ~ # change in x will be more drastic since player and enemy are so far apart~ + # generate an enemy if there aren't any on the screen +** Processing line: ~ add_enemy if state.enemies.length == 0~ - Inside source: true *** True Line Result - # change in x will be more drastic since player and enemy are so far apart -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change~ + add_enemy if state.enemies.length == 0 +** Processing line: ~ calc_movement~ - Inside source: true *** True Line Result - volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change -** Processing line: ~ end~ + calc_movement +** Processing line: ~ calc_slash~ - Inside source: true *** True Line Result - end + calc_slash +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i|~ +** Processing line: ~ # source is at http://github.com/amirrajan/dragonruby-link-to-the-past~ - Inside source: true *** True Line Result - (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i| -** Processing line: ~ args.state.enemy.hammer_queue << { # stores hammer values in a hash~ + # source is at http://github.com/amirrajan/dragonruby-link-to-the-past +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - args.state.enemy.hammer_queue << { # stores hammer values in a hash -** Processing line: ~ x: args.state.enemy.x,~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - x: args.state.enemy.x, -** Processing line: ~ w: args.state.hammer_size,~ + defaults +** Processing line: ~ render_enemies~ - Inside source: true *** True Line Result - w: args.state.hammer_size, -** Processing line: ~ h: args.state.hammer_size,~ + render_enemies +** Processing line: ~ render_player~ - Inside source: true *** True Line Result - h: args.state.hammer_size, -** Processing line: ~ dx: volley_dx, # change in horizontal position~ + render_player +** Processing line: ~ outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."]~ - Inside source: true *** True Line Result - dx: volley_dx, # change in horizontal position -** Processing line: ~ # multiplication operator takes precedence over addition operator~ + outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] +** Processing line: ~ outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."]~ - Inside source: true *** True Line Result - # multiplication operator takes precedence over addition operator -** Processing line: ~ throw_at: args.state.tick_count + i * args.state.gap_between_hammers~ + outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] +** Processing line: ~ render_debug_layer~ - Inside source: true *** True Line Result - throw_at: args.state.tick_count + i * args.state.gap_between_hammers -** Processing line: ~ }~ + render_debug_layer +** Processing line: ~ input~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + input +** Processing line: ~ calc~ - Inside source: true *** True Line Result - end + calc ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -16205,322 +16556,318 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # add elements from hammer_queue collection to the hammers collection by~ -- Inside source: true -*** True Line Result - # add elements from hammer_queue collection to the hammers collection by -** Processing line: ~ # finding all hammers that were thrown before the current frame (have already been thrown)~ -- Inside source: true -*** True Line Result - # finding all hammers that were thrown before the current frame (have already been thrown) -** Processing line: ~ args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h|~ +** Processing line: ~ def player~ - Inside source: true *** True Line Result - args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h| -** Processing line: ~ h[:throw_at] < args.state.tick_count~ + def player +** Processing line: ~ state.player~ - Inside source: true *** True Line Result - h[:throw_at] < args.state.tick_count + state.player ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.enemy.hammers.each do |h| # sets values for all hammers in collection~ +** Processing line: ~ $game = Game.new~ - Inside source: true *** True Line Result - args.state.enemy.hammers.each do |h| # sets values for all hammers in collection -** Processing line: ~ h[:y] ||= args.state.enemy.y + 130~ + $game = Game.new +** Processing line: ~~ - Inside source: true *** True Line Result - h[:y] ||= args.state.enemy.y + 130 -** Processing line: ~ h[:dy] ||= args.state.hammer_upward_launch_power~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - h[:dy] ||= args.state.hammer_upward_launch_power -** Processing line: ~ h[:dy] += args.state.gravity # acceleration is change in gravity~ + def tick args +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - h[:dy] += args.state.gravity # acceleration is change in gravity -** Processing line: ~ h[:x] += h[:dx] # incremented by change in position~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - h[:x] += h[:dx] # incremented by change in position -** Processing line: ~ h[:y] += h[:dy]~ + $game.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - h[:y] += h[:dy] -** Processing line: ~ h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect -** Processing line: ~ end~ + +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - end + $gtk.reset ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # reject hammers that have been thrown before current frame (have already been thrown)~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - # reject hammers that have been thrown before current frame (have already been thrown) -** Processing line: ~ args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h|~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h| -** Processing line: ~ h[:throw_at] < args.state.tick_count~ -- Inside source: true + +** Processing line: ~* Rendering Sprites - Color And Rotation - main.rb~ +- Header detected. *** True Line Result - h[:throw_at] < args.state.tick_count -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ -- Inside source: true +* Rendering Sprites - Color And Rotation - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ # any hammers with a y position less than 0 are rejected from the hammers collection~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb~ - Inside source: true *** True Line Result - # any hammers with a y position less than 0 are rejected from the hammers collection -** Processing line: ~ # since they have gone too far down (outside the scope's screen)~ + # ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - # since they have gone too far down (outside the scope's screen) -** Processing line: ~ args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 }~ + =begin +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 } + APIs listing that haven't been encountered in previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if there are any hammers that intersect with (or hit) the player,~ -- Inside source: true -*** True Line Result - # if there are any hammers that intersect with (or hit) the player, -** Processing line: ~ # the reset_player method is called (so the game can start over)~ -- Inside source: true -*** True Line Result - # the reset_player method is called (so the game can start over) -** Processing line: ~ if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) }~ +** Processing line: ~ - merge: Returns a hash containing the contents of two original hashes.~ - Inside source: true *** True Line Result - if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) } -** Processing line: ~ reset_player args~ + - merge: Returns a hash containing the contents of two original hashes. +** Processing line: ~ Merge does not allow duplicate keys, so the value of a repeated key~ - Inside source: true *** True Line Result - reset_player args -** Processing line: ~ end~ + Merge does not allow duplicate keys, so the value of a repeated key +** Processing line: ~ will be overwritten.~ - Inside source: true *** True Line Result - end + will be overwritten. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the enemy's rect intersects with (or hits) the player,~ +** Processing line: ~ For example, if we had two hashes~ - Inside source: true *** True Line Result - # if the enemy's rect intersects with (or hits) the player, -** Processing line: ~ # the reset_player method is called (so the game can start over)~ + For example, if we had two hashes +** Processing line: ~ h1 = { "a" => 1, "b" => 2}~ - Inside source: true *** True Line Result - # the reset_player method is called (so the game can start over) -** Processing line: ~ if args.state.enemy.rect.intersect_rect? args.state.player.rect~ + h1 = { "a" => 1, "b" => 2} +** Processing line: ~ h2 = { "b" => 3, "c" => 3}~ - Inside source: true *** True Line Result - if args.state.enemy.rect.intersect_rect? args.state.player.rect -** Processing line: ~ reset_player args~ + h2 = { "b" => 3, "c" => 3} +** Processing line: ~ and we called the command~ - Inside source: true *** True Line Result - reset_player args -** Processing line: ~ end~ + and we called the command +** Processing line: ~ h1.merge(h2)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + h1.merge(h2) +** Processing line: ~ the result would the following hash~ - Inside source: true *** True Line Result - end + the result would the following hash +** Processing line: ~ { "a" => 1, "b" => 3, "c" => 3}.~ +- Inside source: true +*** True Line Result + { "a" => 1, "b" => 3, "c" => 3}. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - # Resets the player by changing its properties back to the values they had at initialization -** Processing line: ~ def reset_player args~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - def reset_player args -** Processing line: ~ args.state.player.x = 0~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ - Inside source: true *** True Line Result - args.state.player.x = 0 -** Processing line: ~ args.state.player.y = args.state.bridge_top~ + - Hashes: Collection of unique keys and their corresponding values. The value can be found +** Processing line: ~ using their keys.~ - Inside source: true *** True Line Result - args.state.player.y = args.state.bridge_top -** Processing line: ~ args.state.player.dy = 0~ + using their keys. +** Processing line: ~ In this sample app, we're using a hash to create a sprite.~ - Inside source: true *** True Line Result - args.state.player.dy = 0 -** Processing line: ~ args.state.player.dx = 0~ + In this sample app, we're using a hash to create a sprite. +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.dx = 0 -** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ + +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ - Inside source: true *** True Line Result - args.state.enemy.hammers.clear # empties hammer collection -** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ + - args.outputs.sprites: An array. The values generate a sprite. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - args.state.enemy.hammer_queue.clear # empties hammer_queue -** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] +** Processing line: ~ Before continuing with this sample app, it is HIGHLY recommended that you look~ - Inside source: true *** True Line Result - args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) -** Processing line: ~ end~ + Before continuing with this sample app, it is HIGHLY recommended that you look +** Processing line: ~ at mygame/documentation/05-sprites.md.~ - Inside source: true *** True Line Result - end + at mygame/documentation/05-sprites.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Processes input from the user to move the player~ +** Processing line: ~ - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed.~ - Inside source: true *** True Line Result - # Processes input from the user to move the player -** Processing line: ~ def input args~ + - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - def input args -** Processing line: ~ if args.inputs.keyboard.space # if the user presses the space bar~ + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. +** Processing line: ~~ - Inside source: true *** True Line Result - if args.inputs.keyboard.space # if the user presses the space bar -** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ + +** Processing line: ~ - args.inputs.controller_one: Takes input from the controller based on what key is pressed.~ - Inside source: true *** True Line Result - args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame + - args.inputs.controller_one: Takes input from the controller based on what key is pressed. +** Processing line: ~ For more information about the controller, go to mygame/documentation/08-controllers.md.~ +- Inside source: true +*** True Line Result + For more information about the controller, go to mygame/documentation/08-controllers.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ +** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ - Inside source: true *** True Line Result - # if the time that has passed since the jump is less than the player's jump duration and -** Processing line: ~ # the player is not falling~ + - num1.lesser(num2): Finds the lower value of the given options. +** Processing line: ~~ - Inside source: true *** True Line Result - # the player is not falling -** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling -** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump -** Processing line: ~ end~ + +** Processing line: ~ # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, +** Processing line: ~ # and also can be moved in different directions through keyboard input from the user.~ - Inside source: true *** True Line Result - end + # and also can be moved in different directions through keyboard input from the user. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ +** Processing line: ~ # Calls the methods necessary for the game to run successfully.~ - Inside source: true *** True Line Result - # if the space bar is in the "up" state (or not being pressed down) -** Processing line: ~ if args.inputs.keyboard.key_up.space~ + # Calls the methods necessary for the game to run successfully. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_up.space -** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ + def tick args +** Processing line: ~ default args~ - Inside source: true *** True Line Result - args.state.player.jumped_at = nil # jumped_at is empty -** Processing line: ~ args.state.player.falling = true # the player is falling~ + default args +** Processing line: ~ render args.grid, args.outputs, args.state~ - Inside source: true *** True Line Result - args.state.player.falling = true # the player is falling -** Processing line: ~ end~ + render args.grid, args.outputs, args.state +** Processing line: ~ calc args.state~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + calc args.state +** Processing line: ~ process_inputs args~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.keyboard.left # if left key is pressed~ + process_inputs args +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.inputs.keyboard.left # if left key is pressed -** Processing line: ~ args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left) -** Processing line: ~ # dx is either set to current dx or the negative max run speed (which would be -10),~ + +** Processing line: ~ # Sets default values for the car sprite~ - Inside source: true *** True Line Result - # dx is either set to current dx or the negative max run speed (which would be -10), -** Processing line: ~ # whichever has a greater value~ + # Sets default values for the car sprite +** Processing line: ~ # Initialization ||= only happens in the first frame~ - Inside source: true *** True Line Result - # whichever has a greater value -** Processing line: ~ args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)~ + # Initialization ||= only happens in the first frame +** Processing line: ~ def default args~ - Inside source: true *** True Line Result - args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed) -** Processing line: ~ elsif args.inputs.keyboard.right # if right key is pressed~ + def default args +** Processing line: ~ args.state.sprite.width = 19~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.right # if right key is pressed -** Processing line: ~ args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)~ + args.state.sprite.width = 19 +** Processing line: ~ args.state.sprite.height = 10~ - Inside source: true *** True Line Result - args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right) -** Processing line: ~ # dx is either set to current dx or max run speed (which would be 10),~ + args.state.sprite.height = 10 +** Processing line: ~ args.state.sprite.scale = 4~ - Inside source: true *** True Line Result - # dx is either set to current dx or max run speed (which would be 10), -** Processing line: ~ # whichever has a lesser value~ + args.state.sprite.scale = 4 +** Processing line: ~ args.state.max_speed = 5~ - Inside source: true *** True Line Result - # whichever has a lesser value -** Processing line: ~ args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)~ + args.state.max_speed = 5 +** Processing line: ~ args.state.x ||= 100~ - Inside source: true *** True Line Result - args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed) -** Processing line: ~ else~ + args.state.x ||= 100 +** Processing line: ~ args.state.y ||= 100~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ + args.state.y ||= 100 +** Processing line: ~ args.state.speed ||= 1~ - Inside source: true *** True Line Result - args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down -** Processing line: ~ end~ + args.state.speed ||= 1 +** Processing line: ~ args.state.angle ||= 0~ - Inside source: true *** True Line Result - end + args.state.angle ||= 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -16529,322 +16876,314 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ # Outputs sprite onto screen~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + # Outputs sprite onto screen +** Processing line: ~ def render grid, outputs, state~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + def render grid, outputs, state +** Processing line: ~ outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background +** Processing line: ~ outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite +** Processing line: ~ 'sprites/86.png', # image path of car~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.space ||~ + 'sprites/86.png', # image path of car +** Processing line: ~ state.angle,~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.space || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + state.angle, +** Processing line: ~ opacity, # transparency~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + opacity, # transparency +** Processing line: ~ saturation,~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + saturation, +** Processing line: ~ source_rect(state), # sprite sub division/tile (tile x, y, w, h)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + source_rect(state), # sprite sub division/tile (tile x, y, w, h) +** Processing line: ~ false, false, # don't flip sprites~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + false, false, # don't flip sprites +** Processing line: ~ rotation_anchor]~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + rotation_anchor] +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + +** Processing line: ~ # also look at the create_sprite helper method~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + # also look at the create_sprite helper method +** Processing line: ~ #~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # +** Processing line: ~ # For example:~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + # For example: +** Processing line: ~ #~ +- Inside source: true *** True Line Result - -** Processing line: ~* 04_physics_and_collisions/03_entities/app/main.rb~ -- Header detected. + # +** Processing line: ~ # dest = destination_rect(state)~ +- Inside source: true *** True Line Result - + # dest = destination_rect(state) +** Processing line: ~ # source = source_rect(state),~ +- Inside source: true *** True Line Result -* 04_physics_and_collisions/03_entities/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + # source = source_rect(state), +** Processing line: ~ # outputs.sprites << create_sprite(~ +- Inside source: true *** True Line Result - + # outputs.sprites << create_sprite( +** Processing line: ~ # 'sprites/86.png',~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + # 'sprites/86.png', +** Processing line: ~ # x: dest.x,~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # x: dest.x, +** Processing line: ~ # y: dest.y,~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + # y: dest.y, +** Processing line: ~ # w: dest.w,~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + # w: dest.w, +** Processing line: ~ # h: dest.h,~ - Inside source: true *** True Line Result - -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ + # h: dest.h, +** Processing line: ~ # angle: state.angle,~ - Inside source: true *** True Line Result - - map: Ruby method used to transform data; used in arrays, hashes, and collections. -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ + # angle: state.angle, +** Processing line: ~ # source_x: source.x,~ - Inside source: true *** True Line Result - Can be used to perform an action on every element of a collection, such as multiplying -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ + # source_x: source.x, +** Processing line: ~ # source_y: source.y,~ - Inside source: true *** True Line Result - each element by 2 or declaring every element as a new entity. -** Processing line: ~~ + # source_y: source.y, +** Processing line: ~ # source_w: source.w,~ - Inside source: true *** True Line Result - -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ + # source_w: source.w, +** Processing line: ~ # source_h: source.h,~ - Inside source: true *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. -** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ + # source_h: source.h, +** Processing line: ~ # flip_h: false,~ - Inside source: true *** True Line Result - For example, you can derive an array of odd numbers from an original array of -** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ + # flip_h: false, +** Processing line: ~ # flip_v: false,~ - Inside source: true *** True Line Result - numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). -** Processing line: ~~ + # flip_v: false, +** Processing line: ~ # rotation_anchor_x: 0.7,~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ + # rotation_anchor_x: 0.7, +** Processing line: ~ # rotation_anchor_y: 0.5~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ In this sample app, new_entity is used to define the properties of enemies and bullets.~ + # rotation_anchor_y: 0.5 +** Processing line: ~ # )~ - Inside source: true *** True Line Result - In this sample app, new_entity is used to define the properties of enemies and bullets. -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ + # ) +** Processing line: ~ end~ - Inside source: true *** True Line Result - (Remember, you can use state to define ANY property and it will be retained across frames.) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values generate a label on the screen.~ +** Processing line: ~ # Creates sprite by setting values inside of a hash~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label on the screen. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # Creates sprite by setting values inside of a hash +** Processing line: ~ def create_sprite path, options = {}~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + def create_sprite path, options = {} +** Processing line: ~ options = {~ +- Inside source: true +*** True Line Result + options = { ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +** Processing line: ~ # dest x, y, w, h~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. -** Processing line: ~~ + # dest x, y, w, h +** Processing line: ~ x: 0,~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ + x: 0, +** Processing line: ~ y: 0,~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. -** Processing line: ~~ + y: 0, +** Processing line: ~ w: 100,~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + w: 100, +** Processing line: ~ h: 100,~ - Inside source: true *** True Line Result - =end + h: 100, ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows enemies that contain an id value and the time they were created.~ -- Inside source: true -*** True Line Result - # This sample app shows enemies that contain an id value and the time they were created. -** Processing line: ~ # These enemies can be removed by shooting at them with bullets.~ +** Processing line: ~ # angle, rotation~ - Inside source: true *** True Line Result - # These enemies can be removed by shooting at them with bullets. -** Processing line: ~~ + # angle, rotation +** Processing line: ~ angle: 0,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calls all methods necessary for the game to function properly.~ + angle: 0, +** Processing line: ~ rotation_anchor_x: 0.5,~ - Inside source: true *** True Line Result - # Calls all methods necessary for the game to function properly. -** Processing line: ~ def tick args~ + rotation_anchor_x: 0.5, +** Processing line: ~ rotation_anchor_y: 0.5,~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet."~ + rotation_anchor_y: 0.5, +** Processing line: ~~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet." -** Processing line: ~ defaults args~ + +** Processing line: ~ # color saturation (red, green, blue), transparency~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render args~ + # color saturation (red, green, blue), transparency +** Processing line: ~ r: 255,~ - Inside source: true *** True Line Result - render args -** Processing line: ~ calc args~ + r: 255, +** Processing line: ~ g: 255,~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ process_inputs args~ + g: 255, +** Processing line: ~ b: 255,~ - Inside source: true *** True Line Result - process_inputs args -** Processing line: ~ end~ + b: 255, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - end + a: 255, ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values~ -- Inside source: true -*** True Line Result - # Sets default values -** Processing line: ~ # Enemies and bullets start off as empty collections~ +** Processing line: ~ # source x, y, width, height~ - Inside source: true *** True Line Result - # Enemies and bullets start off as empty collections -** Processing line: ~ def defaults args~ + # source x, y, width, height +** Processing line: ~ source_x: 0,~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ args.state.enemies ||= []~ + source_x: 0, +** Processing line: ~ source_y: 0,~ - Inside source: true *** True Line Result - args.state.enemies ||= [] -** Processing line: ~ args.state.bullets ||= []~ + source_y: 0, +** Processing line: ~ source_w: -1,~ - Inside source: true *** True Line Result - args.state.bullets ||= [] -** Processing line: ~ end~ + source_w: -1, +** Processing line: ~ source_h: -1,~ - Inside source: true *** True Line Result - end + source_h: -1, ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Provides each enemy in enemies collection with rectangular border,~ -- Inside source: true -*** True Line Result - # Provides each enemy in enemies collection with rectangular border, -** Processing line: ~ # as well as a label showing id and when they were created~ +** Processing line: ~ # flip horiztonally, flip vertically~ - Inside source: true *** True Line Result - # as well as a label showing id and when they were created -** Processing line: ~ def render args~ + # flip horiztonally, flip vertically +** Processing line: ~ flip_h: false,~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ # When you're calling a method that takes no arguments, you can use this & syntax on map.~ + flip_h: false, +** Processing line: ~ flip_v: false,~ - Inside source: true *** True Line Result - # When you're calling a method that takes no arguments, you can use this & syntax on map. -** Processing line: ~ # Numbers are being added to x and y in order to keep the text within the enemy's borders.~ + flip_v: false, +** Processing line: ~~ - Inside source: true *** True Line Result - # Numbers are being added to x and y in order to keep the text within the enemy's borders. -** Processing line: ~ args.outputs.borders << args.state.enemies.map(&:rect)~ + +** Processing line: ~ }.merge options~ - Inside source: true *** True Line Result - args.outputs.borders << args.state.enemies.map(&:rect) -** Processing line: ~ args.outputs.labels << args.state.enemies.flat_map do |enemy|~ + }.merge options +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << args.state.enemies.flat_map do |enemy| -** Processing line: ~ [~ + +** Processing line: ~ [~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0],~ + [ +** Processing line: ~ options[:x], options[:y], options[:w], options[:h], # dest rect keys~ - Inside source: true *** True Line Result - [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0], -** Processing line: ~ [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created~ + options[:x], options[:y], options[:w], options[:h], # dest rect keys +** Processing line: ~ path,~ - Inside source: true *** True Line Result - [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created -** Processing line: ~ ]~ + path, +** Processing line: ~ options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha +** Processing line: ~ options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys +** Processing line: ~ options[:flip_h], options[:flip_v], # flip~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs bullets in bullets collection as rectangular solids~ + options[:flip_h], options[:flip_v], # flip +** Processing line: ~ options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor~ - Inside source: true *** True Line Result - # Outputs bullets in bullets collection as rectangular solids -** Processing line: ~ args.outputs.solids << args.state.bullets.map(&:rect)~ + options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor +** Processing line: ~ ] # hash keys contain corresponding values~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.bullets.map(&:rect) + ] # hash keys contain corresponding values ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -16853,30 +17192,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Calls all methods necessary for performing calculations~ -- Inside source: true -*** True Line Result - # Calls all methods necessary for performing calculations -** Processing line: ~ def calc args~ -- Inside source: true -*** True Line Result - def calc args -** Processing line: ~ add_new_enemies_if_needed args~ +** Processing line: ~ # Calls the calc_pos and calc_wrap methods.~ - Inside source: true *** True Line Result - add_new_enemies_if_needed args -** Processing line: ~ move_bullets args~ + # Calls the calc_pos and calc_wrap methods. +** Processing line: ~ def calc state~ - Inside source: true *** True Line Result - move_bullets args -** Processing line: ~ calculate_collisions args~ + def calc state +** Processing line: ~ calc_pos state~ - Inside source: true *** True Line Result - calculate_collisions args -** Processing line: ~ remove_bullets_of_screen args~ + calc_pos state +** Processing line: ~ calc_wrap state~ - Inside source: true *** True Line Result - remove_bullets_of_screen args + calc_wrap state ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -16885,110 +17216,110 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Adds enemies to the enemies collection and sets their values~ -- Inside source: true -*** True Line Result - # Adds enemies to the enemies collection and sets their values -** Processing line: ~ def add_new_enemies_if_needed args~ +** Processing line: ~ # Changes sprite's position on screen~ - Inside source: true *** True Line Result - def add_new_enemies_if_needed args -** Processing line: ~ return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added~ + # Changes sprite's position on screen +** Processing line: ~ # Vectors have magnitude and direction, so the incremented x and y values give the car direction~ - Inside source: true *** True Line Result - return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added -** Processing line: ~ return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added~ + # Vectors have magnitude and direction, so the incremented x and y values give the car direction +** Processing line: ~ def calc_pos state~ - Inside source: true *** True Line Result - return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added -** Processing line: ~~ + def calc_pos state +** Processing line: ~ state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total~ + state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed +** Processing line: ~ state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed~ - Inside source: true *** True Line Result - args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total -** Processing line: ~ args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity~ + state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed +** Processing line: ~ state.speed *= 1.1 # scales speed up~ - Inside source: true *** True Line Result - args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity -** Processing line: ~ e.x = 640 + 500 * rand # each enemy is given random position on screen~ + state.speed *= 1.1 # scales speed up +** Processing line: ~ state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed)~ - Inside source: true *** True Line Result - e.x = 640 + 500 * rand # each enemy is given random position on screen -** Processing line: ~ e.y = 600 * rand + 50~ + state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) +** Processing line: ~ end~ - Inside source: true *** True Line Result - e.y = 600 * rand + 50 -** Processing line: ~ e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect -** Processing line: ~ end~ + +** Processing line: ~ # The screen's dimensions are 1280x720. If the car goes out of scope,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # The screen's dimensions are 1280x720. If the car goes out of scope, +** Processing line: ~ # it loops back around on the screen.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # it loops back around on the screen. +** Processing line: ~ def calc_wrap state~ - Inside source: true *** True Line Result - end + def calc_wrap state ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Moves bullets across screen~ +** Processing line: ~ # car returns to left side of screen if it disappears on right side of screen~ - Inside source: true *** True Line Result - # Moves bullets across screen -** Processing line: ~ # Sets definition of the bullets~ + # car returns to left side of screen if it disappears on right side of screen +** Processing line: ~ # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger~ - Inside source: true *** True Line Result - # Sets definition of the bullets -** Processing line: ~ def move_bullets args~ + # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger +** Processing line: ~ state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280~ - Inside source: true *** True Line Result - def move_bullets args -** Processing line: ~ args.state.bullets.each do |bullet| # perform action on each bullet in collection~ + state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.bullets.each do |bullet| # perform action on each bullet in collection -** Processing line: ~ bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)~ + +** Processing line: ~ # car wraps around to right side of screen if it disappears on the left side~ - Inside source: true *** True Line Result - bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen) + # car wraps around to right side of screen if it disappears on the left side +** Processing line: ~ state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0~ +- Inside source: true +*** True Line Result + state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out~ +** Processing line: ~ # car wraps around to bottom of screen if it disappears at the top of the screen~ - Inside source: true *** True Line Result - # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out -** Processing line: ~ # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to~ + # car wraps around to bottom of screen if it disappears at the top of the screen +** Processing line: ~ # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!)~ - Inside source: true *** True Line Result - # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to -** Processing line: ~ # see what happens to the bullet's movement.~ + # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) +** Processing line: ~ state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope~ - Inside source: true *** True Line Result - # see what happens to the bullet's movement. -** Processing line: ~ bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)~ + state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope +** Processing line: ~~ - Inside source: true *** True Line Result - bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign) -** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect~ + +** Processing line: ~ # car wraps around to top of screen if it disappears at the bottom of the screen~ - Inside source: true *** True Line Result - bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect -** Processing line: ~ end~ + # car wraps around to top of screen if it disappears at the bottom of the screen +** Processing line: ~ state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0~ - Inside source: true *** True Line Result - end + state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -16997,90 +17328,86 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Determines if a bullet hits an enemy~ +** Processing line: ~ # Changes angle of sprite based on user input from keyboard or controller~ - Inside source: true *** True Line Result - # Determines if a bullet hits an enemy -** Processing line: ~ def calculate_collisions args~ + # Changes angle of sprite based on user input from keyboard or controller +** Processing line: ~ def process_inputs args~ - Inside source: true *** True Line Result - def calculate_collisions args -** Processing line: ~ args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections~ + def process_inputs args +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections -** Processing line: ~ args.state.enemies.each do |enemy|~ + +** Processing line: ~ # NOTE: increasing the angle doesn't mean that the car will continue to go~ - Inside source: true *** True Line Result - args.state.enemies.each do |enemy| -** Processing line: ~ # if bullet has not exploded yet and the bullet hits an enemy~ -- Inside source: true -*** True Line Result - # if bullet has not exploded yet and the bullet hits an enemy -** Processing line: ~ if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)~ -- Inside source: true -*** True Line Result - if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect) -** Processing line: ~ bullet.exploded = true # bullet explodes~ + # NOTE: increasing the angle doesn't mean that the car will continue to go +** Processing line: ~ # in a specific direction. The angle is increasing, which means that if the~ - Inside source: true *** True Line Result - bullet.exploded = true # bullet explodes -** Processing line: ~ enemy.dead = true # enemy is killed~ + # in a specific direction. The angle is increasing, which means that if the +** Processing line: ~ # left key was kept in the "down" state, the change in the angle would cause~ - Inside source: true *** True Line Result - enemy.dead = true # enemy is killed -** Processing line: ~ end~ + # left key was kept in the "down" state, the change in the angle would cause +** Processing line: ~ # the car to go in a counter-clockwise direction and form a circle (360 degrees)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # the car to go in a counter-clockwise direction and form a circle (360 degrees) +** Processing line: ~ if args.inputs.keyboard.key_held.left # if left key is pressed~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if args.inputs.keyboard.key_held.left # if left key is pressed +** Processing line: ~ args.state.angle += 2 # car's angle is incremented by 2~ - Inside source: true *** True Line Result - end + args.state.angle += 2 # car's angle is incremented by 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # All exploded bullets are rejected or removed from the bullets collection~ +** Processing line: ~ # The same applies to decreasing the angle. If the right key was kept in the~ - Inside source: true *** True Line Result - # All exploded bullets are rejected or removed from the bullets collection -** Processing line: ~ # and any dead enemy is rejected from the enemies collection.~ + # The same applies to decreasing the angle. If the right key was kept in the +** Processing line: ~ # "down" state, the decreasing angle would cause the car to go in a clockwise~ - Inside source: true *** True Line Result - # and any dead enemy is rejected from the enemies collection. -** Processing line: ~ args.state.bullets = args.state.bullets.reject(&:exploded)~ + # "down" state, the decreasing angle would cause the car to go in a clockwise +** Processing line: ~ # direction and form a circle (360 degrees)~ - Inside source: true *** True Line Result - args.state.bullets = args.state.bullets.reject(&:exploded) -** Processing line: ~ args.state.enemies = args.state.enemies.reject(&:dead)~ + # direction and form a circle (360 degrees) +** Processing line: ~ elsif args.inputs.keyboard.key_held.right # if right key is pressed~ - Inside source: true *** True Line Result - args.state.enemies = args.state.enemies.reject(&:dead) -** Processing line: ~ end~ + elsif args.inputs.keyboard.key_held.right # if right key is pressed +** Processing line: ~ args.state.angle -= 2 # car's angle is decremented by 2~ - Inside source: true *** True Line Result - end + args.state.angle -= 2 # car's angle is decremented by 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Bullets are rejected from bullets collection once their position exceeds the width of screen~ +** Processing line: ~ # Input from a controller can also change the angle of the car~ - Inside source: true *** True Line Result - # Bullets are rejected from bullets collection once their position exceeds the width of screen -** Processing line: ~ def remove_bullets_of_screen args~ + # Input from a controller can also change the angle of the car +** Processing line: ~ elsif args.inputs.controller_one.left_analog_x_perc != 0~ - Inside source: true *** True Line Result - def remove_bullets_of_screen args -** Processing line: ~ args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280~ + elsif args.inputs.controller_one.left_analog_x_perc != 0 +** Processing line: ~ args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1~ - Inside source: true *** True Line Result - args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280 + args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17089,18 +17416,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Calls fire_bullet method~ +** Processing line: ~ # A sprite's center of rotation can be altered~ - Inside source: true *** True Line Result - # Calls fire_bullet method -** Processing line: ~ def process_inputs args~ + # A sprite's center of rotation can be altered +** Processing line: ~ # Increasing either of these numbers would dramatically increase the~ - Inside source: true *** True Line Result - def process_inputs args -** Processing line: ~ fire_bullet args~ + # Increasing either of these numbers would dramatically increase the +** Processing line: ~ # car's drift when it turns!~ - Inside source: true *** True Line Result - fire_bullet args + # car's drift when it turns! +** Processing line: ~ def rotation_anchor~ +- Inside source: true +*** True Line Result + def rotation_anchor +** Processing line: ~ [0.7, 0.5]~ +- Inside source: true +*** True Line Result + [0.7, 0.5] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17109,46 +17444,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection~ -- Inside source: true -*** True Line Result - # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection -** Processing line: ~ def fire_bullet args~ +** Processing line: ~ # Sets opacity value of sprite to 255 so that it is not transparent at all~ - Inside source: true *** True Line Result - def fire_bullet args -** Processing line: ~ return unless args.inputs.mouse.click # return unless mouse is clicked~ + # Sets opacity value of sprite to 255 so that it is not transparent at all +** Processing line: ~ # Change it to 0 and you won't be able to see the car sprite on the screen~ - Inside source: true *** True Line Result - return unless args.inputs.mouse.click # return unless mouse is clicked -** Processing line: ~ args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity~ + # Change it to 0 and you won't be able to see the car sprite on the screen +** Processing line: ~ def opacity~ - Inside source: true *** True Line Result - args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity -** Processing line: ~ bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked~ + def opacity +** Processing line: ~ 255~ - Inside source: true *** True Line Result - bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked -** Processing line: ~ bullet.x = 0 # starts on the left side of the screen~ + 255 +** Processing line: ~ end~ - Inside source: true *** True Line Result - bullet.x = 0 # starts on the left side of the screen -** Processing line: ~ bullet.size = 10~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - bullet.size = 10 -** Processing line: ~ bullet.speed = 10 * rand + 2 # speed of a bullet is randomized~ + +** Processing line: ~ # Sets the color of the sprite to white.~ - Inside source: true *** True Line Result - bullet.speed = 10 * rand + 2 # speed of a bullet is randomized -** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set~ + # Sets the color of the sprite to white. +** Processing line: ~ def saturation~ - Inside source: true *** True Line Result - bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set -** Processing line: ~ end~ + def saturation +** Processing line: ~ [255, 255, 255]~ - Inside source: true *** True Line Result - end + [255, 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17157,58 +17488,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ -- Inside source: true -*** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ # Sets definition of destination_rect (used to define the car sprite)~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + # Sets definition of destination_rect (used to define the car sprite) +** Processing line: ~ def destination_rect state~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + def destination_rect state +** Processing line: ~ [state.x, state.y,~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + [state.x, state.y, +** Processing line: ~ state.sprite.width * state.sprite.scale, # multiplies by 4 to set size~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.space ||~ + state.sprite.width * state.sprite.scale, # multiplies by 4 to set size +** Processing line: ~ state.sprite.height * state.sprite.scale]~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.space || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + state.sprite.height * state.sprite.scale] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + +** Processing line: ~ # Portion of a sprite (a tile)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Portion of a sprite (a tile) +** Processing line: ~ # Sub division of sprite is denoted as a rectangle directly related to original size of .png~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ + # Sub division of sprite is denoted as a rectangle directly related to original size of .png +** Processing line: ~ # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height)~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) +** Processing line: ~ def source_rect state~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + def source_rect state +** Processing line: ~ [0, 0, state.sprite.width, state.sprite.height]~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + [0, 0, state.sprite.width, state.sprite.height] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17225,18 +17552,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 04_physics_and_collisions/04_box_collision/app/main.rb~ +** Processing line: ~* Physics And Collisions - Simple - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 04_physics_and_collisions/04_box_collision/app/main.rb +* Physics And Collisions - Simple - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/01_simple/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/04_physics_and_collisions/01_simple/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -17245,158 +17576,162 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + Reminders: +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +- Inside source: true +*** True Line Result + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - first: Returns the first element of the array.~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - - first: Returns the first element of the array. -** Processing line: ~ For example, if we have an array~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - For example, if we have an array -** Processing line: ~ numbers = [1, 2, 3, 4, 5]~ + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~~ - Inside source: true *** True Line Result - numbers = [1, 2, 3, 4, 5] -** Processing line: ~ and we call first by saying~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - and we call first by saying -** Processing line: ~ numbers.first~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - numbers.first -** Processing line: ~ the number 1 will be returned because it is the first element of the numbers array.~ + +** Processing line: ~ # This sample app shows collisions between two boxes.~ - Inside source: true *** True Line Result - the number 1 will be returned because it is the first element of the numbers array. + # This sample app shows collisions between two boxes. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ -- Inside source: true -*** True Line Result - - num1.idiv(num2): Divides two numbers and returns an integer. -** Processing line: ~ For example,~ +** Processing line: ~ # Runs methods needed for game to run properly.~ - Inside source: true *** True Line Result - For example, -** Processing line: ~ 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer.~ + # Runs methods needed for game to run properly. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer. -** Processing line: ~ 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal.~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to move a square over time and determine collision."~ - Inside source: true *** True Line Result - 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal. -** Processing line: ~~ + tick_instructions args, "Sample app shows how to move a square over time and determine collision." +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ + calc args +** Processing line: ~ end~ - Inside source: true *** True Line Result - - find_all: Finds all values that satisfy specific requirements. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ +** Processing line: ~ # Sets default values.~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: An array with at least four values is -** Processing line: ~ considered a rect. The intersect_rect? function returns true~ + # Sets default values. +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - considered a rect. The intersect_rect? function returns true -** Processing line: ~ or false depending on if the two rectangles intersect.~ + def defaults args +** Processing line: ~ # These values represent the moving box.~ - Inside source: true *** True Line Result - or false depending on if the two rectangles intersect. -** Processing line: ~~ + # These values represent the moving box. +** Processing line: ~ args.state.moving_box_speed = 10~ - Inside source: true *** True Line Result - -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ + args.state.moving_box_speed = 10 +** Processing line: ~ args.state.moving_box_size = 100~ - Inside source: true *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. -** Processing line: ~~ + args.state.moving_box_size = 100 +** Processing line: ~ args.state.moving_box_dx ||= 1~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + args.state.moving_box_dx ||= 1 +** Processing line: ~ args.state.moving_box_dy ||= 1~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + args.state.moving_box_dy ||= 1 +** Processing line: ~ args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height~ - Inside source: true *** True Line Result - -** Processing line: ~ # This sample app allows users to create tiles and place them anywhere on the screen as obstacles.~ + args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height +** Processing line: ~~ - Inside source: true *** True Line Result - # This sample app allows users to create tiles and place them anywhere on the screen as obstacles. -** Processing line: ~ # The player can then move and maneuver around them.~ + +** Processing line: ~ # These values represent the center box.~ - Inside source: true *** True Line Result - # The player can then move and maneuver around them. -** Processing line: ~~ + # These values represent the center box. +** Processing line: ~ args.state.center_box ||= [540, 260, 200, 200, 180]~ - Inside source: true *** True Line Result - -** Processing line: ~ class PoorManPlatformerPhysics~ + args.state.center_box ||= [540, 260, 200, 200, 180] +** Processing line: ~ args.state.center_box_collision ||= false # initially no collision~ - Inside source: true *** True Line Result - class PoorManPlatformerPhysics -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ + args.state.center_box_collision ||= false # initially no collision +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :grid, :inputs, :state, :outputs + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls all methods necessary for the app to run successfully.~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - # Calls all methods necessary for the app to run successfully. -** Processing line: ~ def tick~ + def render args +** Processing line: ~ # If the game state denotes that a collision has occured,~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + # If the game state denotes that a collision has occured, +** Processing line: ~ # render a solid square, otherwise render a border instead.~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + # render a solid square, otherwise render a border instead. +** Processing line: ~ if args.state.center_box_collision~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + if args.state.center_box_collision +** Processing line: ~ args.outputs.solids << args.state.center_box~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + args.outputs.solids << args.state.center_box +** Processing line: ~ else~ - Inside source: true *** True Line Result - process_inputs + else +** Processing line: ~ args.outputs.borders << args.state.center_box~ +- Inside source: true +*** True Line Result + args.outputs.borders << args.state.center_box ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -17405,1162 +17740,1166 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values for variables.~ +** Processing line: ~ # Then render the moving box.~ - Inside source: true *** True Line Result - # Sets default values for variables. -** Processing line: ~ # The ||= sign means that the variable will only be set to the value following the = sign if the value has~ + # Then render the moving box. +** Processing line: ~ args.outputs.solids << args.state.moving_box~ - Inside source: true *** True Line Result - # The ||= sign means that the variable will only be set to the value following the = sign if the value has -** Processing line: ~ # not already been set before. Intialization happens only in the first frame.~ + args.outputs.solids << args.state.moving_box +** Processing line: ~ end~ - Inside source: true *** True Line Result - # not already been set before. Intialization happens only in the first frame. -** Processing line: ~ def defaults~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.tile_size = 64~ + +** Processing line: ~ # Generally in a pipeline for a game engine, you have rendering,~ - Inside source: true *** True Line Result - state.tile_size = 64 -** Processing line: ~ state.gravity = -0.2~ + # Generally in a pipeline for a game engine, you have rendering, +** Processing line: ~ # game simulation (calculation), and input processing.~ - Inside source: true *** True Line Result - state.gravity = -0.2 -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ + # game simulation (calculation), and input processing. +** Processing line: ~ # This fuction represents the game simulation.~ - Inside source: true *** True Line Result - state.previous_tile_size ||= state.tile_size -** Processing line: ~ state.x ||= 0~ + # This fuction represents the game simulation. +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - state.x ||= 0 -** Processing line: ~ state.y ||= 800~ + def calc args +** Processing line: ~ position_moving_box args~ - Inside source: true *** True Line Result - state.y ||= 800 -** Processing line: ~ state.dy ||= 0~ + position_moving_box args +** Processing line: ~ determine_collision_center_box args~ - Inside source: true *** True Line Result - state.dy ||= 0 -** Processing line: ~ state.dx ||= 0~ + determine_collision_center_box args +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.dx ||= 0 -** Processing line: ~ state.world ||= []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.world ||= [] -** Processing line: ~ state.world_lookup ||= {}~ + +** Processing line: ~ # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed,~ - Inside source: true *** True Line Result - state.world_lookup ||= {} -** Processing line: ~ state.world_collision_rects ||= []~ + # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed, +** Processing line: ~ # and adding it to the current position.~ - Inside source: true *** True Line Result - state.world_collision_rects ||= [] -** Processing line: ~ end~ + # and adding it to the current position. +** Processing line: ~ # dx and dy are positive if the box is moving right and up, respectively~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # dx and dy are positive if the box is moving right and up, respectively +** Processing line: ~ # dx and dy are negative if the box is moving left and down, respectively~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs solids and borders of different colors for the world and collision_rects collections.~ + # dx and dy are negative if the box is moving left and down, respectively +** Processing line: ~ def position_moving_box args~ - Inside source: true *** True Line Result - # Outputs solids and borders of different colors for the world and collision_rects collections. -** Processing line: ~ def render~ + def position_moving_box args +** Processing line: ~ args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed~ - Inside source: true *** True Line Result - def render + args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed +** Processing line: ~ args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed~ +- Inside source: true +*** True Line Result + args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets a black background on the screen (Comment this line out and the background will become white.)~ +** Processing line: ~ # 1280x720 are the virtual pixels you work with (essentially 720p).~ - Inside source: true *** True Line Result - # Sets a black background on the screen (Comment this line out and the background will become white.) -** Processing line: ~ # Also note that black is the default color for when no color is assigned.~ + # 1280x720 are the virtual pixels you work with (essentially 720p). +** Processing line: ~ screen_width = 1280~ - Inside source: true *** True Line Result - # Also note that black is the default color for when no color is assigned. -** Processing line: ~ outputs.solids << grid.rect~ + screen_width = 1280 +** Processing line: ~ screen_height = 720~ - Inside source: true *** True Line Result - outputs.solids << grid.rect + screen_height = 720 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The position, size, and color (white) are set for borders given to the world collection.~ +** Processing line: ~ # Position of the box is denoted by the bottom left hand corner, in~ - Inside source: true *** True Line Result - # The position, size, and color (white) are set for borders given to the world collection. -** Processing line: ~ # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.~ + # Position of the box is denoted by the bottom left hand corner, in +** Processing line: ~ # that case, we have to subtract the width of the box so that it stays~ - Inside source: true *** True Line Result - # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters. -** Processing line: ~ outputs.borders << state.world.map do |x, y|~ + # that case, we have to subtract the width of the box so that it stays +** Processing line: ~ # in the scene (you can try deleting the subtraction to see how it~ - Inside source: true *** True Line Result - outputs.borders << state.world.map do |x, y| -** Processing line: ~ [x * state.tile_size,~ + # in the scene (you can try deleting the subtraction to see how it +** Processing line: ~ # impacts the box's movement).~ - Inside source: true *** True Line Result - [x * state.tile_size, -** Processing line: ~ y * state.tile_size,~ + # impacts the box's movement). +** Processing line: ~ if args.state.moving_box.x > screen_width - args.state.moving_box_size~ - Inside source: true *** True Line Result - y * state.tile_size, -** Processing line: ~ state.tile_size,~ + if args.state.moving_box.x > screen_width - args.state.moving_box_size +** Processing line: ~ args.state.moving_box_dx = -1 # moves left~ - Inside source: true *** True Line Result - state.tile_size, -** Processing line: ~ state.tile_size, 255, 255, 255]~ + args.state.moving_box_dx = -1 # moves left +** Processing line: ~ elsif args.state.moving_box.x < 0~ - Inside source: true *** True Line Result - state.tile_size, 255, 255, 255] -** Processing line: ~ end~ + elsif args.state.moving_box.x < 0 +** Processing line: ~ args.state.moving_box_dx = 1 # moves right~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.moving_box_dx = 1 # moves right +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # The top, bottom, and sides of the borders for collision_rects are different colors.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # The top, bottom, and sides of the borders for collision_rects are different colors. -** Processing line: ~ outputs.borders << state.world_collision_rects.map do |e|~ + +** Processing line: ~ # Here, we're making sure the moving box remains within the vertical scope of the screen~ - Inside source: true *** True Line Result - outputs.borders << state.world_collision_rects.map do |e| -** Processing line: ~ [~ + # Here, we're making sure the moving box remains within the vertical scope of the screen +** Processing line: ~ if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [e[:top], 0, 170, 0], # top is a shade of green~ + if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high +** Processing line: ~ args.state.moving_box_dy = -1 # moves down~ - Inside source: true *** True Line Result - [e[:top], 0, 170, 0], # top is a shade of green -** Processing line: ~ [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue~ + args.state.moving_box_dy = -1 # moves down +** Processing line: ~ elsif args.state.moving_box.y < 0 # if the box moves too low~ - Inside source: true *** True Line Result - [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue -** Processing line: ~ [e[:left_right], 170, 0, 0], # left and right are a shade of red~ + elsif args.state.moving_box.y < 0 # if the box moves too low +** Processing line: ~ args.state.moving_box_dy = 1 # moves up~ - Inside source: true *** True Line Result - [e[:left_right], 170, 0, 0], # left and right are a shade of red -** Processing line: ~ ]~ + args.state.moving_box_dy = 1 # moves up +** Processing line: ~ end~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the position, size, and color (a shade of green) of the borders of only the player's~ +** Processing line: ~ def determine_collision_center_box args~ - Inside source: true *** True Line Result - # Sets the position, size, and color (a shade of green) of the borders of only the player's -** Processing line: ~ # box and outputs it. If you change the 180 to 0, the player's box will be black and you~ + def determine_collision_center_box args +** Processing line: ~ # Collision is handled by the engine. You simply have to call the~ - Inside source: true *** True Line Result - # box and outputs it. If you change the 180 to 0, the player's box will be black and you -** Processing line: ~ # won't be able to see it (because it will match the black background).~ + # Collision is handled by the engine. You simply have to call the +** Processing line: ~ # `intersect_rect?` function.~ - Inside source: true *** True Line Result - # won't be able to see it (because it will match the black background). -** Processing line: ~ outputs.borders << [state.x,~ + # `intersect_rect?` function. +** Processing line: ~ if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect~ - Inside source: true *** True Line Result - outputs.borders << [state.x, -** Processing line: ~ state.y,~ + if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect +** Processing line: ~ args.state.center_box_collision = true # then a collision happened~ - Inside source: true *** True Line Result - state.y, -** Processing line: ~ state.tile_size,~ + args.state.center_box_collision = true # then a collision happened +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.tile_size, -** Processing line: ~ state.tile_size, 0, 180, 0]~ + else +** Processing line: ~ args.state.center_box_collision = false # otherwise, no collision happened~ - Inside source: true *** True Line Result - state.tile_size, 0, 180, 0] + args.state.center_box_collision = false # otherwise, no collision happened ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods needed to perform calculations.~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # Calls methods needed to perform calculations. -** Processing line: ~ def calc~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_world_lookup~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - calc_world_lookup -** Processing line: ~ calc_player~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - calc_player -** Processing line: ~ end~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - -** Processing line: ~ # Performs calculations on world_lookup and sets values.~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - # Performs calculations on world_lookup and sets values. -** Processing line: ~ def calc_world_lookup~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - def calc_world_lookup + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ -- Inside source: true -*** True Line Result - # If the tile size isn't equal to the previous tile size, -** Processing line: ~ # the previous tile size is set to the tile size,~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # the previous tile size is set to the tile size, -** Processing line: ~ # and world_lookup hash is set to empty.~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # and world_lookup hash is set to empty. -** Processing line: ~ if state.tile_size != state.previous_tile_size~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - if state.tile_size != state.previous_tile_size -** Processing line: ~ state.previous_tile_size = state.tile_size~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.previous_tile_size = state.tile_size -** Processing line: ~ state.world_lookup = {} # empty hash~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.world_lookup = {} # empty hash -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # return if the world_lookup hash has keys (or, in other words, is not empty)~ -- Inside source: true +** Processing line: ~* Physics And Collisions - Moving Objects - main.rb~ +- Header detected. *** True Line Result - # return if the world_lookup hash has keys (or, in other words, is not empty) -** Processing line: ~ # return unless the world collection has values inside of it (or is not empty)~ -- Inside source: true + *** True Line Result - # return unless the world collection has values inside of it (or is not empty) -** Processing line: ~ return if state.world_lookup.keys.length > 0~ +* Physics And Collisions - Moving Objects - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb~ - Inside source: true *** True Line Result - return if state.world_lookup.keys.length > 0 -** Processing line: ~ return unless state.world.length > 0~ + # ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - return unless state.world.length > 0 + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Starts with an empty hash for world_lookup.~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - # Starts with an empty hash for world_lookup. -** Processing line: ~ # Searches through the world and finds the coordinates that exist.~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - # Searches through the world and finds the coordinates that exist. -** Processing line: ~ state.world_lookup = {}~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ + - Hashes: Collection of unique keys and their corresponding values. The value can be found +** Processing line: ~ using their keys.~ - Inside source: true *** True Line Result - state.world.each { |x, y| state.world_lookup[[x, y]] = true } + using their keys. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Assigns world_collision_rects for every sprite drawn.~ +** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ - Inside source: true *** True Line Result - # Assigns world_collision_rects for every sprite drawn. -** Processing line: ~ state.world_collision_rects =~ + For example, if we have a "numbers" hash that stores numbers in English as the +** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ - Inside source: true *** True Line Result - state.world_collision_rects = -** Processing line: ~ state.world_lookup~ + key and numbers in Spanish as the value, we'd have a hash that looks like this... +** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ - Inside source: true *** True Line Result - state.world_lookup -** Processing line: ~ .keys~ + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } +** Processing line: ~ and on it goes.~ - Inside source: true *** True Line Result - .keys -** Processing line: ~ .map do |coord_x, coord_y|~ + and on it goes. +** Processing line: ~~ - Inside source: true *** True Line Result - .map do |coord_x, coord_y| -** Processing line: ~ s = state.tile_size~ + +** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ - Inside source: true *** True Line Result - s = state.tile_size -** Processing line: ~ # multiply by tile size so the grid coordinates; sets pixel value~ + Now if we wanted to find the corresponding value of the "one" key, we could say +** Processing line: ~ puts numbers["one"]~ - Inside source: true *** True Line Result - # multiply by tile size so the grid coordinates; sets pixel value -** Processing line: ~ # don't forget that position is denoted by bottom left corner~ + puts numbers["one"] +** Processing line: ~ which would print "uno" to the console.~ - Inside source: true *** True Line Result - # don't forget that position is denoted by bottom left corner -** Processing line: ~ # set x = coord_x or y = coord_y and see what happens!~ + which would print "uno" to the console. +** Processing line: ~~ - Inside source: true *** True Line Result - # set x = coord_x or y = coord_y and see what happens! -** Processing line: ~ x = s * coord_x~ + +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ - Inside source: true *** True Line Result - x = s * coord_x -** Processing line: ~ y = s * coord_y~ + - num1.greater(num2): Returns the greater value. +** Processing line: ~ For example, if we have the command~ - Inside source: true *** True Line Result - y = s * coord_y -** Processing line: ~ {~ + For example, if we have the command +** Processing line: ~ puts 4.greater(3)~ - Inside source: true *** True Line Result - { -** Processing line: ~ # The values added to x, y, and s position the world_collision_rects so they all appear~ + puts 4.greater(3) +** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ - Inside source: true *** True Line Result - # The values added to x, y, and s position the world_collision_rects so they all appear -** Processing line: ~ # stacked (on top of world rects) but don't directly overlap.~ + the number 4 would be printed to the console since it has a greater value than 3. +** Processing line: ~ Similar to lesser, which returns the lesser value.~ - Inside source: true *** True Line Result - # stacked (on top of world rects) but don't directly overlap. -** Processing line: ~ # Remove these added values and mess around with the rect placement!~ + Similar to lesser, which returns the lesser value. +** Processing line: ~~ - Inside source: true *** True Line Result - # Remove these added values and mess around with the rect placement! -** Processing line: ~ args: [coord_x, coord_y],~ + +** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ - Inside source: true *** True Line Result - args: [coord_x, coord_y], -** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ + - num1.lesser(num2): Finds the lower value of the given options. +** Processing line: ~ For example, in the statement~ - Inside source: true *** True Line Result - left_right: [x, y + 4, s, s - 6], # hash keys and values -** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ + For example, in the statement +** Processing line: ~ a = 4.lesser(3)~ - Inside source: true *** True Line Result - top: [x + 4, y + 6, s - 8, s - 6], -** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ + a = 4.lesser(3) +** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ - Inside source: true *** True Line Result - bottom: [x + 1, y - 1, s - 2, s - 8], -** Processing line: ~ }~ + 3 has a lower value than 4, which means that the value of a would be set to 3, +** Processing line: ~ but if the statement had been~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + but if the statement had been +** Processing line: ~ a = 4.lesser(5)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + a = 4.lesser(5) +** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ - Inside source: true *** True Line Result - end + 4 has a lower value than 5, which means that the value of a would be set to 4. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Performs calculations to change the x and y values of the player's box.~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ - Inside source: true *** True Line Result - # Performs calculations to change the x and y values of the player's box. -** Processing line: ~ def calc_player~ + - reject: Removes elements from a collection if they meet certain requirements. +** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ - Inside source: true *** True Line Result - def calc_player + For example, you can derive an array of odd numbers from an original array of +** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ +- Inside source: true +*** True Line Result + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame.~ +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ - Inside source: true *** True Line Result - # Since acceleration is the change in velocity, the change in y (dy) increases every frame. -** Processing line: ~ # What goes up must come down because of gravity.~ + - find_all: Finds all values that satisfy specific requirements. +** Processing line: ~ For example, you can find all elements of a collection that are divisible by 2~ - Inside source: true *** True Line Result - # What goes up must come down because of gravity. -** Processing line: ~ state.dy += state.gravity~ + For example, you can find all elements of a collection that are divisible by 2 +** Processing line: ~ or find all objects that have intersected with another object.~ - Inside source: true *** True Line Result - state.dy += state.gravity + or find all objects that have intersected with another object. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls the calc_box_collision and calc_edge_collision methods.~ +** Processing line: ~ - abs: Returns the absolute value.~ - Inside source: true *** True Line Result - # Calls the calc_box_collision and calc_edge_collision methods. -** Processing line: ~ calc_box_collision~ + - abs: Returns the absolute value. +** Processing line: ~ For example, the command~ - Inside source: true *** True Line Result - calc_box_collision -** Processing line: ~ calc_edge_collision~ + For example, the command +** Processing line: ~ (-30).abs~ - Inside source: true *** True Line Result - calc_edge_collision + (-30).abs +** Processing line: ~ would return 30 as a result.~ +- Inside source: true +*** True Line Result + would return 30 as a result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.~ +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ - Inside source: true *** True Line Result - # Since velocity is the change in position, the change in y increases by dy. Same with x and dx. -** Processing line: ~ state.y += state.dy~ + - map: Ruby method used to transform data; used in arrays, hashes, and collections. +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ - Inside source: true *** True Line Result - state.y += state.dy -** Processing line: ~ state.x += state.dx~ + Can be used to perform an action on every element of a collection, such as multiplying +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ - Inside source: true *** True Line Result - state.x += state.dx + each element by 2 or declaring every element as a new entity. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Scales dx down.~ -- Inside source: true -*** True Line Result - # Scales dx down. -** Processing line: ~ state.dx *= 0.8~ -- Inside source: true -*** True Line Result - state.dx *= 0.8 -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - end + Reminders: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods needed to determine collisions between player and world_collision rects.~ +** Processing line: ~ - args.inputs.keyboard.KEY: Determines if a key has been pressed.~ - Inside source: true *** True Line Result - # Calls methods needed to determine collisions between player and world_collision rects. -** Processing line: ~ def calc_box_collision~ + - args.inputs.keyboard.KEY: Determines if a key has been pressed. +** Processing line: ~ For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - def calc_box_collision -** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ + For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md. +** Processing line: ~~ - Inside source: true *** True Line Result - return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key -** Processing line: ~ collision_floor!~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ - Inside source: true *** True Line Result - collision_floor! -** Processing line: ~ collision_left!~ + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - collision_left! -** Processing line: ~ collision_right!~ + +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - collision_right! -** Processing line: ~ collision_ceiling!~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - collision_ceiling! -** Processing line: ~ end~ + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - end + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. -** Processing line: ~ def collision_floor!~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - def collision_floor! -** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ + +** Processing line: ~ # Calls methods needed for game to run properly~ - Inside source: true *** True Line Result - return unless state.dy <= 0 # return unless player is going down or is as far down as possible -** Processing line: ~ player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player~ + # Calls methods needed for game to run properly +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player -** Processing line: ~~ + def tick args +** Processing line: ~ tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ - Inside source: true *** True Line Result - -** Processing line: ~ # Goes through world_collision_rects to find all intersections between the bottom of player's rect and~ + tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - # Goes through world_collision_rects to find all intersections between the bottom of player's rect and -** Processing line: ~ # the top of a world_collision_rect (hence the "-0.1" above)~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - # the top of a world_collision_rect (hence the "-0.1" above) -** Processing line: ~ floor_collisions = state.world_collision_rects~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - floor_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }~ + calc args +** Processing line: ~ input args~ - Inside source: true *** True Line Result - .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) } -** Processing line: ~ .first~ + input args +** Processing line: ~ end~ - Inside source: true *** True Line Result - .first + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return unless floor_collisions # return unless collision occurred~ +** Processing line: ~ # sets default values and creates empty collections~ - Inside source: true *** True Line Result - return unless floor_collisions # return unless collision occurred -** Processing line: ~ state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect~ + # sets default values and creates empty collections +** Processing line: ~ # initialization only happens in the first frame~ - Inside source: true *** True Line Result - state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect -** Processing line: ~ state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked~ + # initialization only happens in the first frame +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked -** Processing line: ~ end~ + def defaults args +** Processing line: ~ fiddle args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + fiddle args +** Processing line: ~ args.state.enemy.hammers ||= []~ - Inside source: true *** True Line Result - -** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ + args.state.enemy.hammers ||= [] +** Processing line: ~ args.state.enemy.hammer_queue ||= []~ - Inside source: true *** True Line Result - # Finds collisions between the player's left side and the right side of a world_collision_rect. -** Processing line: ~ def collision_left!~ + args.state.enemy.hammer_queue ||= [] +** Processing line: ~ args.state.tick_count = args.state.tick_count~ - Inside source: true *** True Line Result - def collision_left! -** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ + args.state.tick_count = args.state.tick_count +** Processing line: ~ args.state.bridge_top = 128~ - Inside source: true *** True Line Result - return unless state.dx < 0 # return unless player is moving left -** Processing line: ~ player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]~ + args.state.bridge_top = 128 +** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ - Inside source: true *** True Line Result - player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size] -** Processing line: ~~ + args.state.player.x ||= 0 # initializes player's properties +** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ - Inside source: true *** True Line Result - -** Processing line: ~ # Goes through world_collision_rects to find all intersections beween the player's left side and the~ + args.state.player.y ||= args.state.bridge_top +** Processing line: ~ args.state.player.w ||= 64~ - Inside source: true *** True Line Result - # Goes through world_collision_rects to find all intersections beween the player's left side and the -** Processing line: ~ # right side of a world_collision_rect.~ + args.state.player.w ||= 64 +** Processing line: ~ args.state.player.h ||= 64~ - Inside source: true *** True Line Result - # right side of a world_collision_rect. -** Processing line: ~ left_side_collisions = state.world_collision_rects~ + args.state.player.h ||= 64 +** Processing line: ~ args.state.player.dy ||= 0~ - Inside source: true *** True Line Result - left_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ + args.state.player.dy ||= 0 +** Processing line: ~ args.state.player.dx ||= 0~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } -** Processing line: ~ .first~ + args.state.player.dx ||= 0 +** Processing line: ~ args.state.enemy.x ||= 800 # initializes enemy's properties~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + args.state.enemy.x ||= 800 # initializes enemy's properties +** Processing line: ~ args.state.enemy.y ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ + args.state.enemy.y ||= 0 +** Processing line: ~ args.state.enemy.w ||= 128~ - Inside source: true *** True Line Result - return unless left_side_collisions # return unless collision occurred -** Processing line: ~~ + args.state.enemy.w ||= 128 +** Processing line: ~ args.state.enemy.h ||= 128~ - Inside source: true *** True Line Result - -** Processing line: ~ # player's x is set to the value of the x of the collided rect's right side~ + args.state.enemy.h ||= 128 +** Processing line: ~ args.state.enemy.dy ||= 0~ - Inside source: true *** True Line Result - # player's x is set to the value of the x of the collided rect's right side -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ + args.state.enemy.dy ||= 0 +** Processing line: ~ args.state.enemy.dx ||= 0~ - Inside source: true *** True Line Result - state.x = left_side_collisions[:left_right].right -** Processing line: ~ state.dx = 0 # player isn't moving left because its path is blocked~ + args.state.enemy.dx ||= 0 +** Processing line: ~ args.state.game_over_at ||= 0~ - Inside source: true *** True Line Result - state.dx = 0 # player isn't moving left because its path is blocked -** Processing line: ~ end~ + args.state.game_over_at ||= 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ +** Processing line: ~ # sets enemy, player, hammer values~ - Inside source: true *** True Line Result - # Finds collisions between the right side of the player and the left side of a world_collision_rect. -** Processing line: ~ def collision_right!~ + # sets enemy, player, hammer values +** Processing line: ~ def fiddle args~ - Inside source: true *** True Line Result - def collision_right! -** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ + def fiddle args +** Processing line: ~ args.state.gravity = -0.3~ - Inside source: true *** True Line Result - return unless state.dx > 0 # return unless player is moving right -** Processing line: ~ player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size]~ + args.state.gravity = -0.3 +** Processing line: ~ args.state.enemy_jump_power = 10 # sets enemy values~ - Inside source: true *** True Line Result - player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size] -** Processing line: ~~ + args.state.enemy_jump_power = 10 # sets enemy values +** Processing line: ~ args.state.enemy_jump_interval = 60~ - Inside source: true *** True Line Result - -** Processing line: ~ # Goes through world_collision_rects to find all intersections between the player's right side~ + args.state.enemy_jump_interval = 60 +** Processing line: ~ args.state.hammer_throw_interval = 40 # sets hammer values~ - Inside source: true *** True Line Result - # Goes through world_collision_rects to find all intersections between the player's right side -** Processing line: ~ # and the left side of a world_collision_rect (hence the "+0.1" above)~ + args.state.hammer_throw_interval = 40 # sets hammer values +** Processing line: ~ args.state.hammer_launch_power_default = 5~ - Inside source: true *** True Line Result - # and the left side of a world_collision_rect (hence the "+0.1" above) -** Processing line: ~ right_side_collisions = state.world_collision_rects~ + args.state.hammer_launch_power_default = 5 +** Processing line: ~ args.state.hammer_launch_power_near = 2~ - Inside source: true *** True Line Result - right_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ + args.state.hammer_launch_power_near = 2 +** Processing line: ~ args.state.hammer_launch_power_far = 7~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } -** Processing line: ~ .first~ + args.state.hammer_launch_power_far = 7 +** Processing line: ~ args.state.hammer_upward_launch_power = 15~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + args.state.hammer_upward_launch_power = 15 +** Processing line: ~ args.state.max_hammers_per_volley = 10~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ + args.state.max_hammers_per_volley = 10 +** Processing line: ~ args.state.gap_between_hammers = 10~ - Inside source: true *** True Line Result - return unless right_side_collisions # return unless collision occurred -** Processing line: ~~ + args.state.gap_between_hammers = 10 +** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ - Inside source: true *** True Line Result - -** Processing line: ~ # player's x is set to the value of the collided rect's left, minus the size of a rect~ + args.state.player_jump_power = 10 # sets player values +** Processing line: ~ args.state.player_jump_power_duration = 10~ - Inside source: true *** True Line Result - # player's x is set to the value of the collided rect's left, minus the size of a rect -** Processing line: ~ # tile size is subtracted because player's position is denoted by bottom left corner~ + args.state.player_jump_power_duration = 10 +** Processing line: ~ args.state.player_max_run_speed = 10~ - Inside source: true *** True Line Result - # tile size is subtracted because player's position is denoted by bottom left corner -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ + args.state.player_max_run_speed = 10 +** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ - Inside source: true *** True Line Result - state.x = right_side_collisions[:left_right].left - state.tile_size -** Processing line: ~ state.dx = 0 # player isn't moving right because its path is blocked~ + args.state.player_speed_slowdown_rate = 0.9 +** Processing line: ~ args.state.player_acceleration = 1~ - Inside source: true *** True Line Result - state.dx = 0 # player isn't moving right because its path is blocked -** Processing line: ~ end~ + args.state.player_acceleration = 1 +** Processing line: ~ args.state.hammer_size = 32~ - Inside source: true *** True Line Result - end + args.state.hammer_size = 32 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ +** Processing line: ~ # outputs objects onto the screen~ - Inside source: true *** True Line Result - # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. -** Processing line: ~ def collision_ceiling!~ + # outputs objects onto the screen +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - def collision_ceiling! -** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ + def render args +** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ - Inside source: true *** True Line Result - return unless state.dy > 0 # return unless player is moving up -** Processing line: ~ player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size]~ + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge +** Processing line: ~ # sets x by multiplying 64 to index to find pixel value (places all squares side by side)~ - Inside source: true *** True Line Result - player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size] -** Processing line: ~~ + # sets x by multiplying 64 to index to find pixel value (places all squares side by side) +** Processing line: ~ # subtracts 64 from bridge_top because position is denoted by bottom left corner~ - Inside source: true *** True Line Result - -** Processing line: ~ # Goes through world_collision_rects to find intersections between the bottom of a~ + # subtracts 64 from bridge_top because position is denoted by bottom left corner +** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ - Inside source: true *** True Line Result - # Goes through world_collision_rects to find intersections between the bottom of a -** Processing line: ~ # world_collision_rect and the top of the player's rect (hence the "+0.1" above)~ + [i * 64, args.state.bridge_top - 64, 64, 64] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # world_collision_rect and the top of the player's rect (hence the "+0.1" above) -** Processing line: ~ ceil_collisions = state.world_collision_rects~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ceil_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) }~ + +** Processing line: ~ args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0]~ - Inside source: true *** True Line Result - .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) } -** Processing line: ~ .first~ + args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0] +** Processing line: ~ args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box)~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box) +** Processing line: ~ args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box)~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ + args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box) +** Processing line: ~ args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen~ - Inside source: true *** True Line Result - return unless ceil_collisions # return unless collision occurred + args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # player's y is set to the bottom y of the rect it collided with, minus the size of a rect~ +** Processing line: ~ # Performs calculations to move objects on the screen~ - Inside source: true *** True Line Result - # player's y is set to the bottom y of the rect it collided with, minus the size of a rect -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ + # Performs calculations to move objects on the screen +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - state.y = ceil_collisions[:bottom].y - state.tile_size -** Processing line: ~ state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked~ + def calc args +** Processing line: ~~ - Inside source: true *** True Line Result - state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked -** Processing line: ~ end~ + +** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ - Inside source: true *** True Line Result - end + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. +** Processing line: ~ args.state.player.x += args.state.player.dx~ +- Inside source: true +*** True Line Result + args.state.player.x += args.state.player.dx +** Processing line: ~ args.state.player.y += args.state.player.dy~ +- Inside source: true +*** True Line Result + args.state.player.y += args.state.player.dy ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ - Inside source: true *** True Line Result - # Makes sure the player remains within the screen's dimensions. -** Processing line: ~ def calc_edge_collision~ + # Since acceleration is the change in velocity, the change in y (dy) increases every frame +** Processing line: ~ args.state.player.dy += args.state.gravity~ - Inside source: true *** True Line Result - def calc_edge_collision + args.state.player.dy += args.state.gravity ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Ensures that the player doesn't fall below the map.~ +** Processing line: ~ # player's y position is either current y position or y position of top of~ - Inside source: true *** True Line Result - #Ensures that the player doesn't fall below the map. -** Processing line: ~ if state.y < 0~ + # player's y position is either current y position or y position of top of +** Processing line: ~ # bridge, whichever has a greater value~ - Inside source: true *** True Line Result - if state.y < 0 -** Processing line: ~ state.y = 0~ + # bridge, whichever has a greater value +** Processing line: ~ # ensures that the player never goes below the bridge~ - Inside source: true *** True Line Result - state.y = 0 -** Processing line: ~ state.dy = 0~ + # ensures that the player never goes below the bridge +** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ - Inside source: true *** True Line Result - state.dy = 0 + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Ensures that the player doesn't go too high.~ +** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ - Inside source: true *** True Line Result - #Ensures that the player doesn't go too high. -** Processing line: ~ # Position of player is denoted by bottom left hand corner, which is why we have to subtract the~ + # player's x position is either the current x position or 0, whichever has a greater value +** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ - Inside source: true *** True Line Result - # Position of player is denoted by bottom left hand corner, which is why we have to subtract the -** Processing line: ~ # size of the player's box (so it remains visible on the screen)~ + # ensures that the player doesn't go too far left (out of the screen's scope) +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ - Inside source: true *** True Line Result - # size of the player's box (so it remains visible on the screen) -** Processing line: ~ elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen~ + args.state.player.x = args.state.player.x.greater(0) +** Processing line: ~~ - Inside source: true *** True Line Result - elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen -** Processing line: ~ state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen~ + +** Processing line: ~ # player is not falling if it is located on the top of the bridge~ - Inside source: true *** True Line Result - state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen -** Processing line: ~ state.dy = 0~ + # player is not falling if it is located on the top of the bridge +** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ end~ + args.state.player.falling = false if args.state.player.y == args.state.bridge_top +** Processing line: ~ args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ - Inside source: true *** True Line Result - end + args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Ensures that the player remains in the horizontal range that it is supposed to.~ -- Inside source: true -*** True Line Result - # Ensures that the player remains in the horizontal range that it is supposed to. -** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right~ +** Processing line: ~ args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx~ - Inside source: true *** True Line Result - if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right -** Processing line: ~ state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen~ + args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx +** Processing line: ~ args.state.enemy.y += args.state.enemy.dy # same with y and dy~ - Inside source: true *** True Line Result - state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen -** Processing line: ~ state.dx = 0~ + args.state.enemy.y += args.state.enemy.dy # same with y and dy +** Processing line: ~~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if player moves too far left~ + +** Processing line: ~ # ensures that the enemy never goes below the bridge~ - Inside source: true *** True Line Result - elsif state.x <= 0 && state.dx < 0 # if player moves too far left -** Processing line: ~ state.x = 0 # player will remain as left as possible while remaining on screen~ + # ensures that the enemy never goes below the bridge +** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ - Inside source: true *** True Line Result - state.x = 0 # player will remain as left as possible while remaining on screen -** Processing line: ~ state.dx = 0~ + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) +** Processing line: ~~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ end~ + +** Processing line: ~ # ensures that the enemy never goes too far left (outside the screen's scope)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # ensures that the enemy never goes too far left (outside the screen's scope) +** Processing line: ~ args.state.enemy.x = args.state.enemy.x.greater(0)~ - Inside source: true *** True Line Result - end + args.state.enemy.x = args.state.enemy.x.greater(0) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Processes input from the user on the keyboard.~ -- Inside source: true -*** True Line Result - # Processes input from the user on the keyboard. -** Processing line: ~ def process_inputs~ +** Processing line: ~ # objects that go up must come down because of gravity~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ if inputs.mouse.down~ + # objects that go up must come down because of gravity +** Processing line: ~ args.state.enemy.dy += args.state.gravity~ - Inside source: true *** True Line Result - if inputs.mouse.down -** Processing line: ~ state.world_lookup = {}~ + args.state.enemy.dy += args.state.gravity +** Processing line: ~~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ + +** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ - Inside source: true *** True Line Result - x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate~ +** Processing line: ~ #sets definition of enemy~ - Inside source: true *** True Line Result - if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate -** Processing line: ~ state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space~ + #sets definition of enemy +** Processing line: ~ args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w]~ - Inside source: true *** True Line Result - state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space -** Processing line: ~ else~ + args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w] +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.world << [x, y] # If no duplicates, adds to world collection~ + +** Processing line: ~ if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge~ - Inside source: true *** True Line Result - state.world << [x, y] # If no duplicates, adds to world collection -** Processing line: ~ end~ + if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge +** Processing line: ~ args.state.enemy.dy = 0 # there is no change in y~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.enemy.dy = 0 # there is no change in y +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys.~ -- Inside source: true -*** True Line Result - # Sets dx to 0 if the player lets go of arrow keys. -** Processing line: ~ if inputs.keyboard.key_up.right~ -- Inside source: true -*** True Line Result - if inputs.keyboard.key_up.right -** Processing line: ~ state.dx = 0~ +** Processing line: ~ # if 60 frames have passed and the enemy is not moving vertically~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ elsif inputs.keyboard.key_up.left~ + # if 60 frames have passed and the enemy is not moving vertically +** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_up.left -** Processing line: ~ state.dx = 0~ + if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0 +** Processing line: ~ args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ end~ + args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses.~ -- Inside source: true -*** True Line Result - # Sets dx to 3 in whatever direction the player chooses. -** Processing line: ~ if inputs.keyboard.key_held.right # if right key is pressed~ +** Processing line: ~ # if 40 frames have passed or 5 frames have passed since the game ended~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.right # if right key is pressed -** Processing line: ~ state.dx = 3~ + # if 40 frames have passed or 5 frames have passed since the game ended +** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5~ - Inside source: true *** True Line Result - state.dx = 3 -** Processing line: ~ elsif inputs.keyboard.key_held.left # if left key is pressed~ + if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5 +** Processing line: ~ # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded)~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_held.left # if left key is pressed -** Processing line: ~ state.dx = -3~ + # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded) +** Processing line: ~ # that is why we're adding 1, to include the max possibility~ - Inside source: true *** True Line Result - state.dx = -3 -** Processing line: ~ end~ + # that is why we're adding 1, to include the max possibility +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations)~ - Inside source: true *** True Line Result - end + volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Sets dy to 5 to make the player ~fly~ when they press the space bar~ +** Processing line: ~ # if the horizontal distance between the player and enemy is less than 128 pixels~ - Inside source: true *** True Line Result - #Sets dy to 5 to make the player ~fly~ when they press the space bar -** Processing line: ~ if inputs.keyboard.key_held.space~ + # if the horizontal distance between the player and enemy is less than 128 pixels +** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs < 128~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.space -** Processing line: ~ state.dy = 5~ + if (args.state.player.x - args.state.enemy.x).abs < 128 +** Processing line: ~ # the change in x won't be that great since the enemy and player are closer to each other~ - Inside source: true *** True Line Result - state.dy = 5 -** Processing line: ~ end~ + # the change in x won't be that great since the enemy and player are closer to each other +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_coord point~ -- Inside source: true -*** True Line Result - def to_coord point -** Processing line: ~~ +** Processing line: ~ # if the horizontal distance between the player and enemy is greater than 300 pixels~ - Inside source: true *** True Line Result - -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ + # if the horizontal distance between the player and enemy is greater than 300 pixels +** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs > 300~ - Inside source: true *** True Line Result - # Integer divides (idiv) point.x to turn into grid -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size later so the grid coordinates.~ + if (args.state.player.x - args.state.enemy.x).abs > 300 +** Processing line: ~ # change in x will be more drastic since player and enemy are so far apart~ - Inside source: true *** True Line Result - # Then, you can just multiply each integer by state.tile_size later so the grid coordinates. -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ + # change in x will be more drastic since player and enemy are so far apart +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change~ - Inside source: true *** True Line Result - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] -** Processing line: ~ end~ + volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Represents the tolerance for a collision between the player's rect and another rect.~ +** Processing line: ~ (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i|~ - Inside source: true *** True Line Result - # Represents the tolerance for a collision between the player's rect and another rect. -** Processing line: ~ def collision_tollerance~ + (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i| +** Processing line: ~ args.state.enemy.hammer_queue << { # stores hammer values in a hash~ - Inside source: true *** True Line Result - def collision_tollerance -** Processing line: ~ 0.0~ + args.state.enemy.hammer_queue << { # stores hammer values in a hash +** Processing line: ~ x: args.state.enemy.x,~ - Inside source: true *** True Line Result - 0.0 -** Processing line: ~ end~ + x: args.state.enemy.x, +** Processing line: ~ w: args.state.hammer_size,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + w: args.state.hammer_size, +** Processing line: ~ h: args.state.hammer_size,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + h: args.state.hammer_size, +** Processing line: ~ dx: volley_dx, # change in horizontal position~ - Inside source: true *** True Line Result - -** Processing line: ~ $platformer_physics = PoorManPlatformerPhysics.new~ + dx: volley_dx, # change in horizontal position +** Processing line: ~ # multiplication operator takes precedence over addition operator~ - Inside source: true *** True Line Result - $platformer_physics = PoorManPlatformerPhysics.new -** Processing line: ~~ + # multiplication operator takes precedence over addition operator +** Processing line: ~ throw_at: args.state.tick_count + i * args.state.gap_between_hammers~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + throw_at: args.state.tick_count + i * args.state.gap_between_hammers +** Processing line: ~ }~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $platformer_physics.grid = args.grid~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - $platformer_physics.grid = args.grid -** Processing line: ~ $platformer_physics.inputs = args.inputs~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - $platformer_physics.inputs = args.inputs -** Processing line: ~ $platformer_physics.state = args.state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $platformer_physics.state = args.state -** Processing line: ~ $platformer_physics.outputs = args.outputs~ + +** Processing line: ~ # add elements from hammer_queue collection to the hammers collection by~ - Inside source: true *** True Line Result - $platformer_physics.outputs = args.outputs -** Processing line: ~ $platformer_physics.tick~ + # add elements from hammer_queue collection to the hammers collection by +** Processing line: ~ # finding all hammers that were thrown before the current frame (have already been thrown)~ - Inside source: true *** True Line Result - $platformer_physics.tick -** Processing line: ~ tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump."~ + # finding all hammers that were thrown before the current frame (have already been thrown) +** Processing line: ~ args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h|~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump." -** Processing line: ~ end~ + args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h| +** Processing line: ~ h[:throw_at] < args.state.tick_count~ - Inside source: true *** True Line Result - end + h[:throw_at] < args.state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ args.state.enemy.hammers.each do |h| # sets values for all hammers in collection~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + args.state.enemy.hammers.each do |h| # sets values for all hammers in collection +** Processing line: ~ h[:y] ||= args.state.enemy.y + 130~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + h[:y] ||= args.state.enemy.y + 130 +** Processing line: ~ h[:dy] ||= args.state.hammer_upward_launch_power~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + h[:dy] ||= args.state.hammer_upward_launch_power +** Processing line: ~ h[:dy] += args.state.gravity # acceleration is change in gravity~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + h[:dy] += args.state.gravity # acceleration is change in gravity +** Processing line: ~ h[:x] += h[:dx] # incremented by change in position~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + h[:x] += h[:dx] # incremented by change in position +** Processing line: ~ h[:y] += h[:dy]~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + h[:y] += h[:dy] +** Processing line: ~ h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18569,298 +18908,302 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ # reject hammers that have been thrown before current frame (have already been thrown)~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + # reject hammers that have been thrown before current frame (have already been thrown) +** Processing line: ~ args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h|~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h| +** Processing line: ~ h[:throw_at] < args.state.tick_count~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + h[:throw_at] < args.state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 04_physics_and_collisions/04_box_collision_2/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 04_physics_and_collisions/04_box_collision_2/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - +** Processing line: ~ # any hammers with a y position less than 0 are rejected from the hammers collection~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + # any hammers with a y position less than 0 are rejected from the hammers collection +** Processing line: ~ # since they have gone too far down (outside the scope's screen)~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + # since they have gone too far down (outside the scope's screen) +** Processing line: ~ args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 }~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - times: Performs an action a specific number of times.~ +** Processing line: ~ # if there are any hammers that intersect with (or hit) the player,~ - Inside source: true *** True Line Result - - times: Performs an action a specific number of times. -** Processing line: ~ For example, if we said~ + # if there are any hammers that intersect with (or hit) the player, +** Processing line: ~ # the reset_player method is called (so the game can start over)~ - Inside source: true *** True Line Result - For example, if we said -** Processing line: ~ 5.times puts "Hello DragonRuby",~ + # the reset_player method is called (so the game can start over) +** Processing line: ~ if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) }~ - Inside source: true *** True Line Result - 5.times puts "Hello DragonRuby", -** Processing line: ~ then we'd see the words "Hello DragonRuby" printed on the console 5 times.~ + if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) } +** Processing line: ~ reset_player args~ - Inside source: true *** True Line Result - then we'd see the words "Hello DragonRuby" printed on the console 5 times. + reset_player args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - split: Divides a string into substrings based on a delimiter.~ +** Processing line: ~ # if the enemy's rect intersects with (or hits) the player,~ - Inside source: true *** True Line Result - - split: Divides a string into substrings based on a delimiter. -** Processing line: ~ For example, if we had a command~ + # if the enemy's rect intersects with (or hits) the player, +** Processing line: ~ # the reset_player method is called (so the game can start over)~ - Inside source: true *** True Line Result - For example, if we had a command -** Processing line: ~ "DragonRuby is awesome".split(" ")~ + # the reset_player method is called (so the game can start over) +** Processing line: ~ if args.state.enemy.rect.intersect_rect? args.state.player.rect~ - Inside source: true *** True Line Result - "DragonRuby is awesome".split(" ") -** Processing line: ~ then the result would be~ + if args.state.enemy.rect.intersect_rect? args.state.player.rect +** Processing line: ~ reset_player args~ - Inside source: true *** True Line Result - then the result would be -** Processing line: ~ ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter.~ + reset_player args +** Processing line: ~ end~ - Inside source: true *** True Line Result - ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - join: Opposite of split; converts each element of array to a string separated by delimiter.~ +** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ - Inside source: true *** True Line Result - - join: Opposite of split; converts each element of array to a string separated by delimiter. -** Processing line: ~ For example, if we had a command~ + # Resets the player by changing its properties back to the values they had at initialization +** Processing line: ~ def reset_player args~ - Inside source: true *** True Line Result - For example, if we had a command -** Processing line: ~ ["DragonRuby","is","awesome"].join(" ")~ + def reset_player args +** Processing line: ~ args.state.player.x = 0~ - Inside source: true *** True Line Result - ["DragonRuby","is","awesome"].join(" ") -** Processing line: ~ then the result would be~ + args.state.player.x = 0 +** Processing line: ~ args.state.player.y = args.state.bridge_top~ - Inside source: true *** True Line Result - then the result would be -** Processing line: ~ "DragonRuby is awesome".~ + args.state.player.y = args.state.bridge_top +** Processing line: ~ args.state.player.dy = 0~ - Inside source: true *** True Line Result - "DragonRuby is awesome". -** Processing line: ~~ + args.state.player.dy = 0 +** Processing line: ~ args.state.player.dx = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + args.state.player.dx = 0 +** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + args.state.enemy.hammers.clear # empties hammer collection +** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ - Inside source: true *** True Line Result - -** Processing line: ~ - to_s: Returns a string representation of an object.~ + args.state.enemy.hammer_queue.clear # empties hammer_queue +** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ - Inside source: true *** True Line Result - - to_s: Returns a string representation of an object. -** Processing line: ~ For example, if we had~ + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) +** Processing line: ~ end~ - Inside source: true *** True Line Result - For example, if we had -** Processing line: ~ 500.to_s~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 500.to_s -** Processing line: ~ the string "500" would be returned.~ + +** Processing line: ~ # Processes input from the user to move the player~ - Inside source: true *** True Line Result - the string "500" would be returned. -** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ + # Processes input from the user to move the player +** Processing line: ~ def input args~ - Inside source: true *** True Line Result - Similar to to_i, which returns an integer representation of an object. -** Processing line: ~~ + def input args +** Processing line: ~ if args.inputs.keyboard.space # if the user presses the space bar~ - Inside source: true *** True Line Result - -** Processing line: ~ - elapsed_time: How many frames have passed since the click event.~ + if args.inputs.keyboard.space # if the user presses the space bar +** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ - Inside source: true *** True Line Result - - elapsed_time: How many frames have passed since the click event. + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ +** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. Values in the array generate labels on the screen. -** Processing line: ~ The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # if the time that has passed since the jump is less than the player's jump duration and +** Processing line: ~ # the player is not falling~ - Inside source: true *** True Line Result - The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + # the player is not falling +** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling +** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ - Inside source: true *** True Line Result - -** Processing line: ~ - inputs.mouse.down: Determines whether or not the mouse is being pressed down.~ + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump +** Processing line: ~ end~ - Inside source: true *** True Line Result - - inputs.mouse.down: Determines whether or not the mouse is being pressed down. -** Processing line: ~ The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y).~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - first: Returns the first element of the array.~ +** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ - Inside source: true *** True Line Result - - first: Returns the first element of the array. -** Processing line: ~~ + # if the space bar is in the "up" state (or not being pressed down) +** Processing line: ~ if args.inputs.keyboard.key_up.space~ - Inside source: true *** True Line Result - -** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ + if args.inputs.keyboard.key_up.space +** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ - Inside source: true *** True Line Result - - num1.idiv(num2): Divides two numbers and returns an integer. -** Processing line: ~~ + args.state.player.jumped_at = nil # jumped_at is empty +** Processing line: ~ args.state.player.falling = true # the player is falling~ - Inside source: true *** True Line Result - -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ + args.state.player.falling = true # the player is falling +** Processing line: ~ end~ - Inside source: true *** True Line Result - - find_all: Finds all values that satisfy specific requirements. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ +** Processing line: ~ if args.inputs.keyboard.left # if left key is pressed~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. -** Processing line: ~~ + if args.inputs.keyboard.left # if left key is pressed +** Processing line: ~ args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)~ - Inside source: true *** True Line Result - -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ + args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left) +** Processing line: ~ # dx is either set to current dx or the negative max run speed (which would be -10),~ - Inside source: true *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. -** Processing line: ~~ + # dx is either set to current dx or the negative max run speed (which would be -10), +** Processing line: ~ # whichever has a greater value~ - Inside source: true *** True Line Result - -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ + # whichever has a greater value +** Processing line: ~ args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed) +** Processing line: ~ elsif args.inputs.keyboard.right # if right key is pressed~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. -** Processing line: ~~ + elsif args.inputs.keyboard.right # if right key is pressed +** Processing line: ~ args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right) +** Processing line: ~ # dx is either set to current dx or max run speed (which would be 10),~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + # dx is either set to current dx or max run speed (which would be 10), +** Processing line: ~ # whichever has a lesser value~ - Inside source: true *** True Line Result - -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map~ + # whichever has a lesser value +** Processing line: ~ args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)~ - Inside source: true *** True Line Result - MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map -** Processing line: ~~ + args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed) +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ class MetroidvaniaStarter~ + else +** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ - Inside source: true *** True Line Result - class MetroidvaniaStarter -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs, :gtk~ + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :grid, :inputs, :state, :outputs, :gtk + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods needed to run the game properly.~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # Calls methods needed to run the game properly. -** Processing line: ~ def tick~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ - Inside source: true *** True Line Result - process_inputs + args.inputs.keyboard.key_down.space || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -18869,590 +19212,630 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets all the default variables.~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # Sets all the default variables. -** Processing line: ~ # '||' states that initialization occurs only in the first frame.~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # '||' states that initialization occurs only in the first frame. -** Processing line: ~ def defaults~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.tile_size = 64~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tile_size = 64 -** Processing line: ~ state.gravity = -0.2~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.gravity = -0.2 -** Processing line: ~ state.player_width = 60~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - state.player_width = 60 -** Processing line: ~ state.player_height = 64~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.player_height = 64 -** Processing line: ~ state.collision_tolerance = 0.0~ -- Inside source: true + +** Processing line: ~* Physics And Collisions - Entities - main.rb~ +- Header detected. *** True Line Result - state.collision_tolerance = 0.0 -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ -- Inside source: true + *** True Line Result - state.previous_tile_size ||= state.tile_size -** Processing line: ~ state.x ||= 0~ -- Inside source: true +* Physics And Collisions - Entities - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - state.x ||= 0 -** Processing line: ~ state.y ||= 800~ -- Inside source: true + *** True Line Result - state.y ||= 800 -** Processing line: ~ state.dy ||= 0~ +#+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/03_entities/app/main.rb~ - Inside source: true *** True Line Result - state.dy ||= 0 -** Processing line: ~ state.dx ||= 0~ + # ./samples/04_physics_and_collisions/03_entities/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - state.dx ||= 0 -** Processing line: ~ attempt_load_world_from_file~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - attempt_load_world_from_file -** Processing line: ~ state.world_lookup ||= { }~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - state.world_lookup ||= { } -** Processing line: ~ state.world_collision_rects ||= []~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - state.world_collision_rects ||= [] -** Processing line: ~ state.mode ||= :creating # alternates between :creating and :selecting for sprite selection~ + +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ - Inside source: true *** True Line Result - state.mode ||= :creating # alternates between :creating and :selecting for sprite selection -** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ + - map: Ruby method used to transform data; used in arrays, hashes, and collections. +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ - Inside source: true *** True Line Result - state.select_menu ||= [0, 720, 1280, 720] -** Processing line: ~ #=======================================IMPORTANT=======================================#~ + Can be used to perform an action on every element of a collection, such as multiplying +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ - Inside source: true *** True Line Result - #=======================================IMPORTANT=======================================# -** Processing line: ~ # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc.~ + each element by 2 or declaring every element as a new entity. +** Processing line: ~~ - Inside source: true *** True Line Result - # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. -** Processing line: ~ # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have.~ + +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ - Inside source: true *** True Line Result - # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. -** Processing line: ~ #=======================================================================================#~ + - reject: Removes elements from a collection if they meet certain requirements. +** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ - Inside source: true *** True Line Result - #=======================================================================================# -** Processing line: ~ state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES~ + For example, you can derive an array of odd numbers from an original array of +** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ - Inside source: true *** True Line Result - state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES -** Processing line: ~ state.sprite_coords ||= []~ + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). +** Processing line: ~~ - Inside source: true *** True Line Result - state.sprite_coords ||= [] -** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ + +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - state.banner_coords ||= [640, 680 + 720] -** Processing line: ~ state.sprite_selected ||= 1~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ In this sample app, new_entity is used to define the properties of enemies and bullets.~ - Inside source: true *** True Line Result - state.sprite_selected ||= 1 -** Processing line: ~ state.map_saved_at ||= 0~ + In this sample app, new_entity is used to define the properties of enemies and bullets. +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ - Inside source: true *** True Line Result - state.map_saved_at ||= 0 + (Remember, you can use state to define ANY property and it will be retained across frames.) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets all the cordinate values for the sprite selection screen into a grid~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label on the screen.~ - Inside source: true *** True Line Result - # Sets all the cordinate values for the sprite selection screen into a grid -** Processing line: ~ # Displayed when 's' is pressed by player to access sprites~ + - args.outputs.labels: An array. The values generate a label on the screen. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - # Displayed when 's' is pressed by player to access sprites -** Processing line: ~ if state.sprite_coords == [] # if sprite_coords is an empty array~ + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~~ - Inside source: true *** True Line Result - if state.sprite_coords == [] # if sprite_coords is an empty array -** Processing line: ~ count = 1~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ - Inside source: true *** True Line Result - count = 1 -** Processing line: ~ temp_x = 165 # sets a starting x and y position for display~ + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - temp_x = 165 # sets a starting x and y position for display -** Processing line: ~ temp_y = 500 + 720~ + +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ - Inside source: true *** True Line Result - temp_y = 500 + 720 -** Processing line: ~ state.sprite_quantity.times do # for the number of sprites you have~ + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. +** Processing line: ~~ - Inside source: true *** True Line Result - state.sprite_quantity.times do # for the number of sprites you have -** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array -** Processing line: ~ temp_x += 100 # increment temp_x~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - temp_x += 100 # increment temp_x -** Processing line: ~ count += 1 # increment count~ + +** Processing line: ~ # This sample app shows enemies that contain an id value and the time they were created.~ - Inside source: true *** True Line Result - count += 1 # increment count -** Processing line: ~ if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen~ + # This sample app shows enemies that contain an id value and the time they were created. +** Processing line: ~ # These enemies can be removed by shooting at them with bullets.~ - Inside source: true *** True Line Result - if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen -** Processing line: ~ temp_x = 165 # a new row of sprites starts~ + # These enemies can be removed by shooting at them with bullets. +** Processing line: ~~ - Inside source: true *** True Line Result - temp_x = 165 # a new row of sprites starts -** Processing line: ~ temp_y -= 75 # new row of sprites starts 75 units lower than the previous row~ + +** Processing line: ~ # Calls all methods necessary for the game to function properly.~ - Inside source: true *** True Line Result - temp_y -= 75 # new row of sprites starts 75 units lower than the previous row -** Processing line: ~ end~ + # Calls all methods necessary for the game to function properly. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def tick args +** Processing line: ~ tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet."~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet." +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - -** Processing line: ~ # Places sprites~ + calc args +** Processing line: ~ process_inputs args~ - Inside source: true *** True Line Result - # Places sprites -** Processing line: ~ def render~ + process_inputs args +** Processing line: ~ end~ - Inside source: true *** True Line Result - def render + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the x, y, width, height, and image path for each sprite in the world collection.~ +** Processing line: ~ # Sets default values~ - Inside source: true *** True Line Result - # Sets the x, y, width, height, and image path for each sprite in the world collection. -** Processing line: ~ outputs.sprites << state.world.map do |x, y, sprite|~ + # Sets default values +** Processing line: ~ # Enemies and bullets start off as empty collections~ - Inside source: true *** True Line Result - outputs.sprites << state.world.map do |x, y, sprite| -** Processing line: ~ [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location~ + # Enemies and bullets start off as empty collections +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location -** Processing line: ~ y * state.tile_size,~ + def defaults args +** Processing line: ~ args.state.enemies ||= []~ - Inside source: true *** True Line Result - y * state.tile_size, -** Processing line: ~ state.tile_size,~ + args.state.enemies ||= [] +** Processing line: ~ args.state.bullets ||= []~ - Inside source: true *** True Line Result - state.tile_size, -** Processing line: ~ state.tile_size,~ + args.state.bullets ||= [] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tile_size, -** Processing line: ~ 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path -** Processing line: ~ end~ + +** Processing line: ~ # Provides each enemy in enemies collection with rectangular border,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Provides each enemy in enemies collection with rectangular border, +** Processing line: ~ # as well as a label showing id and when they were created~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs sprite for the player by setting x, y, width, height, and image path~ + # as well as a label showing id and when they were created +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - # Outputs sprite for the player by setting x, y, width, height, and image path -** Processing line: ~ outputs.sprites << [state.x,~ + def render args +** Processing line: ~ # When you're calling a method that takes no arguments, you can use this & syntax on map.~ - Inside source: true *** True Line Result - outputs.sprites << [state.x, -** Processing line: ~ state.y,~ + # When you're calling a method that takes no arguments, you can use this & syntax on map. +** Processing line: ~ # Numbers are being added to x and y in order to keep the text within the enemy's borders.~ - Inside source: true *** True Line Result - state.y, -** Processing line: ~ state.player_width,~ + # Numbers are being added to x and y in order to keep the text within the enemy's borders. +** Processing line: ~ args.outputs.borders << args.state.enemies.map(&:rect)~ - Inside source: true *** True Line Result - state.player_width, -** Processing line: ~ state.player_height,'sprites/player.png']~ + args.outputs.borders << args.state.enemies.map(&:rect) +** Processing line: ~ args.outputs.labels << args.state.enemies.flat_map do |enemy|~ - Inside source: true *** True Line Result - state.player_height,'sprites/player.png'] -** Processing line: ~~ + args.outputs.labels << args.state.enemies.flat_map do |enemy| +** Processing line: ~ [~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs labels as primitives in top right of the screen~ + [ +** Processing line: ~ [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0],~ - Inside source: true *** True Line Result - # Outputs labels as primitives in top right of the screen -** Processing line: ~ outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label~ + [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0], +** Processing line: ~ [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created~ - Inside source: true *** True Line Result - outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label -** Processing line: ~ outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label~ + [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created +** Processing line: ~ ]~ - Inside source: true *** True Line Result - outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label~ +** Processing line: ~ # Outputs bullets in bullets collection as rectangular solids~ - Inside source: true *** True Line Result - outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label -** Processing line: ~ outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label~ + # Outputs bullets in bullets collection as rectangular solids +** Processing line: ~ args.outputs.solids << args.state.bullets.map(&:rect)~ - Inside source: true *** True Line Result - outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label + args.outputs.solids << args.state.bullets.map(&:rect) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label~ +** Processing line: ~ # Calls all methods necessary for performing calculations~ - Inside source: true *** True Line Result - outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label -** Processing line: ~~ + # Calls all methods necessary for performing calculations +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - -** Processing line: ~ # if the map is saved and less than 120 frames have passed, the label is displayed~ + def calc args +** Processing line: ~ add_new_enemies_if_needed args~ - Inside source: true *** True Line Result - # if the map is saved and less than 120 frames have passed, the label is displayed -** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ + add_new_enemies_if_needed args +** Processing line: ~ move_bullets args~ - Inside source: true *** True Line Result - if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 -** Processing line: ~ outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label~ + move_bullets args +** Processing line: ~ calculate_collisions args~ - Inside source: true *** True Line Result - outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label -** Processing line: ~ end~ + calculate_collisions args +** Processing line: ~ remove_bullets_of_screen args~ - Inside source: true *** True Line Result - end + remove_bullets_of_screen args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If player hits 's', following appears~ +** Processing line: ~ # Adds enemies to the enemies collection and sets their values~ - Inside source: true *** True Line Result - # If player hits 's', following appears -** Processing line: ~ if state.mode == :selecting~ + # Adds enemies to the enemies collection and sets their values +** Processing line: ~ def add_new_enemies_if_needed args~ - Inside source: true *** True Line Result - if state.mode == :selecting -** Processing line: ~ # White background for sprite selection~ + def add_new_enemies_if_needed args +** Processing line: ~ return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added~ - Inside source: true *** True Line Result - # White background for sprite selection -** Processing line: ~ outputs.primitives << [state.select_menu, 255, 255, 255].solid~ + return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added +** Processing line: ~ return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added~ - Inside source: true *** True Line Result - outputs.primitives << [state.select_menu, 255, 255, 255].solid + return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Select tile label at the top of the screen~ +** Processing line: ~ args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total~ - Inside source: true *** True Line Result - # Select tile label at the top of the screen -** Processing line: ~ outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label~ + args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total +** Processing line: ~ args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity~ - Inside source: true *** True Line Result - outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label -** Processing line: ~~ + args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity +** Processing line: ~ e.x = 640 + 500 * rand # each enemy is given random position on screen~ - Inside source: true *** True Line Result - -** Processing line: ~ # Places sprites in locations calculated in the defaults function~ + e.x = 640 + 500 * rand # each enemy is given random position on screen +** Processing line: ~ e.y = 600 * rand + 50~ - Inside source: true *** True Line Result - # Places sprites in locations calculated in the defaults function -** Processing line: ~ outputs.primitives << state.sprite_coords.map do |x, y, order|~ + e.y = 600 * rand + 50 +** Processing line: ~ e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect~ - Inside source: true *** True Line Result - outputs.primitives << state.sprite_coords.map do |x, y, order| -** Processing line: ~ [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite~ + e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect +** Processing line: ~ end~ - Inside source: true *** True Line Result - [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ +** Processing line: ~ # Moves bullets across screen~ - Inside source: true *** True Line Result - # Creates sprite following mouse to help indicate which sprite you have selected -** Processing line: ~ # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon~ + # Moves bullets across screen +** Processing line: ~ # Sets definition of the bullets~ - Inside source: true *** True Line Result - # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y,~ + # Sets definition of the bullets +** Processing line: ~ def move_bullets args~ - Inside source: true *** True Line Result - outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, -** Processing line: ~ 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite~ + def move_bullets args +** Processing line: ~ args.state.bullets.each do |bullet| # perform action on each bullet in collection~ - Inside source: true *** True Line Result - 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite -** Processing line: ~ end~ + args.state.bullets.each do |bullet| # perform action on each bullet in collection +** Processing line: ~ bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)~ - Inside source: true *** True Line Result - end + bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods that perform calculations~ +** Processing line: ~ # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out~ - Inside source: true *** True Line Result - # Calls methods that perform calculations -** Processing line: ~ def calc~ + # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out +** Processing line: ~ # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_in_game~ + # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to +** Processing line: ~ # see what happens to the bullet's movement.~ - Inside source: true *** True Line Result - calc_in_game -** Processing line: ~ calc_sprite_selection~ + # see what happens to the bullet's movement. +** Processing line: ~ bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)~ - Inside source: true *** True Line Result - calc_sprite_selection + bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign) +** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect~ +- Inside source: true +*** True Line Result + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods that perform calculations (if in creating mode)~ +** Processing line: ~ # Determines if a bullet hits an enemy~ - Inside source: true *** True Line Result - # Calls methods that perform calculations (if in creating mode) -** Processing line: ~ def calc_in_game~ + # Determines if a bullet hits an enemy +** Processing line: ~ def calculate_collisions args~ - Inside source: true *** True Line Result - def calc_in_game -** Processing line: ~ return unless state.mode == :creating~ + def calculate_collisions args +** Processing line: ~ args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections~ - Inside source: true *** True Line Result - return unless state.mode == :creating -** Processing line: ~ calc_world_lookup~ + args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections +** Processing line: ~ args.state.enemies.each do |enemy|~ - Inside source: true *** True Line Result - calc_world_lookup -** Processing line: ~ calc_player~ + args.state.enemies.each do |enemy| +** Processing line: ~ # if bullet has not exploded yet and the bullet hits an enemy~ - Inside source: true *** True Line Result - calc_player -** Processing line: ~ end~ + # if bullet has not exploded yet and the bullet hits an enemy +** Processing line: ~ if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect) +** Processing line: ~ bullet.exploded = true # bullet explodes~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_world_lookup~ + bullet.exploded = true # bullet explodes +** Processing line: ~ enemy.dead = true # enemy is killed~ - Inside source: true *** True Line Result - def calc_world_lookup -** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ + enemy.dead = true # enemy is killed +** Processing line: ~ end~ - Inside source: true *** True Line Result - # If the tile size isn't equal to the previous tile size, -** Processing line: ~ # the previous tile size is set to the tile size,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # the previous tile size is set to the tile size, -** Processing line: ~ # and world_lookup hash is set to empty.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # and world_lookup hash is set to empty. -** Processing line: ~ if state.tile_size != state.previous_tile_size~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if state.tile_size != state.previous_tile_size -** Processing line: ~ state.previous_tile_size = state.tile_size~ + +** Processing line: ~ # All exploded bullets are rejected or removed from the bullets collection~ - Inside source: true *** True Line Result - state.previous_tile_size = state.tile_size -** Processing line: ~ state.world_lookup = {}~ + # All exploded bullets are rejected or removed from the bullets collection +** Processing line: ~ # and any dead enemy is rejected from the enemies collection.~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ end~ + # and any dead enemy is rejected from the enemies collection. +** Processing line: ~ args.state.bullets = args.state.bullets.reject(&:exploded)~ - Inside source: true *** True Line Result - end + args.state.bullets = args.state.bullets.reject(&:exploded) +** Processing line: ~ args.state.enemies = args.state.enemies.reject(&:dead)~ +- Inside source: true +*** True Line Result + args.state.enemies = args.state.enemies.reject(&:dead) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # return if world_lookup is not empty or if world is empty~ +** Processing line: ~ # Bullets are rejected from bullets collection once their position exceeds the width of screen~ - Inside source: true *** True Line Result - # return if world_lookup is not empty or if world is empty -** Processing line: ~ return if state.world_lookup.keys.length > 0~ + # Bullets are rejected from bullets collection once their position exceeds the width of screen +** Processing line: ~ def remove_bullets_of_screen args~ - Inside source: true *** True Line Result - return if state.world_lookup.keys.length > 0 -** Processing line: ~ return unless state.world.length > 0~ + def remove_bullets_of_screen args +** Processing line: ~ args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280~ - Inside source: true *** True Line Result - return unless state.world.length > 0 + args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Searches through the world and finds the coordinates that exist~ +** Processing line: ~ # Calls fire_bullet method~ - Inside source: true *** True Line Result - # Searches through the world and finds the coordinates that exist -** Processing line: ~ state.world_lookup = {}~ + # Calls fire_bullet method +** Processing line: ~ def process_inputs args~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ + def process_inputs args +** Processing line: ~ fire_bullet args~ - Inside source: true *** True Line Result - state.world.each { |x, y| state.world_lookup[[x, y]] = true } + fire_bullet args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Assigns collision rects for every sprite drawn~ +** Processing line: ~ # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection~ - Inside source: true *** True Line Result - # Assigns collision rects for every sprite drawn -** Processing line: ~ state.world_collision_rects =~ + # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection +** Processing line: ~ def fire_bullet args~ - Inside source: true *** True Line Result - state.world_collision_rects = -** Processing line: ~ state.world_lookup~ + def fire_bullet args +** Processing line: ~ return unless args.inputs.mouse.click # return unless mouse is clicked~ - Inside source: true *** True Line Result - state.world_lookup -** Processing line: ~ .keys~ + return unless args.inputs.mouse.click # return unless mouse is clicked +** Processing line: ~ args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity~ - Inside source: true *** True Line Result - .keys -** Processing line: ~ .map do |coord_x, coord_y|~ + args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity +** Processing line: ~ bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked~ - Inside source: true *** True Line Result - .map do |coord_x, coord_y| -** Processing line: ~ s = state.tile_size~ + bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked +** Processing line: ~ bullet.x = 0 # starts on the left side of the screen~ - Inside source: true *** True Line Result - s = state.tile_size -** Processing line: ~ # Multiplying by s (the size of a tile) ensures that the rect is~ + bullet.x = 0 # starts on the left side of the screen +** Processing line: ~ bullet.size = 10~ - Inside source: true *** True Line Result - # Multiplying by s (the size of a tile) ensures that the rect is -** Processing line: ~ # placed exactly where you want it to be placed (causes grid to coordinate)~ + bullet.size = 10 +** Processing line: ~ bullet.speed = 10 * rand + 2 # speed of a bullet is randomized~ - Inside source: true *** True Line Result - # placed exactly where you want it to be placed (causes grid to coordinate) -** Processing line: ~ # How many pixels horizontally across and vertically up and down~ + bullet.speed = 10 * rand + 2 # speed of a bullet is randomized +** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set~ - Inside source: true *** True Line Result - # How many pixels horizontally across and vertically up and down -** Processing line: ~ x = s * coord_x~ + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set +** Processing line: ~ end~ - Inside source: true *** True Line Result - x = s * coord_x -** Processing line: ~ y = s * coord_y~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - y = s * coord_y -** Processing line: ~ {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { -** Processing line: ~ args: [coord_x, coord_y],~ + +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - args: [coord_x, coord_y], -** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - left_right: [x, y + 4, s, s - 6], # hash keys and values -** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - top: [x + 4, y + 6, s - 8, s - 6], -** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - bottom: [x + 1, y - 1, s - 2, s - 8], -** Processing line: ~ }~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ - Inside source: true *** True Line Result - end + args.inputs.keyboard.key_down.space || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19461,202 +19844,210 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Calculates movement of player and calls methods that perform collision calculations~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # Calculates movement of player and calls methods that perform collision calculations -** Processing line: ~ def calc_player~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - def calc_player -** Processing line: ~ state.dy += state.gravity # what goes up must come down because of gravity~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - state.dy += state.gravity # what goes up must come down because of gravity -** Processing line: ~ calc_box_collision~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - calc_box_collision -** Processing line: ~ calc_edge_collision~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc_edge_collision -** Processing line: ~ state.y += state.dy # Since velocity is the change in position, the change in y increases by dy~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - state.y += state.dy # Since velocity is the change in position, the change in y increases by dy -** Processing line: ~ state.x += state.dx # Ditto line above but dx and x~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.x += state.dx # Ditto line above but dx and x -** Processing line: ~ state.dx *= 0.8 # Scales dx down~ + +** Processing line: ~* Physics And Collisions - Box Collision - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Physics And Collisions - Box Collision - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/04_box_collision/app/main.rb~ - Inside source: true *** True Line Result - state.dx *= 0.8 # Scales dx down -** Processing line: ~ end~ + # ./samples/04_physics_and_collisions/04_box_collision/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls methods that determine whether the player collides with any world_collision_rects.~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - # Calls methods that determine whether the player collides with any world_collision_rects. -** Processing line: ~ def calc_box_collision~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - def calc_box_collision -** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ + +** Processing line: ~ - first: Returns the first element of the array.~ - Inside source: true *** True Line Result - return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key -** Processing line: ~ collision_floor~ + - first: Returns the first element of the array. +** Processing line: ~ For example, if we have an array~ - Inside source: true *** True Line Result - collision_floor -** Processing line: ~ collision_left~ + For example, if we have an array +** Processing line: ~ numbers = [1, 2, 3, 4, 5]~ - Inside source: true *** True Line Result - collision_left -** Processing line: ~ collision_right~ + numbers = [1, 2, 3, 4, 5] +** Processing line: ~ and we call first by saying~ - Inside source: true *** True Line Result - collision_right -** Processing line: ~ collision_ceiling~ + and we call first by saying +** Processing line: ~ numbers.first~ - Inside source: true *** True Line Result - collision_ceiling -** Processing line: ~ end~ + numbers.first +** Processing line: ~ the number 1 will be returned because it is the first element of the numbers array.~ - Inside source: true *** True Line Result - end + the number 1 will be returned because it is the first element of the numbers array. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ +** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ - Inside source: true *** True Line Result - # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. -** Processing line: ~ def collision_floor~ + - num1.idiv(num2): Divides two numbers and returns an integer. +** Processing line: ~ For example,~ - Inside source: true *** True Line Result - def collision_floor -** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ + For example, +** Processing line: ~ 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer.~ - Inside source: true *** True Line Result - return unless state.dy <= 0 # return unless player is going down or is as far down as possible -** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player~ + 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer. +** Processing line: ~ 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal.~ - Inside source: true *** True Line Result - player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player + 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between player's~ -- Inside source: true -*** True Line Result - # Runs through all the sprites on the field and finds all intersections between player's -** Processing line: ~ # bottom and the top of a rect.~ -- Inside source: true -*** True Line Result - # bottom and the top of a rect. -** Processing line: ~ floor_collisions = state.world_collision_rects~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - floor_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ - Inside source: true *** True Line Result - .first + - find_all: Finds all values that satisfy specific requirements. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return unless floor_collisions # performs following changes if a collision has occurred~ +** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ - Inside source: true *** True Line Result - return unless floor_collisions # performs following changes if a collision has occurred -** Processing line: ~ state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top~ + - ARRAY#intersect_rect?: An array with at least four values is +** Processing line: ~ considered a rect. The intersect_rect? function returns true~ - Inside source: true *** True Line Result - state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top -** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ + considered a rect. The intersect_rect? function returns true +** Processing line: ~ or false depending on if the two rectangles intersect.~ - Inside source: true *** True Line Result - state.dy = 0 # no change in y because the player's path is blocked -** Processing line: ~ end~ + or false depending on if the two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +- Inside source: true +*** True Line Result + - reject: Removes elements from a collection if they meet certain requirements. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - # Finds collisions between the player's left side and the right side of a world_collision_rect. -** Processing line: ~ def collision_left~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - def collision_left -** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ + +** Processing line: ~ # This sample app allows users to create tiles and place them anywhere on the screen as obstacles.~ - Inside source: true *** True Line Result - return unless state.dx < 0 # return unless player is moving left -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ + # This sample app allows users to create tiles and place them anywhere on the screen as obstacles. +** Processing line: ~ # The player can then move and maneuver around them.~ - Inside source: true *** True Line Result - player_rect = [next_x, state.y, state.tile_size, state.tile_size] + # The player can then move and maneuver around them. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's left side~ +** Processing line: ~ class PoorManPlatformerPhysics~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and finds all intersections between the player's left side -** Processing line: ~ # and the right side of a rect.~ + class PoorManPlatformerPhysics +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ - Inside source: true *** True Line Result - # and the right side of a rect. -** Processing line: ~ left_side_collisions = state.world_collision_rects~ + attr_accessor :grid, :inputs, :state, :outputs +** Processing line: ~~ - Inside source: true *** True Line Result - left_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ + +** Processing line: ~ # Calls all methods necessary for the app to run successfully.~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + # Calls all methods necessary for the app to run successfully. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - return unless left_side_collisions # return unless collision occurred -** Processing line: ~ state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side -** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - state.dx = 0 # no change in x because the player's path is blocked + process_inputs ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19665,62 +20056,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ +** Processing line: ~ # Sets default values for variables.~ - Inside source: true *** True Line Result - # Finds collisions between the right side of the player and the left side of a world_collision_rect. -** Processing line: ~ def collision_right~ + # Sets default values for variables. +** Processing line: ~ # The ||= sign means that the variable will only be set to the value following the = sign if the value has~ - Inside source: true *** True Line Result - def collision_right -** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ + # The ||= sign means that the variable will only be set to the value following the = sign if the value has +** Processing line: ~ # not already been set before. Intialization happens only in the first frame.~ - Inside source: true *** True Line Result - return unless state.dx > 0 # return unless player is moving right -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ + # not already been set before. Intialization happens only in the first frame. +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - player_rect = [next_x, state.y, state.tile_size, state.tile_size] -** Processing line: ~~ + def defaults +** Processing line: ~ state.tile_size = 64~ - Inside source: true *** True Line Result - -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's~ + state.tile_size = 64 +** Processing line: ~ state.gravity = -0.2~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and finds all intersections between the player's -** Processing line: ~ # right side and the left side of a rect.~ + state.gravity = -0.2 +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ - Inside source: true *** True Line Result - # right side and the left side of a rect. -** Processing line: ~ right_side_collisions = state.world_collision_rects~ + state.previous_tile_size ||= state.tile_size +** Processing line: ~ state.x ||= 0~ - Inside source: true *** True Line Result - right_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ + state.x ||= 0 +** Processing line: ~ state.y ||= 800~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + state.y ||= 800 +** Processing line: ~ state.dy ||= 0~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + state.dy ||= 0 +** Processing line: ~ state.dx ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ + state.dx ||= 0 +** Processing line: ~ state.world ||= []~ - Inside source: true *** True Line Result - return unless right_side_collisions # return unless collision occurred -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner)~ + state.world ||= [] +** Processing line: ~ state.world_lookup ||= {}~ - Inside source: true *** True Line Result - state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) -** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ + state.world_lookup ||= {} +** Processing line: ~ state.world_collision_rects ||= []~ - Inside source: true *** True Line Result - state.dx = 0 # no change in x because the player's path is blocked + state.world_collision_rects ||= [] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19729,150 +20120,158 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ +** Processing line: ~ # Outputs solids and borders of different colors for the world and collision_rects collections.~ - Inside source: true *** True Line Result - # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. -** Processing line: ~ def collision_ceiling~ + # Outputs solids and borders of different colors for the world and collision_rects collections. +** Processing line: ~ def render~ - Inside source: true *** True Line Result - def collision_ceiling -** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ + def render +** Processing line: ~~ - Inside source: true *** True Line Result - return unless state.dy > 0 # return unless player is moving up -** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ + +** Processing line: ~ # Sets a black background on the screen (Comment this line out and the background will become white.)~ - Inside source: true *** True Line Result - player_rect = [state.x, next_y, state.player_width, state.player_height] -** Processing line: ~~ + # Sets a black background on the screen (Comment this line out and the background will become white.) +** Processing line: ~ # Also note that black is the default color for when no color is assigned.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's top~ + # Also note that black is the default color for when no color is assigned. +** Processing line: ~ outputs.solids << grid.rect~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and finds all intersections between the player's top -** Processing line: ~ # and the bottom of a rect.~ + outputs.solids << grid.rect +** Processing line: ~~ - Inside source: true *** True Line Result - # and the bottom of a rect. -** Processing line: ~ ceil_collisions = state.world_collision_rects~ + +** Processing line: ~ # The position, size, and color (white) are set for borders given to the world collection.~ - Inside source: true *** True Line Result - ceil_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ + # The position, size, and color (white) are set for borders given to the world collection. +** Processing line: ~ # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.~ - Inside source: true *** True Line Result - .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters. +** Processing line: ~ outputs.borders << state.world.map do |x, y|~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + outputs.borders << state.world.map do |x, y| +** Processing line: ~ [x * state.tile_size,~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ + [x * state.tile_size, +** Processing line: ~ y * state.tile_size,~ - Inside source: true *** True Line Result - return unless ceil_collisions # return unless collision occurred -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size)~ + y * state.tile_size, +** Processing line: ~ state.tile_size,~ - Inside source: true *** True Line Result - state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) -** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ + state.tile_size, +** Processing line: ~ state.tile_size, 255, 255, 255]~ - Inside source: true *** True Line Result - state.dy = 0 # no change in y because the player's path is blocked -** Processing line: ~ end~ + state.tile_size, 255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ +** Processing line: ~ # The top, bottom, and sides of the borders for collision_rects are different colors.~ - Inside source: true *** True Line Result - # Makes sure the player remains within the screen's dimensions. -** Processing line: ~ def calc_edge_collision~ + # The top, bottom, and sides of the borders for collision_rects are different colors. +** Processing line: ~ outputs.borders << state.world_collision_rects.map do |e|~ - Inside source: true *** True Line Result - def calc_edge_collision -** Processing line: ~ # Ensures that player doesn't fall below the map~ + outputs.borders << state.world_collision_rects.map do |e| +** Processing line: ~ [~ - Inside source: true *** True Line Result - # Ensures that player doesn't fall below the map -** Processing line: ~ if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope~ + [ +** Processing line: ~ [e[:top], 0, 170, 0], # top is a shade of green~ - Inside source: true *** True Line Result - if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope -** Processing line: ~ state.y = 0 # 0 is the lowest the player can be while staying on the screen~ + [e[:top], 0, 170, 0], # top is a shade of green +** Processing line: ~ [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue~ - Inside source: true *** True Line Result - state.y = 0 # 0 is the lowest the player can be while staying on the screen -** Processing line: ~ state.dy = 0~ + [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue +** Processing line: ~ [e[:left_right], 170, 0, 0], # left and right are a shade of red~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ # Ensures player doesn't go insanely high~ + [e[:left_right], 170, 0, 0], # left and right are a shade of red +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # Ensures player doesn't go insanely high -** Processing line: ~ elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope -** Processing line: ~ state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen -** Processing line: ~ state.dy = 0~ + +** Processing line: ~ # Sets the position, size, and color (a shade of green) of the borders of only the player's~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ end~ + # Sets the position, size, and color (a shade of green) of the borders of only the player's +** Processing line: ~ # box and outputs it. If you change the 180 to 0, the player's box will be black and you~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # box and outputs it. If you change the 180 to 0, the player's box will be black and you +** Processing line: ~ # won't be able to see it (because it will match the black background).~ - Inside source: true *** True Line Result - -** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ + # won't be able to see it (because it will match the black background). +** Processing line: ~ outputs.borders << [state.x,~ - Inside source: true *** True Line Result - # Ensures that player remains in the horizontal range its supposed to -** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right~ + outputs.borders << [state.x, +** Processing line: ~ state.y,~ - Inside source: true *** True Line Result - if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right -** Processing line: ~ state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope~ + state.y, +** Processing line: ~ state.tile_size,~ - Inside source: true *** True Line Result - state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope -** Processing line: ~ state.dx = 0~ + state.tile_size, +** Processing line: ~ state.tile_size, 0, 180, 0]~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left~ + state.tile_size, 0, 180, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left -** Processing line: ~ state.x = 0 # farthest left the player can be while remaining in the screen's scope~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.x = 0 # farthest left the player can be while remaining in the screen's scope -** Processing line: ~ state.dx = 0~ + +** Processing line: ~ # Calls methods needed to perform calculations.~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ end~ + # Calls methods needed to perform calculations. +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - end + def calc +** Processing line: ~ calc_world_lookup~ +- Inside source: true +*** True Line Result + calc_world_lookup +** Processing line: ~ calc_player~ +- Inside source: true +*** True Line Result + calc_player ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19881,38 +20280,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_sprite_selection~ +** Processing line: ~ # Performs calculations on world_lookup and sets values.~ - Inside source: true *** True Line Result - def calc_sprite_selection -** Processing line: ~ # Does the transition to bring down the select sprite screen~ + # Performs calculations on world_lookup and sets values. +** Processing line: ~ def calc_world_lookup~ - Inside source: true *** True Line Result - # Does the transition to bring down the select sprite screen -** Processing line: ~ if state.mode == :selecting && state.select_menu.y != 0~ + def calc_world_lookup +** Processing line: ~~ - Inside source: true *** True Line Result - if state.mode == :selecting && state.select_menu.y != 0 -** Processing line: ~ state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed)~ + +** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ - Inside source: true *** True Line Result - state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) -** Processing line: ~ state.banner_coords.y = 680 # sets y position of Select Sprite banner~ + # If the tile size isn't equal to the previous tile size, +** Processing line: ~ # the previous tile size is set to the tile size,~ - Inside source: true *** True Line Result - state.banner_coords.y = 680 # sets y position of Select Sprite banner -** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ + # the previous tile size is set to the tile size, +** Processing line: ~ # and world_lookup hash is set to empty.~ - Inside source: true *** True Line Result - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| -** Processing line: ~ [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen)~ + # and world_lookup hash is set to empty. +** Processing line: ~ if state.tile_size != state.previous_tile_size~ - Inside source: true *** True Line Result - [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) -** Processing line: ~ end~ + if state.tile_size != state.previous_tile_size +** Processing line: ~ state.previous_tile_size = state.tile_size~ - Inside source: true *** True Line Result - end + state.previous_tile_size = state.tile_size +** Processing line: ~ state.world_lookup = {} # empty hash~ +- Inside source: true +*** True Line Result + state.world_lookup = {} # empty hash ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -19921,230 +20324,242 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Does the transition to leave the select sprite screen~ +** Processing line: ~ # return if the world_lookup hash has keys (or, in other words, is not empty)~ - Inside source: true *** True Line Result - # Does the transition to leave the select sprite screen -** Processing line: ~ if state.mode == :creating && state.select_menu.y != 720~ + # return if the world_lookup hash has keys (or, in other words, is not empty) +** Processing line: ~ # return unless the world collection has values inside of it (or is not empty)~ - Inside source: true *** True Line Result - if state.mode == :creating && state.select_menu.y != 720 -** Processing line: ~ state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up)~ + # return unless the world collection has values inside of it (or is not empty) +** Processing line: ~ return if state.world_lookup.keys.length > 0~ - Inside source: true *** True Line Result - state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) -** Processing line: ~ state.banner_coords.y = 1000 # sets y position of Select Sprite banner~ + return if state.world_lookup.keys.length > 0 +** Processing line: ~ return unless state.world.length > 0~ - Inside source: true *** True Line Result - state.banner_coords.y = 1000 # sets y position of Select Sprite banner -** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ + return unless state.world.length > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| -** Processing line: ~ [x, y + 720, w, h] # sets definition of all elements in collection~ + +** Processing line: ~ # Starts with an empty hash for world_lookup.~ - Inside source: true *** True Line Result - [x, y + 720, w, h] # sets definition of all elements in collection -** Processing line: ~ end~ + # Starts with an empty hash for world_lookup. +** Processing line: ~ # Searches through the world and finds the coordinates that exist.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Searches through the world and finds the coordinates that exist. +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.world_lookup = {} +** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ - Inside source: true *** True Line Result - end + state.world.each { |x, y| state.world_lookup[[x, y]] = true } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs~ +** Processing line: ~ # Assigns world_collision_rects for every sprite drawn.~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ # If the state.mode is back and if the menu has retreated back up~ + # Assigns world_collision_rects for every sprite drawn. +** Processing line: ~ state.world_collision_rects =~ - Inside source: true *** True Line Result - # If the state.mode is back and if the menu has retreated back up -** Processing line: ~ # call methods that process user inputs~ + state.world_collision_rects = +** Processing line: ~ state.world_lookup~ - Inside source: true *** True Line Result - # call methods that process user inputs -** Processing line: ~ if state.mode == :creating~ + state.world_lookup +** Processing line: ~ .keys~ - Inside source: true *** True Line Result - if state.mode == :creating -** Processing line: ~ process_inputs_player_movement~ + .keys +** Processing line: ~ .map do |coord_x, coord_y|~ - Inside source: true *** True Line Result - process_inputs_player_movement -** Processing line: ~ process_inputs_place_tile~ + .map do |coord_x, coord_y| +** Processing line: ~ s = state.tile_size~ - Inside source: true *** True Line Result - process_inputs_place_tile -** Processing line: ~ end~ + s = state.tile_size +** Processing line: ~ # multiply by tile size so the grid coordinates; sets pixel value~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # multiply by tile size so the grid coordinates; sets pixel value +** Processing line: ~ # don't forget that position is denoted by bottom left corner~ - Inside source: true *** True Line Result - -** Processing line: ~ # For each sprite_coordinate added, check what sprite was selected~ + # don't forget that position is denoted by bottom left corner +** Processing line: ~ # set x = coord_x or y = coord_y and see what happens!~ - Inside source: true *** True Line Result - # For each sprite_coordinate added, check what sprite was selected -** Processing line: ~ if state.mode == :selecting~ + # set x = coord_x or y = coord_y and see what happens! +** Processing line: ~ x = s * coord_x~ - Inside source: true *** True Line Result - if state.mode == :selecting -** Processing line: ~ state.sprite_coords.map do |x, y, order| # goes through all sprites in collection~ + x = s * coord_x +** Processing line: ~ y = s * coord_y~ - Inside source: true *** True Line Result - state.sprite_coords.map do |x, y, order| # goes through all sprites in collection -** Processing line: ~ # checks that a specific sprite was pressed based on x, y position~ + y = s * coord_y +** Processing line: ~ {~ - Inside source: true *** True Line Result - # checks that a specific sprite was pressed based on x, y position -** Processing line: ~ if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true~ + { +** Processing line: ~ # The values added to x, y, and s position the world_collision_rects so they all appear~ - Inside source: true *** True Line Result - if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true -** Processing line: ~ inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and~ + # The values added to x, y, and s position the world_collision_rects so they all appear +** Processing line: ~ # stacked (on top of world rects) but don't directly overlap.~ - Inside source: true *** True Line Result - inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and -** Processing line: ~ inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right~ + # stacked (on top of world rects) but don't directly overlap. +** Processing line: ~ # Remove these added values and mess around with the rect placement!~ - Inside source: true *** True Line Result - inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right -** Processing line: ~ inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y~ + # Remove these added values and mess around with the rect placement! +** Processing line: ~ args: [coord_x, coord_y],~ - Inside source: true *** True Line Result - inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y -** Processing line: ~ inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up~ + args: [coord_x, coord_y], +** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ - Inside source: true *** True Line Result - inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up -** Processing line: ~ state.sprite_selected = order # sprite is chosen~ + left_right: [x, y + 4, s, s - 6], # hash keys and values +** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ - Inside source: true *** True Line Result - state.sprite_selected = order # sprite is chosen -** Processing line: ~ end~ + top: [x + 4, y + 6, s - 8, s - 6], +** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + bottom: [x + 1, y - 1, s - 2, s - 8], +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ inputs_export_stage~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - inputs_export_stage -** Processing line: ~ process_inputs_show_available_sprites~ + +** Processing line: ~ # Performs calculations to change the x and y values of the player's box.~ - Inside source: true *** True Line Result - process_inputs_show_available_sprites -** Processing line: ~ end~ + # Performs calculations to change the x and y values of the player's box. +** Processing line: ~ def calc_player~ - Inside source: true *** True Line Result - end + def calc_player ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Moves the player based on the keys they press on their keyboard~ -- Inside source: true -*** True Line Result - # Moves the player based on the keys they press on their keyboard -** Processing line: ~ def process_inputs_player_movement~ +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame.~ - Inside source: true *** True Line Result - def process_inputs_player_movement -** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right)~ + # Since acceleration is the change in velocity, the change in y (dy) increases every frame. +** Processing line: ~ # What goes up must come down because of gravity.~ - Inside source: true *** True Line Result - # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) -** Processing line: ~ if inputs.keyboard.key_up.right~ + # What goes up must come down because of gravity. +** Processing line: ~ state.dy += state.gravity~ - Inside source: true *** True Line Result - if inputs.keyboard.key_up.right -** Processing line: ~ state.dx = 0~ + state.dy += state.gravity +** Processing line: ~~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ elsif inputs.keyboard.key_up.left~ + +** Processing line: ~ # Calls the calc_box_collision and calc_edge_collision methods.~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_up.left -** Processing line: ~ state.dx = 0~ + # Calls the calc_box_collision and calc_edge_collision methods. +** Processing line: ~ calc_box_collision~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ end~ + calc_box_collision +** Processing line: ~ calc_edge_collision~ - Inside source: true *** True Line Result - end + calc_edge_collision ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys~ +** Processing line: ~ # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.~ - Inside source: true *** True Line Result - # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys -** Processing line: ~ if inputs.keyboard.key_held.right~ + # Since velocity is the change in position, the change in y increases by dy. Same with x and dx. +** Processing line: ~ state.y += state.dy~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.right -** Processing line: ~ state.dx = 3~ + state.y += state.dy +** Processing line: ~ state.x += state.dx~ - Inside source: true *** True Line Result - state.dx = 3 -** Processing line: ~ elsif inputs.keyboard.key_held.left~ + state.x += state.dx +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_held.left -** Processing line: ~ state.dx = -3~ + +** Processing line: ~ # Scales dx down.~ - Inside source: true *** True Line Result - state.dx = -3 -** Processing line: ~ end~ + # Scales dx down. +** Processing line: ~ state.dx *= 0.8~ - Inside source: true *** True Line Result - end + state.dx *= 0.8 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard~ +** Processing line: ~ # Calls methods needed to determine collisions between player and world_collision rects.~ - Inside source: true *** True Line Result - # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard -** Processing line: ~ if inputs.keyboard.key_held.space~ + # Calls methods needed to determine collisions between player and world_collision rects. +** Processing line: ~ def calc_box_collision~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.space -** Processing line: ~ state.dy = 5~ + def calc_box_collision +** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ - Inside source: true *** True Line Result - state.dy = 5 -** Processing line: ~ end~ + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key +** Processing line: ~ collision_floor!~ - Inside source: true *** True Line Result - end + collision_floor! +** Processing line: ~ collision_left!~ +- Inside source: true +*** True Line Result + collision_left! +** Processing line: ~ collision_right!~ +- Inside source: true +*** True Line Result + collision_right! +** Processing line: ~ collision_ceiling!~ +- Inside source: true +*** True Line Result + collision_ceiling! ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20153,70 +20568,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Adds tile in the place the user holds down the mouse~ -- Inside source: true -*** True Line Result - # Adds tile in the place the user holds down the mouse -** Processing line: ~ def process_inputs_place_tile~ +** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ - Inside source: true *** True Line Result - def process_inputs_place_tile -** Processing line: ~ if inputs.mouse.down # if mouse is pressed~ + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. +** Processing line: ~ def collision_floor!~ - Inside source: true *** True Line Result - if inputs.mouse.down # if mouse is pressed -** Processing line: ~ state.world_lookup = {}~ + def collision_floor! +** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ + return unless state.dy <= 0 # return unless player is going down or is as far down as possible +** Processing line: ~ player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player~ - Inside source: true *** True Line Result - x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks if any coordinates duplicate (already exist in world)~ -- Inside source: true -*** True Line Result - # Checks if any coordinates duplicate (already exist in world) -** Processing line: ~ if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y }~ +** Processing line: ~ # Goes through world_collision_rects to find all intersections between the bottom of player's rect and~ - Inside source: true *** True Line Result - if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } -** Processing line: ~ #erases existing tile space by rejecting them from world~ + # Goes through world_collision_rects to find all intersections between the bottom of player's rect and +** Processing line: ~ # the top of a world_collision_rect (hence the "-0.1" above)~ - Inside source: true *** True Line Result - #erases existing tile space by rejecting them from world -** Processing line: ~ state.world = state.world.reject do |existing_x, existing_y, n|~ + # the top of a world_collision_rect (hence the "-0.1" above) +** Processing line: ~ floor_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - state.world = state.world.reject do |existing_x, existing_y, n| -** Processing line: ~ existing_x == x && existing_y == y~ + floor_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }~ - Inside source: true *** True Line Result - existing_x == x && existing_y == y -** Processing line: ~ end~ + .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + .first +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite~ + +** Processing line: ~ return unless floor_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite -** Processing line: ~ end~ + return unless floor_collisions # return unless collision occurred +** Processing line: ~ state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect +** Processing line: ~ state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked~ - Inside source: true *** True Line Result - end + state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20225,134 +20632,146 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Stores/exports world collection's info (coordinates, sprite number) into a file~ +** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ - Inside source: true *** True Line Result - # Stores/exports world collection's info (coordinates, sprite number) into a file -** Processing line: ~ def inputs_export_stage~ + # Finds collisions between the player's left side and the right side of a world_collision_rect. +** Processing line: ~ def collision_left!~ - Inside source: true *** True Line Result - def inputs_export_stage -** Processing line: ~ if inputs.keyboard.key_down.e # if "e" is pressed~ + def collision_left! +** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.e # if "e" is pressed -** Processing line: ~ export_string = state.world.map do |x, y, sprite_number| # stores world info in a string~ + return unless state.dx < 0 # return unless player is moving left +** Processing line: ~ player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - export_string = state.world.map do |x, y, sprite_number| # stores world info in a string -** Processing line: ~ "#{x},#{y},#{sprite_number}" # using string interpolation~ + player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size] +** Processing line: ~~ - Inside source: true *** True Line Result - "#{x},#{y},#{sprite_number}" # using string interpolation -** Processing line: ~ end~ + +** Processing line: ~ # Goes through world_collision_rects to find all intersections beween the player's left side and the~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file~ + # Goes through world_collision_rects to find all intersections beween the player's left side and the +** Processing line: ~ # right side of a world_collision_rect.~ - Inside source: true *** True Line Result - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file -** Processing line: ~ state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved~ + # right side of a world_collision_rect. +** Processing line: ~ left_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved -** Processing line: ~ end~ + left_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs_show_available_sprites~ +** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - def process_inputs_show_available_sprites -** Processing line: ~ # Based on keyboard input, the entity (:creating and :selecting) switch~ + return unless left_side_collisions # return unless collision occurred +** Processing line: ~~ - Inside source: true *** True Line Result - # Based on keyboard input, the entity (:creating and :selecting) switch -** Processing line: ~ if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating~ + +** Processing line: ~ # player's x is set to the value of the x of the collided rect's right side~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating -** Processing line: ~ state.mode = :selecting # will change to selecting~ + # player's x is set to the value of the x of the collided rect's right side +** Processing line: ~ state.x = left_side_collisions[:left_right].right~ - Inside source: true *** True Line Result - state.mode = :selecting # will change to selecting -** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ + state.x = left_side_collisions[:left_right].right +** Processing line: ~ state.dx = 0 # player isn't moving left because its path is blocked~ - Inside source: true *** True Line Result - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off -** Processing line: ~ elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting~ + state.dx = 0 # player isn't moving left because its path is blocked +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting -** Processing line: ~ state.mode = :creating # will change to creating~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.mode = :creating # will change to creating -** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ + +** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ - Inside source: true *** True Line Result - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off -** Processing line: ~ end~ + # Finds collisions between the right side of the player and the left side of a world_collision_rect. +** Processing line: ~ def collision_right!~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def collision_right! +** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ - Inside source: true *** True Line Result - end + return unless state.dx > 0 # return unless player is moving right +** Processing line: ~ player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size]~ +- Inside source: true +*** True Line Result + player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Loads the world collection by reading from the map.txt file in the app folder~ +** Processing line: ~ # Goes through world_collision_rects to find all intersections between the player's right side~ - Inside source: true *** True Line Result - # Loads the world collection by reading from the map.txt file in the app folder -** Processing line: ~ def attempt_load_world_from_file~ + # Goes through world_collision_rects to find all intersections between the player's right side +** Processing line: ~ # and the left side of a world_collision_rect (hence the "+0.1" above)~ - Inside source: true *** True Line Result - def attempt_load_world_from_file -** Processing line: ~ return if state.world # return if the world collection is already populated~ + # and the left side of a world_collision_rect (hence the "+0.1" above) +** Processing line: ~ right_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - return if state.world # return if the world collection is already populated -** Processing line: ~ state.world ||= [] # initialized as an empty collection~ + right_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ - Inside source: true *** True Line Result - state.world ||= [] # initialized as an empty collection -** Processing line: ~ exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code~ + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code -** Processing line: ~ return unless exported_world # return unless the file read was successful~ + .first +** Processing line: ~~ - Inside source: true *** True Line Result - return unless exported_world # return unless the file read was successful -** Processing line: ~ state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world~ + +** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world -** Processing line: ~ l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,~ + return unless right_side_collisions # return unless collision occurred +** Processing line: ~~ - Inside source: true *** True Line Result - l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, -** Processing line: ~ # calling to_i (converts to integers) on each element~ + +** Processing line: ~ # player's x is set to the value of the collided rect's left, minus the size of a rect~ - Inside source: true *** True Line Result - # calling to_i (converts to integers) on each element -** Processing line: ~ end~ + # player's x is set to the value of the collided rect's left, minus the size of a rect +** Processing line: ~ # tile size is subtracted because player's position is denoted by bottom left corner~ - Inside source: true *** True Line Result - end + # tile size is subtracted because player's position is denoted by bottom left corner +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ +- Inside source: true +*** True Line Result + state.x = right_side_collisions[:left_right].left - state.tile_size +** Processing line: ~ state.dx = 0 # player isn't moving right because its path is blocked~ +- Inside source: true +*** True Line Result + state.dx = 0 # player isn't moving right because its path is blocked ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20361,306 +20780,306 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Adds the change in y to y to determine the next y position of the player.~ +** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ - Inside source: true *** True Line Result - # Adds the change in y to y to determine the next y position of the player. -** Processing line: ~ def next_y~ + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. +** Processing line: ~ def collision_ceiling!~ - Inside source: true *** True Line Result - def next_y -** Processing line: ~ state.y + state.dy~ + def collision_ceiling! +** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ - Inside source: true *** True Line Result - state.y + state.dy -** Processing line: ~ end~ + return unless state.dy > 0 # return unless player is moving up +** Processing line: ~ player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - end + player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Determines next x position of player~ -- Inside source: true -*** True Line Result - # Determines next x position of player -** Processing line: ~ def next_x~ +** Processing line: ~ # Goes through world_collision_rects to find intersections between the bottom of a~ - Inside source: true *** True Line Result - def next_x -** Processing line: ~ if state.dx < 0 # if the player moves left~ + # Goes through world_collision_rects to find intersections between the bottom of a +** Processing line: ~ # world_collision_rect and the top of the player's rect (hence the "+0.1" above)~ - Inside source: true *** True Line Result - if state.dx < 0 # if the player moves left -** Processing line: ~ return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)~ + # world_collision_rect and the top of the player's rect (hence the "+0.1" above) +** Processing line: ~ ceil_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) -** Processing line: ~ else~ + ceil_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) }~ - Inside source: true *** True Line Result - else -** Processing line: ~ return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)~ + .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) -** Processing line: ~ end~ + .first +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - end + return unless ceil_collisions # return unless collision occurred ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_coord point~ +** Processing line: ~ # player's y is set to the bottom y of the rect it collided with, minus the size of a rect~ - Inside source: true *** True Line Result - def to_coord point -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ + # player's y is set to the bottom y of the rect it collided with, minus the size of a rect +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ - Inside source: true *** True Line Result - # Integer divides (idiv) point.x to turn into grid -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ + state.y = ceil_collisions[:bottom].y - state.tile_size +** Processing line: ~ state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked~ - Inside source: true *** True Line Result - # Then, you can just multiply each integer by state.tile_size -** Processing line: ~ # later and huzzah. Grid coordinates~ + state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked +** Processing line: ~ end~ - Inside source: true *** True Line Result - # later and huzzah. Grid coordinates -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] -** Processing line: ~ end~ + +** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Makes sure the player remains within the screen's dimensions. +** Processing line: ~ def calc_edge_collision~ - Inside source: true *** True Line Result - end + def calc_edge_collision ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $metroidvania_starter = MetroidvaniaStarter.new~ +** Processing line: ~ #Ensures that the player doesn't fall below the map.~ - Inside source: true *** True Line Result - $metroidvania_starter = MetroidvaniaStarter.new -** Processing line: ~~ + #Ensures that the player doesn't fall below the map. +** Processing line: ~ if state.y < 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + if state.y < 0 +** Processing line: ~ state.y = 0~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $metroidvania_starter.grid = args.grid~ + state.y = 0 +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - $metroidvania_starter.grid = args.grid -** Processing line: ~ $metroidvania_starter.inputs = args.inputs~ + state.dy = 0 +** Processing line: ~~ - Inside source: true *** True Line Result - $metroidvania_starter.inputs = args.inputs -** Processing line: ~ $metroidvania_starter.state = args.state~ + +** Processing line: ~ #Ensures that the player doesn't go too high.~ - Inside source: true *** True Line Result - $metroidvania_starter.state = args.state -** Processing line: ~ $metroidvania_starter.outputs = args.outputs~ + #Ensures that the player doesn't go too high. +** Processing line: ~ # Position of player is denoted by bottom left hand corner, which is why we have to subtract the~ - Inside source: true *** True Line Result - $metroidvania_starter.outputs = args.outputs -** Processing line: ~ $metroidvania_starter.gtk = args.gtk~ + # Position of player is denoted by bottom left hand corner, which is why we have to subtract the +** Processing line: ~ # size of the player's box (so it remains visible on the screen)~ - Inside source: true *** True Line Result - $metroidvania_starter.gtk = args.gtk -** Processing line: ~ $metroidvania_starter.tick~ + # size of the player's box (so it remains visible on the screen) +** Processing line: ~ elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen~ - Inside source: true *** True Line Result - $metroidvania_starter.tick -** Processing line: ~ end~ + elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen +** Processing line: ~ state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + state.dy = 0 +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 04_physics_and_collisions/04_jump_physics/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 04_physics_and_collisions/04_jump_physics/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +- Inside source: true *** True Line Result +** Processing line: ~ # Ensures that the player remains in the horizontal range that it is supposed to.~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + # Ensures that the player remains in the horizontal range that it is supposed to. +** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right +** Processing line: ~ state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + state.dx = 0 +** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if player moves too far left~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ + elsif state.x <= 0 && state.dx < 0 # if player moves too far left +** Processing line: ~ state.x = 0 # player will remain as left as possible while remaining on screen~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ + state.x = 0 # player will remain as left as possible while remaining on screen +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - For example, if we want to create a new button, we would declare it as a new entity and -** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ + state.dx = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - then define its properties. (Remember, you can use state to define ANY property and it will -** Processing line: ~ be retained across frames.)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - be retained across frames.) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ # Processes input from the user on the keyboard.~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ + # Processes input from the user on the keyboard. +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ + def process_inputs +** Processing line: ~ if inputs.mouse.down~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + if inputs.mouse.down +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ + state.world_lookup = {} +** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ - Inside source: true *** True Line Result - - num1.greater(num2): Returns the greater value. + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate~ - Inside source: true *** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The value can be found -** Processing line: ~ using their keys.~ + if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate +** Processing line: ~ state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space~ - Inside source: true *** True Line Result - using their keys. -** Processing line: ~~ + state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ + else +** Processing line: ~ state.world << [x, y] # If no duplicates, adds to world collection~ - Inside source: true *** True Line Result - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. -** Processing line: ~~ + state.world << [x, y] # If no duplicates, adds to world collection +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - =end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app is a game that requires the user to jump from one platform to the next.~ +** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys.~ - Inside source: true *** True Line Result - # This sample app is a game that requires the user to jump from one platform to the next. -** Processing line: ~ # As the player successfully clears platforms, they become smaller and move faster.~ + # Sets dx to 0 if the player lets go of arrow keys. +** Processing line: ~ if inputs.keyboard.key_up.right~ - Inside source: true *** True Line Result - # As the player successfully clears platforms, they become smaller and move faster. -** Processing line: ~~ + if inputs.keyboard.key_up.right +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ class VerticalPlatformer~ + state.dx = 0 +** Processing line: ~ elsif inputs.keyboard.key_up.left~ - Inside source: true *** True Line Result - class VerticalPlatformer -** Processing line: ~ attr_gtk~ + elsif inputs.keyboard.key_up.left +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - attr_gtk + state.dx = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # declares vertical platformer as new entity~ +** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses.~ - Inside source: true *** True Line Result - # declares vertical platformer as new entity -** Processing line: ~ def s~ + # Sets dx to 3 in whatever direction the player chooses. +** Processing line: ~ if inputs.keyboard.key_held.right # if right key is pressed~ - Inside source: true *** True Line Result - def s -** Processing line: ~ state.vertical_platformer ||= state.new_entity(:vertical_platformer)~ + if inputs.keyboard.key_held.right # if right key is pressed +** Processing line: ~ state.dx = 3~ - Inside source: true *** True Line Result - state.vertical_platformer ||= state.new_entity(:vertical_platformer) -** Processing line: ~ state.vertical_platformer~ + state.dx = 3 +** Processing line: ~ elsif inputs.keyboard.key_held.left # if left key is pressed~ - Inside source: true *** True Line Result - state.vertical_platformer -** Processing line: ~ end~ + elsif inputs.keyboard.key_held.left # if left key is pressed +** Processing line: ~ state.dx = -3~ - Inside source: true *** True Line Result - end + state.dx = -3 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # creates a new platform using a hash~ +** Processing line: ~ #Sets dy to 5 to make the player ~fly~ when they press the space bar~ - Inside source: true *** True Line Result - # creates a new platform using a hash -** Processing line: ~ def new_platform hash~ + #Sets dy to 5 to make the player ~fly~ when they press the space bar +** Processing line: ~ if inputs.keyboard.key_held.space~ - Inside source: true *** True Line Result - def new_platform hash -** Processing line: ~ s.new_entity_strict(:platform, hash) # platform key~ + if inputs.keyboard.key_held.space +** Processing line: ~ state.dy = 5~ - Inside source: true *** True Line Result - s.new_entity_strict(:platform, hash) # platform key + state.dy = 5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20669,30 +21088,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # calls methods needed for game to run properly~ -- Inside source: true -*** True Line Result - # calls methods needed for game to run properly -** Processing line: ~ def tick~ +** Processing line: ~ def to_coord point~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + def to_coord point +** Processing line: ~~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + # Integer divides (idiv) point.x to turn into grid +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size later so the grid coordinates.~ - Inside source: true *** True Line Result - calc -** Processing line: ~ input~ + # Then, you can just multiply each integer by state.tile_size later so the grid coordinates. +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ - Inside source: true *** True Line Result - input + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20701,94 +21116,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values~ +** Processing line: ~ # Represents the tolerance for a collision between the player's rect and another rect.~ - Inside source: true *** True Line Result - # Sets default values -** Processing line: ~ def defaults~ + # Represents the tolerance for a collision between the player's rect and another rect. +** Processing line: ~ def collision_tollerance~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ + def collision_tollerance +** Processing line: ~ 0.0~ - Inside source: true *** True Line Result - s.platforms ||= [ # initializes platforms collection with two platforms using hashes -** Processing line: ~ new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil),~ + 0.0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), -** Processing line: ~ new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher -** Processing line: ~ ]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ] + +** Processing line: ~ $platformer_physics = PoorManPlatformerPhysics.new~ +- Inside source: true +*** True Line Result + $platformer_physics = PoorManPlatformerPhysics.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ s.tick_count = args.state.tick_count~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - s.tick_count = args.state.tick_count -** Processing line: ~ s.gravity = -0.3 # what goes up must come down because of gravity~ + def tick args +** Processing line: ~ $platformer_physics.grid = args.grid~ - Inside source: true *** True Line Result - s.gravity = -0.3 # what goes up must come down because of gravity -** Processing line: ~ s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared~ + $platformer_physics.grid = args.grid +** Processing line: ~ $platformer_physics.inputs = args.inputs~ - Inside source: true *** True Line Result - s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared -** Processing line: ~ s.player.x ||= 0 # sets player values~ + $platformer_physics.inputs = args.inputs +** Processing line: ~ $platformer_physics.state = args.state~ - Inside source: true *** True Line Result - s.player.x ||= 0 # sets player values -** Processing line: ~ s.player.y ||= 100~ + $platformer_physics.state = args.state +** Processing line: ~ $platformer_physics.outputs = args.outputs~ - Inside source: true *** True Line Result - s.player.y ||= 100 -** Processing line: ~ s.player.w ||= 64~ + $platformer_physics.outputs = args.outputs +** Processing line: ~ $platformer_physics.tick~ - Inside source: true *** True Line Result - s.player.w ||= 64 -** Processing line: ~ s.player.h ||= 64~ + $platformer_physics.tick +** Processing line: ~ tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump."~ - Inside source: true *** True Line Result - s.player.h ||= 64 -** Processing line: ~ s.player.dy ||= 0 # change in position~ + tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump." +** Processing line: ~ end~ - Inside source: true *** True Line Result - s.player.dy ||= 0 # change in position -** Processing line: ~ s.player.dx ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - s.player.dx ||= 0 -** Processing line: ~ s.player_jump_power = 15~ + +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - s.player_jump_power = 15 -** Processing line: ~ s.player_jump_power_duration = 10~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - s.player_jump_power_duration = 10 -** Processing line: ~ s.player_max_run_speed = 5~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - s.player_max_run_speed = 5 -** Processing line: ~ s.player_speed_slowdown_rate = 0.9~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - s.player_speed_slowdown_rate = 0.9 -** Processing line: ~ s.player_acceleration = 1~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - s.player_acceleration = 1 -** Processing line: ~ s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too)~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -20797,750 +21220,746 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs objects onto the screen~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # Outputs objects onto the screen -** Processing line: ~ def render~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.solids << s.platforms.map do |p| # outputs platforms onto screen~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - outputs.solids << s.platforms.map do |p| # outputs platforms onto screen -** Processing line: ~ [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center -** Processing line: ~ # don't forget, position of platform is denoted by bottom left hand corner~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # don't forget, position of platform is denoted by bottom left hand corner -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # outputs player using hash~ -- Inside source: true +** Processing line: ~* Physics And Collisions - Box Collision 2 - main.rb~ +- Header detected. *** True Line Result - # outputs player using hash -** Processing line: ~ outputs.solids << {~ -- Inside source: true + *** True Line Result - outputs.solids << { -** Processing line: ~ x: s.player.x + 300, # player positioned on top of platform~ -- Inside source: true +* Physics And Collisions - Box Collision 2 - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - x: s.player.x + 300, # player positioned on top of platform -** Processing line: ~ y: s.player.y - s.camera[:y],~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb~ - Inside source: true *** True Line Result - y: s.player.y - s.camera[:y], -** Processing line: ~ w: s.player.w,~ + # ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - w: s.player.w, -** Processing line: ~ h: s.player.h,~ + =begin +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - h: s.player.h, -** Processing line: ~ r: 100, # color saturation~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - r: 100, # color saturation -** Processing line: ~ g: 100,~ + +** Processing line: ~ - times: Performs an action a specific number of times.~ - Inside source: true *** True Line Result - g: 100, -** Processing line: ~ b: 200~ + - times: Performs an action a specific number of times. +** Processing line: ~ For example, if we said~ - Inside source: true *** True Line Result - b: 200 -** Processing line: ~ }~ + For example, if we said +** Processing line: ~ 5.times puts "Hello DragonRuby",~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + 5.times puts "Hello DragonRuby", +** Processing line: ~ then we'd see the words "Hello DragonRuby" printed on the console 5 times.~ - Inside source: true *** True Line Result - end + then we'd see the words "Hello DragonRuby" printed on the console 5 times. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Performs calculations~ +** Processing line: ~ - split: Divides a string into substrings based on a delimiter.~ - Inside source: true *** True Line Result - # Performs calculations -** Processing line: ~ def calc~ + - split: Divides a string into substrings based on a delimiter. +** Processing line: ~ For example, if we had a command~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ + For example, if we had a command +** Processing line: ~ "DragonRuby is awesome".split(" ")~ - Inside source: true *** True Line Result - s.platforms.each do |p| # for each platform in the collection -** Processing line: ~ p.rect = [p.x, p.y, p.w, p.h] # set the definition~ + "DragonRuby is awesome".split(" ") +** Processing line: ~ then the result would be~ - Inside source: true *** True Line Result - p.rect = [p.x, p.y, p.w, p.h] # set the definition -** Processing line: ~ end~ + then the result would be +** Processing line: ~ ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter.~ - Inside source: true *** True Line Result - end + ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # sets player point by adding half the player's width to the player's x~ +** Processing line: ~ - join: Opposite of split; converts each element of array to a string separated by delimiter.~ - Inside source: true *** True Line Result - # sets player point by adding half the player's width to the player's x -** Processing line: ~ s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens!~ + - join: Opposite of split; converts each element of array to a string separated by delimiter. +** Processing line: ~ For example, if we had a command~ - Inside source: true *** True Line Result - s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! -** Processing line: ~~ + For example, if we had a command +** Processing line: ~ ["DragonRuby","is","awesome"].join(" ")~ - Inside source: true *** True Line Result - -** Processing line: ~ # search the platforms collection to find if the player's point is inside the rect of a platform~ + ["DragonRuby","is","awesome"].join(" ") +** Processing line: ~ then the result would be~ - Inside source: true *** True Line Result - # search the platforms collection to find if the player's point is inside the rect of a platform -** Processing line: ~ collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect }~ + then the result would be +** Processing line: ~ "DragonRuby is awesome".~ - Inside source: true *** True Line Result - collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } + "DragonRuby is awesome". ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if collision occurred and player is moving down (or not moving vertically at all)~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - # if collision occurred and player is moving down (or not moving vertically at all) -** Processing line: ~ if collision && s.player.dy <= 0~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - if collision && s.player.dy <= 0 -** Processing line: ~ s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform~ + +** Processing line: ~ - to_s: Returns a string representation of an object.~ - Inside source: true *** True Line Result - s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform -** Processing line: ~ s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically~ + - to_s: Returns a string representation of an object. +** Processing line: ~ For example, if we had~ - Inside source: true *** True Line Result - s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically -** Processing line: ~ if !s.player.platform~ + For example, if we had +** Processing line: ~ 500.to_s~ - Inside source: true *** True Line Result - if !s.player.platform -** Processing line: ~ s.player.dx = 0 # no horizontal movement~ + 500.to_s +** Processing line: ~ the string "500" would be returned.~ - Inside source: true *** True Line Result - s.player.dx = 0 # no horizontal movement -** Processing line: ~ end~ + the string "500" would be returned. +** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ - Inside source: true *** True Line Result - end -** Processing line: ~ # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x~ + Similar to to_i, which returns an integer representation of an object. +** Processing line: ~~ - Inside source: true *** True Line Result - # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x -** Processing line: ~ s.player.x += collision.dx * collision.speed~ + +** Processing line: ~ - elapsed_time: How many frames have passed since the click event.~ - Inside source: true *** True Line Result - s.player.x += collision.dx * collision.speed -** Processing line: ~ s.player.platform = collision # player is on the platform that it collided with (or landed on)~ + - elapsed_time: How many frames have passed since the click event. +** Processing line: ~~ - Inside source: true *** True Line Result - s.player.platform = collision # player is on the platform that it collided with (or landed on) -** Processing line: ~ if s.player.falling # if player is falling~ + +** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ - Inside source: true *** True Line Result - if s.player.falling # if player is falling -** Processing line: ~ s.player.dx = 0 # no horizontal movement~ + - args.outputs.labels: An array. Values in the array generate labels on the screen. +** Processing line: ~ The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - s.player.dx = 0 # no horizontal movement -** Processing line: ~ end~ + The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end -** Processing line: ~ s.player.falling = false~ + For more information about labels, go to mygame/documentation/02-labels.md. +** Processing line: ~~ - Inside source: true *** True Line Result - s.player.falling = false -** Processing line: ~ s.player.jumped_at = nil~ + +** Processing line: ~ - inputs.mouse.down: Determines whether or not the mouse is being pressed down.~ - Inside source: true *** True Line Result - s.player.jumped_at = nil -** Processing line: ~ else~ + - inputs.mouse.down: Determines whether or not the mouse is being pressed down. +** Processing line: ~ The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y).~ - Inside source: true *** True Line Result - else -** Processing line: ~ s.player.platform = nil # player is not on a platform~ + The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). +** Processing line: ~~ - Inside source: true *** True Line Result - s.player.platform = nil # player is not on a platform -** Processing line: ~ s.player.y += s.player.dy # velocity is the change in position~ + +** Processing line: ~ - first: Returns the first element of the array.~ - Inside source: true *** True Line Result - s.player.y += s.player.dy # velocity is the change in position -** Processing line: ~ s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down~ + - first: Returns the first element of the array. +** Processing line: ~~ - Inside source: true *** True Line Result - s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down -** Processing line: ~ end~ + +** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ - Inside source: true *** True Line Result - end + - num1.idiv(num2): Divides two numbers and returns an integer. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ -- Inside source: true -*** True Line Result - s.platforms.each do |p| # for each platform in the collection -** Processing line: ~ p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally)~ +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ - Inside source: true *** True Line Result - p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) -** Processing line: ~ # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels)~ + - find_all: Finds all values that satisfy specific requirements. +** Processing line: ~~ - Inside source: true *** True Line Result - # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) -** Processing line: ~ if p.x < -300 # if platform goes too far left~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ - Inside source: true *** True Line Result - if p.x < -300 # if platform goes too far left -** Processing line: ~ p.dx *= -1 # dx is scaled down~ + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - p.dx *= -1 # dx is scaled down -** Processing line: ~ p.x = -300 # as far left as possible within scope~ + +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ - Inside source: true *** True Line Result - p.x = -300 # as far left as possible within scope -** Processing line: ~ elsif p.x > (1000 - p.w) # if platform's x is greater than 300~ + - reject: Removes elements from a collection if they meet certain requirements. +** Processing line: ~~ - Inside source: true *** True Line Result - elsif p.x > (1000 - p.w) # if platform's x is greater than 300 -** Processing line: ~ p.dx *= -1~ + +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - p.dx *= -1 -** Processing line: ~ p.x = (1000 - p.w) # set to 300 (as far right as possible within scope)~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) -** Processing line: ~ end~ + as Ruby code, and the placeholder is replaced with its corresponding value or result. +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - end + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ delta = (s.player.y - s.camera[:y] - 100) # used to position camera view~ +** Processing line: ~ MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map~ - Inside source: true *** True Line Result - delta = (s.player.y - s.camera[:y] - 100) # used to position camera view + MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if delta > -200~ -- Inside source: true -*** True Line Result - if delta > -200 -** Processing line: ~ s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards~ +** Processing line: ~ class MetroidvaniaStarter~ - Inside source: true *** True Line Result - s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards -** Processing line: ~ s.player.x += s.player.dx # velocity is change in position; change in x increases by dx~ + class MetroidvaniaStarter +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs, :gtk~ - Inside source: true *** True Line Result - s.player.x += s.player.dx # velocity is change in position; change in x increases by dx + attr_accessor :grid, :inputs, :state, :outputs, :gtk ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # searches platform collection to find platforms located more than 300 pixels above the player~ -- Inside source: true -*** True Line Result - # searches platform collection to find platforms located more than 300 pixels above the player -** Processing line: ~ has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) }~ +** Processing line: ~ # Calls methods needed to run the game properly.~ - Inside source: true *** True Line Result - has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } -** Processing line: ~ if !has_platforms # if there are no platforms 300 pixels above the player~ + # Calls methods needed to run the game properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - if !has_platforms # if there are no platforms 300 pixels above the player -** Processing line: ~ width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous -** Processing line: ~ s.player.platforms_cleared += 1 # player successfully cleared another platform~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - s.player.platforms_cleared += 1 # player successfully cleared another platform -** Processing line: ~ last_platform = s.platforms[-1] # platform just cleared becomes last platform~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - last_platform = s.platforms[-1] # platform just cleared becomes last platform -** Processing line: ~ # another platform is created 300 pixels above the last platform, and this~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - # another platform is created 300 pixels above the last platform, and this -** Processing line: ~ # new platform has a smaller width and moves faster than all previous platforms~ + process_inputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - # new platform has a smaller width and moves faster than all previous platforms -** Processing line: ~ s.platforms << new_platform(x: (700 - width) * rand, # random x position~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - s.platforms << new_platform(x: (700 - width) * rand, # random x position -** Processing line: ~ y: last_platform.y + 300,~ + +** Processing line: ~ # Sets all the default variables.~ - Inside source: true *** True Line Result - y: last_platform.y + 300, -** Processing line: ~ w: width,~ + # Sets all the default variables. +** Processing line: ~ # '||' states that initialization occurs only in the first frame.~ - Inside source: true *** True Line Result - w: width, -** Processing line: ~ h: 32,~ + # '||' states that initialization occurs only in the first frame. +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - h: 32, -** Processing line: ~ dx: 1.randomize(:sign), # random change in x~ + def defaults +** Processing line: ~ state.tile_size = 64~ - Inside source: true *** True Line Result - dx: 1.randomize(:sign), # random change in x -** Processing line: ~ speed: 2 * s.player.platforms_cleared,~ + state.tile_size = 64 +** Processing line: ~ state.gravity = -0.2~ - Inside source: true *** True Line Result - speed: 2 * s.player.platforms_cleared, -** Processing line: ~ rect: nil)~ + state.gravity = -0.2 +** Processing line: ~ state.player_width = 60~ - Inside source: true *** True Line Result - rect: nil) -** Processing line: ~ end~ + state.player_width = 60 +** Processing line: ~ state.player_height = 64~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + state.player_height = 64 +** Processing line: ~ state.collision_tolerance = 0.0~ - Inside source: true *** True Line Result - else -** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ + state.collision_tolerance = 0.0 +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ - Inside source: true *** True Line Result - s.as_hash.clear # otherwise clear the hash (no new platform is necessary) -** Processing line: ~ end~ + state.previous_tile_size ||= state.tile_size +** Processing line: ~ state.x ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.x ||= 0 +** Processing line: ~ state.y ||= 800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.y ||= 800 +** Processing line: ~ state.dy ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # Takes input from the user to move the player~ + state.dy ||= 0 +** Processing line: ~ state.dx ||= 0~ - Inside source: true *** True Line Result - # Takes input from the user to move the player -** Processing line: ~ def input~ + state.dx ||= 0 +** Processing line: ~ attempt_load_world_from_file~ - Inside source: true *** True Line Result - def input -** Processing line: ~ if inputs.keyboard.space # if the space bar is pressed~ + attempt_load_world_from_file +** Processing line: ~ state.world_lookup ||= { }~ - Inside source: true *** True Line Result - if inputs.keyboard.space # if the space bar is pressed -** Processing line: ~ s.player.jumped_at ||= s.tick_count # set to current frame~ + state.world_lookup ||= { } +** Processing line: ~ state.world_collision_rects ||= []~ - Inside source: true *** True Line Result - s.player.jumped_at ||= s.tick_count # set to current frame -** Processing line: ~~ + state.world_collision_rects ||= [] +** Processing line: ~ state.mode ||= :creating # alternates between :creating and :selecting for sprite selection~ - Inside source: true *** True Line Result - -** Processing line: ~ # if the time that has passed since the jump is less than the duration of a jump (10 frames)~ + state.mode ||= :creating # alternates between :creating and :selecting for sprite selection +** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ - Inside source: true *** True Line Result - # if the time that has passed since the jump is less than the duration of a jump (10 frames) -** Processing line: ~ # and the player is not falling~ + state.select_menu ||= [0, 720, 1280, 720] +** Processing line: ~ #=======================================IMPORTANT=======================================#~ - Inside source: true *** True Line Result - # and the player is not falling -** Processing line: ~ if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling~ + #=======================================IMPORTANT=======================================# +** Processing line: ~ # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc.~ - Inside source: true *** True Line Result - if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling -** Processing line: ~ s.player.dy = s.player_jump_power # player jumps up~ + # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. +** Processing line: ~ # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have.~ - Inside source: true *** True Line Result - s.player.dy = s.player_jump_power # player jumps up -** Processing line: ~ end~ + # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. +** Processing line: ~ #=======================================================================================#~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + #=======================================================================================# +** Processing line: ~ state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES +** Processing line: ~ state.sprite_coords ||= []~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.key_up.space # if space bar is in "up" state~ + state.sprite_coords ||= [] +** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ - Inside source: true *** True Line Result - if inputs.keyboard.key_up.space # if space bar is in "up" state -** Processing line: ~ s.player.falling = true # player is falling~ + state.banner_coords ||= [640, 680 + 720] +** Processing line: ~ state.sprite_selected ||= 1~ - Inside source: true *** True Line Result - s.player.falling = true # player is falling -** Processing line: ~ end~ + state.sprite_selected ||= 1 +** Processing line: ~ state.map_saved_at ||= 0~ - Inside source: true *** True Line Result - end + state.map_saved_at ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.keyboard.left # if left key is pressed~ -- Inside source: true -*** True Line Result - if inputs.keyboard.left # if left key is pressed -** Processing line: ~ s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration~ +** Processing line: ~ # Sets all the cordinate values for the sprite selection screen into a grid~ - Inside source: true *** True Line Result - s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration -** Processing line: ~ s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater~ + # Sets all the cordinate values for the sprite selection screen into a grid +** Processing line: ~ # Displayed when 's' is pressed by player to access sprites~ - Inside source: true *** True Line Result - s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater -** Processing line: ~ elsif inputs.keyboard.right # if right key is pressed~ + # Displayed when 's' is pressed by player to access sprites +** Processing line: ~ if state.sprite_coords == [] # if sprite_coords is an empty array~ - Inside source: true *** True Line Result - elsif inputs.keyboard.right # if right key is pressed -** Processing line: ~ s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration~ + if state.sprite_coords == [] # if sprite_coords is an empty array +** Processing line: ~ count = 1~ - Inside source: true *** True Line Result - s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration -** Processing line: ~ s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser~ + count = 1 +** Processing line: ~ temp_x = 165 # sets a starting x and y position for display~ - Inside source: true *** True Line Result - s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser -** Processing line: ~ else~ + temp_x = 165 # sets a starting x and y position for display +** Processing line: ~ temp_y = 500 + 720~ - Inside source: true *** True Line Result - else -** Processing line: ~ s.player.dx *= s.player_speed_slowdown_rate # scales dx down~ + temp_y = 500 + 720 +** Processing line: ~ state.sprite_quantity.times do # for the number of sprites you have~ - Inside source: true *** True Line Result - s.player.dx *= s.player_speed_slowdown_rate # scales dx down -** Processing line: ~ end~ + state.sprite_quantity.times do # for the number of sprites you have +** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array +** Processing line: ~ temp_x += 100 # increment temp_x~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + temp_x += 100 # increment temp_x +** Processing line: ~ count += 1 # increment count~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + count += 1 # increment count +** Processing line: ~ if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen~ - Inside source: true *** True Line Result - -** Processing line: ~ $game = VerticalPlatformer.new~ + if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen +** Processing line: ~ temp_x = 165 # a new row of sprites starts~ - Inside source: true *** True Line Result - $game = VerticalPlatformer.new -** Processing line: ~~ + temp_x = 165 # a new row of sprites starts +** Processing line: ~ temp_y -= 75 # new row of sprites starts 75 units lower than the previous row~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + temp_y -= 75 # new row of sprites starts 75 units lower than the previous row +** Processing line: ~ end~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $game.args = args~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ # Places sprites~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + # Places sprites +** Processing line: ~ def render~ +- Inside source: true *** True Line Result - -** Processing line: ~* 05_mouse/03_mouse_click/app/main.rb~ -- Header detected. + def render +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ # Sets the x, y, width, height, and image path for each sprite in the world collection.~ +- Inside source: true *** True Line Result -* 05_mouse/03_mouse_click/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + # Sets the x, y, width, height, and image path for each sprite in the world collection. +** Processing line: ~ outputs.sprites << state.world.map do |x, y, sprite|~ +- Inside source: true *** True Line Result - + outputs.sprites << state.world.map do |x, y, sprite| +** Processing line: ~ [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location +** Processing line: ~ y * state.tile_size,~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + y * state.tile_size, +** Processing line: ~ state.tile_size,~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + state.tile_size, +** Processing line: ~ state.tile_size,~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: -** Processing line: ~~ + state.tile_size, +** Processing line: ~ 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path~ - Inside source: true *** True Line Result - -** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ + 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path +** Processing line: ~ end~ - Inside source: true *** True Line Result - - product: Returns an array of all combinations of elements from all arrays. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For example, [1,2].product([1,2]) would return the following array...~ +** Processing line: ~ # Outputs sprite for the player by setting x, y, width, height, and image path~ - Inside source: true *** True Line Result - For example, [1,2].product([1,2]) would return the following array... -** Processing line: ~ [[1,1], [1,2], [2,1], [2,2]]~ + # Outputs sprite for the player by setting x, y, width, height, and image path +** Processing line: ~ outputs.sprites << [state.x,~ - Inside source: true *** True Line Result - [[1,1], [1,2], [2,1], [2,2]] -** Processing line: ~ More than two arrays can be given to product and it will still work,~ + outputs.sprites << [state.x, +** Processing line: ~ state.y,~ - Inside source: true *** True Line Result - More than two arrays can be given to product and it will still work, -** Processing line: ~ such as [1,2].product([1,2],[3,4]). What would product return in this case?~ + state.y, +** Processing line: ~ state.player_width,~ - Inside source: true *** True Line Result - such as [1,2].product([1,2],[3,4]). What would product return in this case? + state.player_width, +** Processing line: ~ state.player_height,'sprites/player.png']~ +- Inside source: true +*** True Line Result + state.player_height,'sprites/player.png'] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Answer:~ +** Processing line: ~ # Outputs labels as primitives in top right of the screen~ - Inside source: true *** True Line Result - Answer: -** Processing line: ~ [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]]~ + # Outputs labels as primitives in top right of the screen +** Processing line: ~ outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label~ - Inside source: true *** True Line Result - [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] + outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label +** Processing line: ~ outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label~ +- Inside source: true +*** True Line Result + outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers.~ +** Processing line: ~ outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label~ - Inside source: true *** True Line Result - - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. -** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ + outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label +** Processing line: ~ outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label~ - Inside source: true *** True Line Result - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - yield: Allows you to call a method with a code block and yield to that block.~ +** Processing line: ~ outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label~ - Inside source: true *** True Line Result - - yield: Allows you to call a method with a code block and yield to that block. + outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ # if the map is saved and less than 120 frames have passed, the label is displayed~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + # if the map is saved and less than 120 frames have passed, the label is displayed +** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ - Inside source: true *** True Line Result - -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 +** Processing line: ~ outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label~ - Inside source: true *** True Line Result - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ # If player hits 's', following appears~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + # If player hits 's', following appears +** Processing line: ~ if state.mode == :selecting~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. -** Processing line: ~~ + if state.mode == :selecting +** Processing line: ~ # White background for sprite selection~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ + # White background for sprite selection +** Processing line: ~ outputs.primitives << [state.select_menu, 255, 255, 255].solid~ - Inside source: true *** True Line Result - - args.inputs.mouse.click: This property will be set if the mouse was clicked. + outputs.primitives << [state.select_menu, 255, 255, 255].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Ternary operator (?): Will evaluate a statement (just like an if statement)~ +** Processing line: ~ # Select tile label at the top of the screen~ - Inside source: true *** True Line Result - - Ternary operator (?): Will evaluate a statement (just like an if statement) -** Processing line: ~ and perform an action if the result is true or another action if it is false.~ + # Select tile label at the top of the screen +** Processing line: ~ outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label~ - Inside source: true *** True Line Result - and perform an action if the result is true or another action if it is false. + outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~ # Places sprites in locations calculated in the defaults function~ - Inside source: true *** True Line Result - - reject: Removes elements from a collection if they meet certain requirements. -** Processing line: ~~ + # Places sprites in locations calculated in the defaults function +** Processing line: ~ outputs.primitives << state.sprite_coords.map do |x, y, order|~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ + outputs.primitives << state.sprite_coords.map do |x, y, order| +** Processing line: ~ [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite~ - Inside source: true *** True Line Result - - args.outputs.borders: An array. The values generate a border. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ + [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # Creates sprite following mouse to help indicate which sprite you have selected +** Processing line: ~ # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ + # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y,~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels. -** Processing line: ~~ + outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, +** Processing line: ~ 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - =end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app is a classic game of Tic Tac Toe.~ -- Inside source: true -*** True Line Result - # This sample app is a classic game of Tic Tac Toe. -** Processing line: ~~ +** Processing line: ~ # Calls methods that perform calculations~ - Inside source: true *** True Line Result - -** Processing line: ~ class TicTacToe~ + # Calls methods that perform calculations +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - class TicTacToe -** Processing line: ~ attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk~ + def calc +** Processing line: ~ calc_in_game~ - Inside source: true *** True Line Result - attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk -** Processing line: ~~ + calc_in_game +** Processing line: ~ calc_sprite_selection~ - Inside source: true *** True Line Result - -** Processing line: ~ # Starts the game with player x's turn and creates an array (to_a) for space combinations.~ + calc_sprite_selection +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Starts the game with player x's turn and creates an array (to_a) for space combinations. -** Processing line: ~ # Calls methods necessary for the game to run properly.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Calls methods necessary for the game to run properly. -** Processing line: ~ def tick~ + +** Processing line: ~ # Calls methods that perform calculations (if in creating mode)~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ state.current_turn ||= :x~ + # Calls methods that perform calculations (if in creating mode) +** Processing line: ~ def calc_in_game~ - Inside source: true *** True Line Result - state.current_turn ||= :x -** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ + def calc_in_game +** Processing line: ~ return unless state.mode == :creating~ - Inside source: true *** True Line Result - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a -** Processing line: ~ render_board~ + return unless state.mode == :creating +** Processing line: ~ calc_world_lookup~ - Inside source: true *** True Line Result - render_board -** Processing line: ~ input_board~ + calc_world_lookup +** Processing line: ~ calc_player~ - Inside source: true *** True Line Result - input_board + calc_player ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -21549,170 +21968,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ +** Processing line: ~ def calc_world_lookup~ - Inside source: true *** True Line Result - # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. -** Processing line: ~ def render_board~ + def calc_world_lookup +** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ - Inside source: true *** True Line Result - def render_board -** Processing line: ~ square_size = 80~ + # If the tile size isn't equal to the previous tile size, +** Processing line: ~ # the previous tile size is set to the tile size,~ - Inside source: true *** True Line Result - square_size = 80 -** Processing line: ~~ + # the previous tile size is set to the tile size, +** Processing line: ~ # and world_lookup hash is set to empty.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Positions the game's board in the center of the screen.~ + # and world_lookup hash is set to empty. +** Processing line: ~ if state.tile_size != state.previous_tile_size~ - Inside source: true *** True Line Result - # Positions the game's board in the center of the screen. -** Processing line: ~ # Try removing what follows grid.w_half or grid.h_half and see how the position changes!~ + if state.tile_size != state.previous_tile_size +** Processing line: ~ state.previous_tile_size = state.tile_size~ - Inside source: true *** True Line Result - # Try removing what follows grid.w_half or grid.h_half and see how the position changes! -** Processing line: ~ board_left = grid.w_half - square_size * 1.5~ + state.previous_tile_size = state.tile_size +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - board_left = grid.w_half - square_size * 1.5 -** Processing line: ~ board_top = grid.h_half - square_size * 1.5~ + state.world_lookup = {} +** Processing line: ~ end~ - Inside source: true *** True Line Result - board_top = grid.h_half - square_size * 1.5 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # At first glance, the add(1) looks pretty trivial. But if you remove it,~ +** Processing line: ~ # return if world_lookup is not empty or if world is empty~ - Inside source: true *** True Line Result - # At first glance, the add(1) looks pretty trivial. But if you remove it, -** Processing line: ~ # you'll see that the positioning of the board would be skewed without it!~ + # return if world_lookup is not empty or if world is empty +** Processing line: ~ return if state.world_lookup.keys.length > 0~ - Inside source: true *** True Line Result - # you'll see that the positioning of the board would be skewed without it! -** Processing line: ~ # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares~ + return if state.world_lookup.keys.length > 0 +** Processing line: ~ return unless state.world.length > 0~ - Inside source: true *** True Line Result - # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares -** Processing line: ~ # due to the change in board placement.~ + return unless state.world.length > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - # due to the change in board placement. -** Processing line: ~ outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces~ + +** Processing line: ~ # Searches through the world and finds the coordinates that exist~ - Inside source: true *** True Line Result - outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces -** Processing line: ~ space.border ||= [~ + # Searches through the world and finds the coordinates that exist +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - space.border ||= [ -** Processing line: ~ board_left + x.add(1) * square_size, # space.border is initialized using this definition~ + state.world_lookup = {} +** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ - Inside source: true *** True Line Result - board_left + x.add(1) * square_size, # space.border is initialized using this definition -** Processing line: ~ board_top + y.add(1) * square_size,~ + state.world.each { |x, y| state.world_lookup[[x, y]] = true } +** Processing line: ~~ - Inside source: true *** True Line Result - board_top + y.add(1) * square_size, -** Processing line: ~ square_size,~ + +** Processing line: ~ # Assigns collision rects for every sprite drawn~ - Inside source: true *** True Line Result - square_size, -** Processing line: ~ square_size~ + # Assigns collision rects for every sprite drawn +** Processing line: ~ state.world_collision_rects =~ - Inside source: true *** True Line Result - square_size -** Processing line: ~ ]~ + state.world_collision_rects = +** Processing line: ~ state.world_lookup~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + state.world_lookup +** Processing line: ~ .keys~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .keys +** Processing line: ~ .map do |coord_x, coord_y|~ - Inside source: true *** True Line Result - -** Processing line: ~ # Again, the calculations ensure that the piece is placed in the center of the grid square.~ + .map do |coord_x, coord_y| +** Processing line: ~ s = state.tile_size~ - Inside source: true *** True Line Result - # Again, the calculations ensure that the piece is placed in the center of the grid square. -** Processing line: ~ # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center.~ + s = state.tile_size +** Processing line: ~ # Multiplying by s (the size of a tile) ensures that the rect is~ - Inside source: true *** True Line Result - # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. -** Processing line: ~ outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board~ + # Multiplying by s (the size of a tile) ensures that the rect is +** Processing line: ~ # placed exactly where you want it to be placed (causes grid to coordinate)~ - Inside source: true *** True Line Result - outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board -** Processing line: ~ label board_left + x.add(1) * square_size + square_size.fdiv(2),~ + # placed exactly where you want it to be placed (causes grid to coordinate) +** Processing line: ~ # How many pixels horizontally across and vertically up and down~ - Inside source: true *** True Line Result - label board_left + x.add(1) * square_size + square_size.fdiv(2), -** Processing line: ~ board_top + y.add(1) * square_size + square_size - 20,~ + # How many pixels horizontally across and vertically up and down +** Processing line: ~ x = s * coord_x~ - Inside source: true *** True Line Result - board_top + y.add(1) * square_size + square_size - 20, -** Processing line: ~ space.piece # text of label, either "x" or "o"~ + x = s * coord_x +** Processing line: ~ y = s * coord_y~ - Inside source: true *** True Line Result - space.piece # text of label, either "x" or "o" -** Processing line: ~ end~ + y = s * coord_y +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ args: [coord_x, coord_y],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Uses a label to output whether x or o won, or if a draw occurred.~ + args: [coord_x, coord_y], +** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ - Inside source: true *** True Line Result - # Uses a label to output whether x or o won, or if a draw occurred. -** Processing line: ~ # If the game is ongoing, a label shows whose turn it currently is.~ + left_right: [x, y + 4, s, s - 6], # hash keys and values +** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ - Inside source: true *** True Line Result - # If the game is ongoing, a label shows whose turn it currently is. -** Processing line: ~ outputs.labels << if state.x_won~ + top: [x + 4, y + 6, s - 8, s - 6], +** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ - Inside source: true *** True Line Result - outputs.labels << if state.x_won -** Processing line: ~ label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top~ + bottom: [x + 1, y - 1, s - 2, s - 8], +** Processing line: ~ }~ - Inside source: true *** True Line Result - label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top -** Processing line: ~ elsif state.o_won~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif state.o_won -** Processing line: ~ label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally -** Processing line: ~ elsif state.draw~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif state.draw -** Processing line: ~ label grid.w_half, grid.top - 80, "a draw"~ + +** Processing line: ~ # Calculates movement of player and calls methods that perform collision calculations~ - Inside source: true *** True Line Result - label grid.w_half, grid.top - 80, "a draw" -** Processing line: ~ else # if no one won and the game is ongoing~ + # Calculates movement of player and calls methods that perform collision calculations +** Processing line: ~ def calc_player~ - Inside source: true *** True Line Result - else # if no one won and the game is ongoing -** Processing line: ~ label grid.w_half, grid.top - 80, "turn: #{state.current_turn}"~ + def calc_player +** Processing line: ~ state.dy += state.gravity # what goes up must come down because of gravity~ - Inside source: true *** True Line Result - label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" -** Processing line: ~ end~ + state.dy += state.gravity # what goes up must come down because of gravity +** Processing line: ~ calc_box_collision~ - Inside source: true *** True Line Result - end + calc_box_collision +** Processing line: ~ calc_edge_collision~ +- Inside source: true +*** True Line Result + calc_edge_collision +** Processing line: ~ state.y += state.dy # Since velocity is the change in position, the change in y increases by dy~ +- Inside source: true +*** True Line Result + state.y += state.dy # Since velocity is the change in position, the change in y increases by dy +** Processing line: ~ state.x += state.dx # Ditto line above but dx and x~ +- Inside source: true +*** True Line Result + state.x += state.dx # Ditto line above but dx and x +** Processing line: ~ state.dx *= 0.8 # Scales dx down~ +- Inside source: true +*** True Line Result + state.dx *= 0.8 # Scales dx down ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -21721,34 +22156,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Calls the methods responsible for handling user input and determining the winner.~ +** Processing line: ~ # Calls methods that determine whether the player collides with any world_collision_rects.~ - Inside source: true *** True Line Result - # Calls the methods responsible for handling user input and determining the winner. -** Processing line: ~ # Does nothing unless the mouse is clicked.~ + # Calls methods that determine whether the player collides with any world_collision_rects. +** Processing line: ~ def calc_box_collision~ - Inside source: true *** True Line Result - # Does nothing unless the mouse is clicked. -** Processing line: ~ def input_board~ + def calc_box_collision +** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ - Inside source: true *** True Line Result - def input_board -** Processing line: ~ return unless inputs.mouse.click~ + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key +** Processing line: ~ collision_floor~ - Inside source: true *** True Line Result - return unless inputs.mouse.click -** Processing line: ~ input_place_piece~ + collision_floor +** Processing line: ~ collision_left~ - Inside source: true *** True Line Result - input_place_piece -** Processing line: ~ input_restart_game~ + collision_left +** Processing line: ~ collision_right~ - Inside source: true *** True Line Result - input_restart_game -** Processing line: ~ determine_winner~ + collision_right +** Processing line: ~ collision_ceiling~ - Inside source: true *** True Line Result - determine_winner + collision_ceiling ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -21757,354 +22192,338 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Handles user input for placing pieces on the board.~ +** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ - Inside source: true *** True Line Result - # Handles user input for placing pieces on the board. -** Processing line: ~ def input_place_piece~ + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. +** Processing line: ~ def collision_floor~ - Inside source: true *** True Line Result - def input_place_piece -** Processing line: ~ return if state.game_over~ + def collision_floor +** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ - Inside source: true *** True Line Result - return if state.game_over + return unless state.dy <= 0 # return unless player is going down or is as far down as possible +** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player~ +- Inside source: true +*** True Line Result + player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already~ +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between player's~ - Inside source: true *** True Line Result - # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already -** Processing line: ~ # have a piece in it.~ + # Runs through all the sprites on the field and finds all intersections between player's +** Processing line: ~ # bottom and the top of a rect.~ - Inside source: true *** True Line Result - # have a piece in it. -** Processing line: ~ __, __, space = all_spaces.find do |__, __, space|~ + # bottom and the top of a rect. +** Processing line: ~ floor_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - __, __, space = all_spaces.find do |__, __, space| -** Processing line: ~ inputs.mouse.click.point.inside_rect?(space.border) && !space.piece~ + floor_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - inputs.mouse.click.point.inside_rect?(space.border) && !space.piece -** Processing line: ~ end~ + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The piece that goes into the space belongs to the player whose turn it currently is.~ +** Processing line: ~ return unless floor_collisions # performs following changes if a collision has occurred~ - Inside source: true *** True Line Result - # The piece that goes into the space belongs to the player whose turn it currently is. -** Processing line: ~ return unless space~ + return unless floor_collisions # performs following changes if a collision has occurred +** Processing line: ~ state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top~ - Inside source: true *** True Line Result - return unless space -** Processing line: ~ space.piece = state.current_turn~ + state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top +** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ - Inside source: true *** True Line Result - space.piece = state.current_turn + state.dy = 0 # no change in y because the player's path is blocked +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This ternary operator statement allows us to change the current player's turn.~ +** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ - Inside source: true *** True Line Result - # This ternary operator statement allows us to change the current player's turn. -** Processing line: ~ # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn.~ + # Finds collisions between the player's left side and the right side of a world_collision_rect. +** Processing line: ~ def collision_left~ - Inside source: true *** True Line Result - # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. -** Processing line: ~ state.current_turn = state.current_turn == :x ? :o : :x~ + def collision_left +** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ - Inside source: true *** True Line Result - state.current_turn = state.current_turn == :x ? :o : :x -** Processing line: ~ end~ + return unless state.dx < 0 # return unless player is moving left +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - end + player_rect = [next_x, state.y, state.tile_size, state.tile_size] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Resets the game.~ +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's left side~ - Inside source: true *** True Line Result - # Resets the game. -** Processing line: ~ def input_restart_game~ + # Runs through all the sprites on the field and finds all intersections between the player's left side +** Processing line: ~ # and the right side of a rect.~ - Inside source: true *** True Line Result - def input_restart_game -** Processing line: ~ return unless state.game_over~ + # and the right side of a rect. +** Processing line: ~ left_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - return unless state.game_over -** Processing line: ~ gtk.reset~ + left_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - gtk.reset -** Processing line: ~ end~ + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks if x or o won the game.~ +** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - # Checks if x or o won the game. -** Processing line: ~ # If neither player wins and all nine squares are filled, a draw happens.~ + return unless left_side_collisions # return unless collision occurred +** Processing line: ~ state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side~ - Inside source: true *** True Line Result - # If neither player wins and all nine squares are filled, a draw happens. -** Processing line: ~ # Once a player is chosen as the winner or a draw happens, the game is over.~ + state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side +** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ - Inside source: true *** True Line Result - # Once a player is chosen as the winner or a draw happens, the game is over. -** Processing line: ~ def determine_winner~ + state.dx = 0 # no change in x because the player's path is blocked +** Processing line: ~ end~ - Inside source: true *** True Line Result - def determine_winner -** Processing line: ~ state.x_won = won? :x # evaluates to either true or false (boolean values)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.x_won = won? :x # evaluates to either true or false (boolean values) -** Processing line: ~ state.o_won = won? :o~ + +** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ - Inside source: true *** True Line Result - state.o_won = won? :o -** Processing line: ~ state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won~ + # Finds collisions between the right side of the player and the left side of a world_collision_rect. +** Processing line: ~ def collision_right~ - Inside source: true *** True Line Result - state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won -** Processing line: ~ state.game_over = state.x_won || state.o_won || state.draw~ + def collision_right +** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ - Inside source: true *** True Line Result - state.game_over = state.x_won || state.o_won || state.draw -** Processing line: ~ end~ + return unless state.dx > 0 # return unless player is moving right +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - end + player_rect = [next_x, state.y, state.tile_size, state.tile_size] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Determines if a player won by checking if there is a horizontal match or vertical match.~ +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's~ - Inside source: true *** True Line Result - # Determines if a player won by checking if there is a horizontal match or vertical match. -** Processing line: ~ # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won.~ + # Runs through all the sprites on the field and finds all intersections between the player's +** Processing line: ~ # right side and the left side of a rect.~ - Inside source: true *** True Line Result - # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. -** Processing line: ~ def won? piece~ + # right side and the left side of a rect. +** Processing line: ~ right_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - def won? piece -** Processing line: ~ # performs action on all space combinations~ + right_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - # performs action on all space combinations -** Processing line: ~ won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y|~ + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks if the 3 grid spaces with the same y value (or same row) and~ -- Inside source: true -*** True Line Result - # Checks if the 3 grid spaces with the same y value (or same row) and -** Processing line: ~ # x values that are next to each other have pieces that belong to the same player.~ -- Inside source: true -*** True Line Result - # x values that are next to each other have pieces that belong to the same player. -** Processing line: ~ # Remember, the value of piece is equal to the current turn (which is the player).~ +** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - # Remember, the value of piece is equal to the current turn (which is the player). -** Processing line: ~ horizontal_match = state.spaces[xs[0]][y].piece == piece &&~ + return unless right_side_collisions # return unless collision occurred +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner)~ - Inside source: true *** True Line Result - horizontal_match = state.spaces[xs[0]][y].piece == piece && -** Processing line: ~ state.spaces[xs[1]][y].piece == piece &&~ + state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) +** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ - Inside source: true *** True Line Result - state.spaces[xs[1]][y].piece == piece && -** Processing line: ~ state.spaces[xs[2]][y].piece == piece~ + state.dx = 0 # no change in x because the player's path is blocked +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.spaces[xs[2]][y].piece == piece + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks if the 3 grid spaces with the same x value (or same column) and~ +** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ - Inside source: true *** True Line Result - # Checks if the 3 grid spaces with the same x value (or same column) and -** Processing line: ~ # y values that are next to each other have pieces that belong to the same player.~ + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. +** Processing line: ~ def collision_ceiling~ - Inside source: true *** True Line Result - # y values that are next to each other have pieces that belong to the same player. -** Processing line: ~ # The && represents an "and" statement: if even one part of the statement is false,~ + def collision_ceiling +** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ - Inside source: true *** True Line Result - # The && represents an "and" statement: if even one part of the statement is false, -** Processing line: ~ # the entire statement evaluates to false.~ + return unless state.dy > 0 # return unless player is moving up +** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ - Inside source: true *** True Line Result - # the entire statement evaluates to false. -** Processing line: ~ vertical_match = state.spaces[y][xs[0]].piece == piece &&~ + player_rect = [state.x, next_y, state.player_width, state.player_height] +** Processing line: ~~ - Inside source: true *** True Line Result - vertical_match = state.spaces[y][xs[0]].piece == piece && -** Processing line: ~ state.spaces[y][xs[1]].piece == piece &&~ + +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's top~ - Inside source: true *** True Line Result - state.spaces[y][xs[1]].piece == piece && -** Processing line: ~ state.spaces[y][xs[2]].piece == piece~ + # Runs through all the sprites on the field and finds all intersections between the player's top +** Processing line: ~ # and the bottom of a rect.~ - Inside source: true *** True Line Result - state.spaces[y][xs[2]].piece == piece -** Processing line: ~~ + # and the bottom of a rect. +** Processing line: ~ ceil_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - -** Processing line: ~ horizontal_match || vertical_match # if either is true, true is returned~ + ceil_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - horizontal_match || vertical_match # if either is true, true is returned -** Processing line: ~ end~ + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sees if there is a diagonal match, starting from the bottom left and ending at the top right.~ +** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ - Inside source: true *** True Line Result - # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. -** Processing line: ~ # Is added to won regardless of whether the statement is true or false.~ + return unless ceil_collisions # return unless collision occurred +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size)~ - Inside source: true *** True Line Result - # Is added to won regardless of whether the statement is true or false. -** Processing line: ~ won << (state.spaces[-1][-1].piece == piece && # bottom left~ + state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) +** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ - Inside source: true *** True Line Result - won << (state.spaces[-1][-1].piece == piece && # bottom left -** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ -- Inside source: true -*** True Line Result - state.spaces[ 0][ 0].piece == piece && # center -** Processing line: ~ state.spaces[ 1][ 1].piece == piece) # top right~ + state.dy = 0 # no change in y because the player's path is blocked +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.spaces[ 1][ 1].piece == piece) # top right + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sees if there is a diagonal match, starting at the bottom right and ending at the top left~ -- Inside source: true -*** True Line Result - # Sees if there is a diagonal match, starting at the bottom right and ending at the top left -** Processing line: ~ # and is added to won.~ -- Inside source: true -*** True Line Result - # and is added to won. -** Processing line: ~ won << (state.spaces[ 1][-1].piece == piece && # bottom right~ -- Inside source: true -*** True Line Result - won << (state.spaces[ 1][-1].piece == piece && # bottom right -** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ +** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ - Inside source: true *** True Line Result - state.spaces[ 0][ 0].piece == piece && # center -** Processing line: ~ state.spaces[-1][ 1].piece == piece) # top left~ + # Makes sure the player remains within the screen's dimensions. +** Processing line: ~ def calc_edge_collision~ - Inside source: true *** True Line Result - state.spaces[-1][ 1].piece == piece) # top left -** Processing line: ~~ + def calc_edge_collision +** Processing line: ~ # Ensures that player doesn't fall below the map~ - Inside source: true *** True Line Result - -** Processing line: ~ # Any false statements (meaning false diagonal matches) are rejected from won~ + # Ensures that player doesn't fall below the map +** Processing line: ~ if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope~ - Inside source: true *** True Line Result - # Any false statements (meaning false diagonal matches) are rejected from won -** Processing line: ~ won.reject_false.any?~ + if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope +** Processing line: ~ state.y = 0 # 0 is the lowest the player can be while staying on the screen~ - Inside source: true *** True Line Result - won.reject_false.any? -** Processing line: ~ end~ + state.y = 0 # 0 is the lowest the player can be while staying on the screen +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.dy = 0 +** Processing line: ~ # Ensures player doesn't go insanely high~ - Inside source: true *** True Line Result - -** Processing line: ~ # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them.~ + # Ensures player doesn't go insanely high +** Processing line: ~ elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope~ - Inside source: true *** True Line Result - # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. -** Processing line: ~ # The ! before a statement means "not". For example, we are rejecting any space combinations that do~ + elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope +** Processing line: ~ state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen~ - Inside source: true *** True Line Result - # The ! before a statement means "not". For example, we are rejecting any space combinations that do -** Processing line: ~ # NOT have pieces in them.~ + state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - # NOT have pieces in them. -** Processing line: ~ def filled_spaces~ + state.dy = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - def filled_spaces -** Processing line: ~ state.space_combinations~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.space_combinations -** Processing line: ~ .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them~ + +** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ - Inside source: true *** True Line Result - .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them -** Processing line: ~ .map do |x, y|~ + # Ensures that player remains in the horizontal range its supposed to +** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right~ - Inside source: true *** True Line Result - .map do |x, y| -** Processing line: ~ if block_given?~ + if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right +** Processing line: ~ state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope~ - Inside source: true *** True Line Result - if block_given? -** Processing line: ~ yield x, y, state.spaces[x][y]~ + state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - yield x, y, state.spaces[x][y] -** Processing line: ~ else~ + state.dx = 0 +** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left~ - Inside source: true *** True Line Result - else -** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ + elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left +** Processing line: ~ state.x = 0 # farthest left the player can be while remaining in the screen's scope~ - Inside source: true *** True Line Result - [x, y, state.spaces[x][y]] # sets definition of space -** Processing line: ~ end~ + state.x = 0 # farthest left the player can be while remaining in the screen's scope +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - end + state.dx = 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22117,42 +22536,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Defines all spaces on the board.~ +** Processing line: ~ def calc_sprite_selection~ - Inside source: true *** True Line Result - # Defines all spaces on the board. -** Processing line: ~ def all_spaces~ + def calc_sprite_selection +** Processing line: ~ # Does the transition to bring down the select sprite screen~ - Inside source: true *** True Line Result - def all_spaces -** Processing line: ~ if !block_given?~ + # Does the transition to bring down the select sprite screen +** Processing line: ~ if state.mode == :selecting && state.select_menu.y != 0~ - Inside source: true *** True Line Result - if !block_given? -** Processing line: ~ state.space_combinations.map do |x, y|~ + if state.mode == :selecting && state.select_menu.y != 0 +** Processing line: ~ state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed)~ - Inside source: true *** True Line Result - state.space_combinations.map do |x, y| -** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ + state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) +** Processing line: ~ state.banner_coords.y = 680 # sets y position of Select Sprite banner~ - Inside source: true *** True Line Result - [x, y, state.spaces[x][y]] # sets definition of space + state.banner_coords.y = 680 # sets y position of Select Sprite banner +** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ +- Inside source: true +*** True Line Result + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| +** Processing line: ~ [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen)~ +- Inside source: true +*** True Line Result + [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ else # if a block is given (block_given? is true)~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - else # if a block is given (block_given? is true) -** Processing line: ~ state.space_combinations.map do |x, y|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.space_combinations.map do |x, y| -** Processing line: ~ yield x, y, state.spaces[x][y] # yield if a block is given~ + +** Processing line: ~ # Does the transition to leave the select sprite screen~ - Inside source: true *** True Line Result - yield x, y, state.spaces[x][y] # yield if a block is given + # Does the transition to leave the select sprite screen +** Processing line: ~ if state.mode == :creating && state.select_menu.y != 720~ +- Inside source: true +*** True Line Result + if state.mode == :creating && state.select_menu.y != 720 +** Processing line: ~ state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up)~ +- Inside source: true +*** True Line Result + state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) +** Processing line: ~ state.banner_coords.y = 1000 # sets y position of Select Sprite banner~ +- Inside source: true +*** True Line Result + state.banner_coords.y = 1000 # sets y position of Select Sprite banner +** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ +- Inside source: true +*** True Line Result + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| +** Processing line: ~ [x, y + 720, w, h] # sets definition of all elements in collection~ +- Inside source: true +*** True Line Result + [x, y + 720, w, h] # sets definition of all elements in collection ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22169,110 +22616,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets values for a label, such as the position, value, size, alignment, and color.~ +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - # Sets values for a label, such as the position, value, size, alignment, and color. -** Processing line: ~ def label x, y, value~ + def process_inputs +** Processing line: ~ # If the state.mode is back and if the menu has retreated back up~ - Inside source: true *** True Line Result - def label x, y, value -** Processing line: ~ [x, y + 10, value, 20, 1, 0, 0, 0]~ + # If the state.mode is back and if the menu has retreated back up +** Processing line: ~ # call methods that process user inputs~ - Inside source: true *** True Line Result - [x, y + 10, value, 20, 1, 0, 0, 0] -** Processing line: ~ end~ + # call methods that process user inputs +** Processing line: ~ if state.mode == :creating~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if state.mode == :creating +** Processing line: ~ process_inputs_player_movement~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + process_inputs_player_movement +** Processing line: ~ process_inputs_place_tile~ - Inside source: true *** True Line Result - -** Processing line: ~ $tic_tac_toe = TicTacToe.new~ + process_inputs_place_tile +** Processing line: ~ end~ - Inside source: true *** True Line Result - $tic_tac_toe = TicTacToe.new + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ $tic_tac_toe._ = args~ -- Inside source: true -*** True Line Result - $tic_tac_toe._ = args -** Processing line: ~ $tic_tac_toe.state = args.state~ +** Processing line: ~ # For each sprite_coordinate added, check what sprite was selected~ - Inside source: true *** True Line Result - $tic_tac_toe.state = args.state -** Processing line: ~ $tic_tac_toe.outputs = args.outputs~ + # For each sprite_coordinate added, check what sprite was selected +** Processing line: ~ if state.mode == :selecting~ - Inside source: true *** True Line Result - $tic_tac_toe.outputs = args.outputs -** Processing line: ~ $tic_tac_toe.inputs = args.inputs~ + if state.mode == :selecting +** Processing line: ~ state.sprite_coords.map do |x, y, order| # goes through all sprites in collection~ - Inside source: true *** True Line Result - $tic_tac_toe.inputs = args.inputs -** Processing line: ~ $tic_tac_toe.grid = args.grid~ + state.sprite_coords.map do |x, y, order| # goes through all sprites in collection +** Processing line: ~ # checks that a specific sprite was pressed based on x, y position~ - Inside source: true *** True Line Result - $tic_tac_toe.grid = args.grid -** Processing line: ~ $tic_tac_toe.gtk = args.gtk~ + # checks that a specific sprite was pressed based on x, y position +** Processing line: ~ if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true~ - Inside source: true *** True Line Result - $tic_tac_toe.gtk = args.gtk -** Processing line: ~ $tic_tac_toe.tick~ + if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true +** Processing line: ~ inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and~ - Inside source: true *** True Line Result - $tic_tac_toe.tick -** Processing line: ~ tick_instructions args, "Sample app shows how to work with mouse clicks."~ + inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and +** Processing line: ~ inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to work with mouse clicks." -** Processing line: ~ end~ + inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right +** Processing line: ~ inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y +** Processing line: ~ inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_instructions args, text, y = 715~ + inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up +** Processing line: ~ state.sprite_selected = order # sprite is chosen~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + state.sprite_selected = order # sprite is chosen +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + +** Processing line: ~ inputs_export_stage~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + inputs_export_stage +** Processing line: ~ process_inputs_show_available_sprites~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + process_inputs_show_available_sprites ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22281,262 +22720,246 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ # Moves the player based on the keys they press on their keyboard~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + # Moves the player based on the keys they press on their keyboard +** Processing line: ~ def process_inputs_player_movement~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + def process_inputs_player_movement +** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right)~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) +** Processing line: ~ if inputs.keyboard.key_up.right~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if inputs.keyboard.key_up.right +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 05_mouse/05_mouse_move/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 05_mouse/05_mouse_move/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + state.dx = 0 +** Processing line: ~ elsif inputs.keyboard.key_up.left~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + elsif inputs.keyboard.key_up.left +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + state.dx = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - Reminders: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ +** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys~ - Inside source: true *** True Line Result - - num1.greater(num2): Returns the greater value. -** Processing line: ~ For example, if we have the command~ + # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys +** Processing line: ~ if inputs.keyboard.key_held.right~ - Inside source: true *** True Line Result - For example, if we have the command -** Processing line: ~ puts 4.greater(3)~ + if inputs.keyboard.key_held.right +** Processing line: ~ state.dx = 3~ - Inside source: true *** True Line Result - puts 4.greater(3) -** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ + state.dx = 3 +** Processing line: ~ elsif inputs.keyboard.key_held.left~ - Inside source: true *** True Line Result - the number 4 would be printed to the console since it has a greater value than 3. -** Processing line: ~ Similar to lesser, which returns the lesser value.~ + elsif inputs.keyboard.key_held.left +** Processing line: ~ state.dx = -3~ - Inside source: true *** True Line Result - Similar to lesser, which returns the lesser value. + state.dx = -3 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ +** Processing line: ~ # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard~ - Inside source: true *** True Line Result - - find_all: Finds all elements of a collection that meet certain requirements. -** Processing line: ~ For example, in this sample app, we're using find_all to find all zombies that have intersected~ + # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard +** Processing line: ~ if inputs.keyboard.key_held.space~ - Inside source: true *** True Line Result - For example, in this sample app, we're using find_all to find all zombies that have intersected -** Processing line: ~ or hit the player's sprite since these zombies have been killed.~ + if inputs.keyboard.key_held.space +** Processing line: ~ state.dy = 5~ - Inside source: true *** True Line Result - or hit the player's sprite since these zombies have been killed. -** Processing line: ~~ + state.dy = 5 +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. -** Processing line: ~ Stores the frame the "down" event occurred.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - Stores the frame the "down" event occurred. -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ + +** Processing line: ~ # Adds tile in the place the user holds down the mouse~ - Inside source: true *** True Line Result - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. -** Processing line: ~~ + # Adds tile in the place the user holds down the mouse +** Processing line: ~ def process_inputs_place_tile~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ + def process_inputs_place_tile +** Processing line: ~ if inputs.mouse.down # if mouse is pressed~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. The values generate a sprite. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ + if inputs.mouse.down # if mouse is pressed +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ + state.world_lookup = {} +** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ # Checks if any coordinates duplicate (already exist in world)~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ When we want to create a new object, we can declare it as a new entity and then define~ + # Checks if any coordinates duplicate (already exist in world) +** Processing line: ~ if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y }~ - Inside source: true *** True Line Result - When we want to create a new object, we can declare it as a new entity and then define -** Processing line: ~ its properties. (Remember, you can use state to define ANY property and it will~ + if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } +** Processing line: ~ #erases existing tile space by rejecting them from world~ - Inside source: true *** True Line Result - its properties. (Remember, you can use state to define ANY property and it will -** Processing line: ~ be retained across frames.)~ + #erases existing tile space by rejecting them from world +** Processing line: ~ state.world = state.world.reject do |existing_x, existing_y, n|~ - Inside source: true *** True Line Result - be retained across frames.) -** Processing line: ~~ + state.world = state.world.reject do |existing_x, existing_y, n| +** Processing line: ~ existing_x == x && existing_y == y~ - Inside source: true *** True Line Result - -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ + existing_x == x && existing_y == y +** Processing line: ~ end~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. -** Processing line: ~~ + else +** Processing line: ~ state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite~ - Inside source: true *** True Line Result - -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ + state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - - map: Ruby method used to transform data; used in arrays, hashes, and collections. -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - Can be used to perform an action on every element of a collection, such as multiplying -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - each element by 2 or declaring every element as a new entity. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - sample: Chooses a random element from the array.~ +** Processing line: ~ # Stores/exports world collection's info (coordinates, sprite number) into a file~ - Inside source: true *** True Line Result - - sample: Chooses a random element from the array. -** Processing line: ~~ + # Stores/exports world collection's info (coordinates, sprite number) into a file +** Processing line: ~ def inputs_export_stage~ - Inside source: true *** True Line Result - -** Processing line: ~ - reject: Removes elements that meet certain requirements.~ + def inputs_export_stage +** Processing line: ~ if inputs.keyboard.key_down.e # if "e" is pressed~ - Inside source: true *** True Line Result - - reject: Removes elements that meet certain requirements. -** Processing line: ~ In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also~ + if inputs.keyboard.key_down.e # if "e" is pressed +** Processing line: ~ export_string = state.world.map do |x, y, sprite_number| # stores world info in a string~ - Inside source: true *** True Line Result - In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also -** Processing line: ~ rejecting zombies that were killed more than 30 frames ago.~ + export_string = state.world.map do |x, y, sprite_number| # stores world info in a string +** Processing line: ~ "#{x},#{y},#{sprite_number}" # using string interpolation~ - Inside source: true *** True Line Result - rejecting zombies that were killed more than 30 frames ago. -** Processing line: ~~ + "#{x},#{y},#{sprite_number}" # using string interpolation +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + end +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file +** Processing line: ~ state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved~ - Inside source: true *** True Line Result - -** Processing line: ~ # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal~ + state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved +** Processing line: ~ end~ - Inside source: true *** True Line Result - # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal -** Processing line: ~ # is to kill the zombies as fast as possible!~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # is to kill the zombies as fast as possible! + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class ProtectThePuppiesFromTheZombies~ +** Processing line: ~ def process_inputs_show_available_sprites~ - Inside source: true *** True Line Result - class ProtectThePuppiesFromTheZombies -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ + def process_inputs_show_available_sprites +** Processing line: ~ # Based on keyboard input, the entity (:creating and :selecting) switch~ - Inside source: true *** True Line Result - attr_accessor :grid, :inputs, :state, :outputs -** Processing line: ~~ + # Based on keyboard input, the entity (:creating and :selecting) switch +** Processing line: ~ if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calls the methods necessary for the game to run properly.~ + if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating +** Processing line: ~ state.mode = :selecting # will change to selecting~ - Inside source: true *** True Line Result - # Calls the methods necessary for the game to run properly. -** Processing line: ~ def tick~ + state.mode = :selecting # will change to selecting +** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off +** Processing line: ~ elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting +** Processing line: ~ state.mode = :creating # will change to creating~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + state.mode = :creating # will change to creating +** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ - Inside source: true *** True Line Result - calc -** Processing line: ~ input~ + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off +** Processing line: ~ end~ - Inside source: true *** True Line Result - input + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22545,70 +22968,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values for the zombies and for the player.~ +** Processing line: ~ # Loads the world collection by reading from the map.txt file in the app folder~ - Inside source: true *** True Line Result - # Sets default values for the zombies and for the player. -** Processing line: ~ # Initialization happens only in the first frame.~ + # Loads the world collection by reading from the map.txt file in the app folder +** Processing line: ~ def attempt_load_world_from_file~ - Inside source: true *** True Line Result - # Initialization happens only in the first frame. -** Processing line: ~ def defaults~ + def attempt_load_world_from_file +** Processing line: ~ return if state.world # return if the world collection is already populated~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.flash_at ||= 0~ + return if state.world # return if the world collection is already populated +** Processing line: ~ state.world ||= [] # initialized as an empty collection~ - Inside source: true *** True Line Result - state.flash_at ||= 0 -** Processing line: ~ state.zombie_min_spawn_rate ||= 60~ + state.world ||= [] # initialized as an empty collection +** Processing line: ~ exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code~ - Inside source: true *** True Line Result - state.zombie_min_spawn_rate ||= 60 -** Processing line: ~ state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate~ -- Inside source: true -*** True Line Result - state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate -** Processing line: ~ state.zombies ||= []~ + exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code +** Processing line: ~ return unless exported_world # return unless the file read was successful~ - Inside source: true *** True Line Result - state.zombies ||= [] -** Processing line: ~ state.killed_zombies ||= []~ + return unless exported_world # return unless the file read was successful +** Processing line: ~ state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world~ - Inside source: true *** True Line Result - state.killed_zombies ||= [] -** Processing line: ~~ + state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world +** Processing line: ~ l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Declares player as a new entity and sets its properties.~ + l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, +** Processing line: ~ # calling to_i (converts to integers) on each element~ - Inside source: true *** True Line Result - # Declares player as a new entity and sets its properties. -** Processing line: ~ # The player begins the game in the center of the screen, not moving in any direction.~ + # calling to_i (converts to integers) on each element +** Processing line: ~ end~ - Inside source: true *** True Line Result - # The player begins the game in the center of the screen, not moving in any direction. -** Processing line: ~ state.player ||= state.new_entity(:player, { x: 640,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.player ||= state.new_entity(:player, { x: 640, -** Processing line: ~ y: 360,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y: 360, -** Processing line: ~ attack_angle: 0,~ + +** Processing line: ~ # Adds the change in y to y to determine the next y position of the player.~ - Inside source: true *** True Line Result - attack_angle: 0, -** Processing line: ~ dx: 0,~ + # Adds the change in y to y to determine the next y position of the player. +** Processing line: ~ def next_y~ - Inside source: true *** True Line Result - dx: 0, -** Processing line: ~ dy: 0 })~ + def next_y +** Processing line: ~ state.y + state.dy~ - Inside source: true *** True Line Result - dy: 0 }) + state.y + state.dy ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22617,38 +23036,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs a gray background.~ -- Inside source: true -*** True Line Result - # Outputs a gray background. -** Processing line: ~ # Calls the methods needed to output the player, zombies, etc onto the screen.~ +** Processing line: ~ # Determines next x position of player~ - Inside source: true *** True Line Result - # Calls the methods needed to output the player, zombies, etc onto the screen. -** Processing line: ~ def render~ + # Determines next x position of player +** Processing line: ~ def next_x~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.solids << [grid.rect, 100, 100, 100]~ + def next_x +** Processing line: ~ if state.dx < 0 # if the player moves left~ - Inside source: true *** True Line Result - outputs.solids << [grid.rect, 100, 100, 100] -** Processing line: ~ render_zombies~ + if state.dx < 0 # if the player moves left +** Processing line: ~ return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)~ - Inside source: true *** True Line Result - render_zombies -** Processing line: ~ render_killed_zombies~ + return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) +** Processing line: ~ else~ - Inside source: true *** True Line Result - render_killed_zombies -** Processing line: ~ render_player~ + else +** Processing line: ~ return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)~ - Inside source: true *** True Line Result - render_player -** Processing line: ~ render_flash~ + return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_flash + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22657,234 +23072,234 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation.~ -- Inside source: true -*** True Line Result - # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. -** Processing line: ~ def render_zombies~ +** Processing line: ~ def to_coord point~ - Inside source: true *** True Line Result - def render_zombies -** Processing line: ~ outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection~ + def to_coord point +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ - Inside source: true *** True Line Result - outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection -** Processing line: ~ z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method~ + # Integer divides (idiv) point.x to turn into grid +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ - Inside source: true *** True Line Result - z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method -** Processing line: ~ z.sprite~ + # Then, you can just multiply each integer by state.tile_size +** Processing line: ~ # later and huzzah. Grid coordinates~ - Inside source: true *** True Line Result - z.sprite -** Processing line: ~ end~ + # later and huzzah. Grid coordinates +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ - Inside source: true *** True Line Result - end + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. -** Processing line: ~ def render_killed_zombies~ + +** Processing line: ~ $metroidvania_starter = MetroidvaniaStarter.new~ - Inside source: true *** True Line Result - def render_killed_zombies -** Processing line: ~ outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection~ + $metroidvania_starter = MetroidvaniaStarter.new +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection -** Processing line: ~ z.sprite = [z.x,~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - z.sprite = [z.x, -** Processing line: ~ z.y,~ + def tick args +** Processing line: ~ $metroidvania_starter.grid = args.grid~ - Inside source: true *** True Line Result - z.y, -** Processing line: ~ 4 * 3,~ + $metroidvania_starter.grid = args.grid +** Processing line: ~ $metroidvania_starter.inputs = args.inputs~ - Inside source: true *** True Line Result - 4 * 3, -** Processing line: ~ 8 * 3,~ + $metroidvania_starter.inputs = args.inputs +** Processing line: ~ $metroidvania_starter.state = args.state~ - Inside source: true *** True Line Result - 8 * 3, -** Processing line: ~ animation_sprite(z, z.death_at), # calls animation_sprite method~ + $metroidvania_starter.state = args.state +** Processing line: ~ $metroidvania_starter.outputs = args.outputs~ - Inside source: true *** True Line Result - animation_sprite(z, z.death_at), # calls animation_sprite method -** Processing line: ~ 0, # angle~ + $metroidvania_starter.outputs = args.outputs +** Processing line: ~ $metroidvania_starter.gtk = args.gtk~ - Inside source: true *** True Line Result - 0, # angle -** Processing line: ~ 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die~ + $metroidvania_starter.gtk = args.gtk +** Processing line: ~ $metroidvania_starter.tick~ - Inside source: true *** True Line Result - 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die -** Processing line: ~ # change the value of 30 and see what happens when a zombie is killed~ + $metroidvania_starter.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - # change the value of 30 and see what happens when a zombie is killed + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets values to output the slash over the zombie's sprite when a zombie is killed.~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - # Sets values to output the slash over the zombie's sprite when a zombie is killed. -** Processing line: ~ # The slash is tilted 45 degrees from the angle of the player's attack.~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - # The slash is tilted 45 degrees from the angle of the player's attack. -** Processing line: ~ # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions~ -- Inside source: true + +** Processing line: ~* Physics And Collisions - Jump Physics - main.rb~ +- Header detected. *** True Line Result - # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions -** Processing line: ~ # the slash over the killed zombie's sprite.~ -- Inside source: true + *** True Line Result - # the slash over the killed zombie's sprite. -** Processing line: ~ [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)]~ -- Inside source: true +* Physics And Collisions - Jump Physics - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] -** Processing line: ~ end~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/04_physics_and_collisions/06_jump_physics/app/main.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # ./samples/04_physics_and_collisions/06_jump_physics/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs the player sprite using the images in the sprites folder.~ -- Inside source: true -*** True Line Result - # Outputs the player sprite using the images in the sprites folder. -** Processing line: ~ def render_player~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - def render_player -** Processing line: ~ state.player_sprite = [state.player.x,~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - state.player_sprite = [state.player.x, -** Processing line: ~ state.player.y,~ + +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - state.player.y, -** Processing line: ~ 4 * 3,~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ - Inside source: true *** True Line Result - 4 * 3, -** Processing line: ~ 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation~ + For example, if we want to create a new button, we would declare it as a new entity and +** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ - Inside source: true *** True Line Result - 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation -** Processing line: ~ outputs.sprites << state.player_sprite~ + then define its properties. (Remember, you can use state to define ANY property and it will +** Processing line: ~ be retained across frames.)~ - Inside source: true *** True Line Result - outputs.sprites << state.player_sprite + be retained across frames.) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs a small red square that previews the angles that the player can attack in.~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - # Outputs a small red square that previews the angles that the player can attack in. -** Processing line: ~ # It can be moved in a perfect circle around the player to show possible movements.~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - # It can be moved in a perfect circle around the player to show possible movements. -** Processing line: ~ # Change the 60 in the parenthesis and see what happens to the movement of the red square.~ + The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - # Change the 60 in the parenthesis and see what happens to the movement of the red square. -** Processing line: ~ outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),~ + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), -** Processing line: ~ state.player.y + state.player.attack_angle.vector_y(60),~ + +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ - Inside source: true *** True Line Result - state.player.y + state.player.attack_angle.vector_y(60), -** Processing line: ~ 3, 3, 255, 0, 0]~ + - num1.greater(num2): Returns the greater value. +** Processing line: ~~ - Inside source: true *** True Line Result - 3, 3, 255, 0, 0] -** Processing line: ~ end~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ - Inside source: true *** True Line Result - end + - Hashes: Collection of unique keys and their corresponding values. The value can be found +** Processing line: ~ using their keys.~ +- Inside source: true +*** True Line Result + using their keys. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed.~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. -** Processing line: ~ def render_flash~ + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. +** Processing line: ~~ - Inside source: true *** True Line Result - def render_flash -** Processing line: ~ return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash.~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. -** Processing line: ~ # Transparency gradually changes (or eases) during the 10 frames of flash.~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - # Transparency gradually changes (or eases) during the 10 frames of flash. -** Processing line: ~ outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid~ + +** Processing line: ~ # This sample app is a game that requires the user to jump from one platform to the next.~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid -** Processing line: ~ end~ + # This sample app is a game that requires the user to jump from one platform to the next. +** Processing line: ~ # As the player successfully clears platforms, they become smaller and move faster.~ - Inside source: true *** True Line Result - end + # As the player successfully clears platforms, they become smaller and move faster. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls all methods necessary for performing calculations.~ +** Processing line: ~ class VerticalPlatformer~ - Inside source: true *** True Line Result - # Calls all methods necessary for performing calculations. -** Processing line: ~ def calc~ + class VerticalPlatformer +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_spawn_zombie~ + attr_gtk +** Processing line: ~~ - Inside source: true *** True Line Result - calc_spawn_zombie -** Processing line: ~ calc_move_zombies~ + +** Processing line: ~ # declares vertical platformer as new entity~ - Inside source: true *** True Line Result - calc_move_zombies -** Processing line: ~ calc_player~ + # declares vertical platformer as new entity +** Processing line: ~ def s~ - Inside source: true *** True Line Result - calc_player -** Processing line: ~ calc_kill_zombie~ + def s +** Processing line: ~ state.vertical_platformer ||= state.new_entity(:vertical_platformer)~ - Inside source: true *** True Line Result - calc_kill_zombie + state.vertical_platformer ||= state.new_entity(:vertical_platformer) +** Processing line: ~ state.vertical_platformer~ +- Inside source: true +*** True Line Result + state.vertical_platformer ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -22893,142 +23308,146 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Decreases the zombie spawn countdown by 1 if it has a value greater than 0.~ +** Processing line: ~ # creates a new platform using a hash~ - Inside source: true *** True Line Result - # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. -** Processing line: ~ def calc_spawn_zombie~ + # creates a new platform using a hash +** Processing line: ~ def new_platform hash~ - Inside source: true *** True Line Result - def calc_spawn_zombie -** Processing line: ~ if state.zombie_spawn_countdown > 0~ + def new_platform hash +** Processing line: ~ s.new_entity_strict(:platform, hash) # platform key~ - Inside source: true *** True Line Result - if state.zombie_spawn_countdown > 0 -** Processing line: ~ state.zombie_spawn_countdown -= 1~ + s.new_entity_strict(:platform, hash) # platform key +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.zombie_spawn_countdown -= 1 -** Processing line: ~ return~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + +** Processing line: ~ # calls methods needed for game to run properly~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # calls methods needed for game to run properly +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - -** Processing line: ~ # New zombies are created, positioned on the screen, and added to the zombies collection.~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - # New zombies are created, positioned on the screen, and added to the zombies collection. -** Processing line: ~ state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity -** Processing line: ~ if rand > 0.5~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - if rand > 0.5 -** Processing line: ~ z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope)~ + calc +** Processing line: ~ input~ - Inside source: true *** True Line Result - z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) -** Processing line: ~ z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen)~ + input +** Processing line: ~ end~ - Inside source: true *** True Line Result - z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) -** Processing line: ~ # the possible values exceed the screen's scope so zombies appear to be coming from far away~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # the possible values exceed the screen's scope so zombies appear to be coming from far away -** Processing line: ~ else~ + +** Processing line: ~ # Sets default values~ - Inside source: true *** True Line Result - else -** Processing line: ~ z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen)~ + # Sets default values +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) -** Processing line: ~ z.y = grid.rect.w.randomize(:ratio) # random y position on screen~ + def defaults +** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ - Inside source: true *** True Line Result - z.y = grid.rect.w.randomize(:ratio) # random y position on screen -** Processing line: ~ end~ + s.platforms ||= [ # initializes platforms collection with two platforms using hashes +** Processing line: ~ new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), +** Processing line: ~ new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher~ - Inside source: true *** True Line Result - end + new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls random_spawn_countdown method (determines how fast new zombies appear)~ +** Processing line: ~ s.tick_count = args.state.tick_count~ - Inside source: true *** True Line Result - # Calls random_spawn_countdown method (determines how fast new zombies appear) -** Processing line: ~ state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate~ + s.tick_count = args.state.tick_count +** Processing line: ~ s.gravity = -0.3 # what goes up must come down because of gravity~ - Inside source: true *** True Line Result - state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate -** Processing line: ~ state.zombie_min_spawn_rate -= 1~ + s.gravity = -0.3 # what goes up must come down because of gravity +** Processing line: ~ s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared~ - Inside source: true *** True Line Result - state.zombie_min_spawn_rate -= 1 -** Processing line: ~ # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater~ + s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared +** Processing line: ~ s.player.x ||= 0 # sets player values~ - Inside source: true *** True Line Result - # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater -** Processing line: ~ state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0)~ + s.player.x ||= 0 # sets player values +** Processing line: ~ s.player.y ||= 100~ - Inside source: true *** True Line Result - state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) -** Processing line: ~ end~ + s.player.y ||= 100 +** Processing line: ~ s.player.w ||= 64~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + s.player.w ||= 64 +** Processing line: ~ s.player.h ||= 64~ - Inside source: true *** True Line Result - -** Processing line: ~ # Moves all zombies towards the center of the screen.~ + s.player.h ||= 64 +** Processing line: ~ s.player.dy ||= 0 # change in position~ - Inside source: true *** True Line Result - # Moves all zombies towards the center of the screen. -** Processing line: ~ # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear.~ + s.player.dy ||= 0 # change in position +** Processing line: ~ s.player.dx ||= 0~ - Inside source: true *** True Line Result - # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. -** Processing line: ~ def calc_move_zombies~ + s.player.dx ||= 0 +** Processing line: ~ s.player_jump_power = 15~ - Inside source: true *** True Line Result - def calc_move_zombies -** Processing line: ~ state.zombies.each do |z| # for each zombie in the collection~ + s.player_jump_power = 15 +** Processing line: ~ s.player_jump_power_duration = 10~ - Inside source: true *** True Line Result - state.zombies.each do |z| # for each zombie in the collection -** Processing line: ~ z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1~ + s.player_jump_power_duration = 10 +** Processing line: ~ s.player_max_run_speed = 5~ - Inside source: true *** True Line Result - z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 -** Processing line: ~ z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center~ + s.player_max_run_speed = 5 +** Processing line: ~ s.player_speed_slowdown_rate = 0.9~ - Inside source: true *** True Line Result - z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center -** Processing line: ~ end~ + s.player_speed_slowdown_rate = 0.9 +** Processing line: ~ s.player_acceleration = 1~ - Inside source: true *** True Line Result - end -** Processing line: ~ state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center~ + s.player_acceleration = 1 +** Processing line: ~ s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too)~ - Inside source: true *** True Line Result - state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center + s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23037,110 +23456,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Calculates the position and movement of the player on the screen.~ -- Inside source: true -*** True Line Result - # Calculates the position and movement of the player on the screen. -** Processing line: ~ def calc_player~ +** Processing line: ~ # Outputs objects onto the screen~ - Inside source: true *** True Line Result - def calc_player -** Processing line: ~ state.player.x += state.player.dx # changes x based on dx (change in x)~ + # Outputs objects onto the screen +** Processing line: ~ def render~ - Inside source: true *** True Line Result - state.player.x += state.player.dx # changes x based on dx (change in x) -** Processing line: ~ state.player.y += state.player.dy # changes y based on dy (change in y)~ + def render +** Processing line: ~ outputs.solids << s.platforms.map do |p| # outputs platforms onto screen~ - Inside source: true *** True Line Result - state.player.y += state.player.dy # changes y based on dy (change in y) -** Processing line: ~~ + outputs.solids << s.platforms.map do |p| # outputs platforms onto screen +** Processing line: ~ [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center~ - Inside source: true *** True Line Result - -** Processing line: ~ state.player.dx *= 0.9 # scales dx down~ + [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center +** Processing line: ~ # don't forget, position of platform is denoted by bottom left hand corner~ - Inside source: true *** True Line Result - state.player.dx *= 0.9 # scales dx down -** Processing line: ~ state.player.dy *= 0.9 # scales dy down~ + # don't forget, position of platform is denoted by bottom left hand corner +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.player.dy *= 0.9 # scales dy down + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value.~ +** Processing line: ~ # outputs player using hash~ - Inside source: true *** True Line Result - # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. -** Processing line: ~ # This ensures that the player remains within the screen's scope.~ + # outputs player using hash +** Processing line: ~ outputs.solids << {~ - Inside source: true *** True Line Result - # This ensures that the player remains within the screen's scope. -** Processing line: ~ state.player.x = state.player.x.lesser(1280).greater(0)~ + outputs.solids << { +** Processing line: ~ x: s.player.x + 300, # player positioned on top of platform~ - Inside source: true *** True Line Result - state.player.x = state.player.x.lesser(1280).greater(0) -** Processing line: ~ state.player.y = state.player.y.lesser(720).greater(0) # same with player's y~ + x: s.player.x + 300, # player positioned on top of platform +** Processing line: ~ y: s.player.y - s.camera[:y],~ - Inside source: true *** True Line Result - state.player.y = state.player.y.lesser(720).greater(0) # same with player's y -** Processing line: ~ end~ + y: s.player.y - s.camera[:y], +** Processing line: ~ w: s.player.w,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + w: s.player.w, +** Processing line: ~ h: s.player.h,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection~ + h: s.player.h, +** Processing line: ~ r: 100, # color saturation~ - Inside source: true *** True Line Result - # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection -** Processing line: ~ # and added to the killed_zombies collection since any zombie that intersects with the player is killed.~ + r: 100, # color saturation +** Processing line: ~ g: 100,~ - Inside source: true *** True Line Result - # and added to the killed_zombies collection since any zombie that intersects with the player is killed. -** Processing line: ~ def calc_kill_zombie~ + g: 100, +** Processing line: ~ b: 200~ - Inside source: true *** True Line Result - def calc_kill_zombie -** Processing line: ~~ + b: 200 +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ # Find all zombies that intersect with the player. They are considered killed.~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Find all zombies that intersect with the player. They are considered killed. -** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } -** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ + +** Processing line: ~ # Performs calculations~ - Inside source: true *** True Line Result - state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection -** Processing line: ~ state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies~ -- Inside source: true -*** True Line Result - state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame~ + # Performs calculations +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame -** Processing line: ~ state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed~ + def calc +** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ - Inside source: true *** True Line Result - state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed -** Processing line: ~ # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method)~ + s.platforms.each do |p| # for each platform in the collection +** Processing line: ~ p.rect = [p.x, p.y, p.w, p.h] # set the definition~ - Inside source: true *** True Line Result - # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) + p.rect = [p.x, p.y, p.w, p.h] # set the definition ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23149,86 +23556,106 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie.~ +** Processing line: ~ # sets player point by adding half the player's width to the player's x~ - Inside source: true *** True Line Result - # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. -** Processing line: ~ # Death_at stores the frame a zombie was killed.~ + # sets player point by adding half the player's width to the player's x +** Processing line: ~ s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens!~ - Inside source: true *** True Line Result - # Death_at stores the frame a zombie was killed. -** Processing line: ~ killed_this_frame.each do |z|~ + s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! +** Processing line: ~~ - Inside source: true *** True Line Result - killed_this_frame.each do |z| -** Processing line: ~ z.death_at = state.tick_count~ + +** Processing line: ~ # search the platforms collection to find if the player's point is inside the rect of a platform~ - Inside source: true *** True Line Result - z.death_at = state.tick_count -** Processing line: ~ end~ + # search the platforms collection to find if the player's point is inside the rect of a platform +** Processing line: ~ collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect }~ - Inside source: true *** True Line Result - end + collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Zombies are rejected from the killed_zombies collection depending on when they were killed.~ +** Processing line: ~ # if collision occurred and player is moving down (or not moving vertically at all)~ - Inside source: true *** True Line Result - # Zombies are rejected from the killed_zombies collection depending on when they were killed. -** Processing line: ~ # They are rejected if more than 30 frames have passed since their death.~ + # if collision occurred and player is moving down (or not moving vertically at all) +** Processing line: ~ if collision && s.player.dy <= 0~ - Inside source: true *** True Line Result - # They are rejected if more than 30 frames have passed since their death. -** Processing line: ~ state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 }~ + if collision && s.player.dy <= 0 +** Processing line: ~ s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform~ - Inside source: true *** True Line Result - state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } -** Processing line: ~ end~ + s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform +** Processing line: ~ s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically +** Processing line: ~ if !s.player.platform~ - Inside source: true *** True Line Result - -** Processing line: ~ # Uses input from the user to move the player around the screen.~ + if !s.player.platform +** Processing line: ~ s.player.dx = 0 # no horizontal movement~ - Inside source: true *** True Line Result - # Uses input from the user to move the player around the screen. -** Processing line: ~ def input~ + s.player.dx = 0 # no horizontal movement +** Processing line: ~ end~ - Inside source: true *** True Line Result - def input -** Processing line: ~~ + end +** Processing line: ~ # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x~ - Inside source: true *** True Line Result - -** Processing line: ~ # If the "a" key or left key is pressed, the x position of the player decreases.~ + # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x +** Processing line: ~ s.player.x += collision.dx * collision.speed~ - Inside source: true *** True Line Result - # If the "a" key or left key is pressed, the x position of the player decreases. -** Processing line: ~ # Otherwise, if the "d" key or right key is pressed, the x position of the player increases.~ + s.player.x += collision.dx * collision.speed +** Processing line: ~ s.player.platform = collision # player is on the platform that it collided with (or landed on)~ - Inside source: true *** True Line Result - # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. -** Processing line: ~ if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left~ + s.player.platform = collision # player is on the platform that it collided with (or landed on) +** Processing line: ~ if s.player.falling # if player is falling~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left -** Processing line: ~ state.player.x -= 5~ + if s.player.falling # if player is falling +** Processing line: ~ s.player.dx = 0 # no horizontal movement~ - Inside source: true *** True Line Result - state.player.x -= 5 -** Processing line: ~ elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right~ + s.player.dx = 0 # no horizontal movement +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right -** Processing line: ~ state.player.x += 5~ + end +** Processing line: ~ s.player.falling = false~ - Inside source: true *** True Line Result - state.player.x += 5 + s.player.falling = false +** Processing line: ~ s.player.jumped_at = nil~ +- Inside source: true +*** True Line Result + s.player.jumped_at = nil +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ s.player.platform = nil # player is not on a platform~ +- Inside source: true +*** True Line Result + s.player.platform = nil # player is not on a platform +** Processing line: ~ s.player.y += s.player.dy # velocity is the change in position~ +- Inside source: true +*** True Line Result + s.player.y += s.player.dy # velocity is the change in position +** Processing line: ~ s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down~ +- Inside source: true +*** True Line Result + s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23237,30 +23664,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # If the "w" or up key is pressed, the y position of the player increases.~ +** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ - Inside source: true *** True Line Result - # If the "w" or up key is pressed, the y position of the player increases. -** Processing line: ~ # Otherwise, if the "s" or down key is pressed, the y position of the player decreases.~ + s.platforms.each do |p| # for each platform in the collection +** Processing line: ~ p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally)~ - Inside source: true *** True Line Result - # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. -** Processing line: ~ if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up~ + p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) +** Processing line: ~ # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels)~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up -** Processing line: ~ state.player.y += 5~ + # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) +** Processing line: ~ if p.x < -300 # if platform goes too far left~ - Inside source: true *** True Line Result - state.player.y += 5 -** Processing line: ~ elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down~ + if p.x < -300 # if platform goes too far left +** Processing line: ~ p.dx *= -1 # dx is scaled down~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down -** Processing line: ~ state.player.y -= 5~ + p.dx *= -1 # dx is scaled down +** Processing line: ~ p.x = -300 # as far left as possible within scope~ - Inside source: true *** True Line Result - state.player.y -= 5 + p.x = -300 # as far left as possible within scope +** Processing line: ~ elsif p.x > (1000 - p.w) # if platform's x is greater than 300~ +- Inside source: true +*** True Line Result + elsif p.x > (1000 - p.w) # if platform's x is greater than 300 +** Processing line: ~ p.dx *= -1~ +- Inside source: true +*** True Line Result + p.dx *= -1 +** Processing line: ~ p.x = (1000 - p.w) # set to 300 (as far right as possible within scope)~ +- Inside source: true +*** True Line Result + p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23269,106 +23712,106 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets the attack angle so the player can move and attack in the precise direction it wants to go.~ -- Inside source: true -*** True Line Result - # Sets the attack angle so the player can move and attack in the precise direction it wants to go. -** Processing line: ~ # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position).~ +** Processing line: ~ delta = (s.player.y - s.camera[:y] - 100) # used to position camera view~ - Inside source: true *** True Line Result - # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). -** Processing line: ~ # Attack angle also contributes to the position of red square.~ + delta = (s.player.y - s.camera[:y] - 100) # used to position camera view +** Processing line: ~~ - Inside source: true *** True Line Result - # Attack angle also contributes to the position of red square. -** Processing line: ~ if inputs.mouse.moved~ + +** Processing line: ~ if delta > -200~ - Inside source: true *** True Line Result - if inputs.mouse.moved -** Processing line: ~ state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ + if delta > -200 +** Processing line: ~ s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards~ - Inside source: true *** True Line Result - state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] -** Processing line: ~ end~ + s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards +** Processing line: ~ s.player.x += s.player.dx # velocity is change in position; change in x increases by dx~ - Inside source: true *** True Line Result - end + s.player.x += s.player.dx # velocity is change in position; change in x increases by dx ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5~ +** Processing line: ~ # searches platform collection to find platforms located more than 300 pixels above the player~ - Inside source: true *** True Line Result - if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 -** Processing line: ~ state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ + # searches platform collection to find platforms located more than 300 pixels above the player +** Processing line: ~ has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) }~ - Inside source: true *** True Line Result - state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] -** Processing line: ~ state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set~ + has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } +** Processing line: ~ if !has_platforms # if there are no platforms 300 pixels above the player~ - Inside source: true *** True Line Result - state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set -** Processing line: ~ state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position~ + if !has_platforms # if there are no platforms 300 pixels above the player +** Processing line: ~ width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous~ - Inside source: true *** True Line Result - state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position -** Processing line: ~ state.player.dy = state.player.attack_angle.vector_y(25)~ + width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous +** Processing line: ~ s.player.platforms_cleared += 1 # player successfully cleared another platform~ - Inside source: true *** True Line Result - state.player.dy = state.player.attack_angle.vector_y(25) -** Processing line: ~ end~ + s.player.platforms_cleared += 1 # player successfully cleared another platform +** Processing line: ~ last_platform = s.platforms[-1] # platform just cleared becomes last platform~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + last_platform = s.platforms[-1] # platform just cleared becomes last platform +** Processing line: ~ # another platform is created 300 pixels above the last platform, and this~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # another platform is created 300 pixels above the last platform, and this +** Processing line: ~ # new platform has a smaller width and moves faster than all previous platforms~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the zombie spawn's countdown to a random number.~ + # new platform has a smaller width and moves faster than all previous platforms +** Processing line: ~ s.platforms << new_platform(x: (700 - width) * rand, # random x position~ - Inside source: true *** True Line Result - # Sets the zombie spawn's countdown to a random number. -** Processing line: ~ # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!)~ + s.platforms << new_platform(x: (700 - width) * rand, # random x position +** Processing line: ~ y: last_platform.y + 300,~ - Inside source: true *** True Line Result - # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) -** Processing line: ~ def random_spawn_countdown minimum~ + y: last_platform.y + 300, +** Processing line: ~ w: width,~ - Inside source: true *** True Line Result - def random_spawn_countdown minimum -** Processing line: ~ 10.randomize(:ratio, :sign).to_i + 60~ + w: width, +** Processing line: ~ h: 32,~ - Inside source: true *** True Line Result - 10.randomize(:ratio, :sign).to_i + 60 -** Processing line: ~ end~ + h: 32, +** Processing line: ~ dx: 1.randomize(:sign), # random change in x~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + dx: 1.randomize(:sign), # random change in x +** Processing line: ~ speed: 2 * s.player.platforms_cleared,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Helps to iterate through the images in the sprites folder by setting the animation index.~ + speed: 2 * s.player.platforms_cleared, +** Processing line: ~ rect: nil)~ - Inside source: true *** True Line Result - # Helps to iterate through the images in the sprites folder by setting the animation index. -** Processing line: ~ # 3 frames is how long to show an image, and 6 is how many images to flip through.~ + rect: nil) +** Processing line: ~ end~ - Inside source: true *** True Line Result - # 3 frames is how long to show an image, and 6 is how many images to flip through. -** Processing line: ~ def animation_index at~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - def animation_index at -** Processing line: ~ at.idiv(3).mod(6)~ + else +** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ - Inside source: true *** True Line Result - at.idiv(3).mod(6) + s.as_hash.clear # otherwise clear the hash (no new platform is necessary) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23377,130 +23820,138 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Animates the zombies by using the animation index to go through the images in the sprites folder.~ +** Processing line: ~ # Takes input from the user to move the player~ - Inside source: true *** True Line Result - # Animates the zombies by using the animation index to go through the images in the sprites folder. -** Processing line: ~ def animation_sprite zombie, at = nil~ + # Takes input from the user to move the player +** Processing line: ~ def input~ - Inside source: true *** True Line Result - def animation_sprite zombie, at = nil -** Processing line: ~ at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created~ + def input +** Processing line: ~ if inputs.keyboard.space # if the space bar is pressed~ - Inside source: true *** True Line Result - at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created -** Processing line: ~ index = animation_index at~ + if inputs.keyboard.space # if the space bar is pressed +** Processing line: ~ s.player.jumped_at ||= s.tick_count # set to current frame~ - Inside source: true *** True Line Result - index = animation_index at -** Processing line: ~ "sprites/zombie-#{index}.png" # string interpolation to iterate through images~ + s.player.jumped_at ||= s.tick_count # set to current frame +** Processing line: ~~ - Inside source: true *** True Line Result - "sprites/zombie-#{index}.png" # string interpolation to iterate through images -** Processing line: ~ end~ + +** Processing line: ~ # if the time that has passed since the jump is less than the duration of a jump (10 frames)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # if the time that has passed since the jump is less than the duration of a jump (10 frames) +** Processing line: ~ # and the player is not falling~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # and the player is not falling +** Processing line: ~ if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling~ - Inside source: true *** True Line Result - -** Processing line: ~ $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new~ + if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling +** Processing line: ~ s.player.dy = s.player_jump_power # player jumps up~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new + s.player.dy = s.player_jump_power # player jumps up +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ if inputs.keyboard.key_up.space # if space bar is in "up" state~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $protect_the_puppies_from_the_zombies.grid = args.grid~ + if inputs.keyboard.key_up.space # if space bar is in "up" state +** Processing line: ~ s.player.falling = true # player is falling~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies.grid = args.grid -** Processing line: ~ $protect_the_puppies_from_the_zombies.inputs = args.inputs~ + s.player.falling = true # player is falling +** Processing line: ~ end~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies.inputs = args.inputs -** Processing line: ~ $protect_the_puppies_from_the_zombies.state = args.state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies.state = args.state -** Processing line: ~ $protect_the_puppies_from_the_zombies.outputs = args.outputs~ + +** Processing line: ~ if inputs.keyboard.left # if left key is pressed~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies.outputs = args.outputs -** Processing line: ~ $protect_the_puppies_from_the_zombies.tick~ + if inputs.keyboard.left # if left key is pressed +** Processing line: ~ s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration~ - Inside source: true *** True Line Result - $protect_the_puppies_from_the_zombies.tick -** Processing line: ~ tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play."~ + s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration +** Processing line: ~ s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater~ - Inside source: true *** True Line Result - tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." -** Processing line: ~ end~ + s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater +** Processing line: ~ elsif inputs.keyboard.right # if right key is pressed~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif inputs.keyboard.right # if right key is pressed +** Processing line: ~ s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_instructions args, text, y = 715~ + s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration +** Processing line: ~ s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser +** Processing line: ~ else~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + else +** Processing line: ~ s.player.dx *= s.player_speed_slowdown_rate # scales dx down~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + s.player.dx *= s.player_speed_slowdown_rate # scales dx down +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true -** Processing line: ~ end~ + +** Processing line: ~ $game = VerticalPlatformer.new~ - Inside source: true *** True Line Result - end + $game = VerticalPlatformer.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + def tick args +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label + $game.tick ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23517,18 +23968,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 05_mouse/05_mouse_move_paint_app/app/main.rb~ +** Processing line: ~* Mouse - Mouse Click - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 05_mouse/05_mouse_move_paint_app/app/main.rb +* Mouse - Mouse Click - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/05_mouse/01_mouse_click/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/05_mouse/01_mouse_click/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -23545,146 +24000,150 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ - Floor: Method that returns an integer number smaller than or equal to the original with no decimal.~ +** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ - Inside source: true *** True Line Result - - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. + - product: Returns an array of all combinations of elements from all arrays. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this...~ -- Inside source: true -*** True Line Result - For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... -** Processing line: ~ puts a.floor()~ -- Inside source: true -*** True Line Result - puts a.floor() -** Processing line: ~ which would print out 13.~ -- Inside source: true -*** True Line Result - which would print out 13. -** Processing line: ~ (There is also a ceil method, which returns an integer number greater than or equal to the original~ +** Processing line: ~ For example, [1,2].product([1,2]) would return the following array...~ - Inside source: true *** True Line Result - (There is also a ceil method, which returns an integer number greater than or equal to the original -** Processing line: ~ with no decimal. If we had called ceil on the variable a, the result would have been 14.)~ + For example, [1,2].product([1,2]) would return the following array... +** Processing line: ~ [[1,1], [1,2], [2,1], [2,2]]~ - Inside source: true *** True Line Result - with no decimal. If we had called ceil on the variable a, the result would have been 14.) -** Processing line: ~~ + [[1,1], [1,2], [2,1], [2,2]] +** Processing line: ~ More than two arrays can be given to product and it will still work,~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + More than two arrays can be given to product and it will still work, +** Processing line: ~ such as [1,2].product([1,2],[3,4]). What would product return in this case?~ - Inside source: true *** True Line Result - Reminders: + such as [1,2].product([1,2],[3,4]). What would product return in this case? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ Answer:~ - Inside source: true *** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The value can be found -** Processing line: ~ using their keys.~ + Answer: +** Processing line: ~ [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]]~ - Inside source: true *** True Line Result - using their keys. + [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ +** Processing line: ~ - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers.~ - Inside source: true *** True Line Result - For example, if we have a "numbers" hash that stores numbers in English as the -** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ + - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. +** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ - Inside source: true *** True Line Result - key and numbers in Spanish as the value, we'd have a hash that looks like this... -** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 +** Processing line: ~~ - Inside source: true *** True Line Result - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } -** Processing line: ~ and on it goes.~ + +** Processing line: ~ - yield: Allows you to call a method with a code block and yield to that block.~ - Inside source: true *** True Line Result - and on it goes. + - yield: Allows you to call a method with a code block and yield to that block. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - Now if we wanted to find the corresponding value of the "one" key, we could say -** Processing line: ~ puts numbers["one"]~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - puts numbers["one"] -** Processing line: ~ which would print "uno" to the console.~ + +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - which would print "uno" to the console. + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - In this sample app, new_entity is used to create a new button that clears the grid. -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ + as Ruby code, and the placeholder is replaced with its corresponding value or result. +** Processing line: ~~ - Inside source: true *** True Line Result - (Remember, you can use state to define ANY property and it will be retained across frames.) + +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +- Inside source: true +*** True Line Result + - args.inputs.mouse.click: This property will be set if the mouse was clicked. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ +** Processing line: ~ - Ternary operator (?): Will evaluate a statement (just like an if statement)~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + - Ternary operator (?): Will evaluate a statement (just like an if statement) +** Processing line: ~ and perform an action if the result is true or another action if it is false.~ +- Inside source: true +*** True Line Result + and perform an action if the result is true or another action if it is false. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + - reject: Removes elements from a collection if they meet certain requirements. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values in the array generate a label.~ +** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values in the array generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + - args.outputs.borders: An array. The values generate a border. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +- Inside source: true +*** True Line Result + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ +- Inside source: true +*** True Line Result + For more information about labels, go to mygame/documentation/02-labels. ** Processing line: ~~ - Inside source: true *** True Line Result @@ -23697,58 +24156,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows an empty grid that the user can paint on.~ +** Processing line: ~ # This sample app is a classic game of Tic Tac Toe.~ - Inside source: true *** True Line Result - # This sample app shows an empty grid that the user can paint on. -** Processing line: ~ # To paint, the user must keep their mouse presssed and drag it around the grid.~ + # This sample app is a classic game of Tic Tac Toe. +** Processing line: ~~ - Inside source: true *** True Line Result - # To paint, the user must keep their mouse presssed and drag it around the grid. -** Processing line: ~ # The "clear" button allows users to clear the grid so they can start over.~ + +** Processing line: ~ class TicTacToe~ - Inside source: true *** True Line Result - # The "clear" button allows users to clear the grid so they can start over. -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ class PaintApp~ -- Inside source: true -*** True Line Result - class PaintApp -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ + class TicTacToe +** Processing line: ~ attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk~ - Inside source: true *** True Line Result - attr_accessor :inputs, :state, :outputs, :grid, :args + attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs methods necessary for the game to function properly.~ +** Processing line: ~ # Starts the game with player x's turn and creates an array (to_a) for space combinations.~ - Inside source: true *** True Line Result - # Runs methods necessary for the game to function properly. + # Starts the game with player x's turn and creates an array (to_a) for space combinations. +** Processing line: ~ # Calls methods necessary for the game to run properly.~ +- Inside source: true +*** True Line Result + # Calls methods necessary for the game to run properly. ** Processing line: ~ def tick~ - Inside source: true *** True Line Result def tick -** Processing line: ~ print_title~ +** Processing line: ~ state.current_turn ||= :x~ - Inside source: true *** True Line Result - print_title -** Processing line: ~ add_grid~ + state.current_turn ||= :x +** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ - Inside source: true *** True Line Result - add_grid -** Processing line: ~ check_click~ + state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a +** Processing line: ~ render_board~ - Inside source: true *** True Line Result - check_click -** Processing line: ~ draw_buttons~ + render_board +** Processing line: ~ input_board~ - Inside source: true *** True Line Result - draw_buttons + input_board ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23757,162 +24212,170 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Prints the title onto the screen by using a label.~ +** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ - Inside source: true *** True Line Result - # Prints the title onto the screen by using a label. -** Processing line: ~ # Also separates the title from the grid with a line as a horizontal separator.~ + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. +** Processing line: ~ def render_board~ - Inside source: true *** True Line Result - # Also separates the title from the grid with a line as a horizontal separator. -** Processing line: ~ def print_title~ + def render_board +** Processing line: ~ square_size = 80~ - Inside source: true *** True Line Result - def print_title -** Processing line: ~ args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ]~ + square_size = 80 +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] -** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280)~ + +** Processing line: ~ # Positions the game's board in the center of the screen.~ - Inside source: true *** True Line Result - outputs.lines << horizontal_separator(660, 0, 1280) -** Processing line: ~ end~ + # Positions the game's board in the center of the screen. +** Processing line: ~ # Try removing what follows grid.w_half or grid.h_half and see how the position changes!~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Try removing what follows grid.w_half or grid.h_half and see how the position changes! +** Processing line: ~ board_left = grid.w_half - square_size * 1.5~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ + board_left = grid.w_half - square_size * 1.5 +** Processing line: ~ board_top = grid.h_half - square_size * 1.5~ - Inside source: true *** True Line Result - # Sets the starting position, ending position, and color for the horizontal separator. -** Processing line: ~ # The starting and ending positions have the same y values.~ + board_top = grid.h_half - square_size * 1.5 +** Processing line: ~~ - Inside source: true *** True Line Result - # The starting and ending positions have the same y values. -** Processing line: ~ def horizontal_separator y, x, x2~ + +** Processing line: ~ # At first glance, the add(1) looks pretty trivial. But if you remove it,~ - Inside source: true *** True Line Result - def horizontal_separator y, x, x2 -** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ + # At first glance, the add(1) looks pretty trivial. But if you remove it, +** Processing line: ~ # you'll see that the positioning of the board would be skewed without it!~ - Inside source: true *** True Line Result - [x, y, x2, y, 150, 150, 150] -** Processing line: ~ end~ + # you'll see that the positioning of the board would be skewed without it! +** Processing line: ~ # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares +** Processing line: ~ # due to the change in board placement.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the starting position, ending position, and color for the vertical separator.~ + # due to the change in board placement. +** Processing line: ~ outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces~ - Inside source: true *** True Line Result - # Sets the starting position, ending position, and color for the vertical separator. -** Processing line: ~ # The starting and ending positions have the same x values.~ + outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces +** Processing line: ~ space.border ||= [~ - Inside source: true *** True Line Result - # The starting and ending positions have the same x values. -** Processing line: ~ def vertical_separator x, y, y2~ + space.border ||= [ +** Processing line: ~ board_left + x.add(1) * square_size, # space.border is initialized using this definition~ - Inside source: true *** True Line Result - def vertical_separator x, y, y2 -** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ + board_left + x.add(1) * square_size, # space.border is initialized using this definition +** Processing line: ~ board_top + y.add(1) * square_size,~ - Inside source: true *** True Line Result - [x, y, x, y2, 150, 150, 150] -** Processing line: ~ end~ + board_top + y.add(1) * square_size, +** Processing line: ~ square_size,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + square_size, +** Processing line: ~ square_size~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs a border and a grid containing empty squares onto the screen.~ + square_size +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # Outputs a border and a grid containing empty squares onto the screen. -** Processing line: ~ def add_grid~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - def add_grid + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the x, y, height, and width of the grid.~ +** Processing line: ~ # Again, the calculations ensure that the piece is placed in the center of the grid square.~ - Inside source: true *** True Line Result - # Sets the x, y, height, and width of the grid. -** Processing line: ~ # There are 31 horizontal lines and 31 vertical lines in the grid.~ + # Again, the calculations ensure that the piece is placed in the center of the grid square. +** Processing line: ~ # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center.~ - Inside source: true *** True Line Result - # There are 31 horizontal lines and 31 vertical lines in the grid. -** Processing line: ~ # Feel free to count them yourself before continuing!~ + # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. +** Processing line: ~ outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board~ - Inside source: true *** True Line Result - # Feel free to count them yourself before continuing! -** Processing line: ~ x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center~ + outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board +** Processing line: ~ label board_left + x.add(1) * square_size + square_size.fdiv(2),~ - Inside source: true *** True Line Result - x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center -** Processing line: ~ lines_h = 31~ + label board_left + x.add(1) * square_size + square_size.fdiv(2), +** Processing line: ~ board_top + y.add(1) * square_size + square_size - 20,~ - Inside source: true *** True Line Result - lines_h = 31 -** Processing line: ~ lines_v = 31~ + board_top + y.add(1) * square_size + square_size - 20, +** Processing line: ~ space.piece # text of label, either "x" or "o"~ - Inside source: true *** True Line Result - lines_v = 31 + space.piece # text of label, either "x" or "o" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets values for the grid's border, grid lines, and filled squares.~ +** Processing line: ~ # Uses a label to output whether x or o won, or if a draw occurred.~ - Inside source: true *** True Line Result - # Sets values for the grid's border, grid lines, and filled squares. -** Processing line: ~ # The filled_squares variable is initially set to an empty array.~ + # Uses a label to output whether x or o won, or if a draw occurred. +** Processing line: ~ # If the game is ongoing, a label shows whose turn it currently is.~ - Inside source: true *** True Line Result - # The filled_squares variable is initially set to an empty array. -** Processing line: ~ state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border~ + # If the game is ongoing, a label shows whose turn it currently is. +** Processing line: ~ outputs.labels << if state.x_won~ - Inside source: true *** True Line Result - state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border -** Processing line: ~ state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method~ + outputs.labels << if state.x_won +** Processing line: ~ label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top~ - Inside source: true *** True Line Result - state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method -** Processing line: ~ state.filled_squares ||= [] # there are no filled squares until the user fills them in~ + label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top +** Processing line: ~ elsif state.o_won~ - Inside source: true *** True Line Result - state.filled_squares ||= [] # there are no filled squares until the user fills them in -** Processing line: ~~ + elsif state.o_won +** Processing line: ~ label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs the grid lines, border, and filled squares onto the screen.~ + label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally +** Processing line: ~ elsif state.draw~ - Inside source: true *** True Line Result - # Outputs the grid lines, border, and filled squares onto the screen. -** Processing line: ~ outputs.lines.concat state.grid_lines~ + elsif state.draw +** Processing line: ~ label grid.w_half, grid.top - 80, "a draw"~ - Inside source: true *** True Line Result - outputs.lines.concat state.grid_lines -** Processing line: ~ outputs.borders << state.grid_border~ + label grid.w_half, grid.top - 80, "a draw" +** Processing line: ~ else # if no one won and the game is ongoing~ - Inside source: true *** True Line Result - outputs.borders << state.grid_border -** Processing line: ~ outputs.solids << state.filled_squares~ + else # if no one won and the game is ongoing +** Processing line: ~ label grid.w_half, grid.top - 80, "turn: #{state.current_turn}"~ - Inside source: true *** True Line Result - outputs.solids << state.filled_squares + label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -23921,86 +24384,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Draws the grid by adding in vertical and horizontal separators.~ -- Inside source: true -*** True Line Result - # Draws the grid by adding in vertical and horizontal separators. -** Processing line: ~ def draw_grid x, y, h, w, lines_h, lines_v~ +** Processing line: ~ # Calls the methods responsible for handling user input and determining the winner.~ - Inside source: true *** True Line Result - def draw_grid x, y, h, w, lines_h, lines_v -** Processing line: ~~ + # Calls the methods responsible for handling user input and determining the winner. +** Processing line: ~ # Does nothing unless the mouse is clicked.~ - Inside source: true *** True Line Result - -** Processing line: ~ # The grid starts off empty.~ + # Does nothing unless the mouse is clicked. +** Processing line: ~ def input_board~ - Inside source: true *** True Line Result - # The grid starts off empty. -** Processing line: ~ grid = []~ + def input_board +** Processing line: ~ return unless inputs.mouse.click~ - Inside source: true *** True Line Result - grid = [] -** Processing line: ~~ + return unless inputs.mouse.click +** Processing line: ~ input_place_piece~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calculates the placement and adds horizontal lines or separators into the grid.~ + input_place_piece +** Processing line: ~ input_restart_game~ - Inside source: true *** True Line Result - # Calculates the placement and adds horizontal lines or separators into the grid. -** Processing line: ~ curr_y = y # start at the bottom of the box~ + input_restart_game +** Processing line: ~ determine_winner~ - Inside source: true *** True Line Result - curr_y = y # start at the bottom of the box -** Processing line: ~ dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid~ + determine_winner +** Processing line: ~ end~ - Inside source: true *** True Line Result - dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid -** Processing line: ~ lines_h.times do~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - lines_h.times do -** Processing line: ~ curr_y += dist_y # increment curr_y by the distance between the horizontal lines~ + +** Processing line: ~ # Handles user input for placing pieces on the board.~ - Inside source: true *** True Line Result - curr_y += dist_y # increment curr_y by the distance between the horizontal lines -** Processing line: ~ grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid~ + # Handles user input for placing pieces on the board. +** Processing line: ~ def input_place_piece~ - Inside source: true *** True Line Result - grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid -** Processing line: ~ end~ + def input_place_piece +** Processing line: ~ return if state.game_over~ - Inside source: true *** True Line Result - end + return if state.game_over ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calculates the placement and adds vertical lines or separators into the grid.~ -- Inside source: true -*** True Line Result - # Calculates the placement and adds vertical lines or separators into the grid. -** Processing line: ~ curr_x = x # now start at the left of the box~ -- Inside source: true -*** True Line Result - curr_x = x # now start at the left of the box -** Processing line: ~ dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid~ +** Processing line: ~ # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already~ - Inside source: true *** True Line Result - dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid -** Processing line: ~ lines_v.times do~ + # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already +** Processing line: ~ # have a piece in it.~ - Inside source: true *** True Line Result - lines_v.times do -** Processing line: ~ curr_x += dist_x # increment curr_x by the distance between the vertical lines~ + # have a piece in it. +** Processing line: ~ __, __, space = all_spaces.find do |__, __, space|~ - Inside source: true *** True Line Result - curr_x += dist_x # increment curr_x by the distance between the vertical lines -** Processing line: ~ grid << vertical_separator(curr_x, y + 1, y + h) # add separator~ + __, __, space = all_spaces.find do |__, __, space| +** Processing line: ~ inputs.mouse.click.point.inside_rect?(space.border) && !space.piece~ - Inside source: true *** True Line Result - grid << vertical_separator(curr_x, y + 1, y + h) # add separator + inputs.mouse.click.point.inside_rect?(space.border) && !space.piece ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24009,30 +24460,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # paint_grid uses a hash to assign values to keys.~ -- Inside source: true -*** True Line Result - # paint_grid uses a hash to assign values to keys. -** Processing line: ~ state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h,~ +** Processing line: ~ # The piece that goes into the space belongs to the player whose turn it currently is.~ - Inside source: true *** True Line Result - state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, -** Processing line: ~ "lines_v" => lines_v, "dist_x" => dist_x,~ + # The piece that goes into the space belongs to the player whose turn it currently is. +** Processing line: ~ return unless space~ - Inside source: true *** True Line Result - "lines_v" => lines_v, "dist_x" => dist_x, -** Processing line: ~ "dist_y" => dist_y }~ + return unless space +** Processing line: ~ space.piece = state.current_turn~ - Inside source: true *** True Line Result - "dist_y" => dist_y } + space.piece = state.current_turn ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return grid~ +** Processing line: ~ # This ternary operator statement allows us to change the current player's turn.~ - Inside source: true *** True Line Result - return grid + # This ternary operator statement allows us to change the current player's turn. +** Processing line: ~ # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn.~ +- Inside source: true +*** True Line Result + # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. +** Processing line: ~ state.current_turn = state.current_turn == :x ? :o : :x~ +- Inside source: true +*** True Line Result + state.current_turn = state.current_turn == :x ? :o : :x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24041,222 +24496,222 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values.~ +** Processing line: ~ # Resets the game.~ - Inside source: true *** True Line Result - # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. -** Processing line: ~ # If the mouse is up, the user cannot drag the mouse.~ + # Resets the game. +** Processing line: ~ def input_restart_game~ - Inside source: true *** True Line Result - # If the mouse is up, the user cannot drag the mouse. -** Processing line: ~ def check_click~ + def input_restart_game +** Processing line: ~ return unless state.game_over~ - Inside source: true *** True Line Result - def check_click -** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ + return unless state.game_over +** Processing line: ~ gtk.reset~ - Inside source: true *** True Line Result - if inputs.mouse.down #is mouse up or down? -** Processing line: ~ state.mouse_held = true # mouse is being held down~ + gtk.reset +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.mouse_held = true # mouse is being held down -** Processing line: ~ elsif inputs.mouse.up # if mouse is up~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs.mouse.up # if mouse is up -** Processing line: ~ state.mouse_held = false # mouse is not being held down or dragged~ + +** Processing line: ~ # Checks if x or o won the game.~ - Inside source: true *** True Line Result - state.mouse_held = false # mouse is not being held down or dragged -** Processing line: ~ state.mouse_dragging = false~ + # Checks if x or o won the game. +** Processing line: ~ # If neither player wins and all nine squares are filled, a draw happens.~ - Inside source: true *** True Line Result - state.mouse_dragging = false -** Processing line: ~ end~ + # If neither player wins and all nine squares are filled, a draw happens. +** Processing line: ~ # Once a player is chosen as the winner or a draw happens, the game is over.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Once a player is chosen as the winner or a draw happens, the game is over. +** Processing line: ~ def determine_winner~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.mouse_held && # mouse needs to be down~ + def determine_winner +** Processing line: ~ state.x_won = won? :x # evaluates to either true or false (boolean values)~ - Inside source: true *** True Line Result - if state.mouse_held && # mouse needs to be down -** Processing line: ~ !inputs.mouse.click && # must not be first click~ + state.x_won = won? :x # evaluates to either true or false (boolean values) +** Processing line: ~ state.o_won = won? :o~ - Inside source: true *** True Line Result - !inputs.mouse.click && # must not be first click -** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag"~ + state.o_won = won? :o +** Processing line: ~ state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won~ - Inside source: true *** True Line Result - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" -** Processing line: ~ state.mouse_dragging = true~ + state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won +** Processing line: ~ state.game_over = state.x_won || state.o_won || state.draw~ - Inside source: true *** True Line Result - state.mouse_dragging = true -** Processing line: ~ end~ + state.game_over = state.x_won || state.o_won || state.draw +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type.~ +** Processing line: ~ # Determines if a player won by checking if there is a horizontal match or vertical match.~ - Inside source: true *** True Line Result - # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. -** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ + # Determines if a player won by checking if there is a horizontal match or vertical match. +** Processing line: ~ # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won.~ - Inside source: true *** True Line Result - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) -** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ + # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. +** Processing line: ~ def won? piece~ - Inside source: true *** True Line Result - search_lines(inputs.mouse.click.point, :click) + def won? piece +** Processing line: ~ # performs action on all space combinations~ +- Inside source: true +*** True Line Result + # performs action on all space combinations +** Processing line: ~ won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y|~ +- Inside source: true +*** True Line Result + won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type.~ +** Processing line: ~ # Checks if the 3 grid spaces with the same y value (or same row) and~ - Inside source: true *** True Line Result - # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. -** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ + # Checks if the 3 grid spaces with the same y value (or same row) and +** Processing line: ~ # x values that are next to each other have pieces that belong to the same player.~ - Inside source: true *** True Line Result - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) -** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ + # x values that are next to each other have pieces that belong to the same player. +** Processing line: ~ # Remember, the value of piece is equal to the current turn (which is the player).~ - Inside source: true *** True Line Result - search_lines(inputs.mouse.position, :drag) -** Processing line: ~ end~ + # Remember, the value of piece is equal to the current turn (which is the player). +** Processing line: ~ horizontal_match = state.spaces[xs[0]][y].piece == piece &&~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + horizontal_match = state.spaces[xs[0]][y].piece == piece && +** Processing line: ~ state.spaces[xs[1]][y].piece == piece &&~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.spaces[xs[1]][y].piece == piece && +** Processing line: ~ state.spaces[xs[2]][y].piece == piece~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the definition of a grid box and handles user input to fill in or clear grid boxes.~ + state.spaces[xs[2]][y].piece == piece +** Processing line: ~~ - Inside source: true *** True Line Result - # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. -** Processing line: ~ def search_lines (point, input_type)~ + +** Processing line: ~ # Checks if the 3 grid spaces with the same x value (or same column) and~ - Inside source: true *** True Line Result - def search_lines (point, input_type) -** Processing line: ~ point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash~ + # Checks if the 3 grid spaces with the same x value (or same column) and +** Processing line: ~ # y values that are next to each other have pieces that belong to the same player.~ - Inside source: true *** True Line Result - point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash -** Processing line: ~ point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash~ + # y values that are next to each other have pieces that belong to the same player. +** Processing line: ~ # The && represents an "and" statement: if even one part of the statement is false,~ - Inside source: true *** True Line Result - point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash -** Processing line: ~~ + # The && represents an "and" statement: if even one part of the statement is false, +** Processing line: ~ # the entire statement evaluates to false.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Remove code following the .floor and see what happens when you try to fill in grid squares~ + # the entire statement evaluates to false. +** Processing line: ~ vertical_match = state.spaces[y][xs[0]].piece == piece &&~ - Inside source: true *** True Line Result - # Remove code following the .floor and see what happens when you try to fill in grid squares -** Processing line: ~ point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"]~ + vertical_match = state.spaces[y][xs[0]].piece == piece && +** Processing line: ~ state.spaces[y][xs[1]].piece == piece &&~ - Inside source: true *** True Line Result - point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] -** Processing line: ~ point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"]~ + state.spaces[y][xs[1]].piece == piece && +** Processing line: ~ state.spaces[y][xs[2]].piece == piece~ - Inside source: true *** True Line Result - point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] + state.spaces[y][xs[2]].piece == piece ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ point.x += state.paint_grid["x"]~ +** Processing line: ~ horizontal_match || vertical_match # if either is true, true is returned~ - Inside source: true *** True Line Result - point.x += state.paint_grid["x"] -** Processing line: ~ point.y += state.paint_grid["y"]~ + horizontal_match || vertical_match # if either is true, true is returned +** Processing line: ~ end~ - Inside source: true *** True Line Result - point.y += state.paint_grid["y"] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets definition of a grid box, meaning its x, y, width, and height.~ -- Inside source: true -*** True Line Result - # Sets definition of a grid box, meaning its x, y, width, and height. -** Processing line: ~ # Floor is called on the point.x and point.y variables.~ -- Inside source: true -*** True Line Result - # Floor is called on the point.x and point.y variables. -** Processing line: ~ # Ceil method is called on values of the distance hash keys, setting the width and height of a box.~ +** Processing line: ~ # Sees if there is a diagonal match, starting from the bottom left and ending at the top right.~ - Inside source: true *** True Line Result - # Ceil method is called on values of the distance hash keys, setting the width and height of a box. -** Processing line: ~ grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ]~ + # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. +** Processing line: ~ # Is added to won regardless of whether the statement is true or false.~ - Inside source: true *** True Line Result - grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] -** Processing line: ~~ + # Is added to won regardless of whether the statement is true or false. +** Processing line: ~ won << (state.spaces[-1][-1].piece == piece && # bottom left~ - Inside source: true *** True Line Result - -** Processing line: ~ if input_type == :click # if user clicks their mouse~ + won << (state.spaces[-1][-1].piece == piece && # bottom left +** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ - Inside source: true *** True Line Result - if input_type == :click # if user clicks their mouse -** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ + state.spaces[ 0][ 0].piece == piece && # center +** Processing line: ~ state.spaces[ 1][ 1].piece == piece) # top right~ - Inside source: true *** True Line Result - if state.filled_squares.include? grid_box # if grid box is already filled in -** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ + state.spaces[ 1][ 1].piece == piece) # top right +** Processing line: ~~ - Inside source: true *** True Line Result - state.filled_squares.delete grid_box # box is cleared and removed from filled_squares -** Processing line: ~ else~ + +** Processing line: ~ # Sees if there is a diagonal match, starting at the bottom right and ending at the top left~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ + # Sees if there is a diagonal match, starting at the bottom right and ending at the top left +** Processing line: ~ # and is added to won.~ - Inside source: true *** True Line Result - state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares -** Processing line: ~ end~ + # and is added to won. +** Processing line: ~ won << (state.spaces[ 1][-1].piece == piece && # bottom right~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif input_type == :drag # if user drags mouse~ + won << (state.spaces[ 1][-1].piece == piece && # bottom right +** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ - Inside source: true *** True Line Result - elsif input_type == :drag # if user drags mouse -** Processing line: ~ unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in~ + state.spaces[ 0][ 0].piece == piece && # center +** Processing line: ~ state.spaces[-1][ 1].piece == piece) # top left~ - Inside source: true *** True Line Result - unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in -** Processing line: ~ state.filled_squares << grid_box # the box is filled in and added to filled_squares~ + state.spaces[-1][ 1].piece == piece) # top left +** Processing line: ~~ - Inside source: true *** True Line Result - state.filled_squares << grid_box # the box is filled in and added to filled_squares -** Processing line: ~ end~ + +** Processing line: ~ # Any false statements (meaning false diagonal matches) are rejected from won~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Any false statements (meaning false diagonal matches) are rejected from won +** Processing line: ~ won.reject_false.any?~ - Inside source: true *** True Line Result - end + won.reject_false.any? ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24265,118 +24720,130 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates and outputs a "Clear" button on the screen using a label and a border.~ +** Processing line: ~ # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them.~ - Inside source: true *** True Line Result - # Creates and outputs a "Clear" button on the screen using a label and a border. -** Processing line: ~ # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty.~ + # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. +** Processing line: ~ # The ! before a statement means "not". For example, we are rejecting any space combinations that do~ - Inside source: true *** True Line Result - # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. -** Processing line: ~ def draw_buttons~ + # The ! before a statement means "not". For example, we are rejecting any space combinations that do +** Processing line: ~ # NOT have pieces in them.~ - Inside source: true *** True Line Result - def draw_buttons -** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ + # NOT have pieces in them. +** Processing line: ~ def filled_spaces~ - Inside source: true *** True Line Result - x, y, w, h = 390, 50, 240, 50 -** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ + def filled_spaces +** Processing line: ~ state.space_combinations~ - Inside source: true *** True Line Result - state.clear_button ||= state.new_entity(:button_with_fade) -** Processing line: ~~ + state.space_combinations +** Processing line: ~ .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them~ - Inside source: true *** True Line Result - -** Processing line: ~ # The x and y positions are set to display the label in the center of the button.~ + .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them +** Processing line: ~ .map do |x, y|~ - Inside source: true *** True Line Result - # The x and y positions are set to display the label in the center of the button. -** Processing line: ~ # Try changing the first two parameters to simply x, y and see what happens to the text placement!~ + .map do |x, y| +** Processing line: ~ if block_given?~ - Inside source: true *** True Line Result - # Try changing the first two parameters to simply x, y and see what happens to the text placement! -** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border~ + if block_given? +** Processing line: ~ yield x, y, state.spaces[x][y]~ - Inside source: true *** True Line Result - state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border -** Processing line: ~ state.clear_button.border ||= [x, y, w, h]~ + yield x, y, state.spaces[x][y] +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.clear_button.border ||= [x, y, w, h] -** Processing line: ~~ + else +** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ - Inside source: true *** True Line Result - -** Processing line: ~ # If the mouse is clicked inside the borders of the clear button,~ + [x, y, state.spaces[x][y]] # sets definition of space +** Processing line: ~ end~ - Inside source: true *** True Line Result - # If the mouse is clicked inside the borders of the clear button, -** Processing line: ~ # the filled_squares collection is emptied and the squares are cleared.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # the filled_squares collection is emptied and the squares are cleared. -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) -** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred -** Processing line: ~ state.filled_squares.clear~ + +** Processing line: ~ # Defines all spaces on the board.~ - Inside source: true *** True Line Result - state.filled_squares.clear -** Processing line: ~ inputs.mouse.previous_click = nil~ + # Defines all spaces on the board. +** Processing line: ~ def all_spaces~ - Inside source: true *** True Line Result - inputs.mouse.previous_click = nil -** Processing line: ~ end~ + def all_spaces +** Processing line: ~ if !block_given?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if !block_given? +** Processing line: ~ state.space_combinations.map do |x, y|~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << state.clear_button.label~ + state.space_combinations.map do |x, y| +** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ - Inside source: true *** True Line Result - outputs.labels << state.clear_button.label -** Processing line: ~ outputs.borders << state.clear_button.border~ + [x, y, state.spaces[x][y]] # sets definition of space +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.borders << state.clear_button.border -** Processing line: ~~ + end +** Processing line: ~ else # if a block is given (block_given? is true)~ - Inside source: true *** True Line Result - -** Processing line: ~ # When the clear button is clicked, the color of the button changes~ + else # if a block is given (block_given? is true) +** Processing line: ~ state.space_combinations.map do |x, y|~ - Inside source: true *** True Line Result - # When the clear button is clicked, the color of the button changes -** Processing line: ~ # and the transparency changes, as well. If you change the time from~ + state.space_combinations.map do |x, y| +** Processing line: ~ yield x, y, state.spaces[x][y] # yield if a block is given~ - Inside source: true *** True Line Result - # and the transparency changes, as well. If you change the time from -** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ + yield x, y, state.spaces[x][y] # yield if a block is given +** Processing line: ~ end~ - Inside source: true *** True Line Result - # 0.25.seconds to 1.25.seconds or more, the change will last longer. -** Processing line: ~ if state.clear_button.clicked_at~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - if state.clear_button.clicked_at -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ # Sets values for a label, such as the position, value, size, alignment, and color.~ +- Inside source: true +*** True Line Result + # Sets values for a label, such as the position, value, size, alignment, and color. +** Processing line: ~ def label x, y, value~ +- Inside source: true +*** True Line Result + def label x, y, value +** Processing line: ~ [x, y + 10, value, 20, 1, 0, 0, 0]~ +- Inside source: true +*** True Line Result + [x, y + 10, value, 20, 1, 0, 0, 0] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24389,10 +24856,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $paint_app = PaintApp.new~ +** Processing line: ~ $tic_tac_toe = TicTacToe.new~ - Inside source: true *** True Line Result - $paint_app = PaintApp.new + $tic_tac_toe = TicTacToe.new ** Processing line: ~~ - Inside source: true *** True Line Result @@ -24401,34 +24868,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def tick args -** Processing line: ~ $paint_app.inputs = args.inputs~ +** Processing line: ~ $tic_tac_toe._ = args~ - Inside source: true *** True Line Result - $paint_app.inputs = args.inputs -** Processing line: ~ $paint_app.state = args.state~ + $tic_tac_toe._ = args +** Processing line: ~ $tic_tac_toe.state = args.state~ - Inside source: true *** True Line Result - $paint_app.state = args.state -** Processing line: ~ $paint_app.grid = args.grid~ + $tic_tac_toe.state = args.state +** Processing line: ~ $tic_tac_toe.outputs = args.outputs~ - Inside source: true *** True Line Result - $paint_app.grid = args.grid -** Processing line: ~ $paint_app.args = args~ + $tic_tac_toe.outputs = args.outputs +** Processing line: ~ $tic_tac_toe.inputs = args.inputs~ - Inside source: true *** True Line Result - $paint_app.args = args -** Processing line: ~ $paint_app.outputs = args.outputs~ + $tic_tac_toe.inputs = args.inputs +** Processing line: ~ $tic_tac_toe.grid = args.grid~ - Inside source: true *** True Line Result - $paint_app.outputs = args.outputs -** Processing line: ~ $paint_app.tick~ + $tic_tac_toe.grid = args.grid +** Processing line: ~ $tic_tac_toe.gtk = args.gtk~ - Inside source: true *** True Line Result - $paint_app.tick -** Processing line: ~ tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw."~ + $tic_tac_toe.gtk = args.gtk +** Processing line: ~ $tic_tac_toe.tick~ - Inside source: true *** True Line Result - tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." + $tic_tac_toe.tick +** Processing line: ~ tick_instructions args, "Sample app shows how to work with mouse clicks."~ +- Inside source: true +*** True Line Result + tick_instructions args, "Sample app shows how to work with mouse clicks." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24501,18 +24972,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 05_mouse/06_coordinate_systems/app/main.rb~ +** Processing line: ~* Mouse - Mouse Move - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 05_mouse/06_coordinate_systems/app/main.rb +* Mouse - Mouse Move - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/05_mouse/02_mouse_move/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/05_mouse/02_mouse_move/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -24521,294 +24996,286 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + Reminders: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen.~ -- Inside source: true -*** True Line Result - - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. -** Processing line: ~ Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for~ +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ - Inside source: true *** True Line Result - Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for -** Processing line: ~ position to know the mouse's coordinates.~ + - num1.greater(num2): Returns the greater value. +** Processing line: ~ For example, if we have the command~ - Inside source: true *** True Line Result - position to know the mouse's coordinates. -** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ + For example, if we have the command +** Processing line: ~ puts 4.greater(3)~ - Inside source: true *** True Line Result - For more information about the mouse, go to mygame/documentation/07-mouse.md. -** Processing line: ~~ + puts 4.greater(3) +** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + the number 4 would be printed to the console since it has a greater value than 3. +** Processing line: ~ Similar to lesser, which returns the lesser value.~ - Inside source: true *** True Line Result - Reminders: + Similar to lesser, which returns the lesser value. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ - Inside source: true *** True Line Result - - args.inputs.mouse.click: This property will be set if the mouse was clicked. -** Processing line: ~~ + - find_all: Finds all elements of a collection that meet certain requirements. +** Processing line: ~ For example, in this sample app, we're using find_all to find all zombies that have intersected~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ + For example, in this sample app, we're using find_all to find all zombies that have intersected +** Processing line: ~ or hit the player's sprite since these zombies have been killed.~ - Inside source: true *** True Line Result - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + or hit the player's sprite since these zombies have been killed. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed.~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. +** Processing line: ~ Stores the frame the "down" event occurred.~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + Stores the frame the "down" event occurred. +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +- Inside source: true +*** True Line Result + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ In this sample app, string interpolation is used to show the current position of the mouse~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ - Inside source: true *** True Line Result - In this sample app, string interpolation is used to show the current position of the mouse -** Processing line: ~ in a label.~ + - args.outputs.sprites: An array. The values generate a sprite. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - in a label. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +- Inside source: true +*** True Line Result + For more information about sprites, go to mygame/documentation/05-sprites.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array that generates a label.~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - - args.outputs.labels: An array that generates a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ When we want to create a new object, we can declare it as a new entity and then define~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + When we want to create a new object, we can declare it as a new entity and then define +** Processing line: ~ its properties. (Remember, you can use state to define ANY property and it will~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + its properties. (Remember, you can use state to define ANY property and it will +** Processing line: ~ be retained across frames.)~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.solids: An array that generates a solid.~ + be retained across frames.) +** Processing line: ~~ - Inside source: true *** True Line Result - - args.outputs.solids: An array that generates a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ + +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] -** Processing line: ~ 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 +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.lines: An array that generates a line.~ +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ - Inside source: true *** True Line Result - - args.outputs.lines: An array that generates a line. -** Processing line: ~ The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA]~ + - map: Ruby method used to transform data; used in arrays, hashes, and collections. +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ - Inside source: true *** True Line Result - The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ + Can be used to perform an action on every element of a collection, such as multiplying +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ - Inside source: true *** True Line Result - For more information about lines, go to mygame/documentation/04-lines.md. + each element by 2 or declaring every element as a new entity. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ - sample: Chooses a random element from the array.~ - Inside source: true *** True Line Result - =end + - sample: Chooses a random element from the array. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the~ +** Processing line: ~ - reject: Removes elements that meet certain requirements.~ - Inside source: true *** True Line Result - # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the -** Processing line: ~ # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or~ + - reject: Removes elements that meet certain requirements. +** Processing line: ~ In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also~ - Inside source: true *** True Line Result - # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or -** Processing line: ~ # four quadrants by pressing the button.~ + In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also +** Processing line: ~ rejecting zombies that were killed more than 30 frames ago.~ - Inside source: true *** True Line Result - # four quadrants by pressing the button. + rejecting zombies that were killed more than 30 frames ago. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - def tick args + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The addition and subtraction in the first two parameters of the label and solid~ -- Inside source: true -*** True Line Result - # The addition and subtraction in the first two parameters of the label and solid -** Processing line: ~ # ensure that the outputs don't overlap each other. Try removing them and see what happens.~ -- Inside source: true -*** True Line Result - # ensure that the outputs don't overlap each other. Try removing them and see what happens. -** Processing line: ~ pos = args.inputs.mouse.position # stores coordinates of mouse's position~ -- Inside source: true -*** True Line Result - pos = args.inputs.mouse.position # stores coordinates of mouse's position -** Processing line: ~ args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates~ +** Processing line: ~ # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal~ - Inside source: true *** True Line Result - args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates -** Processing line: ~ args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering~ + # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal +** Processing line: ~ # is to kill the zombies as fast as possible!~ - Inside source: true *** True Line Result - args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering + # is to kill the zombies as fast as possible! ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ button = [0, 0, 370, 50] # sets definition of toggle button~ +** Processing line: ~ class ProtectThePuppiesFromTheZombies~ - Inside source: true *** True Line Result - button = [0, 0, 370, 50] # sets definition of toggle button -** Processing line: ~ args.outputs.borders << button # outputs button as border (not filled in)~ + class ProtectThePuppiesFromTheZombies +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ - Inside source: true *** True Line Result - args.outputs.borders << button # outputs button as border (not filled in) -** Processing line: ~ args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button~ + attr_accessor :grid, :inputs, :state, :outputs +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button -** Processing line: ~ args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants~ + +** Processing line: ~ # Calls the methods necessary for the game to run properly.~ - Inside source: true *** True Line Result - args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants -** Processing line: ~ args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants~ + # Calls the methods necessary for the game to run properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants -** Processing line: ~~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.mouse.click # if the user clicks the mouse~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - if args.inputs.mouse.click # if the user clicks the mouse -** Processing line: ~ pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates)~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) -** Processing line: ~ if pos.inside_rect? button # if the click occurred inside the button~ + calc +** Processing line: ~ input~ - Inside source: true *** True Line Result - if pos.inside_rect? button # if the click occurred inside the button -** Processing line: ~ if args.grid.name == :bottom_left # if the grid shows bottom left as origin~ + input +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.grid.name == :bottom_left # if the grid shows bottom left as origin -** Processing line: ~ args.grid.origin_center! # origin will be shown in center~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.grid.origin_center! # origin will be shown in center -** Processing line: ~ else~ + +** Processing line: ~ # Sets default values for the zombies and for the player.~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin~ + # Sets default values for the zombies and for the player. +** Processing line: ~ # Initialization happens only in the first frame.~ - Inside source: true *** True Line Result - args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin -** Processing line: ~ end~ + # Initialization happens only in the first frame. +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def defaults +** Processing line: ~ state.flash_at ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.flash_at ||= 0 +** Processing line: ~ state.zombie_min_spawn_rate ||= 60~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.zombie_min_spawn_rate ||= 60 +** Processing line: ~ state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate~ - Inside source: true *** True Line Result - -** Processing line: ~ tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit."~ + state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate +** Processing line: ~ state.zombies ||= []~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." -** Processing line: ~ end~ + state.zombies ||= [] +** Processing line: ~ state.killed_zombies ||= []~ - Inside source: true *** True Line Result - end + state.killed_zombies ||= [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ # Declares player as a new entity and sets its properties.~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + # Declares player as a new entity and sets its properties. +** Processing line: ~ # The player begins the game in the center of the screen, not moving in any direction.~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + # The player begins the game in the center of the screen, not moving in any direction. +** Processing line: ~ state.player ||= state.new_entity(:player, { x: 640,~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + state.player ||= state.new_entity(:player, { x: 640, +** Processing line: ~ y: 360,~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + y: 360, +** Processing line: ~ attack_angle: 0,~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + attack_angle: 0, +** Processing line: ~ dx: 0,~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + dx: 0, +** Processing line: ~ dy: 0 })~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + dy: 0 }) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -24817,278 +25284,242 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ # Outputs a gray background.~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + # Outputs a gray background. +** Processing line: ~ # Calls the methods needed to output the player, zombies, etc onto the screen.~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + # Calls the methods needed to output the player, zombies, etc onto the screen. +** Processing line: ~ def render~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + def render +** Processing line: ~ outputs.solids << [grid.rect, 100, 100, 100]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.solids << [grid.rect, 100, 100, 100] +** Processing line: ~ render_zombies~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 06_save_load/10_save_load_game/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 06_save_load/10_save_load_game/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + render_zombies +** Processing line: ~ render_killed_zombies~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + render_killed_zombies +** Processing line: ~ render_player~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + render_player +** Processing line: ~ render_flash~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + render_flash +** Processing line: ~ end~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful~ +** Processing line: ~ # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation.~ - Inside source: true *** True Line Result - - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful -** Processing line: ~ because with a given symbol name, you can refer to the same object throughout~ + # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. +** Processing line: ~ def render_zombies~ - Inside source: true *** True Line Result - because with a given symbol name, you can refer to the same object throughout -** Processing line: ~ a Ruby program.~ + def render_zombies +** Processing line: ~ outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection~ - Inside source: true *** True Line Result - a Ruby program. -** Processing line: ~~ + outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection +** Processing line: ~ z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method~ - Inside source: true *** True Line Result - -** Processing line: ~ In this sample app, we're using symbols for our buttons. We have buttons that~ + z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method +** Processing line: ~ z.sprite~ - Inside source: true *** True Line Result - In this sample app, we're using symbols for our buttons. We have buttons that -** Processing line: ~ light fires, save, load, etc. Each of these buttons has a distinct symbol like~ + z.sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - light fires, save, load, etc. Each of these buttons has a distinct symbol like -** Processing line: ~ :light_fire, :save_game, :load_game, etc.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - :light_fire, :save_game, :load_game, etc. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - to_sym: Returns the symbol corresponding to the given string; creates the symbol~ +** Processing line: ~ # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.~ - Inside source: true *** True Line Result - - to_sym: Returns the symbol corresponding to the given string; creates the symbol -** Processing line: ~ if it does not already exist.~ + # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. +** Processing line: ~ def render_killed_zombies~ - Inside source: true *** True Line Result - if it does not already exist. -** Processing line: ~ For example,~ + def render_killed_zombies +** Processing line: ~ outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection~ - Inside source: true *** True Line Result - For example, -** Processing line: ~ 'car'.to_sym~ + outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection +** Processing line: ~ z.sprite = [z.x,~ - Inside source: true *** True Line Result - 'car'.to_sym -** Processing line: ~ would return the symbol :car.~ + z.sprite = [z.x, +** Processing line: ~ z.y,~ - Inside source: true *** True Line Result - would return the symbol :car. -** Processing line: ~~ + z.y, +** Processing line: ~ 4 * 3,~ - Inside source: true *** True Line Result - -** Processing line: ~ - last: Returns the last element of an array.~ + 4 * 3, +** Processing line: ~ 8 * 3,~ - Inside source: true *** True Line Result - - last: Returns the last element of an array. -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ Reminders:~ -- Inside source: true -*** True Line Result - Reminders: -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ - num1.lesser(num2): finds the lower value of the given options.~ -- Inside source: true -*** True Line Result - - num1.lesser(num2): finds the lower value of the given options. -** Processing line: ~ For example, in the statement~ + 8 * 3, +** Processing line: ~ animation_sprite(z, z.death_at), # calls animation_sprite method~ - Inside source: true *** True Line Result - For example, in the statement -** Processing line: ~ a = 4.lesser(3)~ + animation_sprite(z, z.death_at), # calls animation_sprite method +** Processing line: ~ 0, # angle~ - Inside source: true *** True Line Result - a = 4.lesser(3) -** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ + 0, # angle +** Processing line: ~ 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die~ - Inside source: true *** True Line Result - 3 has a lower value than 4, which means that the value of a would be set to 3, -** Processing line: ~ but if the statement had been~ + 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die +** Processing line: ~ # change the value of 30 and see what happens when a zombie is killed~ - Inside source: true *** True Line Result - but if the statement had been -** Processing line: ~ a = 4.lesser(5)~ + # change the value of 30 and see what happens when a zombie is killed +** Processing line: ~~ - Inside source: true *** True Line Result - a = 4.lesser(5) -** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ + +** Processing line: ~ # Sets values to output the slash over the zombie's sprite when a zombie is killed.~ - Inside source: true *** True Line Result - 4 has a lower value than 5, which means that the value of a would be set to 4. -** Processing line: ~~ + # Sets values to output the slash over the zombie's sprite when a zombie is killed. +** Processing line: ~ # The slash is tilted 45 degrees from the angle of the player's attack.~ - Inside source: true *** True Line Result - -** Processing line: ~ - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers.~ + # The slash is tilted 45 degrees from the angle of the player's attack. +** Processing line: ~ # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions~ - Inside source: true *** True Line Result - - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. -** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ + # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions +** Processing line: ~ # the slash over the killed zombie's sprite.~ - Inside source: true *** True Line Result - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 -** Processing line: ~~ + # the slash over the killed zombie's sprite. +** Processing line: ~ [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)]~ - Inside source: true *** True Line Result - -** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ + [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. Values generate a label.~ +** Processing line: ~ # Outputs the player sprite using the images in the sprites folder.~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. Values generate a label. -** Processing line: ~ Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # Outputs the player sprite using the images in the sprites folder. +** Processing line: ~ def render_player~ - Inside source: true *** True Line Result - Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information, go to mygame/documentation/02-labels.md.~ + def render_player +** Processing line: ~ state.player_sprite = [state.player.x,~ - Inside source: true *** True Line Result - For more information, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + state.player_sprite = [state.player.x, +** Processing line: ~ state.player.y,~ - Inside source: true *** True Line Result - -** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ + state.player.y, +** Processing line: ~ 4 * 3,~ - Inside source: true *** True Line Result - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array -** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ + 4 * 3, +** Processing line: ~ 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation~ - Inside source: true *** True Line Result - with at least four values is considered a rect. The inside_rect? function returns true -** Processing line: ~ or false depending on if the point is inside the rect.~ + 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation +** Processing line: ~ outputs.sprites << state.player_sprite~ - Inside source: true *** True Line Result - or false depending on if the point is inside the rect. + outputs.sprites << state.player_sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ -- Inside source: true -*** True Line Result - =end -** Processing line: ~~ +** Processing line: ~ # Outputs a small red square that previews the angles that the player can attack in.~ - Inside source: true *** True Line Result - -** Processing line: ~ # This code allows users to perform different tasks, such as saving and loading the game.~ + # Outputs a small red square that previews the angles that the player can attack in. +** Processing line: ~ # It can be moved in a perfect circle around the player to show possible movements.~ - Inside source: true *** True Line Result - # This code allows users to perform different tasks, such as saving and loading the game. -** Processing line: ~ # Users also have options to reset the game and light a fire.~ + # It can be moved in a perfect circle around the player to show possible movements. +** Processing line: ~ # Change the 60 in the parenthesis and see what happens to the movement of the red square.~ - Inside source: true *** True Line Result - # Users also have options to reset the game and light a fire. -** Processing line: ~~ + # Change the 60 in the parenthesis and see what happens to the movement of the red square. +** Processing line: ~ outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),~ - Inside source: true *** True Line Result - -** Processing line: ~ class TextedBasedGame~ + outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), +** Processing line: ~ state.player.y + state.player.attack_angle.vector_y(60),~ - Inside source: true *** True Line Result - class TextedBasedGame -** Processing line: ~~ + state.player.y + state.player.attack_angle.vector_y(60), +** Processing line: ~ 3, 3, 255, 0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Contains methods needed for game to run properly.~ + 3, 3, 255, 0, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Contains methods needed for game to run properly. -** Processing line: ~ # Increments tick count by 1 each time it runs (60 times in a single second)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Increments tick count by 1 each time it runs (60 times in a single second) -** Processing line: ~ def tick~ + +** Processing line: ~ # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed.~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ default~ + # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. +** Processing line: ~ def render_flash~ - Inside source: true *** True Line Result - default -** Processing line: ~ show_intro~ + def render_flash +** Processing line: ~ return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash.~ - Inside source: true *** True Line Result - show_intro -** Processing line: ~ state.engine_tick_count += 1~ + return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. +** Processing line: ~ # Transparency gradually changes (or eases) during the 10 frames of flash.~ - Inside source: true *** True Line Result - state.engine_tick_count += 1 -** Processing line: ~ tick_fire~ + # Transparency gradually changes (or eases) during the 10 frames of flash. +** Processing line: ~ outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid~ - Inside source: true *** True Line Result - tick_fire + outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25097,46 +25528,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values.~ -- Inside source: true -*** True Line Result - # Sets default values. -** Processing line: ~ # The ||= ensures that a variable's value is only set to the value following the = sign~ -- Inside source: true -*** True Line Result - # The ||= ensures that a variable's value is only set to the value following the = sign -** Processing line: ~ # if the value has not already been set before. Intialization happens only in the first frame.~ -- Inside source: true -*** True Line Result - # if the value has not already been set before. Intialization happens only in the first frame. -** Processing line: ~ def default~ -- Inside source: true -*** True Line Result - def default -** Processing line: ~ state.engine_tick_count ||= 0~ +** Processing line: ~ # Calls all methods necessary for performing calculations.~ - Inside source: true *** True Line Result - state.engine_tick_count ||= 0 -** Processing line: ~ state.active_module ||= :room~ + # Calls all methods necessary for performing calculations. +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - state.active_module ||= :room -** Processing line: ~ state.fire_progress ||= 0~ + def calc +** Processing line: ~ calc_spawn_zombie~ - Inside source: true *** True Line Result - state.fire_progress ||= 0 -** Processing line: ~ state.fire_ready_in ||= 10~ + calc_spawn_zombie +** Processing line: ~ calc_move_zombies~ - Inside source: true *** True Line Result - state.fire_ready_in ||= 10 -** Processing line: ~ state.previous_fire ||= :dead~ + calc_move_zombies +** Processing line: ~ calc_player~ - Inside source: true *** True Line Result - state.previous_fire ||= :dead -** Processing line: ~ state.fire ||= :dead~ + calc_player +** Processing line: ~ calc_kill_zombie~ - Inside source: true *** True Line Result - state.fire ||= :dead + calc_kill_zombie ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25145,98 +25560,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def show_intro~ +** Processing line: ~ # Decreases the zombie spawn countdown by 1 if it has a value greater than 0.~ - Inside source: true *** True Line Result - def show_intro -** Processing line: ~ return unless state.engine_tick_count == 0 # return unless the game just started~ + # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. +** Processing line: ~ def calc_spawn_zombie~ - Inside source: true *** True Line Result - return unless state.engine_tick_count == 0 # return unless the game just started -** Processing line: ~ set_story_line "awake." # calls set_story_line method, sets to "awake"~ + def calc_spawn_zombie +** Processing line: ~ if state.zombie_spawn_countdown > 0~ - Inside source: true *** True Line Result - set_story_line "awake." # calls set_story_line method, sets to "awake" -** Processing line: ~ end~ + if state.zombie_spawn_countdown > 0 +** Processing line: ~ state.zombie_spawn_countdown -= 1~ - Inside source: true *** True Line Result - end + state.zombie_spawn_countdown -= 1 +** Processing line: ~ return~ +- Inside source: true +*** True Line Result + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets story line.~ +** Processing line: ~ # New zombies are created, positioned on the screen, and added to the zombies collection.~ - Inside source: true *** True Line Result - # Sets story line. -** Processing line: ~ def set_story_line story_line~ + # New zombies are created, positioned on the screen, and added to the zombies collection. +** Processing line: ~ state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity~ - Inside source: true *** True Line Result - def set_story_line story_line -** Processing line: ~ state.story_line = story_line # story line set to value of parameter~ + state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity +** Processing line: ~ if rand > 0.5~ - Inside source: true *** True Line Result - state.story_line = story_line # story line set to value of parameter -** Processing line: ~ state.active_module = :alert # active module set to alert~ + if rand > 0.5 +** Processing line: ~ z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope)~ - Inside source: true *** True Line Result - state.active_module = :alert # active module set to alert -** Processing line: ~ end~ + z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) +** Processing line: ~ z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) +** Processing line: ~ # the possible values exceed the screen's scope so zombies appear to be coming from far away~ - Inside source: true *** True Line Result - -** Processing line: ~ # Clears story line.~ + # the possible values exceed the screen's scope so zombies appear to be coming from far away +** Processing line: ~ else~ - Inside source: true *** True Line Result - # Clears story line. -** Processing line: ~ def clear_storyline~ + else +** Processing line: ~ z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen)~ - Inside source: true *** True Line Result - def clear_storyline -** Processing line: ~ state.active_module = :none # active module set to none~ + z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) +** Processing line: ~ z.y = grid.rect.w.randomize(:ratio) # random y position on screen~ - Inside source: true *** True Line Result - state.active_module = :none # active module set to none -** Processing line: ~ state.story_line = nil # story line is cleared, set to nil (or empty)~ + z.y = grid.rect.w.randomize(:ratio) # random y position on screen +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.story_line = nil # story line is cleared, set to nil (or empty) -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Determines fire progress (how close the fire is to being ready to light).~ -- Inside source: true -*** True Line Result - # Determines fire progress (how close the fire is to being ready to light). -** Processing line: ~ def tick_fire~ +** Processing line: ~ # Calls random_spawn_countdown method (determines how fast new zombies appear)~ - Inside source: true *** True Line Result - def tick_fire -** Processing line: ~ return if state.active_module == :alert # return if active module is alert~ + # Calls random_spawn_countdown method (determines how fast new zombies appear) +** Processing line: ~ state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate~ - Inside source: true *** True Line Result - return if state.active_module == :alert # return if active module is alert -** Processing line: ~ state.fire_progress += 1 # increment fire progress~ + state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate +** Processing line: ~ state.zombie_min_spawn_rate -= 1~ - Inside source: true *** True Line Result - state.fire_progress += 1 # increment fire progress -** Processing line: ~ # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value.~ + state.zombie_min_spawn_rate -= 1 +** Processing line: ~ # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater~ - Inside source: true *** True Line Result - # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. -** Processing line: ~ state.fire_progress = state.fire_progress.lesser(state.fire_ready_in)~ + # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater +** Processing line: ~ state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0)~ - Inside source: true *** True Line Result - state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) + state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25245,42 +25664,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets the value of fire (whether it is dead or roaring), and the story line~ -- Inside source: true -*** True Line Result - # Sets the value of fire (whether it is dead or roaring), and the story line -** Processing line: ~ def light_fire~ -- Inside source: true -*** True Line Result - def light_fire -** Processing line: ~ return unless fire_ready? # returns unless the fire is ready to be lit~ +** Processing line: ~ # Moves all zombies towards the center of the screen.~ - Inside source: true *** True Line Result - return unless fire_ready? # returns unless the fire is ready to be lit -** Processing line: ~ state.fire = :roaring # fire is lit, set to roaring~ + # Moves all zombies towards the center of the screen. +** Processing line: ~ # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear.~ - Inside source: true *** True Line Result - state.fire = :roaring # fire is lit, set to roaring -** Processing line: ~ state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit~ + # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. +** Processing line: ~ def calc_move_zombies~ - Inside source: true *** True Line Result - state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit -** Processing line: ~ if state.fire != state.previous_fire~ + def calc_move_zombies +** Processing line: ~ state.zombies.each do |z| # for each zombie in the collection~ - Inside source: true *** True Line Result - if state.fire != state.previous_fire -** Processing line: ~ set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation~ + state.zombies.each do |z| # for each zombie in the collection +** Processing line: ~ z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1~ - Inside source: true *** True Line Result - set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation -** Processing line: ~ state.previous_fire = state.fire~ + z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 +** Processing line: ~ z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center~ - Inside source: true *** True Line Result - state.previous_fire = state.fire + z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center~ +- Inside source: true +*** True Line Result + state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25289,50 +25704,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Checks if the fire is ready to be lit. Returns a boolean value.~ +** Processing line: ~ # Calculates the position and movement of the player on the screen.~ - Inside source: true *** True Line Result - # Checks if the fire is ready to be lit. Returns a boolean value. -** Processing line: ~ def fire_ready?~ + # Calculates the position and movement of the player on the screen. +** Processing line: ~ def calc_player~ - Inside source: true *** True Line Result - def fire_ready? -** Processing line: ~ # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10),~ + def calc_player +** Processing line: ~ state.player.x += state.player.dx # changes x based on dx (change in x)~ - Inside source: true *** True Line Result - # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), -** Processing line: ~ # the fire is ready to be lit.~ + state.player.x += state.player.dx # changes x based on dx (change in x) +** Processing line: ~ state.player.y += state.player.dy # changes y based on dy (change in y)~ - Inside source: true *** True Line Result - # the fire is ready to be lit. -** Processing line: ~ state.fire_progress == state.fire_ready_in~ + state.player.y += state.player.dy # changes y based on dy (change in y) +** Processing line: ~~ - Inside source: true *** True Line Result - state.fire_progress == state.fire_ready_in -** Processing line: ~ end~ + +** Processing line: ~ state.player.dx *= 0.9 # scales dx down~ - Inside source: true *** True Line Result - end + state.player.dx *= 0.9 # scales dx down +** Processing line: ~ state.player.dy *= 0.9 # scales dy down~ +- Inside source: true +*** True Line Result + state.player.dy *= 0.9 # scales dy down ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Divides the value of the fire_progress variable by 10 to determine how close the user is to~ +** Processing line: ~ # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value.~ - Inside source: true *** True Line Result - # Divides the value of the fire_progress variable by 10 to determine how close the user is to -** Processing line: ~ # being able to light a fire.~ + # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. +** Processing line: ~ # This ensures that the player remains within the screen's scope.~ - Inside source: true *** True Line Result - # being able to light a fire. -** Processing line: ~ def light_fire_progress~ + # This ensures that the player remains within the screen's scope. +** Processing line: ~ state.player.x = state.player.x.lesser(1280).greater(0)~ - Inside source: true *** True Line Result - def light_fire_progress -** Processing line: ~ state.fire_progress.fdiv(10) # float division~ + state.player.x = state.player.x.lesser(1280).greater(0) +** Processing line: ~ state.player.y = state.player.y.lesser(720).greater(0) # same with player's y~ - Inside source: true *** True Line Result - state.fire_progress.fdiv(10) # float division + state.player.y = state.player.y.lesser(720).greater(0) # same with player's y ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25341,102 +25760,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Defines fire as the state.fire variable.~ -- Inside source: true -*** True Line Result - # Defines fire as the state.fire variable. -** Processing line: ~ def fire~ +** Processing line: ~ # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection~ - Inside source: true *** True Line Result - def fire -** Processing line: ~ state.fire~ + # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection +** Processing line: ~ # and added to the killed_zombies collection since any zombie that intersects with the player is killed.~ - Inside source: true *** True Line Result - state.fire -** Processing line: ~ end~ + # and added to the killed_zombies collection since any zombie that intersects with the player is killed. +** Processing line: ~ def calc_kill_zombie~ - Inside source: true *** True Line Result - end + def calc_kill_zombie ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the title of the room.~ -- Inside source: true -*** True Line Result - # Sets the title of the room. -** Processing line: ~ def room_title~ +** Processing line: ~ # Find all zombies that intersect with the player. They are considered killed.~ - Inside source: true *** True Line Result - def room_title -** Processing line: ~ return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead~ + # Find all zombies that intersect with the player. They are considered killed. +** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ - Inside source: true *** True Line Result - return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead -** Processing line: ~ return "a room that is lit" # room is lit if the fire is not dead~ + killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } +** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ - Inside source: true *** True Line Result - return "a room that is lit" # room is lit if the fire is not dead -** Processing line: ~ end~ + state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection +** Processing line: ~ state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies~ - Inside source: true *** True Line Result - end + state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the active_module to room.~ +** Processing line: ~ if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame~ - Inside source: true *** True Line Result - # Sets the active_module to room. -** Processing line: ~ def go_to_room~ + if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame +** Processing line: ~ state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed~ - Inside source: true *** True Line Result - def go_to_room -** Processing line: ~ state.active_module = :room~ + state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed +** Processing line: ~ # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method)~ - Inside source: true *** True Line Result - state.active_module = :room -** Processing line: ~ end~ + # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Defines active_module as the state.active_module variable.~ +** Processing line: ~ # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie.~ - Inside source: true *** True Line Result - # Defines active_module as the state.active_module variable. -** Processing line: ~ def active_module~ + # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. +** Processing line: ~ # Death_at stores the frame a zombie was killed.~ - Inside source: true *** True Line Result - def active_module -** Processing line: ~ state.active_module~ + # Death_at stores the frame a zombie was killed. +** Processing line: ~ killed_this_frame.each do |z|~ - Inside source: true *** True Line Result - state.active_module -** Processing line: ~ end~ + killed_this_frame.each do |z| +** Processing line: ~ z.death_at = state.tick_count~ - Inside source: true *** True Line Result - end + z.death_at = state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Defines story_line as the state.story_line variable.~ +** Processing line: ~ # Zombies are rejected from the killed_zombies collection depending on when they were killed.~ - Inside source: true *** True Line Result - # Defines story_line as the state.story_line variable. -** Processing line: ~ def story_line~ + # Zombies are rejected from the killed_zombies collection depending on when they were killed. +** Processing line: ~ # They are rejected if more than 30 frames have passed since their death.~ - Inside source: true *** True Line Result - def story_line -** Processing line: ~ state.story_line~ + # They are rejected if more than 30 frames have passed since their death. +** Processing line: ~ state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 }~ - Inside source: true *** True Line Result - state.story_line + state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25445,198 +25860,182 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Update every 60 frames (or every second)~ +** Processing line: ~ # Uses input from the user to move the player around the screen.~ - Inside source: true *** True Line Result - # Update every 60 frames (or every second) -** Processing line: ~ def should_tick?~ + # Uses input from the user to move the player around the screen. +** Processing line: ~ def input~ - Inside source: true *** True Line Result - def should_tick? -** Processing line: ~ state.tick_count.mod_zero?(60)~ + def input +** Processing line: ~~ - Inside source: true *** True Line Result - state.tick_count.mod_zero?(60) -** Processing line: ~ end~ + +** Processing line: ~ # If the "a" key or left key is pressed, the x position of the player decreases.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # If the "a" key or left key is pressed, the x position of the player decreases. +** Processing line: ~ # Otherwise, if the "d" key or right key is pressed, the x position of the player increases.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the value of the game state provider.~ + # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. +** Processing line: ~ if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left~ - Inside source: true *** True Line Result - # Sets the value of the game state provider. -** Processing line: ~ def initialize game_state_provider~ + if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left +** Processing line: ~ state.player.x -= 5~ - Inside source: true *** True Line Result - def initialize game_state_provider -** Processing line: ~ @game_state_provider = game_state_provider~ + state.player.x -= 5 +** Processing line: ~ elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right~ - Inside source: true *** True Line Result - @game_state_provider = game_state_provider -** Processing line: ~ end~ + elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right +** Processing line: ~ state.player.x += 5~ - Inside source: true *** True Line Result - end + state.player.x += 5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Defines the game state.~ +** Processing line: ~ # If the "w" or up key is pressed, the y position of the player increases.~ - Inside source: true *** True Line Result - # Defines the game state. -** Processing line: ~ # Any variable prefixed with an @ symbol is an instance variable.~ + # If the "w" or up key is pressed, the y position of the player increases. +** Processing line: ~ # Otherwise, if the "s" or down key is pressed, the y position of the player decreases.~ - Inside source: true *** True Line Result - # Any variable prefixed with an @ symbol is an instance variable. -** Processing line: ~ def state~ + # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. +** Processing line: ~ if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up~ - Inside source: true *** True Line Result - def state -** Processing line: ~ @game_state_provider.state~ + if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up +** Processing line: ~ state.player.y += 5~ - Inside source: true *** True Line Result - @game_state_provider.state -** Processing line: ~ end~ + state.player.y += 5 +** Processing line: ~ elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down +** Processing line: ~ state.player.y -= 5~ - Inside source: true *** True Line Result - -** Processing line: ~ # Saves the state of the game in a text file called game_state.txt.~ + state.player.y -= 5 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Saves the state of the game in a text file called game_state.txt. -** Processing line: ~ def save~ -- Inside source: true -*** True Line Result - def save -** Processing line: ~ $gtk.serialize_state('game_state.txt', state)~ -- Inside source: true -*** True Line Result - $gtk.serialize_state('game_state.txt', state) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Loads the game state from the game_state.txt text file.~ -- Inside source: true -*** True Line Result - # Loads the game state from the game_state.txt text file. -** Processing line: ~ # If the load is unsuccessful, the user is informed since the story line indicates the failure.~ +** Processing line: ~ # Sets the attack angle so the player can move and attack in the precise direction it wants to go.~ - Inside source: true *** True Line Result - # If the load is unsuccessful, the user is informed since the story line indicates the failure. -** Processing line: ~ def load~ + # Sets the attack angle so the player can move and attack in the precise direction it wants to go. +** Processing line: ~ # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position).~ - Inside source: true *** True Line Result - def load -** Processing line: ~ parsed_state = $gtk.deserialize_state('game_state.txt')~ + # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). +** Processing line: ~ # Attack angle also contributes to the position of red square.~ - Inside source: true *** True Line Result - parsed_state = $gtk.deserialize_state('game_state.txt') -** Processing line: ~ if !parsed_state~ + # Attack angle also contributes to the position of red square. +** Processing line: ~ if inputs.mouse.moved~ - Inside source: true *** True Line Result - if !parsed_state -** Processing line: ~ set_story_line "no game to load. press save first."~ + if inputs.mouse.moved +** Processing line: ~ state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ - Inside source: true *** True Line Result - set_story_line "no game to load. press save first." -** Processing line: ~ else~ + state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] +** Processing line: ~ end~ - Inside source: true *** True Line Result - else -** Processing line: ~ $gtk.args.state = parsed_state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $gtk.args.state = parsed_state -** Processing line: ~ end~ + +** Processing line: ~ if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 +** Processing line: ~ state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] +** Processing line: ~ state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set~ - Inside source: true *** True Line Result - -** Processing line: ~ # Resets the game.~ + state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set +** Processing line: ~ state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position~ - Inside source: true *** True Line Result - # Resets the game. -** Processing line: ~ def reset~ + state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position +** Processing line: ~ state.player.dy = state.player.attack_angle.vector_y(25)~ - Inside source: true *** True Line Result - def reset -** Processing line: ~ $gtk.reset~ + state.player.dy = state.player.attack_angle.vector_y(25) +** Processing line: ~ end~ - Inside source: true *** True Line Result - $gtk.reset + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class TextedBasedGamePresenter~ +** Processing line: ~ # Sets the zombie spawn's countdown to a random number.~ - Inside source: true *** True Line Result - class TextedBasedGamePresenter -** Processing line: ~ attr_accessor :state, :outputs, :inputs~ + # Sets the zombie spawn's countdown to a random number. +** Processing line: ~ # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!)~ - Inside source: true *** True Line Result - attr_accessor :state, :outputs, :inputs -** Processing line: ~~ + # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) +** Processing line: ~ def random_spawn_countdown minimum~ - Inside source: true *** True Line Result - -** Processing line: ~ # Creates empty collection called highlights.~ + def random_spawn_countdown minimum +** Processing line: ~ 10.randomize(:ratio, :sign).to_i + 60~ - Inside source: true *** True Line Result - # Creates empty collection called highlights. -** Processing line: ~ # Calls methods necessary to run the game.~ + 10.randomize(:ratio, :sign).to_i + 60 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Calls methods necessary to run the game. -** Processing line: ~ def tick~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ state.layout.highlights ||= []~ + +** Processing line: ~ # Helps to iterate through the images in the sprites folder by setting the animation index.~ - Inside source: true *** True Line Result - state.layout.highlights ||= [] -** Processing line: ~ game.tick if game.should_tick?~ + # Helps to iterate through the images in the sprites folder by setting the animation index. +** Processing line: ~ # 3 frames is how long to show an image, and 6 is how many images to flip through.~ - Inside source: true *** True Line Result - game.tick if game.should_tick? -** Processing line: ~ render~ + # 3 frames is how long to show an image, and 6 is how many images to flip through. +** Processing line: ~ def animation_index at~ - Inside source: true *** True Line Result - render -** Processing line: ~ process_input~ + def animation_index at +** Processing line: ~ at.idiv(3).mod(6)~ - Inside source: true *** True Line Result - process_input + at.idiv(3).mod(6) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25645,122 +26044,110 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs a label of the tick count (passage of time) and calls all render methods.~ -- Inside source: true -*** True Line Result - # Outputs a label of the tick count (passage of time) and calls all render methods. -** Processing line: ~ def render~ +** Processing line: ~ # Animates the zombies by using the animation index to go through the images in the sprites folder.~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.labels << [10, 30, state.tick_count]~ + # Animates the zombies by using the animation index to go through the images in the sprites folder. +** Processing line: ~ def animation_sprite zombie, at = nil~ - Inside source: true *** True Line Result - outputs.labels << [10, 30, state.tick_count] -** Processing line: ~ render_alert~ + def animation_sprite zombie, at = nil +** Processing line: ~ at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created~ - Inside source: true *** True Line Result - render_alert -** Processing line: ~ render_room~ + at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created +** Processing line: ~ index = animation_index at~ - Inside source: true *** True Line Result - render_room -** Processing line: ~ render_highlights~ + index = animation_index at +** Processing line: ~ "sprites/zombie-#{index}.png" # string interpolation to iterate through images~ - Inside source: true *** True Line Result - render_highlights + "sprites/zombie-#{index}.png" # string interpolation to iterate through images ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # Outputs a label onto the screen that shows the story line, and also outputs a "close" button.~ -- Inside source: true -*** True Line Result - # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. -** Processing line: ~ def render_alert~ -- Inside source: true -*** True Line Result - def render_alert -** Processing line: ~ return unless game.active_module == :alert~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - return unless game.active_module == :alert + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label~ +** Processing line: ~ $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new~ - Inside source: true *** True Line Result - outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label -** Processing line: ~ outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line~ + $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line -** Processing line: ~ end~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def tick args +** Processing line: ~ $protect_the_puppies_from_the_zombies.grid = args.grid~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_room~ + $protect_the_puppies_from_the_zombies.grid = args.grid +** Processing line: ~ $protect_the_puppies_from_the_zombies.inputs = args.inputs~ - Inside source: true *** True Line Result - def render_room -** Processing line: ~ return unless game.active_module == :room~ + $protect_the_puppies_from_the_zombies.inputs = args.inputs +** Processing line: ~ $protect_the_puppies_from_the_zombies.state = args.state~ - Inside source: true *** True Line Result - return unless game.active_module == :room -** Processing line: ~ outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen~ + $protect_the_puppies_from_the_zombies.state = args.state +** Processing line: ~ $protect_the_puppies_from_the_zombies.outputs = args.outputs~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen -** Processing line: ~~ + $protect_the_puppies_from_the_zombies.outputs = args.outputs +** Processing line: ~ $protect_the_puppies_from_the_zombies.tick~ - Inside source: true *** True Line Result - -** Processing line: ~ # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value~ + $protect_the_puppies_from_the_zombies.tick +** Processing line: ~ tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play."~ - Inside source: true *** True Line Result - # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value -** Processing line: ~ # that positions it 60 pixels lower than the previous output.~ + tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # that positions it 60 pixels lower than the previous output. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance)~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) -** Processing line: ~ outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress)~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) -** Processing line: ~ outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button -** Processing line: ~ outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button -** Processing line: ~ outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button -** Processing line: ~ outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -25769,306 +26156,322 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. -** Processing line: ~ def render_highlights~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - def render_highlights -** Processing line: ~ state.layout.highlights.each do |h| # for each highlight in the collection~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - state.layout.highlights.each do |h| # for each highlight in the collection -** Processing line: ~ h.lifetime -= 1 # decrease the value of its lifetime~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - h.lifetime -= 1 # decrease the value of its lifetime -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection~ -- Inside source: true +** Processing line: ~* Mouse - Mouse Move Paint App - main.rb~ +- Header detected. *** True Line Result - outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection -** Processing line: ~ [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight~ -- Inside source: true + *** True Line Result - [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight -** Processing line: ~ # transparency changes; divide lifetime by max_lifetime, multiply result by 255~ +* Mouse - Mouse Move Paint App - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb~ - Inside source: true *** True Line Result - # transparency changes; divide lifetime by max_lifetime, multiply result by 255 -** Processing line: ~ end~ + # ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # reject highlights from collection that have no remaining lifetime~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - # reject highlights from collection that have no remaining lifetime -** Processing line: ~ state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 }~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } -** Processing line: ~ end~ + +** Processing line: ~ - Floor: Method that returns an integer number smaller than or equal to the original with no decimal.~ - Inside source: true *** True Line Result - end + - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks whether or not a button was clicked.~ +** Processing line: ~ For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this...~ - Inside source: true *** True Line Result - # Checks whether or not a button was clicked. -** Processing line: ~ # Returns a boolean value.~ + For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... +** Processing line: ~ puts a.floor()~ - Inside source: true *** True Line Result - # Returns a boolean value. -** Processing line: ~ def process_input~ + puts a.floor() +** Processing line: ~ which would print out 13.~ - Inside source: true *** True Line Result - def process_input -** Processing line: ~ button = button_clicked? # calls button_clicked? method~ + which would print out 13. +** Processing line: ~ (There is also a ceil method, which returns an integer number greater than or equal to the original~ - Inside source: true *** True Line Result - button = button_clicked? # calls button_clicked? method -** Processing line: ~ end~ + (There is also a ceil method, which returns an integer number greater than or equal to the original +** Processing line: ~ with no decimal. If we had called ceil on the variable a, the result would have been 14.)~ - Inside source: true *** True Line Result - end + with no decimal. If we had called ceil on the variable a, the result would have been 14.) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns a boolean value.~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - # Returns a boolean value. -** Processing line: ~ # Finds the button that was clicked from the button list and determines what method to call.~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - # Finds the button that was clicked from the button list and determines what method to call. -** Processing line: ~ # Adds a highlight to the highlights collection.~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ - Inside source: true *** True Line Result - # Adds a highlight to the highlights collection. -** Processing line: ~ def button_clicked?~ + - Hashes: Collection of unique keys and their corresponding values. The value can be found +** Processing line: ~ using their keys.~ - Inside source: true *** True Line Result - def button_clicked? -** Processing line: ~ return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click~ + using their keys. +** Processing line: ~~ - Inside source: true *** True Line Result - return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click -** Processing line: ~ button = @button_list.find do |k, v| # goes through button_list to find button clicked~ + +** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ - Inside source: true *** True Line Result - button = @button_list.find do |k, v| # goes through button_list to find button clicked -** Processing line: ~ click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button?~ + For example, if we have a "numbers" hash that stores numbers in English as the +** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ - Inside source: true *** True Line Result - click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? -** Processing line: ~ end~ + key and numbers in Spanish as the value, we'd have a hash that looks like this... +** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ - Inside source: true *** True Line Result - end -** Processing line: ~ return unless button # return unless a button was clicked~ + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } +** Processing line: ~ and on it goes.~ - Inside source: true *** True Line Result - return unless button # return unless a button was clicked -** Processing line: ~ method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game)~ + and on it goes. +** Processing line: ~~ - Inside source: true *** True Line Result - method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) -** Processing line: ~ if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists)~ + +** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ - Inside source: true *** True Line Result - if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) -** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in button list hash~ + Now if we wanted to find the corresponding value of the "one" key, we could say +** Processing line: ~ puts numbers["one"]~ - Inside source: true *** True Line Result - border = button[1][:primitives].last # sets border definition using value of last key in button list hash + puts numbers["one"] +** Processing line: ~ which would print "uno" to the console.~ +- Inside source: true +*** True Line Result + which would print "uno" to the console. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # declares each highlight as a new entity, sets properties~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - # declares each highlight as a new entity, sets properties -** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ - Inside source: true *** True Line Result - state.layout.highlights << state.new_entity(:highlight) do |h| -** Processing line: ~ h.x = border.x~ + In this sample app, new_entity is used to create a new button that clears the grid. +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ - Inside source: true *** True Line Result - h.x = border.x -** Processing line: ~ h.y = border.y~ + (Remember, you can use state to define ANY property and it will be retained across frames.) +** Processing line: ~~ - Inside source: true *** True Line Result - h.y = border.y -** Processing line: ~ h.w = border.w~ + +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ - Inside source: true *** True Line Result - h.w = border.w -** Processing line: ~ h.h = border.h~ + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. +** Processing line: ~~ - Inside source: true *** True Line Result - h.h = border.h -** Processing line: ~ h.max_lifetime = 10~ + +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ - Inside source: true *** True Line Result - h.max_lifetime = 10 -** Processing line: ~ h.lifetime = h.max_lifetime~ + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. +** Processing line: ~~ - Inside source: true *** True Line Result - h.lifetime = h.max_lifetime -** Processing line: ~ h.color = [120, 120, 180] # sets color to shade of purple~ + +** Processing line: ~ - args.outputs.labels: An array. The values in the array generate a label.~ - Inside source: true *** True Line Result - h.color = [120, 120, 180] # sets color to shade of purple -** Processing line: ~ end~ + - args.outputs.labels: An array. The values in the array generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - end + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +- Inside source: true +*** True Line Result + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ self.send method_to_call # invoke method identified by symbol~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - self.send method_to_call # invoke method identified by symbol -** Processing line: ~ else # otherwise, if self doesn't respond to given method~ + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. +** Processing line: ~~ - Inside source: true *** True Line Result - else # otherwise, if self doesn't respond to given method -** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in hash~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - border = button[1][:primitives].last # sets border definition using value of last key in hash + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # declares each highlight as a new entity, sets properties~ +** Processing line: ~ # This sample app shows an empty grid that the user can paint on.~ - Inside source: true *** True Line Result - # declares each highlight as a new entity, sets properties -** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ + # This sample app shows an empty grid that the user can paint on. +** Processing line: ~ # To paint, the user must keep their mouse presssed and drag it around the grid.~ - Inside source: true *** True Line Result - state.layout.highlights << state.new_entity(:highlight) do |h| -** Processing line: ~ h.x = border.x~ + # To paint, the user must keep their mouse presssed and drag it around the grid. +** Processing line: ~ # The "clear" button allows users to clear the grid so they can start over.~ - Inside source: true *** True Line Result - h.x = border.x -** Processing line: ~ h.y = border.y~ + # The "clear" button allows users to clear the grid so they can start over. +** Processing line: ~~ - Inside source: true *** True Line Result - h.y = border.y -** Processing line: ~ h.w = border.w~ + +** Processing line: ~ class PaintApp~ - Inside source: true *** True Line Result - h.w = border.w -** Processing line: ~ h.h = border.h~ + class PaintApp +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ - Inside source: true *** True Line Result - h.h = border.h -** Processing line: ~ h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true~ + attr_accessor :inputs, :state, :outputs, :grid, :args +** Processing line: ~~ - Inside source: true *** True Line Result - h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true -** Processing line: ~ h.lifetime = h.max_lifetime~ + +** Processing line: ~ # Runs methods necessary for the game to function properly.~ - Inside source: true *** True Line Result - h.lifetime = h.max_lifetime -** Processing line: ~ h.color = [120, 80, 80] # sets color to dark color~ + # Runs methods necessary for the game to function properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - h.color = [120, 80, 80] # sets color to dark color -** Processing line: ~ end~ + def tick +** Processing line: ~ print_title~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + print_title +** Processing line: ~ add_grid~ - Inside source: true *** True Line Result - -** Processing line: ~ # instructions for users on how to add the missing method_to_call to the code~ + add_grid +** Processing line: ~ check_click~ - Inside source: true *** True Line Result - # instructions for users on how to add the missing method_to_call to the code -** Processing line: ~ puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:"~ + check_click +** Processing line: ~ draw_buttons~ - Inside source: true *** True Line Result - puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" -** Processing line: ~ puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition."~ + draw_buttons +** Processing line: ~ end~ - Inside source: true *** True Line Result - puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." -** Processing line: ~ puts ""~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - puts "" -** Processing line: ~ puts "```"~ + +** Processing line: ~ # Prints the title onto the screen by using a label.~ - Inside source: true *** True Line Result - puts "```" -** Processing line: ~ puts "class TextedBasedGamePresenter <--- find this class and put the method below in it"~ + # Prints the title onto the screen by using a label. +** Processing line: ~ # Also separates the title from the grid with a line as a horizontal separator.~ - Inside source: true *** True Line Result - puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" -** Processing line: ~ puts ""~ + # Also separates the title from the grid with a line as a horizontal separator. +** Processing line: ~ def print_title~ - Inside source: true *** True Line Result - puts "" -** Processing line: ~ puts " def #{method_to_call}"~ + def print_title +** Processing line: ~ args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ]~ - Inside source: true *** True Line Result - puts " def #{method_to_call}" -** Processing line: ~ puts " puts 'Yay that worked!'"~ + args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] +** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280)~ - Inside source: true *** True Line Result - puts " puts 'Yay that worked!'" -** Processing line: ~ puts " end"~ + outputs.lines << horizontal_separator(660, 0, 1280) +** Processing line: ~ end~ - Inside source: true *** True Line Result - puts " end" -** Processing line: ~ puts ""~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - puts "" -** Processing line: ~ puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement."~ + +** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ - Inside source: true *** True Line Result - puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." -** Processing line: ~ puts "```"~ + # Sets the starting position, ending position, and color for the horizontal separator. +** Processing line: ~ # The starting and ending positions have the same y values.~ - Inside source: true *** True Line Result - puts "```" -** Processing line: ~ puts ""~ + # The starting and ending positions have the same y values. +** Processing line: ~ def horizontal_separator y, x, x2~ - Inside source: true *** True Line Result - puts "" -** Processing line: ~ end~ + def horizontal_separator y, x, x2 +** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ - Inside source: true *** True Line Result - end + [x, y, x2, y, 150, 150, 150] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -26077,22 +26480,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns the position of the mouse when it is clicked.~ +** Processing line: ~ # Sets the starting position, ending position, and color for the vertical separator.~ - Inside source: true *** True Line Result - # Returns the position of the mouse when it is clicked. -** Processing line: ~ def click_pos~ + # Sets the starting position, ending position, and color for the vertical separator. +** Processing line: ~ # The starting and ending positions have the same x values.~ - Inside source: true *** True Line Result - def click_pos -** Processing line: ~ return nil unless inputs.mouse.click # returns nil unless the mouse was clicked~ + # The starting and ending positions have the same x values. +** Processing line: ~ def vertical_separator x, y, y2~ - Inside source: true *** True Line Result - return nil unless inputs.mouse.click # returns nil unless the mouse was clicked -** Processing line: ~ return inputs.mouse.click.point # returns location of mouse click (coordinates)~ + def vertical_separator x, y, y2 +** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ - Inside source: true *** True Line Result - return inputs.mouse.click.point # returns location of mouse click (coordinates) + [x, y, x, y2, 150, 150, 150] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -26101,194 +26504,206 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)~ -- Inside source: true -*** True Line Result - # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) -** Processing line: ~ def button id, x, y, text~ +** Processing line: ~ # Outputs a border and a grid containing empty squares onto the screen.~ - Inside source: true *** True Line Result - def button id, x, y, text -** Processing line: ~ @button_list[id] ||= { # assigns values to hash keys~ + # Outputs a border and a grid containing empty squares onto the screen. +** Processing line: ~ def add_grid~ - Inside source: true *** True Line Result - @button_list[id] ||= { # assigns values to hash keys -** Processing line: ~ id: id,~ + def add_grid +** Processing line: ~~ - Inside source: true *** True Line Result - id: id, -** Processing line: ~ text: text,~ + +** Processing line: ~ # Sets the x, y, height, and width of the grid.~ - Inside source: true *** True Line Result - text: text, -** Processing line: ~ primitives: [~ + # Sets the x, y, height, and width of the grid. +** Processing line: ~ # There are 31 horizontal lines and 31 vertical lines in the grid.~ - Inside source: true *** True Line Result - primitives: [ -** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # positions label inside border~ + # There are 31 horizontal lines and 31 vertical lines in the grid. +** Processing line: ~ # Feel free to count them yourself before continuing!~ - Inside source: true *** True Line Result - [x + 10, y + 30, text, 2, 0].label, # positions label inside border -** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ + # Feel free to count them yourself before continuing! +** Processing line: ~ x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center~ - Inside source: true *** True Line Result - [x, y, 300, 50].border, # sets definition of border -** Processing line: ~ ]~ + x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center +** Processing line: ~ lines_h = 31~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + lines_h = 31 +** Processing line: ~ lines_v = 31~ - Inside source: true *** True Line Result - } + lines_v = 31 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @button_list[id][:primitives] # returns label and border for buttons~ +** Processing line: ~ # Sets values for the grid's border, grid lines, and filled squares.~ - Inside source: true *** True Line Result - @button_list[id][:primitives] # returns label and border for buttons -** Processing line: ~ end~ + # Sets values for the grid's border, grid lines, and filled squares. +** Processing line: ~ # The filled_squares variable is initially set to an empty array.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # The filled_squares variable is initially set to an empty array. +** Processing line: ~ state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border~ - Inside source: true *** True Line Result - -** Processing line: ~ # Creates a progress bar (used for lighting the fire) and sets its values.~ + state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border +** Processing line: ~ state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method~ - Inside source: true *** True Line Result - # Creates a progress bar (used for lighting the fire) and sets its values. -** Processing line: ~ def progress_bar id, x, y, text, percentage~ + state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method +** Processing line: ~ state.filled_squares ||= [] # there are no filled squares until the user fills them in~ - Inside source: true *** True Line Result - def progress_bar id, x, y, text, percentage -** Processing line: ~ @button_list[id] = { # assigns values to hash keys~ + state.filled_squares ||= [] # there are no filled squares until the user fills them in +** Processing line: ~~ - Inside source: true *** True Line Result - @button_list[id] = { # assigns values to hash keys -** Processing line: ~ id: id,~ + +** Processing line: ~ # Outputs the grid lines, border, and filled squares onto the screen.~ - Inside source: true *** True Line Result - id: id, -** Processing line: ~ text: text,~ + # Outputs the grid lines, border, and filled squares onto the screen. +** Processing line: ~ outputs.lines.concat state.grid_lines~ - Inside source: true *** True Line Result - text: text, -** Processing line: ~ primitives: [~ + outputs.lines.concat state.grid_lines +** Processing line: ~ outputs.borders << state.grid_border~ - Inside source: true *** True Line Result - primitives: [ -** Processing line: ~ [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray)~ + outputs.borders << state.grid_border +** Processing line: ~ outputs.solids << state.filled_squares~ - Inside source: true *** True Line Result - [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) -** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border~ + outputs.solids << state.filled_squares +** Processing line: ~ end~ - Inside source: true *** True Line Result - [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border -** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [x, y, 300, 50].border, # sets definition of border -** Processing line: ~ ]~ + +** Processing line: ~ # Draws the grid by adding in vertical and horizontal separators.~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + # Draws the grid by adding in vertical and horizontal separators. +** Processing line: ~ def draw_grid x, y, h, w, lines_h, lines_v~ - Inside source: true *** True Line Result - } + def draw_grid x, y, h, w, lines_h, lines_v ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by~ +** Processing line: ~ # The grid starts off empty.~ - Inside source: true *** True Line Result - # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by -** Processing line: ~ # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in.~ + # The grid starts off empty. +** Processing line: ~ grid = []~ - Inside source: true *** True Line Result - # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. -** Processing line: ~ @button_list[id][:primitives][0][2] = 300 * percentage~ + grid = [] +** Processing line: ~~ - Inside source: true *** True Line Result - @button_list[id][:primitives][0][2] = 300 * percentage -** Processing line: ~ @button_list[id][:primitives]~ + +** Processing line: ~ # Calculates the placement and adds horizontal lines or separators into the grid.~ - Inside source: true *** True Line Result - @button_list[id][:primitives] -** Processing line: ~ end~ + # Calculates the placement and adds horizontal lines or separators into the grid. +** Processing line: ~ curr_y = y # start at the bottom of the box~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + curr_y = y # start at the bottom of the box +** Processing line: ~ dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid~ - Inside source: true *** True Line Result - -** Processing line: ~ # Defines the game.~ + dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid +** Processing line: ~ lines_h.times do~ - Inside source: true *** True Line Result - # Defines the game. -** Processing line: ~ def game~ + lines_h.times do +** Processing line: ~ curr_y += dist_y # increment curr_y by the distance between the horizontal lines~ - Inside source: true *** True Line Result - def game -** Processing line: ~ @game~ + curr_y += dist_y # increment curr_y by the distance between the horizontal lines +** Processing line: ~ grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid~ - Inside source: true *** True Line Result - @game -** Processing line: ~ end~ + grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Initalizes the game and creates an empty list of buttons.~ +** Processing line: ~ # Calculates the placement and adds vertical lines or separators into the grid.~ - Inside source: true *** True Line Result - # Initalizes the game and creates an empty list of buttons. -** Processing line: ~ def initialize~ + # Calculates the placement and adds vertical lines or separators into the grid. +** Processing line: ~ curr_x = x # now start at the left of the box~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @game = TextedBasedGame.new self~ + curr_x = x # now start at the left of the box +** Processing line: ~ dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid~ - Inside source: true *** True Line Result - @game = TextedBasedGame.new self -** Processing line: ~ @button_list ||= {}~ + dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid +** Processing line: ~ lines_v.times do~ - Inside source: true *** True Line Result - @button_list ||= {} -** Processing line: ~ end~ + lines_v.times do +** Processing line: ~ curr_x += dist_x # increment curr_x by the distance between the vertical lines~ - Inside source: true *** True Line Result - end + curr_x += dist_x # increment curr_x by the distance between the vertical lines +** Processing line: ~ grid << vertical_separator(curr_x, y + 1, y + h) # add separator~ +- Inside source: true +*** True Line Result + grid << vertical_separator(curr_x, y + 1, y + h) # add separator +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Clears the storyline and takes the user to the room.~ +** Processing line: ~ # paint_grid uses a hash to assign values to keys.~ - Inside source: true *** True Line Result - # Clears the storyline and takes the user to the room. -** Processing line: ~ def alert_dismiss_clicked~ + # paint_grid uses a hash to assign values to keys. +** Processing line: ~ state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h,~ - Inside source: true *** True Line Result - def alert_dismiss_clicked -** Processing line: ~ game.clear_storyline~ + state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, +** Processing line: ~ "lines_v" => lines_v, "dist_x" => dist_x,~ - Inside source: true *** True Line Result - game.clear_storyline -** Processing line: ~ game.go_to_room~ + "lines_v" => lines_v, "dist_x" => dist_x, +** Processing line: ~ "dist_y" => dist_y }~ - Inside source: true *** True Line Result - game.go_to_room + "dist_y" => dist_y } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ return grid~ +- Inside source: true +*** True Line Result + return grid ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -26297,198 +26712,214 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Lights the fire when the user clicks the "light fire" option.~ +** Processing line: ~ # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values.~ - Inside source: true *** True Line Result - # Lights the fire when the user clicks the "light fire" option. -** Processing line: ~ def light_fire_clicked~ + # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. +** Processing line: ~ # If the mouse is up, the user cannot drag the mouse.~ - Inside source: true *** True Line Result - def light_fire_clicked -** Processing line: ~ game.light_fire~ + # If the mouse is up, the user cannot drag the mouse. +** Processing line: ~ def check_click~ - Inside source: true *** True Line Result - game.light_fire -** Processing line: ~ end~ + def check_click +** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if inputs.mouse.down #is mouse up or down? +** Processing line: ~ state.mouse_held = true # mouse is being held down~ - Inside source: true *** True Line Result - -** Processing line: ~ # Saves the game when the user clicks the "save" option.~ + state.mouse_held = true # mouse is being held down +** Processing line: ~ elsif inputs.mouse.up # if mouse is up~ - Inside source: true *** True Line Result - # Saves the game when the user clicks the "save" option. -** Processing line: ~ def save_game_clicked~ + elsif inputs.mouse.up # if mouse is up +** Processing line: ~ state.mouse_held = false # mouse is not being held down or dragged~ - Inside source: true *** True Line Result - def save_game_clicked -** Processing line: ~ game.save~ + state.mouse_held = false # mouse is not being held down or dragged +** Processing line: ~ state.mouse_dragging = false~ - Inside source: true *** True Line Result - game.save -** Processing line: ~ end~ + state.mouse_dragging = false +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Resets the game when the user clicks the "reset" option.~ +** Processing line: ~ if state.mouse_held && # mouse needs to be down~ - Inside source: true *** True Line Result - # Resets the game when the user clicks the "reset" option. -** Processing line: ~ def reset_game_clicked~ + if state.mouse_held && # mouse needs to be down +** Processing line: ~ !inputs.mouse.click && # must not be first click~ - Inside source: true *** True Line Result - def reset_game_clicked -** Processing line: ~ game.reset~ + !inputs.mouse.click && # must not be first click +** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag"~ - Inside source: true *** True Line Result - game.reset -** Processing line: ~ end~ + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" +** Processing line: ~ state.mouse_dragging = true~ - Inside source: true *** True Line Result - end + state.mouse_dragging = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Loads the game when the user clicks the "load" option.~ +** Processing line: ~ # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type.~ - Inside source: true *** True Line Result - # Loads the game when the user clicks the "load" option. -** Processing line: ~ def load_game_clicked~ + # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. +** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ - Inside source: true *** True Line Result - def load_game_clicked -** Processing line: ~ game.load~ + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) +** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ - Inside source: true *** True Line Result - game.load -** Processing line: ~ end~ + search_lines(inputs.mouse.click.point, :click) +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. +** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ - Inside source: true *** True Line Result - -** Processing line: ~ $text_based_rpg = TextedBasedGamePresenter.new~ + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) +** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ - Inside source: true *** True Line Result - $text_based_rpg = TextedBasedGamePresenter.new -** Processing line: ~~ + search_lines(inputs.mouse.position, :drag) +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $text_based_rpg.state = args.state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $text_based_rpg.state = args.state -** Processing line: ~ $text_based_rpg.outputs = args.outputs~ + +** Processing line: ~ # Sets the definition of a grid box and handles user input to fill in or clear grid boxes.~ - Inside source: true *** True Line Result - $text_based_rpg.outputs = args.outputs -** Processing line: ~ $text_based_rpg.inputs = args.inputs~ + # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. +** Processing line: ~ def search_lines (point, input_type)~ - Inside source: true *** True Line Result - $text_based_rpg.inputs = args.inputs -** Processing line: ~ $text_based_rpg.tick~ + def search_lines (point, input_type) +** Processing line: ~ point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash~ - Inside source: true *** True Line Result - $text_based_rpg.tick -** Processing line: ~ end~ + point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash +** Processing line: ~ point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash~ - Inside source: true *** True Line Result - end + point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ # Remove code following the .floor and see what happens when you try to fill in grid squares~ +- Inside source: true *** True Line Result -#+end_src + # Remove code following the .floor and see what happens when you try to fill in grid squares +** Processing line: ~ point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"]~ +- Inside source: true +*** True Line Result + point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] +** Processing line: ~ point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"]~ +- Inside source: true +*** True Line Result + point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] ** Processing line: ~~ -- End of paragraph detected. +- Inside source: true *** True Line Result -** Processing line: ~* 07_advanced_rendering/01_simple_render_targets/app/main.rb~ -- Header detected. +** Processing line: ~ point.x += state.paint_grid["x"]~ +- Inside source: true *** True Line Result - + point.x += state.paint_grid["x"] +** Processing line: ~ point.y += state.paint_grid["y"]~ +- Inside source: true *** True Line Result -* 07_advanced_rendering/01_simple_render_targets/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + point.y += state.paint_grid["y"] +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ # Sets definition of a grid box, meaning its x, y, width, and height.~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def tick args~ + # Sets definition of a grid box, meaning its x, y, width, and height. +** Processing line: ~ # Floor is called on the point.x and point.y variables.~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # args.outputs.render_targets are really really powerful.~ + # Floor is called on the point.x and point.y variables. +** Processing line: ~ # Ceil method is called on values of the distance hash keys, setting the width and height of a box.~ - Inside source: true *** True Line Result - # args.outputs.render_targets are really really powerful. -** Processing line: ~ # They essentially allow you to create a sprite programmatically and cache the result.~ + # Ceil method is called on values of the distance hash keys, setting the width and height of a box. +** Processing line: ~ grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ]~ - Inside source: true *** True Line Result - # They essentially allow you to create a sprite programmatically and cache the result. + grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Create a render_target of a :block and a :gradient on tick zero.~ +** Processing line: ~ if input_type == :click # if user clicks their mouse~ - Inside source: true *** True Line Result - # Create a render_target of a :block and a :gradient on tick zero. -** Processing line: ~ if args.state.tick_count == 0~ + if input_type == :click # if user clicks their mouse +** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.render_target(:block).solids << [0, 0, 1280, 100]~ + if state.filled_squares.include? grid_box # if grid box is already filled in +** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ - Inside source: true *** True Line Result - args.render_target(:block).solids << [0, 0, 1280, 100] -** Processing line: ~~ + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # The gradient is actually just a collection of black solids with increasing~ + else +** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ - Inside source: true *** True Line Result - # The gradient is actually just a collection of black solids with increasing -** Processing line: ~ # opacities.~ + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares +** Processing line: ~ end~ - Inside source: true *** True Line Result - # opacities. -** Processing line: ~ args.render_target(:gradient).solids << 90.map_with_index do |x|~ + end +** Processing line: ~ elsif input_type == :drag # if user drags mouse~ - Inside source: true *** True Line Result - args.render_target(:gradient).solids << 90.map_with_index do |x| -** Processing line: ~ 50.map_with_index do |y|~ + elsif input_type == :drag # if user drags mouse +** Processing line: ~ unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in~ - Inside source: true *** True Line Result - 50.map_with_index do |y| -** Processing line: ~ [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255]~ + unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in +** Processing line: ~ state.filled_squares << grid_box # the box is filled in and added to filled_squares~ - Inside source: true *** True Line Result - [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255] + state.filled_squares << grid_box # the box is filled in and added to filled_squares ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -26505,238 +26936,226 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Take the :block render_target and present it horizontally centered.~ -- Inside source: true -*** True Line Result - # Take the :block render_target and present it horizontally centered. -** Processing line: ~ # Use a subsection of the render_targetd specified by source_x,~ -- Inside source: true -*** True Line Result - # Use a subsection of the render_targetd specified by source_x, -** Processing line: ~ # source_y, source_w, source_h.~ +** Processing line: ~ # Creates and outputs a "Clear" button on the screen using a label and a border.~ - Inside source: true *** True Line Result - # source_y, source_w, source_h. -** Processing line: ~ args.outputs.sprites << { x: 0,~ + # Creates and outputs a "Clear" button on the screen using a label and a border. +** Processing line: ~ # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty.~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 0, -** Processing line: ~ y: 310,~ + # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. +** Processing line: ~ def draw_buttons~ - Inside source: true *** True Line Result - y: 310, -** Processing line: ~ w: 1280,~ + def draw_buttons +** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ - Inside source: true *** True Line Result - w: 1280, -** Processing line: ~ h: 100,~ + x, y, w, h = 390, 50, 240, 50 +** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ - Inside source: true *** True Line Result - h: 100, -** Processing line: ~ path: :block,~ + state.clear_button ||= state.new_entity(:button_with_fade) +** Processing line: ~~ - Inside source: true *** True Line Result - path: :block, -** Processing line: ~ source_x: 0,~ + +** Processing line: ~ # The x and y positions are set to display the label in the center of the button.~ - Inside source: true *** True Line Result - source_x: 0, -** Processing line: ~ source_y: 0,~ + # The x and y positions are set to display the label in the center of the button. +** Processing line: ~ # Try changing the first two parameters to simply x, y and see what happens to the text placement!~ - Inside source: true *** True Line Result - source_y: 0, -** Processing line: ~ source_w: 1280,~ + # Try changing the first two parameters to simply x, y and see what happens to the text placement! +** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border~ - Inside source: true *** True Line Result - source_w: 1280, -** Processing line: ~ source_h: 100 }~ + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border +** Processing line: ~ state.clear_button.border ||= [x, y, w, h]~ - Inside source: true *** True Line Result - source_h: 100 } + state.clear_button.border ||= [x, y, w, h] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # After rendering :block, render gradient on top of :block.~ +** Processing line: ~ # If the mouse is clicked inside the borders of the clear button,~ - Inside source: true *** True Line Result - # After rendering :block, render gradient on top of :block. -** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :gradient]~ + # If the mouse is clicked inside the borders of the clear button, +** Processing line: ~ # the filled_squares collection is emptied and the squares are cleared.~ - Inside source: true *** True Line Result - args.outputs.sprites << [0, 0, 1280, 720, :gradient] -** Processing line: ~~ + # the filled_squares collection is emptied and the squares are cleared. +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255]~ + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) +** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred~ - Inside source: true *** True Line Result - args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255] -** Processing line: ~ tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)."~ + state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred +** Processing line: ~ state.filled_squares.clear~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)." -** Processing line: ~ end~ + state.filled_squares.clear +** Processing line: ~ inputs.mouse.previous_click = nil~ - Inside source: true *** True Line Result - end + inputs.mouse.previous_click = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ outputs.labels << state.clear_button.label~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + outputs.labels << state.clear_button.label +** Processing line: ~ outputs.borders << state.clear_button.border~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + outputs.borders << state.clear_button.border +** Processing line: ~~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + +** Processing line: ~ # When the clear button is clicked, the color of the button changes~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + # When the clear button is clicked, the color of the button changes +** Processing line: ~ # and the transparency changes, as well. If you change the time from~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + # and the transparency changes, as well. If you change the time from +** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + # 0.25.seconds to 1.25.seconds or more, the change will last longer. +** Processing line: ~ if state.clear_button.clicked_at~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + if state.clear_button.clicked_at +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ +- Inside source: true +*** True Line Result + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ $paint_app = PaintApp.new~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + $paint_app = PaintApp.new +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + def tick args +** Processing line: ~ $paint_app.inputs = args.inputs~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + $paint_app.inputs = args.inputs +** Processing line: ~ $paint_app.state = args.state~ - Inside source: true *** True Line Result - -** Processing line: ~ $gtk.reset~ + $paint_app.state = args.state +** Processing line: ~ $paint_app.grid = args.grid~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~~ + $paint_app.grid = args.grid +** Processing line: ~ $paint_app.args = args~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 07_advanced_rendering/02_render_targets_with_alphas/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 07_advanced_rendering/02_render_targets_with_alphas/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # This sample is meant to show you how to do that dripping transition thing~ + $paint_app.args = args +** Processing line: ~ $paint_app.outputs = args.outputs~ - Inside source: true *** True Line Result - # This sample is meant to show you how to do that dripping transition thing -** Processing line: ~ # at the start of the original Doom. Most of this file is here to animate~ + $paint_app.outputs = args.outputs +** Processing line: ~ $paint_app.tick~ - Inside source: true *** True Line Result - # at the start of the original Doom. Most of this file is here to animate -** Processing line: ~ # a scene to wipe away; the actual wipe effect is in the last 20 lines or~ + $paint_app.tick +** Processing line: ~ tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw."~ - Inside source: true *** True Line Result - # a scene to wipe away; the actual wipe effect is in the last 20 lines or -** Processing line: ~ # so.~ + tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # so. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset # reset all game state if reloaded.~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - $gtk.reset # reset all game state if reloaded. -** Processing line: ~~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - -** Processing line: ~ def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance -** Processing line: ~ numblocks = 10~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - numblocks = 10 -** Processing line: ~~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - -** Processing line: ~ for i in 1..numblocks do~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - for i in 1..numblocks do -** Processing line: ~ angle = ((360 / numblocks) * i) + angleoffset~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - angle = ((360 / numblocks) * i) + angleoffset -** Processing line: ~ radians = angle * (Math::PI / 180)~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - radians = angle * (Math::PI / 180) -** Processing line: ~ x = (xoffset + (distance * Math.cos(radians))).round~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - x = (xoffset + (distance * Math.cos(radians))).round -** Processing line: ~ y = (yoffset + (distance * Math.sin(radians))).round~ + +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - y = (yoffset + (distance * Math.sin(radians))).round -** Processing line: ~ pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ]~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ] -** Processing line: ~ end~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - end + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -26745,250 +27164,290 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def draw_scene args, pass~ +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Mouse - Coordinate Systems - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Mouse - Coordinate Systems - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/05_mouse/04_coordinate_systems/app/main.rb~ - Inside source: true *** True Line Result - def draw_scene args, pass -** Processing line: ~ pass.solids << [0, 360, 1280, 360, 0, 0, 200]~ + # ./samples/05_mouse/04_coordinate_systems/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - pass.solids << [0, 360, 1280, 360, 0, 0, 200] -** Processing line: ~ pass.solids << [0, 0, 1280, 360, 0, 127, 0]~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - pass.solids << [0, 0, 1280, 360, 0, 127, 0] + +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +- Inside source: true +*** True Line Result + APIs listing that haven't been encountered in previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ blocksize = 100~ +** Processing line: ~ - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen.~ - Inside source: true *** True Line Result - blocksize = 100 -** Processing line: ~ angleoffset = args.state.tick_count * 2.5~ + - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. +** Processing line: ~ Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for~ - Inside source: true *** True Line Result - angleoffset = args.state.tick_count * 2.5 -** Processing line: ~ centerx = (1280 - blocksize) / 2~ + Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for +** Processing line: ~ position to know the mouse's coordinates.~ - Inside source: true *** True Line Result - centerx = (1280 - blocksize) / 2 -** Processing line: ~ centery = (720 - blocksize) / 2~ + position to know the mouse's coordinates. +** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ - Inside source: true *** True Line Result - centery = (720 - blocksize) / 2 + For more information about the mouse, go to mygame/documentation/07-mouse.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500 -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325 -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200~ + +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ - Inside source: true *** True Line Result - circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200 -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100~ + - args.inputs.mouse.click: This property will be set if the mouse was clicked. +** Processing line: ~~ - Inside source: true *** True Line Result - circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100 -** Processing line: ~ end~ + +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ - Inside source: true *** True Line Result - end + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ segments = 160~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - segments = 160 + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # On the first tick, initialize some stuff.~ +** Processing line: ~ In this sample app, string interpolation is used to show the current position of the mouse~ - Inside source: true *** True Line Result - # On the first tick, initialize some stuff. -** Processing line: ~ if !args.state.yoffsets~ + In this sample app, string interpolation is used to show the current position of the mouse +** Processing line: ~ in a label.~ - Inside source: true *** True Line Result - if !args.state.yoffsets -** Processing line: ~ args.state.baseyoff = 0~ + in a label. +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.baseyoff = 0 -** Processing line: ~ args.state.yoffsets = []~ + +** Processing line: ~ - args.outputs.labels: An array that generates a label.~ - Inside source: true *** True Line Result - args.state.yoffsets = [] -** Processing line: ~ for i in 0..segments do~ + - args.outputs.labels: An array that generates a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - for i in 0..segments do -** Processing line: ~ args.state.yoffsets << rand * 100~ + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - args.state.yoffsets << rand * 100 -** Processing line: ~ end~ + For more information about labels, go to mygame/documentation/02-labels.md. +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ - args.outputs.solids: An array that generates a solid.~ - Inside source: true *** True Line Result - end + - args.outputs.solids: An array that generates a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ +- Inside source: true +*** True Line Result + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +- Inside source: true +*** True Line Result + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Just draw some random stuff for a few seconds.~ +** Processing line: ~ - args.outputs.lines: An array that generates a line.~ - Inside source: true *** True Line Result - # Just draw some random stuff for a few seconds. -** Processing line: ~ args.state.static_debounce ||= 60 * 2.5~ + - args.outputs.lines: An array that generates a line. +** Processing line: ~ The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA]~ - Inside source: true *** True Line Result - args.state.static_debounce ||= 60 * 2.5 -** Processing line: ~ if args.state.static_debounce > 0~ + The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ - Inside source: true *** True Line Result - if args.state.static_debounce > 0 -** Processing line: ~ last_frame = args.state.static_debounce == 1~ + For more information about lines, go to mygame/documentation/04-lines.md. +** Processing line: ~~ - Inside source: true *** True Line Result - last_frame = args.state.static_debounce == 1 -** Processing line: ~ target = last_frame ? args.render_target(:last_frame) : args.outputs~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - target = last_frame ? args.render_target(:last_frame) : args.outputs -** Processing line: ~ draw_scene args, target~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - draw_scene args, target -** Processing line: ~ args.state.static_debounce -= 1~ + +** Processing line: ~ # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the~ - Inside source: true *** True Line Result - args.state.static_debounce -= 1 -** Processing line: ~ return unless last_frame~ + # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the +** Processing line: ~ # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or~ - Inside source: true *** True Line Result - return unless last_frame -** Processing line: ~ end~ + # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or +** Processing line: ~ # four quadrants by pressing the button.~ - Inside source: true *** True Line Result - end + # four quadrants by pressing the button. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # build up the wipe...~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # build up the wipe... + def tick args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # this is the thing we're wiping to.~ +** Processing line: ~ # The addition and subtraction in the first two parameters of the label and solid~ - Inside source: true *** True Line Result - # this is the thing we're wiping to. -** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ]~ + # The addition and subtraction in the first two parameters of the label and solid +** Processing line: ~ # ensure that the outputs don't overlap each other. Try removing them and see what happens.~ - Inside source: true *** True Line Result - args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ] -** Processing line: ~~ + # ensure that the outputs don't overlap each other. Try removing them and see what happens. +** Processing line: ~ pos = args.inputs.mouse.position # stores coordinates of mouse's position~ - Inside source: true *** True Line Result - -** Processing line: ~ return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding~ + pos = args.inputs.mouse.position # stores coordinates of mouse's position +** Processing line: ~ args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates~ - Inside source: true *** True Line Result - return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding + args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates +** Processing line: ~ args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering~ +- Inside source: true +*** True Line Result + args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ segmentw = 1280 / segments~ +** Processing line: ~ button = [0, 0, 370, 50] # sets definition of toggle button~ - Inside source: true *** True Line Result - segmentw = 1280 / segments -** Processing line: ~~ + button = [0, 0, 370, 50] # sets definition of toggle button +** Processing line: ~ args.outputs.borders << button # outputs button as border (not filled in)~ - Inside source: true *** True Line Result - -** Processing line: ~ x = 0~ + args.outputs.borders << button # outputs button as border (not filled in) +** Processing line: ~ args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button~ - Inside source: true *** True Line Result - x = 0 -** Processing line: ~ for i in 0..segments do~ + args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button +** Processing line: ~ args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants~ - Inside source: true *** True Line Result - for i in 0..segments do -** Processing line: ~ yoffset = 0~ + args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants +** Processing line: ~ args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants~ - Inside source: true *** True Line Result - yoffset = 0 -** Processing line: ~ if args.state.yoffsets[i] < args.state.baseyoff~ + args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants +** Processing line: ~~ - Inside source: true *** True Line Result - if args.state.yoffsets[i] < args.state.baseyoff -** Processing line: ~ yoffset = args.state.baseyoff - args.state.yoffsets[i]~ + +** Processing line: ~ if args.inputs.mouse.click # if the user clicks the mouse~ - Inside source: true *** True Line Result - yoffset = args.state.baseyoff - args.state.yoffsets[i] -** Processing line: ~ end~ + if args.inputs.mouse.click # if the user clicks the mouse +** Processing line: ~ pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) +** Processing line: ~ if pos.inside_rect? button # if the click occurred inside the button~ - Inside source: true *** True Line Result - -** Processing line: ~ # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment.~ + if pos.inside_rect? button # if the click occurred inside the button +** Processing line: ~ if args.grid.name == :bottom_left # if the grid shows bottom left as origin~ - Inside source: true *** True Line Result - # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment. -** Processing line: ~ args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ]~ + if args.grid.name == :bottom_left # if the grid shows bottom left as origin +** Processing line: ~ args.grid.origin_center! # origin will be shown in center~ - Inside source: true *** True Line Result - args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ] -** Processing line: ~ x += segmentw~ + args.grid.origin_center! # origin will be shown in center +** Processing line: ~ else~ - Inside source: true *** True Line Result - x += segmentw -** Processing line: ~ end~ + else +** Processing line: ~ args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.baseyoff += 4~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.baseyoff += 4 + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ tick_instructions args, "Sample app shows an advanced usage of render_target."~ +** Processing line: ~ tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit."~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows an advanced usage of render_target." + tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27061,18 +27520,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 07_advanced_rendering/03_render_target_viewports/app/main.rb~ +** Processing line: ~* Save Load - Save Load Game - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 07_advanced_rendering/03_render_target_viewports/app/main.rb +* Save Load - Save Load Game - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./samples/06_save_load/01_save_load_game/app/main.rb~ +- Inside source: true +*** True Line Result + # ./samples/06_save_load/01_save_load_game/app/main.rb ** Processing line: ~ =begin~ - Inside source: true *** True Line Result @@ -27089,158 +27552,146 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -- Inside source: true -*** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ +** Processing line: ~ - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful~ - Inside source: true *** True Line Result - For example, if we want to create a new button, we would declare it as a new entity and -** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ + - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful +** Processing line: ~ because with a given symbol name, you can refer to the same object throughout~ - Inside source: true *** True Line Result - then define its properties. (Remember, you can use state to define ANY property and it will -** Processing line: ~ be retained across frames.)~ + because with a given symbol name, you can refer to the same object throughout +** Processing line: ~ a Ruby program.~ - Inside source: true *** True Line Result - be retained across frames.) + a Ruby program. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ If you have a solar system and you're creating args.state.sun and setting its image path to an~ +** Processing line: ~ In this sample app, we're using symbols for our buttons. We have buttons that~ - Inside source: true *** True Line Result - If you have a solar system and you're creating args.state.sun and setting its image path to an -** Processing line: ~ image in the sprites folder, you would do the following:~ + In this sample app, we're using symbols for our buttons. We have buttons that +** Processing line: ~ light fires, save, load, etc. Each of these buttons has a distinct symbol like~ - Inside source: true *** True Line Result - image in the sprites folder, you would do the following: -** Processing line: ~ (See samples/99_sample_nddnug_workshop for more details.)~ + light fires, save, load, etc. Each of these buttons has a distinct symbol like +** Processing line: ~ :light_fire, :save_game, :load_game, etc.~ - Inside source: true *** True Line Result - (See samples/99_sample_nddnug_workshop for more details.) + :light_fire, :save_game, :load_game, etc. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ -- Inside source: true -*** True Line Result - args.state.sun ||= args.state.new_entity(:sun) do |s| -** Processing line: ~ s.path = 'sprites/sun.png'~ +** Processing line: ~ - to_sym: Returns the symbol corresponding to the given string; creates the symbol~ - Inside source: true *** True Line Result - s.path = 'sprites/sun.png' -** Processing line: ~ end~ + - to_sym: Returns the symbol corresponding to the given string; creates the symbol +** Processing line: ~ if it does not already exist.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if it does not already exist. +** Processing line: ~ For example,~ - Inside source: true *** True Line Result - -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ + For example, +** Processing line: ~ 'car'.to_sym~ - Inside source: true *** True Line Result - - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + 'car'.to_sym +** Processing line: ~ would return the symbol :car.~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + would return the symbol :car. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ For example, if we have a variable~ -- Inside source: true -*** True Line Result - For example, if we have a variable -** Processing line: ~ name = "Ruby"~ -- Inside source: true -*** True Line Result - name = "Ruby" -** Processing line: ~ then the line~ -- Inside source: true -*** True Line Result - then the line -** Processing line: ~ puts "How are you, #{name}?"~ +** Processing line: ~ - last: Returns the last element of an array.~ - Inside source: true *** True Line Result - puts "How are you, #{name}?" -** Processing line: ~ would print "How are you, Ruby?" to the console.~ + - last: Returns the last element of an array. +** Processing line: ~~ - Inside source: true *** True Line Result - would print "How are you, Ruby?" to the console. -** Processing line: ~ (Remember, string interpolation only works with double quotes!)~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - (Remember, string interpolation only works with double quotes!) + Reminders: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Ternary operator (?): Similar to if statement; first evalulates whether a statement is~ +** Processing line: ~ - num1.lesser(num2): finds the lower value of the given options.~ - Inside source: true *** True Line Result - - Ternary operator (?): Similar to if statement; first evalulates whether a statement is -** Processing line: ~ true or false, and then executes a command depending on that result.~ + - num1.lesser(num2): finds the lower value of the given options. +** Processing line: ~ For example, in the statement~ - Inside source: true *** True Line Result - true or false, and then executes a command depending on that result. -** Processing line: ~ For example, if we had a variable~ + For example, in the statement +** Processing line: ~ a = 4.lesser(3)~ - Inside source: true *** True Line Result - For example, if we had a variable -** Processing line: ~ grade = 75~ + a = 4.lesser(3) +** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ - Inside source: true *** True Line Result - grade = 75 -** Processing line: ~ and used the ternary operator in the command~ + 3 has a lower value than 4, which means that the value of a would be set to 3, +** Processing line: ~ but if the statement had been~ - Inside source: true *** True Line Result - and used the ternary operator in the command -** Processing line: ~ pass_or_fail = grade > 65 ? "pass" : "fail"~ + but if the statement had been +** Processing line: ~ a = 4.lesser(5)~ - Inside source: true *** True Line Result - pass_or_fail = grade > 65 ? "pass" : "fail" -** Processing line: ~ then the value of pass_or_fail would be "pass" since grade's value was greater than 65.~ + a = 4.lesser(5) +** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ - Inside source: true *** True Line Result - then the value of pass_or_fail would be "pass" since grade's value was greater than 65. + 4 has a lower value than 5, which means that the value of a would be set to 4. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers.~ - Inside source: true *** True Line Result - Reminders: + - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. +** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ +- Inside source: true +*** True Line Result + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ +** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ +** Processing line: ~ - args.outputs.labels: An array. Values generate a label.~ - Inside source: true *** True Line Result - - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction -** Processing line: ~ by adding or subracting.~ + - args.outputs.labels: An array. Values generate a label. +** Processing line: ~ Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - by adding or subracting. + Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information, go to mygame/documentation/02-labels.md.~ +- Inside source: true +*** True Line Result + For more information, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result @@ -27261,294 +27712,282 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ # This code allows users to perform different tasks, such as saving and loading the game.~ - Inside source: true *** True Line Result - - args.inputs.mouse.click: This property will be set if the mouse was clicked. -** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ + # This code allows users to perform different tasks, such as saving and loading the game. +** Processing line: ~ # Users also have options to reset the game and light a fire.~ - Inside source: true *** True Line Result - For more information about the mouse, go to mygame/documentation/07-mouse.md. + # Users also have options to reset the game and light a fire. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ +** Processing line: ~ class TextedBasedGame~ - Inside source: true *** True Line Result - - args.inputs.keyboard.key_up.KEY: The value of the properties will be set -** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ + class TextedBasedGame +** Processing line: ~~ - Inside source: true *** True Line Result - to the frame that the key_up event occurred (the frame correlates -** Processing line: ~ to args.state.tick_count).~ + +** Processing line: ~ # Contains methods needed for game to run properly.~ - Inside source: true *** True Line Result - to args.state.tick_count). -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ + # Contains methods needed for game to run properly. +** Processing line: ~ # Increments tick count by 1 each time it runs (60 times in a single second)~ - Inside source: true *** True Line Result - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ - args.state.labels:~ -- Inside source: true -*** True Line Result - - args.state.labels: -** Processing line: ~ The parameters for a label are~ -- Inside source: true -*** True Line Result - The parameters for a label are -** Processing line: ~ 1. the position (x, y)~ -- Inside source: true -*** True Line Result - 1. the position (x, y) -** Processing line: ~ 2. the text~ + # Increments tick count by 1 each time it runs (60 times in a single second) +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - 2. the text -** Processing line: ~ 3. the size~ + def tick +** Processing line: ~ default~ - Inside source: true *** True Line Result - 3. the size -** Processing line: ~ 4. the alignment~ + default +** Processing line: ~ show_intro~ - Inside source: true *** True Line Result - 4. the alignment -** Processing line: ~ 5. the color (red, green, and blue saturations)~ + show_intro +** Processing line: ~ state.engine_tick_count += 1~ - Inside source: true *** True Line Result - 5. the color (red, green, and blue saturations) -** Processing line: ~ 6. the alpha (or transparency)~ + state.engine_tick_count += 1 +** Processing line: ~ tick_fire~ - Inside source: true *** True Line Result - 6. the alpha (or transparency) -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + tick_fire +** Processing line: ~ end~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.lines:~ +** Processing line: ~ # Sets default values.~ - Inside source: true *** True Line Result - - args.state.lines: -** Processing line: ~ The parameters for a line are~ + # Sets default values. +** Processing line: ~ # The ||= ensures that a variable's value is only set to the value following the = sign~ - Inside source: true *** True Line Result - The parameters for a line are -** Processing line: ~ 1. the starting position (x, y)~ + # The ||= ensures that a variable's value is only set to the value following the = sign +** Processing line: ~ # if the value has not already been set before. Intialization happens only in the first frame.~ - Inside source: true *** True Line Result - 1. the starting position (x, y) -** Processing line: ~ 2. the ending position (x2, y2)~ + # if the value has not already been set before. Intialization happens only in the first frame. +** Processing line: ~ def default~ - Inside source: true *** True Line Result - 2. the ending position (x2, y2) -** Processing line: ~ 3. the color (red, green, and blue saturations)~ + def default +** Processing line: ~ state.engine_tick_count ||= 0~ - Inside source: true *** True Line Result - 3. the color (red, green, and blue saturations) -** Processing line: ~ 4. the alpha (or transparency)~ + state.engine_tick_count ||= 0 +** Processing line: ~ state.active_module ||= :room~ - Inside source: true *** True Line Result - 4. the alpha (or transparency) -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ + state.active_module ||= :room +** Processing line: ~ state.fire_progress ||= 0~ - Inside source: true *** True Line Result - For more information about lines, go to mygame/documentation/04-lines.md. -** Processing line: ~~ + state.fire_progress ||= 0 +** Processing line: ~ state.fire_ready_in ||= 10~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.state.solids (and args.state.borders):~ + state.fire_ready_in ||= 10 +** Processing line: ~ state.previous_fire ||= :dead~ - Inside source: true *** True Line Result - - args.state.solids (and args.state.borders): -** Processing line: ~ The parameters for a solid (or border) are~ + state.previous_fire ||= :dead +** Processing line: ~ state.fire ||= :dead~ - Inside source: true *** True Line Result - The parameters for a solid (or border) are -** Processing line: ~ 1. the position (x, y)~ + state.fire ||= :dead +** Processing line: ~ end~ - Inside source: true *** True Line Result - 1. the position (x, y) -** Processing line: ~ 2. the width (w)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 2. the width (w) -** Processing line: ~ 3. the height (h)~ + +** Processing line: ~ def show_intro~ - Inside source: true *** True Line Result - 3. the height (h) -** Processing line: ~ 4. the color (r, g, b)~ + def show_intro +** Processing line: ~ return unless state.engine_tick_count == 0 # return unless the game just started~ - Inside source: true *** True Line Result - 4. the color (r, g, b) -** Processing line: ~ 5. the alpha (or transparency)~ + return unless state.engine_tick_count == 0 # return unless the game just started +** Processing line: ~ set_story_line "awake." # calls set_story_line method, sets to "awake"~ - Inside source: true *** True Line Result - 5. the alpha (or transparency) -** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ + set_story_line "awake." # calls set_story_line method, sets to "awake" +** Processing line: ~ end~ - Inside source: true *** True Line Result - For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.state.sprites:~ +** Processing line: ~ # Sets story line.~ - Inside source: true *** True Line Result - - args.state.sprites: -** Processing line: ~ The parameters for a sprite are~ + # Sets story line. +** Processing line: ~ def set_story_line story_line~ - Inside source: true *** True Line Result - The parameters for a sprite are -** Processing line: ~ 1. the position (x, y)~ + def set_story_line story_line +** Processing line: ~ state.story_line = story_line # story line set to value of parameter~ - Inside source: true *** True Line Result - 1. the position (x, y) -** Processing line: ~ 2. the width (w)~ + state.story_line = story_line # story line set to value of parameter +** Processing line: ~ state.active_module = :alert # active module set to alert~ - Inside source: true *** True Line Result - 2. the width (w) -** Processing line: ~ 3. the height (h)~ + state.active_module = :alert # active module set to alert +** Processing line: ~ end~ - Inside source: true *** True Line Result - 3. the height (h) -** Processing line: ~ 4. the image path~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 4. the image path -** Processing line: ~ 5. the angle~ + +** Processing line: ~ # Clears story line.~ - Inside source: true *** True Line Result - 5. the angle -** Processing line: ~ 6. the alpha (or transparency)~ + # Clears story line. +** Processing line: ~ def clear_storyline~ - Inside source: true *** True Line Result - 6. the alpha (or transparency) -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ + def clear_storyline +** Processing line: ~ state.active_module = :none # active module set to none~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. -** Processing line: ~ =end~ + state.active_module = :none # active module set to none +** Processing line: ~ state.story_line = nil # story line is cleared, set to nil (or empty)~ - Inside source: true *** True Line Result - =end + state.story_line = nil # story line is cleared, set to nil (or empty) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows different objects that can be used when making games, such as labels,~ +** Processing line: ~ # Determines fire progress (how close the fire is to being ready to light).~ - Inside source: true *** True Line Result - # This sample app shows different objects that can be used when making games, such as labels, -** Processing line: ~ # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used.~ + # Determines fire progress (how close the fire is to being ready to light). +** Processing line: ~ def tick_fire~ - Inside source: true *** True Line Result - # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used. -** Processing line: ~~ + def tick_fire +** Processing line: ~ return if state.active_module == :alert # return if active module is alert~ - Inside source: true *** True Line Result - -** Processing line: ~ # Also note that state.tick_count refers to the passage of time, or current frame.~ + return if state.active_module == :alert # return if active module is alert +** Processing line: ~ state.fire_progress += 1 # increment fire progress~ - Inside source: true *** True Line Result - # Also note that state.tick_count refers to the passage of time, or current frame. -** Processing line: ~~ + state.fire_progress += 1 # increment fire progress +** Processing line: ~ # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value.~ - Inside source: true *** True Line Result - -** Processing line: ~ class TechDemo~ + # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. +** Processing line: ~ state.fire_progress = state.fire_progress.lesser(state.fire_ready_in)~ - Inside source: true *** True Line Result - class TechDemo -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ + state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :inputs, :state, :outputs, :grid, :args + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls all methods necessary for the app to run properly.~ +** Processing line: ~ # Sets the value of fire (whether it is dead or roaring), and the story line~ - Inside source: true *** True Line Result - # Calls all methods necessary for the app to run properly. -** Processing line: ~ def tick~ + # Sets the value of fire (whether it is dead or roaring), and the story line +** Processing line: ~ def light_fire~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ labels_tech_demo~ + def light_fire +** Processing line: ~ return unless fire_ready? # returns unless the fire is ready to be lit~ - Inside source: true *** True Line Result - labels_tech_demo -** Processing line: ~ lines_tech_demo~ + return unless fire_ready? # returns unless the fire is ready to be lit +** Processing line: ~ state.fire = :roaring # fire is lit, set to roaring~ - Inside source: true *** True Line Result - lines_tech_demo -** Processing line: ~ solids_tech_demo~ + state.fire = :roaring # fire is lit, set to roaring +** Processing line: ~ state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit~ - Inside source: true *** True Line Result - solids_tech_demo -** Processing line: ~ borders_tech_demo~ + state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit +** Processing line: ~ if state.fire != state.previous_fire~ - Inside source: true *** True Line Result - borders_tech_demo -** Processing line: ~ sprites_tech_demo~ + if state.fire != state.previous_fire +** Processing line: ~ set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation~ - Inside source: true *** True Line Result - sprites_tech_demo -** Processing line: ~ keyboards_tech_demo~ + set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation +** Processing line: ~ state.previous_fire = state.fire~ - Inside source: true *** True Line Result - keyboards_tech_demo -** Processing line: ~ controller_tech_demo~ + state.previous_fire = state.fire +** Processing line: ~ end~ - Inside source: true *** True Line Result - controller_tech_demo -** Processing line: ~ mouse_tech_demo~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - mouse_tech_demo -** Processing line: ~ point_to_rect_tech_demo~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - point_to_rect_tech_demo -** Processing line: ~ rect_to_rect_tech_demo~ + +** Processing line: ~ # Checks if the fire is ready to be lit. Returns a boolean value.~ - Inside source: true *** True Line Result - rect_to_rect_tech_demo -** Processing line: ~ button_tech_demo~ + # Checks if the fire is ready to be lit. Returns a boolean value. +** Processing line: ~ def fire_ready?~ - Inside source: true *** True Line Result - button_tech_demo -** Processing line: ~ export_game_state_demo~ + def fire_ready? +** Processing line: ~ # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10),~ - Inside source: true *** True Line Result - export_game_state_demo -** Processing line: ~ window_state_demo~ + # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), +** Processing line: ~ # the fire is ready to be lit.~ - Inside source: true *** True Line Result - window_state_demo -** Processing line: ~ render_seperators~ + # the fire is ready to be lit. +** Processing line: ~ state.fire_progress == state.fire_ready_in~ - Inside source: true *** True Line Result - render_seperators + state.fire_progress == state.fire_ready_in ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27557,74 +27996,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows output of different kinds of labels on the screen~ -- Inside source: true -*** True Line Result - # Shows output of different kinds of labels on the screen -** Processing line: ~ def labels_tech_demo~ -- Inside source: true -*** True Line Result - def labels_tech_demo -** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."]~ +** Processing line: ~ # Divides the value of the fire_progress variable by 10 to determine how close the user is to~ - Inside source: true *** True Line Result - outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."] -** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ + # Divides the value of the fire_progress variable by 10 to determine how close the user is to +** Processing line: ~ # being able to light a fire.~ - Inside source: true *** True Line Result - outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."] -** Processing line: ~ outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"]~ + # being able to light a fire. +** Processing line: ~ def light_fire_progress~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"] -** Processing line: ~ outputs.labels << [ 5, 660, "Smaller label.", -2]~ + def light_fire_progress +** Processing line: ~ state.fire_progress.fdiv(10) # float division~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 660, "Smaller label.", -2] -** Processing line: ~ outputs.labels << [ 5, 630, "Small label.", -1]~ + state.fire_progress.fdiv(10) # float division +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 630, "Small label.", -1] -** Processing line: ~ outputs.labels << [ 5, 600, "Medium label.", 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 600, "Medium label.", 0] -** Processing line: ~ outputs.labels << [ 5, 570, "Large label.", 1]~ + +** Processing line: ~ # Defines fire as the state.fire variable.~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 570, "Large label.", 1] -** Processing line: ~ outputs.labels << [ 5, 540, "Larger label.", 2]~ + # Defines fire as the state.fire variable. +** Processing line: ~ def fire~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 540, "Larger label.", 2] -** Processing line: ~ outputs.labels << [300, 660, "Left aligned.", 0, 2]~ + def fire +** Processing line: ~ state.fire~ - Inside source: true *** True Line Result - outputs.labels << [300, 660, "Left aligned.", 0, 2] -** Processing line: ~ outputs.labels << [300, 640, "Center aligned.", 0, 1]~ + state.fire +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << [300, 640, "Center aligned.", 0, 1] -** Processing line: ~ outputs.labels << [300, 620, "Right aligned.", 0, 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << [300, 620, "Right aligned.", 0, 0] -** Processing line: ~ outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0]~ + +** Processing line: ~ # Sets the title of the room.~ - Inside source: true *** True Line Result - outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0] -** Processing line: ~ outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0]~ + # Sets the title of the room. +** Processing line: ~ def room_title~ - Inside source: true *** True Line Result - outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0] -** Processing line: ~ outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255]~ + def room_title +** Processing line: ~ return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead~ - Inside source: true *** True Line Result - outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255] -** Processing line: ~ outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128]~ + return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead +** Processing line: ~ return "a room that is lit" # room is lit if the fire is not dead~ - Inside source: true *** True Line Result - outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128] + return "a room that is lit" # room is lit if the fire is not dead ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27633,38 +28064,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows output of lines on the screen~ +** Processing line: ~ # Sets the active_module to room.~ - Inside source: true *** True Line Result - # Shows output of lines on the screen -** Processing line: ~ def lines_tech_demo~ + # Sets the active_module to room. +** Processing line: ~ def go_to_room~ - Inside source: true *** True Line Result - def lines_tech_demo -** Processing line: ~ outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"]~ + def go_to_room +** Processing line: ~ state.active_module = :room~ - Inside source: true *** True Line Result - outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"] -** Processing line: ~ outputs.lines << [5, 450, 100, 450]~ + state.active_module = :room +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.lines << [5, 450, 100, 450] -** Processing line: ~ outputs.lines << [5, 430, 300, 430]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.lines << [5, 430, 300, 430] -** Processing line: ~ outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes~ + +** Processing line: ~ # Defines active_module as the state.active_module variable.~ - Inside source: true *** True Line Result - outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes -** Processing line: ~ outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes~ + # Defines active_module as the state.active_module variable. +** Processing line: ~ def active_module~ - Inside source: true *** True Line Result - outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes -** Processing line: ~ outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes~ + def active_module +** Processing line: ~ state.active_module~ - Inside source: true *** True Line Result - outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes + state.active_module ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27673,38 +28104,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows output of different kinds of solids on the screen~ +** Processing line: ~ # Defines story_line as the state.story_line variable.~ - Inside source: true *** True Line Result - # Shows output of different kinds of solids on the screen -** Processing line: ~ def solids_tech_demo~ + # Defines story_line as the state.story_line variable. +** Processing line: ~ def story_line~ - Inside source: true *** True Line Result - def solids_tech_demo -** Processing line: ~ outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"]~ + def story_line +** Processing line: ~ state.story_line~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"] -** Processing line: ~ outputs.solids << [ 10, 270, 50, 50]~ + state.story_line +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.solids << [ 10, 270, 50, 50] -** Processing line: ~ outputs.solids << [ 70, 270, 50, 50, 0, 0, 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.solids << [ 70, 270, 50, 50, 0, 0, 0] -** Processing line: ~ outputs.solids << [130, 270, 50, 50, 255, 0, 0]~ + +** Processing line: ~ # Update every 60 frames (or every second)~ - Inside source: true *** True Line Result - outputs.solids << [130, 270, 50, 50, 255, 0, 0] -** Processing line: ~ outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128]~ + # Update every 60 frames (or every second) +** Processing line: ~ def should_tick?~ - Inside source: true *** True Line Result - outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128] -** Processing line: ~ outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ + def should_tick? +** Processing line: ~ state.tick_count.mod_zero?(60)~ - Inside source: true *** True Line Result - outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes + state.tick_count.mod_zero?(60) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27713,42 +28144,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows output of different kinds of borders on the screen~ +** Processing line: ~ # Sets the value of the game state provider.~ - Inside source: true *** True Line Result - # Shows output of different kinds of borders on the screen -** Processing line: ~ # The parameters for a border are the same as the parameters for a solid~ + # Sets the value of the game state provider. +** Processing line: ~ def initialize game_state_provider~ - Inside source: true *** True Line Result - # The parameters for a border are the same as the parameters for a solid -** Processing line: ~ def borders_tech_demo~ + def initialize game_state_provider +** Processing line: ~ @game_state_provider = game_state_provider~ - Inside source: true *** True Line Result - def borders_tech_demo -** Processing line: ~ outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"]~ + @game_state_provider = game_state_provider +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"] -** Processing line: ~ outputs.borders << [ 10, 180, 50, 50]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.borders << [ 10, 180, 50, 50] -** Processing line: ~ outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]~ + +** Processing line: ~ # Defines the game state.~ - Inside source: true *** True Line Result - outputs.borders << [ 70, 180, 50, 50, 0, 0, 0] -** Processing line: ~ outputs.borders << [130, 180, 50, 50, 255, 0, 0]~ + # Defines the game state. +** Processing line: ~ # Any variable prefixed with an @ symbol is an instance variable.~ - Inside source: true *** True Line Result - outputs.borders << [130, 180, 50, 50, 255, 0, 0] -** Processing line: ~ outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]~ + # Any variable prefixed with an @ symbol is an instance variable. +** Processing line: ~ def state~ - Inside source: true *** True Line Result - outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128] -** Processing line: ~ outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ + def state +** Processing line: ~ @game_state_provider.state~ - Inside source: true *** True Line Result - outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes + @game_state_provider.state ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27757,30 +28188,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows output of different kinds of sprites on the screen~ -- Inside source: true -*** True Line Result - # Shows output of different kinds of sprites on the screen -** Processing line: ~ def sprites_tech_demo~ -- Inside source: true -*** True Line Result - def sprites_tech_demo -** Processing line: ~ outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"]~ -- Inside source: true -*** True Line Result - outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"] -** Processing line: ~ outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']~ +** Processing line: ~ # Saves the state of the game in a text file called game_state.txt.~ - Inside source: true *** True Line Result - outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png'] -** Processing line: ~ outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes~ + # Saves the state of the game in a text file called game_state.txt. +** Processing line: ~ def save~ - Inside source: true *** True Line Result - outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes -** Processing line: ~ outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes~ + def save +** Processing line: ~ $gtk.serialize_state('game_state.txt', state)~ - Inside source: true *** True Line Result - outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes + $gtk.serialize_state('game_state.txt', state) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27789,158 +28208,146 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Holds size, alignment, color (black), and alpha (transparency) parameters~ +** Processing line: ~ # Loads the game state from the game_state.txt text file.~ - Inside source: true *** True Line Result - # Holds size, alignment, color (black), and alpha (transparency) parameters -** Processing line: ~ # Using small_font as a parameter accounts for all remaining parameters~ + # Loads the game state from the game_state.txt text file. +** Processing line: ~ # If the load is unsuccessful, the user is informed since the story line indicates the failure.~ - Inside source: true *** True Line Result - # Using small_font as a parameter accounts for all remaining parameters -** Processing line: ~ # so they don't have to be repeatedly typed~ + # If the load is unsuccessful, the user is informed since the story line indicates the failure. +** Processing line: ~ def load~ - Inside source: true *** True Line Result - # so they don't have to be repeatedly typed -** Processing line: ~ def small_font~ + def load +** Processing line: ~ parsed_state = $gtk.deserialize_state('game_state.txt')~ - Inside source: true *** True Line Result - def small_font -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ + parsed_state = $gtk.deserialize_state('game_state.txt') +** Processing line: ~ if !parsed_state~ - Inside source: true *** True Line Result - [-2, 0, 0, 0, 0, 255] -** Processing line: ~ end~ + if !parsed_state +** Processing line: ~ set_story_line "no game to load. press save first."~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + set_story_line "no game to load. press save first." +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets position of each row~ + else +** Processing line: ~ $gtk.args.state = parsed_state~ - Inside source: true *** True Line Result - # Sets position of each row -** Processing line: ~ # Converts given row value to pixels that DragonRuby understands~ + $gtk.args.state = parsed_state +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Converts given row value to pixels that DragonRuby understands -** Processing line: ~ def row_to_px row_number~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def row_to_px row_number + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Row 0 starts 5 units below the top of the grid.~ +** Processing line: ~ # Resets the game.~ - Inside source: true *** True Line Result - # Row 0 starts 5 units below the top of the grid. -** Processing line: ~ # Each row afterward is 20 units lower.~ + # Resets the game. +** Processing line: ~ def reset~ - Inside source: true *** True Line Result - # Each row afterward is 20 units lower. -** Processing line: ~ grid.top.shift_down(5).shift_down(20 * row_number)~ + def reset +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - grid.top.shift_down(5).shift_down(20 * row_number) + $gtk.reset ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Uses labels to output current game time (passage of time), and whether or not "h" was pressed~ +** Processing line: ~ class TextedBasedGamePresenter~ - Inside source: true *** True Line Result - # Uses labels to output current game time (passage of time), and whether or not "h" was pressed -** Processing line: ~ # If "h" is pressed, the frame is output when the key_up event occurred~ + class TextedBasedGamePresenter +** Processing line: ~ attr_accessor :state, :outputs, :inputs~ - Inside source: true *** True Line Result - # If "h" is pressed, the frame is output when the key_up event occurred -** Processing line: ~ def keyboards_tech_demo~ + attr_accessor :state, :outputs, :inputs +** Processing line: ~~ - Inside source: true *** True Line Result - def keyboards_tech_demo -** Processing line: ~ outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font]~ + +** Processing line: ~ # Creates empty collection called highlights.~ - Inside source: true *** True Line Result - outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font] -** Processing line: ~ outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font]~ + # Creates empty collection called highlights. +** Processing line: ~ # Calls methods necessary to run the game.~ - Inside source: true *** True Line Result - outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font] -** Processing line: ~ outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font]~ + # Calls methods necessary to run the game. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font] -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ if inputs.keyboard.key_up.h # if "h" key_up event occurs~ -- Inside source: true -*** True Line Result - if inputs.keyboard.key_up.h # if "h" key_up event occurs -** Processing line: ~ state.h_pressed_at = state.tick_count # frame it occurred is stored~ + def tick +** Processing line: ~ state.layout.highlights ||= []~ - Inside source: true *** True Line Result - state.h_pressed_at = state.tick_count # frame it occurred is stored -** Processing line: ~ end~ + state.layout.highlights ||= [] +** Processing line: ~ game.tick if game.should_tick?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + game.tick if game.should_tick? +** Processing line: ~ render~ - Inside source: true *** True Line Result - -** Processing line: ~ # h_pressed_at is initially set to false, and changes once the user presses the "h" key.~ + render +** Processing line: ~ process_input~ - Inside source: true *** True Line Result - # h_pressed_at is initially set to false, and changes once the user presses the "h" key. -** Processing line: ~ state.h_pressed_at ||= false~ + process_input +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.h_pressed_at ||= false + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false)~ -- Inside source: true -*** True Line Result - if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false) -** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font]~ -- Inside source: true -*** True Line Result - outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font] -** Processing line: ~ else # otherwise, label says "h" was never pressed~ +** Processing line: ~ # Outputs a label of the tick count (passage of time) and calls all render methods.~ - Inside source: true *** True Line Result - else # otherwise, label says "h" was never pressed -** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font]~ + # Outputs a label of the tick count (passage of time) and calls all render methods. +** Processing line: ~ def render~ - Inside source: true *** True Line Result - outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font] -** Processing line: ~ end~ + def render +** Processing line: ~ outputs.labels << [10, 30, state.tick_count]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.labels << [10, 30, state.tick_count] +** Processing line: ~ render_alert~ - Inside source: true *** True Line Result - -** Processing line: ~ # border around keyboard input demo section~ + render_alert +** Processing line: ~ render_room~ - Inside source: true *** True Line Result - # border around keyboard input demo section -** Processing line: ~ outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)]~ + render_room +** Processing line: ~ render_highlights~ - Inside source: true *** True Line Result - outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)] + render_highlights ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -27949,486 +28356,478 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets definition for a small label~ -- Inside source: true -*** True Line Result - # Sets definition for a small label -** Processing line: ~ # Makes it easier to position labels in respect to the position of other labels~ -- Inside source: true -*** True Line Result - # Makes it easier to position labels in respect to the position of other labels -** Processing line: ~ def small_label x, row, message~ +** Processing line: ~ # Outputs a label onto the screen that shows the story line, and also outputs a "close" button.~ - Inside source: true *** True Line Result - def small_label x, row, message -** Processing line: ~ [x, row_to_px(row), message, small_font]~ + # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. +** Processing line: ~ def render_alert~ - Inside source: true *** True Line Result - [x, row_to_px(row), message, small_font] -** Processing line: ~ end~ + def render_alert +** Processing line: ~ return unless game.active_module == :alert~ - Inside source: true *** True Line Result - end + return unless game.active_module == :alert ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Uses small labels to show whether the "a" button on the controller is down, held, or up.~ +** Processing line: ~ outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label~ - Inside source: true *** True Line Result - # Uses small labels to show whether the "a" button on the controller is down, held, or up. -** Processing line: ~ # y value of each small label is set by calling the row_to_px method~ + outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label +** Processing line: ~ outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line~ - Inside source: true *** True Line Result - # y value of each small label is set by calling the row_to_px method -** Processing line: ~ def controller_tech_demo~ + outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line +** Processing line: ~ end~ - Inside source: true *** True Line Result - def controller_tech_demo -** Processing line: ~ x = 460~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~ outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")~ + +** Processing line: ~ def render_room~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one") -** Processing line: ~ outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")~ + def render_room +** Processing line: ~ return unless game.active_module == :room~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 7, "Current state of the \"a\" button.") -** Processing line: ~ outputs.labels << small_label(x, 8, "Check console window for more info.")~ + return unless game.active_module == :room +** Processing line: ~ outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 8, "Check console window for more info.") + outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.controller_one.key_down.a # if "a" is in "down" state~ -- Inside source: true -*** True Line Result - if inputs.controller_one.key_down.a # if "a" is in "down" state -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")~ +** Processing line: ~ # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}") -** Processing line: ~ puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred~ + # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value +** Processing line: ~ # that positions it 60 pixels lower than the previous output.~ - Inside source: true *** True Line Result - puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred -** Processing line: ~ elsif inputs.controller_one.key_held.a # if "a" is held down~ + # that positions it 60 pixels lower than the previous output. +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs.controller_one.key_held.a # if "a" is held down -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")~ + +** Processing line: ~ # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance)~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}") -** Processing line: ~ elsif inputs.controller_one.key_up.a # if "a" is in up state~ + # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) +** Processing line: ~ outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress)~ - Inside source: true *** True Line Result - elsif inputs.controller_one.key_up.a # if "a" is in up state -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")~ + outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) +** Processing line: ~ outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}") -** Processing line: ~ puts "\"a\" key up at #{inputs.controller_one.key_up.a}"~ + outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button +** Processing line: ~ outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button~ - Inside source: true *** True Line Result - puts "\"a\" key up at #{inputs.controller_one.key_up.a}" -** Processing line: ~ else # if no event has occurred~ + outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button +** Processing line: ~ outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button~ - Inside source: true *** True Line Result - else # if no event has occurred -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button state is nil.")~ + outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button +** Processing line: ~ outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 9, "\"a\" button state is nil.") -** Processing line: ~ end~ + outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # border around controller input demo section~ +** Processing line: ~ # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.~ - Inside source: true *** True Line Result - # border around controller input demo section -** Processing line: ~ outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]~ + # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. +** Processing line: ~ def render_highlights~ - Inside source: true *** True Line Result - outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)] -** Processing line: ~ end~ + def render_highlights +** Processing line: ~ state.layout.highlights.each do |h| # for each highlight in the collection~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.layout.highlights.each do |h| # for each highlight in the collection +** Processing line: ~ h.lifetime -= 1 # decrease the value of its lifetime~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs when the mouse was clicked, as well as the coordinates on the screen~ + h.lifetime -= 1 # decrease the value of its lifetime +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Outputs when the mouse was clicked, as well as the coordinates on the screen -** Processing line: ~ # of where the click occurred~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # of where the click occurred -** Processing line: ~ def mouse_tech_demo~ + +** Processing line: ~ outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection~ - Inside source: true *** True Line Result - def mouse_tech_demo -** Processing line: ~ x = 460~ + outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection +** Processing line: ~ [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~~ + [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight +** Processing line: ~ # transparency changes; divide lifetime by max_lifetime, multiply result by 255~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse")~ + # transparency changes; divide lifetime by max_lifetime, multiply result by 255 +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse") + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.mouse.click # if click has a value and is not nil~ +** Processing line: ~ # reject highlights from collection that have no remaining lifetime~ - Inside source: true *** True Line Result - if inputs.mouse.click # if click has a value and is not nil -** Processing line: ~ state.last_mouse_click = inputs.mouse.click # coordinates of click are stored~ + # reject highlights from collection that have no remaining lifetime +** Processing line: ~ state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 }~ - Inside source: true *** True Line Result - state.last_mouse_click = inputs.mouse.click # coordinates of click are stored -** Processing line: ~ end~ + state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.last_mouse_click # if mouse is clicked (has coordinates as value)~ -- Inside source: true -*** True Line Result - if state.last_mouse_click # if mouse is clicked (has coordinates as value) -** Processing line: ~ # outputs the time (frame) the click occurred, as well as how many frames have passed since the event~ +** Processing line: ~ # Checks whether or not a button was clicked.~ - Inside source: true *** True Line Result - # outputs the time (frame) the click occurred, as well as how many frames have passed since the event -** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}")~ + # Checks whether or not a button was clicked. +** Processing line: ~ # Returns a boolean value.~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}") -** Processing line: ~ # outputs coordinates of click~ + # Returns a boolean value. +** Processing line: ~ def process_input~ - Inside source: true *** True Line Result - # outputs coordinates of click -** Processing line: ~ outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}")~ + def process_input +** Processing line: ~ button = button_clicked? # calls button_clicked? method~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}") -** Processing line: ~ else # otherwise if the mouse has not been clicked~ + button = button_clicked? # calls button_clicked? method +** Processing line: ~ end~ - Inside source: true *** True Line Result - else # otherwise if the mouse has not been clicked -** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.")~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.") -** Processing line: ~ outputs.labels << small_label(x, 13, "Please click mouse.")~ + +** Processing line: ~ # Returns a boolean value.~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 13, "Please click mouse.") -** Processing line: ~ end~ + # Returns a boolean value. +** Processing line: ~ # Finds the button that was clicked from the button list and determines what method to call.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Finds the button that was clicked from the button list and determines what method to call. +** Processing line: ~ # Adds a highlight to the highlights collection.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Adds a highlight to the highlights collection. +** Processing line: ~ def button_clicked?~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs whether a mouse click occurred inside or outside of a box~ + def button_clicked? +** Processing line: ~ return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click~ - Inside source: true *** True Line Result - # Outputs whether a mouse click occurred inside or outside of a box -** Processing line: ~ def point_to_rect_tech_demo~ + return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click +** Processing line: ~ button = @button_list.find do |k, v| # goes through button_list to find button clicked~ - Inside source: true *** True Line Result - def point_to_rect_tech_demo -** Processing line: ~ x = 460~ + button = @button_list.find do |k, v| # goes through button_list to find button clicked +** Processing line: ~ click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button?~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~~ + click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->")~ + end +** Processing line: ~ return unless button # return unless a button was clicked~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->") -** Processing line: ~~ + return unless button # return unless a button was clicked +** Processing line: ~ method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game)~ - Inside source: true *** True Line Result - -** Processing line: ~ box = [765, 370, 50, 50, 0, 0, 170] # blue box~ + method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) +** Processing line: ~ if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists)~ - Inside source: true *** True Line Result - box = [765, 370, 50, 50, 0, 0, 170] # blue box -** Processing line: ~ outputs.borders << box~ + if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) +** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in button list hash~ - Inside source: true *** True Line Result - outputs.borders << box + border = button[1][:primitives].last # sets border definition using value of last key in button list hash ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.last_mouse_click # if the mouse was clicked~ +** Processing line: ~ # declares each highlight as a new entity, sets properties~ - Inside source: true *** True Line Result - if state.last_mouse_click # if the mouse was clicked -** Processing line: ~ if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box~ + # declares each highlight as a new entity, sets properties +** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ - Inside source: true *** True Line Result - if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened inside the box.")~ + state.layout.highlights << state.new_entity(:highlight) do |h| +** Processing line: ~ h.x = border.x~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 16, "Mouse click happened inside the box.") -** Processing line: ~ else # otherwise, if mouse was clicked outside the box~ + h.x = border.x +** Processing line: ~ h.y = border.y~ - Inside source: true *** True Line Result - else # otherwise, if mouse was clicked outside the box -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened outside the box.")~ + h.y = border.y +** Processing line: ~ h.w = border.w~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 16, "Mouse click happened outside the box.") -** Processing line: ~ end~ + h.w = border.w +** Processing line: ~ h.h = border.h~ - Inside source: true *** True Line Result - end -** Processing line: ~ else # otherwise, if was not clicked at all~ + h.h = border.h +** Processing line: ~ h.max_lifetime = 10~ - Inside source: true *** True Line Result - else # otherwise, if was not clicked at all -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked~ + h.max_lifetime = 10 +** Processing line: ~ h.lifetime = h.max_lifetime~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked -** Processing line: ~ end~ + h.lifetime = h.max_lifetime +** Processing line: ~ h.color = [120, 120, 180] # sets color to shade of purple~ - Inside source: true *** True Line Result - end + h.color = [120, 120, 180] # sets color to shade of purple +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # border around mouse input demo section~ +** Processing line: ~ self.send method_to_call # invoke method identified by symbol~ - Inside source: true *** True Line Result - # border around mouse input demo section -** Processing line: ~ outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]~ + self.send method_to_call # invoke method identified by symbol +** Processing line: ~ else # otherwise, if self doesn't respond to given method~ - Inside source: true *** True Line Result - outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)] -** Processing line: ~ end~ + else # otherwise, if self doesn't respond to given method +** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in hash~ - Inside source: true *** True Line Result - end + border = button[1][:primitives].last # sets border definition using value of last key in hash ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output~ +** Processing line: ~ # declares each highlight as a new entity, sets properties~ - Inside source: true *** True Line Result - # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output -** Processing line: ~ # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not~ + # declares each highlight as a new entity, sets properties +** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ - Inside source: true *** True Line Result - # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not -** Processing line: ~ # they intersect.~ + state.layout.highlights << state.new_entity(:highlight) do |h| +** Processing line: ~ h.x = border.x~ - Inside source: true *** True Line Result - # they intersect. -** Processing line: ~ def rect_to_rect_tech_demo~ + h.x = border.x +** Processing line: ~ h.y = border.y~ - Inside source: true *** True Line Result - def rect_to_rect_tech_demo -** Processing line: ~ x = 460~ + h.y = border.y +** Processing line: ~ h.w = border.w~ - Inside source: true *** True Line Result - x = 460 -** Processing line: ~~ + h.w = border.w +** Processing line: ~ h.h = border.h~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions~ + h.h = border.h +** Processing line: ~ h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions -** Processing line: ~ red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box~ + h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true +** Processing line: ~ h.lifetime = h.max_lifetime~ - Inside source: true *** True Line Result - red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box -** Processing line: ~ outputs.borders << red_box # output as a border (not filled in)~ + h.lifetime = h.max_lifetime +** Processing line: ~ h.color = [120, 80, 80] # sets color to dark color~ - Inside source: true *** True Line Result - outputs.borders << red_box # output as a border (not filled in) + h.color = [120, 80, 80] # sets color to dark color +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If the mouse is clicked inside the red box, two collision boxes are created.~ +** Processing line: ~ # instructions for users on how to add the missing method_to_call to the code~ - Inside source: true *** True Line Result - # If the mouse is clicked inside the red box, two collision boxes are created. -** Processing line: ~ if inputs.mouse.click~ + # instructions for users on how to add the missing method_to_call to the code +** Processing line: ~ puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:"~ - Inside source: true *** True Line Result - if inputs.mouse.click -** Processing line: ~ if inputs.mouse.click.point.inside_rect? red_box~ + puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" +** Processing line: ~ puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition."~ - Inside source: true *** True Line Result - if inputs.mouse.click.point.inside_rect? red_box -** Processing line: ~ if !state.box_collision_one # if the collision_one box does not yet have a definition~ + puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." +** Processing line: ~ puts ""~ - Inside source: true *** True Line Result - if !state.box_collision_one # if the collision_one box does not yet have a definition -** Processing line: ~ # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.~ + puts "" +** Processing line: ~ puts "```"~ - Inside source: true *** True Line Result - # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box. -** Processing line: ~ # You can try deleting the subtraction to see how it impacts the box placement.~ + puts "```" +** Processing line: ~ puts "class TextedBasedGamePresenter <--- find this class and put the method below in it"~ - Inside source: true *** True Line Result - # You can try deleting the subtraction to see how it impacts the box placement. -** Processing line: ~ state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition~ + puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" +** Processing line: ~ puts ""~ - Inside source: true *** True Line Result - state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition -** Processing line: ~ elsif !state.box_collision_two # if collision_two does not yet have a definition~ + puts "" +** Processing line: ~ puts " def #{method_to_call}"~ - Inside source: true *** True Line Result - elsif !state.box_collision_two # if collision_two does not yet have a definition -** Processing line: ~ state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition~ + puts " def #{method_to_call}" +** Processing line: ~ puts " puts 'Yay that worked!'"~ - Inside source: true *** True Line Result - state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition -** Processing line: ~ else~ + puts " puts 'Yay that worked!'" +** Processing line: ~ puts " end"~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.box_collision_one = nil # both boxes are empty~ + puts " end" +** Processing line: ~ puts ""~ - Inside source: true *** True Line Result - state.box_collision_one = nil # both boxes are empty -** Processing line: ~ state.box_collision_two = nil~ + puts "" +** Processing line: ~ puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement."~ - Inside source: true *** True Line Result - state.box_collision_two = nil -** Processing line: ~ end~ + puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." +** Processing line: ~ puts "```"~ - Inside source: true *** True Line Result - end + puts "```" +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If collision boxes exist, they are output onto screen inside the red box as solids~ -- Inside source: true -*** True Line Result - # If collision boxes exist, they are output onto screen inside the red box as solids -** Processing line: ~ if state.box_collision_one~ +** Processing line: ~ # Returns the position of the mouse when it is clicked.~ - Inside source: true *** True Line Result - if state.box_collision_one -** Processing line: ~ outputs.solids << state.box_collision_one~ + # Returns the position of the mouse when it is clicked. +** Processing line: ~ def click_pos~ - Inside source: true *** True Line Result - outputs.solids << state.box_collision_one -** Processing line: ~ end~ + def click_pos +** Processing line: ~ return nil unless inputs.mouse.click # returns nil unless the mouse was clicked~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return nil unless inputs.mouse.click # returns nil unless the mouse was clicked +** Processing line: ~ return inputs.mouse.click.point # returns location of mouse click (coordinates)~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.box_collision_two~ + return inputs.mouse.click.point # returns location of mouse click (coordinates) +** Processing line: ~ end~ - Inside source: true *** True Line Result - if state.box_collision_two -** Processing line: ~ outputs.solids << state.box_collision_two~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.solids << state.box_collision_two -** Processing line: ~ end~ + +** Processing line: ~ # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) +** Processing line: ~ def button id, x, y, text~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs whether or not the two collision boxes intersect.~ + def button id, x, y, text +** Processing line: ~ @button_list[id] ||= { # assigns values to hash keys~ - Inside source: true *** True Line Result - # Outputs whether or not the two collision boxes intersect. -** Processing line: ~ if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)~ + @button_list[id] ||= { # assigns values to hash keys +** Processing line: ~ id: id,~ - Inside source: true *** True Line Result - if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty) -** Processing line: ~ if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect~ + id: id, +** Processing line: ~ text: text,~ - Inside source: true *** True Line Result - if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect -** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes intersect.')~ + text: text, +** Processing line: ~ primitives: [~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 23.5, 'The boxes intersect.') -** Processing line: ~ else # otherwise, if the two boxes do not intersect~ + primitives: [ +** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # positions label inside border~ - Inside source: true *** True Line Result - else # otherwise, if the two boxes do not intersect -** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')~ + [x + 10, y + 30, text, 2, 0].label, # positions label inside border +** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.') -** Processing line: ~ end~ + [x, y, 300, 50].border, # sets definition of border +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output -** Processing line: ~ end~ + +** Processing line: ~ @button_list[id][:primitives] # returns label and border for buttons~ - Inside source: true *** True Line Result - end + @button_list[id][:primitives] # returns label and border for buttons ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28437,102 +28836,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates a button and outputs it onto the screen using labels and borders.~ +** Processing line: ~ # Creates a progress bar (used for lighting the fire) and sets its values.~ - Inside source: true *** True Line Result - # Creates a button and outputs it onto the screen using labels and borders. -** Processing line: ~ # If the button is clicked, the color changes to make it look faded.~ -- Inside source: true -*** True Line Result - # If the button is clicked, the color changes to make it look faded. -** Processing line: ~ def button_tech_demo~ -- Inside source: true -*** True Line Result - def button_tech_demo -** Processing line: ~ x, y, w, h = 460, 160, 300, 50~ + # Creates a progress bar (used for lighting the fire) and sets its values. +** Processing line: ~ def progress_bar id, x, y, text, percentage~ - Inside source: true *** True Line Result - x, y, w, h = 460, 160, 300, 50 -** Processing line: ~ state.button ||= state.new_entity(:button_with_fade)~ + def progress_bar id, x, y, text, percentage +** Processing line: ~ @button_list[id] = { # assigns values to hash keys~ - Inside source: true *** True Line Result - state.button ||= state.new_entity(:button_with_fade) -** Processing line: ~~ + @button_list[id] = { # assigns values to hash keys +** Processing line: ~ id: id,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.~ + id: id, +** Processing line: ~ text: text,~ - Inside source: true *** True Line Result - # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders. -** Processing line: ~ state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1]~ + text: text, +** Processing line: ~ primitives: [~ - Inside source: true *** True Line Result - state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1] -** Processing line: ~ state.button.border ||= [x, y, w, h]~ + primitives: [ +** Processing line: ~ [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray)~ - Inside source: true *** True Line Result - state.button.border ||= [x, y, w, h] -** Processing line: ~~ + [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) +** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border~ + [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border +** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ - Inside source: true *** True Line Result - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border -** Processing line: ~ state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred~ + [x, y, 300, 50].border, # sets definition of border +** Processing line: ~ ]~ - Inside source: true *** True Line Result - state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << state.button.label~ -- Inside source: true -*** True Line Result - outputs.labels << state.button.label -** Processing line: ~ outputs.borders << state.button.border~ +** Processing line: ~ # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by~ - Inside source: true *** True Line Result - outputs.borders << state.button.border -** Processing line: ~~ + # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by +** Processing line: ~ # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in.~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.button.clicked_at # if button was clicked (variable has a value and is not nil)~ + # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. +** Processing line: ~ @button_list[id][:primitives][0][2] = 300 * percentage~ - Inside source: true *** True Line Result - if state.button.clicked_at # if button was clicked (variable has a value and is not nil) -** Processing line: ~~ + @button_list[id][:primitives][0][2] = 300 * percentage +** Processing line: ~ @button_list[id][:primitives]~ - Inside source: true *** True Line Result - -** Processing line: ~ # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.~ + @button_list[id][:primitives] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # The appearance of the button changes for 0.25 seconds after the time the button is clicked at. -** Processing line: ~ # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes. -** Processing line: ~ # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.~ + +** Processing line: ~ # Defines the game.~ - Inside source: true *** True Line Result - # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal. -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]~ + # Defines the game. +** Processing line: ~ def game~ - Inside source: true *** True Line Result - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)] -** Processing line: ~ end~ + def game +** Processing line: ~ @game~ - Inside source: true *** True Line Result - end + @game ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28541,34 +28928,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates a new button by declaring it as a new entity, and sets values.~ -- Inside source: true -*** True Line Result - # Creates a new button by declaring it as a new entity, and sets values. -** Processing line: ~ def new_button_prefab x, y, message~ -- Inside source: true -*** True Line Result - def new_button_prefab x, y, message -** Processing line: ~ w, h = 300, 50~ -- Inside source: true -*** True Line Result - w, h = 300, 50 -** Processing line: ~ button = state.new_entity(:button_with_fade)~ +** Processing line: ~ # Initalizes the game and creates an empty list of buttons.~ - Inside source: true *** True Line Result - button = state.new_entity(:button_with_fade) -** Processing line: ~ button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders~ + # Initalizes the game and creates an empty list of buttons. +** Processing line: ~ def initialize~ - Inside source: true *** True Line Result - button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders -** Processing line: ~ button.border = [x, y, w, h] # sets border definition~ + def initialize +** Processing line: ~ @game = TextedBasedGame.new self~ - Inside source: true *** True Line Result - button.border = [x, y, w, h] # sets border definition -** Processing line: ~ button~ + @game = TextedBasedGame.new self +** Processing line: ~ @button_list ||= {}~ - Inside source: true *** True Line Result - button + @button_list ||= {} ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28577,22 +28952,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # If the mouse has been clicked and the click's location is inside of the button's border, that means~ +** Processing line: ~ # Clears the storyline and takes the user to the room.~ - Inside source: true *** True Line Result - # If the mouse has been clicked and the click's location is inside of the button's border, that means -** Processing line: ~ # that the button has been clicked. This method returns a boolean value.~ + # Clears the storyline and takes the user to the room. +** Processing line: ~ def alert_dismiss_clicked~ - Inside source: true *** True Line Result - # that the button has been clicked. This method returns a boolean value. -** Processing line: ~ def button_clicked? button~ + def alert_dismiss_clicked +** Processing line: ~ game.clear_storyline~ - Inside source: true *** True Line Result - def button_clicked? button -** Processing line: ~ inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)~ + game.clear_storyline +** Processing line: ~ game.go_to_room~ - Inside source: true *** True Line Result - inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border) + game.go_to_room ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28601,62 +28976,58 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Determines if button was clicked, and changes its appearance if it is clicked~ +** Processing line: ~ # Lights the fire when the user clicks the "light fire" option.~ - Inside source: true *** True Line Result - # Determines if button was clicked, and changes its appearance if it is clicked -** Processing line: ~ def tick_button_prefab button~ + # Lights the fire when the user clicks the "light fire" option. +** Processing line: ~ def light_fire_clicked~ - Inside source: true *** True Line Result - def tick_button_prefab button -** Processing line: ~ outputs.labels << button.label # outputs button's label and border~ + def light_fire_clicked +** Processing line: ~ game.light_fire~ - Inside source: true *** True Line Result - outputs.labels << button.label # outputs button's label and border -** Processing line: ~ outputs.borders << button.border~ + game.light_fire +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.borders << button.border + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if button_clicked? button # if button is clicked~ -- Inside source: true -*** True Line Result - if button_clicked? button # if button is clicked -** Processing line: ~ button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked~ +** Processing line: ~ # Saves the game when the user clicks the "save" option.~ - Inside source: true *** True Line Result - button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked -** Processing line: ~ end~ + # Saves the game when the user clicks the "save" option. +** Processing line: ~ def save_game_clicked~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def save_game_clicked +** Processing line: ~ game.save~ - Inside source: true *** True Line Result - -** Processing line: ~ if button.clicked_at # if clicked_at has a frame value and is not nil~ + game.save +** Processing line: ~ end~ - Inside source: true *** True Line Result - if button.clicked_at # if clicked_at has a frame value and is not nil -** Processing line: ~ # button is output; color changes and transparency changes for 0.25 seconds after click occurs~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # button is output; color changes and transparency changes for 0.25 seconds after click occurs -** Processing line: ~ outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,~ + +** Processing line: ~ # Resets the game when the user clicks the "reset" option.~ - Inside source: true *** True Line Result - outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h, -** Processing line: ~ 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds~ + # Resets the game when the user clicks the "reset" option. +** Processing line: ~ def reset_game_clicked~ - Inside source: true *** True Line Result - 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds -** Processing line: ~ end~ + def reset_game_clicked +** Processing line: ~ game.reset~ - Inside source: true *** True Line Result - end + game.reset ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28665,226 +29036,230 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Exports the app's game state if the export button is clicked.~ -- Inside source: true -*** True Line Result - # Exports the app's game state if the export button is clicked. -** Processing line: ~ def export_game_state_demo~ +** Processing line: ~ # Loads the game when the user clicks the "load" option.~ - Inside source: true *** True Line Result - def export_game_state_demo -** Processing line: ~ state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state")~ + # Loads the game when the user clicks the "load" option. +** Processing line: ~ def load_game_clicked~ - Inside source: true *** True Line Result - state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state") -** Processing line: ~ tick_button_prefab(state.export_game_state_button) # calls method to output button~ + def load_game_clicked +** Processing line: ~ game.load~ - Inside source: true *** True Line Result - tick_button_prefab(state.export_game_state_button) # calls method to output button -** Processing line: ~ if button_clicked? state.export_game_state_button # if the export button is clicked~ + game.load +** Processing line: ~ end~ - Inside source: true *** True Line Result - if button_clicked? state.export_game_state_button # if the export button is clicked -** Processing line: ~ args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ $text_based_rpg = TextedBasedGamePresenter.new~ - Inside source: true *** True Line Result - end + $text_based_rpg = TextedBasedGamePresenter.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window.~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window. -** Processing line: ~ def window_state_demo~ + def tick args +** Processing line: ~ $text_based_rpg.state = args.state~ - Inside source: true *** True Line Result - def window_state_demo -** Processing line: ~ m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement)~ + $text_based_rpg.state = args.state +** Processing line: ~ $text_based_rpg.outputs = args.outputs~ - Inside source: true *** True Line Result - m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement) -** Processing line: ~ k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N'~ + $text_based_rpg.outputs = args.outputs +** Processing line: ~ $text_based_rpg.inputs = args.inputs~ - Inside source: true *** True Line Result - k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N' -** Processing line: ~ outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font]~ + $text_based_rpg.inputs = args.inputs +** Processing line: ~ $text_based_rpg.tick~ - Inside source: true *** True Line Result - outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font] -** Processing line: ~ end~ + $text_based_rpg.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Sets values for the horizontal separator (divides demo sections)~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - #Sets values for the horizontal separator (divides demo sections) -** Processing line: ~ def horizontal_seperator y, x, x2~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - def horizontal_seperator y, x, x2 -** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ -- Inside source: true + +** Processing line: ~* Advanced Rendering - Simple Render Targets - main.rb~ +- Header detected. *** True Line Result - [x, y, x2, y, 150, 150, 150] -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ -- Inside source: true +* Advanced Rendering - Simple Render Targets - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ #Sets the values for the vertical separator (divides demo sections)~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb~ - Inside source: true *** True Line Result - #Sets the values for the vertical separator (divides demo sections) -** Processing line: ~ def vertical_seperator x, y, y2~ + # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - def vertical_seperator x, y, y2 -** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ + def tick args +** Processing line: ~ # args.outputs.render_targets are really really powerful.~ - Inside source: true *** True Line Result - [x, y, x, y2, 150, 150, 150] -** Processing line: ~ end~ + # args.outputs.render_targets are really really powerful. +** Processing line: ~ # They essentially allow you to create a sprite programmatically and cache the result.~ - Inside source: true *** True Line Result - end + # They essentially allow you to create a sprite programmatically and cache the result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs vertical and horizontal separators onto the screen to separate each demo section.~ +** Processing line: ~ # Create a render_target of a :block and a :gradient on tick zero.~ - Inside source: true *** True Line Result - # Outputs vertical and horizontal separators onto the screen to separate each demo section. -** Processing line: ~ def render_seperators~ + # Create a render_target of a :block and a :gradient on tick zero. +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - def render_seperators -** Processing line: ~ outputs.lines << horizontal_seperator(505, grid.left, 445)~ + if args.state.tick_count == 0 +** Processing line: ~ args.render_target(:block).solids << [0, 0, 1280, 100]~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(505, grid.left, 445) -** Processing line: ~ outputs.lines << horizontal_seperator(353, grid.left, 445)~ + args.render_target(:block).solids << [0, 0, 1280, 100] +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(353, grid.left, 445) -** Processing line: ~ outputs.lines << horizontal_seperator(264, grid.left, 445)~ + +** Processing line: ~ # The gradient is actually just a collection of black solids with increasing~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(264, grid.left, 445) -** Processing line: ~ outputs.lines << horizontal_seperator(174, grid.left, 445)~ + # The gradient is actually just a collection of black solids with increasing +** Processing line: ~ # opacities.~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(174, grid.left, 445) -** Processing line: ~~ + # opacities. +** Processing line: ~ args.render_target(:gradient).solids << 90.map_with_index do |x|~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.lines << vertical_seperator(445, grid.top, grid.bottom)~ + args.render_target(:gradient).solids << 90.map_with_index do |x| +** Processing line: ~ 50.map_with_index do |y|~ - Inside source: true *** True Line Result - outputs.lines << vertical_seperator(445, grid.top, grid.bottom) -** Processing line: ~~ + 50.map_with_index do |y| +** Processing line: ~ [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255]~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.lines << horizontal_seperator(690, 445, 820)~ + [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(690, 445, 820) -** Processing line: ~ outputs.lines << horizontal_seperator(426, 445, 820)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.lines << horizontal_seperator(426, 445, 820) + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.lines << vertical_seperator(820, grid.top, grid.bottom)~ +** Processing line: ~ # Take the :block render_target and present it horizontally centered.~ - Inside source: true *** True Line Result - outputs.lines << vertical_seperator(820, grid.top, grid.bottom) -** Processing line: ~ end~ + # Take the :block render_target and present it horizontally centered. +** Processing line: ~ # Use a subsection of the render_targetd specified by source_x,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Use a subsection of the render_targetd specified by source_x, +** Processing line: ~ # source_y, source_w, source_h.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # source_y, source_w, source_h. +** Processing line: ~ args.outputs.sprites << { x: 0,~ - Inside source: true *** True Line Result - -** Processing line: ~ $tech_demo = TechDemo.new~ + args.outputs.sprites << { x: 0, +** Processing line: ~ y: 310,~ - Inside source: true *** True Line Result - $tech_demo = TechDemo.new -** Processing line: ~~ + y: 310, +** Processing line: ~ w: 1280,~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + w: 1280, +** Processing line: ~ h: 100,~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $tech_demo.inputs = args.inputs~ + h: 100, +** Processing line: ~ path: :block,~ - Inside source: true *** True Line Result - $tech_demo.inputs = args.inputs -** Processing line: ~ $tech_demo.state = args.state~ + path: :block, +** Processing line: ~ source_x: 0,~ - Inside source: true *** True Line Result - $tech_demo.state = args.state -** Processing line: ~ $tech_demo.grid = args.grid~ + source_x: 0, +** Processing line: ~ source_y: 0,~ - Inside source: true *** True Line Result - $tech_demo.grid = args.grid -** Processing line: ~ $tech_demo.args = args~ + source_y: 0, +** Processing line: ~ source_w: 1280,~ - Inside source: true *** True Line Result - $tech_demo.args = args -** Processing line: ~ $tech_demo.outputs = args.render_target(:mini_map)~ + source_w: 1280, +** Processing line: ~ source_h: 100 }~ - Inside source: true *** True Line Result - $tech_demo.outputs = args.render_target(:mini_map) -** Processing line: ~ $tech_demo.tick~ + source_h: 100 } +** Processing line: ~~ - Inside source: true *** True Line Result - $tech_demo.tick -** Processing line: ~ args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]]~ + +** Processing line: ~ # After rendering :block, render gradient on top of :block.~ - Inside source: true *** True Line Result - args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]] -** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :mini_map]~ + # After rendering :block, render gradient on top of :block. +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :gradient]~ - Inside source: true *** True Line Result - args.outputs.sprites << [0, 0, 1280, 720, :mini_map] -** Processing line: ~ args.outputs.sprites << [830, 300, 675, 379, :mini_map]~ + args.outputs.sprites << [0, 0, 1280, 720, :gradient] +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.sprites << [830, 300, 675, 379, :mini_map] -** Processing line: ~ tick_instructions args, "Sample app shows all the rendering apis available."~ + +** Processing line: ~ args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255]~ - Inside source: true *** True Line Result - tick_instructions args, "Sample app shows all the rendering apis available." + args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255] +** Processing line: ~ tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)."~ +- Inside source: true +*** True Line Result + tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -28949,6 +29324,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -28957,306 +29340,342 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb~ +** Processing line: ~* Advanced Rendering - Render Targets With Alphas - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb +* Advanced Rendering - Render Targets With Alphas - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/07_advanced_rendering/02_render_targets_with_alphas/app/main.rb~ - Inside source: true *** True Line Result - =begin + # ./samples/07_advanced_rendering/02_render_targets_with_alphas/app/main.rb +** Processing line: ~ # This sample is meant to show you how to do that dripping transition thing~ +- Inside source: true +*** True Line Result + # This sample is meant to show you how to do that dripping transition thing +** Processing line: ~ # at the start of the original Doom. Most of this file is here to animate~ +- Inside source: true +*** True Line Result + # at the start of the original Doom. Most of this file is here to animate +** Processing line: ~ # a scene to wipe away; the actual wipe effect is in the last 20 lines or~ +- Inside source: true +*** True Line Result + # a scene to wipe away; the actual wipe effect is in the last 20 lines or +** Processing line: ~ # so.~ +- Inside source: true +*** True Line Result + # so. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ $gtk.reset # reset all game state if reloaded.~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + $gtk.reset # reset all game state if reloaded. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Nested array: An array whose individual elements are also arrays; useful for~ +** Processing line: ~ def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance~ - Inside source: true *** True Line Result - - Nested array: An array whose individual elements are also arrays; useful for -** Processing line: ~ storing groups of similar data. Also called multidimensional arrays.~ + def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance +** Processing line: ~ numblocks = 10~ - Inside source: true *** True Line Result - storing groups of similar data. Also called multidimensional arrays. + numblocks = 10 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ In this sample app, we see nested arrays being used in object definitions.~ -- Inside source: true -*** True Line Result - In this sample app, we see nested arrays being used in object definitions. -** Processing line: ~ Notice the parameters for solids, listed below. Parameters 1-3 set the~ +** Processing line: ~ for i in 1..numblocks do~ - Inside source: true *** True Line Result - Notice the parameters for solids, listed below. Parameters 1-3 set the -** Processing line: ~ definition for the rect, and parameter 4 sets the definition of the color.~ + for i in 1..numblocks do +** Processing line: ~ angle = ((360 / numblocks) * i) + angleoffset~ - Inside source: true *** True Line Result - definition for the rect, and parameter 4 sets the definition of the color. -** Processing line: ~~ + angle = ((360 / numblocks) * i) + angleoffset +** Processing line: ~ radians = angle * (Math::PI / 180)~ - Inside source: true *** True Line Result - -** Processing line: ~ Instead of having a solid definition that looks like this,~ + radians = angle * (Math::PI / 180) +** Processing line: ~ x = (xoffset + (distance * Math.cos(radians))).round~ - Inside source: true *** True Line Result - Instead of having a solid definition that looks like this, -** Processing line: ~ [X, Y, W, H, R, G, B]~ + x = (xoffset + (distance * Math.cos(radians))).round +** Processing line: ~ y = (yoffset + (distance * Math.sin(radians))).round~ - Inside source: true *** True Line Result - [X, Y, W, H, R, G, B] -** Processing line: ~ we can separate it into two separate array definitions in one, like this~ + y = (yoffset + (distance * Math.sin(radians))).round +** Processing line: ~ pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ]~ - Inside source: true *** True Line Result - we can separate it into two separate array definitions in one, like this -** Processing line: ~ [[X, Y, W, H], [R, G, B]]~ + pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [[X, Y, W, H], [R, G, B]] -** Processing line: ~ and both options work fine in defining our solid (or any object).~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - and both options work fine in defining our solid (or any object). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Collections: Lists of data; useful for organizing large amounts of data.~ +** Processing line: ~ def draw_scene args, pass~ - Inside source: true *** True Line Result - - Collections: Lists of data; useful for organizing large amounts of data. -** Processing line: ~ One element of a collection could be an array (which itself contains many elements).~ + def draw_scene args, pass +** Processing line: ~ pass.solids << [0, 360, 1280, 360, 0, 0, 200]~ - Inside source: true *** True Line Result - One element of a collection could be an array (which itself contains many elements). -** Processing line: ~ For example, a collection that stores two solid objects would look like this:~ + pass.solids << [0, 360, 1280, 360, 0, 0, 200] +** Processing line: ~ pass.solids << [0, 0, 1280, 360, 0, 127, 0]~ - Inside source: true *** True Line Result - For example, a collection that stores two solid objects would look like this: -** Processing line: ~ [~ + pass.solids << [0, 0, 1280, 360, 0, 127, 0] +** Processing line: ~~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [100, 100, 50, 50, 0, 0, 0],~ + +** Processing line: ~ blocksize = 100~ - Inside source: true *** True Line Result - [100, 100, 50, 50, 0, 0, 0], -** Processing line: ~ [100, 150, 50, 50, 255, 255, 255]~ + blocksize = 100 +** Processing line: ~ angleoffset = args.state.tick_count * 2.5~ - Inside source: true *** True Line Result - [100, 150, 50, 50, 255, 255, 255] -** Processing line: ~ ]~ + angleoffset = args.state.tick_count * 2.5 +** Processing line: ~ centerx = (1280 - blocksize) / 2~ - Inside source: true *** True Line Result - ] -** Processing line: ~ If this collection was added to args.outputs.solids, two solids would be output~ + centerx = (1280 - blocksize) / 2 +** Processing line: ~ centery = (720 - blocksize) / 2~ - Inside source: true *** True Line Result - If this collection was added to args.outputs.solids, two solids would be output -** Processing line: ~ next to each other, one black and one white.~ + centery = (720 - blocksize) / 2 +** Processing line: ~~ - Inside source: true *** True Line Result - next to each other, one black and one white. -** Processing line: ~ Nested arrays can be used in collections, as you will see in this sample app.~ + +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500~ - Inside source: true *** True Line Result - Nested arrays can be used in collections, as you will see in this sample app. + circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500 +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325~ +- Inside source: true +*** True Line Result + circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325 +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200~ +- Inside source: true +*** True Line Result + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200 +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100~ +- Inside source: true +*** True Line Result + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - Reminders: + def tick args +** Processing line: ~ segments = 160~ +- Inside source: true +*** True Line Result + segments = 160 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ # On the first tick, initialize some stuff.~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters for a solid are~ + # On the first tick, initialize some stuff. +** Processing line: ~ if !args.state.yoffsets~ - Inside source: true *** True Line Result - The parameters for a solid are -** Processing line: ~ 1. The position on the screen (x, y)~ + if !args.state.yoffsets +** Processing line: ~ args.state.baseyoff = 0~ - Inside source: true *** True Line Result - 1. The position on the screen (x, y) -** Processing line: ~ 2. The width (w)~ + args.state.baseyoff = 0 +** Processing line: ~ args.state.yoffsets = []~ - Inside source: true *** True Line Result - 2. The width (w) -** Processing line: ~ 3. The height (h)~ + args.state.yoffsets = [] +** Processing line: ~ for i in 0..segments do~ - Inside source: true *** True Line Result - 3. The height (h) -** Processing line: ~ 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black)~ + for i in 0..segments do +** Processing line: ~ args.state.yoffsets << rand * 100~ - Inside source: true *** True Line Result - 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black) -** Processing line: ~ NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS!~ + args.state.yoffsets << rand * 100 +** Processing line: ~ end~ - Inside source: true *** True Line Result - NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS! + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Here is an example of a (red) border or solid definition:~ +** Processing line: ~ # Just draw some random stuff for a few seconds.~ - Inside source: true *** True Line Result - Here is an example of a (red) border or solid definition: -** Processing line: ~ [100, 100, 400, 500, 255, 0, 0]~ + # Just draw some random stuff for a few seconds. +** Processing line: ~ args.state.static_debounce ||= 60 * 2.5~ - Inside source: true *** True Line Result - [100, 100, 400, 500, 255, 0, 0] -** Processing line: ~ It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders.~ + args.state.static_debounce ||= 60 * 2.5 +** Processing line: ~ if args.state.static_debounce > 0~ - Inside source: true *** True Line Result - It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders. -** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ + if args.state.static_debounce > 0 +** Processing line: ~ last_frame = args.state.static_debounce == 1~ - Inside source: true *** True Line Result - For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + last_frame = args.state.static_debounce == 1 +** Processing line: ~ target = last_frame ? args.render_target(:last_frame) : args.outputs~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ + target = last_frame ? args.render_target(:last_frame) : args.outputs +** Processing line: ~ draw_scene args, target~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. The values generate a sprite. -** Processing line: ~ The parameters for sprites are~ + draw_scene args, target +** Processing line: ~ args.state.static_debounce -= 1~ - Inside source: true *** True Line Result - The parameters for sprites are -** Processing line: ~ 1. The position on the screen (x, y)~ + args.state.static_debounce -= 1 +** Processing line: ~ return unless last_frame~ - Inside source: true *** True Line Result - 1. The position on the screen (x, y) -** Processing line: ~ 2. The width (w)~ + return unless last_frame +** Processing line: ~ end~ - Inside source: true *** True Line Result - 2. The width (w) -** Processing line: ~ 3. The height (h)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 3. The height (h) -** Processing line: ~ 4. The image path (p)~ + +** Processing line: ~ # build up the wipe...~ - Inside source: true *** True Line Result - 4. The image path (p) + # build up the wipe... ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Here is an example of a sprite definition:~ -- Inside source: true -*** True Line Result - Here is an example of a sprite definition: -** Processing line: ~ [100, 100, 400, 500, 'sprites/dragonruby.png']~ +** Processing line: ~ # this is the thing we're wiping to.~ - Inside source: true *** True Line Result - [100, 100, 400, 500, 'sprites/dragonruby.png'] -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ + # this is the thing we're wiping to. +** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ]~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. + args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding~ - Inside source: true *** True Line Result - =end + return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This code demonstrates the creation and output of objects like sprites, borders, and solids~ +** Processing line: ~ segmentw = 1280 / segments~ - Inside source: true *** True Line Result - # This code demonstrates the creation and output of objects like sprites, borders, and solids -** Processing line: ~ # If filled in, they are solids~ + segmentw = 1280 / segments +** Processing line: ~~ - Inside source: true *** True Line Result - # If filled in, they are solids -** Processing line: ~ # If hollow, they are borders~ + +** Processing line: ~ x = 0~ - Inside source: true *** True Line Result - # If hollow, they are borders -** Processing line: ~ # If images, they are sprites~ + x = 0 +** Processing line: ~ for i in 0..segments do~ - Inside source: true *** True Line Result - # If images, they are sprites -** Processing line: ~~ + for i in 0..segments do +** Processing line: ~ yoffset = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # Solids are added to args.outputs.solids~ + yoffset = 0 +** Processing line: ~ if args.state.yoffsets[i] < args.state.baseyoff~ - Inside source: true *** True Line Result - # Solids are added to args.outputs.solids -** Processing line: ~ # Borders are added to args.outputs.borders~ + if args.state.yoffsets[i] < args.state.baseyoff +** Processing line: ~ yoffset = args.state.baseyoff - args.state.yoffsets[i]~ - Inside source: true *** True Line Result - # Borders are added to args.outputs.borders -** Processing line: ~ # Sprites are added to args.outputs.sprites~ + yoffset = args.state.baseyoff - args.state.yoffsets[i] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Sprites are added to args.outputs.sprites + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The tick method runs 60 frames every second.~ +** Processing line: ~ # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment.~ - Inside source: true *** True Line Result - # The tick method runs 60 frames every second. -** Processing line: ~ # Your game is going to happen under this one function.~ + # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment. +** Processing line: ~ args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ]~ - Inside source: true *** True Line Result - # Your game is going to happen under this one function. -** Processing line: ~ def tick args~ + args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ] +** Processing line: ~ x += segmentw~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ border_as_solid_and_solid_as_border args~ + x += segmentw +** Processing line: ~ end~ - Inside source: true *** True Line Result - border_as_solid_and_solid_as_border args -** Processing line: ~ sprite_as_border_or_solids args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - sprite_as_border_or_solids args -** Processing line: ~ collection_of_borders_and_solids args~ + +** Processing line: ~ args.state.baseyoff += 4~ - Inside source: true *** True Line Result - collection_of_borders_and_solids args -** Processing line: ~ collection_of_sprites args~ + args.state.baseyoff += 4 +** Processing line: ~~ - Inside source: true *** True Line Result - collection_of_sprites args + +** Processing line: ~ tick_instructions args, "Sample app shows an advanced usage of render_target."~ +- Inside source: true +*** True Line Result + tick_instructions args, "Sample app shows an advanced usage of render_target." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -29265,1570 +29684,1542 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Shows a border being output onto the screen as a border and a solid~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # Shows a border being output onto the screen as a border and a solid -** Processing line: ~ # Also shows how colors can be set~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - # Also shows how colors can be set -** Processing line: ~ def border_as_solid_and_solid_as_border args~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - def border_as_solid_and_solid_as_border args -** Processing line: ~ border = [0, 0, 50, 50]~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - border = [0, 0, 50, 50] -** Processing line: ~ args.outputs.borders << border~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - args.outputs.borders << border -** Processing line: ~ args.outputs.solids << border~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - args.outputs.solids << border + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + args.state.key_event_occurred = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Red, green, blue saturations (last three parameters) can be any number between 0 and 255~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - # Red, green, blue saturations (last three parameters) can be any number between 0 and 255 -** Processing line: ~ border_with_color = [0, 100, 50, 50, 255, 0, 0]~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - border_with_color = [0, 100, 50, 50, 255, 0, 0] -** Processing line: ~ args.outputs.borders << border_with_color~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - args.outputs.borders << border_with_color -** Processing line: ~ args.outputs.solids << border_with_color~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.solids << border_with_color + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color -** Processing line: ~ args.outputs.borders << border_with_nested_color~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - args.outputs.borders << border_with_nested_color -** Processing line: ~ args.outputs.solids << border_with_nested_color~ -- Inside source: true + +** Processing line: ~* Advanced Rendering - Render Target Viewports - main.rb~ +- Header detected. *** True Line Result - args.outputs.solids << border_with_nested_color -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Advanced Rendering - Render Target Viewports - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb~ - Inside source: true *** True Line Result - border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect -** Processing line: ~ args.outputs.borders << border_with_nested_rect~ + # ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - args.outputs.borders << border_with_nested_rect -** Processing line: ~ args.outputs.solids << border_with_nested_rect~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.solids << border_with_nested_rect + +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +- Inside source: true +*** True Line Result + APIs listing that haven't been encountered in previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color -** Processing line: ~ args.outputs.borders << border_with_nested_color_and_rect~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ - Inside source: true *** True Line Result - args.outputs.borders << border_with_nested_color_and_rect -** Processing line: ~ args.outputs.solids << border_with_nested_color_and_rect~ + For example, if we want to create a new button, we would declare it as a new entity and +** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ - Inside source: true *** True Line Result - args.outputs.solids << border_with_nested_color_and_rect -** Processing line: ~ end~ + then define its properties. (Remember, you can use state to define ANY property and it will +** Processing line: ~ be retained across frames.)~ - Inside source: true *** True Line Result - end + be retained across frames.) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Shows a sprite output onto the screen as a sprite, border, and solid~ +** Processing line: ~ If you have a solar system and you're creating args.state.sun and setting its image path to an~ - Inside source: true *** True Line Result - # Shows a sprite output onto the screen as a sprite, border, and solid -** Processing line: ~ # Demonstrates that all three outputs appear differently on screen~ + If you have a solar system and you're creating args.state.sun and setting its image path to an +** Processing line: ~ image in the sprites folder, you would do the following:~ - Inside source: true *** True Line Result - # Demonstrates that all three outputs appear differently on screen -** Processing line: ~ def sprite_as_border_or_solids args~ + image in the sprites folder, you would do the following: +** Processing line: ~ (See samples/99_sample_nddnug_workshop for more details.)~ - Inside source: true *** True Line Result - def sprite_as_border_or_solids args -** Processing line: ~ sprite = [100, 0, 50, 50, 'sprites/ship.png']~ + (See samples/99_sample_nddnug_workshop for more details.) +** Processing line: ~~ - Inside source: true *** True Line Result - sprite = [100, 0, 50, 50, 'sprites/ship.png'] -** Processing line: ~ args.outputs.sprites << sprite~ + +** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ - Inside source: true *** True Line Result - args.outputs.sprites << sprite -** Processing line: ~~ + args.state.sun ||= args.state.new_entity(:sun) do |s| +** Processing line: ~ s.path = 'sprites/sun.png'~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sprite_as_border variable has same parameters (excluding position) as above object,~ + s.path = 'sprites/sun.png' +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Sprite_as_border variable has same parameters (excluding position) as above object, -** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.borders~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # but will appear differently on screen because it is added to args.outputs.borders -** Processing line: ~ sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png']~ + +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png'] -** Processing line: ~ args.outputs.borders << sprite_as_border~ + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - args.outputs.borders << sprite_as_border + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sprite_as_solid variable has same parameters (excluding position) as above object,~ +** Processing line: ~ For example, if we have a variable~ - Inside source: true *** True Line Result - # Sprite_as_solid variable has same parameters (excluding position) as above object, -** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.solids~ + For example, if we have a variable +** Processing line: ~ name = "Ruby"~ - Inside source: true *** True Line Result - # but will appear differently on screen because it is added to args.outputs.solids -** Processing line: ~ sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png']~ + name = "Ruby" +** Processing line: ~ then the line~ - Inside source: true *** True Line Result - sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png'] -** Processing line: ~ args.outputs.solids << sprite_as_solid~ + then the line +** Processing line: ~ puts "How are you, #{name}?"~ - Inside source: true *** True Line Result - args.outputs.solids << sprite_as_solid -** Processing line: ~ end~ + puts "How are you, #{name}?" +** Processing line: ~ would print "How are you, Ruby?" to the console.~ - Inside source: true *** True Line Result - end + would print "How are you, Ruby?" to the console. +** Processing line: ~ (Remember, string interpolation only works with double quotes!)~ +- Inside source: true +*** True Line Result + (Remember, string interpolation only works with double quotes!) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Holds and outputs a collection of borders and a collection of solids~ +** Processing line: ~ - Ternary operator (?): Similar to if statement; first evalulates whether a statement is~ - Inside source: true *** True Line Result - # Holds and outputs a collection of borders and a collection of solids -** Processing line: ~ # Collections are created by using arrays to hold parameters of each individual object~ + - Ternary operator (?): Similar to if statement; first evalulates whether a statement is +** Processing line: ~ true or false, and then executes a command depending on that result.~ - Inside source: true *** True Line Result - # Collections are created by using arrays to hold parameters of each individual object -** Processing line: ~ def collection_of_borders_and_solids args~ + true or false, and then executes a command depending on that result. +** Processing line: ~ For example, if we had a variable~ - Inside source: true *** True Line Result - def collection_of_borders_and_solids args -** Processing line: ~ collection_borders = [~ + For example, if we had a variable +** Processing line: ~ grade = 75~ - Inside source: true *** True Line Result - collection_borders = [ -** Processing line: ~ [~ + grade = 75 +** Processing line: ~ and used the ternary operator in the command~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [200, 0, 50, 50], # black border~ + and used the ternary operator in the command +** Processing line: ~ pass_or_fail = grade > 65 ? "pass" : "fail"~ - Inside source: true *** True Line Result - [200, 0, 50, 50], # black border -** Processing line: ~ [200, 100, 50, 50, 255, 0, 0], # red border~ + pass_or_fail = grade > 65 ? "pass" : "fail" +** Processing line: ~ then the value of pass_or_fail would be "pass" since grade's value was greater than 65.~ - Inside source: true *** True Line Result - [200, 100, 50, 50, 255, 0, 0], # red border -** Processing line: ~ [200, 200, 50, 50, [0, 255, 0]], # nested color~ + then the value of pass_or_fail would be "pass" since grade's value was greater than 65. +** Processing line: ~~ - Inside source: true *** True Line Result - [200, 200, 50, 50, [0, 255, 0]], # nested color -** Processing line: ~ ],~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [[200, 300, 50, 50], 0, 0, 255], # nested rect~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - [[200, 300, 50, 50], 0, 0, 255], # nested rect -** Processing line: ~ [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ + +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ - Inside source: true *** True Line Result - [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color -** Processing line: ~ ]~ + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ - Inside source: true *** True Line Result - ] + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.borders << collection_borders~ +** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ - Inside source: true *** True Line Result - args.outputs.borders << collection_borders -** Processing line: ~~ + - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction +** Processing line: ~ by adding or subracting.~ - Inside source: true *** True Line Result - -** Processing line: ~ collection_solids = [~ + by adding or subracting. +** Processing line: ~~ - Inside source: true *** True Line Result - collection_solids = [ -** Processing line: ~ [~ + +** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [[300, 300, 50, 50], 0, 0, 255], # nested rect~ + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array +** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ - Inside source: true *** True Line Result - [[300, 300, 50, 50], 0, 0, 255], # nested rect -** Processing line: ~ [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ + with at least four values is considered a rect. The inside_rect? function returns true +** Processing line: ~ or false depending on if the point is inside the rect.~ - Inside source: true *** True Line Result - [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color -** Processing line: ~ ],~ + or false depending on if the point is inside the rect. +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [300, 0, 50, 50],~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ - Inside source: true *** True Line Result - [300, 0, 50, 50], -** Processing line: ~ [300, 100, 50, 50, 255, 0, 0],~ + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - [300, 100, 50, 50, 255, 0, 0], -** Processing line: ~ [300, 200, 50, 50, [0, 255, 0]], # nested color~ + +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ - Inside source: true *** True Line Result - [300, 200, 50, 50, [0, 255, 0]], # nested color -** Processing line: ~ ]~ + - args.inputs.mouse.click: This property will be set if the mouse was clicked. +** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ - Inside source: true *** True Line Result - ] + For more information about the mouse, go to mygame/documentation/07-mouse.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.solids << collection_solids~ +** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ - Inside source: true *** True Line Result - args.outputs.solids << collection_solids -** Processing line: ~ end~ + - args.inputs.keyboard.key_up.KEY: The value of the properties will be set +** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + to the frame that the key_up event occurred (the frame correlates +** Processing line: ~ to args.state.tick_count).~ - Inside source: true *** True Line Result - -** Processing line: ~ # Holds and outputs a collection of sprites by adding it to args.outputs.sprites~ + to args.state.tick_count). +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - # Holds and outputs a collection of sprites by adding it to args.outputs.sprites -** Processing line: ~ # Also outputs a collection with same parameters (excluding position) by adding~ + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. +** Processing line: ~~ - Inside source: true *** True Line Result - # Also outputs a collection with same parameters (excluding position) by adding -** Processing line: ~ # it to args.outputs.solids and another to args.outputs.borders~ + +** Processing line: ~ - args.state.labels:~ - Inside source: true *** True Line Result - # it to args.outputs.solids and another to args.outputs.borders -** Processing line: ~ def collection_of_sprites args~ + - args.state.labels: +** Processing line: ~ The parameters for a label are~ - Inside source: true *** True Line Result - def collection_of_sprites args -** Processing line: ~ sprites_collection = [~ + The parameters for a label are +** Processing line: ~ 1. the position (x, y)~ - Inside source: true *** True Line Result - sprites_collection = [ -** Processing line: ~ [~ + 1. the position (x, y) +** Processing line: ~ 2. the text~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [400, 0, 50, 50, 'sprites/ship.png'],~ + 2. the text +** Processing line: ~ 3. the size~ - Inside source: true *** True Line Result - [400, 0, 50, 50, 'sprites/ship.png'], -** Processing line: ~ [400, 100, 50, 50, 'sprites/ship.png'],~ + 3. the size +** Processing line: ~ 4. the alignment~ - Inside source: true *** True Line Result - [400, 100, 50, 50, 'sprites/ship.png'], -** Processing line: ~ ],~ + 4. the alignment +** Processing line: ~ 5. the color (red, green, and blue saturations)~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [400, 200, 50, 50, 'sprites/ship.png']~ + 5. the color (red, green, and blue saturations) +** Processing line: ~ 6. the alpha (or transparency)~ - Inside source: true *** True Line Result - [400, 200, 50, 50, 'sprites/ship.png'] -** Processing line: ~ ]~ + 6. the alpha (or transparency) +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - ] + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.sprites << sprites_collection~ +** Processing line: ~ - args.state.lines:~ - Inside source: true *** True Line Result - args.outputs.sprites << sprites_collection -** Processing line: ~~ + - args.state.lines: +** Processing line: ~ The parameters for a line are~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.solids << [~ + The parameters for a line are +** Processing line: ~ 1. the starting position (x, y)~ - Inside source: true *** True Line Result - args.outputs.solids << [ -** Processing line: ~ [500, 0, 50, 50, 'sprites/ship.png'],~ + 1. the starting position (x, y) +** Processing line: ~ 2. the ending position (x2, y2)~ - Inside source: true *** True Line Result - [500, 0, 50, 50, 'sprites/ship.png'], -** Processing line: ~ [500, 100, 50, 50, 'sprites/ship.png'],~ + 2. the ending position (x2, y2) +** Processing line: ~ 3. the color (red, green, and blue saturations)~ - Inside source: true *** True Line Result - [500, 100, 50, 50, 'sprites/ship.png'], -** Processing line: ~ [[[500, 200, 50, 50, 'sprites/ship.png']]]~ + 3. the color (red, green, and blue saturations) +** Processing line: ~ 4. the alpha (or transparency)~ - Inside source: true *** True Line Result - [[[500, 200, 50, 50, 'sprites/ship.png']]] -** Processing line: ~ ]~ + 4. the alpha (or transparency) +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ - Inside source: true *** True Line Result - ] + For more information about lines, go to mygame/documentation/04-lines.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.borders << [~ +** Processing line: ~ - args.state.solids (and args.state.borders):~ - Inside source: true *** True Line Result - args.outputs.borders << [ -** Processing line: ~ [~ + - args.state.solids (and args.state.borders): +** Processing line: ~ The parameters for a solid (or border) are~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [600, 0, 50, 50, 'sprites/ship.png'],~ + The parameters for a solid (or border) are +** Processing line: ~ 1. the position (x, y)~ - Inside source: true *** True Line Result - [600, 0, 50, 50, 'sprites/ship.png'], -** Processing line: ~ [600, 100, 50, 50, 'sprites/ship.png'],~ + 1. the position (x, y) +** Processing line: ~ 2. the width (w)~ - Inside source: true *** True Line Result - [600, 100, 50, 50, 'sprites/ship.png'], -** Processing line: ~ ],~ + 2. the width (w) +** Processing line: ~ 3. the height (h)~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [600, 200, 50, 50, 'sprites/ship.png']~ + 3. the height (h) +** Processing line: ~ 4. the color (r, g, b)~ - Inside source: true *** True Line Result - [600, 200, 50, 50, 'sprites/ship.png'] -** Processing line: ~ ]~ + 4. the color (r, g, b) +** Processing line: ~ 5. the alpha (or transparency)~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + 5. the alpha (or transparency) +** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - end + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 07_advanced_rendering/11_render_primitives_as_hash/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 07_advanced_rendering/11_render_primitives_as_hash/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ -- Inside source: true -*** True Line Result - =begin -** Processing line: ~~ +** Processing line: ~ - args.state.sprites:~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + - args.state.sprites: +** Processing line: ~ The parameters for a sprite are~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + The parameters for a sprite are +** Processing line: ~ 1. the position (x, y)~ - Inside source: true *** True Line Result - -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ + 1. the position (x, y) +** Processing line: ~ 2. the width (w)~ - Inside source: true *** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The value can be found -** Processing line: ~ using their keys.~ + 2. the width (w) +** Processing line: ~ 3. the height (h)~ - Inside source: true *** True Line Result - using their keys. -** Processing line: ~~ + 3. the height (h) +** Processing line: ~ 4. the image path~ - Inside source: true *** True Line Result - -** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ + 4. the image path +** Processing line: ~ 5. the angle~ - Inside source: true *** True Line Result - For example, if we have a "numbers" hash that stores numbers in English as the -** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ + 5. the angle +** Processing line: ~ 6. the alpha (or transparency)~ - Inside source: true *** True Line Result - key and numbers in Spanish as the value, we'd have a hash that looks like this... -** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ + 6. the alpha (or transparency) +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ - Inside source: true *** True Line Result - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } -** Processing line: ~ and on it goes.~ + For more information about sprites, go to mygame/documentation/05-sprites.md. +** Processing line: ~ =end~ - Inside source: true *** True Line Result - and on it goes. + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ -- Inside source: true -*** True Line Result - Now if we wanted to find the corresponding value of the "one" key, we could say -** Processing line: ~ puts numbers["one"]~ +** Processing line: ~ # This sample app shows different objects that can be used when making games, such as labels,~ - Inside source: true *** True Line Result - puts numbers["one"] -** Processing line: ~ which would print "uno" to the console.~ + # This sample app shows different objects that can be used when making games, such as labels, +** Processing line: ~ # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used.~ - Inside source: true *** True Line Result - which would print "uno" to the console. + # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ +** Processing line: ~ # Also note that state.tick_count refers to the passage of time, or current frame.~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. The values generate a sprite. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ + # Also note that state.tick_count refers to the passage of time, or current frame. +** Processing line: ~~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ + +** Processing line: ~ class TechDemo~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. + class TechDemo +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ +- Inside source: true +*** True Line Result + attr_accessor :inputs, :state, :outputs, :grid, :args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ # Calls all methods necessary for the app to run properly.~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + # Calls all methods necessary for the app to run properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + def tick +** Processing line: ~ labels_tech_demo~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + labels_tech_demo +** Processing line: ~ lines_tech_demo~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ + lines_tech_demo +** Processing line: ~ solids_tech_demo~ - Inside source: true *** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ + solids_tech_demo +** Processing line: ~ borders_tech_demo~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ + borders_tech_demo +** Processing line: ~ sprites_tech_demo~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + sprites_tech_demo +** Processing line: ~ keyboards_tech_demo~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ + keyboards_tech_demo +** Processing line: ~ controller_tech_demo~ - Inside source: true *** True Line Result - - args.outputs.borders: An array. The values generate a border. -** Processing line: ~ The parameters are the same as a solid.~ + controller_tech_demo +** Processing line: ~ mouse_tech_demo~ - Inside source: true *** True Line Result - The parameters are the same as a solid. -** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ + mouse_tech_demo +** Processing line: ~ point_to_rect_tech_demo~ - Inside source: true *** True Line Result - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + point_to_rect_tech_demo +** Processing line: ~ rect_to_rect_tech_demo~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ + rect_to_rect_tech_demo +** Processing line: ~ button_tech_demo~ - Inside source: true *** True Line Result - - args.outputs.lines: An array. The values generate a line. -** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ + button_tech_demo +** Processing line: ~ export_game_state_demo~ - Inside source: true *** True Line Result - The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + export_game_state_demo +** Processing line: ~ window_state_demo~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + window_state_demo +** Processing line: ~ render_seperators~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + render_seperators +** Processing line: ~ end~ - Inside source: true *** True Line Result - =end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app demonstrates how hashes can be used to output different kinds of objects.~ +** Processing line: ~ # Shows output of different kinds of labels on the screen~ - Inside source: true *** True Line Result - # This sample app demonstrates how hashes can be used to output different kinds of objects. -** Processing line: ~~ + # Shows output of different kinds of labels on the screen +** Processing line: ~ def labels_tech_demo~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + def labels_tech_demo +** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."]~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.angle ||= 0 # initializes angle to 0~ + outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."] +** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ - Inside source: true *** True Line Result - args.state.angle ||= 0 # initializes angle to 0 -** Processing line: ~ args.state.angle += 1 # increments angle by 1 every frame (60 times a second)~ + outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."] +** Processing line: ~ outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"]~ - Inside source: true *** True Line Result - args.state.angle += 1 # increments angle by 1 every frame (60 times a second) -** Processing line: ~~ + outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"] +** Processing line: ~ outputs.labels << [ 5, 660, "Smaller label.", -2]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs sprite using a hash~ + outputs.labels << [ 5, 660, "Smaller label.", -2] +** Processing line: ~ outputs.labels << [ 5, 630, "Small label.", -1]~ - Inside source: true *** True Line Result - # Outputs sprite using a hash -** Processing line: ~ args.outputs.sprites << {~ + outputs.labels << [ 5, 630, "Small label.", -1] +** Processing line: ~ outputs.labels << [ 5, 600, "Medium label.", 0]~ - Inside source: true *** True Line Result - args.outputs.sprites << { -** Processing line: ~ x: 30, # sprite position~ + outputs.labels << [ 5, 600, "Medium label.", 0] +** Processing line: ~ outputs.labels << [ 5, 570, "Large label.", 1]~ - Inside source: true *** True Line Result - x: 30, # sprite position -** Processing line: ~ y: 550,~ + outputs.labels << [ 5, 570, "Large label.", 1] +** Processing line: ~ outputs.labels << [ 5, 540, "Larger label.", 2]~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ w: 128, # sprite size~ + outputs.labels << [ 5, 540, "Larger label.", 2] +** Processing line: ~ outputs.labels << [300, 660, "Left aligned.", 0, 2]~ - Inside source: true *** True Line Result - w: 128, # sprite size -** Processing line: ~ h: 101,~ + outputs.labels << [300, 660, "Left aligned.", 0, 2] +** Processing line: ~ outputs.labels << [300, 640, "Center aligned.", 0, 1]~ - Inside source: true *** True Line Result - h: 101, -** Processing line: ~ path: "dragonruby.png", # image path~ + outputs.labels << [300, 640, "Center aligned.", 0, 1] +** Processing line: ~ outputs.labels << [300, 620, "Right aligned.", 0, 0]~ - Inside source: true *** True Line Result - path: "dragonruby.png", # image path -** Processing line: ~ angle: args.state.angle, # angle~ + outputs.labels << [300, 620, "Right aligned.", 0, 0] +** Processing line: ~ outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0]~ - Inside source: true *** True Line Result - angle: args.state.angle, # angle -** Processing line: ~ a: 255, # alpha (transparency)~ + outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0] +** Processing line: ~ outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0]~ - Inside source: true *** True Line Result - a: 255, # alpha (transparency) -** Processing line: ~ r: 255, # color saturation~ + outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0] +** Processing line: ~ outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - r: 255, # color saturation -** Processing line: ~ g: 255,~ + outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255] +** Processing line: ~ outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128]~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128] +** Processing line: ~ end~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ tile_x: 0, # sprite sub division/tile~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - tile_x: 0, # sprite sub division/tile -** Processing line: ~ tile_y: 0,~ + +** Processing line: ~ # Shows output of lines on the screen~ - Inside source: true *** True Line Result - tile_y: 0, -** Processing line: ~ tile_w: -1,~ + # Shows output of lines on the screen +** Processing line: ~ def lines_tech_demo~ - Inside source: true *** True Line Result - tile_w: -1, -** Processing line: ~ tile_h: -1,~ + def lines_tech_demo +** Processing line: ~ outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"]~ - Inside source: true *** True Line Result - tile_h: -1, -** Processing line: ~ flip_vertically: false, # don't flip sprite~ + outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"] +** Processing line: ~ outputs.lines << [5, 450, 100, 450]~ - Inside source: true *** True Line Result - flip_vertically: false, # don't flip sprite -** Processing line: ~ flip_horizontally: false,~ + outputs.lines << [5, 450, 100, 450] +** Processing line: ~ outputs.lines << [5, 430, 300, 430]~ - Inside source: true *** True Line Result - flip_horizontally: false, -** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ + outputs.lines << [5, 430, 300, 430] +** Processing line: ~ outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes~ - Inside source: true *** True Line Result - angle_anchor_x: 0.5, # rotation center set to middle -** Processing line: ~ angle_anchor_y: 0.5~ + outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes +** Processing line: ~ outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes~ - Inside source: true *** True Line Result - angle_anchor_y: 0.5 -** Processing line: ~ }~ + outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes +** Processing line: ~ outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes~ - Inside source: true *** True Line Result - } + outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs label using a hash~ +** Processing line: ~ # Shows output of different kinds of solids on the screen~ - Inside source: true *** True Line Result - # Outputs label using a hash -** Processing line: ~ args.outputs.labels << {~ + # Shows output of different kinds of solids on the screen +** Processing line: ~ def solids_tech_demo~ - Inside source: true *** True Line Result - args.outputs.labels << { -** Processing line: ~ x: 200, # label position~ + def solids_tech_demo +** Processing line: ~ outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"]~ - Inside source: true *** True Line Result - x: 200, # label position -** Processing line: ~ y: 550,~ + outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"] +** Processing line: ~ outputs.solids << [ 10, 270, 50, 50]~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ text: "dragonruby", # label text~ + outputs.solids << [ 10, 270, 50, 50] +** Processing line: ~ outputs.solids << [ 70, 270, 50, 50, 0, 0, 0]~ - Inside source: true *** True Line Result - text: "dragonruby", # label text -** Processing line: ~ size_enum: 2,~ + outputs.solids << [ 70, 270, 50, 50, 0, 0, 0] +** Processing line: ~ outputs.solids << [130, 270, 50, 50, 255, 0, 0]~ - Inside source: true *** True Line Result - size_enum: 2, -** Processing line: ~ alignment_enum: 1,~ + outputs.solids << [130, 270, 50, 50, 255, 0, 0] +** Processing line: ~ outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128]~ - Inside source: true *** True Line Result - alignment_enum: 1, -** Processing line: ~ r: 155, # color saturation~ + outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128] +** Processing line: ~ outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ - Inside source: true *** True Line Result - r: 155, # color saturation -** Processing line: ~ g: 50,~ + outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes +** Processing line: ~ end~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255, # transparency~ + +** Processing line: ~ # Shows output of different kinds of borders on the screen~ - Inside source: true *** True Line Result - a: 255, # transparency -** Processing line: ~ font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly~ + # Shows output of different kinds of borders on the screen +** Processing line: ~ # The parameters for a border are the same as the parameters for a solid~ - Inside source: true *** True Line Result - font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly -** Processing line: ~ }~ + # The parameters for a border are the same as the parameters for a solid +** Processing line: ~ def borders_tech_demo~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + def borders_tech_demo +** Processing line: ~ outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs solid using a hash~ + outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"] +** Processing line: ~ outputs.borders << [ 10, 180, 50, 50]~ - Inside source: true *** True Line Result - # Outputs solid using a hash -** Processing line: ~ # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ + outputs.borders << [ 10, 180, 50, 50] +** Processing line: ~ outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]~ - Inside source: true *** True Line Result - # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] -** Processing line: ~ args.outputs.solids << {~ + outputs.borders << [ 70, 180, 50, 50, 0, 0, 0] +** Processing line: ~ outputs.borders << [130, 180, 50, 50, 255, 0, 0]~ - Inside source: true *** True Line Result - args.outputs.solids << { -** Processing line: ~ x: 400, # position~ + outputs.borders << [130, 180, 50, 50, 255, 0, 0] +** Processing line: ~ outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]~ - Inside source: true *** True Line Result - x: 400, # position -** Processing line: ~ y: 550,~ + outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128] +** Processing line: ~ outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ w: 160, # size~ + outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes +** Processing line: ~ end~ - Inside source: true *** True Line Result - w: 160, # size -** Processing line: ~ h: 90,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - h: 90, -** Processing line: ~ r: 120, # color saturation~ + +** Processing line: ~ # Shows output of different kinds of sprites on the screen~ - Inside source: true *** True Line Result - r: 120, # color saturation -** Processing line: ~ g: 50,~ + # Shows output of different kinds of sprites on the screen +** Processing line: ~ def sprites_tech_demo~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + def sprites_tech_demo +** Processing line: ~ outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"]~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255 # transparency~ + outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"] +** Processing line: ~ outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']~ - Inside source: true *** True Line Result - a: 255 # transparency -** Processing line: ~ }~ + outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png'] +** Processing line: ~ outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes +** Processing line: ~ outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs border using a hash~ + outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Outputs border using a hash -** Processing line: ~ # Same parameters as a solid~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Same parameters as a solid -** Processing line: ~ args.outputs.borders << {~ + +** Processing line: ~ # Holds size, alignment, color (black), and alpha (transparency) parameters~ - Inside source: true *** True Line Result - args.outputs.borders << { -** Processing line: ~ x: 600,~ + # Holds size, alignment, color (black), and alpha (transparency) parameters +** Processing line: ~ # Using small_font as a parameter accounts for all remaining parameters~ - Inside source: true *** True Line Result - x: 600, -** Processing line: ~ y: 550,~ + # Using small_font as a parameter accounts for all remaining parameters +** Processing line: ~ # so they don't have to be repeatedly typed~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ w: 160,~ + # so they don't have to be repeatedly typed +** Processing line: ~ def small_font~ - Inside source: true *** True Line Result - w: 160, -** Processing line: ~ h: 90,~ + def small_font +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - h: 90, -** Processing line: ~ r: 120,~ + [-2, 0, 0, 0, 0, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 120, -** Processing line: ~ g: 50,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + +** Processing line: ~ # Sets position of each row~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255~ + # Sets position of each row +** Processing line: ~ # Converts given row value to pixels that DragonRuby understands~ - Inside source: true *** True Line Result - a: 255 -** Processing line: ~ }~ + # Converts given row value to pixels that DragonRuby understands +** Processing line: ~ def row_to_px row_number~ - Inside source: true *** True Line Result - } + def row_to_px row_number ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs line using a hash~ +** Processing line: ~ # Row 0 starts 5 units below the top of the grid.~ - Inside source: true *** True Line Result - # Outputs line using a hash -** Processing line: ~ args.outputs.lines << {~ + # Row 0 starts 5 units below the top of the grid. +** Processing line: ~ # Each row afterward is 20 units lower.~ - Inside source: true *** True Line Result - args.outputs.lines << { -** Processing line: ~ x: 900, # starting position~ + # Each row afterward is 20 units lower. +** Processing line: ~ grid.top.shift_down(5).shift_down(20 * row_number)~ - Inside source: true *** True Line Result - x: 900, # starting position -** Processing line: ~ y: 550,~ + grid.top.shift_down(5).shift_down(20 * row_number) +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: 550, -** Processing line: ~ x2: 1200, # ending position~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - x2: 1200, # ending position -** Processing line: ~ y2: 550,~ + +** Processing line: ~ # Uses labels to output current game time (passage of time), and whether or not "h" was pressed~ - Inside source: true *** True Line Result - y2: 550, -** Processing line: ~ r: 120, # color saturation~ + # Uses labels to output current game time (passage of time), and whether or not "h" was pressed +** Processing line: ~ # If "h" is pressed, the frame is output when the key_up event occurred~ - Inside source: true *** True Line Result - r: 120, # color saturation -** Processing line: ~ g: 50,~ + # If "h" is pressed, the frame is output when the key_up event occurred +** Processing line: ~ def keyboards_tech_demo~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + def keyboards_tech_demo +** Processing line: ~ outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font]~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255 # transparency~ + outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font] +** Processing line: ~ outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font]~ - Inside source: true *** True Line Result - a: 255 # transparency -** Processing line: ~ }~ + outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font] +** Processing line: ~ outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font]~ - Inside source: true *** True Line Result - } + outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs sprite as a primitive using a hash~ -- Inside source: true -*** True Line Result - # Outputs sprite as a primitive using a hash -** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ if inputs.keyboard.key_up.h # if "h" key_up event occurs~ - Inside source: true *** True Line Result - args.outputs.primitives << { -** Processing line: ~ x: 30, # position~ + if inputs.keyboard.key_up.h # if "h" key_up event occurs +** Processing line: ~ state.h_pressed_at = state.tick_count # frame it occurred is stored~ - Inside source: true *** True Line Result - x: 30, # position -** Processing line: ~ y: 200,~ + state.h_pressed_at = state.tick_count # frame it occurred is stored +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: 200, -** Processing line: ~ w: 128, # size~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - w: 128, # size -** Processing line: ~ h: 101,~ + +** Processing line: ~ # h_pressed_at is initially set to false, and changes once the user presses the "h" key.~ - Inside source: true *** True Line Result - h: 101, -** Processing line: ~ path: "dragonruby.png", # image path~ + # h_pressed_at is initially set to false, and changes once the user presses the "h" key. +** Processing line: ~ state.h_pressed_at ||= false~ - Inside source: true *** True Line Result - path: "dragonruby.png", # image path -** Processing line: ~ angle: args.state.angle, # angle~ + state.h_pressed_at ||= false +** Processing line: ~~ - Inside source: true *** True Line Result - angle: args.state.angle, # angle -** Processing line: ~ a: 255, # transparency~ + +** Processing line: ~ if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false)~ - Inside source: true *** True Line Result - a: 255, # transparency -** Processing line: ~ r: 255, # color saturation~ + if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false) +** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font]~ - Inside source: true *** True Line Result - r: 255, # color saturation -** Processing line: ~ g: 255,~ + outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font] +** Processing line: ~ else # otherwise, label says "h" was never pressed~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + else # otherwise, label says "h" was never pressed +** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font]~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ tile_x: 0, # sprite sub division/tile~ + outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - tile_x: 0, # sprite sub division/tile -** Processing line: ~ tile_y: 0,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - tile_y: 0, -** Processing line: ~ tile_w: -1,~ + +** Processing line: ~ # border around keyboard input demo section~ - Inside source: true *** True Line Result - tile_w: -1, -** Processing line: ~ tile_h: -1,~ + # border around keyboard input demo section +** Processing line: ~ outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)]~ - Inside source: true *** True Line Result - tile_h: -1, -** Processing line: ~ flip_vertically: false, # don't flip~ + outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - flip_vertically: false, # don't flip -** Processing line: ~ flip_horizontally: false,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - flip_horizontally: false, -** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ + +** Processing line: ~ # Sets definition for a small label~ - Inside source: true *** True Line Result - angle_anchor_x: 0.5, # rotation center set to middle -** Processing line: ~ angle_anchor_y: 0.5~ + # Sets definition for a small label +** Processing line: ~ # Makes it easier to position labels in respect to the position of other labels~ - Inside source: true *** True Line Result - angle_anchor_y: 0.5 -** Processing line: ~ }.sprite~ + # Makes it easier to position labels in respect to the position of other labels +** Processing line: ~ def small_label x, row, message~ - Inside source: true *** True Line Result - }.sprite -** Processing line: ~~ + def small_label x, row, message +** Processing line: ~ [x, row_to_px(row), message, small_font]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs label as primitive using a hash~ + [x, row_to_px(row), message, small_font] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Outputs label as primitive using a hash -** Processing line: ~ args.outputs.primitives << {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.primitives << { -** Processing line: ~ x: 200, # position~ + +** Processing line: ~ # Uses small labels to show whether the "a" button on the controller is down, held, or up.~ - Inside source: true *** True Line Result - x: 200, # position -** Processing line: ~ y: 200,~ + # Uses small labels to show whether the "a" button on the controller is down, held, or up. +** Processing line: ~ # y value of each small label is set by calling the row_to_px method~ - Inside source: true *** True Line Result - y: 200, -** Processing line: ~ text: "dragonruby", # text~ + # y value of each small label is set by calling the row_to_px method +** Processing line: ~ def controller_tech_demo~ - Inside source: true *** True Line Result - text: "dragonruby", # text -** Processing line: ~ size: 2,~ + def controller_tech_demo +** Processing line: ~ x = 460~ - Inside source: true *** True Line Result - size: 2, -** Processing line: ~ alignment: 1,~ + x = 460 +** Processing line: ~ outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")~ - Inside source: true *** True Line Result - alignment: 1, -** Processing line: ~ r: 155, # color saturation~ + outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one") +** Processing line: ~ outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")~ - Inside source: true *** True Line Result - r: 155, # color saturation -** Processing line: ~ g: 50,~ + outputs.labels << small_label(x, 7, "Current state of the \"a\" button.") +** Processing line: ~ outputs.labels << small_label(x, 8, "Check console window for more info.")~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + outputs.labels << small_label(x, 8, "Check console window for more info.") +** Processing line: ~~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255, # transparency~ + +** Processing line: ~ if inputs.controller_one.key_down.a # if "a" is in "down" state~ - Inside source: true *** True Line Result - a: 255, # transparency -** Processing line: ~ font: "fonts/manaspc.ttf" # font style~ + if inputs.controller_one.key_down.a # if "a" is in "down" state +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")~ - Inside source: true *** True Line Result - font: "fonts/manaspc.ttf" # font style -** Processing line: ~ }.label~ + outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}") +** Processing line: ~ puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred~ - Inside source: true *** True Line Result - }.label -** Processing line: ~~ + puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred +** Processing line: ~ elsif inputs.controller_one.key_held.a # if "a" is held down~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs solid as primitive using a hash~ + elsif inputs.controller_one.key_held.a # if "a" is held down +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")~ - Inside source: true *** True Line Result - # Outputs solid as primitive using a hash -** Processing line: ~ args.outputs.primitives << {~ + outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}") +** Processing line: ~ elsif inputs.controller_one.key_up.a # if "a" is in up state~ - Inside source: true *** True Line Result - args.outputs.primitives << { -** Processing line: ~ x: 400, # position~ + elsif inputs.controller_one.key_up.a # if "a" is in up state +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")~ - Inside source: true *** True Line Result - x: 400, # position -** Processing line: ~ y: 200,~ + outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}") +** Processing line: ~ puts "\"a\" key up at #{inputs.controller_one.key_up.a}"~ - Inside source: true *** True Line Result - y: 200, -** Processing line: ~ w: 160, # size~ + puts "\"a\" key up at #{inputs.controller_one.key_up.a}" +** Processing line: ~ else # if no event has occurred~ - Inside source: true *** True Line Result - w: 160, # size -** Processing line: ~ h: 90,~ + else # if no event has occurred +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button state is nil.")~ - Inside source: true *** True Line Result - h: 90, -** Processing line: ~ r: 120, # color saturation~ + outputs.labels << small_label(x, 9, "\"a\" button state is nil.") +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 120, # color saturation -** Processing line: ~ g: 50,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + +** Processing line: ~ # border around controller input demo section~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255 # transparency~ + # border around controller input demo section +** Processing line: ~ outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]~ - Inside source: true *** True Line Result - a: 255 # transparency -** Processing line: ~ }.solid~ + outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - }.solid + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs border as primitive using a hash~ +** Processing line: ~ # Outputs when the mouse was clicked, as well as the coordinates on the screen~ - Inside source: true *** True Line Result - # Outputs border as primitive using a hash -** Processing line: ~ # Same parameters as solid~ + # Outputs when the mouse was clicked, as well as the coordinates on the screen +** Processing line: ~ # of where the click occurred~ - Inside source: true *** True Line Result - # Same parameters as solid -** Processing line: ~ args.outputs.primitives << {~ + # of where the click occurred +** Processing line: ~ def mouse_tech_demo~ - Inside source: true *** True Line Result - args.outputs.primitives << { -** Processing line: ~ x: 600, # position~ + def mouse_tech_demo +** Processing line: ~ x = 460~ - Inside source: true *** True Line Result - x: 600, # position -** Processing line: ~ y: 200,~ + x = 460 +** Processing line: ~~ - Inside source: true *** True Line Result - y: 200, -** Processing line: ~ w: 160, # size~ + +** Processing line: ~ outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse")~ - Inside source: true *** True Line Result - w: 160, # size -** Processing line: ~ h: 90,~ + outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse") +** Processing line: ~~ - Inside source: true *** True Line Result - h: 90, -** Processing line: ~ r: 120, # color saturation~ + +** Processing line: ~ if inputs.mouse.click # if click has a value and is not nil~ - Inside source: true *** True Line Result - r: 120, # color saturation -** Processing line: ~ g: 50,~ + if inputs.mouse.click # if click has a value and is not nil +** Processing line: ~ state.last_mouse_click = inputs.mouse.click # coordinates of click are stored~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + state.last_mouse_click = inputs.mouse.click # coordinates of click are stored +** Processing line: ~ end~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255 # transparency~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - a: 255 # transparency -** Processing line: ~ }.border~ + +** Processing line: ~ if state.last_mouse_click # if mouse is clicked (has coordinates as value)~ - Inside source: true *** True Line Result - }.border -** Processing line: ~~ + if state.last_mouse_click # if mouse is clicked (has coordinates as value) +** Processing line: ~ # outputs the time (frame) the click occurred, as well as how many frames have passed since the event~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs line as primitive using a hash~ + # outputs the time (frame) the click occurred, as well as how many frames have passed since the event +** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}")~ - Inside source: true *** True Line Result - # Outputs line as primitive using a hash -** Processing line: ~ args.outputs.primitives << {~ + outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}") +** Processing line: ~ # outputs coordinates of click~ - Inside source: true *** True Line Result - args.outputs.primitives << { -** Processing line: ~ x: 900, # starting position~ + # outputs coordinates of click +** Processing line: ~ outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}")~ - Inside source: true *** True Line Result - x: 900, # starting position -** Processing line: ~ y: 200,~ + outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}") +** Processing line: ~ else # otherwise if the mouse has not been clicked~ - Inside source: true *** True Line Result - y: 200, -** Processing line: ~ x2: 1200, # ending position~ + else # otherwise if the mouse has not been clicked +** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.")~ - Inside source: true *** True Line Result - x2: 1200, # ending position -** Processing line: ~ y2: 200,~ + outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.") +** Processing line: ~ outputs.labels << small_label(x, 13, "Please click mouse.")~ - Inside source: true *** True Line Result - y2: 200, -** Processing line: ~ r: 120, # color saturation~ + outputs.labels << small_label(x, 13, "Please click mouse.") +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 120, # color saturation -** Processing line: ~ g: 50,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - g: 50, -** Processing line: ~ b: 50,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - b: 50, -** Processing line: ~ a: 255 # transparency~ + +** Processing line: ~ # Outputs whether a mouse click occurred inside or outside of a box~ - Inside source: true *** True Line Result - a: 255 # transparency -** Processing line: ~ }.line~ + # Outputs whether a mouse click occurred inside or outside of a box +** Processing line: ~ def point_to_rect_tech_demo~ - Inside source: true *** True Line Result - }.line -** Processing line: ~ end~ + def point_to_rect_tech_demo +** Processing line: ~ x = 460~ - Inside source: true *** True Line Result - end + x = 460 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->")~ +- Inside source: true *** True Line Result -#+end_src + outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->") ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 08_lerping_easing_functions/01_easing_functions/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 08_lerping_easing_functions/01_easing_functions/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ def tick args~ +** Processing line: ~ box = [765, 370, 50, 50, 0, 0, 170] # blue box~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # STOP! Watch the following presentation first!!!!~ + box = [765, 370, 50, 50, 0, 0, 170] # blue box +** Processing line: ~ outputs.borders << box~ - Inside source: true *** True Line Result - # STOP! Watch the following presentation first!!!! -** Processing line: ~ # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations~ + outputs.borders << box +** Processing line: ~~ - Inside source: true *** True Line Result - # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations -** Processing line: ~ # https://www.youtube.com/watch?v=mr5xkf6zSzk~ + +** Processing line: ~ if state.last_mouse_click # if the mouse was clicked~ - Inside source: true *** True Line Result - # https://www.youtube.com/watch?v=mr5xkf6zSzk -** Processing line: ~~ + if state.last_mouse_click # if the mouse was clicked +** Processing line: ~ if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box~ - Inside source: true *** True Line Result - -** Processing line: ~ # You've watched the talk, yes? YES???~ + if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened inside the box.")~ - Inside source: true *** True Line Result - # You've watched the talk, yes? YES??? -** Processing line: ~~ + outputs.labels << small_label(x, 16, "Mouse click happened inside the box.") +** Processing line: ~ else # otherwise, if mouse was clicked outside the box~ - Inside source: true *** True Line Result - -** Processing line: ~ # define starting and ending points of properties to animate~ + else # otherwise, if mouse was clicked outside the box +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened outside the box.")~ - Inside source: true *** True Line Result - # define starting and ending points of properties to animate -** Processing line: ~ args.state.target_x = 1180~ + outputs.labels << small_label(x, 16, "Mouse click happened outside the box.") +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.target_x = 1180 -** Processing line: ~ args.state.target_y = 620~ + end +** Processing line: ~ else # otherwise, if was not clicked at all~ - Inside source: true *** True Line Result - args.state.target_y = 620 -** Processing line: ~ args.state.target_w = 100~ + else # otherwise, if was not clicked at all +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked~ - Inside source: true *** True Line Result - args.state.target_w = 100 -** Processing line: ~ args.state.target_h = 100~ + outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.target_h = 100 -** Processing line: ~ args.state.starting_x = 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.starting_x = 0 -** Processing line: ~ args.state.starting_y = 0~ + +** Processing line: ~ # border around mouse input demo section~ - Inside source: true *** True Line Result - args.state.starting_y = 0 -** Processing line: ~ args.state.starting_w = 300~ + # border around mouse input demo section +** Processing line: ~ outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]~ - Inside source: true *** True Line Result - args.state.starting_w = 300 -** Processing line: ~ args.state.starting_h = 300~ + outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.starting_h = 300 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # define start time and duration of animation~ +** Processing line: ~ # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output~ - Inside source: true *** True Line Result - # define start time and duration of animation -** Processing line: ~ args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300)~ + # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output +** Processing line: ~ # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not~ - Inside source: true *** True Line Result - args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) -** Processing line: ~ args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120)~ + # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not +** Processing line: ~ # they intersect.~ - Inside source: true *** True Line Result - args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) + # they intersect. +** Processing line: ~ def rect_to_rect_tech_demo~ +- Inside source: true +*** True Line Result + def rect_to_rect_tech_demo +** Processing line: ~ x = 460~ +- Inside source: true +*** True Line Result + x = 460 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # define type of animations~ +** Processing line: ~ outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions~ - Inside source: true *** True Line Result - # define type of animations -** Processing line: ~ # Here are all the options you have for values you can put in the array:~ + outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions +** Processing line: ~ red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box~ - Inside source: true *** True Line Result - # Here are all the options you have for values you can put in the array: -** Processing line: ~ # :identity, :quad, :cube, :quart, :quint, :flip~ + red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box +** Processing line: ~ outputs.borders << red_box # output as a border (not filled in)~ - Inside source: true *** True Line Result - # :identity, :quad, :cube, :quart, :quint, :flip + outputs.borders << red_box # output as a border (not filled in) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Linear is defined as:~ +** Processing line: ~ # If the mouse is clicked inside the red box, two collision boxes are created.~ - Inside source: true *** True Line Result - # Linear is defined as: -** Processing line: ~ # [:identity]~ + # If the mouse is clicked inside the red box, two collision boxes are created. +** Processing line: ~ if inputs.mouse.click~ - Inside source: true *** True Line Result - # [:identity] -** Processing line: ~ #~ + if inputs.mouse.click +** Processing line: ~ if inputs.mouse.click.point.inside_rect? red_box~ - Inside source: true *** True Line Result - # -** Processing line: ~ # Smooth start variations are:~ + if inputs.mouse.click.point.inside_rect? red_box +** Processing line: ~ if !state.box_collision_one # if the collision_one box does not yet have a definition~ - Inside source: true *** True Line Result - # Smooth start variations are: -** Processing line: ~ # [:quad]~ + if !state.box_collision_one # if the collision_one box does not yet have a definition +** Processing line: ~ # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.~ - Inside source: true *** True Line Result - # [:quad] -** Processing line: ~ # [:cube]~ + # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box. +** Processing line: ~ # You can try deleting the subtraction to see how it impacts the box placement.~ - Inside source: true *** True Line Result - # [:cube] -** Processing line: ~ # [:quart]~ + # You can try deleting the subtraction to see how it impacts the box placement. +** Processing line: ~ state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition~ - Inside source: true *** True Line Result - # [:quart] -** Processing line: ~ # [:quint]~ + state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition +** Processing line: ~ elsif !state.box_collision_two # if collision_two does not yet have a definition~ - Inside source: true *** True Line Result - # [:quint] -** Processing line: ~~ + elsif !state.box_collision_two # if collision_two does not yet have a definition +** Processing line: ~ state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition~ - Inside source: true *** True Line Result - -** Processing line: ~ # Linear reversed, and smooth stop are the same as the animations defined above, but reversed:~ + state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition +** Processing line: ~ else~ - Inside source: true *** True Line Result - # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: -** Processing line: ~ # [:flip, :identity]~ + else +** Processing line: ~ state.box_collision_one = nil # both boxes are empty~ - Inside source: true *** True Line Result - # [:flip, :identity] -** Processing line: ~ # [:flip, :quad, :flip]~ + state.box_collision_one = nil # both boxes are empty +** Processing line: ~ state.box_collision_two = nil~ - Inside source: true *** True Line Result - # [:flip, :quad, :flip] -** Processing line: ~ # [:flip, :cube, :flip]~ + state.box_collision_two = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - # [:flip, :cube, :flip] -** Processing line: ~ # [:flip, :quart, :flip]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # [:flip, :quart, :flip] -** Processing line: ~ # [:flip, :quint, :flip]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # [:flip, :quint, :flip] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # You can also do custom definitions. See the bottom of the file details~ +** Processing line: ~ # If collision boxes exist, they are output onto screen inside the red box as solids~ - Inside source: true *** True Line Result - # You can also do custom definitions. See the bottom of the file details -** Processing line: ~ # on how to do that. I've defined a couple for you:~ + # If collision boxes exist, they are output onto screen inside the red box as solids +** Processing line: ~ if state.box_collision_one~ - Inside source: true *** True Line Result - # on how to do that. I've defined a couple for you: -** Processing line: ~ # [:smoothest_start]~ + if state.box_collision_one +** Processing line: ~ outputs.solids << state.box_collision_one~ - Inside source: true *** True Line Result - # [:smoothest_start] -** Processing line: ~ # [:smoothest_stop]~ + outputs.solids << state.box_collision_one +** Processing line: ~ end~ - Inside source: true *** True Line Result - # [:smoothest_stop] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS~ +** Processing line: ~ if state.box_collision_two~ - Inside source: true *** True Line Result - # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS -** Processing line: ~ args.state.animation_type = [:identity]~ + if state.box_collision_two +** Processing line: ~ outputs.solids << state.box_collision_two~ - Inside source: true *** True Line Result - args.state.animation_type = [:identity] -** Processing line: ~ # args.state.animation_type = [:quad]~ + outputs.solids << state.box_collision_two +** Processing line: ~ end~ - Inside source: true *** True Line Result - # args.state.animation_type = [:quad] -** Processing line: ~ # args.state.animation_type = [:cube]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # args.state.animation_type = [:cube] -** Processing line: ~ # args.state.animation_type = [:quart]~ + +** Processing line: ~ # Outputs whether or not the two collision boxes intersect.~ - Inside source: true *** True Line Result - # args.state.animation_type = [:quart] -** Processing line: ~ # args.state.animation_type = [:quint]~ + # Outputs whether or not the two collision boxes intersect. +** Processing line: ~ if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)~ - Inside source: true *** True Line Result - # args.state.animation_type = [:quint] -** Processing line: ~ # args.state.animation_type = [:flip, :identity]~ + if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty) +** Processing line: ~ if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect~ - Inside source: true *** True Line Result - # args.state.animation_type = [:flip, :identity] -** Processing line: ~ # args.state.animation_type = [:flip, :quad, :flip]~ + if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect +** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes intersect.')~ - Inside source: true *** True Line Result - # args.state.animation_type = [:flip, :quad, :flip] -** Processing line: ~ # args.state.animation_type = [:flip, :cube, :flip]~ -- Inside source: true -*** True Line Result - # args.state.animation_type = [:flip, :cube, :flip] -** Processing line: ~ # args.state.animation_type = [:flip, :quart, :flip]~ -- Inside source: true -*** True Line Result - # args.state.animation_type = [:flip, :quart, :flip] -** Processing line: ~ # args.state.animation_type = [:flip, :quint, :flip]~ + outputs.labels << small_label(x, 23.5, 'The boxes intersect.') +** Processing line: ~ else # otherwise, if the two boxes do not intersect~ - Inside source: true *** True Line Result - # args.state.animation_type = [:flip, :quint, :flip] -** Processing line: ~ # args.state.animation_type = [:smoothest_start]~ + else # otherwise, if the two boxes do not intersect +** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')~ - Inside source: true *** True Line Result - # args.state.animation_type = [:smoothest_start] -** Processing line: ~ # args.state.animation_type = [:smoothest_stop]~ + outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.') +** Processing line: ~ end~ - Inside source: true *** True Line Result - # args.state.animation_type = [:smoothest_stop] -** Processing line: ~~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # THIS IS WHERE THE MAGIC HAPPENS!~ + else +** Processing line: ~ outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output~ - Inside source: true *** True Line Result - # THIS IS WHERE THE MAGIC HAPPENS! -** Processing line: ~ # Numeric#ease~ + outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Numeric#ease -** Processing line: ~ progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Numeric#ease needs to called:~ -- Inside source: true -*** True Line Result - # Numeric#ease needs to called: -** Processing line: ~ # 1. On the number that represents the point in time you want to start, and takes two parameters:~ -- Inside source: true -*** True Line Result - # 1. On the number that represents the point in time you want to start, and takes two parameters: -** Processing line: ~ # a. The first parameter is how long the animation should take.~ -- Inside source: true -*** True Line Result - # a. The first parameter is how long the animation should take. -** Processing line: ~ # b. The second parameter represents the functions that need to be called.~ +** Processing line: ~ # Creates a button and outputs it onto the screen using labels and borders.~ - Inside source: true *** True Line Result - # b. The second parameter represents the functions that need to be called. -** Processing line: ~ #~ + # Creates a button and outputs it onto the screen using labels and borders. +** Processing line: ~ # If the button is clicked, the color changes to make it look faded.~ - Inside source: true *** True Line Result - # -** Processing line: ~ # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds,~ + # If the button is clicked, the color changes to make it look faded. +** Processing line: ~ def button_tech_demo~ - Inside source: true *** True Line Result - # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, -** Processing line: ~ # and I want to animation to start fast and end slow, I would do:~ + def button_tech_demo +** Processing line: ~ x, y, w, h = 460, 160, 300, 50~ - Inside source: true *** True Line Result - # and I want to animation to start fast and end slow, I would do: -** Processing line: ~ # (60 * 3).ease(60 * 10, :flip, :quint, :flip)~ + x, y, w, h = 460, 160, 300, 50 +** Processing line: ~ state.button ||= state.new_entity(:button_with_fade)~ - Inside source: true *** True Line Result - # (60 * 3).ease(60 * 10, :flip, :quint, :flip) + state.button ||= state.new_entity(:button_with_fade) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # initial value delta to the final value~ +** Processing line: ~ # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.~ - Inside source: true *** True Line Result - # initial value delta to the final value -** Processing line: ~ calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress~ + # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders. +** Processing line: ~ state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1]~ - Inside source: true *** True Line Result - calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress -** Processing line: ~ calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress~ + state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1] +** Processing line: ~ state.button.border ||= [x, y, w, h]~ - Inside source: true *** True Line Result - calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress -** Processing line: ~ calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress~ + state.button.border ||= [x, y, w, h] +** Processing line: ~~ - Inside source: true *** True Line Result - calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress -** Processing line: ~ calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress~ + +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border~ - Inside source: true *** True Line Result - calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress -** Processing line: ~~ + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border +** Processing line: ~ state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0]~ + state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # count down~ +** Processing line: ~ outputs.labels << state.button.label~ - Inside source: true *** True Line Result - # count down -** Processing line: ~ count_down = args.state.start_animate_at - args.state.tick_count~ + outputs.labels << state.button.label +** Processing line: ~ outputs.borders << state.button.border~ - Inside source: true *** True Line Result - count_down = args.state.start_animate_at - args.state.tick_count -** Processing line: ~ if count_down > 0~ + outputs.borders << state.button.border +** Processing line: ~~ - Inside source: true *** True Line Result - if count_down > 0 -** Processing line: ~ args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1]~ + +** Processing line: ~ if state.button.clicked_at # if button was clicked (variable has a value and is not nil)~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] -** Processing line: ~ args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1]~ + if state.button.clicked_at # if button was clicked (variable has a value and is not nil) +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] -** Processing line: ~ elsif progress >= 1~ + +** Processing line: ~ # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.~ - Inside source: true *** True Line Result - elsif progress >= 1 -** Processing line: ~ args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1]~ + # The appearance of the button changes for 0.25 seconds after the time the button is clicked at. +** Processing line: ~ # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] -** Processing line: ~ if args.inputs.click~ + # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes. +** Processing line: ~ # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.~ - Inside source: true *** True Line Result - if args.inputs.click -** Processing line: ~ $gtk.reset~ + # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal. +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]~ - Inside source: true *** True Line Result - $gtk.reset + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -30837,42 +31228,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # $gtk.reset~ +** Processing line: ~ # Creates a new button by declaring it as a new entity, and sets values.~ - Inside source: true *** True Line Result - # $gtk.reset -** Processing line: ~~ + # Creates a new button by declaring it as a new entity, and sets values. +** Processing line: ~ def new_button_prefab x, y, message~ - Inside source: true *** True Line Result - -** Processing line: ~ # you can make own variations of animations using this~ + def new_button_prefab x, y, message +** Processing line: ~ w, h = 300, 50~ - Inside source: true *** True Line Result - # you can make own variations of animations using this -** Processing line: ~ module Easing~ + w, h = 300, 50 +** Processing line: ~ button = state.new_entity(:button_with_fade)~ - Inside source: true *** True Line Result - module Easing -** Processing line: ~ # you have access to all the built in functions: identity, flip, quad, cube, quart, quint~ + button = state.new_entity(:button_with_fade) +** Processing line: ~ button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders~ - Inside source: true *** True Line Result - # you have access to all the built in functions: identity, flip, quad, cube, quart, quint -** Processing line: ~ def self.smoothest_start x~ + button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders +** Processing line: ~ button.border = [x, y, w, h] # sets border definition~ - Inside source: true *** True Line Result - def self.smoothest_start x -** Processing line: ~ quad(quint(x))~ + button.border = [x, y, w, h] # sets border definition +** Processing line: ~ button~ - Inside source: true *** True Line Result - quad(quint(x)) + button ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -30881,14 +31268,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.smoothest_stop x~ +** Processing line: ~ # If the mouse has been clicked and the click's location is inside of the button's border, that means~ - Inside source: true *** True Line Result - def self.smoothest_stop x -** Processing line: ~ flip(quad(quint(flip(x))))~ + # If the mouse has been clicked and the click's location is inside of the button's border, that means +** Processing line: ~ # that the button has been clicked. This method returns a boolean value.~ - Inside source: true *** True Line Result - flip(quad(quint(flip(x)))) + # that the button has been clicked. This method returns a boolean value. +** Processing line: ~ def button_clicked? button~ +- Inside source: true +*** True Line Result + def button_clicked? button +** Processing line: ~ inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)~ +- Inside source: true +*** True Line Result + inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -30897,50 +31292,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # this is the source for the existing easing functions~ +** Processing line: ~ # Determines if button was clicked, and changes its appearance if it is clicked~ - Inside source: true *** True Line Result - # this is the source for the existing easing functions -** Processing line: ~ def self.identity x~ + # Determines if button was clicked, and changes its appearance if it is clicked +** Processing line: ~ def tick_button_prefab button~ - Inside source: true *** True Line Result - def self.identity x -** Processing line: ~ x~ + def tick_button_prefab button +** Processing line: ~ outputs.labels << button.label # outputs button's label and border~ - Inside source: true *** True Line Result - x -** Processing line: ~ end~ + outputs.labels << button.label # outputs button's label and border +** Processing line: ~ outputs.borders << button.border~ - Inside source: true *** True Line Result - end + outputs.borders << button.border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.flip x~ +** Processing line: ~ if button_clicked? button # if button is clicked~ - Inside source: true *** True Line Result - def self.flip x -** Processing line: ~ 1 - x~ + if button_clicked? button # if button is clicked +** Processing line: ~ button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked~ - Inside source: true *** True Line Result - 1 - x -** Processing line: ~ end~ + button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.quad x~ +** Processing line: ~ if button.clicked_at # if clicked_at has a frame value and is not nil~ - Inside source: true *** True Line Result - def self.quad x -** Processing line: ~ x * x~ + if button.clicked_at # if clicked_at has a frame value and is not nil +** Processing line: ~ # button is output; color changes and transparency changes for 0.25 seconds after click occurs~ - Inside source: true *** True Line Result - x * x + # button is output; color changes and transparency changes for 0.25 seconds after click occurs +** Processing line: ~ outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,~ +- Inside source: true +*** True Line Result + outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h, +** Processing line: ~ 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds~ +- Inside source: true +*** True Line Result + 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -30949,30 +31356,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.cube x~ +** Processing line: ~ # Exports the app's game state if the export button is clicked.~ - Inside source: true *** True Line Result - def self.cube x -** Processing line: ~ x * x * x~ + # Exports the app's game state if the export button is clicked. +** Processing line: ~ def export_game_state_demo~ - Inside source: true *** True Line Result - x * x * x -** Processing line: ~ end~ + def export_game_state_demo +** Processing line: ~ state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state") +** Processing line: ~ tick_button_prefab(state.export_game_state_button) # calls method to output button~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.quart x~ + tick_button_prefab(state.export_game_state_button) # calls method to output button +** Processing line: ~ if button_clicked? state.export_game_state_button # if the export button is clicked~ - Inside source: true *** True Line Result - def self.quart x -** Processing line: ~ x * x * x * x * x~ + if button_clicked? state.export_game_state_button # if the export button is clicked +** Processing line: ~ args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs~ - Inside source: true *** True Line Result - x * x * x * x * x + args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -30981,138 +31392,126 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.quint x~ +** Processing line: ~ # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window.~ - Inside source: true *** True Line Result - def self.quint x -** Processing line: ~ x * x * x * x * x * x~ + # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window. +** Processing line: ~ def window_state_demo~ - Inside source: true *** True Line Result - x * x * x * x * x * x -** Processing line: ~ end~ + def window_state_demo +** Processing line: ~ m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement) +** Processing line: ~ k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N'~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N' +** Processing line: ~ outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font]~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font] +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 08_lerping_easing_functions/02_cubic_bezier/app/main.rb~ -- Header detected. +- Inside source: true *** True Line Result +** Processing line: ~ #Sets values for the horizontal separator (divides demo sections)~ +- Inside source: true *** True Line Result -* 08_lerping_easing_functions/02_cubic_bezier/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + #Sets values for the horizontal separator (divides demo sections) +** Processing line: ~ def horizontal_seperator y, x, x2~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def tick args~ + def horizontal_seperator y, x, x2 +** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.outputs.background_color = [33, 33, 33]~ + [x, y, x2, y, 150, 150, 150] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.background_color = [33, 33, 33] -** Processing line: ~ args.outputs.lines << bezier(100, 100,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.lines << bezier(100, 100, -** Processing line: ~ 100, 620,~ + +** Processing line: ~ #Sets the values for the vertical separator (divides demo sections)~ - Inside source: true *** True Line Result - 100, 620, -** Processing line: ~ 1180, 620,~ + #Sets the values for the vertical separator (divides demo sections) +** Processing line: ~ def vertical_seperator x, y, y2~ - Inside source: true *** True Line Result - 1180, 620, -** Processing line: ~ 1180, 100,~ + def vertical_seperator x, y, y2 +** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ - Inside source: true *** True Line Result - 1180, 100, -** Processing line: ~ 0)~ + [x, y, x, y2, 150, 150, 150] +** Processing line: ~ end~ - Inside source: true *** True Line Result - 0) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.lines << bezier(100, 100,~ -- Inside source: true -*** True Line Result - args.outputs.lines << bezier(100, 100, -** Processing line: ~ 100, 620,~ +** Processing line: ~ # Outputs vertical and horizontal separators onto the screen to separate each demo section.~ - Inside source: true *** True Line Result - 100, 620, -** Processing line: ~ 1180, 620,~ + # Outputs vertical and horizontal separators onto the screen to separate each demo section. +** Processing line: ~ def render_seperators~ - Inside source: true *** True Line Result - 1180, 620, -** Processing line: ~ 1180, 100,~ + def render_seperators +** Processing line: ~ outputs.lines << horizontal_seperator(505, grid.left, 445)~ - Inside source: true *** True Line Result - 1180, 100, -** Processing line: ~ 20)~ + outputs.lines << horizontal_seperator(505, grid.left, 445) +** Processing line: ~ outputs.lines << horizontal_seperator(353, grid.left, 445)~ - Inside source: true *** True Line Result - 20) -** Processing line: ~ end~ + outputs.lines << horizontal_seperator(353, grid.left, 445) +** Processing line: ~ outputs.lines << horizontal_seperator(264, grid.left, 445)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.lines << horizontal_seperator(264, grid.left, 445) +** Processing line: ~ outputs.lines << horizontal_seperator(174, grid.left, 445)~ - Inside source: true *** True Line Result - + outputs.lines << horizontal_seperator(174, grid.left, 445) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def bezier x1, y1, x2, y2, x3, y3, x4, y4, step~ +** Processing line: ~ outputs.lines << vertical_seperator(445, grid.top, grid.bottom)~ - Inside source: true *** True Line Result - def bezier x1, y1, x2, y2, x3, y3, x4, y4, step -** Processing line: ~ step ||= 0~ + outputs.lines << vertical_seperator(445, grid.top, grid.bottom) +** Processing line: ~~ - Inside source: true *** True Line Result - step ||= 0 -** Processing line: ~ color = [200, 200, 200]~ + +** Processing line: ~ outputs.lines << horizontal_seperator(690, 445, 820)~ - Inside source: true *** True Line Result - color = [200, 200, 200] -** Processing line: ~ points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step~ + outputs.lines << horizontal_seperator(690, 445, 820) +** Processing line: ~ outputs.lines << horizontal_seperator(426, 445, 820)~ - Inside source: true *** True Line Result - points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step + outputs.lines << horizontal_seperator(426, 445, 820) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ points.each_cons(2).map do |p1, p2|~ -- Inside source: true -*** True Line Result - points.each_cons(2).map do |p1, p2| -** Processing line: ~ [p1, p2, color]~ +** Processing line: ~ outputs.lines << vertical_seperator(820, grid.top, grid.bottom)~ - Inside source: true *** True Line Result - [p1, p2, color] + outputs.lines << vertical_seperator(820, grid.top, grid.bottom) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -31125,142 +31524,114 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def points_for_bezier p1, p2, p3, p4, step~ +** Processing line: ~ $tech_demo = TechDemo.new~ - Inside source: true *** True Line Result - def points_for_bezier p1, p2, p3, p4, step -** Processing line: ~ points = []~ + $tech_demo = TechDemo.new +** Processing line: ~~ - Inside source: true *** True Line Result - points = [] -** Processing line: ~ if step == 0~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - if step == 0 -** Processing line: ~ [p1, p2, p3, p4]~ + def tick args +** Processing line: ~ $tech_demo.inputs = args.inputs~ - Inside source: true *** True Line Result - [p1, p2, p3, p4] -** Processing line: ~ else~ + $tech_demo.inputs = args.inputs +** Processing line: ~ $tech_demo.state = args.state~ - Inside source: true *** True Line Result - else -** Processing line: ~ t_step = 1.fdiv(step + 1)~ + $tech_demo.state = args.state +** Processing line: ~ $tech_demo.grid = args.grid~ - Inside source: true *** True Line Result - t_step = 1.fdiv(step + 1) -** Processing line: ~ t = 0~ + $tech_demo.grid = args.grid +** Processing line: ~ $tech_demo.args = args~ - Inside source: true *** True Line Result - t = 0 -** Processing line: ~ t += t_step~ + $tech_demo.args = args +** Processing line: ~ $tech_demo.outputs = args.render_target(:mini_map)~ - Inside source: true *** True Line Result - t += t_step -** Processing line: ~ points = []~ + $tech_demo.outputs = args.render_target(:mini_map) +** Processing line: ~ $tech_demo.tick~ - Inside source: true *** True Line Result - points = [] -** Processing line: ~ while t < 1~ + $tech_demo.tick +** Processing line: ~ args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]]~ - Inside source: true *** True Line Result - while t < 1 -** Processing line: ~ points << [~ + args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]] +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :mini_map]~ - Inside source: true *** True Line Result - points << [ -** Processing line: ~ b_for_t(p1.x, p2.x, p3.x, p4.x, t),~ + args.outputs.sprites << [0, 0, 1280, 720, :mini_map] +** Processing line: ~ args.outputs.sprites << [830, 300, 675, 379, :mini_map]~ - Inside source: true *** True Line Result - b_for_t(p1.x, p2.x, p3.x, p4.x, t), -** Processing line: ~ b_for_t(p1.y, p2.y, p3.y, p4.y, t),~ + args.outputs.sprites << [830, 300, 675, 379, :mini_map] +** Processing line: ~ tick_instructions args, "Sample app shows all the rendering apis available."~ - Inside source: true *** True Line Result - b_for_t(p1.y, p2.y, p3.y, p4.y, t), -** Processing line: ~ ]~ + tick_instructions args, "Sample app shows all the rendering apis available." +** Processing line: ~ end~ - Inside source: true *** True Line Result - ] -** Processing line: ~ t += t_step~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - t += t_step -** Processing line: ~ end~ + +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - -** Processing line: ~ [~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - [ -** Processing line: ~ p1,~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - p1, -** Processing line: ~ *points,~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - *points, -** Processing line: ~ p4~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - p4 -** Processing line: ~ ]~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - ] + args.state.key_event_occurred = true ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def b_for_t v0, v1, v2, v3, t~ -- Inside source: true -*** True Line Result - def b_for_t v0, v1, v2, v3, t -** Processing line: ~ pow(1 - t, 3) * v0 +~ -- Inside source: true -*** True Line Result - pow(1 - t, 3) * v0 + -** Processing line: ~ 3 * pow(1 - t, 2) * t * v1 +~ -- Inside source: true -*** True Line Result - 3 * pow(1 - t, 2) * t * v1 + -** Processing line: ~ 3 * (1 - t) * pow(t, 2) * v2 +~ -- Inside source: true -*** True Line Result - 3 * (1 - t) * pow(t, 2) * v2 + -** Processing line: ~ pow(t, 3) * v3~ -- Inside source: true -*** True Line Result - pow(t, 3) * v3 -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - -** Processing line: ~ def pow n, to~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - def pow n, to -** Processing line: ~ n ** to~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - n ** to + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -31277,414 +31648,410 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 08_lerping_easing_functions/03_easing_using_spline/app/main.rb~ +** Processing line: ~* Advanced Rendering - Render Primitive Hierarchies - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 08_lerping_easing_functions/03_easing_using_spline/app/main.rb +* Advanced Rendering - Render Primitive Hierarchies - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def tick args~ +** Processing line: ~ # ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.duration = 10.seconds~ + # ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - args.state.duration = 10.seconds -** Processing line: ~ args.state.spline = [~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.spline = [ -** Processing line: ~ [0.0, 0.33, 0.66, 1.0],~ + +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - [0.0, 0.33, 0.66, 1.0], -** Processing line: ~ [1.0, 1.0, 1.0, 1.0],~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - [1.0, 1.0, 1.0, 1.0], -** Processing line: ~ [1.0, 0.66, 0.33, 0.0],~ + +** Processing line: ~ - Nested array: An array whose individual elements are also arrays; useful for~ - Inside source: true *** True Line Result - [1.0, 0.66, 0.33, 0.0], -** Processing line: ~ ]~ + - Nested array: An array whose individual elements are also arrays; useful for +** Processing line: ~ storing groups of similar data. Also called multidimensional arrays.~ - Inside source: true *** True Line Result - ] + storing groups of similar data. Also called multidimensional arrays. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.simulation_tick = args.state.tick_count % args.state.duration~ -- Inside source: true -*** True Line Result - args.state.simulation_tick = args.state.tick_count % args.state.duration -** Processing line: ~ progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline~ +** Processing line: ~ In this sample app, we see nested arrays being used in object definitions.~ - Inside source: true *** True Line Result - progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline -** Processing line: ~ args.outputs.borders << args.grid.rect~ + In this sample app, we see nested arrays being used in object definitions. +** Processing line: ~ Notice the parameters for solids, listed below. Parameters 1-3 set the~ - Inside source: true *** True Line Result - args.outputs.borders << args.grid.rect -** Processing line: ~ args.outputs.solids << [20 + 1240 * progress,~ + Notice the parameters for solids, listed below. Parameters 1-3 set the +** Processing line: ~ definition for the rect, and parameter 4 sets the definition of the color.~ - Inside source: true *** True Line Result - args.outputs.solids << [20 + 1240 * progress, -** Processing line: ~ 20 + 680 * progress,~ + definition for the rect, and parameter 4 sets the definition of the color. +** Processing line: ~~ - Inside source: true *** True Line Result - 20 + 680 * progress, -** Processing line: ~ 20, 20].anchor_rect(0.5, 0.5)~ + +** Processing line: ~ Instead of having a solid definition that looks like this,~ - Inside source: true *** True Line Result - 20, 20].anchor_rect(0.5, 0.5) -** Processing line: ~ args.outputs.labels << [10,~ + Instead of having a solid definition that looks like this, +** Processing line: ~ [X, Y, W, H, R, G, B]~ - Inside source: true *** True Line Result - args.outputs.labels << [10, -** Processing line: ~ 710,~ + [X, Y, W, H, R, G, B] +** Processing line: ~ we can separate it into two separate array definitions in one, like this~ - Inside source: true *** True Line Result - 710, -** Processing line: ~ "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"]~ + we can separate it into two separate array definitions in one, like this +** Processing line: ~ [[X, Y, W, H], [R, G, B]]~ - Inside source: true *** True Line Result - "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] -** Processing line: ~ end~ + [[X, Y, W, H], [R, G, B]] +** Processing line: ~ and both options work fine in defining our solid (or any object).~ - Inside source: true *** True Line Result - end + and both options work fine in defining our solid (or any object). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def new_star args~ +** Processing line: ~ - Collections: Lists of data; useful for organizing large amounts of data.~ - Inside source: true *** True Line Result - def new_star args -** Processing line: ~ { x: 1280.randomize(:ratio),~ + - Collections: Lists of data; useful for organizing large amounts of data. +** Processing line: ~ One element of a collection could be an array (which itself contains many elements).~ - Inside source: true *** True Line Result - { x: 1280.randomize(:ratio), -** Processing line: ~ starting_y: 800,~ + One element of a collection could be an array (which itself contains many elements). +** Processing line: ~ For example, a collection that stores two solid objects would look like this:~ - Inside source: true *** True Line Result - starting_y: 800, -** Processing line: ~ distance_to_travel: 900 + 100.randomize(:ratio),~ + For example, a collection that stores two solid objects would look like this: +** Processing line: ~ [~ - Inside source: true *** True Line Result - distance_to_travel: 900 + 100.randomize(:ratio), -** Processing line: ~ duration: 100.randomize(:ratio) + 60,~ + [ +** Processing line: ~ [100, 100, 50, 50, 0, 0, 0],~ - Inside source: true *** True Line Result - duration: 100.randomize(:ratio) + 60, -** Processing line: ~ created_at: args.state.tick_count,~ + [100, 100, 50, 50, 0, 0, 0], +** Processing line: ~ [100, 150, 50, 50, 255, 255, 255]~ - Inside source: true *** True Line Result - created_at: args.state.tick_count, -** Processing line: ~ max_alpha: 128.randomize(:ratio) + 128,~ + [100, 150, 50, 50, 255, 255, 255] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - max_alpha: 128.randomize(:ratio) + 128, -** Processing line: ~ b: 255.randomize(:ratio),~ + ] +** Processing line: ~ If this collection was added to args.outputs.solids, two solids would be output~ - Inside source: true *** True Line Result - b: 255.randomize(:ratio), -** Processing line: ~ g: 200.randomize(:ratio),~ + If this collection was added to args.outputs.solids, two solids would be output +** Processing line: ~ next to each other, one black and one white.~ - Inside source: true *** True Line Result - g: 200.randomize(:ratio), -** Processing line: ~ w: 1.randomize(:ratio) + 1,~ + next to each other, one black and one white. +** Processing line: ~ Nested arrays can be used in collections, as you will see in this sample app.~ - Inside source: true *** True Line Result - w: 1.randomize(:ratio) + 1, -** Processing line: ~ h: 1.randomize(:ratio) + 1 }~ + Nested arrays can be used in collections, as you will see in this sample app. +** Processing line: ~~ - Inside source: true *** True Line Result - h: 1.randomize(:ratio) + 1 } -** Processing line: ~ end~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - end + Reminders: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def new_enemy args~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - def new_enemy args -** Processing line: ~ { x: 1280.randomize(:ratio),~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters for a solid are~ - Inside source: true *** True Line Result - { x: 1280.randomize(:ratio), -** Processing line: ~ starting_y: 800,~ + The parameters for a solid are +** Processing line: ~ 1. The position on the screen (x, y)~ - Inside source: true *** True Line Result - starting_y: 800, -** Processing line: ~ distance_to_travel: -900,~ + 1. The position on the screen (x, y) +** Processing line: ~ 2. The width (w)~ - Inside source: true *** True Line Result - distance_to_travel: -900, -** Processing line: ~ duration: 60.randomize(:ratio) + 180,~ + 2. The width (w) +** Processing line: ~ 3. The height (h)~ - Inside source: true *** True Line Result - duration: 60.randomize(:ratio) + 180, -** Processing line: ~ created_at: args.state.tick_count,~ + 3. The height (h) +** Processing line: ~ 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black)~ - Inside source: true *** True Line Result - created_at: args.state.tick_count, -** Processing line: ~ w: 32,~ + 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black) +** Processing line: ~ NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS!~ - Inside source: true *** True Line Result - w: 32, -** Processing line: ~ h: 32,~ + NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS! +** Processing line: ~~ - Inside source: true *** True Line Result - h: 32, -** Processing line: ~ fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i }~ + +** Processing line: ~ Here is an example of a (red) border or solid definition:~ - Inside source: true *** True Line Result - fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } -** Processing line: ~ end~ + Here is an example of a (red) border or solid definition: +** Processing line: ~ [100, 100, 400, 500, 255, 0, 0]~ - Inside source: true *** True Line Result - end + [100, 100, 400, 500, 255, 0, 0] +** Processing line: ~ It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders.~ +- Inside source: true +*** True Line Result + It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders. +** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ +- Inside source: true +*** True Line Result + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def new_bullet args, starting_x, starting_y, enemy_speed~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ - Inside source: true *** True Line Result - def new_bullet args, starting_x, starting_y, enemy_speed -** Processing line: ~ { x: starting_x,~ + - args.outputs.sprites: An array. The values generate a sprite. +** Processing line: ~ The parameters for sprites are~ - Inside source: true *** True Line Result - { x: starting_x, -** Processing line: ~ starting_y: starting_y,~ + The parameters for sprites are +** Processing line: ~ 1. The position on the screen (x, y)~ - Inside source: true *** True Line Result - starting_y: starting_y, -** Processing line: ~ distance_to_travel: -900,~ + 1. The position on the screen (x, y) +** Processing line: ~ 2. The width (w)~ - Inside source: true *** True Line Result - distance_to_travel: -900, -** Processing line: ~ created_at: args.state.tick_count,~ + 2. The width (w) +** Processing line: ~ 3. The height (h)~ - Inside source: true *** True Line Result - created_at: args.state.tick_count, -** Processing line: ~ duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs,~ + 3. The height (h) +** Processing line: ~ 4. The image path (p)~ - Inside source: true *** True Line Result - duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, -** Processing line: ~ w: 5,~ + 4. The image path (p) +** Processing line: ~~ - Inside source: true *** True Line Result - w: 5, -** Processing line: ~ h: 5 }~ + +** Processing line: ~ Here is an example of a sprite definition:~ - Inside source: true *** True Line Result - h: 5 } -** Processing line: ~ end~ + Here is an example of a sprite definition: +** Processing line: ~ [100, 100, 400, 500, 'sprites/dragonruby.png']~ - Inside source: true *** True Line Result - end + [100, 100, 400, 500, 'sprites/dragonruby.png'] +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +- Inside source: true +*** True Line Result + For more information about sprites, go to mygame/documentation/05-sprites.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def new_player_bullet args, starting_x, starting_y, player_speed~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - def new_player_bullet args, starting_x, starting_y, player_speed -** Processing line: ~ { x: starting_x,~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - { x: starting_x, -** Processing line: ~ starting_y: starting_y,~ + +** Processing line: ~ # This code demonstrates the creation and output of objects like sprites, borders, and solids~ - Inside source: true *** True Line Result - starting_y: starting_y, -** Processing line: ~ distance_to_travel: 900,~ + # This code demonstrates the creation and output of objects like sprites, borders, and solids +** Processing line: ~ # If filled in, they are solids~ - Inside source: true *** True Line Result - distance_to_travel: 900, -** Processing line: ~ created_at: args.state.tick_count,~ + # If filled in, they are solids +** Processing line: ~ # If hollow, they are borders~ - Inside source: true *** True Line Result - created_at: args.state.tick_count, -** Processing line: ~ duration: 900 / (player_speed + 2.0),~ + # If hollow, they are borders +** Processing line: ~ # If images, they are sprites~ - Inside source: true *** True Line Result - duration: 900 / (player_speed + 2.0), -** Processing line: ~ w: 5,~ + # If images, they are sprites +** Processing line: ~~ - Inside source: true *** True Line Result - w: 5, -** Processing line: ~ h: 5 }~ + +** Processing line: ~ # Solids are added to args.outputs.solids~ - Inside source: true *** True Line Result - h: 5 } -** Processing line: ~ end~ + # Solids are added to args.outputs.solids +** Processing line: ~ # Borders are added to args.outputs.borders~ - Inside source: true *** True Line Result - end + # Borders are added to args.outputs.borders +** Processing line: ~ # Sprites are added to args.outputs.sprites~ +- Inside source: true +*** True Line Result + # Sprites are added to args.outputs.sprites ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults args~ +** Processing line: ~ # The tick method runs 60 frames every second.~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + # The tick method runs 60 frames every second. +** Processing line: ~ # Your game is going to happen under this one function.~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.state.score ||= 0~ + # Your game is going to happen under this one function. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - args.state.score ||= 0 -** Processing line: ~ args.state.stars ||= []~ + def tick args +** Processing line: ~ border_as_solid_and_solid_as_border args~ - Inside source: true *** True Line Result - args.state.stars ||= [] -** Processing line: ~ args.state.enemies ||= []~ + border_as_solid_and_solid_as_border args +** Processing line: ~ sprite_as_border_or_solids args~ - Inside source: true *** True Line Result - args.state.enemies ||= [] -** Processing line: ~ args.state.bullets ||= []~ + sprite_as_border_or_solids args +** Processing line: ~ collection_of_borders_and_solids args~ - Inside source: true *** True Line Result - args.state.bullets ||= [] -** Processing line: ~ args.state.player_bullets ||= []~ + collection_of_borders_and_solids args +** Processing line: ~ collection_of_sprites args~ - Inside source: true *** True Line Result - args.state.player_bullets ||= [] -** Processing line: ~ args.state.max_stars = 50~ + collection_of_sprites args +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.max_stars = 50 -** Processing line: ~ args.state.max_enemies = 10~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.max_enemies = 10 -** Processing line: ~ args.state.player.x ||= 640~ + +** Processing line: ~ # Shows a border being output onto the screen as a border and a solid~ - Inside source: true *** True Line Result - args.state.player.x ||= 640 -** Processing line: ~ args.state.player.y ||= 100~ + # Shows a border being output onto the screen as a border and a solid +** Processing line: ~ # Also shows how colors can be set~ - Inside source: true *** True Line Result - args.state.player.y ||= 100 -** Processing line: ~ args.state.player.w ||= 32~ + # Also shows how colors can be set +** Processing line: ~ def border_as_solid_and_solid_as_border args~ - Inside source: true *** True Line Result - args.state.player.w ||= 32 -** Processing line: ~ args.state.player.h ||= 32~ + def border_as_solid_and_solid_as_border args +** Processing line: ~ border = [0, 0, 50, 50]~ - Inside source: true *** True Line Result - args.state.player.h ||= 32 + border = [0, 0, 50, 50] +** Processing line: ~ args.outputs.borders << border~ +- Inside source: true +*** True Line Result + args.outputs.borders << border +** Processing line: ~ args.outputs.solids << border~ +- Inside source: true +*** True Line Result + args.outputs.solids << border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ # Red, green, blue saturations (last three parameters) can be any number between 0 and 255~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars.clear~ + # Red, green, blue saturations (last three parameters) can be any number between 0 and 255 +** Processing line: ~ border_with_color = [0, 100, 50, 50, 255, 0, 0]~ - Inside source: true *** True Line Result - args.state.stars.clear -** Processing line: ~ args.state.max_stars.times do~ + border_with_color = [0, 100, 50, 50, 255, 0, 0] +** Processing line: ~ args.outputs.borders << border_with_color~ - Inside source: true *** True Line Result - args.state.max_stars.times do -** Processing line: ~ s = new_star args~ + args.outputs.borders << border_with_color +** Processing line: ~ args.outputs.solids << border_with_color~ - Inside source: true *** True Line Result - s = new_star args -** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ + args.outputs.solids << border_with_color +** Processing line: ~~ - Inside source: true *** True Line Result - s[:created_at] += s[:duration].randomize(:ratio) -** Processing line: ~ args.state.stars << s~ + +** Processing line: ~ border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color~ - Inside source: true *** True Line Result - args.state.stars << s -** Processing line: ~ end~ + border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color +** Processing line: ~ args.outputs.borders << border_with_nested_color~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.borders << border_with_nested_color +** Processing line: ~ args.outputs.solids << border_with_nested_color~ - Inside source: true *** True Line Result - end + args.outputs.solids << border_with_nested_color ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.tick_count == 0~ -- Inside source: true -*** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.enemies.clear~ +** Processing line: ~ border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect~ - Inside source: true *** True Line Result - args.state.enemies.clear -** Processing line: ~ args.state.max_enemies.times do~ + border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect +** Processing line: ~ args.outputs.borders << border_with_nested_rect~ - Inside source: true *** True Line Result - args.state.max_enemies.times do -** Processing line: ~ s = new_enemy args~ + args.outputs.borders << border_with_nested_rect +** Processing line: ~ args.outputs.solids << border_with_nested_rect~ - Inside source: true *** True Line Result - s = new_enemy args -** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ + args.outputs.solids << border_with_nested_rect +** Processing line: ~~ - Inside source: true *** True Line Result - s[:created_at] += s[:duration].randomize(:ratio) -** Processing line: ~ args.state.enemies << s~ + +** Processing line: ~ border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color~ - Inside source: true *** True Line Result - args.state.enemies << s -** Processing line: ~ end~ + border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color +** Processing line: ~ args.outputs.borders << border_with_nested_color_and_rect~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.borders << border_with_nested_color_and_rect +** Processing line: ~ args.outputs.solids << border_with_nested_color_and_rect~ - Inside source: true *** True Line Result - end + args.outputs.solids << border_with_nested_color_and_rect ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -31693,1102 +32060,1086 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def input args~ -- Inside source: true -*** True Line Result - def input args -** Processing line: ~ if args.inputs.keyboard.left~ +** Processing line: ~ # Shows a sprite output onto the screen as a sprite, border, and solid~ - Inside source: true *** True Line Result - if args.inputs.keyboard.left -** Processing line: ~ args.state.player.x -= 5~ + # Shows a sprite output onto the screen as a sprite, border, and solid +** Processing line: ~ # Demonstrates that all three outputs appear differently on screen~ - Inside source: true *** True Line Result - args.state.player.x -= 5 -** Processing line: ~ elsif args.inputs.keyboard.right~ + # Demonstrates that all three outputs appear differently on screen +** Processing line: ~ def sprite_as_border_or_solids args~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.right -** Processing line: ~ args.state.player.x += 5~ + def sprite_as_border_or_solids args +** Processing line: ~ sprite = [100, 0, 50, 50, 'sprites/ship.png']~ - Inside source: true *** True Line Result - args.state.player.x += 5 -** Processing line: ~ end~ + sprite = [100, 0, 50, 50, 'sprites/ship.png'] +** Processing line: ~ args.outputs.sprites << sprite~ - Inside source: true *** True Line Result - end + args.outputs.sprites << sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.up~ -- Inside source: true -*** True Line Result - if args.inputs.keyboard.up -** Processing line: ~ args.state.player.y += 5~ +** Processing line: ~ # Sprite_as_border variable has same parameters (excluding position) as above object,~ - Inside source: true *** True Line Result - args.state.player.y += 5 -** Processing line: ~ elsif args.inputs.keyboard.down~ + # Sprite_as_border variable has same parameters (excluding position) as above object, +** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.borders~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.down -** Processing line: ~ args.state.player.y -= 5~ + # but will appear differently on screen because it is added to args.outputs.borders +** Processing line: ~ sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png']~ - Inside source: true *** True Line Result - args.state.player.y -= 5 -** Processing line: ~ end~ + sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png'] +** Processing line: ~ args.outputs.borders << sprite_as_border~ - Inside source: true *** True Line Result - end + args.outputs.borders << sprite_as_border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.key_down.space~ +** Processing line: ~ # Sprite_as_solid variable has same parameters (excluding position) as above object,~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.space -** Processing line: ~ args.state.player_bullets << new_player_bullet(args,~ + # Sprite_as_solid variable has same parameters (excluding position) as above object, +** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.solids~ - Inside source: true *** True Line Result - args.state.player_bullets << new_player_bullet(args, -** Processing line: ~ args.state.player.x + args.state.player.w.half,~ + # but will appear differently on screen because it is added to args.outputs.solids +** Processing line: ~ sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png']~ - Inside source: true *** True Line Result - args.state.player.x + args.state.player.w.half, -** Processing line: ~ args.state.player.y + args.state.player.h, 5)~ + sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png'] +** Processing line: ~ args.outputs.solids << sprite_as_solid~ - Inside source: true *** True Line Result - args.state.player.y + args.state.player.h, 5) -** Processing line: ~ end~ + args.outputs.solids << sprite_as_solid +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w)~ +** Processing line: ~ # Holds and outputs a collection of borders and a collection of solids~ - Inside source: true *** True Line Result - args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) -** Processing line: ~ args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h)~ + # Holds and outputs a collection of borders and a collection of solids +** Processing line: ~ # Collections are created by using arrays to hold parameters of each individual object~ - Inside source: true *** True Line Result - args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) -** Processing line: ~ end~ + # Collections are created by using arrays to hold parameters of each individual object +** Processing line: ~ def collection_of_borders_and_solids args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def collection_of_borders_and_solids args +** Processing line: ~ collection_borders = [~ - Inside source: true *** True Line Result - -** Processing line: ~ def completed? entity~ + collection_borders = [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - def completed? entity -** Processing line: ~ (entity[:created_at] + entity[:duration]).elapsed_time > 0~ + [ +** Processing line: ~ [200, 0, 50, 50], # black border~ - Inside source: true *** True Line Result - (entity[:created_at] + entity[:duration]).elapsed_time > 0 -** Processing line: ~ end~ + [200, 0, 50, 50], # black border +** Processing line: ~ [200, 100, 50, 50, 255, 0, 0], # red border~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [200, 100, 50, 50, 255, 0, 0], # red border +** Processing line: ~ [200, 200, 50, 50, [0, 255, 0]], # nested color~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_stars args~ + [200, 200, 50, 50, [0, 255, 0]], # nested color +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def calc_stars args -** Processing line: ~ if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0~ + ], +** Processing line: ~ [[200, 300, 50, 50], 0, 0, 255], # nested rect~ - Inside source: true *** True Line Result - if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 -** Processing line: ~ stars_to_add.times { args.state.stars << new_star(args) }~ + [[200, 300, 50, 50], 0, 0, 255], # nested rect +** Processing line: ~ [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ - Inside source: true *** True Line Result - stars_to_add.times { args.state.stars << new_star(args) } -** Processing line: ~ end~ + [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.stars = args.state.stars.reject { |s| completed? s }~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.stars = args.state.stars.reject { |s| completed? s } -** Processing line: ~ end~ + +** Processing line: ~ args.outputs.borders << collection_borders~ - Inside source: true *** True Line Result - end + args.outputs.borders << collection_borders ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move_enemies args~ +** Processing line: ~ collection_solids = [~ - Inside source: true *** True Line Result - def move_enemies args -** Processing line: ~ if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0~ + collection_solids = [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 -** Processing line: ~ enemies_to_add.times { args.state.enemies << new_enemy(args) }~ + [ +** Processing line: ~ [[300, 300, 50, 50], 0, 0, 255], # nested rect~ - Inside source: true *** True Line Result - enemies_to_add.times { args.state.enemies << new_enemy(args) } -** Processing line: ~ end~ + [[300, 300, 50, 50], 0, 0, 255], # nested rect +** Processing line: ~ [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.enemies = args.state.enemies.reject { |s| completed? s }~ + ], +** Processing line: ~ [300, 0, 50, 50],~ - Inside source: true *** True Line Result - args.state.enemies = args.state.enemies.reject { |s| completed? s } -** Processing line: ~ end~ + [300, 0, 50, 50], +** Processing line: ~ [300, 100, 50, 50, 255, 0, 0],~ - Inside source: true *** True Line Result - end + [300, 100, 50, 50, 255, 0, 0], +** Processing line: ~ [300, 200, 50, 50, [0, 255, 0]], # nested color~ +- Inside source: true +*** True Line Result + [300, 200, 50, 50, [0, 255, 0]], # nested color +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move_bullets args~ +** Processing line: ~ args.outputs.solids << collection_solids~ - Inside source: true *** True Line Result - def move_bullets args -** Processing line: ~ args.state.enemies.each do |e|~ + args.outputs.solids << collection_solids +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.enemies.each do |e| -** Processing line: ~ if args.state.tick_count.mod_zero?(e[:fire_rate])~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if args.state.tick_count.mod_zero?(e[:fire_rate]) -** Processing line: ~ args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration])~ + +** Processing line: ~ # Holds and outputs a collection of sprites by adding it to args.outputs.sprites~ - Inside source: true *** True Line Result - args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) -** Processing line: ~ end~ + # Holds and outputs a collection of sprites by adding it to args.outputs.sprites +** Processing line: ~ # Also outputs a collection with same parameters (excluding position) by adding~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Also outputs a collection with same parameters (excluding position) by adding +** Processing line: ~ # it to args.outputs.solids and another to args.outputs.borders~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # it to args.outputs.solids and another to args.outputs.borders +** Processing line: ~ def collection_of_sprites args~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.bullets = args.state.bullets.reject { |s| completed? s }~ + def collection_of_sprites args +** Processing line: ~ sprites_collection = [~ - Inside source: true *** True Line Result - args.state.bullets = args.state.bullets.reject { |s| completed? s } -** Processing line: ~ args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s }~ + sprites_collection = [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } -** Processing line: ~ end~ + [ +** Processing line: ~ [400, 0, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [400, 0, 50, 50, 'sprites/ship.png'], +** Processing line: ~ [400, 100, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - -** Processing line: ~ def intersect? entity_one, entity_two~ + [400, 100, 50, 50, 'sprites/ship.png'], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def intersect? entity_one, entity_two -** Processing line: ~ entity_one.merge(y: current_y(entity_one))~ + ], +** Processing line: ~ [400, 200, 50, 50, 'sprites/ship.png']~ - Inside source: true *** True Line Result - entity_one.merge(y: current_y(entity_one)) -** Processing line: ~ .intersect_rect? entity_two.merge(y: current_y(entity_two))~ + [400, 200, 50, 50, 'sprites/ship.png'] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - .intersect_rect? entity_two.merge(y: current_y(entity_two)) -** Processing line: ~ end~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ args.outputs.sprites << sprites_collection~ +- Inside source: true +*** True Line Result + args.outputs.sprites << sprites_collection ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def kill args~ +** Processing line: ~ args.outputs.solids << [~ - Inside source: true *** True Line Result - def kill args -** Processing line: ~ bullets_hitting_enemies = []~ + args.outputs.solids << [ +** Processing line: ~ [500, 0, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - bullets_hitting_enemies = [] -** Processing line: ~ dead_bullets = []~ + [500, 0, 50, 50, 'sprites/ship.png'], +** Processing line: ~ [500, 100, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - dead_bullets = [] -** Processing line: ~ dead_enemies = []~ + [500, 100, 50, 50, 'sprites/ship.png'], +** Processing line: ~ [[[500, 200, 50, 50, 'sprites/ship.png']]]~ - Inside source: true *** True Line Result - dead_enemies = [] + [[[500, 200, 50, 50, 'sprites/ship.png']]] +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.player_bullets.each do |b|~ +** Processing line: ~ args.outputs.borders << [~ - Inside source: true *** True Line Result - args.state.player_bullets.each do |b| -** Processing line: ~ args.state.enemies.each do |e|~ + args.outputs.borders << [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - args.state.enemies.each do |e| -** Processing line: ~ if intersect? b, e~ + [ +** Processing line: ~ [600, 0, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - if intersect? b, e -** Processing line: ~ dead_bullets << b~ + [600, 0, 50, 50, 'sprites/ship.png'], +** Processing line: ~ [600, 100, 50, 50, 'sprites/ship.png'],~ - Inside source: true *** True Line Result - dead_bullets << b -** Processing line: ~ dead_enemies << e~ + [600, 100, 50, 50, 'sprites/ship.png'], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - dead_enemies << e -** Processing line: ~ end~ + ], +** Processing line: ~ [600, 200, 50, 50, 'sprites/ship.png']~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [600, 200, 50, 50, 'sprites/ship.png'] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.score += dead_enemies.length~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - args.state.score += dead_enemies.length +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ args.state.player_bullets.reject! { |b| dead_bullets.include? b }~ +** Processing line: ~* Advanced Rendering - Render Primitives As Hash - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Advanced Rendering - Render Primitives As Hash - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb~ - Inside source: true *** True Line Result - args.state.player_bullets.reject! { |b| dead_bullets.include? b } -** Processing line: ~ args.state.enemies.reject! { |e| dead_enemies.include? e }~ + # ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - args.state.enemies.reject! { |e| dead_enemies.include? e } + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ dead = args.state.bullets.any? do |b|~ -- Inside source: true -*** True Line Result - dead = args.state.bullets.any? do |b| -** Processing line: ~ [args.state.player.x,~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - [args.state.player.x, -** Processing line: ~ args.state.player.y,~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player.y, -** Processing line: ~ args.state.player.w,~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ - Inside source: true *** True Line Result - args.state.player.w, -** Processing line: ~ args.state.player.h].intersect_rect? b.merge(y: current_y(b))~ + - Hashes: Collection of unique keys and their corresponding values. The value can be found +** Processing line: ~ using their keys.~ - Inside source: true *** True Line Result - args.state.player.h].intersect_rect? b.merge(y: current_y(b)) -** Processing line: ~ end~ + using their keys. +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ return unless dead~ + +** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ - Inside source: true *** True Line Result - return unless dead -** Processing line: ~ args.gtk.reset~ + For example, if we have a "numbers" hash that stores numbers in English as the +** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ - Inside source: true *** True Line Result - args.gtk.reset -** Processing line: ~ defaults args~ + key and numbers in Spanish as the value, we'd have a hash that looks like this... +** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ end~ + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } +** Processing line: ~ and on it goes.~ - Inside source: true *** True Line Result - end + and on it goes. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc args~ +** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ - Inside source: true *** True Line Result - def calc args -** Processing line: ~ calc_stars args~ + Now if we wanted to find the corresponding value of the "one" key, we could say +** Processing line: ~ puts numbers["one"]~ - Inside source: true *** True Line Result - calc_stars args -** Processing line: ~ move_enemies args~ + puts numbers["one"] +** Processing line: ~ which would print "uno" to the console.~ - Inside source: true *** True Line Result - move_enemies args -** Processing line: ~ move_bullets args~ + which would print "uno" to the console. +** Processing line: ~~ - Inside source: true *** True Line Result - move_bullets args -** Processing line: ~ kill args~ + +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ - Inside source: true *** True Line Result - kill args -** Processing line: ~ end~ + - args.outputs.sprites: An array. The values generate a sprite. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - end + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +- Inside source: true +*** True Line Result + For more information about sprites, go to mygame/documentation/05-sprites.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def current_y entity~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - def current_y entity -** Processing line: ~ entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity))~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) -** Processing line: ~ end~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render args~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ args.outputs.solids << args.state.stars.map do |s|~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.stars.map do |s| -** Processing line: ~ [s[:x],~ + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - [s[:x], -** Processing line: ~ current_y(s),~ + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. +** Processing line: ~~ - Inside source: true *** True Line Result - current_y(s), -** Processing line: ~ s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)]~ + +** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ - Inside source: true *** True Line Result - s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] -** Processing line: ~ end~ + - args.outputs.borders: An array. The values generate a border. +** Processing line: ~ The parameters are the same as a solid.~ - Inside source: true *** True Line Result - end + The parameters are the same as a solid. +** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ +- Inside source: true +*** True Line Result + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.borders << args.state.enemies.map do |s|~ +** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ - Inside source: true *** True Line Result - args.outputs.borders << args.state.enemies.map do |s| -** Processing line: ~ [s[:x],~ + - args.outputs.lines: An array. The values generate a line. +** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - [s[:x], -** Processing line: ~ current_y(s),~ + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - current_y(s), -** Processing line: ~ s[:w], s[:h], 255, 0, 0]~ + For more information about labels, go to mygame/documentation/02-labels.md. +** Processing line: ~~ - Inside source: true *** True Line Result - s[:w], s[:h], 255, 0, 0] -** Processing line: ~ end~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - end + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.borders << args.state.bullets.map do |b|~ +** Processing line: ~ # This sample app demonstrates how hashes can be used to output different kinds of objects.~ - Inside source: true *** True Line Result - args.outputs.borders << args.state.bullets.map do |b| -** Processing line: ~ [b[:x],~ + # This sample app demonstrates how hashes can be used to output different kinds of objects. +** Processing line: ~~ - Inside source: true *** True Line Result - [b[:x], -** Processing line: ~ current_y(b),~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - current_y(b), -** Processing line: ~ b[:w], b[:h], 255, 0, 0]~ + def tick args +** Processing line: ~ args.state.angle ||= 0 # initializes angle to 0~ - Inside source: true *** True Line Result - b[:w], b[:h], 255, 0, 0] -** Processing line: ~ end~ + args.state.angle ||= 0 # initializes angle to 0 +** Processing line: ~ args.state.angle += 1 # increments angle by 1 every frame (60 times a second)~ - Inside source: true *** True Line Result - end + args.state.angle += 1 # increments angle by 1 every frame (60 times a second) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.borders << args.state.player_bullets.map do |b|~ +** Processing line: ~ # Outputs sprite using a hash~ - Inside source: true *** True Line Result - args.outputs.borders << args.state.player_bullets.map do |b| -** Processing line: ~ [b[:x],~ + # Outputs sprite using a hash +** Processing line: ~ args.outputs.sprites << {~ - Inside source: true *** True Line Result - [b[:x], -** Processing line: ~ current_y(b),~ + args.outputs.sprites << { +** Processing line: ~ x: 30, # sprite position~ - Inside source: true *** True Line Result - current_y(b), -** Processing line: ~ b[:w], b[:h], 255, 255, 255]~ + x: 30, # sprite position +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - b[:w], b[:h], 255, 255, 255] -** Processing line: ~ end~ + y: 550, +** Processing line: ~ w: 128, # sprite size~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + w: 128, # sprite size +** Processing line: ~ h: 101,~ - Inside source: true *** True Line Result - -** Processing line: ~ args.borders << [args.state.player.x,~ + h: 101, +** Processing line: ~ path: "dragonruby.png", # image path~ - Inside source: true *** True Line Result - args.borders << [args.state.player.x, -** Processing line: ~ args.state.player.y,~ + path: "dragonruby.png", # image path +** Processing line: ~ angle: args.state.angle, # angle~ - Inside source: true *** True Line Result - args.state.player.y, -** Processing line: ~ args.state.player.w,~ + angle: args.state.angle, # angle +** Processing line: ~ a: 255, # alpha (transparency)~ - Inside source: true *** True Line Result - args.state.player.w, -** Processing line: ~ args.state.player.h, 255, 255, 255]~ + a: 255, # alpha (transparency) +** Processing line: ~ r: 255, # color saturation~ - Inside source: true *** True Line Result - args.state.player.h, 255, 255, 255] -** Processing line: ~ end~ + r: 255, # color saturation +** Processing line: ~ g: 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 255, +** Processing line: ~ b: 255,~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + b: 255, +** Processing line: ~ tile_x: 0, # sprite sub division/tile~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ defaults args~ + tile_x: 0, # sprite sub division/tile +** Processing line: ~ tile_y: 0,~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ input args~ + tile_y: 0, +** Processing line: ~ tile_w: -1,~ - Inside source: true *** True Line Result - input args -** Processing line: ~ calc args~ + tile_w: -1, +** Processing line: ~ tile_h: -1,~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ render args~ + tile_h: -1, +** Processing line: ~ flip_vertically: false, # don't flip sprite~ - Inside source: true *** True Line Result - render args -** Processing line: ~ end~ + flip_vertically: false, # don't flip sprite +** Processing line: ~ flip_horizontally: false,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + flip_horizontally: false, +** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + angle_anchor_x: 0.5, # rotation center set to middle +** Processing line: ~ angle_anchor_y: 0.5~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + angle_anchor_y: 0.5 +** Processing line: ~ }~ +- Inside source: true *** True Line Result - -** Processing line: ~* 09_performance/01_sprites_as_hash/app/main.rb~ -- Header detected. + } +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ # Outputs label using a hash~ +- Inside source: true *** True Line Result -* 09_performance/01_sprites_as_hash/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + # Outputs label using a hash +** Processing line: ~ args.outputs.labels << {~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Sprites represented as Hashes using the queue ~args.outputs.sprites~~ + args.outputs.labels << { +** Processing line: ~ x: 200, # label position~ - Inside source: true *** True Line Result - # Sprites represented as Hashes using the queue ~args.outputs.sprites~ -** Processing line: ~ # code up, but are the "slowest" to render.~ + x: 200, # label position +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - # code up, but are the "slowest" to render. -** Processing line: ~ # The reason for this is the access of the key in the Hash and also~ + y: 550, +** Processing line: ~ text: "dragonruby", # label text~ - Inside source: true *** True Line Result - # The reason for this is the access of the key in the Hash and also -** Processing line: ~ # because the data args.outputs.sprites is cleared every tick.~ + text: "dragonruby", # label text +** Processing line: ~ size_enum: 2,~ - Inside source: true *** True Line Result - # because the data args.outputs.sprites is cleared every tick. -** Processing line: ~ def random_x args~ + size_enum: 2, +** Processing line: ~ alignment_enum: 1,~ - Inside source: true *** True Line Result - def random_x args -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ + alignment_enum: 1, +** Processing line: ~ r: 155, # color saturation~ - Inside source: true *** True Line Result - (args.grid.w.randomize :ratio) * -1 -** Processing line: ~ end~ + r: 155, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_y args~ + b: 50, +** Processing line: ~ a: 255, # transparency~ - Inside source: true *** True Line Result - def random_y args -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ + a: 255, # transparency +** Processing line: ~ font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly~ - Inside source: true *** True Line Result - (args.grid.h.randomize :ratio) * -1 -** Processing line: ~ end~ + font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def random_speed~ +** Processing line: ~ # Outputs solid using a hash~ - Inside source: true *** True Line Result - def random_speed -** Processing line: ~ 1 + (4.randomize :ratio)~ + # Outputs solid using a hash +** Processing line: ~ # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ - Inside source: true *** True Line Result - 1 + (4.randomize :ratio) -** Processing line: ~ end~ + # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] +** Processing line: ~ args.outputs.solids << {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.outputs.solids << { +** Processing line: ~ x: 400, # position~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_star args~ + x: 400, # position +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - def new_star args -** Processing line: ~ {~ + y: 550, +** Processing line: ~ w: 160, # size~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: (random_x args),~ + w: 160, # size +** Processing line: ~ h: 90,~ - Inside source: true *** True Line Result - x: (random_x args), -** Processing line: ~ y: (random_y args),~ + h: 90, +** Processing line: ~ r: 120, # color saturation~ - Inside source: true *** True Line Result - y: (random_y args), -** Processing line: ~ w: 4, h: 4, path: 'sprites/tiny-star.png',~ + r: 120, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - w: 4, h: 4, path: 'sprites/tiny-star.png', -** Processing line: ~ s: random_speed~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - s: random_speed -** Processing line: ~ }~ + b: 50, +** Processing line: ~ a: 255 # transparency~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + a: 255 # transparency +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move_star args, star~ +** Processing line: ~ # Outputs border using a hash~ - Inside source: true *** True Line Result - def move_star args, star -** Processing line: ~ star.x += star[:s]~ + # Outputs border using a hash +** Processing line: ~ # Same parameters as a solid~ - Inside source: true *** True Line Result - star.x += star[:s] -** Processing line: ~ star.y += star[:s]~ + # Same parameters as a solid +** Processing line: ~ args.outputs.borders << {~ - Inside source: true *** True Line Result - star.y += star[:s] -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ + args.outputs.borders << { +** Processing line: ~ x: 600,~ - Inside source: true *** True Line Result - if star.x > args.grid.w || star.y > args.grid.h -** Processing line: ~ star.x = (random_x args)~ + x: 600, +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - star.x = (random_x args) -** Processing line: ~ star.y = (random_y args)~ + y: 550, +** Processing line: ~ w: 160,~ - Inside source: true *** True Line Result - star.y = (random_y args) -** Processing line: ~ star[:s] = random_speed~ + w: 160, +** Processing line: ~ h: 90,~ - Inside source: true *** True Line Result - star[:s] = random_speed -** Processing line: ~ end~ + h: 90, +** Processing line: ~ r: 120,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + r: 120, +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + b: 50, +** Processing line: ~ a: 255~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.star_count ||= 0~ + a: 255 +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.star_count ||= 0 + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # sets console command when sample app initially opens~ -- Inside source: true -*** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ -- Inside source: true -*** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ # Outputs line using a hash~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + # Outputs line using a hash +** Processing line: ~ args.outputs.lines << {~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" -** Processing line: ~ end~ + args.outputs.lines << { +** Processing line: ~ x: 900, # starting position~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x: 900, # starting position +** Processing line: ~ y: 550,~ - Inside source: true *** True Line Result - -** Processing line: ~ # init~ + y: 550, +** Processing line: ~ x2: 1200, # ending position~ - Inside source: true *** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ + x2: 1200, # ending position +** Processing line: ~ y2: 550,~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ + y2: 550, +** Processing line: ~ r: 120, # color saturation~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| new_star args } -** Processing line: ~ end~ + r: 120, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ # update~ + b: 50, +** Processing line: ~ a: 255 # transparency~ - Inside source: true *** True Line Result - # update -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ + a: 255 # transparency +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.stars.each { |s| move_star args, s } + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # render~ -- Inside source: true -*** True Line Result - # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ -- Inside source: true -*** True Line Result - args.outputs.sprites << args.state.stars -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ # Outputs sprite as a primitive using a hash~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + # Outputs sprite as a primitive using a hash +** Processing line: ~ args.outputs.primitives << {~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives -** Processing line: ~ end~ + args.outputs.primitives << { +** Processing line: ~ x: 30, # position~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x: 30, # position +** Processing line: ~ y: 200,~ - Inside source: true *** True Line Result - -** Processing line: ~ # resets game, and assigns star count given by user~ + y: 200, +** Processing line: ~ w: 128, # size~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + w: 128, # size +** Processing line: ~ h: 101,~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + h: 101, +** Processing line: ~ path: "dragonruby.png", # image path~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + path: "dragonruby.png", # image path +** Processing line: ~ angle: args.state.angle, # angle~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count -** Processing line: ~ end~ + angle: args.state.angle, # angle +** Processing line: ~ a: 255, # transparency~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + a: 255, # transparency +** Processing line: ~ r: 255, # color saturation~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 09_performance/02_sprites_as_entities/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 09_performance/02_sprites_as_entities/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # Sprites represented as Entities using the queue ~args.outputs.sprites~~ + r: 255, # color saturation +** Processing line: ~ g: 255,~ - Inside source: true *** True Line Result - # Sprites represented as Entities using the queue ~args.outputs.sprites~ -** Processing line: ~ # yields nicer access apis over Hashes, but require a bit more code upfront.~ + g: 255, +** Processing line: ~ b: 255,~ - Inside source: true *** True Line Result - # yields nicer access apis over Hashes, but require a bit more code upfront. -** Processing line: ~ # The hash sample has to use star[:s] to get the speed of the star, but~ + b: 255, +** Processing line: ~ tile_x: 0, # sprite sub division/tile~ - Inside source: true *** True Line Result - # The hash sample has to use star[:s] to get the speed of the star, but -** Processing line: ~ # an entity can use .s instead.~ + tile_x: 0, # sprite sub division/tile +** Processing line: ~ tile_y: 0,~ - Inside source: true *** True Line Result - # an entity can use .s instead. -** Processing line: ~ def random_x args~ + tile_y: 0, +** Processing line: ~ tile_w: -1,~ - Inside source: true *** True Line Result - def random_x args -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ + tile_w: -1, +** Processing line: ~ tile_h: -1,~ - Inside source: true *** True Line Result - (args.grid.w.randomize :ratio) * -1 -** Processing line: ~ end~ + tile_h: -1, +** Processing line: ~ flip_vertically: false, # don't flip~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + flip_vertically: false, # don't flip +** Processing line: ~ flip_horizontally: false,~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_y args~ + flip_horizontally: false, +** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ - Inside source: true *** True Line Result - def random_y args -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ + angle_anchor_x: 0.5, # rotation center set to middle +** Processing line: ~ angle_anchor_y: 0.5~ - Inside source: true *** True Line Result - (args.grid.h.randomize :ratio) * -1 -** Processing line: ~ end~ + angle_anchor_y: 0.5 +** Processing line: ~ }.sprite~ - Inside source: true *** True Line Result - end + }.sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def random_speed~ +** Processing line: ~ # Outputs label as primitive using a hash~ - Inside source: true *** True Line Result - def random_speed -** Processing line: ~ 1 + (4.randomize :ratio)~ + # Outputs label as primitive using a hash +** Processing line: ~ args.outputs.primitives << {~ - Inside source: true *** True Line Result - 1 + (4.randomize :ratio) -** Processing line: ~ end~ + args.outputs.primitives << { +** Processing line: ~ x: 200, # position~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x: 200, # position +** Processing line: ~ y: 200,~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_star args~ + y: 200, +** Processing line: ~ text: "dragonruby", # text~ - Inside source: true *** True Line Result - def new_star args -** Processing line: ~ args.state.new_entity :star, {~ + text: "dragonruby", # text +** Processing line: ~ size: 2,~ - Inside source: true *** True Line Result - args.state.new_entity :star, { -** Processing line: ~ x: (random_x args),~ + size: 2, +** Processing line: ~ alignment: 1,~ - Inside source: true *** True Line Result - x: (random_x args), -** Processing line: ~ y: (random_y args),~ + alignment: 1, +** Processing line: ~ r: 155, # color saturation~ - Inside source: true *** True Line Result - y: (random_y args), -** Processing line: ~ w: 4, h: 4,~ + r: 155, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - w: 4, h: 4, -** Processing line: ~ path: 'sprites/tiny-star.png',~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - path: 'sprites/tiny-star.png', -** Processing line: ~ s: random_speed~ + b: 50, +** Processing line: ~ a: 255, # transparency~ - Inside source: true *** True Line Result - s: random_speed -** Processing line: ~ }~ + a: 255, # transparency +** Processing line: ~ font: "fonts/manaspc.ttf" # font style~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + font: "fonts/manaspc.ttf" # font style +** Processing line: ~ }.label~ - Inside source: true *** True Line Result - end + }.label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move_star args, star~ -- Inside source: true -*** True Line Result - def move_star args, star -** Processing line: ~ star.x += star.s~ +** Processing line: ~ # Outputs solid as primitive using a hash~ - Inside source: true *** True Line Result - star.x += star.s -** Processing line: ~ star.y += star.s~ + # Outputs solid as primitive using a hash +** Processing line: ~ args.outputs.primitives << {~ - Inside source: true *** True Line Result - star.y += star.s -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ + args.outputs.primitives << { +** Processing line: ~ x: 400, # position~ - Inside source: true *** True Line Result - if star.x > args.grid.w || star.y > args.grid.h -** Processing line: ~ star.x = (random_x args)~ + x: 400, # position +** Processing line: ~ y: 200,~ - Inside source: true *** True Line Result - star.x = (random_x args) -** Processing line: ~ star.y = (random_y args)~ + y: 200, +** Processing line: ~ w: 160, # size~ - Inside source: true *** True Line Result - star.y = (random_y args) -** Processing line: ~ star.s = random_speed~ + w: 160, # size +** Processing line: ~ h: 90,~ - Inside source: true *** True Line Result - star.s = random_speed -** Processing line: ~ end~ + h: 90, +** Processing line: ~ r: 120, # color saturation~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + r: 120, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + b: 50, +** Processing line: ~ a: 255 # transparency~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.star_count ||= 0~ + a: 255 # transparency +** Processing line: ~ }.solid~ - Inside source: true *** True Line Result - args.state.star_count ||= 0 + }.solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # sets console command when sample app initially opens~ -- Inside source: true -*** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ # Outputs border as primitive using a hash~ - Inside source: true *** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ + # Outputs border as primitive using a hash +** Processing line: ~ # Same parameters as solid~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + # Same parameters as solid +** Processing line: ~ args.outputs.primitives << {~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" -** Processing line: ~ end~ + args.outputs.primitives << { +** Processing line: ~ x: 600, # position~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x: 600, # position +** Processing line: ~ y: 200,~ - Inside source: true *** True Line Result - -** Processing line: ~ # init~ + y: 200, +** Processing line: ~ w: 160, # size~ - Inside source: true *** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ + w: 160, # size +** Processing line: ~ h: 90,~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ + h: 90, +** Processing line: ~ r: 120, # color saturation~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| new_star args } -** Processing line: ~ end~ + r: 120, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ # update~ + b: 50, +** Processing line: ~ a: 255 # transparency~ - Inside source: true *** True Line Result - # update -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ + a: 255 # transparency +** Processing line: ~ }.border~ - Inside source: true *** True Line Result - args.state.stars.each { |s| move_star args, s } + }.border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # render~ +** Processing line: ~ # Outputs line as primitive using a hash~ - Inside source: true *** True Line Result - # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ + # Outputs line as primitive using a hash +** Processing line: ~ args.outputs.primitives << {~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.stars -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + args.outputs.primitives << { +** Processing line: ~ x: 900, # starting position~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + x: 900, # starting position +** Processing line: ~ y: 200,~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives -** Processing line: ~ end~ + y: 200, +** Processing line: ~ x2: 1200, # ending position~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x2: 1200, # ending position +** Processing line: ~ y2: 200,~ - Inside source: true *** True Line Result - -** Processing line: ~ # resets game, and assigns star count given by user~ + y2: 200, +** Processing line: ~ r: 120, # color saturation~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + r: 120, # color saturation +** Processing line: ~ g: 50,~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + g: 50, +** Processing line: ~ b: 50,~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + b: 50, +** Processing line: ~ a: 255 # transparency~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count + a: 255 # transparency +** Processing line: ~ }.line~ +- Inside source: true +*** True Line Result + }.line ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -32805,430 +33156,462 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 09_performance/03_sprites_as_strict_entities/app/main.rb~ +** Processing line: ~* Tweening Lerping Easing Functions - Easing Functions - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 09_performance/03_sprites_as_strict_entities/app/main.rb +* Tweening Lerping Easing Functions - Easing Functions - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ -- Inside source: true -*** True Line Result - # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ -** Processing line: ~ # yields apis access similar to Entities, but all properties that can be set on the~ +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb~ - Inside source: true *** True Line Result - # yields apis access similar to Entities, but all properties that can be set on the -** Processing line: ~ # entity must be predefined with a default value. Strict entities do not support the~ + # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # entity must be predefined with a default value. Strict entities do not support the -** Processing line: ~ # addition of new properties after the fact. They are more performant than OpenEntities~ + def tick args +** Processing line: ~ # STOP! Watch the following presentation first!!!!~ - Inside source: true *** True Line Result - # addition of new properties after the fact. They are more performant than OpenEntities -** Processing line: ~ # because of this constraint.~ + # STOP! Watch the following presentation first!!!! +** Processing line: ~ # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations~ - Inside source: true *** True Line Result - # because of this constraint. -** Processing line: ~ def random_x args~ + # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations +** Processing line: ~ # https://www.youtube.com/watch?v=mr5xkf6zSzk~ - Inside source: true *** True Line Result - def random_x args -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ + # https://www.youtube.com/watch?v=mr5xkf6zSzk +** Processing line: ~~ - Inside source: true *** True Line Result - (args.grid.w.randomize :ratio) * -1 -** Processing line: ~ end~ + +** Processing line: ~ # You've watched the talk, yes? YES???~ - Inside source: true *** True Line Result - end + # You've watched the talk, yes? YES??? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def random_y args~ +** Processing line: ~ # define starting and ending points of properties to animate~ - Inside source: true *** True Line Result - def random_y args -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ + # define starting and ending points of properties to animate +** Processing line: ~ args.state.target_x = 1180~ - Inside source: true *** True Line Result - (args.grid.h.randomize :ratio) * -1 -** Processing line: ~ end~ + args.state.target_x = 1180 +** Processing line: ~ args.state.target_y = 620~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.target_y = 620 +** Processing line: ~ args.state.target_w = 100~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_speed~ + args.state.target_w = 100 +** Processing line: ~ args.state.target_h = 100~ - Inside source: true *** True Line Result - def random_speed -** Processing line: ~ 1 + (4.randomize :ratio)~ + args.state.target_h = 100 +** Processing line: ~ args.state.starting_x = 0~ - Inside source: true *** True Line Result - 1 + (4.randomize :ratio) -** Processing line: ~ end~ + args.state.starting_x = 0 +** Processing line: ~ args.state.starting_y = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.starting_y = 0 +** Processing line: ~ args.state.starting_w = 300~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_star args~ + args.state.starting_w = 300 +** Processing line: ~ args.state.starting_h = 300~ - Inside source: true *** True Line Result - def new_star args -** Processing line: ~ args.state.new_entity_strict(:star,~ + args.state.starting_h = 300 +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.new_entity_strict(:star, -** Processing line: ~ x: (random_x args),~ + +** Processing line: ~ # define start time and duration of animation~ - Inside source: true *** True Line Result - x: (random_x args), -** Processing line: ~ y: (random_y args),~ + # define start time and duration of animation +** Processing line: ~ args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300)~ - Inside source: true *** True Line Result - y: (random_y args), -** Processing line: ~ w: 4, h: 4,~ + args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) +** Processing line: ~ args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120)~ - Inside source: true *** True Line Result - w: 4, h: 4, -** Processing line: ~ path: 'sprites/tiny-star.png',~ + args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) +** Processing line: ~~ - Inside source: true *** True Line Result - path: 'sprites/tiny-star.png', -** Processing line: ~ s: random_speed) do |entity|~ + +** Processing line: ~ # define type of animations~ - Inside source: true *** True Line Result - s: random_speed) do |entity| -** Processing line: ~ # invoke attr_sprite so that it responds to~ + # define type of animations +** Processing line: ~ # Here are all the options you have for values you can put in the array:~ - Inside source: true *** True Line Result - # invoke attr_sprite so that it responds to -** Processing line: ~ # all properties that are required to render a sprite~ + # Here are all the options you have for values you can put in the array: +** Processing line: ~ # :identity, :quad, :cube, :quart, :quint, :flip~ - Inside source: true *** True Line Result - # all properties that are required to render a sprite -** Processing line: ~ entity.attr_sprite~ + # :identity, :quad, :cube, :quart, :quint, :flip +** Processing line: ~~ - Inside source: true *** True Line Result - entity.attr_sprite -** Processing line: ~ end~ + +** Processing line: ~ # Linear is defined as:~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Linear is defined as: +** Processing line: ~ # [:identity]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # [:identity] +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ def move_star args, star~ + # +** Processing line: ~ # Smooth start variations are:~ - Inside source: true *** True Line Result - def move_star args, star -** Processing line: ~ star.x += star.s~ + # Smooth start variations are: +** Processing line: ~ # [:quad]~ - Inside source: true *** True Line Result - star.x += star.s -** Processing line: ~ star.y += star.s~ + # [:quad] +** Processing line: ~ # [:cube]~ - Inside source: true *** True Line Result - star.y += star.s -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ + # [:cube] +** Processing line: ~ # [:quart]~ - Inside source: true *** True Line Result - if star.x > args.grid.w || star.y > args.grid.h -** Processing line: ~ star.x = (random_x args)~ + # [:quart] +** Processing line: ~ # [:quint]~ - Inside source: true *** True Line Result - star.x = (random_x args) -** Processing line: ~ star.y = (random_y args)~ + # [:quint] +** Processing line: ~~ - Inside source: true *** True Line Result - star.y = (random_y args) -** Processing line: ~ star.s = random_speed~ + +** Processing line: ~ # Linear reversed, and smooth stop are the same as the animations defined above, but reversed:~ - Inside source: true *** True Line Result - star.s = random_speed -** Processing line: ~ end~ + # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: +** Processing line: ~ # [:flip, :identity]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # [:flip, :identity] +** Processing line: ~ # [:flip, :quad, :flip]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # [:flip, :quad, :flip] +** Processing line: ~ # [:flip, :cube, :flip]~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + # [:flip, :cube, :flip] +** Processing line: ~ # [:flip, :quart, :flip]~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.star_count ||= 0~ + # [:flip, :quart, :flip] +** Processing line: ~ # [:flip, :quint, :flip]~ - Inside source: true *** True Line Result - args.state.star_count ||= 0 + # [:flip, :quint, :flip] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # sets console command when sample app initially opens~ -- Inside source: true -*** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ # You can also do custom definitions. See the bottom of the file details~ - Inside source: true *** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ + # You can also do custom definitions. See the bottom of the file details +** Processing line: ~ # on how to do that. I've defined a couple for you:~ - Inside source: true *** True Line Result - puts "* INFO - Please specify the number of sprites to render." -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + # on how to do that. I've defined a couple for you: +** Processing line: ~ # [:smoothest_start]~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" -** Processing line: ~ end~ + # [:smoothest_start] +** Processing line: ~ # [:smoothest_stop]~ - Inside source: true *** True Line Result - end + # [:smoothest_stop] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # init~ +** Processing line: ~ # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS~ - Inside source: true *** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ + # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS +** Processing line: ~ args.state.animation_type = [:identity]~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ + args.state.animation_type = [:identity] +** Processing line: ~ # args.state.animation_type = [:quad]~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| new_star args } -** Processing line: ~ end~ + # args.state.animation_type = [:quad] +** Processing line: ~ # args.state.animation_type = [:cube]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # args.state.animation_type = [:cube] +** Processing line: ~ # args.state.animation_type = [:quart]~ - Inside source: true *** True Line Result - -** Processing line: ~ # update~ + # args.state.animation_type = [:quart] +** Processing line: ~ # args.state.animation_type = [:quint]~ - Inside source: true *** True Line Result - # update -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ + # args.state.animation_type = [:quint] +** Processing line: ~ # args.state.animation_type = [:flip, :identity]~ - Inside source: true *** True Line Result - args.state.stars.each { |s| move_star args, s } -** Processing line: ~~ + # args.state.animation_type = [:flip, :identity] +** Processing line: ~ # args.state.animation_type = [:flip, :quad, :flip]~ - Inside source: true *** True Line Result - -** Processing line: ~ # render~ + # args.state.animation_type = [:flip, :quad, :flip] +** Processing line: ~ # args.state.animation_type = [:flip, :cube, :flip]~ - Inside source: true *** True Line Result - # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ + # args.state.animation_type = [:flip, :cube, :flip] +** Processing line: ~ # args.state.animation_type = [:flip, :quart, :flip]~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.stars -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + # args.state.animation_type = [:flip, :quart, :flip] +** Processing line: ~ # args.state.animation_type = [:flip, :quint, :flip]~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + # args.state.animation_type = [:flip, :quint, :flip] +** Processing line: ~ # args.state.animation_type = [:smoothest_start]~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives -** Processing line: ~ end~ + # args.state.animation_type = [:smoothest_start] +** Processing line: ~ # args.state.animation_type = [:smoothest_stop]~ - Inside source: true *** True Line Result - end + # args.state.animation_type = [:smoothest_stop] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ # THIS IS WHERE THE MAGIC HAPPENS!~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + # THIS IS WHERE THE MAGIC HAPPENS! +** Processing line: ~ # Numeric#ease~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + # Numeric#ease +** Processing line: ~ progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type)~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) +** Processing line: ~~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count -** Processing line: ~ end~ + +** Processing line: ~ # Numeric#ease needs to called:~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Numeric#ease needs to called: +** Processing line: ~ # 1. On the number that represents the point in time you want to start, and takes two parameters:~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + # 1. On the number that represents the point in time you want to start, and takes two parameters: +** Processing line: ~ # a. The first parameter is how long the animation should take.~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + # a. The first parameter is how long the animation should take. +** Processing line: ~ # b. The second parameter represents the functions that need to be called.~ +- Inside source: true *** True Line Result - -** Processing line: ~* 09_performance/04_sprites_as_classes/app/main.rb~ -- Header detected. + # b. The second parameter represents the functions that need to be called. +** Processing line: ~ #~ +- Inside source: true *** True Line Result - + # +** Processing line: ~ # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds,~ +- Inside source: true *** True Line Result -* 09_performance/04_sprites_as_classes/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, +** Processing line: ~ # and I want to animation to start fast and end slow, I would do:~ +- Inside source: true +*** True Line Result + # and I want to animation to start fast and end slow, I would do: +** Processing line: ~ # (60 * 3).ease(60 * 10, :flip, :quint, :flip)~ +- Inside source: true +*** True Line Result + # (60 * 3).ease(60 * 10, :flip, :quint, :flip) +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ # initial value delta to the final value~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ + # initial value delta to the final value +** Processing line: ~ calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress~ - Inside source: true *** True Line Result - # Sprites represented as Classes using the queue ~args.outputs.sprites~. -** Processing line: ~ # gives you full control of property declaration and method invocation.~ + calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress +** Processing line: ~ calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress~ - Inside source: true *** True Line Result - # gives you full control of property declaration and method invocation. -** Processing line: ~ # They are more performant than OpenEntities and StrictEntities, but more code upfront.~ + calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress +** Processing line: ~ calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress~ - Inside source: true *** True Line Result - # They are more performant than OpenEntities and StrictEntities, but more code upfront. -** Processing line: ~ class Star~ + calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress +** Processing line: ~ calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress~ - Inside source: true *** True Line Result - class Star -** Processing line: ~ attr_sprite~ + calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress +** Processing line: ~~ - Inside source: true *** True Line Result - attr_sprite + +** Processing line: ~ args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0]~ +- Inside source: true +*** True Line Result + args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize grid~ +** Processing line: ~ # count down~ - Inside source: true *** True Line Result - def initialize grid -** Processing line: ~ @grid = grid~ + # count down +** Processing line: ~ count_down = args.state.start_animate_at - args.state.tick_count~ - Inside source: true *** True Line Result - @grid = grid -** Processing line: ~ @x = (rand @grid.w) * -1~ + count_down = args.state.start_animate_at - args.state.tick_count +** Processing line: ~ if count_down > 0~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 -** Processing line: ~ @y = (rand @grid.h) * -1~ + if count_down > 0 +** Processing line: ~ args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1]~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 -** Processing line: ~ @w = 4~ + args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] +** Processing line: ~ args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1]~ - Inside source: true *** True Line Result - @w = 4 -** Processing line: ~ @h = 4~ + args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] +** Processing line: ~ elsif progress >= 1~ - Inside source: true *** True Line Result - @h = 4 -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ + elsif progress >= 1 +** Processing line: ~ args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1]~ - Inside source: true *** True Line Result - @s = 1 + (4.randomize :ratio) -** Processing line: ~ @path = 'sprites/tiny-star.png'~ + args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] +** Processing line: ~ if args.inputs.click~ - Inside source: true *** True Line Result - @path = 'sprites/tiny-star.png' + if args.inputs.click +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move~ +** Processing line: ~ # $gtk.reset~ - Inside source: true *** True Line Result - def move -** Processing line: ~ @x += @s~ + # $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - @x += @s -** Processing line: ~ @y += @s~ + +** Processing line: ~ # you can make own variations of animations using this~ - Inside source: true *** True Line Result - @y += @s -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ + # you can make own variations of animations using this +** Processing line: ~ module Easing~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 if @x > @grid.right -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ + module Easing +** Processing line: ~ # you have access to all the built in functions: identity, flip, quad, cube, quart, quint~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 if @y > @grid.top -** Processing line: ~ end~ + # you have access to all the built in functions: identity, flip, quad, cube, quart, quint +** Processing line: ~ def self.smoothest_start x~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def self.smoothest_start x +** Processing line: ~ quad(quint(x))~ - Inside source: true *** True Line Result - end + quad(quint(x)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def self.smoothest_stop x~ - Inside source: true *** True Line Result - # calls methods needed for game to run properly -** Processing line: ~ def tick args~ + def self.smoothest_stop x +** Processing line: ~ flip(quad(quint(flip(x))))~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # sets console command when sample app initially opens~ + flip(quad(quint(flip(x)))) +** Processing line: ~ end~ - Inside source: true *** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + +** Processing line: ~ # this is the source for the existing easing functions~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" + # this is the source for the existing easing functions +** Processing line: ~ def self.identity x~ +- Inside source: true +*** True Line Result + def self.identity x +** Processing line: ~ x~ +- Inside source: true +*** True Line Result + x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33237,18 +33620,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # init~ -- Inside source: true -*** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ def self.flip x~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ + def self.flip x +** Processing line: ~ 1 - x~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } + 1 - x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33257,58 +33636,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # update~ +** Processing line: ~ def self.quad x~ - Inside source: true *** True Line Result - # update -** Processing line: ~ args.state.stars.each(&:move)~ + def self.quad x +** Processing line: ~ x * x~ - Inside source: true *** True Line Result - args.state.stars.each(&:move) + x * x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # render~ +** Processing line: ~ def self.cube x~ - Inside source: true *** True Line Result - # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ + def self.cube x +** Processing line: ~ x * x * x~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.stars -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + x * x * x +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives -** Processing line: ~ end~ + +** Processing line: ~ def self.quart x~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def self.quart x +** Processing line: ~ x * x * x * x * x~ - Inside source: true *** True Line Result - -** Processing line: ~ # resets game, and assigns star count given by user~ + x * x * x * x * x +** Processing line: ~ end~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + +** Processing line: ~ def self.quint x~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + def self.quint x +** Processing line: ~ x * x * x * x * x * x~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count + x * x * x * x * x * x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33325,106 +33712,114 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 09_performance/05_static_sprites_as_classes/app/main.rb~ +** Processing line: ~* Tweening Lerping Easing Functions - Cubic Bezier - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 09_performance/05_static_sprites_as_classes/app/main.rb +* Tweening Lerping Easing Functions - Cubic Bezier - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb~ - Inside source: true *** True Line Result - # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. -** Processing line: ~ # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held~ + # ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held -** Processing line: ~ # by reference. You get better performance, but you are mutating state of held objects~ + def tick args +** Processing line: ~ args.outputs.background_color = [33, 33, 33]~ - Inside source: true *** True Line Result - # by reference. You get better performance, but you are mutating state of held objects -** Processing line: ~ # which is less functional/data oriented.~ + args.outputs.background_color = [33, 33, 33] +** Processing line: ~ args.outputs.lines << bezier(100, 100,~ - Inside source: true *** True Line Result - # which is less functional/data oriented. -** Processing line: ~ class Star~ + args.outputs.lines << bezier(100, 100, +** Processing line: ~ 100, 620,~ - Inside source: true *** True Line Result - class Star -** Processing line: ~ attr_sprite~ + 100, 620, +** Processing line: ~ 1180, 620,~ - Inside source: true *** True Line Result - attr_sprite -** Processing line: ~~ + 1180, 620, +** Processing line: ~ 1180, 100,~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize grid~ + 1180, 100, +** Processing line: ~ 0)~ - Inside source: true *** True Line Result - def initialize grid -** Processing line: ~ @grid = grid~ + 0) +** Processing line: ~~ - Inside source: true *** True Line Result - @grid = grid -** Processing line: ~ @x = (rand @grid.w) * -1~ + +** Processing line: ~ args.outputs.lines << bezier(100, 100,~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 -** Processing line: ~ @y = (rand @grid.h) * -1~ + args.outputs.lines << bezier(100, 100, +** Processing line: ~ 100, 620,~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 -** Processing line: ~ @w = 4~ + 100, 620, +** Processing line: ~ 1180, 620,~ - Inside source: true *** True Line Result - @w = 4 -** Processing line: ~ @h = 4~ + 1180, 620, +** Processing line: ~ 1180, 100,~ - Inside source: true *** True Line Result - @h = 4 -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ + 1180, 100, +** Processing line: ~ 20)~ - Inside source: true *** True Line Result - @s = 1 + (4.randomize :ratio) -** Processing line: ~ @path = 'sprites/tiny-star.png'~ + 20) +** Processing line: ~ end~ - Inside source: true *** True Line Result - @path = 'sprites/tiny-star.png' -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move~ +** Processing line: ~ def bezier x1, y1, x2, y2, x3, y3, x4, y4, step~ - Inside source: true *** True Line Result - def move -** Processing line: ~ @x += @s~ + def bezier x1, y1, x2, y2, x3, y3, x4, y4, step +** Processing line: ~ step ||= 0~ - Inside source: true *** True Line Result - @x += @s -** Processing line: ~ @y += @s~ + step ||= 0 +** Processing line: ~ color = [200, 200, 200]~ - Inside source: true *** True Line Result - @y += @s -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ + color = [200, 200, 200] +** Processing line: ~ points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 if @x > @grid.right -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ + points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step +** Processing line: ~~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 if @y > @grid.top + +** Processing line: ~ points.each_cons(2).map do |p1, p2|~ +- Inside source: true +*** True Line Result + points.each_cons(2).map do |p1, p2| +** Processing line: ~ [p1, p2, color]~ +- Inside source: true +*** True Line Result + [p1, p2, color] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33437,82 +33832,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def points_for_bezier p1, p2, p3, p4, step~ - Inside source: true *** True Line Result - # calls methods needed for game to run properly -** Processing line: ~ def tick args~ + def points_for_bezier p1, p2, p3, p4, step +** Processing line: ~ points = []~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # sets console command when sample app initially opens~ + points = [] +** Processing line: ~ if step == 0~ - Inside source: true *** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ + if step == 0 +** Processing line: ~ [p1, p2, p3, p4]~ - Inside source: true *** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + [p1, p2, p3, p4] +** Processing line: ~ else~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" -** Processing line: ~ end~ + else +** Processing line: ~ t_step = 1.fdiv(step + 1)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + t_step = 1.fdiv(step + 1) +** Processing line: ~ t = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # init~ + t = 0 +** Processing line: ~ t += t_step~ - Inside source: true *** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ + t += t_step +** Processing line: ~ points = []~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ + points = [] +** Processing line: ~ while t < 1~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } -** Processing line: ~ end~ + while t < 1 +** Processing line: ~ points << [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + points << [ +** Processing line: ~ b_for_t(p1.x, p2.x, p3.x, p4.x, t),~ - Inside source: true *** True Line Result - -** Processing line: ~ # update~ + b_for_t(p1.x, p2.x, p3.x, p4.x, t), +** Processing line: ~ b_for_t(p1.y, p2.y, p3.y, p4.y, t),~ - Inside source: true *** True Line Result - # update -** Processing line: ~ args.state.stars.each(&:move)~ + b_for_t(p1.y, p2.y, p3.y, p4.y, t), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.state.stars.each(&:move) + ] +** Processing line: ~ t += t_step~ +- Inside source: true +*** True Line Result + t += t_step +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # render~ +** Processing line: ~ [~ - Inside source: true *** True Line Result - # render -** Processing line: ~ args.outputs.sprites << args.state.stars~ + [ +** Processing line: ~ p1,~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.stars -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + p1, +** Processing line: ~ *points,~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + *points, +** Processing line: ~ p4~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives + p4 +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33521,22 +33932,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def b_for_t v0, v1, v2, v3, t~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + def b_for_t v0, v1, v2, v3, t +** Processing line: ~ pow(1 - t, 3) * v0 +~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + pow(1 - t, 3) * v0 + +** Processing line: ~ 3 * pow(1 - t, 2) * t * v1 +~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + 3 * pow(1 - t, 2) * t * v1 + +** Processing line: ~ 3 * (1 - t) * pow(t, 2) * v2 +~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count + 3 * (1 - t) * pow(t, 2) * v2 + +** Processing line: ~ pow(t, 3) * v3~ +- Inside source: true +*** True Line Result + pow(t, 3) * v3 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def pow n, to~ +- Inside source: true +*** True Line Result + def pow n, to +** Processing line: ~ n ** to~ +- Inside source: true +*** True Line Result + n ** to ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33553,206 +33984,210 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ +** Processing line: ~* Tweening Lerping Easing Functions - Easing Using Spline - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb +* Tweening Lerping Easing Functions - Easing Using Spline - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb~ - Inside source: true *** True Line Result - # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. -** Processing line: ~ # is the fastest approach. This is comparable to what other game engines set as the default behavior.~ + # ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # is the fastest approach. This is comparable to what other game engines set as the default behavior. -** Processing line: ~ # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing~ + def tick args +** Processing line: ~ args.state.duration = 10.seconds~ - Inside source: true *** True Line Result - # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing -** Processing line: ~ # functional/data-oriented practices.~ + args.state.duration = 10.seconds +** Processing line: ~ args.state.spline = [~ - Inside source: true *** True Line Result - # functional/data-oriented practices. -** Processing line: ~ class Star~ + args.state.spline = [ +** Processing line: ~ [0.0, 0.33, 0.66, 1.0],~ - Inside source: true *** True Line Result - class Star -** Processing line: ~ def initialize grid~ + [0.0, 0.33, 0.66, 1.0], +** Processing line: ~ [1.0, 1.0, 1.0, 1.0],~ - Inside source: true *** True Line Result - def initialize grid -** Processing line: ~ @grid = grid~ + [1.0, 1.0, 1.0, 1.0], +** Processing line: ~ [1.0, 0.66, 0.33, 0.0],~ - Inside source: true *** True Line Result - @grid = grid -** Processing line: ~ @x = (rand @grid.w) * -1~ + [1.0, 0.66, 0.33, 0.0], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 -** Processing line: ~ @y = (rand @grid.h) * -1~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 -** Processing line: ~ @w = 4~ + +** Processing line: ~ args.state.simulation_tick = args.state.tick_count % args.state.duration~ - Inside source: true *** True Line Result - @w = 4 -** Processing line: ~ @h = 4~ + args.state.simulation_tick = args.state.tick_count % args.state.duration +** Processing line: ~ progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline~ - Inside source: true *** True Line Result - @h = 4 -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ + progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline +** Processing line: ~ args.outputs.borders << args.grid.rect~ - Inside source: true *** True Line Result - @s = 1 + (4.randomize :ratio) -** Processing line: ~ @path = 'sprites/tiny-star.png'~ + args.outputs.borders << args.grid.rect +** Processing line: ~ args.outputs.solids << [20 + 1240 * progress,~ - Inside source: true *** True Line Result - @path = 'sprites/tiny-star.png' -** Processing line: ~ end~ + args.outputs.solids << [20 + 1240 * progress, +** Processing line: ~ 20 + 680 * progress,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 20 + 680 * progress, +** Processing line: ~ 20, 20].anchor_rect(0.5, 0.5)~ - Inside source: true *** True Line Result - -** Processing line: ~ def move~ + 20, 20].anchor_rect(0.5, 0.5) +** Processing line: ~ args.outputs.labels << [10,~ - Inside source: true *** True Line Result - def move -** Processing line: ~ @x += @s~ + args.outputs.labels << [10, +** Processing line: ~ 710,~ - Inside source: true *** True Line Result - @x += @s -** Processing line: ~ @y += @s~ + 710, +** Processing line: ~ "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"]~ - Inside source: true *** True Line Result - @y += @s -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ + "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - @x = (rand @grid.w) * -1 if @x > @grid.right -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @y = (rand @grid.h) * -1 if @y > @grid.top -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # if the object that is in args.outputs.sprites (or static_sprites)~ -- Inside source: true +** Processing line: ~* Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb~ +- Header detected. *** True Line Result - # if the object that is in args.outputs.sprites (or static_sprites) -** Processing line: ~ # respond_to? :draw_override, then the method is invoked giving you~ + +*** True Line Result +* Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb~ - Inside source: true *** True Line Result - # respond_to? :draw_override, then the method is invoked giving you -** Processing line: ~ # access to the class used to draw to the canvas.~ + # ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb +** Processing line: ~ def new_star args~ - Inside source: true *** True Line Result - # access to the class used to draw to the canvas. -** Processing line: ~ def draw_override ffi_draw~ + def new_star args +** Processing line: ~ { x: 1280.randomize(:ratio),~ - Inside source: true *** True Line Result - def draw_override ffi_draw -** Processing line: ~ # first move then draw~ + { x: 1280.randomize(:ratio), +** Processing line: ~ starting_y: 800,~ - Inside source: true *** True Line Result - # first move then draw -** Processing line: ~ move~ + starting_y: 800, +** Processing line: ~ distance_to_travel: 900 + 100.randomize(:ratio),~ - Inside source: true *** True Line Result - move -** Processing line: ~~ + distance_to_travel: 900 + 100.randomize(:ratio), +** Processing line: ~ duration: 100.randomize(:ratio) + 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ # The argument order for ffi.draw_sprite is:~ + duration: 100.randomize(:ratio) + 60, +** Processing line: ~ created_at: args.state.tick_count,~ - Inside source: true *** True Line Result - # The argument order for ffi.draw_sprite is: -** Processing line: ~ # x, y, w, h, path~ + created_at: args.state.tick_count, +** Processing line: ~ max_alpha: 128.randomize(:ratio) + 128,~ - Inside source: true *** True Line Result - # x, y, w, h, path -** Processing line: ~ ffi_draw.draw_sprite @x, @y, @w, @h, @path~ + max_alpha: 128.randomize(:ratio) + 128, +** Processing line: ~ b: 255.randomize(:ratio),~ - Inside source: true *** True Line Result - ffi_draw.draw_sprite @x, @y, @w, @h, @path -** Processing line: ~~ + b: 255.randomize(:ratio), +** Processing line: ~ g: 200.randomize(:ratio),~ - Inside source: true *** True Line Result - -** Processing line: ~ # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value):~ + g: 200.randomize(:ratio), +** Processing line: ~ w: 1.randomize(:ratio) + 1,~ - Inside source: true *** True Line Result - # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value): -** Processing line: ~ # x, y, w, h, path,~ + w: 1.randomize(:ratio) + 1, +** Processing line: ~ h: 1.randomize(:ratio) + 1 }~ - Inside source: true *** True Line Result - # x, y, w, h, path, -** Processing line: ~ # angle, alpha~ + h: 1.randomize(:ratio) + 1 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # angle, alpha + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The argument order for ffi_draw.draw_sprite_3 is:~ -- Inside source: true -*** True Line Result - # The argument order for ffi_draw.draw_sprite_3 is: -** Processing line: ~ # x, y, w, h,~ +** Processing line: ~ def new_enemy args~ - Inside source: true *** True Line Result - # x, y, w, h, -** Processing line: ~ # path,~ + def new_enemy args +** Processing line: ~ { x: 1280.randomize(:ratio),~ - Inside source: true *** True Line Result - # path, -** Processing line: ~ # angle,~ + { x: 1280.randomize(:ratio), +** Processing line: ~ starting_y: 800,~ - Inside source: true *** True Line Result - # angle, -** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ + starting_y: 800, +** Processing line: ~ distance_to_travel: -900,~ - Inside source: true *** True Line Result - # alpha, red_saturation, green_saturation, blue_saturation -** Processing line: ~ # flip_horizontally, flip_vertically,~ + distance_to_travel: -900, +** Processing line: ~ duration: 60.randomize(:ratio) + 180,~ - Inside source: true *** True Line Result - # flip_horizontally, flip_vertically, -** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ + duration: 60.randomize(:ratio) + 180, +** Processing line: ~ created_at: args.state.tick_count,~ - Inside source: true *** True Line Result - # tile_x, tile_y, tile_w, tile_h -** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ + created_at: args.state.tick_count, +** Processing line: ~ w: 32,~ - Inside source: true *** True Line Result - # angle_anchor_x, angle_anchor_y, -** Processing line: ~ # source_x, source_y, source_w, source_h~ + w: 32, +** Processing line: ~ h: 32,~ - Inside source: true *** True Line Result - # source_x, source_y, source_w, source_h -** Processing line: ~ end~ + h: 32, +** Processing line: ~ fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i }~ - Inside source: true *** True Line Result - end + fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33761,70 +34196,78 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def new_bullet args, starting_x, starting_y, enemy_speed~ - Inside source: true *** True Line Result - # calls methods needed for game to run properly -** Processing line: ~ def tick args~ + def new_bullet args, starting_x, starting_y, enemy_speed +** Processing line: ~ { x: starting_x,~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # sets console command when sample app initially opens~ + { x: starting_x, +** Processing line: ~ starting_y: starting_y,~ - Inside source: true *** True Line Result - # sets console command when sample app initially opens -** Processing line: ~ if Kernel.global_tick_count == 0~ + starting_y: starting_y, +** Processing line: ~ distance_to_travel: -900,~ - Inside source: true *** True Line Result - if Kernel.global_tick_count == 0 -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ + distance_to_travel: -900, +** Processing line: ~ created_at: args.state.tick_count,~ - Inside source: true *** True Line Result - args.gtk.console.set_command "reset_with count: 100" -** Processing line: ~ end~ + created_at: args.state.tick_count, +** Processing line: ~ duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, +** Processing line: ~ w: 5,~ - Inside source: true *** True Line Result - -** Processing line: ~ # init~ + w: 5, +** Processing line: ~ h: 5 }~ - Inside source: true *** True Line Result - # init -** Processing line: ~ if args.state.tick_count == 0~ + h: 5 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.stars = args.state.star_count.map { |i| Star.new args.grid } -** Processing line: ~ args.outputs.static_sprites << args.state.stars~ + +** Processing line: ~ def new_player_bullet args, starting_x, starting_y, player_speed~ - Inside source: true *** True Line Result - args.outputs.static_sprites << args.state.stars -** Processing line: ~ end~ + def new_player_bullet args, starting_x, starting_y, player_speed +** Processing line: ~ { x: starting_x,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { x: starting_x, +** Processing line: ~ starting_y: starting_y,~ - Inside source: true *** True Line Result - -** Processing line: ~ # render framerate~ + starting_y: starting_y, +** Processing line: ~ distance_to_travel: 900,~ - Inside source: true *** True Line Result - # render framerate -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + distance_to_travel: 900, +** Processing line: ~ created_at: args.state.tick_count,~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ + created_at: args.state.tick_count, +** Processing line: ~ duration: 900 / (player_speed + 2.0),~ - Inside source: true *** True Line Result - args.outputs.primitives << args.gtk.current_framerate_primitives + duration: 900 / (player_speed + 2.0), +** Processing line: ~ w: 5,~ +- Inside source: true +*** True Line Result + w: 5, +** Processing line: ~ h: 5 }~ +- Inside source: true +*** True Line Result + h: 5 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33833,142 +34276,130 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - # resets game, and assigns star count given by user -** Processing line: ~ def reset_with count: count~ + def defaults args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - def reset_with count: count -** Processing line: ~ $gtk.reset~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.state.score ||= 0~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ $gtk.args.state.star_count = count~ + args.state.score ||= 0 +** Processing line: ~ args.state.stars ||= []~ - Inside source: true *** True Line Result - $gtk.args.state.star_count = count -** Processing line: ~ end~ + args.state.stars ||= [] +** Processing line: ~ args.state.enemies ||= []~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.enemies ||= [] +** Processing line: ~ args.state.bullets ||= []~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 09_performance/07_collision_limits/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 09_performance/07_collision_limits/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + args.state.bullets ||= [] +** Processing line: ~ args.state.player_bullets ||= []~ +- Inside source: true *** True Line Result - + args.state.player_bullets ||= [] +** Processing line: ~ args.state.max_stars = 50~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + args.state.max_stars = 50 +** Processing line: ~ args.state.max_enemies = 10~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + args.state.max_enemies = 10 +** Processing line: ~ args.state.player.x ||= 640~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + args.state.player.x ||= 640 +** Processing line: ~ args.state.player.y ||= 100~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ + args.state.player.y ||= 100 +** Processing line: ~ args.state.player.w ||= 32~ - Inside source: true *** True Line Result - - find_all: Finds all elements of a collection that meet certain requirements. -** Processing line: ~ In this sample app, we're finding all bodies that intersect with the center body.~ + args.state.player.w ||= 32 +** Processing line: ~ args.state.player.h ||= 32~ - Inside source: true *** True Line Result - In this sample app, we're finding all bodies that intersect with the center body. + args.state.player.h ||= 32 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -- Inside source: true -*** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars.clear~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + args.state.stars.clear +** Processing line: ~ args.state.max_stars.times do~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ + args.state.max_stars.times do +** Processing line: ~ s = new_star args~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + s = new_star args +** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + s[:created_at] += s[:duration].randomize(:ratio) +** Processing line: ~ args.state.stars << s~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + args.state.stars << s +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.enemies.clear~ - Inside source: true *** True Line Result - -** Processing line: ~ # This code demonstrates moving objects that loop around once they exceed the scope of the screen,~ + args.state.enemies.clear +** Processing line: ~ args.state.max_enemies.times do~ - Inside source: true *** True Line Result - # This code demonstrates moving objects that loop around once they exceed the scope of the screen, -** Processing line: ~ # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies".~ + args.state.max_enemies.times do +** Processing line: ~ s = new_enemy args~ - Inside source: true *** True Line Result - # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies". -** Processing line: ~~ + s = new_enemy args +** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ - Inside source: true *** True Line Result - -** Processing line: ~ def body_count num~ + s[:created_at] += s[:duration].randomize(:ratio) +** Processing line: ~ args.state.enemies << s~ - Inside source: true *** True Line Result - def body_count num -** Processing line: ~ $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection~ + args.state.enemies << s +** Processing line: ~ end~ - Inside source: true *** True Line Result - $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -33977,110 +34408,134 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~~ +** Processing line: ~ def input args~ - Inside source: true *** True Line Result - -** Processing line: ~ # Center body's values are set using an array~ + def input args +** Processing line: ~ if args.inputs.keyboard.left~ - Inside source: true *** True Line Result - # Center body's values are set using an array -** Processing line: ~ # Map is used to set values of 2000 other bodies~ + if args.inputs.keyboard.left +** Processing line: ~ args.state.player.x -= 5~ - Inside source: true *** True Line Result - # Map is used to set values of 2000 other bodies -** Processing line: ~ # All bodies that intersect with center body are stored in collisions collection~ + args.state.player.x -= 5 +** Processing line: ~ elsif args.inputs.keyboard.right~ - Inside source: true *** True Line Result - # All bodies that intersect with center body are stored in collisions collection -** Processing line: ~ args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center~ + elsif args.inputs.keyboard.right +** Processing line: ~ args.state.player.x += 5~ - Inside source: true *** True Line Result - args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center -** Processing line: ~ args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen~ + args.state.player.x += 5 +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # finds all bodies that intersect with center body, stores them in collisions~ +** Processing line: ~ if args.inputs.keyboard.up~ - Inside source: true *** True Line Result - # finds all bodies that intersect with center body, stores them in collisions -** Processing line: ~ collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body }~ + if args.inputs.keyboard.up +** Processing line: ~ args.state.player.y += 5~ - Inside source: true *** True Line Result - collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body } -** Processing line: ~~ + args.state.player.y += 5 +** Processing line: ~ elsif args.inputs.keyboard.down~ - Inside source: true *** True Line Result - -** Processing line: ~ args.borders << args.state.center_body # outputs center body as a black border~ + elsif args.inputs.keyboard.down +** Processing line: ~ args.state.player.y -= 5~ - Inside source: true *** True Line Result - args.borders << args.state.center_body # outputs center body as a black border + args.state.player.y -= 5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes~ +** Processing line: ~ if args.inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes -** Processing line: ~ args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid~ + if args.inputs.keyboard.key_down.space +** Processing line: ~ args.state.player_bullets << new_player_bullet(args,~ - Inside source: true *** True Line Result - args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid -** Processing line: ~ args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well~ + args.state.player_bullets << new_player_bullet(args, +** Processing line: ~ args.state.player.x + args.state.player.w.half,~ - Inside source: true *** True Line Result - args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well + args.state.player.x + args.state.player.w.half, +** Processing line: ~ args.state.player.y + args.state.player.h, 5)~ +- Inside source: true +*** True Line Result + args.state.player.y + args.state.player.h, 5) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner~ +** Processing line: ~ args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w)~ - Inside source: true *** True Line Result - args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner + args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h)~ +- Inside source: true +*** True Line Result + args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Bodies are returned to bottom left corner if positions exceed scope of screen~ +** Processing line: ~ def completed? entity~ - Inside source: true *** True Line Result - # Bodies are returned to bottom left corner if positions exceed scope of screen -** Processing line: ~ args.state.other_bodies.each do |b| # for each body in the other_bodies collection~ + def completed? entity +** Processing line: ~ (entity[:created_at] + entity[:duration]).elapsed_time > 0~ - Inside source: true *** True Line Result - args.state.other_bodies.each do |b| # for each body in the other_bodies collection -** Processing line: ~ b.x += 5 # x and y are both incremented by 5~ + (entity[:created_at] + entity[:duration]).elapsed_time > 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - b.x += 5 # x and y are both incremented by 5 -** Processing line: ~ b.y += 5~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - b.y += 5 -** Processing line: ~ b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right)~ + +** Processing line: ~ def calc_stars args~ - Inside source: true *** True Line Result - b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right) -** Processing line: ~ b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up)~ + def calc_stars args +** Processing line: ~ if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0~ - Inside source: true *** True Line Result - b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up) + if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 +** Processing line: ~ stars_to_add.times { args.state.stars << new_star(args) }~ +- Inside source: true +*** True Line Result + stars_to_add.times { args.state.stars << new_star(args) } ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ args.state.stars = args.state.stars.reject { |s| completed? s }~ +- Inside source: true +*** True Line Result + args.state.stars = args.state.stars.reject { |s| completed? s } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34089,58 +34544,58 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Resets the game.~ +** Processing line: ~ def move_enemies args~ - Inside source: true *** True Line Result - # Resets the game. -** Processing line: ~ $gtk.reset~ + def move_enemies args +** Processing line: ~ if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~~ + if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 +** Processing line: ~ enemies_to_add.times { args.state.enemies << new_enemy(args) }~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + enemies_to_add.times { args.state.enemies << new_enemy(args) } +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. +- Inside source: true *** True Line Result -** Processing line: ~* 10_advanced_debugging/01_trace_debugging/app/main.rb~ -- Header detected. +** Processing line: ~ args.state.enemies = args.state.enemies.reject { |s| completed? s }~ +- Inside source: true *** True Line Result - + args.state.enemies = args.state.enemies.reject { |s| completed? s } +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* 10_advanced_debugging/01_trace_debugging/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~~ +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ class Game~ +** Processing line: ~ def move_bullets args~ - Inside source: true *** True Line Result - class Game -** Processing line: ~ attr_gtk~ + def move_bullets args +** Processing line: ~ args.state.enemies.each do |e|~ - Inside source: true *** True Line Result - attr_gtk -** Processing line: ~~ + args.state.enemies.each do |e| +** Processing line: ~ if args.state.tick_count.mod_zero?(e[:fire_rate])~ - Inside source: true *** True Line Result - -** Processing line: ~ def method1 num~ + if args.state.tick_count.mod_zero?(e[:fire_rate]) +** Processing line: ~ args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration])~ - Inside source: true *** True Line Result - def method1 num -** Processing line: ~ method2 num~ + args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) +** Processing line: ~ end~ - Inside source: true *** True Line Result - method2 num + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34149,74 +34604,86 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def method2 num~ +** Processing line: ~ args.state.bullets = args.state.bullets.reject { |s| completed? s }~ - Inside source: true *** True Line Result - def method2 num -** Processing line: ~ method3 num~ + args.state.bullets = args.state.bullets.reject { |s| completed? s } +** Processing line: ~ args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s }~ - Inside source: true *** True Line Result - method3 num -** Processing line: ~ end~ + args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def method3 num~ +** Processing line: ~ def intersect? entity_one, entity_two~ - Inside source: true *** True Line Result - def method3 num -** Processing line: ~ method4 num~ + def intersect? entity_one, entity_two +** Processing line: ~ entity_one.merge(y: current_y(entity_one))~ - Inside source: true *** True Line Result - method4 num -** Processing line: ~ end~ + entity_one.merge(y: current_y(entity_one)) +** Processing line: ~ .intersect_rect? entity_two.merge(y: current_y(entity_two))~ - Inside source: true *** True Line Result - end + .intersect_rect? entity_two.merge(y: current_y(entity_two)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def method4 num~ +** Processing line: ~ def kill args~ - Inside source: true *** True Line Result - def method4 num -** Processing line: ~ if num == 1~ + def kill args +** Processing line: ~ bullets_hitting_enemies = []~ - Inside source: true *** True Line Result - if num == 1 -** Processing line: ~ puts "UNLUCKY #{num}."~ + bullets_hitting_enemies = [] +** Processing line: ~ dead_bullets = []~ - Inside source: true *** True Line Result - puts "UNLUCKY #{num}." -** Processing line: ~ state.unlucky_count += 1~ + dead_bullets = [] +** Processing line: ~ dead_enemies = []~ - Inside source: true *** True Line Result - state.unlucky_count += 1 -** Processing line: ~ if state.unlucky_count > 3~ + dead_enemies = [] +** Processing line: ~~ - Inside source: true *** True Line Result - if state.unlucky_count > 3 -** Processing line: ~ raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history."~ + +** Processing line: ~ args.state.player_bullets.each do |b|~ - Inside source: true *** True Line Result - raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." -** Processing line: ~ end~ + args.state.player_bullets.each do |b| +** Processing line: ~ args.state.enemies.each do |e|~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + args.state.enemies.each do |e| +** Processing line: ~ if intersect? b, e~ - Inside source: true *** True Line Result - else -** Processing line: ~ puts "LUCKY #{num}."~ + if intersect? b, e +** Processing line: ~ dead_bullets << b~ - Inside source: true *** True Line Result - puts "LUCKY #{num}." + dead_bullets << b +** Processing line: ~ dead_enemies << e~ +- Inside source: true +*** True Line Result + dead_enemies << e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34229,74 +34696,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def tick~ +** Processing line: ~ args.state.score += dead_enemies.length~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ state.roll_history ||= []~ + args.state.score += dead_enemies.length +** Processing line: ~~ - Inside source: true *** True Line Result - state.roll_history ||= [] -** Processing line: ~ state.roll_history << rand(20) + 1~ + +** Processing line: ~ args.state.player_bullets.reject! { |b| dead_bullets.include? b }~ - Inside source: true *** True Line Result - state.roll_history << rand(20) + 1 -** Processing line: ~ state.countdown ||= 600~ + args.state.player_bullets.reject! { |b| dead_bullets.include? b } +** Processing line: ~ args.state.enemies.reject! { |e| dead_enemies.include? e }~ - Inside source: true *** True Line Result - state.countdown ||= 600 -** Processing line: ~ state.countdown -= 1~ + args.state.enemies.reject! { |e| dead_enemies.include? e } +** Processing line: ~~ - Inside source: true *** True Line Result - state.countdown -= 1 -** Processing line: ~ state.unlucky_count ||= 0~ + +** Processing line: ~ dead = args.state.bullets.any? do |b|~ - Inside source: true *** True Line Result - state.unlucky_count ||= 0 -** Processing line: ~ outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1]~ + dead = args.state.bullets.any? do |b| +** Processing line: ~ [args.state.player.x,~ - Inside source: true *** True Line Result - outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] -** Processing line: ~ if state.countdown > 0~ + [args.state.player.x, +** Processing line: ~ args.state.player.y,~ - Inside source: true *** True Line Result - if state.countdown > 0 -** Processing line: ~ outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1]~ + args.state.player.y, +** Processing line: ~ args.state.player.w,~ - Inside source: true *** True Line Result - outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] -** Processing line: ~ else~ + args.state.player.w, +** Processing line: ~ args.state.player.h].intersect_rect? b.merge(y: current_y(b))~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.attempts ||= 0~ + args.state.player.h].intersect_rect? b.merge(y: current_y(b)) +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.attempts ||= 0 -** Processing line: ~ state.attempts += 1~ + end +** Processing line: ~ return unless dead~ - Inside source: true *** True Line Result - state.attempts += 1 -** Processing line: ~ outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1]~ + return unless dead +** Processing line: ~ args.gtk.reset~ - Inside source: true *** True Line Result - outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] -** Processing line: ~ end~ + args.gtk.reset +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - end -** Processing line: ~ return if state.countdown > 0~ + defaults args +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if state.countdown > 0 -** Processing line: ~ method1 state.roll_history[-1]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - method1 state.roll_history[-1] -** Processing line: ~ end~ + +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - end + def calc args +** Processing line: ~ calc_stars args~ +- Inside source: true +*** True Line Result + calc_stars args +** Processing line: ~ move_enemies args~ +- Inside source: true +*** True Line Result + move_enemies args +** Processing line: ~ move_bullets args~ +- Inside source: true +*** True Line Result + move_bullets args +** Processing line: ~ kill args~ +- Inside source: true +*** True Line Result + kill args ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34305,70 +34788,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $game = Game.new~ +** Processing line: ~ def current_y entity~ - Inside source: true *** True Line Result - $game = Game.new + def current_y entity +** Processing line: ~ entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity))~ +- Inside source: true +*** True Line Result + entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT~ + def render args +** Processing line: ~ args.outputs.solids << args.state.stars.map do |s|~ - Inside source: true *** True Line Result - trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT -** Processing line: ~ $game.args = args~ + args.outputs.solids << args.state.stars.map do |s| +** Processing line: ~ [s[:x],~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + [s[:x], +** Processing line: ~ current_y(s),~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + current_y(s), +** Processing line: ~ s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)]~ - Inside source: true *** True Line Result - end + s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ args.outputs.borders << args.state.enemies.map do |s|~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + args.outputs.borders << args.state.enemies.map do |s| +** Processing line: ~ [s[:x],~ +- Inside source: true *** True Line Result - -** Processing line: ~* 10_advanced_debugging/02_trace_debugging_classes/app/main.rb~ -- Header detected. + [s[:x], +** Processing line: ~ current_y(s),~ +- Inside source: true *** True Line Result - + current_y(s), +** Processing line: ~ s[:w], s[:h], 255, 0, 0]~ +- Inside source: true *** True Line Result -* 10_advanced_debugging/02_trace_debugging_classes/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + s[:w], s[:h], 255, 0, 0] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ args.outputs.borders << args.state.bullets.map do |b|~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ class Foobar~ + args.outputs.borders << args.state.bullets.map do |b| +** Processing line: ~ [b[:x],~ - Inside source: true *** True Line Result - class Foobar -** Processing line: ~ def initialize~ + [b[:x], +** Processing line: ~ current_y(b),~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ trace! # Trace is added to the constructor.~ + current_y(b), +** Processing line: ~ b[:w], b[:h], 255, 0, 0]~ - Inside source: true *** True Line Result - trace! # Trace is added to the constructor. + b[:w], b[:h], 255, 0, 0] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34377,18 +34880,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def clicky args~ +** Processing line: ~ args.outputs.borders << args.state.player_bullets.map do |b|~ - Inside source: true *** True Line Result - def clicky args -** Processing line: ~ return unless args.inputs.mouse.click~ + args.outputs.borders << args.state.player_bullets.map do |b| +** Processing line: ~ [b[:x],~ - Inside source: true *** True Line Result - return unless args.inputs.mouse.click -** Processing line: ~ try_rand rand~ + [b[:x], +** Processing line: ~ current_y(b),~ - Inside source: true *** True Line Result - try_rand rand + current_y(b), +** Processing line: ~ b[:w], b[:h], 255, 255, 255]~ +- Inside source: true +*** True Line Result + b[:w], b[:h], 255, 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34397,22 +34904,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def try_rand num~ +** Processing line: ~ args.borders << [args.state.player.x,~ - Inside source: true *** True Line Result - def try_rand num -** Processing line: ~ return if num < 0.9~ + args.borders << [args.state.player.x, +** Processing line: ~ args.state.player.y,~ - Inside source: true *** True Line Result - return if num < 0.9 -** Processing line: ~ raise "Exception finally occurred. Take a look at logs/trace.txt #{num}."~ + args.state.player.y, +** Processing line: ~ args.state.player.w,~ - Inside source: true *** True Line Result - raise "Exception finally occurred. Take a look at logs/trace.txt #{num}." -** Processing line: ~ end~ + args.state.player.w, +** Processing line: ~ args.state.player.h, 255, 255, 255]~ - Inside source: true *** True Line Result - end + args.state.player.h, 255, 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34425,22 +34932,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result def tick args -** Processing line: ~ args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1]~ +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1] -** Processing line: ~ args.state.foobar = Foobar.new if args.tick_count~ + defaults args +** Processing line: ~ input args~ - Inside source: true *** True Line Result - args.state.foobar = Foobar.new if args.tick_count -** Processing line: ~ return unless args.state.foobar~ + input args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - return unless args.state.foobar -** Processing line: ~ args.state.foobar.clicky args~ + calc args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - args.state.foobar.clicky args + render args ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34457,42 +34964,46 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 10_advanced_debugging/03_unit_tests/exception_raising_tests.rb~ +** Processing line: ~* Performance - Sprites As Hash - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 10_advanced_debugging/03_unit_tests/exception_raising_tests.rb +* Performance - Sprites As Hash - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ begin :shared~ +** Processing line: ~ # ./samples/09_performance/01_sprites_as_hash/app/main.rb~ - Inside source: true *** True Line Result - begin :shared -** Processing line: ~ class ExceptionalClass~ + # ./samples/09_performance/01_sprites_as_hash/app/main.rb +** Processing line: ~ # Sprites represented as Hashes using the queue ~args.outputs.sprites~~ - Inside source: true *** True Line Result - class ExceptionalClass -** Processing line: ~ def initialize exception_to_throw = nil~ + # Sprites represented as Hashes using the queue ~args.outputs.sprites~ +** Processing line: ~ # code up, but are the "slowest" to render.~ - Inside source: true *** True Line Result - def initialize exception_to_throw = nil -** Processing line: ~ raise exception_to_throw if exception_to_throw~ + # code up, but are the "slowest" to render. +** Processing line: ~ # The reason for this is the access of the key in the Hash and also~ - Inside source: true *** True Line Result - raise exception_to_throw if exception_to_throw -** Processing line: ~ end~ + # The reason for this is the access of the key in the Hash and also +** Processing line: ~ # because the data args.outputs.sprites is cleared every tick.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # because the data args.outputs.sprites is cleared every tick. +** Processing line: ~ def random_x args~ - Inside source: true *** True Line Result - end + def random_x args +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ +- Inside source: true +*** True Line Result + (args.grid.w.randomize :ratio) * -1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34501,34 +35012,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_exception_in_newing_object args, assert~ -- Inside source: true -*** True Line Result - def test_exception_in_newing_object args, assert -** Processing line: ~ begin~ +** Processing line: ~ def random_y args~ - Inside source: true *** True Line Result - begin -** Processing line: ~ ExceptionalClass.new TypeError~ + def random_y args +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ - Inside source: true *** True Line Result - ExceptionalClass.new TypeError -** Processing line: ~ raise "Exception wasn't thrown!"~ + (args.grid.h.randomize :ratio) * -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - raise "Exception wasn't thrown!" -** Processing line: ~ rescue Exception => e~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ assert.equal! e.class, TypeError, "Exceptions within constructor should be retained."~ + +** Processing line: ~ def random_speed~ - Inside source: true *** True Line Result - assert.equal! e.class, TypeError, "Exceptions within constructor should be retained." -** Processing line: ~ end~ + def random_speed +** Processing line: ~ 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - end + 1 + (4.randomize :ratio) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34537,286 +35044,246 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ puts "running tests"~ +** Processing line: ~ def new_star args~ - Inside source: true *** True Line Result - puts "running tests" -** Processing line: ~ $gtk.reset 100~ + def new_star args +** Processing line: ~ {~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + { +** Processing line: ~ x: (random_x args),~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + x: (random_x args), +** Processing line: ~ y: (random_y args),~ - Inside source: true *** True Line Result - $gtk.tests.start -** Processing line: ~~ + y: (random_y args), +** Processing line: ~ w: 4, h: 4, path: 'sprites/tiny-star.png',~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + w: 4, h: 4, path: 'sprites/tiny-star.png', +** Processing line: ~ s: random_speed~ +- Inside source: true *** True Line Result - -** Processing line: ~* 10_advanced_debugging/03_unit_tests/gen_docs.rb~ -- Header detected. + s: random_speed +** Processing line: ~ }~ +- Inside source: true *** True Line Result - + } +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* 10_advanced_debugging/03_unit_tests/gen_docs.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~~ +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick~ +** Processing line: ~ def move_star args, star~ - Inside source: true *** True Line Result - # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick -** Processing line: ~ Kernel.export_docs!~ -- Inside source: true -*** True Line Result - Kernel.export_docs! -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 10_advanced_debugging/03_unit_tests/geometry_tests.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 10_advanced_debugging/03_unit_tests/geometry_tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ begin :shared~ -- Inside source: true -*** True Line Result - begin :shared -** Processing line: ~ def primitive_representations x, y, w, h~ + def move_star args, star +** Processing line: ~ star.x += star[:s]~ - Inside source: true *** True Line Result - def primitive_representations x, y, w, h -** Processing line: ~ [~ + star.x += star[:s] +** Processing line: ~ star.y += star[:s]~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [x, y, w, h],~ + star.y += star[:s] +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ - Inside source: true *** True Line Result - [x, y, w, h], -** Processing line: ~ { x: x, y: y, w: w, h: h },~ + if star.x > args.grid.w || star.y > args.grid.h +** Processing line: ~ star.x = (random_x args)~ - Inside source: true *** True Line Result - { x: x, y: y, w: w, h: h }, -** Processing line: ~ RectForTest.new(x, y, w, h)~ + star.x = (random_x args) +** Processing line: ~ star.y = (random_y args)~ - Inside source: true *** True Line Result - RectForTest.new(x, y, w, h) -** Processing line: ~ ]~ + star.y = (random_y args) +** Processing line: ~ star[:s] = random_speed~ - Inside source: true *** True Line Result - ] + star[:s] = random_speed ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class RectForTest~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - class RectForTest -** Processing line: ~ attr_sprite~ + def tick args +** Processing line: ~ args.state.star_count ||= 0~ - Inside source: true *** True Line Result - attr_sprite + args.state.star_count ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize x, y, w, h~ -- Inside source: true -*** True Line Result - def initialize x, y, w, h -** Processing line: ~ @x = x~ +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - @x = x -** Processing line: ~ @y = y~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - @y = y -** Processing line: ~ @w = w~ + if Kernel.global_tick_count == 0 +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ - Inside source: true *** True Line Result - @w = w -** Processing line: ~ @h = h~ + puts "* INFO - Please specify the number of sprites to render." +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - @h = h -** Processing line: ~ end~ + args.gtk.console.set_command "reset_with count: 100" +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_s~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - def to_s -** Processing line: ~ "RectForTest: #{[x, y, w, h]}"~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - "RectForTest: #{[x, y, w, h]}" -** Processing line: ~ end~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ - Inside source: true *** True Line Result - end + args.state.stars = args.state.star_count.map { |i| new_star args } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ begin :intersect_rect?~ +** Processing line: ~ # update~ - Inside source: true *** True Line Result - begin :intersect_rect? -** Processing line: ~ def test_intersect_rect_point args, assert~ + # update +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ - Inside source: true *** True Line Result - def test_intersect_rect_point args, assert -** Processing line: ~ assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect."~ + args.state.stars.each { |s| move_star args, s } +** Processing line: ~~ - Inside source: true *** True Line Result - assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect." -** Processing line: ~ end~ + +** Processing line: ~ # render~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_intersect_rect args, assert~ + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - def test_intersect_rect args, assert -** Processing line: ~ intersecting = primitive_representations(0, 0, 100, 100) +~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ - Inside source: true *** True Line Result - intersecting = primitive_representations(0, 0, 100, 100) + -** Processing line: ~ primitive_representations(20, 20, 20, 20)~ + args.outputs.primitives << args.gtk.current_framerate_primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - primitive_representations(20, 20, 20, 20) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ intersecting.product(intersecting).each do |rect_one, rect_two|~ +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - intersecting.product(intersecting).each do |rect_one, rect_two| -** Processing line: ~ assert.true! rect_one.intersect_rect?(rect_two),~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - assert.true! rect_one.intersect_rect?(rect_two), -** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)."~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)." -** Processing line: ~ end~ + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + $gtk.args.state.star_count = count +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ not_intersecting = [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - not_intersecting = [ -** Processing line: ~ [ 0, 0, 5, 5],~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - [ 0, 0, 5, 5], -** Processing line: ~ { x: 10, y: 10, w: 5, h: 5 },~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - { x: 10, y: 10, w: 5, h: 5 }, -** Processing line: ~ RectForTest.new(20, 20, 5, 5)~ -- Inside source: true + +** Processing line: ~* Performance - Sprites As Entities - main.rb~ +- Header detected. *** True Line Result - RectForTest.new(20, 20, 5, 5) -** Processing line: ~ ]~ -- Inside source: true + *** True Line Result - ] -** Processing line: ~~ -- Inside source: true +* Performance - Sprites As Entities - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ not_intersecting.product(not_intersecting)~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/09_performance/02_sprites_as_entities/app/main.rb~ - Inside source: true *** True Line Result - not_intersecting.product(not_intersecting) -** Processing line: ~ .reject { |rect_one, rect_two| rect_one == rect_two }~ + # ./samples/09_performance/02_sprites_as_entities/app/main.rb +** Processing line: ~ # Sprites represented as Entities using the queue ~args.outputs.sprites~~ - Inside source: true *** True Line Result - .reject { |rect_one, rect_two| rect_one == rect_two } -** Processing line: ~ .each do |rect_one, rect_two|~ + # Sprites represented as Entities using the queue ~args.outputs.sprites~ +** Processing line: ~ # yields nicer access apis over Hashes, but require a bit more code upfront.~ - Inside source: true *** True Line Result - .each do |rect_one, rect_two| -** Processing line: ~ assert.false! rect_one.intersect_rect?(rect_two),~ + # yields nicer access apis over Hashes, but require a bit more code upfront. +** Processing line: ~ # The hash sample has to use star[:s] to get the speed of the star, but~ - Inside source: true *** True Line Result - assert.false! rect_one.intersect_rect?(rect_two), -** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)."~ + # The hash sample has to use star[:s] to get the speed of the star, but +** Processing line: ~ # an entity can use .s instead.~ - Inside source: true *** True Line Result - "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)." -** Processing line: ~ end~ + # an entity can use .s instead. +** Processing line: ~ def random_x args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def random_x args +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ - Inside source: true *** True Line Result - end + (args.grid.w.randomize :ratio) * -1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -34825,230 +35292,202 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ begin :inside_rect?~ -- Inside source: true -*** True Line Result - begin :inside_rect? -** Processing line: ~ def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil~ -- Inside source: true -*** True Line Result - def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil -** Processing line: ~ assert.true! inner.inside_rect?(outer) == expected,~ +** Processing line: ~ def random_y args~ - Inside source: true *** True Line Result - assert.true! inner.inside_rect?(outer) == expected, -** Processing line: ~ "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})."~ + def random_y args +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ - Inside source: true *** True Line Result - "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})." -** Processing line: ~ end~ + (args.grid.h.randomize :ratio) * -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def test_inside_rect args, assert~ -- Inside source: true -*** True Line Result - def test_inside_rect args, assert -** Processing line: ~ outer_rects = primitive_representations(0, 0, 10, 10)~ +** Processing line: ~ def random_speed~ - Inside source: true *** True Line Result - outer_rects = primitive_representations(0, 0, 10, 10) -** Processing line: ~ inner_rects = primitive_representations(1, 1, 5, 5)~ + def random_speed +** Processing line: ~ 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - inner_rects = primitive_representations(1, 1, 5, 5) -** Processing line: ~ primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5))~ + 1 + (4.randomize :ratio) +** Processing line: ~ end~ - Inside source: true *** True Line Result - primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5)) -** Processing line: ~ .each do |outer, inner|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - .each do |outer, inner| -** Processing line: ~ assert_inside_rect outer: outer, inner: inner,~ + +** Processing line: ~ def new_star args~ - Inside source: true *** True Line Result - assert_inside_rect outer: outer, inner: inner, -** Processing line: ~ expected: true, assert: assert~ + def new_star args +** Processing line: ~ args.state.new_entity :star, {~ - Inside source: true *** True Line Result - expected: true, assert: assert -** Processing line: ~ end~ + args.state.new_entity :star, { +** Processing line: ~ x: (random_x args),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + x: (random_x args), +** Processing line: ~ y: (random_y args),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + y: (random_y args), +** Processing line: ~ w: 4, h: 4,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + w: 4, h: 4, +** Processing line: ~ path: 'sprites/tiny-star.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ begin :angle_to~ + path: 'sprites/tiny-star.png', +** Processing line: ~ s: random_speed~ - Inside source: true *** True Line Result - begin :angle_to -** Processing line: ~ def test_angle_to args, assert~ + s: random_speed +** Processing line: ~ }~ - Inside source: true *** True Line Result - def test_angle_to args, assert -** Processing line: ~ origins = primitive_representations(0, 0, 0, 0)~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - origins = primitive_representations(0, 0, 0, 0) -** Processing line: ~ rights = primitive_representations(1, 0, 0, 0)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rights = primitive_representations(1, 0, 0, 0) -** Processing line: ~ aboves = primitive_representations(0, 1, 0, 0)~ + +** Processing line: ~ def move_star args, star~ - Inside source: true *** True Line Result - aboves = primitive_representations(0, 1, 0, 0) -** Processing line: ~~ + def move_star args, star +** Processing line: ~ star.x += star.s~ - Inside source: true *** True Line Result - -** Processing line: ~ origins.product(aboves).each do |origin, above|~ + star.x += star.s +** Processing line: ~ star.y += star.s~ - Inside source: true *** True Line Result - origins.product(aboves).each do |origin, above| -** Processing line: ~ assert.equal! origin.angle_to(above), 90,~ + star.y += star.s +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ - Inside source: true *** True Line Result - assert.equal! origin.angle_to(above), 90, -** Processing line: ~ "A point directly above should be 90 degrees."~ + if star.x > args.grid.w || star.y > args.grid.h +** Processing line: ~ star.x = (random_x args)~ - Inside source: true *** True Line Result - "A point directly above should be 90 degrees." -** Processing line: ~~ + star.x = (random_x args) +** Processing line: ~ star.y = (random_y args)~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! above.angle_from(origin), 90,~ + star.y = (random_y args) +** Processing line: ~ star.s = random_speed~ - Inside source: true *** True Line Result - assert.equal! above.angle_from(origin), 90, -** Processing line: ~ "A point coming from above should be 90 degrees."~ + star.s = random_speed +** Processing line: ~ end~ - Inside source: true *** True Line Result - "A point coming from above should be 90 degrees." -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ origins.product(rights).each do |origin, right|~ -- Inside source: true -*** True Line Result - origins.product(rights).each do |origin, right| -** Processing line: ~ assert.equal! origin.angle_to(right) % 360, 0,~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - assert.equal! origin.angle_to(right) % 360, 0, -** Processing line: ~ "A point directly to the right should be 0 degrees."~ + def tick args +** Processing line: ~ args.state.star_count ||= 0~ - Inside source: true *** True Line Result - "A point directly to the right should be 0 degrees." + args.state.star_count ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ assert.equal! right.angle_from(origin) % 360, 0,~ +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - assert.equal! right.angle_from(origin) % 360, 0, -** Processing line: ~ "A point coming from the right should be 0 degrees."~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - "A point coming from the right should be 0 degrees." -** Processing line: ~~ + if Kernel.global_tick_count == 0 +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ - Inside source: true *** True Line Result - -** Processing line: ~ end~ + puts "* INFO - Please specify the number of sprites to render." +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - end + args.gtk.console.set_command "reset_with count: 100" ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ begin :scale_rect~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - begin :scale_rect -** Processing line: ~ def test_scale_rect args, assert~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - def test_scale_rect args, assert -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5),~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ - Inside source: true *** True Line Result - assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5), -** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ + args.state.stars = args.state.star_count.map { |i| new_star args } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [25.0, 25.0, 50.0, 50.0] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5),~ +** Processing line: ~ # update~ - Inside source: true *** True Line Result - assert.equal! [0, 0, 100, 100].scale_rect(0.5), -** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ + # update +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ - Inside source: true *** True Line Result - [0.0, 0.0, 50.0, 50.0] + args.state.stars.each { |s| move_star args, s } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5),~ -- Inside source: true -*** True Line Result - assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5), -** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ -- Inside source: true -*** True Line Result - [25.0, 25.0, 50.0, 50.0] -** Processing line: ~~ +** Processing line: ~ # render~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0),~ + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ - Inside source: true *** True Line Result - assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0), -** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - [0.0, 0.0, 50.0, 50.0] -** Processing line: ~ end~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ - Inside source: true *** True Line Result - end + args.outputs.primitives << args.gtk.current_framerate_primitives ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35057,22 +35496,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ puts "running tests"~ +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - puts "running tests" -** Processing line: ~ $gtk.reset 100~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ - Inside source: true *** True Line Result - $gtk.tests.start + $gtk.args.state.star_count = count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -35085,70 +35528,66 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 10_advanced_debugging/03_unit_tests/http_tests.rb~ +** Processing line: ~* Performance - Sprites As Strict Entities - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 10_advanced_debugging/03_unit_tests/http_tests.rb +* Performance - Sprites As Strict Entities - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def try_assert_or_schedule args, assert~ -- Inside source: true -*** True Line Result - def try_assert_or_schedule args, assert -** Processing line: ~ if $result[:complete]~ +** Processing line: ~ # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb~ - Inside source: true *** True Line Result - if $result[:complete] -** Processing line: ~ log_info "Request completed! Verifying."~ + # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb +** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ - Inside source: true *** True Line Result - log_info "Request completed! Verifying." -** Processing line: ~ if $result[:http_response_code] != 200~ + # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~ +** Processing line: ~ # yields apis access similar to Entities, but all properties that can be set on the~ - Inside source: true *** True Line Result - if $result[:http_response_code] != 200 -** Processing line: ~ log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200."~ + # yields apis access similar to Entities, but all properties that can be set on the +** Processing line: ~ # entity must be predefined with a default value. Strict entities do not support the~ - Inside source: true *** True Line Result - log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200." -** Processing line: ~ exit~ + # entity must be predefined with a default value. Strict entities do not support the +** Processing line: ~ # addition of new properties after the fact. They are more performant than OpenEntities~ - Inside source: true *** True Line Result - exit -** Processing line: ~ end~ + # addition of new properties after the fact. They are more performant than OpenEntities +** Processing line: ~ # because of this constraint.~ - Inside source: true *** True Line Result - end -** Processing line: ~ log_info ":try_assert_or_schedule succeeded!"~ + # because of this constraint. +** Processing line: ~ def random_x args~ - Inside source: true *** True Line Result - log_info ":try_assert_or_schedule succeeded!" -** Processing line: ~ else~ + def random_x args +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.gtk.schedule_callback Kernel.tick_count + 10 do~ + (args.grid.w.randomize :ratio) * -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.gtk.schedule_callback Kernel.tick_count + 10 do -** Processing line: ~ try_assert_or_schedule args, assert~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - try_assert_or_schedule args, assert -** Processing line: ~ end~ + +** Processing line: ~ def random_y args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def random_y args +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ - Inside source: true *** True Line Result - end + (args.grid.h.randomize :ratio) * -1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35157,18 +35596,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_http args, assert~ -- Inside source: true -*** True Line Result - def test_http args, assert -** Processing line: ~ $result = $gtk.http_get 'http://dragonruby.org'~ +** Processing line: ~ def random_speed~ - Inside source: true *** True Line Result - $result = $gtk.http_get 'http://dragonruby.org' -** Processing line: ~ try_assert_or_schedule args, assert~ + def random_speed +** Processing line: ~ 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - try_assert_or_schedule args, assert + 1 + (4.randomize :ratio) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35177,70 +35612,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ puts "running tests"~ +** Processing line: ~ def new_star args~ - Inside source: true *** True Line Result - puts "running tests" -** Processing line: ~ $gtk.reset 100~ + def new_star args +** Processing line: ~ args.state.new_entity_strict(:star,~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + args.state.new_entity_strict(:star, +** Processing line: ~ x: (random_x args),~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + x: (random_x args), +** Processing line: ~ y: (random_y args),~ - Inside source: true *** True Line Result - $gtk.tests.start -** Processing line: ~~ + y: (random_y args), +** Processing line: ~ w: 4, h: 4,~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ class PlayerSpriteForTest~ + w: 4, h: 4, +** Processing line: ~ path: 'sprites/tiny-star.png',~ - Inside source: true *** True Line Result - class PlayerSpriteForTest -** Processing line: ~ end~ + path: 'sprites/tiny-star.png', +** Processing line: ~ s: random_speed) do |entity|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + s: random_speed) do |entity| +** Processing line: ~ # invoke attr_sprite so that it responds to~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_array_to_sprite args, assert~ + # invoke attr_sprite so that it responds to +** Processing line: ~ # all properties that are required to render a sprite~ - Inside source: true *** True Line Result - def test_array_to_sprite args, assert -** Processing line: ~ array = [[0, 0, 100, 100, "test.png"]].sprites~ + # all properties that are required to render a sprite +** Processing line: ~ entity.attr_sprite~ - Inside source: true *** True Line Result - array = [[0, 0, 100, 100, "test.png"]].sprites -** Processing line: ~ puts "No exception was thrown. Sweet!"~ + entity.attr_sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - puts "No exception was thrown. Sweet!" + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35249,158 +35664,130 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_class_to_sprite args, assert~ +** Processing line: ~ def move_star args, star~ - Inside source: true *** True Line Result - def test_class_to_sprite args, assert -** Processing line: ~ array = [PlayerSprite.new].sprites~ + def move_star args, star +** Processing line: ~ star.x += star.s~ - Inside source: true *** True Line Result - array = [PlayerSprite.new].sprites -** Processing line: ~ assert.true! array.first.is_a?(PlayerSprite)~ + star.x += star.s +** Processing line: ~ star.y += star.s~ - Inside source: true *** True Line Result - assert.true! array.first.is_a?(PlayerSprite) -** Processing line: ~ puts "No exception was thrown. Sweet!"~ + star.y += star.s +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ - Inside source: true *** True Line Result - puts "No exception was thrown. Sweet!" -** Processing line: ~ end~ + if star.x > args.grid.w || star.y > args.grid.h +** Processing line: ~ star.x = (random_x args)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + star.x = (random_x args) +** Processing line: ~ star.y = (random_y args)~ - Inside source: true *** True Line Result - -** Processing line: ~ $gtk.reset 100~ + star.y = (random_y args) +** Processing line: ~ star.s = random_speed~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + star.s = random_speed +** Processing line: ~ end~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - $gtk.tests.start + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 10_advanced_debugging/03_unit_tests/parsing_tests.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 10_advanced_debugging/03_unit_tests/parsing_tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def test_parse_json args, assert~ -- Inside source: true -*** True Line Result - def test_parse_json args, assert -** Processing line: ~ result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }'~ -- Inside source: true -*** True Line Result - result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' -** Processing line: ~ assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed."~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed." -** Processing line: ~ end~ + def tick args +** Processing line: ~ args.state.star_count ||= 0~ - Inside source: true *** True Line Result - end + args.state.star_count ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def test_parse_xml args, assert~ -- Inside source: true -*** True Line Result - def test_parse_xml args, assert -** Processing line: ~ result = args.gtk.parse_xml <<-S~ +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - result = args.gtk.parse_xml <<-S -** Processing line: ~ ~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - -** Processing line: ~ John Doe~ + if Kernel.global_tick_count == 0 +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ - Inside source: true *** True Line Result - John Doe -** Processing line: ~ ~ + puts "* INFO - Please specify the number of sprites to render." +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - -** Processing line: ~ S~ + args.gtk.console.set_command "reset_with count: 100" +** Processing line: ~ end~ - Inside source: true *** True Line Result - S + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ expected = {:type=>:element,~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - expected = {:type=>:element, -** Processing line: ~ :name=>nil,~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - :name=>nil, -** Processing line: ~ :children=>[{:type=>:element,~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ - Inside source: true *** True Line Result - :children=>[{:type=>:element, -** Processing line: ~ :name=>"Person",~ + args.state.stars = args.state.star_count.map { |i| new_star args } +** Processing line: ~ end~ - Inside source: true *** True Line Result - :name=>"Person", -** Processing line: ~ :children=>[{:type=>:element,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :children=>[{:type=>:element, -** Processing line: ~ :name=>"Name",~ + +** Processing line: ~ # update~ - Inside source: true *** True Line Result - :name=>"Name", -** Processing line: ~ :children=>[{:type=>:content,~ + # update +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ - Inside source: true *** True Line Result - :children=>[{:type=>:content, -** Processing line: ~ :data=>"John Doe"}]}],~ + args.state.stars.each { |s| move_star args, s } +** Processing line: ~~ - Inside source: true *** True Line Result - :data=>"John Doe"}]}], -** Processing line: ~ :attributes=>{"id"=>"100"}}]}~ + +** Processing line: ~ # render~ - Inside source: true *** True Line Result - :attributes=>{"id"=>"100"}}]} -** Processing line: ~~ + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! result, expected, "Parsing xml failed."~ + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - assert.equal! result, expected, "Parsing xml failed." + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ +- Inside source: true +*** True Line Result + args.outputs.primitives << args.gtk.current_framerate_primitives ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35409,22 +35796,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ puts "running tests"~ +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - puts "running tests" -** Processing line: ~ $gtk.reset 100~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ - Inside source: true *** True Line Result - $gtk.tests.start + $gtk.args.state.star_count = count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -35437,102 +35828,110 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb~ +** Processing line: ~* Performance - Sprites As Classes - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb +* Performance - Sprites As Classes - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def test_serialize args, assert~ +** Processing line: ~ # ./samples/09_performance/04_sprites_as_classes/app/main.rb~ - Inside source: true *** True Line Result - def test_serialize args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ + # ./samples/09_performance/04_sprites_as_classes/app/main.rb +** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.state.player_one = "test"~ + # Sprites represented as Classes using the queue ~args.outputs.sprites~. +** Processing line: ~ # gives you full control of property declaration and method invocation.~ - Inside source: true *** True Line Result - args.state.player_one = "test" -** Processing line: ~ result = args.gtk.serialize_state args.state~ + # gives you full control of property declaration and method invocation. +** Processing line: ~ # They are more performant than OpenEntities and StrictEntities, but more code upfront.~ - Inside source: true *** True Line Result - result = args.gtk.serialize_state args.state -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ + # They are more performant than OpenEntities and StrictEntities, but more code upfront. +** Processing line: ~ class Star~ - Inside source: true *** True Line Result - assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" -** Processing line: ~~ + class Star +** Processing line: ~ attr_sprite~ - Inside source: true *** True Line Result - -** Processing line: ~ GTK::Entity.__reset_id__!~ + attr_sprite +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.gtk.write_file 'state.txt', ''~ + +** Processing line: ~ def initialize grid~ - Inside source: true *** True Line Result - args.gtk.write_file 'state.txt', '' -** Processing line: ~ result = args.gtk.serialize_state 'state.txt', args.state~ + def initialize grid +** Processing line: ~ @grid = grid~ - Inside source: true *** True Line Result - result = args.gtk.serialize_state 'state.txt', args.state -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ + @grid = grid +** Processing line: ~ @x = (rand @grid.w) * -1~ - Inside source: true *** True Line Result - assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" -** Processing line: ~ end~ + @x = (rand @grid.w) * -1 +** Processing line: ~ @y = (rand @grid.h) * -1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @y = (rand @grid.h) * -1 +** Processing line: ~ @w = 4~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_deserialize args, assert~ + @w = 4 +** Processing line: ~ @h = 4~ - Inside source: true *** True Line Result - def test_deserialize args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ + @h = 4 +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ + @s = 1 + (4.randomize :ratio) +** Processing line: ~ @path = 'sprites/tiny-star.png'~ - Inside source: true *** True Line Result - result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' -** Processing line: ~ assert.equal! result.player_one, "test"~ + @path = 'sprites/tiny-star.png' +** Processing line: ~ end~ - Inside source: true *** True Line Result - assert.equal! result.player_one, "test" + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ def move~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ + def move +** Processing line: ~ @x += @s~ - Inside source: true *** True Line Result - args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' -** Processing line: ~ result = args.gtk.deserialize_state 'state.txt'~ + @x += @s +** Processing line: ~ @y += @s~ - Inside source: true *** True Line Result - result = args.gtk.deserialize_state 'state.txt' -** Processing line: ~ assert.equal! result.player_one, "test"~ + @y += @s +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ - Inside source: true *** True Line Result - assert.equal! result.player_one, "test" + @x = (rand @grid.w) * -1 if @x > @grid.right +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ +- Inside source: true +*** True Line Result + @y = (rand @grid.h) * -1 if @y > @grid.top +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35541,26 +35940,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_very_large_serialization args, assert~ +** Processing line: ~ # calls methods needed for game to run properly~ - Inside source: true *** True Line Result - def test_very_large_serialization args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ + # calls methods needed for game to run properly +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ size = 3000~ + def tick args +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - size = 3000 -** Processing line: ~ size.map_with_index do |i|~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - size.map_with_index do |i| -** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ + if Kernel.global_tick_count == 0 +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - args.state.send("k#{i}=".to_sym, i) + args.gtk.console.set_command "reset_with count: 100" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35569,82 +35968,78 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ result = args.gtk.serialize_state args.state~ -- Inside source: true -*** True Line Result - result = args.gtk.serialize_state args.state -** Processing line: ~ assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly")~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly") -** Processing line: ~ end~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_strict_entity_serialization args, assert~ + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } +** Processing line: ~ end~ - Inside source: true *** True Line Result - def test_strict_entity_serialization args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ + +** Processing line: ~ # update~ - Inside source: true *** True Line Result - args.state.player_one = args.state.new_entity(:player, name: "Ryu") -** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken")~ + # update +** Processing line: ~ args.state.stars.each(&:move)~ - Inside source: true *** True Line Result - args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken") + args.state.stars.each(&:move) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +** Processing line: ~ # render~ - Inside source: true *** True Line Result - serialized_state = args.gtk.serialize_state args.state -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}'~ + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ - Inside source: true *** True Line Result - assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}' -** Processing line: ~~ + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ deserialize_state = args.gtk.deserialize_state serialized_state~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ - Inside source: true *** True Line Result - deserialize_state = args.gtk.deserialize_state serialized_state -** Processing line: ~~ + args.outputs.primitives << args.gtk.current_framerate_primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! args.state.player_one.name, deserialize_state.player_one.name~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - assert.equal! args.state.player_one.name, deserialize_state.player_one.name -** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ + +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - assert.true! args.state.player_one.is_a? GTK::OpenEntity -** Processing line: ~~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! args.state.player_two.name, deserialize_state.player_two.name~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - assert.equal! args.state.player_two.name, deserialize_state.player_two.name -** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ - Inside source: true *** True Line Result - assert.true! args.state.player_two.is_a? GTK::StrictEntity + $gtk.args.state.star_count = count ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35653,262 +36048,230 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_strict_entity_serialization_with_nil args, assert~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def test_strict_entity_serialization_with_nil args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ -- Inside source: true + +** Processing line: ~* Performance - Static Sprites As Classes - main.rb~ +- Header detected. *** True Line Result - args.state.player_one = args.state.new_entity(:player, name: "Ryu") -** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil)~ -- Inside source: true + *** True Line Result - args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) -** Processing line: ~~ -- Inside source: true +* Performance - Static Sprites As Classes - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb~ - Inside source: true *** True Line Result - serialized_state = args.gtk.serialize_state args.state -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}'~ + # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb +** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ - Inside source: true *** True Line Result - assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}' -** Processing line: ~~ + # Sprites represented as Classes using the queue ~args.outputs.static_sprites~. +** Processing line: ~ # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held~ - Inside source: true *** True Line Result - -** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ + # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held +** Processing line: ~ # by reference. You get better performance, but you are mutating state of held objects~ - Inside source: true *** True Line Result - deserialized_state = args.gtk.deserialize_state serialized_state -** Processing line: ~~ + # by reference. You get better performance, but you are mutating state of held objects +** Processing line: ~ # which is less functional/data oriented.~ - Inside source: true *** True Line Result - -** Processing line: ~ assert.equal! args.state.player_one.name, deserialized_state.player_one.name~ + # which is less functional/data oriented. +** Processing line: ~ class Star~ - Inside source: true *** True Line Result - assert.equal! args.state.player_one.name, deserialized_state.player_one.name -** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ + class Star +** Processing line: ~ attr_sprite~ - Inside source: true *** True Line Result - assert.true! args.state.player_one.is_a? GTK::OpenEntity + attr_sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ assert.equal! args.state.player_two.name, deserialized_state.player_two.name~ +** Processing line: ~ def initialize grid~ - Inside source: true *** True Line Result - assert.equal! args.state.player_two.name, deserialized_state.player_two.name -** Processing line: ~ assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type~ + def initialize grid +** Processing line: ~ @grid = grid~ - Inside source: true *** True Line Result - assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type -** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, nil~ + @grid = grid +** Processing line: ~ @x = (rand @grid.w) * -1~ - Inside source: true *** True Line Result - assert.equal! deserialized_state.player_two.blood_type, nil -** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ + @x = (rand @grid.w) * -1 +** Processing line: ~ @y = (rand @grid.h) * -1~ - Inside source: true *** True Line Result - assert.true! args.state.player_two.is_a? GTK::StrictEntity -** Processing line: ~~ + @y = (rand @grid.h) * -1 +** Processing line: ~ @w = 4~ - Inside source: true *** True Line Result - -** Processing line: ~ deserialized_state.player_two.blood_type = :O~ + @w = 4 +** Processing line: ~ @h = 4~ - Inside source: true *** True Line Result - deserialized_state.player_two.blood_type = :O -** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, :O~ + @h = 4 +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - assert.equal! deserialized_state.player_two.blood_type, :O -** Processing line: ~ end~ + @s = 1 + (4.randomize :ratio) +** Processing line: ~ @path = 'sprites/tiny-star.png'~ - Inside source: true *** True Line Result - end + @path = 'sprites/tiny-star.png' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def test_multiple_strict_entities args, assert~ +** Processing line: ~ def move~ - Inside source: true *** True Line Result - def test_multiple_strict_entities args, assert -** Processing line: ~ GTK::Entity.__reset_id__!~ + def move +** Processing line: ~ @x += @s~ - Inside source: true *** True Line Result - GTK::Entity.__reset_id__! -** Processing line: ~ args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu")~ + @x += @s +** Processing line: ~ @y += @s~ - Inside source: true *** True Line Result - args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu") -** Processing line: ~ args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean')~ + @y += @s +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ - Inside source: true *** True Line Result - args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean') -** Processing line: ~~ + @x = (rand @grid.w) * -1 if @x > @grid.right +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ - Inside source: true *** True Line Result - -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ + @y = (rand @grid.h) * -1 if @y > @grid.top +** Processing line: ~ end~ - Inside source: true *** True Line Result - serialized_state = args.gtk.serialize_state args.state -** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - deserialized_state = args.gtk.deserialize_state serialized_state + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ assert.equal! deserialized_state.player.name, "Ryu"~ +** Processing line: ~ # calls methods needed for game to run properly~ - Inside source: true *** True Line Result - assert.equal! deserialized_state.player.name, "Ryu" -** Processing line: ~ assert.equal! deserialized_state.enemy.other_property, "extra mean"~ + # calls methods needed for game to run properly +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - assert.equal! deserialized_state.enemy.other_property, "extra mean" -** Processing line: ~ end~ + def tick args +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ $tests.start~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - $tests.start -** Processing line: ~~ + if Kernel.global_tick_count == 0 +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ MAX_CODE_GEN_LENGTH = 50~ + args.gtk.console.set_command "reset_with count: 100" +** Processing line: ~ end~ - Inside source: true *** True Line Result - MAX_CODE_GEN_LENGTH = 50 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # NOTE: This is experimental/advanced stuff.~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - # NOTE: This is experimental/advanced stuff. -** Processing line: ~ def needs_partitioning? target~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - def needs_partitioning? target -** Processing line: ~ target[:value].to_s.length > MAX_CODE_GEN_LENGTH~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ - Inside source: true *** True Line Result - target[:value].to_s.length > MAX_CODE_GEN_LENGTH -** Processing line: ~ end~ + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def partition target~ -- Inside source: true -*** True Line Result - def partition target -** Processing line: ~ return [] unless needs_partitioning? target~ -- Inside source: true -*** True Line Result - return [] unless needs_partitioning? target -** Processing line: ~ if target[:value].is_a? GTK::OpenEntity~ -- Inside source: true -*** True Line Result - if target[:value].is_a? GTK::OpenEntity -** Processing line: ~ target[:value] = target[:value].hash~ +** Processing line: ~ # update~ - Inside source: true *** True Line Result - target[:value] = target[:value].hash -** Processing line: ~ end~ + # update +** Processing line: ~ args.state.stars.each(&:move)~ - Inside source: true *** True Line Result - end + args.state.stars.each(&:move) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ results = []~ +** Processing line: ~ # render~ - Inside source: true *** True Line Result - results = [] -** Processing line: ~ idx = 0~ + # render +** Processing line: ~ args.outputs.sprites << args.state.stars~ - Inside source: true *** True Line Result - idx = 0 -** Processing line: ~ left, right = target[:value].partition do~ + args.outputs.sprites << args.state.stars +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - left, right = target[:value].partition do -** Processing line: ~ idx += 1~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ - Inside source: true *** True Line Result - idx += 1 -** Processing line: ~ idx.even?~ + args.outputs.primitives << args.gtk.current_framerate_primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - idx.even? -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ left, right = Hash[left], Hash[right]~ + +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - left, right = Hash[left], Hash[right] -** Processing line: ~ left = { value: left }~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - left = { value: left } -** Processing line: ~ right = { value: right}~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - right = { value: right} -** Processing line: ~ [left, right]~ + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ - Inside source: true *** True Line Result - [left, right] + $gtk.args.state.star_count = count ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -35917,314 +36280,290 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def add_partition target, path, aggregate, final_result~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def add_partition target, path, aggregate, final_result -** Processing line: ~ partitions = partition target~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - partitions = partition target -** Processing line: ~ partitions.each do |part|~ -- Inside source: true + +** Processing line: ~* Performance - Static Sprites As Classes With Custom Drawing - main.rb~ +- Header detected. *** True Line Result - partitions.each do |part| -** Processing line: ~ if needs_partitioning? part~ + +*** True Line Result +* Performance - Static Sprites As Classes With Custom Drawing - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ - Inside source: true *** True Line Result - if needs_partitioning? part -** Processing line: ~ if part[:value].keys.length == 1~ + # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb +** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ - Inside source: true *** True Line Result - if part[:value].keys.length == 1 -** Processing line: ~ first_key = part[:value].keys[0]~ + # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~. +** Processing line: ~ # is the fastest approach. This is comparable to what other game engines set as the default behavior.~ - Inside source: true *** True Line Result - first_key = part[:value].keys[0] -** Processing line: ~ new_part = { value: part[:value][first_key] }~ + # is the fastest approach. This is comparable to what other game engines set as the default behavior. +** Processing line: ~ # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing~ - Inside source: true *** True Line Result - new_part = { value: part[:value][first_key] } -** Processing line: ~ path.push first_key~ + # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing +** Processing line: ~ # functional/data-oriented practices.~ - Inside source: true *** True Line Result - path.push first_key -** Processing line: ~ add_partition new_part, path, aggregate, final_result~ + # functional/data-oriented practices. +** Processing line: ~ class Star~ - Inside source: true *** True Line Result - add_partition new_part, path, aggregate, final_result -** Processing line: ~ path.pop~ + class Star +** Processing line: ~ def initialize grid~ - Inside source: true *** True Line Result - path.pop -** Processing line: ~ else~ + def initialize grid +** Processing line: ~ @grid = grid~ - Inside source: true *** True Line Result - else -** Processing line: ~ add_partition part, path, aggregate, final_result~ + @grid = grid +** Processing line: ~ @x = (rand @grid.w) * -1~ - Inside source: true *** True Line Result - add_partition part, path, aggregate, final_result -** Processing line: ~ end~ + @x = (rand @grid.w) * -1 +** Processing line: ~ @y = (rand @grid.h) * -1~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + @y = (rand @grid.h) * -1 +** Processing line: ~ @w = 4~ - Inside source: true *** True Line Result - else -** Processing line: ~ final_result << { value: { __path__: [*path] } }~ + @w = 4 +** Processing line: ~ @h = 4~ - Inside source: true *** True Line Result - final_result << { value: { __path__: [*path] } } -** Processing line: ~ final_result << { value: part[:value] }~ + @h = 4 +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ - Inside source: true *** True Line Result - final_result << { value: part[:value] } -** Processing line: ~ end~ + @s = 1 + (4.randomize :ratio) +** Processing line: ~ @path = 'sprites/tiny-star.png'~ - Inside source: true *** True Line Result - end + @path = 'sprites/tiny-star.png' ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def state_to_string state~ -- Inside source: true -*** True Line Result - def state_to_string state -** Processing line: ~ parts_queue = []~ +** Processing line: ~ def move~ - Inside source: true *** True Line Result - parts_queue = [] -** Processing line: ~ final_queue = []~ + def move +** Processing line: ~ @x += @s~ - Inside source: true *** True Line Result - final_queue = [] -** Processing line: ~ add_partition({ value: state.hash },~ + @x += @s +** Processing line: ~ @y += @s~ - Inside source: true *** True Line Result - add_partition({ value: state.hash }, -** Processing line: ~ [],~ + @y += @s +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ - Inside source: true *** True Line Result - [], -** Processing line: ~ parts_queue,~ + @x = (rand @grid.w) * -1 if @x > @grid.right +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ - Inside source: true *** True Line Result - parts_queue, -** Processing line: ~ final_queue)~ + @y = (rand @grid.h) * -1 if @y > @grid.top +** Processing line: ~ end~ - Inside source: true *** True Line Result - final_queue) -** Processing line: ~ final_queue.reject {|i| i[:value].keys.length == 0}.map do |i|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - final_queue.reject {|i| i[:value].keys.length == 0}.map do |i| -** Processing line: ~ i[:value].to_s~ + +** Processing line: ~ # if the object that is in args.outputs.sprites (or static_sprites)~ - Inside source: true *** True Line Result - i[:value].to_s -** Processing line: ~ end.join("\n#==================================================#\n")~ + # if the object that is in args.outputs.sprites (or static_sprites) +** Processing line: ~ # respond_to? :draw_override, then the method is invoked giving you~ - Inside source: true *** True Line Result - end.join("\n#==================================================#\n") -** Processing line: ~ end~ + # respond_to? :draw_override, then the method is invoked giving you +** Processing line: ~ # access to the class used to draw to the canvas.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # access to the class used to draw to the canvas. +** Processing line: ~ def draw_override ffi_draw~ - Inside source: true *** True Line Result - -** Processing line: ~ def state_from_string string~ + def draw_override ffi_draw +** Processing line: ~ # first move then draw~ - Inside source: true *** True Line Result - def state_from_string string -** Processing line: ~ Kernel.eval("$load_data = {}")~ + # first move then draw +** Processing line: ~ move~ - Inside source: true *** True Line Result - Kernel.eval("$load_data = {}") -** Processing line: ~ lines = string.split("\n#==================================================#\n")~ + move +** Processing line: ~~ - Inside source: true *** True Line Result - lines = string.split("\n#==================================================#\n") -** Processing line: ~ lines.each do |l|~ + +** Processing line: ~ # The argument order for ffi.draw_sprite is:~ - Inside source: true *** True Line Result - lines.each do |l| -** Processing line: ~ puts "todo: #{l}"~ + # The argument order for ffi.draw_sprite is: +** Processing line: ~ # x, y, w, h, path~ - Inside source: true *** True Line Result - puts "todo: #{l}" -** Processing line: ~ end~ + # x, y, w, h, path +** Processing line: ~ ffi_draw.draw_sprite @x, @y, @w, @h, @path~ - Inside source: true *** True Line Result - end + ffi_draw.draw_sprite @x, @y, @w, @h, @path ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ GTK::OpenEntity.parse_from_hash $load_data~ -- Inside source: true -*** True Line Result - GTK::OpenEntity.parse_from_hash $load_data -** Processing line: ~ end~ +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value):~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value): +** Processing line: ~ # x, y, w, h, path,~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_save_and_load args, assert~ + # x, y, w, h, path, +** Processing line: ~ # angle, alpha~ - Inside source: true *** True Line Result - def test_save_and_load args, assert -** Processing line: ~ args.state.item_1.name = "Jane"~ + # angle, alpha +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.item_1.name = "Jane" -** Processing line: ~ string = state_to_string args.state~ + +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_3 is:~ - Inside source: true *** True Line Result - string = state_to_string args.state -** Processing line: ~ state = state_from_string string~ + # The argument order for ffi_draw.draw_sprite_3 is: +** Processing line: ~ # x, y, w, h,~ - Inside source: true *** True Line Result - state = state_from_string string -** Processing line: ~ assert.equal! args.state.item_1.name, state.item_1.name~ + # x, y, w, h, +** Processing line: ~ # path,~ - Inside source: true *** True Line Result - assert.equal! args.state.item_1.name, state.item_1.name -** Processing line: ~ end~ + # path, +** Processing line: ~ # angle,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # angle, +** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_save_and_load_big args, assert~ + # alpha, red_saturation, green_saturation, blue_saturation +** Processing line: ~ # flip_horizontally, flip_vertically,~ - Inside source: true *** True Line Result - def test_save_and_load_big args, assert -** Processing line: ~ size = 1000~ + # flip_horizontally, flip_vertically, +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ - Inside source: true *** True Line Result - size = 1000 -** Processing line: ~ size.map_with_index do |i|~ + # tile_x, tile_y, tile_w, tile_h +** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ - Inside source: true *** True Line Result - size.map_with_index do |i| -** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ + # angle_anchor_x, angle_anchor_y, +** Processing line: ~ # source_x, source_y, source_w, source_h~ - Inside source: true *** True Line Result - args.state.send("k#{i}=".to_sym, i) + # source_x, source_y, source_w, source_h ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ string = state_to_string args.state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - string = state_to_string args.state -** Processing line: ~ state = state_from_string string~ + +** Processing line: ~ # calls methods needed for game to run properly~ - Inside source: true *** True Line Result - state = state_from_string string -** Processing line: ~ size.map_with_index do |i|~ + # calls methods needed for game to run properly +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - size.map_with_index do |i| -** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym)~ + def tick args +** Processing line: ~ # sets console command when sample app initially opens~ - Inside source: true *** True Line Result - assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym) -** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), i~ + # sets console command when sample app initially opens +** Processing line: ~ if Kernel.global_tick_count == 0~ - Inside source: true *** True Line Result - assert.equal! args.state.send("k#{i}".to_sym), i -** Processing line: ~ assert.equal! state.send("k#{i}".to_sym), i~ + if Kernel.global_tick_count == 0 +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ - Inside source: true *** True Line Result - assert.equal! state.send("k#{i}".to_sym), i + args.gtk.console.set_command "reset_with count: 100" ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def test_save_and_load_big_nested args, assert~ -- Inside source: true -*** True Line Result - def test_save_and_load_big_nested args, assert -** Processing line: ~ args.state.player_one.friend.nested_hash.k0 = 0~ -- Inside source: true -*** True Line Result - args.state.player_one.friend.nested_hash.k0 = 0 -** Processing line: ~ args.state.player_one.friend.nested_hash.k1 = 1~ -- Inside source: true -*** True Line Result - args.state.player_one.friend.nested_hash.k1 = 1 -** Processing line: ~ args.state.player_one.friend.nested_hash.k2 = 2~ -- Inside source: true -*** True Line Result - args.state.player_one.friend.nested_hash.k2 = 2 -** Processing line: ~ args.state.player_one.friend.nested_hash.k3 = 3~ +** Processing line: ~ # init~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k3 = 3 -** Processing line: ~ args.state.player_one.friend.nested_hash.k4 = 4~ + # init +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k4 = 4 -** Processing line: ~ args.state.player_one.friend.nested_hash.k5 = 5~ + if args.state.tick_count == 0 +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k5 = 5 -** Processing line: ~ args.state.player_one.friend.nested_hash.k6 = 6~ + args.state.stars = args.state.star_count.map { |i| Star.new args.grid } +** Processing line: ~ args.outputs.static_sprites << args.state.stars~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k6 = 6 -** Processing line: ~ args.state.player_one.friend.nested_hash.k7 = 7~ + args.outputs.static_sprites << args.state.stars +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k7 = 7 -** Processing line: ~ args.state.player_one.friend.nested_hash.k8 = 8~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k8 = 8 -** Processing line: ~ args.state.player_one.friend.nested_hash.k9 = 9~ + +** Processing line: ~ # render framerate~ - Inside source: true *** True Line Result - args.state.player_one.friend.nested_hash.k9 = 9 -** Processing line: ~ string = state_to_string args.state~ + # render framerate +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - string = state_to_string args.state -** Processing line: ~ state = state_from_string string~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ - Inside source: true *** True Line Result - state = state_from_string string + args.outputs.primitives << args.gtk.current_framerate_primitives ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -36233,18 +36572,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ # resets game, and assigns star count given by user~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.log_level = :off~ + # resets game, and assigns star count given by user +** Processing line: ~ def reset_with count: count~ - Inside source: true *** True Line Result - $gtk.log_level = :off -** Processing line: ~ $gtk.tests.start~ + def reset_with count: count +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - $gtk.tests.start + $gtk.reset +** Processing line: ~ $gtk.args.state.star_count = count~ +- Inside source: true +*** True Line Result + $gtk.args.state.star_count = count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -36257,222 +36604,222 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 11_http/01_retrieve_images/app/main.rb~ +** Processing line: ~* Performance - Collision Limits - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 11_http/01_retrieve_images/app/main.rb +* Performance - Collision Limits - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ def tick args~ +** Processing line: ~ # ./samples/09_performance/07_collision_limits/app/main.rb~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + # ./samples/09_performance/07_collision_limits/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Show a warning at the start.~ -- Inside source: true -*** True Line Result - # Show a warning at the start. -** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ -- Inside source: true -*** True Line Result - args.state.warning_debounce ||= 11 * 60 -** Processing line: ~ if args.state.warning_debounce > 0~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - if args.state.warning_debounce > 0 -** Processing line: ~ args.state.warning_debounce -= 1~ + Reminders: +** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ - Inside source: true *** True Line Result - args.state.warning_debounce -= 1 -** Processing line: ~ args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255]~ + - find_all: Finds all elements of a collection that meet certain requirements. +** Processing line: ~ In this sample app, we're finding all bodies that intersect with the center body.~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] -** Processing line: ~ args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255]~ + In this sample app, we're finding all bodies that intersect with the center body. +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255] -** Processing line: ~ args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255]~ + +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255] -** Processing line: ~ return~ + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ - Inside source: true *** True Line Result - end + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.download_debounce ||= 0 # start immediately, reset to non zero later.~ -- Inside source: true -*** True Line Result - args.state.download_debounce ||= 0 # start immediately, reset to non zero later. -** Processing line: ~ args.state.photos ||= []~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - args.state.photos ||= [] -** Processing line: ~~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Put a little pause between each download.~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - # Put a little pause between each download. -** Processing line: ~ if args.state.download.nil?~ + For more information about labels, go to mygame/documentation/02-labels.md. +** Processing line: ~~ - Inside source: true *** True Line Result - if args.state.download.nil? -** Processing line: ~ if args.state.download_debounce > 0~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ - Inside source: true *** True Line Result - if args.state.download_debounce > 0 -** Processing line: ~ args.state.download_debounce -= 1~ + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.download_debounce -= 1 -** Processing line: ~ else~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg'~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg' -** Processing line: ~ end~ + +** Processing line: ~ # This code demonstrates moving objects that loop around once they exceed the scope of the screen,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # This code demonstrates moving objects that loop around once they exceed the scope of the screen, +** Processing line: ~ # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies".~ - Inside source: true *** True Line Result - end + # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies". ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !args.state.download.nil?~ +** Processing line: ~ def body_count num~ - Inside source: true *** True Line Result - if !args.state.download.nil? -** Processing line: ~ if args.state.download[:complete]~ + def body_count num +** Processing line: ~ $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection~ - Inside source: true *** True Line Result - if args.state.download[:complete] -** Processing line: ~ if args.state.download[:http_response_code] == 200~ + $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.state.download[:http_response_code] == 200 -** Processing line: ~ fname = "sprites/#{args.state.photos.length}.jpg"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - fname = "sprites/#{args.state.photos.length}.jpg" -** Processing line: ~ $gtk.write_file fname, args.state.download[:response_data]~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - $gtk.write_file fname, args.state.download[:response_data] -** Processing line: ~ args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ]~ + def tick args +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ] -** Processing line: ~ end~ + +** Processing line: ~ # Center body's values are set using an array~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.download = nil~ + # Center body's values are set using an array +** Processing line: ~ # Map is used to set values of 2000 other bodies~ - Inside source: true *** True Line Result - args.state.download = nil -** Processing line: ~ args.state.download_debounce = (rand(3) + 2) * 60~ + # Map is used to set values of 2000 other bodies +** Processing line: ~ # All bodies that intersect with center body are stored in collisions collection~ - Inside source: true *** True Line Result - args.state.download_debounce = (rand(3) + 2) * 60 -** Processing line: ~ end~ + # All bodies that intersect with center body are stored in collisions collection +** Processing line: ~ args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center +** Processing line: ~ args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen~ - Inside source: true *** True Line Result - end + args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # draw any downloaded photos...~ +** Processing line: ~ # finds all bodies that intersect with center body, stores them in collisions~ - Inside source: true *** True Line Result - # draw any downloaded photos... -** Processing line: ~ args.state.photos.each { |i|~ + # finds all bodies that intersect with center body, stores them in collisions +** Processing line: ~ collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body }~ - Inside source: true *** True Line Result - args.state.photos.each { |i| -** Processing line: ~ args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite~ + collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body } +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite -** Processing line: ~ }~ + +** Processing line: ~ args.borders << args.state.center_body # outputs center body as a black border~ - Inside source: true *** True Line Result - } + args.borders << args.state.center_body # outputs center body as a black border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Draw a download progress bar...~ +** Processing line: ~ # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes~ - Inside source: true *** True Line Result - # Draw a download progress bar... -** Processing line: ~ args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid~ + # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes +** Processing line: ~ args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid~ - Inside source: true *** True Line Result - args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid -** Processing line: ~ if !args.state.download.nil?~ + args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid +** Processing line: ~ args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well~ - Inside source: true *** True Line Result - if !args.state.download.nil? -** Processing line: ~ br = args.state.download[:response_read]~ + args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well +** Processing line: ~~ - Inside source: true *** True Line Result - br = args.state.download[:response_read] -** Processing line: ~ total = args.state.download[:response_total]~ + +** Processing line: ~ args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner~ - Inside source: true *** True Line Result - total = args.state.download[:response_total] -** Processing line: ~ if total != 0~ + args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner +** Processing line: ~~ - Inside source: true *** True Line Result - if total != 0 -** Processing line: ~ pct = br.to_f / total.to_f~ + +** Processing line: ~ # Bodies are returned to bottom left corner if positions exceed scope of screen~ - Inside source: true *** True Line Result - pct = br.to_f / total.to_f -** Processing line: ~ args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid~ + # Bodies are returned to bottom left corner if positions exceed scope of screen +** Processing line: ~ args.state.other_bodies.each do |b| # for each body in the other_bodies collection~ - Inside source: true *** True Line Result - args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid -** Processing line: ~ end~ + args.state.other_bodies.each do |b| # for each body in the other_bodies collection +** Processing line: ~ b.x += 5 # x and y are both incremented by 5~ - Inside source: true *** True Line Result - end + b.x += 5 # x and y are both incremented by 5 +** Processing line: ~ b.y += 5~ +- Inside source: true +*** True Line Result + b.y += 5 +** Processing line: ~ b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right)~ +- Inside source: true +*** True Line Result + b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right) +** Processing line: ~ b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up)~ +- Inside source: true +*** True Line Result + b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -36485,6 +36832,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ # Resets the game.~ +- Inside source: true +*** True Line Result + # Resets the game. +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -36493,202 +36852,194 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 99_genre_3d/3d_cube/app/main.rb~ +** Processing line: ~* Advanced Debugging - Trace Debugging - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 99_genre_3d/3d_cube/app/main.rb +* Advanced Debugging - Trace Debugging - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ STARTX = 0.0~ -- Inside source: true -*** True Line Result - STARTX = 0.0 -** Processing line: ~ STARTY = 0.0~ -- Inside source: true -*** True Line Result - STARTY = 0.0 -** Processing line: ~ ENDY = 20.0~ -- Inside source: true -*** True Line Result - ENDY = 20.0 -** Processing line: ~ ENDX = 20.0~ +** Processing line: ~ # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb~ - Inside source: true *** True Line Result - ENDX = 20.0 -** Processing line: ~ SPINPOINT = 10~ + # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb +** Processing line: ~ class Game~ - Inside source: true *** True Line Result - SPINPOINT = 10 -** Processing line: ~ SPINDURATION = 400~ + class Game +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - SPINDURATION = 400 -** Processing line: ~ POINTSIZE = 8~ + attr_gtk +** Processing line: ~~ - Inside source: true *** True Line Result - POINTSIZE = 8 -** Processing line: ~ BOXDEPTH = 40~ + +** Processing line: ~ def method1 num~ - Inside source: true *** True Line Result - BOXDEPTH = 40 -** Processing line: ~ YAW = 1~ + def method1 num +** Processing line: ~ method2 num~ - Inside source: true *** True Line Result - YAW = 1 -** Processing line: ~ DISTANCE = 10~ + method2 num +** Processing line: ~ end~ - Inside source: true *** True Line Result - DISTANCE = 10 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def method2 num~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + def method2 num +** Processing line: ~ method3 num~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION)~ + method3 num +** Processing line: ~ end~ - Inside source: true *** True Line Result - a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION) -** Processing line: ~ s = Math.sin(a)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - s = Math.sin(a) -** Processing line: ~ c = Math.cos(a)~ + +** Processing line: ~ def method3 num~ - Inside source: true *** True Line Result - c = Math.cos(a) -** Processing line: ~ x = STARTX~ + def method3 num +** Processing line: ~ method4 num~ - Inside source: true *** True Line Result - x = STARTX -** Processing line: ~ y = STARTY~ + method4 num +** Processing line: ~ end~ - Inside source: true *** True Line Result - y = STARTY -** Processing line: ~ offset_x = (1280 - (ENDX - STARTX)) / 2~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - offset_x = (1280 - (ENDX - STARTX)) / 2 -** Processing line: ~ offset_y = (360 - (ENDY - STARTY)) / 2~ + +** Processing line: ~ def method4 num~ - Inside source: true *** True Line Result - offset_y = (360 - (ENDY - STARTY)) / 2 -** Processing line: ~~ + def method4 num +** Processing line: ~ if num == 1~ - Inside source: true *** True Line Result - -** Processing line: ~ srand(1)~ + if num == 1 +** Processing line: ~ puts "UNLUCKY #{num}."~ - Inside source: true *** True Line Result - srand(1) -** Processing line: ~ while y < ENDY do~ + puts "UNLUCKY #{num}." +** Processing line: ~ state.unlucky_count += 1~ - Inside source: true *** True Line Result - while y < ENDY do -** Processing line: ~ while x < ENDX do~ + state.unlucky_count += 1 +** Processing line: ~ if state.unlucky_count > 3~ - Inside source: true *** True Line Result - while x < ENDX do -** Processing line: ~ if (y == STARTY ||~ + if state.unlucky_count > 3 +** Processing line: ~ raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history."~ - Inside source: true *** True Line Result - if (y == STARTY || -** Processing line: ~ y == (ENDY / 0.5) * 2 ||~ + raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." +** Processing line: ~ end~ - Inside source: true *** True Line Result - y == (ENDY / 0.5) * 2 || -** Processing line: ~ y == (ENDY / 0.5) * 2 + 0.5 ||~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - y == (ENDY / 0.5) * 2 + 0.5 || -** Processing line: ~ y == ENDY - 0.5 ||~ + else +** Processing line: ~ puts "LUCKY #{num}."~ - Inside source: true *** True Line Result - y == ENDY - 0.5 || -** Processing line: ~ x == STARTX ||~ + puts "LUCKY #{num}." +** Processing line: ~ end~ - Inside source: true *** True Line Result - x == STARTX || -** Processing line: ~ x == ENDX - 0.5)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - x == ENDX - 0.5) -** Processing line: ~ z = rand(BOXDEPTH)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - z = rand(BOXDEPTH) -** Processing line: ~ z *= Math.sin(a / 2)~ + +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - z *= Math.sin(a / 2) -** Processing line: ~ x -= SPINPOINT~ + def tick +** Processing line: ~ state.roll_history ||= []~ - Inside source: true *** True Line Result - x -= SPINPOINT -** Processing line: ~ u = (x * c) - (z * s)~ + state.roll_history ||= [] +** Processing line: ~ state.roll_history << rand(20) + 1~ - Inside source: true *** True Line Result - u = (x * c) - (z * s) -** Processing line: ~ v = (x * s) + (z * c)~ + state.roll_history << rand(20) + 1 +** Processing line: ~ state.countdown ||= 600~ - Inside source: true *** True Line Result - v = (x * s) + (z * c) -** Processing line: ~ k = DISTANCE.fdiv(100) + (v / 500 * YAW)~ + state.countdown ||= 600 +** Processing line: ~ state.countdown -= 1~ - Inside source: true *** True Line Result - k = DISTANCE.fdiv(100) + (v / 500 * YAW) -** Processing line: ~ u = u / k~ + state.countdown -= 1 +** Processing line: ~ state.unlucky_count ||= 0~ - Inside source: true *** True Line Result - u = u / k -** Processing line: ~ v = y / k~ + state.unlucky_count ||= 0 +** Processing line: ~ outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1]~ - Inside source: true *** True Line Result - v = y / k -** Processing line: ~ w = POINTSIZE / 10 / k~ + outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] +** Processing line: ~ if state.countdown > 0~ - Inside source: true *** True Line Result - w = POINTSIZE / 10 / k -** Processing line: ~ args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'}~ + if state.countdown > 0 +** Processing line: ~ outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1]~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'} -** Processing line: ~ x += SPINPOINT~ + outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] +** Processing line: ~ else~ - Inside source: true *** True Line Result - x += SPINPOINT -** Processing line: ~ end~ + else +** Processing line: ~ state.attempts ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ x += 0.5~ + state.attempts ||= 0 +** Processing line: ~ state.attempts += 1~ - Inside source: true *** True Line Result - x += 0.5 + state.attempts += 1 +** Processing line: ~ outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ y += 0.5~ +** Processing line: ~ return if state.countdown > 0~ - Inside source: true *** True Line Result - y += 0.5 -** Processing line: ~ x = STARTX~ + return if state.countdown > 0 +** Processing line: ~ method1 state.roll_history[-1]~ - Inside source: true *** True Line Result - x = STARTX + method1 state.roll_history[-1] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -36701,10 +37052,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset~ +** Processing line: ~ $game = Game.new~ - Inside source: true *** True Line Result - $gtk.reset + $game = Game.new +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT~ +- Inside source: true +*** True Line Result + trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT +** Processing line: ~ $game.args = args~ +- Inside source: true +*** True Line Result + $game.args = args +** Processing line: ~ $game.tick~ +- Inside source: true +*** True Line Result + $game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -36717,50 +37092,54 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 99_genre_arcade/dueling_starships/app/main.rb~ +** Processing line: ~* Advanced Debugging - Trace Debugging Classes - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 99_genre_arcade/dueling_starships/app/main.rb +* Advanced Debugging - Trace Debugging Classes - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ class DuelingSpaceships~ +** Processing line: ~ # ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb~ - Inside source: true *** True Line Result - class DuelingSpaceships -** Processing line: ~ attr_accessor :state, :inputs, :outputs, :grid~ + # ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb +** Processing line: ~ class Foobar~ - Inside source: true *** True Line Result - attr_accessor :state, :inputs, :outputs, :grid -** Processing line: ~~ + class Foobar +** Processing line: ~ def initialize~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick~ + def initialize +** Processing line: ~ trace! # Trace is added to the constructor.~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + trace! # Trace is added to the constructor. +** Processing line: ~ end~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + +** Processing line: ~ def clicky args~ - Inside source: true *** True Line Result - calc -** Processing line: ~ input~ + def clicky args +** Processing line: ~ return unless args.inputs.mouse.click~ - Inside source: true *** True Line Result - input + return unless args.inputs.mouse.click +** Processing line: ~ try_rand rand~ +- Inside source: true +*** True Line Result + try_rand rand ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -36769,494 +37148,462 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def defaults~ +** Processing line: ~ def try_rand num~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ outputs.background_color = [0, 0, 0]~ + def try_rand num +** Processing line: ~ return if num < 0.9~ - Inside source: true *** True Line Result - outputs.background_color = [0, 0, 0] -** Processing line: ~ state.ship_blue ||= new_blue_ship~ + return if num < 0.9 +** Processing line: ~ raise "Exception finally occurred. Take a look at logs/trace.txt #{num}."~ - Inside source: true *** True Line Result - state.ship_blue ||= new_blue_ship -** Processing line: ~ state.ship_red ||= new_red_ship~ + raise "Exception finally occurred. Take a look at logs/trace.txt #{num}." +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.ship_red ||= new_red_ship -** Processing line: ~ state.flames ||= []~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.flames ||= [] -** Processing line: ~ state.bullets ||= []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.bullets ||= [] -** Processing line: ~ state.ship_blue_score ||= 0~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - state.ship_blue_score ||= 0 -** Processing line: ~ state.ship_red_score ||= 0~ + def tick args +** Processing line: ~ args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1]~ - Inside source: true *** True Line Result - state.ship_red_score ||= 0 -** Processing line: ~ state.stars ||= 100.map do~ + args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1] +** Processing line: ~ args.state.foobar = Foobar.new if args.tick_count~ - Inside source: true *** True Line Result - state.stars ||= 100.map do -** Processing line: ~ [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio),~ + args.state.foobar = Foobar.new if args.tick_count +** Processing line: ~ return unless args.state.foobar~ - Inside source: true *** True Line Result - [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio), -** Processing line: ~ grid.h_half.randomize(:sign, :ratio)),~ + return unless args.state.foobar +** Processing line: ~ args.state.foobar.clicky args~ - Inside source: true *** True Line Result - grid.h_half.randomize(:sign, :ratio)), -** Processing line: ~ 128 + 128.randomize(:ratio), 255, 255]~ + args.state.foobar.clicky args +** Processing line: ~ end~ - Inside source: true *** True Line Result - 128 + 128.randomize(:ratio), 255, 255] -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def default_ship x, y, angle, sprite_path, bullet_sprite_path, color~ -- Inside source: true +** Processing line: ~* Advanced Debugging - Unit Tests - exception_raising_tests.rb~ +- Header detected. *** True Line Result - def default_ship x, y, angle, sprite_path, bullet_sprite_path, color -** Processing line: ~ state.new_entity(:ship,~ -- Inside source: true + *** True Line Result - state.new_entity(:ship, -** Processing line: ~ { x: x,~ -- Inside source: true +* Advanced Debugging - Unit Tests - exception_raising_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - { x: x, -** Processing line: ~ y: y,~ -- Inside source: true + *** True Line Result - y: y, -** Processing line: ~ dy: 0,~ +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb~ - Inside source: true *** True Line Result - dy: 0, -** Processing line: ~ dx: 0,~ + # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb +** Processing line: ~ begin :shared~ - Inside source: true *** True Line Result - dx: 0, -** Processing line: ~ damage: 0,~ + begin :shared +** Processing line: ~ class ExceptionalClass~ - Inside source: true *** True Line Result - damage: 0, -** Processing line: ~ dead: false,~ + class ExceptionalClass +** Processing line: ~ def initialize exception_to_throw = nil~ - Inside source: true *** True Line Result - dead: false, -** Processing line: ~ angle: angle,~ + def initialize exception_to_throw = nil +** Processing line: ~ raise exception_to_throw if exception_to_throw~ - Inside source: true *** True Line Result - angle: angle, -** Processing line: ~ max_alpha: 255,~ + raise exception_to_throw if exception_to_throw +** Processing line: ~ end~ - Inside source: true *** True Line Result - max_alpha: 255, -** Processing line: ~ sprite_path: sprite_path,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - sprite_path: sprite_path, -** Processing line: ~ bullet_sprite_path: bullet_sprite_path,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - bullet_sprite_path: bullet_sprite_path, -** Processing line: ~ color: color })~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - color: color }) -** Processing line: ~ end~ + +** Processing line: ~ def test_exception_in_newing_object args, assert~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def test_exception_in_newing_object args, assert +** Processing line: ~ begin~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_red_ship~ + begin +** Processing line: ~ ExceptionalClass.new TypeError~ - Inside source: true *** True Line Result - def new_red_ship -** Processing line: ~ default_ship(400, 250.randomize(:sign, :ratio),~ + ExceptionalClass.new TypeError +** Processing line: ~ raise "Exception wasn't thrown!"~ - Inside source: true *** True Line Result - default_ship(400, 250.randomize(:sign, :ratio), -** Processing line: ~ 180, 'sprites/ship_red.png', 'sprites/red_bullet.png',~ + raise "Exception wasn't thrown!" +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - 180, 'sprites/ship_red.png', 'sprites/red_bullet.png', -** Processing line: ~ [255, 90, 90])~ + rescue Exception => e +** Processing line: ~ assert.equal! e.class, TypeError, "Exceptions within constructor should be retained."~ - Inside source: true *** True Line Result - [255, 90, 90]) + assert.equal! e.class, TypeError, "Exceptions within constructor should be retained." ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def new_blue_ship~ +** Processing line: ~ puts "running tests"~ - Inside source: true *** True Line Result - def new_blue_ship -** Processing line: ~ default_ship(-400, 250.randomize(:sign, :ratio),~ + puts "running tests" +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - default_ship(-400, 250.randomize(:sign, :ratio), -** Processing line: ~ 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png',~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png', -** Processing line: ~ [110, 140, 255])~ + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ - Inside source: true *** True Line Result - [110, 140, 255]) -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def render -** Processing line: ~ render_instructions~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - render_instructions -** Processing line: ~ render_score~ -- Inside source: true + +** Processing line: ~* Advanced Debugging - Unit Tests - gen_docs.rb~ +- Header detected. *** True Line Result - render_score -** Processing line: ~ render_universe~ -- Inside source: true + *** True Line Result - render_universe -** Processing line: ~ render_flames~ -- Inside source: true +* Advanced Debugging - Unit Tests - gen_docs.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - render_flames -** Processing line: ~ render_ships~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb~ - Inside source: true *** True Line Result - render_ships -** Processing line: ~ render_bullets~ + # ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb +** Processing line: ~ # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick~ - Inside source: true *** True Line Result - render_bullets -** Processing line: ~ end~ + # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick +** Processing line: ~ Kernel.export_docs!~ - Inside source: true *** True Line Result - end + Kernel.export_docs! ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_ships~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def render_ships -** Processing line: ~ update_ship_outputs(state.ship_blue)~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - update_ship_outputs(state.ship_blue) -** Processing line: ~ update_ship_outputs(state.ship_red)~ -- Inside source: true + +** Processing line: ~* Advanced Debugging - Unit Tests - geometry_tests.rb~ +- Header detected. *** True Line Result - update_ship_outputs(state.ship_red) -** Processing line: ~ outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite]~ -- Inside source: true + *** True Line Result - outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite] -** Processing line: ~ outputs.labels << [state.ship_blue.label, state.ship_red.label]~ -- Inside source: true +* Advanced Debugging - Unit Tests - geometry_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - outputs.labels << [state.ship_blue.label, state.ship_red.label] -** Processing line: ~ end~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb +** Processing line: ~ begin :shared~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_instructions~ + begin :shared +** Processing line: ~ def primitive_representations x, y, w, h~ - Inside source: true *** True Line Result - def render_instructions -** Processing line: ~ return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 ||~ + def primitive_representations x, y, w, h +** Processing line: ~ [~ - Inside source: true *** True Line Result - return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 || -** Processing line: ~ state.ship_red.dx > 0 || state.ship_red.dy > 0 ||~ + [ +** Processing line: ~ [x, y, w, h],~ - Inside source: true *** True Line Result - state.ship_red.dx > 0 || state.ship_red.dy > 0 || -** Processing line: ~ state.flames.length > 0~ + [x, y, w, h], +** Processing line: ~ { x: x, y: y, w: w, h: h },~ - Inside source: true *** True Line Result - state.flames.length > 0 -** Processing line: ~~ + { x: x, y: y, w: w, h: h }, +** Processing line: ~ RectForTest.new(x, y, w, h)~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [grid.left.shift_right(30),~ + RectForTest.new(x, y, w, h) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - outputs.labels << [grid.left.shift_right(30), -** Processing line: ~ grid.bottom.shift_up(30),~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - grid.bottom.shift_up(30), -** Processing line: ~ "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.", -** Processing line: ~ 0, 0, 255, 255, 255]~ + +** Processing line: ~ class RectForTest~ - Inside source: true *** True Line Result - 0, 0, 255, 255, 255] -** Processing line: ~ end~ + class RectForTest +** Processing line: ~ attr_sprite~ - Inside source: true *** True Line Result - end + attr_sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc~ +** Processing line: ~ def initialize x, y, w, h~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_thrusts~ + def initialize x, y, w, h +** Processing line: ~ @x = x~ - Inside source: true *** True Line Result - calc_thrusts -** Processing line: ~ calc_ships~ + @x = x +** Processing line: ~ @y = y~ - Inside source: true *** True Line Result - calc_ships -** Processing line: ~ calc_bullets~ + @y = y +** Processing line: ~ @w = w~ - Inside source: true *** True Line Result - calc_bullets -** Processing line: ~ calc_winner~ + @w = w +** Processing line: ~ @h = h~ - Inside source: true *** True Line Result - calc_winner -** Processing line: ~ end~ + @h = h +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input~ -- Inside source: true -*** True Line Result - def input -** Processing line: ~ input_accelerate~ +** Processing line: ~ def to_s~ - Inside source: true *** True Line Result - input_accelerate -** Processing line: ~ input_turn~ + def to_s +** Processing line: ~ "RectForTest: #{[x, y, w, h]}"~ - Inside source: true *** True Line Result - input_turn -** Processing line: ~ input_bullets_and_mines~ + "RectForTest: #{[x, y, w, h]}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - input_bullets_and_mines + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_score~ +** Processing line: ~ begin :intersect_rect?~ - Inside source: true *** True Line Result - def render_score -** Processing line: ~ outputs.labels << [grid.left.shift_right(80),~ + begin :intersect_rect? +** Processing line: ~ def test_intersect_rect_point args, assert~ - Inside source: true *** True Line Result - outputs.labels << [grid.left.shift_right(80), -** Processing line: ~ grid.top.shift_down(40),~ + def test_intersect_rect_point args, assert +** Processing line: ~ assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect."~ - Inside source: true *** True Line Result - grid.top.shift_down(40), -** Processing line: ~ state.ship_blue_score, 30, 1, state.ship_blue.color]~ + assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect." +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.ship_blue_score, 30, 1, state.ship_blue.color] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [grid.right.shift_left(80),~ -- Inside source: true -*** True Line Result - outputs.labels << [grid.right.shift_left(80), -** Processing line: ~ grid.top.shift_down(40),~ +** Processing line: ~ def test_intersect_rect args, assert~ - Inside source: true *** True Line Result - grid.top.shift_down(40), -** Processing line: ~ state.ship_red_score, 30, 1, state.ship_red.color]~ + def test_intersect_rect args, assert +** Processing line: ~ intersecting = primitive_representations(0, 0, 100, 100) +~ - Inside source: true *** True Line Result - state.ship_red_score, 30, 1, state.ship_red.color] -** Processing line: ~ end~ + intersecting = primitive_representations(0, 0, 100, 100) + +** Processing line: ~ primitive_representations(20, 20, 20, 20)~ - Inside source: true *** True Line Result - end + primitive_representations(20, 20, 20, 20) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_universe~ -- Inside source: true -*** True Line Result - def render_universe -** Processing line: ~ return if outputs.static_solids.any?~ +** Processing line: ~ intersecting.product(intersecting).each do |rect_one, rect_two|~ - Inside source: true *** True Line Result - return if outputs.static_solids.any? -** Processing line: ~ outputs.static_solids << grid.rect~ + intersecting.product(intersecting).each do |rect_one, rect_two| +** Processing line: ~ assert.true! rect_one.intersect_rect?(rect_two),~ - Inside source: true *** True Line Result - outputs.static_solids << grid.rect -** Processing line: ~ outputs.static_solids << state.stars~ + assert.true! rect_one.intersect_rect?(rect_two), +** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)."~ - Inside source: true *** True Line Result - outputs.static_solids << state.stars -** Processing line: ~ end~ + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def apply_round_finished_alpha entity~ +** Processing line: ~ not_intersecting = [~ - Inside source: true *** True Line Result - def apply_round_finished_alpha entity -** Processing line: ~ return entity unless state.round_finished_debounce~ + not_intersecting = [ +** Processing line: ~ [ 0, 0, 5, 5],~ - Inside source: true *** True Line Result - return entity unless state.round_finished_debounce -** Processing line: ~ entity.a *= state.round_finished_debounce.percentage_of(2.seconds)~ + [ 0, 0, 5, 5], +** Processing line: ~ { x: 10, y: 10, w: 5, h: 5 },~ - Inside source: true *** True Line Result - entity.a *= state.round_finished_debounce.percentage_of(2.seconds) -** Processing line: ~ return entity~ + { x: 10, y: 10, w: 5, h: 5 }, +** Processing line: ~ RectForTest.new(20, 20, 5, 5)~ - Inside source: true *** True Line Result - return entity -** Processing line: ~ end~ + RectForTest.new(20, 20, 5, 5) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def update_ship_outputs ship, sprite_size = 66~ -- Inside source: true -*** True Line Result - def update_ship_outputs ship, sprite_size = 66 -** Processing line: ~ ship.sprite =~ -- Inside source: true -*** True Line Result - ship.sprite = -** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y),~ -- Inside source: true -*** True Line Result - apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y), -** Processing line: ~ ship.sprite_path,~ -- Inside source: true -*** True Line Result - ship.sprite_path, -** Processing line: ~ ship.angle,~ +** Processing line: ~ not_intersecting.product(not_intersecting)~ - Inside source: true *** True Line Result - ship.angle, -** Processing line: ~ ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite~ + not_intersecting.product(not_intersecting) +** Processing line: ~ .reject { |rect_one, rect_two| rect_one == rect_two }~ - Inside source: true *** True Line Result - ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite -** Processing line: ~ ship.label =~ + .reject { |rect_one, rect_two| rect_one == rect_two } +** Processing line: ~ .each do |rect_one, rect_two|~ - Inside source: true *** True Line Result - ship.label = -** Processing line: ~ apply_round_finished_alpha [ship.x,~ + .each do |rect_one, rect_two| +** Processing line: ~ assert.false! rect_one.intersect_rect?(rect_two),~ - Inside source: true *** True Line Result - apply_round_finished_alpha [ship.x, -** Processing line: ~ ship.y + 100,~ + assert.false! rect_one.intersect_rect?(rect_two), +** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)."~ - Inside source: true *** True Line Result - ship.y + 100, -** Processing line: ~ "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label~ + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)." +** Processing line: ~ end~ - Inside source: true *** True Line Result - "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def render_flames sprite_size = 6~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - def render_flames sprite_size = 6 -** Processing line: ~ outputs.sprites << state.flames.map do |p|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.sprites << state.flames.map do |p| -** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(p.x, p.y),~ + +** Processing line: ~ begin :inside_rect?~ - Inside source: true *** True Line Result - apply_round_finished_alpha [sprite_size.to_square(p.x, p.y), -** Processing line: ~ 'sprites/flame.png', 0,~ + begin :inside_rect? +** Processing line: ~ def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil~ - Inside source: true *** True Line Result - 'sprites/flame.png', 0, -** Processing line: ~ p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite~ + def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil +** Processing line: ~ assert.true! inner.inside_rect?(outer) == expected,~ - Inside source: true *** True Line Result - p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite -** Processing line: ~ end~ + assert.true! inner.inside_rect?(outer) == expected, +** Processing line: ~ "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})."~ - Inside source: true *** True Line Result - end + "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -37265,26 +37612,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_bullets sprite_size = 10~ +** Processing line: ~ def test_inside_rect args, assert~ - Inside source: true *** True Line Result - def render_bullets sprite_size = 10 -** Processing line: ~ outputs.sprites << state.bullets.map do |b|~ + def test_inside_rect args, assert +** Processing line: ~ outer_rects = primitive_representations(0, 0, 10, 10)~ - Inside source: true *** True Line Result - outputs.sprites << state.bullets.map do |b| -** Processing line: ~ apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y),~ + outer_rects = primitive_representations(0, 0, 10, 10) +** Processing line: ~ inner_rects = primitive_representations(1, 1, 5, 5)~ - Inside source: true *** True Line Result - apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y), -** Processing line: ~ b.owner.bullet_sprite_path,~ + inner_rects = primitive_representations(1, 1, 5, 5) +** Processing line: ~ primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5))~ - Inside source: true *** True Line Result - b.owner.bullet_sprite_path, -** Processing line: ~ 0, b.max_alpha].sprite~ + primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5)) +** Processing line: ~ .each do |outer, inner|~ - Inside source: true *** True Line Result - 0, b.max_alpha].sprite + .each do |outer, inner| +** Processing line: ~ assert_inside_rect outer: outer, inner: inner,~ +- Inside source: true +*** True Line Result + assert_inside_rect outer: outer, inner: inner, +** Processing line: ~ expected: true, assert: assert~ +- Inside source: true +*** True Line Result + expected: true, assert: assert ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -37293,706 +37648,698 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def wrap_location! location~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - def wrap_location! location -** Processing line: ~ location.x = grid.left if location.x > grid.right~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - location.x = grid.left if location.x > grid.right -** Processing line: ~ location.x = grid.right if location.x < grid.left~ + +** Processing line: ~ begin :angle_to~ - Inside source: true *** True Line Result - location.x = grid.right if location.x < grid.left -** Processing line: ~ location.y = grid.top if location.y < grid.bottom~ + begin :angle_to +** Processing line: ~ def test_angle_to args, assert~ - Inside source: true *** True Line Result - location.y = grid.top if location.y < grid.bottom -** Processing line: ~ location.y = grid.bottom if location.y > grid.top~ + def test_angle_to args, assert +** Processing line: ~ origins = primitive_representations(0, 0, 0, 0)~ - Inside source: true *** True Line Result - location.y = grid.bottom if location.y > grid.top -** Processing line: ~ location~ + origins = primitive_representations(0, 0, 0, 0) +** Processing line: ~ rights = primitive_representations(1, 0, 0, 0)~ - Inside source: true *** True Line Result - location -** Processing line: ~ end~ + rights = primitive_representations(1, 0, 0, 0) +** Processing line: ~ aboves = primitive_representations(0, 1, 0, 0)~ - Inside source: true *** True Line Result - end + aboves = primitive_representations(0, 1, 0, 0) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_thrusts~ +** Processing line: ~ origins.product(aboves).each do |origin, above|~ - Inside source: true *** True Line Result - def calc_thrusts -** Processing line: ~ state.flames =~ + origins.product(aboves).each do |origin, above| +** Processing line: ~ assert.equal! origin.angle_to(above), 90,~ - Inside source: true *** True Line Result - state.flames = -** Processing line: ~ state.flames~ + assert.equal! origin.angle_to(above), 90, +** Processing line: ~ "A point directly above should be 90 degrees."~ - Inside source: true *** True Line Result - state.flames -** Processing line: ~ .reject(&:old?)~ + "A point directly above should be 90 degrees." +** Processing line: ~~ - Inside source: true *** True Line Result - .reject(&:old?) -** Processing line: ~ .map do |p|~ + +** Processing line: ~ assert.equal! above.angle_from(origin), 90,~ - Inside source: true *** True Line Result - .map do |p| -** Processing line: ~ p.speed *= 0.9~ + assert.equal! above.angle_from(origin), 90, +** Processing line: ~ "A point coming from above should be 90 degrees."~ - Inside source: true *** True Line Result - p.speed *= 0.9 -** Processing line: ~ p.y += p.angle.vector_y(p.speed)~ + "A point coming from above should be 90 degrees." +** Processing line: ~ end~ - Inside source: true *** True Line Result - p.y += p.angle.vector_y(p.speed) -** Processing line: ~ p.x += p.angle.vector_x(p.speed)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - p.x += p.angle.vector_x(p.speed) -** Processing line: ~ wrap_location! p~ + +** Processing line: ~ origins.product(rights).each do |origin, right|~ - Inside source: true *** True Line Result - wrap_location! p -** Processing line: ~ end~ + origins.product(rights).each do |origin, right| +** Processing line: ~ assert.equal! origin.angle_to(right) % 360, 0,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + assert.equal! origin.angle_to(right) % 360, 0, +** Processing line: ~ "A point directly to the right should be 0 degrees."~ - Inside source: true *** True Line Result - end + "A point directly to the right should be 0 degrees." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def all_ships~ -- Inside source: true -*** True Line Result - def all_ships -** Processing line: ~ [state.ship_blue, state.ship_red]~ +** Processing line: ~ assert.equal! right.angle_from(origin) % 360, 0,~ - Inside source: true *** True Line Result - [state.ship_blue, state.ship_red] -** Processing line: ~ end~ + assert.equal! right.angle_from(origin) % 360, 0, +** Processing line: ~ "A point coming from the right should be 0 degrees."~ - Inside source: true *** True Line Result - end + "A point coming from the right should be 0 degrees." ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def alive_ships~ -- Inside source: true -*** True Line Result - def alive_ships -** Processing line: ~ all_ships.reject { |s| s.dead }~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - all_ships.reject { |s| s.dead } + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_bullet bullet~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def calc_bullet bullet -** Processing line: ~ bullet.y += bullet.angle.vector_y(bullet.speed)~ + +** Processing line: ~ begin :scale_rect~ - Inside source: true *** True Line Result - bullet.y += bullet.angle.vector_y(bullet.speed) -** Processing line: ~ bullet.x += bullet.angle.vector_x(bullet.speed)~ + begin :scale_rect +** Processing line: ~ def test_scale_rect args, assert~ - Inside source: true *** True Line Result - bullet.x += bullet.angle.vector_x(bullet.speed) -** Processing line: ~ wrap_location! bullet~ + def test_scale_rect args, assert +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5),~ - Inside source: true *** True Line Result - wrap_location! bullet -** Processing line: ~ explode_bullet! bullet if bullet.old?~ + assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5), +** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ - Inside source: true *** True Line Result - explode_bullet! bullet if bullet.old? -** Processing line: ~ return if bullet.exploded~ + [25.0, 25.0, 50.0, 50.0] +** Processing line: ~~ - Inside source: true *** True Line Result - return if bullet.exploded -** Processing line: ~ return if state.round_finished~ + +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5),~ - Inside source: true *** True Line Result - return if state.round_finished -** Processing line: ~ alive_ships.each do |s|~ + assert.equal! [0, 0, 100, 100].scale_rect(0.5), +** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ - Inside source: true *** True Line Result - alive_ships.each do |s| -** Processing line: ~ if s != bullet.owner &&~ + [0.0, 0.0, 50.0, 50.0] +** Processing line: ~~ - Inside source: true *** True Line Result - if s != bullet.owner && -** Processing line: ~ s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y))~ + +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5),~ - Inside source: true *** True Line Result - s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y)) -** Processing line: ~ explode_bullet! bullet, 10, 5, 30~ + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5), +** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ - Inside source: true *** True Line Result - explode_bullet! bullet, 10, 5, 30 -** Processing line: ~ s.damage += 1~ + [25.0, 25.0, 50.0, 50.0] +** Processing line: ~~ - Inside source: true *** True Line Result - s.damage += 1 -** Processing line: ~ end~ + +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0), +** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ - Inside source: true *** True Line Result - end + [0.0, 0.0, 50.0, 50.0] ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_bullets~ +** Processing line: ~ puts "running tests"~ - Inside source: true *** True Line Result - def calc_bullets -** Processing line: ~ state.bullets.each { |b| calc_bullet b }~ + puts "running tests" +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - state.bullets.each { |b| calc_bullet b } -** Processing line: ~ state.bullets.reject! { |b| b.exploded }~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - state.bullets.reject! { |b| b.exploded } -** Processing line: ~ end~ + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ - Inside source: true *** True Line Result - end + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255 -** Processing line: ~ flame_count.times do~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - flame_count.times do -** Processing line: ~ state.flames << state.new_entity(type,~ + +** Processing line: ~* Advanced Debugging - Unit Tests - http_tests.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Advanced Debugging - Unit Tests - http_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb~ - Inside source: true *** True Line Result - state.flames << state.new_entity(type, -** Processing line: ~ { angle: 360.randomize(:ratio),~ + # ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb +** Processing line: ~ def try_assert_or_schedule args, assert~ - Inside source: true *** True Line Result - { angle: 360.randomize(:ratio), -** Processing line: ~ speed: max_speed.randomize(:ratio),~ + def try_assert_or_schedule args, assert +** Processing line: ~ if $result[:complete]~ - Inside source: true *** True Line Result - speed: max_speed.randomize(:ratio), -** Processing line: ~ lifetime: lifetime,~ + if $result[:complete] +** Processing line: ~ log_info "Request completed! Verifying."~ - Inside source: true *** True Line Result - lifetime: lifetime, -** Processing line: ~ x: entity.x,~ + log_info "Request completed! Verifying." +** Processing line: ~ if $result[:http_response_code] != 200~ - Inside source: true *** True Line Result - x: entity.x, -** Processing line: ~ y: entity.y,~ + if $result[:http_response_code] != 200 +** Processing line: ~ log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200."~ - Inside source: true *** True Line Result - y: entity.y, -** Processing line: ~ max_alpha: max_alpha })~ + log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200." +** Processing line: ~ exit~ - Inside source: true *** True Line Result - max_alpha: max_alpha }) + exit ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~ log_info ":try_assert_or_schedule succeeded!"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + log_info ":try_assert_or_schedule succeeded!" +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10~ + else +** Processing line: ~ args.gtk.schedule_callback Kernel.tick_count + 10 do~ - Inside source: true *** True Line Result - def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10 -** Processing line: ~ bullet.exploded = true~ + args.gtk.schedule_callback Kernel.tick_count + 10 do +** Processing line: ~ try_assert_or_schedule args, assert~ - Inside source: true *** True Line Result - bullet.exploded = true -** Processing line: ~ create_explosion! :bullet_explosion,~ + try_assert_or_schedule args, assert +** Processing line: ~ end~ - Inside source: true *** True Line Result - create_explosion! :bullet_explosion, -** Processing line: ~ bullet,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - bullet, -** Processing line: ~ flame_override,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - flame_override, -** Processing line: ~ max_speed,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - max_speed, -** Processing line: ~ lifetime,~ + +** Processing line: ~ def test_http args, assert~ - Inside source: true *** True Line Result - lifetime, -** Processing line: ~ bullet.max_alpha~ + def test_http args, assert +** Processing line: ~ $result = $gtk.http_get 'http://dragonruby.org'~ - Inside source: true *** True Line Result - bullet.max_alpha -** Processing line: ~ end~ + $result = $gtk.http_get 'http://dragonruby.org' +** Processing line: ~ try_assert_or_schedule args, assert~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + try_assert_or_schedule args, assert +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_ship ship~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def calc_ship ship -** Processing line: ~ ship.x += ship.dx~ + +** Processing line: ~ puts "running tests"~ - Inside source: true *** True Line Result - ship.x += ship.dx -** Processing line: ~ ship.y += ship.dy~ + puts "running tests" +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - ship.y += ship.dy -** Processing line: ~ wrap_location! ship~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - wrap_location! ship -** Processing line: ~ end~ + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ - Inside source: true *** True Line Result - end + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_ships~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def calc_ships -** Processing line: ~ all_ships.each { |s| calc_ship s }~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - all_ships.each { |s| calc_ship s } -** Processing line: ~ return if all_ships.any? { |s| s.dead }~ -- Inside source: true + +** Processing line: ~* Advanced Debugging - Unit Tests - object_to_primitive_tests.rb~ +- Header detected. *** True Line Result - return if all_ships.any? { |s| s.dead } -** Processing line: ~ return if state.round_finished~ -- Inside source: true + *** True Line Result - return if state.round_finished -** Processing line: ~ return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite)~ -- Inside source: true +* Advanced Debugging - Unit Tests - object_to_primitive_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite) -** Processing line: ~ state.ship_blue.damage = 5~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb~ - Inside source: true *** True Line Result - state.ship_blue.damage = 5 -** Processing line: ~ state.ship_red.damage = 5~ + # ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb +** Processing line: ~ class PlayerSpriteForTest~ - Inside source: true *** True Line Result - state.ship_red.damage = 5 -** Processing line: ~ end~ + class PlayerSpriteForTest +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def create_thruster_flames! ship~ +** Processing line: ~ def test_array_to_sprite args, assert~ - Inside source: true *** True Line Result - def create_thruster_flames! ship -** Processing line: ~ state.flames << state.new_entity(:ship_thruster,~ + def test_array_to_sprite args, assert +** Processing line: ~ array = [[0, 0, 100, 100, "test.png"]].sprites~ - Inside source: true *** True Line Result - state.flames << state.new_entity(:ship_thruster, -** Processing line: ~ { angle: ship.angle + 180 + 60.randomize(:sign, :ratio),~ + array = [[0, 0, 100, 100, "test.png"]].sprites +** Processing line: ~ puts "No exception was thrown. Sweet!"~ - Inside source: true *** True Line Result - { angle: ship.angle + 180 + 60.randomize(:sign, :ratio), -** Processing line: ~ speed: 5.randomize(:ratio),~ + puts "No exception was thrown. Sweet!" +** Processing line: ~ end~ - Inside source: true *** True Line Result - speed: 5.randomize(:ratio), -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), -** Processing line: ~ lifetime: 30,~ + +** Processing line: ~ def test_class_to_sprite args, assert~ - Inside source: true *** True Line Result - lifetime: 30, -** Processing line: ~ x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio),~ + def test_class_to_sprite args, assert +** Processing line: ~ array = [PlayerSprite.new].sprites~ - Inside source: true *** True Line Result - x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio), -** Processing line: ~ y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) })~ + array = [PlayerSprite.new].sprites +** Processing line: ~ assert.true! array.first.is_a?(PlayerSprite)~ - Inside source: true *** True Line Result - y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) }) -** Processing line: ~ end~ + assert.true! array.first.is_a?(PlayerSprite) +** Processing line: ~ puts "No exception was thrown. Sweet!"~ - Inside source: true *** True Line Result - end + puts "No exception was thrown. Sweet!" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input_accelerate_ship should_move_ship, ship~ +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - def input_accelerate_ship should_move_ship, ship -** Processing line: ~ return if ship.dead~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - return if ship.dead + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ +- Inside source: true +*** True Line Result + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ should_move_ship &&= (ship.dx + ship.dy).abs < 5~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - should_move_ship &&= (ship.dx + ship.dy).abs < 5 +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if should_move_ship~ -- Inside source: true +** Processing line: ~* Advanced Debugging - Unit Tests - parsing_tests.rb~ +- Header detected. *** True Line Result - if should_move_ship -** Processing line: ~ create_thruster_flames! ship~ -- Inside source: true + *** True Line Result - create_thruster_flames! ship -** Processing line: ~ ship.dx += ship.angle.vector_x 0.050~ -- Inside source: true +* Advanced Debugging - Unit Tests - parsing_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - ship.dx += ship.angle.vector_x 0.050 -** Processing line: ~ ship.dy += ship.angle.vector_y 0.050~ -- Inside source: true + *** True Line Result - ship.dy += ship.angle.vector_y 0.050 -** Processing line: ~ else~ +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb~ - Inside source: true *** True Line Result - else -** Processing line: ~ ship.dx *= 0.99~ + # ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb +** Processing line: ~ def test_parse_json args, assert~ - Inside source: true *** True Line Result - ship.dx *= 0.99 -** Processing line: ~ ship.dy *= 0.99~ + def test_parse_json args, assert +** Processing line: ~ result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }'~ - Inside source: true *** True Line Result - ship.dy *= 0.99 -** Processing line: ~ end~ + result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' +** Processing line: ~ assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed."~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input_accelerate~ -- Inside source: true -*** True Line Result - def input_accelerate -** Processing line: ~ input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue~ -- Inside source: true -*** True Line Result - input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue -** Processing line: ~ input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red~ +** Processing line: ~ def test_parse_xml args, assert~ - Inside source: true *** True Line Result - input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red -** Processing line: ~ end~ + def test_parse_xml args, assert +** Processing line: ~ result = args.gtk.parse_xml <<-S~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + result = args.gtk.parse_xml <<-S +** Processing line: ~ ~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_turn_ship direction, ship~ + +** Processing line: ~ John Doe~ - Inside source: true *** True Line Result - def input_turn_ship direction, ship -** Processing line: ~ ship.angle -= 3 * direction~ + John Doe +** Processing line: ~ ~ - Inside source: true *** True Line Result - ship.angle -= 3 * direction -** Processing line: ~ end~ + +** Processing line: ~ S~ - Inside source: true *** True Line Result - end + S ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input_turn~ +** Processing line: ~ expected = {:type=>:element,~ - Inside source: true *** True Line Result - def input_turn -** Processing line: ~ input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue~ + expected = {:type=>:element, +** Processing line: ~ :name=>nil,~ - Inside source: true *** True Line Result - input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue -** Processing line: ~ input_turn_ship inputs.controller_two.left_right, state.ship_red~ + :name=>nil, +** Processing line: ~ :children=>[{:type=>:element,~ - Inside source: true *** True Line Result - input_turn_ship inputs.controller_two.left_right, state.ship_red -** Processing line: ~ end~ + :children=>[{:type=>:element, +** Processing line: ~ :name=>"Person",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + :name=>"Person", +** Processing line: ~ :children=>[{:type=>:element,~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_bullet create_bullet, ship~ + :children=>[{:type=>:element, +** Processing line: ~ :name=>"Name",~ - Inside source: true *** True Line Result - def input_bullet create_bullet, ship -** Processing line: ~ return unless create_bullet~ + :name=>"Name", +** Processing line: ~ :children=>[{:type=>:content,~ - Inside source: true *** True Line Result - return unless create_bullet -** Processing line: ~ return if ship.dead~ + :children=>[{:type=>:content, +** Processing line: ~ :data=>"John Doe"}]}],~ - Inside source: true *** True Line Result - return if ship.dead -** Processing line: ~~ + :data=>"John Doe"}]}], +** Processing line: ~ :attributes=>{"id"=>"100"}}]}~ - Inside source: true *** True Line Result - -** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ + :attributes=>{"id"=>"100"}}]} +** Processing line: ~~ - Inside source: true *** True Line Result - state.bullets << state.new_entity(:ship_bullet, -** Processing line: ~ { owner: ship,~ + +** Processing line: ~ assert.equal! result, expected, "Parsing xml failed."~ - Inside source: true *** True Line Result - { owner: ship, -** Processing line: ~ angle: ship.angle,~ + assert.equal! result, expected, "Parsing xml failed." +** Processing line: ~ end~ - Inside source: true *** True Line Result - angle: ship.angle, -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), -** Processing line: ~ speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y),~ + +** Processing line: ~ puts "running tests"~ - Inside source: true *** True Line Result - speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y), -** Processing line: ~ lifetime: 120,~ + puts "running tests" +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - lifetime: 120, -** Processing line: ~ sprite_size: 10,~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - sprite_size: 10, -** Processing line: ~ x: ship.x + ship.angle.vector_x * 32,~ + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ - Inside source: true *** True Line Result - x: ship.x + ship.angle.vector_x * 32, -** Processing line: ~ y: ship.y + ship.angle.vector_y * 32 })~ + $gtk.tests.start +** Processing line: ~~ - Inside source: true *** True Line Result - y: ship.y + ship.angle.vector_y * 32 }) -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def input_mine create_mine, ship~ -- Inside source: true -*** True Line Result - def input_mine create_mine, ship -** Processing line: ~ return unless create_mine~ -- Inside source: true +** Processing line: ~* Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb~ +- Header detected. *** True Line Result - return unless create_mine -** Processing line: ~ return if ship.dead~ -- Inside source: true + *** True Line Result - return if ship.dead -** Processing line: ~~ -- Inside source: true +* Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ -- Inside source: true *** True Line Result - state.bullets << state.new_entity(:ship_bullet, -** Processing line: ~ { owner: ship,~ +#+begin_src ruby +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb~ - Inside source: true *** True Line Result - { owner: ship, -** Processing line: ~ angle: 360.randomize(:sign, :ratio),~ + # ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb +** Processing line: ~ def test_serialize args, assert~ - Inside source: true *** True Line Result - angle: 360.randomize(:sign, :ratio), -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ + def test_serialize args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), -** Processing line: ~ speed: 0.02,~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.state.player_one = "test"~ - Inside source: true *** True Line Result - speed: 0.02, -** Processing line: ~ sprite_size: 10,~ + args.state.player_one = "test" +** Processing line: ~ result = args.gtk.serialize_state args.state~ - Inside source: true *** True Line Result - sprite_size: 10, -** Processing line: ~ lifetime: 600,~ + result = args.gtk.serialize_state args.state +** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ - Inside source: true *** True Line Result - lifetime: 600, -** Processing line: ~ x: ship.x + ship.angle.vector_x * -50,~ + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" +** Processing line: ~~ - Inside source: true *** True Line Result - x: ship.x + ship.angle.vector_x * -50, -** Processing line: ~ y: ship.y + ship.angle.vector_y * -50 })~ + +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - y: ship.y + ship.angle.vector_y * -50 }) -** Processing line: ~ end~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.gtk.write_file 'state.txt', ''~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.gtk.write_file 'state.txt', '' +** Processing line: ~ result = args.gtk.serialize_state 'state.txt', args.state~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_bullets_and_mines~ + result = args.gtk.serialize_state 'state.txt', args.state +** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ - Inside source: true *** True Line Result - def input_bullets_and_mines -** Processing line: ~ return if state.bullets.length > 100~ + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if state.bullets.length > 100 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [~ +** Processing line: ~ def test_deserialize args, assert~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space,~ + def test_deserialize args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space, -** Processing line: ~ inputs.controller_one.key_down.b || inputs.keyboard.key_down.down,~ + GTK::Entity.__reset_id__! +** Processing line: ~ result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ - Inside source: true *** True Line Result - inputs.controller_one.key_down.b || inputs.keyboard.key_down.down, -** Processing line: ~ state.ship_blue],~ + result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' +** Processing line: ~ assert.equal! result.player_one, "test"~ - Inside source: true *** True Line Result - state.ship_blue], -** Processing line: ~ [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red]~ + assert.equal! result.player_one, "test" +** Processing line: ~~ - Inside source: true *** True Line Result - [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red] -** Processing line: ~ ].each do |a_held, b_down, ship|~ + +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - ].each do |a_held, b_down, ship| -** Processing line: ~ input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship)~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ - Inside source: true *** True Line Result - input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship) -** Processing line: ~ input_mine(b_down, ship)~ + args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' +** Processing line: ~ result = args.gtk.deserialize_state 'state.txt'~ - Inside source: true *** True Line Result - input_mine(b_down, ship) -** Processing line: ~ end~ + result = args.gtk.deserialize_state 'state.txt' +** Processing line: ~ assert.equal! result.player_one, "test"~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + assert.equal! result.player_one, "test" +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_kill_ships~ +** Processing line: ~ def test_very_large_serialization args, assert~ - Inside source: true *** True Line Result - def calc_kill_ships -** Processing line: ~ alive_ships.find_all { |s| s.damage >= 5 }.each do |s|~ + def test_very_large_serialization args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - alive_ships.find_all { |s| s.damage >= 5 }.each do |s| -** Processing line: ~ s.dead = true~ + GTK::Entity.__reset_id__! +** Processing line: ~ size = 3000~ - Inside source: true *** True Line Result - s.dead = true -** Processing line: ~ create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha~ + size = 3000 +** Processing line: ~ size.map_with_index do |i|~ - Inside source: true *** True Line Result - create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha -** Processing line: ~ end~ + size.map_with_index do |i| +** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ - Inside source: true *** True Line Result - end + args.state.send("k#{i}=".to_sym, i) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38001,146 +38348,170 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_score~ +** Processing line: ~ result = args.gtk.serialize_state args.state~ - Inside source: true *** True Line Result - def calc_score -** Processing line: ~ return if state.round_finished~ + result = args.gtk.serialize_state args.state +** Processing line: ~ assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly")~ - Inside source: true *** True Line Result - return if state.round_finished -** Processing line: ~ return if alive_ships.length > 1~ + assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly") +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if alive_ships.length > 1 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if alive_ships.first == state.ship_red~ +** Processing line: ~ def test_strict_entity_serialization args, assert~ - Inside source: true *** True Line Result - if alive_ships.first == state.ship_red -** Processing line: ~ state.ship_red_score += 1~ + def test_strict_entity_serialization args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - state.ship_red_score += 1 -** Processing line: ~ elsif alive_ships.first == state.ship_blue~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ - Inside source: true *** True Line Result - elsif alive_ships.first == state.ship_blue -** Processing line: ~ state.ship_blue_score += 1~ + args.state.player_one = args.state.new_entity(:player, name: "Ryu") +** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken")~ - Inside source: true *** True Line Result - state.ship_blue_score += 1 -** Processing line: ~ end~ + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken") +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +- Inside source: true +*** True Line Result + serialized_state = args.gtk.serialize_state args.state +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}'~ +- Inside source: true +*** True Line Result + assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.round_finished = true~ +** Processing line: ~ deserialize_state = args.gtk.deserialize_state serialized_state~ - Inside source: true *** True Line Result - state.round_finished = true -** Processing line: ~ end~ + deserialize_state = args.gtk.deserialize_state serialized_state +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ assert.equal! args.state.player_one.name, deserialize_state.player_one.name~ +- Inside source: true +*** True Line Result + assert.equal! args.state.player_one.name, deserialize_state.player_one.name +** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ +- Inside source: true +*** True Line Result + assert.true! args.state.player_one.is_a? GTK::OpenEntity ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_reset_ships~ +** Processing line: ~ assert.equal! args.state.player_two.name, deserialize_state.player_two.name~ - Inside source: true *** True Line Result - def calc_reset_ships -** Processing line: ~ return unless state.round_finished~ + assert.equal! args.state.player_two.name, deserialize_state.player_two.name +** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ - Inside source: true *** True Line Result - return unless state.round_finished -** Processing line: ~ state.round_finished_debounce ||= 2.seconds~ + assert.true! args.state.player_two.is_a? GTK::StrictEntity +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.round_finished_debounce ||= 2.seconds -** Processing line: ~ state.round_finished_debounce -= 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.round_finished_debounce -= 1 -** Processing line: ~ return if state.round_finished_debounce > 0~ + +** Processing line: ~ def test_strict_entity_serialization_with_nil args, assert~ - Inside source: true *** True Line Result - return if state.round_finished_debounce > 0 -** Processing line: ~ start_new_round!~ + def test_strict_entity_serialization_with_nil args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - start_new_round! -** Processing line: ~ end~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.player_one = args.state.new_entity(:player, name: "Ryu") +** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil)~ - Inside source: true *** True Line Result - -** Processing line: ~ def start_new_round!~ + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) +** Processing line: ~~ - Inside source: true *** True Line Result - def start_new_round! -** Processing line: ~ state.ship_blue = new_blue_ship~ + +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ - Inside source: true *** True Line Result - state.ship_blue = new_blue_ship -** Processing line: ~ state.ship_red = new_red_ship~ + serialized_state = args.gtk.serialize_state args.state +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}'~ - Inside source: true *** True Line Result - state.ship_red = new_red_ship -** Processing line: ~ state.round_finished = false~ + assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}' +** Processing line: ~~ - Inside source: true *** True Line Result - state.round_finished = false -** Processing line: ~ state.round_finished_debounce = nil~ + +** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ - Inside source: true *** True Line Result - state.round_finished_debounce = nil -** Processing line: ~ state.flames.clear~ + deserialized_state = args.gtk.deserialize_state serialized_state +** Processing line: ~~ - Inside source: true *** True Line Result - state.flames.clear -** Processing line: ~ state.bullets.clear~ + +** Processing line: ~ assert.equal! args.state.player_one.name, deserialized_state.player_one.name~ - Inside source: true *** True Line Result - state.bullets.clear -** Processing line: ~ end~ + assert.equal! args.state.player_one.name, deserialized_state.player_one.name +** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ - Inside source: true *** True Line Result - end + assert.true! args.state.player_one.is_a? GTK::OpenEntity ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_winner~ +** Processing line: ~ assert.equal! args.state.player_two.name, deserialized_state.player_two.name~ - Inside source: true *** True Line Result - def calc_winner -** Processing line: ~ calc_kill_ships~ + assert.equal! args.state.player_two.name, deserialized_state.player_two.name +** Processing line: ~ assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type~ - Inside source: true *** True Line Result - calc_kill_ships -** Processing line: ~ calc_score~ + assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type +** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, nil~ - Inside source: true *** True Line Result - calc_score -** Processing line: ~ calc_reset_ships~ + assert.equal! deserialized_state.player_two.blood_type, nil +** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ - Inside source: true *** True Line Result - calc_reset_ships -** Processing line: ~ end~ + assert.true! args.state.player_two.is_a? GTK::StrictEntity +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ deserialized_state.player_two.blood_type = :O~ +- Inside source: true +*** True Line Result + deserialized_state.player_two.blood_type = :O +** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, :O~ +- Inside source: true +*** True Line Result + assert.equal! deserialized_state.player_two.blood_type, :O ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38149,42 +38520,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $dueling_spaceship = DuelingSpaceships.new~ +** Processing line: ~ def test_multiple_strict_entities args, assert~ - Inside source: true *** True Line Result - $dueling_spaceship = DuelingSpaceships.new -** Processing line: ~~ + def test_multiple_strict_entities args, assert +** Processing line: ~ GTK::Entity.__reset_id__!~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + GTK::Entity.__reset_id__! +** Processing line: ~ args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu")~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.grid.origin_center!~ + args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu") +** Processing line: ~ args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean')~ - Inside source: true *** True Line Result - args.grid.origin_center! -** Processing line: ~ $dueling_spaceship.inputs = args.inputs~ + args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean') +** Processing line: ~~ - Inside source: true *** True Line Result - $dueling_spaceship.inputs = args.inputs -** Processing line: ~ $dueling_spaceship.outputs = args.outputs~ + +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ - Inside source: true *** True Line Result - $dueling_spaceship.outputs = args.outputs -** Processing line: ~ $dueling_spaceship.state = args.state~ + serialized_state = args.gtk.serialize_state args.state +** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ - Inside source: true *** True Line Result - $dueling_spaceship.state = args.state -** Processing line: ~ $dueling_spaceship.grid = args.grid~ + deserialized_state = args.gtk.deserialize_state serialized_state +** Processing line: ~~ - Inside source: true *** True Line Result - $dueling_spaceship.grid = args.grid -** Processing line: ~ $dueling_spaceship.tick~ + +** Processing line: ~ assert.equal! deserialized_state.player.name, "Ryu"~ - Inside source: true *** True Line Result - $dueling_spaceship.tick + assert.equal! deserialized_state.player.name, "Ryu" +** Processing line: ~ assert.equal! deserialized_state.enemy.other_property, "extra mean"~ +- Inside source: true +*** True Line Result + assert.equal! deserialized_state.enemy.other_property, "extra mean" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38193,6 +38568,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ $tests.start~ +- Inside source: true +*** True Line Result + $tests.start +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -38201,262 +38584,270 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 99_genre_arcade/flappy_dragon/app/main.rb~ +** Processing line: ~* Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb~ - Header detected. *** True Line Result *** True Line Result -* 99_genre_arcade/flappy_dragon/app/main.rb +* Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ class FlappyDragon~ +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb~ - Inside source: true *** True Line Result - class FlappyDragon -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ + # ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb +** Processing line: ~ MAX_CODE_GEN_LENGTH = 50~ - Inside source: true *** True Line Result - attr_accessor :grid, :inputs, :state, :outputs + MAX_CODE_GEN_LENGTH = 50 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick~ +** Processing line: ~ # NOTE: This is experimental/advanced stuff.~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + # NOTE: This is experimental/advanced stuff. +** Processing line: ~ def needs_partitioning? target~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + def needs_partitioning? target +** Processing line: ~ target[:value].to_s.length > MAX_CODE_GEN_LENGTH~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + target[:value].to_s.length > MAX_CODE_GEN_LENGTH +** Processing line: ~ end~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - process_inputs -** Processing line: ~ end~ + +** Processing line: ~ def partition target~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def partition target +** Processing line: ~ return [] unless needs_partitioning? target~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults~ + return [] unless needs_partitioning? target +** Processing line: ~ if target[:value].is_a? GTK::OpenEntity~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.flap_power = 11~ + if target[:value].is_a? GTK::OpenEntity +** Processing line: ~ target[:value] = target[:value].hash~ - Inside source: true *** True Line Result - state.flap_power = 11 -** Processing line: ~ state.gravity = 0.9~ + target[:value] = target[:value].hash +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.gravity = 0.9 -** Processing line: ~ state.ceiling = 600~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.ceiling = 600 -** Processing line: ~ state.ceiling_flap_power = 6~ + +** Processing line: ~ results = []~ - Inside source: true *** True Line Result - state.ceiling_flap_power = 6 -** Processing line: ~ state.wall_countdown_length = 100~ + results = [] +** Processing line: ~ idx = 0~ - Inside source: true *** True Line Result - state.wall_countdown_length = 100 -** Processing line: ~ state.wall_gap_size = 100~ + idx = 0 +** Processing line: ~ left, right = target[:value].partition do~ - Inside source: true *** True Line Result - state.wall_gap_size = 100 -** Processing line: ~ state.wall_countdown ||= 0~ + left, right = target[:value].partition do +** Processing line: ~ idx += 1~ - Inside source: true *** True Line Result - state.wall_countdown ||= 0 -** Processing line: ~ state.hi_score ||= 0~ + idx += 1 +** Processing line: ~ idx.even?~ - Inside source: true *** True Line Result - state.hi_score ||= 0 -** Processing line: ~ state.score ||= 0~ + idx.even? +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.score ||= 0 -** Processing line: ~ state.walls ||= []~ + end +** Processing line: ~ left, right = Hash[left], Hash[right]~ - Inside source: true *** True Line Result - state.walls ||= [] -** Processing line: ~ state.x ||= 50~ + left, right = Hash[left], Hash[right] +** Processing line: ~ left = { value: left }~ - Inside source: true *** True Line Result - state.x ||= 50 -** Processing line: ~ state.y ||= 500~ + left = { value: left } +** Processing line: ~ right = { value: right}~ - Inside source: true *** True Line Result - state.y ||= 500 -** Processing line: ~ state.dy ||= 0~ + right = { value: right} +** Processing line: ~ [left, right]~ - Inside source: true *** True Line Result - state.dy ||= 0 -** Processing line: ~ state.scene ||= :menu~ + [left, right] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.scene ||= :menu -** Processing line: ~ state.scene_at ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.scene_at ||= 0 -** Processing line: ~ state.difficulty ||= :normal~ + +** Processing line: ~ def add_partition target, path, aggregate, final_result~ - Inside source: true *** True Line Result - state.difficulty ||= :normal -** Processing line: ~ state.new_difficulty ||= :normal~ + def add_partition target, path, aggregate, final_result +** Processing line: ~ partitions = partition target~ - Inside source: true *** True Line Result - state.new_difficulty ||= :normal -** Processing line: ~ state.countdown ||= 4.seconds~ + partitions = partition target +** Processing line: ~ partitions.each do |part|~ - Inside source: true *** True Line Result - state.countdown ||= 4.seconds -** Processing line: ~ state.flash_at ||= 0~ + partitions.each do |part| +** Processing line: ~ if needs_partitioning? part~ - Inside source: true *** True Line Result - state.flash_at ||= 0 -** Processing line: ~ end~ + if needs_partitioning? part +** Processing line: ~ if part[:value].keys.length == 1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if part[:value].keys.length == 1 +** Processing line: ~ first_key = part[:value].keys[0]~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + first_key = part[:value].keys[0] +** Processing line: ~ new_part = { value: part[:value][first_key] }~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1~ + new_part = { value: part[:value][first_key] } +** Processing line: ~ path.push first_key~ - Inside source: true *** True Line Result - outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1 -** Processing line: ~ render_score~ + path.push first_key +** Processing line: ~ add_partition new_part, path, aggregate, final_result~ - Inside source: true *** True Line Result - render_score -** Processing line: ~ render_menu~ + add_partition new_part, path, aggregate, final_result +** Processing line: ~ path.pop~ - Inside source: true *** True Line Result - render_menu -** Processing line: ~ render_game~ + path.pop +** Processing line: ~ else~ - Inside source: true *** True Line Result - render_game -** Processing line: ~ end~ + else +** Processing line: ~ add_partition part, path, aggregate, final_result~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + add_partition part, path, aggregate, final_result +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_score~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - def render_score -** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ + else +** Processing line: ~ final_result << { value: { __path__: [*path] } }~ - Inside source: true *** True Line Result - outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label -** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ + final_result << { value: { __path__: [*path] } } +** Processing line: ~ final_result << { value: part[:value] }~ - Inside source: true *** True Line Result - outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label -** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ + final_result << { value: part[:value] } +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_menu~ +** Processing line: ~ def state_to_string state~ - Inside source: true *** True Line Result - def render_menu -** Processing line: ~ return unless state.scene == :menu~ + def state_to_string state +** Processing line: ~ parts_queue = []~ - Inside source: true *** True Line Result - return unless state.scene == :menu -** Processing line: ~ render_overlay~ + parts_queue = [] +** Processing line: ~ final_queue = []~ - Inside source: true *** True Line Result - render_overlay -** Processing line: ~~ + final_queue = [] +** Processing line: ~ add_partition({ value: state.hash },~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ + add_partition({ value: state.hash }, +** Processing line: ~ [],~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ + [], +** Processing line: ~ parts_queue,~ - Inside source: true *** True Line Result - outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ + parts_queue, +** Processing line: ~ final_queue)~ - Inside source: true *** True Line Result - outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ + final_queue) +** Processing line: ~ final_queue.reject {|i| i[:value].keys.length == 0}.map do |i|~ - Inside source: true *** True Line Result - outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ + final_queue.reject {|i| i[:value].keys.length == 0}.map do |i| +** Processing line: ~ i[:value].to_s~ - Inside source: true *** True Line Result - outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ + i[:value].to_s +** Processing line: ~ end.join("\n#==================================================#\n")~ - Inside source: true *** True Line Result - outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ + end.join("\n#==================================================#\n") +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ +** Processing line: ~ def state_from_string string~ - Inside source: true *** True Line Result - outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ + def state_from_string string +** Processing line: ~ Kernel.eval("$load_data = {}")~ - Inside source: true *** True Line Result - outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ + Kernel.eval("$load_data = {}") +** Processing line: ~ lines = string.split("\n#==================================================#\n")~ - Inside source: true *** True Line Result - outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] -** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ + lines = string.split("\n#==================================================#\n") +** Processing line: ~ lines.each do |l|~ - Inside source: true *** True Line Result - outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + lines.each do |l| +** Processing line: ~ puts "todo: #{l}"~ +- Inside source: true +*** True Line Result + puts "todo: #{l}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38465,78 +38856,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_overlay~ -- Inside source: true -*** True Line Result - def render_overlay -** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ +** Processing line: ~ GTK::OpenEntity.parse_from_hash $load_data~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid -** Processing line: ~ end~ + GTK::OpenEntity.parse_from_hash $load_data +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_game~ -- Inside source: true -*** True Line Result - def render_game -** Processing line: ~ render_game_over~ +** Processing line: ~ def test_save_and_load args, assert~ - Inside source: true *** True Line Result - render_game_over -** Processing line: ~ render_background~ + def test_save_and_load args, assert +** Processing line: ~ args.state.item_1.name = "Jane"~ - Inside source: true *** True Line Result - render_background -** Processing line: ~ render_walls~ + args.state.item_1.name = "Jane" +** Processing line: ~ string = state_to_string args.state~ - Inside source: true *** True Line Result - render_walls -** Processing line: ~ render_dragon~ + string = state_to_string args.state +** Processing line: ~ state = state_from_string string~ - Inside source: true *** True Line Result - render_dragon -** Processing line: ~ render_flash~ + state = state_from_string string +** Processing line: ~ assert.equal! args.state.item_1.name, state.item_1.name~ - Inside source: true *** True Line Result - render_flash -** Processing line: ~ end~ + assert.equal! args.state.item_1.name, state.item_1.name +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_game_over~ -- Inside source: true -*** True Line Result - def render_game_over -** Processing line: ~ return unless state.scene == :game~ -- Inside source: true -*** True Line Result - return unless state.scene == :game -** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ +** Processing line: ~ def test_save_and_load_big args, assert~ - Inside source: true *** True Line Result - outputs.labels << [638, 358, score_text, 20, 1] -** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ + def test_save_and_load_big args, assert +** Processing line: ~ size = 1000~ - Inside source: true *** True Line Result - outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] -** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ + size = 1000 +** Processing line: ~ size.map_with_index do |i|~ - Inside source: true *** True Line Result - outputs.labels << [638, 428, countdown_text, 20, 1] -** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ + size.map_with_index do |i| +** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ - Inside source: true *** True Line Result - outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + args.state.send("k#{i}=".to_sym, i) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38545,202 +38920,230 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_background~ +** Processing line: ~ string = state_to_string args.state~ - Inside source: true *** True Line Result - def render_background -** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ + string = state_to_string args.state +** Processing line: ~ state = state_from_string string~ - Inside source: true *** True Line Result - outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] -** Processing line: ~~ + state = state_from_string string +** Processing line: ~ size.map_with_index do |i|~ - Inside source: true *** True Line Result - -** Processing line: ~ scroll_point_at = state.tick_count~ + size.map_with_index do |i| +** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym)~ - Inside source: true *** True Line Result - scroll_point_at = state.tick_count -** Processing line: ~ scroll_point_at = state.scene_at if state.scene == :menu~ + assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym) +** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), i~ - Inside source: true *** True Line Result - scroll_point_at = state.scene_at if state.scene == :menu -** Processing line: ~ scroll_point_at = state.death_at if state.countdown > 0~ + assert.equal! args.state.send("k#{i}".to_sym), i +** Processing line: ~ assert.equal! state.send("k#{i}".to_sym), i~ - Inside source: true *** True Line Result - scroll_point_at = state.death_at if state.countdown > 0 -** Processing line: ~ scroll_point_at ||= 0~ + assert.equal! state.send("k#{i}".to_sym), i +** Processing line: ~ end~ - Inside source: true *** True Line Result - scroll_point_at ||= 0 + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25)~ +** Processing line: ~ def test_save_and_load_big_nested args, assert~ - Inside source: true *** True Line Result - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25) -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50)~ + def test_save_and_load_big_nested args, assert +** Processing line: ~ args.state.player_one.friend.nested_hash.k0 = 0~ - Inside source: true *** True Line Result - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50) -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80)~ + args.state.player_one.friend.nested_hash.k0 = 0 +** Processing line: ~ args.state.player_one.friend.nested_hash.k1 = 1~ - Inside source: true *** True Line Result - outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) -** Processing line: ~ end~ + args.state.player_one.friend.nested_hash.k1 = 1 +** Processing line: ~ args.state.player_one.friend.nested_hash.k2 = 2~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.player_one.friend.nested_hash.k2 = 2 +** Processing line: ~ args.state.player_one.friend.nested_hash.k3 = 3~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_walls~ + args.state.player_one.friend.nested_hash.k3 = 3 +** Processing line: ~ args.state.player_one.friend.nested_hash.k4 = 4~ - Inside source: true *** True Line Result - def render_walls -** Processing line: ~ state.walls.each do |w|~ + args.state.player_one.friend.nested_hash.k4 = 4 +** Processing line: ~ args.state.player_one.friend.nested_hash.k5 = 5~ - Inside source: true *** True Line Result - state.walls.each do |w| -** Processing line: ~ w.sprites = [~ + args.state.player_one.friend.nested_hash.k5 = 5 +** Processing line: ~ args.state.player_one.friend.nested_hash.k6 = 6~ - Inside source: true *** True Line Result - w.sprites = [ -** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ + args.state.player_one.friend.nested_hash.k6 = 6 +** Processing line: ~ args.state.player_one.friend.nested_hash.k7 = 7~ - Inside source: true *** True Line Result - [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], -** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ + args.state.player_one.friend.nested_hash.k7 = 7 +** Processing line: ~ args.state.player_one.friend.nested_hash.k8 = 8~ - Inside source: true *** True Line Result - [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] -** Processing line: ~ ]~ + args.state.player_one.friend.nested_hash.k8 = 8 +** Processing line: ~ args.state.player_one.friend.nested_hash.k9 = 9~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + args.state.player_one.friend.nested_hash.k9 = 9 +** Processing line: ~ string = state_to_string args.state~ - Inside source: true *** True Line Result - end -** Processing line: ~ outputs.sprites << state.walls.map(&:sprites)~ + string = state_to_string args.state +** Processing line: ~ state = state_from_string string~ - Inside source: true *** True Line Result - outputs.sprites << state.walls.map(&:sprites) -** Processing line: ~ end~ + state = state_from_string string +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_dragon~ +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - def render_dragon -** Processing line: ~ state.show_death = true if state.countdown == 3.seconds~ + $gtk.reset 100 +** Processing line: ~ $gtk.log_level = :off~ - Inside source: true *** True Line Result - state.show_death = true if state.countdown == 3.seconds + $gtk.log_level = :off +** Processing line: ~ $gtk.tests.start~ +- Inside source: true +*** True Line Result + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ render_debug_hitbox false~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - render_debug_hitbox false +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if state.show_death == false || !state.death_at~ +** Processing line: ~* Http - Retrieve Images - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Http - Retrieve Images - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/11_http/01_retrieve_images/app/main.rb~ - Inside source: true *** True Line Result - if state.show_death == false || !state.death_at -** Processing line: ~ animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at~ + # ./samples/11_http/01_retrieve_images/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at -** Processing line: ~ sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png"~ + def tick args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~~ - Inside source: true *** True Line Result - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] -** Processing line: ~ else~ + +** Processing line: ~ # Show a warning at the start.~ - Inside source: true *** True Line Result - else -** Processing line: ~ sprite_name = "sprites/dragon_die.png"~ + # Show a warning at the start. +** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ - Inside source: true *** True Line Result - sprite_name = "sprites/dragon_die.png" -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ + args.state.warning_debounce ||= 11 * 60 +** Processing line: ~ if args.state.warning_debounce > 0~ - Inside source: true *** True Line Result - state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] -** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ + if args.state.warning_debounce > 0 +** Processing line: ~ args.state.warning_debounce -= 1~ - Inside source: true *** True Line Result - sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds -** Processing line: ~ state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1~ + args.state.warning_debounce -= 1 +** Processing line: ~ args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 -** Processing line: ~ state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction~ + args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] +** Processing line: ~ args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction -** Processing line: ~ state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6)~ + args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255] +** Processing line: ~ args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6) -** Processing line: ~ end~ + args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255] +** Processing line: ~ return~ - Inside source: true *** True Line Result - end + return +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.sprites << state.dragon_sprite~ +** Processing line: ~ args.state.download_debounce ||= 0 # start immediately, reset to non zero later.~ - Inside source: true *** True Line Result - outputs.sprites << state.dragon_sprite -** Processing line: ~ end~ + args.state.download_debounce ||= 0 # start immediately, reset to non zero later. +** Processing line: ~ args.state.photos ||= []~ - Inside source: true *** True Line Result - end + args.state.photos ||= [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_debug_hitbox show~ +** Processing line: ~ # Put a little pause between each download.~ - Inside source: true *** True Line Result - def render_debug_hitbox show -** Processing line: ~ return unless show~ + # Put a little pause between each download. +** Processing line: ~ if args.state.download.nil?~ - Inside source: true *** True Line Result - return unless show -** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ + if args.state.download.nil? +** Processing line: ~ if args.state.download_debounce > 0~ - Inside source: true *** True Line Result - outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite -** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ + if args.state.download_debounce > 0 +** Processing line: ~ args.state.download_debounce -= 1~ - Inside source: true *** True Line Result - outputs.borders << state.walls.flat_map do |w| -** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ + args.state.download_debounce -= 1 +** Processing line: ~ else~ - Inside source: true *** True Line Result - w.sprites.map { |s| [s.rect, 255, 0, 0] } + else +** Processing line: ~ args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg'~ +- Inside source: true +*** True Line Result + args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg' ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38753,38 +39156,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_flash~ +** Processing line: ~ if !args.state.download.nil?~ - Inside source: true *** True Line Result - def render_flash -** Processing line: ~ return unless state.flash_at~ + if !args.state.download.nil? +** Processing line: ~ if args.state.download[:complete]~ - Inside source: true *** True Line Result - return unless state.flash_at -** Processing line: ~~ + if args.state.download[:complete] +** Processing line: ~ if args.state.download[:http_response_code] == 200~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.primitives << [grid.rect,~ + if args.state.download[:http_response_code] == 200 +** Processing line: ~ fname = "sprites/#{args.state.photos.length}.jpg"~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect, -** Processing line: ~ white,~ + fname = "sprites/#{args.state.photos.length}.jpg" +** Processing line: ~ $gtk.write_file fname, args.state.download[:response_data]~ - Inside source: true *** True Line Result - white, -** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ + $gtk.write_file fname, args.state.download[:response_data] +** Processing line: ~ args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ]~ - Inside source: true *** True Line Result - 255 * state.flash_at.ease(20, :flip)].solid -** Processing line: ~~ + args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ state.flash_at = 0 if state.flash_at.elapsed_time > 20~ + end +** Processing line: ~ args.state.download = nil~ - Inside source: true *** True Line Result - state.flash_at = 0 if state.flash_at.elapsed_time > 20 + args.state.download = nil +** Processing line: ~ args.state.download_debounce = (rand(3) + 2) * 60~ +- Inside source: true +*** True Line Result + args.state.download_debounce = (rand(3) + 2) * 60 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -38793,454 +39204,470 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc~ -- Inside source: true -*** True Line Result - def calc -** Processing line: ~ return unless state.scene == :game~ +** Processing line: ~ # draw any downloaded photos...~ - Inside source: true *** True Line Result - return unless state.scene == :game -** Processing line: ~ reset_game if state.countdown == 1~ + # draw any downloaded photos... +** Processing line: ~ args.state.photos.each { |i|~ - Inside source: true *** True Line Result - reset_game if state.countdown == 1 -** Processing line: ~ state.countdown -= 1 and return if state.countdown > 0~ + args.state.photos.each { |i| +** Processing line: ~ args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite~ - Inside source: true *** True Line Result - state.countdown -= 1 and return if state.countdown > 0 -** Processing line: ~ calc_walls~ + args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite +** Processing line: ~ }~ - Inside source: true *** True Line Result - calc_walls -** Processing line: ~ calc_flap~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - calc_flap -** Processing line: ~ calc_game_over~ + +** Processing line: ~ # Draw a download progress bar...~ - Inside source: true *** True Line Result - calc_game_over -** Processing line: ~ end~ + # Draw a download progress bar... +** Processing line: ~ args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid +** Processing line: ~ if !args.state.download.nil?~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_walls~ + if !args.state.download.nil? +** Processing line: ~ br = args.state.download[:response_read]~ - Inside source: true *** True Line Result - def calc_walls -** Processing line: ~ state.walls.each { |w| w.x -= 8 }~ + br = args.state.download[:response_read] +** Processing line: ~ total = args.state.download[:response_total]~ - Inside source: true *** True Line Result - state.walls.each { |w| w.x -= 8 } -** Processing line: ~~ + total = args.state.download[:response_total] +** Processing line: ~ if total != 0~ - Inside source: true *** True Line Result - -** Processing line: ~ walls_count_before_removal = state.walls.length~ + if total != 0 +** Processing line: ~ pct = br.to_f / total.to_f~ - Inside source: true *** True Line Result - walls_count_before_removal = state.walls.length -** Processing line: ~~ + pct = br.to_f / total.to_f +** Processing line: ~ args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid~ - Inside source: true *** True Line Result - -** Processing line: ~ state.walls.reject! { |w| w.x < -100 }~ + args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.walls.reject! { |w| w.x < -100 } -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ state.score += 1 if state.walls.count < walls_count_before_removal~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.score += 1 if state.walls.count < walls_count_before_removal + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.wall_countdown -= 1 and return if state.wall_countdown > 0~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - state.wall_countdown -= 1 and return if state.wall_countdown > 0 +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ state.walls << state.new_entity(:wall) do |w|~ -- Inside source: true +** Processing line: ~* 12 C Extensions - Basics - main.rb~ +- Header detected. *** True Line Result - state.walls << state.new_entity(:wall) do |w| -** Processing line: ~ w.x = grid.right~ -- Inside source: true + *** True Line Result - w.x = grid.right -** Processing line: ~ w.opening = grid.top~ +* 12 C Extensions - Basics - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/12_c_extensions/01_basics/app/main.rb~ - Inside source: true *** True Line Result - w.opening = grid.top -** Processing line: ~ .randomize(:ratio)~ + # ./samples/12_c_extensions/01_basics/app/main.rb +** Processing line: ~ $gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib")~ - Inside source: true *** True Line Result - .randomize(:ratio) -** Processing line: ~ .greater(200)~ + $gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib") +** Processing line: ~ include FFI::CExt~ - Inside source: true *** True Line Result - .greater(200) -** Processing line: ~ .lesser(520)~ + include FFI::CExt +** Processing line: ~~ - Inside source: true *** True Line Result - .lesser(520) -** Processing line: ~ w.bottom_height = w.opening - state.wall_gap_size~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - w.bottom_height = w.opening - state.wall_gap_size -** Processing line: ~ w.top_y = w.opening + state.wall_gap_size~ + def tick args +** Processing line: ~ args.outputs.labels << [460, 600, "square(42) = #{square(42)}"]~ - Inside source: true *** True Line Result - w.top_y = w.opening + state.wall_gap_size -** Processing line: ~ end~ + args.outputs.labels << [460, 600, "square(42) = #{square(42)}"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.wall_countdown = state.wall_countdown_length~ +** Processing line: ~~ - Inside source: true *** True Line Result - state.wall_countdown = state.wall_countdown_length -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def calc_flap~ -- Inside source: true +** Processing line: ~* 3d - 3d Cube - main.rb~ +- Header detected. *** True Line Result - def calc_flap -** Processing line: ~ state.y += state.dy~ -- Inside source: true + *** True Line Result - state.y += state.dy -** Processing line: ~ state.dy = state.dy.lesser state.flap_power~ -- Inside source: true +* 3d - 3d Cube - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - state.dy = state.dy.lesser state.flap_power -** Processing line: ~ state.dy -= state.gravity~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_3d/3d_cube/app/main.rb~ - Inside source: true *** True Line Result - state.dy -= state.gravity -** Processing line: ~ return if state.y < state.ceiling~ + # ./samples/99_genre_3d/3d_cube/app/main.rb +** Processing line: ~ STARTX = 0.0~ - Inside source: true *** True Line Result - return if state.y < state.ceiling -** Processing line: ~ state.y = state.ceiling~ + STARTX = 0.0 +** Processing line: ~ STARTY = 0.0~ - Inside source: true *** True Line Result - state.y = state.ceiling -** Processing line: ~ state.dy = state.dy.lesser state.ceiling_flap_power~ + STARTY = 0.0 +** Processing line: ~ ENDY = 20.0~ - Inside source: true *** True Line Result - state.dy = state.dy.lesser state.ceiling_flap_power -** Processing line: ~ end~ + ENDY = 20.0 +** Processing line: ~ ENDX = 20.0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ENDX = 20.0 +** Processing line: ~ SPINPOINT = 10~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_game_over~ + SPINPOINT = 10 +** Processing line: ~ SPINDURATION = 400~ - Inside source: true *** True Line Result - def calc_game_over -** Processing line: ~ return unless game_over?~ + SPINDURATION = 400 +** Processing line: ~ POINTSIZE = 8~ - Inside source: true *** True Line Result - return unless game_over? -** Processing line: ~~ + POINTSIZE = 8 +** Processing line: ~ BOXDEPTH = 40~ - Inside source: true *** True Line Result - -** Processing line: ~ state.death_at = state.tick_count~ + BOXDEPTH = 40 +** Processing line: ~ YAW = 1~ - Inside source: true *** True Line Result - state.death_at = state.tick_count -** Processing line: ~ state.death_from = state.walls.first~ + YAW = 1 +** Processing line: ~ DISTANCE = 10~ - Inside source: true *** True Line Result - state.death_from = state.walls.first -** Processing line: ~ state.death_fall_direction = -1~ + DISTANCE = 10 +** Processing line: ~~ - Inside source: true *** True Line Result - state.death_fall_direction = -1 -** Processing line: ~ state.death_fall_direction = 1 if state.x > state.death_from.x~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - state.death_fall_direction = 1 if state.x > state.death_from.x -** Processing line: ~ outputs.sounds << "sounds/hit-sound.wav"~ + def tick args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - outputs.sounds << "sounds/hit-sound.wav" -** Processing line: ~ begin_countdown~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION)~ - Inside source: true *** True Line Result - begin_countdown -** Processing line: ~ end~ + a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION) +** Processing line: ~ s = Math.sin(a)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + s = Math.sin(a) +** Processing line: ~ c = Math.cos(a)~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs~ + c = Math.cos(a) +** Processing line: ~ x = STARTX~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ process_inputs_menu~ + x = STARTX +** Processing line: ~ y = STARTY~ - Inside source: true *** True Line Result - process_inputs_menu -** Processing line: ~ process_inputs_game~ + y = STARTY +** Processing line: ~ offset_x = (1280 - (ENDX - STARTX)) / 2~ - Inside source: true *** True Line Result - process_inputs_game -** Processing line: ~ end~ + offset_x = (1280 - (ENDX - STARTX)) / 2 +** Processing line: ~ offset_y = (360 - (ENDY - STARTY)) / 2~ - Inside source: true *** True Line Result - end + offset_y = (360 - (ENDY - STARTY)) / 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs_menu~ -- Inside source: true -*** True Line Result - def process_inputs_menu -** Processing line: ~ return unless state.scene == :menu~ +** Processing line: ~ srand(1)~ - Inside source: true *** True Line Result - return unless state.scene == :menu -** Processing line: ~~ + srand(1) +** Processing line: ~ while y < ENDY do~ - Inside source: true *** True Line Result - -** Processing line: ~ changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select~ + while y < ENDY do +** Processing line: ~ while x < ENDX do~ - Inside source: true *** True Line Result - changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select -** Processing line: ~ if inputs.mouse.click~ + while x < ENDX do +** Processing line: ~ if (y == STARTY ||~ - Inside source: true *** True Line Result - if inputs.mouse.click -** Processing line: ~ p = inputs.mouse.click.point~ + if (y == STARTY || +** Processing line: ~ y == (ENDY / 0.5) * 2 ||~ - Inside source: true *** True Line Result - p = inputs.mouse.click.point -** Processing line: ~ if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800)~ + y == (ENDY / 0.5) * 2 || +** Processing line: ~ y == (ENDY / 0.5) * 2 + 0.5 ||~ - Inside source: true *** True Line Result - if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800) -** Processing line: ~ changediff = true~ + y == (ENDY / 0.5) * 2 + 0.5 || +** Processing line: ~ y == ENDY - 0.5 ||~ - Inside source: true *** True Line Result - changediff = true -** Processing line: ~ end~ + y == ENDY - 0.5 || +** Processing line: ~ x == STARTX ||~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + x == STARTX || +** Processing line: ~ x == ENDX - 0.5)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x == ENDX - 0.5) +** Processing line: ~ z = rand(BOXDEPTH)~ - Inside source: true *** True Line Result - -** Processing line: ~ if changediff~ + z = rand(BOXDEPTH) +** Processing line: ~ z *= Math.sin(a / 2)~ - Inside source: true *** True Line Result - if changediff -** Processing line: ~ case state.new_difficulty~ + z *= Math.sin(a / 2) +** Processing line: ~ x -= SPINPOINT~ - Inside source: true *** True Line Result - case state.new_difficulty -** Processing line: ~ when :easy~ + x -= SPINPOINT +** Processing line: ~ u = (x * c) - (z * s)~ - Inside source: true *** True Line Result - when :easy -** Processing line: ~ state.new_difficulty = :normal~ + u = (x * c) - (z * s) +** Processing line: ~ v = (x * s) + (z * c)~ - Inside source: true *** True Line Result - state.new_difficulty = :normal -** Processing line: ~ when :normal~ + v = (x * s) + (z * c) +** Processing line: ~ k = DISTANCE.fdiv(100) + (v / 500 * YAW)~ - Inside source: true *** True Line Result - when :normal -** Processing line: ~ state.new_difficulty = :hard~ + k = DISTANCE.fdiv(100) + (v / 500 * YAW) +** Processing line: ~ u = u / k~ - Inside source: true *** True Line Result - state.new_difficulty = :hard -** Processing line: ~ when :hard~ + u = u / k +** Processing line: ~ v = y / k~ - Inside source: true *** True Line Result - when :hard -** Processing line: ~ state.new_difficulty = :flappy~ + v = y / k +** Processing line: ~ w = POINTSIZE / 10 / k~ - Inside source: true *** True Line Result - state.new_difficulty = :flappy -** Processing line: ~ when :flappy~ + w = POINTSIZE / 10 / k +** Processing line: ~ args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'}~ - Inside source: true *** True Line Result - when :flappy -** Processing line: ~ state.new_difficulty = :easy~ + args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'} +** Processing line: ~ x += SPINPOINT~ - Inside source: true *** True Line Result - state.new_difficulty = :easy + x += SPINPOINT ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ x += 0.5~ +- Inside source: true +*** True Line Result + x += 0.5 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ y += 0.5~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a~ + y += 0.5 +** Processing line: ~ x = STARTX~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a -** Processing line: ~ state.difficulty = state.new_difficulty~ + x = STARTX +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.difficulty = state.new_difficulty -** Processing line: ~ change_to_scene :game~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - change_to_scene :game -** Processing line: ~ reset_game false~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - reset_game false -** Processing line: ~ state.hi_score = 0~ + +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - state.hi_score = 0 -** Processing line: ~ begin_countdown~ + $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - begin_countdown -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b~ -- Inside source: true +** Processing line: ~* Arcade - Dueling Starships - main.rb~ +- Header detected. *** True Line Result - if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b -** Processing line: ~ state.new_difficulty = state.difficulty~ -- Inside source: true + *** True Line Result - state.new_difficulty = state.difficulty -** Processing line: ~ change_to_scene :game~ +* Arcade - Dueling Starships - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/dueling_starships/app/main.rb~ - Inside source: true *** True Line Result - change_to_scene :game -** Processing line: ~ end~ + # ./samples/99_genre_arcade/dueling_starships/app/main.rb +** Processing line: ~ class DuelingSpaceships~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + class DuelingSpaceships +** Processing line: ~ attr_accessor :state, :inputs, :outputs, :grid~ - Inside source: true *** True Line Result - end + attr_accessor :state, :inputs, :outputs, :grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs_game~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - def process_inputs_game -** Processing line: ~ return unless state.scene == :game~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - return unless state.scene == :game -** Processing line: ~~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - -** Processing line: ~ clicked_menu = false~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - clicked_menu = false -** Processing line: ~ if inputs.mouse.click~ + calc +** Processing line: ~ input~ - Inside source: true *** True Line Result - if inputs.mouse.click -** Processing line: ~ p = inputs.mouse.click.point~ + input +** Processing line: ~ end~ - Inside source: true *** True Line Result - p = inputs.mouse.click.point -** Processing line: ~ clicked_menu = (p.y >= 620) && (p.x < 275)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - clicked_menu = (p.y >= 620) && (p.x < 275) -** Processing line: ~ end~ + +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def defaults +** Processing line: ~ outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start~ + outputs.background_color = [0, 0, 0] +** Processing line: ~ state.ship_blue ||= new_blue_ship~ - Inside source: true *** True Line Result - if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start -** Processing line: ~ change_to_scene :menu~ + state.ship_blue ||= new_blue_ship +** Processing line: ~ state.ship_red ||= new_red_ship~ - Inside source: true *** True Line Result - change_to_scene :menu -** Processing line: ~ elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0~ + state.ship_red ||= new_red_ship +** Processing line: ~ state.flames ||= []~ - Inside source: true *** True Line Result - elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0 -** Processing line: ~ state.dy = 0~ + state.flames ||= [] +** Processing line: ~ state.bullets ||= []~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ state.dy += state.flap_power~ + state.bullets ||= [] +** Processing line: ~ state.ship_blue_score ||= 0~ - Inside source: true *** True Line Result - state.dy += state.flap_power -** Processing line: ~ state.flapped_at = state.tick_count~ + state.ship_blue_score ||= 0 +** Processing line: ~ state.ship_red_score ||= 0~ - Inside source: true *** True Line Result - state.flapped_at = state.tick_count -** Processing line: ~ outputs.sounds << "sounds/fly-sound.wav"~ + state.ship_red_score ||= 0 +** Processing line: ~ state.stars ||= 100.map do~ - Inside source: true *** True Line Result - outputs.sounds << "sounds/fly-sound.wav" + state.stars ||= 100.map do +** Processing line: ~ [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio),~ +- Inside source: true +*** True Line Result + [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio), +** Processing line: ~ grid.h_half.randomize(:sign, :ratio)),~ +- Inside source: true +*** True Line Result + grid.h_half.randomize(:sign, :ratio)), +** Processing line: ~ 128 + 128.randomize(:ratio), 255, 255]~ +- Inside source: true +*** True Line Result + 128 + 128.randomize(:ratio), 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39253,58 +39680,58 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def scrolling_background at, path, rate, y = 0~ +** Processing line: ~ def default_ship x, y, angle, sprite_path, bullet_sprite_path, color~ - Inside source: true *** True Line Result - def scrolling_background at, path, rate, y = 0 -** Processing line: ~ [~ + def default_ship x, y, angle, sprite_path, bullet_sprite_path, color +** Processing line: ~ state.new_entity(:ship,~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ + state.new_entity(:ship, +** Processing line: ~ { x: x,~ - Inside source: true *** True Line Result - [ 0 - at.*(rate) % 1440, y, 1440, 720, path], -** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ + { x: x, +** Processing line: ~ y: y,~ - Inside source: true *** True Line Result - [1440 - at.*(rate) % 1440, y, 1440, 720, path] -** Processing line: ~ ]~ + y: y, +** Processing line: ~ dy: 0,~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + dy: 0, +** Processing line: ~ dx: 0,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + dx: 0, +** Processing line: ~ damage: 0,~ - Inside source: true *** True Line Result - -** Processing line: ~ def white~ + damage: 0, +** Processing line: ~ dead: false,~ - Inside source: true *** True Line Result - def white -** Processing line: ~ [255, 255, 255]~ + dead: false, +** Processing line: ~ angle: angle,~ - Inside source: true *** True Line Result - [255, 255, 255] -** Processing line: ~ end~ + angle: angle, +** Processing line: ~ max_alpha: 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + max_alpha: 255, +** Processing line: ~ sprite_path: sprite_path,~ - Inside source: true *** True Line Result - -** Processing line: ~ def large_white_typeset~ + sprite_path: sprite_path, +** Processing line: ~ bullet_sprite_path: bullet_sprite_path,~ - Inside source: true *** True Line Result - def large_white_typeset -** Processing line: ~ [5, 0, 255, 255, 255]~ + bullet_sprite_path: bullet_sprite_path, +** Processing line: ~ color: color })~ - Inside source: true *** True Line Result - [5, 0, 255, 255, 255] + color: color }) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39313,14 +39740,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def at_beginning?~ +** Processing line: ~ def new_red_ship~ - Inside source: true *** True Line Result - def at_beginning? -** Processing line: ~ state.walls.count == 0~ + def new_red_ship +** Processing line: ~ default_ship(400, 250.randomize(:sign, :ratio),~ - Inside source: true *** True Line Result - state.walls.count == 0 + default_ship(400, 250.randomize(:sign, :ratio), +** Processing line: ~ 180, 'sprites/ship_red.png', 'sprites/red_bullet.png',~ +- Inside source: true +*** True Line Result + 180, 'sprites/ship_red.png', 'sprites/red_bullet.png', +** Processing line: ~ [255, 90, 90])~ +- Inside source: true +*** True Line Result + [255, 90, 90]) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39329,26 +39764,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def dragon_collision_box~ -- Inside source: true -*** True Line Result - def dragon_collision_box -** Processing line: ~ state.dragon_sprite~ +** Processing line: ~ def new_blue_ship~ - Inside source: true *** True Line Result - state.dragon_sprite -** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ + def new_blue_ship +** Processing line: ~ default_ship(-400, 250.randomize(:sign, :ratio),~ - Inside source: true *** True Line Result - .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) -** Processing line: ~ .rect_shift_right(10)~ + default_ship(-400, 250.randomize(:sign, :ratio), +** Processing line: ~ 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png',~ - Inside source: true *** True Line Result - .rect_shift_right(10) -** Processing line: ~ .rect_shift_up(state.dy * 2)~ + 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png', +** Processing line: ~ [110, 140, 255])~ - Inside source: true *** True Line Result - .rect_shift_up(state.dy * 2) + [110, 140, 255]) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39357,38 +39788,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def game_over?~ -- Inside source: true -*** True Line Result - def game_over? -** Processing line: ~ return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning?~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning? -** Processing line: ~~ + def render +** Processing line: ~ render_instructions~ - Inside source: true *** True Line Result - -** Processing line: ~ state.walls~ + render_instructions +** Processing line: ~ render_score~ - Inside source: true *** True Line Result - state.walls -** Processing line: ~ .flat_map { |w| w.sprites }~ + render_score +** Processing line: ~ render_universe~ - Inside source: true *** True Line Result - .flat_map { |w| w.sprites } -** Processing line: ~ .any? do |s|~ + render_universe +** Processing line: ~ render_flames~ - Inside source: true *** True Line Result - .any? do |s| -** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ + render_flames +** Processing line: ~ render_ships~ - Inside source: true *** True Line Result - s.intersect_rect?(dragon_collision_box) -** Processing line: ~ end~ + render_ships +** Processing line: ~ render_bullets~ - Inside source: true *** True Line Result - end + render_bullets ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39397,58 +39824,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def collision_forgiveness~ +** Processing line: ~ def render_ships~ - Inside source: true *** True Line Result - def collision_forgiveness -** Processing line: ~ case state.difficulty~ + def render_ships +** Processing line: ~ update_ship_outputs(state.ship_blue)~ - Inside source: true *** True Line Result - case state.difficulty -** Processing line: ~ when :easy~ + update_ship_outputs(state.ship_blue) +** Processing line: ~ update_ship_outputs(state.ship_red)~ - Inside source: true *** True Line Result - when :easy -** Processing line: ~ 0.9~ + update_ship_outputs(state.ship_red) +** Processing line: ~ outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite]~ - Inside source: true *** True Line Result - 0.9 -** Processing line: ~ when :normal~ + outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite] +** Processing line: ~ outputs.labels << [state.ship_blue.label, state.ship_red.label]~ - Inside source: true *** True Line Result - when :normal -** Processing line: ~ 0.7~ + outputs.labels << [state.ship_blue.label, state.ship_red.label] +** Processing line: ~ end~ - Inside source: true *** True Line Result - 0.7 -** Processing line: ~ when :hard~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - when :hard -** Processing line: ~ 0.5~ + +** Processing line: ~ def render_instructions~ - Inside source: true *** True Line Result - 0.5 -** Processing line: ~ when :flappy~ + def render_instructions +** Processing line: ~ return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 ||~ - Inside source: true *** True Line Result - when :flappy -** Processing line: ~ 0.3~ + return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 || +** Processing line: ~ state.ship_red.dx > 0 || state.ship_red.dy > 0 ||~ - Inside source: true *** True Line Result - 0.3 -** Processing line: ~ else~ + state.ship_red.dx > 0 || state.ship_red.dy > 0 || +** Processing line: ~ state.flames.length > 0~ - Inside source: true *** True Line Result - else -** Processing line: ~ 0.9~ + state.flames.length > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - 0.9 -** Processing line: ~ end~ + +** Processing line: ~ outputs.labels << [grid.left.shift_right(30),~ - Inside source: true *** True Line Result - end + outputs.labels << [grid.left.shift_right(30), +** Processing line: ~ grid.bottom.shift_up(30),~ +- Inside source: true +*** True Line Result + grid.bottom.shift_up(30), +** Processing line: ~ "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.",~ +- Inside source: true +*** True Line Result + "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.", +** Processing line: ~ 0, 0, 255, 255, 255]~ +- Inside source: true +*** True Line Result + 0, 0, 255, 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39457,30 +39896,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def countdown_text~ -- Inside source: true -*** True Line Result - def countdown_text -** Processing line: ~ state.countdown ||= -1~ +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - state.countdown ||= -1 -** Processing line: ~ return "" if state.countdown == 0~ + def calc +** Processing line: ~ calc_thrusts~ - Inside source: true *** True Line Result - return "" if state.countdown == 0 -** Processing line: ~ return "GO!" if state.countdown.idiv(60) == 0~ + calc_thrusts +** Processing line: ~ calc_ships~ - Inside source: true *** True Line Result - return "GO!" if state.countdown.idiv(60) == 0 -** Processing line: ~ return "GAME OVER" if state.death_at~ + calc_ships +** Processing line: ~ calc_bullets~ - Inside source: true *** True Line Result - return "GAME OVER" if state.death_at -** Processing line: ~ return "READY?"~ + calc_bullets +** Processing line: ~ calc_winner~ - Inside source: true *** True Line Result - return "READY?" + calc_winner ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39489,14 +39924,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def begin_countdown~ +** Processing line: ~ def input~ - Inside source: true *** True Line Result - def begin_countdown -** Processing line: ~ state.countdown = 4.seconds~ + def input +** Processing line: ~ input_accelerate~ - Inside source: true *** True Line Result - state.countdown = 4.seconds + input_accelerate +** Processing line: ~ input_turn~ +- Inside source: true +*** True Line Result + input_turn +** Processing line: ~ input_bullets_and_mines~ +- Inside source: true +*** True Line Result + input_bullets_and_mines ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39505,30 +39948,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def score_text~ +** Processing line: ~ def render_score~ - Inside source: true *** True Line Result - def score_text -** Processing line: ~ return "" unless state.countdown > 1.seconds~ + def render_score +** Processing line: ~ outputs.labels << [grid.left.shift_right(80),~ - Inside source: true *** True Line Result - return "" unless state.countdown > 1.seconds -** Processing line: ~ return "" unless state.death_at~ + outputs.labels << [grid.left.shift_right(80), +** Processing line: ~ grid.top.shift_down(40),~ - Inside source: true *** True Line Result - return "" unless state.death_at -** Processing line: ~ return "SCORE: 0 (LOL)" if state.score == 0~ + grid.top.shift_down(40), +** Processing line: ~ state.ship_blue_score, 30, 1, state.ship_blue.color]~ - Inside source: true *** True Line Result - return "SCORE: 0 (LOL)" if state.score == 0 -** Processing line: ~ return "HI SCORE: #{state.score}" if state.score == state.hi_score~ + state.ship_blue_score, 30, 1, state.ship_blue.color] +** Processing line: ~~ - Inside source: true *** True Line Result - return "HI SCORE: #{state.score}" if state.score == state.hi_score -** Processing line: ~ return "SCORE: #{state.score}"~ + +** Processing line: ~ outputs.labels << [grid.right.shift_left(80),~ - Inside source: true *** True Line Result - return "SCORE: #{state.score}" + outputs.labels << [grid.right.shift_left(80), +** Processing line: ~ grid.top.shift_down(40),~ +- Inside source: true +*** True Line Result + grid.top.shift_down(40), +** Processing line: ~ state.ship_red_score, 30, 1, state.ship_red.color]~ +- Inside source: true +*** True Line Result + state.ship_red_score, 30, 1, state.ship_red.color] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39537,46 +39988,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def reset_game set_flash = true~ +** Processing line: ~ def render_universe~ - Inside source: true *** True Line Result - def reset_game set_flash = true -** Processing line: ~ state.flash_at = state.tick_count if set_flash~ + def render_universe +** Processing line: ~ return if outputs.static_solids.any?~ - Inside source: true *** True Line Result - state.flash_at = state.tick_count if set_flash -** Processing line: ~ state.walls = []~ + return if outputs.static_solids.any? +** Processing line: ~ outputs.static_solids << grid.rect~ - Inside source: true *** True Line Result - state.walls = [] -** Processing line: ~ state.y = 500~ + outputs.static_solids << grid.rect +** Processing line: ~ outputs.static_solids << state.stars~ - Inside source: true *** True Line Result - state.y = 500 -** Processing line: ~ state.dy = 0~ + outputs.static_solids << state.stars +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ state.hi_score = state.hi_score.greater(state.score)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.hi_score = state.hi_score.greater(state.score) -** Processing line: ~ state.score = 0~ + +** Processing line: ~ def apply_round_finished_alpha entity~ - Inside source: true *** True Line Result - state.score = 0 -** Processing line: ~ state.wall_countdown = state.wall_countdown_length.fdiv(2)~ + def apply_round_finished_alpha entity +** Processing line: ~ return entity unless state.round_finished_debounce~ - Inside source: true *** True Line Result - state.wall_countdown = state.wall_countdown_length.fdiv(2) -** Processing line: ~ state.show_death = false~ + return entity unless state.round_finished_debounce +** Processing line: ~ entity.a *= state.round_finished_debounce.percentage_of(2.seconds)~ - Inside source: true *** True Line Result - state.show_death = false -** Processing line: ~ state.death_at = nil~ + entity.a *= state.round_finished_debounce.percentage_of(2.seconds) +** Processing line: ~ return entity~ - Inside source: true *** True Line Result - state.death_at = nil + return entity ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39585,238 +40036,206 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def change_to_scene scene~ +** Processing line: ~ def update_ship_outputs ship, sprite_size = 66~ - Inside source: true *** True Line Result - def change_to_scene scene -** Processing line: ~ state.scene = scene~ + def update_ship_outputs ship, sprite_size = 66 +** Processing line: ~ ship.sprite =~ - Inside source: true *** True Line Result - state.scene = scene -** Processing line: ~ state.scene_at = state.tick_count~ + ship.sprite = +** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y),~ - Inside source: true *** True Line Result - state.scene_at = state.tick_count -** Processing line: ~ inputs.keyboard.clear~ + apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y), +** Processing line: ~ ship.sprite_path,~ - Inside source: true *** True Line Result - inputs.keyboard.clear -** Processing line: ~ inputs.controller_one.clear~ + ship.sprite_path, +** Processing line: ~ ship.angle,~ - Inside source: true *** True Line Result - inputs.controller_one.clear -** Processing line: ~ end~ + ship.angle, +** Processing line: ~ ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite +** Processing line: ~ ship.label =~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ship.label = +** Processing line: ~ apply_round_finished_alpha [ship.x,~ - Inside source: true *** True Line Result - -** Processing line: ~ $flappy_dragon = FlappyDragon.new~ + apply_round_finished_alpha [ship.x, +** Processing line: ~ ship.y + 100,~ - Inside source: true *** True Line Result - $flappy_dragon = FlappyDragon.new + ship.y + 100, +** Processing line: ~ "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label~ +- Inside source: true +*** True Line Result + "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def render_flames sprite_size = 6~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $flappy_dragon.grid = args.grid~ + def render_flames sprite_size = 6 +** Processing line: ~ outputs.sprites << state.flames.map do |p|~ - Inside source: true *** True Line Result - $flappy_dragon.grid = args.grid -** Processing line: ~ $flappy_dragon.inputs = args.inputs~ + outputs.sprites << state.flames.map do |p| +** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(p.x, p.y),~ - Inside source: true *** True Line Result - $flappy_dragon.inputs = args.inputs -** Processing line: ~ $flappy_dragon.state = args.state~ + apply_round_finished_alpha [sprite_size.to_square(p.x, p.y), +** Processing line: ~ 'sprites/flame.png', 0,~ - Inside source: true *** True Line Result - $flappy_dragon.state = args.state -** Processing line: ~ $flappy_dragon.outputs = args.outputs~ + 'sprites/flame.png', 0, +** Processing line: ~ p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite~ - Inside source: true *** True Line Result - $flappy_dragon.outputs = args.outputs -** Processing line: ~ $flappy_dragon.tick~ + p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - $flappy_dragon.tick -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ def render_bullets sprite_size = 10~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + def render_bullets sprite_size = 10 +** Processing line: ~ outputs.sprites << state.bullets.map do |b|~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_arcade/pong/app/main.rb~ -- Header detected. + outputs.sprites << state.bullets.map do |b| +** Processing line: ~ apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y),~ +- Inside source: true *** True Line Result - + apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y), +** Processing line: ~ b.owner.bullet_sprite_path,~ +- Inside source: true *** True Line Result -* 99_genre_arcade/pong/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ defaults args~ -- Inside source: true -*** True Line Result - defaults args -** Processing line: ~ render args~ -- Inside source: true -*** True Line Result - render args -** Processing line: ~ calc args~ + b.owner.bullet_sprite_path, +** Processing line: ~ 0, b.max_alpha].sprite~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ input args~ + 0, b.max_alpha].sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - input args -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults args~ -- Inside source: true -*** True Line Result - def defaults args -** Processing line: ~ args.state.ball.debounce ||= 3 * 60~ -- Inside source: true -*** True Line Result - args.state.ball.debounce ||= 3 * 60 -** Processing line: ~ args.state.ball.size ||= 10~ -- Inside source: true -*** True Line Result - args.state.ball.size ||= 10 -** Processing line: ~ args.state.ball.size_half ||= args.state.ball.size / 2~ -- Inside source: true -*** True Line Result - args.state.ball.size_half ||= args.state.ball.size / 2 -** Processing line: ~ args.state.ball.x ||= 640~ -- Inside source: true -*** True Line Result - args.state.ball.x ||= 640 -** Processing line: ~ args.state.ball.y ||= 360~ +** Processing line: ~ def wrap_location! location~ - Inside source: true *** True Line Result - args.state.ball.y ||= 360 -** Processing line: ~ args.state.ball.dx ||= 5.randomize(:sign)~ + def wrap_location! location +** Processing line: ~ location.x = grid.left if location.x > grid.right~ - Inside source: true *** True Line Result - args.state.ball.dx ||= 5.randomize(:sign) -** Processing line: ~ args.state.ball.dy ||= 5.randomize(:sign)~ + location.x = grid.left if location.x > grid.right +** Processing line: ~ location.x = grid.right if location.x < grid.left~ - Inside source: true *** True Line Result - args.state.ball.dy ||= 5.randomize(:sign) -** Processing line: ~ args.state.left_paddle.y ||= 360~ + location.x = grid.right if location.x < grid.left +** Processing line: ~ location.y = grid.top if location.y < grid.bottom~ - Inside source: true *** True Line Result - args.state.left_paddle.y ||= 360 -** Processing line: ~ args.state.right_paddle.y ||= 360~ + location.y = grid.top if location.y < grid.bottom +** Processing line: ~ location.y = grid.bottom if location.y > grid.top~ - Inside source: true *** True Line Result - args.state.right_paddle.y ||= 360 -** Processing line: ~ args.state.paddle.h ||= 120~ + location.y = grid.bottom if location.y > grid.top +** Processing line: ~ location~ - Inside source: true *** True Line Result - args.state.paddle.h ||= 120 -** Processing line: ~ args.state.paddle.w ||= 10~ + location +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.paddle.w ||= 10 -** Processing line: ~ args.state.left_paddle.score ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.left_paddle.score ||= 0 -** Processing line: ~ args.state.right_paddle.score ||= 0~ + +** Processing line: ~ def calc_thrusts~ - Inside source: true *** True Line Result - args.state.right_paddle.score ||= 0 -** Processing line: ~ end~ + def calc_thrusts +** Processing line: ~ state.flames =~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.flames = +** Processing line: ~ state.flames~ - Inside source: true *** True Line Result - -** Processing line: ~ def render args~ + state.flames +** Processing line: ~ .reject(&:old?)~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ render_center_line args~ + .reject(&:old?) +** Processing line: ~ .map do |p|~ - Inside source: true *** True Line Result - render_center_line args -** Processing line: ~ render_scores args~ + .map do |p| +** Processing line: ~ p.speed *= 0.9~ - Inside source: true *** True Line Result - render_scores args -** Processing line: ~ render_countdown args~ + p.speed *= 0.9 +** Processing line: ~ p.y += p.angle.vector_y(p.speed)~ - Inside source: true *** True Line Result - render_countdown args -** Processing line: ~ render_ball args~ + p.y += p.angle.vector_y(p.speed) +** Processing line: ~ p.x += p.angle.vector_x(p.speed)~ - Inside source: true *** True Line Result - render_ball args -** Processing line: ~ render_paddles args~ + p.x += p.angle.vector_x(p.speed) +** Processing line: ~ wrap_location! p~ - Inside source: true *** True Line Result - render_paddles args -** Processing line: ~ render_instructions args~ + wrap_location! p +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_instructions args -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ begin :render_methods~ -- Inside source: true -*** True Line Result - begin :render_methods -** Processing line: ~ def render_center_line args~ +** Processing line: ~ def all_ships~ - Inside source: true *** True Line Result - def render_center_line args -** Processing line: ~ args.outputs.lines << [640, 0, 640, 720]~ + def all_ships +** Processing line: ~ [state.ship_blue, state.ship_red]~ - Inside source: true *** True Line Result - args.outputs.lines << [640, 0, 640, 720] + [state.ship_blue, state.ship_red] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39825,26 +40244,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_scores args~ -- Inside source: true -*** True Line Result - def render_scores args -** Processing line: ~ args.outputs.labels << [~ -- Inside source: true -*** True Line Result - args.outputs.labels << [ -** Processing line: ~ [320, 650, args.state.left_paddle.score, 10, 1],~ -- Inside source: true -*** True Line Result - [320, 650, args.state.left_paddle.score, 10, 1], -** Processing line: ~ [960, 650, args.state.right_paddle.score, 10, 1]~ +** Processing line: ~ def alive_ships~ - Inside source: true *** True Line Result - [960, 650, args.state.right_paddle.score, 10, 1] -** Processing line: ~ ]~ + def alive_ships +** Processing line: ~ all_ships.reject { |s| s.dead }~ - Inside source: true *** True Line Result - ] + all_ships.reject { |s| s.dead } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39853,54 +40260,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_countdown args~ +** Processing line: ~ def calc_bullet bullet~ - Inside source: true *** True Line Result - def render_countdown args -** Processing line: ~ return unless args.state.ball.debounce > 0~ + def calc_bullet bullet +** Processing line: ~ bullet.y += bullet.angle.vector_y(bullet.speed)~ - Inside source: true *** True Line Result - return unless args.state.ball.debounce > 0 -** Processing line: ~ args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1]~ + bullet.y += bullet.angle.vector_y(bullet.speed) +** Processing line: ~ bullet.x += bullet.angle.vector_x(bullet.speed)~ - Inside source: true *** True Line Result - args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1] -** Processing line: ~ end~ + bullet.x += bullet.angle.vector_x(bullet.speed) +** Processing line: ~ wrap_location! bullet~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + wrap_location! bullet +** Processing line: ~ explode_bullet! bullet if bullet.old?~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_ball args~ + explode_bullet! bullet if bullet.old? +** Processing line: ~ return if bullet.exploded~ - Inside source: true *** True Line Result - def render_ball args -** Processing line: ~ args.outputs.solids << solid_ball(args)~ + return if bullet.exploded +** Processing line: ~ return if state.round_finished~ - Inside source: true *** True Line Result - args.outputs.solids << solid_ball(args) -** Processing line: ~ end~ + return if state.round_finished +** Processing line: ~ alive_ships.each do |s|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + alive_ships.each do |s| +** Processing line: ~ if s != bullet.owner &&~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_paddles args~ + if s != bullet.owner && +** Processing line: ~ s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y))~ - Inside source: true *** True Line Result - def render_paddles args -** Processing line: ~ args.outputs.solids << solid_left_paddle(args)~ + s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y)) +** Processing line: ~ explode_bullet! bullet, 10, 5, 30~ - Inside source: true *** True Line Result - args.outputs.solids << solid_left_paddle(args) -** Processing line: ~ args.outputs.solids << solid_right_paddle(args)~ + explode_bullet! bullet, 10, 5, 30 +** Processing line: ~ s.damage += 1~ - Inside source: true *** True Line Result - args.outputs.solids << solid_right_paddle(args) + s.damage += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39909,78 +40324,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_instructions args~ +** Processing line: ~ def calc_bullets~ - Inside source: true *** True Line Result - def render_instructions args -** Processing line: ~ args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1]~ + def calc_bullets +** Processing line: ~ state.bullets.each { |b| calc_bullet b }~ - Inside source: true *** True Line Result - args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1] -** Processing line: ~ args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1]~ + state.bullets.each { |b| calc_bullet b } +** Processing line: ~ state.bullets.reject! { |b| b.exploded }~ - Inside source: true *** True Line Result - args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1] + state.bullets.reject! { |b| b.exploded } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc args~ -- Inside source: true -*** True Line Result - def calc args -** Processing line: ~ args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0~ -- Inside source: true -*** True Line Result - args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0 -** Processing line: ~ calc_move_ball args~ +** Processing line: ~ def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255~ - Inside source: true *** True Line Result - calc_move_ball args -** Processing line: ~ calc_collision_with_left_paddle args~ + def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255 +** Processing line: ~ flame_count.times do~ - Inside source: true *** True Line Result - calc_collision_with_left_paddle args -** Processing line: ~ calc_collision_with_right_paddle args~ + flame_count.times do +** Processing line: ~ state.flames << state.new_entity(type,~ - Inside source: true *** True Line Result - calc_collision_with_right_paddle args -** Processing line: ~ calc_collision_with_walls args~ + state.flames << state.new_entity(type, +** Processing line: ~ { angle: 360.randomize(:ratio),~ - Inside source: true *** True Line Result - calc_collision_with_walls args -** Processing line: ~ end~ + { angle: 360.randomize(:ratio), +** Processing line: ~ speed: max_speed.randomize(:ratio),~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + speed: max_speed.randomize(:ratio), +** Processing line: ~ lifetime: lifetime,~ - Inside source: true *** True Line Result - -** Processing line: ~ begin :calc_methods~ + lifetime: lifetime, +** Processing line: ~ x: entity.x,~ - Inside source: true *** True Line Result - begin :calc_methods -** Processing line: ~ def calc_move_ball args~ + x: entity.x, +** Processing line: ~ y: entity.y,~ - Inside source: true *** True Line Result - def calc_move_ball args -** Processing line: ~ args.state.ball.x += args.state.ball.dx~ + y: entity.y, +** Processing line: ~ max_alpha: max_alpha })~ - Inside source: true *** True Line Result - args.state.ball.x += args.state.ball.dx -** Processing line: ~ args.state.ball.y += args.state.ball.dy~ + max_alpha: max_alpha }) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.ball.y += args.state.ball.dy + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -39989,34 +40392,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_collision_with_left_paddle args~ +** Processing line: ~ def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10~ - Inside source: true *** True Line Result - def calc_collision_with_left_paddle args -** Processing line: ~ if solid_left_paddle(args).intersect_rect? solid_ball(args)~ + def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10 +** Processing line: ~ bullet.exploded = true~ - Inside source: true *** True Line Result - if solid_left_paddle(args).intersect_rect? solid_ball(args) -** Processing line: ~ args.state.ball.dx *= -1~ + bullet.exploded = true +** Processing line: ~ create_explosion! :bullet_explosion,~ - Inside source: true *** True Line Result - args.state.ball.dx *= -1 -** Processing line: ~ elsif args.state.ball.x < 0~ + create_explosion! :bullet_explosion, +** Processing line: ~ bullet,~ - Inside source: true *** True Line Result - elsif args.state.ball.x < 0 -** Processing line: ~ args.state.right_paddle.score += 1~ + bullet, +** Processing line: ~ flame_override,~ - Inside source: true *** True Line Result - args.state.right_paddle.score += 1 -** Processing line: ~ calc_reset_round args~ + flame_override, +** Processing line: ~ max_speed,~ - Inside source: true *** True Line Result - calc_reset_round args -** Processing line: ~ end~ + max_speed, +** Processing line: ~ lifetime,~ - Inside source: true *** True Line Result - end + lifetime, +** Processing line: ~ bullet.max_alpha~ +- Inside source: true +*** True Line Result + bullet.max_alpha ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40025,34 +40432,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_collision_with_right_paddle args~ -- Inside source: true -*** True Line Result - def calc_collision_with_right_paddle args -** Processing line: ~ if solid_right_paddle(args).intersect_rect? solid_ball(args)~ -- Inside source: true -*** True Line Result - if solid_right_paddle(args).intersect_rect? solid_ball(args) -** Processing line: ~ args.state.ball.dx *= -1~ -- Inside source: true -*** True Line Result - args.state.ball.dx *= -1 -** Processing line: ~ elsif args.state.ball.x > 1280~ +** Processing line: ~ def calc_ship ship~ - Inside source: true *** True Line Result - elsif args.state.ball.x > 1280 -** Processing line: ~ args.state.left_paddle.score += 1~ + def calc_ship ship +** Processing line: ~ ship.x += ship.dx~ - Inside source: true *** True Line Result - args.state.left_paddle.score += 1 -** Processing line: ~ calc_reset_round args~ + ship.x += ship.dx +** Processing line: ~ ship.y += ship.dy~ - Inside source: true *** True Line Result - calc_reset_round args -** Processing line: ~ end~ + ship.y += ship.dy +** Processing line: ~ wrap_location! ship~ - Inside source: true *** True Line Result - end + wrap_location! ship ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40061,38 +40456,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_collision_with_walls args~ -- Inside source: true -*** True Line Result - def calc_collision_with_walls args -** Processing line: ~ if args.state.ball.y + args.state.ball.size_half > 720~ +** Processing line: ~ def calc_ships~ - Inside source: true *** True Line Result - if args.state.ball.y + args.state.ball.size_half > 720 -** Processing line: ~ args.state.ball.y = 720 - args.state.ball.size_half~ + def calc_ships +** Processing line: ~ all_ships.each { |s| calc_ship s }~ - Inside source: true *** True Line Result - args.state.ball.y = 720 - args.state.ball.size_half -** Processing line: ~ args.state.ball.dy *= -1~ + all_ships.each { |s| calc_ship s } +** Processing line: ~ return if all_ships.any? { |s| s.dead }~ - Inside source: true *** True Line Result - args.state.ball.dy *= -1 -** Processing line: ~ elsif args.state.ball.y - args.state.ball.size_half < 0~ + return if all_ships.any? { |s| s.dead } +** Processing line: ~ return if state.round_finished~ - Inside source: true *** True Line Result - elsif args.state.ball.y - args.state.ball.size_half < 0 -** Processing line: ~ args.state.ball.y = args.state.ball.size_half~ + return if state.round_finished +** Processing line: ~ return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite)~ - Inside source: true *** True Line Result - args.state.ball.y = args.state.ball.size_half -** Processing line: ~ args.state.ball.dy *= -1~ + return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite) +** Processing line: ~ state.ship_blue.damage = 5~ - Inside source: true *** True Line Result - args.state.ball.dy *= -1 -** Processing line: ~ end~ + state.ship_blue.damage = 5 +** Processing line: ~ state.ship_red.damage = 5~ - Inside source: true *** True Line Result - end + state.ship_red.damage = 5 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40101,86 +40492,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_reset_round args~ +** Processing line: ~ def create_thruster_flames! ship~ - Inside source: true *** True Line Result - def calc_reset_round args -** Processing line: ~ args.state.ball.x = 640~ + def create_thruster_flames! ship +** Processing line: ~ state.flames << state.new_entity(:ship_thruster,~ - Inside source: true *** True Line Result - args.state.ball.x = 640 -** Processing line: ~ args.state.ball.y = 360~ + state.flames << state.new_entity(:ship_thruster, +** Processing line: ~ { angle: ship.angle + 180 + 60.randomize(:sign, :ratio),~ - Inside source: true *** True Line Result - args.state.ball.y = 360 -** Processing line: ~ args.state.ball.dx = 5.randomize(:sign)~ + { angle: ship.angle + 180 + 60.randomize(:sign, :ratio), +** Processing line: ~ speed: 5.randomize(:ratio),~ - Inside source: true *** True Line Result - args.state.ball.dx = 5.randomize(:sign) -** Processing line: ~ args.state.ball.dy = 5.randomize(:sign)~ + speed: 5.randomize(:ratio), +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ - Inside source: true *** True Line Result - args.state.ball.dy = 5.randomize(:sign) -** Processing line: ~ args.state.ball.debounce = 3 * 60~ + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), +** Processing line: ~ lifetime: 30,~ - Inside source: true *** True Line Result - args.state.ball.debounce = 3 * 60 -** Processing line: ~ end~ + lifetime: 30, +** Processing line: ~ x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio), +** Processing line: ~ y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) })~ - Inside source: true *** True Line Result - end + y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) }) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input args~ +** Processing line: ~ def input_accelerate_ship should_move_ship, ship~ - Inside source: true *** True Line Result - def input args -** Processing line: ~ input_left_paddle args~ + def input_accelerate_ship should_move_ship, ship +** Processing line: ~ return if ship.dead~ - Inside source: true *** True Line Result - input_left_paddle args -** Processing line: ~ input_right_paddle args~ + return if ship.dead +** Processing line: ~~ - Inside source: true *** True Line Result - input_right_paddle args -** Processing line: ~ end~ + +** Processing line: ~ should_move_ship &&= (ship.dx + ship.dy).abs < 5~ - Inside source: true *** True Line Result - end + should_move_ship &&= (ship.dx + ship.dy).abs < 5 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ begin :input_methods~ +** Processing line: ~ if should_move_ship~ - Inside source: true *** True Line Result - begin :input_methods -** Processing line: ~ def input_left_paddle args~ + if should_move_ship +** Processing line: ~ create_thruster_flames! ship~ - Inside source: true *** True Line Result - def input_left_paddle args -** Processing line: ~ if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s~ + create_thruster_flames! ship +** Processing line: ~ ship.dx += ship.angle.vector_x 0.050~ - Inside source: true *** True Line Result - if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s -** Processing line: ~ args.state.left_paddle.y -= 40~ + ship.dx += ship.angle.vector_x 0.050 +** Processing line: ~ ship.dy += ship.angle.vector_y 0.050~ - Inside source: true *** True Line Result - args.state.left_paddle.y -= 40 -** Processing line: ~ elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w~ + ship.dy += ship.angle.vector_y 0.050 +** Processing line: ~ else~ - Inside source: true *** True Line Result - elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w -** Processing line: ~ args.state.left_paddle.y += 40~ + else +** Processing line: ~ ship.dx *= 0.99~ - Inside source: true *** True Line Result - args.state.left_paddle.y += 40 + ship.dx *= 0.99 +** Processing line: ~ ship.dy *= 0.99~ +- Inside source: true +*** True Line Result + ship.dy *= 0.99 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40193,54 +40592,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def input_right_paddle args~ +** Processing line: ~ def input_accelerate~ - Inside source: true *** True Line Result - def input_right_paddle args -** Processing line: ~ if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l~ + def input_accelerate +** Processing line: ~ input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue~ - Inside source: true *** True Line Result - if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l -** Processing line: ~ args.state.right_paddle.y -= 40~ + input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue +** Processing line: ~ input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red~ - Inside source: true *** True Line Result - args.state.right_paddle.y -= 40 -** Processing line: ~ elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o~ + input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o -** Processing line: ~ args.state.right_paddle.y += 40~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.right_paddle.y += 40 -** Processing line: ~ end~ + +** Processing line: ~ def input_turn_ship direction, ship~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def input_turn_ship direction, ship +** Processing line: ~ ship.angle -= 3 * direction~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ship.angle -= 3 * direction +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ begin :assets~ +** Processing line: ~ def input_turn~ - Inside source: true *** True Line Result - begin :assets -** Processing line: ~ def solid_ball args~ + def input_turn +** Processing line: ~ input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue~ - Inside source: true *** True Line Result - def solid_ball args -** Processing line: ~ centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size~ + input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue +** Processing line: ~ input_turn_ship inputs.controller_two.left_right, state.ship_red~ - Inside source: true *** True Line Result - centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size + input_turn_ship inputs.controller_two.left_right, state.ship_red ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40249,210 +40648,174 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def solid_left_paddle args~ +** Processing line: ~ def input_bullet create_bullet, ship~ - Inside source: true *** True Line Result - def solid_left_paddle args -** Processing line: ~ centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h~ + def input_bullet create_bullet, ship +** Processing line: ~ return unless create_bullet~ - Inside source: true *** True Line Result - centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h -** Processing line: ~ end~ + return unless create_bullet +** Processing line: ~ return if ship.dead~ - Inside source: true *** True Line Result - end + return if ship.dead ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def solid_right_paddle args~ +** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ - Inside source: true *** True Line Result - def solid_right_paddle args -** Processing line: ~ centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h~ + state.bullets << state.new_entity(:ship_bullet, +** Processing line: ~ { owner: ship,~ - Inside source: true *** True Line Result - centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ + { owner: ship, +** Processing line: ~ angle: ship.angle,~ - Inside source: true *** True Line Result - -** Processing line: ~ def centered_rect x, y, w, h~ + angle: ship.angle, +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ - Inside source: true *** True Line Result - def centered_rect x, y, w, h -** Processing line: ~ [x - w / 2, y - h / 2, w, h]~ + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), +** Processing line: ~ speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y),~ - Inside source: true *** True Line Result - [x - w / 2, y - h / 2, w, h] -** Processing line: ~ end~ + speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y), +** Processing line: ~ lifetime: 120,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + lifetime: 120, +** Processing line: ~ sprite_size: 10,~ - Inside source: true *** True Line Result - -** Processing line: ~ def centered_rect_vertically x, y, w, h~ + sprite_size: 10, +** Processing line: ~ x: ship.x + ship.angle.vector_x * 32,~ - Inside source: true *** True Line Result - def centered_rect_vertically x, y, w, h -** Processing line: ~ [x, y - h / 2, w, h]~ + x: ship.x + ship.angle.vector_x * 32, +** Processing line: ~ y: ship.y + ship.angle.vector_y * 32 })~ - Inside source: true *** True Line Result - [x, y - h / 2, w, h] + y: ship.y + ship.angle.vector_y * 32 }) ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_arcade/snakemoji/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_arcade/snakemoji/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ -- Inside source: true -*** True Line Result - # coding: utf-8 -** Processing line: ~ ################################~ -- Inside source: true -*** True Line Result - ################################ -** Processing line: ~ # So I was working on a snake game while~ +** Processing line: ~ def input_mine create_mine, ship~ - Inside source: true *** True Line Result - # So I was working on a snake game while -** Processing line: ~ # learning DragonRuby, and at some point I had a thought~ + def input_mine create_mine, ship +** Processing line: ~ return unless create_mine~ - Inside source: true *** True Line Result - # learning DragonRuby, and at some point I had a thought -** Processing line: ~ # what if I use "😀" as a function name, surely it wont work right...?~ + return unless create_mine +** Processing line: ~ return if ship.dead~ - Inside source: true *** True Line Result - # what if I use "😀" as a function name, surely it wont work right...? -** Processing line: ~ # RIGHT....?~ + return if ship.dead +** Processing line: ~~ - Inside source: true *** True Line Result - # RIGHT....? -** Processing line: ~ # BUT IT DID, IT WORKED~ + +** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ - Inside source: true *** True Line Result - # BUT IT DID, IT WORKED -** Processing line: ~ # it all went downhill from then~ + state.bullets << state.new_entity(:ship_bullet, +** Processing line: ~ { owner: ship,~ - Inside source: true *** True Line Result - # it all went downhill from then -** Processing line: ~ # Created by Anton K. (ai Doge)~ + { owner: ship, +** Processing line: ~ angle: 360.randomize(:sign, :ratio),~ - Inside source: true *** True Line Result - # Created by Anton K. (ai Doge) -** Processing line: ~ # https://gist.github.com/scorp200~ + angle: 360.randomize(:sign, :ratio), +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ - Inside source: true *** True Line Result - # https://gist.github.com/scorp200 -** Processing line: ~ #############LICENSE############~ + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), +** Processing line: ~ speed: 0.02,~ - Inside source: true *** True Line Result - #############LICENSE############ -** Processing line: ~ # Feel free to use this anywhere and however you want~ + speed: 0.02, +** Processing line: ~ sprite_size: 10,~ - Inside source: true *** True Line Result - # Feel free to use this anywhere and however you want -** Processing line: ~ # You can sell this to EA for $1,000,000 if you want, its completely free.~ + sprite_size: 10, +** Processing line: ~ lifetime: 600,~ - Inside source: true *** True Line Result - # You can sell this to EA for $1,000,000 if you want, its completely free. -** Processing line: ~ # Just rememeber you are helping this... thing... to spread...~ + lifetime: 600, +** Processing line: ~ x: ship.x + ship.angle.vector_x * -50,~ - Inside source: true *** True Line Result - # Just rememeber you are helping this... thing... to spread... -** Processing line: ~ # ALSO! I am not liable for any mental, physical or financial damage caused.~ + x: ship.x + ship.angle.vector_x * -50, +** Processing line: ~ y: ship.y + ship.angle.vector_y * -50 })~ - Inside source: true *** True Line Result - # ALSO! I am not liable for any mental, physical or financial damage caused. -** Processing line: ~ #############LICENSE############~ + y: ship.y + ship.angle.vector_y * -50 }) +** Processing line: ~ end~ - Inside source: true *** True Line Result - #############LICENSE############ + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ def input_bullets_and_mines~ - Inside source: true *** True Line Result - -** Processing line: ~ class Array~ + def input_bullets_and_mines +** Processing line: ~ return if state.bullets.length > 100~ - Inside source: true *** True Line Result - class Array -** Processing line: ~ #Helper function~ + return if state.bullets.length > 100 +** Processing line: ~~ - Inside source: true *** True Line Result - #Helper function -** Processing line: ~ def move! vector~ + +** Processing line: ~ [~ - Inside source: true *** True Line Result - def move! vector -** Processing line: ~ self.x += vector.x~ + [ +** Processing line: ~ [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space,~ - Inside source: true *** True Line Result - self.x += vector.x -** Processing line: ~ self.y += vector.y~ + [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space, +** Processing line: ~ inputs.controller_one.key_down.b || inputs.keyboard.key_down.down,~ - Inside source: true *** True Line Result - self.y += vector.y -** Processing line: ~ return self~ + inputs.controller_one.key_down.b || inputs.keyboard.key_down.down, +** Processing line: ~ state.ship_blue],~ - Inside source: true *** True Line Result - return self -** Processing line: ~ end~ + state.ship_blue], +** Processing line: ~ [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red] +** Processing line: ~ ].each do |a_held, b_down, ship|~ - Inside source: true *** True Line Result - -** Processing line: ~ #Helper function to draw snake body~ + ].each do |a_held, b_down, ship| +** Processing line: ~ input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship)~ - Inside source: true *** True Line Result - #Helper function to draw snake body -** Processing line: ~ def draw! 🎮, 📺, color~ + input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship) +** Processing line: ~ input_mine(b_down, ship)~ - Inside source: true *** True Line Result - def draw! 🎮, 📺, color -** Processing line: ~ translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]~ + input_mine(b_down, ship) +** Processing line: ~ end~ - Inside source: true *** True Line Result - translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color] + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -40461,602 +40824,582 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is **~ +** Processing line: ~ def calc_kill_ships~ - Inside source: true *** True Line Result - #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is ** -** Processing line: ~ #I kept trying different combinations of symbols, when suddenly...~ + def calc_kill_ships +** Processing line: ~ alive_ships.find_all { |s| s.damage >= 5 }.each do |s|~ - Inside source: true *** True Line Result - #I kept trying different combinations of symbols, when suddenly... -** Processing line: ~ def 😀 value~ + alive_ships.find_all { |s| s.damage >= 5 }.each do |s| +** Processing line: ~ s.dead = true~ - Inside source: true *** True Line Result - def 😀 value -** Processing line: ~ self.map {|d| d * value}~ + s.dead = true +** Processing line: ~ create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha~ - Inside source: true *** True Line Result - self.map {|d| d * value} -** Processing line: ~ end~ + create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Draw stuff with an offset~ -- Inside source: true -*** True Line Result - #Draw stuff with an offset -** Processing line: ~ def translate output_collection, ⛓, what~ -- Inside source: true -*** True Line Result - def translate output_collection, ⛓, what -** Processing line: ~ what.x += ⛓.x~ -- Inside source: true -*** True Line Result - what.x += ⛓.x -** Processing line: ~ what.y += ⛓.y~ +** Processing line: ~ def calc_score~ - Inside source: true *** True Line Result - what.y += ⛓.y -** Processing line: ~ output_collection << what~ + def calc_score +** Processing line: ~ return if state.round_finished~ - Inside source: true *** True Line Result - output_collection << what -** Processing line: ~ end~ + return if state.round_finished +** Processing line: ~ return if alive_ships.length > 1~ - Inside source: true *** True Line Result - end + return if alive_ships.length > 1 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ BLUE = [33, 150, 243]~ +** Processing line: ~ if alive_ships.first == state.ship_red~ - Inside source: true *** True Line Result - BLUE = [33, 150, 243] -** Processing line: ~ RED = [244, 67, 54]~ + if alive_ships.first == state.ship_red +** Processing line: ~ state.ship_red_score += 1~ - Inside source: true *** True Line Result - RED = [244, 67, 54] -** Processing line: ~ GOLD = [255, 193, 7]~ + state.ship_red_score += 1 +** Processing line: ~ elsif alive_ships.first == state.ship_blue~ - Inside source: true *** True Line Result - GOLD = [255, 193, 7] -** Processing line: ~ LAST = 0~ + elsif alive_ships.first == state.ship_blue +** Processing line: ~ state.ship_blue_score += 1~ - Inside source: true *** True Line Result - LAST = 0 + state.ship_blue_score += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ state.round_finished = true~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ defaults args.state~ + state.round_finished = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - defaults args.state -** Processing line: ~ render args.state, args.outputs~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - render args.state, args.outputs -** Processing line: ~ input args.state, args.inputs~ + +** Processing line: ~ def calc_reset_ships~ - Inside source: true *** True Line Result - input args.state, args.inputs -** Processing line: ~ update args.state~ + def calc_reset_ships +** Processing line: ~ return unless state.round_finished~ - Inside source: true *** True Line Result - update args.state -** Processing line: ~ end~ + return unless state.round_finished +** Processing line: ~ state.round_finished_debounce ||= 2.seconds~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.round_finished_debounce ||= 2.seconds +** Processing line: ~ state.round_finished_debounce -= 1~ - Inside source: true *** True Line Result - -** Processing line: ~ def update 🎮~ + state.round_finished_debounce -= 1 +** Processing line: ~ return if state.round_finished_debounce > 0~ - Inside source: true *** True Line Result - def update 🎮 -** Processing line: ~ #Update every 10 frames~ + return if state.round_finished_debounce > 0 +** Processing line: ~ start_new_round!~ - Inside source: true *** True Line Result - #Update every 10 frames -** Processing line: ~ if 🎮.tick_count.mod_zero? 10~ + start_new_round! +** Processing line: ~ end~ - Inside source: true *** True Line Result - if 🎮.tick_count.mod_zero? 10 -** Processing line: ~ #Add new snake body piece at head's location~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - #Add new snake body piece at head's location -** Processing line: ~ 🎮.🐍 << [*🎮.🤖]~ + +** Processing line: ~ def start_new_round!~ - Inside source: true *** True Line Result - 🎮.🐍 << [*🎮.🤖] -** Processing line: ~ #Assign Next Direction to Direction~ + def start_new_round! +** Processing line: ~ state.ship_blue = new_blue_ship~ - Inside source: true *** True Line Result - #Assign Next Direction to Direction -** Processing line: ~ 🎮.🚗 = *🎮.🚦~ + state.ship_blue = new_blue_ship +** Processing line: ~ state.ship_red = new_red_ship~ - Inside source: true *** True Line Result - 🎮.🚗 = *🎮.🚦 -** Processing line: ~~ + state.ship_red = new_red_ship +** Processing line: ~ state.round_finished = false~ - Inside source: true *** True Line Result - -** Processing line: ~ #Trim the snake a bit if its longer than current size~ + state.round_finished = false +** Processing line: ~ state.round_finished_debounce = nil~ - Inside source: true *** True Line Result - #Trim the snake a bit if its longer than current size -** Processing line: ~ if 🎮.🐍.length > 🎮.🛒~ + state.round_finished_debounce = nil +** Processing line: ~ state.flames.clear~ - Inside source: true *** True Line Result - if 🎮.🐍.length > 🎮.🛒 -** Processing line: ~ 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1]~ + state.flames.clear +** Processing line: ~ state.bullets.clear~ - Inside source: true *** True Line Result - 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1] -** Processing line: ~ end~ + state.bullets.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Move the head in the Direction~ -- Inside source: true -*** True Line Result - #Move the head in the Direction -** Processing line: ~ 🎮.🤖.move! 🎮.🚗~ +** Processing line: ~ def calc_winner~ - Inside source: true *** True Line Result - 🎮.🤖.move! 🎮.🚗 -** Processing line: ~~ + def calc_winner +** Processing line: ~ calc_kill_ships~ - Inside source: true *** True Line Result - -** Processing line: ~ #If Head is outside the playing field, or inside snake's body restart game~ + calc_kill_ships +** Processing line: ~ calc_score~ - Inside source: true *** True Line Result - #If Head is outside the playing field, or inside snake's body restart game -** Processing line: ~ if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖}~ + calc_score +** Processing line: ~ calc_reset_ships~ - Inside source: true *** True Line Result - if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖} -** Processing line: ~ LAST = 🎮.💰~ + calc_reset_ships +** Processing line: ~ end~ - Inside source: true *** True Line Result - LAST = 🎮.💰 -** Processing line: ~ 🎮.as_hash.clear~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - 🎮.as_hash.clear -** Processing line: ~ return~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + +** Processing line: ~ $dueling_spaceship = DuelingSpaceships.new~ - Inside source: true *** True Line Result - end + $dueling_spaceship = DuelingSpaceships.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #If head lands on food add size and score~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - #If head lands on food add size and score -** Processing line: ~ if 🎮.🤖 == 🎮.🍎~ + def tick args +** Processing line: ~ args.grid.origin_center!~ - Inside source: true *** True Line Result - if 🎮.🤖 == 🎮.🍎 -** Processing line: ~ 🎮.🛒 += 1~ + args.grid.origin_center! +** Processing line: ~ $dueling_spaceship.inputs = args.inputs~ - Inside source: true *** True Line Result - 🎮.🛒 += 1 -** Processing line: ~ 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5~ + $dueling_spaceship.inputs = args.inputs +** Processing line: ~ $dueling_spaceship.outputs = args.outputs~ - Inside source: true *** True Line Result - 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5 -** Processing line: ~ spawn_🍎 🎮~ + $dueling_spaceship.outputs = args.outputs +** Processing line: ~ $dueling_spaceship.state = args.state~ - Inside source: true *** True Line Result - spawn_🍎 🎮 -** Processing line: ~ puts 🎮.🍎~ + $dueling_spaceship.state = args.state +** Processing line: ~ $dueling_spaceship.grid = args.grid~ - Inside source: true *** True Line Result - puts 🎮.🍎 -** Processing line: ~ end~ + $dueling_spaceship.grid = args.grid +** Processing line: ~ $dueling_spaceship.tick~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + $dueling_spaceship.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Every second remove 1 point~ -- Inside source: true -*** True Line Result - #Every second remove 1 point -** Processing line: ~ if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60)~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60) -** Processing line: ~ 🎮.💰 -= 1~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - 🎮.💰 -= 1 -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~* arcade/flappy dragon/credits.txt~ +- Header detected. *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ -- Inside source: true +* arcade/flappy dragon/credits.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def spawn_🍎 🎮~ -- Inside source: true -*** True Line Result - def spawn_🍎 🎮 -** Processing line: ~ #Food~ -- Inside source: true *** True Line Result - #Food -** Processing line: ~ 🎮.🍎 ||= [*🎮.🤖]~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt~ - Inside source: true *** True Line Result - 🎮.🍎 ||= [*🎮.🤖] -** Processing line: ~ #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body~ + # ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt +** Processing line: ~ code: Amir Rajan, https://twitter.com/amirrajan~ - Inside source: true *** True Line Result - #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body -** Processing line: ~ while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do~ + code: Amir Rajan, https://twitter.com/amirrajan +** Processing line: ~ graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel~ - Inside source: true *** True Line Result - while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do -** Processing line: ~ 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)]~ + graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel +** Processing line: ~~ - Inside source: true *** True Line Result - 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)] -** Processing line: ~ end~ + +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def render 🎮, 📺~ -- Inside source: true +** Processing line: ~* arcade/flappy dragon/main.rb~ +- Header detected. *** True Line Result - def render 🎮, 📺 -** Processing line: ~ #Paint the background black~ -- Inside source: true + *** True Line Result - #Paint the background black -** Processing line: ~ 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255]~ +* arcade/flappy dragon/main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/flappy_dragon/app/main.rb~ - Inside source: true *** True Line Result - 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255] -** Processing line: ~ #Draw a border for the playing field~ + # ./samples/99_genre_arcade/flappy_dragon/app/main.rb +** Processing line: ~ class FlappyDragon~ - Inside source: true *** True Line Result - #Draw a border for the playing field -** Processing line: ~ translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255]~ + class FlappyDragon +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ - Inside source: true *** True Line Result - translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255] + attr_accessor :grid, :inputs, :state, :outputs ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Draw the snake's body~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - #Draw the snake's body -** Processing line: ~ 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end -** Processing line: ~ #Draw the head~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - #Draw the head -** Processing line: ~ 🎮.🤖.draw! 🎮, 📺, BLUE~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - 🎮.🤖.draw! 🎮, 📺, BLUE -** Processing line: ~ #Draw the food~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - #Draw the food -** Processing line: ~ 🎮.🍎.draw! 🎮, 📺, RED~ + process_inputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - 🎮.🍎.draw! 🎮, 📺, RED + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Draw current score~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - #Draw current score -** Processing line: ~ translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD]~ + def defaults +** Processing line: ~ state.flap_power = 11~ - Inside source: true *** True Line Result - translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD] -** Processing line: ~ #Draw your last score, if any~ + state.flap_power = 11 +** Processing line: ~ state.gravity = 0.9~ - Inside source: true *** True Line Result - #Draw your last score, if any -** Processing line: ~ translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0]~ + state.gravity = 0.9 +** Processing line: ~ state.ceiling = 600~ - Inside source: true *** True Line Result - translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0] -** Processing line: ~ #Draw starting message, only if Direction is 0~ + state.ceiling = 600 +** Processing line: ~ state.ceiling_flap_power = 6~ - Inside source: true *** True Line Result - #Draw starting message, only if Direction is 0 -** Processing line: ~ translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0]~ + state.ceiling_flap_power = 6 +** Processing line: ~ state.wall_countdown_length = 100~ - Inside source: true *** True Line Result - translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0] -** Processing line: ~ end~ + state.wall_countdown_length = 100 +** Processing line: ~ state.wall_gap_size = 100~ - Inside source: true *** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def input 🎮, 🕹~ + state.wall_gap_size = 100 +** Processing line: ~ state.wall_countdown ||= 0~ - Inside source: true *** True Line Result - def input 🎮, 🕹 -** Processing line: ~ #Left and Right keyboard input, only change if X direction is 0~ + state.wall_countdown ||= 0 +** Processing line: ~ state.hi_score ||= 0~ - Inside source: true *** True Line Result - #Left and Right keyboard input, only change if X direction is 0 -** Processing line: ~ if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0~ + state.hi_score ||= 0 +** Processing line: ~ state.score ||= 0~ - Inside source: true *** True Line Result - if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0 -** Processing line: ~ 🎮.🚦 = [-1, 0]~ + state.score ||= 0 +** Processing line: ~ state.walls ||= []~ - Inside source: true *** True Line Result - 🎮.🚦 = [-1, 0] -** Processing line: ~ elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0~ + state.walls ||= [] +** Processing line: ~ state.x ||= 50~ - Inside source: true *** True Line Result - elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0 -** Processing line: ~ 🎮.🚦 = [1, 0]~ + state.x ||= 50 +** Processing line: ~ state.y ||= 500~ - Inside source: true *** True Line Result - 🎮.🚦 = [1, 0] -** Processing line: ~ end~ + state.y ||= 500 +** Processing line: ~ state.dy ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.dy ||= 0 +** Processing line: ~ state.scene ||= :menu~ - Inside source: true *** True Line Result - -** Processing line: ~ #Up and Down keyboard input, only change if Y direction is 0~ + state.scene ||= :menu +** Processing line: ~ state.scene_at ||= 0~ - Inside source: true *** True Line Result - #Up and Down keyboard input, only change if Y direction is 0 -** Processing line: ~ if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0~ + state.scene_at ||= 0 +** Processing line: ~ state.difficulty ||= :normal~ - Inside source: true *** True Line Result - if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0 -** Processing line: ~ 🎮.🚦 = [0, 1]~ + state.difficulty ||= :normal +** Processing line: ~ state.new_difficulty ||= :normal~ - Inside source: true *** True Line Result - 🎮.🚦 = [0, 1] -** Processing line: ~ elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0~ + state.new_difficulty ||= :normal +** Processing line: ~ state.countdown ||= 4.seconds~ - Inside source: true *** True Line Result - elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0 -** Processing line: ~ 🎮.🚦 = [0, -1]~ + state.countdown ||= 4.seconds +** Processing line: ~ state.flash_at ||= 0~ - Inside source: true *** True Line Result - 🎮.🚦 = [0, -1] + state.flash_at ||= 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults 🎮~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - def defaults 🎮 -** Processing line: ~ #Playing field size~ + def render +** Processing line: ~ outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1~ - Inside source: true *** True Line Result - #Playing field size -** Processing line: ~ 🎮.🗺 ||= [20, 20]~ + outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1 +** Processing line: ~ render_score~ - Inside source: true *** True Line Result - 🎮.🗺 ||= [20, 20] -** Processing line: ~ #Scale for drawing, screen height / Field height~ + render_score +** Processing line: ~ render_menu~ - Inside source: true *** True Line Result - #Scale for drawing, screen height / Field height -** Processing line: ~ 🎮.⚖️ ||= 720 / 🎮.🗺.y~ + render_menu +** Processing line: ~ render_game~ - Inside source: true *** True Line Result - 🎮.⚖️ ||= 720 / 🎮.🗺.y -** Processing line: ~ #Offset, offset all rendering to the center of the screen~ + render_game +** Processing line: ~ end~ - Inside source: true *** True Line Result - #Offset, offset all rendering to the center of the screen -** Processing line: ~ 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0] -** Processing line: ~ #Padding, make the snake body slightly smaller than the scale~ + +** Processing line: ~ def render_score~ - Inside source: true *** True Line Result - #Padding, make the snake body slightly smaller than the scale -** Processing line: ~ 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i~ + def render_score +** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ - Inside source: true *** True Line Result - 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i -** Processing line: ~ #Snake Size~ + outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label +** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ - Inside source: true *** True Line Result - #Snake Size -** Processing line: ~ 🎮.🛒 ||= 3~ + outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label +** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ - Inside source: true *** True Line Result - 🎮.🛒 ||= 3 -** Processing line: ~ #Snake head, the only part we are actually controlling~ + outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - #Snake head, the only part we are actually controlling -** Processing line: ~ 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2] -** Processing line: ~ #Snake body map, follows the head~ + +** Processing line: ~ def render_menu~ - Inside source: true *** True Line Result - #Snake body map, follows the head -** Processing line: ~ 🎮.🐍 ||= []~ + def render_menu +** Processing line: ~ return unless state.scene == :menu~ - Inside source: true *** True Line Result - 🎮.🐍 ||= [] -** Processing line: ~ #Direction the head moves to~ + return unless state.scene == :menu +** Processing line: ~ render_overlay~ - Inside source: true *** True Line Result - #Direction the head moves to -** Processing line: ~ 🎮.🚗 ||= [0, 0]~ + render_overlay +** Processing line: ~~ - Inside source: true *** True Line Result - 🎮.🚗 ||= [0, 0] -** Processing line: ~ #Next_Direction, during input check only change this variable and then when game updates asign this to Direction~ + +** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - #Next_Direction, during input check only change this variable and then when game updates asign this to Direction -** Processing line: ~ 🎮.🚦 ||= [*🎮.🚗]~ + outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] +** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - 🎮.🚦 ||= [*🎮.🚗] -** Processing line: ~ #Your score~ + outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] +** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - #Your score -** Processing line: ~ 🎮.💰 ||= 0~ + outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - 🎮.💰 ||= 0 -** Processing line: ~ #Spawns Food randomly~ + outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - #Spawns Food randomly -** Processing line: ~ spawn_🍎(🎮) unless 🎮.🍎?~ + outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - spawn_🍎(🎮) unless 🎮.🍎? -** Processing line: ~ end~ + outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] +** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ - Inside source: true *** True Line Result - end + outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] +** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_arcade/solar_system/app/main.rb~ -- Header detected. + outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] +** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ +- Inside source: true *** True Line Result - + outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] +** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ +- Inside source: true *** True Line Result -* 99_genre_arcade/solar_system/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ def render_overlay~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4~ + def render_overlay +** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ - Inside source: true *** True Line Result - # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 -** Processing line: ~ # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8~ + outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults args~ +** Processing line: ~ def render_game~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + def render_game +** Processing line: ~ render_game_over~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.state.x ||= 640~ + render_game_over +** Processing line: ~ render_background~ - Inside source: true *** True Line Result - args.state.x ||= 640 -** Processing line: ~ args.state.y ||= 360~ + render_background +** Processing line: ~ render_walls~ - Inside source: true *** True Line Result - args.state.y ||= 360 -** Processing line: ~ args.state.stars ||= 100.map do~ + render_walls +** Processing line: ~ render_dragon~ - Inside source: true *** True Line Result - args.state.stars ||= 100.map do -** Processing line: ~ [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand]~ + render_dragon +** Processing line: ~ render_flash~ - Inside source: true *** True Line Result - [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand] + render_flash ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41065,18 +41408,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ +** Processing line: ~ def render_game_over~ - Inside source: true *** True Line Result - args.state.sun ||= args.state.new_entity(:sun) do |s| -** Processing line: ~ s.s = 100~ + def render_game_over +** Processing line: ~ return unless state.scene == :game~ - Inside source: true *** True Line Result - s.s = 100 -** Processing line: ~ s.path = 'sprites/sun.png'~ + return unless state.scene == :game +** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ - Inside source: true *** True Line Result - s.path = 'sprites/sun.png' + outputs.labels << [638, 358, score_text, 20, 1] +** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ +- Inside source: true +*** True Line Result + outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] +** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ +- Inside source: true +*** True Line Result + outputs.labels << [638, 428, countdown_text, 20, 1] +** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ +- Inside source: true +*** True Line Result + outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41085,74 +41440,90 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.state.planets = [~ +** Processing line: ~ def render_background~ - Inside source: true *** True Line Result - args.state.planets = [ -** Processing line: ~ [:mercury, 65, 5, 88],~ + def render_background +** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ - Inside source: true *** True Line Result - [:mercury, 65, 5, 88], -** Processing line: ~ [:venus, 100, 10, 225],~ + outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] +** Processing line: ~~ - Inside source: true *** True Line Result - [:venus, 100, 10, 225], -** Processing line: ~ [:earth, 120, 10, 365],~ + +** Processing line: ~ scroll_point_at = state.tick_count~ - Inside source: true *** True Line Result - [:earth, 120, 10, 365], -** Processing line: ~ [:mars, 140, 8, 687],~ + scroll_point_at = state.tick_count +** Processing line: ~ scroll_point_at = state.scene_at if state.scene == :menu~ - Inside source: true *** True Line Result - [:mars, 140, 8, 687], -** Processing line: ~ [:jupiter, 280, 30, 365 * 11.8],~ + scroll_point_at = state.scene_at if state.scene == :menu +** Processing line: ~ scroll_point_at = state.death_at if state.countdown > 0~ - Inside source: true *** True Line Result - [:jupiter, 280, 30, 365 * 11.8], -** Processing line: ~ [:saturn, 350, 20, 365 * 29.5],~ + scroll_point_at = state.death_at if state.countdown > 0 +** Processing line: ~ scroll_point_at ||= 0~ - Inside source: true *** True Line Result - [:saturn, 350, 20, 365 * 29.5], -** Processing line: ~ [:uranus, 400, 15, 365 * 84],~ + scroll_point_at ||= 0 +** Processing line: ~~ - Inside source: true *** True Line Result - [:uranus, 400, 15, 365 * 84], -** Processing line: ~ [:neptune, 440, 15, 365 * 164.8],~ + +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25)~ - Inside source: true *** True Line Result - [:neptune, 440, 15, 365 * 164.8], -** Processing line: ~ [:pluto, 480, 5, 365 * 247.8],~ + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25) +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50)~ - Inside source: true *** True Line Result - [:pluto, 480, 5, 365 * 247.8], -** Processing line: ~ ].map do |name, distance, size, year_in_days|~ + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50) +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80)~ - Inside source: true *** True Line Result - ].map do |name, distance, size, year_in_days| -** Processing line: ~ args.state.new_entity(name) do |p|~ + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.new_entity(name) do |p| -** Processing line: ~ p.path = "sprites/#{name}.png"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - p.path = "sprites/#{name}.png" -** Processing line: ~ p.distance = distance * 0.7~ + +** Processing line: ~ def render_walls~ - Inside source: true *** True Line Result - p.distance = distance * 0.7 -** Processing line: ~ p.s = size * 0.7~ + def render_walls +** Processing line: ~ state.walls.each do |w|~ - Inside source: true *** True Line Result - p.s = size * 0.7 -** Processing line: ~ p.year_in_days = year_in_days~ + state.walls.each do |w| +** Processing line: ~ w.sprites = [~ - Inside source: true *** True Line Result - p.year_in_days = year_in_days + w.sprites = [ +** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ +- Inside source: true +*** True Line Result + [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], +** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ +- Inside source: true +*** True Line Result + [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ outputs.sprites << state.walls.map(&:sprites)~ +- Inside source: true +*** True Line Result + outputs.sprites << state.walls.map(&:sprites) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41161,82 +41532,82 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.state.ship ||= args.state.new_entity(:ship) do |s|~ +** Processing line: ~ def render_dragon~ - Inside source: true *** True Line Result - args.state.ship ||= args.state.new_entity(:ship) do |s| -** Processing line: ~ s.x = 1280 * rand~ + def render_dragon +** Processing line: ~ state.show_death = true if state.countdown == 3.seconds~ - Inside source: true *** True Line Result - s.x = 1280 * rand -** Processing line: ~ s.y = 720 * rand~ + state.show_death = true if state.countdown == 3.seconds +** Processing line: ~~ - Inside source: true *** True Line Result - s.y = 720 * rand -** Processing line: ~ s.angle = 0~ + +** Processing line: ~ render_debug_hitbox false~ - Inside source: true *** True Line Result - s.angle = 0 -** Processing line: ~ end~ + render_debug_hitbox false +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ if state.show_death == false || !state.death_at~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if state.show_death == false || !state.death_at +** Processing line: ~ animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at~ - Inside source: true *** True Line Result - -** Processing line: ~ def to_sprite args, entity~ + animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at +** Processing line: ~ sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png"~ - Inside source: true *** True Line Result - def to_sprite args, entity -** Processing line: ~ x = 0~ + sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" +** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ - Inside source: true *** True Line Result - x = 0 -** Processing line: ~ y = 0~ + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] +** Processing line: ~ else~ - Inside source: true *** True Line Result - y = 0 -** Processing line: ~~ + else +** Processing line: ~ sprite_name = "sprites/dragon_die.png"~ - Inside source: true *** True Line Result - -** Processing line: ~ if entity.year_in_days~ + sprite_name = "sprites/dragon_die.png" +** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ - Inside source: true *** True Line Result - if entity.year_in_days -** Processing line: ~ day = args.state.tick_count~ + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] +** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ - Inside source: true *** True Line Result - day = args.state.tick_count -** Processing line: ~ day_in_year = day % entity.year_in_days~ + sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds +** Processing line: ~ state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1~ - Inside source: true *** True Line Result - day_in_year = day % entity.year_in_days -** Processing line: ~ entity.random_start_day ||= day_in_year * rand~ + state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 +** Processing line: ~ state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction~ - Inside source: true *** True Line Result - entity.random_start_day ||= day_in_year * rand -** Processing line: ~ percentage_of_year = day_in_year.fdiv(entity.year_in_days)~ + state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction +** Processing line: ~ state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6)~ - Inside source: true *** True Line Result - percentage_of_year = day_in_year.fdiv(entity.year_in_days) -** Processing line: ~ angle = 365 * percentage_of_year~ + state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6) +** Processing line: ~ end~ - Inside source: true *** True Line Result - angle = 365 * percentage_of_year -** Processing line: ~ x = angle.vector_x(entity.distance)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - x = angle.vector_x(entity.distance) -** Processing line: ~ y = angle.vector_y(entity.distance)~ + +** Processing line: ~ outputs.sprites << state.dragon_sprite~ - Inside source: true *** True Line Result - y = angle.vector_y(entity.distance) + outputs.sprites << state.dragon_sprite ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41245,94 +41616,106 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path]~ +** Processing line: ~ def render_debug_hitbox show~ - Inside source: true *** True Line Result - [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path] -** Processing line: ~ end~ + def render_debug_hitbox show +** Processing line: ~ return unless show~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return unless show +** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ - Inside source: true *** True Line Result - -** Processing line: ~ def render args~ + outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite +** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ args.outputs.solids << [0, 0, 1280, 720]~ + outputs.borders << state.walls.flat_map do |w| +** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ - Inside source: true *** True Line Result - args.outputs.solids << [0, 0, 1280, 720] -** Processing line: ~~ + w.sprites.map { |s| [s.rect, 255, 0, 0] } +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b|~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b| -** Processing line: ~ [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b] -** Processing line: ~ end~ + +** Processing line: ~ def render_flash~ - Inside source: true *** True Line Result - end + def render_flash +** Processing line: ~ return unless state.flash_at~ +- Inside source: true +*** True Line Result + return unless state.flash_at ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.sprites << to_sprite(args, args.state.sun)~ +** Processing line: ~ outputs.primitives << [grid.rect,~ - Inside source: true *** True Line Result - args.outputs.sprites << to_sprite(args, args.state.sun) -** Processing line: ~ args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p }~ + outputs.primitives << [grid.rect, +** Processing line: ~ white,~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p } -** Processing line: ~ args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle]~ + white, +** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ - Inside source: true *** True Line Result - args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle] -** Processing line: ~ end~ + 255 * state.flash_at.ease(20, :flip)].solid +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ state.flash_at = 0 if state.flash_at.elapsed_time > 20~ +- Inside source: true +*** True Line Result + state.flash_at = 0 if state.flash_at.elapsed_time > 20 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc args~ +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - def calc args -** Processing line: ~ args.state.stars = args.state.stars.map do |x, y, speed, r, g, b|~ + def calc +** Processing line: ~ return unless state.scene == :game~ - Inside source: true *** True Line Result - args.state.stars = args.state.stars.map do |x, y, speed, r, g, b| -** Processing line: ~ x += speed~ + return unless state.scene == :game +** Processing line: ~ reset_game if state.countdown == 1~ - Inside source: true *** True Line Result - x += speed -** Processing line: ~ y += speed~ + reset_game if state.countdown == 1 +** Processing line: ~ state.countdown -= 1 and return if state.countdown > 0~ - Inside source: true *** True Line Result - y += speed -** Processing line: ~ x = 0 if x > 1280~ + state.countdown -= 1 and return if state.countdown > 0 +** Processing line: ~ calc_walls~ - Inside source: true *** True Line Result - x = 0 if x > 1280 -** Processing line: ~ y = 0 if y > 720~ + calc_walls +** Processing line: ~ calc_flap~ - Inside source: true *** True Line Result - y = 0 if y > 720 -** Processing line: ~ [x, y, speed, r, g, b]~ + calc_flap +** Processing line: ~ calc_game_over~ - Inside source: true *** True Line Result - [x, y, speed, r, g, b] + calc_game_over ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41341,530 +41724,526 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ def calc_walls~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.outputs.sounds << 'sounds/bg.ogg'~ + def calc_walls +** Processing line: ~ state.walls.each { |w| w.x -= 8 }~ - Inside source: true *** True Line Result - args.outputs.sounds << 'sounds/bg.ogg' -** Processing line: ~ end~ + state.walls.each { |w| w.x -= 8 } +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ walls_count_before_removal = state.walls.length~ - Inside source: true *** True Line Result - end + walls_count_before_removal = state.walls.length ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs args~ +** Processing line: ~ state.walls.reject! { |w| w.x < -100 }~ - Inside source: true *** True Line Result - def process_inputs args -** Processing line: ~ if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left~ -- Inside source: true -*** True Line Result - if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left -** Processing line: ~ args.state.ship.angle += 1~ + state.walls.reject! { |w| w.x < -100 } +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.ship.angle += 1 -** Processing line: ~ elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right~ + +** Processing line: ~ state.score += 1 if state.walls.count < walls_count_before_removal~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right -** Processing line: ~ args.state.ship.angle -= 1~ + state.score += 1 if state.walls.count < walls_count_before_removal +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.ship.angle -= 1 -** Processing line: ~ end~ + +** Processing line: ~ state.wall_countdown -= 1 and return if state.wall_countdown > 0~ - Inside source: true *** True Line Result - end + state.wall_countdown -= 1 and return if state.wall_countdown > 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a~ +** Processing line: ~ state.walls << state.new_entity(:wall) do |w|~ - Inside source: true *** True Line Result - if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a -** Processing line: ~ args.state.ship.x += args.state.ship.angle.x_vector~ + state.walls << state.new_entity(:wall) do |w| +** Processing line: ~ w.x = grid.right~ - Inside source: true *** True Line Result - args.state.ship.x += args.state.ship.angle.x_vector -** Processing line: ~ args.state.ship.y += args.state.ship.angle.y_vector~ + w.x = grid.right +** Processing line: ~ w.opening = grid.top~ - Inside source: true *** True Line Result - args.state.ship.y += args.state.ship.angle.y_vector -** Processing line: ~ end~ + w.opening = grid.top +** Processing line: ~ .randomize(:ratio)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + .randomize(:ratio) +** Processing line: ~ .greater(200)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .greater(200) +** Processing line: ~ .lesser(520)~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + .lesser(520) +** Processing line: ~ w.bottom_height = w.opening - state.wall_gap_size~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ defaults args~ + w.bottom_height = w.opening - state.wall_gap_size +** Processing line: ~ w.top_y = w.opening + state.wall_gap_size~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render args~ + w.top_y = w.opening + state.wall_gap_size +** Processing line: ~ end~ - Inside source: true *** True Line Result - render args -** Processing line: ~ calc args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ process_inputs args~ + +** Processing line: ~ state.wall_countdown = state.wall_countdown_length~ - Inside source: true *** True Line Result - process_inputs args -** Processing line: ~ end~ + state.wall_countdown = state.wall_countdown_length +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def r~ +** Processing line: ~ def calc_flap~ - Inside source: true *** True Line Result - def r -** Processing line: ~ $gtk.reset~ + def calc_flap +** Processing line: ~ state.y += state.dy~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ end~ + state.y += state.dy +** Processing line: ~ state.dy = state.dy.lesser state.flap_power~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.dy = state.dy.lesser state.flap_power +** Processing line: ~ state.dy -= state.gravity~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_crafting/craft_game_starting_point/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_crafting/craft_game_starting_point/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + state.dy -= state.gravity +** Processing line: ~ return if state.y < state.ceiling~ +- Inside source: true *** True Line Result - + return if state.y < state.ceiling +** Processing line: ~ state.y = state.ceiling~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # ==================================================~ + state.y = state.ceiling +** Processing line: ~ state.dy = state.dy.lesser state.ceiling_flap_power~ - Inside source: true *** True Line Result - # ================================================== -** Processing line: ~ # A NOTE TO JAM CRAFT PARTICIPANTS:~ + state.dy = state.dy.lesser state.ceiling_flap_power +** Processing line: ~ end~ - Inside source: true *** True Line Result - # A NOTE TO JAM CRAFT PARTICIPANTS: -** Processing line: ~ # The comments and code in here are just as small piece of DragonRuby's capabilities.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # The comments and code in here are just as small piece of DragonRuby's capabilities. -** Processing line: ~ # Be sure to check out the rest of the sample apps. Start with README.txt and go from there!~ + +** Processing line: ~ def calc_game_over~ - Inside source: true *** True Line Result - # Be sure to check out the rest of the sample apps. Start with README.txt and go from there! -** Processing line: ~ # ==================================================~ + def calc_game_over +** Processing line: ~ return unless game_over?~ - Inside source: true *** True Line Result - # ================================================== + return unless game_over? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # def tick args is the entry point into your game. This function is called at~ -- Inside source: true -*** True Line Result - # def tick args is the entry point into your game. This function is called at -** Processing line: ~ # a fixed update time of 60hz (60 fps).~ +** Processing line: ~ state.death_at = state.tick_count~ - Inside source: true *** True Line Result - # a fixed update time of 60hz (60 fps). -** Processing line: ~ def tick args~ + state.death_at = state.tick_count +** Processing line: ~ state.death_from = state.walls.first~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # The defaults function intitializes the game.~ + state.death_from = state.walls.first +** Processing line: ~ state.death_fall_direction = -1~ - Inside source: true *** True Line Result - # The defaults function intitializes the game. -** Processing line: ~ defaults args~ + state.death_fall_direction = -1 +** Processing line: ~ state.death_fall_direction = 1 if state.x > state.death_from.x~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~~ + state.death_fall_direction = 1 if state.x > state.death_from.x +** Processing line: ~ outputs.sounds << "sounds/hit-sound.wav"~ - Inside source: true *** True Line Result - -** Processing line: ~ # After the game is initialized, render it.~ + outputs.sounds << "sounds/hit-sound.wav" +** Processing line: ~ begin_countdown~ - Inside source: true *** True Line Result - # After the game is initialized, render it. -** Processing line: ~ render args~ + begin_countdown +** Processing line: ~ end~ - Inside source: true *** True Line Result - render args + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # After rendering the player should be able to respond to input.~ +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - # After rendering the player should be able to respond to input. -** Processing line: ~ input args~ + def process_inputs +** Processing line: ~ process_inputs_menu~ - Inside source: true *** True Line Result - input args -** Processing line: ~~ + process_inputs_menu +** Processing line: ~ process_inputs_game~ - Inside source: true *** True Line Result - -** Processing line: ~ # After responding to input, the game performs any additional calculations.~ + process_inputs_game +** Processing line: ~ end~ - Inside source: true *** True Line Result - # After responding to input, the game performs any additional calculations. -** Processing line: ~ calc args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ end~ + +** Processing line: ~ def process_inputs_menu~ - Inside source: true *** True Line Result - end + def process_inputs_menu +** Processing line: ~ return unless state.scene == :menu~ +- Inside source: true +*** True Line Result + return unless state.scene == :menu ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults args~ +** Processing line: ~ changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ # hide the mouse cursor for this game, we are going to render our own cursor~ + changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select +** Processing line: ~ if inputs.mouse.click~ - Inside source: true *** True Line Result - # hide the mouse cursor for this game, we are going to render our own cursor -** Processing line: ~ if args.state.tick_count == 0~ + if inputs.mouse.click +** Processing line: ~ p = inputs.mouse.click.point~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.gtk.hide_cursor~ + p = inputs.mouse.click.point +** Processing line: ~ if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800)~ - Inside source: true *** True Line Result - args.gtk.hide_cursor -** Processing line: ~ end~ + if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800) +** Processing line: ~ changediff = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + changediff = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.click_ripples ||= []~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.click_ripples ||= [] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # everything is on a 1280x720 virtual canvas, so you can~ +** Processing line: ~ if changediff~ - Inside source: true *** True Line Result - # everything is on a 1280x720 virtual canvas, so you can -** Processing line: ~ # hardcode locations~ + if changediff +** Processing line: ~ case state.new_difficulty~ - Inside source: true *** True Line Result - # hardcode locations -** Processing line: ~~ + case state.new_difficulty +** Processing line: ~ when :easy~ - Inside source: true *** True Line Result - -** Processing line: ~ # define the borders for where the inventory is located~ + when :easy +** Processing line: ~ state.new_difficulty = :normal~ - Inside source: true *** True Line Result - # define the borders for where the inventory is located -** Processing line: ~ # args.state is a data structure that accepts any arbitrary parameters~ + state.new_difficulty = :normal +** Processing line: ~ when :normal~ - Inside source: true *** True Line Result - # args.state is a data structure that accepts any arbitrary parameters -** Processing line: ~ # so you can create an object graph without having to create any classes.~ + when :normal +** Processing line: ~ state.new_difficulty = :hard~ - Inside source: true *** True Line Result - # so you can create an object graph without having to create any classes. -** Processing line: ~~ + state.new_difficulty = :hard +** Processing line: ~ when :hard~ - Inside source: true *** True Line Result - -** Processing line: ~ # Bottom left is 0, 0. Top right is 1280, 720.~ + when :hard +** Processing line: ~ state.new_difficulty = :flappy~ - Inside source: true *** True Line Result - # Bottom left is 0, 0. Top right is 1280, 720. -** Processing line: ~ # The inventory area is at the top of the screen~ + state.new_difficulty = :flappy +** Processing line: ~ when :flappy~ - Inside source: true *** True Line Result - # The inventory area is at the top of the screen -** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ + when :flappy +** Processing line: ~ state.new_difficulty = :easy~ - Inside source: true *** True Line Result - # the number 80 is the size of all the sprites, so that is what is being -** Processing line: ~ # used to decide the with and height~ + state.new_difficulty = :easy +** Processing line: ~ end~ - Inside source: true *** True Line Result - # used to decide the with and height -** Processing line: ~ args.state.sprite_size = 80~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.sprite_size = 80 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.inventory_border.w = args.state.sprite_size * 10~ +** Processing line: ~ if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a~ - Inside source: true *** True Line Result - args.state.inventory_border.w = args.state.sprite_size * 10 -** Processing line: ~ args.state.inventory_border.h = args.state.sprite_size * 3~ + if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a +** Processing line: ~ state.difficulty = state.new_difficulty~ - Inside source: true *** True Line Result - args.state.inventory_border.h = args.state.sprite_size * 3 -** Processing line: ~ args.state.inventory_border.x = 10~ + state.difficulty = state.new_difficulty +** Processing line: ~ change_to_scene :game~ - Inside source: true *** True Line Result - args.state.inventory_border.x = 10 -** Processing line: ~ args.state.inventory_border.y = 710 - args.state.inventory_border.h~ + change_to_scene :game +** Processing line: ~ reset_game false~ - Inside source: true *** True Line Result - args.state.inventory_border.y = 710 - args.state.inventory_border.h -** Processing line: ~~ + reset_game false +** Processing line: ~ state.hi_score = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # define the borders for where the crafting area is located~ + state.hi_score = 0 +** Processing line: ~ begin_countdown~ - Inside source: true *** True Line Result - # define the borders for where the crafting area is located -** Processing line: ~ # the crafting area is below the inventory area~ + begin_countdown +** Processing line: ~ end~ - Inside source: true *** True Line Result - # the crafting area is below the inventory area -** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # the number 80 is the size of all the sprites, so that is what is being -** Processing line: ~ # used to decide the with and height~ + +** Processing line: ~ if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b~ - Inside source: true *** True Line Result - # used to decide the with and height -** Processing line: ~ args.state.craft_border.x = 10~ + if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b +** Processing line: ~ state.new_difficulty = state.difficulty~ - Inside source: true *** True Line Result - args.state.craft_border.x = 10 -** Processing line: ~ args.state.craft_border.y = 220~ + state.new_difficulty = state.difficulty +** Processing line: ~ change_to_scene :game~ - Inside source: true *** True Line Result - args.state.craft_border.y = 220 -** Processing line: ~ args.state.craft_border.w = args.state.sprite_size * 3~ + change_to_scene :game +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.craft_border.w = args.state.sprite_size * 3 -** Processing line: ~ args.state.craft_border.h = args.state.sprite_size * 3~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.craft_border.h = args.state.sprite_size * 3 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # define the area where results are located~ +** Processing line: ~ def process_inputs_game~ - Inside source: true *** True Line Result - # define the area where results are located -** Processing line: ~ # the crafting result is to the right of the craft area~ + def process_inputs_game +** Processing line: ~ return unless state.scene == :game~ - Inside source: true *** True Line Result - # the crafting result is to the right of the craft area -** Processing line: ~ args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size~ + return unless state.scene == :game +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size -** Processing line: ~ args.state.result_border.y = 220 + args.state.sprite_size~ + +** Processing line: ~ clicked_menu = false~ - Inside source: true *** True Line Result - args.state.result_border.y = 220 + args.state.sprite_size -** Processing line: ~ args.state.result_border.w = args.state.sprite_size~ + clicked_menu = false +** Processing line: ~ if inputs.mouse.click~ - Inside source: true *** True Line Result - args.state.result_border.w = args.state.sprite_size -** Processing line: ~ args.state.result_border.h = args.state.sprite_size~ + if inputs.mouse.click +** Processing line: ~ p = inputs.mouse.click.point~ - Inside source: true *** True Line Result - args.state.result_border.h = args.state.sprite_size -** Processing line: ~~ + p = inputs.mouse.click.point +** Processing line: ~ clicked_menu = (p.y >= 620) && (p.x < 275)~ - Inside source: true *** True Line Result - -** Processing line: ~ # initialize items for the first time if they are nil~ + clicked_menu = (p.y >= 620) && (p.x < 275) +** Processing line: ~ end~ - Inside source: true *** True Line Result - # initialize items for the first time if they are nil -** Processing line: ~ # you start with 15 wood, 1 chest, and 5 plank~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # you start with 15 wood, 1 chest, and 5 plank -** Processing line: ~ # Ruby has built in syntax for dictionaries (they look a lot like json objects).~ + +** Processing line: ~ if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start~ - Inside source: true *** True Line Result - # Ruby has built in syntax for dictionaries (they look a lot like json objects). -** Processing line: ~ # Ruby also has a special type called a Symbol denoted with a : followed by a word.~ + if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start +** Processing line: ~ change_to_scene :menu~ - Inside source: true *** True Line Result - # Ruby also has a special type called a Symbol denoted with a : followed by a word. -** Processing line: ~ # Symbols are nice because they remove the need for magic strings.~ + change_to_scene :menu +** Processing line: ~ elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0~ - Inside source: true *** True Line Result - # Symbols are nice because they remove the need for magic strings. -** Processing line: ~ if !args.state.items~ + elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0 +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - if !args.state.items -** Processing line: ~ args.state.items = [~ + state.dy = 0 +** Processing line: ~ state.dy += state.flap_power~ - Inside source: true *** True Line Result - args.state.items = [ -** Processing line: ~ {~ + state.dy += state.flap_power +** Processing line: ~ state.flapped_at = state.tick_count~ - Inside source: true *** True Line Result - { -** Processing line: ~ id: :wood, # :wood is a Symbol, this is better than using "wood" for the id~ + state.flapped_at = state.tick_count +** Processing line: ~ outputs.sounds << "sounds/fly-sound.wav"~ - Inside source: true *** True Line Result - id: :wood, # :wood is a Symbol, this is better than using "wood" for the id -** Processing line: ~ quantity: 15,~ + outputs.sounds << "sounds/fly-sound.wav" +** Processing line: ~ end~ - Inside source: true *** True Line Result - quantity: 15, -** Processing line: ~ path: 'sprites/wood.png',~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - path: 'sprites/wood.png', -** Processing line: ~ location: :inventory,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - location: :inventory, -** Processing line: ~ ordinal_x: 0, ordinal_y: 0~ + +** Processing line: ~ def scrolling_background at, path, rate, y = 0~ - Inside source: true *** True Line Result - ordinal_x: 0, ordinal_y: 0 -** Processing line: ~ },~ + def scrolling_background at, path, rate, y = 0 +** Processing line: ~ [~ - Inside source: true *** True Line Result - }, -** Processing line: ~ {~ + [ +** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ - Inside source: true *** True Line Result - { -** Processing line: ~ id: :chest,~ + [ 0 - at.*(rate) % 1440, y, 1440, 720, path], +** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ - Inside source: true *** True Line Result - id: :chest, -** Processing line: ~ quantity: 1,~ + [1440 - at.*(rate) % 1440, y, 1440, 720, path] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - quantity: 1, -** Processing line: ~ path: 'sprites/chest.png',~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - path: 'sprites/chest.png', -** Processing line: ~ location: :inventory,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - location: :inventory, -** Processing line: ~ ordinal_x: 1, ordinal_y: 0~ + +** Processing line: ~ def white~ - Inside source: true *** True Line Result - ordinal_x: 1, ordinal_y: 0 -** Processing line: ~ },~ + def white +** Processing line: ~ [255, 255, 255]~ - Inside source: true *** True Line Result - }, -** Processing line: ~ {~ + [255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ id: :plank,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - id: :plank, -** Processing line: ~ quantity: 5,~ + +** Processing line: ~ def large_white_typeset~ - Inside source: true *** True Line Result - quantity: 5, -** Processing line: ~ path: 'sprites/plank.png',~ + def large_white_typeset +** Processing line: ~ [5, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - path: 'sprites/plank.png', -** Processing line: ~ location: :inventory,~ + [5, 0, 255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - location: :inventory, -** Processing line: ~ ordinal_x: 2, ordinal_y: 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ordinal_x: 2, ordinal_y: 0 -** Processing line: ~ },~ + +** Processing line: ~ def at_beginning?~ - Inside source: true *** True Line Result - }, -** Processing line: ~ ]~ + def at_beginning? +** Processing line: ~ state.walls.count == 0~ - Inside source: true *** True Line Result - ] + state.walls.count == 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ +** Processing line: ~ def dragon_collision_box~ - Inside source: true *** True Line Result - # after initializing the oridinal positions, derive the pixel -** Processing line: ~ # locations assuming that the width and height are 80~ + def dragon_collision_box +** Processing line: ~ state.dragon_sprite~ - Inside source: true *** True Line Result - # locations assuming that the width and height are 80 -** Processing line: ~ args.state.items.each { |item| set_inventory_position args, item }~ + state.dragon_sprite +** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ - Inside source: true *** True Line Result - args.state.items.each { |item| set_inventory_position args, item } + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) +** Processing line: ~ .rect_shift_right(10)~ +- Inside source: true +*** True Line Result + .rect_shift_right(10) +** Processing line: ~ .rect_shift_up(state.dy * 2)~ +- Inside source: true +*** True Line Result + .rect_shift_up(state.dy * 2) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -41873,186 +42252,178 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # define all the oridinal positions of the inventory slots~ +** Processing line: ~ def game_over?~ - Inside source: true *** True Line Result - # define all the oridinal positions of the inventory slots -** Processing line: ~ if !args.state.inventory_area~ + def game_over? +** Processing line: ~ return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning?~ - Inside source: true *** True Line Result - if !args.state.inventory_area -** Processing line: ~ args.state.inventory_area = [~ + return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning? +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.inventory_area = [ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ + +** Processing line: ~ state.walls~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ + state.walls +** Processing line: ~ .flat_map { |w| w.sprites }~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ + .flat_map { |w| w.sprites } +** Processing line: ~ .any? do |s|~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ + .any? do |s| +** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ - Inside source: true *** True Line Result - { ordinal_x: 3, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ -- Inside source: true -*** True Line Result - { ordinal_x: 4, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ -- Inside source: true -*** True Line Result - { ordinal_x: 5, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ + s.intersect_rect?(dragon_collision_box) +** Processing line: ~ end~ - Inside source: true *** True Line Result - { ordinal_x: 6, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - { ordinal_x: 7, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { ordinal_x: 8, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ + +** Processing line: ~ def collision_forgiveness~ - Inside source: true *** True Line Result - { ordinal_x: 9, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ + def collision_forgiveness +** Processing line: ~ case state.difficulty~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ + case state.difficulty +** Processing line: ~ when :easy~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ + when :easy +** Processing line: ~ 0.9~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 3, ordinal_y: 1 },~ + 0.9 +** Processing line: ~ when :normal~ - Inside source: true *** True Line Result - { ordinal_x: 3, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 4, ordinal_y: 1 },~ + when :normal +** Processing line: ~ 0.7~ - Inside source: true *** True Line Result - { ordinal_x: 4, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 5, ordinal_y: 1 },~ + 0.7 +** Processing line: ~ when :hard~ - Inside source: true *** True Line Result - { ordinal_x: 5, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 6, ordinal_y: 1 },~ + when :hard +** Processing line: ~ 0.5~ - Inside source: true *** True Line Result - { ordinal_x: 6, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 7, ordinal_y: 1 },~ + 0.5 +** Processing line: ~ when :flappy~ - Inside source: true *** True Line Result - { ordinal_x: 7, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 8, ordinal_y: 1 },~ + when :flappy +** Processing line: ~ 0.3~ - Inside source: true *** True Line Result - { ordinal_x: 8, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 9, ordinal_y: 1 },~ + 0.3 +** Processing line: ~ else~ - Inside source: true *** True Line Result - { ordinal_x: 9, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ + else +** Processing line: ~ 0.9~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ + 0.9 +** Processing line: ~ end~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 3, ordinal_y: 2 },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { ordinal_x: 3, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 4, ordinal_y: 2 },~ + +** Processing line: ~ def countdown_text~ - Inside source: true *** True Line Result - { ordinal_x: 4, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 5, ordinal_y: 2 },~ + def countdown_text +** Processing line: ~ state.countdown ||= -1~ - Inside source: true *** True Line Result - { ordinal_x: 5, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 6, ordinal_y: 2 },~ + state.countdown ||= -1 +** Processing line: ~ return "" if state.countdown == 0~ - Inside source: true *** True Line Result - { ordinal_x: 6, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 7, ordinal_y: 2 },~ + return "" if state.countdown == 0 +** Processing line: ~ return "GO!" if state.countdown.idiv(60) == 0~ - Inside source: true *** True Line Result - { ordinal_x: 7, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 8, ordinal_y: 2 },~ + return "GO!" if state.countdown.idiv(60) == 0 +** Processing line: ~ return "GAME OVER" if state.death_at~ - Inside source: true *** True Line Result - { ordinal_x: 8, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 9, ordinal_y: 2 },~ + return "GAME OVER" if state.death_at +** Processing line: ~ return "READY?"~ - Inside source: true *** True Line Result - { ordinal_x: 9, ordinal_y: 2 }, -** Processing line: ~ ]~ + return "READY?" +** Processing line: ~ end~ - Inside source: true *** True Line Result - ] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ +** Processing line: ~ def begin_countdown~ - Inside source: true *** True Line Result - # after initializing the oridinal positions, derive the pixel -** Processing line: ~ # locations assuming that the width and height are 80~ + def begin_countdown +** Processing line: ~ state.countdown = 4.seconds~ - Inside source: true *** True Line Result - # locations assuming that the width and height are 80 -** Processing line: ~ args.state.inventory_area.each { |i| set_inventory_position args, i }~ + state.countdown = 4.seconds +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.inventory_area.each { |i| set_inventory_position args, i } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if you want to see the result you can use the Ruby function called "puts".~ +** Processing line: ~ def score_text~ - Inside source: true *** True Line Result - # if you want to see the result you can use the Ruby function called "puts". -** Processing line: ~ # Uncomment this line to see the value.~ + def score_text +** Processing line: ~ return "" unless state.countdown > 1.seconds~ - Inside source: true *** True Line Result - # Uncomment this line to see the value. -** Processing line: ~ # puts args.state.inventory_area~ + return "" unless state.countdown > 1.seconds +** Processing line: ~ return "" unless state.death_at~ - Inside source: true *** True Line Result - # puts args.state.inventory_area -** Processing line: ~~ + return "" unless state.death_at +** Processing line: ~ return "SCORE: 0 (LOL)" if state.score == 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt.~ + return "SCORE: 0 (LOL)" if state.score == 0 +** Processing line: ~ return "HI SCORE: #{state.score}" if state.score == state.hi_score~ - Inside source: true *** True Line Result - # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt. -** Processing line: ~ # To bring up DragonRuby's Console, press the ~ key within the game.~ + return "HI SCORE: #{state.score}" if state.score == state.hi_score +** Processing line: ~ return "SCORE: #{state.score}"~ - Inside source: true *** True Line Result - # To bring up DragonRuby's Console, press the ~ key within the game. + return "SCORE: #{state.score}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -42061,74 +42432,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # define all the oridinal positions of the craft slots~ +** Processing line: ~ def reset_game set_flash = true~ - Inside source: true *** True Line Result - # define all the oridinal positions of the craft slots -** Processing line: ~ if !args.state.craft_area~ + def reset_game set_flash = true +** Processing line: ~ state.flash_at = state.tick_count if set_flash~ - Inside source: true *** True Line Result - if !args.state.craft_area -** Processing line: ~ args.state.craft_area = [~ + state.flash_at = state.tick_count if set_flash +** Processing line: ~ state.walls = []~ - Inside source: true *** True Line Result - args.state.craft_area = [ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ + state.walls = [] +** Processing line: ~ state.y = 500~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ + state.y = 500 +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ + state.dy = 0 +** Processing line: ~ state.hi_score = state.hi_score.greater(state.score)~ - Inside source: true *** True Line Result - { ordinal_x: 0, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ + state.hi_score = state.hi_score.greater(state.score) +** Processing line: ~ state.score = 0~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ + state.score = 0 +** Processing line: ~ state.wall_countdown = state.wall_countdown_length.fdiv(2)~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ + state.wall_countdown = state.wall_countdown_length.fdiv(2) +** Processing line: ~ state.show_death = false~ - Inside source: true *** True Line Result - { ordinal_x: 1, ordinal_y: 2 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ + state.show_death = false +** Processing line: ~ state.death_at = nil~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 0 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ + state.death_at = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 1 }, -** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { ordinal_x: 2, ordinal_y: 2 }, -** Processing line: ~ ]~ + +** Processing line: ~ def change_to_scene scene~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + def change_to_scene scene +** Processing line: ~ state.scene = scene~ - Inside source: true *** True Line Result - -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ + state.scene = scene +** Processing line: ~ state.scene_at = state.tick_count~ - Inside source: true *** True Line Result - # after initializing the oridinal positions, derive the pixel -** Processing line: ~ # locations assuming that the width and height are 80~ + state.scene_at = state.tick_count +** Processing line: ~ inputs.keyboard.clear~ - Inside source: true *** True Line Result - # locations assuming that the width and height are 80 -** Processing line: ~ args.state.craft_area.each { |c| set_craft_position args, c }~ + inputs.keyboard.clear +** Processing line: ~ inputs.controller_one.clear~ - Inside source: true *** True Line Result - args.state.craft_area.each { |c| set_craft_position args, c } + inputs.controller_one.clear ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -42141,622 +42512,606 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ $flappy_dragon = FlappyDragon.new~ +- Inside source: true +*** True Line Result + $flappy_dragon = FlappyDragon.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render args~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ # for the results area, create a sprite that show its boundaries~ + def tick args +** Processing line: ~ $flappy_dragon.grid = args.grid~ - Inside source: true *** True Line Result - # for the results area, create a sprite that show its boundaries -** Processing line: ~ args.outputs.primitives << { x: args.state.result_border.x,~ + $flappy_dragon.grid = args.grid +** Processing line: ~ $flappy_dragon.inputs = args.inputs~ - Inside source: true *** True Line Result - args.outputs.primitives << { x: args.state.result_border.x, -** Processing line: ~ y: args.state.result_border.y,~ + $flappy_dragon.inputs = args.inputs +** Processing line: ~ $flappy_dragon.state = args.state~ - Inside source: true *** True Line Result - y: args.state.result_border.y, -** Processing line: ~ w: args.state.result_border.w,~ + $flappy_dragon.state = args.state +** Processing line: ~ $flappy_dragon.outputs = args.outputs~ - Inside source: true *** True Line Result - w: args.state.result_border.w, -** Processing line: ~ h: args.state.result_border.h,~ + $flappy_dragon.outputs = args.outputs +** Processing line: ~ $flappy_dragon.tick~ - Inside source: true *** True Line Result - h: args.state.result_border.h, -** Processing line: ~ path: 'sprites/border-black.png' }~ + $flappy_dragon.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - path: 'sprites/border-black.png' } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # for each inventory spot, create a sprite~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - # for each inventory spot, create a sprite -** Processing line: ~ # args.outputs.primitives is how DragonRuby performs a render.~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - # args.outputs.primitives is how DragonRuby performs a render. -** Processing line: ~ # Adding a single hash or multiple hashes to this array will tell~ -- Inside source: true + +** Processing line: ~* Arcade - Pong - main.rb~ +- Header detected. *** True Line Result - # Adding a single hash or multiple hashes to this array will tell -** Processing line: ~ # DragonRuby to render those primitives on that frame.~ + +*** True Line Result +* Arcade - Pong - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/pong/app/main.rb~ - Inside source: true *** True Line Result - # DragonRuby to render those primitives on that frame. -** Processing line: ~~ + # ./samples/99_genre_arcade/pong/app/main.rb +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - -** Processing line: ~ # The .map function on Array is used instead of any kind of looping.~ + def tick args +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - # The .map function on Array is used instead of any kind of looping. -** Processing line: ~ # .map returns a new object for every object within an Array.~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - # .map returns a new object for every object within an Array. -** Processing line: ~ args.outputs.primitives << args.state.inventory_area.map do |a|~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - args.outputs.primitives << args.state.inventory_area.map do |a| -** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ + calc args +** Processing line: ~ input args~ - Inside source: true *** True Line Result - { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } -** Processing line: ~ end~ + input args +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # for each craft spot, create a sprite~ +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - # for each craft spot, create a sprite -** Processing line: ~ args.outputs.primitives << args.state.craft_area.map do |a|~ + def defaults args +** Processing line: ~ args.state.ball.debounce ||= 3 * 60~ - Inside source: true *** True Line Result - args.outputs.primitives << args.state.craft_area.map do |a| -** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ + args.state.ball.debounce ||= 3 * 60 +** Processing line: ~ args.state.ball.size ||= 10~ - Inside source: true *** True Line Result - { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } -** Processing line: ~ end~ + args.state.ball.size ||= 10 +** Processing line: ~ args.state.ball.size_half ||= args.state.ball.size / 2~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.ball.size_half ||= args.state.ball.size / 2 +** Processing line: ~ args.state.ball.x ||= 640~ - Inside source: true *** True Line Result - -** Processing line: ~ # after the borders have been rendered, render the~ + args.state.ball.x ||= 640 +** Processing line: ~ args.state.ball.y ||= 360~ - Inside source: true *** True Line Result - # after the borders have been rendered, render the -** Processing line: ~ # items within those slots (and allow for highlighting)~ + args.state.ball.y ||= 360 +** Processing line: ~ args.state.ball.dx ||= 5.randomize(:sign)~ - Inside source: true *** True Line Result - # items within those slots (and allow for highlighting) -** Processing line: ~ # if an item isn't currently being held~ + args.state.ball.dx ||= 5.randomize(:sign) +** Processing line: ~ args.state.ball.dy ||= 5.randomize(:sign)~ - Inside source: true *** True Line Result - # if an item isn't currently being held -** Processing line: ~ allow_inventory_highlighting = !args.state.held_item~ + args.state.ball.dy ||= 5.randomize(:sign) +** Processing line: ~ args.state.left_paddle.y ||= 360~ - Inside source: true *** True Line Result - allow_inventory_highlighting = !args.state.held_item -** Processing line: ~~ + args.state.left_paddle.y ||= 360 +** Processing line: ~ args.state.right_paddle.y ||= 360~ - Inside source: true *** True Line Result - -** Processing line: ~ # go through each item and render them~ + args.state.right_paddle.y ||= 360 +** Processing line: ~ args.state.paddle.h ||= 120~ - Inside source: true *** True Line Result - # go through each item and render them -** Processing line: ~ # use Array's find_all method to remove any items that are currently being held~ + args.state.paddle.h ||= 120 +** Processing line: ~ args.state.paddle.w ||= 10~ - Inside source: true *** True Line Result - # use Array's find_all method to remove any items that are currently being held -** Processing line: ~ args.state.items.find_all { |item| item[:location] != :held }.map do |item|~ + args.state.paddle.w ||= 10 +** Processing line: ~ args.state.left_paddle.score ||= 0~ - Inside source: true *** True Line Result - args.state.items.find_all { |item| item[:location] != :held }.map do |item| -** Processing line: ~ # if an item is currently being held, don't render it in it's spot within the~ + args.state.left_paddle.score ||= 0 +** Processing line: ~ args.state.right_paddle.score ||= 0~ - Inside source: true *** True Line Result - # if an item is currently being held, don't render it in it's spot within the -** Processing line: ~ # inventory or craft area (this is handled via the find_all method).~ + args.state.right_paddle.score ||= 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # inventory or craft area (this is handled via the find_all method). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # the item_prefab returns a hash containing all the visual components of an item.~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - # the item_prefab returns a hash containing all the visual components of an item. -** Processing line: ~ # the main sprite, the black background, the quantity text, and a hover indication~ + def render args +** Processing line: ~ render_center_line args~ - Inside source: true *** True Line Result - # the main sprite, the black background, the quantity text, and a hover indication -** Processing line: ~ # if the mouse is currently hovering over the item.~ + render_center_line args +** Processing line: ~ render_scores args~ - Inside source: true *** True Line Result - # if the mouse is currently hovering over the item. -** Processing line: ~ args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse)~ + render_scores args +** Processing line: ~ render_countdown args~ - Inside source: true *** True Line Result - args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse) -** Processing line: ~ end~ + render_countdown args +** Processing line: ~ render_ball args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render_ball args +** Processing line: ~ render_paddles args~ - Inside source: true *** True Line Result - -** Processing line: ~ # The last thing we want to render is the item currently being held.~ + render_paddles args +** Processing line: ~ render_instructions args~ - Inside source: true *** True Line Result - # The last thing we want to render is the item currently being held. -** Processing line: ~ args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse)~ + render_instructions args +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.primitives << args.state.click_ripples~ -- Inside source: true -*** True Line Result - args.outputs.primitives << args.state.click_ripples -** Processing line: ~~ +** Processing line: ~ begin :render_methods~ - Inside source: true *** True Line Result - -** Processing line: ~ # render a mouse cursor since we have the OS cursor hidden~ + begin :render_methods +** Processing line: ~ def render_center_line args~ - Inside source: true *** True Line Result - # render a mouse cursor since we have the OS cursor hidden -** Processing line: ~ args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ + def render_center_line args +** Processing line: ~ args.outputs.lines << [640, 0, 640, 720]~ - Inside source: true *** True Line Result - args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } -** Processing line: ~ end~ + args.outputs.lines << [640, 0, 640, 720] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Alrighty! This is where all the fun happens~ +** Processing line: ~ def render_scores args~ - Inside source: true *** True Line Result - # Alrighty! This is where all the fun happens -** Processing line: ~ def input args~ + def render_scores args +** Processing line: ~ args.outputs.labels << [~ - Inside source: true *** True Line Result - def input args -** Processing line: ~ # if the mouse is clicked and not item is currently being held~ + args.outputs.labels << [ +** Processing line: ~ [320, 650, args.state.left_paddle.score, 10, 1],~ - Inside source: true *** True Line Result - # if the mouse is clicked and not item is currently being held -** Processing line: ~ # args.state.held_item is nil when the game starts.~ + [320, 650, args.state.left_paddle.score, 10, 1], +** Processing line: ~ [960, 650, args.state.right_paddle.score, 10, 1]~ - Inside source: true *** True Line Result - # args.state.held_item is nil when the game starts. -** Processing line: ~ # If the player clicks, the property args.inputs.mouse.click will~ + [960, 650, args.state.right_paddle.score, 10, 1] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # If the player clicks, the property args.inputs.mouse.click will -** Processing line: ~ # be a non nil value, we don't want to process any of the code here~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # be a non nil value, we don't want to process any of the code here -** Processing line: ~ # if the mouse hasn't been clicked~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # if the mouse hasn't been clicked -** Processing line: ~ return if !args.inputs.mouse.click~ + +** Processing line: ~ def render_countdown args~ - Inside source: true *** True Line Result - return if !args.inputs.mouse.click -** Processing line: ~~ + def render_countdown args +** Processing line: ~ return unless args.state.ball.debounce > 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # if a click occurred, add a ripple to the ripple queue~ + return unless args.state.ball.debounce > 0 +** Processing line: ~ args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1]~ - Inside source: true *** True Line Result - # if a click occurred, add a ripple to the ripple queue -** Processing line: ~ args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ + args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the mouse has been clicked, and no item is currently held...~ -- Inside source: true -*** True Line Result - # if the mouse has been clicked, and no item is currently held... -** Processing line: ~ if !args.state.held_item~ +** Processing line: ~ def render_ball args~ - Inside source: true *** True Line Result - if !args.state.held_item -** Processing line: ~ # see if any of the items intersect the pointer using the inside_rect? method~ + def render_ball args +** Processing line: ~ args.outputs.solids << solid_ball(args)~ - Inside source: true *** True Line Result - # see if any of the items intersect the pointer using the inside_rect? method -** Processing line: ~ # the find method will either return the first object that returns true~ + args.outputs.solids << solid_ball(args) +** Processing line: ~ end~ - Inside source: true *** True Line Result - # the find method will either return the first object that returns true -** Processing line: ~ # for the match clause, or it'll return nil if nothing matches the match clause~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # for the match clause, or it'll return nil if nothing matches the match clause -** Processing line: ~ found = args.state.items.find do |item|~ + +** Processing line: ~ def render_paddles args~ - Inside source: true *** True Line Result - found = args.state.items.find do |item| -** Processing line: ~ # for each item in args.state.items, run the following boolean check~ + def render_paddles args +** Processing line: ~ args.outputs.solids << solid_left_paddle(args)~ - Inside source: true *** True Line Result - # for each item in args.state.items, run the following boolean check -** Processing line: ~ args.inputs.mouse.click.point.inside_rect?(item)~ + args.outputs.solids << solid_left_paddle(args) +** Processing line: ~ args.outputs.solids << solid_right_paddle(args)~ - Inside source: true *** True Line Result - args.inputs.mouse.click.point.inside_rect?(item) -** Processing line: ~ end~ + args.outputs.solids << solid_right_paddle(args) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if an item intersects the mouse pointer, then set the item's location to :held and~ -- Inside source: true -*** True Line Result - # if an item intersects the mouse pointer, then set the item's location to :held and -** Processing line: ~ # set args.state.held_item to the item for later reference~ +** Processing line: ~ def render_instructions args~ - Inside source: true *** True Line Result - # set args.state.held_item to the item for later reference -** Processing line: ~ if found~ + def render_instructions args +** Processing line: ~ args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1]~ - Inside source: true *** True Line Result - if found -** Processing line: ~ args.state.held_item = found~ + args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1] +** Processing line: ~ args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1]~ - Inside source: true *** True Line Result - args.state.held_item = found -** Processing line: ~ found[:location] = :held~ + args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - found[:location] = :held -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the mouse is clicked and an item is currently beign held....~ +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - # if the mouse is clicked and an item is currently beign held.... -** Processing line: ~ elsif args.state.held_item~ + def calc args +** Processing line: ~ args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0~ - Inside source: true *** True Line Result - elsif args.state.held_item -** Processing line: ~ # determine if a slot within the craft area was clicked~ + args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0 +** Processing line: ~ calc_move_ball args~ - Inside source: true *** True Line Result - # determine if a slot within the craft area was clicked -** Processing line: ~ craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ + calc_move_ball args +** Processing line: ~ calc_collision_with_left_paddle args~ - Inside source: true *** True Line Result - craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } -** Processing line: ~~ + calc_collision_with_left_paddle args +** Processing line: ~ calc_collision_with_right_paddle args~ - Inside source: true *** True Line Result - -** Processing line: ~ # also determine if a slot within the inventory area was clicked~ + calc_collision_with_right_paddle args +** Processing line: ~ calc_collision_with_walls args~ - Inside source: true *** True Line Result - # also determine if a slot within the inventory area was clicked -** Processing line: ~ inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ + calc_collision_with_walls args +** Processing line: ~ end~ - Inside source: true *** True Line Result - inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the click was within a craft area~ -- Inside source: true -*** True Line Result - # if the click was within a craft area -** Processing line: ~ if craft_area~ +** Processing line: ~ begin :calc_methods~ - Inside source: true *** True Line Result - if craft_area -** Processing line: ~ # check to see if an item is already there and ignore the click if an item is found~ + begin :calc_methods +** Processing line: ~ def calc_move_ball args~ - Inside source: true *** True Line Result - # check to see if an item is already there and ignore the click if an item is found -** Processing line: ~ # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal~ + def calc_move_ball args +** Processing line: ~ args.state.ball.x += args.state.ball.dx~ - Inside source: true *** True Line Result - # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal -** Processing line: ~ # position~ + args.state.ball.x += args.state.ball.dx +** Processing line: ~ args.state.ball.y += args.state.ball.dy~ - Inside source: true *** True Line Result - # position -** Processing line: ~ item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y]~ + args.state.ball.y += args.state.ball.dy +** Processing line: ~ end~ - Inside source: true *** True Line Result - item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if an item *doesn't* exist in the craft area~ -- Inside source: true -*** True Line Result - # if an item *doesn't* exist in the craft area -** Processing line: ~ if !item_already_there~ +** Processing line: ~ def calc_collision_with_left_paddle args~ - Inside source: true *** True Line Result - if !item_already_there -** Processing line: ~ # if the quantity they are currently holding is greater than 1~ + def calc_collision_with_left_paddle args +** Processing line: ~ if solid_left_paddle(args).intersect_rect? solid_ball(args)~ - Inside source: true *** True Line Result - # if the quantity they are currently holding is greater than 1 -** Processing line: ~ if args.state.held_item[:quantity] > 1~ + if solid_left_paddle(args).intersect_rect? solid_ball(args) +** Processing line: ~ args.state.ball.dx *= -1~ - Inside source: true *** True Line Result - if args.state.held_item[:quantity] > 1 -** Processing line: ~ # remove one item (creating a seperate item of the same type), and place it~ + args.state.ball.dx *= -1 +** Processing line: ~ elsif args.state.ball.x < 0~ - Inside source: true *** True Line Result - # remove one item (creating a seperate item of the same type), and place it -** Processing line: ~ # at the oridinal position and location of the craft area~ + elsif args.state.ball.x < 0 +** Processing line: ~ args.state.right_paddle.score += 1~ - Inside source: true *** True Line Result - # at the oridinal position and location of the craft area -** Processing line: ~ # the .merge method on Hash creates a new Hash, but updates any values~ + args.state.right_paddle.score += 1 +** Processing line: ~ calc_reset_round args~ - Inside source: true *** True Line Result - # the .merge method on Hash creates a new Hash, but updates any values -** Processing line: ~ # passed as arguments to merge~ + calc_reset_round args +** Processing line: ~ end~ - Inside source: true *** True Line Result - # passed as arguments to merge -** Processing line: ~ new_item = args.state.held_item.merge(quantity: 1,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - new_item = args.state.held_item.merge(quantity: 1, -** Processing line: ~ location: :craft,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - location: :craft, -** Processing line: ~ ordinal_x: craft_area[:ordinal_x],~ + +** Processing line: ~ def calc_collision_with_right_paddle args~ - Inside source: true *** True Line Result - ordinal_x: craft_area[:ordinal_x], -** Processing line: ~ ordinal_y: craft_area[:ordinal_y])~ + def calc_collision_with_right_paddle args +** Processing line: ~ if solid_right_paddle(args).intersect_rect? solid_ball(args)~ - Inside source: true *** True Line Result - ordinal_y: craft_area[:ordinal_y]) -** Processing line: ~~ + if solid_right_paddle(args).intersect_rect? solid_ball(args) +** Processing line: ~ args.state.ball.dx *= -1~ - Inside source: true *** True Line Result - -** Processing line: ~ # after the item is crated, place it into the args.state.items collection~ + args.state.ball.dx *= -1 +** Processing line: ~ elsif args.state.ball.x > 1280~ - Inside source: true *** True Line Result - # after the item is crated, place it into the args.state.items collection -** Processing line: ~ args.state.items << new_item~ + elsif args.state.ball.x > 1280 +** Processing line: ~ args.state.left_paddle.score += 1~ - Inside source: true *** True Line Result - args.state.items << new_item -** Processing line: ~~ + args.state.left_paddle.score += 1 +** Processing line: ~ calc_reset_round args~ - Inside source: true *** True Line Result - -** Processing line: ~ # then subtract one from the held item~ + calc_reset_round args +** Processing line: ~ end~ - Inside source: true *** True Line Result - # then subtract one from the held item -** Processing line: ~ args.state.held_item[:quantity] -= 1~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.held_item[:quantity] -= 1 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if the craft area is available and there is only one item being held~ +** Processing line: ~ def calc_collision_with_walls args~ - Inside source: true *** True Line Result - # if the craft area is available and there is only one item being held -** Processing line: ~ elsif args.state.held_item[:quantity] == 1~ + def calc_collision_with_walls args +** Processing line: ~ if args.state.ball.y + args.state.ball.size_half > 720~ - Inside source: true *** True Line Result - elsif args.state.held_item[:quantity] == 1 -** Processing line: ~ # instead of creating any new items just set the location of the held item~ + if args.state.ball.y + args.state.ball.size_half > 720 +** Processing line: ~ args.state.ball.y = 720 - args.state.ball.size_half~ - Inside source: true *** True Line Result - # instead of creating any new items just set the location of the held item -** Processing line: ~ # to the oridinal position of the craft area, and then nil out the~ + args.state.ball.y = 720 - args.state.ball.size_half +** Processing line: ~ args.state.ball.dy *= -1~ - Inside source: true *** True Line Result - # to the oridinal position of the craft area, and then nil out the -** Processing line: ~ # held item state so that a new item can be picked up~ + args.state.ball.dy *= -1 +** Processing line: ~ elsif args.state.ball.y - args.state.ball.size_half < 0~ - Inside source: true *** True Line Result - # held item state so that a new item can be picked up -** Processing line: ~ args.state.held_item[:location] = :craft~ + elsif args.state.ball.y - args.state.ball.size_half < 0 +** Processing line: ~ args.state.ball.y = args.state.ball.size_half~ - Inside source: true *** True Line Result - args.state.held_item[:location] = :craft -** Processing line: ~ args.state.held_item[:ordinal_x] = craft_area[:ordinal_x]~ + args.state.ball.y = args.state.ball.size_half +** Processing line: ~ args.state.ball.dy *= -1~ - Inside source: true *** True Line Result - args.state.held_item[:ordinal_x] = craft_area[:ordinal_x] -** Processing line: ~ args.state.held_item[:ordinal_y] = craft_area[:ordinal_y]~ + args.state.ball.dy *= -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.held_item[:ordinal_y] = craft_area[:ordinal_y] -** Processing line: ~ args.state.held_item = nil~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.held_item = nil -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def calc_reset_round args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def calc_reset_round args +** Processing line: ~ args.state.ball.x = 640~ - Inside source: true *** True Line Result - -** Processing line: ~ # if the selected area is an inventory area (as opposed to within the craft area)~ + args.state.ball.x = 640 +** Processing line: ~ args.state.ball.y = 360~ - Inside source: true *** True Line Result - # if the selected area is an inventory area (as opposed to within the craft area) -** Processing line: ~ elsif inventory_area~ + args.state.ball.y = 360 +** Processing line: ~ args.state.ball.dx = 5.randomize(:sign)~ - Inside source: true *** True Line Result - elsif inventory_area -** Processing line: ~~ + args.state.ball.dx = 5.randomize(:sign) +** Processing line: ~ args.state.ball.dy = 5.randomize(:sign)~ - Inside source: true *** True Line Result - -** Processing line: ~ # check to see if there is already an item in that inventory slot~ + args.state.ball.dy = 5.randomize(:sign) +** Processing line: ~ args.state.ball.debounce = 3 * 60~ - Inside source: true *** True Line Result - # check to see if there is already an item in that inventory slot -** Processing line: ~ # the item_at_inventory_slot helper method returns an item or nil~ + args.state.ball.debounce = 3 * 60 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # the item_at_inventory_slot helper method returns an item or nil -** Processing line: ~ item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if there is already an item there, and the item types/id match~ -- Inside source: true -*** True Line Result - # if there is already an item there, and the item types/id match -** Processing line: ~ if item_already_there && item_already_there[:id] == args.state.held_item[:id]~ +** Processing line: ~ def input args~ - Inside source: true *** True Line Result - if item_already_there && item_already_there[:id] == args.state.held_item[:id] -** Processing line: ~ # then merge the item quantities~ + def input args +** Processing line: ~ input_left_paddle args~ - Inside source: true *** True Line Result - # then merge the item quantities -** Processing line: ~ held_quantity = args.state.held_item[:quantity]~ + input_left_paddle args +** Processing line: ~ input_right_paddle args~ - Inside source: true *** True Line Result - held_quantity = args.state.held_item[:quantity] -** Processing line: ~ item_already_there[:quantity] += held_quantity~ + input_right_paddle args +** Processing line: ~ end~ - Inside source: true *** True Line Result - item_already_there[:quantity] += held_quantity + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # remove the item being held from the items collection (since it's quantity is now 0)~ -- Inside source: true -*** True Line Result - # remove the item being held from the items collection (since it's quantity is now 0) -** Processing line: ~ args.state.items.reject! { |i| i[:location] == :held }~ +** Processing line: ~ begin :input_methods~ - Inside source: true *** True Line Result - args.state.items.reject! { |i| i[:location] == :held } -** Processing line: ~~ + begin :input_methods +** Processing line: ~ def input_left_paddle args~ - Inside source: true *** True Line Result - -** Processing line: ~ # nil out the held_item so a new item can be picked up~ + def input_left_paddle args +** Processing line: ~ if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s~ - Inside source: true *** True Line Result - # nil out the held_item so a new item can be picked up -** Processing line: ~ args.state.held_item = nil~ + if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s +** Processing line: ~ args.state.left_paddle.y -= 40~ - Inside source: true *** True Line Result - args.state.held_item = nil -** Processing line: ~~ + args.state.left_paddle.y -= 40 +** Processing line: ~ elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w~ - Inside source: true *** True Line Result - -** Processing line: ~ # if there currently isn't an item there, then put the held item in the slot~ + elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w +** Processing line: ~ args.state.left_paddle.y += 40~ - Inside source: true *** True Line Result - # if there currently isn't an item there, then put the held item in the slot -** Processing line: ~ elsif !item_already_there~ + args.state.left_paddle.y += 40 +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif !item_already_there -** Processing line: ~ args.state.held_item[:location] = :inventory~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.held_item[:location] = :inventory -** Processing line: ~ args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x] -** Processing line: ~ args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y]~ + +** Processing line: ~ def input_right_paddle args~ - Inside source: true *** True Line Result - args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y] -** Processing line: ~~ + def input_right_paddle args +** Processing line: ~ if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l~ - Inside source: true *** True Line Result - -** Processing line: ~ # nil out the held_item so a new item can be picked up~ + if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l +** Processing line: ~ args.state.right_paddle.y -= 40~ - Inside source: true *** True Line Result - # nil out the held_item so a new item can be picked up -** Processing line: ~ args.state.held_item = nil~ + args.state.right_paddle.y -= 40 +** Processing line: ~ elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o~ - Inside source: true *** True Line Result - args.state.held_item = nil -** Processing line: ~ end~ + elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o +** Processing line: ~ args.state.right_paddle.y += 40~ - Inside source: true *** True Line Result - end + args.state.right_paddle.y += 40 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -42773,74 +43128,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # the calc method is executed after input~ -- Inside source: true -*** True Line Result - # the calc method is executed after input -** Processing line: ~ def calc args~ -- Inside source: true -*** True Line Result - def calc args -** Processing line: ~ # make sure that the real position of the inventory~ +** Processing line: ~ begin :assets~ - Inside source: true *** True Line Result - # make sure that the real position of the inventory -** Processing line: ~ # items are updated every frame to ensure that they~ + begin :assets +** Processing line: ~ def solid_ball args~ - Inside source: true *** True Line Result - # items are updated every frame to ensure that they -** Processing line: ~ # are placed correctly given their location and oridinal positions~ + def solid_ball args +** Processing line: ~ centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size~ - Inside source: true *** True Line Result - # are placed correctly given their location and oridinal positions -** Processing line: ~ # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place)~ + centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size +** Processing line: ~ end~ - Inside source: true *** True Line Result - # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place) -** Processing line: ~ args.state.items.each do |item|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.items.each do |item| -** Processing line: ~ # based on the location of the item, invoke the correct pixel conversion method~ + +** Processing line: ~ def solid_left_paddle args~ - Inside source: true *** True Line Result - # based on the location of the item, invoke the correct pixel conversion method -** Processing line: ~ if item[:location] == :inventory~ + def solid_left_paddle args +** Processing line: ~ centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h~ - Inside source: true *** True Line Result - if item[:location] == :inventory -** Processing line: ~ set_inventory_position args, item~ + centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h +** Processing line: ~ end~ - Inside source: true *** True Line Result - set_inventory_position args, item -** Processing line: ~ elsif item[:location] == :craft~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif item[:location] == :craft -** Processing line: ~ set_craft_position args, item~ + +** Processing line: ~ def solid_right_paddle args~ - Inside source: true *** True Line Result - set_craft_position args, item -** Processing line: ~ elsif item[:location] == :held~ + def solid_right_paddle args +** Processing line: ~ centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h~ - Inside source: true *** True Line Result - elsif item[:location] == :held -** Processing line: ~ # if the item is held, center the item around the mouse pointer~ + centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h +** Processing line: ~ end~ - Inside source: true *** True Line Result - # if the item is held, center the item around the mouse pointer -** Processing line: ~ args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half -** Processing line: ~ args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half~ + +** Processing line: ~ def centered_rect x, y, w, h~ - Inside source: true *** True Line Result - args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half -** Processing line: ~ end~ + def centered_rect x, y, w, h +** Processing line: ~ [x - w / 2, y - h / 2, w, h]~ - Inside source: true *** True Line Result - end + [x - w / 2, y - h / 2, w, h] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -42849,174 +43196,166 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # for each hash/sprite in the click ripples queue,~ +** Processing line: ~ def centered_rect_vertically x, y, w, h~ - Inside source: true *** True Line Result - # for each hash/sprite in the click ripples queue, -** Processing line: ~ # expand its size by 20 percent and decrease its alpha~ + def centered_rect_vertically x, y, w, h +** Processing line: ~ [x, y - h / 2, w, h]~ - Inside source: true *** True Line Result - # expand its size by 20 percent and decrease its alpha -** Processing line: ~ # by 10.~ + [x, y - h / 2, w, h] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # by 10. -** Processing line: ~ args.state.click_ripples.each do |ripple|~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.click_ripples.each do |ripple| -** Processing line: ~ delta_w = ripple.w * 1.2 - ripple.w~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - delta_w = ripple.w * 1.2 - ripple.w -** Processing line: ~ delta_h = ripple.h * 1.2 - ripple.h~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - delta_h = ripple.h * 1.2 - ripple.h -** Processing line: ~ ripple.x -= delta_w.half~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - ripple.x -= delta_w.half -** Processing line: ~ ripple.y -= delta_h.half~ -- Inside source: true + +** Processing line: ~* Arcade - Snakemoji - main.rb~ +- Header detected. *** True Line Result - ripple.y -= delta_h.half -** Processing line: ~ ripple.w += delta_w~ -- Inside source: true + *** True Line Result - ripple.w += delta_w -** Processing line: ~ ripple.h += delta_h~ -- Inside source: true +* Arcade - Snakemoji - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - ripple.h += delta_h -** Processing line: ~ ripple.a -= 10~ -- Inside source: true + *** True Line Result - ripple.a -= 10 -** Processing line: ~ end~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/snakemoji/app/main.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./samples/99_genre_arcade/snakemoji/app/main.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - -** Processing line: ~ # remove any items from the collection where the alpha value is less than equal to~ + # coding: utf-8 +** Processing line: ~ ################################~ - Inside source: true *** True Line Result - # remove any items from the collection where the alpha value is less than equal to -** Processing line: ~ # zero using the reject! method (reject with an exclamation point at the end changes the~ + ################################ +** Processing line: ~ # So I was working on a snake game while~ - Inside source: true *** True Line Result - # zero using the reject! method (reject with an exclamation point at the end changes the -** Processing line: ~ # array value in place, while reject without the exclamation point returns a new array).~ + # So I was working on a snake game while +** Processing line: ~ # learning DragonRuby, and at some point I had a thought~ - Inside source: true *** True Line Result - # array value in place, while reject without the exclamation point returns a new array). -** Processing line: ~ args.state.click_ripples.reject! { |ripple| ripple.a <= 0 }~ + # learning DragonRuby, and at some point I had a thought +** Processing line: ~ # what if I use "😀" as a function name, surely it wont work right...?~ - Inside source: true *** True Line Result - args.state.click_ripples.reject! { |ripple| ripple.a <= 0 } -** Processing line: ~ end~ + # what if I use "😀" as a function name, surely it wont work right...? +** Processing line: ~ # RIGHT....?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # RIGHT....? +** Processing line: ~ # BUT IT DID, IT WORKED~ - Inside source: true *** True Line Result - -** Processing line: ~ # helper function for finding an item at a craft slot~ + # BUT IT DID, IT WORKED +** Processing line: ~ # it all went downhill from then~ - Inside source: true *** True Line Result - # helper function for finding an item at a craft slot -** Processing line: ~ def item_at_craft_slot args, ordinal_x, ordinal_y~ + # it all went downhill from then +** Processing line: ~ # Created by Anton K. (ai Doge)~ - Inside source: true *** True Line Result - def item_at_craft_slot args, ordinal_x, ordinal_y -** Processing line: ~ args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ + # Created by Anton K. (ai Doge) +** Processing line: ~ # https://gist.github.com/scorp200~ - Inside source: true *** True Line Result - args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } -** Processing line: ~ end~ + # https://gist.github.com/scorp200 +** Processing line: ~ #############LICENSE############~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + #############LICENSE############ +** Processing line: ~ # Feel free to use this anywhere and however you want~ - Inside source: true *** True Line Result - -** Processing line: ~ # helper function for finding an item at an inventory slot~ + # Feel free to use this anywhere and however you want +** Processing line: ~ # You can sell this to EA for $1,000,000 if you want, its completely free.~ - Inside source: true *** True Line Result - # helper function for finding an item at an inventory slot -** Processing line: ~ def item_at_inventory_slot args, ordinal_x, ordinal_y~ + # You can sell this to EA for $1,000,000 if you want, its completely free. +** Processing line: ~ # Just rememeber you are helping this... thing... to spread...~ - Inside source: true *** True Line Result - def item_at_inventory_slot args, ordinal_x, ordinal_y -** Processing line: ~ args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ + # Just rememeber you are helping this... thing... to spread... +** Processing line: ~ # ALSO! I am not liable for any mental, physical or financial damage caused.~ - Inside source: true *** True Line Result - args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } -** Processing line: ~ end~ + # ALSO! I am not liable for any mental, physical or financial damage caused. +** Processing line: ~ #############LICENSE############~ - Inside source: true *** True Line Result - end + #############LICENSE############ ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # helper function that creates a visual representation of an item~ -- Inside source: true -*** True Line Result - # helper function that creates a visual representation of an item -** Processing line: ~ def item_prefab args, item, should_highlight, mouse~ -- Inside source: true -*** True Line Result - def item_prefab args, item, should_highlight, mouse -** Processing line: ~ return nil unless item~ -- Inside source: true -*** True Line Result - return nil unless item ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ overlay = nil~ +** Processing line: ~ class Array~ - Inside source: true *** True Line Result - overlay = nil -** Processing line: ~~ + class Array +** Processing line: ~ #Helper function~ - Inside source: true *** True Line Result - -** Processing line: ~ x = item.x~ + #Helper function +** Processing line: ~ def move! vector~ - Inside source: true *** True Line Result - x = item.x -** Processing line: ~ y = item.y~ + def move! vector +** Processing line: ~ self.x += vector.x~ - Inside source: true *** True Line Result - y = item.y -** Processing line: ~ w = item.w~ + self.x += vector.x +** Processing line: ~ self.y += vector.y~ - Inside source: true *** True Line Result - w = item.w -** Processing line: ~ h = item.h~ + self.y += vector.y +** Processing line: ~ return self~ - Inside source: true *** True Line Result - h = item.h + return self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if should_highlight && mouse.point.inside_rect?(item)~ +** Processing line: ~ #Helper function to draw snake body~ - Inside source: true *** True Line Result - if should_highlight && mouse.point.inside_rect?(item) -** Processing line: ~ overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, }~ + #Helper function to draw snake body +** Processing line: ~ def draw! 🎮, 📺, color~ - Inside source: true *** True Line Result - overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, } + def draw! 🎮, 📺, color +** Processing line: ~ translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]~ +- Inside source: true +*** True Line Result + translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43025,94 +43364,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ [~ +** Processing line: ~ #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is **~ - Inside source: true *** True Line Result - [ -** Processing line: ~ # sprites are hashes with a path property, this is the main sprite~ + #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is ** +** Processing line: ~ #I kept trying different combinations of symbols, when suddenly...~ - Inside source: true *** True Line Result - # sprites are hashes with a path property, this is the main sprite -** Processing line: ~ { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], },~ + #I kept trying different combinations of symbols, when suddenly... +** Processing line: ~ def 😀 value~ - Inside source: true *** True Line Result - { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], }, + def 😀 value +** Processing line: ~ self.map {|d| d * value}~ +- Inside source: true +*** True Line Result + self.map {|d| d * value} +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # this represents the black area in the bottom right corner of the main sprite so that the~ +** Processing line: ~ #Draw stuff with an offset~ - Inside source: true *** True Line Result - # this represents the black area in the bottom right corner of the main sprite so that the -** Processing line: ~ # quantity is visible~ + #Draw stuff with an offset +** Processing line: ~ def translate output_collection, ⛓, what~ - Inside source: true *** True Line Result - # quantity is visible -** Processing line: ~ { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property~ + def translate output_collection, ⛓, what +** Processing line: ~ what.x += ⛓.x~ - Inside source: true *** True Line Result - { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property -** Processing line: ~~ + what.x += ⛓.x +** Processing line: ~ what.y += ⛓.y~ - Inside source: true *** True Line Result - -** Processing line: ~ # labels are hashes with a text property~ + what.y += ⛓.y +** Processing line: ~ output_collection << what~ - Inside source: true *** True Line Result - # labels are hashes with a text property -** Processing line: ~ { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, },~ + output_collection << what +** Processing line: ~ end~ - Inside source: true *** True Line Result - { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, }, + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered)~ +** Processing line: ~ BLUE = [33, 150, 243]~ - Inside source: true *** True Line Result - # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered) -** Processing line: ~ overlay~ + BLUE = [33, 150, 243] +** Processing line: ~ RED = [244, 67, 54]~ - Inside source: true *** True Line Result - overlay -** Processing line: ~ ]~ + RED = [244, 67, 54] +** Processing line: ~ GOLD = [255, 193, 7]~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + GOLD = [255, 193, 7] +** Processing line: ~ LAST = 0~ - Inside source: true *** True Line Result - end + LAST = 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # helper function for deriving the position of an item within inventory~ -- Inside source: true -*** True Line Result - # helper function for deriving the position of an item within inventory -** Processing line: ~ def set_inventory_position args, item~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - def set_inventory_position args, item -** Processing line: ~ item.x = args.state.inventory_border.x + item[:ordinal_x] * 80~ + def tick args +** Processing line: ~ defaults args.state~ - Inside source: true *** True Line Result - item.x = args.state.inventory_border.x + item[:ordinal_x] * 80 -** Processing line: ~ item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ + defaults args.state +** Processing line: ~ render args.state, args.outputs~ - Inside source: true *** True Line Result - item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 -** Processing line: ~ item.w = 80~ + render args.state, args.outputs +** Processing line: ~ input args.state, args.inputs~ - Inside source: true *** True Line Result - item.w = 80 -** Processing line: ~ item.h = 80~ + input args.state, args.inputs +** Processing line: ~ update args.state~ - Inside source: true *** True Line Result - item.h = 80 + update args.state ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43121,154 +43468,126 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # helper function for deriving the position of an item within the craft area~ +** Processing line: ~ def update 🎮~ - Inside source: true *** True Line Result - # helper function for deriving the position of an item within the craft area -** Processing line: ~ def set_craft_position args, item~ + def update 🎮 +** Processing line: ~ #Update every 10 frames~ - Inside source: true *** True Line Result - def set_craft_position args, item -** Processing line: ~ item.x = args.state.craft_border.x + item[:ordinal_x] * 80~ + #Update every 10 frames +** Processing line: ~ if 🎮.tick_count.mod_zero? 10~ - Inside source: true *** True Line Result - item.x = args.state.craft_border.x + item[:ordinal_x] * 80 -** Processing line: ~ item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ + if 🎮.tick_count.mod_zero? 10 +** Processing line: ~ #Add new snake body piece at head's location~ - Inside source: true *** True Line Result - item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 -** Processing line: ~ item.w = 80~ + #Add new snake body piece at head's location +** Processing line: ~ 🎮.🐍 << [*🎮.🤖]~ - Inside source: true *** True Line Result - item.w = 80 -** Processing line: ~ item.h = 80~ + 🎮.🐍 << [*🎮.🤖] +** Processing line: ~ #Assign Next Direction to Direction~ - Inside source: true *** True Line Result - item.h = 80 -** Processing line: ~ end~ + #Assign Next Direction to Direction +** Processing line: ~ 🎮.🚗 = *🎮.🚦~ - Inside source: true *** True Line Result - end + 🎮.🚗 = *🎮.🚦 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Any lines outside of a function will be executed when the file is reloaded.~ +** Processing line: ~ #Trim the snake a bit if its longer than current size~ - Inside source: true *** True Line Result - # Any lines outside of a function will be executed when the file is reloaded. -** Processing line: ~ # So every time you save main.rb, the game will be reset.~ + #Trim the snake a bit if its longer than current size +** Processing line: ~ if 🎮.🐍.length > 🎮.🛒~ - Inside source: true *** True Line Result - # So every time you save main.rb, the game will be reset. -** Processing line: ~ # Comment out the line below if you don't want this to happen.~ + if 🎮.🐍.length > 🎮.🛒 +** Processing line: ~ 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1]~ - Inside source: true *** True Line Result - # Comment out the line below if you don't want this to happen. -** Processing line: ~ $gtk.reset~ + 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - $gtk.reset + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_dev_tools/animation_creator_starting_point/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_dev_tools/animation_creator_starting_point/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ class OneBitLowrezPaint~ +** Processing line: ~ #Move the head in the Direction~ - Inside source: true *** True Line Result - class OneBitLowrezPaint -** Processing line: ~ attr_gtk~ + #Move the head in the Direction +** Processing line: ~ 🎮.🤖.move! 🎮.🚗~ - Inside source: true *** True Line Result - attr_gtk + 🎮.🤖.move! 🎮.🚗 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick~ -- Inside source: true -*** True Line Result - def tick -** Processing line: ~ outputs.background_color = [0, 0, 0]~ -- Inside source: true -*** True Line Result - outputs.background_color = [0, 0, 0] -** Processing line: ~ defaults~ +** Processing line: ~ #If Head is outside the playing field, or inside snake's body restart game~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render_instructions~ + #If Head is outside the playing field, or inside snake's body restart game +** Processing line: ~ if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖}~ - Inside source: true *** True Line Result - render_instructions -** Processing line: ~ render_canvas~ + if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖} +** Processing line: ~ LAST = 🎮.💰~ - Inside source: true *** True Line Result - render_canvas -** Processing line: ~ render_buttons_frame_selection~ + LAST = 🎮.💰 +** Processing line: ~ 🎮.as_hash.clear~ - Inside source: true *** True Line Result - render_buttons_frame_selection -** Processing line: ~ render_animation_frame_thumbnails~ + 🎮.as_hash.clear +** Processing line: ~ return~ - Inside source: true *** True Line Result - render_animation_frame_thumbnails -** Processing line: ~ render_animation~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_animation -** Processing line: ~ input_mouse_click~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - input_mouse_click -** Processing line: ~ input_keyboard~ + +** Processing line: ~ #If head lands on food add size and score~ - Inside source: true *** True Line Result - input_keyboard -** Processing line: ~ calc_auto_export~ + #If head lands on food add size and score +** Processing line: ~ if 🎮.🤖 == 🎮.🍎~ - Inside source: true *** True Line Result - calc_auto_export -** Processing line: ~ calc_buttons_frame_selection~ + if 🎮.🤖 == 🎮.🍎 +** Processing line: ~ 🎮.🛒 += 1~ - Inside source: true *** True Line Result - calc_buttons_frame_selection -** Processing line: ~ calc_animation_frames~ + 🎮.🛒 += 1 +** Processing line: ~ 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5~ - Inside source: true *** True Line Result - calc_animation_frames -** Processing line: ~ process_queue_create_sprite~ + 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5 +** Processing line: ~ spawn_🍎 🎮~ - Inside source: true *** True Line Result - process_queue_create_sprite -** Processing line: ~ process_queue_reset_sprite~ + spawn_🍎 🎮 +** Processing line: ~ puts 🎮.🍎~ - Inside source: true *** True Line Result - process_queue_reset_sprite -** Processing line: ~ process_queue_update_rt_animation_frame~ + puts 🎮.🍎 +** Processing line: ~ end~ - Inside source: true *** True Line Result - process_queue_update_rt_animation_frame + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43277,382 +43596,394 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def defaults~ +** Processing line: ~ #Every second remove 1 point~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.animation_frames_per_second = 12~ + #Every second remove 1 point +** Processing line: ~ if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60)~ - Inside source: true *** True Line Result - state.animation_frames_per_second = 12 -** Processing line: ~ queues.create_sprite ||= []~ + if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60) +** Processing line: ~ 🎮.💰 -= 1~ - Inside source: true *** True Line Result - queues.create_sprite ||= [] -** Processing line: ~ queues.reset_sprite ||= []~ + 🎮.💰 -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - queues.reset_sprite ||= [] -** Processing line: ~ queues.update_rt_animation_frame ||= []~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame ||= [] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !state.animation_frames~ +** Processing line: ~ def spawn_🍎 🎮~ - Inside source: true *** True Line Result - if !state.animation_frames -** Processing line: ~ state.animation_frames ||= []~ + def spawn_🍎 🎮 +** Processing line: ~ #Food~ - Inside source: true *** True Line Result - state.animation_frames ||= [] -** Processing line: ~ add_animation_frame_to_end~ + #Food +** Processing line: ~ 🎮.🍎 ||= [*🎮.🤖]~ - Inside source: true *** True Line Result - add_animation_frame_to_end -** Processing line: ~ end~ + 🎮.🍎 ||= [*🎮.🤖] +** Processing line: ~ #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body +** Processing line: ~ while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do~ - Inside source: true *** True Line Result - -** Processing line: ~ state.last_mouse_down ||= 0~ + while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do +** Processing line: ~ 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)]~ - Inside source: true *** True Line Result - state.last_mouse_down ||= 0 -** Processing line: ~ state.last_mouse_up ||= 0~ + 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.last_mouse_up ||= 0 + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.buttons_frame_selection.left = 10~ +** Processing line: ~ def render 🎮, 📺~ - Inside source: true *** True Line Result - state.buttons_frame_selection.left = 10 -** Processing line: ~ state.buttons_frame_selection.top = grid.top - 10~ + def render 🎮, 📺 +** Processing line: ~ #Paint the background black~ - Inside source: true *** True Line Result - state.buttons_frame_selection.top = grid.top - 10 -** Processing line: ~ state.buttons_frame_selection.size = 20~ + #Paint the background black +** Processing line: ~ 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - state.buttons_frame_selection.size = 20 -** Processing line: ~~ + 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255] +** Processing line: ~ #Draw a border for the playing field~ - Inside source: true *** True Line Result - -** Processing line: ~ defaults_canvas_sprite~ + #Draw a border for the playing field +** Processing line: ~ translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255]~ - Inside source: true *** True Line Result - defaults_canvas_sprite + translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.edit_mode ||= :drawing~ -- Inside source: true -*** True Line Result - state.edit_mode ||= :drawing -** Processing line: ~ end~ +** Processing line: ~ #Draw the snake's body~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + #Draw the snake's body +** Processing line: ~ 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults_canvas_sprite~ + 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end +** Processing line: ~ #Draw the head~ - Inside source: true *** True Line Result - def defaults_canvas_sprite -** Processing line: ~ rt_canvas.size = 16~ + #Draw the head +** Processing line: ~ 🎮.🤖.draw! 🎮, 📺, BLUE~ - Inside source: true *** True Line Result - rt_canvas.size = 16 -** Processing line: ~ rt_canvas.zoom = 30~ + 🎮.🤖.draw! 🎮, 📺, BLUE +** Processing line: ~ #Draw the food~ - Inside source: true *** True Line Result - rt_canvas.zoom = 30 -** Processing line: ~ rt_canvas.width = rt_canvas.size * rt_canvas.zoom~ + #Draw the food +** Processing line: ~ 🎮.🍎.draw! 🎮, 📺, RED~ - Inside source: true *** True Line Result - rt_canvas.width = rt_canvas.size * rt_canvas.zoom -** Processing line: ~ rt_canvas.height = rt_canvas.size * rt_canvas.zoom~ + 🎮.🍎.draw! 🎮, 📺, RED +** Processing line: ~~ - Inside source: true *** True Line Result - rt_canvas.height = rt_canvas.size * rt_canvas.zoom -** Processing line: ~ rt_canvas.sprite = { x: 0,~ + +** Processing line: ~ #Draw current score~ - Inside source: true *** True Line Result - rt_canvas.sprite = { x: 0, -** Processing line: ~ y: 0,~ + #Draw current score +** Processing line: ~ translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD]~ - Inside source: true *** True Line Result - y: 0, -** Processing line: ~ w: rt_canvas.width,~ + translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD] +** Processing line: ~ #Draw your last score, if any~ - Inside source: true *** True Line Result - w: rt_canvas.width, -** Processing line: ~ h: rt_canvas.height,~ + #Draw your last score, if any +** Processing line: ~ translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0]~ - Inside source: true *** True Line Result - h: rt_canvas.height, -** Processing line: ~ path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720)~ + translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0] +** Processing line: ~ #Draw starting message, only if Direction is 0~ - Inside source: true *** True Line Result - path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720) -** Processing line: ~~ + #Draw starting message, only if Direction is 0 +** Processing line: ~ translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless state.tick_count == 1~ + translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - return unless state.tick_count == 1 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs[:rt_canvas].width = rt_canvas.width~ -- Inside source: true -*** True Line Result - outputs[:rt_canvas].width = rt_canvas.width -** Processing line: ~ outputs[:rt_canvas].height = rt_canvas.height~ +** Processing line: ~ def input 🎮, 🕹~ - Inside source: true *** True Line Result - outputs[:rt_canvas].height = rt_canvas.height -** Processing line: ~ outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x|~ + def input 🎮, 🕹 +** Processing line: ~ #Left and Right keyboard input, only change if X direction is 0~ - Inside source: true *** True Line Result - outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x| -** Processing line: ~ (rt_canvas.size + 1).map_with_index do |y|~ + #Left and Right keyboard input, only change if X direction is 0 +** Processing line: ~ if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0~ - Inside source: true *** True Line Result - (rt_canvas.size + 1).map_with_index do |y| -** Processing line: ~ path = 'sprites/square-white.png'~ + if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0 +** Processing line: ~ 🎮.🚦 = [-1, 0]~ - Inside source: true *** True Line Result - path = 'sprites/square-white.png' -** Processing line: ~ path = 'sprites/square-blue.png' if x == 7 || x == 8~ + 🎮.🚦 = [-1, 0] +** Processing line: ~ elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0~ - Inside source: true *** True Line Result - path = 'sprites/square-blue.png' if x == 7 || x == 8 -** Processing line: ~ { x: x * rt_canvas.zoom,~ + elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0 +** Processing line: ~ 🎮.🚦 = [1, 0]~ - Inside source: true *** True Line Result - { x: x * rt_canvas.zoom, -** Processing line: ~ y: y * rt_canvas.zoom,~ + 🎮.🚦 = [1, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: y * rt_canvas.zoom, -** Processing line: ~ w: rt_canvas.zoom,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - w: rt_canvas.zoom, -** Processing line: ~ h: rt_canvas.zoom,~ + +** Processing line: ~ #Up and Down keyboard input, only change if Y direction is 0~ - Inside source: true *** True Line Result - h: rt_canvas.zoom, -** Processing line: ~ path: path,~ + #Up and Down keyboard input, only change if Y direction is 0 +** Processing line: ~ if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0~ - Inside source: true *** True Line Result - path: path, -** Processing line: ~ a: 50 }~ + if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0 +** Processing line: ~ 🎮.🚦 = [0, 1]~ - Inside source: true *** True Line Result - a: 50 } -** Processing line: ~ end~ + 🎮.🚦 = [0, 1] +** Processing line: ~ elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0 +** Processing line: ~ 🎮.🚦 = [0, -1]~ - Inside source: true *** True Line Result - end + 🎮.🚦 = [0, -1] ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_instructions~ +** Processing line: ~ def defaults 🎮~ - Inside source: true *** True Line Result - def render_instructions -** Processing line: ~ instructions = <<-S~ + def defaults 🎮 +** Processing line: ~ #Playing field size~ - Inside source: true *** True Line Result - instructions = <<-S -** Processing line: ~ * Instructions:~ + #Playing field size +** Processing line: ~ 🎮.🗺 ||= [20, 20]~ - Inside source: true *** True Line Result - * Instructions: -** Processing line: ~ - All data is stored in the ~canvas~ directory.~ + 🎮.🗺 ||= [20, 20] +** Processing line: ~ #Scale for drawing, screen height / Field height~ - Inside source: true *** True Line Result - - All data is stored in the ~canvas~ directory. -** Processing line: ~ - Hold ~d~ to set the edit mode to erase.~ + #Scale for drawing, screen height / Field height +** Processing line: ~ 🎮.⚖️ ||= 720 / 🎮.🗺.y~ - Inside source: true *** True Line Result - - Hold ~d~ to set the edit mode to erase. -** Processing line: ~ - Release ~d~ to set the edit mode drawing.~ + 🎮.⚖️ ||= 720 / 🎮.🗺.y +** Processing line: ~ #Offset, offset all rendering to the center of the screen~ - Inside source: true *** True Line Result - - Release ~d~ to set the edit mode drawing. -** Processing line: ~ - Press ~a~ to added a frame to the end.~ + #Offset, offset all rendering to the center of the screen +** Processing line: ~ 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0]~ - Inside source: true *** True Line Result - - Press ~a~ to added a frame to the end. -** Processing line: ~ - Press ~b~ to select the previous frame.~ + 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0] +** Processing line: ~ #Padding, make the snake body slightly smaller than the scale~ - Inside source: true *** True Line Result - - Press ~b~ to select the previous frame. -** Processing line: ~ - Press ~f~ to select the next frame.~ + #Padding, make the snake body slightly smaller than the scale +** Processing line: ~ 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i~ - Inside source: true *** True Line Result - - Press ~f~ to select the next frame. -** Processing line: ~ - Press ~c~ to copy a frame.~ + 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i +** Processing line: ~ #Snake Size~ - Inside source: true *** True Line Result - - Press ~c~ to copy a frame. -** Processing line: ~ - Press ~v~ to paste a copied frame into the selected frame.~ + #Snake Size +** Processing line: ~ 🎮.🛒 ||= 3~ - Inside source: true *** True Line Result - - Press ~v~ to paste a copied frame into the selected frame. -** Processing line: ~ - Press ~x~ to delete the currently selected frame.~ + 🎮.🛒 ||= 3 +** Processing line: ~ #Snake head, the only part we are actually controlling~ - Inside source: true *** True Line Result - - Press ~x~ to delete the currently selected frame. -** Processing line: ~ - Press ~w~ to save the canvas and export all sprites.~ + #Snake head, the only part we are actually controlling +** Processing line: ~ 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2]~ - Inside source: true *** True Line Result - - Press ~w~ to save the canvas and export all sprites. -** Processing line: ~ - Press ~l~ to load the canvas.~ + 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2] +** Processing line: ~ #Snake body map, follows the head~ - Inside source: true *** True Line Result - - Press ~l~ to load the canvas. -** Processing line: ~ S~ + #Snake body map, follows the head +** Processing line: ~ 🎮.🐍 ||= []~ - Inside source: true *** True Line Result - S -** Processing line: ~~ + 🎮.🐍 ||= [] +** Processing line: ~ #Direction the head moves to~ - Inside source: true *** True Line Result - -** Processing line: ~ instructions.strip.each_line.with_index do |l, i|~ + #Direction the head moves to +** Processing line: ~ 🎮.🚗 ||= [0, 0]~ - Inside source: true *** True Line Result - instructions.strip.each_line.with_index do |l, i| -** Processing line: ~ outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}",~ + 🎮.🚗 ||= [0, 0] +** Processing line: ~ #Next_Direction, during input check only change this variable and then when game updates asign this to Direction~ - Inside source: true *** True Line Result - outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}", -** Processing line: ~ r: 180, g: 180, b: 180, size_enum: -3 }~ + #Next_Direction, during input check only change this variable and then when game updates asign this to Direction +** Processing line: ~ 🎮.🚦 ||= [*🎮.🚗]~ - Inside source: true *** True Line Result - r: 180, g: 180, b: 180, size_enum: -3 } -** Processing line: ~ end~ + 🎮.🚦 ||= [*🎮.🚗] +** Processing line: ~ #Your score~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + #Your score +** Processing line: ~ 🎮.💰 ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 🎮.💰 ||= 0 +** Processing line: ~ #Spawns Food randomly~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_canvas~ + #Spawns Food randomly +** Processing line: ~ spawn_🍎(🎮) unless 🎮.🍎?~ - Inside source: true *** True Line Result - def render_canvas -** Processing line: ~ return if state.tick_count.zero?~ + spawn_🍎(🎮) unless 🎮.🍎? +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if state.tick_count.zero? -** Processing line: ~ outputs.sprites << rt_canvas.sprite~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.sprites << rt_canvas.sprite -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def render_buttons_frame_selection~ -- Inside source: true +** Processing line: ~* Arcade - Solar System - main.rb~ +- Header detected. *** True Line Result - def render_buttons_frame_selection -** Processing line: ~ args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i|~ -- Inside source: true + *** True Line Result - args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i| -** Processing line: ~ label = { x: b.x + state.buttons_frame_selection.size.half,~ -- Inside source: true +* Arcade - Solar System - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - label = { x: b.x + state.buttons_frame_selection.size.half, -** Processing line: ~ y: b.y,~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_arcade/solar_system/app/main.rb~ - Inside source: true *** True Line Result - y: b.y, -** Processing line: ~ text: "#{i + 1}", r: 180, g: 180, b: 180,~ + # ./samples/99_genre_arcade/solar_system/app/main.rb +** Processing line: ~ # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4~ - Inside source: true *** True Line Result - text: "#{i + 1}", r: 180, g: 180, b: 180, -** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ + # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 +** Processing line: ~ # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8~ - Inside source: true *** True Line Result - size_enum: -4, alignment_enum: 1 }.label + # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - selection_border = b.merge(r: 40, g: 40, b: 40).border -** Processing line: ~~ + def defaults args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - -** Processing line: ~ if i == state.animation_frames_selected_index~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.state.x ||= 640~ - Inside source: true *** True Line Result - if i == state.animation_frames_selected_index -** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ + args.state.x ||= 640 +** Processing line: ~ args.state.y ||= 360~ - Inside source: true *** True Line Result - selection_border = b.merge(r: 40, g: 230, b: 200).border -** Processing line: ~ end~ + args.state.y ||= 360 +** Processing line: ~ args.state.stars ||= 100.map do~ - Inside source: true *** True Line Result - end + args.state.stars ||= 100.map do +** Processing line: ~ [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand]~ +- Inside source: true +*** True Line Result + [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ [selection_border, label]~ +** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ - Inside source: true *** True Line Result - [selection_border, label] -** Processing line: ~ end~ + args.state.sun ||= args.state.new_entity(:sun) do |s| +** Processing line: ~ s.s = 100~ - Inside source: true *** True Line Result - end + s.s = 100 +** Processing line: ~ s.path = 'sprites/sun.png'~ +- Inside source: true +*** True Line Result + s.path = 'sprites/sun.png' ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43661,74 +43992,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_animation_frame_thumbnails~ -- Inside source: true -*** True Line Result - def render_animation_frame_thumbnails -** Processing line: ~ return if state.tick_count.zero?~ +** Processing line: ~ args.state.planets = [~ - Inside source: true *** True Line Result - return if state.tick_count.zero? -** Processing line: ~~ + args.state.planets = [ +** Processing line: ~ [:mercury, 65, 5, 88],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs[:current_animation_frame].width = rt_canvas.size~ + [:mercury, 65, 5, 88], +** Processing line: ~ [:venus, 100, 10, 225],~ - Inside source: true *** True Line Result - outputs[:current_animation_frame].width = rt_canvas.size -** Processing line: ~ outputs[:current_animation_frame].height = rt_canvas.size~ + [:venus, 100, 10, 225], +** Processing line: ~ [:earth, 120, 10, 365],~ - Inside source: true *** True Line Result - outputs[:current_animation_frame].height = rt_canvas.size -** Processing line: ~ outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i|~ + [:earth, 120, 10, 365], +** Processing line: ~ [:mars, 140, 8, 687],~ - Inside source: true *** True Line Result - outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i| -** Processing line: ~ { x: f.x,~ + [:mars, 140, 8, 687], +** Processing line: ~ [:jupiter, 280, 30, 365 * 11.8],~ - Inside source: true *** True Line Result - { x: f.x, -** Processing line: ~ y: f.y,~ + [:jupiter, 280, 30, 365 * 11.8], +** Processing line: ~ [:saturn, 350, 20, 365 * 29.5],~ - Inside source: true *** True Line Result - y: f.y, -** Processing line: ~ w: 1,~ + [:saturn, 350, 20, 365 * 29.5], +** Processing line: ~ [:uranus, 400, 15, 365 * 84],~ - Inside source: true *** True Line Result - w: 1, -** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ + [:uranus, 400, 15, 365 * 84], +** Processing line: ~ [:neptune, 440, 15, 365 * 164.8],~ - Inside source: true *** True Line Result - h: 1, r: 255, g: 255, b: 255 } -** Processing line: ~ end~ + [:neptune, 440, 15, 365 * 164.8], +** Processing line: ~ [:pluto, 480, 5, 365 * 247.8],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [:pluto, 480, 5, 365 * 247.8], +** Processing line: ~ ].map do |name, distance, size, year_in_days|~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame)~ + ].map do |name, distance, size, year_in_days| +** Processing line: ~ args.state.new_entity(name) do |p|~ - Inside source: true *** True Line Result - outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame) -** Processing line: ~~ + args.state.new_entity(name) do |p| +** Processing line: ~ p.path = "sprites/#{name}.png"~ - Inside source: true *** True Line Result - -** Processing line: ~ state.animation_frames.map_with_index do |animation_frame, animation_frame_index|~ + p.path = "sprites/#{name}.png" +** Processing line: ~ p.distance = distance * 0.7~ - Inside source: true *** True Line Result - state.animation_frames.map_with_index do |animation_frame, animation_frame_index| -** Processing line: ~ outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect]~ + p.distance = distance * 0.7 +** Processing line: ~ p.s = size * 0.7~ - Inside source: true *** True Line Result - outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect] -** Processing line: ~ .merge(path: animation_frame[:rt_name])~ + p.s = size * 0.7 +** Processing line: ~ p.year_in_days = year_in_days~ - Inside source: true *** True Line Result - .merge(path: animation_frame[:rt_name]) + p.year_in_days = year_in_days ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43741,118 +44068,122 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_animation~ +** Processing line: ~ args.state.ship ||= args.state.new_entity(:ship) do |s|~ - Inside source: true *** True Line Result - def render_animation -** Processing line: ~ sprite_index = 0.frame_index count: state.animation_frames.length,~ + args.state.ship ||= args.state.new_entity(:ship) do |s| +** Processing line: ~ s.x = 1280 * rand~ - Inside source: true *** True Line Result - sprite_index = 0.frame_index count: state.animation_frames.length, -** Processing line: ~ hold_for: 60 / state.animation_frames_per_second,~ + s.x = 1280 * rand +** Processing line: ~ s.y = 720 * rand~ - Inside source: true *** True Line Result - hold_for: 60 / state.animation_frames_per_second, -** Processing line: ~ repeat: true~ + s.y = 720 * rand +** Processing line: ~ s.angle = 0~ - Inside source: true *** True Line Result - repeat: true -** Processing line: ~~ + s.angle = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.sprites << { x: 700 - 8,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 700 - 8, -** Processing line: ~ y: 120,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y: 120, -** Processing line: ~ w: 16,~ + +** Processing line: ~ def to_sprite args, entity~ - Inside source: true *** True Line Result - w: 16, -** Processing line: ~ h: 16,~ + def to_sprite args, entity +** Processing line: ~ x = 0~ - Inside source: true *** True Line Result - h: 16, -** Processing line: ~ path: (sprite_path sprite_index) }~ + x = 0 +** Processing line: ~ y = 0~ - Inside source: true *** True Line Result - path: (sprite_path sprite_index) } + y = 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.sprites << { x: 700 - 16,~ +** Processing line: ~ if entity.year_in_days~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 700 - 16, -** Processing line: ~ y: 230,~ + if entity.year_in_days +** Processing line: ~ day = args.state.tick_count~ - Inside source: true *** True Line Result - y: 230, -** Processing line: ~ w: 32,~ + day = args.state.tick_count +** Processing line: ~ day_in_year = day % entity.year_in_days~ - Inside source: true *** True Line Result - w: 32, -** Processing line: ~ h: 32,~ + day_in_year = day % entity.year_in_days +** Processing line: ~ entity.random_start_day ||= day_in_year * rand~ - Inside source: true *** True Line Result - h: 32, -** Processing line: ~ path: (sprite_path sprite_index) }~ + entity.random_start_day ||= day_in_year * rand +** Processing line: ~ percentage_of_year = day_in_year.fdiv(entity.year_in_days)~ - Inside source: true *** True Line Result - path: (sprite_path sprite_index) } -** Processing line: ~~ + percentage_of_year = day_in_year.fdiv(entity.year_in_days) +** Processing line: ~ angle = 365 * percentage_of_year~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.sprites << { x: 700 - 32,~ + angle = 365 * percentage_of_year +** Processing line: ~ x = angle.vector_x(entity.distance)~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 700 - 32, -** Processing line: ~ y: 360,~ + x = angle.vector_x(entity.distance) +** Processing line: ~ y = angle.vector_y(entity.distance)~ - Inside source: true *** True Line Result - y: 360, -** Processing line: ~ w: 64,~ + y = angle.vector_y(entity.distance) +** Processing line: ~ end~ - Inside source: true *** True Line Result - w: 64, -** Processing line: ~ h: 64,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - h: 64, -** Processing line: ~ path: (sprite_path sprite_index) }~ + +** Processing line: ~ [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path]~ - Inside source: true *** True Line Result - path: (sprite_path sprite_index) } + [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.sprites << { x: 700 - 64,~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 700 - 64, -** Processing line: ~ y: 520,~ + def render args +** Processing line: ~ args.outputs.solids << [0, 0, 1280, 720]~ - Inside source: true *** True Line Result - y: 520, -** Processing line: ~ w: 128,~ + args.outputs.solids << [0, 0, 1280, 720] +** Processing line: ~~ - Inside source: true *** True Line Result - w: 128, -** Processing line: ~ h: 128,~ + +** Processing line: ~ args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b|~ - Inside source: true *** True Line Result - h: 128, -** Processing line: ~ path: (sprite_path sprite_index) }~ + args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b| +** Processing line: ~ [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b]~ - Inside source: true *** True Line Result - path: (sprite_path sprite_index) } + [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43861,90 +44192,102 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def input_mouse_click~ +** Processing line: ~ args.outputs.sprites << to_sprite(args, args.state.sun)~ - Inside source: true *** True Line Result - def input_mouse_click -** Processing line: ~ if inputs.mouse.up~ + args.outputs.sprites << to_sprite(args, args.state.sun) +** Processing line: ~ args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p }~ - Inside source: true *** True Line Result - if inputs.mouse.up -** Processing line: ~ state.last_mouse_up = state.tick_count~ + args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p } +** Processing line: ~ args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle]~ - Inside source: true *** True Line Result - state.last_mouse_up = state.tick_count -** Processing line: ~ elsif inputs.mouse.moved && user_is_editing?~ + args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif inputs.mouse.moved && user_is_editing? -** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - edit_current_animation_frame inputs.mouse.point -** Processing line: ~ end~ + +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def calc args +** Processing line: ~ args.state.stars = args.state.stars.map do |x, y, speed, r, g, b|~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless inputs.mouse.click~ + args.state.stars = args.state.stars.map do |x, y, speed, r, g, b| +** Processing line: ~ x += speed~ - Inside source: true *** True Line Result - return unless inputs.mouse.click -** Processing line: ~~ + x += speed +** Processing line: ~ y += speed~ - Inside source: true *** True Line Result - -** Processing line: ~ clicked_frame_button = state.buttons_frame_selection.items.find do |b|~ + y += speed +** Processing line: ~ x = 0 if x > 1280~ - Inside source: true *** True Line Result - clicked_frame_button = state.buttons_frame_selection.items.find do |b| -** Processing line: ~ inputs.mouse.point.inside_rect? b~ + x = 0 if x > 1280 +** Processing line: ~ y = 0 if y > 720~ - Inside source: true *** True Line Result - inputs.mouse.point.inside_rect? b -** Processing line: ~ end~ + y = 0 if y > 720 +** Processing line: ~ [x, y, speed, r, g, b]~ - Inside source: true *** True Line Result - end + [x, y, speed, r, g, b] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if (clicked_frame_button)~ +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - if (clicked_frame_button) -** Processing line: ~ state.animation_frames_selected_index = clicked_frame_button[:index]~ + if args.state.tick_count == 0 +** Processing line: ~ args.outputs.sounds << 'sounds/bg.ogg'~ - Inside source: true *** True Line Result - state.animation_frames_selected_index = clicked_frame_button[:index] -** Processing line: ~ end~ + args.outputs.sounds << 'sounds/bg.ogg' +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if (inputs.mouse.point.inside_rect? rt_canvas.sprite)~ +** Processing line: ~ def process_inputs args~ - Inside source: true *** True Line Result - if (inputs.mouse.point.inside_rect? rt_canvas.sprite) -** Processing line: ~ state.last_mouse_down = state.tick_count~ + def process_inputs args +** Processing line: ~ if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left~ - Inside source: true *** True Line Result - state.last_mouse_down = state.tick_count -** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ + if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left +** Processing line: ~ args.state.ship.angle += 1~ - Inside source: true *** True Line Result - edit_current_animation_frame inputs.mouse.point -** Processing line: ~ end~ + args.state.ship.angle += 1 +** Processing line: ~ elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right~ - Inside source: true *** True Line Result - end + elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right +** Processing line: ~ args.state.ship.angle -= 1~ +- Inside source: true +*** True Line Result + args.state.ship.angle -= 1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -43953,498 +44296,486 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def input_keyboard~ +** Processing line: ~ if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a~ - Inside source: true *** True Line Result - def input_keyboard -** Processing line: ~ # w to save~ + if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a +** Processing line: ~ args.state.ship.x += args.state.ship.angle.x_vector~ - Inside source: true *** True Line Result - # w to save -** Processing line: ~ if inputs.keyboard.key_down.w~ + args.state.ship.x += args.state.ship.angle.x_vector +** Processing line: ~ args.state.ship.y += args.state.ship.angle.y_vector~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.w -** Processing line: ~ t = Time.now~ + args.state.ship.y += args.state.ship.angle.y_vector +** Processing line: ~ end~ - Inside source: true *** True Line Result - t = Time.now -** Processing line: ~ state.save_description = "Time: #{t} (#{t.to_i})"~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.save_description = "Time: #{t} (#{t.to_i})" -** Processing line: ~ gtk.serialize_state 'canvas/state.txt', state~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - gtk.serialize_state 'canvas/state.txt', state -** Processing line: ~ gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state -** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ + def tick args +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - animation_frames.each_with_index do |animation_frame, i| -** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ + defaults args +** Processing line: ~ render args~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: i, -** Processing line: ~ at: state.tick_count + i,~ + render args +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - at: state.tick_count + i, -** Processing line: ~ queue_sprite_creation: true }~ + calc args +** Processing line: ~ process_inputs args~ - Inside source: true *** True Line Result - queue_sprite_creation: true } -** Processing line: ~ queues.create_sprite << { index: i,~ + process_inputs args +** Processing line: ~ end~ - Inside source: true *** True Line Result - queues.create_sprite << { index: i, -** Processing line: ~ at: state.tick_count + animation_frames.length + i,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - at: state.tick_count + animation_frames.length + i, -** Processing line: ~ path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" }~ + +** Processing line: ~ def r~ - Inside source: true *** True Line Result - path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" } -** Processing line: ~ end~ + def r +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.notify! "Canvas saved."~ + $gtk.reset +** Processing line: ~ end~ - Inside source: true *** True Line Result - gtk.notify! "Canvas saved." -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # l to load~ -- Inside source: true +** Processing line: ~* Crafting - Craft Game Starting Point - main.rb~ +- Header detected. *** True Line Result - # l to load -** Processing line: ~ if inputs.keyboard.key_down.l~ -- Inside source: true + *** True Line Result - if inputs.keyboard.key_down.l -** Processing line: ~ args.state = gtk.deserialize_state 'canvas/state.txt'~ -- Inside source: true +* Crafting - Craft Game Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - args.state = gtk.deserialize_state 'canvas/state.txt' -** Processing line: ~ animation_frames.each_with_index do |a, i|~ -- Inside source: true + *** True Line Result - animation_frames.each_with_index do |a, i| -** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: i, -** Processing line: ~ at: state.tick_count + i,~ + # ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb +** Processing line: ~ # ==================================================~ - Inside source: true *** True Line Result - at: state.tick_count + i, -** Processing line: ~ queue_sprite_creation: true }~ + # ================================================== +** Processing line: ~ # A NOTE TO JAM CRAFT PARTICIPANTS:~ - Inside source: true *** True Line Result - queue_sprite_creation: true } -** Processing line: ~ end~ + # A NOTE TO JAM CRAFT PARTICIPANTS: +** Processing line: ~ # The comments and code in here are just as small piece of DragonRuby's capabilities.~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.notify! "Canvas loaded."~ + # The comments and code in here are just as small piece of DragonRuby's capabilities. +** Processing line: ~ # Be sure to check out the rest of the sample apps. Start with README.txt and go from there!~ - Inside source: true *** True Line Result - gtk.notify! "Canvas loaded." -** Processing line: ~ end~ + # Be sure to check out the rest of the sample apps. Start with README.txt and go from there! +** Processing line: ~ # ==================================================~ - Inside source: true *** True Line Result - end + # ================================================== ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # d to go into delete mode, release to paint~ +** Processing line: ~ # def tick args is the entry point into your game. This function is called at~ - Inside source: true *** True Line Result - # d to go into delete mode, release to paint -** Processing line: ~ if inputs.keyboard.key_held.d~ + # def tick args is the entry point into your game. This function is called at +** Processing line: ~ # a fixed update time of 60hz (60 fps).~ - Inside source: true *** True Line Result - if inputs.keyboard.key_held.d -** Processing line: ~ state.edit_mode = :erasing~ + # a fixed update time of 60hz (60 fps). +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - state.edit_mode = :erasing -** Processing line: ~ gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1)~ + def tick args +** Processing line: ~ # The defaults function intitializes the game.~ - Inside source: true *** True Line Result - gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1) -** Processing line: ~ elsif inputs.keyboard.key_up.d~ + # The defaults function intitializes the game. +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_up.d -** Processing line: ~ state.edit_mode = :drawing~ + defaults args +** Processing line: ~~ - Inside source: true *** True Line Result - state.edit_mode = :drawing -** Processing line: ~ gtk.notify! "Drawing."~ + +** Processing line: ~ # After the game is initialized, render it.~ - Inside source: true *** True Line Result - gtk.notify! "Drawing." -** Processing line: ~ end~ + # After the game is initialized, render it. +** Processing line: ~ render args~ - Inside source: true *** True Line Result - end + render args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # a to add a frame to the end~ +** Processing line: ~ # After rendering the player should be able to respond to input.~ - Inside source: true *** True Line Result - # a to add a frame to the end -** Processing line: ~ if inputs.keyboard.key_down.a~ + # After rendering the player should be able to respond to input. +** Processing line: ~ input args~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.a -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ + input args +** Processing line: ~~ - Inside source: true *** True Line Result - queues.create_sprite << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count }~ + +** Processing line: ~ # After responding to input, the game performs any additional calculations.~ - Inside source: true *** True Line Result - at: state.tick_count } -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index + 1,~ + # After responding to input, the game performs any additional calculations. +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - queues.create_sprite << { index: state.animation_frames_selected_index + 1, -** Processing line: ~ at: state.tick_count }~ + calc args +** Processing line: ~ end~ - Inside source: true *** True Line Result - at: state.tick_count } -** Processing line: ~ add_animation_frame_to_end~ -- Inside source: true -*** True Line Result - add_animation_frame_to_end -** Processing line: ~ gtk.notify! "Frame added to end."~ -- Inside source: true -*** True Line Result - gtk.notify! "Frame added to end." -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # c or t to copy~ +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - # c or t to copy -** Processing line: ~ if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t)~ + def defaults args +** Processing line: ~ # hide the mouse cursor for this game, we are going to render our own cursor~ - Inside source: true *** True Line Result - if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t) -** Processing line: ~ state.clipboard = [selected_animation_frame[:pixels]].flatten~ + # hide the mouse cursor for this game, we are going to render our own cursor +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - state.clipboard = [selected_animation_frame[:pixels]].flatten -** Processing line: ~ gtk.notify! "Current frame copied."~ + if args.state.tick_count == 0 +** Processing line: ~ args.gtk.hide_cursor~ - Inside source: true *** True Line Result - gtk.notify! "Current frame copied." -** Processing line: ~ end~ + args.gtk.hide_cursor +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # v or q to paste~ +** Processing line: ~ args.state.click_ripples ||= []~ - Inside source: true *** True Line Result - # v or q to paste -** Processing line: ~ if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard~ + args.state.click_ripples ||= [] +** Processing line: ~~ - Inside source: true *** True Line Result - if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard -** Processing line: ~ selected_animation_frame[:pixels] = [state.clipboard].flatten~ + +** Processing line: ~ # everything is on a 1280x720 virtual canvas, so you can~ - Inside source: true *** True Line Result - selected_animation_frame[:pixels] = [state.clipboard].flatten -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ + # everything is on a 1280x720 virtual canvas, so you can +** Processing line: ~ # hardcode locations~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count,~ + # hardcode locations +** Processing line: ~~ - Inside source: true *** True Line Result - at: state.tick_count, -** Processing line: ~ queue_sprite_creation: true }~ + +** Processing line: ~ # define the borders for where the inventory is located~ - Inside source: true *** True Line Result - queue_sprite_creation: true } -** Processing line: ~ gtk.notify! "Pasted."~ + # define the borders for where the inventory is located +** Processing line: ~ # args.state is a data structure that accepts any arbitrary parameters~ - Inside source: true *** True Line Result - gtk.notify! "Pasted." -** Processing line: ~ end~ + # args.state is a data structure that accepts any arbitrary parameters +** Processing line: ~ # so you can create an object graph without having to create any classes.~ - Inside source: true *** True Line Result - end + # so you can create an object graph without having to create any classes. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # f to go forward/next frame~ +** Processing line: ~ # Bottom left is 0, 0. Top right is 1280, 720.~ - Inside source: true *** True Line Result - # f to go forward/next frame -** Processing line: ~ if (inputs.keyboard.key_down.f)~ + # Bottom left is 0, 0. Top right is 1280, 720. +** Processing line: ~ # The inventory area is at the top of the screen~ - Inside source: true *** True Line Result - if (inputs.keyboard.key_down.f) -** Processing line: ~ if (state.animation_frames_selected_index == (state.animation_frames.length - 1))~ + # The inventory area is at the top of the screen +** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ - Inside source: true *** True Line Result - if (state.animation_frames_selected_index == (state.animation_frames.length - 1)) -** Processing line: ~ state.animation_frames_selected_index = 0~ + # the number 80 is the size of all the sprites, so that is what is being +** Processing line: ~ # used to decide the with and height~ - Inside source: true *** True Line Result - state.animation_frames_selected_index = 0 -** Processing line: ~ else~ + # used to decide the with and height +** Processing line: ~ args.state.sprite_size = 80~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.animation_frames_selected_index += 1~ + args.state.sprite_size = 80 +** Processing line: ~~ - Inside source: true *** True Line Result - state.animation_frames_selected_index += 1 -** Processing line: ~ end~ + +** Processing line: ~ args.state.inventory_border.w = args.state.sprite_size * 10~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.notify! "Next frame."~ + args.state.inventory_border.w = args.state.sprite_size * 10 +** Processing line: ~ args.state.inventory_border.h = args.state.sprite_size * 3~ - Inside source: true *** True Line Result - gtk.notify! "Next frame." -** Processing line: ~ end~ + args.state.inventory_border.h = args.state.sprite_size * 3 +** Processing line: ~ args.state.inventory_border.x = 10~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.inventory_border.x = 10 +** Processing line: ~ args.state.inventory_border.y = 710 - args.state.inventory_border.h~ - Inside source: true *** True Line Result - -** Processing line: ~ # b to go back/previous frame~ + args.state.inventory_border.y = 710 - args.state.inventory_border.h +** Processing line: ~~ - Inside source: true *** True Line Result - # b to go back/previous frame -** Processing line: ~ if (inputs.keyboard.key_down.b)~ + +** Processing line: ~ # define the borders for where the crafting area is located~ - Inside source: true *** True Line Result - if (inputs.keyboard.key_down.b) -** Processing line: ~ if (state.animation_frames_selected_index == 0)~ + # define the borders for where the crafting area is located +** Processing line: ~ # the crafting area is below the inventory area~ - Inside source: true *** True Line Result - if (state.animation_frames_selected_index == 0) -** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ + # the crafting area is below the inventory area +** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ - Inside source: true *** True Line Result - state.animation_frames_selected_index = state.animation_frames.length - 1 -** Processing line: ~ else~ + # the number 80 is the size of all the sprites, so that is what is being +** Processing line: ~ # used to decide the with and height~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.animation_frames_selected_index -= 1~ + # used to decide the with and height +** Processing line: ~ args.state.craft_border.x = 10~ - Inside source: true *** True Line Result - state.animation_frames_selected_index -= 1 -** Processing line: ~ end~ + args.state.craft_border.x = 10 +** Processing line: ~ args.state.craft_border.y = 220~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.notify! "Previous frame."~ + args.state.craft_border.y = 220 +** Processing line: ~ args.state.craft_border.w = args.state.sprite_size * 3~ - Inside source: true *** True Line Result - gtk.notify! "Previous frame." -** Processing line: ~ end~ + args.state.craft_border.w = args.state.sprite_size * 3 +** Processing line: ~ args.state.craft_border.h = args.state.sprite_size * 3~ - Inside source: true *** True Line Result - end + args.state.craft_border.h = args.state.sprite_size * 3 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # x to delete frame~ +** Processing line: ~ # define the area where results are located~ - Inside source: true *** True Line Result - # x to delete frame -** Processing line: ~ if (inputs.keyboard.key_down.x) && animation_frames.length > 1~ + # define the area where results are located +** Processing line: ~ # the crafting result is to the right of the craft area~ - Inside source: true *** True Line Result - if (inputs.keyboard.key_down.x) && animation_frames.length > 1 -** Processing line: ~ state.clipboard = selected_animation_frame[:pixels]~ + # the crafting result is to the right of the craft area +** Processing line: ~ args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size~ - Inside source: true *** True Line Result - state.clipboard = selected_animation_frame[:pixels] -** Processing line: ~ state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index }~ + args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size +** Processing line: ~ args.state.result_border.y = 220 + args.state.sprite_size~ - Inside source: true *** True Line Result - state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index } -** Processing line: ~ if state.animation_frames_selected_index >= state.animation_frames.length~ + args.state.result_border.y = 220 + args.state.sprite_size +** Processing line: ~ args.state.result_border.w = args.state.sprite_size~ - Inside source: true *** True Line Result - if state.animation_frames_selected_index >= state.animation_frames.length -** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ + args.state.result_border.w = args.state.sprite_size +** Processing line: ~ args.state.result_border.h = args.state.sprite_size~ - Inside source: true *** True Line Result - state.animation_frames_selected_index = state.animation_frames.length - 1 -** Processing line: ~ end~ + args.state.result_border.h = args.state.sprite_size +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ gtk.notify! "Frame deleted."~ + +** Processing line: ~ # initialize items for the first time if they are nil~ - Inside source: true *** True Line Result - gtk.notify! "Frame deleted." -** Processing line: ~ end~ + # initialize items for the first time if they are nil +** Processing line: ~ # you start with 15 wood, 1 chest, and 5 plank~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # you start with 15 wood, 1 chest, and 5 plank +** Processing line: ~ # Ruby has built in syntax for dictionaries (they look a lot like json objects).~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Ruby has built in syntax for dictionaries (they look a lot like json objects). +** Processing line: ~ # Ruby also has a special type called a Symbol denoted with a : followed by a word.~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_auto_export~ + # Ruby also has a special type called a Symbol denoted with a : followed by a word. +** Processing line: ~ # Symbols are nice because they remove the need for magic strings.~ - Inside source: true *** True Line Result - def calc_auto_export -** Processing line: ~ return if user_is_editing?~ + # Symbols are nice because they remove the need for magic strings. +** Processing line: ~ if !args.state.items~ - Inside source: true *** True Line Result - return if user_is_editing? -** Processing line: ~ return if state.last_mouse_up.elapsed_time != 30~ + if !args.state.items +** Processing line: ~ args.state.items = [~ - Inside source: true *** True Line Result - return if state.last_mouse_up.elapsed_time != 30 -** Processing line: ~ # auto export current animation frame if there is no editing for 30 ticks~ + args.state.items = [ +** Processing line: ~ {~ - Inside source: true *** True Line Result - # auto export current animation frame if there is no editing for 30 ticks -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ + { +** Processing line: ~ id: :wood, # :wood is a Symbol, this is better than using "wood" for the id~ - Inside source: true *** True Line Result - queues.create_sprite << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count }~ + id: :wood, # :wood is a Symbol, this is better than using "wood" for the id +** Processing line: ~ quantity: 15,~ - Inside source: true *** True Line Result - at: state.tick_count } -** Processing line: ~ end~ + quantity: 15, +** Processing line: ~ path: 'sprites/wood.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + path: 'sprites/wood.png', +** Processing line: ~ location: :inventory,~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_buttons_frame_selection~ + location: :inventory, +** Processing line: ~ ordinal_x: 0, ordinal_y: 0~ - Inside source: true *** True Line Result - def calc_buttons_frame_selection -** Processing line: ~ state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i|~ + ordinal_x: 0, ordinal_y: 0 +** Processing line: ~ },~ - Inside source: true *** True Line Result - state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i| -** Processing line: ~ { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size,~ + }, +** Processing line: ~ {~ - Inside source: true *** True Line Result - { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size, -** Processing line: ~ y: state.buttons_frame_selection.top - state.buttons_frame_selection.size,~ + { +** Processing line: ~ id: :chest,~ - Inside source: true *** True Line Result - y: state.buttons_frame_selection.top - state.buttons_frame_selection.size, -** Processing line: ~ inner_rect: {~ + id: :chest, +** Processing line: ~ quantity: 1,~ - Inside source: true *** True Line Result - inner_rect: { -** Processing line: ~ x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size,~ + quantity: 1, +** Processing line: ~ path: 'sprites/chest.png',~ - Inside source: true *** True Line Result - x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size, -** Processing line: ~ y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2),~ + path: 'sprites/chest.png', +** Processing line: ~ location: :inventory,~ - Inside source: true *** True Line Result - y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2), -** Processing line: ~ w: 16,~ + location: :inventory, +** Processing line: ~ ordinal_x: 1, ordinal_y: 0~ - Inside source: true *** True Line Result - w: 16, -** Processing line: ~ h: 16,~ + ordinal_x: 1, ordinal_y: 0 +** Processing line: ~ },~ - Inside source: true *** True Line Result - h: 16, -** Processing line: ~ },~ + }, +** Processing line: ~ {~ - Inside source: true *** True Line Result - }, -** Processing line: ~ w: state.buttons_frame_selection.size,~ + { +** Processing line: ~ id: :plank,~ - Inside source: true *** True Line Result - w: state.buttons_frame_selection.size, -** Processing line: ~ h: state.buttons_frame_selection.size,~ + id: :plank, +** Processing line: ~ quantity: 5,~ - Inside source: true *** True Line Result - h: state.buttons_frame_selection.size, -** Processing line: ~ index: i }~ + quantity: 5, +** Processing line: ~ path: 'sprites/plank.png',~ - Inside source: true *** True Line Result - index: i } -** Processing line: ~ end~ + path: 'sprites/plank.png', +** Processing line: ~ location: :inventory,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + location: :inventory, +** Processing line: ~ ordinal_x: 2, ordinal_y: 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ordinal_x: 2, ordinal_y: 0 +** Processing line: ~ },~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_animation_frames~ + }, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def calc_animation_frames -** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - animation_frames.each_with_index do |animation_frame, i| -** Processing line: ~ animation_frame[:index] = i~ + +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ - Inside source: true *** True Line Result - animation_frame[:index] = i -** Processing line: ~ animation_frame[:rt_name] = "animation_frame_#{i}"~ + # after initializing the oridinal positions, derive the pixel +** Processing line: ~ # locations assuming that the width and height are 80~ - Inside source: true *** True Line Result - animation_frame[:rt_name] = "animation_frame_#{i}" -** Processing line: ~ end~ + # locations assuming that the width and height are 80 +** Processing line: ~ args.state.items.each { |item| set_inventory_position args, item }~ - Inside source: true *** True Line Result - end + args.state.items.each { |item| set_inventory_position args, item } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -44453,194 +44784,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def process_queue_create_sprite~ -- Inside source: true -*** True Line Result - def process_queue_create_sprite -** Processing line: ~ sprites_to_create = queues.create_sprite~ +** Processing line: ~ # define all the oridinal positions of the inventory slots~ - Inside source: true *** True Line Result - sprites_to_create = queues.create_sprite -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ + # define all the oridinal positions of the inventory slots +** Processing line: ~ if !args.state.inventory_area~ - Inside source: true *** True Line Result - .find_all { |h| h[:at].elapsed? } -** Processing line: ~~ + if !args.state.inventory_area +** Processing line: ~ args.state.inventory_area = [~ - Inside source: true *** True Line Result - -** Processing line: ~ queues.create_sprite = queues.create_sprite - sprites_to_create~ + args.state.inventory_area = [ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ - Inside source: true *** True Line Result - queues.create_sprite = queues.create_sprite - sprites_to_create -** Processing line: ~~ + { ordinal_x: 0, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ - Inside source: true *** True Line Result - -** Processing line: ~ sprites_to_create.each do |h|~ + { ordinal_x: 1, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ - Inside source: true *** True Line Result - sprites_to_create.each do |h| -** Processing line: ~ export_animation_frame h[:index], h[:path_override]~ + { ordinal_x: 2, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ - Inside source: true *** True Line Result - export_animation_frame h[:index], h[:path_override] -** Processing line: ~ end~ + { ordinal_x: 3, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + { ordinal_x: 4, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { ordinal_x: 5, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_queue_reset_sprite~ + { ordinal_x: 6, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ - Inside source: true *** True Line Result - def process_queue_reset_sprite -** Processing line: ~ sprites_to_reset = queues.reset_sprite~ + { ordinal_x: 7, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ - Inside source: true *** True Line Result - sprites_to_reset = queues.reset_sprite -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ + { ordinal_x: 8, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ - Inside source: true *** True Line Result - .find_all { |h| h[:at].elapsed? } -** Processing line: ~~ + { ordinal_x: 9, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ - Inside source: true *** True Line Result - -** Processing line: ~ queues.reset_sprite -= sprites_to_reset~ + { ordinal_x: 0, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ - Inside source: true *** True Line Result - queues.reset_sprite -= sprites_to_reset -** Processing line: ~~ + { ordinal_x: 1, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ - Inside source: true *** True Line Result - -** Processing line: ~ sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) }~ + { ordinal_x: 2, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 3, ordinal_y: 1 },~ - Inside source: true *** True Line Result - sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) } -** Processing line: ~ end~ + { ordinal_x: 3, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 4, ordinal_y: 1 },~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { ordinal_x: 4, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 5, ordinal_y: 1 },~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_queue_update_rt_animation_frame~ + { ordinal_x: 5, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 6, ordinal_y: 1 },~ - Inside source: true *** True Line Result - def process_queue_update_rt_animation_frame -** Processing line: ~ animation_frames_to_update = queues.update_rt_animation_frame~ + { ordinal_x: 6, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 7, ordinal_y: 1 },~ - Inside source: true *** True Line Result - animation_frames_to_update = queues.update_rt_animation_frame -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ + { ordinal_x: 7, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 8, ordinal_y: 1 },~ - Inside source: true *** True Line Result - .find_all { |h| h[:at].elapsed? } -** Processing line: ~~ + { ordinal_x: 8, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 9, ordinal_y: 1 },~ - Inside source: true *** True Line Result - -** Processing line: ~ queues.update_rt_animation_frame -= animation_frames_to_update~ + { ordinal_x: 9, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame -= animation_frames_to_update -** Processing line: ~~ + { ordinal_x: 0, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ - Inside source: true *** True Line Result - -** Processing line: ~ animation_frames_to_update.each do |h|~ + { ordinal_x: 1, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ - Inside source: true *** True Line Result - animation_frames_to_update.each do |h| -** Processing line: ~ update_animation_frame_render_target animation_frames[h[:index]]~ + { ordinal_x: 2, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 3, ordinal_y: 2 },~ - Inside source: true *** True Line Result - update_animation_frame_render_target animation_frames[h[:index]] -** Processing line: ~~ + { ordinal_x: 3, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 4, ordinal_y: 2 },~ - Inside source: true *** True Line Result - -** Processing line: ~ if h[:queue_sprite_creation]~ + { ordinal_x: 4, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 5, ordinal_y: 2 },~ - Inside source: true *** True Line Result - if h[:queue_sprite_creation] -** Processing line: ~ queues.create_sprite << { index: h[:index],~ + { ordinal_x: 5, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 6, ordinal_y: 2 },~ - Inside source: true *** True Line Result - queues.create_sprite << { index: h[:index], -** Processing line: ~ at: state.tick_count + 1 }~ + { ordinal_x: 6, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 7, ordinal_y: 2 },~ - Inside source: true *** True Line Result - at: state.tick_count + 1 } -** Processing line: ~ end~ + { ordinal_x: 7, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 8, ordinal_y: 2 },~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + { ordinal_x: 8, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 9, ordinal_y: 2 },~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + { ordinal_x: 9, ordinal_y: 2 }, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def update_animation_frame_render_target animation_frame~ -- Inside source: true -*** True Line Result - def update_animation_frame_render_target animation_frame -** Processing line: ~ return if !animation_frame~ +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ - Inside source: true *** True Line Result - return if !animation_frame -** Processing line: ~~ + # after initializing the oridinal positions, derive the pixel +** Processing line: ~ # locations assuming that the width and height are 80~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs[animation_frame[:rt_name]].width = state.rt_canvas.size~ + # locations assuming that the width and height are 80 +** Processing line: ~ args.state.inventory_area.each { |i| set_inventory_position args, i }~ - Inside source: true *** True Line Result - outputs[animation_frame[:rt_name]].width = state.rt_canvas.size -** Processing line: ~ outputs[animation_frame[:rt_name]].height = state.rt_canvas.size~ + args.state.inventory_area.each { |i| set_inventory_position args, i } +** Processing line: ~~ - Inside source: true *** True Line Result - outputs[animation_frame[:rt_name]].height = state.rt_canvas.size -** Processing line: ~ outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f|~ + +** Processing line: ~ # if you want to see the result you can use the Ruby function called "puts".~ - Inside source: true *** True Line Result - outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f| -** Processing line: ~ { x: f.x,~ + # if you want to see the result you can use the Ruby function called "puts". +** Processing line: ~ # Uncomment this line to see the value.~ - Inside source: true *** True Line Result - { x: f.x, -** Processing line: ~ y: f.y,~ + # Uncomment this line to see the value. +** Processing line: ~ # puts args.state.inventory_area~ - Inside source: true *** True Line Result - y: f.y, -** Processing line: ~ w: 1,~ + # puts args.state.inventory_area +** Processing line: ~~ - Inside source: true *** True Line Result - w: 1, -** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ + +** Processing line: ~ # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt.~ - Inside source: true *** True Line Result - h: 1, r: 255, g: 255, b: 255 } -** Processing line: ~ end~ + # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt. +** Processing line: ~ # To bring up DragonRuby's Console, press the ~ key within the game.~ - Inside source: true *** True Line Result - end + # To bring up DragonRuby's Console, press the ~ key within the game. ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -44649,154 +44972,158 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def animation_frames~ +** Processing line: ~ # define all the oridinal positions of the craft slots~ - Inside source: true *** True Line Result - def animation_frames -** Processing line: ~ state.animation_frames~ + # define all the oridinal positions of the craft slots +** Processing line: ~ if !args.state.craft_area~ - Inside source: true *** True Line Result - state.animation_frames -** Processing line: ~ end~ + if !args.state.craft_area +** Processing line: ~ args.state.craft_area = [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.craft_area = [ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ - Inside source: true *** True Line Result - -** Processing line: ~ def add_animation_frame_to_end~ + { ordinal_x: 0, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ - Inside source: true *** True Line Result - def add_animation_frame_to_end -** Processing line: ~ animation_frames << {~ + { ordinal_x: 0, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ - Inside source: true *** True Line Result - animation_frames << { -** Processing line: ~ index: animation_frames.length,~ + { ordinal_x: 0, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ - Inside source: true *** True Line Result - index: animation_frames.length, -** Processing line: ~ pixels: [],~ + { ordinal_x: 1, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ - Inside source: true *** True Line Result - pixels: [], -** Processing line: ~ rt_name: "animation_frame_#{animation_frames.length}"~ + { ordinal_x: 1, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ - Inside source: true *** True Line Result - rt_name: "animation_frame_#{animation_frames.length}" -** Processing line: ~ }~ + { ordinal_x: 1, ordinal_y: 2 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + { ordinal_x: 2, ordinal_y: 0 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ - Inside source: true *** True Line Result - -** Processing line: ~ state.animation_frames_selected_index = (animation_frames.length - 1)~ + { ordinal_x: 2, ordinal_y: 1 }, +** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ - Inside source: true *** True Line Result - state.animation_frames_selected_index = (animation_frames.length - 1) -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ + { ordinal_x: 2, ordinal_y: 2 }, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count,~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - at: state.tick_count, -** Processing line: ~ queue_sprite_creation: true }~ + +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ - Inside source: true *** True Line Result - queue_sprite_creation: true } -** Processing line: ~ end~ + # after initializing the oridinal positions, derive the pixel +** Processing line: ~ # locations assuming that the width and height are 80~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # locations assuming that the width and height are 80 +** Processing line: ~ args.state.craft_area.each { |c| set_craft_position args, c }~ - Inside source: true *** True Line Result - -** Processing line: ~ def sprite_path i~ + args.state.craft_area.each { |c| set_craft_position args, c } +** Processing line: ~ end~ - Inside source: true *** True Line Result - def sprite_path i -** Processing line: ~ "canvas/sprite-#{i}.png"~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - "canvas/sprite-#{i}.png" -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def export_animation_frame i, path_override = nil~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - def export_animation_frame i, path_override = nil -** Processing line: ~ return if !state.animation_frames[i]~ + def render args +** Processing line: ~ # for the results area, create a sprite that show its boundaries~ - Inside source: true *** True Line Result - return if !state.animation_frames[i] -** Processing line: ~~ + # for the results area, create a sprite that show its boundaries +** Processing line: ~ args.outputs.primitives << { x: args.state.result_border.x,~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ + args.outputs.primitives << { x: args.state.result_border.x, +** Processing line: ~ y: args.state.result_border.y,~ - Inside source: true *** True Line Result - outputs.screenshots << state.buttons_frame_selection -** Processing line: ~ .items[i][:inner_rect]~ + y: args.state.result_border.y, +** Processing line: ~ w: args.state.result_border.w,~ - Inside source: true *** True Line Result - .items[i][:inner_rect] -** Processing line: ~ .merge(path: path_override || (sprite_path i))~ + w: args.state.result_border.w, +** Processing line: ~ h: args.state.result_border.h,~ - Inside source: true *** True Line Result - .merge(path: path_override || (sprite_path i)) + h: args.state.result_border.h, +** Processing line: ~ path: 'sprites/border-black.png' }~ +- Inside source: true +*** True Line Result + path: 'sprites/border-black.png' } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ +** Processing line: ~ # for each inventory spot, create a sprite~ - Inside source: true *** True Line Result - outputs.screenshots << state.buttons_frame_selection -** Processing line: ~ .items[i][:inner_rect]~ + # for each inventory spot, create a sprite +** Processing line: ~ # args.outputs.primitives is how DragonRuby performs a render.~ - Inside source: true *** True Line Result - .items[i][:inner_rect] -** Processing line: ~ .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png")~ + # args.outputs.primitives is how DragonRuby performs a render. +** Processing line: ~ # Adding a single hash or multiple hashes to this array will tell~ - Inside source: true *** True Line Result - .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png") -** Processing line: ~~ + # Adding a single hash or multiple hashes to this array will tell +** Processing line: ~ # DragonRuby to render those primitives on that frame.~ - Inside source: true *** True Line Result - -** Processing line: ~ queues.reset_sprite << { index: i, at: state.tick_count }~ + # DragonRuby to render those primitives on that frame. +** Processing line: ~~ - Inside source: true *** True Line Result - queues.reset_sprite << { index: i, at: state.tick_count } -** Processing line: ~ end~ + +** Processing line: ~ # The .map function on Array is used instead of any kind of looping.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # The .map function on Array is used instead of any kind of looping. +** Processing line: ~ # .map returns a new object for every object within an Array.~ - Inside source: true *** True Line Result - -** Processing line: ~ def selected_animation_frame~ + # .map returns a new object for every object within an Array. +** Processing line: ~ args.outputs.primitives << args.state.inventory_area.map do |a|~ - Inside source: true *** True Line Result - def selected_animation_frame -** Processing line: ~ state.animation_frames[state.animation_frames_selected_index]~ + args.outputs.primitives << args.state.inventory_area.map do |a| +** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ - Inside source: true *** True Line Result - state.animation_frames[state.animation_frames_selected_index] + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -44805,74 +45132,86 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def edit_current_animation_frame point~ +** Processing line: ~ # for each craft spot, create a sprite~ - Inside source: true *** True Line Result - def edit_current_animation_frame point -** Processing line: ~ draw_area_point = (to_draw_area point)~ + # for each craft spot, create a sprite +** Processing line: ~ args.outputs.primitives << args.state.craft_area.map do |a|~ - Inside source: true *** True Line Result - draw_area_point = (to_draw_area point) -** Processing line: ~ if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point)~ + args.outputs.primitives << args.state.craft_area.map do |a| +** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ - Inside source: true *** True Line Result - if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point) -** Processing line: ~ selected_animation_frame[:pixels] << draw_area_point~ + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } +** Processing line: ~ end~ - Inside source: true *** True Line Result - selected_animation_frame[:pixels] << draw_area_point -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count,~ + +** Processing line: ~ # after the borders have been rendered, render the~ - Inside source: true *** True Line Result - at: state.tick_count, -** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ + # after the borders have been rendered, render the +** Processing line: ~ # items within those slots (and allow for highlighting)~ - Inside source: true *** True Line Result - queue_sprite_creation: !user_is_editing? } -** Processing line: ~ elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point)~ + # items within those slots (and allow for highlighting) +** Processing line: ~ # if an item isn't currently being held~ - Inside source: true *** True Line Result - elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point) -** Processing line: ~ selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point }~ + # if an item isn't currently being held +** Processing line: ~ allow_inventory_highlighting = !args.state.held_item~ - Inside source: true *** True Line Result - selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point } -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ + allow_inventory_highlighting = !args.state.held_item +** Processing line: ~~ - Inside source: true *** True Line Result - queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, -** Processing line: ~ at: state.tick_count,~ + +** Processing line: ~ # go through each item and render them~ - Inside source: true *** True Line Result - at: state.tick_count, -** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ + # go through each item and render them +** Processing line: ~ # use Array's find_all method to remove any items that are currently being held~ - Inside source: true *** True Line Result - queue_sprite_creation: !user_is_editing? } -** Processing line: ~ end~ + # use Array's find_all method to remove any items that are currently being held +** Processing line: ~ args.state.items.find_all { |item| item[:location] != :held }.map do |item|~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.items.find_all { |item| item[:location] != :held }.map do |item| +** Processing line: ~ # if an item is currently being held, don't render it in it's spot within the~ - Inside source: true *** True Line Result - end + # if an item is currently being held, don't render it in it's spot within the +** Processing line: ~ # inventory or craft area (this is handled via the find_all method).~ +- Inside source: true +*** True Line Result + # inventory or craft area (this is handled via the find_all method). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def user_is_editing?~ +** Processing line: ~ # the item_prefab returns a hash containing all the visual components of an item.~ - Inside source: true *** True Line Result - def user_is_editing? -** Processing line: ~ state.last_mouse_down > state.last_mouse_up~ + # the item_prefab returns a hash containing all the visual components of an item. +** Processing line: ~ # the main sprite, the black background, the quantity text, and a hover indication~ - Inside source: true *** True Line Result - state.last_mouse_down > state.last_mouse_up + # the main sprite, the black background, the quantity text, and a hover indication +** Processing line: ~ # if the mouse is currently hovering over the item.~ +- Inside source: true +*** True Line Result + # if the mouse is currently hovering over the item. +** Processing line: ~ args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse)~ +- Inside source: true +*** True Line Result + args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -44881,518 +45220,534 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def to_draw_area point~ +** Processing line: ~ # The last thing we want to render is the item currently being held.~ - Inside source: true *** True Line Result - def to_draw_area point -** Processing line: ~ x, y = point~ + # The last thing we want to render is the item currently being held. +** Processing line: ~ args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse)~ - Inside source: true *** True Line Result - x, y = point -** Processing line: ~ x -= rt_canvas.sprite.x~ + args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse) +** Processing line: ~~ - Inside source: true *** True Line Result - x -= rt_canvas.sprite.x -** Processing line: ~ y -= rt_canvas.sprite.y~ + +** Processing line: ~ args.outputs.primitives << args.state.click_ripples~ - Inside source: true *** True Line Result - y -= rt_canvas.sprite.y -** Processing line: ~ { x: x.idiv(rt_canvas.zoom),~ + args.outputs.primitives << args.state.click_ripples +** Processing line: ~~ - Inside source: true *** True Line Result - { x: x.idiv(rt_canvas.zoom), -** Processing line: ~ y: y.idiv(rt_canvas.zoom) }~ + +** Processing line: ~ # render a mouse cursor since we have the OS cursor hidden~ - Inside source: true *** True Line Result - y: y.idiv(rt_canvas.zoom) } -** Processing line: ~ end~ + # render a mouse cursor since we have the OS cursor hidden +** Processing line: ~ args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ - Inside source: true *** True Line Result - end + args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rt_canvas~ +** Processing line: ~ # Alrighty! This is where all the fun happens~ - Inside source: true *** True Line Result - def rt_canvas -** Processing line: ~ state.rt_canvas ||= state.new_entity(:rt_canvas)~ + # Alrighty! This is where all the fun happens +** Processing line: ~ def input args~ - Inside source: true *** True Line Result - state.rt_canvas ||= state.new_entity(:rt_canvas) -** Processing line: ~ end~ + def input args +** Processing line: ~ # if the mouse is clicked and not item is currently being held~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # if the mouse is clicked and not item is currently being held +** Processing line: ~ # args.state.held_item is nil when the game starts.~ - Inside source: true *** True Line Result - -** Processing line: ~ def queues~ + # args.state.held_item is nil when the game starts. +** Processing line: ~ # If the player clicks, the property args.inputs.mouse.click will~ - Inside source: true *** True Line Result - def queues -** Processing line: ~ state.queues ||= state.new_entity(:queues)~ + # If the player clicks, the property args.inputs.mouse.click will +** Processing line: ~ # be a non nil value, we don't want to process any of the code here~ - Inside source: true *** True Line Result - state.queues ||= state.new_entity(:queues) -** Processing line: ~ end~ + # be a non nil value, we don't want to process any of the code here +** Processing line: ~ # if the mouse hasn't been clicked~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # if the mouse hasn't been clicked +** Processing line: ~ return if !args.inputs.mouse.click~ - Inside source: true *** True Line Result - end + return if !args.inputs.mouse.click ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $game = OneBitLowrezPaint.new~ +** Processing line: ~ # if a click occurred, add a ripple to the ripple queue~ - Inside source: true *** True Line Result - $game = OneBitLowrezPaint.new + # if a click occurred, add a ripple to the ripple queue +** Processing line: ~ args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ +- Inside source: true +*** True Line Result + args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ # if the mouse has been clicked, and no item is currently held...~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $game.args = args~ + # if the mouse has been clicked, and no item is currently held... +** Processing line: ~ if !args.state.held_item~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + if !args.state.held_item +** Processing line: ~ # see if any of the items intersect the pointer using the inside_rect? method~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + # see if any of the items intersect the pointer using the inside_rect? method +** Processing line: ~ # the find method will either return the first object that returns true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # the find method will either return the first object that returns true +** Processing line: ~ # for the match clause, or it'll return nil if nothing matches the match clause~ - Inside source: true *** True Line Result - -** Processing line: ~ # $gtk.reset~ + # for the match clause, or it'll return nil if nothing matches the match clause +** Processing line: ~ found = args.state.items.find do |item|~ - Inside source: true *** True Line Result - # $gtk.reset -** Processing line: ~~ + found = args.state.items.find do |item| +** Processing line: ~ # for each item in args.state.items, run the following boolean check~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_dev_tools/tile_editor_starting_point/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_dev_tools/tile_editor_starting_point/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + # for each item in args.state.items, run the following boolean check +** Processing line: ~ args.inputs.mouse.click.point.inside_rect?(item)~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + args.inputs.mouse.click.point.inside_rect?(item) +** Processing line: ~ end~ - Inside source: true *** True Line Result - =begin + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ -- Inside source: true -*** True Line Result - APIs listing that haven't been encountered in previous sample apps: -** Processing line: ~~ +** Processing line: ~ # if an item intersects the mouse pointer, then set the item's location to :held and~ - Inside source: true *** True Line Result - -** Processing line: ~ - to_s: Returns a string representation of an object.~ + # if an item intersects the mouse pointer, then set the item's location to :held and +** Processing line: ~ # set args.state.held_item to the item for later reference~ - Inside source: true *** True Line Result - - to_s: Returns a string representation of an object. -** Processing line: ~ For example, if we had~ + # set args.state.held_item to the item for later reference +** Processing line: ~ if found~ - Inside source: true *** True Line Result - For example, if we had -** Processing line: ~ 500.to_s~ + if found +** Processing line: ~ args.state.held_item = found~ - Inside source: true *** True Line Result - 500.to_s -** Processing line: ~ the string "500" would be returned.~ + args.state.held_item = found +** Processing line: ~ found[:location] = :held~ - Inside source: true *** True Line Result - the string "500" would be returned. -** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ + found[:location] = :held +** Processing line: ~ end~ - Inside source: true *** True Line Result - Similar to to_i, which returns an integer representation of an object. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - Ceil: Returns an integer number greater than or equal to the original~ +** Processing line: ~ # if the mouse is clicked and an item is currently beign held....~ - Inside source: true *** True Line Result - - Ceil: Returns an integer number greater than or equal to the original -** Processing line: ~ with no decimal.~ + # if the mouse is clicked and an item is currently beign held.... +** Processing line: ~ elsif args.state.held_item~ - Inside source: true *** True Line Result - with no decimal. -** Processing line: ~~ + elsif args.state.held_item +** Processing line: ~ # determine if a slot within the craft area was clicked~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + # determine if a slot within the craft area was clicked +** Processing line: ~ craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ - Inside source: true *** True Line Result - Reminders: + craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect.~ +** Processing line: ~ # also determine if a slot within the inventory area was clicked~ - Inside source: true *** True Line Result - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect. -** Processing line: ~~ + # also determine if a slot within the inventory area was clicked +** Processing line: ~ inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ + inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } +** Processing line: ~~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + +** Processing line: ~ # if the click was within a craft area~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + # if the click was within a craft area +** Processing line: ~ if craft_area~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + if craft_area +** Processing line: ~ # check to see if an item is already there and ignore the click if an item is found~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ + # check to see if an item is already there and ignore the click if an item is found +** Processing line: ~ # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal~ - Inside source: true *** True Line Result - - args.outputs.sprites: An array. The values generate a sprite. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ + # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal +** Processing line: ~ # position~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ + # position +** Processing line: ~ item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y]~ - Inside source: true *** True Line Result - For more information about sprites, go to mygame/documentation/05-sprites.md. + item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -- Inside source: true -*** True Line Result - - args.outputs.solids: An array. The values generate a solid. -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ # if an item *doesn't* exist in the craft area~ - Inside source: true *** True Line Result - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ + # if an item *doesn't* exist in the craft area +** Processing line: ~ if !item_already_there~ - Inside source: true *** True Line Result - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. -** Processing line: ~~ + if !item_already_there +** Processing line: ~ # if the quantity they are currently holding is greater than 1~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ + # if the quantity they are currently holding is greater than 1 +** Processing line: ~ if args.state.held_item[:quantity] > 1~ - Inside source: true *** True Line Result - - args.outputs.lines: An array. The values generate a line. -** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ + if args.state.held_item[:quantity] > 1 +** Processing line: ~ # remove one item (creating a seperate item of the same type), and place it~ - Inside source: true *** True Line Result - The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ + # remove one item (creating a seperate item of the same type), and place it +** Processing line: ~ # at the oridinal position and location of the craft area~ - Inside source: true *** True Line Result - For more information about lines, go to mygame/documentation/04-lines.md. -** Processing line: ~~ + # at the oridinal position and location of the craft area +** Processing line: ~ # the .merge method on Hash creates a new Hash, but updates any values~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ + # the .merge method on Hash creates a new Hash, but updates any values +** Processing line: ~ # passed as arguments to merge~ - Inside source: true *** True Line Result - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. -** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ + # passed as arguments to merge +** Processing line: ~ new_item = args.state.held_item.merge(quantity: 1,~ - Inside source: true *** True Line Result - In this sample app, new_entity is used to create a new button that clears the grid. -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ + new_item = args.state.held_item.merge(quantity: 1, +** Processing line: ~ location: :craft,~ - Inside source: true *** True Line Result - (Remember, you can use state to define ANY property and it will be retained across frames.) -** Processing line: ~~ + location: :craft, +** Processing line: ~ ordinal_x: craft_area[:ordinal_x],~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + ordinal_x: craft_area[:ordinal_x], +** Processing line: ~ ordinal_y: craft_area[:ordinal_y])~ - Inside source: true *** True Line Result - =end + ordinal_y: craft_area[:ordinal_y]) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This sample app shows an empty grid that the user can paint in. There are different image tiles that~ +** Processing line: ~ # after the item is crated, place it into the args.state.items collection~ - Inside source: true *** True Line Result - # This sample app shows an empty grid that the user can paint in. There are different image tiles that -** Processing line: ~ # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes.~ + # after the item is crated, place it into the args.state.items collection +** Processing line: ~ args.state.items << new_item~ - Inside source: true *** True Line Result - # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes. + args.state.items << new_item ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class TileEditor~ +** Processing line: ~ # then subtract one from the held item~ - Inside source: true *** True Line Result - class TileEditor -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ + # then subtract one from the held item +** Processing line: ~ args.state.held_item[:quantity] -= 1~ - Inside source: true *** True Line Result - attr_accessor :inputs, :state, :outputs, :grid, :args + args.state.held_item[:quantity] -= 1 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ +** Processing line: ~ # if the craft area is available and there is only one item being held~ - Inside source: true *** True Line Result - # Runs all the methods necessary for the game to function properly. -** Processing line: ~ def tick~ + # if the craft area is available and there is only one item being held +** Processing line: ~ elsif args.state.held_item[:quantity] == 1~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + elsif args.state.held_item[:quantity] == 1 +** Processing line: ~ # instead of creating any new items just set the location of the held item~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + # instead of creating any new items just set the location of the held item +** Processing line: ~ # to the oridinal position of the craft area, and then nil out the~ - Inside source: true *** True Line Result - render -** Processing line: ~ check_click~ + # to the oridinal position of the craft area, and then nil out the +** Processing line: ~ # held item state so that a new item can be picked up~ - Inside source: true *** True Line Result - check_click -** Processing line: ~ draw_buttons~ + # held item state so that a new item can be picked up +** Processing line: ~ args.state.held_item[:location] = :craft~ - Inside source: true *** True Line Result - draw_buttons -** Processing line: ~ end~ + args.state.held_item[:location] = :craft +** Processing line: ~ args.state.held_item[:ordinal_x] = craft_area[:ordinal_x]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.held_item[:ordinal_x] = craft_area[:ordinal_x] +** Processing line: ~ args.state.held_item[:ordinal_y] = craft_area[:ordinal_y]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets default values~ + args.state.held_item[:ordinal_y] = craft_area[:ordinal_y] +** Processing line: ~ args.state.held_item = nil~ - Inside source: true *** True Line Result - # Sets default values -** Processing line: ~ # Initialization only happens in the first frame~ + args.state.held_item = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Initialization only happens in the first frame -** Processing line: ~ # NOTE: The values of some of these variables may seem confusingly large at first.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # NOTE: The values of some of these variables may seem confusingly large at first. -** Processing line: ~ # The gridSize is 1600 but it seems a lot smaller on the screen, for example.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # The gridSize is 1600 but it seems a lot smaller on the screen, for example. -** Processing line: ~ # But keep in mind that by using the "W", "A", "S", and "D" keys, you can~ + +** Processing line: ~ # if the selected area is an inventory area (as opposed to within the craft area)~ - Inside source: true *** True Line Result - # But keep in mind that by using the "W", "A", "S", and "D" keys, you can -** Processing line: ~ # move the grid's view in all four directions for more grid spaces.~ + # if the selected area is an inventory area (as opposed to within the craft area) +** Processing line: ~ elsif inventory_area~ - Inside source: true *** True Line Result - # move the grid's view in all four directions for more grid spaces. -** Processing line: ~ def defaults~ + elsif inventory_area +** Processing line: ~~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.tileCords ||= []~ + +** Processing line: ~ # check to see if there is already an item in that inventory slot~ - Inside source: true *** True Line Result - state.tileCords ||= [] -** Processing line: ~ state.tileQuantity ||= 6~ + # check to see if there is already an item in that inventory slot +** Processing line: ~ # the item_at_inventory_slot helper method returns an item or nil~ - Inside source: true *** True Line Result - state.tileQuantity ||= 6 -** Processing line: ~ state.tileSize ||= 50~ + # the item_at_inventory_slot helper method returns an item or nil +** Processing line: ~ item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y]~ - Inside source: true *** True Line Result - state.tileSize ||= 50 -** Processing line: ~ state.tileSelected ||= 1~ + item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y] +** Processing line: ~~ - Inside source: true *** True Line Result - state.tileSelected ||= 1 -** Processing line: ~ state.tempX ||= 50~ + +** Processing line: ~ # if there is already an item there, and the item types/id match~ - Inside source: true *** True Line Result - state.tempX ||= 50 -** Processing line: ~ state.tempY ||= 500~ + # if there is already an item there, and the item types/id match +** Processing line: ~ if item_already_there && item_already_there[:id] == args.state.held_item[:id]~ - Inside source: true *** True Line Result - state.tempY ||= 500 -** Processing line: ~ state.speed ||= 4~ + if item_already_there && item_already_there[:id] == args.state.held_item[:id] +** Processing line: ~ # then merge the item quantities~ - Inside source: true *** True Line Result - state.speed ||= 4 -** Processing line: ~ state.centerX ||= 4000~ + # then merge the item quantities +** Processing line: ~ held_quantity = args.state.held_item[:quantity]~ - Inside source: true *** True Line Result - state.centerX ||= 4000 -** Processing line: ~ state.centerY ||= 4000~ + held_quantity = args.state.held_item[:quantity] +** Processing line: ~ item_already_there[:quantity] += held_quantity~ - Inside source: true *** True Line Result - state.centerY ||= 4000 -** Processing line: ~ state.originalCenter ||= [state.centerX, state.centerY]~ + item_already_there[:quantity] += held_quantity +** Processing line: ~~ - Inside source: true *** True Line Result - state.originalCenter ||= [state.centerX, state.centerY] -** Processing line: ~ state.gridSize ||= 1600~ + +** Processing line: ~ # remove the item being held from the items collection (since it's quantity is now 0)~ - Inside source: true *** True Line Result - state.gridSize ||= 1600 -** Processing line: ~ state.lineQuantity ||= 50~ + # remove the item being held from the items collection (since it's quantity is now 0) +** Processing line: ~ args.state.items.reject! { |i| i[:location] == :held }~ - Inside source: true *** True Line Result - state.lineQuantity ||= 50 -** Processing line: ~ state.increment ||= state.gridSize / state.lineQuantity~ + args.state.items.reject! { |i| i[:location] == :held } +** Processing line: ~~ - Inside source: true *** True Line Result - state.increment ||= state.gridSize / state.lineQuantity -** Processing line: ~ state.gridX ||= []~ + +** Processing line: ~ # nil out the held_item so a new item can be picked up~ - Inside source: true *** True Line Result - state.gridX ||= [] -** Processing line: ~ state.gridY ||= []~ + # nil out the held_item so a new item can be picked up +** Processing line: ~ args.state.held_item = nil~ - Inside source: true *** True Line Result - state.gridY ||= [] -** Processing line: ~ state.filled_squares ||= []~ + args.state.held_item = nil +** Processing line: ~~ - Inside source: true *** True Line Result - state.filled_squares ||= [] -** Processing line: ~ state.grid_border ||= [390, 140, 500, 500]~ + +** Processing line: ~ # if there currently isn't an item there, then put the held item in the slot~ - Inside source: true *** True Line Result - state.grid_border ||= [390, 140, 500, 500] + # if there currently isn't an item there, then put the held item in the slot +** Processing line: ~ elsif !item_already_there~ +- Inside source: true +*** True Line Result + elsif !item_already_there +** Processing line: ~ args.state.held_item[:location] = :inventory~ +- Inside source: true +*** True Line Result + args.state.held_item[:location] = :inventory +** Processing line: ~ args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x]~ +- Inside source: true +*** True Line Result + args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x] +** Processing line: ~ args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y]~ +- Inside source: true +*** True Line Result + args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ get_grid unless state.tempX == 0 # calls get_grid in the first frame only~ +** Processing line: ~ # nil out the held_item so a new item can be picked up~ - Inside source: true *** True Line Result - get_grid unless state.tempX == 0 # calls get_grid in the first frame only -** Processing line: ~ determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame~ + # nil out the held_item so a new item can be picked up +** Processing line: ~ args.state.held_item = nil~ - Inside source: true *** True Line Result - determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame -** Processing line: ~ state.tempX = 0 # sets tempX to 0; the two methods aren't called again~ + args.state.held_item = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tempX = 0 # sets tempX to 0; the two methods aren't called again + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calculates the placement of lines or separators in the grid~ +** Processing line: ~ # the calc method is executed after input~ - Inside source: true *** True Line Result - # Calculates the placement of lines or separators in the grid -** Processing line: ~ def get_grid~ + # the calc method is executed after input +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - def get_grid -** Processing line: ~ curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid~ + def calc args +** Processing line: ~ # make sure that the real position of the inventory~ - Inside source: true *** True Line Result - curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid -** Processing line: ~ deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid~ + # make sure that the real position of the inventory +** Processing line: ~ # items are updated every frame to ensure that they~ - Inside source: true *** True Line Result - deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid -** Processing line: ~ (state.lineQuantity + 2).times do~ + # items are updated every frame to ensure that they +** Processing line: ~ # are placed correctly given their location and oridinal positions~ - Inside source: true *** True Line Result - (state.lineQuantity + 2).times do -** Processing line: ~ state.gridX << curr_x # adds curr_x to gridX collection~ + # are placed correctly given their location and oridinal positions +** Processing line: ~ # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place)~ - Inside source: true *** True Line Result - state.gridX << curr_x # adds curr_x to gridX collection -** Processing line: ~ curr_x += deltaX # increment curr_x by the distance between vertical lines~ + # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place) +** Processing line: ~ args.state.items.each do |item|~ - Inside source: true *** True Line Result - curr_x += deltaX # increment curr_x by the distance between vertical lines -** Processing line: ~ end~ + args.state.items.each do |item| +** Processing line: ~ # based on the location of the item, invoke the correct pixel conversion method~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # based on the location of the item, invoke the correct pixel conversion method +** Processing line: ~ if item[:location] == :inventory~ - Inside source: true *** True Line Result - -** Processing line: ~ curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid~ + if item[:location] == :inventory +** Processing line: ~ set_inventory_position args, item~ - Inside source: true *** True Line Result - curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid -** Processing line: ~ deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid~ + set_inventory_position args, item +** Processing line: ~ elsif item[:location] == :craft~ - Inside source: true *** True Line Result - deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid -** Processing line: ~ (state.lineQuantity + 2).times do~ + elsif item[:location] == :craft +** Processing line: ~ set_craft_position args, item~ - Inside source: true *** True Line Result - (state.lineQuantity + 2).times do -** Processing line: ~ state.gridY << curr_y # adds curr_y to gridY collection~ + set_craft_position args, item +** Processing line: ~ elsif item[:location] == :held~ - Inside source: true *** True Line Result - state.gridY << curr_y # adds curr_y to gridY collection -** Processing line: ~ curr_y += deltaY # increments curr_y to distance between horizontal lines~ + elsif item[:location] == :held +** Processing line: ~ # if the item is held, center the item around the mouse pointer~ - Inside source: true *** True Line Result - curr_y += deltaY # increments curr_y to distance between horizontal lines + # if the item is held, center the item around the mouse pointer +** Processing line: ~ args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half~ +- Inside source: true +*** True Line Result + args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half +** Processing line: ~ args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half~ +- Inside source: true +*** True Line Result + args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -45405,54 +45760,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Determines coordinate positions of patterned tiles (on the left side of the grid)~ -- Inside source: true -*** True Line Result - # Determines coordinate positions of patterned tiles (on the left side of the grid) -** Processing line: ~ def determineTileCords~ +** Processing line: ~ # for each hash/sprite in the click ripples queue,~ - Inside source: true *** True Line Result - def determineTileCords -** Processing line: ~ state.tempCounter ||= 1 # initializes tempCounter to 1~ + # for each hash/sprite in the click ripples queue, +** Processing line: ~ # expand its size by 20 percent and decrease its alpha~ - Inside source: true *** True Line Result - state.tempCounter ||= 1 # initializes tempCounter to 1 -** Processing line: ~ state.tileQuantity.times do # there are 6 different kinds of tiles~ + # expand its size by 20 percent and decrease its alpha +** Processing line: ~ # by 10.~ - Inside source: true *** True Line Result - state.tileQuantity.times do # there are 6 different kinds of tiles -** Processing line: ~ state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection~ + # by 10. +** Processing line: ~ args.state.click_ripples.each do |ripple|~ - Inside source: true *** True Line Result - state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection -** Processing line: ~ state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles~ + args.state.click_ripples.each do |ripple| +** Processing line: ~ delta_w = ripple.w * 1.2 - ripple.w~ - Inside source: true *** True Line Result - state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles -** Processing line: ~ state.tempCounter += 1 # increments tempCounter~ + delta_w = ripple.w * 1.2 - ripple.w +** Processing line: ~ delta_h = ripple.h * 1.2 - ripple.h~ - Inside source: true *** True Line Result - state.tempCounter += 1 # increments tempCounter -** Processing line: ~ if state.tempX > 200 # if tempX exceeds 200 pixels~ + delta_h = ripple.h * 1.2 - ripple.h +** Processing line: ~ ripple.x -= delta_w.half~ - Inside source: true *** True Line Result - if state.tempX > 200 # if tempX exceeds 200 pixels -** Processing line: ~ state.tempX = 50 # a new row of patterned tiles begins~ + ripple.x -= delta_w.half +** Processing line: ~ ripple.y -= delta_h.half~ - Inside source: true *** True Line Result - state.tempX = 50 # a new row of patterned tiles begins -** Processing line: ~ state.tempY -= 75 # the new row is 75 pixels lower than the previous row~ + ripple.y -= delta_h.half +** Processing line: ~ ripple.w += delta_w~ - Inside source: true *** True Line Result - state.tempY -= 75 # the new row is 75 pixels lower than the previous row -** Processing line: ~ end~ + ripple.w += delta_w +** Processing line: ~ ripple.h += delta_h~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ripple.h += delta_h +** Processing line: ~ ripple.a -= 10~ - Inside source: true *** True Line Result - end + ripple.a -= 10 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -45461,646 +45812,682 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Outputs objects (grid, tiles, etc) onto the screen~ +** Processing line: ~ # remove any items from the collection where the alpha value is less than equal to~ - Inside source: true *** True Line Result - # Outputs objects (grid, tiles, etc) onto the screen -** Processing line: ~ def render~ + # remove any items from the collection where the alpha value is less than equal to +** Processing line: ~ # zero using the reject! method (reject with an exclamation point at the end changes the~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder~ + # zero using the reject! method (reject with an exclamation point at the end changes the +** Processing line: ~ # array value in place, while reject without the exclamation point returns a new array).~ - Inside source: true *** True Line Result - outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder -** Processing line: ~ |x, y, order|~ + # array value in place, while reject without the exclamation point returns a new array). +** Processing line: ~ args.state.click_ripples.reject! { |ripple| ripple.a <= 0 }~ - Inside source: true *** True Line Result - |x, y, order| -** Processing line: ~ [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"]~ + args.state.click_ripples.reject! { |ripple| ripple.a <= 0 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"] -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background~ + +** Processing line: ~ # helper function for finding an item at a craft slot~ - Inside source: true *** True Line Result - outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background -** Processing line: ~ add_grid # outputs grid~ + # helper function for finding an item at a craft slot +** Processing line: ~ def item_at_craft_slot args, ordinal_x, ordinal_y~ - Inside source: true *** True Line Result - add_grid # outputs grid -** Processing line: ~ print_title # outputs title and current tile pattern~ + def item_at_craft_slot args, ordinal_x, ordinal_y +** Processing line: ~ args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ - Inside source: true *** True Line Result - print_title # outputs title and current tile pattern -** Processing line: ~ end~ + args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates a grid by outputting vertical and horizontal grid lines onto the screen.~ +** Processing line: ~ # helper function for finding an item at an inventory slot~ - Inside source: true *** True Line Result - # Creates a grid by outputting vertical and horizontal grid lines onto the screen. -** Processing line: ~ # Outputs sprites for the filled_squares collection onto the screen.~ + # helper function for finding an item at an inventory slot +** Processing line: ~ def item_at_inventory_slot args, ordinal_x, ordinal_y~ - Inside source: true *** True Line Result - # Outputs sprites for the filled_squares collection onto the screen. -** Processing line: ~ def add_grid~ + def item_at_inventory_slot args, ordinal_x, ordinal_y +** Processing line: ~ args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ - Inside source: true *** True Line Result - def add_grid + args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs the grid's border.~ +** Processing line: ~ # helper function that creates a visual representation of an item~ - Inside source: true *** True Line Result - # Outputs the grid's border. -** Processing line: ~ outputs.borders << state.grid_border~ + # helper function that creates a visual representation of an item +** Processing line: ~ def item_prefab args, item, should_highlight, mouse~ - Inside source: true *** True Line Result - outputs.borders << state.grid_border -** Processing line: ~ temp = 0~ + def item_prefab args, item, should_highlight, mouse +** Processing line: ~ return nil unless item~ - Inside source: true *** True Line Result - temp = 0 + return nil unless item ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Before looking at the code that outputs the vertical and horizontal lines in the~ +** Processing line: ~ overlay = nil~ - Inside source: true *** True Line Result - # Before looking at the code that outputs the vertical and horizontal lines in the -** Processing line: ~ # grid, take note of the fact that:~ + overlay = nil +** Processing line: ~~ - Inside source: true *** True Line Result - # grid, take note of the fact that: -** Processing line: ~ # grid_border[1] refers to the border's bottom line (running horizontally),~ + +** Processing line: ~ x = item.x~ - Inside source: true *** True Line Result - # grid_border[1] refers to the border's bottom line (running horizontally), -** Processing line: ~ # grid_border[2] refers to the border's top line (running (horizontally),~ + x = item.x +** Processing line: ~ y = item.y~ - Inside source: true *** True Line Result - # grid_border[2] refers to the border's top line (running (horizontally), -** Processing line: ~ # grid_border[0] refers to the border's left line (running vertically),~ + y = item.y +** Processing line: ~ w = item.w~ - Inside source: true *** True Line Result - # grid_border[0] refers to the border's left line (running vertically), -** Processing line: ~ # and grid_border[3] refers to the border's right line (running vertically).~ + w = item.w +** Processing line: ~ h = item.h~ - Inside source: true *** True Line Result - # and grid_border[3] refers to the border's right line (running vertically). + h = item.h ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # [2]~ +** Processing line: ~ if should_highlight && mouse.point.inside_rect?(item)~ - Inside source: true *** True Line Result - # [2] -** Processing line: ~ # ----------~ + if should_highlight && mouse.point.inside_rect?(item) +** Processing line: ~ overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, }~ - Inside source: true *** True Line Result - # ---------- -** Processing line: ~ # | |~ + overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # | | -** Processing line: ~ # [0] | | [3]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # [0] | | [3] -** Processing line: ~ # | |~ + +** Processing line: ~ [~ - Inside source: true *** True Line Result - # | | -** Processing line: ~ # ----------~ + [ +** Processing line: ~ # sprites are hashes with a path property, this is the main sprite~ - Inside source: true *** True Line Result - # ---------- -** Processing line: ~ # [1]~ + # sprites are hashes with a path property, this is the main sprite +** Processing line: ~ { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], },~ - Inside source: true *** True Line Result - # [1] + { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], }, ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calculates the positions and outputs the x grid lines in the color gray.~ -- Inside source: true -*** True Line Result - # Calculates the positions and outputs the x grid lines in the color gray. -** Processing line: ~ state.gridX.map do # perform an action on all elements of the gridX collection~ +** Processing line: ~ # this represents the black area in the bottom right corner of the main sprite so that the~ - Inside source: true *** True Line Result - state.gridX.map do # perform an action on all elements of the gridX collection -** Processing line: ~ |x|~ + # this represents the black area in the bottom right corner of the main sprite so that the +** Processing line: ~ # quantity is visible~ - Inside source: true *** True Line Result - |x| -** Processing line: ~ temp += 1 # increment temp~ + # quantity is visible +** Processing line: ~ { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property~ - Inside source: true *** True Line Result - temp += 1 # increment temp + { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if x's value is greater than (or equal to) the x value of the border's left side~ +** Processing line: ~ # labels are hashes with a text property~ - Inside source: true *** True Line Result - # if x's value is greater than (or equal to) the x value of the border's left side -** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ + # labels are hashes with a text property +** Processing line: ~ { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, },~ - Inside source: true *** True Line Result - # and less than (or equal to) the x value of the border's right side -** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2)~ + { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, }, +** Processing line: ~~ - Inside source: true *** True Line Result - if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2) -** Processing line: ~ delta = state.centerX - 640~ + +** Processing line: ~ # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered)~ - Inside source: true *** True Line Result - delta = state.centerX - 640 -** Processing line: ~ # vertical lines have the same starting and ending x positions~ + # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered) +** Processing line: ~ overlay~ - Inside source: true *** True Line Result - # vertical lines have the same starting and ending x positions -** Processing line: ~ # starting y and ending y positions lead from the bottom of the border to the top of the border~ + overlay +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # starting y and ending y positions lead from the bottom of the border to the top of the border -** Processing line: ~ outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # helper function for deriving the position of an item within inventory~ - Inside source: true *** True Line Result - end -** Processing line: ~ temp = 0~ + # helper function for deriving the position of an item within inventory +** Processing line: ~ def set_inventory_position args, item~ - Inside source: true *** True Line Result - temp = 0 -** Processing line: ~~ + def set_inventory_position args, item +** Processing line: ~ item.x = args.state.inventory_border.x + item[:ordinal_x] * 80~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calculates the positions and outputs the y grid lines in the color gray.~ + item.x = args.state.inventory_border.x + item[:ordinal_x] * 80 +** Processing line: ~ item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ - Inside source: true *** True Line Result - # Calculates the positions and outputs the y grid lines in the color gray. -** Processing line: ~ state.gridY.map do # perform an action on all elements of the gridY collection~ + item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 +** Processing line: ~ item.w = 80~ - Inside source: true *** True Line Result - state.gridY.map do # perform an action on all elements of the gridY collection -** Processing line: ~ |y|~ + item.w = 80 +** Processing line: ~ item.h = 80~ - Inside source: true *** True Line Result - |y| -** Processing line: ~ temp += 1 # increment temp~ + item.h = 80 +** Processing line: ~ end~ - Inside source: true *** True Line Result - temp += 1 # increment temp + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if y's value is greater than (or equal to) the y value of the border's bottom side~ +** Processing line: ~ # helper function for deriving the position of an item within the craft area~ - Inside source: true *** True Line Result - # if y's value is greater than (or equal to) the y value of the border's bottom side -** Processing line: ~ # and less than (or equal to) the y value of the border's top side~ + # helper function for deriving the position of an item within the craft area +** Processing line: ~ def set_craft_position args, item~ - Inside source: true *** True Line Result - # and less than (or equal to) the y value of the border's top side -** Processing line: ~ if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2)~ + def set_craft_position args, item +** Processing line: ~ item.x = args.state.craft_border.x + item[:ordinal_x] * 80~ - Inside source: true *** True Line Result - if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) -** Processing line: ~ delta = state.centerY - 393~ + item.x = args.state.craft_border.x + item[:ordinal_x] * 80 +** Processing line: ~ item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ - Inside source: true *** True Line Result - delta = state.centerY - 393 -** Processing line: ~ # horizontal lines have the same starting and ending y positions~ + item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 +** Processing line: ~ item.w = 80~ - Inside source: true *** True Line Result - # horizontal lines have the same starting and ending y positions -** Processing line: ~ # starting x and ending x positions lead from the left side of the border to the right side of the border~ + item.w = 80 +** Processing line: ~ item.h = 80~ - Inside source: true *** True Line Result - # starting x and ending x positions lead from the left side of the border to the right side of the border -** Processing line: ~ outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it~ + item.h = 80 +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # Any lines outside of a function will be executed when the file is reloaded.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Any lines outside of a function will be executed when the file is reloaded. +** Processing line: ~ # So every time you save main.rb, the game will be reset.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets values and outputs sprites for the filled_squares collection.~ + # So every time you save main.rb, the game will be reset. +** Processing line: ~ # Comment out the line below if you don't want this to happen.~ - Inside source: true *** True Line Result - # Sets values and outputs sprites for the filled_squares collection. -** Processing line: ~ state.filled_squares.map do # perform an action on every element of the filled_squares collection~ + # Comment out the line below if you don't want this to happen. +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - state.filled_squares.map do # perform an action on every element of the filled_squares collection -** Processing line: ~ |x, y, w, h, sprite|~ + $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - |x, y, w, h, sprite| -** Processing line: ~ # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Dev Tools - Add Buttons To Console - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Dev Tools - Add Buttons To Console - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb~ - Inside source: true *** True Line Result - # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side -** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ + # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb +** Processing line: ~ # You can customize the buttons that show up in the Console.~ - Inside source: true *** True Line Result - # and less than (or equal to) the x value of the border's right side -** Processing line: ~ # and y's value is greater than (or equal to) the y value of the border's bottom side~ + # You can customize the buttons that show up in the Console. +** Processing line: ~ class GTK::Console::Menu~ - Inside source: true *** True Line Result - # and y's value is greater than (or equal to) the y value of the border's bottom side -** Processing line: ~ # and less than (or equal to) the y value of 25 pixels above the border's top side~ + class GTK::Console::Menu +** Processing line: ~ # STEP 1: Override the custom_buttons function.~ - Inside source: true *** True Line Result - # and less than (or equal to) the y value of 25 pixels above the border's top side -** Processing line: ~ # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or~ + # STEP 1: Override the custom_buttons function. +** Processing line: ~ def custom_buttons~ - Inside source: true *** True Line Result - # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or -** Processing line: ~ # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D")~ + def custom_buttons +** Processing line: ~ [~ - Inside source: true *** True Line Result - # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D") -** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) &&~ + [ +** Processing line: ~ (button id: :yay,~ - Inside source: true *** True Line Result - if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) && -** Processing line: ~ y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25~ + (button id: :yay, +** Processing line: ~ # row for button~ - Inside source: true *** True Line Result - y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25 -** Processing line: ~ # calculations done to place sprites in grid spaces that are meant to filled in~ + # row for button +** Processing line: ~ row: 3,~ - Inside source: true *** True Line Result - # calculations done to place sprites in grid spaces that are meant to filled in -** Processing line: ~ # mess around with the x and y values and see how the sprite placement changes~ + row: 3, +** Processing line: ~ # column for button~ - Inside source: true *** True Line Result - # mess around with the x and y values and see how the sprite placement changes -** Processing line: ~ outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite]~ + # column for button +** Processing line: ~ col: 10,~ - Inside source: true *** True Line Result - outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite] -** Processing line: ~ end~ + col: 10, +** Processing line: ~ # text~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # text +** Processing line: ~ text: "I AM CUSTOM",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + text: "I AM CUSTOM", +** Processing line: ~ # when clicked call the custom_button_clicked function~ - Inside source: true *** True Line Result - -** Processing line: ~ # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background)~ + # when clicked call the custom_button_clicked function +** Processing line: ~ method: :custom_button_clicked),~ - Inside source: true *** True Line Result - # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background) -** Processing line: ~ # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner~ + method: :custom_button_clicked), +** Processing line: ~~ - Inside source: true *** True Line Result - # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner -** Processing line: ~ # state.increment subtracted in y parameter to avoid covering the title label~ + +** Processing line: ~ (button id: :yay,~ - Inside source: true *** True Line Result - # state.increment subtracted in y parameter to avoid covering the title label -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment,~ + (button id: :yay, +** Processing line: ~ # row for button~ - Inside source: true *** True Line Result - outputs.primitives << [state.grid_border[0] - state.increment, -** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ + # row for button +** Processing line: ~ row: 3,~ - Inside source: true *** True Line Result - state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), -** Processing line: ~ 255, 255, 255].solid~ + row: 3, +** Processing line: ~ # column for button~ - Inside source: true *** True Line Result - 255, 255, 255].solid -** Processing line: ~~ + # column for button +** Processing line: ~ col: 9,~ - Inside source: true *** True Line Result - -** Processing line: ~ # outputs a white solid along the right side of the grid~ + col: 9, +** Processing line: ~ # text~ - Inside source: true *** True Line Result - # outputs a white solid along the right side of the grid -** Processing line: ~ # state.increment subtracted from y parameter to avoid covering title label~ + # text +** Processing line: ~ text: "CUSTOM ALSO",~ - Inside source: true *** True Line Result - # state.increment subtracted from y parameter to avoid covering title label -** Processing line: ~ outputs.primitives << [state.grid_border[0] + state.grid_border[2],~ + text: "CUSTOM ALSO", +** Processing line: ~ # when clicked call the custom_button_also_clicked function~ - Inside source: true *** True Line Result - outputs.primitives << [state.grid_border[0] + state.grid_border[2], -** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ + # when clicked call the custom_button_also_clicked function +** Processing line: ~ method: :custom_button_also_clicked)~ - Inside source: true *** True Line Result - state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), -** Processing line: ~ 255, 255, 255].solid~ + method: :custom_button_also_clicked) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - 255, 255, 255].solid + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # outputs a white solid along the bottom of the grid~ +** Processing line: ~ # STEP 2: Define the function that should be called.~ - Inside source: true *** True Line Result - # outputs a white solid along the bottom of the grid -** Processing line: ~ # state.increment subtracted from y parameter to avoid covering last row of grid boxes~ + # STEP 2: Define the function that should be called. +** Processing line: ~ def custom_button_clicked~ - Inside source: true *** True Line Result - # state.increment subtracted from y parameter to avoid covering last row of grid boxes -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment,~ + def custom_button_clicked +** Processing line: ~ log "* INFO: I AM CUSTOM was clicked!"~ - Inside source: true *** True Line Result - outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment, -** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ + log "* INFO: I AM CUSTOM was clicked!" +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # outputs a white solid along the top of the grid~ -- Inside source: true -*** True Line Result - # outputs a white solid along the top of the grid -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3],~ +** Processing line: ~ def custom_button_also_clicked~ - Inside source: true *** True Line Result - outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3], -** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ + def custom_button_also_clicked +** Processing line: ~ log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!"~ - Inside source: true *** True Line Result - state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!" ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ end~ +** Processing line: ~ all_buttons_as_string = $gtk.console.menu.buttons.map do |b|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + all_buttons_as_string = $gtk.console.menu.buttons.map do |b| +** Processing line: ~ <<-S.strip~ - Inside source: true *** True Line Result - -** Processing line: ~ # Outputs title and current tile pattern~ + <<-S.strip +** Processing line: ~ ** id: #{b[:id]}~ - Inside source: true *** True Line Result - # Outputs title and current tile pattern -** Processing line: ~ def print_title~ + ** id: #{b[:id]} +** Processing line: ~ :PROPERTIES:~ - Inside source: true *** True Line Result - def print_title -** Processing line: ~ outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label~ + :PROPERTIES: +** Processing line: ~ :id: :#{b[:id]}~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label -** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator~ + :id: :#{b[:id]} +** Processing line: ~ :method: :#{b[:method]}~ - Inside source: true *** True Line Result - outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator -** Processing line: ~ outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label~ + :method: :#{b[:method]} +** Processing line: ~ :text: #{b[:text]}~ - Inside source: true *** True Line Result - outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label -** Processing line: ~ outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile~ + :text: #{b[:text]} +** Processing line: ~ :END:~ - Inside source: true *** True Line Result - outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile -** Processing line: ~ end~ + :END: +** Processing line: ~ S~ - Inside source: true *** True Line Result - end + S +** Processing line: ~ end.join("\n")~ +- Inside source: true +*** True Line Result + end.join("\n") ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ +** Processing line: ~ log <<-S~ - Inside source: true *** True Line Result - # Sets the starting position, ending position, and color for the horizontal separator. -** Processing line: ~ def horizontal_separator y, x, x2~ + log <<-S +** Processing line: ~ * INFO: Here are all the buttons:~ - Inside source: true *** True Line Result - def horizontal_separator y, x, x2 -** Processing line: ~ [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y~ + * INFO: Here are all the buttons: +** Processing line: ~ #{all_buttons_as_string}~ - Inside source: true *** True Line Result - [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y + #{all_buttons_as_string} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Checks if the mouse is being clicked or dragged~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # Checks if the mouse is being clicked or dragged -** Processing line: ~ def check_click~ + def tick args +** Processing line: ~ args.outputs.labels << [args.grid.center.x, args.grid.center.y,~ - Inside source: true *** True Line Result - def check_click -** Processing line: ~ if inputs.keyboard.key_down.r # if the "r" key is pressed down~ + args.outputs.labels << [args.grid.center.x, args.grid.center.y, +** Processing line: ~ "Open the DragonRuby Console to see the custom menu items.",~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.r # if the "r" key is pressed down -** Processing line: ~ $dragon.reset~ + "Open the DragonRuby Console to see the custom menu items.", +** Processing line: ~ 0, 1]~ - Inside source: true *** True Line Result - $dragon.reset -** Processing line: ~ end~ + 0, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if inputs.mouse.down #is mouse up or down? -** Processing line: ~ state.mouse_held = true~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.mouse_held = true -** Processing line: ~ if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders~ -- Inside source: true + +** Processing line: ~* Dev Tools - Animation Creator Starting Point - main.rb~ +- Header detected. *** True Line Result - if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders -** Processing line: ~ state.tileCords.map do # perform action on all elements of tileCords collection~ -- Inside source: true + *** True Line Result - state.tileCords.map do # perform action on all elements of tileCords collection -** Processing line: ~ |x, y, order|~ -- Inside source: true +* Dev Tools - Animation Creator Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - |x, y, order| -** Processing line: ~ # if mouse's x position is greater than (or equal to) the starting x position of a tile~ -- Inside source: true + *** True Line Result - # if mouse's x position is greater than (or equal to) the starting x position of a tile -** Processing line: ~ # and the mouse's x position is also less than (or equal to) the ending x position of that tile,~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb~ - Inside source: true *** True Line Result - # and the mouse's x position is also less than (or equal to) the ending x position of that tile, -** Processing line: ~ # and the mouse's y position is greater than (or equal to) the starting y position of that tile,~ + # ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb +** Processing line: ~ class OneBitLowrezPaint~ - Inside source: true *** True Line Result - # and the mouse's y position is greater than (or equal to) the starting y position of that tile, -** Processing line: ~ # and the mouse's y position is also less than (or equal to) the ending y position of that tile,~ + class OneBitLowrezPaint +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - # and the mouse's y position is also less than (or equal to) the ending y position of that tile, -** Processing line: ~ # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE)~ + attr_gtk +** Processing line: ~~ - Inside source: true *** True Line Result - # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE) -** Processing line: ~ if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize &&~ + +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize && -** Processing line: ~ inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize~ + def tick +** Processing line: ~ outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize -** Processing line: ~ state.tileSelected = order # that tile is selected~ + outputs.background_color = [0, 0, 0] +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - state.tileSelected = order # that tile is selected -** Processing line: ~ end~ + defaults +** Processing line: ~ render_instructions~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_instructions +** Processing line: ~ render_canvas~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_canvas +** Processing line: ~ render_buttons_frame_selection~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state~ + render_buttons_frame_selection +** Processing line: ~ render_animation_frame_thumbnails~ - Inside source: true *** True Line Result - elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state -** Processing line: ~ state.mouse_held = false # mouse is not held down or dragged~ + render_animation_frame_thumbnails +** Processing line: ~ render_animation~ - Inside source: true *** True Line Result - state.mouse_held = false # mouse is not held down or dragged -** Processing line: ~ state.mouse_dragging = false~ + render_animation +** Processing line: ~ input_mouse_click~ - Inside source: true *** True Line Result - state.mouse_dragging = false -** Processing line: ~ end~ + input_mouse_click +** Processing line: ~ input_keyboard~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + input_keyboard +** Processing line: ~ calc_auto_export~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.mouse_held && # mouse needs to be down~ + calc_auto_export +** Processing line: ~ calc_buttons_frame_selection~ - Inside source: true *** True Line Result - if state.mouse_held && # mouse needs to be down -** Processing line: ~ !inputs.mouse.click && # must not be first click~ + calc_buttons_frame_selection +** Processing line: ~ calc_animation_frames~ - Inside source: true *** True Line Result - !inputs.mouse.click && # must not be first click -** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 ||~ + calc_animation_frames +** Processing line: ~ process_queue_create_sprite~ - Inside source: true *** True Line Result - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 || -** Processing line: ~ (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag"~ + process_queue_create_sprite +** Processing line: ~ process_queue_reset_sprite~ - Inside source: true *** True Line Result - (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag" -** Processing line: ~ state.mouse_dragging = true~ + process_queue_reset_sprite +** Processing line: ~ process_queue_update_rt_animation_frame~ - Inside source: true *** True Line Result - state.mouse_dragging = true -** Processing line: ~ end~ + process_queue_update_rt_animation_frame +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if mouse is clicked inside grid's border, search_lines method is called with click input type~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - # if mouse is clicked inside grid's border, search_lines method is called with click input type -** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ + def defaults +** Processing line: ~ state.animation_frames_per_second = 12~ - Inside source: true *** True Line Result - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) -** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ + state.animation_frames_per_second = 12 +** Processing line: ~ queues.create_sprite ||= []~ - Inside source: true *** True Line Result - search_lines(inputs.mouse.click.point, :click) + queues.create_sprite ||= [] +** Processing line: ~ queues.reset_sprite ||= []~ +- Inside source: true +*** True Line Result + queues.reset_sprite ||= [] +** Processing line: ~ queues.update_rt_animation_frame ||= []~ +- Inside source: true +*** True Line Result + queues.update_rt_animation_frame ||= [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if mouse is dragged inside grid's border, search_lines method is called with drag input type~ +** Processing line: ~ if !state.animation_frames~ - Inside source: true *** True Line Result - # if mouse is dragged inside grid's border, search_lines method is called with drag input type -** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ + if !state.animation_frames +** Processing line: ~ state.animation_frames ||= []~ - Inside source: true *** True Line Result - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) -** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ + state.animation_frames ||= [] +** Processing line: ~ add_animation_frame_to_end~ - Inside source: true *** True Line Result - search_lines(inputs.mouse.position, :drag) + add_animation_frame_to_end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -46109,238 +46496,246 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Changes grid's position on screen by moving it up, down, left, or right.~ +** Processing line: ~ state.last_mouse_down ||= 0~ - Inside source: true *** True Line Result - # Changes grid's position on screen by moving it up, down, left, or right. + state.last_mouse_down ||= 0 +** Processing line: ~ state.last_mouse_up ||= 0~ +- Inside source: true +*** True Line Result + state.last_mouse_up ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # centerX is incremented by speed if the "d" key is pressed and if that sum is less than~ +** Processing line: ~ state.buttons_frame_selection.left = 10~ - Inside source: true *** True Line Result - # centerX is incremented by speed if the "d" key is pressed and if that sum is less than -** Processing line: ~ # the original left side of the center plus half the grid, minus half the top border of grid.~ + state.buttons_frame_selection.left = 10 +** Processing line: ~ state.buttons_frame_selection.top = grid.top - 10~ - Inside source: true *** True Line Result - # the original left side of the center plus half the grid, minus half the top border of grid. -** Processing line: ~ # MOVES GRID RIGHT (increasing x)~ + state.buttons_frame_selection.top = grid.top - 10 +** Processing line: ~ state.buttons_frame_selection.size = 20~ - Inside source: true *** True Line Result - # MOVES GRID RIGHT (increasing x) -** Processing line: ~ state.centerX += state.speed if inputs.keyboard.key_held.d &&~ + state.buttons_frame_selection.size = 20 +** Processing line: ~~ - Inside source: true *** True Line Result - state.centerX += state.speed if inputs.keyboard.key_held.d && -** Processing line: ~ (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2)~ + +** Processing line: ~ defaults_canvas_sprite~ - Inside source: true *** True Line Result - (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2) -** Processing line: ~ # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than~ + defaults_canvas_sprite +** Processing line: ~~ - Inside source: true *** True Line Result - # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than -** Processing line: ~ # the original left side of the center minus half the grid, plus half the top border of grid.~ + +** Processing line: ~ state.edit_mode ||= :drawing~ - Inside source: true *** True Line Result - # the original left side of the center minus half the grid, plus half the top border of grid. -** Processing line: ~ # MOVES GRID LEFT (decreasing x)~ + state.edit_mode ||= :drawing +** Processing line: ~ end~ - Inside source: true *** True Line Result - # MOVES GRID LEFT (decreasing x) -** Processing line: ~ state.centerX -= state.speed if inputs.keyboard.key_held.a &&~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.centerX -= state.speed if inputs.keyboard.key_held.a && -** Processing line: ~ (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2)~ + +** Processing line: ~ def defaults_canvas_sprite~ - Inside source: true *** True Line Result - (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2) -** Processing line: ~ # centerY is incremented by speed if the "w" key is pressed and if that sum is less than~ + def defaults_canvas_sprite +** Processing line: ~ rt_canvas.size = 16~ - Inside source: true *** True Line Result - # centerY is incremented by speed if the "w" key is pressed and if that sum is less than -** Processing line: ~ # the original bottom of the center plus half the grid, minus half the right border of grid.~ + rt_canvas.size = 16 +** Processing line: ~ rt_canvas.zoom = 30~ - Inside source: true *** True Line Result - # the original bottom of the center plus half the grid, minus half the right border of grid. -** Processing line: ~ # MOVES GRID UP (increasing y)~ + rt_canvas.zoom = 30 +** Processing line: ~ rt_canvas.width = rt_canvas.size * rt_canvas.zoom~ - Inside source: true *** True Line Result - # MOVES GRID UP (increasing y) -** Processing line: ~ state.centerY += state.speed if inputs.keyboard.key_held.w &&~ + rt_canvas.width = rt_canvas.size * rt_canvas.zoom +** Processing line: ~ rt_canvas.height = rt_canvas.size * rt_canvas.zoom~ - Inside source: true *** True Line Result - state.centerY += state.speed if inputs.keyboard.key_held.w && -** Processing line: ~ (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2)~ + rt_canvas.height = rt_canvas.size * rt_canvas.zoom +** Processing line: ~ rt_canvas.sprite = { x: 0,~ - Inside source: true *** True Line Result - (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2) -** Processing line: ~ # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than~ + rt_canvas.sprite = { x: 0, +** Processing line: ~ y: 0,~ - Inside source: true *** True Line Result - # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than -** Processing line: ~ # the original bottom of the center minus half the grid, plus half the right border of grid.~ + y: 0, +** Processing line: ~ w: rt_canvas.width,~ - Inside source: true *** True Line Result - # the original bottom of the center minus half the grid, plus half the right border of grid. -** Processing line: ~ # MOVES GRID DOWN (decreasing y)~ + w: rt_canvas.width, +** Processing line: ~ h: rt_canvas.height,~ - Inside source: true *** True Line Result - # MOVES GRID DOWN (decreasing y) -** Processing line: ~ state.centerY -= state.speed if inputs.keyboard.key_held.s &&~ + h: rt_canvas.height, +** Processing line: ~ path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720)~ - Inside source: true *** True Line Result - state.centerY -= state.speed if inputs.keyboard.key_held.s && -** Processing line: ~ (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2)~ + path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720) +** Processing line: ~~ - Inside source: true *** True Line Result - (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2) -** Processing line: ~ end~ + +** Processing line: ~ return unless state.tick_count == 1~ - Inside source: true *** True Line Result - end + return unless state.tick_count == 1 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Performs calculations on the gridX and gridY collections, and sets values.~ +** Processing line: ~ outputs[:rt_canvas].width = rt_canvas.width~ - Inside source: true *** True Line Result - # Performs calculations on the gridX and gridY collections, and sets values. -** Processing line: ~ # Sets the definition of a grid box, including the image that it is filled with.~ + outputs[:rt_canvas].width = rt_canvas.width +** Processing line: ~ outputs[:rt_canvas].height = rt_canvas.height~ - Inside source: true *** True Line Result - # Sets the definition of a grid box, including the image that it is filled with. -** Processing line: ~ def search_lines (point, input_type)~ + outputs[:rt_canvas].height = rt_canvas.height +** Processing line: ~ outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x|~ - Inside source: true *** True Line Result - def search_lines (point, input_type) -** Processing line: ~ point.x += state.centerX - 630 # increments x and y~ + outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x| +** Processing line: ~ (rt_canvas.size + 1).map_with_index do |y|~ - Inside source: true *** True Line Result - point.x += state.centerX - 630 # increments x and y -** Processing line: ~ point.y += state.centerY - 360~ + (rt_canvas.size + 1).map_with_index do |y| +** Processing line: ~ path = 'sprites/square-white.png'~ - Inside source: true *** True Line Result - point.y += state.centerY - 360 -** Processing line: ~ findX = 0~ + path = 'sprites/square-white.png' +** Processing line: ~ path = 'sprites/square-blue.png' if x == 7 || x == 8~ - Inside source: true *** True Line Result - findX = 0 -** Processing line: ~ findY = 0~ + path = 'sprites/square-blue.png' if x == 7 || x == 8 +** Processing line: ~ { x: x * rt_canvas.zoom,~ - Inside source: true *** True Line Result - findY = 0 -** Processing line: ~ increment = state.gridSize / state.lineQuantity # divides grid by number of separators~ + { x: x * rt_canvas.zoom, +** Processing line: ~ y: y * rt_canvas.zoom,~ - Inside source: true *** True Line Result - increment = state.gridSize / state.lineQuantity # divides grid by number of separators -** Processing line: ~~ + y: y * rt_canvas.zoom, +** Processing line: ~ w: rt_canvas.zoom,~ - Inside source: true *** True Line Result - -** Processing line: ~ state.gridX.map do # perform an action on every element of collection~ + w: rt_canvas.zoom, +** Processing line: ~ h: rt_canvas.zoom,~ - Inside source: true *** True Line Result - state.gridX.map do # perform an action on every element of collection -** Processing line: ~ |x|~ + h: rt_canvas.zoom, +** Processing line: ~ path: path,~ - Inside source: true *** True Line Result - |x| -** Processing line: ~ # findX increments x by 10 if point.x is less than that sum and findX is currently 0~ + path: path, +** Processing line: ~ a: 50 }~ - Inside source: true *** True Line Result - # findX increments x by 10 if point.x is less than that sum and findX is currently 0 -** Processing line: ~ findX = x + 10 if point.x < (x + 10) && findX == 0~ + a: 50 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - findX = x + 10 if point.x < (x + 10) && findX == 0 + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.gridY.map do~ +** Processing line: ~ def render_instructions~ - Inside source: true *** True Line Result - state.gridY.map do -** Processing line: ~ |y|~ + def render_instructions +** Processing line: ~ instructions = <<-S~ - Inside source: true *** True Line Result - |y| -** Processing line: ~ # findY is set to y if point.y is less than that value and findY is currently 0~ + instructions = <<-S +** Processing line: ~ * Instructions:~ - Inside source: true *** True Line Result - # findY is set to y if point.y is less than that value and findY is currently 0 -** Processing line: ~ findY = y if point.y < (y) && findY == 0~ + * Instructions: +** Processing line: ~ - All data is stored in the ~canvas~ directory.~ - Inside source: true *** True Line Result - findY = y if point.y < (y) && findY == 0 -** Processing line: ~ end~ + - All data is stored in the ~canvas~ directory. +** Processing line: ~ - Hold ~d~ to set the edit mode to erase.~ - Inside source: true *** True Line Result - end -** Processing line: ~ # position of a box is denoted by bottom left corner, which is why the increment is being subtracted~ + - Hold ~d~ to set the edit mode to erase. +** Processing line: ~ - Release ~d~ to set the edit mode drawing.~ - Inside source: true *** True Line Result - # position of a box is denoted by bottom left corner, which is why the increment is being subtracted -** Processing line: ~ grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil,~ + - Release ~d~ to set the edit mode drawing. +** Processing line: ~ - Press ~a~ to added a frame to the end.~ - Inside source: true *** True Line Result - grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil, -** Processing line: ~ "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition~ + - Press ~a~ to added a frame to the end. +** Processing line: ~ - Press ~b~ to select the previous frame.~ - Inside source: true *** True Line Result - "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition -** Processing line: ~~ + - Press ~b~ to select the previous frame. +** Processing line: ~ - Press ~f~ to select the next frame.~ - Inside source: true *** True Line Result - -** Processing line: ~ if input_type == :click # if user clicks their mouse~ + - Press ~f~ to select the next frame. +** Processing line: ~ - Press ~c~ to copy a frame.~ - Inside source: true *** True Line Result - if input_type == :click # if user clicks their mouse -** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ + - Press ~c~ to copy a frame. +** Processing line: ~ - Press ~v~ to paste a copied frame into the selected frame.~ - Inside source: true *** True Line Result - if state.filled_squares.include? grid_box # if grid box is already filled in -** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ + - Press ~v~ to paste a copied frame into the selected frame. +** Processing line: ~ - Press ~x~ to delete the currently selected frame.~ - Inside source: true *** True Line Result - state.filled_squares.delete grid_box # box is cleared and removed from filled_squares -** Processing line: ~ else~ + - Press ~x~ to delete the currently selected frame. +** Processing line: ~ - Press ~w~ to save the canvas and export all sprites.~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ + - Press ~w~ to save the canvas and export all sprites. +** Processing line: ~ - Press ~l~ to load the canvas.~ - Inside source: true *** True Line Result - state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares -** Processing line: ~ end~ + - Press ~l~ to load the canvas. +** Processing line: ~ S~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif input_type == :drag # if user drags mouse~ + S +** Processing line: ~~ - Inside source: true *** True Line Result - elsif input_type == :drag # if user drags mouse -** Processing line: ~ unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in~ + +** Processing line: ~ instructions.strip.each_line.with_index do |l, i|~ - Inside source: true *** True Line Result - unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in -** Processing line: ~ state.filled_squares << grid_box # box is filled in and added to filled_squares~ + instructions.strip.each_line.with_index do |l, i| +** Processing line: ~ outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}",~ - Inside source: true *** True Line Result - state.filled_squares << grid_box # box is filled in and added to filled_squares -** Processing line: ~ end~ + outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}", +** Processing line: ~ r: 180, g: 180, b: 180, size_enum: -3 }~ - Inside source: true *** True Line Result - end + r: 180, g: 180, b: 180, size_enum: -3 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -46353,106 +46748,82 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates a "Clear" button using labels and borders.~ +** Processing line: ~ def render_canvas~ - Inside source: true *** True Line Result - # Creates a "Clear" button using labels and borders. -** Processing line: ~ def draw_buttons~ + def render_canvas +** Processing line: ~ return if state.tick_count.zero?~ - Inside source: true *** True Line Result - def draw_buttons -** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ + return if state.tick_count.zero? +** Processing line: ~ outputs.sprites << rt_canvas.sprite~ - Inside source: true *** True Line Result - x, y, w, h = 390, 50, 240, 50 -** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ + outputs.sprites << rt_canvas.sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.clear_button ||= state.new_entity(:button_with_fade) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # x and y positions are set to display "Clear" label in center of the button~ +** Processing line: ~ def render_buttons_frame_selection~ - Inside source: true *** True Line Result - # x and y positions are set to display "Clear" label in center of the button -** Processing line: ~ # Try changing first two parameters to simply x, y and see what happens to the text placement~ + def render_buttons_frame_selection +** Processing line: ~ args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i|~ - Inside source: true *** True Line Result - # Try changing first two parameters to simply x, y and see what happens to the text placement -** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1]~ + args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i| +** Processing line: ~ label = { x: b.x + state.buttons_frame_selection.size.half,~ - Inside source: true *** True Line Result - state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] -** Processing line: ~ state.clear_button.border ||= [x, y, w, h] # definition of button's border~ + label = { x: b.x + state.buttons_frame_selection.size.half, +** Processing line: ~ y: b.y,~ - Inside source: true *** True Line Result - state.clear_button.border ||= [x, y, w, h] # definition of button's border -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # If the mouse is clicked inside the borders of the clear button~ -- Inside source: true -*** True Line Result - # If the mouse is clicked inside the borders of the clear button -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ -- Inside source: true -*** True Line Result - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) -** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click~ -- Inside source: true -*** True Line Result - state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click -** Processing line: ~ state.filled_squares.clear # filled squares collection is emptied (squares are cleared)~ -- Inside source: true -*** True Line Result - state.filled_squares.clear # filled squares collection is emptied (squares are cleared) -** Processing line: ~ inputs.mouse.previous_click = nil # no previous click~ + y: b.y, +** Processing line: ~ text: "#{i + 1}", r: 180, g: 180, b: 180,~ - Inside source: true *** True Line Result - inputs.mouse.previous_click = nil # no previous click -** Processing line: ~ end~ + text: "#{i + 1}", r: 180, g: 180, b: 180, +** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ - Inside source: true *** True Line Result - end + size_enum: -4, alignment_enum: 1 }.label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.labels << state.clear_button.label # outputs clear button~ -- Inside source: true -*** True Line Result - outputs.labels << state.clear_button.label # outputs clear button -** Processing line: ~ outputs.borders << state.clear_button.border~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ - Inside source: true *** True Line Result - outputs.borders << state.clear_button.border + selection_border = b.merge(r: 40, g: 40, b: 40).border ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # When the clear button is clicked, the color of the button changes~ +** Processing line: ~ if i == state.animation_frames_selected_index~ - Inside source: true *** True Line Result - # When the clear button is clicked, the color of the button changes -** Processing line: ~ # and the transparency changes, as well. If you change the time from~ + if i == state.animation_frames_selected_index +** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ - Inside source: true *** True Line Result - # and the transparency changes, as well. If you change the time from -** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ + selection_border = b.merge(r: 40, g: 230, b: 200).border +** Processing line: ~ end~ - Inside source: true *** True Line Result - # 0.25.seconds to 1.25.seconds or more, the change will last longer. -** Processing line: ~ if state.clear_button.clicked_at~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if state.clear_button.clicked_at -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ + +** Processing line: ~ [selection_border, label]~ - Inside source: true *** True Line Result - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + [selection_border, label] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -46461,90 +46832,82 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $tile_editor = TileEditor.new~ +** Processing line: ~ def render_animation_frame_thumbnails~ - Inside source: true *** True Line Result - $tile_editor = TileEditor.new -** Processing line: ~~ + def render_animation_frame_thumbnails +** Processing line: ~ return if state.tick_count.zero?~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + return if state.tick_count.zero? +** Processing line: ~~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $tile_editor.inputs = args.inputs~ + +** Processing line: ~ outputs[:current_animation_frame].width = rt_canvas.size~ - Inside source: true *** True Line Result - $tile_editor.inputs = args.inputs -** Processing line: ~ $tile_editor.grid = args.grid~ + outputs[:current_animation_frame].width = rt_canvas.size +** Processing line: ~ outputs[:current_animation_frame].height = rt_canvas.size~ - Inside source: true *** True Line Result - $tile_editor.grid = args.grid -** Processing line: ~ $tile_editor.args = args~ + outputs[:current_animation_frame].height = rt_canvas.size +** Processing line: ~ outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i|~ - Inside source: true *** True Line Result - $tile_editor.args = args -** Processing line: ~ $tile_editor.outputs = args.outputs~ + outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i| +** Processing line: ~ { x: f.x,~ - Inside source: true *** True Line Result - $tile_editor.outputs = args.outputs -** Processing line: ~ $tile_editor.state = args.state~ + { x: f.x, +** Processing line: ~ y: f.y,~ - Inside source: true *** True Line Result - $tile_editor.state = args.state -** Processing line: ~ $tile_editor.tick~ + y: f.y, +** Processing line: ~ w: 1,~ - Inside source: true *** True Line Result - $tile_editor.tick -** Processing line: ~ tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around."~ + w: 1, +** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around." -** Processing line: ~ end~ + h: 1, r: 255, g: 255, b: 255 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ -- Inside source: true -*** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame)~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.mouse.click ||~ + outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame) +** Processing line: ~~ - Inside source: true *** True Line Result - if args.inputs.mouse.click || -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ + +** Processing line: ~ state.animation_frames.map_with_index do |animation_frame, animation_frame_index|~ - Inside source: true *** True Line Result - args.inputs.keyboard.directional_vector || -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ + state.animation_frames.map_with_index do |animation_frame, animation_frame_index| +** Processing line: ~ outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect]~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.enter || -** Processing line: ~ args.inputs.keyboard.key_down.escape~ + outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect] +** Processing line: ~ .merge(path: animation_frame[:rt_name])~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.escape -** Processing line: ~ args.state.key_event_occurred = true~ + .merge(path: animation_frame[:rt_name]) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -46553,214 +46916,210 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ def render_animation~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + def render_animation +** Processing line: ~ sprite_index = 0.frame_index count: state.animation_frames.length,~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + sprite_index = 0.frame_index count: state.animation_frames.length, +** Processing line: ~ hold_for: 60 / state.animation_frames_per_second,~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + hold_for: 60 / state.animation_frames_per_second, +** Processing line: ~ repeat: true~ - Inside source: true *** True Line Result - end + repeat: true ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_lowrez/resolution_64x64/app/lowrez.rb~ -- Header detected. -*** True Line Result - +** Processing line: ~ args.outputs.sprites << { x: 700 - 8,~ +- Inside source: true *** True Line Result -* 99_genre_lowrez/resolution_64x64/app/lowrez.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + args.outputs.sprites << { x: 700 - 8, +** Processing line: ~ y: 120,~ +- Inside source: true *** True Line Result - + y: 120, +** Processing line: ~ w: 16,~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)~ + w: 16, +** Processing line: ~ h: 16,~ - Inside source: true *** True Line Result - # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-) -** Processing line: ~ # Head over to main.rb and study the code there.~ + h: 16, +** Processing line: ~ path: (sprite_path sprite_index) }~ - Inside source: true *** True Line Result - # Head over to main.rb and study the code there. + path: (sprite_path sprite_index) } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ LOWREZ_SIZE = 64~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 16,~ - Inside source: true *** True Line Result - LOWREZ_SIZE = 64 -** Processing line: ~ LOWREZ_ZOOM = 10~ + args.outputs.sprites << { x: 700 - 16, +** Processing line: ~ y: 230,~ - Inside source: true *** True Line Result - LOWREZ_ZOOM = 10 -** Processing line: ~ LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM~ + y: 230, +** Processing line: ~ w: 32,~ - Inside source: true *** True Line Result - LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM -** Processing line: ~ LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half~ + w: 32, +** Processing line: ~ h: 32,~ - Inside source: true *** True Line Result - LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half -** Processing line: ~ LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half~ + h: 32, +** Processing line: ~ path: (sprite_path sprite_index) }~ - Inside source: true *** True Line Result - LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half + path: (sprite_path sprite_index) } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ LOWREZ_FONT_XL = -1~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 32,~ - Inside source: true *** True Line Result - LOWREZ_FONT_XL = -1 -** Processing line: ~ LOWREZ_FONT_XL_HEIGHT = 20~ + args.outputs.sprites << { x: 700 - 32, +** Processing line: ~ y: 360,~ - Inside source: true *** True Line Result - LOWREZ_FONT_XL_HEIGHT = 20 -** Processing line: ~~ + y: 360, +** Processing line: ~ w: 64,~ - Inside source: true *** True Line Result - -** Processing line: ~ LOWREZ_FONT_LG = -3.5~ + w: 64, +** Processing line: ~ h: 64,~ - Inside source: true *** True Line Result - LOWREZ_FONT_LG = -3.5 -** Processing line: ~ LOWREZ_FONT_LG_HEIGHT = 15~ + h: 64, +** Processing line: ~ path: (sprite_path sprite_index) }~ - Inside source: true *** True Line Result - LOWREZ_FONT_LG_HEIGHT = 15 + path: (sprite_path sprite_index) } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ LOWREZ_FONT_MD = -6~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 64,~ - Inside source: true *** True Line Result - LOWREZ_FONT_MD = -6 -** Processing line: ~ LOWREZ_FONT_MD_HEIGHT = 10~ + args.outputs.sprites << { x: 700 - 64, +** Processing line: ~ y: 520,~ - Inside source: true *** True Line Result - LOWREZ_FONT_MD_HEIGHT = 10 -** Processing line: ~~ + y: 520, +** Processing line: ~ w: 128,~ - Inside source: true *** True Line Result - -** Processing line: ~ LOWREZ_FONT_SM = -8.5~ + w: 128, +** Processing line: ~ h: 128,~ - Inside source: true *** True Line Result - LOWREZ_FONT_SM = -8.5 -** Processing line: ~ LOWREZ_FONT_SM_HEIGHT = 5~ + h: 128, +** Processing line: ~ path: (sprite_path sprite_index) }~ - Inside source: true *** True Line Result - LOWREZ_FONT_SM_HEIGHT = 5 + path: (sprite_path sprite_index) } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ LOWREZ_FONT_PATH = 'fonts/lowrez.ttf'~ +** Processing line: ~ def input_mouse_click~ - Inside source: true *** True Line Result - LOWREZ_FONT_PATH = 'fonts/lowrez.ttf' -** Processing line: ~~ + def input_mouse_click +** Processing line: ~ if inputs.mouse.up~ - Inside source: true *** True Line Result - -** Processing line: ~~ + if inputs.mouse.up +** Processing line: ~ state.last_mouse_up = state.tick_count~ - Inside source: true *** True Line Result - -** Processing line: ~ class LowrezOutputs~ + state.last_mouse_up = state.tick_count +** Processing line: ~ elsif inputs.mouse.moved && user_is_editing?~ - Inside source: true *** True Line Result - class LowrezOutputs -** Processing line: ~ attr_accessor :width, :height~ + elsif inputs.mouse.moved && user_is_editing? +** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ - Inside source: true *** True Line Result - attr_accessor :width, :height + edit_current_animation_frame inputs.mouse.point +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize args~ +** Processing line: ~ return unless inputs.mouse.click~ - Inside source: true *** True Line Result - def initialize args -** Processing line: ~ @args = args~ + return unless inputs.mouse.click +** Processing line: ~~ - Inside source: true *** True Line Result - @args = args -** Processing line: ~ @background_color ||= [0, 0, 0]~ + +** Processing line: ~ clicked_frame_button = state.buttons_frame_selection.items.find do |b|~ - Inside source: true *** True Line Result - @background_color ||= [0, 0, 0] -** Processing line: ~ @args.outputs.background_color = @background_color~ + clicked_frame_button = state.buttons_frame_selection.items.find do |b| +** Processing line: ~ inputs.mouse.point.inside_rect? b~ - Inside source: true *** True Line Result - @args.outputs.background_color = @background_color -** Processing line: ~ end~ + inputs.mouse.point.inside_rect? b +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def background_color~ +** Processing line: ~ if (clicked_frame_button)~ - Inside source: true *** True Line Result - def background_color -** Processing line: ~ @background_color ||= [0, 0, 0]~ + if (clicked_frame_button) +** Processing line: ~ state.animation_frames_selected_index = clicked_frame_button[:index]~ - Inside source: true *** True Line Result - @background_color ||= [0, 0, 0] -** Processing line: ~ end~ + state.animation_frames_selected_index = clicked_frame_button[:index] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def background_color= opts~ -- Inside source: true -*** True Line Result - def background_color= opts -** Processing line: ~ @background_color = opts~ +** Processing line: ~ if (inputs.mouse.point.inside_rect? rt_canvas.sprite)~ - Inside source: true *** True Line Result - @background_color = opts -** Processing line: ~ @args.outputs.background_color = @background_color~ + if (inputs.mouse.point.inside_rect? rt_canvas.sprite) +** Processing line: ~ state.last_mouse_down = state.tick_count~ - Inside source: true *** True Line Result - @args.outputs.background_color = @background_color -** Processing line: ~~ + state.last_mouse_down = state.tick_count +** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color]~ + edit_current_animation_frame inputs.mouse.point +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color] + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -46769,498 +47128,494 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def outputs_lowrez~ +** Processing line: ~ def input_keyboard~ - Inside source: true *** True Line Result - def outputs_lowrez -** Processing line: ~ return @args.outputs if @args.state.tick_count <= 0~ + def input_keyboard +** Processing line: ~ # w to save~ - Inside source: true *** True Line Result - return @args.outputs if @args.state.tick_count <= 0 -** Processing line: ~ return @args.outputs[:lowrez]~ + # w to save +** Processing line: ~ if inputs.keyboard.key_down.w~ - Inside source: true *** True Line Result - return @args.outputs[:lowrez] -** Processing line: ~ end~ + if inputs.keyboard.key_down.w +** Processing line: ~ t = Time.now~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + t = Time.now +** Processing line: ~ state.save_description = "Time: #{t} (#{t.to_i})"~ - Inside source: true *** True Line Result - -** Processing line: ~ def solids~ + state.save_description = "Time: #{t} (#{t.to_i})" +** Processing line: ~ gtk.serialize_state 'canvas/state.txt', state~ - Inside source: true *** True Line Result - def solids -** Processing line: ~ outputs_lowrez.solids~ + gtk.serialize_state 'canvas/state.txt', state +** Processing line: ~ gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state~ - Inside source: true *** True Line Result - outputs_lowrez.solids -** Processing line: ~ end~ + gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state +** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + animation_frames.each_with_index do |animation_frame, i| +** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ - Inside source: true *** True Line Result - -** Processing line: ~ def borders~ + queues.update_rt_animation_frame << { index: i, +** Processing line: ~ at: state.tick_count + i,~ - Inside source: true *** True Line Result - def borders -** Processing line: ~ outputs_lowrez.borders~ + at: state.tick_count + i, +** Processing line: ~ queue_sprite_creation: true }~ - Inside source: true *** True Line Result - outputs_lowrez.borders -** Processing line: ~ end~ + queue_sprite_creation: true } +** Processing line: ~ queues.create_sprite << { index: i,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + queues.create_sprite << { index: i, +** Processing line: ~ at: state.tick_count + animation_frames.length + i,~ - Inside source: true *** True Line Result - -** Processing line: ~ def sprites~ + at: state.tick_count + animation_frames.length + i, +** Processing line: ~ path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" }~ - Inside source: true *** True Line Result - def sprites -** Processing line: ~ outputs_lowrez.sprites~ + path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" } +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs_lowrez.sprites -** Processing line: ~ end~ + end +** Processing line: ~ gtk.notify! "Canvas saved."~ - Inside source: true *** True Line Result - end + gtk.notify! "Canvas saved." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def labels~ +** Processing line: ~ # l to load~ - Inside source: true *** True Line Result - def labels -** Processing line: ~ outputs_lowrez.labels~ + # l to load +** Processing line: ~ if inputs.keyboard.key_down.l~ - Inside source: true *** True Line Result - outputs_lowrez.labels -** Processing line: ~ end~ + if inputs.keyboard.key_down.l +** Processing line: ~ args.state = gtk.deserialize_state 'canvas/state.txt'~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state = gtk.deserialize_state 'canvas/state.txt' +** Processing line: ~ animation_frames.each_with_index do |a, i|~ - Inside source: true *** True Line Result - -** Processing line: ~ def default_label~ + animation_frames.each_with_index do |a, i| +** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ - Inside source: true *** True Line Result - def default_label -** Processing line: ~ {~ + queues.update_rt_animation_frame << { index: i, +** Processing line: ~ at: state.tick_count + i,~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 0,~ + at: state.tick_count + i, +** Processing line: ~ queue_sprite_creation: true }~ - Inside source: true *** True Line Result - x: 0, -** Processing line: ~ y: 63,~ + queue_sprite_creation: true } +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: 63, -** Processing line: ~ text: "",~ + end +** Processing line: ~ gtk.notify! "Canvas loaded."~ - Inside source: true *** True Line Result - text: "", -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ + gtk.notify! "Canvas loaded." +** Processing line: ~ end~ - Inside source: true *** True Line Result - size_enum: LOWREZ_FONT_SM, -** Processing line: ~ alignment_enum: 0,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - alignment_enum: 0, -** Processing line: ~ r: 0,~ + +** Processing line: ~ # d to go into delete mode, release to paint~ - Inside source: true *** True Line Result - r: 0, -** Processing line: ~ g: 0,~ + # d to go into delete mode, release to paint +** Processing line: ~ if inputs.keyboard.key_held.d~ - Inside source: true *** True Line Result - g: 0, -** Processing line: ~ b: 0,~ + if inputs.keyboard.key_held.d +** Processing line: ~ state.edit_mode = :erasing~ - Inside source: true *** True Line Result - b: 0, -** Processing line: ~ a: 255,~ + state.edit_mode = :erasing +** Processing line: ~ gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1)~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH~ + gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1) +** Processing line: ~ elsif inputs.keyboard.key_up.d~ - Inside source: true *** True Line Result - font: LOWREZ_FONT_PATH -** Processing line: ~ }~ + elsif inputs.keyboard.key_up.d +** Processing line: ~ state.edit_mode = :drawing~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.edit_mode = :drawing +** Processing line: ~ gtk.notify! "Drawing."~ - Inside source: true *** True Line Result - end + gtk.notify! "Drawing." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def lines~ +** Processing line: ~ # a to add a frame to the end~ - Inside source: true *** True Line Result - def lines -** Processing line: ~ outputs_lowrez.lines~ + # a to add a frame to the end +** Processing line: ~ if inputs.keyboard.key_down.a~ - Inside source: true *** True Line Result - outputs_lowrez.lines -** Processing line: ~ end~ + if inputs.keyboard.key_down.a +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + queues.create_sprite << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count }~ - Inside source: true *** True Line Result - -** Processing line: ~ def primitives~ + at: state.tick_count } +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index + 1,~ - Inside source: true *** True Line Result - def primitives -** Processing line: ~ outputs_lowrez.primitives~ + queues.create_sprite << { index: state.animation_frames_selected_index + 1, +** Processing line: ~ at: state.tick_count }~ - Inside source: true *** True Line Result - outputs_lowrez.primitives -** Processing line: ~ end~ + at: state.tick_count } +** Processing line: ~ add_animation_frame_to_end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + add_animation_frame_to_end +** Processing line: ~ gtk.notify! "Frame added to end."~ - Inside source: true *** True Line Result - -** Processing line: ~ def click~ + gtk.notify! "Frame added to end." +** Processing line: ~ end~ - Inside source: true *** True Line Result - def click -** Processing line: ~ return nil unless @args.inputs.mouse.click~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return nil unless @args.inputs.mouse.click -** Processing line: ~ mouse~ + +** Processing line: ~ # c or t to copy~ - Inside source: true *** True Line Result - mouse -** Processing line: ~ end~ + # c or t to copy +** Processing line: ~ if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def mouse_click~ + if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t) +** Processing line: ~ state.clipboard = [selected_animation_frame[:pixels]].flatten~ - Inside source: true *** True Line Result - def mouse_click -** Processing line: ~ click~ + state.clipboard = [selected_animation_frame[:pixels]].flatten +** Processing line: ~ gtk.notify! "Current frame copied."~ - Inside source: true *** True Line Result - click -** Processing line: ~ end~ + gtk.notify! "Current frame copied." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def mouse_down~ +** Processing line: ~ # v or q to paste~ - Inside source: true *** True Line Result - def mouse_down -** Processing line: ~ @args.inputs.mouse.down~ + # v or q to paste +** Processing line: ~ if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard~ - Inside source: true *** True Line Result - @args.inputs.mouse.down -** Processing line: ~ end~ + if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard +** Processing line: ~ selected_animation_frame[:pixels] = [state.clipboard].flatten~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + selected_animation_frame[:pixels] = [state.clipboard].flatten +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - -** Processing line: ~ def mouse_up~ + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count,~ - Inside source: true *** True Line Result - def mouse_up -** Processing line: ~ @args.inputs.mouse.up~ + at: state.tick_count, +** Processing line: ~ queue_sprite_creation: true }~ - Inside source: true *** True Line Result - @args.inputs.mouse.up -** Processing line: ~ end~ + queue_sprite_creation: true } +** Processing line: ~ gtk.notify! "Pasted."~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + gtk.notify! "Pasted." +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def mouse~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def mouse -** Processing line: ~ [~ + +** Processing line: ~ # f to go forward/next frame~ - Inside source: true *** True Line Result - [ -** Processing line: ~ ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)),~ + # f to go forward/next frame +** Processing line: ~ if (inputs.keyboard.key_down.f)~ - Inside source: true *** True Line Result - ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)), -** Processing line: ~ ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM))~ + if (inputs.keyboard.key_down.f) +** Processing line: ~ if (state.animation_frames_selected_index == (state.animation_frames.length - 1))~ - Inside source: true *** True Line Result - ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM)) -** Processing line: ~ ]~ + if (state.animation_frames_selected_index == (state.animation_frames.length - 1)) +** Processing line: ~ state.animation_frames_selected_index = 0~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + state.animation_frames_selected_index = 0 +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + else +** Processing line: ~ state.animation_frames_selected_index += 1~ - Inside source: true *** True Line Result - -** Processing line: ~ def mouse_position~ + state.animation_frames_selected_index += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - def mouse_position -** Processing line: ~ mouse~ + end +** Processing line: ~ gtk.notify! "Next frame."~ - Inside source: true *** True Line Result - mouse -** Processing line: ~ end~ + gtk.notify! "Next frame." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def keyboard~ -- Inside source: true -*** True Line Result - def keyboard -** Processing line: ~ @args.inputs.keyboard~ +** Processing line: ~ # b to go back/previous frame~ - Inside source: true *** True Line Result - @args.inputs.keyboard -** Processing line: ~ end~ + # b to go back/previous frame +** Processing line: ~ if (inputs.keyboard.key_down.b)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if (inputs.keyboard.key_down.b) +** Processing line: ~ if (state.animation_frames_selected_index == 0)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if (state.animation_frames_selected_index == 0) +** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ - Inside source: true *** True Line Result - -** Processing line: ~ class GTK::Args~ + state.animation_frames_selected_index = state.animation_frames.length - 1 +** Processing line: ~ else~ - Inside source: true *** True Line Result - class GTK::Args -** Processing line: ~ def init_lowrez~ + else +** Processing line: ~ state.animation_frames_selected_index -= 1~ - Inside source: true *** True Line Result - def init_lowrez -** Processing line: ~ return if @lowrez~ + state.animation_frames_selected_index -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if @lowrez -** Processing line: ~ @lowrez = LowrezOutputs.new self~ + end +** Processing line: ~ gtk.notify! "Previous frame."~ - Inside source: true *** True Line Result - @lowrez = LowrezOutputs.new self -** Processing line: ~ end~ + gtk.notify! "Previous frame." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def lowrez~ -- Inside source: true -*** True Line Result - def lowrez -** Processing line: ~ @lowrez~ -- Inside source: true -*** True Line Result - @lowrez -** Processing line: ~ end~ +** Processing line: ~ # x to delete frame~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # x to delete frame +** Processing line: ~ if (inputs.keyboard.key_down.x) && animation_frames.length > 1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if (inputs.keyboard.key_down.x) && animation_frames.length > 1 +** Processing line: ~ state.clipboard = selected_animation_frame[:pixels]~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + state.clipboard = selected_animation_frame[:pixels] +** Processing line: ~ state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index }~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Runtime~ + state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index } +** Processing line: ~ if state.animation_frames_selected_index >= state.animation_frames.length~ - Inside source: true *** True Line Result - class Runtime -** Processing line: ~ alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__)~ + if state.animation_frames_selected_index >= state.animation_frames.length +** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ - Inside source: true *** True Line Result - alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) -** Processing line: ~~ + state.animation_frames_selected_index = state.animation_frames.length - 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_core~ + end +** Processing line: ~ gtk.notify! "Frame deleted."~ - Inside source: true *** True Line Result - def tick_core -** Processing line: ~ @args.init_lowrez~ + gtk.notify! "Frame deleted." +** Processing line: ~ end~ - Inside source: true *** True Line Result - @args.init_lowrez -** Processing line: ~ __original_tick_core__~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - __original_tick_core__ + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return if @args.state.tick_count <= 0~ +** Processing line: ~ def calc_auto_export~ - Inside source: true *** True Line Result - return if @args.state.tick_count <= 0 -** Processing line: ~~ + def calc_auto_export +** Processing line: ~ return if user_is_editing?~ - Inside source: true *** True Line Result - -** Processing line: ~ @args.render_target(:lowrez)~ + return if user_is_editing? +** Processing line: ~ return if state.last_mouse_up.elapsed_time != 30~ - Inside source: true *** True Line Result - @args.render_target(:lowrez) -** Processing line: ~ .labels~ + return if state.last_mouse_up.elapsed_time != 30 +** Processing line: ~ # auto export current animation frame if there is no editing for 30 ticks~ - Inside source: true *** True Line Result - .labels -** Processing line: ~ .each do |l|~ + # auto export current animation frame if there is no editing for 30 ticks +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - .each do |l| -** Processing line: ~ l.y += 1~ + queues.create_sprite << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count }~ - Inside source: true *** True Line Result - l.y += 1 -** Processing line: ~ end~ + at: state.tick_count } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @args.render_target(:lowrez)~ +** Processing line: ~ def calc_buttons_frame_selection~ - Inside source: true *** True Line Result - @args.render_target(:lowrez) -** Processing line: ~ .lines~ + def calc_buttons_frame_selection +** Processing line: ~ state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i|~ - Inside source: true *** True Line Result - .lines -** Processing line: ~ .each do |l|~ + state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i| +** Processing line: ~ { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size,~ - Inside source: true *** True Line Result - .each do |l| -** Processing line: ~ l.y += 1~ + { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size, +** Processing line: ~ y: state.buttons_frame_selection.top - state.buttons_frame_selection.size,~ - Inside source: true *** True Line Result - l.y += 1 -** Processing line: ~ l.y2 += 1~ + y: state.buttons_frame_selection.top - state.buttons_frame_selection.size, +** Processing line: ~ inner_rect: {~ - Inside source: true *** True Line Result - l.y2 += 1 -** Processing line: ~ l.y2 += 1 if l.y1 != l.y2~ + inner_rect: { +** Processing line: ~ x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size,~ - Inside source: true *** True Line Result - l.y2 += 1 if l.y1 != l.y2 -** Processing line: ~ l.x2 += 1 if l.x1 != l.x2~ + x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size, +** Processing line: ~ y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2),~ - Inside source: true *** True Line Result - l.x2 += 1 if l.x1 != l.x2 -** Processing line: ~ end~ + y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2), +** Processing line: ~ w: 16,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + w: 16, +** Processing line: ~ h: 16,~ - Inside source: true *** True Line Result - -** Processing line: ~ @args.outputs~ + h: 16, +** Processing line: ~ },~ - Inside source: true *** True Line Result - @args.outputs -** Processing line: ~ .sprites << { x: 320,~ + }, +** Processing line: ~ w: state.buttons_frame_selection.size,~ - Inside source: true *** True Line Result - .sprites << { x: 320, -** Processing line: ~ y: 40,~ + w: state.buttons_frame_selection.size, +** Processing line: ~ h: state.buttons_frame_selection.size,~ - Inside source: true *** True Line Result - y: 40, -** Processing line: ~ w: 640,~ + h: state.buttons_frame_selection.size, +** Processing line: ~ index: i }~ - Inside source: true *** True Line Result - w: 640, -** Processing line: ~ h: 640,~ + index: i } +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: 640, -** Processing line: ~ source_x: 0,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - source_x: 0, -** Processing line: ~ source_y: 0,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - source_y: 0, -** Processing line: ~ source_w: 64,~ + +** Processing line: ~ def calc_animation_frames~ - Inside source: true *** True Line Result - source_w: 64, -** Processing line: ~ source_h: 64,~ + def calc_animation_frames +** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ - Inside source: true *** True Line Result - source_h: 64, -** Processing line: ~ path: :lowrez }~ + animation_frames.each_with_index do |animation_frame, i| +** Processing line: ~ animation_frame[:index] = i~ - Inside source: true *** True Line Result - path: :lowrez } + animation_frame[:index] = i +** Processing line: ~ animation_frame[:rt_name] = "animation_frame_#{i}"~ +- Inside source: true +*** True Line Result + animation_frame[:rt_name] = "animation_frame_#{i}" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -47269,938 +47624,958 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. +** Processing line: ~ def process_queue_create_sprite~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_lowrez/resolution_64x64/app/main.rb~ -- Header detected. + def process_queue_create_sprite +** Processing line: ~ sprites_to_create = queues.create_sprite~ +- Inside source: true *** True Line Result - + sprites_to_create = queues.create_sprite +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +- Inside source: true *** True Line Result -* 99_genre_lowrez/resolution_64x64/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + .find_all { |h| h[:at].elapsed? } +** Processing line: ~~ +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ require 'app/lowrez.rb'~ +** Processing line: ~ queues.create_sprite = queues.create_sprite - sprites_to_create~ - Inside source: true *** True Line Result - require 'app/lowrez.rb' + queues.create_sprite = queues.create_sprite - sprites_to_create ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ sprites_to_create.each do |h|~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ # How to set the background color~ + sprites_to_create.each do |h| +** Processing line: ~ export_animation_frame h[:index], h[:path_override]~ - Inside source: true *** True Line Result - # How to set the background color -** Processing line: ~ args.lowrez.background_color = [255, 255, 255]~ + export_animation_frame h[:index], h[:path_override] +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.lowrez.background_color = [255, 255, 255] + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== HELLO WORLD ======================================================~ +** Processing line: ~ def process_queue_reset_sprite~ - Inside source: true *** True Line Result - # ==== HELLO WORLD ====================================================== -** Processing line: ~ # Steps to get started:~ + def process_queue_reset_sprite +** Processing line: ~ sprites_to_reset = queues.reset_sprite~ - Inside source: true *** True Line Result - # Steps to get started: -** Processing line: ~ # 1. ~def tick args~ is the entry point for your game.~ + sprites_to_reset = queues.reset_sprite +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ - Inside source: true *** True Line Result - # 1. ~def tick args~ is the entry point for your game. -** Processing line: ~ # 2. There are quite a few code samples below, remove the "##"~ + .find_all { |h| h[:at].elapsed? } +** Processing line: ~~ - Inside source: true *** True Line Result - # 2. There are quite a few code samples below, remove the "##" -** Processing line: ~ # before each line and save the file to see the changes.~ + +** Processing line: ~ queues.reset_sprite -= sprites_to_reset~ - Inside source: true *** True Line Result - # before each line and save the file to see the changes. -** Processing line: ~ # 3. 0, 0 is in bottom left and 63, 63 is in top right corner.~ + queues.reset_sprite -= sprites_to_reset +** Processing line: ~~ - Inside source: true *** True Line Result - # 3. 0, 0 is in bottom left and 63, 63 is in top right corner. -** Processing line: ~ # 4. Be sure to come to the discord channel if you need~ + +** Processing line: ~ sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) }~ - Inside source: true *** True Line Result - # 4. Be sure to come to the discord channel if you need -** Processing line: ~ # more help: [[http://discord.dragonruby.org]].~ + sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # more help: [[http://discord.dragonruby.org]]. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Commenting and uncommenting code:~ +** Processing line: ~ def process_queue_update_rt_animation_frame~ - Inside source: true *** True Line Result - # Commenting and uncommenting code: -** Processing line: ~ # - Add a "#" infront of lines to comment out code~ + def process_queue_update_rt_animation_frame +** Processing line: ~ animation_frames_to_update = queues.update_rt_animation_frame~ - Inside source: true *** True Line Result - # - Add a "#" infront of lines to comment out code -** Processing line: ~ # - Remove the "#" infront of lines to comment out code~ + animation_frames_to_update = queues.update_rt_animation_frame +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ - Inside source: true *** True Line Result - # - Remove the "#" infront of lines to comment out code + .find_all { |h| h[:at].elapsed? } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Invoke the hello_world subroutine/method~ -- Inside source: true -*** True Line Result - # Invoke the hello_world subroutine/method -** Processing line: ~ hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method.~ -- Inside source: true -*** True Line Result - hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method. -** Processing line: ~ # =======================================================================~ +** Processing line: ~ queues.update_rt_animation_frame -= animation_frames_to_update~ - Inside source: true *** True Line Result - # ======================================================================= + queues.update_rt_animation_frame -= animation_frames_to_update ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ animation_frames_to_update.each do |h|~ - Inside source: true *** True Line Result - -** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ + animation_frames_to_update.each do |h| +** Processing line: ~ update_animation_frame_render_target animation_frames[h[:index]]~ - Inside source: true *** True Line Result - # ==== HOW TO RENDER A LABEL ============================================ -** Processing line: ~ # Uncomment the line below to invoke the how_to_render_a_label subroutine/method.~ + update_animation_frame_render_target animation_frames[h[:index]] +** Processing line: ~~ - Inside source: true *** True Line Result - # Uncomment the line below to invoke the how_to_render_a_label subroutine/method. -** Processing line: ~ # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~~ + +** Processing line: ~ if h[:queue_sprite_creation]~ - Inside source: true *** True Line Result - # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~ -** Processing line: ~ # Scroll down to the method to see the details.~ + if h[:queue_sprite_creation] +** Processing line: ~ queues.create_sprite << { index: h[:index],~ - Inside source: true *** True Line Result - # Scroll down to the method to see the details. -** Processing line: ~~ + queues.create_sprite << { index: h[:index], +** Processing line: ~ at: state.tick_count + 1 }~ - Inside source: true *** True Line Result - -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + at: state.tick_count + 1 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method -** Processing line: ~ # =======================================================================~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ======================================================================= + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ def update_animation_frame_render_target animation_frame~ - Inside source: true *** True Line Result - -** Processing line: ~ # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================~ + def update_animation_frame_render_target animation_frame +** Processing line: ~ return if !animation_frame~ - Inside source: true *** True Line Result - # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + return if !animation_frame +** Processing line: ~~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_render_solids args~ + +** Processing line: ~ outputs[animation_frame[:rt_name]].width = state.rt_canvas.size~ - Inside source: true *** True Line Result - # how_to_render_solids args -** Processing line: ~ # =======================================================================~ + outputs[animation_frame[:rt_name]].width = state.rt_canvas.size +** Processing line: ~ outputs[animation_frame[:rt_name]].height = state.rt_canvas.size~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + outputs[animation_frame[:rt_name]].height = state.rt_canvas.size +** Processing line: ~ outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f|~ - Inside source: true *** True Line Result - -** Processing line: ~~ + outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f| +** Processing line: ~ { x: f.x,~ - Inside source: true *** True Line Result - -** Processing line: ~ # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ========================~ + { x: f.x, +** Processing line: ~ y: f.y,~ - Inside source: true *** True Line Result - # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ======================== -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + y: f.y, +** Processing line: ~ w: 1,~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_render_borders args~ + w: 1, +** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ - Inside source: true *** True Line Result - # how_to_render_borders args -** Processing line: ~ # =======================================================================~ + h: 1, r: 255, g: 255, b: 255 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== HOW TO RENDER A LINE =============================================~ -- Inside source: true -*** True Line Result - # ==== HOW TO RENDER A LINE ============================================= -** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ def animation_frames~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_render_lines args~ + def animation_frames +** Processing line: ~ state.animation_frames~ - Inside source: true *** True Line Result - # how_to_render_lines args -** Processing line: ~ # =======================================================================~ + state.animation_frames +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ======================================================================= + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ def add_animation_frame_to_end~ - Inside source: true *** True Line Result - -** Processing line: ~ # == HOW TO RENDER A SPRITE =============================================~ + def add_animation_frame_to_end +** Processing line: ~ animation_frames << {~ - Inside source: true *** True Line Result - # == HOW TO RENDER A SPRITE ============================================= -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + animation_frames << { +** Processing line: ~ index: animation_frames.length,~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_render_sprites args~ + index: animation_frames.length, +** Processing line: ~ pixels: [],~ - Inside source: true *** True Line Result - # how_to_render_sprites args -** Processing line: ~ # =======================================================================~ + pixels: [], +** Processing line: ~ rt_name: "animation_frame_#{animation_frames.length}"~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + rt_name: "animation_frame_#{animation_frames.length}" +** Processing line: ~ }~ - Inside source: true *** True Line Result - + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT =====================~ +** Processing line: ~ state.animation_frames_selected_index = (animation_frames.length - 1)~ - Inside source: true *** True Line Result - # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT ===================== -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + state.animation_frames_selected_index = (animation_frames.length - 1) +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_move_a_sprite args~ + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count,~ - Inside source: true *** True Line Result - # how_to_move_a_sprite args -** Processing line: ~ # =======================================================================~ + at: state.tick_count, +** Processing line: ~ queue_sprite_creation: true }~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + queue_sprite_creation: true } +** Processing line: ~ end~ - Inside source: true *** True Line Result - + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ -- Inside source: true -*** True Line Result - # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== -** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ def sprite_path i~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_animate_a_sprite args~ + def sprite_path i +** Processing line: ~ "canvas/sprite-#{i}.png"~ - Inside source: true *** True Line Result - # how_to_animate_a_sprite args -** Processing line: ~ # =======================================================================~ + "canvas/sprite-#{i}.png" +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ======================================================================= + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ def export_animation_frame i, path_override = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ===========================~ + def export_animation_frame i, path_override = nil +** Processing line: ~ return if !state.animation_frames[i]~ - Inside source: true *** True Line Result - # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =========================== -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + return if !state.animation_frames[i] +** Processing line: ~~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_animate_a_sprite_sheet args~ + +** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ - Inside source: true *** True Line Result - # how_to_animate_a_sprite_sheet args -** Processing line: ~ # =======================================================================~ + outputs.screenshots << state.buttons_frame_selection +** Processing line: ~ .items[i][:inner_rect]~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + .items[i][:inner_rect] +** Processing line: ~ .merge(path: path_override || (sprite_path i))~ - Inside source: true *** True Line Result - + .merge(path: path_override || (sprite_path i)) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =============================================~ -- Inside source: true -*** True Line Result - # ==== HOW TO DETERMINE COLLISION ============================================= -** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_determine_collision args~ + outputs.screenshots << state.buttons_frame_selection +** Processing line: ~ .items[i][:inner_rect]~ - Inside source: true *** True Line Result - # how_to_determine_collision args -** Processing line: ~ # =======================================================================~ + .items[i][:inner_rect] +** Processing line: ~ .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png")~ - Inside source: true *** True Line Result - # ======================================================================= + .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png") ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ queues.reset_sprite << { index: i, at: state.tick_count }~ - Inside source: true *** True Line Result - -** Processing line: ~ # ==== HOW TO CREATE BUTTONS ==================================================~ + queues.reset_sprite << { index: i, at: state.tick_count } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ==== HOW TO CREATE BUTTONS ================================================== -** Processing line: ~ # Remove the "#" at the beginning of the line below~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Remove the "#" at the beginning of the line below -** Processing line: ~ # how_to_create_buttons args~ + +** Processing line: ~ def selected_animation_frame~ - Inside source: true *** True Line Result - # how_to_create_buttons args -** Processing line: ~ # =======================================================================~ + def selected_animation_frame +** Processing line: ~ state.animation_frames[state.animation_frames_selected_index]~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~~ + state.animation_frames[state.animation_frames_selected_index] +** Processing line: ~ end~ - Inside source: true *** True Line Result - + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # ==== The line below renders a debug grid, mouse information, and current tick~ -- Inside source: true -*** True Line Result - # ==== The line below renders a debug grid, mouse information, and current tick -** Processing line: ~ render_debug args~ +** Processing line: ~ def edit_current_animation_frame point~ - Inside source: true *** True Line Result - render_debug args -** Processing line: ~ end~ + def edit_current_animation_frame point +** Processing line: ~ draw_area_point = (to_draw_area point)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + draw_area_point = (to_draw_area point) +** Processing line: ~ if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point)~ - Inside source: true *** True Line Result - -** Processing line: ~ def hello_world args~ + if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point) +** Processing line: ~ selected_animation_frame[:pixels] << draw_area_point~ - Inside source: true *** True Line Result - def hello_world args -** Processing line: ~ args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 }~ + selected_animation_frame[:pixels] << draw_area_point +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 } -** Processing line: ~~ + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count,~ - Inside source: true *** True Line Result - -** Processing line: ~ args.lowrez.labels << {~ + at: state.tick_count, +** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ - Inside source: true *** True Line Result - args.lowrez.labels << { -** Processing line: ~ x: 32,~ + queue_sprite_creation: !user_is_editing? } +** Processing line: ~ elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point)~ - Inside source: true *** True Line Result - x: 32, -** Processing line: ~ y: 63,~ + elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point) +** Processing line: ~ selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point }~ - Inside source: true *** True Line Result - y: 63, -** Processing line: ~ text: "lowrezjam 2020",~ + selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point } +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ - Inside source: true *** True Line Result - text: "lowrezjam 2020", -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, +** Processing line: ~ at: state.tick_count,~ - Inside source: true *** True Line Result - size_enum: LOWREZ_FONT_SM, -** Processing line: ~ alignment_enum: 1,~ + at: state.tick_count, +** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ - Inside source: true *** True Line Result - alignment_enum: 1, -** Processing line: ~ r: 0,~ + queue_sprite_creation: !user_is_editing? } +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 0, -** Processing line: ~ g: 0,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - g: 0, -** Processing line: ~ b: 0,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - b: 0, -** Processing line: ~ a: 255,~ + +** Processing line: ~ def user_is_editing?~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH~ + def user_is_editing? +** Processing line: ~ state.last_mouse_down > state.last_mouse_up~ - Inside source: true *** True Line Result - font: LOWREZ_FONT_PATH -** Processing line: ~ }~ + state.last_mouse_down > state.last_mouse_up +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.lowrez.sprites << {~ +** Processing line: ~ def to_draw_area point~ - Inside source: true *** True Line Result - args.lowrez.sprites << { -** Processing line: ~ x: 32 - 10,~ + def to_draw_area point +** Processing line: ~ x, y = point~ - Inside source: true *** True Line Result - x: 32 - 10, -** Processing line: ~ y: 32 - 10,~ + x, y = point +** Processing line: ~ x -= rt_canvas.sprite.x~ - Inside source: true *** True Line Result - y: 32 - 10, -** Processing line: ~ w: 20,~ + x -= rt_canvas.sprite.x +** Processing line: ~ y -= rt_canvas.sprite.y~ - Inside source: true *** True Line Result - w: 20, -** Processing line: ~ h: 20,~ + y -= rt_canvas.sprite.y +** Processing line: ~ { x: x.idiv(rt_canvas.zoom),~ - Inside source: true *** True Line Result - h: 20, -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ + { x: x.idiv(rt_canvas.zoom), +** Processing line: ~ y: y.idiv(rt_canvas.zoom) }~ - Inside source: true *** True Line Result - path: 'sprites/lowrez-ship-blue.png', -** Processing line: ~ a: args.state.tick_count % 255,~ + y: y.idiv(rt_canvas.zoom) } +** Processing line: ~ end~ - Inside source: true *** True Line Result - a: args.state.tick_count % 255, -** Processing line: ~ angle: args.state.tick_count % 360~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - angle: args.state.tick_count % 360 -** Processing line: ~ }~ + +** Processing line: ~ def rt_canvas~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + def rt_canvas +** Processing line: ~ state.rt_canvas ||= state.new_entity(:rt_canvas)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.rt_canvas ||= state.new_entity(:rt_canvas) +** Processing line: ~ end~ - Inside source: true *** True Line Result - + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # =======================================================================~ -- Inside source: true -*** True Line Result - # ======================================================================= -** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ +** Processing line: ~ def queues~ - Inside source: true *** True Line Result - # ==== HOW TO RENDER A LABEL ============================================ -** Processing line: ~ # =======================================================================~ + def queues +** Processing line: ~ state.queues ||= state.new_entity(:queues)~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~ def how_to_render_a_label args~ + state.queues ||= state.new_entity(:queues) +** Processing line: ~ end~ - Inside source: true *** True Line Result - def how_to_render_a_label args -** Processing line: ~ # NOTE: Text is aligned from the TOP LEFT corner~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # NOTE: Text is aligned from the TOP LEFT corner + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below)~ +** Processing line: ~ $game = OneBitLowrezPaint.new~ - Inside source: true *** True Line Result - # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below) -** Processing line: ~ args.lowrez.labels << { x: 0, y: 57, text: "Hello World",~ + $game = OneBitLowrezPaint.new +** Processing line: ~~ - Inside source: true *** True Line Result - args.lowrez.labels << { x: 0, y: 57, text: "Hello World", -** Processing line: ~ size_enum: LOWREZ_FONT_XL,~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - size_enum: LOWREZ_FONT_XL, -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ + def tick args +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - r: 0, g: 0, b: 0, a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH }~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - font: LOWREZ_FONT_PATH } + $game.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a LARGE/LG label (remove the "#" in front of each line below)~ +** Processing line: ~ # $gtk.reset~ - Inside source: true *** True Line Result - # Render a LARGE/LG label (remove the "#" in front of each line below) -** Processing line: ~ args.lowrez.labels << { x: 0, y: 36, text: "Hello World",~ + # $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - args.lowrez.labels << { x: 0, y: 36, text: "Hello World", -** Processing line: ~ size_enum: LOWREZ_FONT_LG,~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - size_enum: LOWREZ_FONT_LG, -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - r: 0, g: 0, b: 0, a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH }~ -- Inside source: true + +** Processing line: ~* Dev Tools - Tile Editor Starting Point - main.rb~ +- Header detected. *** True Line Result - font: LOWREZ_FONT_PATH } -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Dev Tools - Tile Editor Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ # Render a MEDIUM/MD label (remove the "#" in front of each line below)~ -- Inside source: true *** True Line Result - # Render a MEDIUM/MD label (remove the "#" in front of each line below) -** Processing line: ~ args.lowrez.labels << { x: 0, y: 20, text: "Hello World",~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb~ - Inside source: true *** True Line Result - args.lowrez.labels << { x: 0, y: 20, text: "Hello World", -** Processing line: ~ size_enum: LOWREZ_FONT_MD,~ + # ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - size_enum: LOWREZ_FONT_MD, -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - r: 0, g: 0, b: 0, a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH }~ + +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - font: LOWREZ_FONT_PATH } + APIs listing that haven't been encountered in previous sample apps: ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a SMALL/SM label (remove the "#" in front of each line below)~ +** Processing line: ~ - to_s: Returns a string representation of an object.~ - Inside source: true *** True Line Result - # Render a SMALL/SM label (remove the "#" in front of each line below) -** Processing line: ~ args.lowrez.labels << { x: 0, y: 9, text: "Hello World",~ + - to_s: Returns a string representation of an object. +** Processing line: ~ For example, if we had~ - Inside source: true *** True Line Result - args.lowrez.labels << { x: 0, y: 9, text: "Hello World", -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ + For example, if we had +** Processing line: ~ 500.to_s~ - Inside source: true *** True Line Result - size_enum: LOWREZ_FONT_SM, -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ + 500.to_s +** Processing line: ~ the string "500" would be returned.~ - Inside source: true *** True Line Result - r: 0, g: 0, b: 0, a: 255, -** Processing line: ~ font: LOWREZ_FONT_PATH }~ + the string "500" would be returned. +** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ - Inside source: true *** True Line Result - font: LOWREZ_FONT_PATH } + Similar to to_i, which returns an integer representation of an object. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # You are provided args.lowrez.default_label which returns a Hash that you~ +** Processing line: ~ - Ceil: Returns an integer number greater than or equal to the original~ - Inside source: true *** True Line Result - # You are provided args.lowrez.default_label which returns a Hash that you -** Processing line: ~ # can ~merge~ properties with~ + - Ceil: Returns an integer number greater than or equal to the original +** Processing line: ~ with no decimal.~ - Inside source: true *** True Line Result - # can ~merge~ properties with -** Processing line: ~ # Example 1~ + with no decimal. +** Processing line: ~~ - Inside source: true *** True Line Result - # Example 1 -** Processing line: ~ args.lowrez.labels << args.lowrez~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(text: "Default")~ + +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect.~ - Inside source: true *** True Line Result - .merge(text: "Default") + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Example 2~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - # Example 2 -** Processing line: ~ args.lowrez.labels << args.lowrez~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 31,~ + For more information about labels, go to mygame/documentation/02-labels.md. +** Processing line: ~~ - Inside source: true *** True Line Result - .merge(x: 31, -** Processing line: ~ text: "Default",~ + +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ - Inside source: true *** True Line Result - text: "Default", -** Processing line: ~ r: 128,~ + - args.outputs.sprites: An array. The values generate a sprite. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ - Inside source: true *** True Line Result - r: 128, -** Processing line: ~ g: 128,~ + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ - Inside source: true *** True Line Result - g: 128, -** Processing line: ~ b: 128)~ + For more information about sprites, go to mygame/documentation/05-sprites.md. +** Processing line: ~~ - Inside source: true *** True Line Result - b: 128) -** Processing line: ~ end~ + +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ - Inside source: true *** True Line Result - end + - args.outputs.solids: An array. The values generate a solid. +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +- Inside source: true +*** True Line Result + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +- Inside source: true +*** True Line Result + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ==================================~ + - args.outputs.lines: An array. The values generate a line. +** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ - Inside source: true *** True Line Result - ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ================================== -** Processing line: ~ ## # =============================================================================~ + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_render_solids args~ + For more information about lines, go to mygame/documentation/04-lines.md. +** Processing line: ~~ - Inside source: true *** True Line Result - def how_to_render_solids args -** Processing line: ~ # Render a red square at 0, 0 with a width and height of 1~ + +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ - Inside source: true *** True Line Result - # Render a red square at 0, 0 with a width and height of 1 -** Processing line: ~ args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 }~ + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. +** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ - Inside source: true *** True Line Result - args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 } -** Processing line: ~~ + In this sample app, new_entity is used to create a new button that clears the grid. +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ - Inside source: true *** True Line Result - -** Processing line: ~ # Render a red square at 1, 1 with a width and height of 2~ + (Remember, you can use state to define ANY property and it will be retained across frames.) +** Processing line: ~~ - Inside source: true *** True Line Result - # Render a red square at 1, 1 with a width and height of 2 -** Processing line: ~ args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 }~ + +** Processing line: ~ =end~ - Inside source: true *** True Line Result - args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 } + =end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ +** Processing line: ~ # This sample app shows an empty grid that the user can paint in. There are different image tiles that~ - Inside source: true *** True Line Result - # Render a red square at 3, 3 with a width and height of 3 -** Processing line: ~ args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 }~ + # This sample app shows an empty grid that the user can paint in. There are different image tiles that +** Processing line: ~ # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes.~ - Inside source: true *** True Line Result - args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 } + # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a red square at 6, 6 with a width and height of 4~ -- Inside source: true -*** True Line Result - # Render a red square at 6, 6 with a width and height of 4 -** Processing line: ~ args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 }~ +** Processing line: ~ class TileEditor~ - Inside source: true *** True Line Result - args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 } -** Processing line: ~ end~ + class TileEditor +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ - Inside source: true *** True Line Result - end + attr_accessor :inputs, :state, :outputs, :grid, :args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) ===============================~ + # Runs all the methods necessary for the game to function properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) =============================== -** Processing line: ~ ## # =============================================================================~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_render_borders args~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - def how_to_render_borders args -** Processing line: ~ # Render a red square at 0, 0 with a width and height of 3~ + render +** Processing line: ~ check_click~ - Inside source: true *** True Line Result - # Render a red square at 0, 0 with a width and height of 3 -** Processing line: ~ args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 }~ + check_click +** Processing line: ~ draw_buttons~ - Inside source: true *** True Line Result - args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 } + draw_buttons +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ +** Processing line: ~ # Sets default values~ - Inside source: true *** True Line Result - # Render a red square at 3, 3 with a width and height of 3 -** Processing line: ~ args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 }~ + # Sets default values +** Processing line: ~ # Initialization only happens in the first frame~ - Inside source: true *** True Line Result - args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 } -** Processing line: ~~ + # Initialization only happens in the first frame +** Processing line: ~ # NOTE: The values of some of these variables may seem confusingly large at first.~ - Inside source: true *** True Line Result - -** Processing line: ~ # Render a red square at 5, 5 with a width and height of 4~ + # NOTE: The values of some of these variables may seem confusingly large at first. +** Processing line: ~ # The gridSize is 1600 but it seems a lot smaller on the screen, for example.~ - Inside source: true *** True Line Result - # Render a red square at 5, 5 with a width and height of 4 -** Processing line: ~ args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 }~ + # The gridSize is 1600 but it seems a lot smaller on the screen, for example. +** Processing line: ~ # But keep in mind that by using the "W", "A", "S", and "D" keys, you can~ - Inside source: true *** True Line Result - args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 } -** Processing line: ~ end~ + # But keep in mind that by using the "W", "A", "S", and "D" keys, you can +** Processing line: ~ # move the grid's view in all four directions for more grid spaces.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # move the grid's view in all four directions for more grid spaces. +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - -** Processing line: ~ ## # =============================================================================~ + def defaults +** Processing line: ~ state.tileCords ||= []~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO RENDER A LINE ===================================================~ + state.tileCords ||= [] +** Processing line: ~ state.tileQuantity ||= 6~ - Inside source: true *** True Line Result - ## # ==== HOW TO RENDER A LINE =================================================== -** Processing line: ~ ## # =============================================================================~ + state.tileQuantity ||= 6 +** Processing line: ~ state.tileSize ||= 50~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_render_lines args~ + state.tileSize ||= 50 +** Processing line: ~ state.tileSelected ||= 1~ - Inside source: true *** True Line Result - def how_to_render_lines args -** Processing line: ~ # Render a horizontal line at the bottom~ + state.tileSelected ||= 1 +** Processing line: ~ state.tempX ||= 50~ - Inside source: true *** True Line Result - # Render a horizontal line at the bottom -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 }~ + state.tempX ||= 50 +** Processing line: ~ state.tempY ||= 500~ - Inside source: true *** True Line Result - args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 } -** Processing line: ~~ + state.tempY ||= 500 +** Processing line: ~ state.speed ||= 4~ - Inside source: true *** True Line Result - -** Processing line: ~ # Render a vertical line at the left~ + state.speed ||= 4 +** Processing line: ~ state.centerX ||= 4000~ - Inside source: true *** True Line Result - # Render a vertical line at the left -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 }~ + state.centerX ||= 4000 +** Processing line: ~ state.centerY ||= 4000~ - Inside source: true *** True Line Result - args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 } + state.centerY ||= 4000 +** Processing line: ~ state.originalCenter ||= [state.centerX, state.centerY]~ +- Inside source: true +*** True Line Result + state.originalCenter ||= [state.centerX, state.centerY] +** Processing line: ~ state.gridSize ||= 1600~ +- Inside source: true +*** True Line Result + state.gridSize ||= 1600 +** Processing line: ~ state.lineQuantity ||= 50~ +- Inside source: true +*** True Line Result + state.lineQuantity ||= 50 +** Processing line: ~ state.increment ||= state.gridSize / state.lineQuantity~ +- Inside source: true +*** True Line Result + state.increment ||= state.gridSize / state.lineQuantity +** Processing line: ~ state.gridX ||= []~ +- Inside source: true +*** True Line Result + state.gridX ||= [] +** Processing line: ~ state.gridY ||= []~ +- Inside source: true +*** True Line Result + state.gridY ||= [] +** Processing line: ~ state.filled_squares ||= []~ +- Inside source: true +*** True Line Result + state.filled_squares ||= [] +** Processing line: ~ state.grid_border ||= [390, 140, 500, 500]~ +- Inside source: true +*** True Line Result + state.grid_border ||= [390, 140, 500, 500] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render a diagonal line starting from the bottom left and going to the top right~ +** Processing line: ~ get_grid unless state.tempX == 0 # calls get_grid in the first frame only~ - Inside source: true *** True Line Result - # Render a diagonal line starting from the bottom left and going to the top right -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 }~ + get_grid unless state.tempX == 0 # calls get_grid in the first frame only +** Processing line: ~ determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame~ - Inside source: true *** True Line Result - args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 } -** Processing line: ~ end~ + determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame +** Processing line: ~ state.tempX = 0 # sets tempX to 0; the two methods aren't called again~ - Inside source: true *** True Line Result - end + state.tempX = 0 # sets tempX to 0; the two methods aren't called again +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ # Calculates the placement of lines or separators in the grid~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # == HOW TO RENDER A SPRITE ===================================================~ + # Calculates the placement of lines or separators in the grid +** Processing line: ~ def get_grid~ - Inside source: true *** True Line Result - ## # == HOW TO RENDER A SPRITE =================================================== -** Processing line: ~ ## # =============================================================================~ + def get_grid +** Processing line: ~ curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_render_sprites args~ + curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid +** Processing line: ~ deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid~ - Inside source: true *** True Line Result - def how_to_render_sprites args -** Processing line: ~ # Loop 10 times and create 10 sprites in 10 positions~ + deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid +** Processing line: ~ (state.lineQuantity + 2).times do~ - Inside source: true *** True Line Result - # Loop 10 times and create 10 sprites in 10 positions -** Processing line: ~ # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png'~ + (state.lineQuantity + 2).times do +** Processing line: ~ state.gridX << curr_x # adds curr_x to gridX collection~ - Inside source: true *** True Line Result - # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png' -** Processing line: ~ 10.times do |i|~ + state.gridX << curr_x # adds curr_x to gridX collection +** Processing line: ~ curr_x += deltaX # increment curr_x by the distance between vertical lines~ - Inside source: true *** True Line Result - 10.times do |i| -** Processing line: ~ args.lowrez.sprites << {~ + curr_x += deltaX # increment curr_x by the distance between vertical lines +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.lowrez.sprites << { -** Processing line: ~ x: i * 5,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - x: i * 5, -** Processing line: ~ y: i * 5,~ + +** Processing line: ~ curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid~ - Inside source: true *** True Line Result - y: i * 5, -** Processing line: ~ w: 5,~ + curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid +** Processing line: ~ deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid~ - Inside source: true *** True Line Result - w: 5, -** Processing line: ~ h: 5,~ + deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid +** Processing line: ~ (state.lineQuantity + 2).times do~ - Inside source: true *** True Line Result - h: 5, -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png'~ + (state.lineQuantity + 2).times do +** Processing line: ~ state.gridY << curr_y # adds curr_y to gridY collection~ - Inside source: true *** True Line Result - path: 'sprites/lowrez-ship-blue.png' -** Processing line: ~ }~ + state.gridY << curr_y # adds curr_y to gridY collection +** Processing line: ~ curr_y += deltaY # increments curr_y to distance between horizontal lines~ - Inside source: true *** True Line Result - } + curr_y += deltaY # increments curr_y to distance between horizontal lines +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -48209,558 +48584,510 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Given an array of positions create sprites~ +** Processing line: ~ # Determines coordinate positions of patterned tiles (on the left side of the grid)~ - Inside source: true *** True Line Result - # Given an array of positions create sprites -** Processing line: ~ positions = [~ + # Determines coordinate positions of patterned tiles (on the left side of the grid) +** Processing line: ~ def determineTileCords~ - Inside source: true *** True Line Result - positions = [ -** Processing line: ~ { x: 10, y: 42 },~ + def determineTileCords +** Processing line: ~ state.tempCounter ||= 1 # initializes tempCounter to 1~ - Inside source: true *** True Line Result - { x: 10, y: 42 }, -** Processing line: ~ { x: 15, y: 45 },~ + state.tempCounter ||= 1 # initializes tempCounter to 1 +** Processing line: ~ state.tileQuantity.times do # there are 6 different kinds of tiles~ - Inside source: true *** True Line Result - { x: 15, y: 45 }, -** Processing line: ~ { x: 22, y: 33 },~ + state.tileQuantity.times do # there are 6 different kinds of tiles +** Processing line: ~ state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection~ - Inside source: true *** True Line Result - { x: 22, y: 33 }, -** Processing line: ~ ]~ + state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection +** Processing line: ~ state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles +** Processing line: ~ state.tempCounter += 1 # increments tempCounter~ - Inside source: true *** True Line Result - -** Processing line: ~ positions.each do |position|~ + state.tempCounter += 1 # increments tempCounter +** Processing line: ~ if state.tempX > 200 # if tempX exceeds 200 pixels~ - Inside source: true *** True Line Result - positions.each do |position| -** Processing line: ~ # use Ruby's ~Hash#merge~ function to create a sprite~ + if state.tempX > 200 # if tempX exceeds 200 pixels +** Processing line: ~ state.tempX = 50 # a new row of patterned tiles begins~ - Inside source: true *** True Line Result - # use Ruby's ~Hash#merge~ function to create a sprite -** Processing line: ~ args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png',~ + state.tempX = 50 # a new row of patterned tiles begins +** Processing line: ~ state.tempY -= 75 # the new row is 75 pixels lower than the previous row~ - Inside source: true *** True Line Result - args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png', -** Processing line: ~ w: 5,~ + state.tempY -= 75 # the new row is 75 pixels lower than the previous row +** Processing line: ~ end~ - Inside source: true *** True Line Result - w: 5, -** Processing line: ~ h: 5)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: 5) + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ -- Inside source: true -*** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ +** Processing line: ~ # Outputs objects (grid, tiles, etc) onto the screen~ - Inside source: true *** True Line Result - ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== -** Processing line: ~ ## # =============================================================================~ + # Outputs objects (grid, tiles, etc) onto the screen +** Processing line: ~ def render~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_animate_a_sprite args~ + def render +** Processing line: ~ outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder~ - Inside source: true *** True Line Result - def how_to_animate_a_sprite args -** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ + outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder +** Processing line: ~ |x, y, order|~ - Inside source: true *** True Line Result - # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds -** Processing line: ~ start_animation_on_tick = 180~ + |x, y, order| +** Processing line: ~ [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"]~ - Inside source: true *** True Line Result - start_animation_on_tick = 180 -** Processing line: ~~ + [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ + end +** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background~ - Inside source: true *** True Line Result - # STEP 2: Get the frame_index given the start tick. -** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ + outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background +** Processing line: ~ add_grid # outputs grid~ - Inside source: true *** True Line Result - sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? -** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ + add_grid # outputs grid +** Processing line: ~ print_title # outputs title and current tile pattern~ - Inside source: true *** True Line Result - hold_for: 4, # how long to hold each sprite? -** Processing line: ~ repeat: true # should it repeat?~ + print_title # outputs title and current tile pattern +** Processing line: ~ end~ - Inside source: true *** True Line Result - repeat: true # should it repeat? + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ -- Inside source: true -*** True Line Result - # STEP 3: frame_index will return nil if the frame hasn't arrived yet -** Processing line: ~ if sprite_index~ +** Processing line: ~ # Creates a grid by outputting vertical and horizontal grid lines onto the screen.~ - Inside source: true *** True Line Result - if sprite_index -** Processing line: ~ # if the sprite_index is populated, use it to determine the sprite path and render it~ + # Creates a grid by outputting vertical and horizontal grid lines onto the screen. +** Processing line: ~ # Outputs sprites for the filled_squares collection onto the screen.~ - Inside source: true *** True Line Result - # if the sprite_index is populated, use it to determine the sprite path and render it -** Processing line: ~ sprite_path = "sprites/explosion-#{sprite_index}.png"~ + # Outputs sprites for the filled_squares collection onto the screen. +** Processing line: ~ def add_grid~ - Inside source: true *** True Line Result - sprite_path = "sprites/explosion-#{sprite_index}.png" -** Processing line: ~ args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path }~ + def add_grid +** Processing line: ~~ - Inside source: true *** True Line Result - args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path } -** Processing line: ~ else~ + +** Processing line: ~ # Outputs the grid's border.~ - Inside source: true *** True Line Result - else -** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ + # Outputs the grid's border. +** Processing line: ~ outputs.borders << state.grid_border~ - Inside source: true *** True Line Result - # if the sprite_index is nil, render a countdown instead -** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ + outputs.borders << state.grid_border +** Processing line: ~ temp = 0~ - Inside source: true *** True Line Result - countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) + temp = 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.lowrez.labels << args.lowrez~ -- Inside source: true -*** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ +** Processing line: ~ # Before looking at the code that outputs the vertical and horizontal lines in the~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ + # Before looking at the code that outputs the vertical and horizontal lines in the +** Processing line: ~ # grid, take note of the fact that:~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 32,~ + # grid, take note of the fact that: +** Processing line: ~ # grid_border[1] refers to the border's bottom line (running horizontally),~ - Inside source: true *** True Line Result - y: 32, -** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ + # grid_border[1] refers to the border's bottom line (running horizontally), +** Processing line: ~ # grid_border[2] refers to the border's top line (running (horizontally),~ - Inside source: true *** True Line Result - text: "Count Down: #{countdown_in_seconds}", -** Processing line: ~ alignment_enum: 1)~ + # grid_border[2] refers to the border's top line (running (horizontally), +** Processing line: ~ # grid_border[0] refers to the border's left line (running vertically),~ - Inside source: true *** True Line Result - alignment_enum: 1) -** Processing line: ~ end~ + # grid_border[0] refers to the border's left line (running vertically), +** Processing line: ~ # and grid_border[3] refers to the border's right line (running vertically).~ - Inside source: true *** True Line Result - end + # and grid_border[3] refers to the border's right line (running vertically). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # render the current tick and the resolved sprite index~ +** Processing line: ~ # [2]~ - Inside source: true *** True Line Result - # render the current tick and the resolved sprite index -** Processing line: ~ args.lowrez.labels << args.lowrez~ + # [2] +** Processing line: ~ # ----------~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # ---------- +** Processing line: ~ # | |~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 0,~ + # | | +** Processing line: ~ # [0] | | [3]~ - Inside source: true *** True Line Result - .merge(x: 0, -** Processing line: ~ y: 11,~ + # [0] | | [3] +** Processing line: ~ # | |~ - Inside source: true *** True Line Result - y: 11, -** Processing line: ~ text: "Tick: #{args.state.tick_count}")~ + # | | +** Processing line: ~ # ----------~ - Inside source: true *** True Line Result - text: "Tick: #{args.state.tick_count}") -** Processing line: ~ args.lowrez.labels << args.lowrez~ + # ---------- +** Processing line: ~ # [1]~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # [1] +** Processing line: ~~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 0,~ + +** Processing line: ~ # Calculates the positions and outputs the x grid lines in the color gray.~ - Inside source: true *** True Line Result - .merge(x: 0, -** Processing line: ~ y: 5,~ + # Calculates the positions and outputs the x grid lines in the color gray. +** Processing line: ~ state.gridX.map do # perform an action on all elements of the gridX collection~ - Inside source: true *** True Line Result - y: 5, -** Processing line: ~ text: "sprite_index: #{sprite_index}")~ + state.gridX.map do # perform an action on all elements of the gridX collection +** Processing line: ~ |x|~ - Inside source: true *** True Line Result - text: "sprite_index: #{sprite_index}") -** Processing line: ~ end~ + |x| +** Processing line: ~ temp += 1 # increment temp~ - Inside source: true *** True Line Result - end + temp += 1 # increment temp ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ -- Inside source: true -*** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =================================~ +** Processing line: ~ # if x's value is greater than (or equal to) the x value of the border's left side~ - Inside source: true *** True Line Result - ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ================================= -** Processing line: ~ ## # =============================================================================~ + # if x's value is greater than (or equal to) the x value of the border's left side +** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_animate_a_sprite_sheet args~ + # and less than (or equal to) the x value of the border's right side +** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2)~ - Inside source: true *** True Line Result - def how_to_animate_a_sprite_sheet args -** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ + if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2) +** Processing line: ~ delta = state.centerX - 640~ - Inside source: true *** True Line Result - # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds -** Processing line: ~ start_animation_on_tick = 180~ + delta = state.centerX - 640 +** Processing line: ~ # vertical lines have the same starting and ending x positions~ - Inside source: true *** True Line Result - start_animation_on_tick = 180 -** Processing line: ~~ + # vertical lines have the same starting and ending x positions +** Processing line: ~ # starting y and ending y positions lead from the bottom of the border to the top of the border~ - Inside source: true *** True Line Result - -** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ + # starting y and ending y positions lead from the bottom of the border to the top of the border +** Processing line: ~ outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it~ - Inside source: true *** True Line Result - # STEP 2: Get the frame_index given the start tick. -** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ + outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it +** Processing line: ~ end~ - Inside source: true *** True Line Result - sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? -** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - hold_for: 4, # how long to hold each sprite? -** Processing line: ~ repeat: true # should it repeat?~ + end +** Processing line: ~ temp = 0~ - Inside source: true *** True Line Result - repeat: true # should it repeat? + temp = 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ +** Processing line: ~ # Calculates the positions and outputs the y grid lines in the color gray.~ - Inside source: true *** True Line Result - # STEP 3: frame_index will return nil if the frame hasn't arrived yet -** Processing line: ~ if sprite_index~ + # Calculates the positions and outputs the y grid lines in the color gray. +** Processing line: ~ state.gridY.map do # perform an action on all elements of the gridY collection~ - Inside source: true *** True Line Result - if sprite_index -** Processing line: ~ # if the sprite_index is populated, use it to determine the source rectangle and render it~ + state.gridY.map do # perform an action on all elements of the gridY collection +** Processing line: ~ |y|~ - Inside source: true *** True Line Result - # if the sprite_index is populated, use it to determine the source rectangle and render it -** Processing line: ~ args.lowrez.sprites << {~ + |y| +** Processing line: ~ temp += 1 # increment temp~ - Inside source: true *** True Line Result - args.lowrez.sprites << { -** Processing line: ~ x: 0,~ + temp += 1 # increment temp +** Processing line: ~~ - Inside source: true *** True Line Result - x: 0, -** Processing line: ~ y: 0,~ + +** Processing line: ~ # if y's value is greater than (or equal to) the y value of the border's bottom side~ - Inside source: true *** True Line Result - y: 0, -** Processing line: ~ w: 64,~ + # if y's value is greater than (or equal to) the y value of the border's bottom side +** Processing line: ~ # and less than (or equal to) the y value of the border's top side~ - Inside source: true *** True Line Result - w: 64, -** Processing line: ~ h: 64,~ + # and less than (or equal to) the y value of the border's top side +** Processing line: ~ if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2)~ - Inside source: true *** True Line Result - h: 64, -** Processing line: ~ path: "sprites/explosion-sheet.png",~ + if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) +** Processing line: ~ delta = state.centerY - 393~ - Inside source: true *** True Line Result - path: "sprites/explosion-sheet.png", -** Processing line: ~ source_x: 32 * sprite_index,~ + delta = state.centerY - 393 +** Processing line: ~ # horizontal lines have the same starting and ending y positions~ - Inside source: true *** True Line Result - source_x: 32 * sprite_index, -** Processing line: ~ source_y: 0,~ + # horizontal lines have the same starting and ending y positions +** Processing line: ~ # starting x and ending x positions lead from the left side of the border to the right side of the border~ - Inside source: true *** True Line Result - source_y: 0, -** Processing line: ~ source_w: 32,~ + # starting x and ending x positions lead from the left side of the border to the right side of the border +** Processing line: ~ outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it~ - Inside source: true *** True Line Result - source_w: 32, -** Processing line: ~ source_h: 32~ + outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it +** Processing line: ~ end~ - Inside source: true *** True Line Result - source_h: 32 -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ + +** Processing line: ~ # Sets values and outputs sprites for the filled_squares collection.~ - Inside source: true *** True Line Result - # if the sprite_index is nil, render a countdown instead -** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ + # Sets values and outputs sprites for the filled_squares collection. +** Processing line: ~ state.filled_squares.map do # perform an action on every element of the filled_squares collection~ - Inside source: true *** True Line Result - countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) -** Processing line: ~~ + state.filled_squares.map do # perform an action on every element of the filled_squares collection +** Processing line: ~ |x, y, w, h, sprite|~ - Inside source: true *** True Line Result - -** Processing line: ~ args.lowrez.labels << args.lowrez~ + |x, y, w, h, sprite| +** Processing line: ~ # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side +** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ + # and less than (or equal to) the x value of the border's right side +** Processing line: ~ # and y's value is greater than (or equal to) the y value of the border's bottom side~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 32,~ + # and y's value is greater than (or equal to) the y value of the border's bottom side +** Processing line: ~ # and less than (or equal to) the y value of 25 pixels above the border's top side~ - Inside source: true *** True Line Result - y: 32, -** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ + # and less than (or equal to) the y value of 25 pixels above the border's top side +** Processing line: ~ # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or~ - Inside source: true *** True Line Result - text: "Count Down: #{countdown_in_seconds}", -** Processing line: ~ alignment_enum: 1)~ + # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or +** Processing line: ~ # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D")~ - Inside source: true *** True Line Result - alignment_enum: 1) -** Processing line: ~ end~ + # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D") +** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) &&~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) && +** Processing line: ~ y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25~ - Inside source: true *** True Line Result - -** Processing line: ~ # render the current tick and the resolved sprite index~ + y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25 +** Processing line: ~ # calculations done to place sprites in grid spaces that are meant to filled in~ - Inside source: true *** True Line Result - # render the current tick and the resolved sprite index -** Processing line: ~ args.lowrez.labels << args.lowrez~ + # calculations done to place sprites in grid spaces that are meant to filled in +** Processing line: ~ # mess around with the x and y values and see how the sprite placement changes~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # mess around with the x and y values and see how the sprite placement changes +** Processing line: ~ outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite]~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 0,~ + outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite] +** Processing line: ~ end~ - Inside source: true *** True Line Result - .merge(x: 0, -** Processing line: ~ y: 11,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: 11, -** Processing line: ~ text: "tick: #{args.state.tick_count}")~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - text: "tick: #{args.state.tick_count}") -** Processing line: ~ args.lowrez.labels << args.lowrez~ + +** Processing line: ~ # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background)~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background) +** Processing line: ~ # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 0,~ + # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner +** Processing line: ~ # state.increment subtracted in y parameter to avoid covering the title label~ - Inside source: true *** True Line Result - .merge(x: 0, -** Processing line: ~ y: 5,~ + # state.increment subtracted in y parameter to avoid covering the title label +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment,~ - Inside source: true *** True Line Result - y: 5, -** Processing line: ~ text: "sprite_index: #{sprite_index}")~ + outputs.primitives << [state.grid_border[0] - state.increment, +** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ - Inside source: true *** True Line Result - text: "sprite_index: #{sprite_index}") -** Processing line: ~ end~ + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), +** Processing line: ~ 255, 255, 255].solid~ - Inside source: true *** True Line Result - end + 255, 255, 255].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ## # =============================================================================~ -- Inside source: true -*** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE =~ -- Inside source: true -*** True Line Result - ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE = -** Processing line: ~ ## # =============================================================================~ -- Inside source: true -*** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_move_a_sprite args~ -- Inside source: true -*** True Line Result - def how_to_move_a_sprite args -** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ # outputs a white solid along the right side of the grid~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # outputs a white solid along the right side of the grid +** Processing line: ~ # state.increment subtracted from y parameter to avoid covering title label~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ + # state.increment subtracted from y parameter to avoid covering title label +** Processing line: ~ outputs.primitives << [state.grid_border[0] + state.grid_border[2],~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 62, text: "Use Arrow Keys",~ + outputs.primitives << [state.grid_border[0] + state.grid_border[2], +** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ - Inside source: true *** True Line Result - y: 62, text: "Use Arrow Keys", -** Processing line: ~ alignment_enum: 1)~ + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), +** Processing line: ~ 255, 255, 255].solid~ - Inside source: true *** True Line Result - alignment_enum: 1) + 255, 255, 255].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.lowrez.labels << args.lowrez~ -- Inside source: true -*** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ +** Processing line: ~ # outputs a white solid along the bottom of the grid~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ + # outputs a white solid along the bottom of the grid +** Processing line: ~ # state.increment subtracted from y parameter to avoid covering last row of grid boxes~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 56, text: "Use WASD",~ + # state.increment subtracted from y parameter to avoid covering last row of grid boxes +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment,~ - Inside source: true *** True Line Result - y: 56, text: "Use WASD", -** Processing line: ~ alignment_enum: 1)~ + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment, +** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ - Inside source: true *** True Line Result - alignment_enum: 1) + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.lowrez.labels << args.lowrez~ -- Inside source: true -*** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ -- Inside source: true -*** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ # outputs a white solid along the top of the grid~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 50, text: "Or Click",~ + # outputs a white solid along the top of the grid +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3],~ - Inside source: true *** True Line Result - y: 50, text: "Or Click", -** Processing line: ~ alignment_enum: 1)~ + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3], +** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ - Inside source: true *** True Line Result - alignment_enum: 1) + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # set the initial values for x and y using ||= ("or equal operator")~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - # set the initial values for x and y using ||= ("or equal operator") -** Processing line: ~ args.state.ship.x ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.ship.x ||= 0 -** Processing line: ~ args.state.ship.y ||= 0~ + +** Processing line: ~ # Outputs title and current tile pattern~ - Inside source: true *** True Line Result - args.state.ship.y ||= 0 -** Processing line: ~~ + # Outputs title and current tile pattern +** Processing line: ~ def print_title~ - Inside source: true *** True Line Result - -** Processing line: ~ # if a mouse click occurs, update the ship's x and y to be the location of the click~ + def print_title +** Processing line: ~ outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label~ - Inside source: true *** True Line Result - # if a mouse click occurs, update the ship's x and y to be the location of the click -** Processing line: ~ if args.lowrez.mouse_click~ + outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label +** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator~ - Inside source: true *** True Line Result - if args.lowrez.mouse_click -** Processing line: ~ args.state.ship.x = args.lowrez.mouse_click.x~ + outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator +** Processing line: ~ outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label~ - Inside source: true *** True Line Result - args.state.ship.x = args.lowrez.mouse_click.x -** Processing line: ~ args.state.ship.y = args.lowrez.mouse_click.y~ + outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label +** Processing line: ~ outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile~ - Inside source: true *** True Line Result - args.state.ship.y = args.lowrez.mouse_click.y + outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -48769,18 +49096,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # if a or left arrow is pressed/held, decrement the ships x position~ +** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ - Inside source: true *** True Line Result - # if a or left arrow is pressed/held, decrement the ships x position -** Processing line: ~ if args.lowrez.keyboard.left~ + # Sets the starting position, ending position, and color for the horizontal separator. +** Processing line: ~ def horizontal_separator y, x, x2~ - Inside source: true *** True Line Result - if args.lowrez.keyboard.left -** Processing line: ~ args.state.ship.x -= 1~ + def horizontal_separator y, x, x2 +** Processing line: ~ [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y~ - Inside source: true *** True Line Result - args.state.ship.x -= 1 + [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -48789,262 +49116,266 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # if d or right arrow is pressed/held, increment the ships x position~ +** Processing line: ~ # Checks if the mouse is being clicked or dragged~ - Inside source: true *** True Line Result - # if d or right arrow is pressed/held, increment the ships x position -** Processing line: ~ if args.lowrez.keyboard.right~ + # Checks if the mouse is being clicked or dragged +** Processing line: ~ def check_click~ - Inside source: true *** True Line Result - if args.lowrez.keyboard.right -** Processing line: ~ args.state.ship.x += 1~ + def check_click +** Processing line: ~ if inputs.keyboard.key_down.r # if the "r" key is pressed down~ - Inside source: true *** True Line Result - args.state.ship.x += 1 -** Processing line: ~ end~ + if inputs.keyboard.key_down.r # if the "r" key is pressed down +** Processing line: ~ $dragon.reset~ - Inside source: true *** True Line Result - end + $dragon.reset +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if s or down arrow is pressed/held, decrement the ships y position~ +** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ - Inside source: true *** True Line Result - # if s or down arrow is pressed/held, decrement the ships y position -** Processing line: ~ if args.lowrez.keyboard.down~ + if inputs.mouse.down #is mouse up or down? +** Processing line: ~ state.mouse_held = true~ - Inside source: true *** True Line Result - if args.lowrez.keyboard.down -** Processing line: ~ args.state.ship.y -= 1~ + state.mouse_held = true +** Processing line: ~ if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders~ - Inside source: true *** True Line Result - args.state.ship.y -= 1 -** Processing line: ~ end~ + if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders +** Processing line: ~ state.tileCords.map do # perform action on all elements of tileCords collection~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.tileCords.map do # perform action on all elements of tileCords collection +** Processing line: ~ |x, y, order|~ - Inside source: true *** True Line Result - -** Processing line: ~ # if w or up arrow is pressed/held, increment the ships y position~ + |x, y, order| +** Processing line: ~ # if mouse's x position is greater than (or equal to) the starting x position of a tile~ - Inside source: true *** True Line Result - # if w or up arrow is pressed/held, increment the ships y position -** Processing line: ~ if args.lowrez.keyboard.up~ + # if mouse's x position is greater than (or equal to) the starting x position of a tile +** Processing line: ~ # and the mouse's x position is also less than (or equal to) the ending x position of that tile,~ - Inside source: true *** True Line Result - if args.lowrez.keyboard.up -** Processing line: ~ args.state.ship.y += 1~ + # and the mouse's x position is also less than (or equal to) the ending x position of that tile, +** Processing line: ~ # and the mouse's y position is greater than (or equal to) the starting y position of that tile,~ - Inside source: true *** True Line Result - args.state.ship.y += 1 -** Processing line: ~ end~ + # and the mouse's y position is greater than (or equal to) the starting y position of that tile, +** Processing line: ~ # and the mouse's y position is also less than (or equal to) the ending y position of that tile,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # and the mouse's y position is also less than (or equal to) the ending y position of that tile, +** Processing line: ~ # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE)~ - Inside source: true *** True Line Result - -** Processing line: ~ # render the sprite to the screen using the position stored in args.state.ship~ + # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE) +** Processing line: ~ if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize &&~ - Inside source: true *** True Line Result - # render the sprite to the screen using the position stored in args.state.ship -** Processing line: ~ args.lowrez.sprites << {~ + if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize && +** Processing line: ~ inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize~ - Inside source: true *** True Line Result - args.lowrez.sprites << { -** Processing line: ~ x: args.state.ship.x,~ + inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize +** Processing line: ~ state.tileSelected = order # that tile is selected~ - Inside source: true *** True Line Result - x: args.state.ship.x, -** Processing line: ~ y: args.state.ship.y,~ + state.tileSelected = order # that tile is selected +** Processing line: ~ end~ - Inside source: true *** True Line Result - y: args.state.ship.y, -** Processing line: ~ w: 5,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - w: 5, -** Processing line: ~ h: 5,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: 5, -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ + end +** Processing line: ~ elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state~ - Inside source: true *** True Line Result - path: 'sprites/lowrez-ship-blue.png', -** Processing line: ~ # parameters beyond this point are optional~ + elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state +** Processing line: ~ state.mouse_held = false # mouse is not held down or dragged~ - Inside source: true *** True Line Result - # parameters beyond this point are optional -** Processing line: ~ angle: 0, # Note: rotation angle is denoted in degrees NOT radians~ + state.mouse_held = false # mouse is not held down or dragged +** Processing line: ~ state.mouse_dragging = false~ - Inside source: true *** True Line Result - angle: 0, # Note: rotation angle is denoted in degrees NOT radians -** Processing line: ~ r: 255,~ + state.mouse_dragging = false +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + +** Processing line: ~ if state.mouse_held && # mouse needs to be down~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ a: 255~ + if state.mouse_held && # mouse needs to be down +** Processing line: ~ !inputs.mouse.click && # must not be first click~ - Inside source: true *** True Line Result - a: 255 -** Processing line: ~ }~ + !inputs.mouse.click && # must not be first click +** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 ||~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 || +** Processing line: ~ (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag" +** Processing line: ~ state.mouse_dragging = true~ - Inside source: true *** True Line Result - -** Processing line: ~ # =======================================================================~ + state.mouse_dragging = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =======================================~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # ==== HOW TO DETERMINE COLLISION ======================================= -** Processing line: ~ # =======================================================================~ + +** Processing line: ~ # if mouse is clicked inside grid's border, search_lines method is called with click input type~ - Inside source: true *** True Line Result - # ======================================================================= -** Processing line: ~ def how_to_determine_collision args~ + # if mouse is clicked inside grid's border, search_lines method is called with click input type +** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ - Inside source: true *** True Line Result - def how_to_determine_collision args -** Processing line: ~ # Render the instructions~ + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) +** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ - Inside source: true *** True Line Result - # Render the instructions -** Processing line: ~ args.lowrez.labels << args.lowrez~ + search_lines(inputs.mouse.click.point, :click) +** Processing line: ~~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + +** Processing line: ~ # if mouse is dragged inside grid's border, search_lines method is called with drag input type~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 32,~ + # if mouse is dragged inside grid's border, search_lines method is called with drag input type +** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 62, text: "Click Anywhere",~ + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) +** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ - Inside source: true *** True Line Result - y: 62, text: "Click Anywhere", -** Processing line: ~ alignment_enum: 1)~ + search_lines(inputs.mouse.position, :drag) +** Processing line: ~ end~ - Inside source: true *** True Line Result - alignment_enum: 1) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if a mouse click occurs:~ +** Processing line: ~ # Changes grid's position on screen by moving it up, down, left, or right.~ - Inside source: true *** True Line Result - # if a mouse click occurs: -** Processing line: ~ # - set ship_one if it isn't set~ + # Changes grid's position on screen by moving it up, down, left, or right. +** Processing line: ~~ - Inside source: true *** True Line Result - # - set ship_one if it isn't set -** Processing line: ~ # - set ship_two if it isn't set~ + +** Processing line: ~ # centerX is incremented by speed if the "d" key is pressed and if that sum is less than~ - Inside source: true *** True Line Result - # - set ship_two if it isn't set -** Processing line: ~ # - otherwise reset ship one and ship two~ + # centerX is incremented by speed if the "d" key is pressed and if that sum is less than +** Processing line: ~ # the original left side of the center plus half the grid, minus half the top border of grid.~ - Inside source: true *** True Line Result - # - otherwise reset ship one and ship two -** Processing line: ~ if args.lowrez.mouse_click~ + # the original left side of the center plus half the grid, minus half the top border of grid. +** Processing line: ~ # MOVES GRID RIGHT (increasing x)~ - Inside source: true *** True Line Result - if args.lowrez.mouse_click -** Processing line: ~ # is ship_one set?~ + # MOVES GRID RIGHT (increasing x) +** Processing line: ~ state.centerX += state.speed if inputs.keyboard.key_held.d &&~ - Inside source: true *** True Line Result - # is ship_one set? -** Processing line: ~ if !args.state.ship_one~ + state.centerX += state.speed if inputs.keyboard.key_held.d && +** Processing line: ~ (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2)~ - Inside source: true *** True Line Result - if !args.state.ship_one -** Processing line: ~ args.state.ship_one = { x: args.lowrez.mouse_click.x - 10,~ + (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2) +** Processing line: ~ # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than~ - Inside source: true *** True Line Result - args.state.ship_one = { x: args.lowrez.mouse_click.x - 10, -** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ + # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than +** Processing line: ~ # the original left side of the center minus half the grid, plus half the top border of grid.~ - Inside source: true *** True Line Result - y: args.lowrez.mouse_click.y - 10, -** Processing line: ~ w: 20,~ + # the original left side of the center minus half the grid, plus half the top border of grid. +** Processing line: ~ # MOVES GRID LEFT (decreasing x)~ - Inside source: true *** True Line Result - w: 20, -** Processing line: ~ h: 20 }~ + # MOVES GRID LEFT (decreasing x) +** Processing line: ~ state.centerX -= state.speed if inputs.keyboard.key_held.a &&~ - Inside source: true *** True Line Result - h: 20 } -** Processing line: ~ # is ship_one set?~ + state.centerX -= state.speed if inputs.keyboard.key_held.a && +** Processing line: ~ (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2)~ - Inside source: true *** True Line Result - # is ship_one set? -** Processing line: ~ elsif !args.state.ship_two~ + (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2) +** Processing line: ~ # centerY is incremented by speed if the "w" key is pressed and if that sum is less than~ - Inside source: true *** True Line Result - elsif !args.state.ship_two -** Processing line: ~ args.state.ship_two = { x: args.lowrez.mouse_click.x - 10,~ + # centerY is incremented by speed if the "w" key is pressed and if that sum is less than +** Processing line: ~ # the original bottom of the center plus half the grid, minus half the right border of grid.~ - Inside source: true *** True Line Result - args.state.ship_two = { x: args.lowrez.mouse_click.x - 10, -** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ + # the original bottom of the center plus half the grid, minus half the right border of grid. +** Processing line: ~ # MOVES GRID UP (increasing y)~ - Inside source: true *** True Line Result - y: args.lowrez.mouse_click.y - 10, -** Processing line: ~ w: 20,~ + # MOVES GRID UP (increasing y) +** Processing line: ~ state.centerY += state.speed if inputs.keyboard.key_held.w &&~ - Inside source: true *** True Line Result - w: 20, -** Processing line: ~ h: 20 }~ + state.centerY += state.speed if inputs.keyboard.key_held.w && +** Processing line: ~ (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2)~ - Inside source: true *** True Line Result - h: 20 } -** Processing line: ~ # should we reset?~ + (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2) +** Processing line: ~ # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than~ - Inside source: true *** True Line Result - # should we reset? -** Processing line: ~ else~ + # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than +** Processing line: ~ # the original bottom of the center minus half the grid, plus half the right border of grid.~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.ship_one = nil~ + # the original bottom of the center minus half the grid, plus half the right border of grid. +** Processing line: ~ # MOVES GRID DOWN (decreasing y)~ - Inside source: true *** True Line Result - args.state.ship_one = nil -** Processing line: ~ args.state.ship_two = nil~ + # MOVES GRID DOWN (decreasing y) +** Processing line: ~ state.centerY -= state.speed if inputs.keyboard.key_held.s &&~ - Inside source: true *** True Line Result - args.state.ship_two = nil -** Processing line: ~ end~ + state.centerY -= state.speed if inputs.keyboard.key_held.s && +** Processing line: ~ (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2)~ - Inside source: true *** True Line Result - end + (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -49053,550 +49384,586 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # render ship one if it's set~ +** Processing line: ~ # Performs calculations on the gridX and gridY collections, and sets values.~ - Inside source: true *** True Line Result - # render ship one if it's set -** Processing line: ~ if args.state.ship_one~ + # Performs calculations on the gridX and gridY collections, and sets values. +** Processing line: ~ # Sets the definition of a grid box, including the image that it is filled with.~ - Inside source: true *** True Line Result - if args.state.ship_one -** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ + # Sets the definition of a grid box, including the image that it is filled with. +** Processing line: ~ def search_lines (point, input_type)~ - Inside source: true *** True Line Result - # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha -** Processing line: ~ # render ship one~ + def search_lines (point, input_type) +** Processing line: ~ point.x += state.centerX - 630 # increments x and y~ - Inside source: true *** True Line Result - # render ship one -** Processing line: ~ args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100)~ + point.x += state.centerX - 630 # increments x and y +** Processing line: ~ point.y += state.centerY - 360~ - Inside source: true *** True Line Result - args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100) -** Processing line: ~ end~ + point.y += state.centerY - 360 +** Processing line: ~ findX = 0~ - Inside source: true *** True Line Result - end + findX = 0 +** Processing line: ~ findY = 0~ +- Inside source: true +*** True Line Result + findY = 0 +** Processing line: ~ increment = state.gridSize / state.lineQuantity # divides grid by number of separators~ +- Inside source: true +*** True Line Result + increment = state.gridSize / state.lineQuantity # divides grid by number of separators ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.ship_two~ +** Processing line: ~ state.gridX.map do # perform an action on every element of collection~ - Inside source: true *** True Line Result - if args.state.ship_two -** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ + state.gridX.map do # perform an action on every element of collection +** Processing line: ~ |x|~ - Inside source: true *** True Line Result - # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha -** Processing line: ~ # render ship two~ + |x| +** Processing line: ~ # findX increments x by 10 if point.x is less than that sum and findX is currently 0~ - Inside source: true *** True Line Result - # render ship two -** Processing line: ~ args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100)~ + # findX increments x by 10 if point.x is less than that sum and findX is currently 0 +** Processing line: ~ findX = x + 10 if point.x < (x + 10) && findX == 0~ - Inside source: true *** True Line Result - args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100) -** Processing line: ~ end~ + findX = x + 10 if point.x < (x + 10) && findX == 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # if both ship one and ship two are set, then determine collision~ +** Processing line: ~ state.gridY.map do~ - Inside source: true *** True Line Result - # if both ship one and ship two are set, then determine collision -** Processing line: ~ if args.state.ship_one && args.state.ship_two~ + state.gridY.map do +** Processing line: ~ |y|~ - Inside source: true *** True Line Result - if args.state.ship_one && args.state.ship_two -** Processing line: ~ # collision is determined using the intersect_rect? method~ + |y| +** Processing line: ~ # findY is set to y if point.y is less than that value and findY is currently 0~ - Inside source: true *** True Line Result - # collision is determined using the intersect_rect? method -** Processing line: ~ if args.state.ship_one.intersect_rect? args.state.ship_two~ + # findY is set to y if point.y is less than that value and findY is currently 0 +** Processing line: ~ findY = y if point.y < (y) && findY == 0~ - Inside source: true *** True Line Result - if args.state.ship_one.intersect_rect? args.state.ship_two -** Processing line: ~ # if collision occurred, render the words collision!~ + findY = y if point.y < (y) && findY == 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # if collision occurred, render the words collision! -** Processing line: ~ args.lowrez.labels << args.lowrez~ + end +** Processing line: ~ # position of a box is denoted by bottom left corner, which is why the increment is being subtracted~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # position of a box is denoted by bottom left corner, which is why the increment is being subtracted +** Processing line: ~ grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil,~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 31,~ + grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil, +** Processing line: ~ "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition~ - Inside source: true *** True Line Result - .merge(x: 31, -** Processing line: ~ y: 5,~ + "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition +** Processing line: ~~ - Inside source: true *** True Line Result - y: 5, -** Processing line: ~ text: "Collision!",~ + +** Processing line: ~ if input_type == :click # if user clicks their mouse~ - Inside source: true *** True Line Result - text: "Collision!", -** Processing line: ~ alignment_enum: 1)~ + if input_type == :click # if user clicks their mouse +** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ - Inside source: true *** True Line Result - alignment_enum: 1) -** Processing line: ~ else~ + if state.filled_squares.include? grid_box # if grid box is already filled in +** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ - Inside source: true *** True Line Result - else -** Processing line: ~ # if collision occurred, render the words no collision.~ + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares +** Processing line: ~ else~ - Inside source: true *** True Line Result - # if collision occurred, render the words no collision. -** Processing line: ~ args.lowrez.labels << args.lowrez~ + else +** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares +** Processing line: ~ end~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 31,~ + end +** Processing line: ~ elsif input_type == :drag # if user drags mouse~ - Inside source: true *** True Line Result - .merge(x: 31, -** Processing line: ~ y: 5,~ + elsif input_type == :drag # if user drags mouse +** Processing line: ~ unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in~ - Inside source: true *** True Line Result - y: 5, -** Processing line: ~ text: "No Collision.",~ + unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in +** Processing line: ~ state.filled_squares << grid_box # box is filled in and added to filled_squares~ - Inside source: true *** True Line Result - text: "No Collision.", -** Processing line: ~ alignment_enum: 1)~ + state.filled_squares << grid_box # box is filled in and added to filled_squares +** Processing line: ~ end~ - Inside source: true *** True Line Result - alignment_enum: 1) + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ else~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - else -** Processing line: ~ # if both ship one and ship two aren't set, then render --~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # if both ship one and ship two aren't set, then render -- -** Processing line: ~ args.lowrez.labels << args.lowrez~ + +** Processing line: ~ # Creates a "Clear" button using labels and borders.~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + # Creates a "Clear" button using labels and borders. +** Processing line: ~ def draw_buttons~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(x: 31,~ + def draw_buttons +** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ - Inside source: true *** True Line Result - .merge(x: 31, -** Processing line: ~ y: 6,~ + x, y, w, h = 390, 50, 240, 50 +** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ - Inside source: true *** True Line Result - y: 6, -** Processing line: ~ text: "--",~ + state.clear_button ||= state.new_entity(:button_with_fade) +** Processing line: ~~ - Inside source: true *** True Line Result - text: "--", -** Processing line: ~ alignment_enum: 1)~ + +** Processing line: ~ # x and y positions are set to display "Clear" label in center of the button~ - Inside source: true *** True Line Result - alignment_enum: 1) -** Processing line: ~ end~ + # x and y positions are set to display "Clear" label in center of the button +** Processing line: ~ # Try changing first two parameters to simply x, y and see what happens to the text placement~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Try changing first two parameters to simply x, y and see what happens to the text placement +** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] +** Processing line: ~ state.clear_button.border ||= [x, y, w, h] # definition of button's border~ - Inside source: true *** True Line Result - -** Processing line: ~ ## # =============================================================================~ + state.clear_button.border ||= [x, y, w, h] # definition of button's border +** Processing line: ~~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ ## # ==== HOW TO CREATE BUTTONS ==================================================~ + +** Processing line: ~ # If the mouse is clicked inside the borders of the clear button~ - Inside source: true *** True Line Result - ## # ==== HOW TO CREATE BUTTONS ================================================== -** Processing line: ~ ## # =============================================================================~ + # If the mouse is clicked inside the borders of the clear button +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ - Inside source: true *** True Line Result - ## # ============================================================================= -** Processing line: ~ def how_to_create_buttons args~ + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) +** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click~ - Inside source: true *** True Line Result - def how_to_create_buttons args -** Processing line: ~ # Define a button style~ + state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click +** Processing line: ~ state.filled_squares.clear # filled squares collection is emptied (squares are cleared)~ - Inside source: true *** True Line Result - # Define a button style -** Processing line: ~ args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 }~ + state.filled_squares.clear # filled squares collection is emptied (squares are cleared) +** Processing line: ~ inputs.mouse.previous_click = nil # no previous click~ - Inside source: true *** True Line Result - args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 } -** Processing line: ~ args.state.label_style = { r: 80, g: 80, b: 80 }~ + inputs.mouse.previous_click = nil # no previous click +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.label_style = { r: 80, g: 80, b: 80 } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render instructions~ +** Processing line: ~ outputs.labels << state.clear_button.label # outputs clear button~ - Inside source: true *** True Line Result - # Render instructions -** Processing line: ~ args.state.button_message ||= "Press a Button!"~ + outputs.labels << state.clear_button.label # outputs clear button +** Processing line: ~ outputs.borders << state.clear_button.border~ - Inside source: true *** True Line Result - args.state.button_message ||= "Press a Button!" -** Processing line: ~ args.lowrez.labels << args.lowrez~ + outputs.borders << state.clear_button.border +** Processing line: ~~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + +** Processing line: ~ # When the clear button is clicked, the color of the button changes~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(args.state.label_style)~ + # When the clear button is clicked, the color of the button changes +** Processing line: ~ # and the transparency changes, as well. If you change the time from~ - Inside source: true *** True Line Result - .merge(args.state.label_style) -** Processing line: ~ .merge(x: 32,~ + # and the transparency changes, as well. If you change the time from +** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 62,~ + # 0.25.seconds to 1.25.seconds or more, the change will last longer. +** Processing line: ~ if state.clear_button.clicked_at~ - Inside source: true *** True Line Result - y: 62, -** Processing line: ~ text: args.state.button_message,~ + if state.clear_button.clicked_at +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ - Inside source: true *** True Line Result - text: args.state.button_message, -** Processing line: ~ alignment_enum: 1)~ + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - alignment_enum: 1) + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result +** Processing line: ~ $tile_editor = TileEditor.new~ +- Inside source: true +*** True Line Result + $tile_editor = TileEditor.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates button one using a border and a label~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # Creates button one using a border and a label -** Processing line: ~ args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)~ + def tick args +** Processing line: ~ $tile_editor.inputs = args.inputs~ - Inside source: true *** True Line Result - args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32) -** Processing line: ~ args.lowrez.borders << args.state.button_one_border~ + $tile_editor.inputs = args.inputs +** Processing line: ~ $tile_editor.grid = args.grid~ - Inside source: true *** True Line Result - args.lowrez.borders << args.state.button_one_border -** Processing line: ~ args.lowrez.labels << args.lowrez~ + $tile_editor.grid = args.grid +** Processing line: ~ $tile_editor.args = args~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + $tile_editor.args = args +** Processing line: ~ $tile_editor.outputs = args.outputs~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(args.state.label_style)~ + $tile_editor.outputs = args.outputs +** Processing line: ~ $tile_editor.state = args.state~ - Inside source: true *** True Line Result - .merge(args.state.label_style) -** Processing line: ~ .merge(x: args.state.button_one_border.x + 2,~ + $tile_editor.state = args.state +** Processing line: ~ $tile_editor.tick~ - Inside source: true *** True Line Result - .merge(x: args.state.button_one_border.x + 2, -** Processing line: ~ y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ + $tile_editor.tick +** Processing line: ~ tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around."~ - Inside source: true *** True Line Result - y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2, -** Processing line: ~ text: "Button One")~ + tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around." +** Processing line: ~ end~ - Inside source: true *** True Line Result - text: "Button One") + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates button two using a border and a label~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - # Creates button two using a border and a label -** Processing line: ~ args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20) -** Processing line: ~~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.mouse.click ||~ - Inside source: true *** True Line Result - -** Processing line: ~ args.lowrez.borders << args.state.button_two_border~ + if args.inputs.mouse.click || +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ - Inside source: true *** True Line Result - args.lowrez.borders << args.state.button_two_border -** Processing line: ~ args.lowrez.labels << args.lowrez~ + args.inputs.keyboard.directional_vector || +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + args.inputs.keyboard.key_down.enter || +** Processing line: ~ args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(args.state.label_style)~ + args.inputs.keyboard.key_down.escape +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - .merge(args.state.label_style) -** Processing line: ~ .merge(x: args.state.button_two_border.x + 2,~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - .merge(x: args.state.button_two_border.x + 2, -** Processing line: ~ y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2, -** Processing line: ~ text: "Button Two")~ + +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - text: "Button Two") -** Processing line: ~~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - -** Processing line: ~ # Initialize the state variable that tracks which button was clicked to "" (empty stringI~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - # Initialize the state variable that tracks which button was clicked to "" (empty stringI -** Processing line: ~ args.state.last_button_clicked ||= "--"~ + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.last_button_clicked ||= "--" + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If a click occurs, check to see if either button one, or button two was clicked~ +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Lowrez - Resolution 64x64 - lowrez.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Lowrez - Resolution 64x64 - lowrez.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb~ - Inside source: true *** True Line Result - # If a click occurs, check to see if either button one, or button two was clicked -** Processing line: ~ # using the inside_rect? method of the mouse~ + # ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb +** Processing line: ~ # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)~ - Inside source: true *** True Line Result - # using the inside_rect? method of the mouse -** Processing line: ~ # set args.state.last_button_clicked accordingly~ + # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-) +** Processing line: ~ # Head over to main.rb and study the code there.~ - Inside source: true *** True Line Result - # set args.state.last_button_clicked accordingly -** Processing line: ~ if args.lowrez.mouse_click~ + # Head over to main.rb and study the code there. +** Processing line: ~~ - Inside source: true *** True Line Result - if args.lowrez.mouse_click -** Processing line: ~ if args.lowrez.mouse_click.inside_rect? args.state.button_one_border~ + +** Processing line: ~ LOWREZ_SIZE = 64~ - Inside source: true *** True Line Result - if args.lowrez.mouse_click.inside_rect? args.state.button_one_border -** Processing line: ~ args.state.last_button_clicked = "One Clicked!"~ + LOWREZ_SIZE = 64 +** Processing line: ~ LOWREZ_ZOOM = 10~ - Inside source: true *** True Line Result - args.state.last_button_clicked = "One Clicked!" -** Processing line: ~ elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border~ + LOWREZ_ZOOM = 10 +** Processing line: ~ LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM~ - Inside source: true *** True Line Result - elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border -** Processing line: ~ args.state.last_button_clicked = "Two Clicked!"~ + LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM +** Processing line: ~ LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half~ - Inside source: true *** True Line Result - args.state.last_button_clicked = "Two Clicked!" -** Processing line: ~ else~ + LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half +** Processing line: ~ LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.last_button_clicked = "--"~ + LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.last_button_clicked = "--" -** Processing line: ~ end~ + +** Processing line: ~ LOWREZ_FONT_XL = -1~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + LOWREZ_FONT_XL = -1 +** Processing line: ~ LOWREZ_FONT_XL_HEIGHT = 20~ - Inside source: true *** True Line Result - end + LOWREZ_FONT_XL_HEIGHT = 20 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Render the current value of args.state.last_button_clicked~ -- Inside source: true -*** True Line Result - # Render the current value of args.state.last_button_clicked -** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ LOWREZ_FONT_LG = -3.5~ - Inside source: true *** True Line Result - args.lowrez.labels << args.lowrez -** Processing line: ~ .default_label~ + LOWREZ_FONT_LG = -3.5 +** Processing line: ~ LOWREZ_FONT_LG_HEIGHT = 15~ - Inside source: true *** True Line Result - .default_label -** Processing line: ~ .merge(args.state.label_style)~ + LOWREZ_FONT_LG_HEIGHT = 15 +** Processing line: ~~ - Inside source: true *** True Line Result - .merge(args.state.label_style) -** Processing line: ~ .merge(x: 32,~ + +** Processing line: ~ LOWREZ_FONT_MD = -6~ - Inside source: true *** True Line Result - .merge(x: 32, -** Processing line: ~ y: 5,~ + LOWREZ_FONT_MD = -6 +** Processing line: ~ LOWREZ_FONT_MD_HEIGHT = 10~ - Inside source: true *** True Line Result - y: 5, -** Processing line: ~ text: args.state.last_button_clicked,~ + LOWREZ_FONT_MD_HEIGHT = 10 +** Processing line: ~~ - Inside source: true *** True Line Result - text: args.state.last_button_clicked, -** Processing line: ~ alignment_enum: 1)~ + +** Processing line: ~ LOWREZ_FONT_SM = -8.5~ - Inside source: true *** True Line Result - alignment_enum: 1) -** Processing line: ~ end~ + LOWREZ_FONT_SM = -8.5 +** Processing line: ~ LOWREZ_FONT_SM_HEIGHT = 5~ - Inside source: true *** True Line Result - end + LOWREZ_FONT_SM_HEIGHT = 5 ** Processing line: ~~ - Inside source: true *** True Line Result +** Processing line: ~ LOWREZ_FONT_PATH = 'fonts/lowrez.ttf'~ +- Inside source: true +*** True Line Result + LOWREZ_FONT_PATH = 'fonts/lowrez.ttf' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_debug args~ +** Processing line: ~~ - Inside source: true *** True Line Result - def render_debug args -** Processing line: ~ if !args.state.grid_rendered~ + +** Processing line: ~ class LowrezOutputs~ - Inside source: true *** True Line Result - if !args.state.grid_rendered -** Processing line: ~ 65.map_with_index do |i|~ + class LowrezOutputs +** Processing line: ~ attr_accessor :width, :height~ - Inside source: true *** True Line Result - 65.map_with_index do |i| -** Processing line: ~ args.outputs.static_debug << {~ + attr_accessor :width, :height +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.static_debug << { -** Processing line: ~ x: LOWREZ_X_OFFSET,~ + +** Processing line: ~ def initialize args~ - Inside source: true *** True Line Result - x: LOWREZ_X_OFFSET, -** Processing line: ~ y: LOWREZ_Y_OFFSET + (i * 10),~ + def initialize args +** Processing line: ~ @args = args~ - Inside source: true *** True Line Result - y: LOWREZ_Y_OFFSET + (i * 10), -** Processing line: ~ x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE,~ + @args = args +** Processing line: ~ @background_color ||= [0, 0, 0]~ - Inside source: true *** True Line Result - x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE, -** Processing line: ~ y2: LOWREZ_Y_OFFSET + (i * 10),~ + @background_color ||= [0, 0, 0] +** Processing line: ~ @args.outputs.background_color = @background_color~ - Inside source: true *** True Line Result - y2: LOWREZ_Y_OFFSET + (i * 10), -** Processing line: ~ r: 128,~ + @args.outputs.background_color = @background_color +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 128, -** Processing line: ~ g: 128,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - g: 128, -** Processing line: ~ b: 128,~ + +** Processing line: ~ def background_color~ - Inside source: true *** True Line Result - b: 128, -** Processing line: ~ a: 80~ + def background_color +** Processing line: ~ @background_color ||= [0, 0, 0]~ - Inside source: true *** True Line Result - a: 80 -** Processing line: ~ }.line~ + @background_color ||= [0, 0, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - }.line + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.static_debug << {~ -- Inside source: true -*** True Line Result - args.outputs.static_debug << { -** Processing line: ~ x: LOWREZ_X_OFFSET + (i * 10),~ +** Processing line: ~ def background_color= opts~ - Inside source: true *** True Line Result - x: LOWREZ_X_OFFSET + (i * 10), -** Processing line: ~ y: LOWREZ_Y_OFFSET,~ + def background_color= opts +** Processing line: ~ @background_color = opts~ - Inside source: true *** True Line Result - y: LOWREZ_Y_OFFSET, -** Processing line: ~ x2: LOWREZ_X_OFFSET + (i * 10),~ + @background_color = opts +** Processing line: ~ @args.outputs.background_color = @background_color~ - Inside source: true *** True Line Result - x2: LOWREZ_X_OFFSET + (i * 10), -** Processing line: ~ y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE,~ + @args.outputs.background_color = @background_color +** Processing line: ~~ - Inside source: true *** True Line Result - y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE, -** Processing line: ~ r: 128,~ + +** Processing line: ~ outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color]~ - Inside source: true *** True Line Result - r: 128, -** Processing line: ~ g: 128,~ + outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color] +** Processing line: ~ end~ - Inside source: true *** True Line Result - g: 128, -** Processing line: ~ b: 128,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - b: 128, -** Processing line: ~ a: 80~ + +** Processing line: ~ def outputs_lowrez~ - Inside source: true *** True Line Result - a: 80 -** Processing line: ~ }.line~ + def outputs_lowrez +** Processing line: ~ return @args.outputs if @args.state.tick_count <= 0~ - Inside source: true *** True Line Result - }.line -** Processing line: ~ end~ + return @args.outputs if @args.state.tick_count <= 0 +** Processing line: ~ return @args.outputs[:lowrez]~ - Inside source: true *** True Line Result - end + return @args.outputs[:lowrez] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -49605,318 +49972,286 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.state.grid_rendered = true~ +** Processing line: ~ def solids~ - Inside source: true *** True Line Result - args.state.grid_rendered = true -** Processing line: ~~ + def solids +** Processing line: ~ outputs_lowrez.solids~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.last_click ||= 0~ + outputs_lowrez.solids +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.last_click ||= 0 -** Processing line: ~ args.state.last_up ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.last_up ||= 0 -** Processing line: ~ args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click~ + +** Processing line: ~ def borders~ - Inside source: true *** True Line Result - args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click -** Processing line: ~ args.state.last_up = args.state.tick_count if args.lowrez.mouse_up~ + def borders +** Processing line: ~ outputs_lowrez.borders~ - Inside source: true *** True Line Result - args.state.last_up = args.state.tick_count if args.lowrez.mouse_up -** Processing line: ~ args.state.label_style = { size_enum: -1.5 }~ + outputs_lowrez.borders +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.label_style = { size_enum: -1.5 } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.watch_list = [~ -- Inside source: true -*** True Line Result - args.state.watch_list = [ -** Processing line: ~ "args.state.tick_count is: #{args.state.tick_count}",~ +** Processing line: ~ def sprites~ - Inside source: true *** True Line Result - "args.state.tick_count is: #{args.state.tick_count}", -** Processing line: ~ "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}",~ + def sprites +** Processing line: ~ outputs_lowrez.sprites~ - Inside source: true *** True Line Result - "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}", -** Processing line: ~ "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}",~ + outputs_lowrez.sprites +** Processing line: ~ end~ - Inside source: true *** True Line Result - "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}", -** Processing line: ~ "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}", -** Processing line: ~ ]~ + +** Processing line: ~ def labels~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + def labels +** Processing line: ~ outputs_lowrez.labels~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.debug << args.state~ + outputs_lowrez.labels +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.debug << args.state -** Processing line: ~ .watch_list~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - .watch_list -** Processing line: ~ .map_with_index do |text, i|~ + +** Processing line: ~ def default_label~ - Inside source: true *** True Line Result - .map_with_index do |text, i| + def default_label ** Processing line: ~ {~ - Inside source: true *** True Line Result { -** Processing line: ~ x: 5,~ +** Processing line: ~ x: 0,~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 720 - (i * 20),~ + x: 0, +** Processing line: ~ y: 63,~ - Inside source: true *** True Line Result - y: 720 - (i * 20), -** Processing line: ~ text: text,~ + y: 63, +** Processing line: ~ text: "",~ - Inside source: true *** True Line Result - text: text, -** Processing line: ~ size_enum: -1.5~ + text: "", +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ - Inside source: true *** True Line Result - size_enum: -1.5 -** Processing line: ~ }.label~ -- Inside source: true -*** True Line Result - }.label -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ args.outputs.debug << {~ + size_enum: LOWREZ_FONT_SM, +** Processing line: ~ alignment_enum: 0,~ - Inside source: true *** True Line Result - args.outputs.debug << { -** Processing line: ~ x: 640,~ + alignment_enum: 0, +** Processing line: ~ r: 0,~ - Inside source: true *** True Line Result - x: 640, -** Processing line: ~ y: 25,~ + r: 0, +** Processing line: ~ g: 0,~ - Inside source: true *** True Line Result - y: 25, -** Processing line: ~ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",~ + g: 0, +** Processing line: ~ b: 0,~ - Inside source: true *** True Line Result - text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.", -** Processing line: ~ size_enum: -0.5,~ + b: 0, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - size_enum: -0.5, -** Processing line: ~ alignment_enum: 1~ + a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH~ - Inside source: true *** True Line Result - alignment_enum: 1 -** Processing line: ~ }.label~ + font: LOWREZ_FONT_PATH +** Processing line: ~ }~ - Inside source: true *** True Line Result - }.label -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset~ +** Processing line: ~ def lines~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~~ + def lines +** Processing line: ~ outputs_lowrez.lines~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + outputs_lowrez.lines +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ # Hey there! Welcome to Four Decisions. Here is how you~ +** Processing line: ~ def primitives~ - Inside source: true *** True Line Result - # Hey there! Welcome to Four Decisions. Here is how you -** Processing line: ~ # create your decision tree. Remove =being and =end from the text to~ + def primitives +** Processing line: ~ outputs_lowrez.primitives~ - Inside source: true *** True Line Result - # create your decision tree. Remove =being and =end from the text to -** Processing line: ~ # enable the game (just save the file). Change stuff and see what happens!~ + outputs_lowrez.primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - # enable the game (just save the file). Change stuff and see what happens! + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def game~ -- Inside source: true -*** True Line Result - def game -** Processing line: ~ {~ +** Processing line: ~ def click~ - Inside source: true *** True Line Result - { -** Processing line: ~ starting_decision: :stormy_night,~ + def click +** Processing line: ~ return nil unless @args.inputs.mouse.click~ - Inside source: true *** True Line Result - starting_decision: :stormy_night, -** Processing line: ~ decisions: {~ + return nil unless @args.inputs.mouse.click +** Processing line: ~ mouse~ - Inside source: true *** True Line Result - decisions: { -** Processing line: ~ stormy_night: {~ + mouse +** Processing line: ~ end~ - Inside source: true *** True Line Result - stormy_night: { -** Processing line: ~ description: 'It was a dark and stormy night. (storyline located in decision.rb)',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - description: 'It was a dark and stormy night. (storyline located in decision.rb)', -** Processing line: ~ option_one: {~ + +** Processing line: ~ def mouse_click~ - Inside source: true *** True Line Result - option_one: { -** Processing line: ~ description: 'Go to sleep.',~ + def mouse_click +** Processing line: ~ click~ - Inside source: true *** True Line Result - description: 'Go to sleep.', -** Processing line: ~ decision: :nap~ + click +** Processing line: ~ end~ - Inside source: true *** True Line Result - decision: :nap -** Processing line: ~ },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - }, -** Processing line: ~ option_two: {~ + +** Processing line: ~ def mouse_down~ - Inside source: true *** True Line Result - option_two: { -** Processing line: ~ description: 'Watch a movie.',~ + def mouse_down +** Processing line: ~ @args.inputs.mouse.down~ - Inside source: true *** True Line Result - description: 'Watch a movie.', -** Processing line: ~ decision: :movie~ + @args.inputs.mouse.down +** Processing line: ~ end~ - Inside source: true *** True Line Result - decision: :movie -** Processing line: ~ },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - }, -** Processing line: ~ option_three: {~ + +** Processing line: ~ def mouse_up~ - Inside source: true *** True Line Result - option_three: { -** Processing line: ~ description: 'Go outside.',~ + def mouse_up +** Processing line: ~ @args.inputs.mouse.up~ - Inside source: true *** True Line Result - description: 'Go outside.', -** Processing line: ~ decision: :go_outside~ + @args.inputs.mouse.up +** Processing line: ~ end~ - Inside source: true *** True Line Result - decision: :go_outside -** Processing line: ~ },~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - }, -** Processing line: ~ option_four: {~ + +** Processing line: ~ def mouse~ - Inside source: true *** True Line Result - option_four: { -** Processing line: ~ description: 'Get a snack.',~ + def mouse +** Processing line: ~ [~ - Inside source: true *** True Line Result - description: 'Get a snack.', -** Processing line: ~ decision: :get_a_snack~ + [ +** Processing line: ~ ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)),~ - Inside source: true *** True Line Result - decision: :get_a_snack -** Processing line: ~ }~ + ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)), +** Processing line: ~ ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM))~ - Inside source: true *** True Line Result - } -** Processing line: ~ },~ + ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM)) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - }, -** Processing line: ~ nap: {~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - nap: { -** Processing line: ~ description: 'You took a nap. The end.',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - description: 'You took a nap. The end.', -** Processing line: ~ option_one: {~ + +** Processing line: ~ def mouse_position~ - Inside source: true *** True Line Result - option_one: { -** Processing line: ~ description: 'Start over.',~ + def mouse_position +** Processing line: ~ mouse~ - Inside source: true *** True Line Result - description: 'Start over.', -** Processing line: ~ decision: :stormy_night~ + mouse +** Processing line: ~ end~ - Inside source: true *** True Line Result - decision: :stormy_night -** Processing line: ~ }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ }~ + +** Processing line: ~ def keyboard~ - Inside source: true *** True Line Result - } -** Processing line: ~ }~ + def keyboard +** Processing line: ~ @args.inputs.keyboard~ - Inside source: true *** True Line Result - } -** Processing line: ~ }~ + @args.inputs.keyboard +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -49925,670 +50260,698 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb~ -- Header detected. +** Processing line: ~ class GTK::Args~ +- Inside source: true *** True Line Result - + class GTK::Args +** Processing line: ~ def init_lowrez~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + def init_lowrez +** Processing line: ~ return if @lowrez~ +- Inside source: true *** True Line Result - + return if @lowrez +** Processing line: ~ @lowrez = LowrezOutputs.new self~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + @lowrez = LowrezOutputs.new self +** Processing line: ~ end~ - Inside source: true *** True Line Result - =begin + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Reminders:~ +** Processing line: ~ def lowrez~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~~ + def lowrez +** Processing line: ~ @lowrez~ - Inside source: true *** True Line Result - -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The values can be found~ + @lowrez +** Processing line: ~ end~ - Inside source: true *** True Line Result - - Hashes: Collection of unique keys and their corresponding values. The values can be found -** Processing line: ~ using their keys.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - using their keys. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ In this sample app, the decisions needed for the game are stored in a hash. In fact, the~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - In this sample app, the decisions needed for the game are stored in a hash. In fact, the -** Processing line: ~ decision.rb file contains hashes inside of other hashes!~ + module GTK +** Processing line: ~ class Runtime~ - Inside source: true *** True Line Result - decision.rb file contains hashes inside of other hashes! + class Runtime +** Processing line: ~ alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__)~ +- Inside source: true +*** True Line Result + alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Each option is a key in the first hash, but also contains a hash (description and~ +** Processing line: ~ def tick_core~ - Inside source: true *** True Line Result - Each option is a key in the first hash, but also contains a hash (description and -** Processing line: ~ decision being its keys) as its value.~ + def tick_core +** Processing line: ~ @args.init_lowrez~ - Inside source: true *** True Line Result - decision being its keys) as its value. -** Processing line: ~ Go into the decision.rb file and take a look before diving into the code below.~ + @args.init_lowrez +** Processing line: ~ __original_tick_core__~ - Inside source: true *** True Line Result - Go into the decision.rb file and take a look before diving into the code below. + __original_tick_core__ ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -- Inside source: true -*** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -- Inside source: true -*** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ return if @args.state.tick_count <= 0~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. + return if @args.state.tick_count <= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.~ +** Processing line: ~ @args.render_target(:lowrez)~ - Inside source: true *** True Line Result - - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ + @args.render_target(:lowrez) +** Processing line: ~ .labels~ - Inside source: true *** True Line Result - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. -** Processing line: ~~ + .labels +** Processing line: ~ .each do |l|~ - Inside source: true *** True Line Result - -** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ + .each do |l| +** Processing line: ~ l.y += 1~ - Inside source: true *** True Line Result - - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ + l.y += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - as Ruby code, and the placeholder is replaced with its corresponding value or result. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ +** Processing line: ~ @args.render_target(:lowrez)~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + @args.render_target(:lowrez) +** Processing line: ~ .lines~ - Inside source: true *** True Line Result - -** Processing line: ~ # This sample app provides users with a story and multiple decisions that they can choose to make.~ + .lines +** Processing line: ~ .each do |l|~ - Inside source: true *** True Line Result - # This sample app provides users with a story and multiple decisions that they can choose to make. -** Processing line: ~ # Users can make a decision using their keyboard, and the story will move forward based on user choices.~ + .each do |l| +** Processing line: ~ l.y += 1~ - Inside source: true *** True Line Result - # Users can make a decision using their keyboard, and the story will move forward based on user choices. -** Processing line: ~~ + l.y += 1 +** Processing line: ~ l.y2 += 1~ - Inside source: true *** True Line Result - -** Processing line: ~ # The decisions available to users are stored in the decision.rb file.~ + l.y2 += 1 +** Processing line: ~ l.y2 += 1 if l.y1 != l.y2~ - Inside source: true *** True Line Result - # The decisions available to users are stored in the decision.rb file. -** Processing line: ~ # We must have access to it for the game to function properly.~ + l.y2 += 1 if l.y1 != l.y2 +** Processing line: ~ l.x2 += 1 if l.x1 != l.x2~ - Inside source: true *** True Line Result - # We must have access to it for the game to function properly. -** Processing line: ~ GAME_FILE = 'app/decision.rb' # found in app folder~ + l.x2 += 1 if l.x1 != l.x2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - GAME_FILE = 'app/decision.rb' # found in app folder + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ require GAME_FILE # require used to load another file, import class/method definitions~ +** Processing line: ~ @args.outputs~ - Inside source: true *** True Line Result - require GAME_FILE # require used to load another file, import class/method definitions -** Processing line: ~~ + @args.outputs +** Processing line: ~ .sprites << { x: 320,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.~ + .sprites << { x: 320, +** Processing line: ~ y: 40,~ - Inside source: true *** True Line Result - # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. -** Processing line: ~ # Otherwise, the game is run.~ + y: 40, +** Processing line: ~ w: 640,~ - Inside source: true *** True Line Result - # Otherwise, the game is run. -** Processing line: ~ def tick args~ + w: 640, +** Processing line: ~ h: 640,~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method~ + h: 640, +** Processing line: ~ source_x: 0,~ - Inside source: true *** True Line Result - if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method -** Processing line: ~ args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown~ + source_x: 0, +** Processing line: ~ source_y: 0,~ - Inside source: true *** True Line Result - args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown -** Processing line: ~ args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]~ + source_y: 0, +** Processing line: ~ source_w: 64,~ - Inside source: true *** True Line Result - args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] -** Processing line: ~ elsif respond_to?(:game) # otherwise, if responds to game~ + source_w: 64, +** Processing line: ~ source_h: 64,~ - Inside source: true *** True Line Result - elsif respond_to?(:game) # otherwise, if responds to game -** Processing line: ~ args.state.loaded = true~ + source_h: 64, +** Processing line: ~ path: :lowrez }~ - Inside source: true *** True Line Result - args.state.loaded = true -** Processing line: ~ tick_game args # calls tick_game method, runs game~ + path: :lowrez } +** Processing line: ~ end~ - Inside source: true *** True Line Result - tick_game args # calls tick_game method, runs game + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.tick_count.mod_zero? 60 # update every 60 frames~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if args.state.tick_count.mod_zero? 60 # update every 60 frames -** Processing line: ~ t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file -** Processing line: ~ if t != args.state.mtime~ -- Inside source: true + +** Processing line: ~* Lowrez - Resolution 64x64 - main.rb~ +- Header detected. *** True Line Result - if t != args.state.mtime -** Processing line: ~ args.state.mtime = t~ -- Inside source: true + *** True Line Result - args.state.mtime = t -** Processing line: ~ require GAME_FILE # require used to load file~ +* Lowrez - Resolution 64x64 - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_lowrez/resolution_64x64/app/main.rb~ - Inside source: true *** True Line Result - require GAME_FILE # require used to load file -** Processing line: ~ args.state.game_definition = nil # game definition and decision are empty~ + # ./samples/99_genre_lowrez/resolution_64x64/app/main.rb +** Processing line: ~ require 'app/lowrez.rb'~ - Inside source: true *** True Line Result - args.state.game_definition = nil # game definition and decision are empty -** Processing line: ~ args.state.decision_id = nil~ + require 'app/lowrez.rb' +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.decision_id = nil -** Processing line: ~ end~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def tick args +** Processing line: ~ # How to set the background color~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # How to set the background color +** Processing line: ~ args.lowrez.background_color = [255, 255, 255]~ - Inside source: true *** True Line Result - end + args.lowrez.background_color = [255, 255, 255] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs methods needed for game to function properly~ +** Processing line: ~ # ==== HELLO WORLD ======================================================~ - Inside source: true *** True Line Result - # Runs methods needed for game to function properly -** Processing line: ~ # Creates a rectangular border around the screen~ + # ==== HELLO WORLD ====================================================== +** Processing line: ~ # Steps to get started:~ - Inside source: true *** True Line Result - # Creates a rectangular border around the screen -** Processing line: ~ def tick_game args~ + # Steps to get started: +** Processing line: ~ # 1. ~def tick args~ is the entry point for your game.~ - Inside source: true *** True Line Result - def tick_game args -** Processing line: ~ defaults args~ + # 1. ~def tick args~ is the entry point for your game. +** Processing line: ~ # 2. There are quite a few code samples below, remove the "##"~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ args.borders << args.grid.rect~ + # 2. There are quite a few code samples below, remove the "##" +** Processing line: ~ # before each line and save the file to see the changes.~ - Inside source: true *** True Line Result - args.borders << args.grid.rect -** Processing line: ~ render_decision args~ + # before each line and save the file to see the changes. +** Processing line: ~ # 3. 0, 0 is in bottom left and 63, 63 is in top right corner.~ - Inside source: true *** True Line Result - render_decision args -** Processing line: ~ process_inputs args~ + # 3. 0, 0 is in bottom left and 63, 63 is in top right corner. +** Processing line: ~ # 4. Be sure to come to the discord channel if you need~ - Inside source: true *** True Line Result - process_inputs args -** Processing line: ~ end~ + # 4. Be sure to come to the discord channel if you need +** Processing line: ~ # more help: [[http://discord.dragonruby.org]].~ - Inside source: true *** True Line Result - end + # more help: [[http://discord.dragonruby.org]]. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values and uses decision.rb file to define game and decision_id~ +** Processing line: ~ # Commenting and uncommenting code:~ - Inside source: true *** True Line Result - # Sets default values and uses decision.rb file to define game and decision_id -** Processing line: ~ # variable using the starting decision~ + # Commenting and uncommenting code: +** Processing line: ~ # - Add a "#" infront of lines to comment out code~ - Inside source: true *** True Line Result - # variable using the starting decision -** Processing line: ~ def defaults args~ + # - Add a "#" infront of lines to comment out code +** Processing line: ~ # - Remove the "#" infront of lines to comment out code~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ args.state.game_definition ||= game~ + # - Remove the "#" infront of lines to comment out code +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.game_definition ||= game -** Processing line: ~ args.state.decision_id ||= args.state.game_definition[:starting_decision]~ + +** Processing line: ~ # Invoke the hello_world subroutine/method~ - Inside source: true *** True Line Result - args.state.decision_id ||= args.state.game_definition[:starting_decision] -** Processing line: ~ end~ + # Invoke the hello_world subroutine/method +** Processing line: ~ hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method.~ - Inside source: true *** True Line Result - end + hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method. +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs the possible decision descriptions the user can choose onto the screen~ +** Processing line: ~~ - Inside source: true *** True Line Result - # Outputs the possible decision descriptions the user can choose onto the screen -** Processing line: ~ # as well as what key to press on their keyboard to make their decision~ + +** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ - Inside source: true *** True Line Result - # as well as what key to press on their keyboard to make their decision -** Processing line: ~ def render_decision args~ + # ==== HOW TO RENDER A LABEL ============================================ +** Processing line: ~ # Uncomment the line below to invoke the how_to_render_a_label subroutine/method.~ - Inside source: true *** True Line Result - def render_decision args -** Processing line: ~ decision = current_decision args~ + # Uncomment the line below to invoke the how_to_render_a_label subroutine/method. +** Processing line: ~ # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~~ - Inside source: true *** True Line Result - decision = current_decision args -** Processing line: ~ # text is either the value of decision's description key or warning that no description exists~ + # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~ +** Processing line: ~ # Scroll down to the method to see the details.~ - Inside source: true *** True Line Result - # text is either the value of decision's description key or warning that no description exists -** Processing line: ~ args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation~ + # Scroll down to the method to see the details. +** Processing line: ~~ - Inside source: true *** True Line Result - args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation + +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +- Inside source: true +*** True Line Result + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method~ +- Inside source: true +*** True Line Result + # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # All decisions are stored in a hash~ +** Processing line: ~~ - Inside source: true *** True Line Result - # All decisions are stored in a hash -** Processing line: ~ # The descriptions output onto the screen are the values for the description keys of the hash.~ + +** Processing line: ~ # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================~ - Inside source: true *** True Line Result - # The descriptions output onto the screen are the values for the description keys of the hash. -** Processing line: ~ if decision[:option_one]~ + # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - if decision[:option_one] -** Processing line: ~ args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_render_solids args~ - Inside source: true *** True Line Result - args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label -** Processing line: ~ args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision~ + # how_to_render_solids args +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision -** Processing line: ~ end~ + # ======================================================================= +** Processing line: ~~ - Inside source: true *** True Line Result - end + ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if decision[:option_two]~ +** Processing line: ~ # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ========================~ - Inside source: true *** True Line Result - if decision[:option_two] -** Processing line: ~ args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description~ + # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ======================== +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description -** Processing line: ~ args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_render_borders args~ - Inside source: true *** True Line Result - args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] -** Processing line: ~ end~ + # how_to_render_borders args +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - end + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if decision[:option_three]~ +** Processing line: ~~ - Inside source: true *** True Line Result - if decision[:option_three] -** Processing line: ~ args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description~ + +** Processing line: ~ # ==== HOW TO RENDER A LINE =============================================~ - Inside source: true *** True Line Result - args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description -** Processing line: ~ args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]~ + # ==== HOW TO RENDER A LINE ============================================= +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] -** Processing line: ~ end~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_render_lines args~ - Inside source: true *** True Line Result - end + # how_to_render_lines args +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if decision[:option_four]~ +** Processing line: ~~ - Inside source: true *** True Line Result - if decision[:option_four] -** Processing line: ~ args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description~ + +** Processing line: ~ # == HOW TO RENDER A SPRITE =============================================~ - Inside source: true *** True Line Result - args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description -** Processing line: ~ args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]~ + # == HOW TO RENDER A SPRITE ============================================= +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] -** Processing line: ~ end~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_render_sprites args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # how_to_render_sprites args +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - end + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Uses keyboard input from the user to make a decision~ +** Processing line: ~~ - Inside source: true *** True Line Result - # Uses keyboard input from the user to make a decision -** Processing line: ~ # Assigns the decision as the value of the decision_id variable~ + +** Processing line: ~ # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT =====================~ - Inside source: true *** True Line Result - # Assigns the decision as the value of the decision_id variable -** Processing line: ~ def process_inputs args~ + # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT ===================== +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - def process_inputs args -** Processing line: ~ decision = current_decision args # calls current_decision method~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_move_a_sprite args~ - Inside source: true *** True Line Result - decision = current_decision args # calls current_decision method -** Processing line: ~~ + # how_to_move_a_sprite args +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists~ + # ======================================================================= +** Processing line: ~~ - Inside source: true *** True Line Result - if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists -** Processing line: ~ args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id~ + +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id -** Processing line: ~ end~ + +** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_animate_a_sprite args~ - Inside source: true *** True Line Result - if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists -** Processing line: ~ args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id~ + # how_to_animate_a_sprite args +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id -** Processing line: ~ end~ + # ======================================================================= +** Processing line: ~~ - Inside source: true *** True Line Result - end + ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists~ +** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ===========================~ - Inside source: true *** True Line Result - if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists -** Processing line: ~ args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id~ + # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =========================== +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id -** Processing line: ~ end~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_animate_a_sprite_sheet args~ - Inside source: true *** True Line Result - end + # how_to_animate_a_sprite_sheet args +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists~ +** Processing line: ~~ - Inside source: true *** True Line Result - if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists -** Processing line: ~ args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id~ + +** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =============================================~ - Inside source: true *** True Line Result - args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id -** Processing line: ~ end~ + # ==== HOW TO DETERMINE COLLISION ============================================= +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_determine_collision args~ - Inside source: true *** True Line Result - end + # how_to_determine_collision args +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Uses decision_id's value to keep track of current decision being made~ +** Processing line: ~~ - Inside source: true *** True Line Result - # Uses decision_id's value to keep track of current decision being made -** Processing line: ~ def current_decision args~ + +** Processing line: ~ # ==== HOW TO CREATE BUTTONS ==================================================~ - Inside source: true *** True Line Result - def current_decision args -** Processing line: ~ args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty~ + # ==== HOW TO CREATE BUTTONS ================================================== +** Processing line: ~ # Remove the "#" at the beginning of the line below~ - Inside source: true *** True Line Result - args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty -** Processing line: ~ end~ + # Remove the "#" at the beginning of the line below +** Processing line: ~ # how_to_create_buttons args~ - Inside source: true *** True Line Result - end + # how_to_create_buttons args +** Processing line: ~ # =======================================================================~ +- Inside source: true +*** True Line Result + # ======================================================================= ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Resets the game.~ +** Processing line: ~~ - Inside source: true *** True Line Result - # Resets the game. -** Processing line: ~ $gtk.reset~ + +** Processing line: ~ # ==== The line below renders a debug grid, mouse information, and current tick~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~~ + # ==== The line below renders a debug grid, mouse information, and current tick +** Processing line: ~ render_debug args~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + render_debug args +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. +- Inside source: true *** True Line Result -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb~ -- Header detected. +** Processing line: ~ def hello_world args~ +- Inside source: true *** True Line Result - + def hello_world args +** Processing line: ~ args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 }~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 } +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ args.lowrez.labels << {~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ ###################################################################################~ + args.lowrez.labels << { +** Processing line: ~ x: 32,~ - Inside source: true *** True Line Result - ################################################################################### -** Processing line: ~ # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES~ + x: 32, +** Processing line: ~ y: 63,~ - Inside source: true *** True Line Result - # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES -** Processing line: ~ # THE 64x64 CANVAS.~ + y: 63, +** Processing line: ~ text: "lowrezjam 2020",~ - Inside source: true *** True Line Result - # THE 64x64 CANVAS. -** Processing line: ~ ###################################################################################~ + text: "lowrezjam 2020", +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ - Inside source: true *** True Line Result - ################################################################################### -** Processing line: ~~ + size_enum: LOWREZ_FONT_SM, +** Processing line: ~ alignment_enum: 1,~ - Inside source: true *** True Line Result - -** Processing line: ~ TINY_RESOLUTION = 64~ + alignment_enum: 1, +** Processing line: ~ r: 0,~ - Inside source: true *** True Line Result - TINY_RESOLUTION = 64 -** Processing line: ~ TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5)~ + r: 0, +** Processing line: ~ g: 0,~ - Inside source: true *** True Line Result - TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) -** Processing line: ~ CENTER_OFFSET = 10~ + g: 0, +** Processing line: ~ b: 0,~ - Inside source: true *** True Line Result - CENTER_OFFSET = 10 -** Processing line: ~ EMULATED_FONT_SIZE = 20~ + b: 0, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - EMULATED_FONT_SIZE = 20 -** Processing line: ~ EMULATED_FONT_X_ZERO = 0~ + a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH~ - Inside source: true *** True Line Result - EMULATED_FONT_X_ZERO = 0 -** Processing line: ~ EMULATED_FONT_Y_ZERO = 46~ + font: LOWREZ_FONT_PATH +** Processing line: ~ }~ - Inside source: true *** True Line Result - EMULATED_FONT_Y_ZERO = 46 + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ sprites = []~ -- Inside source: true -*** True Line Result - sprites = [] -** Processing line: ~ labels = []~ +** Processing line: ~ args.lowrez.sprites << {~ - Inside source: true *** True Line Result - labels = [] -** Processing line: ~ borders = []~ + args.lowrez.sprites << { +** Processing line: ~ x: 32 - 10,~ - Inside source: true *** True Line Result - borders = [] -** Processing line: ~ solids = []~ + x: 32 - 10, +** Processing line: ~ y: 32 - 10,~ - Inside source: true *** True Line Result - solids = [] -** Processing line: ~ mouse = emulate_lowrez_mouse args~ + y: 32 - 10, +** Processing line: ~ w: 20,~ - Inside source: true *** True Line Result - mouse = emulate_lowrez_mouse args -** Processing line: ~ args.state.show_gridlines = false~ + w: 20, +** Processing line: ~ h: 20,~ - Inside source: true *** True Line Result - args.state.show_gridlines = false -** Processing line: ~ lowrez_tick args, sprites, labels, borders, solids, mouse~ + h: 20, +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ - Inside source: true *** True Line Result - lowrez_tick args, sprites, labels, borders, solids, mouse -** Processing line: ~ render_gridlines_if_needed args~ + path: 'sprites/lowrez-ship-blue.png', +** Processing line: ~ a: args.state.tick_count % 255,~ - Inside source: true *** True Line Result - render_gridlines_if_needed args -** Processing line: ~ render_mouse_crosshairs args, mouse~ + a: args.state.tick_count % 255, +** Processing line: ~ angle: args.state.tick_count % 360~ - Inside source: true *** True Line Result - render_mouse_crosshairs args, mouse -** Processing line: ~ emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ + angle: args.state.tick_count % 360 +** Processing line: ~ }~ - Inside source: true *** True Line Result - emulate_lowrez_scene args, sprites, labels, borders, solids, mouse + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -50597,190 +50960,190 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def emulate_lowrez_mouse args~ -- Inside source: true -*** True Line Result - def emulate_lowrez_mouse args -** Processing line: ~ args.state.new_entity_strict(:lowrez_mouse) do |m|~ -- Inside source: true -*** True Line Result - args.state.new_entity_strict(:lowrez_mouse) do |m| -** Processing line: ~ m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1~ +** Processing line: ~~ - Inside source: true *** True Line Result - m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1 -** Processing line: ~ m.y = args.mouse.y.idiv(TINY_SCALE)~ + +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - m.y = args.mouse.y.idiv(TINY_SCALE) -** Processing line: ~ if args.mouse.click~ + # ======================================================================= +** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ - Inside source: true *** True Line Result - if args.mouse.click -** Processing line: ~ m.click = [~ + # ==== HOW TO RENDER A LABEL ============================================ +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - m.click = [ -** Processing line: ~ args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ + # ======================================================================= +** Processing line: ~ def how_to_render_a_label args~ - Inside source: true *** True Line Result - args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, -** Processing line: ~ args.mouse.click.point.y.idiv(TINY_SCALE)~ + def how_to_render_a_label args +** Processing line: ~ # NOTE: Text is aligned from the TOP LEFT corner~ - Inside source: true *** True Line Result - args.mouse.click.point.y.idiv(TINY_SCALE) -** Processing line: ~ ]~ + # NOTE: Text is aligned from the TOP LEFT corner +** Processing line: ~~ - Inside source: true *** True Line Result - ] -** Processing line: ~ m.down = m.click~ + +** Processing line: ~ # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below)~ - Inside source: true *** True Line Result - m.down = m.click -** Processing line: ~ else~ + # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below) +** Processing line: ~ args.lowrez.labels << { x: 0, y: 57, text: "Hello World",~ - Inside source: true *** True Line Result - else -** Processing line: ~ m.click = nil~ + args.lowrez.labels << { x: 0, y: 57, text: "Hello World", +** Processing line: ~ size_enum: LOWREZ_FONT_XL,~ - Inside source: true *** True Line Result - m.click = nil -** Processing line: ~ m.down = nil~ + size_enum: LOWREZ_FONT_XL, +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ - Inside source: true *** True Line Result - m.down = nil -** Processing line: ~ end~ + r: 0, g: 0, b: 0, a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH }~ - Inside source: true *** True Line Result - end + font: LOWREZ_FONT_PATH } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.mouse.up~ +** Processing line: ~ # Render a LARGE/LG label (remove the "#" in front of each line below)~ - Inside source: true *** True Line Result - if args.mouse.up -** Processing line: ~ m.up = [~ + # Render a LARGE/LG label (remove the "#" in front of each line below) +** Processing line: ~ args.lowrez.labels << { x: 0, y: 36, text: "Hello World",~ - Inside source: true *** True Line Result - m.up = [ -** Processing line: ~ args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ + args.lowrez.labels << { x: 0, y: 36, text: "Hello World", +** Processing line: ~ size_enum: LOWREZ_FONT_LG,~ - Inside source: true *** True Line Result - args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, -** Processing line: ~ args.mouse.up.point.y.idiv(TINY_SCALE)~ + size_enum: LOWREZ_FONT_LG, +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ - Inside source: true *** True Line Result - args.mouse.up.point.y.idiv(TINY_SCALE) -** Processing line: ~ ]~ + r: 0, g: 0, b: 0, a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH }~ - Inside source: true *** True Line Result - ] -** Processing line: ~ else~ + font: LOWREZ_FONT_PATH } +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ m.up = nil~ + +** Processing line: ~ # Render a MEDIUM/MD label (remove the "#" in front of each line below)~ - Inside source: true *** True Line Result - m.up = nil -** Processing line: ~ end~ + # Render a MEDIUM/MD label (remove the "#" in front of each line below) +** Processing line: ~ args.lowrez.labels << { x: 0, y: 20, text: "Hello World",~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.lowrez.labels << { x: 0, y: 20, text: "Hello World", +** Processing line: ~ size_enum: LOWREZ_FONT_MD,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + size_enum: LOWREZ_FONT_MD, +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ - Inside source: true *** True Line Result - end + r: 0, g: 0, b: 0, a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +- Inside source: true +*** True Line Result + font: LOWREZ_FONT_PATH } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_mouse_crosshairs args, mouse~ +** Processing line: ~ # Render a SMALL/SM label (remove the "#" in front of each line below)~ - Inside source: true *** True Line Result - def render_mouse_crosshairs args, mouse -** Processing line: ~ return unless args.state.show_gridlines~ + # Render a SMALL/SM label (remove the "#" in front of each line below) +** Processing line: ~ args.lowrez.labels << { x: 0, y: 9, text: "Hello World",~ - Inside source: true *** True Line Result - return unless args.state.show_gridlines -** Processing line: ~ args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]~ + args.lowrez.labels << { x: 0, y: 9, text: "Hello World", +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ - Inside source: true *** True Line Result - args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] -** Processing line: ~ end~ + size_enum: LOWREZ_FONT_SM, +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ - Inside source: true *** True Line Result - end + r: 0, g: 0, b: 0, a: 255, +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +- Inside source: true +*** True Line Result + font: LOWREZ_FONT_PATH } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ +** Processing line: ~ # You are provided args.lowrez.default_label which returns a Hash that you~ - Inside source: true *** True Line Result - def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse -** Processing line: ~ args.render_target(:lowrez).solids << [0, 0, 1280, 720]~ + # You are provided args.lowrez.default_label which returns a Hash that you +** Processing line: ~ # can ~merge~ properties with~ - Inside source: true *** True Line Result - args.render_target(:lowrez).solids << [0, 0, 1280, 720] -** Processing line: ~ args.render_target(:lowrez).sprites << sprites~ + # can ~merge~ properties with +** Processing line: ~ # Example 1~ - Inside source: true *** True Line Result - args.render_target(:lowrez).sprites << sprites -** Processing line: ~ args.render_target(:lowrez).borders << borders~ + # Example 1 +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - args.render_target(:lowrez).borders << borders -** Processing line: ~ args.render_target(:lowrez).solids << solids~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - args.render_target(:lowrez).solids << solids -** Processing line: ~ args.outputs.primitives << labels.map do |l|~ + .default_label +** Processing line: ~ .merge(text: "Default")~ - Inside source: true *** True Line Result - args.outputs.primitives << labels.map do |l| -** Processing line: ~ as_label = l.label~ + .merge(text: "Default") +** Processing line: ~~ - Inside source: true *** True Line Result - as_label = l.label -** Processing line: ~ l.text.each_char.each_with_index.map do |char, i|~ + +** Processing line: ~ # Example 2~ - Inside source: true *** True Line Result - l.text.each_char.each_with_index.map do |char, i| -** Processing line: ~ [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,~ + # Example 2 +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE, -** Processing line: ~ EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char, -** Processing line: ~ EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label~ + .default_label +** Processing line: ~ .merge(x: 31,~ - Inside source: true *** True Line Result - EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label -** Processing line: ~ end~ + .merge(x: 31, +** Processing line: ~ text: "Default",~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + text: "Default", +** Processing line: ~ r: 128,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + r: 128, +** Processing line: ~ g: 128,~ - Inside source: true *** True Line Result - -** Processing line: ~ args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]~ + g: 128, +** Processing line: ~ b: 128)~ - Inside source: true *** True Line Result - args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] + b: 128) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -50789,74 +51152,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_gridlines_if_needed args~ -- Inside source: true -*** True Line Result - def render_gridlines_if_needed args -** Processing line: ~ if args.state.show_gridlines && args.static_lines.length == 0~ -- Inside source: true -*** True Line Result - if args.state.show_gridlines && args.static_lines.length == 0 -** Processing line: ~ args.static_lines << 65.times.map do |i|~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - args.static_lines << 65.times.map do |i| -** Processing line: ~ [~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ==================================~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE + 1, 0,~ + ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ================================== +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - [CENTER_OFFSET + i * TINY_SCALE + 1, 0, -** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],~ + ## # ============================================================================= +** Processing line: ~ def how_to_render_solids args~ - Inside source: true *** True Line Result - CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], -** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE, 0,~ + def how_to_render_solids args +** Processing line: ~ # Render a red square at 0, 0 with a width and height of 1~ - Inside source: true *** True Line Result - [CENTER_OFFSET + i * TINY_SCALE, 0, -** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],~ + # Render a red square at 0, 0 with a width and height of 1 +** Processing line: ~ args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 }~ - Inside source: true *** True Line Result - CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], -** Processing line: ~ [CENTER_OFFSET, 0 + i * TINY_SCALE,~ + args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 } +** Processing line: ~~ - Inside source: true *** True Line Result - [CENTER_OFFSET, 0 + i * TINY_SCALE, -** Processing line: ~ CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],~ + +** Processing line: ~ # Render a red square at 1, 1 with a width and height of 2~ - Inside source: true *** True Line Result - CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], -** Processing line: ~ [CENTER_OFFSET, 1 + i * TINY_SCALE,~ + # Render a red square at 1, 1 with a width and height of 2 +** Processing line: ~ args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 }~ - Inside source: true *** True Line Result - [CENTER_OFFSET, 1 + i * TINY_SCALE, -** Processing line: ~ CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]~ + args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 } +** Processing line: ~~ - Inside source: true *** True Line Result - CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] -** Processing line: ~ ]~ + +** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + # Render a red square at 3, 3 with a width and height of 3 +** Processing line: ~ args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 }~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif !args.state.show_gridlines~ + args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 } +** Processing line: ~~ - Inside source: true *** True Line Result - elsif !args.state.show_gridlines -** Processing line: ~ args.static_lines.clear~ + +** Processing line: ~ # Render a red square at 6, 6 with a width and height of 4~ - Inside source: true *** True Line Result - args.static_lines.clear -** Processing line: ~ end~ + # Render a red square at 6, 6 with a width and height of 4 +** Processing line: ~ args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 }~ - Inside source: true *** True Line Result - end + args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -50865,214 +51220,230 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ ## # =============================================================================~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) ===============================~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/main.rb~ -- Header detected. + ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) =============================== +** Processing line: ~ ## # =============================================================================~ +- Inside source: true *** True Line Result - + ## # ============================================================================= +** Processing line: ~ def how_to_render_borders args~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + def how_to_render_borders args +** Processing line: ~ # Render a red square at 0, 0 with a width and height of 3~ +- Inside source: true +*** True Line Result + # Render a red square at 0, 0 with a width and height of 3 +** Processing line: ~ args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 }~ +- Inside source: true +*** True Line Result + args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 } +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ require 'app/require.rb'~ + # Render a red square at 3, 3 with a width and height of 3 +** Processing line: ~ args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 }~ - Inside source: true *** True Line Result - require 'app/require.rb' + args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults args~ +** Processing line: ~ # Render a red square at 5, 5 with a width and height of 4~ - Inside source: true *** True Line Result - def defaults args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + # Render a red square at 5, 5 with a width and height of 4 +** Processing line: ~ args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 }~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ args.state.last_story_line_text ||= ""~ + args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.last_story_line_text ||= "" -** Processing line: ~ args.state.scene_history ||= []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.scene_history ||= [] -** Processing line: ~ args.state.storyline_history ||= []~ + +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - args.state.storyline_history ||= [] -** Processing line: ~ args.state.word_delay ||= 8~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO RENDER A LINE ===================================================~ - Inside source: true *** True Line Result - args.state.word_delay ||= 8 -** Processing line: ~ if args.state.tick_count == 0~ + ## # ==== HOW TO RENDER A LINE =================================================== +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - if args.state.tick_count == 0 -** Processing line: ~ args.gtk.stop_music~ + ## # ============================================================================= +** Processing line: ~ def how_to_render_lines args~ - Inside source: true *** True Line Result - args.gtk.stop_music -** Processing line: ~ args.outputs.sounds << 'sounds/static-loop.ogg'~ + def how_to_render_lines args +** Processing line: ~ # Render a horizontal line at the bottom~ - Inside source: true *** True Line Result - args.outputs.sounds << 'sounds/static-loop.ogg' -** Processing line: ~ end~ + # Render a horizontal line at the bottom +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 }~ - Inside source: true *** True Line Result - end + args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at~ +** Processing line: ~ # Render a vertical line at the left~ - Inside source: true *** True Line Result - if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at -** Processing line: ~ lines = args.state~ + # Render a vertical line at the left +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 }~ - Inside source: true *** True Line Result - lines = args.state -** Processing line: ~ .storyline_history[-1]~ + args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 } +** Processing line: ~~ - Inside source: true *** True Line Result - .storyline_history[-1] -** Processing line: ~ .gsub("-", "")~ + +** Processing line: ~ # Render a diagonal line starting from the bottom left and going to the top right~ - Inside source: true *** True Line Result - .gsub("-", "") -** Processing line: ~ .gsub("~", "")~ + # Render a diagonal line starting from the bottom left and going to the top right +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 }~ - Inside source: true *** True Line Result - .gsub("~", "") -** Processing line: ~ .wrapped_lines(55)~ + args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - .wrapped_lines(55) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0)~ -- Inside source: true -*** True Line Result - args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0) -** Processing line: ~ elsif !args.state.is_storyline_dialog_active~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - elsif !args.state.is_storyline_dialog_active -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50))~ + ## # ============================================================================= +** Processing line: ~ ## # == HOW TO RENDER A SPRITE ===================================================~ - Inside source: true *** True Line Result - args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50)) -** Processing line: ~ end~ + ## # == HOW TO RENDER A SPRITE =================================================== +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ## # ============================================================================= +** Processing line: ~ def how_to_render_sprites args~ - Inside source: true *** True Line Result - -** Processing line: ~ return if args.state.current_scene~ + def how_to_render_sprites args +** Processing line: ~ # Loop 10 times and create 10 sprites in 10 positions~ - Inside source: true *** True Line Result - return if args.state.current_scene -** Processing line: ~ set_scene(args, day_one_beginning(args))~ + # Loop 10 times and create 10 sprites in 10 positions +** Processing line: ~ # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png'~ - Inside source: true *** True Line Result - set_scene(args, day_one_beginning(args)) -** Processing line: ~ end~ + # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png' +** Processing line: ~ 10.times do |i|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 10.times do |i| +** Processing line: ~ args.lowrez.sprites << {~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_move_player args~ + args.lowrez.sprites << { +** Processing line: ~ x: i * 5,~ - Inside source: true *** True Line Result - def inputs_move_player args -** Processing line: ~ if args.state.scene_changed_at.elapsed_time > 5~ + x: i * 5, +** Processing line: ~ y: i * 5,~ - Inside source: true *** True Line Result - if args.state.scene_changed_at.elapsed_time > 5 -** Processing line: ~ if args.keyboard.down || args.keyboard.s || args.keyboard.j~ + y: i * 5, +** Processing line: ~ w: 5,~ - Inside source: true *** True Line Result - if args.keyboard.down || args.keyboard.s || args.keyboard.j -** Processing line: ~ args.state.player.y -= 0.25~ + w: 5, +** Processing line: ~ h: 5,~ - Inside source: true *** True Line Result - args.state.player.y -= 0.25 -** Processing line: ~ elsif args.keyboard.up || args.keyboard.w || args.keyboard.k~ + h: 5, +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png'~ - Inside source: true *** True Line Result - elsif args.keyboard.up || args.keyboard.w || args.keyboard.k -** Processing line: ~ args.state.player.y += 0.25~ + path: 'sprites/lowrez-ship-blue.png' +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.player.y += 0.25 -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.keyboard.left || args.keyboard.a || args.keyboard.h~ +** Processing line: ~ # Given an array of positions create sprites~ - Inside source: true *** True Line Result - if args.keyboard.left || args.keyboard.a || args.keyboard.h -** Processing line: ~ args.state.player.x -= 0.25~ + # Given an array of positions create sprites +** Processing line: ~ positions = [~ - Inside source: true *** True Line Result - args.state.player.x -= 0.25 -** Processing line: ~ elsif args.keyboard.right || args.keyboard.d || args.keyboard.l~ + positions = [ +** Processing line: ~ { x: 10, y: 42 },~ - Inside source: true *** True Line Result - elsif args.keyboard.right || args.keyboard.d || args.keyboard.l -** Processing line: ~ args.state.player.x += 0.25~ + { x: 10, y: 42 }, +** Processing line: ~ { x: 15, y: 45 },~ - Inside source: true *** True Line Result - args.state.player.x += 0.25 -** Processing line: ~ end~ + { x: 15, y: 45 }, +** Processing line: ~ { x: 22, y: 33 },~ - Inside source: true *** True Line Result - end + { x: 22, y: 33 }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.state.player.y = 60 if args.state.player.y > 63~ +** Processing line: ~ positions.each do |position|~ - Inside source: true *** True Line Result - args.state.player.y = 60 if args.state.player.y > 63 -** Processing line: ~ args.state.player.y = 0 if args.state.player.y < -3~ + positions.each do |position| +** Processing line: ~ # use Ruby's ~Hash#merge~ function to create a sprite~ - Inside source: true *** True Line Result - args.state.player.y = 0 if args.state.player.y < -3 -** Processing line: ~ args.state.player.x = 60 if args.state.player.x > 63~ + # use Ruby's ~Hash#merge~ function to create a sprite +** Processing line: ~ args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png',~ - Inside source: true *** True Line Result - args.state.player.x = 60 if args.state.player.x > 63 -** Processing line: ~ args.state.player.x = 0 if args.state.player.x < -3~ + args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png', +** Processing line: ~ w: 5,~ - Inside source: true *** True Line Result - args.state.player.x = 0 if args.state.player.x < -3 + w: 5, +** Processing line: ~ h: 5)~ +- Inside source: true +*** True Line Result + h: 5) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -51085,158 +51456,166 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def null_or_empty? ary~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - def null_or_empty? ary -** Processing line: ~ return true unless ary~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ - Inside source: true *** True Line Result - return true unless ary -** Processing line: ~ return true if ary.length == 0~ + ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - return true if ary.length == 0 -** Processing line: ~ return false~ + ## # ============================================================================= +** Processing line: ~ def how_to_animate_a_sprite args~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + def how_to_animate_a_sprite args +** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ - Inside source: true *** True Line Result - end + # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds +** Processing line: ~ start_animation_on_tick = 180~ +- Inside source: true +*** True Line Result + start_animation_on_tick = 180 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_storyline_hotspot args~ +** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ - Inside source: true *** True Line Result - def calc_storyline_hotspot args -** Processing line: ~ hotspots = args.state.storylines.find_all do |hs|~ + # STEP 2: Get the frame_index given the start tick. +** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ - Inside source: true *** True Line Result - hotspots = args.state.storylines.find_all do |hs| -** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ + sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? +** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ - Inside source: true *** True Line Result - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) -** Processing line: ~ end~ + hold_for: 4, # how long to hold each sprite? +** Processing line: ~ repeat: true # should it repeat?~ - Inside source: true *** True Line Result - end + repeat: true # should it repeat? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot~ +** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ - Inside source: true *** True Line Result - if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot -** Processing line: ~ _, _, _, _, storyline = hotspots.first~ + # STEP 3: frame_index will return nil if the frame hasn't arrived yet +** Processing line: ~ if sprite_index~ - Inside source: true *** True Line Result - _, _, _, _, storyline = hotspots.first -** Processing line: ~ queue_storyline_text(args, storyline)~ + if sprite_index +** Processing line: ~ # if the sprite_index is populated, use it to determine the sprite path and render it~ - Inside source: true *** True Line Result - queue_storyline_text(args, storyline) -** Processing line: ~ args.state.inside_storyline_hotspot = true~ + # if the sprite_index is populated, use it to determine the sprite path and render it +** Processing line: ~ sprite_path = "sprites/explosion-#{sprite_index}.png"~ - Inside source: true *** True Line Result - args.state.inside_storyline_hotspot = true -** Processing line: ~ elsif null_or_empty?(hotspots)~ + sprite_path = "sprites/explosion-#{sprite_index}.png" +** Processing line: ~ args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path }~ - Inside source: true *** True Line Result - elsif null_or_empty?(hotspots) -** Processing line: ~ args.state.inside_storyline_hotspot = false~ + args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path } +** Processing line: ~ else~ - Inside source: true *** True Line Result - args.state.inside_storyline_hotspot = false -** Processing line: ~ end~ + else +** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # if the sprite_index is nil, render a countdown instead +** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ - Inside source: true *** True Line Result - end + countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_scenes args~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - def calc_scenes args -** Processing line: ~ hotspots = args.state.scenes.find_all do |hs|~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - hotspots = args.state.scenes.find_all do |hs| -** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) -** Processing line: ~ end~ + .merge(x: 32, +** Processing line: ~ y: 32,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + y: 32, +** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ - Inside source: true *** True Line Result - -** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot~ + text: "Count Down: #{countdown_in_seconds}", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot -** Processing line: ~ _, _, _, _, scene_method_or_hash = hotspots.first~ + alignment_enum: 1) +** Processing line: ~ end~ - Inside source: true *** True Line Result - _, _, _, _, scene_method_or_hash = hotspots.first -** Processing line: ~ if scene_method_or_hash.is_a? Symbol~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if scene_method_or_hash.is_a? Symbol -** Processing line: ~ set_scene(args, send(scene_method_or_hash, args))~ + +** Processing line: ~ # render the current tick and the resolved sprite index~ - Inside source: true *** True Line Result - set_scene(args, send(scene_method_or_hash, args)) -** Processing line: ~ args.state.last_hotspot_scene = scene_method_or_hash~ + # render the current tick and the resolved sprite index +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - args.state.last_hotspot_scene = scene_method_or_hash -** Processing line: ~ args.state.scene_history << scene_method_or_hash~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - args.state.scene_history << scene_method_or_hash -** Processing line: ~ else~ + .default_label +** Processing line: ~ .merge(x: 0,~ - Inside source: true *** True Line Result - else -** Processing line: ~ set_scene(args, scene_method_or_hash)~ + .merge(x: 0, +** Processing line: ~ y: 11,~ - Inside source: true *** True Line Result - set_scene(args, scene_method_or_hash) -** Processing line: ~ end~ + y: 11, +** Processing line: ~ text: "Tick: #{args.state.tick_count}")~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.inside_scene_hotspot = true~ + text: "Tick: #{args.state.tick_count}") +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - args.state.inside_scene_hotspot = true -** Processing line: ~ elsif null_or_empty?(hotspots)~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - elsif null_or_empty?(hotspots) -** Processing line: ~ args.state.inside_scene_hotspot = false~ + .default_label +** Processing line: ~ .merge(x: 0,~ - Inside source: true *** True Line Result - args.state.inside_scene_hotspot = false -** Processing line: ~ end~ + .merge(x: 0, +** Processing line: ~ y: 5,~ - Inside source: true *** True Line Result - end + y: 5, +** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +- Inside source: true +*** True Line Result + text: "sprite_index: #{sprite_index}") ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -51245,210 +51624,202 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def null_or_whitespace? word~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - def null_or_whitespace? word -** Processing line: ~ return true if !word~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =================================~ - Inside source: true *** True Line Result - return true if !word -** Processing line: ~ return true if word.strip.length == 0~ + ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ================================= +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - return true if word.strip.length == 0 -** Processing line: ~ return false~ + ## # ============================================================================= +** Processing line: ~ def how_to_animate_a_sprite_sheet args~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + def how_to_animate_a_sprite_sheet args +** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ - Inside source: true *** True Line Result - end + # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds +** Processing line: ~ start_animation_on_tick = 180~ +- Inside source: true +*** True Line Result + start_animation_on_tick = 180 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_storyline_presentation args~ +** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ - Inside source: true *** True Line Result - def calc_storyline_presentation args -** Processing line: ~ return unless args.state.tick_count > args.state.next_storyline~ + # STEP 2: Get the frame_index given the start tick. +** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ - Inside source: true *** True Line Result - return unless args.state.tick_count > args.state.next_storyline -** Processing line: ~ return unless args.state.scene_storyline_queue~ + sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? +** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ - Inside source: true *** True Line Result - return unless args.state.scene_storyline_queue -** Processing line: ~ next_storyline = args.state.scene_storyline_queue.shift~ + hold_for: 4, # how long to hold each sprite? +** Processing line: ~ repeat: true # should it repeat?~ - Inside source: true *** True Line Result - next_storyline = args.state.scene_storyline_queue.shift -** Processing line: ~ if null_or_whitespace? next_storyline~ + repeat: true # should it repeat? +** Processing line: ~~ - Inside source: true *** True Line Result - if null_or_whitespace? next_storyline -** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ + +** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ - Inside source: true *** True Line Result - args.state.storyline_queue_empty_at ||= args.state.tick_count -** Processing line: ~ args.state.is_storyline_dialog_active = false~ + # STEP 3: frame_index will return nil if the frame hasn't arrived yet +** Processing line: ~ if sprite_index~ - Inside source: true *** True Line Result - args.state.is_storyline_dialog_active = false -** Processing line: ~ return~ + if sprite_index +** Processing line: ~ # if the sprite_index is populated, use it to determine the source rectangle and render it~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + # if the sprite_index is populated, use it to determine the source rectangle and render it +** Processing line: ~ args.lowrez.sprites << {~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.storyline_to_show = next_storyline~ + args.lowrez.sprites << { +** Processing line: ~ x: 0,~ - Inside source: true *** True Line Result - args.state.storyline_to_show = next_storyline -** Processing line: ~ args.state.is_storyline_dialog_active = true~ + x: 0, +** Processing line: ~ y: 0,~ - Inside source: true *** True Line Result - args.state.is_storyline_dialog_active = true -** Processing line: ~ args.state.storyline_queue_empty_at = nil~ + y: 0, +** Processing line: ~ w: 64,~ - Inside source: true *** True Line Result - args.state.storyline_queue_empty_at = nil -** Processing line: ~ if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")~ + w: 64, +** Processing line: ~ h: 64,~ - Inside source: true *** True Line Result - if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") -** Processing line: ~ args.state.next_storyline += 60~ + h: 64, +** Processing line: ~ path: "sprites/explosion-sheet.png",~ - Inside source: true *** True Line Result - args.state.next_storyline += 60 -** Processing line: ~ elsif next_storyline.end_with?(",")~ + path: "sprites/explosion-sheet.png", +** Processing line: ~ source_x: 32 * sprite_index,~ - Inside source: true *** True Line Result - elsif next_storyline.end_with?(",") -** Processing line: ~ args.state.next_storyline += 50~ + source_x: 32 * sprite_index, +** Processing line: ~ source_y: 0,~ - Inside source: true *** True Line Result - args.state.next_storyline += 50 -** Processing line: ~ elsif next_storyline.end_with?(":")~ + source_y: 0, +** Processing line: ~ source_w: 32,~ - Inside source: true *** True Line Result - elsif next_storyline.end_with?(":") -** Processing line: ~ args.state.next_storyline += 60~ + source_w: 32, +** Processing line: ~ source_h: 32~ - Inside source: true *** True Line Result - args.state.next_storyline += 60 -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ default_word_delay = 13 + args.state.word_delay - 8~ -- Inside source: true -*** True Line Result - default_word_delay = 13 + args.state.word_delay - 8 -** Processing line: ~ if next_storyline.gsub("-", "").gsub("~", "").length <= 4~ -- Inside source: true -*** True Line Result - if next_storyline.gsub("-", "").gsub("~", "").length <= 4 -** Processing line: ~ default_word_delay = 11 + args.state.word_delay - 8~ + source_h: 32 +** Processing line: ~ }~ - Inside source: true *** True Line Result - default_word_delay = 11 + args.state.word_delay - 8 -** Processing line: ~ end~ + } +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~ number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length~ + else +** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ - Inside source: true *** True Line Result - number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length -** Processing line: ~ args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)~ + # if the sprite_index is nil, render a countdown instead +** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ - Inside source: true *** True Line Result - args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) -** Processing line: ~ end~ + countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_reload_current_scene args~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - def inputs_reload_current_scene args -** Processing line: ~ return~ + .merge(x: 32, +** Processing line: ~ y: 32,~ - Inside source: true *** True Line Result - return -** Processing line: ~ if args.inputs.keyboard.key_down.r!~ + y: 32, +** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.r! -** Processing line: ~ reload_current_scene~ + text: "Count Down: #{countdown_in_seconds}", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - reload_current_scene + alignment_enum: 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def inputs_dismiss_current_storyline args~ +** Processing line: ~ # render the current tick and the resolved sprite index~ - Inside source: true *** True Line Result - def inputs_dismiss_current_storyline args -** Processing line: ~ if args.inputs.keyboard.key_down.x!~ + # render the current tick and the resolved sprite index +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.x! -** Processing line: ~ args.state.scene_storyline_queue.clear~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - args.state.scene_storyline_queue.clear -** Processing line: ~ end~ + .default_label +** Processing line: ~ .merge(x: 0,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + .merge(x: 0, +** Processing line: ~ y: 11,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + y: 11, +** Processing line: ~ text: "tick: #{args.state.tick_count}")~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_restart_game args~ + text: "tick: #{args.state.tick_count}") +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - def inputs_restart_game args -** Processing line: ~ if args.inputs.keyboard.exclamation_point~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - if args.inputs.keyboard.exclamation_point -** Processing line: ~ args.gtk.reset_state~ + .default_label +** Processing line: ~ .merge(x: 0,~ - Inside source: true *** True Line Result - args.gtk.reset_state -** Processing line: ~ end~ + .merge(x: 0, +** Processing line: ~ y: 5,~ - Inside source: true *** True Line Result - end + y: 5, +** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +- Inside source: true +*** True Line Result + text: "sprite_index: #{sprite_index}") ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -51457,302 +51828,270 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def inputs_change_word_delay args~ -- Inside source: true -*** True Line Result - def inputs_change_word_delay args -** Processing line: ~ if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign -** Processing line: ~ args.state.word_delay -= 2~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE =~ - Inside source: true *** True Line Result - args.state.word_delay -= 2 -** Processing line: ~ if args.state.word_delay < 0~ + ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE = +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - if args.state.word_delay < 0 -** Processing line: ~ args.state.word_delay = 0~ + ## # ============================================================================= +** Processing line: ~ def how_to_move_a_sprite args~ - Inside source: true *** True Line Result - args.state.word_delay = 0 -** Processing line: ~ # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"~ + def how_to_move_a_sprite args +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" -** Processing line: ~ else~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - else -** Processing line: ~ # queue_storyline_text args, "Text speed INCREASED."~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - # queue_storyline_text args, "Text speed INCREASED." -** Processing line: ~ end~ + .merge(x: 32, +** Processing line: ~ y: 62, text: "Use Arrow Keys",~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + y: 62, text: "Use Arrow Keys", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - end + alignment_enum: 1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore -** Processing line: ~ args.state.word_delay += 2~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - args.state.word_delay += 2 -** Processing line: ~ # queue_storyline_text args, "Text speed DECREASED."~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - # queue_storyline_text args, "Text speed DECREASED." -** Processing line: ~ end~ + .merge(x: 32, +** Processing line: ~ y: 56, text: "Use WASD",~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + y: 56, text: "Use WASD", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - end + alignment_enum: 1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil -** Processing line: ~ texts.each_with_index.map do |t, i|~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - texts.each_with_index.map do |t, i| -** Processing line: ~ [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] -** Processing line: ~ end~ + .merge(x: 32, +** Processing line: ~ y: 50, text: "Or Click",~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + y: 50, text: "Or Click", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - end + alignment_enum: 1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse~ -- Inside source: true -*** True Line Result - def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse -** Processing line: ~ # args.state.show_gridlines = true~ +** Processing line: ~ # set the initial values for x and y using ||= ("or equal operator")~ - Inside source: true *** True Line Result - # args.state.show_gridlines = true -** Processing line: ~ defaults args~ + # set the initial values for x and y using ||= ("or equal operator") +** Processing line: ~ args.state.ship.x ||= 0~ - Inside source: true *** True Line Result - defaults args -** Processing line: ~ render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ + args.state.ship.x ||= 0 +** Processing line: ~ args.state.ship.y ||= 0~ - Inside source: true *** True Line Result - render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_solids << [0, 0, 64, 64, 0, 0, 0]~ + args.state.ship.y ||= 0 +** Processing line: ~~ - Inside source: true *** True Line Result - lowrez_solids << [0, 0, 64, 64, 0, 0, 0] -** Processing line: ~ calc_storyline_presentation args~ + +** Processing line: ~ # if a mouse click occurs, update the ship's x and y to be the location of the click~ - Inside source: true *** True Line Result - calc_storyline_presentation args -** Processing line: ~ calc_scenes args~ + # if a mouse click occurs, update the ship's x and y to be the location of the click +** Processing line: ~ if args.lowrez.mouse_click~ - Inside source: true *** True Line Result - calc_scenes args -** Processing line: ~ calc_storyline_hotspot args~ + if args.lowrez.mouse_click +** Processing line: ~ args.state.ship.x = args.lowrez.mouse_click.x~ - Inside source: true *** True Line Result - calc_storyline_hotspot args -** Processing line: ~ inputs_move_player args~ + args.state.ship.x = args.lowrez.mouse_click.x +** Processing line: ~ args.state.ship.y = args.lowrez.mouse_click.y~ - Inside source: true *** True Line Result - inputs_move_player args -** Processing line: ~ inputs_print_mouse_rect args, lowrez_mouse~ + args.state.ship.y = args.lowrez.mouse_click.y +** Processing line: ~ end~ - Inside source: true *** True Line Result - inputs_print_mouse_rect args, lowrez_mouse -** Processing line: ~ inputs_reload_current_scene args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - inputs_reload_current_scene args -** Processing line: ~ inputs_dismiss_current_storyline args~ + +** Processing line: ~ # if a or left arrow is pressed/held, decrement the ships x position~ - Inside source: true *** True Line Result - inputs_dismiss_current_storyline args -** Processing line: ~ inputs_change_word_delay args~ + # if a or left arrow is pressed/held, decrement the ships x position +** Processing line: ~ if args.lowrez.keyboard.left~ - Inside source: true *** True Line Result - inputs_change_word_delay args -** Processing line: ~ inputs_restart_game args~ + if args.lowrez.keyboard.left +** Processing line: ~ args.state.ship.x -= 1~ - Inside source: true *** True Line Result - inputs_restart_game args -** Processing line: ~ if !args.state.storyline_queue_empty_at~ + args.state.ship.x -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - if !args.state.storyline_queue_empty_at -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 80,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.labels << multiple_lines(args, 690, 80, -** Processing line: ~ ["Press \"X\" on the keyboard to dismiss dialog.",~ + +** Processing line: ~ # if d or right arrow is pressed/held, increment the ships x position~ - Inside source: true *** True Line Result - ["Press \"X\" on the keyboard to dismiss dialog.", -** Processing line: ~ "Press \"+\" on the keyboard to INCREASE text speed.",~ + # if d or right arrow is pressed/held, increment the ships x position +** Processing line: ~ if args.lowrez.keyboard.right~ - Inside source: true *** True Line Result - "Press \"+\" on the keyboard to INCREASE text speed.", -** Processing line: ~ "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255)~ + if args.lowrez.keyboard.right +** Processing line: ~ args.state.ship.x += 1~ - Inside source: true *** True Line Result - "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255) + args.state.ship.x += 1 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def inputs_print_mouse_rect args, lowrez_mouse~ -- Inside source: true -*** True Line Result - def inputs_print_mouse_rect args, lowrez_mouse -** Processing line: ~ if lowrez_mouse.click~ -- Inside source: true -*** True Line Result - if lowrez_mouse.click -** Processing line: ~ if args.state.previous_mouse_click~ +** Processing line: ~ # if s or down arrow is pressed/held, decrement the ships y position~ - Inside source: true *** True Line Result - if args.state.previous_mouse_click -** Processing line: ~ dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x~ + # if s or down arrow is pressed/held, decrement the ships y position +** Processing line: ~ if args.lowrez.keyboard.down~ - Inside source: true *** True Line Result - dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x -** Processing line: ~ dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y~ + if args.lowrez.keyboard.down +** Processing line: ~ args.state.ship.y -= 1~ - Inside source: true *** True Line Result - dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y -** Processing line: ~ x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy~ + args.state.ship.y -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if dx < 0 && dx < 0~ -- Inside source: true -*** True Line Result - if dx < 0 && dx < 0 -** Processing line: ~ x = x + w~ -- Inside source: true -*** True Line Result - x = x + w -** Processing line: ~ w = w.abs~ +** Processing line: ~ # if w or up arrow is pressed/held, increment the ships y position~ - Inside source: true *** True Line Result - w = w.abs -** Processing line: ~ y = y + h~ + # if w or up arrow is pressed/held, increment the ships y position +** Processing line: ~ if args.lowrez.keyboard.up~ - Inside source: true *** True Line Result - y = y + h -** Processing line: ~ h = h.abs~ + if args.lowrez.keyboard.up +** Processing line: ~ args.state.ship.y += 1~ - Inside source: true *** True Line Result - h = h.abs -** Processing line: ~ end~ + args.state.ship.y += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ w += 1~ -- Inside source: true -*** True Line Result - w += 1 -** Processing line: ~ h += 1~ +** Processing line: ~ # render the sprite to the screen using the position stored in args.state.ship~ - Inside source: true *** True Line Result - h += 1 -** Processing line: ~~ + # render the sprite to the screen using the position stored in args.state.ship +** Processing line: ~ args.lowrez.sprites << {~ - Inside source: true *** True Line Result - -** Processing line: ~ puts [x, y, w, h]~ + args.lowrez.sprites << { +** Processing line: ~ x: args.state.ship.x,~ - Inside source: true *** True Line Result - puts [x, y, w, h] -** Processing line: ~ args.state.previous_mouse_click = nil~ + x: args.state.ship.x, +** Processing line: ~ y: args.state.ship.y,~ - Inside source: true *** True Line Result - args.state.previous_mouse_click = nil -** Processing line: ~ else~ + y: args.state.ship.y, +** Processing line: ~ w: 5,~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.previous_mouse_click = lowrez_mouse.click~ + w: 5, +** Processing line: ~ h: 5,~ - Inside source: true *** True Line Result - args.state.previous_mouse_click = lowrez_mouse.click -** Processing line: ~ square_x, square_y = lowrez_mouse.click~ + h: 5, +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ - Inside source: true *** True Line Result - square_x, square_y = lowrez_mouse.click -** Processing line: ~ puts [square_x, square_y]~ + path: 'sprites/lowrez-ship-blue.png', +** Processing line: ~ # parameters beyond this point are optional~ - Inside source: true *** True Line Result - puts [square_x, square_y] -** Processing line: ~ 8.map_with_index do |i|~ + # parameters beyond this point are optional +** Processing line: ~ angle: 0, # Note: rotation angle is denoted in degrees NOT radians~ - Inside source: true *** True Line Result - 8.map_with_index do |i| -** Processing line: ~ puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1]~ + angle: 0, # Note: rotation angle is denoted in degrees NOT radians +** Processing line: ~ r: 255,~ - Inside source: true *** True Line Result - puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1] -** Processing line: ~ end~ + r: 255, +** Processing line: ~ g: 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + g: 255, +** Processing line: ~ b: 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + b: 255, +** Processing line: ~ a: 255~ - Inside source: true *** True Line Result - -** Processing line: ~ end~ + a: 255 +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -51761,310 +52100,314 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def try_centering! word~ +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - def try_centering! word -** Processing line: ~ word ||= ""~ + # ======================================================================= +** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =======================================~ - Inside source: true *** True Line Result - word ||= "" -** Processing line: ~ just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")~ + # ==== HOW TO DETERMINE COLLISION ======================================= +** Processing line: ~ # =======================================================================~ - Inside source: true *** True Line Result - just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") -** Processing line: ~ return word if just_word.strip.length == 0~ + # ======================================================================= +** Processing line: ~ def how_to_determine_collision args~ - Inside source: true *** True Line Result - return word if just_word.strip.length == 0 -** Processing line: ~ return word if just_word.include? "~"~ + def how_to_determine_collision args +** Processing line: ~ # Render the instructions~ - Inside source: true *** True Line Result - return word if just_word.include? "~" -** Processing line: ~ return "~#{word}" if just_word.length <= 2~ + # Render the instructions +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - return "~#{word}" if just_word.length <= 2 -** Processing line: ~ if just_word.length.mod_zero? 2~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - if just_word.length.mod_zero? 2 -** Processing line: ~ center_index = just_word.length.idiv(2) - 1~ + .default_label +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - center_index = just_word.length.idiv(2) - 1 -** Processing line: ~ else~ + .merge(x: 32, +** Processing line: ~ y: 62, text: "Click Anywhere",~ - Inside source: true *** True Line Result - else -** Processing line: ~ center_index = (just_word.length - 1).idiv(2)~ + y: 62, text: "Click Anywhere", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - center_index = (just_word.length - 1).idiv(2) -** Processing line: ~ end~ + alignment_enum: 1) +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"~ + +** Processing line: ~ # if a mouse click occurs:~ - Inside source: true *** True Line Result - return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" -** Processing line: ~ end~ + # if a mouse click occurs: +** Processing line: ~ # - set ship_one if it isn't set~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # - set ship_one if it isn't set +** Processing line: ~ # - set ship_two if it isn't set~ - Inside source: true *** True Line Result - -** Processing line: ~ def queue_storyline args, scene~ + # - set ship_two if it isn't set +** Processing line: ~ # - otherwise reset ship one and ship two~ - Inside source: true *** True Line Result - def queue_storyline args, scene -** Processing line: ~ queue_storyline_text args, scene[:storyline]~ + # - otherwise reset ship one and ship two +** Processing line: ~ if args.lowrez.mouse_click~ - Inside source: true *** True Line Result - queue_storyline_text args, scene[:storyline] -** Processing line: ~ end~ + if args.lowrez.mouse_click +** Processing line: ~ # is ship_one set?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # is ship_one set? +** Processing line: ~ if !args.state.ship_one~ - Inside source: true *** True Line Result - -** Processing line: ~ def queue_storyline_text args, text~ + if !args.state.ship_one +** Processing line: ~ args.state.ship_one = { x: args.lowrez.mouse_click.x - 10,~ - Inside source: true *** True Line Result - def queue_storyline_text args, text -** Processing line: ~ args.state.last_story_line_text = text~ + args.state.ship_one = { x: args.lowrez.mouse_click.x - 10, +** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ - Inside source: true *** True Line Result - args.state.last_story_line_text = text -** Processing line: ~ args.state.storyline_history << text if text~ + y: args.lowrez.mouse_click.y - 10, +** Processing line: ~ w: 20,~ - Inside source: true *** True Line Result - args.state.storyline_history << text if text -** Processing line: ~ words = (text || "").split(" ")~ + w: 20, +** Processing line: ~ h: 20 }~ - Inside source: true *** True Line Result - words = (text || "").split(" ") -** Processing line: ~ words = words.map { |w| try_centering! w }~ + h: 20 } +** Processing line: ~ # is ship_one set?~ - Inside source: true *** True Line Result - words = words.map { |w| try_centering! w } -** Processing line: ~ args.state.scene_storyline_queue = words~ + # is ship_one set? +** Processing line: ~ elsif !args.state.ship_two~ - Inside source: true *** True Line Result - args.state.scene_storyline_queue = words -** Processing line: ~ if args.state.scene_storyline_queue.length != 0~ + elsif !args.state.ship_two +** Processing line: ~ args.state.ship_two = { x: args.lowrez.mouse_click.x - 10,~ - Inside source: true *** True Line Result - if args.state.scene_storyline_queue.length != 0 -** Processing line: ~ args.state.scene_storyline_queue.unshift "~$--"~ + args.state.ship_two = { x: args.lowrez.mouse_click.x - 10, +** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ - Inside source: true *** True Line Result - args.state.scene_storyline_queue.unshift "~$--" -** Processing line: ~ args.state.storyline_to_show = "~."~ + y: args.lowrez.mouse_click.y - 10, +** Processing line: ~ w: 20,~ - Inside source: true *** True Line Result - args.state.storyline_to_show = "~." -** Processing line: ~ else~ + w: 20, +** Processing line: ~ h: 20 }~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.storyline_to_show = ""~ + h: 20 } +** Processing line: ~ # should we reset?~ - Inside source: true *** True Line Result - args.state.storyline_to_show = "" -** Processing line: ~ end~ + # should we reset? +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.scene_storyline_queue << ""~ + else +** Processing line: ~ args.state.ship_one = nil~ - Inside source: true *** True Line Result - args.state.scene_storyline_queue << "" -** Processing line: ~ args.state.next_storyline = args.state.tick_count~ + args.state.ship_one = nil +** Processing line: ~ args.state.ship_two = nil~ - Inside source: true *** True Line Result - args.state.next_storyline = args.state.tick_count -** Processing line: ~ end~ + args.state.ship_two = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_scene args, scene~ +** Processing line: ~ # render ship one if it's set~ - Inside source: true *** True Line Result - def set_scene args, scene -** Processing line: ~ args.state.current_scene = scene~ + # render ship one if it's set +** Processing line: ~ if args.state.ship_one~ - Inside source: true *** True Line Result - args.state.current_scene = scene -** Processing line: ~ args.state.background = scene[:background] || 'sprites/todo.png'~ + if args.state.ship_one +** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ - Inside source: true *** True Line Result - args.state.background = scene[:background] || 'sprites/todo.png' -** Processing line: ~ args.state.scene_fade = scene[:fade] || 0~ + # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha +** Processing line: ~ # render ship one~ - Inside source: true *** True Line Result - args.state.scene_fade = scene[:fade] || 0 -** Processing line: ~ args.state.scenes = (scene[:scenes] || []).reject { |s| !s }~ + # render ship one +** Processing line: ~ args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100)~ - Inside source: true *** True Line Result - args.state.scenes = (scene[:scenes] || []).reject { |s| !s } -** Processing line: ~ args.state.scene_render_override = scene[:render_override]~ + args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.scene_render_override = scene[:render_override] -** Processing line: ~ args.state.storylines = (scene[:storylines] || []).reject { |s| !s }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.storylines = (scene[:storylines] || []).reject { |s| !s } -** Processing line: ~ args.state.scene_changed_at = args.state.tick_count~ + +** Processing line: ~ if args.state.ship_two~ - Inside source: true *** True Line Result - args.state.scene_changed_at = args.state.tick_count -** Processing line: ~ if scene[:player]~ + if args.state.ship_two +** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ - Inside source: true *** True Line Result - if scene[:player] -** Processing line: ~ args.state.player = scene[:player]~ + # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha +** Processing line: ~ # render ship two~ - Inside source: true *** True Line Result - args.state.player = scene[:player] -** Processing line: ~ end~ + # render ship two +** Processing line: ~ args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100)~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.inside_scene_hotspot = false~ + args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.state.inside_scene_hotspot = false -** Processing line: ~ args.state.inside_storyline_hotspot = false~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.inside_storyline_hotspot = false -** Processing line: ~ queue_storyline args, scene~ + +** Processing line: ~ # if both ship one and ship two are set, then determine collision~ - Inside source: true *** True Line Result - queue_storyline args, scene -** Processing line: ~ end~ + # if both ship one and ship two are set, then determine collision +** Processing line: ~ if args.state.ship_one && args.state.ship_two~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if args.state.ship_one && args.state.ship_two +** Processing line: ~ # collision is determined using the intersect_rect? method~ - Inside source: true *** True Line Result - -** Processing line: ~ def replay_storyline_rect~ + # collision is determined using the intersect_rect? method +** Processing line: ~ if args.state.ship_one.intersect_rect? args.state.ship_two~ - Inside source: true *** True Line Result - def replay_storyline_rect -** Processing line: ~ [26, -1, 7, 4]~ + if args.state.ship_one.intersect_rect? args.state.ship_two +** Processing line: ~ # if collision occurred, render the words collision!~ - Inside source: true *** True Line Result - [26, -1, 7, 4] -** Processing line: ~ end~ + # if collision occurred, render the words collision! +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - -** Processing line: ~ def labels_for_word word~ + .default_label +** Processing line: ~ .merge(x: 31,~ - Inside source: true *** True Line Result - def labels_for_word word -** Processing line: ~ left_side_of_word = ""~ + .merge(x: 31, +** Processing line: ~ y: 5,~ - Inside source: true *** True Line Result - left_side_of_word = "" -** Processing line: ~ center_letter = ""~ + y: 5, +** Processing line: ~ text: "Collision!",~ - Inside source: true *** True Line Result - center_letter = "" -** Processing line: ~ right_side_of_word = ""~ + text: "Collision!", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - right_side_of_word = "" -** Processing line: ~~ + alignment_enum: 1) +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ if word[0] == "~"~ + else +** Processing line: ~ # if collision occurred, render the words no collision.~ - Inside source: true *** True Line Result - if word[0] == "~" -** Processing line: ~ left_side_of_word = ""~ + # if collision occurred, render the words no collision. +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - left_side_of_word = "" -** Processing line: ~ center_letter = word[1]~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - center_letter = word[1] -** Processing line: ~ right_side_of_word = word[2..-1]~ + .default_label +** Processing line: ~ .merge(x: 31,~ - Inside source: true *** True Line Result - right_side_of_word = word[2..-1] -** Processing line: ~ elsif word.length > 0~ + .merge(x: 31, +** Processing line: ~ y: 5,~ - Inside source: true *** True Line Result - elsif word.length > 0 -** Processing line: ~ left_side_of_word, right_side_of_word = word.split("~")~ + y: 5, +** Processing line: ~ text: "No Collision.",~ - Inside source: true *** True Line Result - left_side_of_word, right_side_of_word = word.split("~") -** Processing line: ~ center_letter = right_side_of_word[0]~ + text: "No Collision.", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - center_letter = right_side_of_word[0] -** Processing line: ~ right_side_of_word = right_side_of_word[1..-1]~ + alignment_enum: 1) +** Processing line: ~ end~ - Inside source: true *** True Line Result - right_side_of_word = right_side_of_word[1..-1] -** Processing line: ~ end~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + else +** Processing line: ~ # if both ship one and ship two aren't set, then render --~ - Inside source: true *** True Line Result - -** Processing line: ~ right_side_of_word = right_side_of_word.gsub("-", "")~ + # if both ship one and ship two aren't set, then render -- +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - right_side_of_word = right_side_of_word.gsub("-", "") -** Processing line: ~~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - -** Processing line: ~ {~ + .default_label +** Processing line: ~ .merge(x: 31,~ - Inside source: true *** True Line Result - { -** Processing line: ~ left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],~ + .merge(x: 31, +** Processing line: ~ y: 6,~ - Inside source: true *** True Line Result - left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], -** Processing line: ~ center: [29, 2, center_letter, 255, 0, 0],~ + y: 6, +** Processing line: ~ text: "--",~ - Inside source: true *** True Line Result - center: [29, 2, center_letter, 255, 0, 0], -** Processing line: ~ right: [34, 2, right_side_of_word]~ + text: "--", +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - right: [34, 2, right_side_of_word] -** Processing line: ~ }~ + alignment_enum: 1) +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -52073,270 +52416,262 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_scenes args, lowrez_sprites~ +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - def render_scenes args, lowrez_sprites -** Processing line: ~ lowrez_sprites << args.state.scenes.flat_map do |hs|~ + ## # ============================================================================= +** Processing line: ~ ## # ==== HOW TO CREATE BUTTONS ==================================================~ - Inside source: true *** True Line Result - lowrez_sprites << args.state.scenes.flat_map do |hs| -** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ + ## # ==== HOW TO CREATE BUTTONS ================================================== +** Processing line: ~ ## # =============================================================================~ - Inside source: true *** True Line Result - hotspot_square args, hs.x, hs.y, hs.w, hs.h -** Processing line: ~ end~ + ## # ============================================================================= +** Processing line: ~ def how_to_create_buttons args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def how_to_create_buttons args +** Processing line: ~ # Define a button style~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Define a button style +** Processing line: ~ args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 }~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_storylines args, lowrez_sprites~ + args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 } +** Processing line: ~ args.state.label_style = { r: 80, g: 80, b: 80 }~ - Inside source: true *** True Line Result - def render_storylines args, lowrez_sprites -** Processing line: ~ lowrez_sprites << args.state.storylines.flat_map do |hs|~ + args.state.label_style = { r: 80, g: 80, b: 80 } +** Processing line: ~~ - Inside source: true *** True Line Result - lowrez_sprites << args.state.storylines.flat_map do |hs| -** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ + +** Processing line: ~ # Render instructions~ - Inside source: true *** True Line Result - hotspot_square args, hs.x, hs.y, hs.w, hs.h -** Processing line: ~ end~ + # Render instructions +** Processing line: ~ args.state.button_message ||= "Press a Button!"~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.button_message ||= "Press a Button!" +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - -** Processing line: ~ def adornments_alpha args, target_alpha = nil, minimum_alpha = nil~ + .default_label +** Processing line: ~ .merge(args.state.label_style)~ - Inside source: true *** True Line Result - def adornments_alpha args, target_alpha = nil, minimum_alpha = nil -** Processing line: ~ return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at~ + .merge(args.state.label_style) +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at -** Processing line: ~ target_alpha ||= 255~ + .merge(x: 32, +** Processing line: ~ y: 62,~ - Inside source: true *** True Line Result - target_alpha ||= 255 -** Processing line: ~ target_alpha * args.state.storyline_queue_empty_at.ease(60)~ + y: 62, +** Processing line: ~ text: args.state.button_message,~ - Inside source: true *** True Line Result - target_alpha * args.state.storyline_queue_empty_at.ease(60) -** Processing line: ~ end~ + text: args.state.button_message, +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - end + alignment_enum: 1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def hotspot_square args, x, y, w, h~ +** Processing line: ~~ - Inside source: true *** True Line Result - def hotspot_square args, x, y, w, h -** Processing line: ~ if w >= 3 && h >= 3~ + +** Processing line: ~ # Creates button one using a border and a label~ - Inside source: true *** True Line Result - if w >= 3 && h >= 3 -** Processing line: ~ [~ + # Creates button one using a border and a label +** Processing line: ~ args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],~ + args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32) +** Processing line: ~ args.lowrez.borders << args.state.button_one_border~ - Inside source: true *** True Line Result - [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], -** Processing line: ~ [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],~ + args.lowrez.borders << args.state.button_one_border +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], -** Processing line: ~ [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], -** Processing line: ~ ]~ + .default_label +** Processing line: ~ .merge(args.state.label_style)~ - Inside source: true *** True Line Result - ] -** Processing line: ~ else~ + .merge(args.state.label_style) +** Processing line: ~ .merge(x: args.state.button_one_border.x + 2,~ - Inside source: true *** True Line Result - else -** Processing line: ~ [~ + .merge(x: args.state.button_one_border.x + 2, +** Processing line: ~ y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],~ + y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2, +** Processing line: ~ text: "Button One")~ - Inside source: true *** True Line Result - [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], -** Processing line: ~ ]~ + text: "Button One") +** Processing line: ~~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + +** Processing line: ~ # Creates button two using a border and a label~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Creates button two using a border and a label +** Processing line: ~ args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)~ - Inside source: true *** True Line Result - end + args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_storyline_dialog args, lowrez_labels, lowrez_sprites~ -- Inside source: true -*** True Line Result - def render_storyline_dialog args, lowrez_labels, lowrez_sprites -** Processing line: ~ return unless args.state.is_storyline_dialog_active~ -- Inside source: true -*** True Line Result - return unless args.state.is_storyline_dialog_active -** Processing line: ~ return unless args.state.storyline_to_show~ +** Processing line: ~ args.lowrez.borders << args.state.button_two_border~ - Inside source: true *** True Line Result - return unless args.state.storyline_to_show -** Processing line: ~ labels = labels_for_word args.state.storyline_to_show~ + args.lowrez.borders << args.state.button_two_border +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - labels = labels_for_word args.state.storyline_to_show -** Processing line: ~ if true # high rez version~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - if true # high rez version -** Processing line: ~ scale = 8.88~ + .default_label +** Processing line: ~ .merge(args.state.label_style)~ - Inside source: true *** True Line Result - scale = 8.88 -** Processing line: ~ offset = 45~ + .merge(args.state.label_style) +** Processing line: ~ .merge(x: args.state.button_two_border.x + 2,~ - Inside source: true *** True Line Result - offset = 45 -** Processing line: ~ size = 25~ + .merge(x: args.state.button_two_border.x + 2, +** Processing line: ~ y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ - Inside source: true *** True Line Result - size = 25 -** Processing line: ~ args.outputs.labels << [offset + labels[:left].x.-(1) * scale,~ + y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2, +** Processing line: ~ text: "Button Two")~ - Inside source: true *** True Line Result - args.outputs.labels << [offset + labels[:left].x.-(1) * scale, -** Processing line: ~ labels[:left].y * TINY_SCALE + 55,~ + text: "Button Two") +** Processing line: ~~ - Inside source: true *** True Line Result - labels[:left].y * TINY_SCALE + 55, -** Processing line: ~ labels[:left].text, size, 0, 0, 0, 0, 255,~ + +** Processing line: ~ # Initialize the state variable that tracks which button was clicked to "" (empty stringI~ - Inside source: true *** True Line Result - labels[:left].text, size, 0, 0, 0, 0, 255, -** Processing line: ~ 'fonts/manaspc.ttf']~ + # Initialize the state variable that tracks which button was clicked to "" (empty stringI +** Processing line: ~ args.state.last_button_clicked ||= "--"~ - Inside source: true *** True Line Result - 'fonts/manaspc.ttf'] -** Processing line: ~ center_text = labels[:center].text~ + args.state.last_button_clicked ||= "--" +** Processing line: ~~ - Inside source: true *** True Line Result - center_text = labels[:center].text -** Processing line: ~ center_text = "|" if center_text == "$"~ + +** Processing line: ~ # If a click occurs, check to see if either button one, or button two was clicked~ - Inside source: true *** True Line Result - center_text = "|" if center_text == "$" -** Processing line: ~ args.outputs.labels << [offset + labels[:center].x * scale,~ + # If a click occurs, check to see if either button one, or button two was clicked +** Processing line: ~ # using the inside_rect? method of the mouse~ - Inside source: true *** True Line Result - args.outputs.labels << [offset + labels[:center].x * scale, -** Processing line: ~ labels[:center].y * TINY_SCALE + 55,~ + # using the inside_rect? method of the mouse +** Processing line: ~ # set args.state.last_button_clicked accordingly~ - Inside source: true *** True Line Result - labels[:center].y * TINY_SCALE + 55, -** Processing line: ~ center_text, size, 0, 255, 0, 0, 255,~ + # set args.state.last_button_clicked accordingly +** Processing line: ~ if args.lowrez.mouse_click~ - Inside source: true *** True Line Result - center_text, size, 0, 255, 0, 0, 255, -** Processing line: ~ 'fonts/manaspc.ttf']~ + if args.lowrez.mouse_click +** Processing line: ~ if args.lowrez.mouse_click.inside_rect? args.state.button_one_border~ - Inside source: true *** True Line Result - 'fonts/manaspc.ttf'] -** Processing line: ~ args.outputs.labels << [offset + labels[:right].x * scale,~ + if args.lowrez.mouse_click.inside_rect? args.state.button_one_border +** Processing line: ~ args.state.last_button_clicked = "One Clicked!"~ - Inside source: true *** True Line Result - args.outputs.labels << [offset + labels[:right].x * scale, -** Processing line: ~ labels[:right].y * TINY_SCALE + 55,~ + args.state.last_button_clicked = "One Clicked!" +** Processing line: ~ elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border~ - Inside source: true *** True Line Result - labels[:right].y * TINY_SCALE + 55, -** Processing line: ~ labels[:right].text, size, 0, 0, 0, 0, 255,~ + elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border +** Processing line: ~ args.state.last_button_clicked = "Two Clicked!"~ - Inside source: true *** True Line Result - labels[:right].text, size, 0, 0, 0, 0, 255, -** Processing line: ~ 'fonts/manaspc.ttf']~ + args.state.last_button_clicked = "Two Clicked!" +** Processing line: ~ else~ - Inside source: true *** True Line Result - 'fonts/manaspc.ttf'] -** Processing line: ~ else~ + else +** Processing line: ~ args.state.last_button_clicked = "--"~ - Inside source: true *** True Line Result - else -** Processing line: ~ lowrez_labels << labels[:left]~ + args.state.last_button_clicked = "--" +** Processing line: ~ end~ - Inside source: true *** True Line Result - lowrez_labels << labels[:left] -** Processing line: ~ lowrez_labels << labels[:center]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - lowrez_labels << labels[:center] -** Processing line: ~ lowrez_labels << labels[:right]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - lowrez_labels << labels[:right] -** Processing line: ~ end~ + +** Processing line: ~ # Render the current value of args.state.last_button_clicked~ - Inside source: true *** True Line Result - end -** Processing line: ~ args.state.is_storyline_dialog_active = true~ + # Render the current value of args.state.last_button_clicked +** Processing line: ~ args.lowrez.labels << args.lowrez~ - Inside source: true *** True Line Result - args.state.is_storyline_dialog_active = true -** Processing line: ~ render_player args, lowrez_sprites~ + args.lowrez.labels << args.lowrez +** Processing line: ~ .default_label~ - Inside source: true *** True Line Result - render_player args, lowrez_sprites -** Processing line: ~ lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png']~ + .default_label +** Processing line: ~ .merge(args.state.label_style)~ - Inside source: true *** True Line Result - lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] -** Processing line: ~ end~ + .merge(args.state.label_style) +** Processing line: ~ .merge(x: 32,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .merge(x: 32, +** Processing line: ~ y: 5,~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_player args, lowrez_sprites~ + y: 5, +** Processing line: ~ text: args.state.last_button_clicked,~ - Inside source: true *** True Line Result - def render_player args, lowrez_sprites -** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ + text: args.state.last_button_clicked, +** Processing line: ~ alignment_enum: 1)~ - Inside source: true *** True Line Result - lowrez_sprites << player_md_down(args, *args.state.player) + alignment_enum: 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -52345,234 +52680,250 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def render_adornments args, lowrez_sprites~ +** Processing line: ~~ - Inside source: true *** True Line Result - def render_adornments args, lowrez_sprites -** Processing line: ~ render_scenes args, lowrez_sprites~ + +** Processing line: ~ def render_debug args~ - Inside source: true *** True Line Result - render_scenes args, lowrez_sprites -** Processing line: ~ render_storylines args, lowrez_sprites~ + def render_debug args +** Processing line: ~ if !args.state.grid_rendered~ - Inside source: true *** True Line Result - render_storylines args, lowrez_sprites -** Processing line: ~ return if args.state.is_storyline_dialog_active~ + if !args.state.grid_rendered +** Processing line: ~ 65.map_with_index do |i|~ - Inside source: true *** True Line Result - return if args.state.is_storyline_dialog_active -** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ + 65.map_with_index do |i| +** Processing line: ~ args.outputs.static_debug << {~ - Inside source: true *** True Line Result - lowrez_sprites << player_md_down(args, *args.state.player) -** Processing line: ~ end~ + args.outputs.static_debug << { +** Processing line: ~ x: LOWREZ_X_OFFSET,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x: LOWREZ_X_OFFSET, +** Processing line: ~ y: LOWREZ_Y_OFFSET + (i * 10),~ - Inside source: true *** True Line Result - -** Processing line: ~ def global_alpha_percentage args, max_alpha = 255~ + y: LOWREZ_Y_OFFSET + (i * 10), +** Processing line: ~ x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE,~ - Inside source: true *** True Line Result - def global_alpha_percentage args, max_alpha = 255 -** Processing line: ~ return 255 unless args.state.scene_changed_at~ + x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE, +** Processing line: ~ y2: LOWREZ_Y_OFFSET + (i * 10),~ - Inside source: true *** True Line Result - return 255 unless args.state.scene_changed_at -** Processing line: ~ return 255 unless args.state.scene_fade~ + y2: LOWREZ_Y_OFFSET + (i * 10), +** Processing line: ~ r: 128,~ - Inside source: true *** True Line Result - return 255 unless args.state.scene_fade -** Processing line: ~ return 255 unless args.state.scene_fade > 0~ + r: 128, +** Processing line: ~ g: 128,~ - Inside source: true *** True Line Result - return 255 unless args.state.scene_fade > 0 -** Processing line: ~ return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)~ + g: 128, +** Processing line: ~ b: 128,~ - Inside source: true *** True Line Result - return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) -** Processing line: ~ end~ + b: 128, +** Processing line: ~ a: 80~ - Inside source: true *** True Line Result - end + a: 80 +** Processing line: ~ }.line~ +- Inside source: true +*** True Line Result + }.line ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ args.outputs.static_debug << {~ - Inside source: true *** True Line Result - def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]~ + args.outputs.static_debug << { +** Processing line: ~ x: LOWREZ_X_OFFSET + (i * 10),~ - Inside source: true *** True Line Result - lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] -** Processing line: ~ if args.state.scene_render_override~ + x: LOWREZ_X_OFFSET + (i * 10), +** Processing line: ~ y: LOWREZ_Y_OFFSET,~ - Inside source: true *** True Line Result - if args.state.scene_render_override -** Processing line: ~ send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids~ + y: LOWREZ_Y_OFFSET, +** Processing line: ~ x2: LOWREZ_X_OFFSET + (i * 10),~ - Inside source: true *** True Line Result - send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ end~ + x2: LOWREZ_X_OFFSET + (i * 10), +** Processing line: ~ y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE,~ - Inside source: true *** True Line Result - end -** Processing line: ~ storyline_to_show = args.state.storyline_to_show || ""~ + y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE, +** Processing line: ~ r: 128,~ - Inside source: true *** True Line Result - storyline_to_show = args.state.storyline_to_show || "" -** Processing line: ~ render_adornments args, lowrez_sprites~ + r: 128, +** Processing line: ~ g: 128,~ - Inside source: true *** True Line Result - render_adornments args, lowrez_sprites -** Processing line: ~ render_storyline_dialog args, lowrez_labels, lowrez_sprites~ + g: 128, +** Processing line: ~ b: 128,~ - Inside source: true *** True Line Result - render_storyline_dialog args, lowrez_labels, lowrez_sprites -** Processing line: ~~ + b: 128, +** Processing line: ~ a: 80~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.state.background == 'sprites/tribute-game-over.png'~ + a: 80 +** Processing line: ~ }.line~ - Inside source: true *** True Line Result - if args.state.background == 'sprites/tribute-game-over.png' -** Processing line: ~ lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]~ + }.line +** Processing line: ~ end~ - Inside source: true *** True Line Result - lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] -** Processing line: ~ lowrez_labels << [9, 6, 'Return of', 255, 255, 255]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - lowrez_labels << [9, 6, 'Return of', 255, 255, 255] -** Processing line: ~ lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] -** Processing line: ~ if !args.state.ended~ + +** Processing line: ~ args.state.grid_rendered = true~ - Inside source: true *** True Line Result - if !args.state.ended -** Processing line: ~ args.gtk.stop_music~ + args.state.grid_rendered = true +** Processing line: ~~ - Inside source: true *** True Line Result - args.gtk.stop_music -** Processing line: ~ args.outputs.sounds << 'sounds/music-loop.ogg'~ + +** Processing line: ~ args.state.last_click ||= 0~ - Inside source: true *** True Line Result - args.outputs.sounds << 'sounds/music-loop.ogg' -** Processing line: ~ args.state.ended = true~ + args.state.last_click ||= 0 +** Processing line: ~ args.state.last_up ||= 0~ - Inside source: true *** True Line Result - args.state.ended = true -** Processing line: ~ end~ + args.state.last_up ||= 0 +** Processing line: ~ args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click +** Processing line: ~ args.state.last_up = args.state.tick_count if args.lowrez.mouse_up~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.last_up = args.state.tick_count if args.lowrez.mouse_up +** Processing line: ~ args.state.label_style = { size_enum: -1.5 }~ - Inside source: true *** True Line Result - end + args.state.label_style = { size_enum: -1.5 } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def player_md_right args, x, y~ -- Inside source: true -*** True Line Result - def player_md_right args, x, y -** Processing line: ~ [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ args.state.watch_list = [~ - Inside source: true *** True Line Result - [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] -** Processing line: ~ end~ + args.state.watch_list = [ +** Processing line: ~ "args.state.tick_count is: #{args.state.tick_count}",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "args.state.tick_count is: #{args.state.tick_count}", +** Processing line: ~ "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}",~ - Inside source: true *** True Line Result - -** Processing line: ~ def player_md_left args, x, y~ + "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}", +** Processing line: ~ "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}",~ - Inside source: true *** True Line Result - def player_md_left args, x, y -** Processing line: ~ [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]~ + "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}", +** Processing line: ~ "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}",~ - Inside source: true *** True Line Result - [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] -** Processing line: ~ end~ + "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}", +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def player_md_up args, x, y~ +** Processing line: ~ args.outputs.debug << args.state~ - Inside source: true *** True Line Result - def player_md_up args, x, y -** Processing line: ~ [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]~ + args.outputs.debug << args.state +** Processing line: ~ .watch_list~ - Inside source: true *** True Line Result - [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] -** Processing line: ~ end~ + .watch_list +** Processing line: ~ .map_with_index do |text, i|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .map_with_index do |text, i| +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ def player_md_down args, x, y~ + { +** Processing line: ~ x: 5,~ - Inside source: true *** True Line Result - def player_md_down args, x, y -** Processing line: ~ [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]~ + x: 5, +** Processing line: ~ y: 720 - (i * 20),~ - Inside source: true *** True Line Result - [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] -** Processing line: ~ end~ + y: 720 - (i * 20), +** Processing line: ~ text: text,~ - Inside source: true *** True Line Result - end + text: text, +** Processing line: ~ size_enum: -1.5~ +- Inside source: true +*** True Line Result + size_enum: -1.5 +** Processing line: ~ }.label~ +- Inside source: true +*** True Line Result + }.label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def player_sm args, x, y~ +** Processing line: ~ args.outputs.debug << {~ - Inside source: true *** True Line Result - def player_sm args, x, y -** Processing line: ~ [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ + args.outputs.debug << { +** Processing line: ~ x: 640,~ - Inside source: true *** True Line Result - [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] -** Processing line: ~ end~ + x: 640, +** Processing line: ~ y: 25,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + y: 25, +** Processing line: ~ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",~ - Inside source: true *** True Line Result - -** Processing line: ~ def player_xs args, x, y~ + text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.", +** Processing line: ~ size_enum: -0.5,~ - Inside source: true *** True Line Result - def player_xs args, x, y -** Processing line: ~ [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ + size_enum: -0.5, +** Processing line: ~ alignment_enum: 1~ - Inside source: true *** True Line Result - [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] + alignment_enum: 1 +** Processing line: ~ }.label~ +- Inside source: true +*** True Line Result + }.label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -52581,6 +52932,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ $gtk.reset~ +- Inside source: true +*** True Line Result + $gtk.reset +** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ - Line was identified as the end of a code block. *** True Line Result @@ -52589,3462 +52948,3386 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/repl.rb~ +** Processing line: ~* Platformer - Clepto Frog - main.rb~ - Header detected. *** True Line Result *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/repl.rb +* Platformer - Clepto Frog - main.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ puts $gtk.args.state.current_scene~ +** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/main.rb~ - Inside source: true *** True Line Result - puts $gtk.args.state.current_scene -** Processing line: ~~ + # ./samples/99_genre_platformer/clepto_frog/app/main.rb +** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src + MAP_FILE_PATH = 'app/map.txt' ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/require.rb~ -- Header detected. +- Inside source: true *** True Line Result +** Processing line: ~ require 'app/map.rb'~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/require.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + require 'app/map.rb' +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ class CleptoFrog~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ require 'app/lowrez_simulator.rb'~ + class CleptoFrog +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - require 'app/lowrez_simulator.rb' -** Processing line: ~ require 'app/storyline_day_one.rb'~ + attr_gtk +** Processing line: ~~ - Inside source: true *** True Line Result - require 'app/storyline_day_one.rb' -** Processing line: ~ require 'app/storyline_blinking_light.rb'~ + +** Processing line: ~ def render_ending~ - Inside source: true *** True Line Result - require 'app/storyline_blinking_light.rb' -** Processing line: ~ require 'app/storyline_serenity_introduction.rb'~ + def render_ending +** Processing line: ~ state.game_over_at ||= state.tick_count~ - Inside source: true *** True Line Result - require 'app/storyline_serenity_introduction.rb' -** Processing line: ~ require 'app/storyline_speed_of_light.rb'~ + state.game_over_at ||= state.tick_count +** Processing line: ~~ - Inside source: true *** True Line Result - require 'app/storyline_speed_of_light.rb' -** Processing line: ~ require 'app/storyline_serenity_alive.rb'~ + +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ - Inside source: true *** True Line Result - require 'app/storyline_serenity_alive.rb' -** Processing line: ~ require 'app/storyline_serenity_bio.rb'~ + outputs.labels << [640, 700, "Clepto Frog", 4, 1] +** Processing line: ~~ - Inside source: true *** True Line Result - require 'app/storyline_serenity_bio.rb' -** Processing line: ~ require 'app/storyline_anka.rb'~ + +** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ - Inside source: true *** True Line Result - require 'app/storyline_anka.rb' -** Processing line: ~ require 'app/storyline_final_message.rb'~ + if state.tick_count >= (state.game_over_at + 120) +** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ - Inside source: true *** True Line Result - require 'app/storyline_final_message.rb' -** Processing line: ~ require 'app/storyline_final_decision.rb'~ + outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ - Inside source: true *** True Line Result - require 'app/storyline_final_decision.rb' -** Processing line: ~ require 'app/storyline.rb'~ + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - require 'app/storyline.rb' + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + if state.tick_count >= (state.game_over_at + 240) +** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline.rb~ -- Header detected. + outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ +- Inside source: true *** True Line Result - + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)] +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def hotspot_top~ + if state.tick_count >= (state.game_over_at + 360) +** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ - Inside source: true *** True Line Result - def hotspot_top -** Processing line: ~ [4, 61, 56, 3]~ + outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ - Inside source: true *** True Line Result - [4, 61, 56, 3] -** Processing line: ~ end~ + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def hotspot_bottom~ -- Inside source: true -*** True Line Result - def hotspot_bottom -** Processing line: ~ [4, 0, 56, 3]~ +** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ - Inside source: true *** True Line Result - [4, 0, 56, 3] -** Processing line: ~ end~ + outputs.sprites << [640 - 50, 360 - 50, 100, 100, +** Processing line: ~ "sprites/square-green.png"]~ - Inside source: true *** True Line Result - end + "sprites/square-green.png"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def hotspot_top_right~ -- Inside source: true -*** True Line Result - def hotspot_top_right -** Processing line: ~ [62, 35, 3, 25]~ +** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ - Inside source: true *** True Line Result - [62, 35, 3, 25] -** Processing line: ~ end~ + outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1] +** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ - Inside source: true *** True Line Result - end + outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def hotspot_bottom_right~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ - Inside source: true *** True Line Result - def hotspot_bottom_right -** Processing line: ~ [62, 0, 3, 25]~ + if state.tick_count >= (state.game_over_at + 550) +** Processing line: ~ restart_game~ - Inside source: true *** True Line Result - [62, 0, 3, 25] -** Processing line: ~ end~ + restart_game +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def storyline_history_include? args, text~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def storyline_history_include? args, text -** Processing line: ~ args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }~ + +** Processing line: ~ def restart_game~ - Inside source: true *** True Line Result - args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } -** Processing line: ~ end~ + def restart_game +** Processing line: ~ state.world = nil~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.world = nil +** Processing line: ~ state.x = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ + state.x = nil +** Processing line: ~ state.y = nil~ - Inside source: true *** True Line Result - def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + state.y = nil +** Processing line: ~ state.dx = nil~ - Inside source: true *** True Line Result - lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + state.dx = nil +** Processing line: ~ state.dy = nil~ - Inside source: true *** True Line Result - lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + state.dy = nil +** Processing line: ~ state.stuff_score = 0~ - Inside source: true *** True Line Result - lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ end~ + state.stuff_score = 0 +** Processing line: ~ state.stuff_time = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.stuff_time = 0 +** Processing line: ~ state.intro_tick_count = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ + state.intro_tick_count = nil +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + defaults +** Processing line: ~ state.game_start_at = state.tick_count~ - Inside source: true *** True Line Result - lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + state.game_start_at = state.tick_count +** Processing line: ~ state.scene = :game~ - Inside source: true *** True Line Result - lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + state.scene = :game +** Processing line: ~ state.game_over_at = nil~ - Inside source: true *** True Line Result - lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ end~ + state.game_over_at = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ def render_intro~ - Inside source: true *** True Line Result - def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + def render_intro +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ - Inside source: true *** True Line Result - lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + outputs.labels << [640, 700, "Clepto Frog", 4, 1] +** Processing line: ~ if state.tick_count >= 120~ - Inside source: true *** True Line Result - lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + if state.tick_count >= 120 +** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ - Inside source: true *** True Line Result - lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ end~ + outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4, 1, 0, 0, 0, 255 * 120.ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + +** Processing line: ~ if state.tick_count >= 240~ - Inside source: true *** True Line Result - lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + if state.tick_count >= 240 +** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ - Inside source: true *** True Line Result - lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ - Inside source: true *** True Line Result - lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ end~ + 4, 1, 0, 0, 0, 255 * 240.ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -- Inside source: true -*** True Line Result - def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids -** Processing line: ~ lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ if state.tick_count >= 360~ - Inside source: true *** True Line Result - lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + if state.tick_count >= 360 +** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ - Inside source: true *** True Line Result - lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ + outputs.labels << [640, 540, "\"Uh...\" - New Guy", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ - Inside source: true *** True Line Result - lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -** Processing line: ~ end~ + 4, 1, 0, 0, 0, 255 * 360.ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []~ -- Inside source: true -*** True Line Result - def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] -** Processing line: ~ result_one_scene, result_one_label, result_one_text = context_result_one~ +** Processing line: ~ if state.tick_count >= 480~ - Inside source: true *** True Line Result - result_one_scene, result_one_label, result_one_text = context_result_one -** Processing line: ~ result_two_scene, result_two_label, result_two_text = context_result_two~ + if state.tick_count >= 480 +** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ - Inside source: true *** True Line Result - result_two_scene, result_two_label, result_two_text = context_result_two -** Processing line: ~ result_three_scene, result_three_label, result_three_text = context_result_three~ + outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ - Inside source: true *** True Line Result - result_three_scene, result_three_label, result_three_text = context_result_three -** Processing line: ~ result_four_scene, result_four_label, result_four_text = context_result_four~ + 4, 1, 0, 0, 0, 255 * 480.ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - result_four_scene, result_four_label, result_four_text = context_result_four + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ top_level_hash = {~ +** Processing line: ~ if state.tick_count >= 600~ - Inside source: true *** True Line Result - top_level_hash = { -** Processing line: ~ background: 'sprites/decision.png',~ + if state.tick_count >= 600 +** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ - Inside source: true *** True Line Result - background: 'sprites/decision.png', -** Processing line: ~ fade: 60,~ + outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [20, 36],~ + 4, 1, 0, 0, 0, 255 * 600.ease(60)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [20, 36], -** Processing line: ~ storylines: [ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - storylines: [ ], -** Processing line: ~ scenes: [ ]~ + +** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ - Inside source: true *** True Line Result - scenes: [ ] -** Processing line: ~ }~ + outputs.sprites << [640 - 50, 360 - 50, 100, 100, +** Processing line: ~ "sprites/square-green.png"]~ - Inside source: true *** True Line Result - } + "sprites/square-green.png"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ confirmation_result_one_hash = {~ +** Processing line: ~ if state.tick_count == 800~ - Inside source: true *** True Line Result - confirmation_result_one_hash = { -** Processing line: ~ background: 'sprites/decision.png',~ + if state.tick_count == 800 +** Processing line: ~ state.scene = :game~ - Inside source: true *** True Line Result - background: 'sprites/decision.png', -** Processing line: ~ scenes: [ ],~ + state.scene = :game +** Processing line: ~ state.game_start_at = state.tick_count~ - Inside source: true *** True Line Result - scenes: [ ], -** Processing line: ~ storylines: [ ]~ + state.game_start_at = state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - storylines: [ ] -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ confirmation_result_two_hash = {~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - confirmation_result_two_hash = { -** Processing line: ~ background: 'sprites/decision.png',~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - background: 'sprites/decision.png', -** Processing line: ~ scenes: [ ],~ + defaults +** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ - Inside source: true *** True Line Result - scenes: [ ], -** Processing line: ~ storylines: [ ]~ + if state.scene == :intro && state.tick_count <= 800 +** Processing line: ~ render_intro~ - Inside source: true *** True Line Result - storylines: [ ] -** Processing line: ~ }~ + render_intro +** Processing line: ~ elsif state.scene == :ending~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + elsif state.scene == :ending +** Processing line: ~ render_ending~ - Inside source: true *** True Line Result - -** Processing line: ~ confirmation_result_three_hash = {~ + render_ending +** Processing line: ~ else~ - Inside source: true *** True Line Result - confirmation_result_three_hash = { -** Processing line: ~ background: 'sprites/decision.png',~ + else +** Processing line: ~ render~ - Inside source: true *** True Line Result - background: 'sprites/decision.png', -** Processing line: ~ scenes: [ ],~ + render +** Processing line: ~ end~ - Inside source: true *** True Line Result - scenes: [ ], -** Processing line: ~ storylines: [ ]~ + end +** Processing line: ~ calc~ - Inside source: true *** True Line Result - storylines: [ ] -** Processing line: ~ }~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - } -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ confirmation_result_four_hash = {~ -- Inside source: true -*** True Line Result - confirmation_result_four_hash = { -** Processing line: ~ background: 'sprites/decision.png',~ + process_inputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/decision.png', -** Processing line: ~ scenes: [ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ ], -** Processing line: ~ storylines: [ ]~ + +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - storylines: [ ] -** Processing line: ~ }~ + def defaults +** Processing line: ~ state.scene ||= :intro~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + state.scene ||= :intro +** Processing line: ~ state.stuff_score ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]~ + state.stuff_score ||= 0 +** Processing line: ~ state.stuff_time ||= 0~ - Inside source: true *** True Line Result - top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] -** Processing line: ~ top_level_hash[:storylines] << [20, 35, 4, 4, context_action]~ + state.stuff_time ||= 0 +** Processing line: ~ state.stuff_best_time ||= nil~ - Inside source: true *** True Line Result - top_level_hash[:storylines] << [20, 35, 4, 4, context_action] -** Processing line: ~~ + state.stuff_best_time ||= nil +** Processing line: ~ state.camera_x ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ + state.camera_x ||= 0 +** Processing line: ~ state.camera_y ||= 0~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] -** Processing line: ~ confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene]~ + state.camera_y ||= 0 +** Processing line: ~ state.target_camera_scale ||= 1~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] -** Processing line: ~ confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]~ + state.target_camera_scale ||= 1 +** Processing line: ~ state.camera_scale ||= 1~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ + state.camera_scale ||= 1 +** Processing line: ~ state.tongue_length ||= 100~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ + state.tongue_length ||= 100 +** Processing line: ~ state.dev_action ||= :collision_mode~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ + state.dev_action ||= :collision_mode +** Processing line: ~ state.action ||= :aiming~ - Inside source: true *** True Line Result - confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] -** Processing line: ~~ + state.action ||= :aiming +** Processing line: ~ state.tongue_angle ||= 90~ - Inside source: true *** True Line Result - -** Processing line: ~ confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ + state.tongue_angle ||= 90 +** Processing line: ~ state.tile_size = 64~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ + state.tile_size = 64 +** Processing line: ~ state.gravity = -0.1~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ + state.gravity = -0.1 +** Processing line: ~ state.air = -0.01~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ + state.air = -0.01 +** Processing line: ~ state.player_width = 60~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene -** Processing line: ~ confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene]~ + state.player_width = 60 +** Processing line: ~ state.player_height = 60~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] -** Processing line: ~ confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]~ + state.player_height = 60 +** Processing line: ~ state.collision_tolerance = 0.0~ - Inside source: true *** True Line Result - confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] -** Processing line: ~~ + state.collision_tolerance = 0.0 +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ - Inside source: true *** True Line Result - -** Processing line: ~ confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ + state.previous_tile_size ||= state.tile_size +** Processing line: ~ state.x ||= 2400~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ + state.x ||= 2400 +** Processing line: ~ state.y ||= 200~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash]~ + state.y ||= 200 +** Processing line: ~ state.dy ||= 0~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] -** Processing line: ~ confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene]~ + state.dy ||= 0 +** Processing line: ~ state.dx ||= 0~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] -** Processing line: ~ confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]~ + state.dx ||= 0 +** Processing line: ~ attempt_load_world_from_file~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ + attempt_load_world_from_file +** Processing line: ~ state.world_lookup ||= { }~ - Inside source: true *** True Line Result - confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] -** Processing line: ~~ + state.world_lookup ||= { } +** Processing line: ~ state.world_collision_rects ||= []~ - Inside source: true *** True Line Result - -** Processing line: ~ confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ + state.world_collision_rects ||= [] +** Processing line: ~ state.mode ||= :creating~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ + state.mode ||= :creating +** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] -** Processing line: ~ confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene]~ + state.select_menu ||= [0, 720, 1280, 720] +** Processing line: ~ state.sprite_quantity ||= 20~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] -** Processing line: ~ confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]~ + state.sprite_quantity ||= 20 +** Processing line: ~ state.sprite_coords ||= []~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash]~ + state.sprite_coords ||= [] +** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ + state.banner_coords ||= [640, 680 + 720] +** Processing line: ~ state.sprite_selected ||= 1~ - Inside source: true *** True Line Result - confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] -** Processing line: ~~ + state.sprite_selected ||= 1 +** Processing line: ~ state.map_saved_at ||= 0~ - Inside source: true *** True Line Result - -** Processing line: ~ top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ + state.map_saved_at ||= 0 +** Processing line: ~ state.intro_tick_count ||= state.tick_count~ - Inside source: true *** True Line Result - top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] -** Processing line: ~ top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ + state.intro_tick_count ||= state.tick_count +** Processing line: ~ if state.sprite_coords == []~ - Inside source: true *** True Line Result - top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene -** Processing line: ~ top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ + if state.sprite_coords == [] +** Processing line: ~ count = 1~ - Inside source: true *** True Line Result - top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene -** Processing line: ~ top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ + count = 1 +** Processing line: ~ temp_x = 165~ - Inside source: true *** True Line Result - top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] -** Processing line: ~~ + temp_x = 165 +** Processing line: ~ temp_y = 500 + 720~ - Inside source: true *** True Line Result - -** Processing line: ~ top_level_hash~ + temp_y = 500 + 720 +** Processing line: ~ state.sprite_quantity.times do~ - Inside source: true *** True Line Result - top_level_hash -** Processing line: ~ end~ + state.sprite_quantity.times do +** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.sprite_coords += [[temp_x, temp_y, count]] +** Processing line: ~ temp_x += 100~ - Inside source: true *** True Line Result - -** Processing line: ~ def ship_control_hotspot offset_x, offset_y, a, b, c, d~ + temp_x += 100 +** Processing line: ~ count += 1~ - Inside source: true *** True Line Result - def ship_control_hotspot offset_x, offset_y, a, b, c, d -** Processing line: ~ results = []~ + count += 1 +** Processing line: ~ if temp_x > 1280 - (165 + 50)~ - Inside source: true *** True Line Result - results = [] -** Processing line: ~ results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a~ + if temp_x > 1280 - (165 + 50) +** Processing line: ~ temp_x = 165~ - Inside source: true *** True Line Result - results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a -** Processing line: ~ results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b~ + temp_x = 165 +** Processing line: ~ temp_y -= 75~ - Inside source: true *** True Line Result - results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b -** Processing line: ~ results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c~ + temp_y -= 75 +** Processing line: ~ end~ - Inside source: true *** True Line Result - results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c -** Processing line: ~ results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d -** Processing line: ~ results~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - results -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def reload_current_scene~ +** Processing line: ~ def start_of_tongue x = nil, y = nil~ - Inside source: true *** True Line Result - def reload_current_scene -** Processing line: ~ if $gtk.args.state.last_hotspot_scene~ + def start_of_tongue x = nil, y = nil +** Processing line: ~ x ||= state.x~ - Inside source: true *** True Line Result - if $gtk.args.state.last_hotspot_scene -** Processing line: ~ set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)~ + x ||= state.x +** Processing line: ~ y ||= state.y~ - Inside source: true *** True Line Result - set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) -** Processing line: ~ tick $gtk.args~ + y ||= state.y +** Processing line: ~ [~ - Inside source: true *** True Line Result - tick $gtk.args -** Processing line: ~ elsif respond_to? :set_scene~ + [ +** Processing line: ~ x + state.player_width.half,~ - Inside source: true *** True Line Result - elsif respond_to? :set_scene -** Processing line: ~ set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)~ + x + state.player_width.half, +** Processing line: ~ y + state.player_height.half~ - Inside source: true *** True Line Result - set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) -** Processing line: ~ tick $gtk.args~ + y + state.player_height.half +** Processing line: ~ ]~ - Inside source: true *** True Line Result - tick $gtk.args + ] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ $gtk.console.close~ -- Inside source: true -*** True Line Result - $gtk.console.close -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def anka_inside_room args~ +** Processing line: ~ def stage_definition~ - Inside source: true *** True Line Result - def anka_inside_room args -** Processing line: ~ {~ + def stage_definition +** Processing line: ~ outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-home.png',~ + outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 35],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - player: [34, 35], -** Processing line: ~ storylines: [~ + +** Processing line: ~ def render~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],~ + def render +** Processing line: ~ stage_definition~ - Inside source: true *** True Line Result - [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], -** Processing line: ~ ],~ + stage_definition +** Processing line: ~ start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)] +** Processing line: ~ end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, -1, 8, 3, :anka_observatory]~ + end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)] +** Processing line: ~~ - Inside source: true *** True Line Result - [32, -1, 8, 3, :anka_observatory] -** Processing line: ~ ]~ + +** Processing line: ~ if state.anchor_point~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + if state.anchor_point +** Processing line: ~ anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)] +** Processing line: ~ outputs.sprites << { x: start_of_tongue_render.x,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.sprites << { x: start_of_tongue_render.x, +** Processing line: ~ y: start_of_tongue_render.y,~ - Inside source: true *** True Line Result - -** Processing line: ~ def anka_observatory args~ + y: start_of_tongue_render.y, +** Processing line: ~ w: vw(2),~ - Inside source: true *** True Line Result - def anka_observatory args -** Processing line: ~ {~ + w: vw(2), +** Processing line: ~ h: args.geometry.distance(start_of_tongue_render, anchor_point_render),~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + h: args.geometry.distance(start_of_tongue_render, anchor_point_render), +** Processing line: ~ path: 'sprites/square-pink.png',~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + path: 'sprites/square-pink.png', +** Processing line: ~ angle_anchor_y: 0,~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [51, 12],~ + angle_anchor_y: 0, +** Processing line: ~ angle: state.tongue_angle - 90 }~ - Inside source: true *** True Line Result - player: [51, 12], -** Processing line: ~ storylines: [~ + angle: state.tongue_angle - 90 } +** Processing line: ~ else~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ + else +** Processing line: ~ outputs.sprites << { x: vx(start_of_tongue.x),~ - Inside source: true *** True Line Result - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] -** Processing line: ~ ],~ + outputs.sprites << { x: vx(start_of_tongue.x), +** Processing line: ~ y: vy(start_of_tongue.y),~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + y: vy(start_of_tongue.y), +** Processing line: ~ w: vw(2),~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :anka_inside_mainframe]~ + w: vw(2), +** Processing line: ~ h: vh(state.tongue_length),~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :anka_inside_mainframe] -** Processing line: ~ ],~ + h: vh(state.tongue_length), +** Processing line: ~ path: 'sprites/square-pink.png',~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + path: 'sprites/square-pink.png', +** Processing line: ~ angle_anchor_y: 0,~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + angle_anchor_y: 0, +** Processing line: ~ angle: state.tongue_angle - 90 }~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + angle: state.tongue_angle - 90 } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def anka_inside_mainframe args~ -- Inside source: true -*** True Line Result - def anka_inside_mainframe args -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ player: [32, 4],~ +** Processing line: ~ outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }~ - Inside source: true *** True Line Result - player: [32, 4], -** Processing line: ~ background: 'sprites/mainframe.png',~ + outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] } +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ fade: 60,~ + +** Processing line: ~ if state.god_mode~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ storylines: [~ + if state.god_mode +** Processing line: ~ # SHOW HIDE COLLISIONS~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 45, 17, 4, (anka_last_reply args)],~ + # SHOW HIDE COLLISIONS +** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ - Inside source: true *** True Line Result - [22, 45, 17, 4, (anka_last_reply args)], -** Processing line: ~ [45, 45, 4, 4, (anka_current_reply args)],~ + outputs.sprites << state.world.map do |x, y, w, h| +** Processing line: ~ x = vx(x)~ - Inside source: true *** True Line Result - [45, 45, 4, 4, (anka_current_reply args)], -** Processing line: ~ ],~ + x = vx(x) +** Processing line: ~ y = vy(y)~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + y = vy(y) +** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_top_right, :reply_to_anka]~ + if x > -80 && x < 1280 && y > -80 && y < 720 +** Processing line: ~ {~ - Inside source: true *** True Line Result - [*hotspot_top_right, :reply_to_anka] -** Processing line: ~ ]~ + { +** Processing line: ~ x: x,~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + x: x, +** Processing line: ~ y: y,~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + y: y, +** Processing line: ~ w: vw(w || state.tile_size),~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + w: vw(w || state.tile_size), +** Processing line: ~ h: vh(h || state.tile_size),~ - Inside source: true *** True Line Result - -** Processing line: ~ def reply_to_anka args~ + h: vh(h || state.tile_size), +** Processing line: ~ path: 'sprites/square-gray.png',~ - Inside source: true *** True Line Result - def reply_to_anka args -** Processing line: ~ decision_graph anka_current_reply(args),~ + path: 'sprites/square-gray.png', +** Processing line: ~ a: 128~ - Inside source: true *** True Line Result - decision_graph anka_current_reply(args), -** Processing line: ~ "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",~ + a: 128 +** Processing line: ~ }~ - Inside source: true *** True Line Result - "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", -** Processing line: ~ [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], -** Processing line: ~ [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def anka_last_reply args~ +** Processing line: ~ render_player~ - Inside source: true *** True Line Result - def anka_last_reply args -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ + render_player +** Processing line: ~ outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_to_serenity_alive_firmly -** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ + outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40] +** Processing line: ~~ - Inside source: true *** True Line Result - return "Buffer--: #{serenity_alive_firm_reply.quote}" -** Processing line: ~ else~ + +** Processing line: ~ # Label in top left of the screen~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ + # Label in top left of the screen +** Processing line: ~ outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid~ - Inside source: true *** True Line Result - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" -** Processing line: ~ end~ + outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid +** Processing line: ~ outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label +** Processing line: ~ outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label~ - Inside source: true *** True Line Result - end + outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def anka_reply_whole_truth~ +** Processing line: ~ if state.god_mode~ - Inside source: true *** True Line Result - def anka_reply_whole_truth -** Processing line: ~ "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."~ + if state.god_mode +** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ - Inside source: true *** True Line Result - "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." -** Processing line: ~ end~ + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 +** Processing line: ~ outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label~ - Inside source: true *** True Line Result - end + outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def anka_reply_half_truth~ +** Processing line: ~~ - Inside source: true *** True Line Result - def anka_reply_half_truth -** Processing line: ~ "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."~ + +** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ - Inside source: true *** True Line Result - "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." -** Processing line: ~ end~ + # Creates sprite following mouse to help indicate which sprite you have selected +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ - Inside source: true *** True Line Result - end + outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, +** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ +- Inside source: true +*** True Line Result + state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def replied_with_whole_truth args~ +** Processing line: ~ render_mini_map~ - Inside source: true *** True Line Result - def replied_with_whole_truth args -** Processing line: ~ {~ + render_mini_map +** Processing line: ~ outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + +** Processing line: ~ def render_mini_map~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ + def render_mini_map +** Processing line: ~ x, y = 1170, 10~ - Inside source: true *** True Line Result - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], -** Processing line: ~ storylines: [~ + x, y = 1170, 10 +** Processing line: ~ outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],~ + outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid +** Processing line: ~ outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], -** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],~ + outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid +** Processing line: ~ t_start = start_of_tongue~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], -** Processing line: ~ ]~ + t_start = start_of_tongue +** Processing line: ~ t_end = end_of_tongue~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + t_end = end_of_tongue +** Processing line: ~ outputs.primitives << [~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + outputs.primitives << [ +** Processing line: ~ x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + x + t_start.x.fdiv(100), y + t_start.y.fdiv(100), +** Processing line: ~ x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_with_half_truth args~ + x + t_end.x.fdiv(100), y + t_end.y.fdiv(100), +** Processing line: ~ 255, 255, 255~ - Inside source: true *** True Line Result - def replied_with_half_truth args -** Processing line: ~ {~ + 255, 255, 255 +** Processing line: ~ ].line~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + ].line +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + +** Processing line: ~ state.objects.each do |o|~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + state.objects.each do |o| +** Processing line: ~ outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ + outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid +** Processing line: ~ end~ - Inside source: true *** True Line Result - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], -** Processing line: ~ storylines: [~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], -** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],~ + +** Processing line: ~ def calc_camera percentage_override = nil~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], -** Processing line: ~ ]~ + def calc_camera percentage_override = nil +** Processing line: ~ percentage = percentage_override || (0.2 * state.camera_scale)~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + percentage = percentage_override || (0.2 * state.camera_scale) +** Processing line: ~ target_scale = state.target_camera_scale~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + target_scale = state.target_camera_scale +** Processing line: ~ distance_scale = target_scale - state.camera_scale~ - Inside source: true *** True Line Result - end + distance_scale = target_scale - state.camera_scale +** Processing line: ~ state.camera_scale += distance_scale * percentage~ +- Inside source: true +*** True Line Result + state.camera_scale += distance_scale * percentage ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def anka_current_reply args~ +** Processing line: ~ target_x = state.x * state.target_camera_scale~ - Inside source: true *** True Line Result - def anka_current_reply args -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ + target_x = state.x * state.target_camera_scale +** Processing line: ~ target_y = state.y * state.target_camera_scale~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_to_serenity_alive_firmly -** Processing line: ~ return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ + target_y = state.y * state.target_camera_scale +** Processing line: ~~ - Inside source: true *** True Line Result - return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." -** Processing line: ~ else~ + +** Processing line: ~ distance_x = target_x - (state.camera_x + 640)~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ + distance_x = target_x - (state.camera_x + 640) +** Processing line: ~ distance_y = target_y - (state.camera_y + 360)~ - Inside source: true *** True Line Result - return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." -** Processing line: ~ end~ + distance_y = target_y - (state.camera_y + 360) +** Processing line: ~ state.camera_x += distance_x * percentage if distance_x.abs > 1~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.camera_x += distance_x * percentage if distance_x.abs > 1 +** Processing line: ~ state.camera_y += distance_y * percentage if distance_y.abs > 1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.camera_y += distance_y * percentage if distance_y.abs > 1 +** Processing line: ~ state.camera_x = 0 if state.camera_x < 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_anka_back_home args~ + state.camera_x = 0 if state.camera_x < 0 +** Processing line: ~ state.camera_y = 0 if state.camera_y < 0~ - Inside source: true *** True Line Result - def replied_to_anka_back_home args -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ + state.camera_y = 0 if state.camera_y < 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_with_whole_truth -** Processing line: ~ return {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return { -** Processing line: ~ fade: 60,~ + +** Processing line: ~ def vx x~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + def vx x +** Processing line: ~ (x * state.camera_scale) - state.camera_x~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 4],~ + (x * state.camera_scale) - state.camera_x +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [34, 4], -** Processing line: ~ storylines: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],~ + +** Processing line: ~ def vy y~ - Inside source: true *** True Line Result - [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], -** Processing line: ~ ],~ + def vy y +** Processing line: ~ (y * state.camera_scale) - state.camera_y~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + (y * state.camera_scale) - state.camera_y +** Processing line: ~ end~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 38, 12, 13, :final_message_sad],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [30, 38, 12, 13, :final_message_sad], -** Processing line: ~ ]~ + +** Processing line: ~ def vw w~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + def vw w +** Processing line: ~ w * state.camera_scale~ - Inside source: true *** True Line Result - } -** Processing line: ~ else~ + w * state.camera_scale +** Processing line: ~ end~ - Inside source: true *** True Line Result - else -** Processing line: ~ return {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return { -** Processing line: ~ fade: 60,~ + +** Processing line: ~ def vh h~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + def vh h +** Processing line: ~ h * state.camera_scale~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 4],~ + h * state.camera_scale +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [34, 4], -** Processing line: ~ storylines: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],~ + +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], -** Processing line: ~ ],~ + def calc +** Processing line: ~ calc_camera~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + calc_camera +** Processing line: ~ calc_world_lookup~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 38, 12, 13, :final_message_happy],~ + calc_world_lookup +** Processing line: ~ calc_player~ - Inside source: true *** True Line Result - [30, 38, 12, 13, :final_message_happy], -** Processing line: ~ ]~ + calc_player +** Processing line: ~ calc_on_floor~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + calc_on_floor +** Processing line: ~ calc_score~ - Inside source: true *** True Line Result - } + calc_score ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - +** Processing line: ~ def set_camera_scale v = nil~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def the_blinking_light args~ + def set_camera_scale v = nil +** Processing line: ~ return if v < 0.1~ - Inside source: true *** True Line Result - def the_blinking_light args -** Processing line: ~ {~ + return if v < 0.1 +** Processing line: ~ state.target_camera_scale = v~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + state.target_camera_scale = v +** Processing line: ~ end~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/side-of-home.png',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [16, 13],~ + +** Processing line: ~ def process_inputs_god_mode~ - Inside source: true *** True Line Result - player: [16, 13], -** Processing line: ~ scenes: [~ + def process_inputs_god_mode +** Processing line: ~ return unless state.god_mode~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [52, 24, 11, 5, :blinking_light_mountain_pass],~ + return unless state.god_mode +** Processing line: ~~ - Inside source: true *** True Line Result - [52, 24, 11, 5, :blinking_light_mountain_pass], -** Processing line: ~ ],~ + +** Processing line: ~ if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ + if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10)) +** Processing line: ~ set_camera_scale state.camera_scale + 0.1~ - Inside source: true *** True Line Result - render_override: :blinking_light_side_of_home_render -** Processing line: ~ }~ + set_camera_scale state.camera_scale + 0.1 +** Processing line: ~ elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10)) +** Processing line: ~ set_camera_scale state.camera_scale - 0.1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + set_camera_scale state.camera_scale - 0.1 +** Processing line: ~ elsif inputs.keyboard.eight || inputs.keyboard.zero~ - Inside source: true *** True Line Result - -** Processing line: ~ def blinking_light_mountain_pass args~ + elsif inputs.keyboard.eight || inputs.keyboard.zero +** Processing line: ~ set_camera_scale 1~ - Inside source: true *** True Line Result - def blinking_light_mountain_pass args -** Processing line: ~ {~ + set_camera_scale 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/mountain-pass-zoomed-out.png', -** Processing line: ~ player: [4, 4],~ + +** Processing line: ~ if input_up?~ - Inside source: true *** True Line Result - player: [4, 4], -** Processing line: ~ scenes: [~ + if input_up? +** Processing line: ~ state.y += 10~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [18, 47, 5, 5, :blinking_light_path_to_observatory]~ + state.y += 10 +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - [18, 47, 5, 5, :blinking_light_path_to_observatory] -** Processing line: ~ ],~ + state.dy = 0 +** Processing line: ~ elsif input_down?~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ + elsif input_down? +** Processing line: ~ state.y -= 10~ - Inside source: true *** True Line Result - render_override: :blinking_light_mountain_pass_render -** Processing line: ~ }~ + state.y -= 10 +** Processing line: ~ state.dy = 0~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.dy = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blinking_light_path_to_observatory args~ +** Processing line: ~ if input_left?~ - Inside source: true *** True Line Result - def blinking_light_path_to_observatory args -** Processing line: ~ {~ + if input_left? +** Processing line: ~ state.x -= 10~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ + state.x -= 10 +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [60, 4],~ + state.dx = 0 +** Processing line: ~ elsif input_right?~ - Inside source: true *** True Line Result - player: [60, 4], -** Processing line: ~ scenes: [~ + elsif input_right? +** Processing line: ~ state.x += 10~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 26, 5, 5, :blinking_light_observatory]~ + state.x += 10 +** Processing line: ~ state.dx = 0~ - Inside source: true *** True Line Result - [0, 26, 5, 5, :blinking_light_observatory] -** Processing line: ~ ],~ + state.dx = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_path_to_observatory_render -** Processing line: ~ }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def process_inputs +** Processing line: ~ if state.scene == :game~ - Inside source: true *** True Line Result - -** Processing line: ~ def blinking_light_observatory args~ + if state.scene == :game +** Processing line: ~ process_inputs_player_movement~ - Inside source: true *** True Line Result - def blinking_light_observatory args -** Processing line: ~ {~ + process_inputs_player_movement +** Processing line: ~ process_inputs_god_mode~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/observatory.png',~ + process_inputs_god_mode +** Processing line: ~ elsif state.scene == :intro~ - Inside source: true *** True Line Result - background: 'sprites/observatory.png', -** Processing line: ~ player: [60, 2],~ + elsif state.scene == :intro +** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ scenes: [~ + if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space +** Processing line: ~ if Kernel.tick_count < 600~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [28, 39, 4, 10, :blinking_light_inside_observatory]~ + if Kernel.tick_count < 600 +** Processing line: ~ Kernel.tick_count = 600~ - Inside source: true *** True Line Result - [28, 39, 4, 10, :blinking_light_inside_observatory] -** Processing line: ~ ],~ + Kernel.tick_count = 600 +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_observatory_render~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_observatory_render -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blinking_light_inside_observatory args~ +** Processing line: ~ def input_up?~ - Inside source: true *** True Line Result - def blinking_light_inside_observatory args -** Processing line: ~ {~ + def input_up? +** Processing line: ~ inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ player: [60, 2],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ storylines: [~ + +** Processing line: ~ def input_up_released?~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."]~ + def input_up_released? +** Processing line: ~ inputs.keyboard.key_up.w ||~ - Inside source: true *** True Line Result - [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] -** Processing line: ~ ],~ + inputs.keyboard.key_up.w || +** Processing line: ~ inputs.keyboard.key_up.up ||~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + inputs.keyboard.key_up.up || +** Processing line: ~ inputs.keyboard.key_up.k~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :blinking_light_inside_mainframe]~ + inputs.keyboard.key_up.k +** Processing line: ~ end~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :blinking_light_inside_mainframe] -** Processing line: ~ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + +** Processing line: ~ def input_down?~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + def input_down? +** Processing line: ~ inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blinking_light_inside_mainframe args~ +** Processing line: ~ def input_down_released?~ - Inside source: true *** True Line Result - def blinking_light_inside_mainframe args -** Processing line: ~ {~ + def input_down_released? +** Processing line: ~ inputs.keyboard.key_up.s ||~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mainframe.png',~ + inputs.keyboard.key_up.s || +** Processing line: ~ inputs.keyboard.key_up.down ||~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ fade: 60,~ + inputs.keyboard.key_up.down || +** Processing line: ~ inputs.keyboard.key_up.j~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 4],~ + inputs.keyboard.key_up.j +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [30, 4], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [62, 32, 4, 32, :reply_to_introduction]~ + +** Processing line: ~ def input_left?~ - Inside source: true *** True Line Result - [62, 32, 4, 32, :reply_to_introduction] -** Processing line: ~ ],~ + def input_left? +** Processing line: ~ inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h +** Processing line: ~ end~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], -** Processing line: ~ [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],~ + +** Processing line: ~ def input_right?~ - Inside source: true *** True Line Result - [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], -** Processing line: ~ [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],~ + def input_right? +** Processing line: ~ inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l~ - Inside source: true *** True Line Result - [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], -** Processing line: ~ [14, 20, 24, 4, "What the heck activated--- this thing- though?"]~ + inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l +** Processing line: ~ end~ - Inside source: true *** True Line Result - [14, 20, 24, 4, "What the heck activated--- this thing- though?"] -** Processing line: ~ ]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + +** Processing line: ~ def set_object path, w, h~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + def set_object path, w, h +** Processing line: ~ state.object = path~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.object = path +** Processing line: ~ state.object_w = w~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def day_one_beginning args~ + state.object_w = w +** Processing line: ~ state.object_h = h~ - Inside source: true *** True Line Result - def day_one_beginning args -** Processing line: ~ {~ + state.object_h = h +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/side-of-home.png',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [16, 13],~ + +** Processing line: ~ def collision_mode~ - Inside source: true *** True Line Result - player: [16, 13], -** Processing line: ~ scenes: [~ + def collision_mode +** Processing line: ~ state.dev_action = :collision_mode~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 0, 64, 2, :day_one_infront_of_home],~ + state.dev_action = :collision_mode +** Processing line: ~ end~ - Inside source: true *** True Line Result - [0, 0, 64, 2, :day_one_infront_of_home], -** Processing line: ~ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + +** Processing line: ~ def process_inputs_player_movement~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]~ + def process_inputs_player_movement +** Processing line: ~ if inputs.keyboard.key_down.g~ - Inside source: true *** True Line Result - [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] -** Processing line: ~ ]~ + if inputs.keyboard.key_down.g +** Processing line: ~ state.god_mode = !state.god_mode~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.god_mode = !state.god_mode +** Processing line: ~ puts state.god_mode~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + puts state.god_mode +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def day_one_infront_of_home args~ +** Processing line: ~ if inputs.keyboard.key_down.u && state.dev_action == :collision_mode~ - Inside source: true *** True Line Result - def day_one_infront_of_home args -** Processing line: ~ {~ + if inputs.keyboard.key_down.u && state.dev_action == :collision_mode +** Processing line: ~ state.world = state.world[0..-2]~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/front-of-home.png',~ + state.world = state.world[0..-2] +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - background: 'sprites/front-of-home.png', -** Processing line: ~ player: [56, 23],~ + state.world_lookup = {} +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [56, 23], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [43, 34, 10, 16, :day_one_home],~ + +** Processing line: ~ if inputs.keyboard.key_down.space && !state.anchor_point~ - Inside source: true *** True Line Result - [43, 34, 10, 16, :day_one_home], -** Processing line: ~ [62, 0, 3, 40, :day_one_beginning],~ + if inputs.keyboard.key_down.space && !state.anchor_point +** Processing line: ~ state.tongue_length = 0~ - Inside source: true *** True Line Result - [62, 0, 3, 40, :day_one_beginning], -** Processing line: ~ [0, 4, 3, 20, :day_one_ceremony]~ + state.tongue_length = 0 +** Processing line: ~ state.action = :shooting~ - Inside source: true *** True Line Result - [0, 4, 3, 20, :day_one_ceremony] -** Processing line: ~ ],~ + state.action = :shooting +** Processing line: ~ outputs.sounds << 'sounds/shooting.wav'~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + outputs.sounds << 'sounds/shooting.wav' +** Processing line: ~ elsif inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],~ + elsif inputs.keyboard.key_down.space +** Processing line: ~ state.action = :aiming~ - Inside source: true *** True Line Result - [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], -** Processing line: ~ ]~ + state.action = :aiming +** Processing line: ~ state.anchor_point = nil~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.anchor_point = nil +** Processing line: ~ state.tongue_length = 100~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.tongue_length = 100 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def day_one_home args~ +** Processing line: ~ if state.anchor_point~ - Inside source: true *** True Line Result - def day_one_home args -** Processing line: ~ {~ + if state.anchor_point +** Processing line: ~ if input_up?~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-home.png',~ + if input_up? +** Processing line: ~ if state.tongue_length >= 105~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 3],~ + if state.tongue_length >= 105 +** Processing line: ~ state.tongue_length -= 5~ - Inside source: true *** True Line Result - player: [34, 3], -** Processing line: ~ scenes: [~ + state.tongue_length -= 5 +** Processing line: ~ state.dy += 0.8~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [28, 0, 12, 2, :day_one_infront_of_home]~ + state.dy += 0.8 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [28, 0, 12, 2, :day_one_infront_of_home] -** Processing line: ~ ],~ + end +** Processing line: ~ elsif input_down?~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + elsif input_down? +** Processing line: ~ state.tongue_length += 5~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [~ + state.tongue_length += 5 +** Processing line: ~ state.dy -= 0.8~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."~ + state.dy -= 0.8 +** Processing line: ~ end~ - Inside source: true *** True Line Result - 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." -** Processing line: ~ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [~ + +** Processing line: ~ if input_left? && state.dx > 1~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 28, 7, 4, 7,~ + if input_left? && state.dx > 1 +** Processing line: ~ state.dx *= 0.98~ - Inside source: true *** True Line Result - 28, 7, 4, 7, -** Processing line: ~ "Ahhh. My reading- couch. It's so comfortable--."~ + state.dx *= 0.98 +** Processing line: ~ elsif input_left? && state.dx < -1~ - Inside source: true *** True Line Result - "Ahhh. My reading- couch. It's so comfortable--." -** Processing line: ~ ],~ + elsif input_left? && state.dx < -1 +** Processing line: ~ state.dx *= 1.03~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [~ + state.dx *= 1.03 +** Processing line: ~ elsif input_left? && !state.on_floor~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 38, 21, 4, 4,~ + elsif input_left? && !state.on_floor +** Processing line: ~ state.dx -= 3~ - Inside source: true *** True Line Result - 38, 21, 4, 4, -** Processing line: ~ "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."~ + state.dx -= 3 +** Processing line: ~ elsif input_right? && state.dx > 1~ - Inside source: true *** True Line Result - "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." -** Processing line: ~ ],~ + elsif input_right? && state.dx > 1 +** Processing line: ~ state.dx *= 1.03~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [~ + state.dx *= 1.03 +** Processing line: ~ elsif input_right? && state.dx < -1~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 45, 37, 4, 8,~ + elsif input_right? && state.dx < -1 +** Processing line: ~ state.dx *= 0.98~ - Inside source: true *** True Line Result - 45, 37, 4, 8, -** Processing line: ~ "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."~ + state.dx *= 0.98 +** Processing line: ~ elsif input_right? && !state.on_floor~ - Inside source: true *** True Line Result - "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." -** Processing line: ~ ],~ + elsif input_right? && !state.on_floor +** Processing line: ~ state.dx += 3~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [~ + state.dx += 3 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 32, 40, 8, 10,~ + end +** Processing line: ~ else~ - Inside source: true *** True Line Result - 32, 40, 8, 10, -** Processing line: ~ "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."~ + else +** Processing line: ~ if input_left?~ - Inside source: true *** True Line Result - "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." -** Processing line: ~ ],~ + if input_left? +** Processing line: ~ state.tongue_angle += 1.5~ - Inside source: true *** True Line Result - ], -** Processing line: ~ [~ + state.tongue_angle += 1.5 +** Processing line: ~ state.tongue_angle = state.tongue_angle~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 25, 21, 5, 12,~ + state.tongue_angle = state.tongue_angle +** Processing line: ~ elsif input_right?~ - Inside source: true *** True Line Result - 25, 21, 5, 12, -** Processing line: ~ "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."~ + elsif input_right? +** Processing line: ~ state.tongue_angle -= 1.5~ - Inside source: true *** True Line Result - "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." -** Processing line: ~ ]~ + state.tongue_angle -= 1.5 +** Processing line: ~ state.tongue_angle = state.tongue_angle~ - Inside source: true *** True Line Result - ] -** Processing line: ~ ]~ + state.tongue_angle = state.tongue_angle +** Processing line: ~ end~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def day_one_ceremony args~ +** Processing line: ~ def add_floors~ - Inside source: true *** True Line Result - def day_one_ceremony args -** Processing line: ~ {~ + def add_floors +** Processing line: ~ # floors~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/tribute.png',~ + # floors +** Processing line: ~ state.world += [~ - Inside source: true *** True Line Result - background: 'sprites/tribute.png', -** Processing line: ~ player: [57, 21],~ + state.world += [ +** Processing line: ~ [0, 0, 10000, 40],~ - Inside source: true *** True Line Result - player: [57, 21], -** Processing line: ~ scenes: [~ + [0, 0, 10000, 40], +** Processing line: ~ [0, 1670, 3250, 60],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [62, 0, 2, 40, :day_one_infront_of_home],~ + [0, 1670, 3250, 60], +** Processing line: ~ [6691, 1653, 3290, 60],~ - Inside source: true *** True Line Result - [62, 0, 2, 40, :day_one_infront_of_home], -** Processing line: ~ [0, 24, 2, 40, :day_one_infront_of_library]~ + [6691, 1653, 3290, 60], +** Processing line: ~ [1521, 3792, 7370, 60],~ - Inside source: true *** True Line Result - [0, 24, 2, 40, :day_one_infront_of_library] -** Processing line: ~ ],~ + [1521, 3792, 7370, 60], +** Processing line: ~ [0, 5137, 3290, 60]~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [0, 5137, 3290, 60] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], -** Processing line: ~ [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], -** Processing line: ~ [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],~ + +** Processing line: ~ def attempt_load_world_from_file~ - Inside source: true *** True Line Result - [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], -** Processing line: ~ [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],~ + def attempt_load_world_from_file +** Processing line: ~ return if state.world~ - Inside source: true *** True Line Result - [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], -** Processing line: ~ ]~ + return if state.world +** Processing line: ~ # exported_world = gtk.read_file(MAP_FILE_PATH)~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + # exported_world = gtk.read_file(MAP_FILE_PATH) +** Processing line: ~ state.world = []~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.world = [] +** Processing line: ~ state.objects = []~ - Inside source: true *** True Line Result - end + state.objects = [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def day_one_infront_of_library args~ +** Processing line: ~ if $collisions~ - Inside source: true *** True Line Result - def day_one_infront_of_library args -** Processing line: ~ {~ + if $collisions +** Processing line: ~ $collisions.map do |x, y, w, h|~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/outside-library.png',~ + $collisions.map do |x, y, w, h| +** Processing line: ~ state.world << [x, y, w, h]~ - Inside source: true *** True Line Result - background: 'sprites/outside-library.png', -** Processing line: ~ player: [57, 21],~ + state.world << [x, y, w, h] +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [57, 21], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [62, 0, 2, 40, :day_one_ceremony],~ + +** Processing line: ~ add_floors~ - Inside source: true *** True Line Result - [62, 0, 2, 40, :day_one_ceremony], -** Processing line: ~ [49, 39, 6, 9, :day_one_library]~ + add_floors +** Processing line: ~ # elsif exported_world~ - Inside source: true *** True Line Result - [49, 39, 6, 9, :day_one_library] -** Processing line: ~ ],~ + # elsif exported_world +** Processing line: ~ # exported_world.each_line.map do |l|~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + # exported_world.each_line.map do |l| +** Processing line: ~ # tokens = l.strip.split(',')~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]~ + # tokens = l.strip.split(',') +** Processing line: ~ # x = tokens[0].to_i~ - Inside source: true *** True Line Result - [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] -** Processing line: ~ ]~ + # x = tokens[0].to_i +** Processing line: ~ # y = tokens[1].to_i~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + # y = tokens[1].to_i +** Processing line: ~ # type = tokens[2].to_i~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + # type = tokens[2].to_i +** Processing line: ~ # if type == 1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # if type == 1 +** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - -** Processing line: ~ def day_one_library args~ + # state.world << [x, y, state.tile_size, state.tile_size] +** Processing line: ~ # elsif type == 2~ - Inside source: true *** True Line Result - def day_one_library args -** Processing line: ~ {~ + # elsif type == 2 +** Processing line: ~ # w, h, path = tokens[3..-1]~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/library.png',~ + # w, h, path = tokens[3..-1] +** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ - Inside source: true *** True Line Result - background: 'sprites/library.png', -** Processing line: ~ player: [27, 4],~ + # state.objects << [x, y, w.to_i, h.to_i, path] +** Processing line: ~ # end~ - Inside source: true *** True Line Result - player: [27, 4], -** Processing line: ~ scenes: [~ + # end +** Processing line: ~ # end~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 0, 64, 2, :end_day_one_infront_of_library]~ + # end +** Processing line: ~~ - Inside source: true *** True Line Result - [0, 0, 64, 2, :end_day_one_infront_of_library] -** Processing line: ~ ],~ + +** Processing line: ~ # add_floors~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + # add_floors +** Processing line: ~ end~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], -** Processing line: ~ [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]~ + +** Processing line: ~ if $mugs~ - Inside source: true *** True Line Result - [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] -** Processing line: ~ ]~ + if $mugs +** Processing line: ~ $mugs.map do |x, y, w, h, path|~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + $mugs.map do |x, y, w, h, path| +** Processing line: ~ state.objects << [x, y, w, h, path]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.objects << [x, y, w, h, path] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def end_day_one_infront_of_library args~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def end_day_one_infront_of_library args -** Processing line: ~ {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/outside-library.png',~ + +** Processing line: ~ def calc_world_lookup~ - Inside source: true *** True Line Result - background: 'sprites/outside-library.png', -** Processing line: ~ player: [51, 33],~ + def calc_world_lookup +** Processing line: ~ if state.tile_size != state.previous_tile_size~ - Inside source: true *** True Line Result - player: [51, 33], -** Processing line: ~ scenes: [~ + if state.tile_size != state.previous_tile_size +** Processing line: ~ state.previous_tile_size = state.tile_size~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [49, 39, 6, 9, :day_one_library],~ + state.previous_tile_size = state.tile_size +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - [49, 39, 6, 9, :day_one_library], -** Processing line: ~ [62, 0, 2, 40, :end_day_one_monument],~ + state.world_lookup = {} +** Processing line: ~ end~ - Inside source: true *** True Line Result - [62, 0, 2, 40, :end_day_one_monument], -** Processing line: ~ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + +** Processing line: ~ return if state.world_lookup.keys.length > 0~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."]~ + return if state.world_lookup.keys.length > 0 +** Processing line: ~ return unless state.world.length > 0~ - Inside source: true *** True Line Result - [50, 27, 4, 4, "It's getting late. Better get some sleep."] -** Processing line: ~ ]~ + return unless state.world.length > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + +** Processing line: ~ # Searches through the world and finds the cordinates that exist~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + # Searches through the world and finds the cordinates that exist +** Processing line: ~ state.world_lookup = {}~ - Inside source: true *** True Line Result - end + state.world_lookup = {} +** Processing line: ~ state.world.each do |x, y, w, h|~ +- Inside source: true +*** True Line Result + state.world.each do |x, y, w, h| +** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ +- Inside source: true +*** True Line Result + state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def end_day_one_monument args~ +** Processing line: ~ # Assigns collision rects for every sprite drawn~ - Inside source: true *** True Line Result - def end_day_one_monument args -** Processing line: ~ {~ + # Assigns collision rects for every sprite drawn +** Processing line: ~ state.world_collision_rects =~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/tribute.png',~ + state.world_collision_rects = +** Processing line: ~ state.world_lookup~ - Inside source: true *** True Line Result - background: 'sprites/tribute.png', -** Processing line: ~ player: [2, 36],~ + state.world_lookup +** Processing line: ~ .keys~ - Inside source: true *** True Line Result - player: [2, 36], -** Processing line: ~ scenes: [~ + .keys +** Processing line: ~ .map do |x, y, w, h|~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [62, 0, 2, 40, :end_day_one_infront_of_home],~ + .map do |x, y, w, h| +** Processing line: ~ s = state.tile_size~ - Inside source: true *** True Line Result - [62, 0, 2, 40, :end_day_one_infront_of_home], -** Processing line: ~ ],~ + s = state.tile_size +** Processing line: ~ w ||= s~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + w ||= s +** Processing line: ~ h ||= s~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."],~ + h ||= s +** Processing line: ~ {~ - Inside source: true *** True Line Result - [50, 27, 4, 4, "It's getting late. Better get some sleep."], -** Processing line: ~ ]~ + { +** Processing line: ~ args: [x, y, w, h],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + args: [x, y, w, h], +** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + left_right: [x, y + 4, w, h - 6], +** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + top: [x + 4, y + 6, w - 8, h - 6], +** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ - Inside source: true *** True Line Result - -** Processing line: ~ def end_day_one_infront_of_home args~ + bottom: [x + 1, y - 1, w - 2, h - 8], +** Processing line: ~ }~ - Inside source: true *** True Line Result - def end_day_one_infront_of_home args -** Processing line: ~ {~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/front-of-home.png',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/front-of-home.png', -** Processing line: ~ player: [1, 17],~ + +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [1, 17], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [43, 34, 10, 16, :end_day_one_home],~ + +** Processing line: ~ def calc_pendulum~ - Inside source: true *** True Line Result - [43, 34, 10, 16, :end_day_one_home], -** Processing line: ~ ],~ + def calc_pendulum +** Processing line: ~ return if !state.anchor_point~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + return if !state.anchor_point +** Processing line: ~ target_x = state.anchor_point.x - start_of_tongue.x~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [20, 10, 4, 4, "It's getting late. Better get some sleep."],~ + target_x = state.anchor_point.x - start_of_tongue.x +** Processing line: ~ target_y = state.anchor_point.y -~ - Inside source: true *** True Line Result - [20, 10, 4, 4, "It's getting late. Better get some sleep."], -** Processing line: ~ ]~ + target_y = state.anchor_point.y - +** Processing line: ~ state.tongue_length - 5 - 20 - state.player_height~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.tongue_length - 5 - 20 - state.player_height +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + +** Processing line: ~ diff_y = state.y - target_y~ - Inside source: true *** True Line Result - end + diff_y = state.y - target_y ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def end_day_one_home args~ +** Processing line: ~ if target_x > 0~ - Inside source: true *** True Line Result - def end_day_one_home args -** Processing line: ~ {~ + if target_x > 0 +** Processing line: ~ state.dx += 0.6~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-home.png',~ + state.dx += 0.6 +** Processing line: ~ elsif target_x < 0~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 3],~ + elsif target_x < 0 +** Processing line: ~ state.dx -= 0.6~ - Inside source: true *** True Line Result - player: [34, 3], -** Processing line: ~ scenes: [~ + state.dx -= 0.6 +** Processing line: ~ end~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, 40, 8, 10, :end_day_one_dream],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [32, 40, 8, 10, :end_day_one_dream], -** Processing line: ~ ],~ + +** Processing line: ~ if diff_y > 0~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + if diff_y > 0 +** Processing line: ~ state.dy -= 0.1~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [38, 4, 4, 4, "It's getting late. Better get some sleep."],~ + state.dy -= 0.1 +** Processing line: ~ elsif diff_y < 0~ - Inside source: true *** True Line Result - [38, 4, 4, 4, "It's getting late. Better get some sleep."], -** Processing line: ~ ]~ + elsif diff_y < 0 +** Processing line: ~ state.dy += 0.1~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.dy += 0.1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ state.dx *= 0.99~ +- Inside source: true +*** True Line Result + state.dx *= 0.99 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def end_day_one_dream args~ +** Processing line: ~ if state.dy.abs < 2~ - Inside source: true *** True Line Result - def end_day_one_dream args -** Processing line: ~ {~ + if state.dy.abs < 2 +** Processing line: ~ state.dy *= 0.8~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/dream.png',~ + state.dy *= 0.8 +** Processing line: ~ else~ - Inside source: true *** True Line Result - background: 'sprites/dream.png', -** Processing line: ~ fade: 60,~ + else +** Processing line: ~ state.dy *= 0.90~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [4, 4],~ + state.dy *= 0.90 +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [4, 4], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [62, 0, 2, 64, :explaining_the_special_power]~ + +** Processing line: ~ if state.tongue_length && state.y~ - Inside source: true *** True Line Result - [62, 0, 2, 64, :explaining_the_special_power] -** Processing line: ~ ],~ + if state.tongue_length && state.y +** Processing line: ~ state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000) +** Processing line: ~ end~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], -** Processing line: ~ [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], -** Processing line: ~ [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]~ + +** Processing line: ~ def calc_tongue_angle~ - Inside source: true *** True Line Result - [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] -** Processing line: ~ ]~ + def calc_tongue_angle +** Processing line: ~ return unless state.anchor_point~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + return unless state.anchor_point +** Processing line: ~ state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue +** Processing line: ~ state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)~ - Inside source: true *** True Line Result - end + state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point) +** Processing line: ~ state.tongue_length = state.tongue_length.greater(100)~ +- Inside source: true +*** True Line Result + state.tongue_length = state.tongue_length.greater(100) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def explaining_the_special_power args~ +** Processing line: ~ def player_from_end_of_tongue~ - Inside source: true *** True Line Result - def explaining_the_special_power args -** Processing line: ~ {~ + def player_from_end_of_tongue +** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + p = state.tongue_angle.vector(state.tongue_length) +** Processing line: ~ derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y] +** Processing line: ~ derived_start.x -= state.player_width.half~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [32, 30],~ + derived_start.x -= state.player_width.half +** Processing line: ~ derived_start.y -= state.player_height.half~ - Inside source: true *** True Line Result - player: [32, 30], -** Processing line: ~ scenes: [~ + derived_start.y -= state.player_height.half +** Processing line: ~ derived_start~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [~ + derived_start +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ -** Processing line: ~ 38, 21, 4, 4, :explaining_the_special_power_inside_computer~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 38, 21, 4, 4, :explaining_the_special_power_inside_computer -** Processing line: ~ ],~ + +** Processing line: ~ def end_of_tongue~ - Inside source: true *** True Line Result - ], -** Processing line: ~ ]~ + def end_of_tongue +** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + p = state.tongue_angle.vector(state.tongue_length) +** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [start_of_tongue.x + p.x, start_of_tongue.y + p.y] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def explaining_the_special_power_inside_computer args~ +** Processing line: ~ def calc_shooting~ - Inside source: true *** True Line Result - def explaining_the_special_power_inside_computer args -** Processing line: ~ {~ + def calc_shooting +** Processing line: ~ return unless state.action == :shooting~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/pc.png',~ + return unless state.action == :shooting +** Processing line: ~ state.tongue_length += 30~ - Inside source: true *** True Line Result - background: 'sprites/pc.png', -** Processing line: ~ fade: 60,~ + state.tongue_length += 30 +** Processing line: ~ potential_anchor = end_of_tongue~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [34, 4],~ + potential_anchor = end_of_tongue +** Processing line: ~ if potential_anchor.x <= 0~ - Inside source: true *** True Line Result - player: [34, 4], -** Processing line: ~ scenes: [~ + if potential_anchor.x <= 0 +** Processing line: ~ state.anchor_point = potential_anchor~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 62, 64, 3, :the_blinking_light]~ + state.anchor_point = potential_anchor +** Processing line: ~ state.action = :anchored~ - Inside source: true *** True Line Result - [0, 62, 64, 3, :the_blinking_light] -** Processing line: ~ ],~ + state.action = :anchored +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + outputs.sounds << 'sounds/attached.wav' +** Processing line: ~ elsif potential_anchor.x >= 10000~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],~ + elsif potential_anchor.x >= 10000 +** Processing line: ~ state.anchor_point = potential_anchor~ - Inside source: true *** True Line Result - [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], -** Processing line: ~ [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],~ + state.anchor_point = potential_anchor +** Processing line: ~ state.action = :anchored~ - Inside source: true *** True Line Result - [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], -** Processing line: ~ [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],~ + state.action = :anchored +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ - Inside source: true *** True Line Result - [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], -** Processing line: ~ [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]~ + outputs.sounds << 'sounds/attached.wav' +** Processing line: ~ elsif potential_anchor.y <= 0~ - Inside source: true *** True Line Result - [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] -** Processing line: ~ ]~ + elsif potential_anchor.y <= 0 +** Processing line: ~ state.anchor_point = potential_anchor~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.anchor_point = potential_anchor +** Processing line: ~ state.action = :anchored~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.action = :anchored +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.sounds << 'sounds/attached.wav' +** Processing line: ~ elsif potential_anchor.y >= 5875~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + elsif potential_anchor.y >= 5875 +** Processing line: ~ state.anchor_point = potential_anchor~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + state.anchor_point = potential_anchor +** Processing line: ~ state.action = :anchored~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb~ -- Header detected. + state.action = :anchored +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +- Inside source: true *** True Line Result - + outputs.sounds << 'sounds/attached.wav' +** Processing line: ~ else~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + else +** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ +- Inside source: true *** True Line Result - + anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] +** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def final_decision_side_of_home args~ + collision = state.world_collision_rects.find_all do |v| +** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ - Inside source: true *** True Line Result - def final_decision_side_of_home args -** Processing line: ~ {~ + [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) +** Processing line: ~ end.first~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 120,~ + end.first +** Processing line: ~ if collision~ - Inside source: true *** True Line Result - fade: 120, -** Processing line: ~ background: 'sprites/side-of-home.png',~ + if collision +** Processing line: ~ state.anchor_point = potential_anchor~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [16, 13],~ + state.anchor_point = potential_anchor +** Processing line: ~ state.action = :anchored~ - Inside source: true *** True Line Result - player: [16, 13], -** Processing line: ~ scenes: [~ + state.action = :anchored +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [52, 24, 11, 5, :final_decision_mountain_pass],~ + outputs.sounds << 'sounds/attached.wav' +** Processing line: ~ end~ - Inside source: true *** True Line Result - [52, 24, 11, 5, :final_decision_mountain_pass], -** Processing line: ~ ],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_side_of_home_render,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_side_of_home_render, -** Processing line: ~ storylines: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]~ + +** Processing line: ~ def calc_player~ - Inside source: true *** True Line Result - [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] -** Processing line: ~ ]~ + def calc_player +** Processing line: ~ calc_shooting~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + calc_shooting +** Processing line: ~ if !state.god_mode~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + if !state.god_mode +** Processing line: ~ state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame +** Processing line: ~ state.dx += state.dx * state.air~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_decision_mountain_pass args~ + state.dx += state.dx * state.air +** Processing line: ~ end~ - Inside source: true *** True Line Result - def final_decision_mountain_pass args -** Processing line: ~ {~ + end +** Processing line: ~ calc_pendulum~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ + calc_pendulum +** Processing line: ~ calc_box_collision~ - Inside source: true *** True Line Result - background: 'sprites/mountain-pass-zoomed-out.png', -** Processing line: ~ player: [4, 4],~ + calc_box_collision +** Processing line: ~ calc_edge_collision~ - Inside source: true *** True Line Result - player: [4, 4], -** Processing line: ~ scenes: [~ + calc_edge_collision +** Processing line: ~ if !state.god_mode~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [18, 47, 5, 5, :final_decision_path_to_observatory]~ + if !state.god_mode +** Processing line: ~ state.y += state.dy~ - Inside source: true *** True Line Result - [18, 47, 5, 5, :final_decision_path_to_observatory] -** Processing line: ~ ],~ + state.y += state.dy +** Processing line: ~ state.x += state.dx~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ + state.x += state.dx +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_mountain_pass_render -** Processing line: ~ }~ + end +** Processing line: ~ calc_tongue_angle~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + calc_tongue_angle +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_path_to_observatory args~ +** Processing line: ~ def calc_box_collision~ - Inside source: true *** True Line Result - def final_decision_path_to_observatory args -** Processing line: ~ {~ + def calc_box_collision +** Processing line: ~ return unless state.world_lookup.keys.length > 0~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -- Inside source: true -*** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [60, 4],~ + return unless state.world_lookup.keys.length > 0 +** Processing line: ~ collision_floor~ - Inside source: true *** True Line Result - player: [60, 4], -** Processing line: ~ scenes: [~ + collision_floor +** Processing line: ~ collision_left~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 26, 5, 5, :final_decision_observatory]~ + collision_left +** Processing line: ~ collision_right~ - Inside source: true *** True Line Result - [0, 26, 5, 5, :final_decision_observatory] -** Processing line: ~ ],~ + collision_right +** Processing line: ~ collision_ceiling~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ + collision_ceiling +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_path_to_observatory_render -** Processing line: ~ }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + +** Processing line: ~ def calc_edge_collision~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def calc_edge_collision +** Processing line: ~ # Ensures that player doesn't fall below the map~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_decision_observatory args~ + # Ensures that player doesn't fall below the map +** Processing line: ~ if next_y < 0 && state.dy < 0~ - Inside source: true *** True Line Result - def final_decision_observatory args -** Processing line: ~ {~ + if next_y < 0 && state.dy < 0 +** Processing line: ~ state.y = 0~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/observatory.png',~ + state.y = 0 +** Processing line: ~ state.dy = state.dy.abs * 0.8~ - Inside source: true *** True Line Result - background: 'sprites/observatory.png', -** Processing line: ~ player: [60, 2],~ + state.dy = state.dy.abs * 0.8 +** Processing line: ~ state.collision_on_y = true~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ scenes: [~ + state.collision_on_y = true +** Processing line: ~ # Ensures player doesn't go insanely high~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [28, 39, 4, 10, :final_decision_inside_observatory]~ + # Ensures player doesn't go insanely high +** Processing line: ~ elsif next_y > 5875 - state.tile_size && state.dy > 0~ - Inside source: true *** True Line Result - [28, 39, 4, 10, :final_decision_inside_observatory] -** Processing line: ~ ],~ + elsif next_y > 5875 - state.tile_size && state.dy > 0 +** Processing line: ~ state.y = 5875 - state.tile_size~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_observatory_render~ + state.y = 5875 - state.tile_size +** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ - Inside source: true *** True Line Result - render_override: :blinking_light_observatory_render -** Processing line: ~ }~ + state.dy = state.dy.abs * 0.8 * -1 +** Processing line: ~ state.collision_on_y = true~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.collision_on_y = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_inside_observatory args~ +** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ - Inside source: true *** True Line Result - def final_decision_inside_observatory args -** Processing line: ~ {~ + # Ensures that player remains in the horizontal range its supposed to +** Processing line: ~ if state.x >= 10000 - state.tile_size && state.dx > 0~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + if state.x >= 10000 - state.tile_size && state.dx > 0 +** Processing line: ~ state.x = 10000 - state.tile_size~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ player: [60, 2],~ + state.x = 10000 - state.tile_size +** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ storylines: [],~ + state.dx = state.dx.abs * 0.8 * -1 +** Processing line: ~ state.collision_on_x = true~ - Inside source: true *** True Line Result - storylines: [], -** Processing line: ~ scenes: [~ + state.collision_on_x = true +** Processing line: ~ elsif state.x <= 0 && state.dx < 0~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :final_decision_inside_mainframe]~ + elsif state.x <= 0 && state.dx < 0 +** Processing line: ~ state.x = 0~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :final_decision_inside_mainframe] -** Processing line: ~ ],~ + state.x = 0 +** Processing line: ~ state.dx = state.dx.abs * 0.8~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + state.dx = state.dx.abs * 0.8 +** Processing line: ~ state.collision_on_x = true~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + state.collision_on_x = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_inside_mainframe args~ +** Processing line: ~ def next_y~ - Inside source: true *** True Line Result - def final_decision_inside_mainframe args -** Processing line: ~ {~ + def next_y +** Processing line: ~ state.y + state.dy~ - Inside source: true *** True Line Result - { -** Processing line: ~ player: [32, 4],~ + state.y + state.dy +** Processing line: ~ end~ - Inside source: true *** True Line Result - player: [32, 4], -** Processing line: ~ background: 'sprites/mainframe.png',~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ storylines: [],~ + +** Processing line: ~ def next_x~ - Inside source: true *** True Line Result - storylines: [], -** Processing line: ~ scenes: [~ + def next_x +** Processing line: ~ if state.dx < 0~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_top, :final_decision_ship_status],~ + if state.dx < 0 +** Processing line: ~ return (state.x + state.dx) - (state.tile_size - state.player_width)~ - Inside source: true *** True Line Result - [*hotspot_top, :final_decision_ship_status], -** Processing line: ~ ]~ + return (state.x + state.dx) - (state.tile_size - state.player_width) +** Processing line: ~ else~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + else +** Processing line: ~ return (state.x + state.dx) + (state.tile_size - state.player_width)~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + return (state.x + state.dx) + (state.tile_size - state.player_width) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_ship_status args~ +** Processing line: ~ def collision_floor~ - Inside source: true *** True Line Result - def final_decision_ship_status args -** Processing line: ~ {~ + def collision_floor +** Processing line: ~ return unless state.dy <= 0~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/serenity.png',~ + return unless state.dy <= 0 +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/serenity.png', -** Processing line: ~ fade: 60,~ + +** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 10],~ + player_rect = [state.x, next_y, state.tile_size, state.tile_size] +** Processing line: ~~ - Inside source: true *** True Line Result - player: [30, 10], -** Processing line: ~ scenes: [~ + +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_top_right, :final_decision]~ + # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above) +** Processing line: ~ floor_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - [*hotspot_top_right, :final_decision] -** Processing line: ~ ],~ + floor_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 8, 4, 4, "????"],~ + .first +** Processing line: ~~ - Inside source: true *** True Line Result - [30, 8, 4, 4, "????"], -** Processing line: ~ *final_decision_ship_status_shared(args)~ + +** Processing line: ~ return unless floor_collisions~ - Inside source: true *** True Line Result - *final_decision_ship_status_shared(args) -** Processing line: ~ ]~ + return unless floor_collisions +** Processing line: ~ state.y = floor_collisions[:top].top~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + state.y = floor_collisions[:top].top +** Processing line: ~ state.dy = state.dy.abs * 0.8~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.dy = state.dy.abs * 0.8 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision args~ +** Processing line: ~ def collision_left~ - Inside source: true *** True Line Result - def final_decision args -** Processing line: ~ decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",~ + def collision_left +** Processing line: ~ return unless state.dx < 0~ - Inside source: true *** True Line Result - decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", -** Processing line: ~ "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",~ + return unless state.dx < 0 +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", -** Processing line: ~ [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],~ + player_rect = [next_x, state.y, state.tile_size, state.tile_size] +** Processing line: ~~ - Inside source: true *** True Line Result - [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], -** Processing line: ~ [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],~ + +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)~ - Inside source: true *** True Line Result - [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], -** Processing line: ~ [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],~ + # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above) +** Processing line: ~ left_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], -** Processing line: ~ [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]~ + left_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] -** Processing line: ~ end~ + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_game_over_noone args~ -- Inside source: true -*** True Line Result - def final_decision_game_over_noone args -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ +** Processing line: ~ return unless left_side_collisions~ - Inside source: true *** True Line Result - background: 'sprites/tribute-game-over.png', -** Processing line: ~ player: [53, 14],~ + return unless left_side_collisions +** Processing line: ~ state.x = left_side_collisions[:left_right].right~ - Inside source: true *** True Line Result - player: [53, 14], -** Processing line: ~ fade: 600~ + state.x = left_side_collisions[:left_right].right +** Processing line: ~ state.dx = state.dy.abs * 0.8~ - Inside source: true *** True Line Result - fade: 600 -** Processing line: ~ }~ + state.dx = state.dy.abs * 0.8 +** Processing line: ~ state.collision_on_x = true~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.collision_on_x = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_game_over_matthew args~ +** Processing line: ~ def collision_right~ - Inside source: true *** True Line Result - def final_decision_game_over_matthew args -** Processing line: ~ {~ + def collision_right +** Processing line: ~ return unless state.dx > 0~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ + return unless state.dx > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/tribute-game-over.png', -** Processing line: ~ player: [53, 14],~ + +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ - Inside source: true *** True Line Result - player: [53, 14], -** Processing line: ~ fade: 600~ + player_rect = [next_x, state.y, state.tile_size, state.tile_size] +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)~ - Inside source: true *** True Line Result - fade: 600 -** Processing line: ~ }~ + # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above) +** Processing line: ~ right_side_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + right_side_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - end + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ +- Inside source: true +*** True Line Result + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_game_over_anka args~ +** Processing line: ~ return unless right_side_collisions~ - Inside source: true *** True Line Result - def final_decision_game_over_anka args -** Processing line: ~ {~ + return unless right_side_collisions +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ + state.x = right_side_collisions[:left_right].left - state.tile_size +** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ - Inside source: true *** True Line Result - background: 'sprites/tribute-game-over.png', -** Processing line: ~ player: [53, 14],~ + state.dx = state.dx.abs * 0.8 * -1 +** Processing line: ~ state.collision_on_x = true~ - Inside source: true *** True Line Result - player: [53, 14], -** Processing line: ~ fade: 600~ + state.collision_on_x = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - fade: 600 -** Processing line: ~ }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + +** Processing line: ~ def collision_ceiling~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def collision_ceiling +** Processing line: ~ return unless state.dy > 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_decision_game_over_sasha args~ + return unless state.dy > 0 +** Processing line: ~~ - Inside source: true *** True Line Result - def final_decision_game_over_sasha args -** Processing line: ~ {~ + +** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ + player_rect = [state.x, next_y, state.player_width, state.player_height] +** Processing line: ~~ - Inside source: true *** True Line Result - background: 'sprites/tribute-game-over.png', -** Processing line: ~ player: [53, 14],~ + +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)~ - Inside source: true *** True Line Result - player: [53, 14], -** Processing line: ~ fade: 600~ + # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above) +** Processing line: ~ ceil_collisions = state.world_collision_rects~ - Inside source: true *** True Line Result - fade: 600 -** Processing line: ~ }~ + ceil_collisions = state.world_collision_rects +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } +** Processing line: ~ .first~ - Inside source: true *** True Line Result - end + .first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_decision_ship_status_shared args~ +** Processing line: ~ return unless ceil_collisions~ - Inside source: true *** True Line Result - def final_decision_ship_status_shared args -** Processing line: ~ [~ + return unless ceil_collisions +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ - Inside source: true *** True Line Result - [ -** Processing line: ~ *ship_control_hotspot(24, 22,~ + state.y = ceil_collisions[:bottom].y - state.tile_size +** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ - Inside source: true *** True Line Result - *ship_control_hotspot(24, 22, -** Processing line: ~ "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",~ + state.dy = state.dy.abs * 0.8 * -1 +** Processing line: ~ state.collision_on_y = true~ - Inside source: true *** True Line Result - "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", -** Processing line: ~ "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ + state.collision_on_y = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", -** Processing line: ~ "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", -** Processing line: ~ "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),~ + +** Processing line: ~ def to_coord point~ - Inside source: true *** True Line Result - "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), -** Processing line: ~ ]~ + def to_coord point +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + # Integer divides (idiv) point.x to turn into grid +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Then, you can just multiply each integer by state.tile_size +** Processing line: ~ # later and huzzah. Grid coordinates~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb~ -- Header detected. + # later and huzzah. Grid coordinates +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +- Inside source: true *** True Line Result - + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~~ +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ def final_message_sad args~ +** Processing line: ~ def export_map~ - Inside source: true *** True Line Result - def final_message_sad args -** Processing line: ~ {~ + def export_map +** Processing line: ~ export_string = state.world.map do |x, y|~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + export_string = state.world.map do |x, y| +** Processing line: ~ "#{x},#{y},1"~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + "#{x},#{y},1" +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 35],~ + end +** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ - Inside source: true *** True Line Result - player: [34, 35], -** Processing line: ~ storylines: [~ + export_string += state.objects.map do |x, y, w, h, path| +** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 34, 4, 4, "Another-- sleepless-- night..."],~ + "#{x},#{y},2,#{w},#{h},#{path}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - [34, 34, 4, 4, "Another-- sleepless-- night..."], -** Processing line: ~ ],~ + end +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) +** Processing line: ~ state.map_saved_at = state.tick_count~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ + state.map_saved_at = state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - [32, -1, 8, 3, :final_message_observatory] -** Processing line: ~ ]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + +** Processing line: ~ def inputs_export_stage~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + def inputs_export_stage +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_message_happy args~ +** Processing line: ~ def calc_score~ - Inside source: true *** True Line Result - def final_message_happy args -** Processing line: ~ {~ + def calc_score +** Processing line: ~ return unless state.scene == :game~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + return unless state.scene == :game +** Processing line: ~ player = [state.x, state.y, state.player_width, state.player_height]~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + player = [state.x, state.y, state.player_width, state.player_height] +** Processing line: ~ collected = state.objects.find_all { |s| s.intersect_rect? player }~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 35],~ + collected = state.objects.find_all { |s| s.intersect_rect? player } +** Processing line: ~ state.stuff_score += collected.length~ - Inside source: true *** True Line Result - player: [34, 35], -** Processing line: ~ storylines: [~ + state.stuff_score += collected.length +** Processing line: ~ if collected.length > 0~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 34, 4, 4, "Oh man, I slept like rock!"],~ + if collected.length > 0 +** Processing line: ~ outputs.sounds << 'sounds/collectable.wav'~ - Inside source: true *** True Line Result - [34, 34, 4, 4, "Oh man, I slept like rock!"], -** Processing line: ~ ],~ + outputs.sounds << 'sounds/collectable.wav' +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + end +** Processing line: ~ state.objects = state.objects.reject { |s| collected.include? s }~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ + state.objects = state.objects.reject { |s| collected.include? s } +** Processing line: ~ state.stuff_time += 0.01~ - Inside source: true *** True Line Result - [32, -1, 8, 3, :final_message_observatory] -** Processing line: ~ ]~ + state.stuff_time += 0.01 +** Processing line: ~ if state.objects.length == 0~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + if state.objects.length == 0 +** Processing line: ~ if !state.stuff_best_time || state.stuff_time < state.stuff_best_time~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + if !state.stuff_best_time || state.stuff_time < state.stuff_best_time +** Processing line: ~ state.stuff_best_time = state.stuff_time~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.stuff_best_time = state.stuff_time +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_side_of_home args~ + end +** Processing line: ~ state.game_over_at = nil~ - Inside source: true *** True Line Result - def final_message_side_of_home args -** Processing line: ~ {~ + state.game_over_at = nil +** Processing line: ~ state.scene = :ending~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + state.scene = :ending +** Processing line: ~ end~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/side-of-home.png',~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [16, 13],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - player: [16, 13], -** Processing line: ~ scenes: [~ + +** Processing line: ~ def calc_on_floor~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [52, 24, 11, 5, :final_message_mountain_pass],~ + def calc_on_floor +** Processing line: ~ if state.action == :anchored~ - Inside source: true *** True Line Result - [52, 24, 11, 5, :final_message_mountain_pass], -** Processing line: ~ ],~ + if state.action == :anchored +** Processing line: ~ state.on_floor = false~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ + state.on_floor = false +** Processing line: ~ state.on_floor_debounce = 30~ - Inside source: true *** True Line Result - render_override: :blinking_light_side_of_home_render -** Processing line: ~ }~ + state.on_floor_debounce = 30 +** Processing line: ~ else~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + else +** Processing line: ~ state.on_floor_debounce ||= 30~ - Inside source: true *** True Line Result - end + state.on_floor_debounce ||= 30 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_message_mountain_pass args~ +** Processing line: ~ if state.dy.round != 0~ - Inside source: true *** True Line Result - def final_message_mountain_pass args -** Processing line: ~ {~ + if state.dy.round != 0 +** Processing line: ~ state.on_floor_debounce = 30~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ + state.on_floor_debounce = 30 +** Processing line: ~ state.on_floor = false~ - Inside source: true *** True Line Result - background: 'sprites/mountain-pass-zoomed-out.png', -** Processing line: ~ player: [4, 4],~ + state.on_floor = false +** Processing line: ~ else~ - Inside source: true *** True Line Result - player: [4, 4], -** Processing line: ~ scenes: [~ + else +** Processing line: ~ state.on_floor_debounce -= 1~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [18, 47, 5, 5, :final_message_path_to_observatory],~ + state.on_floor_debounce -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [18, 47, 5, 5, :final_message_path_to_observatory], -** Processing line: ~ ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + +** Processing line: ~ if state.on_floor_debounce <= 0~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ + if state.on_floor_debounce <= 0 +** Processing line: ~ state.on_floor_debounce = 0~ - Inside source: true *** True Line Result - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] -** Processing line: ~ ],~ + state.on_floor_debounce = 0 +** Processing line: ~ state.on_floor = true~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ + state.on_floor = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_override: :blinking_light_mountain_pass_render -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def final_message_path_to_observatory args~ -- Inside source: true -*** True Line Result - def final_message_path_to_observatory args -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ def render_player~ - Inside source: true *** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [60, 4],~ + def render_player +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - player: [60, 4], -** Processing line: ~ scenes: [~ + path = "sprites/square-green.png" +** Processing line: ~ angle = 0~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 26, 5, 5, :final_message_observatory]~ + angle = 0 +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]~ - Inside source: true *** True Line Result - [0, 26, 5, 5, :final_message_observatory] -** Processing line: ~ ],~ + # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"] +** Processing line: ~ if state.action == :idle~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + if state.action == :idle +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ + # outputs.labels << [vx(state.x), vy(state.y), "IDLE"] +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] -** Processing line: ~ ],~ + path = "sprites/square-green.png" +** Processing line: ~ elsif state.action == :aiming && !state.on_floor~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ + elsif state.action == :aiming && !state.on_floor +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]~ - Inside source: true *** True Line Result - render_override: :blinking_light_path_to_observatory_render -** Processing line: ~ }~ + # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"] +** Processing line: ~ angle = state.tongue_angle - 90~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + angle = state.tongue_angle - 90 +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + path = "sprites/square-green.png" +** Processing line: ~ elsif state.action == :aiming # ON THE GROUND~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_observatory args~ + elsif state.action == :aiming # ON THE GROUND +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]~ - Inside source: true *** True Line Result - def final_message_observatory args -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ + # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"] +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_with_whole_truth -** Processing line: ~ return {~ + path = "sprites/square-green.png" +** Processing line: ~ elsif state.action == :shooting && !state.on_floor~ - Inside source: true *** True Line Result - return { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + elsif state.action == :shooting && !state.on_floor +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"] +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [51, 12],~ + path = "sprites/square-green.png" +** Processing line: ~ angle = state.tongue_angle - 90~ - Inside source: true *** True Line Result - player: [51, 12], -** Processing line: ~ storylines: [~ + angle = state.tongue_angle - 90 +** Processing line: ~ elsif state.action == :shooting~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 10, 4, 4, "Here-- we- go..."]~ + elsif state.action == :shooting +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]~ - Inside source: true *** True Line Result - [50, 10, 4, 4, "Here-- we- go..."] -** Processing line: ~ ],~ + # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"] +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + path = "sprites/square-green.png" +** Processing line: ~ elsif state.action == :anchored~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ + elsif state.action == :anchored +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :final_message_inside_mainframe] -** Processing line: ~ ],~ + # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"] +** Processing line: ~ angle = state.tongue_angle - 90~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + angle = state.tongue_angle - 90 +** Processing line: ~ path = "sprites/square-green.png"~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + path = "sprites/square-green.png" +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ return {~ + +** Processing line: ~ outputs.sprites << [vx(state.x),~ - Inside source: true *** True Line Result - return { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + outputs.sprites << [vx(state.x), +** Processing line: ~ vy(state.y),~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + vy(state.y), +** Processing line: ~ vw(state.player_width),~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [51, 12],~ + vw(state.player_width), +** Processing line: ~ vh(state.player_height),~ - Inside source: true *** True Line Result - player: [51, 12], -** Processing line: ~ storylines: [~ + vh(state.player_height), +** Processing line: ~ path,~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]~ + path, +** Processing line: ~ angle]~ - Inside source: true *** True Line Result - [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] -** Processing line: ~ ],~ + angle] +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ + +** Processing line: ~ def render_player_old~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :final_message_inside_mainframe] -** Processing line: ~ ],~ + def render_player_old +** Processing line: ~ # Player~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + # Player +** Processing line: ~ if state.action == :aiming~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + if state.action == :aiming +** Processing line: ~ path = 'sprites\frg\idle\frog_idle.png'~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + path = 'sprites\frg\idle\frog_idle.png' +** Processing line: ~ if state.dx > 2~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if state.dx > 2 +** Processing line: ~ #directional right sprite was here but i needa redo it~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + #directional right sprite was here but i needa redo it +** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_inside_mainframe args~ + path = 'sprites\frg\anchor\frog-anchor-0.png' +** Processing line: ~ #directional left sprite was here but i needa redo it~ - Inside source: true *** True Line Result - def final_message_inside_mainframe args -** Processing line: ~ {~ + #directional left sprite was here but i needa redo it +** Processing line: ~ elsif state.dx < -2~ - Inside source: true *** True Line Result - { -** Processing line: ~ player: [32, 4],~ + elsif state.dx < -2 +** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ - Inside source: true *** True Line Result - player: [32, 4], -** Processing line: ~ background: 'sprites/mainframe.png',~ + path = 'sprites\frg\anchor\frog-anchor-0.png' +** Processing line: ~ end~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ fade: 60,~ + end +** Processing line: ~ outputs.sprites << [vx(state.x),~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ scenes: [[45, 45, 4, 4, :final_message_check_ship_status]]~ + outputs.sprites << [vx(state.x), +** Processing line: ~ vy(state.y),~ - Inside source: true *** True Line Result - scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] -** Processing line: ~ }~ + vy(state.y), +** Processing line: ~ vw(state.player_width),~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + vw(state.player_width), +** Processing line: ~ vh(state.player_height),~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + vh(state.player_height), +** Processing line: ~ path,~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_check_ship_status args~ + path, +** Processing line: ~ (state.tongue_angle - 90)]~ - Inside source: true *** True Line Result - def final_message_check_ship_status args -** Processing line: ~ {~ + (state.tongue_angle - 90)] +** Processing line: ~ elsif state.action == :anchored || state.action == :shooting~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mainframe.png',~ + elsif state.action == :anchored || state.action == :shooting +** Processing line: ~ outputs.sprites << [vx(state.x),~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ storylines: [~ + outputs.sprites << [vx(state.x), +** Processing line: ~ vy(state.y),~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [45, 45, 4, 4, (final_message_current args)],~ + vy(state.y), +** Processing line: ~ vw(state.player_width),~ - Inside source: true *** True Line Result - [45, 45, 4, 4, (final_message_current args)], -** Processing line: ~ ],~ + vw(state.player_width), +** Processing line: ~ vw(state.player_height),~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + vw(state.player_height), +** Processing line: ~ 'sprites/animations_povfrog/frog_bwah_up.png',~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_top, :final_message_ship_status],~ + 'sprites/animations_povfrog/frog_bwah_up.png', +** Processing line: ~ (state.tongue_angle - 90)]~ - Inside source: true *** True Line Result - [*hotspot_top, :final_message_ship_status], -** Processing line: ~ ]~ + (state.tongue_angle - 90)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -56053,58 +56336,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def final_message_ship_status args~ -- Inside source: true -*** True Line Result - def final_message_ship_status args -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ background: 'sprites/serenity.png',~ -- Inside source: true -*** True Line Result - background: 'sprites/serenity.png', -** Processing line: ~ fade: 60,~ -- Inside source: true -*** True Line Result - fade: 60, -** Processing line: ~ player: [30, 10],~ +** Processing line: ~~ - Inside source: true *** True Line Result - player: [30, 10], -** Processing line: ~ scenes: [~ + +** Processing line: ~ $game = CleptoFrog.new~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 50, 4, 4, :final_message_ship_status_reviewed]~ + $game = CleptoFrog.new +** Processing line: ~~ - Inside source: true *** True Line Result - [30, 50, 4, 4, :final_message_ship_status_reviewed] -** Processing line: ~ ],~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + def tick args +** Processing line: ~ if args.state.scene == :game~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],~ + if args.state.scene == :game +** Processing line: ~ tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360~ - Inside source: true *** True Line Result - [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], -** Processing line: ~ *final_message_ship_status_shared(args)~ + tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360 +** Processing line: ~ end~ - Inside source: true *** True Line Result - *final_message_ship_status_shared(args) -** Processing line: ~ ]~ + end +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - } + $game.tick ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -56113,50 +56380,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def final_message_ship_status_reviewed args~ -- Inside source: true -*** True Line Result - def final_message_ship_status_reviewed args -** Processing line: ~ {~ -- Inside source: true -*** True Line Result - { -** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ def tick_instructions args, text, y = 715~ - Inside source: true *** True Line Result - background: 'sprites/serenity.png', -** Processing line: ~ fade: 60,~ + def tick_instructions args, text, y = 715 +** Processing line: ~ return if args.state.key_event_occurred~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ scenes: [~ + return if args.state.key_event_occurred +** Processing line: ~ if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom, :final_message_summary]~ + if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space +** Processing line: ~ args.state.key_event_occurred = true~ - Inside source: true *** True Line Result - [*hotspot_bottom, :final_message_summary] -** Processing line: ~ ],~ + args.state.key_event_occurred = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],~ + +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ - Inside source: true *** True Line Result - [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], -** Processing line: ~ ]~ + args.outputs.debug << [0, y - 50, 1280, 60].solid +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label +** Processing line: ~ args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label~ - Inside source: true *** True Line Result - } + args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -56165,4394 +56424,4298 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def final_message_ship_status_shared args~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def final_message_ship_status_shared args -** Processing line: ~ [~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - [ -** Processing line: ~ *ship_control_hotspot( 0, 50,~ -- Inside source: true + +** Processing line: ~* Platformer - Clepto Frog - map.rb~ +- Header detected. *** True Line Result - *ship_control_hotspot( 0, 50, -** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",~ -- Inside source: true + *** True Line Result - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", -** Processing line: ~ "Matthew's--- Chamber--: OCCUPIED----",~ -- Inside source: true +* Platformer - Clepto Frog - map.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - "Matthew's--- Chamber--: OCCUPIED----", -** Processing line: ~ "Aanka's--- Chamber--: OCCUPIED----",~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/map.rb~ - Inside source: true *** True Line Result - "Aanka's--- Chamber--: OCCUPIED----", -** Processing line: ~ "Sasha's--- Chamber--: OCCUPIED----"),~ + # ./samples/99_genre_platformer/clepto_frog/app/map.rb +** Processing line: ~ $collisions = [~ - Inside source: true *** True Line Result - "Sasha's--- Chamber--: OCCUPIED----"), -** Processing line: ~ *ship_control_hotspot(12, 35,~ + $collisions = [ +** Processing line: ~ [326, 463, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(12, 35, -** Processing line: ~ "Life- Support--: Not-- Needed---",~ + [326, 463, 64, 64], +** Processing line: ~ [274, 462, 64, 64],~ - Inside source: true *** True Line Result - "Life- Support--: Not-- Needed---", -** Processing line: ~ "O2--- Production---: OFF---",~ + [274, 462, 64, 64], +** Processing line: ~ [326, 413, 64, 64],~ - Inside source: true *** True Line Result - "O2--- Production---: OFF---", -** Processing line: ~ "CO2--- Scrubbers---: OFF---",~ + [326, 413, 64, 64], +** Processing line: ~ [275, 412, 64, 64],~ - Inside source: true *** True Line Result - "CO2--- Scrubbers---: OFF---", -** Processing line: ~ "H2O--- Production---: OFF---"),~ + [275, 412, 64, 64], +** Processing line: ~ [124, 651, 64, 64],~ - Inside source: true *** True Line Result - "H2O--- Production---: OFF---"), -** Processing line: ~ *ship_control_hotspot(24, 20,~ + [124, 651, 64, 64], +** Processing line: ~ [72, 651, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(24, 20, -** Processing line: ~ "Navigation: Offline---",~ + [72, 651, 64, 64], +** Processing line: ~ [124, 600, 64, 64],~ - Inside source: true *** True Line Result - "Navigation: Offline---", -** Processing line: ~ "Sensor: OFF---",~ + [124, 600, 64, 64], +** Processing line: ~ [69, 599, 64, 64],~ - Inside source: true *** True Line Result - "Sensor: OFF---", -** Processing line: ~ "Heads- Up- Display: DAMAGED---",~ + [69, 599, 64, 64], +** Processing line: ~ [501, 997, 64, 64],~ - Inside source: true *** True Line Result - "Heads- Up- Display: DAMAGED---", -** Processing line: ~ "Arithmetic--- Unit: DAMAGED----"),~ + [501, 997, 64, 64], +** Processing line: ~ [476, 995, 64, 64],~ - Inside source: true *** True Line Result - "Arithmetic--- Unit: DAMAGED----"), -** Processing line: ~ *ship_control_hotspot(36, 35,~ + [476, 995, 64, 64], +** Processing line: ~ [3224, 2057, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(36, 35, -** Processing line: ~ "COMM: Underpowered----",~ + [3224, 2057, 64, 64], +** Processing line: ~ [3224, 1994, 64, 64],~ - Inside source: true *** True Line Result - "COMM: Underpowered----", -** Processing line: ~ "Text: ON---",~ + [3224, 1994, 64, 64], +** Processing line: ~ [3225, 1932, 64, 64],~ - Inside source: true *** True Line Result - "Text: ON---", -** Processing line: ~ "Audio: SEGFAULT---",~ + [3225, 1932, 64, 64], +** Processing line: ~ [3225, 1870, 64, 64],~ - Inside source: true *** True Line Result - "Audio: SEGFAULT---", -** Processing line: ~ "Video: DAMAGED---"),~ + [3225, 1870, 64, 64], +** Processing line: ~ [3226, 1806, 64, 64],~ - Inside source: true *** True Line Result - "Video: DAMAGED---"), -** Processing line: ~ *ship_control_hotspot(48, 50,~ + [3226, 1806, 64, 64], +** Processing line: ~ [3224, 1744, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(48, 50, -** Processing line: ~ "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",~ + [3224, 1744, 64, 64], +** Processing line: ~ [3225, 1689, 64, 64],~ - Inside source: true *** True Line Result - "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", -** Processing line: ~ "Engine I: ON---",~ + [3225, 1689, 64, 64], +** Processing line: ~ [3226, 1660, 64, 64],~ - Inside source: true *** True Line Result - "Engine I: ON---", -** Processing line: ~ "Engine II: ON---",~ + [3226, 1660, 64, 64], +** Processing line: ~ [3161, 1658, 64, 64],~ - Inside source: true *** True Line Result - "Engine II: ON---", -** Processing line: ~ "Engine III: ON---")~ + [3161, 1658, 64, 64], +** Processing line: ~ [3097, 1660, 64, 64],~ - Inside source: true *** True Line Result - "Engine III: ON---") -** Processing line: ~ ]~ + [3097, 1660, 64, 64], +** Processing line: ~ [3033, 1658, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + [3033, 1658, 64, 64], +** Processing line: ~ [2969, 1658, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2969, 1658, 64, 64], +** Processing line: ~ [2904, 1658, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_last_reply args~ + [2904, 1658, 64, 64], +** Processing line: ~ [2839, 1657, 64, 64],~ - Inside source: true *** True Line Result - def final_message_last_reply args -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ + [2839, 1657, 64, 64], +** Processing line: ~ [2773, 1657, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_with_whole_truth -** Processing line: ~ return "Buffer--: #{anka_reply_whole_truth.quote}"~ + [2773, 1657, 64, 64], +** Processing line: ~ [2709, 1658, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: #{anka_reply_whole_truth.quote}" -** Processing line: ~ else~ + [2709, 1658, 64, 64], +** Processing line: ~ [2643, 1657, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Buffer--: #{anka_reply_half_truth.quote}"~ + [2643, 1657, 64, 64], +** Processing line: ~ [2577, 1657, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: #{anka_reply_half_truth.quote}" -** Processing line: ~ end~ + [2577, 1657, 64, 64], +** Processing line: ~ [2509, 1658, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [2509, 1658, 64, 64], +** Processing line: ~ [2440, 1658, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2440, 1658, 64, 64], +** Processing line: ~ [2371, 1658, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_current args~ + [2371, 1658, 64, 64], +** Processing line: ~ [2301, 1659, 64, 64],~ - Inside source: true *** True Line Result - def final_message_current args -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ + [2301, 1659, 64, 64], +** Processing line: ~ [2230, 1659, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_with_whole_truth -** Processing line: ~ return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."~ + [2230, 1659, 64, 64], +** Processing line: ~ [2159, 1659, 64, 64],~ - Inside source: true *** True Line Result - return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." -** Processing line: ~ else~ + [2159, 1659, 64, 64], +** Processing line: ~ [2092, 1660, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"~ + [2092, 1660, 64, 64], +** Processing line: ~ [2025, 1661, 64, 64],~ - Inside source: true *** True Line Result - return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" -** Processing line: ~ end~ + [2025, 1661, 64, 64], +** Processing line: ~ [1958, 1660, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [1958, 1660, 64, 64], +** Processing line: ~ [1888, 1659, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1888, 1659, 64, 64], +** Processing line: ~ [1817, 1657, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def final_message_summary args~ + [1817, 1657, 64, 64], +** Processing line: ~ [1745, 1656, 64, 64],~ - Inside source: true *** True Line Result - def final_message_summary args -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ + [1745, 1656, 64, 64], +** Processing line: ~ [1673, 1658, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_with_whole_truth -** Processing line: ~ return {~ + [1673, 1658, 64, 64], +** Processing line: ~ [1605, 1660, 64, 64],~ - Inside source: true *** True Line Result - return { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [1605, 1660, 64, 64], +** Processing line: ~ [1536, 1658, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [1536, 1658, 64, 64], +** Processing line: ~ [1465, 1660, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [31, 11],~ + [1465, 1660, 64, 64], +** Processing line: ~ [1386, 1960, 64, 64],~ - Inside source: true *** True Line Result - player: [31, 11], -** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ + [1386, 1960, 64, 64], +** Processing line: ~ [1384, 1908, 64, 64],~ - Inside source: true *** True Line Result - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], -** Processing line: ~ storylines: [~ + [1384, 1908, 64, 64], +** Processing line: ~ [1387, 1862, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],~ + [1387, 1862, 64, 64], +** Processing line: ~ [1326, 1863, 64, 64],~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], -** Processing line: ~ ]~ + [1326, 1863, 64, 64], +** Processing line: ~ [1302, 1862, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [1302, 1862, 64, 64], +** Processing line: ~ [1119, 1906, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ else~ + [1119, 1906, 64, 64], +** Processing line: ~ [1057, 1905, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ return {~ + [1057, 1905, 64, 64], +** Processing line: ~ [994, 1905, 64, 64],~ - Inside source: true *** True Line Result - return { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [994, 1905, 64, 64], +** Processing line: ~ [937, 1904, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [937, 1904, 64, 64], +** Processing line: ~ [896, 1904, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [31, 11],~ + [896, 1904, 64, 64], +** Processing line: ~ [1001, 1845, 64, 64],~ - Inside source: true *** True Line Result - player: [31, 11], -** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ + [1001, 1845, 64, 64], +** Processing line: ~ [1003, 1780, 64, 64],~ - Inside source: true *** True Line Result - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], -** Processing line: ~ storylines: [~ + [1003, 1780, 64, 64], +** Processing line: ~ [1003, 1718, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],~ + [1003, 1718, 64, 64], +** Processing line: ~ [692, 1958, 64, 64],~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], -** Processing line: ~ ]~ + [692, 1958, 64, 64], +** Processing line: ~ [691, 1900, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [691, 1900, 64, 64], +** Processing line: ~ [774, 1861, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [774, 1861, 64, 64], +** Processing line: ~ [712, 1861, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [712, 1861, 64, 64], +** Processing line: ~ [691, 1863, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [691, 1863, 64, 64], +** Processing line: ~ [325, 2133, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + [325, 2133, 64, 64], +** Processing line: ~ [275, 2134, 64, 64],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def serenity_alive_side_of_home args~ + [275, 2134, 64, 64], +** Processing line: ~ [326, 2082, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_side_of_home args -** Processing line: ~ {~ + [326, 2082, 64, 64], +** Processing line: ~ [275, 2082, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [275, 2082, 64, 64], +** Processing line: ~ [124, 2321, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/side-of-home.png',~ + [124, 2321, 64, 64], +** Processing line: ~ [71, 2320, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [16, 13],~ + [71, 2320, 64, 64], +** Processing line: ~ [123, 2267, 64, 64],~ - Inside source: true *** True Line Result - player: [16, 13], -** Processing line: ~ scenes: [~ + [123, 2267, 64, 64], +** Processing line: ~ [71, 2268, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [52, 24, 11, 5, :serenity_alive_mountain_pass],~ + [71, 2268, 64, 64], +** Processing line: ~ [2354, 1859, 64, 64],~ - Inside source: true *** True Line Result - [52, 24, 11, 5, :serenity_alive_mountain_pass], -** Processing line: ~ ],~ + [2354, 1859, 64, 64], +** Processing line: ~ [2292, 1859, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ + [2292, 1859, 64, 64], +** Processing line: ~ [2231, 1857, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_side_of_home_render -** Processing line: ~ }~ + [2231, 1857, 64, 64], +** Processing line: ~ [2198, 1858, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [2198, 1858, 64, 64], +** Processing line: ~ [2353, 1802, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2353, 1802, 64, 64], +** Processing line: ~ [2296, 1798, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_mountain_pass args~ + [2296, 1798, 64, 64], +** Processing line: ~ [2233, 1797, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_mountain_pass args -** Processing line: ~ {~ + [2233, 1797, 64, 64], +** Processing line: ~ [2200, 1797, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ + [2200, 1797, 64, 64], +** Processing line: ~ [2352, 1742, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/mountain-pass-zoomed-out.png', -** Processing line: ~ player: [4, 4],~ + [2352, 1742, 64, 64], +** Processing line: ~ [2288, 1741, 64, 64],~ - Inside source: true *** True Line Result - player: [4, 4], -** Processing line: ~ scenes: [~ + [2288, 1741, 64, 64], +** Processing line: ~ [2230, 1743, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [18, 47, 5, 5, :serenity_alive_path_to_observatory],~ + [2230, 1743, 64, 64], +** Processing line: ~ [2196, 1743, 64, 64],~ - Inside source: true *** True Line Result - [18, 47, 5, 5, :serenity_alive_path_to_observatory], -** Processing line: ~ ],~ + [2196, 1743, 64, 64], +** Processing line: ~ [1736, 460, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [1736, 460, 64, 64], +** Processing line: ~ [1735, 400, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ + [1735, 400, 64, 64], +** Processing line: ~ [1736, 339, 64, 64],~ - Inside source: true *** True Line Result - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] -** Processing line: ~ ],~ + [1736, 339, 64, 64], +** Processing line: ~ [1736, 275, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ + [1736, 275, 64, 64], +** Processing line: ~ [1738, 210, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_mountain_pass_render -** Processing line: ~ }~ + [1738, 210, 64, 64], +** Processing line: ~ [1735, 145, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [1735, 145, 64, 64], +** Processing line: ~ [1735, 87, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1735, 87, 64, 64], +** Processing line: ~ [1736, 51, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_path_to_observatory args~ + [1736, 51, 64, 64], +** Processing line: ~ [539, 289, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_path_to_observatory args -** Processing line: ~ {~ + [539, 289, 64, 64], +** Processing line: ~ [541, 228, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ + [541, 228, 64, 64], +** Processing line: ~ [626, 191, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [60, 4],~ + [626, 191, 64, 64], +** Processing line: ~ [572, 192, 64, 64],~ - Inside source: true *** True Line Result - player: [60, 4], -** Processing line: ~ scenes: [~ + [572, 192, 64, 64], +** Processing line: ~ [540, 193, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 26, 5, 5, :serenity_alive_observatory]~ + [540, 193, 64, 64], +** Processing line: ~ [965, 233, 64, 64],~ - Inside source: true *** True Line Result - [0, 26, 5, 5, :serenity_alive_observatory] -** Processing line: ~ ],~ + [965, 233, 64, 64], +** Processing line: ~ [904, 234, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [904, 234, 64, 64], +** Processing line: ~ [840, 234, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ + [840, 234, 64, 64], +** Processing line: ~ [779, 234, 64, 64],~ - Inside source: true *** True Line Result - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] -** Processing line: ~ ],~ + [779, 234, 64, 64], +** Processing line: ~ [745, 236, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ + [745, 236, 64, 64], +** Processing line: ~ [851, 169, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_path_to_observatory_render -** Processing line: ~ }~ + [851, 169, 64, 64], +** Processing line: ~ [849, 108, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [849, 108, 64, 64], +** Processing line: ~ [852, 50, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [852, 50, 64, 64], +** Processing line: ~ [1237, 289, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_observatory args~ + [1237, 289, 64, 64], +** Processing line: ~ [1236, 228, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_observatory args -** Processing line: ~ {~ + [1236, 228, 64, 64], +** Processing line: ~ [1238, 197, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/observatory.png',~ + [1238, 197, 64, 64], +** Processing line: ~ [1181, 192, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/observatory.png', -** Processing line: ~ player: [60, 2],~ + [1181, 192, 64, 64], +** Processing line: ~ [1152, 192, 64, 64],~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ scenes: [~ + [1152, 192, 64, 64], +** Processing line: ~ [1443, 605, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [28, 39, 4, 10, :serenity_alive_inside_observatory]~ + [1443, 605, 64, 64], +** Processing line: ~ [1419, 606, 64, 64],~ - Inside source: true *** True Line Result - [28, 39, 4, 10, :serenity_alive_inside_observatory] -** Processing line: ~ ],~ + [1419, 606, 64, 64], +** Processing line: ~ [1069, 925, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_observatory_render~ + [1069, 925, 64, 64], +** Processing line: ~ [1068, 902, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_observatory_render -** Processing line: ~ }~ + [1068, 902, 64, 64], +** Processing line: ~ [1024, 927, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [1024, 927, 64, 64], +** Processing line: ~ [1017, 897, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1017, 897, 64, 64], +** Processing line: ~ [963, 926, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_inside_observatory args~ + [963, 926, 64, 64], +** Processing line: ~ [958, 898, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_inside_observatory args -** Processing line: ~ {~ + [958, 898, 64, 64], +** Processing line: ~ [911, 928, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [911, 928, 64, 64], +** Processing line: ~ [911, 896, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ player: [60, 2],~ + [911, 896, 64, 64], +** Processing line: ~ [2132, 803, 64, 64],~ - Inside source: true *** True Line Result - player: [60, 2], -** Processing line: ~ storylines: [],~ + [2132, 803, 64, 64], +** Processing line: ~ [2081, 803, 64, 64],~ - Inside source: true *** True Line Result - storylines: [], -** Processing line: ~ scenes: [~ + [2081, 803, 64, 64], +** Processing line: ~ [2131, 752, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :serenity_alive_inside_mainframe]~ + [2131, 752, 64, 64], +** Processing line: ~ [2077, 751, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :serenity_alive_inside_mainframe] -** Processing line: ~ ],~ + [2077, 751, 64, 64], +** Processing line: ~ [2615, 649, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + [2615, 649, 64, 64], +** Processing line: ~ [2564, 651, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + [2564, 651, 64, 64], +** Processing line: ~ [2533, 650, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [2533, 650, 64, 64], +** Processing line: ~ [2027, 156, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2027, 156, 64, 64], +** Processing line: ~ [1968, 155, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_inside_mainframe args~ + [1968, 155, 64, 64], +** Processing line: ~ [1907, 153, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_inside_mainframe args -** Processing line: ~ {~ + [1907, 153, 64, 64], +** Processing line: ~ [1873, 155, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mainframe.png',~ + [1873, 155, 64, 64], +** Processing line: ~ [2025, 95, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ fade: 60,~ + [2025, 95, 64, 64], +** Processing line: ~ [1953, 98, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 4],~ + [1953, 98, 64, 64], +** Processing line: ~ [1894, 100, 64, 64],~ - Inside source: true *** True Line Result - player: [30, 4], -** Processing line: ~ scenes: [~ + [1894, 100, 64, 64], +** Processing line: ~ [1870, 100, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_top, :serenity_alive_ship_status],~ + [1870, 100, 64, 64], +** Processing line: ~ [2029, 45, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_top, :serenity_alive_ship_status], -** Processing line: ~ ],~ + [2029, 45, 64, 64], +** Processing line: ~ [1971, 48, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [1971, 48, 64, 64], +** Processing line: ~ [1915, 47, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 45, 17, 4, (serenity_alive_last_reply args)],~ + [1915, 47, 64, 64], +** Processing line: ~ [1873, 47, 64, 64],~ - Inside source: true *** True Line Result - [22, 45, 17, 4, (serenity_alive_last_reply args)], -** Processing line: ~ [45, 45, 4, 4, (serenity_alive_current_message args)],~ + [1873, 47, 64, 64], +** Processing line: ~ [3956, 288, 64, 64],~ - Inside source: true *** True Line Result - [45, 45, 4, 4, (serenity_alive_current_message args)], -** Processing line: ~ ]~ + [3956, 288, 64, 64], +** Processing line: ~ [3954, 234, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [3954, 234, 64, 64], +** Processing line: ~ [4042, 190, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4042, 190, 64, 64], +** Processing line: ~ [3990, 190, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3990, 190, 64, 64], +** Processing line: ~ [3958, 195, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_ship_status args~ + [3958, 195, 64, 64], +** Processing line: ~ [3422, 709, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_ship_status args -** Processing line: ~ {~ + [3422, 709, 64, 64], +** Processing line: ~ [3425, 686, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/serenity.png',~ + [3425, 686, 64, 64], +** Processing line: ~ [3368, 709, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/serenity.png', -** Processing line: ~ fade: 60,~ + [3368, 709, 64, 64], +** Processing line: ~ [3364, 683, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 10],~ + [3364, 683, 64, 64], +** Processing line: ~ [3312, 711, 64, 64],~ - Inside source: true *** True Line Result - player: [30, 10], -** Processing line: ~ scenes: [~ + [3312, 711, 64, 64], +** Processing line: ~ [3307, 684, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]~ + [3307, 684, 64, 64], +** Processing line: ~ [3266, 712, 64, 64],~ - Inside source: true *** True Line Result - [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] -** Processing line: ~ ],~ + [3266, 712, 64, 64], +** Processing line: ~ [3269, 681, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [3269, 681, 64, 64], +** Processing line: ~ [4384, 236, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],~ + [4384, 236, 64, 64], +** Processing line: ~ [4320, 234, 64, 64],~ - Inside source: true *** True Line Result - [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], -** Processing line: ~ [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],~ + [4320, 234, 64, 64], +** Processing line: ~ [4257, 235, 64, 64],~ - Inside source: true *** True Line Result - [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], -** Processing line: ~ *serenity_alive_shared_ship_status(args)~ + [4257, 235, 64, 64], +** Processing line: ~ [4192, 234, 64, 64],~ - Inside source: true *** True Line Result - *serenity_alive_shared_ship_status(args) -** Processing line: ~ ]~ + [4192, 234, 64, 64], +** Processing line: ~ [4162, 234, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [4162, 234, 64, 64], +** Processing line: ~ [4269, 171, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4269, 171, 64, 64], +** Processing line: ~ [4267, 111, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4267, 111, 64, 64], +** Processing line: ~ [4266, 52, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_ship_status_reviewed args~ + [4266, 52, 64, 64], +** Processing line: ~ [4580, 458, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_ship_status_reviewed args -** Processing line: ~ {~ + [4580, 458, 64, 64], +** Processing line: ~ [4582, 396, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/serenity.png',~ + [4582, 396, 64, 64], +** Processing line: ~ [4582, 335, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/serenity.png', -** Processing line: ~ fade: 60,~ + [4582, 335, 64, 64], +** Processing line: ~ [4581, 275, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ scenes: [~ + [4581, 275, 64, 64], +** Processing line: ~ [4581, 215, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom, :serenity_alive_time_to_reply]~ + [4581, 215, 64, 64], +** Processing line: ~ [4581, 152, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom, :serenity_alive_time_to_reply] -** Processing line: ~ ],~ + [4581, 152, 64, 64], +** Processing line: ~ [4582, 89, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [4582, 89, 64, 64], +** Processing line: ~ [4583, 51, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],~ + [4583, 51, 64, 64], +** Processing line: ~ [4810, 289, 64, 64],~ - Inside source: true *** True Line Result - [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], -** Processing line: ~ ]~ + [4810, 289, 64, 64], +** Processing line: ~ [4810, 227, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [4810, 227, 64, 64], +** Processing line: ~ [4895, 189, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4895, 189, 64, 64], +** Processing line: ~ [4844, 191, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4844, 191, 64, 64], +** Processing line: ~ [4809, 191, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_time_to_reply args~ + [4809, 191, 64, 64], +** Processing line: ~ [5235, 233, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_time_to_reply args -** Processing line: ~ decision_graph serenity_alive_current_message(args),~ + [5235, 233, 64, 64], +** Processing line: ~ [5176, 232, 64, 64],~ - Inside source: true *** True Line Result - decision_graph serenity_alive_current_message(args), -** Processing line: ~ "Okay... time to deliver the bad news...",~ + [5176, 232, 64, 64], +** Processing line: ~ [5118, 230, 64, 64],~ - Inside source: true *** True Line Result - "Okay... time to deliver the bad news...", -** Processing line: ~ [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],~ + [5118, 230, 64, 64], +** Processing line: ~ [5060, 232, 64, 64],~ - Inside source: true *** True Line Result - [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], -** Processing line: ~ [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]~ + [5060, 232, 64, 64], +** Processing line: ~ [5015, 237, 64, 64],~ - Inside source: true *** True Line Result - [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] -** Processing line: ~ end~ + [5015, 237, 64, 64], +** Processing line: ~ [5123, 171, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5123, 171, 64, 64], +** Processing line: ~ [5123, 114, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_shared_ship_status args~ + [5123, 114, 64, 64], +** Processing line: ~ [5121, 51, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_shared_ship_status args -** Processing line: ~ [~ + [5121, 51, 64, 64], +** Processing line: ~ [5523, 461, 64, 64],~ - Inside source: true *** True Line Result - [ -** Processing line: ~ *ship_control_hotspot( 0, 50,~ + [5523, 461, 64, 64], +** Processing line: ~ [5123, 42, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot( 0, 50, -** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",~ + [5123, 42, 64, 64], +** Processing line: ~ [5525, 401, 64, 64],~ - Inside source: true *** True Line Result - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", -** Processing line: ~ nil,~ + [5525, 401, 64, 64], +** Processing line: ~ [5525, 340, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil,~ + [5525, 340, 64, 64], +** Processing line: ~ [5526, 273, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil),~ + [5526, 273, 64, 64], +** Processing line: ~ [5527, 211, 64, 64],~ - Inside source: true *** True Line Result - nil), -** Processing line: ~ *ship_control_hotspot(12, 35,~ + [5527, 211, 64, 64], +** Processing line: ~ [5525, 150, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(12, 35, -** Processing line: ~ "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",~ + [5525, 150, 64, 64], +** Processing line: ~ [5527, 84, 64, 64],~ - Inside source: true *** True Line Result - "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", -** Processing line: ~ nil,~ + [5527, 84, 64, 64], +** Processing line: ~ [5524, 44, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil,~ + [5524, 44, 64, 64], +** Processing line: ~ [5861, 288, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil),~ + [5861, 288, 64, 64], +** Processing line: ~ [5861, 229, 64, 64],~ - Inside source: true *** True Line Result - nil), -** Processing line: ~ *ship_control_hotspot(24, 20,~ + [5861, 229, 64, 64], +** Processing line: ~ [5945, 193, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(24, 20, -** Processing line: ~ "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",~ + [5945, 193, 64, 64], +** Processing line: ~ [5904, 193, 64, 64],~ - Inside source: true *** True Line Result - "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", -** Processing line: ~ nil,~ + [5904, 193, 64, 64], +** Processing line: ~ [5856, 194, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil,~ + [5856, 194, 64, 64], +** Processing line: ~ [6542, 234, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil),~ + [6542, 234, 64, 64], +** Processing line: ~ [6478, 235, 64, 64],~ - Inside source: true *** True Line Result - nil), -** Processing line: ~ *ship_control_hotspot(36, 35,~ + [6478, 235, 64, 64], +** Processing line: ~ [6413, 238, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(36, 35, -** Processing line: ~ "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",~ + [6413, 238, 64, 64], +** Processing line: ~ [6348, 235, 64, 64],~ - Inside source: true *** True Line Result - "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", -** Processing line: ~ nil,~ + [6348, 235, 64, 64], +** Processing line: ~ [6285, 236, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil,~ + [6285, 236, 64, 64], +** Processing line: ~ [6222, 235, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil),~ + [6222, 235, 64, 64], +** Processing line: ~ [6160, 235, 64, 64],~ - Inside source: true *** True Line Result - nil), -** Processing line: ~ *ship_control_hotspot(48, 50,~ + [6160, 235, 64, 64], +** Processing line: ~ [6097, 236, 64, 64],~ - Inside source: true *** True Line Result - *ship_control_hotspot(48, 50, -** Processing line: ~ "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",~ + [6097, 236, 64, 64], +** Processing line: ~ [6069, 237, 64, 64],~ - Inside source: true *** True Line Result - "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", -** Processing line: ~ nil,~ + [6069, 237, 64, 64], +** Processing line: ~ [6321, 174, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil,~ + [6321, 174, 64, 64], +** Processing line: ~ [6318, 111, 64, 64],~ - Inside source: true *** True Line Result - nil, -** Processing line: ~ nil)~ + [6318, 111, 64, 64], +** Processing line: ~ [6320, 49, 64, 64],~ - Inside source: true *** True Line Result - nil) -** Processing line: ~ ]~ + [6320, 49, 64, 64], +** Processing line: ~ [6753, 291, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + [6753, 291, 64, 64], +** Processing line: ~ [6752, 227, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6752, 227, 64, 64], +** Processing line: ~ [6753, 192, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_firm_reply~ + [6753, 192, 64, 64], +** Processing line: ~ [6692, 191, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_firm_reply -** Processing line: ~ "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."~ + [6692, 191, 64, 64], +** Processing line: ~ [6668, 193, 64, 64],~ - Inside source: true *** True Line Result - "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." -** Processing line: ~ end~ + [6668, 193, 64, 64], +** Processing line: ~ [6336, 604, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6336, 604, 64, 64], +** Processing line: ~ [6309, 603, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_sugarcoated_reply~ + [6309, 603, 64, 64], +** Processing line: ~ [7264, 461, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_sugarcoated_reply -** Processing line: ~ "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."~ + [7264, 461, 64, 64], +** Processing line: ~ [7264, 395, 64, 64],~ - Inside source: true *** True Line Result - "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." -** Processing line: ~ end~ + [7264, 395, 64, 64], +** Processing line: ~ [7264, 333, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7264, 333, 64, 64], +** Processing line: ~ [7264, 270, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_serenity_alive_firmly args~ + [7264, 270, 64, 64], +** Processing line: ~ [7265, 207, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_serenity_alive_firmly args -** Processing line: ~ {~ + [7265, 207, 64, 64], +** Processing line: ~ [7266, 138, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [7266, 138, 64, 64], +** Processing line: ~ [7264, 78, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [7264, 78, 64, 64], +** Processing line: ~ [7266, 48, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + [7266, 48, 64, 64], +** Processing line: ~ [7582, 149, 64, 64],~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [~ + [7582, 149, 64, 64], +** Processing line: ~ [7524, 147, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ + [7524, 147, 64, 64], +** Processing line: ~ [7461, 146, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] -** Processing line: ~ ],~ + [7461, 146, 64, 64], +** Processing line: ~ [7425, 148, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [7425, 148, 64, 64], +** Processing line: ~ [7580, 86, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],~ + [7580, 86, 64, 64], +** Processing line: ~ [7582, 41, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], -** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ + [7582, 41, 64, 64], +** Processing line: ~ [7519, 41, 64, 64],~ - Inside source: true *** True Line Result - *serenity_alive_reply_completed_shared_hotspots(args), -** Processing line: ~ ]~ + [7519, 41, 64, 64], +** Processing line: ~ [7460, 40, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [7460, 40, 64, 64], +** Processing line: ~ [7427, 96, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [7427, 96, 64, 64], +** Processing line: ~ [7427, 41, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7427, 41, 64, 64], +** Processing line: ~ [8060, 288, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_serenity_alive_kindly args~ + [8060, 288, 64, 64], +** Processing line: ~ [8059, 226, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_serenity_alive_kindly args -** Processing line: ~ {~ + [8059, 226, 64, 64], +** Processing line: ~ [8145, 194, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [8145, 194, 64, 64], +** Processing line: ~ [8081, 194, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [8081, 194, 64, 64], +** Processing line: ~ [8058, 195, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + [8058, 195, 64, 64], +** Processing line: ~ [8485, 234, 64, 64],~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [~ + [8485, 234, 64, 64], +** Processing line: ~ [8422, 235, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ + [8422, 235, 64, 64], +** Processing line: ~ [8360, 235, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] -** Processing line: ~ ],~ + [8360, 235, 64, 64], +** Processing line: ~ [8296, 235, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [8296, 235, 64, 64], +** Processing line: ~ [8266, 237, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],~ + [8266, 237, 64, 64], +** Processing line: ~ [8371, 173, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], -** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ + [8371, 173, 64, 64], +** Processing line: ~ [8370, 117, 64, 64],~ - Inside source: true *** True Line Result - *serenity_alive_reply_completed_shared_hotspots(args), -** Processing line: ~ ]~ + [8370, 117, 64, 64], +** Processing line: ~ [8372, 59, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [8372, 59, 64, 64], +** Processing line: ~ [8372, 51, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [8372, 51, 64, 64], +** Processing line: ~ [9147, 192, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9147, 192, 64, 64], +** Processing line: ~ [9063, 287, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_path_from_observatory args~ + [9063, 287, 64, 64], +** Processing line: ~ [9064, 225, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_path_from_observatory args -** Processing line: ~ {~ + [9064, 225, 64, 64], +** Processing line: ~ [9085, 193, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [9085, 193, 64, 64], +** Processing line: ~ [9063, 194, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ + [9063, 194, 64, 64], +** Processing line: ~ [9492, 234, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [4, 21],~ + [9492, 234, 64, 64], +** Processing line: ~ [9428, 234, 64, 64],~ - Inside source: true *** True Line Result - player: [4, 21], -** Processing line: ~ scenes: [~ + [9428, 234, 64, 64], +** Processing line: ~ [9365, 235, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom_right, :serenity_bio_infront_of_home]~ + [9365, 235, 64, 64], +** Processing line: ~ [9302, 235, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom_right, :serenity_bio_infront_of_home] -** Processing line: ~ ],~ + [9302, 235, 64, 64], +** Processing line: ~ [9270, 237, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [9270, 237, 64, 64], +** Processing line: ~ [9374, 172, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]~ + [9374, 172, 64, 64], +** Processing line: ~ [9376, 109, 64, 64],~ - Inside source: true *** True Line Result - [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] -** Processing line: ~ ]~ + [9376, 109, 64, 64], +** Processing line: ~ [9377, 48, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [9377, 48, 64, 64], +** Processing line: ~ [9545, 1060, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [9545, 1060, 64, 64], +** Processing line: ~ [9482, 1062, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9482, 1062, 64, 64], +** Processing line: ~ [9423, 1062, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_reply_completed_shared_hotspots args~ + [9423, 1062, 64, 64], +** Processing line: ~ [9387, 1062, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_reply_completed_shared_hotspots args -** Processing line: ~ [~ + [9387, 1062, 64, 64], +** Processing line: ~ [9541, 999, 64, 64],~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],~ + [9541, 999, 64, 64], +** Processing line: ~ [9542, 953, 64, 64],~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], -** Processing line: ~ [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],~ + [9542, 953, 64, 64], +** Processing line: ~ [9478, 953, 64, 64],~ - Inside source: true *** True Line Result - [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], -** Processing line: ~ [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]~ + [9478, 953, 64, 64], +** Processing line: ~ [9388, 999, 64, 64],~ - Inside source: true *** True Line Result - [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] -** Processing line: ~ ]~ + [9388, 999, 64, 64], +** Processing line: ~ [9414, 953, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + [9414, 953, 64, 64], +** Processing line: ~ [9389, 953, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9389, 953, 64, 64], +** Processing line: ~ [9294, 1194, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_last_reply args~ + [9294, 1194, 64, 64], +** Processing line: ~ [9245, 1195, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_last_reply args -** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ + [9245, 1195, 64, 64], +** Processing line: ~ [9297, 1143, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_to_introduction_seriously -** Processing line: ~ return "Buffer--: \"Hello, Who- is sending-- this message--?\""~ + [9297, 1143, 64, 64], +** Processing line: ~ [9245, 1144, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: \"Hello, Who- is sending-- this message--?\"" -** Processing line: ~ else~ + [9245, 1144, 64, 64], +** Processing line: ~ [5575, 1781, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Buffer--: \"New- phone. Who dis?\""~ + [5575, 1781, 64, 64], +** Processing line: ~ [5574, 1753, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: \"New- phone. Who dis?\"" -** Processing line: ~ end~ + [5574, 1753, 64, 64], +** Processing line: ~ [5522, 1782, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [5522, 1782, 64, 64], +** Processing line: ~ [5518, 1753, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5518, 1753, 64, 64], +** Processing line: ~ [5472, 1783, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_alive_current_message args~ + [5472, 1783, 64, 64], +** Processing line: ~ [5471, 1751, 64, 64],~ - Inside source: true *** True Line Result - def serenity_alive_current_message args -** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ + [5471, 1751, 64, 64], +** Processing line: ~ [5419, 1781, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_to_introduction_seriously -** Processing line: ~ "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote~ + [5419, 1781, 64, 64], +** Processing line: ~ [5421, 1749, 64, 64],~ - Inside source: true *** True Line Result - "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote -** Processing line: ~ else~ + [5421, 1749, 64, 64], +** Processing line: ~ [500, 3207, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote~ + [500, 3207, 64, 64], +** Processing line: ~ [477, 3205, 64, 64],~ - Inside source: true *** True Line Result - "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote -** Processing line: ~ end~ + [477, 3205, 64, 64], +** Processing line: ~ [1282, 3214, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [1282, 3214, 64, 64], +** Processing line: ~ [1221, 3214, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1221, 3214, 64, 64], +** Processing line: ~ [1188, 3215, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + [1188, 3215, 64, 64], +** Processing line: ~ [1345, 3103, 64, 64],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def serenity_bio_infront_of_home args~ + [1345, 3103, 64, 64], +** Processing line: ~ [1288, 3103, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_infront_of_home args -** Processing line: ~ {~ + [1288, 3103, 64, 64], +** Processing line: ~ [1231, 3104, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [1231, 3104, 64, 64], +** Processing line: ~ [1190, 3153, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/front-of-home.png',~ + [1190, 3153, 64, 64], +** Processing line: ~ [1189, 3105, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/front-of-home.png', -** Processing line: ~ player: [54, 23],~ + [1189, 3105, 64, 64], +** Processing line: ~ [2255, 3508, 64, 64],~ - Inside source: true *** True Line Result - player: [54, 23], -** Processing line: ~ scenes: [~ + [2255, 3508, 64, 64], +** Processing line: ~ [2206, 3510, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [44, 34, 8, 14, :serenity_bio_inside_home],~ + [2206, 3510, 64, 64], +** Processing line: ~ [2254, 3458, 64, 64],~ - Inside source: true *** True Line Result - [44, 34, 8, 14, :serenity_bio_inside_home], -** Processing line: ~ [0, 3, 3, 22, :serenity_bio_library]~ + [2254, 3458, 64, 64], +** Processing line: ~ [2202, 3458, 64, 64],~ - Inside source: true *** True Line Result - [0, 3, 3, 22, :serenity_bio_library] -** Processing line: ~ ]~ + [2202, 3458, 64, 64], +** Processing line: ~ [2754, 2930, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [2754, 2930, 64, 64], +** Processing line: ~ [2726, 2932, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [2726, 2932, 64, 64], +** Processing line: ~ [3408, 2874, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3408, 2874, 64, 64], +** Processing line: ~ [3407, 2849, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_bio_inside_home args~ + [3407, 2849, 64, 64], +** Processing line: ~ [3345, 2872, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_inside_home args -** Processing line: ~ {~ + [3345, 2872, 64, 64], +** Processing line: ~ [3342, 2847, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-home.png',~ + [3342, 2847, 64, 64], +** Processing line: ~ [3284, 2874, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 4],~ + [3284, 2874, 64, 64], +** Processing line: ~ [3284, 2848, 64, 64],~ - Inside source: true *** True Line Result - player: [34, 4], -** Processing line: ~ storylines: [~ + [3284, 2848, 64, 64], +** Processing line: ~ [3248, 2878, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 4, 4, 4, "I'm--- completely--- exhausted."],~ + [3248, 2878, 64, 64], +** Processing line: ~ [3252, 2848, 64, 64],~ - Inside source: true *** True Line Result - [34, 4, 4, 4, "I'm--- completely--- exhausted."], -** Processing line: ~ ],~ + [3252, 2848, 64, 64], +** Processing line: ~ [3953, 3274, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [3953, 3274, 64, 64], +** Processing line: ~ [3899, 3277, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 38, 12, 13, :serenity_bio_restless_sleep],~ + [3899, 3277, 64, 64], +** Processing line: ~ [3951, 3222, 64, 64],~ - Inside source: true *** True Line Result - [30, 38, 12, 13, :serenity_bio_restless_sleep], -** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ + [3951, 3222, 64, 64], +** Processing line: ~ [3900, 3222, 64, 64],~ - Inside source: true *** True Line Result - [32, 0, 8, 3, :serenity_bio_infront_of_home], -** Processing line: ~ ]~ + [3900, 3222, 64, 64], +** Processing line: ~ [4310, 2968, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [4310, 2968, 64, 64], +** Processing line: ~ [4246, 2969, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4246, 2969, 64, 64], +** Processing line: ~ [4183, 2965, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4183, 2965, 64, 64], +** Processing line: ~ [4153, 2967, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_bio_restless_sleep args~ + [4153, 2967, 64, 64], +** Processing line: ~ [4311, 2910, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_restless_sleep args -** Processing line: ~ {~ + [4311, 2910, 64, 64], +** Processing line: ~ [4308, 2856, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [4308, 2856, 64, 64], +** Processing line: ~ [4251, 2855, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + [4251, 2855, 64, 64], +** Processing line: ~ [4197, 2857, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ storylines: [~ + [4197, 2857, 64, 64], +** Processing line: ~ [5466, 3184, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],~ + [5466, 3184, 64, 64], +** Processing line: ~ [5466, 3158, 64, 64],~ - Inside source: true *** True Line Result - [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], -** Processing line: ~ ],~ + [5466, 3158, 64, 64], +** Processing line: ~ [5404, 3184, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [5404, 3184, 64, 64], +** Processing line: ~ [5404, 3156, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ + [5404, 3156, 64, 64], +** Processing line: ~ [5343, 3185, 64, 64],~ - Inside source: true *** True Line Result - [32, 0, 8, 3, :serenity_bio_infront_of_home], -** Processing line: ~ ]~ + [5343, 3185, 64, 64], +** Processing line: ~ [5342, 3156, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [5342, 3156, 64, 64], +** Processing line: ~ [5308, 3185, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [5308, 3185, 64, 64], +** Processing line: ~ [5307, 3154, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5307, 3154, 64, 64], +** Processing line: ~ [6163, 2950, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_bio_library args~ + [6163, 2950, 64, 64], +** Processing line: ~ [6111, 2952, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_library args -** Processing line: ~ {~ + [6111, 2952, 64, 64], +** Processing line: ~ [6164, 2898, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/library.png',~ + [6164, 2898, 64, 64], +** Processing line: ~ [6113, 2897, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/library.png', -** Processing line: ~ fade: 60,~ + [6113, 2897, 64, 64], +** Processing line: ~ [7725, 3156, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 7],~ + [7725, 3156, 64, 64], +** Processing line: ~ [7661, 3157, 64, 64],~ - Inside source: true *** True Line Result - player: [30, 7], -** Processing line: ~ scenes: [~ + [7661, 3157, 64, 64], +** Processing line: ~ [7598, 3157, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [21, 35, 3, 18, :serenity_bio_book]~ + [7598, 3157, 64, 64], +** Processing line: ~ [7533, 3156, 64, 64],~ - Inside source: true *** True Line Result - [21, 35, 3, 18, :serenity_bio_book] -** Processing line: ~ ]~ + [7533, 3156, 64, 64], +** Processing line: ~ [7468, 3156, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [7468, 3156, 64, 64], +** Processing line: ~ [7401, 3156, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [7401, 3156, 64, 64], +** Processing line: ~ [7335, 3157, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7335, 3157, 64, 64], +** Processing line: ~ [7270, 3157, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_bio_book args~ + [7270, 3157, 64, 64], +** Processing line: ~ [7208, 3157, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_book args -** Processing line: ~ {~ + [7208, 3157, 64, 64], +** Processing line: ~ [7146, 3157, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/book.png',~ + [7146, 3157, 64, 64], +** Processing line: ~ [7134, 3159, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/book.png', -** Processing line: ~ fade: 60,~ + [7134, 3159, 64, 64], +** Processing line: ~ [6685, 3726, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [6, 52],~ + [6685, 3726, 64, 64], +** Processing line: ~ [6685, 3663, 64, 64],~ - Inside source: true *** True Line Result - player: [6, 52], -** Processing line: ~ storylines: [~ + [6685, 3663, 64, 64], +** Processing line: ~ [6683, 3602, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],~ + [6683, 3602, 64, 64], +** Processing line: ~ [6679, 3538, 64, 64],~ - Inside source: true *** True Line Result - [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], -** Processing line: ~~ + [6679, 3538, 64, 64], +** Processing line: ~ [6680, 3474, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],~ + [6680, 3474, 64, 64], +** Processing line: ~ [6682, 3413, 64, 64],~ - Inside source: true *** True Line Result - [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], -** Processing line: ~ [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],~ + [6682, 3413, 64, 64], +** Processing line: ~ [6681, 3347, 64, 64],~ - Inside source: true *** True Line Result - [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], -** Processing line: ~~ + [6681, 3347, 64, 64], +** Processing line: ~ [6681, 3287, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],~ + [6681, 3287, 64, 64], +** Processing line: ~ [6682, 3223, 64, 64],~ - Inside source: true *** True Line Result - [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], -** Processing line: ~ [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],~ + [6682, 3223, 64, 64], +** Processing line: ~ [6683, 3161, 64, 64],~ - Inside source: true *** True Line Result - [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], -** Processing line: ~~ + [6683, 3161, 64, 64], +** Processing line: ~ [6682, 3102, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],~ + [6682, 3102, 64, 64], +** Processing line: ~ [6684, 3042, 64, 64],~ - Inside source: true *** True Line Result - [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], -** Processing line: ~ [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],~ + [6684, 3042, 64, 64], +** Processing line: ~ [6685, 2980, 64, 64],~ - Inside source: true *** True Line Result - [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], -** Processing line: ~ ],~ + [6685, 2980, 64, 64], +** Processing line: ~ [6685, 2920, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [6685, 2920, 64, 64], +** Processing line: ~ [6683, 2859, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom, :serenity_bio_finally_to_bed]~ + [6683, 2859, 64, 64], +** Processing line: ~ [6684, 2801, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom, :serenity_bio_finally_to_bed] -** Processing line: ~ ]~ + [6684, 2801, 64, 64], +** Processing line: ~ [6686, 2743, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [6686, 2743, 64, 64], +** Processing line: ~ [6683, 2683, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [6683, 2683, 64, 64], +** Processing line: ~ [6681, 2622, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6681, 2622, 64, 64], +** Processing line: ~ [6682, 2559, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def serenity_bio_finally_to_bed args~ + [6682, 2559, 64, 64], +** Processing line: ~ [6683, 2498, 64, 64],~ - Inside source: true *** True Line Result - def serenity_bio_finally_to_bed args -** Processing line: ~ {~ + [6683, 2498, 64, 64], +** Processing line: ~ [6685, 2434, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [6685, 2434, 64, 64], +** Processing line: ~ [6683, 2371, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + [6683, 2371, 64, 64], +** Processing line: ~ [6683, 2306, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [35, 3],~ + [6683, 2306, 64, 64], +** Processing line: ~ [6684, 2242, 64, 64],~ - Inside source: true *** True Line Result - player: [35, 3], -** Processing line: ~ storylines: [~ + [6684, 2242, 64, 64], +** Processing line: ~ [6683, 2177, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],~ + [6683, 2177, 64, 64], +** Processing line: ~ [6683, 2112, 64, 64],~ - Inside source: true *** True Line Result - [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], -** Processing line: ~ ],~ + [6683, 2112, 64, 64], +** Processing line: ~ [6683, 2049, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [6683, 2049, 64, 64], +** Processing line: ~ [6683, 1985, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, 38, 10, 13, :bad_dream],~ + [6683, 1985, 64, 64], +** Processing line: ~ [6682, 1923, 64, 64],~ - Inside source: true *** True Line Result - [32, 38, 10, 13, :bad_dream], -** Processing line: ~ ]~ + [6682, 1923, 64, 64], +** Processing line: ~ [6683, 1860, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [6683, 1860, 64, 64], +** Processing line: ~ [6685, 1797, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [6685, 1797, 64, 64], +** Processing line: ~ [6684, 1735, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6684, 1735, 64, 64], +** Processing line: ~ [6685, 1724, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bad_dream args~ + [6685, 1724, 64, 64], +** Processing line: ~ [7088, 1967, 64, 64],~ - Inside source: true *** True Line Result - def bad_dream args -** Processing line: ~ {~ + [7088, 1967, 64, 64], +** Processing line: ~ [7026, 1966, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 120,~ + [7026, 1966, 64, 64], +** Processing line: ~ [6964, 1967, 64, 64],~ - Inside source: true *** True Line Result - fade: 120, -** Processing line: ~ background: 'sprites/inside-home.png',~ + [6964, 1967, 64, 64], +** Processing line: ~ [6900, 1965, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [34, 35],~ + [6900, 1965, 64, 64], +** Processing line: ~ [6869, 1969, 64, 64],~ - Inside source: true *** True Line Result - player: [34, 35], -** Processing line: ~ storylines: [~ + [6869, 1969, 64, 64], +** Processing line: ~ [6972, 1904, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],~ + [6972, 1904, 64, 64], +** Processing line: ~ [6974, 1840, 64, 64],~ - Inside source: true *** True Line Result - [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], -** Processing line: ~ ],~ + [6974, 1840, 64, 64], +** Processing line: ~ [6971, 1776, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [6971, 1776, 64, 64], +** Processing line: ~ [6971, 1716, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, -1, 8, 3, :bad_dream_observatory]~ + [6971, 1716, 64, 64], +** Processing line: ~ [7168, 1979, 64, 64],~ - Inside source: true *** True Line Result - [32, -1, 8, 3, :bad_dream_observatory] -** Processing line: ~ ]~ + [7168, 1979, 64, 64], +** Processing line: ~ [7170, 1919, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [7170, 1919, 64, 64], +** Processing line: ~ [7169, 1882, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [7169, 1882, 64, 64], +** Processing line: ~ [7115, 1880, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7115, 1880, 64, 64], +** Processing line: ~ [7086, 1881, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bad_dream_observatory args~ + [7086, 1881, 64, 64], +** Processing line: ~ [7725, 1837, 64, 64],~ - Inside source: true *** True Line Result - def bad_dream_observatory args -** Processing line: ~ {~ + [7725, 1837, 64, 64], +** Processing line: ~ [7724, 1776, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [7724, 1776, 64, 64], +** Processing line: ~ [7724, 1728, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 120,~ + [7724, 1728, 64, 64], +** Processing line: ~ [7661, 1727, 64, 64],~ - Inside source: true *** True Line Result - fade: 120, -** Processing line: ~ player: [51, 12],~ + [7661, 1727, 64, 64], +** Processing line: ~ [7603, 1728, 64, 64],~ - Inside source: true *** True Line Result - player: [51, 12], -** Processing line: ~ storylines: [~ + [7603, 1728, 64, 64], +** Processing line: ~ [7571, 1837, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ + [7571, 1837, 64, 64], +** Processing line: ~ [7570, 1774, 64, 64],~ - Inside source: true *** True Line Result - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] -** Processing line: ~ ],~ + [7570, 1774, 64, 64], +** Processing line: ~ [7572, 1725, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [7572, 1725, 64, 64], +** Processing line: ~ [7859, 2134, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [30, 18, 5, 12, :bad_dream_inside_mainframe]~ + [7859, 2134, 64, 64], +** Processing line: ~ [7858, 2070, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, :bad_dream_inside_mainframe] -** Processing line: ~ ],~ + [7858, 2070, 64, 64], +** Processing line: ~ [7858, 2008, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ + [7858, 2008, 64, 64], +** Processing line: ~ [7860, 1942, 64, 64],~ - Inside source: true *** True Line Result - render_override: :blinking_light_inside_observatory_render -** Processing line: ~ }~ + [7860, 1942, 64, 64], +** Processing line: ~ [7856, 1878, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [7856, 1878, 64, 64], +** Processing line: ~ [7860, 1813, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7860, 1813, 64, 64], +** Processing line: ~ [7859, 1750, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bad_dream_inside_mainframe args~ + [7859, 1750, 64, 64], +** Processing line: ~ [7856, 1724, 64, 64],~ - Inside source: true *** True Line Result - def bad_dream_inside_mainframe args -** Processing line: ~ {~ + [7856, 1724, 64, 64], +** Processing line: ~ [8155, 1837, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ player: [32, 4],~ + [8155, 1837, 64, 64], +** Processing line: ~ [8092, 1839, 64, 64],~ - Inside source: true *** True Line Result - player: [32, 4], -** Processing line: ~ background: 'sprites/mainframe.png',~ + [8092, 1839, 64, 64], +** Processing line: ~ [8032, 1838, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ fade: 120,~ + [8032, 1838, 64, 64], +** Processing line: ~ [7999, 1839, 64, 64],~ - Inside source: true *** True Line Result - fade: 120, -** Processing line: ~ storylines: [~ + [7999, 1839, 64, 64], +** Processing line: ~ [8153, 1773, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ + [8153, 1773, 64, 64], +** Processing line: ~ [8154, 1731, 64, 64],~ - Inside source: true *** True Line Result - [22, 45, 17, 4, (bad_dream_last_reply args)], -** Processing line: ~ ],~ + [8154, 1731, 64, 64], +** Processing line: ~ [8090, 1730, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [8090, 1730, 64, 64], +** Processing line: ~ [8035, 1732, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [45, 45, 4, 4, :bad_dream_everyone_dead],~ + [8035, 1732, 64, 64], +** Processing line: ~ [8003, 1776, 64, 64],~ - Inside source: true *** True Line Result - [45, 45, 4, 4, :bad_dream_everyone_dead], -** Processing line: ~ ]~ + [8003, 1776, 64, 64], +** Processing line: ~ [8003, 1730, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [8003, 1730, 64, 64], +** Processing line: ~ [8421, 1978, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [8421, 1978, 64, 64], +** Processing line: ~ [8420, 1917, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [8420, 1917, 64, 64], +** Processing line: ~ [8505, 1878, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bad_dream_everyone_dead args~ + [8505, 1878, 64, 64], +** Processing line: ~ [8443, 1881, 64, 64],~ - Inside source: true *** True Line Result - def bad_dream_everyone_dead args -** Processing line: ~ {~ + [8443, 1881, 64, 64], +** Processing line: ~ [8420, 1882, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mainframe.png',~ + [8420, 1882, 64, 64], +** Processing line: ~ [8847, 1908, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/mainframe.png', -** Processing line: ~ storylines: [~ + [8847, 1908, 64, 64], +** Processing line: ~ [8783, 1908, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ + [8783, 1908, 64, 64], +** Processing line: ~ [8718, 1910, 64, 64],~ - Inside source: true *** True Line Result - [22, 45, 17, 4, (bad_dream_last_reply args)], -** Processing line: ~ [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],~ + [8718, 1910, 64, 64], +** Processing line: ~ [8654, 1910, 64, 64],~ - Inside source: true *** True Line Result - [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], -** Processing line: ~ [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],~ + [8654, 1910, 64, 64], +** Processing line: ~ [8628, 1911, 64, 64],~ - Inside source: true *** True Line Result - [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], -** Processing line: ~ ],~ + [8628, 1911, 64, 64], +** Processing line: ~ [8729, 1847, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [8729, 1847, 64, 64], +** Processing line: ~ [8731, 1781, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [*hotspot_bottom, :anka_inside_room]~ + [8731, 1781, 64, 64], +** Processing line: ~ [8731, 1721, 64, 64],~ - Inside source: true *** True Line Result - [*hotspot_bottom, :anka_inside_room] -** Processing line: ~ ]~ + [8731, 1721, 64, 64], +** Processing line: ~ [9058, 2135, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [9058, 2135, 64, 64], +** Processing line: ~ [9056, 2073, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [9056, 2073, 64, 64], +** Processing line: ~ [9058, 2006, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9058, 2006, 64, 64], +** Processing line: ~ [9057, 1939, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bad_dream_last_reply args~ + [9057, 1939, 64, 64], +** Processing line: ~ [9058, 1876, 64, 64],~ - Inside source: true *** True Line Result - def bad_dream_last_reply args -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ + [9058, 1876, 64, 64], +** Processing line: ~ [9056, 1810, 64, 64],~ - Inside source: true *** True Line Result - if args.state.scene_history.include? :replied_to_serenity_alive_firmly -** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ + [9056, 1810, 64, 64], +** Processing line: ~ [9059, 1745, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: #{serenity_alive_firm_reply.quote}" -** Processing line: ~ else~ + [9059, 1745, 64, 64], +** Processing line: ~ [9060, 1722, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ + [9060, 1722, 64, 64], +** Processing line: ~ [9273, 1977, 64, 64],~ - Inside source: true *** True Line Result - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" -** Processing line: ~ end~ + [9273, 1977, 64, 64], +** Processing line: ~ [9273, 1912, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [9273, 1912, 64, 64], +** Processing line: ~ [9358, 1883, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9358, 1883, 64, 64], +** Processing line: ~ [9298, 1881, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + [9298, 1881, 64, 64], +** Processing line: ~ [9270, 1883, 64, 64],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # decision_graph "Message from Sasha",~ + [9270, 1883, 64, 64], +** Processing line: ~ [9699, 1910, 64, 64],~ - Inside source: true *** True Line Result - # decision_graph "Message from Sasha", -** Processing line: ~ # "I should reply.",~ + [9699, 1910, 64, 64], +** Processing line: ~ [9637, 1910, 64, 64],~ - Inside source: true *** True Line Result - # "I should reply.", -** Processing line: ~ # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"],~ + [9637, 1910, 64, 64], +** Processing line: ~ [9576, 1910, 64, 64],~ - Inside source: true *** True Line Result - # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], -** Processing line: ~ # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]~ + [9576, 1910, 64, 64], +** Processing line: ~ [9512, 1911, 64, 64],~ - Inside source: true *** True Line Result - # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] -** Processing line: ~ def reply_to_introduction args~ + [9512, 1911, 64, 64], +** Processing line: ~ [9477, 1912, 64, 64],~ - Inside source: true *** True Line Result - def reply_to_introduction args -** Processing line: ~ decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",~ + [9477, 1912, 64, 64], +** Processing line: ~ [9584, 1846, 64, 64],~ - Inside source: true *** True Line Result - decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", -** Processing line: ~ "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",~ + [9584, 1846, 64, 64], +** Processing line: ~ [9585, 1783, 64, 64],~ - Inside source: true *** True Line Result - "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", -** Processing line: ~ [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"],~ + [9585, 1783, 64, 64], +** Processing line: ~ [9586, 1719, 64, 64],~ - Inside source: true *** True Line Result - [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], -** Processing line: ~ [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]~ + [9586, 1719, 64, 64], +** Processing line: ~ [8320, 2788, 64, 64],~ - Inside source: true *** True Line Result - [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] -** Processing line: ~ end~ + [8320, 2788, 64, 64], +** Processing line: ~ [8256, 2789, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [8256, 2789, 64, 64], +** Processing line: ~ [8192, 2789, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_seriously args~ + [8192, 2789, 64, 64], +** Processing line: ~ [8180, 2789, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_seriously args -** Processing line: ~ {~ + [8180, 2789, 64, 64], +** Processing line: ~ [8319, 2730, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [8319, 2730, 64, 64], +** Processing line: ~ [8319, 2671, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [8319, 2671, 64, 64], +** Processing line: ~ [8319, 2639, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + [8319, 2639, 64, 64], +** Processing line: ~ [8259, 2639, 64, 64],~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [~ + [8259, 2639, 64, 64], +** Processing line: ~ [8202, 2639, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ + [8202, 2639, 64, 64], +** Processing line: ~ [8179, 2727, 64, 64],~ - Inside source: true *** True Line Result - *replied_to_introduction_shared_scenes(args) -** Processing line: ~ ],~ + [8179, 2727, 64, 64], +** Processing line: ~ [8178, 2665, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [8178, 2665, 64, 64], +** Processing line: ~ [8177, 2636, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],~ + [8177, 2636, 64, 64], +** Processing line: ~ [9360, 3138, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], -** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ + [9360, 3138, 64, 64], +** Processing line: ~ [9296, 3137, 64, 64],~ - Inside source: true *** True Line Result - *replied_to_introduction_shared_storylines(args) -** Processing line: ~ ]~ + [9296, 3137, 64, 64], +** Processing line: ~ [9235, 3139, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [9235, 3139, 64, 64], +** Processing line: ~ [9174, 3139, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [9174, 3139, 64, 64], +** Processing line: ~ [9113, 3138, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9113, 3138, 64, 64], +** Processing line: ~ [9050, 3138, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_humorously args~ + [9050, 3138, 64, 64], +** Processing line: ~ [8988, 3138, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_humorously args -** Processing line: ~ {~ + [8988, 3138, 64, 64], +** Processing line: ~ [8925, 3138, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-observatory.png',~ + [8925, 3138, 64, 64], +** Processing line: ~ [8860, 3136, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-observatory.png', -** Processing line: ~ fade: 60,~ + [8860, 3136, 64, 64], +** Processing line: ~ [8797, 3136, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [32, 21],~ + [8797, 3136, 64, 64], +** Processing line: ~ [8770, 3138, 64, 64],~ - Inside source: true *** True Line Result - player: [32, 21], -** Processing line: ~ scenes: [~ + [8770, 3138, 64, 64], +** Processing line: ~ [8827, 4171, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ + [8827, 4171, 64, 64], +** Processing line: ~ [8827, 4107, 64, 64],~ - Inside source: true *** True Line Result - *replied_to_introduction_shared_scenes(args) -** Processing line: ~ ],~ + [8827, 4107, 64, 64], +** Processing line: ~ [8827, 4043, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [8827, 4043, 64, 64], +** Processing line: ~ [8827, 3978, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],~ + [8827, 3978, 64, 64], +** Processing line: ~ [8825, 3914, 64, 64],~ - Inside source: true *** True Line Result - [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], -** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ + [8825, 3914, 64, 64], +** Processing line: ~ [8824, 3858, 64, 64],~ - Inside source: true *** True Line Result - *replied_to_introduction_shared_storylines(args) -** Processing line: ~ ]~ + [8824, 3858, 64, 64], +** Processing line: ~ [9635, 4234, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [9635, 4234, 64, 64], +** Processing line: ~ [9584, 4235, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [9584, 4235, 64, 64], +** Processing line: ~ [9634, 4187, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9634, 4187, 64, 64], +** Processing line: ~ [9582, 4183, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_shared_storylines args~ + [9582, 4183, 64, 64], +** Processing line: ~ [9402, 5114, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_shared_storylines args -** Processing line: ~ [~ + [9402, 5114, 64, 64], +** Processing line: ~ [9402, 5087, 64, 64],~ - Inside source: true *** True Line Result - [ -** Processing line: ~ [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],~ + [9402, 5087, 64, 64], +** Processing line: ~ [9347, 5113, 64, 64],~ - Inside source: true *** True Line Result - [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], -** Processing line: ~ [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],~ + [9347, 5113, 64, 64], +** Processing line: ~ [9345, 5086, 64, 64],~ - Inside source: true *** True Line Result - [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], -** Processing line: ~ [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]~ + [9345, 5086, 64, 64], +** Processing line: ~ [9287, 5114, 64, 64],~ - Inside source: true *** True Line Result - [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] -** Processing line: ~ ]~ + [9287, 5114, 64, 64], +** Processing line: ~ [9285, 5085, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + [9285, 5085, 64, 64], +** Processing line: ~ [9245, 5114, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9245, 5114, 64, 64], +** Processing line: ~ [9244, 5086, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_shared_scenes args~ + [9244, 5086, 64, 64], +** Processing line: ~ [9336, 5445, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_shared_scenes args -** Processing line: ~ [[60, 0, 4, 32, :replied_to_introduction_observatory]]~ + [9336, 5445, 64, 64], +** Processing line: ~ [9285, 5445, 64, 64],~ - Inside source: true *** True Line Result - [[60, 0, 4, 32, :replied_to_introduction_observatory]] -** Processing line: ~ end~ + [9285, 5445, 64, 64], +** Processing line: ~ [9337, 5395, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9337, 5395, 64, 64], +** Processing line: ~ [9283, 5393, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_observatory args~ + [9283, 5393, 64, 64], +** Processing line: ~ [8884, 4968, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_observatory args -** Processing line: ~ {~ + [8884, 4968, 64, 64], +** Processing line: ~ [8884, 4939, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/observatory.png',~ + [8884, 4939, 64, 64], +** Processing line: ~ [8822, 4967, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/observatory.png', -** Processing line: ~ player: [28, 39],~ + [8822, 4967, 64, 64], +** Processing line: ~ [8823, 4940, 64, 64],~ - Inside source: true *** True Line Result - player: [28, 39], -** Processing line: ~ scenes: [~ + [8823, 4940, 64, 64], +** Processing line: ~ [8765, 4967, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]~ + [8765, 4967, 64, 64], +** Processing line: ~ [8762, 4937, 64, 64],~ - Inside source: true *** True Line Result - [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] -** Processing line: ~ ]~ + [8762, 4937, 64, 64], +** Processing line: ~ [8726, 4969, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [8726, 4969, 64, 64], +** Processing line: ~ [8727, 4939, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [8727, 4939, 64, 64], +** Processing line: ~ [7946, 5248, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7946, 5248, 64, 64], +** Processing line: ~ [7945, 5220, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_path_to_observatory args~ + [7945, 5220, 64, 64], +** Processing line: ~ [7887, 5248, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_path_to_observatory args -** Processing line: ~ {~ + [7887, 5248, 64, 64], +** Processing line: ~ [7886, 5219, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ + [7886, 5219, 64, 64], +** Processing line: ~ [7830, 5248, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/path-to-observatory.png', -** Processing line: ~ player: [0, 26],~ + [7830, 5248, 64, 64], +** Processing line: ~ [7827, 5218, 64, 64],~ - Inside source: true *** True Line Result - player: [0, 26], -** Processing line: ~ scenes: [~ + [7827, 5218, 64, 64], +** Processing line: ~ [7781, 5248, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [60, 0, 4, 20, :replied_to_introduction_mountain_pass]~ + [7781, 5248, 64, 64], +** Processing line: ~ [7781, 5216, 64, 64],~ - Inside source: true *** True Line Result - [60, 0, 4, 20, :replied_to_introduction_mountain_pass] -** Processing line: ~ ],~ + [7781, 5216, 64, 64], +** Processing line: ~ [6648, 4762, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ }~ + [6648, 4762, 64, 64], +** Processing line: ~ [6621, 4761, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [6621, 4761, 64, 64], +** Processing line: ~ [5011, 4446, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5011, 4446, 64, 64], +** Processing line: ~ [4982, 4444, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_mountain_pass args~ + [4982, 4444, 64, 64], +** Processing line: ~ [4146, 4641, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_mountain_pass args -** Processing line: ~ {~ + [4146, 4641, 64, 64], +** Processing line: ~ [4092, 4643, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ + [4092, 4643, 64, 64], +** Processing line: ~ [4145, 4589, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/mountain-pass-zoomed-out.png', -** Processing line: ~ player: [21, 48],~ + [4145, 4589, 64, 64], +** Processing line: ~ [4091, 4590, 64, 64],~ - Inside source: true *** True Line Result - player: [21, 48], -** Processing line: ~ scenes: [~ + [4091, 4590, 64, 64], +** Processing line: ~ [4139, 4497, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [0, 0, 15, 4, :replied_to_introduction_side_of_home]~ + [4139, 4497, 64, 64], +** Processing line: ~ [4135, 4437, 64, 64],~ - Inside source: true *** True Line Result - [0, 0, 15, 4, :replied_to_introduction_side_of_home] -** Processing line: ~ ],~ + [4135, 4437, 64, 64], +** Processing line: ~ [4135, 4383, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [4135, 4383, 64, 64], +** Processing line: ~ [4078, 4495, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]~ + [4078, 4495, 64, 64], +** Processing line: ~ [4014, 4494, 64, 64],~ - Inside source: true *** True Line Result - [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] -** Processing line: ~ ]~ + [4014, 4494, 64, 64], +** Processing line: ~ [3979, 4496, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [3979, 4496, 64, 64], +** Processing line: ~ [4074, 4384, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4074, 4384, 64, 64], +** Processing line: ~ [4015, 4381, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4015, 4381, 64, 64], +** Processing line: ~ [3980, 4433, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def replied_to_introduction_side_of_home args~ + [3980, 4433, 64, 64], +** Processing line: ~ [3981, 4384, 64, 64],~ - Inside source: true *** True Line Result - def replied_to_introduction_side_of_home args -** Processing line: ~ {~ + [3981, 4384, 64, 64], +** Processing line: ~ [3276, 4279, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/side-of-home.png',~ + [3276, 4279, 64, 64], +** Processing line: ~ [3275, 4218, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/side-of-home.png', -** Processing line: ~ player: [58, 29],~ + [3275, 4218, 64, 64], +** Processing line: ~ [3276, 4170, 64, 64],~ - Inside source: true *** True Line Result - player: [58, 29], -** Processing line: ~ scenes: [~ + [3276, 4170, 64, 64], +** Processing line: ~ [3211, 4164, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [2, 0, 61, 2, :speed_of_light_front_of_home]~ + [3211, 4164, 64, 64], +** Processing line: ~ [3213, 4280, 64, 64],~ - Inside source: true *** True Line Result - [2, 0, 61, 2, :speed_of_light_front_of_home] -** Processing line: ~ ],~ + [3213, 4280, 64, 64], +** Processing line: ~ [3156, 4278, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ }~ + [3156, 4278, 64, 64], +** Processing line: ~ [3120, 4278, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [3120, 4278, 64, 64], +** Processing line: ~ [3151, 4163, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3151, 4163, 64, 64], +** Processing line: ~ [3120, 4216, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + [3120, 4216, 64, 64], +** Processing line: ~ [3120, 4161, 64, 64],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def speed_of_light_front_of_home args~ + [3120, 4161, 64, 64], +** Processing line: ~ [1536, 4171, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_front_of_home args -** Processing line: ~ {~ + [1536, 4171, 64, 64], +** Processing line: ~ [1536, 4110, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/front-of-home.png',~ + [1536, 4110, 64, 64], +** Processing line: ~ [1535, 4051, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/front-of-home.png', -** Processing line: ~ player: [54, 23],~ + [1535, 4051, 64, 64], +** Processing line: ~ [1536, 3991, 64, 64],~ - Inside source: true *** True Line Result - player: [54, 23], -** Processing line: ~ scenes: [~ + [1536, 3991, 64, 64], +** Processing line: ~ [1536, 3928, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [44, 34, 8, 14, :speed_of_light_inside_home],~ + [1536, 3928, 64, 64], +** Processing line: ~ [1536, 3863, 64, 64],~ - Inside source: true *** True Line Result - [44, 34, 8, 14, :speed_of_light_inside_home], -** Processing line: ~ [0, 3, 3, 22, :speed_of_light_outside_library]~ + [1536, 3863, 64, 64], +** Processing line: ~ [1078, 4605, 64, 64],~ - Inside source: true *** True Line Result - [0, 3, 3, 22, :speed_of_light_outside_library] -** Processing line: ~ ]~ + [1078, 4605, 64, 64], +** Processing line: ~ [1076, 4577, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [1076, 4577, 64, 64], +** Processing line: ~ [1018, 4604, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [1018, 4604, 64, 64], +** Processing line: ~ [1018, 4575, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1018, 4575, 64, 64], +** Processing line: ~ [957, 4606, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_inside_home args~ + [957, 4606, 64, 64], +** Processing line: ~ [960, 4575, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_inside_home args -** Processing line: ~ {~ + [960, 4575, 64, 64], +** Processing line: ~ [918, 4602, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/inside-home.png',~ + [918, 4602, 64, 64], +** Processing line: ~ [918, 4580, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [35, 4],~ + [918, 4580, 64, 64], +** Processing line: ~ [394, 4164, 64, 64],~ - Inside source: true *** True Line Result - player: [35, 4], -** Processing line: ~ storylines: [~ + [394, 4164, 64, 64], +** Processing line: ~ [335, 4163, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]~ + [335, 4163, 64, 64], +** Processing line: ~ [274, 4161, 64, 64],~ - Inside source: true *** True Line Result - [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] -** Processing line: ~ ],~ + [274, 4161, 64, 64], +** Processing line: ~ [236, 4163, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [236, 4163, 64, 64], +** Processing line: ~ [394, 4140, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [32, 0, 8, 3, :speed_of_light_front_of_home],~ + [394, 4140, 64, 64], +** Processing line: ~ [329, 4139, 64, 64],~ - Inside source: true *** True Line Result - [32, 0, 8, 3, :speed_of_light_front_of_home], -** Processing line: ~ ]~ + [329, 4139, 64, 64], +** Processing line: ~ [268, 4139, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [268, 4139, 64, 64], +** Processing line: ~ [239, 4139, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [239, 4139, 64, 64], +** Processing line: ~ [4326, 5073, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4326, 5073, 64, 64], +** Processing line: ~ [4324, 5042, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_outside_library args~ + [4324, 5042, 64, 64], +** Processing line: ~ [4265, 5074, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_outside_library args -** Processing line: ~ {~ + [4265, 5074, 64, 64], +** Processing line: ~ [4263, 5042, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/outside-library.png',~ + [4263, 5042, 64, 64], +** Processing line: ~ [4214, 5072, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/outside-library.png', -** Processing line: ~ player: [55, 19],~ + [4214, 5072, 64, 64], +** Processing line: ~ [4211, 5043, 64, 64],~ - Inside source: true *** True Line Result - player: [55, 19], -** Processing line: ~ scenes: [~ + [4211, 5043, 64, 64], +** Processing line: ~ [4166, 5073, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [49, 39, 6, 10, :speed_of_light_library],~ + [4166, 5073, 64, 64], +** Processing line: ~ [4164, 5041, 64, 64],~ - Inside source: true *** True Line Result - [49, 39, 6, 10, :speed_of_light_library], -** Processing line: ~ [61, 11, 3, 20, :speed_of_light_front_of_home]~ + [4164, 5041, 64, 64], +** Processing line: ~ [4844, 5216, 64, 64],~ - Inside source: true *** True Line Result - [61, 11, 3, 20, :speed_of_light_front_of_home] -** Processing line: ~ ]~ + [4844, 5216, 64, 64], +** Processing line: ~ [4844, 5189, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [4844, 5189, 64, 64], +** Processing line: ~ [4785, 5217, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4785, 5217, 64, 64], +** Processing line: ~ [4790, 5187, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4790, 5187, 64, 64], +** Processing line: ~ [4726, 5219, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_library args~ + [4726, 5219, 64, 64], +** Processing line: ~ [4728, 5185, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_library args -** Processing line: ~ {~ + [4728, 5185, 64, 64], +** Processing line: ~ [4681, 5218, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/library.png',~ + [4681, 5218, 64, 64], +** Processing line: ~ [4684, 5186, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/library.png', -** Processing line: ~ player: [30, 7],~ + [4684, 5186, 64, 64], +** Processing line: ~ [4789, 4926, 64, 64],~ - Inside source: true *** True Line Result - player: [30, 7], -** Processing line: ~ scenes: [~ + [4789, 4926, 64, 64], +** Processing line: ~ [4734, 4928, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]~ + [4734, 4928, 64, 64], +** Processing line: ~ [4787, 4876, 64, 64],~ - Inside source: true *** True Line Result - [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] -** Processing line: ~ ]~ + [4787, 4876, 64, 64], +** Processing line: ~ [4738, 4874, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [4738, 4874, 64, 64], +** Processing line: ~ [4775, 5548, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [4775, 5548, 64, 64], +** Processing line: ~ [4775, 5495, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4775, 5495, 64, 64], +** Processing line: ~ [4723, 5550, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_celestial_bodies_diagram args~ + [4723, 5550, 64, 64], +** Processing line: ~ [4725, 5494, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_celestial_bodies_diagram args -** Processing line: ~ {~ + [4725, 5494, 64, 64], +** Processing line: ~ [1360, 5269, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/planets.png',~ + [1360, 5269, 64, 64], +** Processing line: ~ [1362, 5218, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/planets.png', -** Processing line: ~ fade: 60,~ + [1362, 5218, 64, 64], +** Processing line: ~ [1315, 5266, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ player: [30, 3],~ + [1315, 5266, 64, 64], +** Processing line: ~ [1282, 5266, 64, 64],~ - Inside source: true *** True Line Result - player: [30, 3], -** Processing line: ~ scenes: [~ + [1282, 5266, 64, 64], +** Processing line: ~ [1246, 5311, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]~ + [1246, 5311, 64, 64], +** Processing line: ~ [1190, 5312, 64, 64],~ - Inside source: true *** True Line Result - [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] -** Processing line: ~ ],~ + [1190, 5312, 64, 64], +** Processing line: ~ [1136, 5310, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [1136, 5310, 64, 64], +** Processing line: ~ [1121, 5427, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],~ + [1121, 5427, 64, 64], +** Processing line: ~ [1121, 5370, 64, 64],~ - Inside source: true *** True Line Result - [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], -** Processing line: ~~ + [1121, 5370, 64, 64], +** Processing line: ~ [1074, 5427, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ + [1074, 5427, 64, 64], +** Processing line: ~ [1064, 5423, 64, 64],~ - Inside source: true *** True Line Result - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], -** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ + [1064, 5423, 64, 64], +** Processing line: ~ [1052, 5417, 64, 64],~ - Inside source: true *** True Line Result - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], -** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ + [1052, 5417, 64, 64], +** Processing line: ~ [1050, 5368, 64, 64],~ - Inside source: true *** True Line Result - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], -** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ + [1050, 5368, 64, 64], +** Processing line: ~ [1008, 5314, 64, 64],~ - Inside source: true *** True Line Result - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], -** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ + [1008, 5314, 64, 64], +** Processing line: ~ [997, 5307, 64, 64],~ - Inside source: true *** True Line Result - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], -** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ + [997, 5307, 64, 64], +** Processing line: ~ [977, 5299, 64, 64],~ - Inside source: true *** True Line Result - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], -** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ + [977, 5299, 64, 64], +** Processing line: ~ [976, 5248, 64, 64],~ - Inside source: true *** True Line Result - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], -** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ + [976, 5248, 64, 64], +** Processing line: ~ [825, 5267, 64, 64],~ - Inside source: true *** True Line Result - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], -** Processing line: ~ # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],~ + [825, 5267, 64, 64], +** Processing line: ~ [826, 5213, 64, 64],~ - Inside source: true *** True Line Result - # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], -** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],~ + [826, 5213, 64, 64], +** Processing line: ~ [776, 5267, 64, 64],~ - Inside source: true *** True Line Result - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], -** Processing line: ~ ]~ + [776, 5267, 64, 64], +** Processing line: ~ [768, 5261, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [768, 5261, 64, 64], +** Processing line: ~ [755, 5256, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [755, 5256, 64, 64], +** Processing line: ~ [753, 5209, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [753, 5209, 64, 64], +** Processing line: ~ [1299, 5206, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_distance_discovered args~ + [1299, 5206, 64, 64], +** Processing line: ~ [1238, 5204, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_distance_discovered args -** Processing line: ~ {~ + [1238, 5204, 64, 64], +** Processing line: ~ [1178, 5203, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ background: 'sprites/planets.png',~ + [1178, 5203, 64, 64], +** Processing line: ~ [1124, 5204, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/planets.png', -** Processing line: ~ scenes: [~ + [1124, 5204, 64, 64], +** Processing line: ~ [1065, 5206, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [13, 0, 44, 3, :speed_of_light_end_of_day]~ + [1065, 5206, 64, 64], +** Processing line: ~ [1008, 5203, 64, 64],~ - Inside source: true *** True Line Result - [13, 0, 44, 3, :speed_of_light_end_of_day] -** Processing line: ~ ],~ + [1008, 5203, 64, 64], +** Processing line: ~ [977, 5214, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ storylines: [~ + [977, 5214, 64, 64], +** Processing line: ~ [410, 5313, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ + [410, 5313, 64, 64], +** Processing line: ~ [407, 5249, 64, 64],~ - Inside source: true *** True Line Result - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], -** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ + [407, 5249, 64, 64], +** Processing line: ~ [411, 5225, 64, 64],~ - Inside source: true *** True Line Result - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], -** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ + [411, 5225, 64, 64], +** Processing line: ~ [397, 5217, 64, 64],~ - Inside source: true *** True Line Result - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], -** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ + [397, 5217, 64, 64], +** Processing line: ~ [378, 5209, 64, 64],~ - Inside source: true *** True Line Result - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], -** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ + [378, 5209, 64, 64], +** Processing line: ~ [358, 5312, 64, 64],~ - Inside source: true *** True Line Result - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], -** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ + [358, 5312, 64, 64], +** Processing line: ~ [287, 5427, 64, 64],~ - Inside source: true *** True Line Result - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], -** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ + [287, 5427, 64, 64], +** Processing line: ~ [286, 5364, 64, 64],~ - Inside source: true *** True Line Result - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], -** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ + [286, 5364, 64, 64], +** Processing line: ~ [300, 5313, 64, 64],~ - Inside source: true *** True Line Result - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], -** Processing line: ~ [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],~ + [300, 5313, 64, 64], +** Processing line: ~ [242, 5427, 64, 64],~ - Inside source: true *** True Line Result - [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], -** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],~ + [242, 5427, 64, 64], +** Processing line: ~ [229, 5420, 64, 64],~ - Inside source: true *** True Line Result - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], -** Processing line: ~ ]~ + [229, 5420, 64, 64], +** Processing line: ~ [217, 5416, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [217, 5416, 64, 64], +** Processing line: ~ [215, 5364, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [215, 5364, 64, 64], +** Processing line: ~ [174, 5311, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [174, 5311, 64, 64], +** Processing line: ~ [165, 5308, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def speed_of_light_end_of_day args~ + [165, 5308, 64, 64], +** Processing line: ~ [139, 5300, 64, 64],~ - Inside source: true *** True Line Result - def speed_of_light_end_of_day args -** Processing line: ~ {~ + [139, 5300, 64, 64], +** Processing line: ~ [141, 5236, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ fade: 60,~ + [141, 5236, 64, 64], +** Processing line: ~ [141, 5211, 64, 64],~ - Inside source: true *** True Line Result - fade: 60, -** Processing line: ~ background: 'sprites/inside-home.png',~ + [141, 5211, 64, 64], +** Processing line: ~ [315, 5208, 64, 64],~ - Inside source: true *** True Line Result - background: 'sprites/inside-home.png', -** Processing line: ~ player: [35, 0],~ + [315, 5208, 64, 64], +** Processing line: ~ [251, 5208, 64, 64],~ - Inside source: true *** True Line Result - player: [35, 0], -** Processing line: ~ storylines: [~ + [251, 5208, 64, 64], +** Processing line: ~ [211, 5211, 64, 64],~ - Inside source: true *** True Line Result - storylines: [ -** Processing line: ~ [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]~ + [211, 5211, 64, 64], +** Processing line: ~ [8050, 4060, 64, 64],~ - Inside source: true *** True Line Result - [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] -** Processing line: ~ ],~ + [8050, 4060, 64, 64], +** Processing line: ~ [7992, 4060, 64, 64],~ - Inside source: true *** True Line Result - ], -** Processing line: ~ scenes: [~ + [7992, 4060, 64, 64], +** Processing line: ~ [7929, 4060, 64, 64],~ - Inside source: true *** True Line Result - scenes: [ -** Processing line: ~ [31, 38, 10, 12, :serenity_alive_side_of_home]~ + [7929, 4060, 64, 64], +** Processing line: ~ [7866, 4061, 64, 64],~ - Inside source: true *** True Line Result - [31, 38, 10, 12, :serenity_alive_side_of_home] -** Processing line: ~ ]~ + [7866, 4061, 64, 64], +** Processing line: ~ [7828, 4063, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ }~ + [7828, 4063, 64, 64], +** Processing line: ~ [7934, 4001, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [7934, 4001, 64, 64], +** Processing line: ~ [7935, 3936, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7935, 3936, 64, 64], +** Processing line: ~ [7935, 3875, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_platformer/clepto_frog/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_platformer/clepto_frog/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + [7935, 3875, 64, 64], +** Processing line: ~ [7622, 4111, 64, 64],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ + [7622, 4111, 64, 64], +** Processing line: ~ [7623, 4049, 64, 64],~ - Inside source: true *** True Line Result - MAP_FILE_PATH = 'app/map.txt' -** Processing line: ~~ + [7623, 4049, 64, 64], +** Processing line: ~ [7707, 4018, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ require 'app/map.rb'~ + [7707, 4018, 64, 64], +** Processing line: ~ [7663, 4019, 64, 64],~ - Inside source: true *** True Line Result - require 'app/map.rb' -** Processing line: ~~ + [7663, 4019, 64, 64], +** Processing line: ~ [7623, 4017, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ class CleptoFrog~ + [7623, 4017, 64, 64], +** Processing line: ~ [7193, 4060, 64, 64],~ - Inside source: true *** True Line Result - class CleptoFrog -** Processing line: ~ attr_gtk~ + [7193, 4060, 64, 64], +** Processing line: ~ [7131, 4059, 64, 64],~ - Inside source: true *** True Line Result - attr_gtk -** Processing line: ~~ + [7131, 4059, 64, 64], +** Processing line: ~ [7070, 4057, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_ending~ + [7070, 4057, 64, 64], +** Processing line: ~ [7008, 4060, 64, 64],~ - Inside source: true *** True Line Result - def render_ending -** Processing line: ~ state.game_over_at ||= state.tick_count~ + [7008, 4060, 64, 64], +** Processing line: ~ [6977, 4060, 64, 64],~ - Inside source: true *** True Line Result - state.game_over_at ||= state.tick_count -** Processing line: ~~ + [6977, 4060, 64, 64], +** Processing line: ~ [7080, 3998, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ + [7080, 3998, 64, 64], +** Processing line: ~ [7081, 3935, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Clepto Frog", 4, 1] -** Processing line: ~~ + [7081, 3935, 64, 64], +** Processing line: ~ [7080, 3873, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ + [7080, 3873, 64, 64], +** Processing line: ~ [6855, 4019, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 120) -** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ + [6855, 4019, 64, 64], +** Processing line: ~ [6790, 4018, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ + [6790, 4018, 64, 64], +** Processing line: ~ [6770, 4114, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] -** Processing line: ~ end~ + [6770, 4114, 64, 64], +** Processing line: ~ [6770, 4060, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6770, 4060, 64, 64], +** Processing line: ~ [6768, 4013, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ + [6768, 4013, 64, 64], +** Processing line: ~ [6345, 4060, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 240) -** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ + [6345, 4060, 64, 64], +** Processing line: ~ [6284, 4062, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ + [6284, 4062, 64, 64], +** Processing line: ~ [6222, 4061, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)] -** Processing line: ~ end~ + [6222, 4061, 64, 64], +** Processing line: ~ [6166, 4061, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6166, 4061, 64, 64], +** Processing line: ~ [6124, 4066, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ + [6124, 4066, 64, 64], +** Processing line: ~ [6226, 3995, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 360) -** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ + [6226, 3995, 64, 64], +** Processing line: ~ [6226, 3933, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ + [6226, 3933, 64, 64], +** Processing line: ~ [6228, 3868, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)] -** Processing line: ~ end~ + [6228, 3868, 64, 64], +** Processing line: ~ [5916, 4113, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5916, 4113, 64, 64], +** Processing line: ~ [5918, 4052, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ + [5918, 4052, 64, 64], +** Processing line: ~ [6001, 4018, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << [640 - 50, 360 - 50, 100, 100, -** Processing line: ~ "sprites/square-green.png"]~ + [6001, 4018, 64, 64], +** Processing line: ~ [5941, 4019, 64, 64],~ - Inside source: true *** True Line Result - "sprites/square-green.png"] -** Processing line: ~~ + [5941, 4019, 64, 64], +** Processing line: ~ [5918, 4020, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ + [5918, 4020, 64, 64], +** Processing line: ~ [5501, 4059, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1] -** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ + [5501, 4059, 64, 64], +** Processing line: ~ [5439, 4061, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1] -** Processing line: ~~ + [5439, 4061, 64, 64], +** Processing line: ~ [5376, 4059, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ + [5376, 4059, 64, 64], +** Processing line: ~ [5312, 4058, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= (state.game_over_at + 550) -** Processing line: ~ restart_game~ + [5312, 4058, 64, 64], +** Processing line: ~ [5285, 4062, 64, 64],~ - Inside source: true *** True Line Result - restart_game -** Processing line: ~ end~ + [5285, 4062, 64, 64], +** Processing line: ~ [5388, 3999, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [5388, 3999, 64, 64], +** Processing line: ~ [5385, 3941, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5385, 3941, 64, 64], +** Processing line: ~ [5384, 3874, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def restart_game~ + [5384, 3874, 64, 64], +** Processing line: ~ [5075, 4112, 64, 64],~ - Inside source: true *** True Line Result - def restart_game -** Processing line: ~ state.world = nil~ + [5075, 4112, 64, 64], +** Processing line: ~ [5074, 4051, 64, 64],~ - Inside source: true *** True Line Result - state.world = nil -** Processing line: ~ state.x = nil~ + [5074, 4051, 64, 64], +** Processing line: ~ [5158, 4018, 64, 64],~ - Inside source: true *** True Line Result - state.x = nil -** Processing line: ~ state.y = nil~ + [5158, 4018, 64, 64], +** Processing line: ~ [5095, 4020, 64, 64],~ - Inside source: true *** True Line Result - state.y = nil -** Processing line: ~ state.dx = nil~ + [5095, 4020, 64, 64], +** Processing line: ~ [5073, 4018, 64, 64],~ - Inside source: true *** True Line Result - state.dx = nil -** Processing line: ~ state.dy = nil~ + [5073, 4018, 64, 64], +** Processing line: ~ [4549, 3998, 64, 64],~ - Inside source: true *** True Line Result - state.dy = nil -** Processing line: ~ state.stuff_score = 0~ + [4549, 3998, 64, 64], +** Processing line: ~ [4393, 3996, 64, 64],~ - Inside source: true *** True Line Result - state.stuff_score = 0 -** Processing line: ~ state.stuff_time = 0~ + [4393, 3996, 64, 64], +** Processing line: ~ [4547, 3938, 64, 64],~ - Inside source: true *** True Line Result - state.stuff_time = 0 -** Processing line: ~ state.intro_tick_count = nil~ + [4547, 3938, 64, 64], +** Processing line: ~ [4547, 3886, 64, 64],~ - Inside source: true *** True Line Result - state.intro_tick_count = nil -** Processing line: ~ defaults~ + [4547, 3886, 64, 64], +** Processing line: ~ [4488, 3885, 64, 64],~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ state.game_start_at = state.tick_count~ + [4488, 3885, 64, 64], +** Processing line: ~ [4427, 3885, 64, 64],~ - Inside source: true *** True Line Result - state.game_start_at = state.tick_count -** Processing line: ~ state.scene = :game~ + [4427, 3885, 64, 64], +** Processing line: ~ [4395, 3938, 64, 64],~ - Inside source: true *** True Line Result - state.scene = :game -** Processing line: ~ state.game_over_at = nil~ + [4395, 3938, 64, 64], +** Processing line: ~ [4395, 3885, 64, 64],~ - Inside source: true *** True Line Result - state.game_over_at = nil -** Processing line: ~ end~ + [4395, 3885, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_intro~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - def render_intro -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 700, "Clepto Frog", 4, 1] -** Processing line: ~ if state.tick_count >= 120~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= 120 -** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ + [0, 5137, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 120.ease(60)] -** Processing line: ~ end~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= 240~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= 240 -** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ + [0, 5137, 64, 64], +** Processing line: ~ [1215, 2421, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ + [1215, 2421, 64, 64], +** Processing line: ~ [1214, 2360, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 240.ease(60)] -** Processing line: ~ end~ + [1214, 2360, 64, 64], +** Processing line: ~ [1211, 2300, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1211, 2300, 64, 64], +** Processing line: ~ [1211, 2291, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= 360~ + [1211, 2291, 64, 64], +** Processing line: ~ [1158, 2420, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= 360 -** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ + [1158, 2420, 64, 64], +** Processing line: ~ [1156, 2358, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 540, "\"Uh...\" - New Guy", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ + [1156, 2358, 64, 64], +** Processing line: ~ [1149, 2291, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 360.ease(60)] -** Processing line: ~ end~ + [1149, 2291, 64, 64], +** Processing line: ~ [1095, 2420, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1095, 2420, 64, 64], +** Processing line: ~ [1030, 2418, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= 480~ + [1030, 2418, 64, 64], +** Processing line: ~ [966, 2419, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= 480 -** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ + [966, 2419, 64, 64], +** Processing line: ~ [903, 2419, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ + [903, 2419, 64, 64], +** Processing line: ~ [852, 2419, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 480.ease(60)] -** Processing line: ~ end~ + [852, 2419, 64, 64], +** Processing line: ~ [1087, 2291, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1087, 2291, 64, 64], +** Processing line: ~ [1023, 2291, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count >= 600~ + [1023, 2291, 64, 64], +** Processing line: ~ [960, 2291, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count >= 600 -** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ + [960, 2291, 64, 64], +** Processing line: ~ [896, 2292, 64, 64],~ - Inside source: true *** True Line Result - outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ + [896, 2292, 64, 64], +** Processing line: ~ [854, 2355, 64, 64],~ - Inside source: true *** True Line Result - 4, 1, 0, 0, 0, 255 * 600.ease(60)] -** Processing line: ~ end~ + [854, 2355, 64, 64], +** Processing line: ~ [854, 2292, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [854, 2292, 64, 64], +** Processing line: ~ [675, 3017, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ + [675, 3017, 64, 64], +** Processing line: ~ [622, 3017, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << [640 - 50, 360 - 50, 100, 100, -** Processing line: ~ "sprites/square-green.png"]~ + [622, 3017, 64, 64], +** Processing line: ~ [676, 2965, 64, 64],~ - Inside source: true *** True Line Result - "sprites/square-green.png"] -** Processing line: ~~ + [676, 2965, 64, 64], +** Processing line: ~ [622, 2965, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count == 800~ + [622, 2965, 64, 64], +** Processing line: ~ [1560, 3212, 64, 64],~ - Inside source: true *** True Line Result - if state.tick_count == 800 -** Processing line: ~ state.scene = :game~ + [1560, 3212, 64, 64], +** Processing line: ~ [1496, 3212, 64, 64],~ - Inside source: true *** True Line Result - state.scene = :game -** Processing line: ~ state.game_start_at = state.tick_count~ + [1496, 3212, 64, 64], +** Processing line: ~ [1430, 3211, 64, 64],~ - Inside source: true *** True Line Result - state.game_start_at = state.tick_count -** Processing line: ~ end~ + [1430, 3211, 64, 64], +** Processing line: ~ [1346, 3214, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [1346, 3214, 64, 64], +** Processing line: ~ [1410, 3213, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1410, 3213, 64, 64], +** Processing line: ~ [1560, 3147, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick~ + [1560, 3147, 64, 64], +** Processing line: ~ [1559, 3105, 64, 64],~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + [1559, 3105, 64, 64], +** Processing line: ~ [1496, 3105, 64, 64],~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ + [1496, 3105, 64, 64], +** Processing line: ~ [1442, 3105, 64, 64],~ - Inside source: true *** True Line Result - if state.scene == :intro && state.tick_count <= 800 -** Processing line: ~ render_intro~ + [1442, 3105, 64, 64], +** Processing line: ~ [1412, 3106, 64, 64],~ - Inside source: true *** True Line Result - render_intro -** Processing line: ~ elsif state.scene == :ending~ + [1412, 3106, 64, 64], +** Processing line: ~ [918, 4163, 64, 64],~ - Inside source: true *** True Line Result - elsif state.scene == :ending -** Processing line: ~ render_ending~ + [918, 4163, 64, 64], +** Processing line: ~ [854, 4161, 64, 64],~ - Inside source: true *** True Line Result - render_ending -** Processing line: ~ else~ + [854, 4161, 64, 64], +** Processing line: ~ [792, 4160, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ render~ + [792, 4160, 64, 64], +** Processing line: ~ [729, 4159, 64, 64],~ - Inside source: true *** True Line Result - render -** Processing line: ~ end~ + [729, 4159, 64, 64], +** Processing line: ~ [666, 4158, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ calc~ + [666, 4158, 64, 64], +** Processing line: ~ [601, 4158, 64, 64],~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + [601, 4158, 64, 64], +** Processing line: ~ [537, 4156, 64, 64],~ - Inside source: true *** True Line Result - process_inputs -** Processing line: ~ end~ + [537, 4156, 64, 64], +** Processing line: ~ [918, 4137, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [918, 4137, 64, 64], +** Processing line: ~ [854, 4137, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults~ + [854, 4137, 64, 64], +** Processing line: ~ [789, 4136, 64, 64],~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.scene ||= :intro~ + [789, 4136, 64, 64], +** Processing line: ~ [726, 4137, 64, 64],~ - Inside source: true *** True Line Result - state.scene ||= :intro -** Processing line: ~ state.stuff_score ||= 0~ + [726, 4137, 64, 64], +** Processing line: ~ [661, 4137, 64, 64],~ - Inside source: true *** True Line Result - state.stuff_score ||= 0 -** Processing line: ~ state.stuff_time ||= 0~ + [661, 4137, 64, 64], +** Processing line: ~ [599, 4139, 64, 64],~ - Inside source: true *** True Line Result - state.stuff_time ||= 0 -** Processing line: ~ state.stuff_best_time ||= nil~ + [599, 4139, 64, 64], +** Processing line: ~ [538, 4137, 64, 64],~ - Inside source: true *** True Line Result - state.stuff_best_time ||= nil -** Processing line: ~ state.camera_x ||= 0~ + [538, 4137, 64, 64], +** Processing line: ~ [5378, 4254, 64, 64],~ - Inside source: true *** True Line Result - state.camera_x ||= 0 -** Processing line: ~ state.camera_y ||= 0~ + [5378, 4254, 64, 64], +** Processing line: ~ [5440, 4204, 64, 64],~ - Inside source: true *** True Line Result - state.camera_y ||= 0 -** Processing line: ~ state.target_camera_scale ||= 1~ + [5440, 4204, 64, 64], +** Processing line: ~ [5405, 4214, 64, 64],~ - Inside source: true *** True Line Result - state.target_camera_scale ||= 1 -** Processing line: ~ state.camera_scale ||= 1~ + [5405, 4214, 64, 64], +** Processing line: ~ [5350, 4254, 64, 64],~ - Inside source: true *** True Line Result - state.camera_scale ||= 1 -** Processing line: ~ state.tongue_length ||= 100~ + [5350, 4254, 64, 64], +** Processing line: ~ [5439, 4177, 64, 64],~ - Inside source: true *** True Line Result - state.tongue_length ||= 100 -** Processing line: ~ state.dev_action ||= :collision_mode~ + [5439, 4177, 64, 64], +** Processing line: ~ [5413, 4173, 64, 64],~ - Inside source: true *** True Line Result - state.dev_action ||= :collision_mode -** Processing line: ~ state.action ||= :aiming~ + [5413, 4173, 64, 64], +** Processing line: ~ [5399, 4128, 64, 64],~ - Inside source: true *** True Line Result - state.action ||= :aiming -** Processing line: ~ state.tongue_angle ||= 90~ + [5399, 4128, 64, 64], +** Processing line: ~ [5352, 4200, 64, 64],~ - Inside source: true *** True Line Result - state.tongue_angle ||= 90 -** Processing line: ~ state.tile_size = 64~ + [5352, 4200, 64, 64], +** Processing line: ~ [5352, 4158, 64, 64],~ - Inside source: true *** True Line Result - state.tile_size = 64 -** Processing line: ~ state.gravity = -0.1~ + [5352, 4158, 64, 64], +** Processing line: ~ [5392, 4130, 64, 64],~ - Inside source: true *** True Line Result - state.gravity = -0.1 -** Processing line: ~ state.air = -0.01~ + [5392, 4130, 64, 64], +** Processing line: ~ [6216, 4251, 64, 64],~ - Inside source: true *** True Line Result - state.air = -0.01 -** Processing line: ~ state.player_width = 60~ + [6216, 4251, 64, 64], +** Processing line: ~ [6190, 4251, 64, 64],~ - Inside source: true *** True Line Result - state.player_width = 60 -** Processing line: ~ state.player_height = 60~ + [6190, 4251, 64, 64], +** Processing line: ~ [6279, 4200, 64, 64],~ - Inside source: true *** True Line Result - state.player_height = 60 -** Processing line: ~ state.collision_tolerance = 0.0~ + [6279, 4200, 64, 64], +** Processing line: ~ [6262, 4205, 64, 64],~ - Inside source: true *** True Line Result - state.collision_tolerance = 0.0 -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ + [6262, 4205, 64, 64], +** Processing line: ~ [6233, 4214, 64, 64],~ - Inside source: true *** True Line Result - state.previous_tile_size ||= state.tile_size -** Processing line: ~ state.x ||= 2400~ + [6233, 4214, 64, 64], +** Processing line: ~ [6280, 4172, 64, 64],~ - Inside source: true *** True Line Result - state.x ||= 2400 -** Processing line: ~ state.y ||= 200~ + [6280, 4172, 64, 64], +** Processing line: ~ [6256, 4169, 64, 64],~ - Inside source: true *** True Line Result - state.y ||= 200 -** Processing line: ~ state.dy ||= 0~ + [6256, 4169, 64, 64], +** Processing line: ~ [6239, 4128, 64, 64],~ - Inside source: true *** True Line Result - state.dy ||= 0 -** Processing line: ~ state.dx ||= 0~ + [6239, 4128, 64, 64], +** Processing line: ~ [6231, 4128, 64, 64],~ - Inside source: true *** True Line Result - state.dx ||= 0 -** Processing line: ~ attempt_load_world_from_file~ + [6231, 4128, 64, 64], +** Processing line: ~ [6191, 4195, 64, 64],~ - Inside source: true *** True Line Result - attempt_load_world_from_file -** Processing line: ~ state.world_lookup ||= { }~ + [6191, 4195, 64, 64], +** Processing line: ~ [6190, 4158, 64, 64],~ - Inside source: true *** True Line Result - state.world_lookup ||= { } -** Processing line: ~ state.world_collision_rects ||= []~ + [6190, 4158, 64, 64], +** Processing line: ~ [7072, 4250, 64, 64],~ - Inside source: true *** True Line Result - state.world_collision_rects ||= [] -** Processing line: ~ state.mode ||= :creating~ + [7072, 4250, 64, 64], +** Processing line: ~ [7046, 4250, 64, 64],~ - Inside source: true *** True Line Result - state.mode ||= :creating -** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ + [7046, 4250, 64, 64], +** Processing line: ~ [7133, 4202, 64, 64],~ - Inside source: true *** True Line Result - state.select_menu ||= [0, 720, 1280, 720] -** Processing line: ~ state.sprite_quantity ||= 20~ + [7133, 4202, 64, 64], +** Processing line: ~ [7107, 4209, 64, 64],~ - Inside source: true *** True Line Result - state.sprite_quantity ||= 20 -** Processing line: ~ state.sprite_coords ||= []~ + [7107, 4209, 64, 64], +** Processing line: ~ [7086, 4214, 64, 64],~ - Inside source: true *** True Line Result - state.sprite_coords ||= [] -** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ + [7086, 4214, 64, 64], +** Processing line: ~ [7133, 4173, 64, 64],~ - Inside source: true *** True Line Result - state.banner_coords ||= [640, 680 + 720] -** Processing line: ~ state.sprite_selected ||= 1~ + [7133, 4173, 64, 64], +** Processing line: ~ [7108, 4169, 64, 64],~ - Inside source: true *** True Line Result - state.sprite_selected ||= 1 -** Processing line: ~ state.map_saved_at ||= 0~ + [7108, 4169, 64, 64], +** Processing line: ~ [7092, 4127, 64, 64],~ - Inside source: true *** True Line Result - state.map_saved_at ||= 0 -** Processing line: ~ state.intro_tick_count ||= state.tick_count~ + [7092, 4127, 64, 64], +** Processing line: ~ [7084, 4128, 64, 64],~ - Inside source: true *** True Line Result - state.intro_tick_count ||= state.tick_count -** Processing line: ~ if state.sprite_coords == []~ + [7084, 4128, 64, 64], +** Processing line: ~ [7047, 4191, 64, 64],~ - Inside source: true *** True Line Result - if state.sprite_coords == [] -** Processing line: ~ count = 1~ + [7047, 4191, 64, 64], +** Processing line: ~ [7047, 4156, 64, 64],~ - Inside source: true *** True Line Result - count = 1 -** Processing line: ~ temp_x = 165~ + [7047, 4156, 64, 64], +** Processing line: ~ [7926, 4252, 64, 64],~ - Inside source: true *** True Line Result - temp_x = 165 -** Processing line: ~ temp_y = 500 + 720~ + [7926, 4252, 64, 64], +** Processing line: ~ [7900, 4253, 64, 64],~ - Inside source: true *** True Line Result - temp_y = 500 + 720 -** Processing line: ~ state.sprite_quantity.times do~ + [7900, 4253, 64, 64], +** Processing line: ~ [7987, 4202, 64, 64],~ - Inside source: true *** True Line Result - state.sprite_quantity.times do -** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]]~ + [7987, 4202, 64, 64], +** Processing line: ~ [7965, 4209, 64, 64],~ - Inside source: true *** True Line Result - state.sprite_coords += [[temp_x, temp_y, count]] -** Processing line: ~ temp_x += 100~ + [7965, 4209, 64, 64], +** Processing line: ~ [7942, 4216, 64, 64],~ - Inside source: true *** True Line Result - temp_x += 100 -** Processing line: ~ count += 1~ + [7942, 4216, 64, 64], +** Processing line: ~ [7989, 4174, 64, 64],~ - Inside source: true *** True Line Result - count += 1 -** Processing line: ~ if temp_x > 1280 - (165 + 50)~ + [7989, 4174, 64, 64], +** Processing line: ~ [7970, 4170, 64, 64],~ - Inside source: true *** True Line Result - if temp_x > 1280 - (165 + 50) -** Processing line: ~ temp_x = 165~ + [7970, 4170, 64, 64], +** Processing line: ~ [7949, 4126, 64, 64],~ - Inside source: true *** True Line Result - temp_x = 165 -** Processing line: ~ temp_y -= 75~ + [7949, 4126, 64, 64], +** Processing line: ~ [7901, 4196, 64, 64],~ - Inside source: true *** True Line Result - temp_y -= 75 -** Processing line: ~ end~ + [7901, 4196, 64, 64], +** Processing line: ~ [7900, 4159, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [7900, 4159, 64, 64], +** Processing line: ~ [7941, 4130, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [7941, 4130, 64, 64], +** Processing line: ~ [2847, 379, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [2847, 379, 64, 64], +** Processing line: ~ [2825, 380, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2825, 380, 64, 64], +** Processing line: ~ [2845, 317, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def start_of_tongue x = nil, y = nil~ + [2845, 317, 64, 64], +** Processing line: ~ [2829, 316, 64, 64],~ - Inside source: true *** True Line Result - def start_of_tongue x = nil, y = nil -** Processing line: ~ x ||= state.x~ + [2829, 316, 64, 64], +** Processing line: ~ [2845, 255, 64, 64],~ - Inside source: true *** True Line Result - x ||= state.x -** Processing line: ~ y ||= state.y~ + [2845, 255, 64, 64], +** Processing line: ~ [2830, 257, 64, 64],~ - Inside source: true *** True Line Result - y ||= state.y -** Processing line: ~ [~ + [2830, 257, 64, 64], +** Processing line: ~ [2845, 202, 64, 64],~ - Inside source: true *** True Line Result - [ -** Processing line: ~ x + state.player_width.half,~ + [2845, 202, 64, 64], +** Processing line: ~ [2829, 198, 64, 64],~ - Inside source: true *** True Line Result - x + state.player_width.half, -** Processing line: ~ y + state.player_height.half~ + [2829, 198, 64, 64], +** Processing line: ~ [2770, 169, 64, 64],~ - Inside source: true *** True Line Result - y + state.player_height.half -** Processing line: ~ ]~ + [2770, 169, 64, 64], +** Processing line: ~ [2708, 170, 64, 64],~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + [2708, 170, 64, 64], +** Processing line: ~ [2646, 171, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2646, 171, 64, 64], +** Processing line: ~ [2582, 171, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def stage_definition~ + [2582, 171, 64, 64], +** Processing line: ~ [2518, 171, 64, 64],~ - Inside source: true *** True Line Result - def stage_definition -** Processing line: ~ outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']~ + [2518, 171, 64, 64], +** Processing line: ~ [2454, 171, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png'] -** Processing line: ~ end~ + [2454, 171, 64, 64], +** Processing line: ~ [2391, 172, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2391, 172, 64, 64], +** Processing line: ~ [2332, 379, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + [2332, 379, 64, 64], +** Processing line: ~ [2315, 379, 64, 64],~ - Inside source: true *** True Line Result - def render -** Processing line: ~ stage_definition~ + [2315, 379, 64, 64], +** Processing line: ~ [2334, 316, 64, 64],~ - Inside source: true *** True Line Result - stage_definition -** Processing line: ~ start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]~ + [2334, 316, 64, 64], +** Processing line: ~ [2315, 317, 64, 64],~ - Inside source: true *** True Line Result - start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)] -** Processing line: ~ end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]~ + [2315, 317, 64, 64], +** Processing line: ~ [2332, 254, 64, 64],~ - Inside source: true *** True Line Result - end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)] -** Processing line: ~~ + [2332, 254, 64, 64], +** Processing line: ~ [2314, 254, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.anchor_point~ + [2314, 254, 64, 64], +** Processing line: ~ [2335, 192, 64, 64],~ - Inside source: true *** True Line Result - if state.anchor_point -** Processing line: ~ anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]~ + [2335, 192, 64, 64], +** Processing line: ~ [2311, 192, 64, 64],~ - Inside source: true *** True Line Result - anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)] -** Processing line: ~ outputs.sprites << { x: start_of_tongue_render.x,~ + [2311, 192, 64, 64], +** Processing line: ~ [2846, 142, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << { x: start_of_tongue_render.x, -** Processing line: ~ y: start_of_tongue_render.y,~ + [2846, 142, 64, 64], +** Processing line: ~ [2784, 140, 64, 64],~ - Inside source: true *** True Line Result - y: start_of_tongue_render.y, -** Processing line: ~ w: vw(2),~ + [2784, 140, 64, 64], +** Processing line: ~ [2846, 79, 64, 64],~ - Inside source: true *** True Line Result - w: vw(2), -** Processing line: ~ h: args.geometry.distance(start_of_tongue_render, anchor_point_render),~ + [2846, 79, 64, 64], +** Processing line: ~ [2847, 41, 64, 64],~ - Inside source: true *** True Line Result - h: args.geometry.distance(start_of_tongue_render, anchor_point_render), -** Processing line: ~ path: 'sprites/square-pink.png',~ + [2847, 41, 64, 64], +** Processing line: ~ [2783, 80, 64, 64],~ - Inside source: true *** True Line Result - path: 'sprites/square-pink.png', -** Processing line: ~ angle_anchor_y: 0,~ + [2783, 80, 64, 64], +** Processing line: ~ [2790, 39, 64, 64],~ - Inside source: true *** True Line Result - angle_anchor_y: 0, -** Processing line: ~ angle: state.tongue_angle - 90 }~ + [2790, 39, 64, 64], +** Processing line: ~ [2727, 41, 64, 64],~ - Inside source: true *** True Line Result - angle: state.tongue_angle - 90 } -** Processing line: ~ else~ + [2727, 41, 64, 64], +** Processing line: ~ [2665, 43, 64, 64],~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.sprites << { x: vx(start_of_tongue.x),~ + [2665, 43, 64, 64], +** Processing line: ~ [2605, 43, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << { x: vx(start_of_tongue.x), -** Processing line: ~ y: vy(start_of_tongue.y),~ + [2605, 43, 64, 64], +** Processing line: ~ [2543, 44, 64, 64],~ - Inside source: true *** True Line Result - y: vy(start_of_tongue.y), -** Processing line: ~ w: vw(2),~ + [2543, 44, 64, 64], +** Processing line: ~ [2480, 45, 64, 64],~ - Inside source: true *** True Line Result - w: vw(2), -** Processing line: ~ h: vh(state.tongue_length),~ + [2480, 45, 64, 64], +** Processing line: ~ [2419, 45, 64, 64],~ - Inside source: true *** True Line Result - h: vh(state.tongue_length), -** Processing line: ~ path: 'sprites/square-pink.png',~ + [2419, 45, 64, 64], +** Processing line: ~ [2357, 44, 64, 64],~ - Inside source: true *** True Line Result - path: 'sprites/square-pink.png', -** Processing line: ~ angle_anchor_y: 0,~ + [2357, 44, 64, 64], +** Processing line: ~ [2313, 129, 64, 64],~ - Inside source: true *** True Line Result - angle_anchor_y: 0, -** Processing line: ~ angle: state.tongue_angle - 90 }~ + [2313, 129, 64, 64], +** Processing line: ~ [2313, 70, 64, 64],~ - Inside source: true *** True Line Result - angle: state.tongue_angle - 90 } -** Processing line: ~ end~ + [2313, 70, 64, 64], +** Processing line: ~ [2314, 40, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2314, 40, 64, 64], +** Processing line: ~ [2517, 2385, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }~ + [2517, 2385, 64, 64], +** Processing line: ~ [2452, 2385, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] } -** Processing line: ~~ + [2452, 2385, 64, 64], +** Processing line: ~ [2390, 2386, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.god_mode~ + [2390, 2386, 64, 64], +** Processing line: ~ [2328, 2386, 64, 64],~ - Inside source: true *** True Line Result - if state.god_mode -** Processing line: ~ # SHOW HIDE COLLISIONS~ + [2328, 2386, 64, 64], +** Processing line: ~ [2264, 2386, 64, 64],~ - Inside source: true *** True Line Result - # SHOW HIDE COLLISIONS -** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ + [2264, 2386, 64, 64], +** Processing line: ~ [2200, 2386, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << state.world.map do |x, y, w, h| -** Processing line: ~ x = vx(x)~ + [2200, 2386, 64, 64], +** Processing line: ~ [2137, 2387, 64, 64],~ - Inside source: true *** True Line Result - x = vx(x) -** Processing line: ~ y = vy(y)~ + [2137, 2387, 64, 64], +** Processing line: ~ [2071, 2385, 64, 64],~ - Inside source: true *** True Line Result - y = vy(y) -** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ + [2071, 2385, 64, 64], +** Processing line: ~ [2016, 2389, 64, 64],~ - Inside source: true *** True Line Result - if x > -80 && x < 1280 && y > -80 && y < 720 -** Processing line: ~ {~ + [2016, 2389, 64, 64], +** Processing line: ~ [2517, 2341, 64, 64],~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: x,~ + [2517, 2341, 64, 64], +** Processing line: ~ [2518, 2316, 64, 64],~ - Inside source: true *** True Line Result - x: x, -** Processing line: ~ y: y,~ + [2518, 2316, 64, 64], +** Processing line: ~ [2456, 2316, 64, 64],~ - Inside source: true *** True Line Result - y: y, -** Processing line: ~ w: vw(w || state.tile_size),~ + [2456, 2316, 64, 64], +** Processing line: ~ [2393, 2316, 64, 64],~ - Inside source: true *** True Line Result - w: vw(w || state.tile_size), -** Processing line: ~ h: vh(h || state.tile_size),~ + [2393, 2316, 64, 64], +** Processing line: ~ [2328, 2317, 64, 64],~ - Inside source: true *** True Line Result - h: vh(h || state.tile_size), -** Processing line: ~ path: 'sprites/square-gray.png',~ + [2328, 2317, 64, 64], +** Processing line: ~ [2264, 2316, 64, 64],~ - Inside source: true *** True Line Result - path: 'sprites/square-gray.png', -** Processing line: ~ a: 128~ + [2264, 2316, 64, 64], +** Processing line: ~ [2207, 2318, 64, 64],~ - Inside source: true *** True Line Result - a: 128 -** Processing line: ~ }~ + [2207, 2318, 64, 64], +** Processing line: ~ [2144, 2317, 64, 64],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [2144, 2317, 64, 64], +** Processing line: ~ [2081, 2316, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [2081, 2316, 64, 64], +** Processing line: ~ [2015, 2342, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [2015, 2342, 64, 64], +** Processing line: ~ [2016, 2315, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [2016, 2315, 64, 64], +** Processing line: ~ [869, 3709, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ render_player~ + [869, 3709, 64, 64], +** Processing line: ~ [819, 3710, 64, 64],~ - Inside source: true *** True Line Result - render_player -** Processing line: ~ outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]~ + [819, 3710, 64, 64], +** Processing line: ~ [869, 3658, 64, 64],~ - Inside source: true *** True Line Result - outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40] -** Processing line: ~~ + [869, 3658, 64, 64], +** Processing line: ~ [820, 3658, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Label in top left of the screen~ + [820, 3658, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - # Label in top left of the screen -** Processing line: ~ outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid -** Processing line: ~ outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label -** Processing line: ~ outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label -** Processing line: ~~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.god_mode~ + [0, 5137, 64, 64], +** Processing line: ~ [3898, 2400, 64, 64],~ - Inside source: true *** True Line Result - if state.god_mode -** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ + [3898, 2400, 64, 64], +** Processing line: ~ [3835, 2400, 64, 64],~ - Inside source: true *** True Line Result - if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 -** Processing line: ~ outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label~ + [3835, 2400, 64, 64], +** Processing line: ~ [3771, 2400, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label -** Processing line: ~ end~ + [3771, 2400, 64, 64], +** Processing line: ~ [3708, 2401, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3708, 2401, 64, 64], +** Processing line: ~ [3646, 2401, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~~ + [3646, 2401, 64, 64], +** Processing line: ~ [3587, 2401, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ + [3587, 2401, 64, 64], +** Processing line: ~ [3530, 2401, 64, 64],~ - Inside source: true *** True Line Result - # Creates sprite following mouse to help indicate which sprite you have selected -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ + [3530, 2401, 64, 64], +** Processing line: ~ [3897, 2340, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, -** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ + [3897, 2340, 64, 64], +** Processing line: ~ [3897, 2295, 64, 64],~ - Inside source: true *** True Line Result - state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite -** Processing line: ~ end~ + [3897, 2295, 64, 64], +** Processing line: ~ [3834, 2296, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3834, 2296, 64, 64], +** Processing line: ~ [3773, 2295, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ render_mini_map~ + [3773, 2295, 64, 64], +** Processing line: ~ [3710, 2296, 64, 64],~ - Inside source: true *** True Line Result - render_mini_map -** Processing line: ~ outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid~ + [3710, 2296, 64, 64], +** Processing line: ~ [3656, 2295, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid -** Processing line: ~ end~ + [3656, 2295, 64, 64], +** Processing line: ~ [3593, 2294, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3593, 2294, 64, 64], +** Processing line: ~ [3527, 2339, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_mini_map~ + [3527, 2339, 64, 64], +** Processing line: ~ [3531, 2293, 64, 64],~ - Inside source: true *** True Line Result - def render_mini_map -** Processing line: ~ x, y = 1170, 10~ + [3531, 2293, 64, 64], +** Processing line: ~ [4152, 2903, 64, 64],~ - Inside source: true *** True Line Result - x, y = 1170, 10 -** Processing line: ~ outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid~ + [4152, 2903, 64, 64], +** Processing line: ~ [4155, 2858, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid -** Processing line: ~ outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid~ + [4155, 2858, 64, 64], +** Processing line: ~ [3942, 1306, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid -** Processing line: ~ t_start = start_of_tongue~ + [3942, 1306, 64, 64], +** Processing line: ~ [3942, 1279, 64, 64],~ - Inside source: true *** True Line Result - t_start = start_of_tongue -** Processing line: ~ t_end = end_of_tongue~ + [3942, 1279, 64, 64], +** Processing line: ~ [3879, 1306, 64, 64],~ - Inside source: true *** True Line Result - t_end = end_of_tongue -** Processing line: ~ outputs.primitives << [~ + [3879, 1306, 64, 64], +** Processing line: ~ [3881, 1278, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [ -** Processing line: ~ x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),~ + [3881, 1278, 64, 64], +** Processing line: ~ [3819, 1305, 64, 64],~ - Inside source: true *** True Line Result - x + t_start.x.fdiv(100), y + t_start.y.fdiv(100), -** Processing line: ~ x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),~ + [3819, 1305, 64, 64], +** Processing line: ~ [3819, 1277, 64, 64],~ - Inside source: true *** True Line Result - x + t_end.x.fdiv(100), y + t_end.y.fdiv(100), -** Processing line: ~ 255, 255, 255~ + [3819, 1277, 64, 64], +** Processing line: ~ [3756, 1306, 64, 64],~ - Inside source: true *** True Line Result - 255, 255, 255 -** Processing line: ~ ].line~ + [3756, 1306, 64, 64], +** Processing line: ~ [3756, 1277, 64, 64],~ - Inside source: true *** True Line Result - ].line -** Processing line: ~~ + [3756, 1277, 64, 64], +** Processing line: ~ [3694, 1306, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ state.objects.each do |o|~ + [3694, 1306, 64, 64], +** Processing line: ~ [3695, 1277, 64, 64],~ - Inside source: true *** True Line Result - state.objects.each do |o| -** Processing line: ~ outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid~ + [3695, 1277, 64, 64], +** Processing line: ~ [3631, 1306, 64, 64],~ - Inside source: true *** True Line Result - outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid -** Processing line: ~ end~ + [3631, 1306, 64, 64], +** Processing line: ~ [3632, 1278, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [3632, 1278, 64, 64], +** Processing line: ~ [3565, 1306, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3565, 1306, 64, 64], +** Processing line: ~ [3567, 1279, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_camera percentage_override = nil~ + [3567, 1279, 64, 64], +** Processing line: ~ [4432, 1165, 64, 64],~ - Inside source: true *** True Line Result - def calc_camera percentage_override = nil -** Processing line: ~ percentage = percentage_override || (0.2 * state.camera_scale)~ + [4432, 1165, 64, 64], +** Processing line: ~ [4408, 1163, 64, 64],~ - Inside source: true *** True Line Result - percentage = percentage_override || (0.2 * state.camera_scale) -** Processing line: ~ target_scale = state.target_camera_scale~ + [4408, 1163, 64, 64], +** Processing line: ~ [5123, 1003, 64, 64],~ - Inside source: true *** True Line Result - target_scale = state.target_camera_scale -** Processing line: ~ distance_scale = target_scale - state.camera_scale~ + [5123, 1003, 64, 64], +** Processing line: ~ [5065, 1002, 64, 64],~ - Inside source: true *** True Line Result - distance_scale = target_scale - state.camera_scale -** Processing line: ~ state.camera_scale += distance_scale * percentage~ + [5065, 1002, 64, 64], +** Processing line: ~ [5042, 1002, 64, 64],~ - Inside source: true *** True Line Result - state.camera_scale += distance_scale * percentage -** Processing line: ~~ + [5042, 1002, 64, 64], +** Processing line: ~ [6020, 1780, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ target_x = state.x * state.target_camera_scale~ + [6020, 1780, 64, 64], +** Processing line: ~ [6020, 1756, 64, 64],~ - Inside source: true *** True Line Result - target_x = state.x * state.target_camera_scale -** Processing line: ~ target_y = state.y * state.target_camera_scale~ + [6020, 1756, 64, 64], +** Processing line: ~ [5959, 1780, 64, 64],~ - Inside source: true *** True Line Result - target_y = state.y * state.target_camera_scale -** Processing line: ~~ + [5959, 1780, 64, 64], +** Processing line: ~ [5959, 1752, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ distance_x = target_x - (state.camera_x + 640)~ + [5959, 1752, 64, 64], +** Processing line: ~ [5897, 1779, 64, 64],~ - Inside source: true *** True Line Result - distance_x = target_x - (state.camera_x + 640) -** Processing line: ~ distance_y = target_y - (state.camera_y + 360)~ + [5897, 1779, 64, 64], +** Processing line: ~ [5899, 1752, 64, 64],~ - Inside source: true *** True Line Result - distance_y = target_y - (state.camera_y + 360) -** Processing line: ~ state.camera_x += distance_x * percentage if distance_x.abs > 1~ + [5899, 1752, 64, 64], +** Processing line: ~ [5836, 1779, 64, 64],~ - Inside source: true *** True Line Result - state.camera_x += distance_x * percentage if distance_x.abs > 1 -** Processing line: ~ state.camera_y += distance_y * percentage if distance_y.abs > 1~ + [5836, 1779, 64, 64], +** Processing line: ~ [5836, 1751, 64, 64],~ - Inside source: true *** True Line Result - state.camera_y += distance_y * percentage if distance_y.abs > 1 -** Processing line: ~ state.camera_x = 0 if state.camera_x < 0~ + [5836, 1751, 64, 64], +** Processing line: ~ [5776, 1780, 64, 64],~ - Inside source: true *** True Line Result - state.camera_x = 0 if state.camera_x < 0 -** Processing line: ~ state.camera_y = 0 if state.camera_y < 0~ + [5776, 1780, 64, 64], +** Processing line: ~ [5776, 1754, 64, 64],~ - Inside source: true *** True Line Result - state.camera_y = 0 if state.camera_y < 0 -** Processing line: ~ end~ + [5776, 1754, 64, 64], +** Processing line: ~ [5717, 1780, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5717, 1780, 64, 64], +** Processing line: ~ [5716, 1752, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def vx x~ + [5716, 1752, 64, 64], +** Processing line: ~ [5658, 1781, 64, 64],~ - Inside source: true *** True Line Result - def vx x -** Processing line: ~ (x * state.camera_scale) - state.camera_x~ + [5658, 1781, 64, 64], +** Processing line: ~ [5658, 1755, 64, 64],~ - Inside source: true *** True Line Result - (x * state.camera_scale) - state.camera_x -** Processing line: ~ end~ + [5658, 1755, 64, 64], +** Processing line: ~ [5640, 1781, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5640, 1781, 64, 64], +** Processing line: ~ [5640, 1754, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def vy y~ + [5640, 1754, 64, 64], +** Processing line: ~ [5832, 2095, 64, 64],~ - Inside source: true *** True Line Result - def vy y -** Processing line: ~ (y * state.camera_scale) - state.camera_y~ + [5832, 2095, 64, 64], +** Processing line: ~ [5782, 2093, 64, 64],~ - Inside source: true *** True Line Result - (y * state.camera_scale) - state.camera_y -** Processing line: ~ end~ + [5782, 2093, 64, 64], +** Processing line: ~ [5832, 2044, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5832, 2044, 64, 64], +** Processing line: ~ [5777, 2043, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def vw w~ + [5777, 2043, 64, 64], +** Processing line: ~ [4847, 2577, 64, 64],~ - Inside source: true *** True Line Result - def vw w -** Processing line: ~ w * state.camera_scale~ + [4847, 2577, 64, 64], +** Processing line: ~ [4795, 2577, 64, 64],~ - Inside source: true *** True Line Result - w * state.camera_scale -** Processing line: ~ end~ + [4795, 2577, 64, 64], +** Processing line: ~ [4846, 2526, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4846, 2526, 64, 64], +** Processing line: ~ [4794, 2526, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def vh h~ + [4794, 2526, 64, 64], +** Processing line: ~ [8390, 923, 64, 64],~ - Inside source: true *** True Line Result - def vh h -** Processing line: ~ h * state.camera_scale~ + [8390, 923, 64, 64], +** Processing line: ~ [8363, 922, 64, 64],~ - Inside source: true *** True Line Result - h * state.camera_scale -** Processing line: ~ end~ + [8363, 922, 64, 64], +** Processing line: ~ [7585, 1084, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7585, 1084, 64, 64], +** Processing line: ~ [7582, 1058, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc~ + [7582, 1058, 64, 64], +** Processing line: ~ [7525, 1084, 64, 64],~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_camera~ + [7525, 1084, 64, 64], +** Processing line: ~ [7524, 1056, 64, 64],~ - Inside source: true *** True Line Result - calc_camera -** Processing line: ~ calc_world_lookup~ + [7524, 1056, 64, 64], +** Processing line: ~ [7478, 1085, 64, 64],~ - Inside source: true *** True Line Result - calc_world_lookup -** Processing line: ~ calc_player~ + [7478, 1085, 64, 64], +** Processing line: ~ [7476, 1055, 64, 64],~ - Inside source: true *** True Line Result - calc_player -** Processing line: ~ calc_on_floor~ + [7476, 1055, 64, 64], +** Processing line: ~ [7421, 1086, 64, 64],~ - Inside source: true *** True Line Result - calc_on_floor -** Processing line: ~ calc_score~ + [7421, 1086, 64, 64], +** Processing line: ~ [7421, 1052, 64, 64],~ - Inside source: true *** True Line Result - calc_score -** Processing line: ~ end~ + [7421, 1052, 64, 64], +** Processing line: ~ [7362, 1085, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7362, 1085, 64, 64], +** Processing line: ~ [7361, 1053, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def set_camera_scale v = nil~ + [7361, 1053, 64, 64], +** Processing line: ~ [7307, 1087, 64, 64],~ - Inside source: true *** True Line Result - def set_camera_scale v = nil -** Processing line: ~ return if v < 0.1~ + [7307, 1087, 64, 64], +** Processing line: ~ [7307, 1054, 64, 64],~ - Inside source: true *** True Line Result - return if v < 0.1 -** Processing line: ~ state.target_camera_scale = v~ + [7307, 1054, 64, 64], +** Processing line: ~ [7258, 1086, 64, 64],~ - Inside source: true *** True Line Result - state.target_camera_scale = v -** Processing line: ~ end~ + [7258, 1086, 64, 64], +** Processing line: ~ [7255, 1058, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [7255, 1058, 64, 64], +** Processing line: ~ [7203, 1083, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs_god_mode~ + [7203, 1083, 64, 64], +** Processing line: ~ [7203, 1055, 64, 64],~ - Inside source: true *** True Line Result - def process_inputs_god_mode -** Processing line: ~ return unless state.god_mode~ + [7203, 1055, 64, 64], +** Processing line: ~ [7161, 1085, 64, 64],~ - Inside source: true *** True Line Result - return unless state.god_mode -** Processing line: ~~ + [7161, 1085, 64, 64], +** Processing line: ~ [7158, 1057, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))~ + [7158, 1057, 64, 64], +** Processing line: ~ [7100, 1083, 64, 64],~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10)) -** Processing line: ~ set_camera_scale state.camera_scale + 0.1~ + [7100, 1083, 64, 64], +** Processing line: ~ [7099, 1058, 64, 64],~ - Inside source: true *** True Line Result - set_camera_scale state.camera_scale + 0.1 -** Processing line: ~ elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))~ + [7099, 1058, 64, 64], +** Processing line: ~ [7038, 1082, 64, 64],~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10)) -** Processing line: ~ set_camera_scale state.camera_scale - 0.1~ + [7038, 1082, 64, 64], +** Processing line: ~ [7038, 1058, 64, 64],~ - Inside source: true *** True Line Result - set_camera_scale state.camera_scale - 0.1 -** Processing line: ~ elsif inputs.keyboard.eight || inputs.keyboard.zero~ + [7038, 1058, 64, 64], +** Processing line: ~ [6982, 1083, 64, 64],~ - Inside source: true *** True Line Result - elsif inputs.keyboard.eight || inputs.keyboard.zero -** Processing line: ~ set_camera_scale 1~ + [6982, 1083, 64, 64], +** Processing line: ~ [6984, 1057, 64, 64],~ - Inside source: true *** True Line Result - set_camera_scale 1 -** Processing line: ~ end~ + [6984, 1057, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if input_up?~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - if input_up? -** Processing line: ~ state.y += 10~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - state.y += 10 -** Processing line: ~ state.dy = 0~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ elsif input_down?~ + [0, 5137, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - elsif input_down? -** Processing line: ~ state.y -= 10~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - state.y -= 10 -** Processing line: ~ state.dy = 0~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - state.dy = 0 -** Processing line: ~ end~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ if input_left?~ + [0, 5137, 64, 64], +** Processing line: ~ [0, 0, 64, 64],~ - Inside source: true *** True Line Result - if input_left? -** Processing line: ~ state.x -= 10~ + [0, 0, 64, 64], +** Processing line: ~ [0, 1670, 64, 64],~ - Inside source: true *** True Line Result - state.x -= 10 -** Processing line: ~ state.dx = 0~ + [0, 1670, 64, 64], +** Processing line: ~ [6691, 1653, 64, 64],~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ elsif input_right?~ + [6691, 1653, 64, 64], +** Processing line: ~ [1521, 3792, 64, 64],~ - Inside source: true *** True Line Result - elsif input_right? -** Processing line: ~ state.x += 10~ + [1521, 3792, 64, 64], +** Processing line: ~ [0, 5137, 64, 64],~ - Inside source: true *** True Line Result - state.x += 10 -** Processing line: ~ state.dx = 0~ + [0, 5137, 64, 64], +** Processing line: ~ [8346, 424, 64, 64],~ - Inside source: true *** True Line Result - state.dx = 0 -** Processing line: ~ end~ + [8346, 424, 64, 64], +** Processing line: ~ [8407, 376, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [8407, 376, 64, 64], +** Processing line: ~ [8375, 386, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [8375, 386, 64, 64], +** Processing line: ~ [8407, 347, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs~ + [8407, 347, 64, 64], +** Processing line: ~ [8388, 343, 64, 64],~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ if state.scene == :game~ + [8388, 343, 64, 64], +** Processing line: ~ [8320, 423, 64, 64],~ - Inside source: true *** True Line Result - if state.scene == :game -** Processing line: ~ process_inputs_player_movement~ + [8320, 423, 64, 64], +** Processing line: ~ [8319, 363, 64, 64],~ - Inside source: true *** True Line Result - process_inputs_player_movement -** Processing line: ~ process_inputs_god_mode~ + [8319, 363, 64, 64], +** Processing line: ~ [8368, 303, 64, 64],~ - Inside source: true *** True Line Result - process_inputs_god_mode -** Processing line: ~ elsif state.scene == :intro~ + [8368, 303, 64, 64], +** Processing line: ~ [8359, 303, 64, 64],~ - Inside source: true *** True Line Result - elsif state.scene == :intro -** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ + [8359, 303, 64, 64], +** Processing line: ~ [8318, 330, 64, 64],~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space -** Processing line: ~ if Kernel.tick_count < 600~ + [8318, 330, 64, 64], +** Processing line: ~ [9369, 425, 64, 64],~ - Inside source: true *** True Line Result - if Kernel.tick_count < 600 -** Processing line: ~ Kernel.tick_count = 600~ + [9369, 425, 64, 64], +** Processing line: ~ [9340, 425, 64, 64],~ - Inside source: true *** True Line Result - Kernel.tick_count = 600 -** Processing line: ~ end~ + [9340, 425, 64, 64], +** Processing line: ~ [9431, 376, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [9431, 376, 64, 64], +** Processing line: ~ [9414, 382, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [9414, 382, 64, 64], +** Processing line: ~ [9387, 391, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [9387, 391, 64, 64], +** Processing line: ~ [9431, 349, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9431, 349, 64, 64], +** Processing line: ~ [9412, 344, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_up?~ + [9412, 344, 64, 64], +** Processing line: ~ [9392, 305, 64, 64],~ - Inside source: true *** True Line Result - def input_up? -** Processing line: ~ inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k~ + [9392, 305, 64, 64], +** Processing line: ~ [9339, 365, 64, 64],~ - Inside source: true *** True Line Result - inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k -** Processing line: ~ end~ + [9339, 365, 64, 64], +** Processing line: ~ [9341, 333, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [9341, 333, 64, 64], +** Processing line: ~ [9384, 301, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_up_released?~ + [9384, 301, 64, 64], +** Processing line: ~ [7673, 1896, 64, 64],~ - Inside source: true *** True Line Result - def input_up_released? -** Processing line: ~ inputs.keyboard.key_up.w ||~ + [7673, 1896, 64, 64], +** Processing line: ~ [7642, 1834, 64, 64],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.w || -** Processing line: ~ inputs.keyboard.key_up.up ||~ + [7642, 1834, 64, 64], +** Processing line: ~ [7646, 1901, 64, 64],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.up || -** Processing line: ~ inputs.keyboard.key_up.k~ + [7646, 1901, 64, 64], +** Processing line: ~ [4500, 4054, 64, 64],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.k -** Processing line: ~ end~ + [4500, 4054, 64, 64], +** Processing line: ~ [4476, 4055, 64, 64],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [4476, 4055, 64, 64], +** Processing line: ~ [4459, 3997, 64, 64],~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_down?~ + [4459, 3997, 64, 64], +** Processing line: ~ [76, 5215, 64, 64],~ - Inside source: true *** True Line Result - def input_down? -** Processing line: ~ inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j~ + [76, 5215, 64, 64], +** Processing line: ~ [39, 5217, 64, 64],~ - Inside source: true *** True Line Result - inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j -** Processing line: ~ end~ + [39, 5217, 64, 64], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def input_down_released?~ +** Processing line: ~ $mugs = [~ - Inside source: true *** True Line Result - def input_down_released? -** Processing line: ~ inputs.keyboard.key_up.s ||~ + $mugs = [ +** Processing line: ~ [85, 87, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.s || -** Processing line: ~ inputs.keyboard.key_up.down ||~ + [85, 87, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [958, 1967, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.down || -** Processing line: ~ inputs.keyboard.key_up.j~ + [958, 1967, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [2537, 1734, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - inputs.keyboard.key_up.j -** Processing line: ~ end~ + [2537, 1734, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [3755, 2464, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3755, 2464, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [1548, 3273, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_left?~ + [1548, 3273, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [2050, 220, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - def input_left? -** Processing line: ~ inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h~ + [2050, 220, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [854, 297, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h -** Processing line: ~ end~ + [854, 297, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [343, 526, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [343, 526, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [3454, 772, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_right?~ + [3454, 772, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [5041, 298, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - def input_right? -** Processing line: ~ inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l~ + [5041, 298, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [6089, 300, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l -** Processing line: ~ end~ + [6089, 300, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [6518, 295, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6518, 295, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [7661, 47, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def set_object path, w, h~ -- Inside source: true -*** True Line Result - def set_object path, w, h -** Processing line: ~ state.object = path~ -- Inside source: true -*** True Line Result - state.object = path -** Processing line: ~ state.object_w = w~ + [7661, 47, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [9392, 1125, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - state.object_w = w -** Processing line: ~ state.object_h = h~ + [9392, 1125, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [7298, 1152, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - state.object_h = h -** Processing line: ~ end~ + [7298, 1152, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [5816, 1843, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [5816, 1843, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [876, 3772, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def collision_mode~ + [876, 3772, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [1029, 4667, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - def collision_mode -** Processing line: ~ state.dev_action = :collision_mode~ + [1029, 4667, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [823, 5324, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - state.dev_action = :collision_mode -** Processing line: ~ end~ + [823, 5324, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [3251, 5220, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [3251, 5220, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [4747, 5282, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs_player_movement~ + [4747, 5282, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [9325, 5178, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - def process_inputs_player_movement -** Processing line: ~ if inputs.keyboard.key_down.g~ + [9325, 5178, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [9635, 4298, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.g -** Processing line: ~ state.god_mode = !state.god_mode~ + [9635, 4298, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [7837, 4127, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - state.god_mode = !state.god_mode -** Processing line: ~ puts state.god_mode~ + [7837, 4127, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [8651, 1971, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - puts state.god_mode -** Processing line: ~ end~ + [8651, 1971, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [6892, 2031, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [6892, 2031, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [4626, 3882, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.key_down.u && state.dev_action == :collision_mode~ + [4626, 3882, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [4024, 4554, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.u && state.dev_action == :collision_mode -** Processing line: ~ state.world = state.world[0..-2]~ + [4024, 4554, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [3925, 3337, 39, 43, "sprites/square-orange.png"],~ - Inside source: true *** True Line Result - state.world = state.world[0..-2] -** Processing line: ~ state.world_lookup = {}~ + [3925, 3337, 39, 43, "sprites/square-orange.png"], +** Processing line: ~ [5064, 1064, 39, 43, "sprites/square-orange.png"]~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ end~ + [5064, 1064, 39, 43, "sprites/square-orange.png"] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if inputs.keyboard.key_down.space && !state.anchor_point~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if inputs.keyboard.key_down.space && !state.anchor_point -** Processing line: ~ state.tongue_length = 0~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.tongue_length = 0 -** Processing line: ~ state.action = :shooting~ -- Inside source: true + +** Processing line: ~* Platformer - Gorillas Basic - credits.txt~ +- Header detected. *** True Line Result - state.action = :shooting -** Processing line: ~ outputs.sounds << 'sounds/shooting.wav'~ -- Inside source: true + *** True Line Result - outputs.sounds << 'sounds/shooting.wav' -** Processing line: ~ elsif inputs.keyboard.key_down.space~ -- Inside source: true +* Platformer - Gorillas Basic - credits.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - elsif inputs.keyboard.key_down.space -** Processing line: ~ state.action = :aiming~ -- Inside source: true + *** True Line Result - state.action = :aiming -** Processing line: ~ state.anchor_point = nil~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt~ - Inside source: true *** True Line Result - state.anchor_point = nil -** Processing line: ~ state.tongue_length = 100~ + # ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt +** Processing line: ~ code: Amir Rajan, https://twitter.com/amirrajan~ - Inside source: true *** True Line Result - state.tongue_length = 100 -** Processing line: ~ end~ + code: Amir Rajan, https://twitter.com/amirrajan +** Processing line: ~ graphics: Nick Culbertson, https://twitter.com/MobyPixel~ - Inside source: true *** True Line Result - end + graphics: Nick Culbertson, https://twitter.com/MobyPixel ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.anchor_point~ +** Processing line: ~~ - Inside source: true *** True Line Result - if state.anchor_point -** Processing line: ~ if input_up?~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if input_up? -** Processing line: ~ if state.tongue_length >= 105~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - if state.tongue_length >= 105 -** Processing line: ~ state.tongue_length -= 5~ -- Inside source: true + +** Processing line: ~* Platformer - Gorillas Basic - main.rb~ +- Header detected. *** True Line Result - state.tongue_length -= 5 -** Processing line: ~ state.dy += 0.8~ -- Inside source: true + *** True Line Result - state.dy += 0.8 -** Processing line: ~ end~ -- Inside source: true +* Platformer - Gorillas Basic - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - end -** Processing line: ~ elsif input_down?~ -- Inside source: true + *** True Line Result - elsif input_down? -** Processing line: ~ state.tongue_length += 5~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/main.rb~ - Inside source: true *** True Line Result - state.tongue_length += 5 -** Processing line: ~ state.dy -= 0.8~ + # ./samples/99_genre_platformer/gorillas_basic/app/main.rb +** Processing line: ~ class YouSoBasicGorillas~ - Inside source: true *** True Line Result - state.dy -= 0.8 -** Processing line: ~ end~ + class YouSoBasicGorillas +** Processing line: ~ attr_accessor :outputs, :grid, :state, :inputs~ - Inside source: true *** True Line Result - end + attr_accessor :outputs, :grid, :state, :inputs ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if input_left? && state.dx > 1~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - if input_left? && state.dx > 1 -** Processing line: ~ state.dx *= 0.98~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - state.dx *= 0.98 -** Processing line: ~ elsif input_left? && state.dx < -1~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - elsif input_left? && state.dx < -1 -** Processing line: ~ state.dx *= 1.03~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - state.dx *= 1.03 -** Processing line: ~ elsif input_left? && !state.on_floor~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - elsif input_left? && !state.on_floor -** Processing line: ~ state.dx -= 3~ + process_inputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.dx -= 3 -** Processing line: ~ elsif input_right? && state.dx > 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif input_right? && state.dx > 1 -** Processing line: ~ state.dx *= 1.03~ + +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - state.dx *= 1.03 -** Processing line: ~ elsif input_right? && state.dx < -1~ + def defaults +** Processing line: ~ outputs.background_color = [33, 32, 87]~ - Inside source: true *** True Line Result - elsif input_right? && state.dx < -1 -** Processing line: ~ state.dx *= 0.98~ + outputs.background_color = [33, 32, 87] +** Processing line: ~ state.building_spacing = 1~ - Inside source: true *** True Line Result - state.dx *= 0.98 -** Processing line: ~ elsif input_right? && !state.on_floor~ + state.building_spacing = 1 +** Processing line: ~ state.building_room_spacing = 15~ - Inside source: true *** True Line Result - elsif input_right? && !state.on_floor -** Processing line: ~ state.dx += 3~ + state.building_room_spacing = 15 +** Processing line: ~ state.building_room_width = 10~ - Inside source: true *** True Line Result - state.dx += 3 -** Processing line: ~ end~ + state.building_room_width = 10 +** Processing line: ~ state.building_room_height = 15~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + state.building_room_height = 15 +** Processing line: ~ state.building_heights = [4, 4, 6, 8, 15, 20, 18]~ - Inside source: true *** True Line Result - else -** Processing line: ~ if input_left?~ + state.building_heights = [4, 4, 6, 8, 15, 20, 18] +** Processing line: ~ state.building_room_sizes = [5, 4, 6, 7]~ - Inside source: true *** True Line Result - if input_left? -** Processing line: ~ state.tongue_angle += 1.5~ + state.building_room_sizes = [5, 4, 6, 7] +** Processing line: ~ state.gravity = 0.25~ - Inside source: true *** True Line Result - state.tongue_angle += 1.5 -** Processing line: ~ state.tongue_angle = state.tongue_angle~ + state.gravity = 0.25 +** Processing line: ~ state.first_strike ||= :player_1~ - Inside source: true *** True Line Result - state.tongue_angle = state.tongue_angle -** Processing line: ~ elsif input_right?~ + state.first_strike ||= :player_1 +** Processing line: ~ state.buildings ||= []~ - Inside source: true *** True Line Result - elsif input_right? -** Processing line: ~ state.tongue_angle -= 1.5~ + state.buildings ||= [] +** Processing line: ~ state.holes ||= []~ - Inside source: true *** True Line Result - state.tongue_angle -= 1.5 -** Processing line: ~ state.tongue_angle = state.tongue_angle~ + state.holes ||= [] +** Processing line: ~ state.player_1_score ||= 0~ - Inside source: true *** True Line Result - state.tongue_angle = state.tongue_angle -** Processing line: ~ end~ + state.player_1_score ||= 0 +** Processing line: ~ state.player_2_score ||= 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.player_2_score ||= 0 +** Processing line: ~ state.wind ||= 0~ - Inside source: true *** True Line Result - end + state.wind ||= 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -60561,42 +60724,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def add_floors~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - def add_floors -** Processing line: ~ # floors~ + def render +** Processing line: ~ render_stage~ - Inside source: true *** True Line Result - # floors -** Processing line: ~ state.world += [~ + render_stage +** Processing line: ~ render_value_insertion~ - Inside source: true *** True Line Result - state.world += [ -** Processing line: ~ [0, 0, 10000, 40],~ + render_value_insertion +** Processing line: ~ render_gorillas~ - Inside source: true *** True Line Result - [0, 0, 10000, 40], -** Processing line: ~ [0, 1670, 3250, 60],~ + render_gorillas +** Processing line: ~ render_holes~ - Inside source: true *** True Line Result - [0, 1670, 3250, 60], -** Processing line: ~ [6691, 1653, 3290, 60],~ + render_holes +** Processing line: ~ render_banana~ - Inside source: true *** True Line Result - [6691, 1653, 3290, 60], -** Processing line: ~ [1521, 3792, 7370, 60],~ + render_banana +** Processing line: ~ render_game_over~ - Inside source: true *** True Line Result - [1521, 3792, 7370, 60], -** Processing line: ~ [0, 5137, 3290, 60]~ + render_game_over +** Processing line: ~ render_score~ - Inside source: true *** True Line Result - [0, 5137, 3290, 60] -** Processing line: ~ ]~ + render_score +** Processing line: ~ render_wind~ - Inside source: true *** True Line Result - ] + render_wind ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -60605,274 +60768,290 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def attempt_load_world_from_file~ +** Processing line: ~ def render_score~ - Inside source: true *** True Line Result - def attempt_load_world_from_file -** Processing line: ~ return if state.world~ + def render_score +** Processing line: ~ outputs.primitives << [0, 0, 1280, 31, fancy_white].solid~ - Inside source: true *** True Line Result - return if state.world -** Processing line: ~ # exported_world = gtk.read_file(MAP_FILE_PATH)~ + outputs.primitives << [0, 0, 1280, 31, fancy_white].solid +** Processing line: ~ outputs.primitives << [1, 1, 1279, 29].solid~ - Inside source: true *** True Line Result - # exported_world = gtk.read_file(MAP_FILE_PATH) -** Processing line: ~ state.world = []~ + outputs.primitives << [1, 1, 1279, 29].solid +** Processing line: ~ outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]~ - Inside source: true *** True Line Result - state.world = [] -** Processing line: ~ state.objects = []~ + outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white] +** Processing line: ~ outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]~ - Inside source: true *** True Line Result - state.objects = [] + outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if $collisions~ +** Processing line: ~ def render_wind~ - Inside source: true *** True Line Result - if $collisions -** Processing line: ~ $collisions.map do |x, y, w, h|~ + def render_wind +** Processing line: ~ outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid~ - Inside source: true *** True Line Result - $collisions.map do |x, y, w, h| -** Processing line: ~ state.world << [x, y, w, h]~ + outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid +** Processing line: ~ outputs.lines << [640, 30, 640, 0, fancy_white]~ - Inside source: true *** True Line Result - state.world << [x, y, w, h] -** Processing line: ~ end~ + outputs.lines << [640, 30, 640, 0, fancy_white] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ add_floors~ +** Processing line: ~ def render_game_over~ - Inside source: true *** True Line Result - add_floors -** Processing line: ~ # elsif exported_world~ + def render_game_over +** Processing line: ~ return unless state.over~ - Inside source: true *** True Line Result - # elsif exported_world -** Processing line: ~ # exported_world.each_line.map do |l|~ + return unless state.over +** Processing line: ~ outputs.primitives << [grid.rect, 0, 0, 0, 200].solid~ - Inside source: true *** True Line Result - # exported_world.each_line.map do |l| -** Processing line: ~ # tokens = l.strip.split(',')~ + outputs.primitives << [grid.rect, 0, 0, 0, 200].solid +** Processing line: ~ outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label~ - Inside source: true *** True Line Result - # tokens = l.strip.split(',') -** Processing line: ~ # x = tokens[0].to_i~ + outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label +** Processing line: ~ if state.winner == :player_1~ - Inside source: true *** True Line Result - # x = tokens[0].to_i -** Processing line: ~ # y = tokens[1].to_i~ + if state.winner == :player_1 +** Processing line: ~ outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label~ - Inside source: true *** True Line Result - # y = tokens[1].to_i -** Processing line: ~ # type = tokens[2].to_i~ + outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label +** Processing line: ~ else~ - Inside source: true *** True Line Result - # type = tokens[2].to_i -** Processing line: ~ # if type == 1~ + else +** Processing line: ~ outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label~ - Inside source: true *** True Line Result - # if type == 1 -** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ + outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - # state.world << [x, y, state.tile_size, state.tile_size] -** Processing line: ~ # elsif type == 2~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # elsif type == 2 -** Processing line: ~ # w, h, path = tokens[3..-1]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # w, h, path = tokens[3..-1] -** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ + +** Processing line: ~ def render_stage~ - Inside source: true *** True Line Result - # state.objects << [x, y, w.to_i, h.to_i, path] -** Processing line: ~ # end~ + def render_stage +** Processing line: ~ return unless state.stage_generated~ - Inside source: true *** True Line Result - # end -** Processing line: ~ # end~ + return unless state.stage_generated +** Processing line: ~ return if state.stage_rendered~ - Inside source: true *** True Line Result - # end + return if state.stage_rendered ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # add_floors~ +** Processing line: ~ outputs.static_solids << [grid.rect, 33, 32, 87]~ - Inside source: true *** True Line Result - # add_floors -** Processing line: ~ end~ + outputs.static_solids << [grid.rect, 33, 32, 87] +** Processing line: ~ outputs.static_solids << state.buildings.map(&:solids)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.static_solids << state.buildings.map(&:solids) +** Processing line: ~ state.stage_rendered = true~ - Inside source: true *** True Line Result - -** Processing line: ~ if $mugs~ + state.stage_rendered = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - if $mugs -** Processing line: ~ $mugs.map do |x, y, w, h, path|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $mugs.map do |x, y, w, h, path| -** Processing line: ~ state.objects << [x, y, w, h, path]~ + +** Processing line: ~ def render_gorilla gorilla, id~ - Inside source: true *** True Line Result - state.objects << [x, y, w, h, path] -** Processing line: ~ end~ + def render_gorilla gorilla, id +** Processing line: ~ return unless gorilla~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + return unless gorilla +** Processing line: ~ if state.banana && state.banana.owner == gorilla~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if state.banana && state.banana.owner == gorilla +** Processing line: ~ animation_index = state.banana.created_at.frame_index(3, 5, false)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + animation_index = state.banana.created_at.frame_index(3, 5, false) +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_world_lookup~ + end +** Processing line: ~ if !animation_index~ - Inside source: true *** True Line Result - def calc_world_lookup -** Processing line: ~ if state.tile_size != state.previous_tile_size~ + if !animation_index +** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]~ - Inside source: true *** True Line Result - if state.tile_size != state.previous_tile_size -** Processing line: ~ state.previous_tile_size = state.tile_size~ + outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"] +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.previous_tile_size = state.tile_size -** Processing line: ~ state.world_lookup = {}~ + else +** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]~ - Inside source: true *** True Line Result - state.world_lookup = {} + outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"] ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return if state.world_lookup.keys.length > 0~ +** Processing line: ~ def render_gorillas~ - Inside source: true *** True Line Result - return if state.world_lookup.keys.length > 0 -** Processing line: ~ return unless state.world.length > 0~ + def render_gorillas +** Processing line: ~ render_gorilla state.player_1, :left~ - Inside source: true *** True Line Result - return unless state.world.length > 0 -** Processing line: ~~ + render_gorilla state.player_1, :left +** Processing line: ~ render_gorilla state.player_2, :right~ - Inside source: true *** True Line Result - -** Processing line: ~ # Searches through the world and finds the cordinates that exist~ + render_gorilla state.player_2, :right +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Searches through the world and finds the cordinates that exist -** Processing line: ~ state.world_lookup = {}~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.world_lookup = {} -** Processing line: ~ state.world.each do |x, y, w, h|~ + +** Processing line: ~ def render_value_insertion~ - Inside source: true *** True Line Result - state.world.each do |x, y, w, h| -** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ + def render_value_insertion +** Processing line: ~ return if state.banana~ - Inside source: true *** True Line Result - state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true -** Processing line: ~ end~ + return if state.banana +** Processing line: ~ return if state.over~ - Inside source: true *** True Line Result - end + return if state.over ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Assigns collision rects for every sprite drawn~ +** Processing line: ~ if state.current_turn == :player_1_angle~ - Inside source: true *** True Line Result - # Assigns collision rects for every sprite drawn -** Processing line: ~ state.world_collision_rects =~ + if state.current_turn == :player_1_angle +** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white]~ - Inside source: true *** True Line Result - state.world_collision_rects = -** Processing line: ~ state.world_lookup~ + outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white] +** Processing line: ~ elsif state.current_turn == :player_1_velocity~ - Inside source: true *** True Line Result - state.world_lookup -** Processing line: ~ .keys~ + elsif state.current_turn == :player_1_velocity +** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white]~ - Inside source: true *** True Line Result - .keys -** Processing line: ~ .map do |x, y, w, h|~ + outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white] +** Processing line: ~ outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]~ - Inside source: true *** True Line Result - .map do |x, y, w, h| -** Processing line: ~ s = state.tile_size~ + outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white] +** Processing line: ~ elsif state.current_turn == :player_2_angle~ - Inside source: true *** True Line Result - s = state.tile_size -** Processing line: ~ w ||= s~ + elsif state.current_turn == :player_2_angle +** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white]~ - Inside source: true *** True Line Result - w ||= s -** Processing line: ~ h ||= s~ + outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white] +** Processing line: ~ elsif state.current_turn == :player_2_velocity~ - Inside source: true *** True Line Result - h ||= s -** Processing line: ~ {~ + elsif state.current_turn == :player_2_velocity +** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white]~ - Inside source: true *** True Line Result - { -** Processing line: ~ args: [x, y, w, h],~ + outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white] +** Processing line: ~ outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]~ - Inside source: true *** True Line Result - args: [x, y, w, h], -** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ + outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white] +** Processing line: ~ end~ - Inside source: true *** True Line Result - left_right: [x, y + 4, w, h - 6], -** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - top: [x + 4, y + 6, w - 8, h - 6], -** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - bottom: [x + 1, y - 1, w - 2, h - 8], -** Processing line: ~ }~ + +** Processing line: ~ def render_banana~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + def render_banana +** Processing line: ~ return unless state.banana~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return unless state.banana +** Processing line: ~ rotation = state.tick_count.%(360) * 20~ - Inside source: true *** True Line Result - + rotation = state.tick_count.%(360) * 20 +** Processing line: ~ rotation *= -1 if state.banana.dx > 0~ +- Inside source: true +*** True Line Result + rotation *= -1 if state.banana.dx > 0 +** Processing line: ~ outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]~ +- Inside source: true +*** True Line Result + outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -60881,110 +61060,138 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_pendulum~ +** Processing line: ~ def render_holes~ - Inside source: true *** True Line Result - def calc_pendulum -** Processing line: ~ return if !state.anchor_point~ + def render_holes +** Processing line: ~ outputs.sprites << state.holes.map do |s|~ - Inside source: true *** True Line Result - return if !state.anchor_point -** Processing line: ~ target_x = state.anchor_point.x - start_of_tongue.x~ + outputs.sprites << state.holes.map do |s| +** Processing line: ~ animation_index = s.created_at.frame_index(7, 3, false)~ - Inside source: true *** True Line Result - target_x = state.anchor_point.x - start_of_tongue.x -** Processing line: ~ target_y = state.anchor_point.y -~ + animation_index = s.created_at.frame_index(7, 3, false) +** Processing line: ~ if animation_index~ - Inside source: true *** True Line Result - target_y = state.anchor_point.y - -** Processing line: ~ state.tongue_length - 5 - 20 - state.player_height~ + if animation_index +** Processing line: ~ [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]~ - Inside source: true *** True Line Result - state.tongue_length - 5 - 20 - state.player_height -** Processing line: ~~ + [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]] +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ diff_y = state.y - target_y~ + else +** Processing line: ~ s.sprite~ - Inside source: true *** True Line Result - diff_y = state.y - target_y + s.sprite +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if target_x > 0~ +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - if target_x > 0 -** Processing line: ~ state.dx += 0.6~ + def calc +** Processing line: ~ calc_generate_stage~ - Inside source: true *** True Line Result - state.dx += 0.6 -** Processing line: ~ elsif target_x < 0~ + calc_generate_stage +** Processing line: ~ calc_current_turn~ - Inside source: true *** True Line Result - elsif target_x < 0 -** Processing line: ~ state.dx -= 0.6~ + calc_current_turn +** Processing line: ~ calc_banana~ - Inside source: true *** True Line Result - state.dx -= 0.6 -** Processing line: ~ end~ + calc_banana +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if diff_y > 0~ +** Processing line: ~ def calc_current_turn~ - Inside source: true *** True Line Result - if diff_y > 0 -** Processing line: ~ state.dy -= 0.1~ + def calc_current_turn +** Processing line: ~ return if state.current_turn~ - Inside source: true *** True Line Result - state.dy -= 0.1 -** Processing line: ~ elsif diff_y < 0~ + return if state.current_turn +** Processing line: ~~ - Inside source: true *** True Line Result - elsif diff_y < 0 -** Processing line: ~ state.dy += 0.1~ + +** Processing line: ~ state.current_turn = :player_1_angle~ - Inside source: true *** True Line Result - state.dy += 0.1 -** Processing line: ~ end~ + state.current_turn = :player_1_angle +** Processing line: ~ state.current_turn = :player_2_angle if state.first_strike == :player_2~ - Inside source: true *** True Line Result - end + state.current_turn = :player_2_angle if state.first_strike == :player_2 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ state.dx *= 0.99~ +** Processing line: ~ def calc_generate_stage~ - Inside source: true *** True Line Result - state.dx *= 0.99 + def calc_generate_stage +** Processing line: ~ return if state.stage_generated~ +- Inside source: true +*** True Line Result + return if state.stage_generated ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.dy.abs < 2~ +** Processing line: ~ state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)~ - Inside source: true *** True Line Result - if state.dy.abs < 2 -** Processing line: ~ state.dy *= 0.8~ + state.buildings << building_prefab(state.building_spacing + -20, *random_building_size) +** Processing line: ~ 8.numbers.inject(state.buildings) do |buildings, i|~ - Inside source: true *** True Line Result - state.dy *= 0.8 -** Processing line: ~ else~ + 8.numbers.inject(state.buildings) do |buildings, i| +** Processing line: ~ buildings <<~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.dy *= 0.90~ + buildings << +** Processing line: ~ building_prefab(state.building_spacing +~ - Inside source: true *** True Line Result - state.dy *= 0.90 + building_prefab(state.building_spacing + +** Processing line: ~ state.buildings.last.right,~ +- Inside source: true +*** True Line Result + state.buildings.last.right, +** Processing line: ~ *random_building_size)~ +- Inside source: true +*** True Line Result + *random_building_size) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -60993,46 +61200,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ if state.tongue_length && state.y~ -- Inside source: true -*** True Line Result - if state.tongue_length && state.y -** Processing line: ~ state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)~ +** Processing line: ~ building_two = state.buildings[1]~ - Inside source: true *** True Line Result - state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000) -** Processing line: ~ end~ + building_two = state.buildings[1] +** Processing line: ~ state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.player_1 = new_player(building_two.x + building_two.w.fdiv(2), +** Processing line: ~ building_two.h)~ - Inside source: true *** True Line Result - end + building_two.h) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_tongue_angle~ +** Processing line: ~ building_nine = state.buildings[-3]~ - Inside source: true *** True Line Result - def calc_tongue_angle -** Processing line: ~ return unless state.anchor_point~ + building_nine = state.buildings[-3] +** Processing line: ~ state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),~ - Inside source: true *** True Line Result - return unless state.anchor_point -** Processing line: ~ state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue~ + state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2), +** Processing line: ~ building_nine.h)~ - Inside source: true *** True Line Result - state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue -** Processing line: ~ state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)~ + building_nine.h) +** Processing line: ~ state.stage_generated = true~ - Inside source: true *** True Line Result - state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point) -** Processing line: ~ state.tongue_length = state.tongue_length.greater(100)~ + state.stage_generated = true +** Processing line: ~ state.wind = 1.randomize(:ratio, :sign)~ - Inside source: true *** True Line Result - state.tongue_length = state.tongue_length.greater(100) + state.wind = 1.randomize(:ratio, :sign) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61041,30 +61244,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def player_from_end_of_tongue~ +** Processing line: ~ def new_player x, y~ - Inside source: true *** True Line Result - def player_from_end_of_tongue -** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ + def new_player x, y +** Processing line: ~ state.new_entity(:gorilla) do |p|~ - Inside source: true *** True Line Result - p = state.tongue_angle.vector(state.tongue_length) -** Processing line: ~ derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]~ + state.new_entity(:gorilla) do |p| +** Processing line: ~ p.x = x - 25~ - Inside source: true *** True Line Result - derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y] -** Processing line: ~ derived_start.x -= state.player_width.half~ + p.x = x - 25 +** Processing line: ~ p.y = y~ - Inside source: true *** True Line Result - derived_start.x -= state.player_width.half -** Processing line: ~ derived_start.y -= state.player_height.half~ + p.y = y +** Processing line: ~ p.solid = [p.x, p.y, 50, 50]~ - Inside source: true *** True Line Result - derived_start.y -= state.player_height.half -** Processing line: ~ derived_start~ + p.solid = [p.x, p.y, 50, 50] +** Processing line: ~ end~ - Inside source: true *** True Line Result - derived_start + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61073,214 +61276,214 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def end_of_tongue~ +** Processing line: ~ def calc_banana~ - Inside source: true *** True Line Result - def end_of_tongue -** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ + def calc_banana +** Processing line: ~ return unless state.banana~ - Inside source: true *** True Line Result - p = state.tongue_angle.vector(state.tongue_length) -** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ + return unless state.banana +** Processing line: ~~ - Inside source: true *** True Line Result - [start_of_tongue.x + p.x, start_of_tongue.y + p.y] -** Processing line: ~ end~ + +** Processing line: ~ state.banana.x += state.banana.dx~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.banana.x += state.banana.dx +** Processing line: ~ state.banana.dx += state.wind.fdiv(50)~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_shooting~ + state.banana.dx += state.wind.fdiv(50) +** Processing line: ~ state.banana.y += state.banana.dy~ - Inside source: true *** True Line Result - def calc_shooting -** Processing line: ~ return unless state.action == :shooting~ + state.banana.y += state.banana.dy +** Processing line: ~ state.banana.dy -= state.gravity~ - Inside source: true *** True Line Result - return unless state.action == :shooting -** Processing line: ~ state.tongue_length += 30~ + state.banana.dy -= state.gravity +** Processing line: ~ banana_collision = [state.banana.x, state.banana.y, 10, 10]~ - Inside source: true *** True Line Result - state.tongue_length += 30 -** Processing line: ~ potential_anchor = end_of_tongue~ + banana_collision = [state.banana.x, state.banana.y, 10, 10] +** Processing line: ~~ - Inside source: true *** True Line Result - potential_anchor = end_of_tongue -** Processing line: ~ if potential_anchor.x <= 0~ + +** Processing line: ~ if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)~ - Inside source: true *** True Line Result - if potential_anchor.x <= 0 -** Processing line: ~ state.anchor_point = potential_anchor~ + if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid) +** Processing line: ~ state.over = true~ - Inside source: true *** True Line Result - state.anchor_point = potential_anchor -** Processing line: ~ state.action = :anchored~ + state.over = true +** Processing line: ~ if state.banana.owner == state.player_2~ - Inside source: true *** True Line Result - state.action = :anchored -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ + if state.banana.owner == state.player_2 +** Processing line: ~ state.winner = :player_2~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/attached.wav' -** Processing line: ~ elsif potential_anchor.x >= 10000~ + state.winner = :player_2 +** Processing line: ~ else~ - Inside source: true *** True Line Result - elsif potential_anchor.x >= 10000 -** Processing line: ~ state.anchor_point = potential_anchor~ + else +** Processing line: ~ state.winner = :player_1~ - Inside source: true *** True Line Result - state.anchor_point = potential_anchor -** Processing line: ~ state.action = :anchored~ + state.winner = :player_1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.action = :anchored -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/attached.wav' -** Processing line: ~ elsif potential_anchor.y <= 0~ + +** Processing line: ~ state.player_2_score += 1~ - Inside source: true *** True Line Result - elsif potential_anchor.y <= 0 -** Processing line: ~ state.anchor_point = potential_anchor~ + state.player_2_score += 1 +** Processing line: ~ elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)~ - Inside source: true *** True Line Result - state.anchor_point = potential_anchor -** Processing line: ~ state.action = :anchored~ + elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid) +** Processing line: ~ state.over = true~ - Inside source: true *** True Line Result - state.action = :anchored -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ + state.over = true +** Processing line: ~ if state.banana.owner == state.player_2~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/attached.wav' -** Processing line: ~ elsif potential_anchor.y >= 5875~ + if state.banana.owner == state.player_2 +** Processing line: ~ state.winner = :player_1~ - Inside source: true *** True Line Result - elsif potential_anchor.y >= 5875 -** Processing line: ~ state.anchor_point = potential_anchor~ + state.winner = :player_1 +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.anchor_point = potential_anchor -** Processing line: ~ state.action = :anchored~ + else +** Processing line: ~ state.winner = :player_2~ - Inside source: true *** True Line Result - state.action = :anchored -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ + state.winner = :player_2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/attached.wav' -** Processing line: ~ else~ + end +** Processing line: ~ state.player_1_score += 1~ - Inside source: true *** True Line Result - else -** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ + state.player_1_score += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] -** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - collision = state.world_collision_rects.find_all do |v| -** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ + +** Processing line: ~ if state.over~ - Inside source: true *** True Line Result - [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) -** Processing line: ~ end.first~ + if state.over +** Processing line: ~ place_hole~ - Inside source: true *** True Line Result - end.first -** Processing line: ~ if collision~ + place_hole +** Processing line: ~ return~ - Inside source: true *** True Line Result - if collision -** Processing line: ~ state.anchor_point = potential_anchor~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.anchor_point = potential_anchor -** Processing line: ~ state.action = :anchored~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.action = :anchored -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ + +** Processing line: ~ return if state.holes.any? do |h|~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/attached.wav' -** Processing line: ~ end~ + return if state.holes.any? do |h| +** Processing line: ~ h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]~ - Inside source: true *** True Line Result - end + h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_player~ +** Processing line: ~ return unless state.banana.y < 0 || state.buildings.any? do |b|~ - Inside source: true *** True Line Result - def calc_player -** Processing line: ~ calc_shooting~ + return unless state.banana.y < 0 || state.buildings.any? do |b| +** Processing line: ~ b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]~ - Inside source: true *** True Line Result - calc_shooting -** Processing line: ~ if !state.god_mode~ + b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - if !state.god_mode -** Processing line: ~ state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame -** Processing line: ~ state.dx += state.dx * state.air~ + +** Processing line: ~ place_hole~ - Inside source: true *** True Line Result - state.dx += state.dx * state.air -** Processing line: ~ end~ + place_hole +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ calc_pendulum~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc_pendulum -** Processing line: ~ calc_box_collision~ + +** Processing line: ~ def place_hole~ - Inside source: true *** True Line Result - calc_box_collision -** Processing line: ~ calc_edge_collision~ + def place_hole +** Processing line: ~ return unless state.banana~ - Inside source: true *** True Line Result - calc_edge_collision -** Processing line: ~ if !state.god_mode~ + return unless state.banana +** Processing line: ~~ - Inside source: true *** True Line Result - if !state.god_mode -** Processing line: ~ state.y += state.dy~ + +** Processing line: ~ state.holes << state.new_entity(:banana) do |b|~ - Inside source: true *** True Line Result - state.y += state.dy -** Processing line: ~ state.x += state.dx~ + state.holes << state.new_entity(:banana) do |b| +** Processing line: ~ b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']~ - Inside source: true *** True Line Result - state.x += state.dx + b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png'] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ calc_tongue_angle~ +** Processing line: ~~ - Inside source: true *** True Line Result - calc_tongue_angle + +** Processing line: ~ state.banana = nil~ +- Inside source: true +*** True Line Result + state.banana = nil ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61289,126 +61492,118 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_box_collision~ +** Processing line: ~ def process_inputs_main~ - Inside source: true *** True Line Result - def calc_box_collision -** Processing line: ~ return unless state.world_lookup.keys.length > 0~ + def process_inputs_main +** Processing line: ~ return if state.banana~ - Inside source: true *** True Line Result - return unless state.world_lookup.keys.length > 0 -** Processing line: ~ collision_floor~ + return if state.banana +** Processing line: ~ return if state.over~ - Inside source: true *** True Line Result - collision_floor -** Processing line: ~ collision_left~ + return if state.over +** Processing line: ~~ - Inside source: true *** True Line Result - collision_left -** Processing line: ~ collision_right~ + +** Processing line: ~ if inputs.keyboard.key_down.enter~ - Inside source: true *** True Line Result - collision_right -** Processing line: ~ collision_ceiling~ + if inputs.keyboard.key_down.enter +** Processing line: ~ input_execute_turn~ - Inside source: true *** True Line Result - collision_ceiling -** Processing line: ~ end~ + input_execute_turn +** Processing line: ~ elsif inputs.keyboard.key_down.backspace~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif inputs.keyboard.key_down.backspace +** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_edge_collision~ + state.as_hash[state.current_turn] ||= "" +** Processing line: ~ state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2]~ - Inside source: true *** True Line Result - def calc_edge_collision -** Processing line: ~ # Ensures that player doesn't fall below the map~ + state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2] +** Processing line: ~ elsif inputs.keyboard.key_down.char~ - Inside source: true *** True Line Result - # Ensures that player doesn't fall below the map -** Processing line: ~ if next_y < 0 && state.dy < 0~ + elsif inputs.keyboard.key_down.char +** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ - Inside source: true *** True Line Result - if next_y < 0 && state.dy < 0 -** Processing line: ~ state.y = 0~ + state.as_hash[state.current_turn] ||= "" +** Processing line: ~ state.as_hash[state.current_turn] += inputs.keyboard.key_down.char~ - Inside source: true *** True Line Result - state.y = 0 -** Processing line: ~ state.dy = state.dy.abs * 0.8~ + state.as_hash[state.current_turn] += inputs.keyboard.key_down.char +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.dy = state.dy.abs * 0.8 -** Processing line: ~ state.collision_on_y = true~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.collision_on_y = true -** Processing line: ~ # Ensures player doesn't go insanely high~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Ensures player doesn't go insanely high -** Processing line: ~ elsif next_y > 5875 - state.tile_size && state.dy > 0~ + +** Processing line: ~ def process_inputs_game_over~ - Inside source: true *** True Line Result - elsif next_y > 5875 - state.tile_size && state.dy > 0 -** Processing line: ~ state.y = 5875 - state.tile_size~ + def process_inputs_game_over +** Processing line: ~ return unless state.over~ - Inside source: true *** True Line Result - state.y = 5875 - state.tile_size -** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ + return unless state.over +** Processing line: ~ return unless inputs.keyboard.key_down.truthy_keys.any?~ - Inside source: true *** True Line Result - state.dy = state.dy.abs * 0.8 * -1 -** Processing line: ~ state.collision_on_y = true~ + return unless inputs.keyboard.key_down.truthy_keys.any? +** Processing line: ~ state.over = false~ - Inside source: true *** True Line Result - state.collision_on_y = true -** Processing line: ~ end~ + state.over = false +** Processing line: ~ outputs.static_solids.clear~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.static_solids.clear +** Processing line: ~ state.buildings.clear~ - Inside source: true *** True Line Result - -** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ + state.buildings.clear +** Processing line: ~ state.holes.clear~ - Inside source: true *** True Line Result - # Ensures that player remains in the horizontal range its supposed to -** Processing line: ~ if state.x >= 10000 - state.tile_size && state.dx > 0~ + state.holes.clear +** Processing line: ~ state.stage_generated = false~ - Inside source: true *** True Line Result - if state.x >= 10000 - state.tile_size && state.dx > 0 -** Processing line: ~ state.x = 10000 - state.tile_size~ + state.stage_generated = false +** Processing line: ~ state.stage_rendered = false~ - Inside source: true *** True Line Result - state.x = 10000 - state.tile_size -** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ + state.stage_rendered = false +** Processing line: ~ if state.first_strike == :player_1~ - Inside source: true *** True Line Result - state.dx = state.dx.abs * 0.8 * -1 -** Processing line: ~ state.collision_on_x = true~ + if state.first_strike == :player_1 +** Processing line: ~ state.first_strike = :player_2~ - Inside source: true *** True Line Result - state.collision_on_x = true -** Processing line: ~ elsif state.x <= 0 && state.dx < 0~ -- Inside source: true -*** True Line Result - elsif state.x <= 0 && state.dx < 0 -** Processing line: ~ state.x = 0~ -- Inside source: true -*** True Line Result - state.x = 0 -** Processing line: ~ state.dx = state.dx.abs * 0.8~ + state.first_strike = :player_2 +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.dx = state.dx.abs * 0.8 -** Processing line: ~ state.collision_on_x = true~ + else +** Processing line: ~ state.first_strike = :player_1~ - Inside source: true *** True Line Result - state.collision_on_x = true + state.first_strike = :player_1 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61421,14 +61616,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def next_y~ +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - def next_y -** Processing line: ~ state.y + state.dy~ + def process_inputs +** Processing line: ~ process_inputs_main~ - Inside source: true *** True Line Result - state.y + state.dy + process_inputs_main +** Processing line: ~ process_inputs_game_over~ +- Inside source: true +*** True Line Result + process_inputs_game_over ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61437,150 +61636,130 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def next_x~ -- Inside source: true -*** True Line Result - def next_x -** Processing line: ~ if state.dx < 0~ -- Inside source: true -*** True Line Result - if state.dx < 0 -** Processing line: ~ return (state.x + state.dx) - (state.tile_size - state.player_width)~ -- Inside source: true -*** True Line Result - return (state.x + state.dx) - (state.tile_size - state.player_width) -** Processing line: ~ else~ -- Inside source: true -*** True Line Result - else -** Processing line: ~ return (state.x + state.dx) + (state.tile_size - state.player_width)~ -- Inside source: true -*** True Line Result - return (state.x + state.dx) + (state.tile_size - state.player_width) -** Processing line: ~ end~ +** Processing line: ~ def input_execute_turn~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def input_execute_turn +** Processing line: ~ return if state.banana~ - Inside source: true *** True Line Result - end + return if state.banana ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def collision_floor~ +** Processing line: ~ if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)~ - Inside source: true *** True Line Result - def collision_floor -** Processing line: ~ return unless state.dy <= 0~ + if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle) +** Processing line: ~ state.current_turn = :player_1_velocity~ - Inside source: true *** True Line Result - return unless state.dy <= 0 -** Processing line: ~~ + state.current_turn = :player_1_velocity +** Processing line: ~ elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)~ - Inside source: true *** True Line Result - -** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size]~ + elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity) +** Processing line: ~ state.current_turn = :player_2_angle~ - Inside source: true *** True Line Result - player_rect = [state.x, next_y, state.tile_size, state.tile_size] -** Processing line: ~~ + state.current_turn = :player_2_angle +** Processing line: ~ state.banana =~ - Inside source: true *** True Line Result - -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)~ + state.banana = +** Processing line: ~ new_banana(state.player_1,~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above) -** Processing line: ~ floor_collisions = state.world_collision_rects~ + new_banana(state.player_1, +** Processing line: ~ state.player_1.x + 25,~ - Inside source: true *** True Line Result - floor_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ + state.player_1.x + 25, +** Processing line: ~ state.player_1.y + 60,~ - Inside source: true *** True Line Result - .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + state.player_1.y + 60, +** Processing line: ~ state.player_1_angle,~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + state.player_1_angle, +** Processing line: ~ state.player_1_velocity)~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless floor_collisions~ + state.player_1_velocity) +** Processing line: ~ elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)~ - Inside source: true *** True Line Result - return unless floor_collisions -** Processing line: ~ state.y = floor_collisions[:top].top~ + elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle) +** Processing line: ~ state.current_turn = :player_2_velocity~ - Inside source: true *** True Line Result - state.y = floor_collisions[:top].top -** Processing line: ~ state.dy = state.dy.abs * 0.8~ + state.current_turn = :player_2_velocity +** Processing line: ~ elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)~ - Inside source: true *** True Line Result - state.dy = state.dy.abs * 0.8 -** Processing line: ~ end~ + elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity) +** Processing line: ~ state.current_turn = :player_1_angle~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.current_turn = :player_1_angle +** Processing line: ~ state.banana =~ - Inside source: true *** True Line Result - -** Processing line: ~ def collision_left~ + state.banana = +** Processing line: ~ new_banana(state.player_2,~ - Inside source: true *** True Line Result - def collision_left -** Processing line: ~ return unless state.dx < 0~ + new_banana(state.player_2, +** Processing line: ~ state.player_2.x + 25,~ - Inside source: true *** True Line Result - return unless state.dx < 0 -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ + state.player_2.x + 25, +** Processing line: ~ state.player_2.y + 60,~ - Inside source: true *** True Line Result - player_rect = [next_x, state.y, state.tile_size, state.tile_size] -** Processing line: ~~ + state.player_2.y + 60, +** Processing line: ~ 180 - state.player_2_angle,~ - Inside source: true *** True Line Result - -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)~ + 180 - state.player_2_angle, +** Processing line: ~ state.player_2_velocity)~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above) -** Processing line: ~ left_side_collisions = state.world_collision_rects~ + state.player_2_velocity) +** Processing line: ~ end~ - Inside source: true *** True Line Result - left_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + +** Processing line: ~ if state.banana~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + if state.banana +** Processing line: ~ state.player_1_angle = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless left_side_collisions~ + state.player_1_angle = nil +** Processing line: ~ state.player_1_velocity = nil~ - Inside source: true *** True Line Result - return unless left_side_collisions -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ + state.player_1_velocity = nil +** Processing line: ~ state.player_2_angle = nil~ - Inside source: true *** True Line Result - state.x = left_side_collisions[:left_right].right -** Processing line: ~ state.dx = state.dy.abs * 0.8~ + state.player_2_angle = nil +** Processing line: ~ state.player_2_velocity = nil~ - Inside source: true *** True Line Result - state.dx = state.dy.abs * 0.8 -** Processing line: ~ state.collision_on_x = true~ + state.player_2_velocity = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.collision_on_x = true + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61589,58 +61768,58 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def collision_right~ -- Inside source: true -*** True Line Result - def collision_right -** Processing line: ~ return unless state.dx > 0~ +** Processing line: ~ def random_building_size~ - Inside source: true *** True Line Result - return unless state.dx > 0 -** Processing line: ~~ + def random_building_size +** Processing line: ~ [state.building_heights.sample, state.building_room_sizes.sample]~ - Inside source: true *** True Line Result - -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ + [state.building_heights.sample, state.building_room_sizes.sample] +** Processing line: ~ end~ - Inside source: true *** True Line Result - player_rect = [next_x, state.y, state.tile_size, state.tile_size] -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above) -** Processing line: ~ right_side_collisions = state.world_collision_rects~ + +** Processing line: ~ def int? v~ - Inside source: true *** True Line Result - right_side_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ + def int? v +** Processing line: ~ v.to_i.to_s == v.to_s~ - Inside source: true *** True Line Result - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + v.to_i.to_s == v.to_s +** Processing line: ~ end~ - Inside source: true *** True Line Result - .first + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return unless right_side_collisions~ +** Processing line: ~ def random_building_color~ - Inside source: true *** True Line Result - return unless right_side_collisions -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ + def random_building_color +** Processing line: ~ [[ 99, 0, 107],~ - Inside source: true *** True Line Result - state.x = right_side_collisions[:left_right].left - state.tile_size -** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ + [[ 99, 0, 107], +** Processing line: ~ [ 35, 64, 124],~ - Inside source: true *** True Line Result - state.dx = state.dx.abs * 0.8 * -1 -** Processing line: ~ state.collision_on_x = true~ + [ 35, 64, 124], +** Processing line: ~ [ 35, 136, 162],~ - Inside source: true *** True Line Result - state.collision_on_x = true + [ 35, 136, 162], +** Processing line: ~ ].sample~ +- Inside source: true +*** True Line Result + ].sample ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61649,62 +61828,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def collision_ceiling~ +** Processing line: ~ def random_window_color~ - Inside source: true *** True Line Result - def collision_ceiling -** Processing line: ~ return unless state.dy > 0~ + def random_window_color +** Processing line: ~ [[ 88, 62, 104],~ - Inside source: true *** True Line Result - return unless state.dy > 0 -** Processing line: ~~ + [[ 88, 62, 104], +** Processing line: ~ [253, 224, 187]].sample~ - Inside source: true *** True Line Result - -** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ + [253, 224, 187]].sample +** Processing line: ~ end~ - Inside source: true *** True Line Result - player_rect = [state.x, next_y, state.player_width, state.player_height] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)~ +** Processing line: ~ def windows_for_building starting_x, floors, rooms~ - Inside source: true *** True Line Result - # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above) -** Processing line: ~ ceil_collisions = state.world_collision_rects~ + def windows_for_building starting_x, floors, rooms +** Processing line: ~ floors.-(1).combinations(rooms - 1).map do |floor, room|~ - Inside source: true *** True Line Result - ceil_collisions = state.world_collision_rects -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ + floors.-(1).combinations(rooms - 1).map do |floor, room| +** Processing line: ~ [starting_x +~ - Inside source: true *** True Line Result - .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } -** Processing line: ~ .first~ + [starting_x + +** Processing line: ~ state.building_room_width.*(room) +~ - Inside source: true *** True Line Result - .first -** Processing line: ~~ + state.building_room_width.*(room) + +** Processing line: ~ state.building_room_spacing.*(room + 1),~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless ceil_collisions~ + state.building_room_spacing.*(room + 1), +** Processing line: ~ state.building_room_height.*(floor) +~ - Inside source: true *** True Line Result - return unless ceil_collisions -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ + state.building_room_height.*(floor) + +** Processing line: ~ state.building_room_spacing.*(floor + 1),~ - Inside source: true *** True Line Result - state.y = ceil_collisions[:bottom].y - state.tile_size -** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ + state.building_room_spacing.*(floor + 1), +** Processing line: ~ state.building_room_width,~ - Inside source: true *** True Line Result - state.dy = state.dy.abs * 0.8 * -1 -** Processing line: ~ state.collision_on_y = true~ + state.building_room_width, +** Processing line: ~ state.building_room_height,~ - Inside source: true *** True Line Result - state.collision_on_y = true + state.building_room_height, +** Processing line: ~ random_window_color]~ +- Inside source: true +*** True Line Result + random_window_color] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61713,70 +61900,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def to_coord point~ +** Processing line: ~ def building_prefab starting_x, floors, rooms~ - Inside source: true *** True Line Result - def to_coord point -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ + def building_prefab starting_x, floors, rooms +** Processing line: ~ state.new_entity(:building) do |b|~ - Inside source: true *** True Line Result - # Integer divides (idiv) point.x to turn into grid -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ + state.new_entity(:building) do |b| +** Processing line: ~ b.x = starting_x~ - Inside source: true *** True Line Result - # Then, you can just multiply each integer by state.tile_size -** Processing line: ~ # later and huzzah. Grid coordinates~ + b.x = starting_x +** Processing line: ~ b.y = 0~ - Inside source: true *** True Line Result - # later and huzzah. Grid coordinates -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ + b.y = 0 +** Processing line: ~ b.w = state.building_room_width.*(rooms) +~ - Inside source: true *** True Line Result - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] -** Processing line: ~ end~ + b.w = state.building_room_width.*(rooms) + +** Processing line: ~ state.building_room_spacing.*(rooms + 1)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.building_room_spacing.*(rooms + 1) +** Processing line: ~ b.h = state.building_room_height.*(floors) +~ - Inside source: true *** True Line Result - -** Processing line: ~ def export_map~ + b.h = state.building_room_height.*(floors) + +** Processing line: ~ state.building_room_spacing.*(floors + 1)~ - Inside source: true *** True Line Result - def export_map -** Processing line: ~ export_string = state.world.map do |x, y|~ + state.building_room_spacing.*(floors + 1) +** Processing line: ~ b.right = b.x + b.w~ - Inside source: true *** True Line Result - export_string = state.world.map do |x, y| -** Processing line: ~ "#{x},#{y},1"~ + b.right = b.x + b.w +** Processing line: ~ b.rect = [b.x, b.y, b.w, b.h]~ - Inside source: true *** True Line Result - "#{x},#{y},1" -** Processing line: ~ end~ + b.rect = [b.x, b.y, b.w, b.h] +** Processing line: ~ b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],~ - Inside source: true *** True Line Result - end -** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ + b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white], +** Processing line: ~ [b.x, b.y, b.w, b.h, random_building_color],~ - Inside source: true *** True Line Result - export_string += state.objects.map do |x, y, w, h, path| -** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ + [b.x, b.y, b.w, b.h, random_building_color], +** Processing line: ~ windows_for_building(b.x, floors, rooms)]~ - Inside source: true *** True Line Result - "#{x},#{y},2,#{w},#{h},#{path}" + windows_for_building(b.x, floors, rooms)] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ -- Inside source: true -*** True Line Result - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) -** Processing line: ~ state.map_saved_at = state.tick_count~ -- Inside source: true -*** True Line Result - state.map_saved_at = state.tick_count ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61785,82 +61964,82 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def inputs_export_stage~ +** Processing line: ~ def parse_or_clear! game_prop~ - Inside source: true *** True Line Result - def inputs_export_stage -** Processing line: ~ end~ + def parse_or_clear! game_prop +** Processing line: ~ if int? state.as_hash[game_prop]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if int? state.as_hash[game_prop] +** Processing line: ~ state.as_hash[game_prop] = state.as_hash[game_prop].to_i~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_score~ + state.as_hash[game_prop] = state.as_hash[game_prop].to_i +** Processing line: ~ return true~ - Inside source: true *** True Line Result - def calc_score -** Processing line: ~ return unless state.scene == :game~ + return true +** Processing line: ~ end~ - Inside source: true *** True Line Result - return unless state.scene == :game -** Processing line: ~ player = [state.x, state.y, state.player_width, state.player_height]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - player = [state.x, state.y, state.player_width, state.player_height] -** Processing line: ~ collected = state.objects.find_all { |s| s.intersect_rect? player }~ + +** Processing line: ~ state.as_hash[game_prop] = nil~ - Inside source: true *** True Line Result - collected = state.objects.find_all { |s| s.intersect_rect? player } -** Processing line: ~ state.stuff_score += collected.length~ + state.as_hash[game_prop] = nil +** Processing line: ~ return false~ - Inside source: true *** True Line Result - state.stuff_score += collected.length -** Processing line: ~ if collected.length > 0~ + return false +** Processing line: ~ end~ - Inside source: true *** True Line Result - if collected.length > 0 -** Processing line: ~ outputs.sounds << 'sounds/collectable.wav'~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - outputs.sounds << 'sounds/collectable.wav' -** Processing line: ~ end~ + +** Processing line: ~ def new_banana owner, x, y, angle, velocity~ - Inside source: true *** True Line Result - end -** Processing line: ~ state.objects = state.objects.reject { |s| collected.include? s }~ + def new_banana owner, x, y, angle, velocity +** Processing line: ~ state.new_entity(:banana) do |b|~ - Inside source: true *** True Line Result - state.objects = state.objects.reject { |s| collected.include? s } -** Processing line: ~ state.stuff_time += 0.01~ + state.new_entity(:banana) do |b| +** Processing line: ~ b.owner = owner~ - Inside source: true *** True Line Result - state.stuff_time += 0.01 -** Processing line: ~ if state.objects.length == 0~ + b.owner = owner +** Processing line: ~ b.x = x~ - Inside source: true *** True Line Result - if state.objects.length == 0 -** Processing line: ~ if !state.stuff_best_time || state.stuff_time < state.stuff_best_time~ + b.x = x +** Processing line: ~ b.y = y~ - Inside source: true *** True Line Result - if !state.stuff_best_time || state.stuff_time < state.stuff_best_time -** Processing line: ~ state.stuff_best_time = state.stuff_time~ + b.y = y +** Processing line: ~ b.angle = angle % 360~ - Inside source: true *** True Line Result - state.stuff_best_time = state.stuff_time -** Processing line: ~ end~ + b.angle = angle % 360 +** Processing line: ~ b.velocity = velocity / 5~ - Inside source: true *** True Line Result - end -** Processing line: ~ state.game_over_at = nil~ + b.velocity = velocity / 5 +** Processing line: ~ b.dx = b.angle.vector_x(b.velocity)~ - Inside source: true *** True Line Result - state.game_over_at = nil -** Processing line: ~ state.scene = :ending~ + b.dx = b.angle.vector_x(b.velocity) +** Processing line: ~ b.dy = b.angle.vector_y(b.velocity)~ - Inside source: true *** True Line Result - state.scene = :ending + b.dy = b.angle.vector_y(b.velocity) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -61873,402 +62052,406 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def calc_on_floor~ +** Processing line: ~ def fancy_white~ - Inside source: true *** True Line Result - def calc_on_floor -** Processing line: ~ if state.action == :anchored~ + def fancy_white +** Processing line: ~ [253, 252, 253]~ - Inside source: true *** True Line Result - if state.action == :anchored -** Processing line: ~ state.on_floor = false~ + [253, 252, 253] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.on_floor = false -** Processing line: ~ state.on_floor_debounce = 30~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.on_floor_debounce = 30 -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.on_floor_debounce ||= 30~ + +** Processing line: ~ $you_so_basic_gorillas = YouSoBasicGorillas.new~ - Inside source: true *** True Line Result - state.on_floor_debounce ||= 30 + $you_so_basic_gorillas = YouSoBasicGorillas.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.dy.round != 0~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - if state.dy.round != 0 -** Processing line: ~ state.on_floor_debounce = 30~ + def tick args +** Processing line: ~ $you_so_basic_gorillas.outputs = args.outputs~ - Inside source: true *** True Line Result - state.on_floor_debounce = 30 -** Processing line: ~ state.on_floor = false~ + $you_so_basic_gorillas.outputs = args.outputs +** Processing line: ~ $you_so_basic_gorillas.grid = args.grid~ - Inside source: true *** True Line Result - state.on_floor = false -** Processing line: ~ else~ + $you_so_basic_gorillas.grid = args.grid +** Processing line: ~ $you_so_basic_gorillas.state = args.state~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.on_floor_debounce -= 1~ + $you_so_basic_gorillas.state = args.state +** Processing line: ~ $you_so_basic_gorillas.inputs = args.inputs~ - Inside source: true *** True Line Result - state.on_floor_debounce -= 1 -** Processing line: ~ end~ + $you_so_basic_gorillas.inputs = args.inputs +** Processing line: ~ $you_so_basic_gorillas.tick~ - Inside source: true *** True Line Result - end + $you_so_basic_gorillas.tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if state.on_floor_debounce <= 0~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - if state.on_floor_debounce <= 0 -** Processing line: ~ state.on_floor_debounce = 0~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.on_floor_debounce = 0 -** Processing line: ~ state.on_floor = true~ -- Inside source: true + +** Processing line: ~* Platformer - Gorillas Basic - repl.rb~ +- Header detected. *** True Line Result - state.on_floor = true -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true +* Platformer - Gorillas Basic - repl.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/repl.rb~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_player~ + # ./samples/99_genre_platformer/gorillas_basic/app/repl.rb +** Processing line: ~ begin~ - Inside source: true *** True Line Result - def render_player -** Processing line: ~ path = "sprites/square-green.png"~ + begin +** Processing line: ~ if $gtk.args.state.current_turn == :player_1_angle~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ angle = 0~ + if $gtk.args.state.current_turn == :player_1_angle +** Processing line: ~ $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"~ - Inside source: true *** True Line Result - angle = 0 -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]~ + $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}" +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"] -** Processing line: ~ if state.action == :idle~ + $you_so_basic_gorillas.input_execute_turn +** Processing line: ~ $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ - Inside source: true *** True Line Result - if state.action == :idle -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]~ + $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}" +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "IDLE"] -** Processing line: ~ path = "sprites/square-green.png"~ + $you_so_basic_gorillas.input_execute_turn +** Processing line: ~ elsif $gtk.args.state.current_turn == :player_2_angle~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ elsif state.action == :aiming && !state.on_floor~ + elsif $gtk.args.state.current_turn == :player_2_angle +** Processing line: ~ $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"~ - Inside source: true *** True Line Result - elsif state.action == :aiming && !state.on_floor -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]~ + $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}" +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"] -** Processing line: ~ angle = state.tongue_angle - 90~ + $you_so_basic_gorillas.input_execute_turn +** Processing line: ~ $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ - Inside source: true *** True Line Result - angle = state.tongue_angle - 90 -** Processing line: ~ path = "sprites/square-green.png"~ + $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}" +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ elsif state.action == :aiming # ON THE GROUND~ + $you_so_basic_gorillas.input_execute_turn +** Processing line: ~ else~ - Inside source: true *** True Line Result - elsif state.action == :aiming # ON THE GROUND -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]~ + else +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"] -** Processing line: ~ path = "sprites/square-green.png"~ + $you_so_basic_gorillas.input_execute_turn +** Processing line: ~ end~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ elsif state.action == :shooting && !state.on_floor~ + end +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - elsif state.action == :shooting && !state.on_floor -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]~ + rescue Exception => e +** Processing line: ~ puts e~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"] -** Processing line: ~ path = "sprites/square-green.png"~ + puts e +** Processing line: ~ end~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ angle = state.tongue_angle - 90~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - angle = state.tongue_angle - 90 -** Processing line: ~ elsif state.action == :shooting~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - elsif state.action == :shooting -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"] -** Processing line: ~ path = "sprites/square-green.png"~ -- Inside source: true + +** Processing line: ~* Platformer - Gorillas Basic - tests.rb~ +- Header detected. *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ elsif state.action == :anchored~ + +*** True Line Result +* Platformer - Gorillas Basic - tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/tests.rb~ - Inside source: true *** True Line Result - elsif state.action == :anchored -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]~ + # ./samples/99_genre_platformer/gorillas_basic/app/tests.rb +** Processing line: ~ $gtk.reset 100~ - Inside source: true *** True Line Result - # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"] -** Processing line: ~ angle = state.tongue_angle - 90~ + $gtk.reset 100 +** Processing line: ~ $gtk.supress_framerate_warning = true~ - Inside source: true *** True Line Result - angle = state.tongue_angle - 90 -** Processing line: ~ path = "sprites/square-green.png"~ + $gtk.supress_framerate_warning = true +** Processing line: ~ $gtk.require 'app/tests/building_generation_tests.rb'~ - Inside source: true *** True Line Result - path = "sprites/square-green.png" -** Processing line: ~ end~ + $gtk.require 'app/tests/building_generation_tests.rb' +** Processing line: ~ $gtk.tests.start~ - Inside source: true *** True Line Result - end + $gtk.tests.start ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ outputs.sprites << [vx(state.x),~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - outputs.sprites << [vx(state.x), -** Processing line: ~ vy(state.y),~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - vy(state.y), -** Processing line: ~ vw(state.player_width),~ -- Inside source: true + +** Processing line: ~* Platformer - Gorillas Basic - Tests - building_generation_tests.rb~ +- Header detected. *** True Line Result - vw(state.player_width), -** Processing line: ~ vh(state.player_height),~ -- Inside source: true + *** True Line Result - vh(state.player_height), -** Processing line: ~ path,~ -- Inside source: true +* Platformer - Gorillas Basic - Tests - building_generation_tests.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - path, -** Processing line: ~ angle]~ -- Inside source: true + *** True Line Result - angle] -** Processing line: ~ end~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb +** Processing line: ~ def test_solids args, assert~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_player_old~ + def test_solids args, assert +** Processing line: ~ game = YouSoBasicGorillas.new~ - Inside source: true *** True Line Result - def render_player_old -** Processing line: ~ # Player~ + game = YouSoBasicGorillas.new +** Processing line: ~ game.outputs = args.outputs~ - Inside source: true *** True Line Result - # Player -** Processing line: ~ if state.action == :aiming~ + game.outputs = args.outputs +** Processing line: ~ game.grid = args.grid~ - Inside source: true *** True Line Result - if state.action == :aiming -** Processing line: ~ path = 'sprites\frg\idle\frog_idle.png'~ + game.grid = args.grid +** Processing line: ~ game.state = args.state~ - Inside source: true *** True Line Result - path = 'sprites\frg\idle\frog_idle.png' -** Processing line: ~ if state.dx > 2~ + game.state = args.state +** Processing line: ~ game.inputs = args.inputs~ - Inside source: true *** True Line Result - if state.dx > 2 -** Processing line: ~ #directional right sprite was here but i needa redo it~ + game.inputs = args.inputs +** Processing line: ~ game.tick~ - Inside source: true *** True Line Result - #directional right sprite was here but i needa redo it -** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ + game.tick +** Processing line: ~ assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"~ - Inside source: true *** True Line Result - path = 'sprites\frg\anchor\frog-anchor-0.png' -** Processing line: ~ #directional left sprite was here but i needa redo it~ + assert.true! args.state.stage_generated, "stage wasn't generated but it should have been" +** Processing line: ~ game.tick~ - Inside source: true *** True Line Result - #directional left sprite was here but i needa redo it -** Processing line: ~ elsif state.dx < -2~ + game.tick +** Processing line: ~ assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"~ - Inside source: true *** True Line Result - elsif state.dx < -2 -** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ + assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered" +** Processing line: ~ number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)~ - Inside source: true *** True Line Result - path = 'sprites\frg\anchor\frog-anchor-0.png' -** Processing line: ~ end~ + number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end) +** Processing line: ~ the_only_background = 1~ - Inside source: true *** True Line Result - end -** Processing line: ~ outputs.sprites << [vx(state.x),~ + the_only_background = 1 +** Processing line: ~ static_solids = args.outputs.static_solids.length~ - Inside source: true *** True Line Result - outputs.sprites << [vx(state.x), -** Processing line: ~ vy(state.y),~ + static_solids = args.outputs.static_solids.length +** Processing line: ~ assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"~ - Inside source: true *** True Line Result - vy(state.y), -** Processing line: ~ vw(state.player_width),~ + assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered" +** Processing line: ~ end~ - Inside source: true *** True Line Result - vw(state.player_width), -** Processing line: ~ vh(state.player_height),~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - vh(state.player_height), -** Processing line: ~ path,~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - path, -** Processing line: ~ (state.tongue_angle - 90)]~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - (state.tongue_angle - 90)] -** Processing line: ~ elsif state.action == :anchored || state.action == :shooting~ -- Inside source: true + +** Processing line: ~* Platformer - The Little Probe - main.rb~ +- Header detected. *** True Line Result - elsif state.action == :anchored || state.action == :shooting -** Processing line: ~ outputs.sprites << [vx(state.x),~ -- Inside source: true + *** True Line Result - outputs.sprites << [vx(state.x), -** Processing line: ~ vy(state.y),~ +* Platformer - The Little Probe - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/app/main.rb~ - Inside source: true *** True Line Result - vy(state.y), -** Processing line: ~ vw(state.player_width),~ + # ./samples/99_genre_platformer/the_little_probe/app/main.rb +** Processing line: ~ class FallingCircle~ - Inside source: true *** True Line Result - vw(state.player_width), -** Processing line: ~ vw(state.player_height),~ + class FallingCircle +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - vw(state.player_height), -** Processing line: ~ 'sprites/animations_povfrog/frog_bwah_up.png',~ + attr_gtk +** Processing line: ~~ - Inside source: true *** True Line Result - 'sprites/animations_povfrog/frog_bwah_up.png', -** Processing line: ~ (state.tongue_angle - 90)]~ + +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - (state.tongue_angle - 90)] -** Processing line: ~ end~ + def tick +** Processing line: ~ fiddle~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + fiddle +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render +** Processing line: ~ input~ - Inside source: true *** True Line Result - -** Processing line: ~~ + input +** Processing line: ~ calc~ - Inside source: true *** True Line Result - -** Processing line: ~ $game = CleptoFrog.new~ + calc +** Processing line: ~ end~ - Inside source: true *** True Line Result - $game = CleptoFrog.new + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ -- Inside source: true -*** True Line Result - def tick args -** Processing line: ~ if args.state.scene == :game~ +** Processing line: ~ def fiddle~ - Inside source: true *** True Line Result - if args.state.scene == :game -** Processing line: ~ tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360~ + def fiddle +** Processing line: ~ state.gravity = -0.02~ - Inside source: true *** True Line Result - tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360 -** Processing line: ~ end~ + state.gravity = -0.02 +** Processing line: ~ circle.radius = 15~ - Inside source: true *** True Line Result - end -** Processing line: ~ $game.args = args~ + circle.radius = 15 +** Processing line: ~ circle.elasticity = 0.4~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + circle.elasticity = 0.4 +** Processing line: ~ camera.follow_speed = 0.4 * 0.4~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + camera.follow_speed = 0.4 * 0.4 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - def tick_instructions args, text, y = 715 -** Processing line: ~ return if args.state.key_event_occurred~ + def render +** Processing line: ~ render_stage_editor~ - Inside source: true *** True Line Result - return if args.state.key_event_occurred -** Processing line: ~ if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space~ + render_stage_editor +** Processing line: ~ render_debug~ - Inside source: true *** True Line Result - if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space -** Processing line: ~ args.state.key_event_occurred = true~ + render_debug +** Processing line: ~ render_game~ - Inside source: true *** True Line Result - args.state.key_event_occurred = true + render_game ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -62277,10490 +62460,10538 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - args.outputs.debug << [0, y - 50, 1280, 60].solid -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ + def defaults +** Processing line: ~ if state.tick_count == 0~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label -** Processing line: ~ args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label~ + if state.tick_count == 0 +** Processing line: ~ outputs.sounds << "sounds/bg.ogg"~ - Inside source: true *** True Line Result - args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label -** Processing line: ~ end~ + outputs.sounds << "sounds/bg.ogg" +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_platformer/clepto_frog/app/map.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_platformer/clepto_frog/app/map.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ $collisions = [~ +** Processing line: ~ state.storyline ||= [~ - Inside source: true *** True Line Result - $collisions = [ -** Processing line: ~ [326, 463, 64, 64],~ + state.storyline ||= [ +** Processing line: ~ { text: "<- -> to aim, hold space to charge", distance_gate: 0 },~ - Inside source: true *** True Line Result - [326, 463, 64, 64], -** Processing line: ~ [274, 462, 64, 64],~ + { text: "<- -> to aim, hold space to charge", distance_gate: 0 }, +** Processing line: ~ { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },~ - Inside source: true *** True Line Result - [274, 462, 64, 64], -** Processing line: ~ [326, 413, 64, 64],~ + { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 }, +** Processing line: ~ { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },~ - Inside source: true *** True Line Result - [326, 413, 64, 64], -** Processing line: ~ [275, 412, 64, 64],~ + { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 }, +** Processing line: ~ { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 },~ - Inside source: true *** True Line Result - [275, 412, 64, 64], -** Processing line: ~ [124, 651, 64, 64],~ + { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 }, +** Processing line: ~ { text: "jupiter's sure is beautiful...", distance_gate: 4000 },~ - Inside source: true *** True Line Result - [124, 651, 64, 64], -** Processing line: ~ [72, 651, 64, 64],~ + { text: "jupiter's sure is beautiful...", distance_gate: 4000 }, +** Processing line: ~ { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 },~ - Inside source: true *** True Line Result - [72, 651, 64, 64], -** Processing line: ~ [124, 600, 64, 64],~ + { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 }, +** Processing line: ~ { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 },~ - Inside source: true *** True Line Result - [124, 600, 64, 64], -** Processing line: ~ [69, 599, 64, 64],~ + { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 }, +** Processing line: ~ { text: "#todo... look i ran out of time -_-", distance_gate: 9000 },~ - Inside source: true *** True Line Result - [69, 599, 64, 64], -** Processing line: ~ [501, 997, 64, 64],~ + { text: "#todo... look i ran out of time -_-", distance_gate: 9000 }, +** Processing line: ~ { text: "there's never enough time", distance_gate: 9000 },~ - Inside source: true *** True Line Result - [501, 997, 64, 64], -** Processing line: ~ [476, 995, 64, 64],~ + { text: "there's never enough time", distance_gate: 9000 }, +** Processing line: ~ { text: "the game jam was fun though ^_^", distance_gate: 10000 },~ - Inside source: true *** True Line Result - [476, 995, 64, 64], -** Processing line: ~ [3224, 2057, 64, 64],~ + { text: "the game jam was fun though ^_^", distance_gate: 10000 }, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - [3224, 2057, 64, 64], -** Processing line: ~ [3224, 1994, 64, 64],~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - [3224, 1994, 64, 64], -** Processing line: ~ [3225, 1932, 64, 64],~ + +** Processing line: ~ load_level force: args.state.tick_count == 0~ - Inside source: true *** True Line Result - [3225, 1932, 64, 64], -** Processing line: ~ [3225, 1870, 64, 64],~ + load_level force: args.state.tick_count == 0 +** Processing line: ~ state.line_mode ||= :terrain~ - Inside source: true *** True Line Result - [3225, 1870, 64, 64], -** Processing line: ~ [3226, 1806, 64, 64],~ + state.line_mode ||= :terrain +** Processing line: ~~ - Inside source: true *** True Line Result - [3226, 1806, 64, 64], -** Processing line: ~ [3224, 1744, 64, 64],~ + +** Processing line: ~ state.sound_index ||= 1~ - Inside source: true *** True Line Result - [3224, 1744, 64, 64], -** Processing line: ~ [3225, 1689, 64, 64],~ + state.sound_index ||= 1 +** Processing line: ~ circle.potential_lift ||= 0~ - Inside source: true *** True Line Result - [3225, 1689, 64, 64], -** Processing line: ~ [3226, 1660, 64, 64],~ + circle.potential_lift ||= 0 +** Processing line: ~ circle.angle ||= 90~ - Inside source: true *** True Line Result - [3226, 1660, 64, 64], -** Processing line: ~ [3161, 1658, 64, 64],~ + circle.angle ||= 90 +** Processing line: ~ circle.check_point_at ||= -1000~ - Inside source: true *** True Line Result - [3161, 1658, 64, 64], -** Processing line: ~ [3097, 1660, 64, 64],~ + circle.check_point_at ||= -1000 +** Processing line: ~ circle.game_over_at ||= -1000~ - Inside source: true *** True Line Result - [3097, 1660, 64, 64], -** Processing line: ~ [3033, 1658, 64, 64],~ + circle.game_over_at ||= -1000 +** Processing line: ~ circle.x ||= -485~ - Inside source: true *** True Line Result - [3033, 1658, 64, 64], -** Processing line: ~ [2969, 1658, 64, 64],~ + circle.x ||= -485 +** Processing line: ~ circle.y ||= 12226~ - Inside source: true *** True Line Result - [2969, 1658, 64, 64], -** Processing line: ~ [2904, 1658, 64, 64],~ + circle.y ||= 12226 +** Processing line: ~ circle.check_point_x ||= circle.x~ - Inside source: true *** True Line Result - [2904, 1658, 64, 64], -** Processing line: ~ [2839, 1657, 64, 64],~ + circle.check_point_x ||= circle.x +** Processing line: ~ circle.check_point_y ||= circle.y~ - Inside source: true *** True Line Result - [2839, 1657, 64, 64], -** Processing line: ~ [2773, 1657, 64, 64],~ + circle.check_point_y ||= circle.y +** Processing line: ~ circle.dy ||= 0~ - Inside source: true *** True Line Result - [2773, 1657, 64, 64], -** Processing line: ~ [2709, 1658, 64, 64],~ + circle.dy ||= 0 +** Processing line: ~ circle.dx ||= 0~ - Inside source: true *** True Line Result - [2709, 1658, 64, 64], -** Processing line: ~ [2643, 1657, 64, 64],~ + circle.dx ||= 0 +** Processing line: ~ circle.previous_dy ||= 0~ - Inside source: true *** True Line Result - [2643, 1657, 64, 64], -** Processing line: ~ [2577, 1657, 64, 64],~ + circle.previous_dy ||= 0 +** Processing line: ~ circle.previous_dx ||= 0~ - Inside source: true *** True Line Result - [2577, 1657, 64, 64], -** Processing line: ~ [2509, 1658, 64, 64],~ + circle.previous_dx ||= 0 +** Processing line: ~ circle.angle ||= 0~ - Inside source: true *** True Line Result - [2509, 1658, 64, 64], -** Processing line: ~ [2440, 1658, 64, 64],~ + circle.angle ||= 0 +** Processing line: ~ circle.after_images ||= []~ - Inside source: true *** True Line Result - [2440, 1658, 64, 64], -** Processing line: ~ [2371, 1658, 64, 64],~ + circle.after_images ||= [] +** Processing line: ~ circle.terrains_to_monitor ||= {}~ - Inside source: true *** True Line Result - [2371, 1658, 64, 64], -** Processing line: ~ [2301, 1659, 64, 64],~ + circle.terrains_to_monitor ||= {} +** Processing line: ~ circle.impact_history ||= []~ - Inside source: true *** True Line Result - [2301, 1659, 64, 64], -** Processing line: ~ [2230, 1659, 64, 64],~ + circle.impact_history ||= [] +** Processing line: ~~ - Inside source: true *** True Line Result - [2230, 1659, 64, 64], -** Processing line: ~ [2159, 1659, 64, 64],~ + +** Processing line: ~ camera.x ||= 0~ - Inside source: true *** True Line Result - [2159, 1659, 64, 64], -** Processing line: ~ [2092, 1660, 64, 64],~ + camera.x ||= 0 +** Processing line: ~ camera.y ||= 0~ - Inside source: true *** True Line Result - [2092, 1660, 64, 64], -** Processing line: ~ [2025, 1661, 64, 64],~ + camera.y ||= 0 +** Processing line: ~ camera.target_x ||= 0~ - Inside source: true *** True Line Result - [2025, 1661, 64, 64], -** Processing line: ~ [1958, 1660, 64, 64],~ + camera.target_x ||= 0 +** Processing line: ~ camera.target_y ||= 0~ - Inside source: true *** True Line Result - [1958, 1660, 64, 64], -** Processing line: ~ [1888, 1659, 64, 64],~ + camera.target_y ||= 0 +** Processing line: ~ state.snaps ||= { }~ - Inside source: true *** True Line Result - [1888, 1659, 64, 64], -** Processing line: ~ [1817, 1657, 64, 64],~ + state.snaps ||= { } +** Processing line: ~ state.snap_number = 10~ - Inside source: true *** True Line Result - [1817, 1657, 64, 64], -** Processing line: ~ [1745, 1656, 64, 64],~ + state.snap_number = 10 +** Processing line: ~~ - Inside source: true *** True Line Result - [1745, 1656, 64, 64], -** Processing line: ~ [1673, 1658, 64, 64],~ + +** Processing line: ~ args.state.storyline_x ||= -1000~ - Inside source: true *** True Line Result - [1673, 1658, 64, 64], -** Processing line: ~ [1605, 1660, 64, 64],~ + args.state.storyline_x ||= -1000 +** Processing line: ~ args.state.storyline_y ||= -1000~ - Inside source: true *** True Line Result - [1605, 1660, 64, 64], -** Processing line: ~ [1536, 1658, 64, 64],~ + args.state.storyline_y ||= -1000 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1536, 1658, 64, 64], -** Processing line: ~ [1465, 1660, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1465, 1660, 64, 64], -** Processing line: ~ [1386, 1960, 64, 64],~ + +** Processing line: ~ def render_game~ - Inside source: true *** True Line Result - [1386, 1960, 64, 64], -** Processing line: ~ [1384, 1908, 64, 64],~ + def render_game +** Processing line: ~ outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - [1384, 1908, 64, 64], -** Processing line: ~ [1387, 1862, 64, 64],~ + outputs.background_color = [0, 0, 0] +** Processing line: ~ outputs.sprites << [-circle.x + 1100,~ - Inside source: true *** True Line Result - [1387, 1862, 64, 64], -** Processing line: ~ [1326, 1863, 64, 64],~ + outputs.sprites << [-circle.x + 1100, +** Processing line: ~ -circle.y - 100,~ - Inside source: true *** True Line Result - [1326, 1863, 64, 64], -** Processing line: ~ [1302, 1862, 64, 64],~ + -circle.y - 100, +** Processing line: ~ 2416 * 4,~ - Inside source: true *** True Line Result - [1302, 1862, 64, 64], -** Processing line: ~ [1119, 1906, 64, 64],~ + 2416 * 4, +** Processing line: ~ 3574 * 4,~ - Inside source: true *** True Line Result - [1119, 1906, 64, 64], -** Processing line: ~ [1057, 1905, 64, 64],~ + 3574 * 4, +** Processing line: ~ 'sprites/jupiter.png']~ - Inside source: true *** True Line Result - [1057, 1905, 64, 64], -** Processing line: ~ [994, 1905, 64, 64],~ + 'sprites/jupiter.png'] +** Processing line: ~ outputs.sprites << [-circle.x,~ - Inside source: true *** True Line Result - [994, 1905, 64, 64], -** Processing line: ~ [937, 1904, 64, 64],~ + outputs.sprites << [-circle.x, +** Processing line: ~ -circle.y,~ - Inside source: true *** True Line Result - [937, 1904, 64, 64], -** Processing line: ~ [896, 1904, 64, 64],~ + -circle.y, +** Processing line: ~ 2416 * 4,~ - Inside source: true *** True Line Result - [896, 1904, 64, 64], -** Processing line: ~ [1001, 1845, 64, 64],~ + 2416 * 4, +** Processing line: ~ 3574 * 4,~ - Inside source: true *** True Line Result - [1001, 1845, 64, 64], -** Processing line: ~ [1003, 1780, 64, 64],~ + 3574 * 4, +** Processing line: ~ 'sprites/level.png']~ - Inside source: true *** True Line Result - [1003, 1780, 64, 64], -** Processing line: ~ [1003, 1718, 64, 64],~ + 'sprites/level.png'] +** Processing line: ~ outputs.sprites << state.whisp_queue~ - Inside source: true *** True Line Result - [1003, 1718, 64, 64], -** Processing line: ~ [692, 1958, 64, 64],~ + outputs.sprites << state.whisp_queue +** Processing line: ~ render_aiming_retical~ - Inside source: true *** True Line Result - [692, 1958, 64, 64], -** Processing line: ~ [691, 1900, 64, 64],~ + render_aiming_retical +** Processing line: ~ render_circle~ - Inside source: true *** True Line Result - [691, 1900, 64, 64], -** Processing line: ~ [774, 1861, 64, 64],~ + render_circle +** Processing line: ~ render_notification~ - Inside source: true *** True Line Result - [774, 1861, 64, 64], -** Processing line: ~ [712, 1861, 64, 64],~ + render_notification +** Processing line: ~ end~ - Inside source: true *** True Line Result - [712, 1861, 64, 64], -** Processing line: ~ [691, 1863, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [691, 1863, 64, 64], -** Processing line: ~ [325, 2133, 64, 64],~ + +** Processing line: ~ def render_notification~ - Inside source: true *** True Line Result - [325, 2133, 64, 64], -** Processing line: ~ [275, 2134, 64, 64],~ + def render_notification +** Processing line: ~ toast_length = 500~ - Inside source: true *** True Line Result - [275, 2134, 64, 64], -** Processing line: ~ [326, 2082, 64, 64],~ + toast_length = 500 +** Processing line: ~ if circle.game_over_at.elapsed_time < toast_length~ - Inside source: true *** True Line Result - [326, 2082, 64, 64], -** Processing line: ~ [275, 2082, 64, 64],~ + if circle.game_over_at.elapsed_time < toast_length +** Processing line: ~ label_text = "..."~ - Inside source: true *** True Line Result - [275, 2082, 64, 64], -** Processing line: ~ [124, 2321, 64, 64],~ + label_text = "..." +** Processing line: ~ elsif circle.check_point_at.elapsed_time > toast_length~ - Inside source: true *** True Line Result - [124, 2321, 64, 64], -** Processing line: ~ [71, 2320, 64, 64],~ + elsif circle.check_point_at.elapsed_time > toast_length +** Processing line: ~ args.state.current_storyline = nil~ - Inside source: true *** True Line Result - [71, 2320, 64, 64], -** Processing line: ~ [123, 2267, 64, 64],~ + args.state.current_storyline = nil +** Processing line: ~ return~ - Inside source: true *** True Line Result - [123, 2267, 64, 64], -** Processing line: ~ [71, 2268, 64, 64],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - [71, 2268, 64, 64], -** Processing line: ~ [2354, 1859, 64, 64],~ + end +** Processing line: ~ if circle.check_point_at &&~ - Inside source: true *** True Line Result - [2354, 1859, 64, 64], -** Processing line: ~ [2292, 1859, 64, 64],~ + if circle.check_point_at && +** Processing line: ~ circle.check_point_at.elapsed_time == 1 &&~ - Inside source: true *** True Line Result - [2292, 1859, 64, 64], -** Processing line: ~ [2231, 1857, 64, 64],~ + circle.check_point_at.elapsed_time == 1 && +** Processing line: ~ !args.state.current_storyline~ - Inside source: true *** True Line Result - [2231, 1857, 64, 64], -** Processing line: ~ [2198, 1858, 64, 64],~ + !args.state.current_storyline +** Processing line: ~ if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]~ - Inside source: true *** True Line Result - [2198, 1858, 64, 64], -** Processing line: ~ [2353, 1802, 64, 64],~ + if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate] +** Processing line: ~ args.state.current_storyline = args.state.storyline.shift[:text]~ - Inside source: true *** True Line Result - [2353, 1802, 64, 64], -** Processing line: ~ [2296, 1798, 64, 64],~ + args.state.current_storyline = args.state.storyline.shift[:text] +** Processing line: ~ args.state.distance_traveled ||= 0~ - Inside source: true *** True Line Result - [2296, 1798, 64, 64], -** Processing line: ~ [2233, 1797, 64, 64],~ + args.state.distance_traveled ||= 0 +** Processing line: ~ args.state.storyline_x = circle.x~ - Inside source: true *** True Line Result - [2233, 1797, 64, 64], -** Processing line: ~ [2200, 1797, 64, 64],~ + args.state.storyline_x = circle.x +** Processing line: ~ args.state.storyline_y = circle.y~ - Inside source: true *** True Line Result - [2200, 1797, 64, 64], -** Processing line: ~ [2352, 1742, 64, 64],~ + args.state.storyline_y = circle.y +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2352, 1742, 64, 64], -** Processing line: ~ [2288, 1741, 64, 64],~ + end +** Processing line: ~ return unless args.state.current_storyline~ - Inside source: true *** True Line Result - [2288, 1741, 64, 64], -** Processing line: ~ [2230, 1743, 64, 64],~ + return unless args.state.current_storyline +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2230, 1743, 64, 64], -** Processing line: ~ [2196, 1743, 64, 64],~ + end +** Processing line: ~ label_text = args.state.current_storyline~ - Inside source: true *** True Line Result - [2196, 1743, 64, 64], -** Processing line: ~ [1736, 460, 64, 64],~ + label_text = args.state.current_storyline +** Processing line: ~ return unless label_text~ - Inside source: true *** True Line Result - [1736, 460, 64, 64], -** Processing line: ~ [1735, 400, 64, 64],~ + return unless label_text +** Processing line: ~ x = circle.x + camera.x~ - Inside source: true *** True Line Result - [1735, 400, 64, 64], -** Processing line: ~ [1736, 339, 64, 64],~ + x = circle.x + camera.x +** Processing line: ~ y = circle.y + camera.y - 40~ - Inside source: true *** True Line Result - [1736, 339, 64, 64], -** Processing line: ~ [1736, 275, 64, 64],~ + y = circle.y + camera.y - 40 +** Processing line: ~ w = 900~ - Inside source: true *** True Line Result - [1736, 275, 64, 64], -** Processing line: ~ [1738, 210, 64, 64],~ + w = 900 +** Processing line: ~ h = 30~ - Inside source: true *** True Line Result - [1738, 210, 64, 64], -** Processing line: ~ [1735, 145, 64, 64],~ + h = 30 +** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid~ - Inside source: true *** True Line Result - [1735, 145, 64, 64], -** Processing line: ~ [1735, 87, 64, 64],~ + outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid +** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border~ - Inside source: true *** True Line Result - [1735, 87, 64, 64], -** Processing line: ~ [1736, 51, 64, 64],~ + outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border +** Processing line: ~ outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]~ - Inside source: true *** True Line Result - [1736, 51, 64, 64], -** Processing line: ~ [539, 289, 64, 64],~ + outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [539, 289, 64, 64], -** Processing line: ~ [541, 228, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [541, 228, 64, 64], -** Processing line: ~ [626, 191, 64, 64],~ + +** Processing line: ~ def render_aiming_retical~ - Inside source: true *** True Line Result - [626, 191, 64, 64], -** Processing line: ~ [572, 192, 64, 64],~ + def render_aiming_retical +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,~ - Inside source: true *** True Line Result - [572, 192, 64, 64], -** Processing line: ~ [540, 193, 64, 64],~ + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5, +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,~ - Inside source: true *** True Line Result - [540, 193, 64, 64], -** Processing line: ~ [965, 233, 64, 64],~ + state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5, +** Processing line: ~ 10, 10, 'sprites/circle-orange.png']~ - Inside source: true *** True Line Result - [965, 233, 64, 64], -** Processing line: ~ [904, 234, 64, 64],~ + 10, 10, 'sprites/circle-orange.png'] +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ - Inside source: true *** True Line Result - [904, 234, 64, 64], -** Processing line: ~ [840, 234, 64, 64],~ + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ - Inside source: true *** True Line Result - [840, 234, 64, 64], -** Processing line: ~ [779, 234, 64, 64],~ + state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, +** Processing line: ~ 10, 10, 'sprites/circle-orange.png', 0, 128]~ - Inside source: true *** True Line Result - [779, 234, 64, 64], -** Processing line: ~ [745, 236, 64, 64],~ + 10, 10, 'sprites/circle-orange.png', 0, 128] +** Processing line: ~ if rand > 0.9~ - Inside source: true *** True Line Result - [745, 236, 64, 64], -** Processing line: ~ [851, 169, 64, 64],~ + if rand > 0.9 +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ - Inside source: true *** True Line Result - [851, 169, 64, 64], -** Processing line: ~ [849, 108, 64, 64],~ + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ - Inside source: true *** True Line Result - [849, 108, 64, 64], -** Processing line: ~ [852, 50, 64, 64],~ + state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, +** Processing line: ~ 10, 10, 'sprites/circle-white.png', 0, 128]~ - Inside source: true *** True Line Result - [852, 50, 64, 64], -** Processing line: ~ [1237, 289, 64, 64],~ + 10, 10, 'sprites/circle-white.png', 0, 128] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1237, 289, 64, 64], -** Processing line: ~ [1236, 228, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1236, 228, 64, 64], -** Processing line: ~ [1238, 197, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1238, 197, 64, 64], -** Processing line: ~ [1181, 192, 64, 64],~ + +** Processing line: ~ def render_circle~ - Inside source: true *** True Line Result - [1181, 192, 64, 64], -** Processing line: ~ [1152, 192, 64, 64],~ + def render_circle +** Processing line: ~ outputs.sprites << circle.after_images.map do |ai|~ - Inside source: true *** True Line Result - [1152, 192, 64, 64], -** Processing line: ~ [1443, 605, 64, 64],~ + outputs.sprites << circle.after_images.map do |ai| +** Processing line: ~ ai.merge(x: ai.x + state.camera.x - circle.radius,~ - Inside source: true *** True Line Result - [1443, 605, 64, 64], -** Processing line: ~ [1419, 606, 64, 64],~ + ai.merge(x: ai.x + state.camera.x - circle.radius, +** Processing line: ~ y: ai.y + state.camera.y - circle.radius,~ - Inside source: true *** True Line Result - [1419, 606, 64, 64], -** Processing line: ~ [1069, 925, 64, 64],~ + y: ai.y + state.camera.y - circle.radius, +** Processing line: ~ w: circle.radius * 2,~ - Inside source: true *** True Line Result - [1069, 925, 64, 64], -** Processing line: ~ [1068, 902, 64, 64],~ + w: circle.radius * 2, +** Processing line: ~ h: circle.radius * 2,~ - Inside source: true *** True Line Result - [1068, 902, 64, 64], -** Processing line: ~ [1024, 927, 64, 64],~ + h: circle.radius * 2, +** Processing line: ~ path: 'sprites/circle-white.png')~ - Inside source: true *** True Line Result - [1024, 927, 64, 64], -** Processing line: ~ [1017, 897, 64, 64],~ + path: 'sprites/circle-white.png') +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1017, 897, 64, 64], -** Processing line: ~ [963, 926, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [963, 926, 64, 64], -** Processing line: ~ [958, 898, 64, 64],~ + +** Processing line: ~ outputs.sprites << [(circle.x - circle.radius) + state.camera.x,~ - Inside source: true *** True Line Result - [958, 898, 64, 64], -** Processing line: ~ [911, 928, 64, 64],~ + outputs.sprites << [(circle.x - circle.radius) + state.camera.x, +** Processing line: ~ (circle.y - circle.radius) + state.camera.y,~ - Inside source: true *** True Line Result - [911, 928, 64, 64], -** Processing line: ~ [911, 896, 64, 64],~ + (circle.y - circle.radius) + state.camera.y, +** Processing line: ~ circle.radius * 2,~ - Inside source: true *** True Line Result - [911, 896, 64, 64], -** Processing line: ~ [2132, 803, 64, 64],~ + circle.radius * 2, +** Processing line: ~ circle.radius * 2,~ - Inside source: true *** True Line Result - [2132, 803, 64, 64], -** Processing line: ~ [2081, 803, 64, 64],~ + circle.radius * 2, +** Processing line: ~ 'sprites/probe.png']~ - Inside source: true *** True Line Result - [2081, 803, 64, 64], -** Processing line: ~ [2131, 752, 64, 64],~ + 'sprites/probe.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2131, 752, 64, 64], -** Processing line: ~ [2077, 751, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2077, 751, 64, 64], -** Processing line: ~ [2615, 649, 64, 64],~ + +** Processing line: ~ def render_debug~ - Inside source: true *** True Line Result - [2615, 649, 64, 64], -** Processing line: ~ [2564, 651, 64, 64],~ + def render_debug +** Processing line: ~ return unless state.debug_mode~ - Inside source: true *** True Line Result - [2564, 651, 64, 64], -** Processing line: ~ [2533, 650, 64, 64],~ + return unless state.debug_mode +** Processing line: ~~ - Inside source: true *** True Line Result - [2533, 650, 64, 64], -** Processing line: ~ [2027, 156, 64, 64],~ + +** Processing line: ~ outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]~ - Inside source: true *** True Line Result - [2027, 156, 64, 64], -** Processing line: ~ [1968, 155, 64, 64],~ + outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0] +** Processing line: ~ outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [1968, 155, 64, 64], -** Processing line: ~ [1907, 153, 64, 64],~ + outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255] +** Processing line: ~~ - Inside source: true *** True Line Result - [1907, 153, 64, 64], -** Processing line: ~ [1873, 155, 64, 64],~ + +** Processing line: ~ args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|~ - Inside source: true *** True Line Result - [1873, 155, 64, 64], -** Processing line: ~ [2025, 95, 64, 64],~ + args.outputs.lines << trajectory(circle).line.to_hash.tap do |h| +** Processing line: ~ h[:x] += state.camera.x~ - Inside source: true *** True Line Result - [2025, 95, 64, 64], -** Processing line: ~ [1953, 98, 64, 64],~ + h[:x] += state.camera.x +** Processing line: ~ h[:y] += state.camera.y~ - Inside source: true *** True Line Result - [1953, 98, 64, 64], -** Processing line: ~ [1894, 100, 64, 64],~ + h[:y] += state.camera.y +** Processing line: ~ h[:x2] += state.camera.x~ - Inside source: true *** True Line Result - [1894, 100, 64, 64], -** Processing line: ~ [1870, 100, 64, 64],~ + h[:x2] += state.camera.x +** Processing line: ~ h[:y2] += state.camera.y~ - Inside source: true *** True Line Result - [1870, 100, 64, 64], -** Processing line: ~ [2029, 45, 64, 64],~ + h[:y2] += state.camera.y +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2029, 45, 64, 64], -** Processing line: ~ [1971, 48, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1971, 48, 64, 64], -** Processing line: ~ [1915, 47, 64, 64],~ + +** Processing line: ~ outputs.primitives << state.terrain.find_all do |t|~ - Inside source: true *** True Line Result - [1915, 47, 64, 64], -** Processing line: ~ [1873, 47, 64, 64],~ + outputs.primitives << state.terrain.find_all do |t| +** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ - Inside source: true *** True Line Result - [1873, 47, 64, 64], -** Processing line: ~ [3956, 288, 64, 64],~ + circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) +** Processing line: ~ end.map do |t|~ - Inside source: true *** True Line Result - [3956, 288, 64, 64], -** Processing line: ~ [3954, 234, 64, 64],~ + end.map do |t| +** Processing line: ~ [~ - Inside source: true *** True Line Result - [3954, 234, 64, 64], -** Processing line: ~ [4042, 190, 64, 64],~ + [ +** Processing line: ~ t.line.associate(r: 0, g: 255, b: 0) do |h|~ - Inside source: true *** True Line Result - [4042, 190, 64, 64], -** Processing line: ~ [3990, 190, 64, 64],~ + t.line.associate(r: 0, g: 255, b: 0) do |h| +** Processing line: ~ h.x += state.camera.x~ - Inside source: true *** True Line Result - [3990, 190, 64, 64], -** Processing line: ~ [3958, 195, 64, 64],~ + h.x += state.camera.x +** Processing line: ~ h.y += state.camera.y~ - Inside source: true *** True Line Result - [3958, 195, 64, 64], -** Processing line: ~ [3422, 709, 64, 64],~ + h.y += state.camera.y +** Processing line: ~ h.x2 += state.camera.x~ - Inside source: true *** True Line Result - [3422, 709, 64, 64], -** Processing line: ~ [3425, 686, 64, 64],~ + h.x2 += state.camera.x +** Processing line: ~ h.y2 += state.camera.y~ - Inside source: true *** True Line Result - [3425, 686, 64, 64], -** Processing line: ~ [3368, 709, 64, 64],~ + h.y2 += state.camera.y +** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ - Inside source: true *** True Line Result - [3368, 709, 64, 64], -** Processing line: ~ [3364, 683, 64, 64],~ + if circle.rect.intersect_rect? t[:rect] +** Processing line: ~ h[:r] = 255~ - Inside source: true *** True Line Result - [3364, 683, 64, 64], -** Processing line: ~ [3312, 711, 64, 64],~ + h[:r] = 255 +** Processing line: ~ h[:g] = 0~ - Inside source: true *** True Line Result - [3312, 711, 64, 64], -** Processing line: ~ [3307, 684, 64, 64],~ + h[:g] = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3307, 684, 64, 64], -** Processing line: ~ [3266, 712, 64, 64],~ + end +** Processing line: ~ h~ - Inside source: true *** True Line Result - [3266, 712, 64, 64], -** Processing line: ~ [3269, 681, 64, 64],~ + h +** Processing line: ~ end,~ - Inside source: true *** True Line Result - [3269, 681, 64, 64], -** Processing line: ~ [4384, 236, 64, 64],~ + end, +** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ - Inside source: true *** True Line Result - [4384, 236, 64, 64], -** Processing line: ~ [4320, 234, 64, 64],~ + t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| +** Processing line: ~ h.x += state.camera.x~ - Inside source: true *** True Line Result - [4320, 234, 64, 64], -** Processing line: ~ [4257, 235, 64, 64],~ + h.x += state.camera.x +** Processing line: ~ h.y += state.camera.y~ - Inside source: true *** True Line Result - [4257, 235, 64, 64], -** Processing line: ~ [4192, 234, 64, 64],~ + h.y += state.camera.y +** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ - Inside source: true *** True Line Result - [4192, 234, 64, 64], -** Processing line: ~ [4162, 234, 64, 64],~ + h.b = 255 if line_near_rect? circle.rect, t +** Processing line: ~ h~ - Inside source: true *** True Line Result - [4162, 234, 64, 64], -** Processing line: ~ [4269, 171, 64, 64],~ + h +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4269, 171, 64, 64], -** Processing line: ~ [4267, 111, 64, 64],~ + end +** Processing line: ~ ]~ - Inside source: true *** True Line Result - [4267, 111, 64, 64], -** Processing line: ~ [4266, 52, 64, 64],~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4266, 52, 64, 64], -** Processing line: ~ [4580, 458, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4580, 458, 64, 64], -** Processing line: ~ [4582, 396, 64, 64],~ + +** Processing line: ~ outputs.primitives << state.lava.find_all do |t|~ - Inside source: true *** True Line Result - [4582, 396, 64, 64], -** Processing line: ~ [4582, 335, 64, 64],~ + outputs.primitives << state.lava.find_all do |t| +** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ - Inside source: true *** True Line Result - [4582, 335, 64, 64], -** Processing line: ~ [4581, 275, 64, 64],~ + circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) +** Processing line: ~ end.map do |t|~ - Inside source: true *** True Line Result - [4581, 275, 64, 64], -** Processing line: ~ [4581, 215, 64, 64],~ + end.map do |t| +** Processing line: ~ [~ - Inside source: true *** True Line Result - [4581, 215, 64, 64], -** Processing line: ~ [4581, 152, 64, 64],~ + [ +** Processing line: ~ t.line.associate(r: 0, g: 0, b: 255) do |h|~ - Inside source: true *** True Line Result - [4581, 152, 64, 64], -** Processing line: ~ [4582, 89, 64, 64],~ + t.line.associate(r: 0, g: 0, b: 255) do |h| +** Processing line: ~ h.x += state.camera.x~ - Inside source: true *** True Line Result - [4582, 89, 64, 64], -** Processing line: ~ [4583, 51, 64, 64],~ + h.x += state.camera.x +** Processing line: ~ h.y += state.camera.y~ - Inside source: true *** True Line Result - [4583, 51, 64, 64], -** Processing line: ~ [4810, 289, 64, 64],~ + h.y += state.camera.y +** Processing line: ~ h.x2 += state.camera.x~ - Inside source: true *** True Line Result - [4810, 289, 64, 64], -** Processing line: ~ [4810, 227, 64, 64],~ + h.x2 += state.camera.x +** Processing line: ~ h.y2 += state.camera.y~ - Inside source: true *** True Line Result - [4810, 227, 64, 64], -** Processing line: ~ [4895, 189, 64, 64],~ + h.y2 += state.camera.y +** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ - Inside source: true *** True Line Result - [4895, 189, 64, 64], -** Processing line: ~ [4844, 191, 64, 64],~ + if circle.rect.intersect_rect? t[:rect] +** Processing line: ~ h[:r] = 255~ - Inside source: true *** True Line Result - [4844, 191, 64, 64], -** Processing line: ~ [4809, 191, 64, 64],~ + h[:r] = 255 +** Processing line: ~ h[:b] = 0~ - Inside source: true *** True Line Result - [4809, 191, 64, 64], -** Processing line: ~ [5235, 233, 64, 64],~ + h[:b] = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5235, 233, 64, 64], -** Processing line: ~ [5176, 232, 64, 64],~ + end +** Processing line: ~ h~ - Inside source: true *** True Line Result - [5176, 232, 64, 64], -** Processing line: ~ [5118, 230, 64, 64],~ + h +** Processing line: ~ end,~ - Inside source: true *** True Line Result - [5118, 230, 64, 64], -** Processing line: ~ [5060, 232, 64, 64],~ + end, +** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ - Inside source: true *** True Line Result - [5060, 232, 64, 64], -** Processing line: ~ [5015, 237, 64, 64],~ + t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| +** Processing line: ~ h.x += state.camera.x~ - Inside source: true *** True Line Result - [5015, 237, 64, 64], -** Processing line: ~ [5123, 171, 64, 64],~ + h.x += state.camera.x +** Processing line: ~ h.y += state.camera.y~ - Inside source: true *** True Line Result - [5123, 171, 64, 64], -** Processing line: ~ [5123, 114, 64, 64],~ + h.y += state.camera.y +** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ - Inside source: true *** True Line Result - [5123, 114, 64, 64], -** Processing line: ~ [5121, 51, 64, 64],~ + h.b = 255 if line_near_rect? circle.rect, t +** Processing line: ~ h~ - Inside source: true *** True Line Result - [5121, 51, 64, 64], -** Processing line: ~ [5523, 461, 64, 64],~ + h +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5523, 461, 64, 64], -** Processing line: ~ [5123, 42, 64, 64],~ + end +** Processing line: ~ ]~ - Inside source: true *** True Line Result - [5123, 42, 64, 64], -** Processing line: ~ [5525, 401, 64, 64],~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5525, 401, 64, 64], -** Processing line: ~ [5525, 340, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5525, 340, 64, 64], -** Processing line: ~ [5526, 273, 64, 64],~ + +** Processing line: ~ if state.god_mode~ - Inside source: true *** True Line Result - [5526, 273, 64, 64], -** Processing line: ~ [5527, 211, 64, 64],~ + if state.god_mode +** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ - Inside source: true *** True Line Result - [5527, 211, 64, 64], -** Processing line: ~ [5525, 150, 64, 64],~ + border = circle.rect.merge(x: circle.rect.x + state.camera.x, +** Processing line: ~ y: circle.rect.y + state.camera.y,~ - Inside source: true *** True Line Result - [5525, 150, 64, 64], -** Processing line: ~ [5527, 84, 64, 64],~ + y: circle.rect.y + state.camera.y, +** Processing line: ~ g: 255)~ - Inside source: true *** True Line Result - [5527, 84, 64, 64], -** Processing line: ~ [5524, 44, 64, 64],~ + g: 255) +** Processing line: ~ else~ - Inside source: true *** True Line Result - [5524, 44, 64, 64], -** Processing line: ~ [5861, 288, 64, 64],~ + else +** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ - Inside source: true *** True Line Result - [5861, 288, 64, 64], -** Processing line: ~ [5861, 229, 64, 64],~ + border = circle.rect.merge(x: circle.rect.x + state.camera.x, +** Processing line: ~ y: circle.rect.y + state.camera.y,~ - Inside source: true *** True Line Result - [5861, 229, 64, 64], -** Processing line: ~ [5945, 193, 64, 64],~ + y: circle.rect.y + state.camera.y, +** Processing line: ~ b: 255)~ - Inside source: true *** True Line Result - [5945, 193, 64, 64], -** Processing line: ~ [5904, 193, 64, 64],~ + b: 255) +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5904, 193, 64, 64], -** Processing line: ~ [5856, 194, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5856, 194, 64, 64], -** Processing line: ~ [6542, 234, 64, 64],~ + +** Processing line: ~ outputs.borders << border~ - Inside source: true *** True Line Result - [6542, 234, 64, 64], -** Processing line: ~ [6478, 235, 64, 64],~ + outputs.borders << border +** Processing line: ~~ - Inside source: true *** True Line Result - [6478, 235, 64, 64], -** Processing line: ~ [6413, 238, 64, 64],~ + +** Processing line: ~ overlapping ||= {}~ - Inside source: true *** True Line Result - [6413, 238, 64, 64], -** Processing line: ~ [6348, 235, 64, 64],~ + overlapping ||= {} +** Processing line: ~~ - Inside source: true *** True Line Result - [6348, 235, 64, 64], -** Processing line: ~ [6285, 236, 64, 64],~ + +** Processing line: ~ circle.impact_history.each do |h|~ - Inside source: true *** True Line Result - [6285, 236, 64, 64], -** Processing line: ~ [6222, 235, 64, 64],~ + circle.impact_history.each do |h| +** Processing line: ~ label_mod = 300~ - Inside source: true *** True Line Result - [6222, 235, 64, 64], -** Processing line: ~ [6160, 235, 64, 64],~ + label_mod = 300 +** Processing line: ~ x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x~ - Inside source: true *** True Line Result - [6160, 235, 64, 64], -** Processing line: ~ [6097, 236, 64, 64],~ + x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x +** Processing line: ~ y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y~ - Inside source: true *** True Line Result - [6097, 236, 64, 64], -** Processing line: ~ [6069, 237, 64, 64],~ + y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y +** Processing line: ~ 10.times do~ - Inside source: true *** True Line Result - [6069, 237, 64, 64], -** Processing line: ~ [6321, 174, 64, 64],~ + 10.times do +** Processing line: ~ if overlapping[x] && overlapping[x][y]~ - Inside source: true *** True Line Result - [6321, 174, 64, 64], -** Processing line: ~ [6318, 111, 64, 64],~ + if overlapping[x] && overlapping[x][y] +** Processing line: ~ y -= 52~ - Inside source: true *** True Line Result - [6318, 111, 64, 64], -** Processing line: ~ [6320, 49, 64, 64],~ + y -= 52 +** Processing line: ~ else~ - Inside source: true *** True Line Result - [6320, 49, 64, 64], -** Processing line: ~ [6753, 291, 64, 64],~ + else +** Processing line: ~ break~ - Inside source: true *** True Line Result - [6753, 291, 64, 64], -** Processing line: ~ [6752, 227, 64, 64],~ + break +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6752, 227, 64, 64], -** Processing line: ~ [6753, 192, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6753, 192, 64, 64], -** Processing line: ~ [6692, 191, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6692, 191, 64, 64], -** Processing line: ~ [6668, 193, 64, 64],~ + +** Processing line: ~ overlapping[x] ||= {}~ - Inside source: true *** True Line Result - [6668, 193, 64, 64], -** Processing line: ~ [6336, 604, 64, 64],~ + overlapping[x] ||= {} +** Processing line: ~ overlapping[x][y] ||= true~ - Inside source: true *** True Line Result - [6336, 604, 64, 64], -** Processing line: ~ [6309, 603, 64, 64],~ + overlapping[x][y] ||= true +** Processing line: ~ outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid~ - Inside source: true *** True Line Result - [6309, 603, 64, 64], -** Processing line: ~ [7264, 461, 64, 64],~ + outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid +** Processing line: ~ outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7264, 461, 64, 64], -** Processing line: ~ [7264, 395, 64, 64],~ + outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7264, 395, 64, 64], -** Processing line: ~ [7264, 333, 64, 64],~ + outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7264, 333, 64, 64], -** Processing line: ~ [7264, 270, 64, 64],~ + outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255] +** Processing line: ~~ - Inside source: true *** True Line Result - [7264, 270, 64, 64], -** Processing line: ~ [7265, 207, 64, 64],~ + +** Processing line: ~ outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7265, 207, 64, 64], -** Processing line: ~ [7266, 138, 64, 64],~ + outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7266, 138, 64, 64], -** Processing line: ~ [7264, 78, 64, 64],~ + outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7264, 78, 64, 64], -** Processing line: ~ [7266, 48, 64, 64],~ + outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255] +** Processing line: ~~ - Inside source: true *** True Line Result - [7266, 48, 64, 64], -** Processing line: ~ [7582, 149, 64, 64],~ + +** Processing line: ~ outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7582, 149, 64, 64], -** Processing line: ~ [7524, 147, 64, 64],~ + outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7524, 147, 64, 64], -** Processing line: ~ [7461, 146, 64, 64],~ + outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7461, 146, 64, 64], -** Processing line: ~ [7425, 148, 64, 64],~ + outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7425, 148, 64, 64], -** Processing line: ~ [7580, 86, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7580, 86, 64, 64], -** Processing line: ~ [7582, 41, 64, 64],~ + +** Processing line: ~ if circle.floor~ - Inside source: true *** True Line Result - [7582, 41, 64, 64], -** Processing line: ~ [7519, 41, 64, 64],~ + if circle.floor +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]~ - Inside source: true *** True Line Result - [7519, 41, 64, 64], -** Processing line: ~ [7460, 40, 64, 64],~ + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0] +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7460, 40, 64, 64], -** Processing line: ~ [7427, 96, 64, 64],~ + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0]~ - Inside source: true *** True Line Result - [7427, 96, 64, 64], -** Processing line: ~ [7427, 41, 64, 64],~ + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0] +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [7427, 41, 64, 64], -** Processing line: ~ [8060, 288, 64, 64],~ + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]~ - Inside source: true *** True Line Result - [8060, 288, 64, 64], -** Processing line: ~ [8059, 226, 64, 64],~ + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0] +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]~ - Inside source: true *** True Line Result - [8059, 226, 64, 64], -** Processing line: ~ [8145, 194, 64, 64],~ + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8145, 194, 64, 64], -** Processing line: ~ [8081, 194, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8081, 194, 64, 64], -** Processing line: ~ [8058, 195, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8058, 195, 64, 64], -** Processing line: ~ [8485, 234, 64, 64],~ + +** Processing line: ~ def render_stage_editor~ - Inside source: true *** True Line Result - [8485, 234, 64, 64], -** Processing line: ~ [8422, 235, 64, 64],~ + def render_stage_editor +** Processing line: ~ return unless state.god_mode~ - Inside source: true *** True Line Result - [8422, 235, 64, 64], -** Processing line: ~ [8360, 235, 64, 64],~ + return unless state.god_mode +** Processing line: ~ return unless state.point_one~ - Inside source: true *** True Line Result - [8360, 235, 64, 64], -** Processing line: ~ [8296, 235, 64, 64],~ + return unless state.point_one +** Processing line: ~ args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]~ - Inside source: true *** True Line Result - [8296, 235, 64, 64], -** Processing line: ~ [8266, 237, 64, 64],~ + args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8266, 237, 64, 64], -** Processing line: ~ [8371, 173, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8371, 173, 64, 64], -** Processing line: ~ [8370, 117, 64, 64],~ + +** Processing line: ~ def trajectory body~ - Inside source: true *** True Line Result - [8370, 117, 64, 64], -** Processing line: ~ [8372, 59, 64, 64],~ + def trajectory body +** Processing line: ~ [body.x + body.dx,~ - Inside source: true *** True Line Result - [8372, 59, 64, 64], -** Processing line: ~ [8372, 51, 64, 64],~ + [body.x + body.dx, +** Processing line: ~ body.y + body.dy,~ - Inside source: true *** True Line Result - [8372, 51, 64, 64], -** Processing line: ~ [9147, 192, 64, 64],~ + body.y + body.dy, +** Processing line: ~ body.x + body.dx * 1000,~ - Inside source: true *** True Line Result - [9147, 192, 64, 64], -** Processing line: ~ [9063, 287, 64, 64],~ + body.x + body.dx * 1000, +** Processing line: ~ body.y + body.dy * 1000,~ - Inside source: true *** True Line Result - [9063, 287, 64, 64], -** Processing line: ~ [9064, 225, 64, 64],~ + body.y + body.dy * 1000, +** Processing line: ~ 0, 255, 255]~ - Inside source: true *** True Line Result - [9064, 225, 64, 64], -** Processing line: ~ [9085, 193, 64, 64],~ + 0, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9085, 193, 64, 64], -** Processing line: ~ [9063, 194, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [9063, 194, 64, 64], -** Processing line: ~ [9492, 234, 64, 64],~ + +** Processing line: ~ def lengthen_line line, num~ - Inside source: true *** True Line Result - [9492, 234, 64, 64], -** Processing line: ~ [9428, 234, 64, 64],~ + def lengthen_line line, num +** Processing line: ~ line = normalize_line(line)~ - Inside source: true *** True Line Result - [9428, 234, 64, 64], -** Processing line: ~ [9365, 235, 64, 64],~ + line = normalize_line(line) +** Processing line: ~ slope = geometry.line_slope(line, replace_infinity: 10).abs~ - Inside source: true *** True Line Result - [9365, 235, 64, 64], -** Processing line: ~ [9302, 235, 64, 64],~ + slope = geometry.line_slope(line, replace_infinity: 10).abs +** Processing line: ~ if slope < 2~ - Inside source: true *** True Line Result - [9302, 235, 64, 64], -** Processing line: ~ [9270, 237, 64, 64],~ + if slope < 2 +** Processing line: ~ [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash~ - Inside source: true *** True Line Result - [9270, 237, 64, 64], -** Processing line: ~ [9374, 172, 64, 64],~ + [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash +** Processing line: ~ else~ - Inside source: true *** True Line Result - [9374, 172, 64, 64], -** Processing line: ~ [9376, 109, 64, 64],~ + else +** Processing line: ~ [line.x, line.y, line.x2, line.y2].line.to_hash~ - Inside source: true *** True Line Result - [9376, 109, 64, 64], -** Processing line: ~ [9377, 48, 64, 64],~ + [line.x, line.y, line.x2, line.y2].line.to_hash +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9377, 48, 64, 64], -** Processing line: ~ [9545, 1060, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9545, 1060, 64, 64], -** Processing line: ~ [9482, 1062, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [9482, 1062, 64, 64], -** Processing line: ~ [9423, 1062, 64, 64],~ + +** Processing line: ~ def normalize_line line~ - Inside source: true *** True Line Result - [9423, 1062, 64, 64], -** Processing line: ~ [9387, 1062, 64, 64],~ + def normalize_line line +** Processing line: ~ if line.x > line.x2~ - Inside source: true *** True Line Result - [9387, 1062, 64, 64], -** Processing line: ~ [9541, 999, 64, 64],~ + if line.x > line.x2 +** Processing line: ~ x = line.x2~ - Inside source: true *** True Line Result - [9541, 999, 64, 64], -** Processing line: ~ [9542, 953, 64, 64],~ + x = line.x2 +** Processing line: ~ y = line.y2~ - Inside source: true *** True Line Result - [9542, 953, 64, 64], -** Processing line: ~ [9478, 953, 64, 64],~ + y = line.y2 +** Processing line: ~ x2 = line.x~ - Inside source: true *** True Line Result - [9478, 953, 64, 64], -** Processing line: ~ [9388, 999, 64, 64],~ + x2 = line.x +** Processing line: ~ y2 = line.y~ - Inside source: true *** True Line Result - [9388, 999, 64, 64], -** Processing line: ~ [9414, 953, 64, 64],~ + y2 = line.y +** Processing line: ~ else~ - Inside source: true *** True Line Result - [9414, 953, 64, 64], -** Processing line: ~ [9389, 953, 64, 64],~ + else +** Processing line: ~ x = line.x~ - Inside source: true *** True Line Result - [9389, 953, 64, 64], -** Processing line: ~ [9294, 1194, 64, 64],~ + x = line.x +** Processing line: ~ y = line.y~ - Inside source: true *** True Line Result - [9294, 1194, 64, 64], -** Processing line: ~ [9245, 1195, 64, 64],~ + y = line.y +** Processing line: ~ x2 = line.x2~ - Inside source: true *** True Line Result - [9245, 1195, 64, 64], -** Processing line: ~ [9297, 1143, 64, 64],~ + x2 = line.x2 +** Processing line: ~ y2 = line.y2~ - Inside source: true *** True Line Result - [9297, 1143, 64, 64], -** Processing line: ~ [9245, 1144, 64, 64],~ + y2 = line.y2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9245, 1144, 64, 64], -** Processing line: ~ [5575, 1781, 64, 64],~ + end +** Processing line: ~ [x, y, x2, y2]~ - Inside source: true *** True Line Result - [5575, 1781, 64, 64], -** Processing line: ~ [5574, 1753, 64, 64],~ + [x, y, x2, y2] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5574, 1753, 64, 64], -** Processing line: ~ [5522, 1782, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5522, 1782, 64, 64], -** Processing line: ~ [5518, 1753, 64, 64],~ + +** Processing line: ~ def rect_for_line line~ - Inside source: true *** True Line Result - [5518, 1753, 64, 64], -** Processing line: ~ [5472, 1783, 64, 64],~ + def rect_for_line line +** Processing line: ~ if line.x > line.x2~ - Inside source: true *** True Line Result - [5472, 1783, 64, 64], -** Processing line: ~ [5471, 1751, 64, 64],~ + if line.x > line.x2 +** Processing line: ~ x = line.x2~ - Inside source: true *** True Line Result - [5471, 1751, 64, 64], -** Processing line: ~ [5419, 1781, 64, 64],~ + x = line.x2 +** Processing line: ~ y = line.y2~ - Inside source: true *** True Line Result - [5419, 1781, 64, 64], -** Processing line: ~ [5421, 1749, 64, 64],~ + y = line.y2 +** Processing line: ~ x2 = line.x~ - Inside source: true *** True Line Result - [5421, 1749, 64, 64], -** Processing line: ~ [500, 3207, 64, 64],~ + x2 = line.x +** Processing line: ~ y2 = line.y~ - Inside source: true *** True Line Result - [500, 3207, 64, 64], -** Processing line: ~ [477, 3205, 64, 64],~ + y2 = line.y +** Processing line: ~ else~ - Inside source: true *** True Line Result - [477, 3205, 64, 64], -** Processing line: ~ [1282, 3214, 64, 64],~ + else +** Processing line: ~ x = line.x~ - Inside source: true *** True Line Result - [1282, 3214, 64, 64], -** Processing line: ~ [1221, 3214, 64, 64],~ + x = line.x +** Processing line: ~ y = line.y~ - Inside source: true *** True Line Result - [1221, 3214, 64, 64], -** Processing line: ~ [1188, 3215, 64, 64],~ + y = line.y +** Processing line: ~ x2 = line.x2~ - Inside source: true *** True Line Result - [1188, 3215, 64, 64], -** Processing line: ~ [1345, 3103, 64, 64],~ + x2 = line.x2 +** Processing line: ~ y2 = line.y2~ - Inside source: true *** True Line Result - [1345, 3103, 64, 64], -** Processing line: ~ [1288, 3103, 64, 64],~ + y2 = line.y2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1288, 3103, 64, 64], -** Processing line: ~ [1231, 3104, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1231, 3104, 64, 64], -** Processing line: ~ [1190, 3153, 64, 64],~ + +** Processing line: ~ w = x2 - x~ - Inside source: true *** True Line Result - [1190, 3153, 64, 64], -** Processing line: ~ [1189, 3105, 64, 64],~ + w = x2 - x +** Processing line: ~ h = y2 - y~ - Inside source: true *** True Line Result - [1189, 3105, 64, 64], -** Processing line: ~ [2255, 3508, 64, 64],~ + h = y2 - y +** Processing line: ~~ - Inside source: true *** True Line Result - [2255, 3508, 64, 64], -** Processing line: ~ [2206, 3510, 64, 64],~ + +** Processing line: ~ if h < 0~ - Inside source: true *** True Line Result - [2206, 3510, 64, 64], -** Processing line: ~ [2254, 3458, 64, 64],~ + if h < 0 +** Processing line: ~ y += h~ - Inside source: true *** True Line Result - [2254, 3458, 64, 64], -** Processing line: ~ [2202, 3458, 64, 64],~ + y += h +** Processing line: ~ h = h.abs~ - Inside source: true *** True Line Result - [2202, 3458, 64, 64], -** Processing line: ~ [2754, 2930, 64, 64],~ + h = h.abs +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2754, 2930, 64, 64], -** Processing line: ~ [2726, 2932, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2726, 2932, 64, 64], -** Processing line: ~ [3408, 2874, 64, 64],~ + +** Processing line: ~ if w < circle.radius~ - Inside source: true *** True Line Result - [3408, 2874, 64, 64], -** Processing line: ~ [3407, 2849, 64, 64],~ + if w < circle.radius +** Processing line: ~ x -= circle.radius~ - Inside source: true *** True Line Result - [3407, 2849, 64, 64], -** Processing line: ~ [3345, 2872, 64, 64],~ + x -= circle.radius +** Processing line: ~ w = circle.radius * 2~ - Inside source: true *** True Line Result - [3345, 2872, 64, 64], -** Processing line: ~ [3342, 2847, 64, 64],~ + w = circle.radius * 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3342, 2847, 64, 64], -** Processing line: ~ [3284, 2874, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [3284, 2874, 64, 64], -** Processing line: ~ [3284, 2848, 64, 64],~ + +** Processing line: ~ if h < circle.radius~ - Inside source: true *** True Line Result - [3284, 2848, 64, 64], -** Processing line: ~ [3248, 2878, 64, 64],~ + if h < circle.radius +** Processing line: ~ y -= circle.radius~ - Inside source: true *** True Line Result - [3248, 2878, 64, 64], -** Processing line: ~ [3252, 2848, 64, 64],~ + y -= circle.radius +** Processing line: ~ h = circle.radius * 2~ - Inside source: true *** True Line Result - [3252, 2848, 64, 64], -** Processing line: ~ [3953, 3274, 64, 64],~ + h = circle.radius * 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3953, 3274, 64, 64], -** Processing line: ~ [3899, 3277, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [3899, 3277, 64, 64], -** Processing line: ~ [3951, 3222, 64, 64],~ + +** Processing line: ~ { x: x, y: y, w: w, h: h }~ - Inside source: true *** True Line Result - [3951, 3222, 64, 64], -** Processing line: ~ [3900, 3222, 64, 64],~ + { x: x, y: y, w: w, h: h } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3900, 3222, 64, 64], -** Processing line: ~ [4310, 2968, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4310, 2968, 64, 64], -** Processing line: ~ [4246, 2969, 64, 64],~ + +** Processing line: ~ def snap_to_grid x, y, snaps~ - Inside source: true *** True Line Result - [4246, 2969, 64, 64], -** Processing line: ~ [4183, 2965, 64, 64],~ + def snap_to_grid x, y, snaps +** Processing line: ~ snap_number = 10~ - Inside source: true *** True Line Result - [4183, 2965, 64, 64], -** Processing line: ~ [4153, 2967, 64, 64],~ + snap_number = 10 +** Processing line: ~ x = x.to_i~ - Inside source: true *** True Line Result - [4153, 2967, 64, 64], -** Processing line: ~ [4311, 2910, 64, 64],~ + x = x.to_i +** Processing line: ~ y = y.to_i~ - Inside source: true *** True Line Result - [4311, 2910, 64, 64], -** Processing line: ~ [4308, 2856, 64, 64],~ + y = y.to_i +** Processing line: ~~ - Inside source: true *** True Line Result - [4308, 2856, 64, 64], -** Processing line: ~ [4251, 2855, 64, 64],~ + +** Processing line: ~ x_floor = x.idiv(snap_number) * snap_number~ - Inside source: true *** True Line Result - [4251, 2855, 64, 64], -** Processing line: ~ [4197, 2857, 64, 64],~ + x_floor = x.idiv(snap_number) * snap_number +** Processing line: ~ x_mod = x % snap_number~ - Inside source: true *** True Line Result - [4197, 2857, 64, 64], -** Processing line: ~ [5466, 3184, 64, 64],~ + x_mod = x % snap_number +** Processing line: ~ x_ceil = (x.idiv(snap_number) + 1) * snap_number~ - Inside source: true *** True Line Result - [5466, 3184, 64, 64], -** Processing line: ~ [5466, 3158, 64, 64],~ + x_ceil = (x.idiv(snap_number) + 1) * snap_number +** Processing line: ~~ - Inside source: true *** True Line Result - [5466, 3158, 64, 64], -** Processing line: ~ [5404, 3184, 64, 64],~ + +** Processing line: ~ y_floor = y.idiv(snap_number) * snap_number~ - Inside source: true *** True Line Result - [5404, 3184, 64, 64], -** Processing line: ~ [5404, 3156, 64, 64],~ + y_floor = y.idiv(snap_number) * snap_number +** Processing line: ~ y_mod = y % snap_number~ - Inside source: true *** True Line Result - [5404, 3156, 64, 64], -** Processing line: ~ [5343, 3185, 64, 64],~ + y_mod = y % snap_number +** Processing line: ~ y_ceil = (y.idiv(snap_number) + 1) * snap_number~ - Inside source: true *** True Line Result - [5343, 3185, 64, 64], -** Processing line: ~ [5342, 3156, 64, 64],~ + y_ceil = (y.idiv(snap_number) + 1) * snap_number +** Processing line: ~~ - Inside source: true *** True Line Result - [5342, 3156, 64, 64], -** Processing line: ~ [5308, 3185, 64, 64],~ + +** Processing line: ~ if snaps[x_floor]~ - Inside source: true *** True Line Result - [5308, 3185, 64, 64], -** Processing line: ~ [5307, 3154, 64, 64],~ + if snaps[x_floor] +** Processing line: ~ x_result = x_floor~ - Inside source: true *** True Line Result - [5307, 3154, 64, 64], -** Processing line: ~ [6163, 2950, 64, 64],~ + x_result = x_floor +** Processing line: ~ elsif snaps[x_ceil]~ - Inside source: true *** True Line Result - [6163, 2950, 64, 64], -** Processing line: ~ [6111, 2952, 64, 64],~ + elsif snaps[x_ceil] +** Processing line: ~ x_result = x_ceil~ - Inside source: true *** True Line Result - [6111, 2952, 64, 64], -** Processing line: ~ [6164, 2898, 64, 64],~ + x_result = x_ceil +** Processing line: ~ elsif x_mod < snap_number.idiv(2)~ - Inside source: true *** True Line Result - [6164, 2898, 64, 64], -** Processing line: ~ [6113, 2897, 64, 64],~ + elsif x_mod < snap_number.idiv(2) +** Processing line: ~ x_result = x_floor~ - Inside source: true *** True Line Result - [6113, 2897, 64, 64], -** Processing line: ~ [7725, 3156, 64, 64],~ + x_result = x_floor +** Processing line: ~ else~ - Inside source: true *** True Line Result - [7725, 3156, 64, 64], -** Processing line: ~ [7661, 3157, 64, 64],~ + else +** Processing line: ~ x_result = x_ceil~ - Inside source: true *** True Line Result - [7661, 3157, 64, 64], -** Processing line: ~ [7598, 3157, 64, 64],~ + x_result = x_ceil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7598, 3157, 64, 64], -** Processing line: ~ [7533, 3156, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7533, 3156, 64, 64], -** Processing line: ~ [7468, 3156, 64, 64],~ + +** Processing line: ~ snaps[x_result] ||= {}~ - Inside source: true *** True Line Result - [7468, 3156, 64, 64], -** Processing line: ~ [7401, 3156, 64, 64],~ + snaps[x_result] ||= {} +** Processing line: ~~ - Inside source: true *** True Line Result - [7401, 3156, 64, 64], -** Processing line: ~ [7335, 3157, 64, 64],~ + +** Processing line: ~ if snaps[x_result][y_floor]~ - Inside source: true *** True Line Result - [7335, 3157, 64, 64], -** Processing line: ~ [7270, 3157, 64, 64],~ + if snaps[x_result][y_floor] +** Processing line: ~ y_result = y_floor~ - Inside source: true *** True Line Result - [7270, 3157, 64, 64], -** Processing line: ~ [7208, 3157, 64, 64],~ + y_result = y_floor +** Processing line: ~ elsif snaps[x_result][y_ceil]~ - Inside source: true *** True Line Result - [7208, 3157, 64, 64], -** Processing line: ~ [7146, 3157, 64, 64],~ + elsif snaps[x_result][y_ceil] +** Processing line: ~ y_result = y_ceil~ - Inside source: true *** True Line Result - [7146, 3157, 64, 64], -** Processing line: ~ [7134, 3159, 64, 64],~ + y_result = y_ceil +** Processing line: ~ elsif y_mod < snap_number.idiv(2)~ - Inside source: true *** True Line Result - [7134, 3159, 64, 64], -** Processing line: ~ [6685, 3726, 64, 64],~ + elsif y_mod < snap_number.idiv(2) +** Processing line: ~ y_result = y_floor~ - Inside source: true *** True Line Result - [6685, 3726, 64, 64], -** Processing line: ~ [6685, 3663, 64, 64],~ + y_result = y_floor +** Processing line: ~ else~ - Inside source: true *** True Line Result - [6685, 3663, 64, 64], -** Processing line: ~ [6683, 3602, 64, 64],~ + else +** Processing line: ~ y_result = y_ceil~ - Inside source: true *** True Line Result - [6683, 3602, 64, 64], -** Processing line: ~ [6679, 3538, 64, 64],~ + y_result = y_ceil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6679, 3538, 64, 64], -** Processing line: ~ [6680, 3474, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6680, 3474, 64, 64], -** Processing line: ~ [6682, 3413, 64, 64],~ + +** Processing line: ~ snaps[x_result][y_result] = true~ - Inside source: true *** True Line Result - [6682, 3413, 64, 64], -** Processing line: ~ [6681, 3347, 64, 64],~ + snaps[x_result][y_result] = true +** Processing line: ~ return [x_result, y_result]~ - Inside source: true *** True Line Result - [6681, 3347, 64, 64], -** Processing line: ~ [6681, 3287, 64, 64],~ + return [x_result, y_result] +** Processing line: ~~ - Inside source: true *** True Line Result - [6681, 3287, 64, 64], -** Processing line: ~ [6682, 3223, 64, 64],~ + +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6682, 3223, 64, 64], -** Processing line: ~ [6683, 3161, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6683, 3161, 64, 64], -** Processing line: ~ [6682, 3102, 64, 64],~ + +** Processing line: ~ def snap_line line~ - Inside source: true *** True Line Result - [6682, 3102, 64, 64], -** Processing line: ~ [6684, 3042, 64, 64],~ + def snap_line line +** Processing line: ~ x, y, x2, y2 = line~ - Inside source: true *** True Line Result - [6684, 3042, 64, 64], -** Processing line: ~ [6685, 2980, 64, 64],~ + x, y, x2, y2 = line +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6685, 2980, 64, 64], -** Processing line: ~ [6685, 2920, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6685, 2920, 64, 64], -** Processing line: ~ [6683, 2859, 64, 64],~ + +** Processing line: ~ def string_to_line s~ - Inside source: true *** True Line Result - [6683, 2859, 64, 64], -** Processing line: ~ [6684, 2801, 64, 64],~ + def string_to_line s +** Processing line: ~ x, y, x2, y2 = s.split(',').map(&:to_f)~ - Inside source: true *** True Line Result - [6684, 2801, 64, 64], -** Processing line: ~ [6686, 2743, 64, 64],~ + x, y, x2, y2 = s.split(',').map(&:to_f) +** Processing line: ~~ - Inside source: true *** True Line Result - [6686, 2743, 64, 64], -** Processing line: ~ [6683, 2683, 64, 64],~ + +** Processing line: ~ if x > x2~ - Inside source: true *** True Line Result - [6683, 2683, 64, 64], -** Processing line: ~ [6681, 2622, 64, 64],~ + if x > x2 +** Processing line: ~ x2, x = x, x2~ - Inside source: true *** True Line Result - [6681, 2622, 64, 64], -** Processing line: ~ [6682, 2559, 64, 64],~ + x2, x = x, x2 +** Processing line: ~ y2, y = y, y2~ - Inside source: true *** True Line Result - [6682, 2559, 64, 64], -** Processing line: ~ [6683, 2498, 64, 64],~ + y2, y = y, y2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6683, 2498, 64, 64], -** Processing line: ~ [6685, 2434, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6685, 2434, 64, 64], -** Processing line: ~ [6683, 2371, 64, 64],~ + +** Processing line: ~ x, y = snap_to_grid x, y, state.snaps~ - Inside source: true *** True Line Result - [6683, 2371, 64, 64], -** Processing line: ~ [6683, 2306, 64, 64],~ + x, y = snap_to_grid x, y, state.snaps +** Processing line: ~ x2, y2 = snap_to_grid x2, y2, state.snaps~ - Inside source: true *** True Line Result - [6683, 2306, 64, 64], -** Processing line: ~ [6684, 2242, 64, 64],~ + x2, y2 = snap_to_grid x2, y2, state.snaps +** Processing line: ~ [x, y, x2, y2].line.to_hash~ - Inside source: true *** True Line Result - [6684, 2242, 64, 64], -** Processing line: ~ [6683, 2177, 64, 64],~ + [x, y, x2, y2].line.to_hash +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6683, 2177, 64, 64], -** Processing line: ~ [6683, 2112, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6683, 2112, 64, 64], -** Processing line: ~ [6683, 2049, 64, 64],~ + +** Processing line: ~ def load_lines file~ - Inside source: true *** True Line Result - [6683, 2049, 64, 64], -** Processing line: ~ [6683, 1985, 64, 64],~ + def load_lines file +** Processing line: ~ data = gtk.read_file(file) || ""~ - Inside source: true *** True Line Result - [6683, 1985, 64, 64], -** Processing line: ~ [6682, 1923, 64, 64],~ + data = gtk.read_file(file) || "" +** Processing line: ~ data.each_line~ - Inside source: true *** True Line Result - [6682, 1923, 64, 64], -** Processing line: ~ [6683, 1860, 64, 64],~ + data.each_line +** Processing line: ~ .reject { |l| l.strip.length == 0 }~ - Inside source: true *** True Line Result - [6683, 1860, 64, 64], -** Processing line: ~ [6685, 1797, 64, 64],~ + .reject { |l| l.strip.length == 0 } +** Processing line: ~ .map { |l| string_to_line l }~ - Inside source: true *** True Line Result - [6685, 1797, 64, 64], -** Processing line: ~ [6684, 1735, 64, 64],~ + .map { |l| string_to_line l } +** Processing line: ~ .map { |h| h.merge(rect: rect_for_line(h)) }~ - Inside source: true *** True Line Result - [6684, 1735, 64, 64], -** Processing line: ~ [6685, 1724, 64, 64],~ + .map { |h| h.merge(rect: rect_for_line(h)) } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6685, 1724, 64, 64], -** Processing line: ~ [7088, 1967, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7088, 1967, 64, 64], -** Processing line: ~ [7026, 1966, 64, 64],~ + +** Processing line: ~ def load_terrain~ - Inside source: true *** True Line Result - [7026, 1966, 64, 64], -** Processing line: ~ [6964, 1967, 64, 64],~ + def load_terrain +** Processing line: ~ load_lines 'data/level.txt'~ - Inside source: true *** True Line Result - [6964, 1967, 64, 64], -** Processing line: ~ [6900, 1965, 64, 64],~ + load_lines 'data/level.txt' +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6900, 1965, 64, 64], -** Processing line: ~ [6869, 1969, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6869, 1969, 64, 64], -** Processing line: ~ [6972, 1904, 64, 64],~ + +** Processing line: ~ def load_lava~ - Inside source: true *** True Line Result - [6972, 1904, 64, 64], -** Processing line: ~ [6974, 1840, 64, 64],~ + def load_lava +** Processing line: ~ load_lines 'data/level_lava.txt'~ - Inside source: true *** True Line Result - [6974, 1840, 64, 64], -** Processing line: ~ [6971, 1776, 64, 64],~ + load_lines 'data/level_lava.txt' +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6971, 1776, 64, 64], -** Processing line: ~ [6971, 1716, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6971, 1716, 64, 64], -** Processing line: ~ [7168, 1979, 64, 64],~ + +** Processing line: ~ def load_level force: false~ - Inside source: true *** True Line Result - [7168, 1979, 64, 64], -** Processing line: ~ [7170, 1919, 64, 64],~ + def load_level force: false +** Processing line: ~ if force~ - Inside source: true *** True Line Result - [7170, 1919, 64, 64], -** Processing line: ~ [7169, 1882, 64, 64],~ + if force +** Processing line: ~ state.snaps = {}~ - Inside source: true *** True Line Result - [7169, 1882, 64, 64], -** Processing line: ~ [7115, 1880, 64, 64],~ + state.snaps = {} +** Processing line: ~ state.terrain = load_terrain~ - Inside source: true *** True Line Result - [7115, 1880, 64, 64], -** Processing line: ~ [7086, 1881, 64, 64],~ + state.terrain = load_terrain +** Processing line: ~ state.lava = load_lava~ - Inside source: true *** True Line Result - [7086, 1881, 64, 64], -** Processing line: ~ [7725, 1837, 64, 64],~ + state.lava = load_lava +** Processing line: ~ else~ - Inside source: true *** True Line Result - [7725, 1837, 64, 64], -** Processing line: ~ [7724, 1776, 64, 64],~ + else +** Processing line: ~ state.terrain ||= load_terrain~ - Inside source: true *** True Line Result - [7724, 1776, 64, 64], -** Processing line: ~ [7724, 1728, 64, 64],~ + state.terrain ||= load_terrain +** Processing line: ~ state.lava ||= load_lava~ - Inside source: true *** True Line Result - [7724, 1728, 64, 64], -** Processing line: ~ [7661, 1727, 64, 64],~ + state.lava ||= load_lava +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7661, 1727, 64, 64], -** Processing line: ~ [7603, 1728, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7603, 1728, 64, 64], -** Processing line: ~ [7571, 1837, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7571, 1837, 64, 64], -** Processing line: ~ [7570, 1774, 64, 64],~ + +** Processing line: ~ def save_lines lines, file~ - Inside source: true *** True Line Result - [7570, 1774, 64, 64], -** Processing line: ~ [7572, 1725, 64, 64],~ + def save_lines lines, file +** Processing line: ~ s = lines.map do |l|~ - Inside source: true *** True Line Result - [7572, 1725, 64, 64], -** Processing line: ~ [7859, 2134, 64, 64],~ + s = lines.map do |l| +** Processing line: ~ "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"~ - Inside source: true *** True Line Result - [7859, 2134, 64, 64], -** Processing line: ~ [7858, 2070, 64, 64],~ + "#{l.x1},#{l.y1},#{l.x2},#{l.y2}" +** Processing line: ~ end.join("\n")~ - Inside source: true *** True Line Result - [7858, 2070, 64, 64], -** Processing line: ~ [7858, 2008, 64, 64],~ + end.join("\n") +** Processing line: ~ gtk.write_file(file, s)~ - Inside source: true *** True Line Result - [7858, 2008, 64, 64], -** Processing line: ~ [7860, 1942, 64, 64],~ + gtk.write_file(file, s) +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7860, 1942, 64, 64], -** Processing line: ~ [7856, 1878, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7856, 1878, 64, 64], -** Processing line: ~ [7860, 1813, 64, 64],~ + +** Processing line: ~ def save_level~ - Inside source: true *** True Line Result - [7860, 1813, 64, 64], -** Processing line: ~ [7859, 1750, 64, 64],~ + def save_level +** Processing line: ~ save_lines(state.terrain, 'level.txt')~ - Inside source: true *** True Line Result - [7859, 1750, 64, 64], -** Processing line: ~ [7856, 1724, 64, 64],~ + save_lines(state.terrain, 'level.txt') +** Processing line: ~ save_lines(state.lava, 'level_lava.txt')~ - Inside source: true *** True Line Result - [7856, 1724, 64, 64], -** Processing line: ~ [8155, 1837, 64, 64],~ + save_lines(state.lava, 'level_lava.txt') +** Processing line: ~ load_level force: true~ - Inside source: true *** True Line Result - [8155, 1837, 64, 64], -** Processing line: ~ [8092, 1839, 64, 64],~ + load_level force: true +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8092, 1839, 64, 64], -** Processing line: ~ [8032, 1838, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8032, 1838, 64, 64], -** Processing line: ~ [7999, 1839, 64, 64],~ + +** Processing line: ~ def line_near_rect? rect, terrain~ - Inside source: true *** True Line Result - [7999, 1839, 64, 64], -** Processing line: ~ [8153, 1773, 64, 64],~ + def line_near_rect? rect, terrain +** Processing line: ~ geometry.intersect_rect?(rect, terrain[:rect])~ - Inside source: true *** True Line Result - [8153, 1773, 64, 64], -** Processing line: ~ [8154, 1731, 64, 64],~ + geometry.intersect_rect?(rect, terrain[:rect]) +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8154, 1731, 64, 64], -** Processing line: ~ [8090, 1730, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8090, 1730, 64, 64], -** Processing line: ~ [8035, 1732, 64, 64],~ + +** Processing line: ~ def point_within_line? point, line~ - Inside source: true *** True Line Result - [8035, 1732, 64, 64], -** Processing line: ~ [8003, 1776, 64, 64],~ + def point_within_line? point, line +** Processing line: ~ return false if !point~ - Inside source: true *** True Line Result - [8003, 1776, 64, 64], -** Processing line: ~ [8003, 1730, 64, 64],~ + return false if !point +** Processing line: ~ return false if !line~ - Inside source: true *** True Line Result - [8003, 1730, 64, 64], -** Processing line: ~ [8421, 1978, 64, 64],~ + return false if !line +** Processing line: ~ return true~ - Inside source: true *** True Line Result - [8421, 1978, 64, 64], -** Processing line: ~ [8420, 1917, 64, 64],~ + return true +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8420, 1917, 64, 64], -** Processing line: ~ [8505, 1878, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8505, 1878, 64, 64], -** Processing line: ~ [8443, 1881, 64, 64],~ + +** Processing line: ~ def calc_impacts x, dx, y, dy, radius~ - Inside source: true *** True Line Result - [8443, 1881, 64, 64], -** Processing line: ~ [8420, 1882, 64, 64],~ + def calc_impacts x, dx, y, dy, radius +** Processing line: ~ results = { }~ - Inside source: true *** True Line Result - [8420, 1882, 64, 64], -** Processing line: ~ [8847, 1908, 64, 64],~ + results = { } +** Processing line: ~ results[:x] = x~ - Inside source: true *** True Line Result - [8847, 1908, 64, 64], -** Processing line: ~ [8783, 1908, 64, 64],~ + results[:x] = x +** Processing line: ~ results[:y] = y~ - Inside source: true *** True Line Result - [8783, 1908, 64, 64], -** Processing line: ~ [8718, 1910, 64, 64],~ + results[:y] = y +** Processing line: ~ results[:dx] = x~ - Inside source: true *** True Line Result - [8718, 1910, 64, 64], -** Processing line: ~ [8654, 1910, 64, 64],~ + results[:dx] = x +** Processing line: ~ results[:dy] = y~ - Inside source: true *** True Line Result - [8654, 1910, 64, 64], -** Processing line: ~ [8628, 1911, 64, 64],~ + results[:dy] = y +** Processing line: ~ results[:point] = { x: x, y: y }~ - Inside source: true *** True Line Result - [8628, 1911, 64, 64], -** Processing line: ~ [8729, 1847, 64, 64],~ + results[:point] = { x: x, y: y } +** Processing line: ~ results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }~ - Inside source: true *** True Line Result - [8729, 1847, 64, 64], -** Processing line: ~ [8731, 1781, 64, 64],~ + results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 } +** Processing line: ~ results[:trajectory] = trajectory(results)~ - Inside source: true *** True Line Result - [8731, 1781, 64, 64], -** Processing line: ~ [8731, 1721, 64, 64],~ + results[:trajectory] = trajectory(results) +** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ - Inside source: true *** True Line Result - [8731, 1721, 64, 64], -** Processing line: ~ [9058, 2135, 64, 64],~ + results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| +** Processing line: ~ {~ - Inside source: true *** True Line Result - [9058, 2135, 64, 64], -** Processing line: ~ [9056, 2073, 64, 64],~ + { +** Processing line: ~ terrain: t,~ - Inside source: true *** True Line Result - [9056, 2073, 64, 64], -** Processing line: ~ [9058, 2006, 64, 64],~ + terrain: t, +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ - Inside source: true *** True Line Result - [9058, 2006, 64, 64], -** Processing line: ~ [9057, 1939, 64, 64],~ + point: geometry.line_intersect(results[:trajectory], t), +** Processing line: ~ type: :terrain~ - Inside source: true *** True Line Result - [9057, 1939, 64, 64], -** Processing line: ~ [9058, 1876, 64, 64],~ + type: :terrain +** Processing line: ~ }~ - Inside source: true *** True Line Result - [9058, 1876, 64, 64], -** Processing line: ~ [9056, 1810, 64, 64],~ + } +** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ - Inside source: true *** True Line Result - [9056, 1810, 64, 64], -** Processing line: ~ [9059, 1745, 64, 64],~ + end.reject { |t| !point_within_line? t[:point], t[:terrain] } +** Processing line: ~~ - Inside source: true *** True Line Result - [9059, 1745, 64, 64], -** Processing line: ~ [9060, 1722, 64, 64],~ + +** Processing line: ~ results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ - Inside source: true *** True Line Result - [9060, 1722, 64, 64], -** Processing line: ~ [9273, 1977, 64, 64],~ + results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t| +** Processing line: ~ {~ - Inside source: true *** True Line Result - [9273, 1977, 64, 64], -** Processing line: ~ [9273, 1912, 64, 64],~ + { +** Processing line: ~ terrain: t,~ - Inside source: true *** True Line Result - [9273, 1912, 64, 64], -** Processing line: ~ [9358, 1883, 64, 64],~ + terrain: t, +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ - Inside source: true *** True Line Result - [9358, 1883, 64, 64], -** Processing line: ~ [9298, 1881, 64, 64],~ + point: geometry.line_intersect(results[:trajectory], t), +** Processing line: ~ type: :lava~ - Inside source: true *** True Line Result - [9298, 1881, 64, 64], -** Processing line: ~ [9270, 1883, 64, 64],~ + type: :lava +** Processing line: ~ }~ - Inside source: true *** True Line Result - [9270, 1883, 64, 64], -** Processing line: ~ [9699, 1910, 64, 64],~ + } +** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ - Inside source: true *** True Line Result - [9699, 1910, 64, 64], -** Processing line: ~ [9637, 1910, 64, 64],~ + end.reject { |t| !point_within_line? t[:point], t[:terrain] } +** Processing line: ~~ - Inside source: true *** True Line Result - [9637, 1910, 64, 64], -** Processing line: ~ [9576, 1910, 64, 64],~ + +** Processing line: ~ results~ - Inside source: true *** True Line Result - [9576, 1910, 64, 64], -** Processing line: ~ [9512, 1911, 64, 64],~ + results +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9512, 1911, 64, 64], -** Processing line: ~ [9477, 1912, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [9477, 1912, 64, 64], -** Processing line: ~ [9584, 1846, 64, 64],~ + +** Processing line: ~ def calc_potential_impacts~ - Inside source: true *** True Line Result - [9584, 1846, 64, 64], -** Processing line: ~ [9585, 1783, 64, 64],~ + def calc_potential_impacts +** Processing line: ~ impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius~ - Inside source: true *** True Line Result - [9585, 1783, 64, 64], -** Processing line: ~ [9586, 1719, 64, 64],~ + impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius +** Processing line: ~ circle.rect = impact_results[:rect]~ - Inside source: true *** True Line Result - [9586, 1719, 64, 64], -** Processing line: ~ [8320, 2788, 64, 64],~ + circle.rect = impact_results[:rect] +** Processing line: ~ circle.trajectory = impact_results[:trajectory]~ - Inside source: true *** True Line Result - [8320, 2788, 64, 64], -** Processing line: ~ [8256, 2789, 64, 64],~ + circle.trajectory = impact_results[:trajectory] +** Processing line: ~ circle.impacts = impact_results[:impacts]~ - Inside source: true *** True Line Result - [8256, 2789, 64, 64], -** Processing line: ~ [8192, 2789, 64, 64],~ + circle.impacts = impact_results[:impacts] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8192, 2789, 64, 64], -** Processing line: ~ [8180, 2789, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8180, 2789, 64, 64], -** Processing line: ~ [8319, 2730, 64, 64],~ + +** Processing line: ~ def calc_terrains_to_monitor~ - Inside source: true *** True Line Result - [8319, 2730, 64, 64], -** Processing line: ~ [8319, 2671, 64, 64],~ + def calc_terrains_to_monitor +** Processing line: ~ circle.impact = nil~ - Inside source: true *** True Line Result - [8319, 2671, 64, 64], -** Processing line: ~ [8319, 2639, 64, 64],~ + circle.impact = nil +** Processing line: ~ circle.impacts.each do |i|~ - Inside source: true *** True Line Result - [8319, 2639, 64, 64], -** Processing line: ~ [8259, 2639, 64, 64],~ + circle.impacts.each do |i| +** Processing line: ~ circle.terrains_to_monitor[i[:terrain]] ||= {~ - Inside source: true *** True Line Result - [8259, 2639, 64, 64], -** Processing line: ~ [8202, 2639, 64, 64],~ + circle.terrains_to_monitor[i[:terrain]] ||= { +** Processing line: ~ ray_start: geometry.ray_test(circle, i[:terrain]),~ - Inside source: true *** True Line Result - [8202, 2639, 64, 64], -** Processing line: ~ [8179, 2727, 64, 64],~ + ray_start: geometry.ray_test(circle, i[:terrain]), +** Processing line: ~ }~ - Inside source: true *** True Line Result - [8179, 2727, 64, 64], -** Processing line: ~ [8178, 2665, 64, 64],~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - [8178, 2665, 64, 64], -** Processing line: ~ [8177, 2636, 64, 64],~ + +** Processing line: ~ circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])~ - Inside source: true *** True Line Result - [8177, 2636, 64, 64], -** Processing line: ~ [9360, 3138, 64, 64],~ + circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain]) +** Processing line: ~ if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]~ - Inside source: true *** True Line Result - [9360, 3138, 64, 64], -** Processing line: ~ [9296, 3137, 64, 64],~ + if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current] +** Processing line: ~ if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)~ - Inside source: true *** True Line Result - [9296, 3137, 64, 64], -** Processing line: ~ [9235, 3139, 64, 64],~ + if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2) +** Processing line: ~ circle.impact = i~ - Inside source: true *** True Line Result - [9235, 3139, 64, 64], -** Processing line: ~ [9174, 3139, 64, 64],~ + circle.impact = i +** Processing line: ~ circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]~ - Inside source: true *** True Line Result - [9174, 3139, 64, 64], -** Processing line: ~ [9113, 3138, 64, 64],~ + circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9113, 3138, 64, 64], -** Processing line: ~ [9050, 3138, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [9050, 3138, 64, 64], -** Processing line: ~ [8988, 3138, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8988, 3138, 64, 64], -** Processing line: ~ [8925, 3138, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [8925, 3138, 64, 64], -** Processing line: ~ [8860, 3136, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [8860, 3136, 64, 64], -** Processing line: ~ [8797, 3136, 64, 64],~ + +** Processing line: ~ def impact_result body, impact~ - Inside source: true *** True Line Result - [8797, 3136, 64, 64], -** Processing line: ~ [8770, 3138, 64, 64],~ + def impact_result body, impact +** Processing line: ~ infinity_alias = 1000~ - Inside source: true *** True Line Result - [8770, 3138, 64, 64], -** Processing line: ~ [8827, 4171, 64, 64],~ + infinity_alias = 1000 +** Processing line: ~ r = {~ - Inside source: true *** True Line Result - [8827, 4171, 64, 64], -** Processing line: ~ [8827, 4107, 64, 64],~ + r = { +** Processing line: ~ body: {},~ - Inside source: true *** True Line Result - [8827, 4107, 64, 64], -** Processing line: ~ [8827, 4043, 64, 64],~ + body: {}, +** Processing line: ~ terrain: {},~ - Inside source: true *** True Line Result - [8827, 4043, 64, 64], -** Processing line: ~ [8827, 3978, 64, 64],~ + terrain: {}, +** Processing line: ~ impact: {}~ - Inside source: true *** True Line Result - [8827, 3978, 64, 64], -** Processing line: ~ [8825, 3914, 64, 64],~ + impact: {} +** Processing line: ~ }~ - Inside source: true *** True Line Result - [8825, 3914, 64, 64], -** Processing line: ~ [8824, 3858, 64, 64],~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - [8824, 3858, 64, 64], -** Processing line: ~ [9635, 4234, 64, 64],~ + +** Processing line: ~ r[:body][:line] = body.trajectory.dup~ - Inside source: true *** True Line Result - [9635, 4234, 64, 64], -** Processing line: ~ [9584, 4235, 64, 64],~ + r[:body][:line] = body.trajectory.dup +** Processing line: ~ r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)~ - Inside source: true *** True Line Result - [9584, 4235, 64, 64], -** Processing line: ~ [9634, 4187, 64, 64],~ + r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias) +** Processing line: ~ r[:body][:slope_sign] = r[:body][:slope].sign~ - Inside source: true *** True Line Result - [9634, 4187, 64, 64], -** Processing line: ~ [9582, 4183, 64, 64],~ + r[:body][:slope_sign] = r[:body][:slope].sign +** Processing line: ~ r[:body][:x] = body.x~ - Inside source: true *** True Line Result - [9582, 4183, 64, 64], -** Processing line: ~ [9402, 5114, 64, 64],~ + r[:body][:x] = body.x +** Processing line: ~ r[:body][:y] = body.y~ - Inside source: true *** True Line Result - [9402, 5114, 64, 64], -** Processing line: ~ [9402, 5087, 64, 64],~ + r[:body][:y] = body.y +** Processing line: ~ r[:body][:dy] = body.dy~ - Inside source: true *** True Line Result - [9402, 5087, 64, 64], -** Processing line: ~ [9347, 5113, 64, 64],~ + r[:body][:dy] = body.dy +** Processing line: ~ r[:body][:dx] = body.dx~ - Inside source: true *** True Line Result - [9347, 5113, 64, 64], -** Processing line: ~ [9345, 5086, 64, 64],~ + r[:body][:dx] = body.dx +** Processing line: ~~ - Inside source: true *** True Line Result - [9345, 5086, 64, 64], -** Processing line: ~ [9287, 5114, 64, 64],~ + +** Processing line: ~ r[:terrain][:line] = impact[:terrain].dup~ - Inside source: true *** True Line Result - [9287, 5114, 64, 64], -** Processing line: ~ [9285, 5085, 64, 64],~ + r[:terrain][:line] = impact[:terrain].dup +** Processing line: ~ r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)~ - Inside source: true *** True Line Result - [9285, 5085, 64, 64], -** Processing line: ~ [9245, 5114, 64, 64],~ + r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias) +** Processing line: ~ r[:terrain][:slope_sign] = r[:terrain][:slope].sign~ - Inside source: true *** True Line Result - [9245, 5114, 64, 64], -** Processing line: ~ [9244, 5086, 64, 64],~ + r[:terrain][:slope_sign] = r[:terrain][:slope].sign +** Processing line: ~~ - Inside source: true *** True Line Result - [9244, 5086, 64, 64], -** Processing line: ~ [9336, 5445, 64, 64],~ + +** Processing line: ~ r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)~ - Inside source: true *** True Line Result - [9336, 5445, 64, 64], -** Processing line: ~ [9285, 5445, 64, 64],~ + r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias) +** Processing line: ~ r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }~ - Inside source: true *** True Line Result - [9285, 5445, 64, 64], -** Processing line: ~ [9337, 5395, 64, 64],~ + r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y } +** Processing line: ~ r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]~ - Inside source: true *** True Line Result - [9337, 5395, 64, 64], -** Processing line: ~ [9283, 5393, 64, 64],~ + r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign] +** Processing line: ~ r[:impact][:ray] = body.ray_current~ - Inside source: true *** True Line Result - [9283, 5393, 64, 64], -** Processing line: ~ [8884, 4968, 64, 64],~ + r[:impact][:ray] = body.ray_current +** Processing line: ~ r[:body][:new_on_floor] = body.on_floor~ - Inside source: true *** True Line Result - [8884, 4968, 64, 64], -** Processing line: ~ [8884, 4939, 64, 64],~ + r[:body][:new_on_floor] = body.on_floor +** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ - Inside source: true *** True Line Result - [8884, 4939, 64, 64], -** Processing line: ~ [8822, 4967, 64, 64],~ + r[:body][:new_floor] = r[:terrain][:line] +** Processing line: ~~ - Inside source: true *** True Line Result - [8822, 4967, 64, 64], -** Processing line: ~ [8823, 4940, 64, 64],~ + +** Processing line: ~ if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3~ - Inside source: true *** True Line Result - [8823, 4940, 64, 64], -** Processing line: ~ [8765, 4967, 64, 64],~ + if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3 +** Processing line: ~ play_sound~ - Inside source: true *** True Line Result - [8765, 4967, 64, 64], -** Processing line: ~ [8762, 4937, 64, 64],~ + play_sound +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1~ - Inside source: true *** True Line Result - [8762, 4937, 64, 64], -** Processing line: ~ [8726, 4969, 64, 64],~ + r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1 +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * circle.elasticity~ - Inside source: true *** True Line Result - [8726, 4969, 64, 64], -** Processing line: ~ [8727, 4939, 64, 64],~ + r[:body][:new_dx] = r[:body][:dx] * circle.elasticity +** Processing line: ~ r[:impact][:type] = :horizontal~ - Inside source: true *** True Line Result - [8727, 4939, 64, 64], -** Processing line: ~ [7946, 5248, 64, 64],~ + r[:impact][:type] = :horizontal +** Processing line: ~ r[:body][:new_reason] = "-"~ - Inside source: true *** True Line Result - [7946, 5248, 64, 64], -** Processing line: ~ [7945, 5220, 64, 64],~ + r[:body][:new_reason] = "-" +** Processing line: ~ elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3~ - Inside source: true *** True Line Result - [7945, 5220, 64, 64], -** Processing line: ~ [7887, 5248, 64, 64],~ + elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3 +** Processing line: ~ play_sound~ - Inside source: true *** True Line Result - [7887, 5248, 64, 64], -** Processing line: ~ [7886, 5219, 64, 64],~ + play_sound +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * 1.1~ - Inside source: true *** True Line Result - [7886, 5219, 64, 64], -** Processing line: ~ [7830, 5248, 64, 64],~ + r[:body][:new_dy] = r[:body][:dy] * 1.1 +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ - Inside source: true *** True Line Result - [7830, 5248, 64, 64], -** Processing line: ~ [7827, 5218, 64, 64],~ + r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity +** Processing line: ~ r[:impact][:type] = :vertical~ - Inside source: true *** True Line Result - [7827, 5218, 64, 64], -** Processing line: ~ [7781, 5248, 64, 64],~ + r[:impact][:type] = :vertical +** Processing line: ~ r[:body][:new_reason] = "|"~ - Inside source: true *** True Line Result - [7781, 5248, 64, 64], -** Processing line: ~ [7781, 5216, 64, 64],~ + r[:body][:new_reason] = "|" +** Processing line: ~ else~ - Inside source: true *** True Line Result - [7781, 5216, 64, 64], -** Processing line: ~ [6648, 4762, 64, 64],~ + else +** Processing line: ~ play_sound~ - Inside source: true *** True Line Result - [6648, 4762, 64, 64], -** Processing line: ~ [6621, 4761, 64, 64],~ + play_sound +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ - Inside source: true *** True Line Result - [6621, 4761, 64, 64], -** Processing line: ~ [5011, 4446, 64, 64],~ + r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity~ - Inside source: true *** True Line Result - [5011, 4446, 64, 64], -** Processing line: ~ [4982, 4444, 64, 64],~ + r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity +** Processing line: ~ r[:impact][:type] = :slanted~ - Inside source: true *** True Line Result - [4982, 4444, 64, 64], -** Processing line: ~ [4146, 4641, 64, 64],~ + r[:impact][:type] = :slanted +** Processing line: ~ r[:body][:new_reason] = "/"~ - Inside source: true *** True Line Result - [4146, 4641, 64, 64], -** Processing line: ~ [4092, 4643, 64, 64],~ + r[:body][:new_reason] = "/" +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4092, 4643, 64, 64], -** Processing line: ~ [4145, 4589, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4145, 4589, 64, 64], -** Processing line: ~ [4091, 4590, 64, 64],~ + +** Processing line: ~ r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs~ - Inside source: true *** True Line Result - [4091, 4590, 64, 64], -** Processing line: ~ [4139, 4497, 64, 64],~ + r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs +** Processing line: ~~ - Inside source: true *** True Line Result - [4139, 4497, 64, 64], -** Processing line: ~ [4135, 4437, 64, 64],~ + +** Processing line: ~ if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4~ - Inside source: true *** True Line Result - [4135, 4437, 64, 64], -** Processing line: ~ [4135, 4383, 64, 64],~ + if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4 +** Processing line: ~ r[:body][:new_dx] = 0~ - Inside source: true *** True Line Result - [4135, 4383, 64, 64], -** Processing line: ~ [4078, 4495, 64, 64],~ + r[:body][:new_dx] = 0 +** Processing line: ~ r[:body][:new_dy] = 0~ - Inside source: true *** True Line Result - [4078, 4495, 64, 64], -** Processing line: ~ [4014, 4494, 64, 64],~ + r[:body][:new_dy] = 0 +** Processing line: ~ r[:impact][:energy] = 0~ - Inside source: true *** True Line Result - [4014, 4494, 64, 64], -** Processing line: ~ [3979, 4496, 64, 64],~ + r[:impact][:energy] = 0 +** Processing line: ~ r[:body][:new_on_floor] = true~ - Inside source: true *** True Line Result - [3979, 4496, 64, 64], -** Processing line: ~ [4074, 4384, 64, 64],~ + r[:body][:new_on_floor] = true +** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ - Inside source: true *** True Line Result - [4074, 4384, 64, 64], -** Processing line: ~ [4015, 4381, 64, 64],~ + r[:body][:new_floor] = r[:terrain][:line] +** Processing line: ~ r[:body][:new_reason] = "0"~ - Inside source: true *** True Line Result - [4015, 4381, 64, 64], -** Processing line: ~ [3980, 4433, 64, 64],~ + r[:body][:new_reason] = "0" +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3980, 4433, 64, 64], -** Processing line: ~ [3981, 4384, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [3981, 4384, 64, 64], -** Processing line: ~ [3276, 4279, 64, 64],~ + +** Processing line: ~ r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],~ - Inside source: true *** True Line Result - [3276, 4279, 64, 64], -** Processing line: ~ [3275, 4218, 64, 64],~ + r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx], +** Processing line: ~ y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },~ - Inside source: true *** True Line Result - [3275, 4218, 64, 64], -** Processing line: ~ [3276, 4170, 64, 64],~ + y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity }, +** Processing line: ~ r[:terrain][:line])~ - Inside source: true *** True Line Result - [3276, 4170, 64, 64], -** Processing line: ~ [3211, 4164, 64, 64],~ + r[:terrain][:line]) +** Processing line: ~~ - Inside source: true *** True Line Result - [3211, 4164, 64, 64], -** Processing line: ~ [3213, 4280, 64, 64],~ + +** Processing line: ~ if r[:impact][:ray_next] == r[:impact][:ray]~ - Inside source: true *** True Line Result - [3213, 4280, 64, 64], -** Processing line: ~ [3156, 4278, 64, 64],~ + if r[:impact][:ray_next] == r[:impact][:ray] +** Processing line: ~ r[:body][:new_dx] *= -1~ - Inside source: true *** True Line Result - [3156, 4278, 64, 64], -** Processing line: ~ [3120, 4278, 64, 64],~ + r[:body][:new_dx] *= -1 +** Processing line: ~ r[:body][:new_dy] *= -1~ - Inside source: true *** True Line Result - [3120, 4278, 64, 64], -** Processing line: ~ [3151, 4163, 64, 64],~ + r[:body][:new_dy] *= -1 +** Processing line: ~ r[:body][:new_reason] = "clip"~ - Inside source: true *** True Line Result - [3151, 4163, 64, 64], -** Processing line: ~ [3120, 4216, 64, 64],~ + r[:body][:new_reason] = "clip" +** Processing line: ~ end~ - Inside source: true *** True Line Result - [3120, 4216, 64, 64], -** Processing line: ~ [3120, 4161, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [3120, 4161, 64, 64], -** Processing line: ~ [1536, 4171, 64, 64],~ + +** Processing line: ~ r~ - Inside source: true *** True Line Result - [1536, 4171, 64, 64], -** Processing line: ~ [1536, 4110, 64, 64],~ + r +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1536, 4110, 64, 64], -** Processing line: ~ [1535, 4051, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1535, 4051, 64, 64], -** Processing line: ~ [1536, 3991, 64, 64],~ + +** Processing line: ~ def game_over!~ - Inside source: true *** True Line Result - [1536, 3991, 64, 64], -** Processing line: ~ [1536, 3928, 64, 64],~ + def game_over! +** Processing line: ~ circle.x = circle.check_point_x~ - Inside source: true *** True Line Result - [1536, 3928, 64, 64], -** Processing line: ~ [1536, 3863, 64, 64],~ + circle.x = circle.check_point_x +** Processing line: ~ circle.y = circle.check_point_y~ - Inside source: true *** True Line Result - [1536, 3863, 64, 64], -** Processing line: ~ [1078, 4605, 64, 64],~ + circle.y = circle.check_point_y +** Processing line: ~ circle.dx = 0~ - Inside source: true *** True Line Result - [1078, 4605, 64, 64], -** Processing line: ~ [1076, 4577, 64, 64],~ + circle.dx = 0 +** Processing line: ~ circle.dy = 0~ - Inside source: true *** True Line Result - [1076, 4577, 64, 64], -** Processing line: ~ [1018, 4604, 64, 64],~ + circle.dy = 0 +** Processing line: ~ circle.game_over_at = state.tick_count~ - Inside source: true *** True Line Result - [1018, 4604, 64, 64], -** Processing line: ~ [1018, 4575, 64, 64],~ + circle.game_over_at = state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1018, 4575, 64, 64], -** Processing line: ~ [957, 4606, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [957, 4606, 64, 64], -** Processing line: ~ [960, 4575, 64, 64],~ + +** Processing line: ~ def not_game_over!~ - Inside source: true *** True Line Result - [960, 4575, 64, 64], -** Processing line: ~ [918, 4602, 64, 64],~ + def not_game_over! +** Processing line: ~ impact_history_entry = impact_result circle, circle.impact~ - Inside source: true *** True Line Result - [918, 4602, 64, 64], -** Processing line: ~ [918, 4580, 64, 64],~ + impact_history_entry = impact_result circle, circle.impact +** Processing line: ~ circle.impact_history << impact_history_entry~ - Inside source: true *** True Line Result - [918, 4580, 64, 64], -** Processing line: ~ [394, 4164, 64, 64],~ + circle.impact_history << impact_history_entry +** Processing line: ~ circle.x -= circle.dx * 1.1~ - Inside source: true *** True Line Result - [394, 4164, 64, 64], -** Processing line: ~ [335, 4163, 64, 64],~ + circle.x -= circle.dx * 1.1 +** Processing line: ~ circle.y -= circle.dy * 1.1~ - Inside source: true *** True Line Result - [335, 4163, 64, 64], -** Processing line: ~ [274, 4161, 64, 64],~ + circle.y -= circle.dy * 1.1 +** Processing line: ~ circle.dx = impact_history_entry[:body][:new_dx]~ - Inside source: true *** True Line Result - [274, 4161, 64, 64], -** Processing line: ~ [236, 4163, 64, 64],~ + circle.dx = impact_history_entry[:body][:new_dx] +** Processing line: ~ circle.dy = impact_history_entry[:body][:new_dy]~ - Inside source: true *** True Line Result - [236, 4163, 64, 64], -** Processing line: ~ [394, 4140, 64, 64],~ + circle.dy = impact_history_entry[:body][:new_dy] +** Processing line: ~ circle.on_floor = impact_history_entry[:body][:new_on_floor]~ - Inside source: true *** True Line Result - [394, 4140, 64, 64], -** Processing line: ~ [329, 4139, 64, 64],~ + circle.on_floor = impact_history_entry[:body][:new_on_floor] +** Processing line: ~~ - Inside source: true *** True Line Result - [329, 4139, 64, 64], -** Processing line: ~ [268, 4139, 64, 64],~ + +** Processing line: ~ if circle.on_floor~ - Inside source: true *** True Line Result - [268, 4139, 64, 64], -** Processing line: ~ [239, 4139, 64, 64],~ + if circle.on_floor +** Processing line: ~ circle.check_point_at = state.tick_count~ - Inside source: true *** True Line Result - [239, 4139, 64, 64], -** Processing line: ~ [4326, 5073, 64, 64],~ + circle.check_point_at = state.tick_count +** Processing line: ~ circle.check_point_x = circle.x~ - Inside source: true *** True Line Result - [4326, 5073, 64, 64], -** Processing line: ~ [4324, 5042, 64, 64],~ + circle.check_point_x = circle.x +** Processing line: ~ circle.check_point_y = circle.y~ - Inside source: true *** True Line Result - [4324, 5042, 64, 64], -** Processing line: ~ [4265, 5074, 64, 64],~ + circle.check_point_y = circle.y +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4265, 5074, 64, 64], -** Processing line: ~ [4263, 5042, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4263, 5042, 64, 64], -** Processing line: ~ [4214, 5072, 64, 64],~ + +** Processing line: ~ circle.previous_floor = circle.floor || {}~ - Inside source: true *** True Line Result - [4214, 5072, 64, 64], -** Processing line: ~ [4211, 5043, 64, 64],~ + circle.previous_floor = circle.floor || {} +** Processing line: ~ circle.floor = impact_history_entry[:body][:new_floor] || {}~ - Inside source: true *** True Line Result - [4211, 5043, 64, 64], -** Processing line: ~ [4166, 5073, 64, 64],~ + circle.floor = impact_history_entry[:body][:new_floor] || {} +** Processing line: ~ circle.floor_point = impact_history_entry[:impact][:point]~ - Inside source: true *** True Line Result - [4166, 5073, 64, 64], -** Processing line: ~ [4164, 5041, 64, 64],~ + circle.floor_point = impact_history_entry[:impact][:point] +** Processing line: ~ if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)~ - Inside source: true *** True Line Result - [4164, 5041, 64, 64], -** Processing line: ~ [4844, 5216, 64, 64],~ + if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2) +** Processing line: ~ new_relative_x = if circle.dx > 0~ - Inside source: true *** True Line Result - [4844, 5216, 64, 64], -** Processing line: ~ [4844, 5189, 64, 64],~ + new_relative_x = if circle.dx > 0 +** Processing line: ~ :right~ - Inside source: true *** True Line Result - [4844, 5189, 64, 64], -** Processing line: ~ [4785, 5217, 64, 64],~ + :right +** Processing line: ~ elsif circle.dx < 0~ - Inside source: true *** True Line Result - [4785, 5217, 64, 64], -** Processing line: ~ [4790, 5187, 64, 64],~ + elsif circle.dx < 0 +** Processing line: ~ :left~ - Inside source: true *** True Line Result - [4790, 5187, 64, 64], -** Processing line: ~ [4726, 5219, 64, 64],~ + :left +** Processing line: ~ else~ - Inside source: true *** True Line Result - [4726, 5219, 64, 64], -** Processing line: ~ [4728, 5185, 64, 64],~ + else +** Processing line: ~ nil~ - Inside source: true *** True Line Result - [4728, 5185, 64, 64], -** Processing line: ~ [4681, 5218, 64, 64],~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4681, 5218, 64, 64], -** Processing line: ~ [4684, 5186, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4684, 5186, 64, 64], -** Processing line: ~ [4789, 4926, 64, 64],~ + +** Processing line: ~ new_relative_y = if circle.dy > 0~ - Inside source: true *** True Line Result - [4789, 4926, 64, 64], -** Processing line: ~ [4734, 4928, 64, 64],~ + new_relative_y = if circle.dy > 0 +** Processing line: ~ :above~ - Inside source: true *** True Line Result - [4734, 4928, 64, 64], -** Processing line: ~ [4787, 4876, 64, 64],~ + :above +** Processing line: ~ elsif circle.dy < 0~ - Inside source: true *** True Line Result - [4787, 4876, 64, 64], -** Processing line: ~ [4738, 4874, 64, 64],~ + elsif circle.dy < 0 +** Processing line: ~ :below~ - Inside source: true *** True Line Result - [4738, 4874, 64, 64], -** Processing line: ~ [4775, 5548, 64, 64],~ + :below +** Processing line: ~ else~ - Inside source: true *** True Line Result - [4775, 5548, 64, 64], -** Processing line: ~ [4775, 5495, 64, 64],~ + else +** Processing line: ~ nil~ - Inside source: true *** True Line Result - [4775, 5495, 64, 64], -** Processing line: ~ [4723, 5550, 64, 64],~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4723, 5550, 64, 64], -** Processing line: ~ [4725, 5494, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [4725, 5494, 64, 64], -** Processing line: ~ [1360, 5269, 64, 64],~ + +** Processing line: ~ circle.floor_relative_x = new_relative_x~ - Inside source: true *** True Line Result - [1360, 5269, 64, 64], -** Processing line: ~ [1362, 5218, 64, 64],~ + circle.floor_relative_x = new_relative_x +** Processing line: ~ circle.floor_relative_y = new_relative_y~ - Inside source: true *** True Line Result - [1362, 5218, 64, 64], -** Processing line: ~ [1315, 5266, 64, 64],~ + circle.floor_relative_y = new_relative_y +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1315, 5266, 64, 64], -** Processing line: ~ [1282, 5266, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1282, 5266, 64, 64], -** Processing line: ~ [1246, 5311, 64, 64],~ + +** Processing line: ~ circle.impact = nil~ - Inside source: true *** True Line Result - [1246, 5311, 64, 64], -** Processing line: ~ [1190, 5312, 64, 64],~ + circle.impact = nil +** Processing line: ~ circle.terrains_to_monitor.clear~ - Inside source: true *** True Line Result - [1190, 5312, 64, 64], -** Processing line: ~ [1136, 5310, 64, 64],~ + circle.terrains_to_monitor.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1136, 5310, 64, 64], -** Processing line: ~ [1121, 5427, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1121, 5427, 64, 64], -** Processing line: ~ [1121, 5370, 64, 64],~ + +** Processing line: ~ def calc_physics~ - Inside source: true *** True Line Result - [1121, 5370, 64, 64], -** Processing line: ~ [1074, 5427, 64, 64],~ + def calc_physics +** Processing line: ~ if args.state.god_mode~ - Inside source: true *** True Line Result - [1074, 5427, 64, 64], -** Processing line: ~ [1064, 5423, 64, 64],~ + if args.state.god_mode +** Processing line: ~ calc_potential_impacts~ - Inside source: true *** True Line Result - [1064, 5423, 64, 64], -** Processing line: ~ [1052, 5417, 64, 64],~ + calc_potential_impacts +** Processing line: ~ calc_terrains_to_monitor~ - Inside source: true *** True Line Result - [1052, 5417, 64, 64], -** Processing line: ~ [1050, 5368, 64, 64],~ + calc_terrains_to_monitor +** Processing line: ~ return~ - Inside source: true *** True Line Result - [1050, 5368, 64, 64], -** Processing line: ~ [1008, 5314, 64, 64],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1008, 5314, 64, 64], -** Processing line: ~ [997, 5307, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [997, 5307, 64, 64], -** Processing line: ~ [977, 5299, 64, 64],~ + +** Processing line: ~ if circle.y < -700~ - Inside source: true *** True Line Result - [977, 5299, 64, 64], -** Processing line: ~ [976, 5248, 64, 64],~ + if circle.y < -700 +** Processing line: ~ game_over~ - Inside source: true *** True Line Result - [976, 5248, 64, 64], -** Processing line: ~ [825, 5267, 64, 64],~ + game_over +** Processing line: ~ return~ - Inside source: true *** True Line Result - [825, 5267, 64, 64], -** Processing line: ~ [826, 5213, 64, 64],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - [826, 5213, 64, 64], -** Processing line: ~ [776, 5267, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [776, 5267, 64, 64], -** Processing line: ~ [768, 5261, 64, 64],~ + +** Processing line: ~ return if state.game_over~ - Inside source: true *** True Line Result - [768, 5261, 64, 64], -** Processing line: ~ [755, 5256, 64, 64],~ + return if state.game_over +** Processing line: ~ return if circle.on_floor~ - Inside source: true *** True Line Result - [755, 5256, 64, 64], -** Processing line: ~ [753, 5209, 64, 64],~ + return if circle.on_floor +** Processing line: ~ circle.previous_dy = circle.dy~ - Inside source: true *** True Line Result - [753, 5209, 64, 64], -** Processing line: ~ [1299, 5206, 64, 64],~ + circle.previous_dy = circle.dy +** Processing line: ~ circle.previous_dx = circle.dx~ - Inside source: true *** True Line Result - [1299, 5206, 64, 64], -** Processing line: ~ [1238, 5204, 64, 64],~ + circle.previous_dx = circle.dx +** Processing line: ~ circle.x += circle.dx~ - Inside source: true *** True Line Result - [1238, 5204, 64, 64], -** Processing line: ~ [1178, 5203, 64, 64],~ + circle.x += circle.dx +** Processing line: ~ circle.y += circle.dy~ - Inside source: true *** True Line Result - [1178, 5203, 64, 64], -** Processing line: ~ [1124, 5204, 64, 64],~ + circle.y += circle.dy +** Processing line: ~ args.state.distance_traveled ||= 0~ - Inside source: true *** True Line Result - [1124, 5204, 64, 64], -** Processing line: ~ [1065, 5206, 64, 64],~ + args.state.distance_traveled ||= 0 +** Processing line: ~ args.state.distance_traveled += circle.dx.abs + circle.dy.abs~ - Inside source: true *** True Line Result - [1065, 5206, 64, 64], -** Processing line: ~ [1008, 5203, 64, 64],~ + args.state.distance_traveled += circle.dx.abs + circle.dy.abs +** Processing line: ~ circle.dy += state.gravity~ - Inside source: true *** True Line Result - [1008, 5203, 64, 64], -** Processing line: ~ [977, 5214, 64, 64],~ + circle.dy += state.gravity +** Processing line: ~ calc_potential_impacts~ - Inside source: true *** True Line Result - [977, 5214, 64, 64], -** Processing line: ~ [410, 5313, 64, 64],~ + calc_potential_impacts +** Processing line: ~ calc_terrains_to_monitor~ - Inside source: true *** True Line Result - [410, 5313, 64, 64], -** Processing line: ~ [407, 5249, 64, 64],~ + calc_terrains_to_monitor +** Processing line: ~ return unless circle.impact~ - Inside source: true *** True Line Result - [407, 5249, 64, 64], -** Processing line: ~ [411, 5225, 64, 64],~ + return unless circle.impact +** Processing line: ~ if circle.impact && circle.impact[:type] == :lava~ - Inside source: true *** True Line Result - [411, 5225, 64, 64], -** Processing line: ~ [397, 5217, 64, 64],~ + if circle.impact && circle.impact[:type] == :lava +** Processing line: ~ game_over!~ - Inside source: true *** True Line Result - [397, 5217, 64, 64], -** Processing line: ~ [378, 5209, 64, 64],~ + game_over! +** Processing line: ~ else~ - Inside source: true *** True Line Result - [378, 5209, 64, 64], -** Processing line: ~ [358, 5312, 64, 64],~ + else +** Processing line: ~ not_game_over!~ - Inside source: true *** True Line Result - [358, 5312, 64, 64], -** Processing line: ~ [287, 5427, 64, 64],~ + not_game_over! +** Processing line: ~ end~ - Inside source: true *** True Line Result - [287, 5427, 64, 64], -** Processing line: ~ [286, 5364, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [286, 5364, 64, 64], -** Processing line: ~ [300, 5313, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [300, 5313, 64, 64], -** Processing line: ~ [242, 5427, 64, 64],~ + +** Processing line: ~ def input_god_mode~ - Inside source: true *** True Line Result - [242, 5427, 64, 64], -** Processing line: ~ [229, 5420, 64, 64],~ + def input_god_mode +** Processing line: ~ state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash~ - Inside source: true *** True Line Result - [229, 5420, 64, 64], -** Processing line: ~ [217, 5416, 64, 64],~ + state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash +** Processing line: ~~ - Inside source: true *** True Line Result - [217, 5416, 64, 64], -** Processing line: ~ [215, 5364, 64, 64],~ + +** Processing line: ~ # toggle god mode~ - Inside source: true *** True Line Result - [215, 5364, 64, 64], -** Processing line: ~ [174, 5311, 64, 64],~ + # toggle god mode +** Processing line: ~ if inputs.keyboard.key_down.g~ - Inside source: true *** True Line Result - [174, 5311, 64, 64], -** Processing line: ~ [165, 5308, 64, 64],~ + if inputs.keyboard.key_down.g +** Processing line: ~ state.god_mode = !state.god_mode~ - Inside source: true *** True Line Result - [165, 5308, 64, 64], -** Processing line: ~ [139, 5300, 64, 64],~ + state.god_mode = !state.god_mode +** Processing line: ~ state.potential_lift = 0~ - Inside source: true *** True Line Result - [139, 5300, 64, 64], -** Processing line: ~ [141, 5236, 64, 64],~ + state.potential_lift = 0 +** Processing line: ~ circle.floor = nil~ - Inside source: true *** True Line Result - [141, 5236, 64, 64], -** Processing line: ~ [141, 5211, 64, 64],~ + circle.floor = nil +** Processing line: ~ circle.floor_point = nil~ - Inside source: true *** True Line Result - [141, 5211, 64, 64], -** Processing line: ~ [315, 5208, 64, 64],~ + circle.floor_point = nil +** Processing line: ~ circle.floor_relative_x = nil~ - Inside source: true *** True Line Result - [315, 5208, 64, 64], -** Processing line: ~ [251, 5208, 64, 64],~ + circle.floor_relative_x = nil +** Processing line: ~ circle.floor_relative_y = nil~ - Inside source: true *** True Line Result - [251, 5208, 64, 64], -** Processing line: ~ [211, 5211, 64, 64],~ + circle.floor_relative_y = nil +** Processing line: ~ circle.impact = nil~ - Inside source: true *** True Line Result - [211, 5211, 64, 64], -** Processing line: ~ [8050, 4060, 64, 64],~ + circle.impact = nil +** Processing line: ~ circle.terrains_to_monitor.clear~ - Inside source: true *** True Line Result - [8050, 4060, 64, 64], -** Processing line: ~ [7992, 4060, 64, 64],~ + circle.terrains_to_monitor.clear +** Processing line: ~ return~ - Inside source: true *** True Line Result - [7992, 4060, 64, 64], -** Processing line: ~ [7929, 4060, 64, 64],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7929, 4060, 64, 64], -** Processing line: ~ [7866, 4061, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7866, 4061, 64, 64], -** Processing line: ~ [7828, 4063, 64, 64],~ + +** Processing line: ~ return unless state.god_mode~ - Inside source: true *** True Line Result - [7828, 4063, 64, 64], -** Processing line: ~ [7934, 4001, 64, 64],~ + return unless state.god_mode +** Processing line: ~~ - Inside source: true *** True Line Result - [7934, 4001, 64, 64], -** Processing line: ~ [7935, 3936, 64, 64],~ + +** Processing line: ~ circle.x = circle.x.to_i~ - Inside source: true *** True Line Result - [7935, 3936, 64, 64], -** Processing line: ~ [7935, 3875, 64, 64],~ + circle.x = circle.x.to_i +** Processing line: ~ circle.y = circle.y.to_i~ - Inside source: true *** True Line Result - [7935, 3875, 64, 64], -** Processing line: ~ [7622, 4111, 64, 64],~ + circle.y = circle.y.to_i +** Processing line: ~~ - Inside source: true *** True Line Result - [7622, 4111, 64, 64], -** Processing line: ~ [7623, 4049, 64, 64],~ + +** Processing line: ~ # move god circle~ - Inside source: true *** True Line Result - [7623, 4049, 64, 64], -** Processing line: ~ [7707, 4018, 64, 64],~ + # move god circle +** Processing line: ~ if inputs.keyboard.left || inputs.keyboard.a~ - Inside source: true *** True Line Result - [7707, 4018, 64, 64], -** Processing line: ~ [7663, 4019, 64, 64],~ + if inputs.keyboard.left || inputs.keyboard.a +** Processing line: ~ circle.x -= 20~ - Inside source: true *** True Line Result - [7663, 4019, 64, 64], -** Processing line: ~ [7623, 4017, 64, 64],~ + circle.x -= 20 +** Processing line: ~ elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f~ - Inside source: true *** True Line Result - [7623, 4017, 64, 64], -** Processing line: ~ [7193, 4060, 64, 64],~ + elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f +** Processing line: ~ circle.x += 20~ - Inside source: true *** True Line Result - [7193, 4060, 64, 64], -** Processing line: ~ [7131, 4059, 64, 64],~ + circle.x += 20 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7131, 4059, 64, 64], -** Processing line: ~ [7070, 4057, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7070, 4057, 64, 64], -** Processing line: ~ [7008, 4060, 64, 64],~ + +** Processing line: ~ if inputs.keyboard.up || inputs.keyboard.w~ - Inside source: true *** True Line Result - [7008, 4060, 64, 64], -** Processing line: ~ [6977, 4060, 64, 64],~ + if inputs.keyboard.up || inputs.keyboard.w +** Processing line: ~ circle.y += 20~ - Inside source: true *** True Line Result - [6977, 4060, 64, 64], -** Processing line: ~ [7080, 3998, 64, 64],~ + circle.y += 20 +** Processing line: ~ elsif inputs.keyboard.down || inputs.keyboard.s~ - Inside source: true *** True Line Result - [7080, 3998, 64, 64], -** Processing line: ~ [7081, 3935, 64, 64],~ + elsif inputs.keyboard.down || inputs.keyboard.s +** Processing line: ~ circle.y -= 20~ - Inside source: true *** True Line Result - [7081, 3935, 64, 64], -** Processing line: ~ [7080, 3873, 64, 64],~ + circle.y -= 20 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7080, 3873, 64, 64], -** Processing line: ~ [6855, 4019, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6855, 4019, 64, 64], -** Processing line: ~ [6790, 4018, 64, 64],~ + +** Processing line: ~ # delete terrain~ - Inside source: true *** True Line Result - [6790, 4018, 64, 64], -** Processing line: ~ [6770, 4114, 64, 64],~ + # delete terrain +** Processing line: ~ if inputs.keyboard.key_down.x~ - Inside source: true *** True Line Result - [6770, 4114, 64, 64], -** Processing line: ~ [6770, 4060, 64, 64],~ + if inputs.keyboard.key_down.x +** Processing line: ~ calc_terrains_to_monitor~ - Inside source: true *** True Line Result - [6770, 4060, 64, 64], -** Processing line: ~ [6768, 4013, 64, 64],~ + calc_terrains_to_monitor +** Processing line: ~ state.terrain = state.terrain.reject do |t|~ - Inside source: true *** True Line Result - [6768, 4013, 64, 64], -** Processing line: ~ [6345, 4060, 64, 64],~ + state.terrain = state.terrain.reject do |t| +** Processing line: ~ t[:rect].intersect_rect? circle.rect~ - Inside source: true *** True Line Result - [6345, 4060, 64, 64], -** Processing line: ~ [6284, 4062, 64, 64],~ + t[:rect].intersect_rect? circle.rect +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6284, 4062, 64, 64], -** Processing line: ~ [6222, 4061, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6222, 4061, 64, 64], -** Processing line: ~ [6166, 4061, 64, 64],~ + +** Processing line: ~ state.lava = state.lava.reject do |t|~ - Inside source: true *** True Line Result - [6166, 4061, 64, 64], -** Processing line: ~ [6124, 4066, 64, 64],~ + state.lava = state.lava.reject do |t| +** Processing line: ~ t[:rect].intersect_rect? circle.rect~ - Inside source: true *** True Line Result - [6124, 4066, 64, 64], -** Processing line: ~ [6226, 3995, 64, 64],~ + t[:rect].intersect_rect? circle.rect +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6226, 3995, 64, 64], -** Processing line: ~ [6226, 3933, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6226, 3933, 64, 64], -** Processing line: ~ [6228, 3868, 64, 64],~ + +** Processing line: ~ calc_potential_impacts~ - Inside source: true *** True Line Result - [6228, 3868, 64, 64], -** Processing line: ~ [5916, 4113, 64, 64],~ + calc_potential_impacts +** Processing line: ~ save_level~ - Inside source: true *** True Line Result - [5916, 4113, 64, 64], -** Processing line: ~ [5918, 4052, 64, 64],~ + save_level +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5918, 4052, 64, 64], -** Processing line: ~ [6001, 4018, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6001, 4018, 64, 64], -** Processing line: ~ [5941, 4019, 64, 64],~ + +** Processing line: ~ # change terrain type~ - Inside source: true *** True Line Result - [5941, 4019, 64, 64], -** Processing line: ~ [5918, 4020, 64, 64],~ + # change terrain type +** Processing line: ~ if inputs.keyboard.key_down.l~ - Inside source: true *** True Line Result - [5918, 4020, 64, 64], -** Processing line: ~ [5501, 4059, 64, 64],~ + if inputs.keyboard.key_down.l +** Processing line: ~ if state.line_mode == :terrain~ - Inside source: true *** True Line Result - [5501, 4059, 64, 64], -** Processing line: ~ [5439, 4061, 64, 64],~ + if state.line_mode == :terrain +** Processing line: ~ state.line_mode = :lava~ - Inside source: true *** True Line Result - [5439, 4061, 64, 64], -** Processing line: ~ [5376, 4059, 64, 64],~ + state.line_mode = :lava +** Processing line: ~ else~ - Inside source: true *** True Line Result - [5376, 4059, 64, 64], -** Processing line: ~ [5312, 4058, 64, 64],~ + else +** Processing line: ~ state.line_mode = :terrain~ - Inside source: true *** True Line Result - [5312, 4058, 64, 64], -** Processing line: ~ [5285, 4062, 64, 64],~ + state.line_mode = :terrain +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5285, 4062, 64, 64], -** Processing line: ~ [5388, 3999, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5388, 3999, 64, 64], -** Processing line: ~ [5385, 3941, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5385, 3941, 64, 64], -** Processing line: ~ [5384, 3874, 64, 64],~ + +** Processing line: ~ if inputs.mouse.click && !state.point_one~ - Inside source: true *** True Line Result - [5384, 3874, 64, 64], -** Processing line: ~ [5075, 4112, 64, 64],~ + if inputs.mouse.click && !state.point_one +** Processing line: ~ state.point_one = inputs.mouse.click.point~ - Inside source: true *** True Line Result - [5075, 4112, 64, 64], -** Processing line: ~ [5074, 4051, 64, 64],~ + state.point_one = inputs.mouse.click.point +** Processing line: ~ elsif inputs.mouse.click && state.point_one~ - Inside source: true *** True Line Result - [5074, 4051, 64, 64], -** Processing line: ~ [5158, 4018, 64, 64],~ + elsif inputs.mouse.click && state.point_one +** Processing line: ~ l = [*state.point_one, *inputs.mouse.click.point]~ - Inside source: true *** True Line Result - [5158, 4018, 64, 64], -** Processing line: ~ [5095, 4020, 64, 64],~ + l = [*state.point_one, *inputs.mouse.click.point] +** Processing line: ~ l = [l.x - state.camera.x,~ - Inside source: true *** True Line Result - [5095, 4020, 64, 64], -** Processing line: ~ [5073, 4018, 64, 64],~ + l = [l.x - state.camera.x, +** Processing line: ~ l.y - state.camera.y,~ - Inside source: true *** True Line Result - [5073, 4018, 64, 64], -** Processing line: ~ [4549, 3998, 64, 64],~ + l.y - state.camera.y, +** Processing line: ~ l.x2 - state.camera.x,~ - Inside source: true *** True Line Result - [4549, 3998, 64, 64], -** Processing line: ~ [4393, 3996, 64, 64],~ + l.x2 - state.camera.x, +** Processing line: ~ l.y2 - state.camera.y].line.to_hash~ - Inside source: true *** True Line Result - [4393, 3996, 64, 64], -** Processing line: ~ [4547, 3938, 64, 64],~ + l.y2 - state.camera.y].line.to_hash +** Processing line: ~ l[:rect] = rect_for_line l~ - Inside source: true *** True Line Result - [4547, 3938, 64, 64], -** Processing line: ~ [4547, 3886, 64, 64],~ + l[:rect] = rect_for_line l +** Processing line: ~ if state.line_mode == :terrain~ - Inside source: true *** True Line Result - [4547, 3886, 64, 64], -** Processing line: ~ [4488, 3885, 64, 64],~ + if state.line_mode == :terrain +** Processing line: ~ state.terrain << l~ - Inside source: true *** True Line Result - [4488, 3885, 64, 64], -** Processing line: ~ [4427, 3885, 64, 64],~ + state.terrain << l +** Processing line: ~ else~ - Inside source: true *** True Line Result - [4427, 3885, 64, 64], -** Processing line: ~ [4395, 3938, 64, 64],~ + else +** Processing line: ~ state.lava << l~ - Inside source: true *** True Line Result - [4395, 3938, 64, 64], -** Processing line: ~ [4395, 3885, 64, 64],~ + state.lava << l +** Processing line: ~ end~ - Inside source: true *** True Line Result - [4395, 3885, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + end +** Processing line: ~ save_level~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + save_level +** Processing line: ~ next_x = inputs.mouse.click.point.x - 640~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + next_x = inputs.mouse.click.point.x - 640 +** Processing line: ~ next_y = inputs.mouse.click.point.y - 360~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + next_y = inputs.mouse.click.point.y - 360 +** Processing line: ~ circle.x += next_x~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + circle.x += next_x +** Processing line: ~ circle.y += next_y~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + circle.y += next_y +** Processing line: ~ state.point_one = nil~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + state.point_one = nil +** Processing line: ~ elsif inputs.keyboard.one~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + elsif inputs.keyboard.one +** Processing line: ~ state.point_one = [circle.x + camera.x, circle.y+ camera.y]~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + state.point_one = [circle.x + camera.x, circle.y+ camera.y] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [1215, 2421, 64, 64],~ + +** Processing line: ~ # cancel chain lines~ - Inside source: true *** True Line Result - [1215, 2421, 64, 64], -** Processing line: ~ [1214, 2360, 64, 64],~ + # cancel chain lines +** Processing line: ~ if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one~ - Inside source: true *** True Line Result - [1214, 2360, 64, 64], -** Processing line: ~ [1211, 2300, 64, 64],~ + if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one +** Processing line: ~ state.point_one = nil~ - Inside source: true *** True Line Result - [1211, 2300, 64, 64], -** Processing line: ~ [1211, 2291, 64, 64],~ + state.point_one = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1211, 2291, 64, 64], -** Processing line: ~ [1158, 2420, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1158, 2420, 64, 64], -** Processing line: ~ [1156, 2358, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1156, 2358, 64, 64], -** Processing line: ~ [1149, 2291, 64, 64],~ + +** Processing line: ~ def play_sound~ - Inside source: true *** True Line Result - [1149, 2291, 64, 64], -** Processing line: ~ [1095, 2420, 64, 64],~ + def play_sound +** Processing line: ~ return if state.sound_debounce > 0~ - Inside source: true *** True Line Result - [1095, 2420, 64, 64], -** Processing line: ~ [1030, 2418, 64, 64],~ + return if state.sound_debounce > 0 +** Processing line: ~ state.sound_debounce = 5~ - Inside source: true *** True Line Result - [1030, 2418, 64, 64], -** Processing line: ~ [966, 2419, 64, 64],~ + state.sound_debounce = 5 +** Processing line: ~ outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"~ - Inside source: true *** True Line Result - [966, 2419, 64, 64], -** Processing line: ~ [903, 2419, 64, 64],~ + outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav" +** Processing line: ~ state.sound_index += 1~ - Inside source: true *** True Line Result - [903, 2419, 64, 64], -** Processing line: ~ [852, 2419, 64, 64],~ + state.sound_index += 1 +** Processing line: ~ if state.sound_index > 21~ - Inside source: true *** True Line Result - [852, 2419, 64, 64], -** Processing line: ~ [1087, 2291, 64, 64],~ + if state.sound_index > 21 +** Processing line: ~ state.sound_index = 1~ - Inside source: true *** True Line Result - [1087, 2291, 64, 64], -** Processing line: ~ [1023, 2291, 64, 64],~ + state.sound_index = 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1023, 2291, 64, 64], -** Processing line: ~ [960, 2291, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [960, 2291, 64, 64], -** Processing line: ~ [896, 2292, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [896, 2292, 64, 64], -** Processing line: ~ [854, 2355, 64, 64],~ + +** Processing line: ~ def input_game~ - Inside source: true *** True Line Result - [854, 2355, 64, 64], -** Processing line: ~ [854, 2292, 64, 64],~ + def input_game +** Processing line: ~ if inputs.keyboard.down || inputs.keyboard.space~ - Inside source: true *** True Line Result - [854, 2292, 64, 64], -** Processing line: ~ [675, 3017, 64, 64],~ + if inputs.keyboard.down || inputs.keyboard.space +** Processing line: ~ circle.potential_lift += 0.03~ - Inside source: true *** True Line Result - [675, 3017, 64, 64], -** Processing line: ~ [622, 3017, 64, 64],~ + circle.potential_lift += 0.03 +** Processing line: ~ circle.potential_lift = circle.potential_lift.lesser(10)~ - Inside source: true *** True Line Result - [622, 3017, 64, 64], -** Processing line: ~ [676, 2965, 64, 64],~ + circle.potential_lift = circle.potential_lift.lesser(10) +** Processing line: ~ elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space~ - Inside source: true *** True Line Result - [676, 2965, 64, 64], -** Processing line: ~ [622, 2965, 64, 64],~ + elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space +** Processing line: ~ play_sound~ - Inside source: true *** True Line Result - [622, 2965, 64, 64], -** Processing line: ~ [1560, 3212, 64, 64],~ + play_sound +** Processing line: ~ circle.dy += circle.angle.vector_y circle.potential_lift~ - Inside source: true *** True Line Result - [1560, 3212, 64, 64], -** Processing line: ~ [1496, 3212, 64, 64],~ + circle.dy += circle.angle.vector_y circle.potential_lift +** Processing line: ~ circle.dx += circle.angle.vector_x circle.potential_lift~ - Inside source: true *** True Line Result - [1496, 3212, 64, 64], -** Processing line: ~ [1430, 3211, 64, 64],~ + circle.dx += circle.angle.vector_x circle.potential_lift +** Processing line: ~~ - Inside source: true *** True Line Result - [1430, 3211, 64, 64], -** Processing line: ~ [1346, 3214, 64, 64],~ + +** Processing line: ~ if circle.on_floor~ - Inside source: true *** True Line Result - [1346, 3214, 64, 64], -** Processing line: ~ [1410, 3213, 64, 64],~ + if circle.on_floor +** Processing line: ~ if circle.floor_relative_y == :above~ - Inside source: true *** True Line Result - [1410, 3213, 64, 64], -** Processing line: ~ [1560, 3147, 64, 64],~ + if circle.floor_relative_y == :above +** Processing line: ~ circle.y += circle.potential_lift.abs * 2~ - Inside source: true *** True Line Result - [1560, 3147, 64, 64], -** Processing line: ~ [1559, 3105, 64, 64],~ + circle.y += circle.potential_lift.abs * 2 +** Processing line: ~ elsif circle.floor_relative_y == :below~ - Inside source: true *** True Line Result - [1559, 3105, 64, 64], -** Processing line: ~ [1496, 3105, 64, 64],~ + elsif circle.floor_relative_y == :below +** Processing line: ~ circle.y -= circle.potential_lift.abs * 2~ - Inside source: true *** True Line Result - [1496, 3105, 64, 64], -** Processing line: ~ [1442, 3105, 64, 64],~ + circle.y -= circle.potential_lift.abs * 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1442, 3105, 64, 64], -** Processing line: ~ [1412, 3106, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [1412, 3106, 64, 64], -** Processing line: ~ [918, 4163, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [918, 4163, 64, 64], -** Processing line: ~ [854, 4161, 64, 64],~ + +** Processing line: ~ circle.on_floor = false~ - Inside source: true *** True Line Result - [854, 4161, 64, 64], -** Processing line: ~ [792, 4160, 64, 64],~ + circle.on_floor = false +** Processing line: ~ circle.potential_lift = 0~ - Inside source: true *** True Line Result - [792, 4160, 64, 64], -** Processing line: ~ [729, 4159, 64, 64],~ + circle.potential_lift = 0 +** Processing line: ~ circle.terrains_to_monitor.clear~ - Inside source: true *** True Line Result - [729, 4159, 64, 64], -** Processing line: ~ [666, 4158, 64, 64],~ + circle.terrains_to_monitor.clear +** Processing line: ~ circle.impact_history.clear~ - Inside source: true *** True Line Result - [666, 4158, 64, 64], -** Processing line: ~ [601, 4158, 64, 64],~ + circle.impact_history.clear +** Processing line: ~ circle.impact = nil~ - Inside source: true *** True Line Result - [601, 4158, 64, 64], -** Processing line: ~ [537, 4156, 64, 64],~ + circle.impact = nil +** Processing line: ~ calc_physics~ - Inside source: true *** True Line Result - [537, 4156, 64, 64], -** Processing line: ~ [918, 4137, 64, 64],~ + calc_physics +** Processing line: ~ end~ - Inside source: true *** True Line Result - [918, 4137, 64, 64], -** Processing line: ~ [854, 4137, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [854, 4137, 64, 64], -** Processing line: ~ [789, 4136, 64, 64],~ + +** Processing line: ~ # aim probe~ - Inside source: true *** True Line Result - [789, 4136, 64, 64], -** Processing line: ~ [726, 4137, 64, 64],~ + # aim probe +** Processing line: ~ if inputs.keyboard.right || inputs.keyboard.a~ - Inside source: true *** True Line Result - [726, 4137, 64, 64], -** Processing line: ~ [661, 4137, 64, 64],~ + if inputs.keyboard.right || inputs.keyboard.a +** Processing line: ~ circle.angle -= 2~ - Inside source: true *** True Line Result - [661, 4137, 64, 64], -** Processing line: ~ [599, 4139, 64, 64],~ + circle.angle -= 2 +** Processing line: ~ elsif inputs.keyboard.left || inputs.keyboard.d~ - Inside source: true *** True Line Result - [599, 4139, 64, 64], -** Processing line: ~ [538, 4137, 64, 64],~ + elsif inputs.keyboard.left || inputs.keyboard.d +** Processing line: ~ circle.angle += 2~ - Inside source: true *** True Line Result - [538, 4137, 64, 64], -** Processing line: ~ [5378, 4254, 64, 64],~ + circle.angle += 2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5378, 4254, 64, 64], -** Processing line: ~ [5440, 4204, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5440, 4204, 64, 64], -** Processing line: ~ [5405, 4214, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5405, 4214, 64, 64], -** Processing line: ~ [5350, 4254, 64, 64],~ + +** Processing line: ~ def input~ - Inside source: true *** True Line Result - [5350, 4254, 64, 64], -** Processing line: ~ [5439, 4177, 64, 64],~ + def input +** Processing line: ~ input_god_mode~ - Inside source: true *** True Line Result - [5439, 4177, 64, 64], -** Processing line: ~ [5413, 4173, 64, 64],~ + input_god_mode +** Processing line: ~ input_game~ - Inside source: true *** True Line Result - [5413, 4173, 64, 64], -** Processing line: ~ [5399, 4128, 64, 64],~ + input_game +** Processing line: ~ end~ - Inside source: true *** True Line Result - [5399, 4128, 64, 64], -** Processing line: ~ [5352, 4200, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [5352, 4200, 64, 64], -** Processing line: ~ [5352, 4158, 64, 64],~ + +** Processing line: ~ def calc_camera~ - Inside source: true *** True Line Result - [5352, 4158, 64, 64], -** Processing line: ~ [5392, 4130, 64, 64],~ + def calc_camera +** Processing line: ~ state.camera.target_x = 640 - circle.x~ - Inside source: true *** True Line Result - [5392, 4130, 64, 64], -** Processing line: ~ [6216, 4251, 64, 64],~ + state.camera.target_x = 640 - circle.x +** Processing line: ~ state.camera.target_y = 360 - circle.y~ - Inside source: true *** True Line Result - [6216, 4251, 64, 64], -** Processing line: ~ [6190, 4251, 64, 64],~ + state.camera.target_y = 360 - circle.y +** Processing line: ~ xdiff = state.camera.target_x - state.camera.x~ - Inside source: true *** True Line Result - [6190, 4251, 64, 64], -** Processing line: ~ [6279, 4200, 64, 64],~ + xdiff = state.camera.target_x - state.camera.x +** Processing line: ~ ydiff = state.camera.target_y - state.camera.y~ - Inside source: true *** True Line Result - [6279, 4200, 64, 64], -** Processing line: ~ [6262, 4205, 64, 64],~ + ydiff = state.camera.target_y - state.camera.y +** Processing line: ~ state.camera.x += xdiff * camera.follow_speed~ - Inside source: true *** True Line Result - [6262, 4205, 64, 64], -** Processing line: ~ [6233, 4214, 64, 64],~ + state.camera.x += xdiff * camera.follow_speed +** Processing line: ~ state.camera.y += ydiff * camera.follow_speed~ - Inside source: true *** True Line Result - [6233, 4214, 64, 64], -** Processing line: ~ [6280, 4172, 64, 64],~ + state.camera.y += ydiff * camera.follow_speed +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6280, 4172, 64, 64], -** Processing line: ~ [6256, 4169, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [6256, 4169, 64, 64], -** Processing line: ~ [6239, 4128, 64, 64],~ + +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - [6239, 4128, 64, 64], -** Processing line: ~ [6231, 4128, 64, 64],~ + def calc +** Processing line: ~ state.sound_debounce ||= 0~ - Inside source: true *** True Line Result - [6231, 4128, 64, 64], -** Processing line: ~ [6191, 4195, 64, 64],~ + state.sound_debounce ||= 0 +** Processing line: ~ state.sound_debounce -= 1~ - Inside source: true *** True Line Result - [6191, 4195, 64, 64], -** Processing line: ~ [6190, 4158, 64, 64],~ + state.sound_debounce -= 1 +** Processing line: ~ state.sound_debounce = 0 if state.sound_debounce < 0~ - Inside source: true *** True Line Result - [6190, 4158, 64, 64], -** Processing line: ~ [7072, 4250, 64, 64],~ + state.sound_debounce = 0 if state.sound_debounce < 0 +** Processing line: ~ if state.god_mode~ - Inside source: true *** True Line Result - [7072, 4250, 64, 64], -** Processing line: ~ [7046, 4250, 64, 64],~ + if state.god_mode +** Processing line: ~ circle.dy *= 0.1~ - Inside source: true *** True Line Result - [7046, 4250, 64, 64], -** Processing line: ~ [7133, 4202, 64, 64],~ + circle.dy *= 0.1 +** Processing line: ~ circle.dx *= 0.1~ - Inside source: true *** True Line Result - [7133, 4202, 64, 64], -** Processing line: ~ [7107, 4209, 64, 64],~ + circle.dx *= 0.1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7107, 4209, 64, 64], -** Processing line: ~ [7086, 4214, 64, 64],~ + end +** Processing line: ~ calc_camera~ - Inside source: true *** True Line Result - [7086, 4214, 64, 64], -** Processing line: ~ [7133, 4173, 64, 64],~ + calc_camera +** Processing line: ~ state.whisp_queue ||= []~ - Inside source: true *** True Line Result - [7133, 4173, 64, 64], -** Processing line: ~ [7108, 4169, 64, 64],~ + state.whisp_queue ||= [] +** Processing line: ~ if state.tick_count.mod_zero?(4)~ - Inside source: true *** True Line Result - [7108, 4169, 64, 64], -** Processing line: ~ [7092, 4127, 64, 64],~ + if state.tick_count.mod_zero?(4) +** Processing line: ~ state.whisp_queue << {~ - Inside source: true *** True Line Result - [7092, 4127, 64, 64], -** Processing line: ~ [7084, 4128, 64, 64],~ + state.whisp_queue << { +** Processing line: ~ x: -300,~ - Inside source: true *** True Line Result - [7084, 4128, 64, 64], -** Processing line: ~ [7047, 4191, 64, 64],~ + x: -300, +** Processing line: ~ y: 1400 * rand,~ - Inside source: true *** True Line Result - [7047, 4191, 64, 64], -** Processing line: ~ [7047, 4156, 64, 64],~ + y: 1400 * rand, +** Processing line: ~ speed: 2.randomize(:ratio) + 3,~ - Inside source: true *** True Line Result - [7047, 4156, 64, 64], -** Processing line: ~ [7926, 4252, 64, 64],~ + speed: 2.randomize(:ratio) + 3, +** Processing line: ~ w: 20,~ - Inside source: true *** True Line Result - [7926, 4252, 64, 64], -** Processing line: ~ [7900, 4253, 64, 64],~ + w: 20, +** Processing line: ~ h: 20, path: 'sprites/whisp.png',~ - Inside source: true *** True Line Result - [7900, 4253, 64, 64], -** Processing line: ~ [7987, 4202, 64, 64],~ + h: 20, path: 'sprites/whisp.png', +** Processing line: ~ a: 0,~ - Inside source: true *** True Line Result - [7987, 4202, 64, 64], -** Processing line: ~ [7965, 4209, 64, 64],~ + a: 0, +** Processing line: ~ created_at: state.tick_count,~ - Inside source: true *** True Line Result - [7965, 4209, 64, 64], -** Processing line: ~ [7942, 4216, 64, 64],~ + created_at: state.tick_count, +** Processing line: ~ angle: 0,~ - Inside source: true *** True Line Result - [7942, 4216, 64, 64], -** Processing line: ~ [7989, 4174, 64, 64],~ + angle: 0, +** Processing line: ~ r: 100,~ - Inside source: true *** True Line Result - [7989, 4174, 64, 64], -** Processing line: ~ [7970, 4170, 64, 64],~ + r: 100, +** Processing line: ~ g: 128 + 128 * rand,~ - Inside source: true *** True Line Result - [7970, 4170, 64, 64], -** Processing line: ~ [7949, 4126, 64, 64],~ + g: 128 + 128 * rand, +** Processing line: ~ b: 128 + 128 * rand~ - Inside source: true *** True Line Result - [7949, 4126, 64, 64], -** Processing line: ~ [7901, 4196, 64, 64],~ + b: 128 + 128 * rand +** Processing line: ~ }~ - Inside source: true *** True Line Result - [7901, 4196, 64, 64], -** Processing line: ~ [7900, 4159, 64, 64],~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [7900, 4159, 64, 64], -** Processing line: ~ [7941, 4130, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [7941, 4130, 64, 64], -** Processing line: ~ [2847, 379, 64, 64],~ + +** Processing line: ~ state.whisp_queue.each do |w|~ - Inside source: true *** True Line Result - [2847, 379, 64, 64], -** Processing line: ~ [2825, 380, 64, 64],~ + state.whisp_queue.each do |w| +** Processing line: ~ w.x += w[:speed] * 2~ - Inside source: true *** True Line Result - [2825, 380, 64, 64], -** Processing line: ~ [2845, 317, 64, 64],~ + w.x += w[:speed] * 2 +** Processing line: ~ w.x -= circle.dx * 0.3~ - Inside source: true *** True Line Result - [2845, 317, 64, 64], -** Processing line: ~ [2829, 316, 64, 64],~ + w.x -= circle.dx * 0.3 +** Processing line: ~ w.y -= w[:speed]~ - Inside source: true *** True Line Result - [2829, 316, 64, 64], -** Processing line: ~ [2845, 255, 64, 64],~ + w.y -= w[:speed] +** Processing line: ~ w.y -= circle.dy * 0.3~ - Inside source: true *** True Line Result - [2845, 255, 64, 64], -** Processing line: ~ [2830, 257, 64, 64],~ + w.y -= circle.dy * 0.3 +** Processing line: ~ w.angle += w[:speed]~ - Inside source: true *** True Line Result - [2830, 257, 64, 64], -** Processing line: ~ [2845, 202, 64, 64],~ + w.angle += w[:speed] +** Processing line: ~ w.a = w[:created_at].ease(30) * 255~ - Inside source: true *** True Line Result - [2845, 202, 64, 64], -** Processing line: ~ [2829, 198, 64, 64],~ + w.a = w[:created_at].ease(30) * 255 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2829, 198, 64, 64], -** Processing line: ~ [2770, 169, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2770, 169, 64, 64], -** Processing line: ~ [2708, 170, 64, 64],~ + +** Processing line: ~ state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }~ - Inside source: true *** True Line Result - [2708, 170, 64, 64], -** Processing line: ~ [2646, 171, 64, 64],~ + state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 } +** Processing line: ~~ - Inside source: true *** True Line Result - [2646, 171, 64, 64], -** Processing line: ~ [2582, 171, 64, 64],~ + +** Processing line: ~ if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)~ - Inside source: true *** True Line Result - [2582, 171, 64, 64], -** Processing line: ~ [2518, 171, 64, 64],~ + if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0) +** Processing line: ~ circle.after_images << {~ - Inside source: true *** True Line Result - [2518, 171, 64, 64], -** Processing line: ~ [2454, 171, 64, 64],~ + circle.after_images << { +** Processing line: ~ x: circle.x,~ - Inside source: true *** True Line Result - [2454, 171, 64, 64], -** Processing line: ~ [2391, 172, 64, 64],~ + x: circle.x, +** Processing line: ~ y: circle.y,~ - Inside source: true *** True Line Result - [2391, 172, 64, 64], -** Processing line: ~ [2332, 379, 64, 64],~ + y: circle.y, +** Processing line: ~ w: circle.radius,~ - Inside source: true *** True Line Result - [2332, 379, 64, 64], -** Processing line: ~ [2315, 379, 64, 64],~ + w: circle.radius, +** Processing line: ~ h: circle.radius,~ - Inside source: true *** True Line Result - [2315, 379, 64, 64], -** Processing line: ~ [2334, 316, 64, 64],~ + h: circle.radius, +** Processing line: ~ a: 255,~ - Inside source: true *** True Line Result - [2334, 316, 64, 64], -** Processing line: ~ [2315, 317, 64, 64],~ + a: 255, +** Processing line: ~ created_at: state.tick_count~ - Inside source: true *** True Line Result - [2315, 317, 64, 64], -** Processing line: ~ [2332, 254, 64, 64],~ + created_at: state.tick_count +** Processing line: ~ }~ - Inside source: true *** True Line Result - [2332, 254, 64, 64], -** Processing line: ~ [2314, 254, 64, 64],~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2314, 254, 64, 64], -** Processing line: ~ [2335, 192, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2335, 192, 64, 64], -** Processing line: ~ [2311, 192, 64, 64],~ + +** Processing line: ~ circle.after_images.each do |ai|~ - Inside source: true *** True Line Result - [2311, 192, 64, 64], -** Processing line: ~ [2846, 142, 64, 64],~ + circle.after_images.each do |ai| +** Processing line: ~ ai.a = ai[:created_at].ease(10, :flip) * 255~ - Inside source: true *** True Line Result - [2846, 142, 64, 64], -** Processing line: ~ [2784, 140, 64, 64],~ + ai.a = ai[:created_at].ease(10, :flip) * 255 +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2784, 140, 64, 64], -** Processing line: ~ [2846, 79, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2846, 79, 64, 64], -** Processing line: ~ [2847, 41, 64, 64],~ + +** Processing line: ~ circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }~ - Inside source: true *** True Line Result - [2847, 41, 64, 64], -** Processing line: ~ [2783, 80, 64, 64],~ + circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 } +** Processing line: ~ calc_physics~ - Inside source: true *** True Line Result - [2783, 80, 64, 64], -** Processing line: ~ [2790, 39, 64, 64],~ + calc_physics +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2790, 39, 64, 64], -** Processing line: ~ [2727, 41, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2727, 41, 64, 64], -** Processing line: ~ [2665, 43, 64, 64],~ + +** Processing line: ~ def circle~ - Inside source: true *** True Line Result - [2665, 43, 64, 64], -** Processing line: ~ [2605, 43, 64, 64],~ + def circle +** Processing line: ~ state.circle~ - Inside source: true *** True Line Result - [2605, 43, 64, 64], -** Processing line: ~ [2543, 44, 64, 64],~ + state.circle +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2543, 44, 64, 64], -** Processing line: ~ [2480, 45, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2480, 45, 64, 64], -** Processing line: ~ [2419, 45, 64, 64],~ + +** Processing line: ~ def camera~ - Inside source: true *** True Line Result - [2419, 45, 64, 64], -** Processing line: ~ [2357, 44, 64, 64],~ + def camera +** Processing line: ~ state.camera~ - Inside source: true *** True Line Result - [2357, 44, 64, 64], -** Processing line: ~ [2313, 129, 64, 64],~ + state.camera +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2313, 129, 64, 64], -** Processing line: ~ [2313, 70, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2313, 70, 64, 64], -** Processing line: ~ [2314, 40, 64, 64],~ + +** Processing line: ~ def terrain~ - Inside source: true *** True Line Result - [2314, 40, 64, 64], -** Processing line: ~ [2517, 2385, 64, 64],~ + def terrain +** Processing line: ~ state.terrain~ - Inside source: true *** True Line Result - [2517, 2385, 64, 64], -** Processing line: ~ [2452, 2385, 64, 64],~ + state.terrain +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2452, 2385, 64, 64], -** Processing line: ~ [2390, 2386, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2390, 2386, 64, 64], -** Processing line: ~ [2328, 2386, 64, 64],~ + +** Processing line: ~ def lava~ - Inside source: true *** True Line Result - [2328, 2386, 64, 64], -** Processing line: ~ [2264, 2386, 64, 64],~ + def lava +** Processing line: ~ state.lava~ - Inside source: true *** True Line Result - [2264, 2386, 64, 64], -** Processing line: ~ [2200, 2386, 64, 64],~ + state.lava +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2200, 2386, 64, 64], -** Processing line: ~ [2137, 2387, 64, 64],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2137, 2387, 64, 64], -** Processing line: ~ [2071, 2385, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [2071, 2385, 64, 64], -** Processing line: ~ [2016, 2389, 64, 64],~ + +** Processing line: ~ # $gtk.reset~ - Inside source: true *** True Line Result - [2016, 2389, 64, 64], -** Processing line: ~ [2517, 2341, 64, 64],~ + # $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - [2517, 2341, 64, 64], -** Processing line: ~ [2518, 2316, 64, 64],~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - [2518, 2316, 64, 64], -** Processing line: ~ [2456, 2316, 64, 64],~ + def tick args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - [2456, 2316, 64, 64], -** Processing line: ~ [2393, 2316, 64, 64],~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ if args.inputs.keyboard.r~ - Inside source: true *** True Line Result - [2393, 2316, 64, 64], -** Processing line: ~ [2328, 2317, 64, 64],~ + if args.inputs.keyboard.r +** Processing line: ~ args.gtk.reset~ - Inside source: true *** True Line Result - [2328, 2317, 64, 64], -** Processing line: ~ [2264, 2316, 64, 64],~ + args.gtk.reset +** Processing line: ~ return~ - Inside source: true *** True Line Result - [2264, 2316, 64, 64], -** Processing line: ~ [2207, 2318, 64, 64],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - [2207, 2318, 64, 64], -** Processing line: ~ [2144, 2317, 64, 64],~ + end +** Processing line: ~ # uncomment the line below to slow down the game so you~ - Inside source: true *** True Line Result - [2144, 2317, 64, 64], -** Processing line: ~ [2081, 2316, 64, 64],~ + # uncomment the line below to slow down the game so you +** Processing line: ~ # can see each tick as it passes~ - Inside source: true *** True Line Result - [2081, 2316, 64, 64], -** Processing line: ~ [2015, 2342, 64, 64],~ + # can see each tick as it passes +** Processing line: ~ # args.gtk.slowmo! 30~ - Inside source: true *** True Line Result - [2015, 2342, 64, 64], -** Processing line: ~ [2016, 2315, 64, 64],~ + # args.gtk.slowmo! 30 +** Processing line: ~ $game ||= FallingCircle.new~ - Inside source: true *** True Line Result - [2016, 2315, 64, 64], -** Processing line: ~ [869, 3709, 64, 64],~ + $game ||= FallingCircle.new +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - [869, 3709, 64, 64], -** Processing line: ~ [819, 3710, 64, 64],~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - [819, 3710, 64, 64], -** Processing line: ~ [869, 3658, 64, 64],~ + $game.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - [869, 3658, 64, 64], -** Processing line: ~ [820, 3658, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [820, 3658, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + +** Processing line: ~ def reset~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + def reset +** Processing line: ~ $game = nil~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + $game = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Platformer - The Little Probe - Data - level.txt~ +- Header detected. +*** True Line Result + +*** True Line Result +* Platformer - The Little Probe - Data - level.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/data/level.txt~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [3898, 2400, 64, 64],~ + # ./samples/99_genre_platformer/the_little_probe/data/level.txt +** Processing line: ~ 640,8840,1180,8840~ - Inside source: true *** True Line Result - [3898, 2400, 64, 64], -** Processing line: ~ [3835, 2400, 64, 64],~ + 640,8840,1180,8840 +** Processing line: ~ -60,10220,0,9960~ - Inside source: true *** True Line Result - [3835, 2400, 64, 64], -** Processing line: ~ [3771, 2400, 64, 64],~ + -60,10220,0,9960 +** Processing line: ~ -60,10220,0,10500~ - Inside source: true *** True Line Result - [3771, 2400, 64, 64], -** Processing line: ~ [3708, 2401, 64, 64],~ + -60,10220,0,10500 +** Processing line: ~ 0,10500,0,10780~ - Inside source: true *** True Line Result - [3708, 2401, 64, 64], -** Processing line: ~ [3646, 2401, 64, 64],~ + 0,10500,0,10780 +** Processing line: ~ 0,10780,40,10900~ - Inside source: true *** True Line Result - [3646, 2401, 64, 64], -** Processing line: ~ [3587, 2401, 64, 64],~ + 0,10780,40,10900 +** Processing line: ~ 500,10920,760,10960~ - Inside source: true *** True Line Result - [3587, 2401, 64, 64], -** Processing line: ~ [3530, 2401, 64, 64],~ + 500,10920,760,10960 +** Processing line: ~ 300,10560,820,10600~ - Inside source: true *** True Line Result - [3530, 2401, 64, 64], -** Processing line: ~ [3897, 2340, 64, 64],~ + 300,10560,820,10600 +** Processing line: ~ 420,10320,700,10300~ - Inside source: true *** True Line Result - [3897, 2340, 64, 64], -** Processing line: ~ [3897, 2295, 64, 64],~ + 420,10320,700,10300 +** Processing line: ~ 820,10600,1500,10600~ - Inside source: true *** True Line Result - [3897, 2295, 64, 64], -** Processing line: ~ [3834, 2296, 64, 64],~ + 820,10600,1500,10600 +** Processing line: ~ 1500,10600,1940,10600~ - Inside source: true *** True Line Result - [3834, 2296, 64, 64], -** Processing line: ~ [3773, 2295, 64, 64],~ + 1500,10600,1940,10600 +** Processing line: ~ 1940,10600,2380,10580~ - Inside source: true *** True Line Result - [3773, 2295, 64, 64], -** Processing line: ~ [3710, 2296, 64, 64],~ + 1940,10600,2380,10580 +** Processing line: ~ 2380,10580,2800,10620~ - Inside source: true *** True Line Result - [3710, 2296, 64, 64], -** Processing line: ~ [3656, 2295, 64, 64],~ + 2380,10580,2800,10620 +** Processing line: ~ 2240,11080,2480,11020~ - Inside source: true *** True Line Result - [3656, 2295, 64, 64], -** Processing line: ~ [3593, 2294, 64, 64],~ + 2240,11080,2480,11020 +** Processing line: ~ 2000,11120,2240,11080~ - Inside source: true *** True Line Result - [3593, 2294, 64, 64], -** Processing line: ~ [3527, 2339, 64, 64],~ + 2000,11120,2240,11080 +** Processing line: ~ 1760,11180,2000,11120~ - Inside source: true *** True Line Result - [3527, 2339, 64, 64], -** Processing line: ~ [3531, 2293, 64, 64],~ + 1760,11180,2000,11120 +** Processing line: ~ 1620,11180,1760,11180~ - Inside source: true *** True Line Result - [3531, 2293, 64, 64], -** Processing line: ~ [4152, 2903, 64, 64],~ + 1620,11180,1760,11180 +** Processing line: ~ 1500,11220,1620,11180~ - Inside source: true *** True Line Result - [4152, 2903, 64, 64], -** Processing line: ~ [4155, 2858, 64, 64],~ + 1500,11220,1620,11180 +** Processing line: ~ 1180,11280,1340,11220~ - Inside source: true *** True Line Result - [4155, 2858, 64, 64], -** Processing line: ~ [3942, 1306, 64, 64],~ + 1180,11280,1340,11220 +** Processing line: ~ 1040,11240,1180,11280~ - Inside source: true *** True Line Result - [3942, 1306, 64, 64], -** Processing line: ~ [3942, 1279, 64, 64],~ + 1040,11240,1180,11280 +** Processing line: ~ 840,11280,1040,11240~ - Inside source: true *** True Line Result - [3942, 1279, 64, 64], -** Processing line: ~ [3879, 1306, 64, 64],~ + 840,11280,1040,11240 +** Processing line: ~ 640,11280,840,11280~ - Inside source: true *** True Line Result - [3879, 1306, 64, 64], -** Processing line: ~ [3881, 1278, 64, 64],~ + 640,11280,840,11280 +** Processing line: ~ 500,11220,640,11280~ - Inside source: true *** True Line Result - [3881, 1278, 64, 64], -** Processing line: ~ [3819, 1305, 64, 64],~ + 500,11220,640,11280 +** Processing line: ~ 420,11140,500,11220~ - Inside source: true *** True Line Result - [3819, 1305, 64, 64], -** Processing line: ~ [3819, 1277, 64, 64],~ + 420,11140,500,11220 +** Processing line: ~ 240,11100,420,11140~ - Inside source: true *** True Line Result - [3819, 1277, 64, 64], -** Processing line: ~ [3756, 1306, 64, 64],~ + 240,11100,420,11140 +** Processing line: ~ 100,11120,240,11100~ - Inside source: true *** True Line Result - [3756, 1306, 64, 64], -** Processing line: ~ [3756, 1277, 64, 64],~ + 100,11120,240,11100 +** Processing line: ~ 0,11180,100,11120~ - Inside source: true *** True Line Result - [3756, 1277, 64, 64], -** Processing line: ~ [3694, 1306, 64, 64],~ + 0,11180,100,11120 +** Processing line: ~ -160,11220,0,11180~ - Inside source: true *** True Line Result - [3694, 1306, 64, 64], -** Processing line: ~ [3695, 1277, 64, 64],~ + -160,11220,0,11180 +** Processing line: ~ -260,11240,-160,11220~ - Inside source: true *** True Line Result - [3695, 1277, 64, 64], -** Processing line: ~ [3631, 1306, 64, 64],~ + -260,11240,-160,11220 +** Processing line: ~ 1340,11220,1500,11220~ - Inside source: true *** True Line Result - [3631, 1306, 64, 64], -** Processing line: ~ [3632, 1278, 64, 64],~ + 1340,11220,1500,11220 +** Processing line: ~ 960,13300,1280,13060~ - Inside source: true *** True Line Result - [3632, 1278, 64, 64], -** Processing line: ~ [3565, 1306, 64, 64],~ + 960,13300,1280,13060 +** Processing line: ~ 1280,13060,1540,12860~ - Inside source: true *** True Line Result - [3565, 1306, 64, 64], -** Processing line: ~ [3567, 1279, 64, 64],~ + 1280,13060,1540,12860 +** Processing line: ~ 1540,12860,1820,12700~ - Inside source: true *** True Line Result - [3567, 1279, 64, 64], -** Processing line: ~ [4432, 1165, 64, 64],~ + 1540,12860,1820,12700 +** Processing line: ~ 1820,12700,2080,12520~ - Inside source: true *** True Line Result - [4432, 1165, 64, 64], -** Processing line: ~ [4408, 1163, 64, 64],~ + 1820,12700,2080,12520 +** Processing line: ~ 2080,12520,2240,12400~ - Inside source: true *** True Line Result - [4408, 1163, 64, 64], -** Processing line: ~ [5123, 1003, 64, 64],~ + 2080,12520,2240,12400 +** Processing line: ~ 2240,12400,2240,12240~ - Inside source: true *** True Line Result - [5123, 1003, 64, 64], -** Processing line: ~ [5065, 1002, 64, 64],~ + 2240,12400,2240,12240 +** Processing line: ~ 2240,12240,2400,12080~ - Inside source: true *** True Line Result - [5065, 1002, 64, 64], -** Processing line: ~ [5042, 1002, 64, 64],~ + 2240,12240,2400,12080 +** Processing line: ~ 2400,12080,2560,11920~ - Inside source: true *** True Line Result - [5042, 1002, 64, 64], -** Processing line: ~ [6020, 1780, 64, 64],~ + 2400,12080,2560,11920 +** Processing line: ~ 2560,11920,2640,11740~ - Inside source: true *** True Line Result - [6020, 1780, 64, 64], -** Processing line: ~ [6020, 1756, 64, 64],~ + 2560,11920,2640,11740 +** Processing line: ~ 2640,11740,2740,11580~ - Inside source: true *** True Line Result - [6020, 1756, 64, 64], -** Processing line: ~ [5959, 1780, 64, 64],~ + 2640,11740,2740,11580 +** Processing line: ~ 2740,11580,2800,11400~ - Inside source: true *** True Line Result - [5959, 1780, 64, 64], -** Processing line: ~ [5959, 1752, 64, 64],~ + 2740,11580,2800,11400 +** Processing line: ~ 2800,11400,2800,11240~ - Inside source: true *** True Line Result - [5959, 1752, 64, 64], -** Processing line: ~ [5897, 1779, 64, 64],~ + 2800,11400,2800,11240 +** Processing line: ~ 2740,11140,2800,11240~ - Inside source: true *** True Line Result - [5897, 1779, 64, 64], -** Processing line: ~ [5899, 1752, 64, 64],~ + 2740,11140,2800,11240 +** Processing line: ~ 2700,11040,2740,11140~ - Inside source: true *** True Line Result - [5899, 1752, 64, 64], -** Processing line: ~ [5836, 1779, 64, 64],~ + 2700,11040,2740,11140 +** Processing line: ~ 2700,11040,2740,10960~ - Inside source: true *** True Line Result - [5836, 1779, 64, 64], -** Processing line: ~ [5836, 1751, 64, 64],~ + 2700,11040,2740,10960 +** Processing line: ~ 2740,10960,2740,10920~ - Inside source: true *** True Line Result - [5836, 1751, 64, 64], -** Processing line: ~ [5776, 1780, 64, 64],~ + 2740,10960,2740,10920 +** Processing line: ~ 2700,10900,2740,10920~ - Inside source: true *** True Line Result - [5776, 1780, 64, 64], -** Processing line: ~ [5776, 1754, 64, 64],~ + 2700,10900,2740,10920 +** Processing line: ~ 2380,10900,2700,10900~ - Inside source: true *** True Line Result - [5776, 1754, 64, 64], -** Processing line: ~ [5717, 1780, 64, 64],~ + 2380,10900,2700,10900 +** Processing line: ~ 2040,10920,2380,10900~ - Inside source: true *** True Line Result - [5717, 1780, 64, 64], -** Processing line: ~ [5716, 1752, 64, 64],~ + 2040,10920,2380,10900 +** Processing line: ~ 1720,10940,2040,10920~ - Inside source: true *** True Line Result - [5716, 1752, 64, 64], -** Processing line: ~ [5658, 1781, 64, 64],~ + 1720,10940,2040,10920 +** Processing line: ~ 1380,11000,1720,10940~ - Inside source: true *** True Line Result - [5658, 1781, 64, 64], -** Processing line: ~ [5658, 1755, 64, 64],~ + 1380,11000,1720,10940 +** Processing line: ~ 1180,10980,1380,11000~ - Inside source: true *** True Line Result - [5658, 1755, 64, 64], -** Processing line: ~ [5640, 1781, 64, 64],~ + 1180,10980,1380,11000 +** Processing line: ~ 900,10980,1180,10980~ - Inside source: true *** True Line Result - [5640, 1781, 64, 64], -** Processing line: ~ [5640, 1754, 64, 64],~ + 900,10980,1180,10980 +** Processing line: ~ 760,10960,900,10980~ - Inside source: true *** True Line Result - [5640, 1754, 64, 64], -** Processing line: ~ [5832, 2095, 64, 64],~ + 760,10960,900,10980 +** Processing line: ~ 240,10960,500,10920~ - Inside source: true *** True Line Result - [5832, 2095, 64, 64], -** Processing line: ~ [5782, 2093, 64, 64],~ + 240,10960,500,10920 +** Processing line: ~ 40,10900,240,10960~ - Inside source: true *** True Line Result - [5782, 2093, 64, 64], -** Processing line: ~ [5832, 2044, 64, 64],~ + 40,10900,240,10960 +** Processing line: ~ 0,9700,0,9960~ - Inside source: true *** True Line Result - [5832, 2044, 64, 64], -** Processing line: ~ [5777, 2043, 64, 64],~ + 0,9700,0,9960 +** Processing line: ~ -60,9500,0,9700~ - Inside source: true *** True Line Result - [5777, 2043, 64, 64], -** Processing line: ~ [4847, 2577, 64, 64],~ + -60,9500,0,9700 +** Processing line: ~ -60,9420,-60,9500~ - Inside source: true *** True Line Result - [4847, 2577, 64, 64], -** Processing line: ~ [4795, 2577, 64, 64],~ + -60,9420,-60,9500 +** Processing line: ~ -60,9420,-60,9340~ - Inside source: true *** True Line Result - [4795, 2577, 64, 64], -** Processing line: ~ [4846, 2526, 64, 64],~ + -60,9420,-60,9340 +** Processing line: ~ -60,9340,-60,9280~ - Inside source: true *** True Line Result - [4846, 2526, 64, 64], -** Processing line: ~ [4794, 2526, 64, 64],~ + -60,9340,-60,9280 +** Processing line: ~ -60,9120,-60,9280~ - Inside source: true *** True Line Result - [4794, 2526, 64, 64], -** Processing line: ~ [8390, 923, 64, 64],~ + -60,9120,-60,9280 +** Processing line: ~ -60,8940,-60,9120~ - Inside source: true *** True Line Result - [8390, 923, 64, 64], -** Processing line: ~ [8363, 922, 64, 64],~ + -60,8940,-60,9120 +** Processing line: ~ -60,8940,-60,8780~ - Inside source: true *** True Line Result - [8363, 922, 64, 64], -** Processing line: ~ [7585, 1084, 64, 64],~ + -60,8940,-60,8780 +** Processing line: ~ -60,8780,0,8700~ - Inside source: true *** True Line Result - [7585, 1084, 64, 64], -** Processing line: ~ [7582, 1058, 64, 64],~ + -60,8780,0,8700 +** Processing line: ~ 0,8700,40,8680~ - Inside source: true *** True Line Result - [7582, 1058, 64, 64], -** Processing line: ~ [7525, 1084, 64, 64],~ + 0,8700,40,8680 +** Processing line: ~ 40,8680,240,8700~ - Inside source: true *** True Line Result - [7525, 1084, 64, 64], -** Processing line: ~ [7524, 1056, 64, 64],~ + 40,8680,240,8700 +** Processing line: ~ 240,8700,360,8780~ - Inside source: true *** True Line Result - [7524, 1056, 64, 64], -** Processing line: ~ [7478, 1085, 64, 64],~ + 240,8700,360,8780 +** Processing line: ~ 360,8780,640,8840~ - Inside source: true *** True Line Result - [7478, 1085, 64, 64], -** Processing line: ~ [7476, 1055, 64, 64],~ + 360,8780,640,8840 +** Processing line: ~ 1420,8400,1540,8480~ - Inside source: true *** True Line Result - [7476, 1055, 64, 64], -** Processing line: ~ [7421, 1086, 64, 64],~ + 1420,8400,1540,8480 +** Processing line: ~ 1540,8480,1680,8500~ - Inside source: true *** True Line Result - [7421, 1086, 64, 64], -** Processing line: ~ [7421, 1052, 64, 64],~ + 1540,8480,1680,8500 +** Processing line: ~ 1680,8500,1940,8460~ - Inside source: true *** True Line Result - [7421, 1052, 64, 64], -** Processing line: ~ [7362, 1085, 64, 64],~ + 1680,8500,1940,8460 +** Processing line: ~ 1180,8840,1280,8880~ - Inside source: true *** True Line Result - [7362, 1085, 64, 64], -** Processing line: ~ [7361, 1053, 64, 64],~ + 1180,8840,1280,8880 +** Processing line: ~ 1280,8880,1340,8860~ - Inside source: true *** True Line Result - [7361, 1053, 64, 64], -** Processing line: ~ [7307, 1087, 64, 64],~ + 1280,8880,1340,8860 +** Processing line: ~ 1340,8860,1720,8860~ - Inside source: true *** True Line Result - [7307, 1087, 64, 64], -** Processing line: ~ [7307, 1054, 64, 64],~ + 1340,8860,1720,8860 +** Processing line: ~ 1720,8860,1820,8920~ - Inside source: true *** True Line Result - [7307, 1054, 64, 64], -** Processing line: ~ [7258, 1086, 64, 64],~ + 1720,8860,1820,8920 +** Processing line: ~ 1820,8920,1820,9140~ - Inside source: true *** True Line Result - [7258, 1086, 64, 64], -** Processing line: ~ [7255, 1058, 64, 64],~ + 1820,8920,1820,9140 +** Processing line: ~ 1820,9140,1820,9280~ - Inside source: true *** True Line Result - [7255, 1058, 64, 64], -** Processing line: ~ [7203, 1083, 64, 64],~ + 1820,9140,1820,9280 +** Processing line: ~ 1820,9460,1820,9280~ - Inside source: true *** True Line Result - [7203, 1083, 64, 64], -** Processing line: ~ [7203, 1055, 64, 64],~ + 1820,9460,1820,9280 +** Processing line: ~ 1760,9480,1820,9460~ - Inside source: true *** True Line Result - [7203, 1055, 64, 64], -** Processing line: ~ [7161, 1085, 64, 64],~ + 1760,9480,1820,9460 +** Processing line: ~ 1640,9480,1760,9480~ - Inside source: true *** True Line Result - [7161, 1085, 64, 64], -** Processing line: ~ [7158, 1057, 64, 64],~ + 1640,9480,1760,9480 +** Processing line: ~ 1540,9500,1640,9480~ - Inside source: true *** True Line Result - [7158, 1057, 64, 64], -** Processing line: ~ [7100, 1083, 64, 64],~ + 1540,9500,1640,9480 +** Processing line: ~ 1340,9500,1540,9500~ - Inside source: true *** True Line Result - [7100, 1083, 64, 64], -** Processing line: ~ [7099, 1058, 64, 64],~ + 1340,9500,1540,9500 +** Processing line: ~ 1100,9500,1340,9500~ - Inside source: true *** True Line Result - [7099, 1058, 64, 64], -** Processing line: ~ [7038, 1082, 64, 64],~ + 1100,9500,1340,9500 +** Processing line: ~ 1040,9540,1100,9500~ - Inside source: true *** True Line Result - [7038, 1082, 64, 64], -** Processing line: ~ [7038, 1058, 64, 64],~ + 1040,9540,1100,9500 +** Processing line: ~ 960,9540,1040,9540~ - Inside source: true *** True Line Result - [7038, 1058, 64, 64], -** Processing line: ~ [6982, 1083, 64, 64],~ + 960,9540,1040,9540 +** Processing line: ~ 300,9420,360,9460~ - Inside source: true *** True Line Result - [6982, 1083, 64, 64], -** Processing line: ~ [6984, 1057, 64, 64],~ + 300,9420,360,9460 +** Processing line: ~ 240,9440,300,9420~ - Inside source: true *** True Line Result - [6984, 1057, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + 240,9440,300,9420 +** Processing line: ~ 180,9600,240,9440~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + 180,9600,240,9440 +** Processing line: ~ 120,9660,180,9600~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + 120,9660,180,9600 +** Processing line: ~ 100,9820,120,9660~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + 100,9820,120,9660 +** Processing line: ~ 100,9820,120,9860~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + 100,9820,120,9860 +** Processing line: ~ 120,9860,140,9900~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + 120,9860,140,9900 +** Processing line: ~ 140,9900,140,10000~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + 140,9900,140,10000 +** Processing line: ~ 140,10440,180,10540~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + 140,10440,180,10540 +** Processing line: ~ 100,10080,140,10000~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + 100,10080,140,10000 +** Processing line: ~ 100,10080,140,10100~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + 100,10080,140,10100 +** Processing line: ~ 140,10100,140,10440~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [0, 0, 64, 64],~ + 140,10100,140,10440 +** Processing line: ~ 180,10540,300,10560~ - Inside source: true *** True Line Result - [0, 0, 64, 64], -** Processing line: ~ [0, 1670, 64, 64],~ + 180,10540,300,10560 +** Processing line: ~ 2140,9560,2140,9640~ - Inside source: true *** True Line Result - [0, 1670, 64, 64], -** Processing line: ~ [6691, 1653, 64, 64],~ + 2140,9560,2140,9640 +** Processing line: ~ 2140,9720,2140,9640~ - Inside source: true *** True Line Result - [6691, 1653, 64, 64], -** Processing line: ~ [1521, 3792, 64, 64],~ + 2140,9720,2140,9640 +** Processing line: ~ 1880,9780,2140,9720~ - Inside source: true *** True Line Result - [1521, 3792, 64, 64], -** Processing line: ~ [0, 5137, 64, 64],~ + 1880,9780,2140,9720 +** Processing line: ~ 1720,9780,1880,9780~ - Inside source: true *** True Line Result - [0, 5137, 64, 64], -** Processing line: ~ [8346, 424, 64, 64],~ + 1720,9780,1880,9780 +** Processing line: ~ 1620,9740,1720,9780~ - Inside source: true *** True Line Result - [8346, 424, 64, 64], -** Processing line: ~ [8407, 376, 64, 64],~ + 1620,9740,1720,9780 +** Processing line: ~ 1500,9780,1620,9740~ - Inside source: true *** True Line Result - [8407, 376, 64, 64], -** Processing line: ~ [8375, 386, 64, 64],~ + 1500,9780,1620,9740 +** Processing line: ~ 1380,9780,1500,9780~ - Inside source: true *** True Line Result - [8375, 386, 64, 64], -** Processing line: ~ [8407, 347, 64, 64],~ + 1380,9780,1500,9780 +** Processing line: ~ 1340,9820,1380,9780~ - Inside source: true *** True Line Result - [8407, 347, 64, 64], -** Processing line: ~ [8388, 343, 64, 64],~ + 1340,9820,1380,9780 +** Processing line: ~ 1200,9820,1340,9820~ - Inside source: true *** True Line Result - [8388, 343, 64, 64], -** Processing line: ~ [8320, 423, 64, 64],~ + 1200,9820,1340,9820 +** Processing line: ~ 1100,9780,1200,9820~ - Inside source: true *** True Line Result - [8320, 423, 64, 64], -** Processing line: ~ [8319, 363, 64, 64],~ + 1100,9780,1200,9820 +** Processing line: ~ 900,9780,1100,9780~ - Inside source: true *** True Line Result - [8319, 363, 64, 64], -** Processing line: ~ [8368, 303, 64, 64],~ + 900,9780,1100,9780 +** Processing line: ~ 820,9720,900,9780~ - Inside source: true *** True Line Result - [8368, 303, 64, 64], -** Processing line: ~ [8359, 303, 64, 64],~ + 820,9720,900,9780 +** Processing line: ~ 540,9720,820,9720~ - Inside source: true *** True Line Result - [8359, 303, 64, 64], -** Processing line: ~ [8318, 330, 64, 64],~ + 540,9720,820,9720 +** Processing line: ~ 360,9840,540,9720~ - Inside source: true *** True Line Result - [8318, 330, 64, 64], -** Processing line: ~ [9369, 425, 64, 64],~ + 360,9840,540,9720 +** Processing line: ~ 360,9840,360,9960~ - Inside source: true *** True Line Result - [9369, 425, 64, 64], -** Processing line: ~ [9340, 425, 64, 64],~ + 360,9840,360,9960 +** Processing line: ~ 360,9960,360,10080~ - Inside source: true *** True Line Result - [9340, 425, 64, 64], -** Processing line: ~ [9431, 376, 64, 64],~ + 360,9960,360,10080 +** Processing line: ~ 360,10140,360,10080~ - Inside source: true *** True Line Result - [9431, 376, 64, 64], -** Processing line: ~ [9414, 382, 64, 64],~ + 360,10140,360,10080 +** Processing line: ~ 360,10140,360,10240~ - Inside source: true *** True Line Result - [9414, 382, 64, 64], -** Processing line: ~ [9387, 391, 64, 64],~ + 360,10140,360,10240 +** Processing line: ~ 360,10240,420,10320~ - Inside source: true *** True Line Result - [9387, 391, 64, 64], -** Processing line: ~ [9431, 349, 64, 64],~ + 360,10240,420,10320 +** Processing line: ~ 700,10300,820,10280~ - Inside source: true *** True Line Result - [9431, 349, 64, 64], -** Processing line: ~ [9412, 344, 64, 64],~ + 700,10300,820,10280 +** Processing line: ~ 820,10280,820,10280~ - Inside source: true *** True Line Result - [9412, 344, 64, 64], -** Processing line: ~ [9392, 305, 64, 64],~ + 820,10280,820,10280 +** Processing line: ~ 820,10280,900,10320~ - Inside source: true *** True Line Result - [9392, 305, 64, 64], -** Processing line: ~ [9339, 365, 64, 64],~ + 820,10280,900,10320 +** Processing line: ~ 900,10320,1040,10300~ - Inside source: true *** True Line Result - [9339, 365, 64, 64], -** Processing line: ~ [9341, 333, 64, 64],~ + 900,10320,1040,10300 +** Processing line: ~ 1040,10300,1200,10320~ - Inside source: true *** True Line Result - [9341, 333, 64, 64], -** Processing line: ~ [9384, 301, 64, 64],~ + 1040,10300,1200,10320 +** Processing line: ~ 1200,10320,1380,10280~ - Inside source: true *** True Line Result - [9384, 301, 64, 64], -** Processing line: ~ [7673, 1896, 64, 64],~ + 1200,10320,1380,10280 +** Processing line: ~ 1380,10280,1500,10300~ - Inside source: true *** True Line Result - [7673, 1896, 64, 64], -** Processing line: ~ [7642, 1834, 64, 64],~ + 1380,10280,1500,10300 +** Processing line: ~ 1500,10300,1760,10300~ - Inside source: true *** True Line Result - [7642, 1834, 64, 64], -** Processing line: ~ [7646, 1901, 64, 64],~ + 1500,10300,1760,10300 +** Processing line: ~ 2800,10620,2840,10600~ - Inside source: true *** True Line Result - [7646, 1901, 64, 64], -** Processing line: ~ [4500, 4054, 64, 64],~ + 2800,10620,2840,10600 +** Processing line: ~ 2840,10600,2900,10600~ - Inside source: true *** True Line Result - [4500, 4054, 64, 64], -** Processing line: ~ [4476, 4055, 64, 64],~ + 2840,10600,2900,10600 +** Processing line: ~ 2900,10600,3000,10620~ - Inside source: true *** True Line Result - [4476, 4055, 64, 64], -** Processing line: ~ [4459, 3997, 64, 64],~ + 2900,10600,3000,10620 +** Processing line: ~ 3000,10620,3080,10620~ - Inside source: true *** True Line Result - [4459, 3997, 64, 64], -** Processing line: ~ [76, 5215, 64, 64],~ + 3000,10620,3080,10620 +** Processing line: ~ 3080,10620,3140,10600~ - Inside source: true *** True Line Result - [76, 5215, 64, 64], -** Processing line: ~ [39, 5217, 64, 64],~ + 3080,10620,3140,10600 +** Processing line: ~ 3140,10540,3140,10600~ - Inside source: true *** True Line Result - [39, 5217, 64, 64], -** Processing line: ~ ]~ + 3140,10540,3140,10600 +** Processing line: ~ 3140,10540,3140,10460~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + 3140,10540,3140,10460 +** Processing line: ~ 3140,10460,3140,10360~ - Inside source: true *** True Line Result - -** Processing line: ~ $mugs = [~ + 3140,10460,3140,10360 +** Processing line: ~ 3140,10360,3140,10260~ - Inside source: true *** True Line Result - $mugs = [ -** Processing line: ~ [85, 87, 39, 43, "sprites/square-orange.png"],~ + 3140,10360,3140,10260 +** Processing line: ~ 3140,10260,3140,10140~ - Inside source: true *** True Line Result - [85, 87, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [958, 1967, 39, 43, "sprites/square-orange.png"],~ + 3140,10260,3140,10140 +** Processing line: ~ 3140,10140,3140,10000~ - Inside source: true *** True Line Result - [958, 1967, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [2537, 1734, 39, 43, "sprites/square-orange.png"],~ + 3140,10140,3140,10000 +** Processing line: ~ 3140,10000,3140,9860~ - Inside source: true *** True Line Result - [2537, 1734, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [3755, 2464, 39, 43, "sprites/square-orange.png"],~ + 3140,10000,3140,9860 +** Processing line: ~ 3140,9860,3160,9720~ - Inside source: true *** True Line Result - [3755, 2464, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [1548, 3273, 39, 43, "sprites/square-orange.png"],~ + 3140,9860,3160,9720 +** Processing line: ~ 3160,9720,3160,9580~ - Inside source: true *** True Line Result - [1548, 3273, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [2050, 220, 39, 43, "sprites/square-orange.png"],~ + 3160,9720,3160,9580 +** Processing line: ~ 3160,9580,3160,9440~ - Inside source: true *** True Line Result - [2050, 220, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [854, 297, 39, 43, "sprites/square-orange.png"],~ + 3160,9580,3160,9440 +** Processing line: ~ 3160,9300,3160,9440~ - Inside source: true *** True Line Result - [854, 297, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [343, 526, 39, 43, "sprites/square-orange.png"],~ + 3160,9300,3160,9440 +** Processing line: ~ 3160,9300,3160,9140~ - Inside source: true *** True Line Result - [343, 526, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [3454, 772, 39, 43, "sprites/square-orange.png"],~ + 3160,9300,3160,9140 +** Processing line: ~ 3160,9140,3160,8980~ - Inside source: true *** True Line Result - [3454, 772, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [5041, 298, 39, 43, "sprites/square-orange.png"],~ + 3160,9140,3160,8980 +** Processing line: ~ 3160,8980,3160,8820~ - Inside source: true *** True Line Result - [5041, 298, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [6089, 300, 39, 43, "sprites/square-orange.png"],~ + 3160,8980,3160,8820 +** Processing line: ~ 3160,8820,3160,8680~ - Inside source: true *** True Line Result - [6089, 300, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [6518, 295, 39, 43, "sprites/square-orange.png"],~ + 3160,8820,3160,8680 +** Processing line: ~ 3160,8680,3160,8520~ - Inside source: true *** True Line Result - [6518, 295, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [7661, 47, 39, 43, "sprites/square-orange.png"],~ + 3160,8680,3160,8520 +** Processing line: ~ 1760,10300,1880,10300~ - Inside source: true *** True Line Result - [7661, 47, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [9392, 1125, 39, 43, "sprites/square-orange.png"],~ + 1760,10300,1880,10300 +** Processing line: ~ 660,9500,960,9540~ - Inside source: true *** True Line Result - [9392, 1125, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [7298, 1152, 39, 43, "sprites/square-orange.png"],~ + 660,9500,960,9540 +** Processing line: ~ 640,9460,660,9500~ - Inside source: true *** True Line Result - [7298, 1152, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [5816, 1843, 39, 43, "sprites/square-orange.png"],~ + 640,9460,660,9500 +** Processing line: ~ 360,9460,640,9460~ - Inside source: true *** True Line Result - [5816, 1843, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [876, 3772, 39, 43, "sprites/square-orange.png"],~ + 360,9460,640,9460 +** Processing line: ~ -480,10760,-440,10880~ - Inside source: true *** True Line Result - [876, 3772, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [1029, 4667, 39, 43, "sprites/square-orange.png"],~ + -480,10760,-440,10880 +** Processing line: ~ -480,11020,-440,10880~ - Inside source: true *** True Line Result - [1029, 4667, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [823, 5324, 39, 43, "sprites/square-orange.png"],~ + -480,11020,-440,10880 +** Processing line: ~ -480,11160,-260,11240~ - Inside source: true *** True Line Result - [823, 5324, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [3251, 5220, 39, 43, "sprites/square-orange.png"],~ + -480,11160,-260,11240 +** Processing line: ~ -480,11020,-480,11160~ - Inside source: true *** True Line Result - [3251, 5220, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [4747, 5282, 39, 43, "sprites/square-orange.png"],~ + -480,11020,-480,11160 +** Processing line: ~ -600,11420,-380,11320~ - Inside source: true *** True Line Result - [4747, 5282, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [9325, 5178, 39, 43, "sprites/square-orange.png"],~ + -600,11420,-380,11320 +** Processing line: ~ -380,11320,-200,11340~ - Inside source: true *** True Line Result - [9325, 5178, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [9635, 4298, 39, 43, "sprites/square-orange.png"],~ + -380,11320,-200,11340 +** Processing line: ~ -200,11340,0,11340~ - Inside source: true *** True Line Result - [9635, 4298, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [7837, 4127, 39, 43, "sprites/square-orange.png"],~ + -200,11340,0,11340 +** Processing line: ~ 0,11340,180,11340~ - Inside source: true *** True Line Result - [7837, 4127, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [8651, 1971, 39, 43, "sprites/square-orange.png"],~ + 0,11340,180,11340 +** Processing line: ~ 960,13420,960,13300~ - Inside source: true *** True Line Result - [8651, 1971, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [6892, 2031, 39, 43, "sprites/square-orange.png"],~ + 960,13420,960,13300 +** Processing line: ~ 960,13420,960,13520~ - Inside source: true *** True Line Result - [6892, 2031, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [4626, 3882, 39, 43, "sprites/square-orange.png"],~ + 960,13420,960,13520 +** Processing line: ~ 960,13520,1000,13560~ - Inside source: true *** True Line Result - [4626, 3882, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [4024, 4554, 39, 43, "sprites/square-orange.png"],~ + 960,13520,1000,13560 +** Processing line: ~ 1000,13560,1040,13540~ - Inside source: true *** True Line Result - [4024, 4554, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [3925, 3337, 39, 43, "sprites/square-orange.png"],~ + 1000,13560,1040,13540 +** Processing line: ~ 1040,13540,1200,13440~ - Inside source: true *** True Line Result - [3925, 3337, 39, 43, "sprites/square-orange.png"], -** Processing line: ~ [5064, 1064, 39, 43, "sprites/square-orange.png"]~ + 1040,13540,1200,13440 +** Processing line: ~ 1200,13440,1380,13380~ - Inside source: true *** True Line Result - [5064, 1064, 39, 43, "sprites/square-orange.png"] -** Processing line: ~ ]~ + 1200,13440,1380,13380 +** Processing line: ~ 1380,13380,1620,13300~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + 1380,13380,1620,13300 +** Processing line: ~ 1620,13300,1820,13220~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 1620,13300,1820,13220 +** Processing line: ~ 1820,13220,2000,13200~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 1820,13220,2000,13200 +** Processing line: ~ 2000,13200,2240,13200~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/main.rb~ -- Header detected. + 2000,13200,2240,13200 +** Processing line: ~ 2240,13200,2440,13160~ +- Inside source: true *** True Line Result - + 2240,13200,2440,13160 +** Processing line: ~ 2440,13160,2640,13040~ +- Inside source: true *** True Line Result -* 99_genre_platformer/gorillas_basic/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 2440,13160,2640,13040 +** Processing line: ~ -480,10760,-440,10620~ +- Inside source: true *** True Line Result - + -480,10760,-440,10620 +** Processing line: ~ -440,10620,-360,10560~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ class YouSoBasicGorillas~ + -440,10620,-360,10560 +** Processing line: ~ -380,10460,-360,10560~ - Inside source: true *** True Line Result - class YouSoBasicGorillas -** Processing line: ~ attr_accessor :outputs, :grid, :state, :inputs~ + -380,10460,-360,10560 +** Processing line: ~ -380,10460,-360,10300~ - Inside source: true *** True Line Result - attr_accessor :outputs, :grid, :state, :inputs -** Processing line: ~~ + -380,10460,-360,10300 +** Processing line: ~ -380,10140,-360,10300~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick~ + -380,10140,-360,10300 +** Processing line: ~ -380,10140,-380,10040~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + -380,10140,-380,10040 +** Processing line: ~ -380,9880,-380,10040~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + -380,9880,-380,10040 +** Processing line: ~ -380,9720,-380,9880~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + -380,9720,-380,9880 +** Processing line: ~ -380,9720,-380,9540~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + -380,9720,-380,9540 +** Processing line: ~ -380,9360,-380,9540~ - Inside source: true *** True Line Result - process_inputs -** Processing line: ~ end~ + -380,9360,-380,9540 +** Processing line: ~ -380,9180,-380,9360~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -380,9180,-380,9360 +** Processing line: ~ -380,9180,-380,9000~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults~ + -380,9180,-380,9000 +** Processing line: ~ -380,8840,-380,9000~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ outputs.background_color = [33, 32, 87]~ + -380,8840,-380,9000 +** Processing line: ~ -380,8840,-380,8760~ - Inside source: true *** True Line Result - outputs.background_color = [33, 32, 87] -** Processing line: ~ state.building_spacing = 1~ + -380,8840,-380,8760 +** Processing line: ~ -380,8760,-380,8620~ - Inside source: true *** True Line Result - state.building_spacing = 1 -** Processing line: ~ state.building_room_spacing = 15~ + -380,8760,-380,8620 +** Processing line: ~ -380,8620,-380,8520~ - Inside source: true *** True Line Result - state.building_room_spacing = 15 -** Processing line: ~ state.building_room_width = 10~ + -380,8620,-380,8520 +** Processing line: ~ -380,8520,-360,8400~ - Inside source: true *** True Line Result - state.building_room_width = 10 -** Processing line: ~ state.building_room_height = 15~ + -380,8520,-360,8400 +** Processing line: ~ -360,8400,-100,8400~ - Inside source: true *** True Line Result - state.building_room_height = 15 -** Processing line: ~ state.building_heights = [4, 4, 6, 8, 15, 20, 18]~ + -360,8400,-100,8400 +** Processing line: ~ -100,8400,-60,8420~ - Inside source: true *** True Line Result - state.building_heights = [4, 4, 6, 8, 15, 20, 18] -** Processing line: ~ state.building_room_sizes = [5, 4, 6, 7]~ + -100,8400,-60,8420 +** Processing line: ~ -60,8420,240,8440~ - Inside source: true *** True Line Result - state.building_room_sizes = [5, 4, 6, 7] -** Processing line: ~ state.gravity = 0.25~ + -60,8420,240,8440 +** Processing line: ~ 240,8440,240,8380~ - Inside source: true *** True Line Result - state.gravity = 0.25 -** Processing line: ~ state.first_strike ||= :player_1~ + 240,8440,240,8380 +** Processing line: ~ 240,8380,500,8440~ - Inside source: true *** True Line Result - state.first_strike ||= :player_1 -** Processing line: ~ state.buildings ||= []~ + 240,8380,500,8440 +** Processing line: ~ 500,8440,760,8460~ - Inside source: true *** True Line Result - state.buildings ||= [] -** Processing line: ~ state.holes ||= []~ + 500,8440,760,8460 +** Processing line: ~ 760,8460,1000,8400~ - Inside source: true *** True Line Result - state.holes ||= [] -** Processing line: ~ state.player_1_score ||= 0~ + 760,8460,1000,8400 +** Processing line: ~ 1000,8400,1180,8420~ - Inside source: true *** True Line Result - state.player_1_score ||= 0 -** Processing line: ~ state.player_2_score ||= 0~ + 1000,8400,1180,8420 +** Processing line: ~ 1180,8420,1420,8400~ - Inside source: true *** True Line Result - state.player_2_score ||= 0 -** Processing line: ~ state.wind ||= 0~ + 1180,8420,1420,8400 +** Processing line: ~ 1940,8460,2140,8420~ - Inside source: true *** True Line Result - state.wind ||= 0 -** Processing line: ~ end~ + 1940,8460,2140,8420 +** Processing line: ~ 2140,8420,2200,8520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2140,8420,2200,8520 +** Processing line: ~ 2200,8680,2200,8520~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + 2200,8680,2200,8520 +** Processing line: ~ 2140,8840,2200,8680~ - Inside source: true *** True Line Result - def render -** Processing line: ~ render_stage~ + 2140,8840,2200,8680 +** Processing line: ~ 2140,8840,2140,9020~ - Inside source: true *** True Line Result - render_stage -** Processing line: ~ render_value_insertion~ + 2140,8840,2140,9020 +** Processing line: ~ 2140,9100,2140,9020~ - Inside source: true *** True Line Result - render_value_insertion -** Processing line: ~ render_gorillas~ + 2140,9100,2140,9020 +** Processing line: ~ 2140,9200,2140,9100~ - Inside source: true *** True Line Result - render_gorillas -** Processing line: ~ render_holes~ + 2140,9200,2140,9100 +** Processing line: ~ 2140,9200,2200,9320~ - Inside source: true *** True Line Result - render_holes -** Processing line: ~ render_banana~ + 2140,9200,2200,9320 +** Processing line: ~ 2200,9320,2200,9440~ - Inside source: true *** True Line Result - render_banana -** Processing line: ~ render_game_over~ + 2200,9320,2200,9440 +** Processing line: ~ 2140,9560,2200,9440~ - Inside source: true *** True Line Result - render_game_over -** Processing line: ~ render_score~ + 2140,9560,2200,9440 +** Processing line: ~ 1880,10300,2200,10280~ - Inside source: true *** True Line Result - render_score -** Processing line: ~ render_wind~ + 1880,10300,2200,10280 +** Processing line: ~ 2200,10280,2480,10260~ - Inside source: true *** True Line Result - render_wind -** Processing line: ~ end~ + 2200,10280,2480,10260 +** Processing line: ~ 2480,10260,2700,10240~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2480,10260,2700,10240 +** Processing line: ~ 2700,10240,2840,10180~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_score~ + 2700,10240,2840,10180 +** Processing line: ~ 2840,10180,2900,10060~ - Inside source: true *** True Line Result - def render_score -** Processing line: ~ outputs.primitives << [0, 0, 1280, 31, fancy_white].solid~ + 2840,10180,2900,10060 +** Processing line: ~ 2900,9860,2900,10060~ - Inside source: true *** True Line Result - outputs.primitives << [0, 0, 1280, 31, fancy_white].solid -** Processing line: ~ outputs.primitives << [1, 1, 1279, 29].solid~ + 2900,9860,2900,10060 +** Processing line: ~ 2900,9640,2900,9860~ - Inside source: true *** True Line Result - outputs.primitives << [1, 1, 1279, 29].solid -** Processing line: ~ outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]~ + 2900,9640,2900,9860 +** Processing line: ~ 2900,9640,2900,9500~ - Inside source: true *** True Line Result - outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white] -** Processing line: ~ outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]~ + 2900,9640,2900,9500 +** Processing line: ~ 2900,9460,2900,9500~ - Inside source: true *** True Line Result - outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white] -** Processing line: ~ end~ + 2900,9460,2900,9500 +** Processing line: ~ 2740,9460,2900,9460~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2740,9460,2900,9460 +** Processing line: ~ 2700,9460,2740,9460~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_wind~ + 2700,9460,2740,9460 +** Processing line: ~ 2700,9360,2700,9460~ - Inside source: true *** True Line Result - def render_wind -** Processing line: ~ outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid~ + 2700,9360,2700,9460 +** Processing line: ~ 2700,9320,2700,9360~ - Inside source: true *** True Line Result - outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid -** Processing line: ~ outputs.lines << [640, 30, 640, 0, fancy_white]~ + 2700,9320,2700,9360 +** Processing line: ~ 2600,9320,2700,9320~ - Inside source: true *** True Line Result - outputs.lines << [640, 30, 640, 0, fancy_white] -** Processing line: ~ end~ + 2600,9320,2700,9320 +** Processing line: ~ 2600,9260,2600,9320~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2600,9260,2600,9320 +** Processing line: ~ 2600,9200,2600,9260~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_game_over~ + 2600,9200,2600,9260 +** Processing line: ~ 2480,9120,2600,9200~ - Inside source: true *** True Line Result - def render_game_over -** Processing line: ~ return unless state.over~ + 2480,9120,2600,9200 +** Processing line: ~ 2440,9080,2480,9120~ - Inside source: true *** True Line Result - return unless state.over -** Processing line: ~ outputs.primitives << [grid.rect, 0, 0, 0, 200].solid~ + 2440,9080,2480,9120 +** Processing line: ~ 2380,9080,2440,9080~ - Inside source: true *** True Line Result - outputs.primitives << [grid.rect, 0, 0, 0, 200].solid -** Processing line: ~ outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label~ + 2380,9080,2440,9080 +** Processing line: ~ 2320,9060,2380,9080~ - Inside source: true *** True Line Result - outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label -** Processing line: ~ if state.winner == :player_1~ + 2320,9060,2380,9080 +** Processing line: ~ 2320,8860,2320,9060~ - Inside source: true *** True Line Result - if state.winner == :player_1 -** Processing line: ~ outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label~ + 2320,8860,2320,9060 +** Processing line: ~ 2320,8860,2380,8840~ - Inside source: true *** True Line Result - outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label -** Processing line: ~ else~ + 2320,8860,2380,8840 +** Processing line: ~ 2380,8840,2480,8860~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label~ + 2380,8840,2480,8860 +** Processing line: ~ 2480,8860,2600,8840~ - Inside source: true *** True Line Result - outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label -** Processing line: ~ end~ + 2480,8860,2600,8840 +** Processing line: ~ 2600,8840,2740,8840~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 2600,8840,2740,8840 +** Processing line: ~ 2740,8840,2840,8800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2740,8840,2840,8800 +** Processing line: ~ 2840,8800,2900,8700~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_stage~ + 2840,8800,2900,8700 +** Processing line: ~ 2900,8600,2900,8700~ - Inside source: true *** True Line Result - def render_stage -** Processing line: ~ return unless state.stage_generated~ + 2900,8600,2900,8700 +** Processing line: ~ 2900,8480,2900,8600~ - Inside source: true *** True Line Result - return unless state.stage_generated -** Processing line: ~ return if state.stage_rendered~ + 2900,8480,2900,8600 +** Processing line: ~ 2900,8380,2900,8480~ - Inside source: true *** True Line Result - return if state.stage_rendered -** Processing line: ~~ + 2900,8380,2900,8480 +** Processing line: ~ 2900,8380,2900,8260~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.static_solids << [grid.rect, 33, 32, 87]~ + 2900,8380,2900,8260 +** Processing line: ~ 2900,8260,2900,8140~ - Inside source: true *** True Line Result - outputs.static_solids << [grid.rect, 33, 32, 87] -** Processing line: ~ outputs.static_solids << state.buildings.map(&:solids)~ + 2900,8260,2900,8140 +** Processing line: ~ 2900,8140,2900,8020~ - Inside source: true *** True Line Result - outputs.static_solids << state.buildings.map(&:solids) -** Processing line: ~ state.stage_rendered = true~ + 2900,8140,2900,8020 +** Processing line: ~ 2900,8020,2900,7900~ - Inside source: true *** True Line Result - state.stage_rendered = true -** Processing line: ~ end~ + 2900,8020,2900,7900 +** Processing line: ~ 2900,7820,2900,7900~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2900,7820,2900,7900 +** Processing line: ~ 2900,7820,2900,7740~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_gorilla gorilla, id~ + 2900,7820,2900,7740 +** Processing line: ~ 2900,7660,2900,7740~ - Inside source: true *** True Line Result - def render_gorilla gorilla, id -** Processing line: ~ return unless gorilla~ + 2900,7660,2900,7740 +** Processing line: ~ 2900,7560,2900,7660~ - Inside source: true *** True Line Result - return unless gorilla -** Processing line: ~ if state.banana && state.banana.owner == gorilla~ + 2900,7560,2900,7660 +** Processing line: ~ 2900,7460,2900,7560~ - Inside source: true *** True Line Result - if state.banana && state.banana.owner == gorilla -** Processing line: ~ animation_index = state.banana.created_at.frame_index(3, 5, false)~ + 2900,7460,2900,7560 +** Processing line: ~ 2900,7460,2900,7360~ - Inside source: true *** True Line Result - animation_index = state.banana.created_at.frame_index(3, 5, false) -** Processing line: ~ end~ + 2900,7460,2900,7360 +** Processing line: ~ 2900,7260,2900,7360~ - Inside source: true *** True Line Result - end -** Processing line: ~ if !animation_index~ + 2900,7260,2900,7360 +** Processing line: ~ 2840,7160,2900,7260~ - Inside source: true *** True Line Result - if !animation_index -** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]~ + 2840,7160,2900,7260 +** Processing line: ~ 2800,7080,2840,7160~ - Inside source: true *** True Line Result - outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"] -** Processing line: ~ else~ + 2800,7080,2840,7160 +** Processing line: ~ 2700,7100,2800,7080~ - Inside source: true *** True Line Result - else -** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]~ + 2700,7100,2800,7080 +** Processing line: ~ 2560,7120,2700,7100~ - Inside source: true *** True Line Result - outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"] -** Processing line: ~ end~ + 2560,7120,2700,7100 +** Processing line: ~ 2400,7100,2560,7120~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 2400,7100,2560,7120 +** Processing line: ~ 2320,7100,2400,7100~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2320,7100,2400,7100 +** Processing line: ~ 2140,7100,2320,7100~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_gorillas~ + 2140,7100,2320,7100 +** Processing line: ~ 2040,7080,2140,7100~ - Inside source: true *** True Line Result - def render_gorillas -** Processing line: ~ render_gorilla state.player_1, :left~ + 2040,7080,2140,7100 +** Processing line: ~ 1940,7080,2040,7080~ - Inside source: true *** True Line Result - render_gorilla state.player_1, :left -** Processing line: ~ render_gorilla state.player_2, :right~ + 1940,7080,2040,7080 +** Processing line: ~ 1820,7140,1940,7080~ - Inside source: true *** True Line Result - render_gorilla state.player_2, :right -** Processing line: ~ end~ + 1820,7140,1940,7080 +** Processing line: ~ 1680,7140,1820,7140~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1680,7140,1820,7140 +** Processing line: ~ 1540,7140,1680,7140~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_value_insertion~ + 1540,7140,1680,7140 +** Processing line: ~ 1420,7220,1540,7140~ - Inside source: true *** True Line Result - def render_value_insertion -** Processing line: ~ return if state.banana~ + 1420,7220,1540,7140 +** Processing line: ~ 1280,7220,1380,7220~ - Inside source: true *** True Line Result - return if state.banana -** Processing line: ~ return if state.over~ + 1280,7220,1380,7220 +** Processing line: ~ 1140,7200,1280,7220~ - Inside source: true *** True Line Result - return if state.over -** Processing line: ~~ + 1140,7200,1280,7220 +** Processing line: ~ 1000,7220,1140,7200~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.current_turn == :player_1_angle~ + 1000,7220,1140,7200 +** Processing line: ~ 760,7280,900,7320~ - Inside source: true *** True Line Result - if state.current_turn == :player_1_angle -** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white]~ + 760,7280,900,7320 +** Processing line: ~ 540,7220,760,7280~ - Inside source: true *** True Line Result - outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white] -** Processing line: ~ elsif state.current_turn == :player_1_velocity~ + 540,7220,760,7280 +** Processing line: ~ 300,7180,540,7220~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_1_velocity -** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white]~ + 300,7180,540,7220 +** Processing line: ~ 180,7120,180,7160~ - Inside source: true *** True Line Result - outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white] -** Processing line: ~ outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]~ + 180,7120,180,7160 +** Processing line: ~ 40,7140,180,7120~ - Inside source: true *** True Line Result - outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white] -** Processing line: ~ elsif state.current_turn == :player_2_angle~ + 40,7140,180,7120 +** Processing line: ~ -60,7160,40,7140~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_2_angle -** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white]~ + -60,7160,40,7140 +** Processing line: ~ -200,7120,-60,7160~ - Inside source: true *** True Line Result - outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white] -** Processing line: ~ elsif state.current_turn == :player_2_velocity~ + -200,7120,-60,7160 +** Processing line: ~ 180,7160,300,7180~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_2_velocity -** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white]~ + 180,7160,300,7180 +** Processing line: ~ -260,7060,-200,7120~ - Inside source: true *** True Line Result - outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white] -** Processing line: ~ outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]~ + -260,7060,-200,7120 +** Processing line: ~ -260,6980,-260,7060~ - Inside source: true *** True Line Result - outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white] -** Processing line: ~ end~ + -260,6980,-260,7060 +** Processing line: ~ -260,6880,-260,6980~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + -260,6880,-260,6980 +** Processing line: ~ -260,6880,-260,6820~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -260,6880,-260,6820 +** Processing line: ~ -260,6820,-200,6760~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_banana~ + -260,6820,-200,6760 +** Processing line: ~ -200,6760,-100,6740~ - Inside source: true *** True Line Result - def render_banana -** Processing line: ~ return unless state.banana~ + -200,6760,-100,6740 +** Processing line: ~ -100,6740,-60,6740~ - Inside source: true *** True Line Result - return unless state.banana -** Processing line: ~ rotation = state.tick_count.%(360) * 20~ + -100,6740,-60,6740 +** Processing line: ~ -60,6740,40,6740~ - Inside source: true *** True Line Result - rotation = state.tick_count.%(360) * 20 -** Processing line: ~ rotation *= -1 if state.banana.dx > 0~ + -60,6740,40,6740 +** Processing line: ~ 40,6740,300,6800~ - Inside source: true *** True Line Result - rotation *= -1 if state.banana.dx > 0 -** Processing line: ~ outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]~ + 40,6740,300,6800 +** Processing line: ~ 300,6800,420,6760~ - Inside source: true *** True Line Result - outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation] -** Processing line: ~ end~ + 300,6800,420,6760 +** Processing line: ~ 420,6760,500,6740~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 420,6760,500,6740 +** Processing line: ~ 500,6740,540,6760~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_holes~ + 500,6740,540,6760 +** Processing line: ~ 540,6760,540,6760~ - Inside source: true *** True Line Result - def render_holes -** Processing line: ~ outputs.sprites << state.holes.map do |s|~ + 540,6760,540,6760 +** Processing line: ~ 540,6760,640,6780~ - Inside source: true *** True Line Result - outputs.sprites << state.holes.map do |s| -** Processing line: ~ animation_index = s.created_at.frame_index(7, 3, false)~ + 540,6760,640,6780 +** Processing line: ~ 640,6660,640,6780~ - Inside source: true *** True Line Result - animation_index = s.created_at.frame_index(7, 3, false) -** Processing line: ~ if animation_index~ + 640,6660,640,6780 +** Processing line: ~ 580,6580,640,6660~ - Inside source: true *** True Line Result - if animation_index -** Processing line: ~ [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]~ + 580,6580,640,6660 +** Processing line: ~ 580,6440,580,6580~ - Inside source: true *** True Line Result - [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]] -** Processing line: ~ else~ + 580,6440,580,6580 +** Processing line: ~ 580,6440,640,6320~ - Inside source: true *** True Line Result - else -** Processing line: ~ s.sprite~ + 580,6440,640,6320 +** Processing line: ~ 640,6320,640,6180~ - Inside source: true *** True Line Result - s.sprite -** Processing line: ~ end~ + 640,6320,640,6180 +** Processing line: ~ 580,6080,640,6180~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 580,6080,640,6180 +** Processing line: ~ 580,6080,640,5960~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 580,6080,640,5960 +** Processing line: ~ 640,5960,640,5840~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 640,5960,640,5840 +** Processing line: ~ 640,5840,640,5700~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc~ + 640,5840,640,5700 +** Processing line: ~ 640,5700,660,5560~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calc_generate_stage~ + 640,5700,660,5560 +** Processing line: ~ 660,5560,660,5440~ - Inside source: true *** True Line Result - calc_generate_stage -** Processing line: ~ calc_current_turn~ + 660,5560,660,5440 +** Processing line: ~ 660,5440,660,5300~ - Inside source: true *** True Line Result - calc_current_turn -** Processing line: ~ calc_banana~ + 660,5440,660,5300 +** Processing line: ~ 660,5140,660,5300~ - Inside source: true *** True Line Result - calc_banana -** Processing line: ~ end~ + 660,5140,660,5300 +** Processing line: ~ 660,5140,660,5000~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 660,5140,660,5000 +** Processing line: ~ 660,5000,660,4880~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_current_turn~ + 660,5000,660,4880 +** Processing line: ~ 660,4880,820,4860~ - Inside source: true *** True Line Result - def calc_current_turn -** Processing line: ~ return if state.current_turn~ + 660,4880,820,4860 +** Processing line: ~ 820,4860,1000,4840~ - Inside source: true *** True Line Result - return if state.current_turn -** Processing line: ~~ + 820,4860,1000,4840 +** Processing line: ~ 1000,4840,1100,4860~ - Inside source: true *** True Line Result - -** Processing line: ~ state.current_turn = :player_1_angle~ + 1000,4840,1100,4860 +** Processing line: ~ 1100,4860,1280,4860~ - Inside source: true *** True Line Result - state.current_turn = :player_1_angle -** Processing line: ~ state.current_turn = :player_2_angle if state.first_strike == :player_2~ + 1100,4860,1280,4860 +** Processing line: ~ 1280,4860,1420,4840~ - Inside source: true *** True Line Result - state.current_turn = :player_2_angle if state.first_strike == :player_2 -** Processing line: ~ end~ + 1280,4860,1420,4840 +** Processing line: ~ 1420,4840,1580,4860~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1420,4840,1580,4860 +** Processing line: ~ 1580,4860,1720,4820~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_generate_stage~ + 1580,4860,1720,4820 +** Processing line: ~ 1720,4820,1880,4860~ - Inside source: true *** True Line Result - def calc_generate_stage -** Processing line: ~ return if state.stage_generated~ + 1720,4820,1880,4860 +** Processing line: ~ 1880,4860,2000,4840~ - Inside source: true *** True Line Result - return if state.stage_generated -** Processing line: ~~ + 1880,4860,2000,4840 +** Processing line: ~ 2000,4840,2140,4840~ - Inside source: true *** True Line Result - -** Processing line: ~ state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)~ + 2000,4840,2140,4840 +** Processing line: ~ 2140,4840,2320,4860~ - Inside source: true *** True Line Result - state.buildings << building_prefab(state.building_spacing + -20, *random_building_size) -** Processing line: ~ 8.numbers.inject(state.buildings) do |buildings, i|~ + 2140,4840,2320,4860 +** Processing line: ~ 2320,4860,2440,4880~ - Inside source: true *** True Line Result - 8.numbers.inject(state.buildings) do |buildings, i| -** Processing line: ~ buildings <<~ + 2320,4860,2440,4880 +** Processing line: ~ 2440,4880,2600,4880~ - Inside source: true *** True Line Result - buildings << -** Processing line: ~ building_prefab(state.building_spacing +~ + 2440,4880,2600,4880 +** Processing line: ~ 2600,4880,2800,4880~ - Inside source: true *** True Line Result - building_prefab(state.building_spacing + -** Processing line: ~ state.buildings.last.right,~ + 2600,4880,2800,4880 +** Processing line: ~ 2800,4880,2900,4880~ - Inside source: true *** True Line Result - state.buildings.last.right, -** Processing line: ~ *random_building_size)~ + 2800,4880,2900,4880 +** Processing line: ~ 2900,4880,2900,4820~ - Inside source: true *** True Line Result - *random_building_size) -** Processing line: ~ end~ + 2900,4880,2900,4820 +** Processing line: ~ 2900,4740,2900,4820~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2900,4740,2900,4820 +** Processing line: ~ 2800,4700,2900,4740~ - Inside source: true *** True Line Result - -** Processing line: ~ building_two = state.buildings[1]~ + 2800,4700,2900,4740 +** Processing line: ~ 2520,4680,2800,4700~ - Inside source: true *** True Line Result - building_two = state.buildings[1] -** Processing line: ~ state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),~ + 2520,4680,2800,4700 +** Processing line: ~ 2240,4660,2520,4680~ - Inside source: true *** True Line Result - state.player_1 = new_player(building_two.x + building_two.w.fdiv(2), -** Processing line: ~ building_two.h)~ + 2240,4660,2520,4680 +** Processing line: ~ 1940,4620,2240,4660~ - Inside source: true *** True Line Result - building_two.h) -** Processing line: ~~ + 1940,4620,2240,4660 +** Processing line: ~ 1820,4580,1940,4620~ - Inside source: true *** True Line Result - -** Processing line: ~ building_nine = state.buildings[-3]~ + 1820,4580,1940,4620 +** Processing line: ~ 1820,4500,1820,4580~ - Inside source: true *** True Line Result - building_nine = state.buildings[-3] -** Processing line: ~ state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),~ + 1820,4500,1820,4580 +** Processing line: ~ 1820,4500,1880,4420~ - Inside source: true *** True Line Result - state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2), -** Processing line: ~ building_nine.h)~ + 1820,4500,1880,4420 +** Processing line: ~ 1880,4420,2000,4420~ - Inside source: true *** True Line Result - building_nine.h) -** Processing line: ~ state.stage_generated = true~ + 1880,4420,2000,4420 +** Processing line: ~ 2000,4420,2200,4420~ - Inside source: true *** True Line Result - state.stage_generated = true -** Processing line: ~ state.wind = 1.randomize(:ratio, :sign)~ + 2000,4420,2200,4420 +** Processing line: ~ 2200,4420,2400,4440~ - Inside source: true *** True Line Result - state.wind = 1.randomize(:ratio, :sign) -** Processing line: ~ end~ + 2200,4420,2400,4440 +** Processing line: ~ 2400,4440,2600,4440~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2400,4440,2600,4440 +** Processing line: ~ 2600,4440,2840,4440~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_player x, y~ + 2600,4440,2840,4440 +** Processing line: ~ 2840,4440,2900,4400~ - Inside source: true *** True Line Result - def new_player x, y -** Processing line: ~ state.new_entity(:gorilla) do |p|~ + 2840,4440,2900,4400 +** Processing line: ~ 2740,4260,2900,4280~ - Inside source: true *** True Line Result - state.new_entity(:gorilla) do |p| -** Processing line: ~ p.x = x - 25~ + 2740,4260,2900,4280 +** Processing line: ~ 2600,4240,2740,4260~ - Inside source: true *** True Line Result - p.x = x - 25 -** Processing line: ~ p.y = y~ + 2600,4240,2740,4260 +** Processing line: ~ 2480,4280,2600,4240~ - Inside source: true *** True Line Result - p.y = y -** Processing line: ~ p.solid = [p.x, p.y, 50, 50]~ + 2480,4280,2600,4240 +** Processing line: ~ 2320,4240,2480,4280~ - Inside source: true *** True Line Result - p.solid = [p.x, p.y, 50, 50] -** Processing line: ~ end~ + 2320,4240,2480,4280 +** Processing line: ~ 2140,4220,2320,4240~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 2140,4220,2320,4240 +** Processing line: ~ 1940,4220,2140,4220~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1940,4220,2140,4220 +** Processing line: ~ 1880,4160,1940,4220~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_banana~ + 1880,4160,1940,4220 +** Processing line: ~ 1880,4160,1880,4080~ - Inside source: true *** True Line Result - def calc_banana -** Processing line: ~ return unless state.banana~ + 1880,4160,1880,4080 +** Processing line: ~ 1880,4080,2040,4040~ - Inside source: true *** True Line Result - return unless state.banana -** Processing line: ~~ + 1880,4080,2040,4040 +** Processing line: ~ 2040,4040,2240,4060~ - Inside source: true *** True Line Result - -** Processing line: ~ state.banana.x += state.banana.dx~ + 2040,4040,2240,4060 +** Processing line: ~ 2240,4060,2400,4040~ - Inside source: true *** True Line Result - state.banana.x += state.banana.dx -** Processing line: ~ state.banana.dx += state.wind.fdiv(50)~ + 2240,4060,2400,4040 +** Processing line: ~ 2400,4040,2600,4060~ - Inside source: true *** True Line Result - state.banana.dx += state.wind.fdiv(50) -** Processing line: ~ state.banana.y += state.banana.dy~ + 2400,4040,2600,4060 +** Processing line: ~ 2600,4060,2740,4020~ - Inside source: true *** True Line Result - state.banana.y += state.banana.dy -** Processing line: ~ state.banana.dy -= state.gravity~ + 2600,4060,2740,4020 +** Processing line: ~ 2740,4020,2840,3940~ - Inside source: true *** True Line Result - state.banana.dy -= state.gravity -** Processing line: ~ banana_collision = [state.banana.x, state.banana.y, 10, 10]~ + 2740,4020,2840,3940 +** Processing line: ~ 2840,3780,2840,3940~ - Inside source: true *** True Line Result - banana_collision = [state.banana.x, state.banana.y, 10, 10] -** Processing line: ~~ + 2840,3780,2840,3940 +** Processing line: ~ 2740,3660,2840,3780~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)~ + 2740,3660,2840,3780 +** Processing line: ~ 2700,3680,2740,3660~ - Inside source: true *** True Line Result - if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid) -** Processing line: ~ state.over = true~ + 2700,3680,2740,3660 +** Processing line: ~ 2520,3700,2700,3680~ - Inside source: true *** True Line Result - state.over = true -** Processing line: ~ if state.banana.owner == state.player_2~ + 2520,3700,2700,3680 +** Processing line: ~ 2380,3700,2520,3700~ - Inside source: true *** True Line Result - if state.banana.owner == state.player_2 -** Processing line: ~ state.winner = :player_2~ + 2380,3700,2520,3700 +** Processing line: ~ 2200,3720,2380,3700~ - Inside source: true *** True Line Result - state.winner = :player_2 -** Processing line: ~ else~ + 2200,3720,2380,3700 +** Processing line: ~ 2040,3720,2200,3720~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.winner = :player_1~ + 2040,3720,2200,3720 +** Processing line: ~ 1880,3700,2040,3720~ - Inside source: true *** True Line Result - state.winner = :player_1 -** Processing line: ~ end~ + 1880,3700,2040,3720 +** Processing line: ~ 1820,3680,1880,3700~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1820,3680,1880,3700 +** Processing line: ~ 1760,3600,1820,3680~ - Inside source: true *** True Line Result - -** Processing line: ~ state.player_2_score += 1~ + 1760,3600,1820,3680 +** Processing line: ~ 1760,3600,1820,3480~ - Inside source: true *** True Line Result - state.player_2_score += 1 -** Processing line: ~ elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)~ + 1760,3600,1820,3480 +** Processing line: ~ 1820,3480,1880,3440~ - Inside source: true *** True Line Result - elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid) -** Processing line: ~ state.over = true~ + 1820,3480,1880,3440 +** Processing line: ~ 1880,3440,1960,3460~ - Inside source: true *** True Line Result - state.over = true -** Processing line: ~ if state.banana.owner == state.player_2~ + 1880,3440,1960,3460 +** Processing line: ~ 1960,3460,2140,3460~ - Inside source: true *** True Line Result - if state.banana.owner == state.player_2 -** Processing line: ~ state.winner = :player_1~ + 1960,3460,2140,3460 +** Processing line: ~ 2140,3460,2380,3460~ - Inside source: true *** True Line Result - state.winner = :player_1 -** Processing line: ~ else~ + 2140,3460,2380,3460 +** Processing line: ~ 2380,3460,2640,3440~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.winner = :player_2~ + 2380,3460,2640,3440 +** Processing line: ~ 2640,3440,2900,3380~ - Inside source: true *** True Line Result - state.winner = :player_2 -** Processing line: ~ end~ + 2640,3440,2900,3380 +** Processing line: ~ 2840,3280,2900,3380~ - Inside source: true *** True Line Result - end -** Processing line: ~ state.player_1_score += 1~ + 2840,3280,2900,3380 +** Processing line: ~ 2840,3280,2900,3200~ - Inside source: true *** True Line Result - state.player_1_score += 1 -** Processing line: ~ end~ + 2840,3280,2900,3200 +** Processing line: ~ 2900,3200,2900,3140~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2900,3200,2900,3140 +** Processing line: ~ 2840,3020,2900,3140~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.over~ + 2840,3020,2900,3140 +** Processing line: ~ 2800,2960,2840,3020~ - Inside source: true *** True Line Result - if state.over -** Processing line: ~ place_hole~ + 2800,2960,2840,3020 +** Processing line: ~ 2700,3000,2800,2960~ - Inside source: true *** True Line Result - place_hole -** Processing line: ~ return~ + 2700,3000,2800,2960 +** Processing line: ~ 2600,2980,2700,3000~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 2600,2980,2700,3000 +** Processing line: ~ 2380,3000,2600,2980~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2380,3000,2600,2980 +** Processing line: ~ 2140,3000,2380,3000~ - Inside source: true *** True Line Result - -** Processing line: ~ return if state.holes.any? do |h|~ + 2140,3000,2380,3000 +** Processing line: ~ 1880,3000,2140,3000~ - Inside source: true *** True Line Result - return if state.holes.any? do |h| -** Processing line: ~ h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]~ + 1880,3000,2140,3000 +** Processing line: ~ 1720,3040,1880,3000~ - Inside source: true *** True Line Result - h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10] -** Processing line: ~ end~ + 1720,3040,1880,3000 +** Processing line: ~ 1640,2960,1720,3040~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1640,2960,1720,3040 +** Processing line: ~ 1500,2940,1640,2960~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless state.banana.y < 0 || state.buildings.any? do |b|~ + 1500,2940,1640,2960 +** Processing line: ~ 1340,3000,1500,2940~ - Inside source: true *** True Line Result - return unless state.banana.y < 0 || state.buildings.any? do |b| -** Processing line: ~ b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]~ + 1340,3000,1500,2940 +** Processing line: ~ 1240,3000,1340,3000~ - Inside source: true *** True Line Result - b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1] -** Processing line: ~ end~ + 1240,3000,1340,3000 +** Processing line: ~ 1140,3020,1240,3000~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1140,3020,1240,3000 +** Processing line: ~ 1040,3000,1140,3020~ - Inside source: true *** True Line Result - -** Processing line: ~ place_hole~ + 1040,3000,1140,3020 +** Processing line: ~ 960,2960,1040,3000~ - Inside source: true *** True Line Result - place_hole -** Processing line: ~ end~ + 960,2960,1040,3000 +** Processing line: ~ 900,2960,960,2960~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 900,2960,960,2960 +** Processing line: ~ 840,2840,900,2960~ - Inside source: true *** True Line Result - -** Processing line: ~ def place_hole~ + 840,2840,900,2960 +** Processing line: ~ 700,2820,840,2840~ - Inside source: true *** True Line Result - def place_hole -** Processing line: ~ return unless state.banana~ + 700,2820,840,2840 +** Processing line: ~ 540,2820,700,2820~ - Inside source: true *** True Line Result - return unless state.banana -** Processing line: ~~ + 540,2820,700,2820 +** Processing line: ~ 420,2820,540,2820~ - Inside source: true *** True Line Result - -** Processing line: ~ state.holes << state.new_entity(:banana) do |b|~ + 420,2820,540,2820 +** Processing line: ~ 180,2800,420,2820~ - Inside source: true *** True Line Result - state.holes << state.new_entity(:banana) do |b| -** Processing line: ~ b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']~ + 180,2800,420,2820 +** Processing line: ~ 60,2780,180,2800~ - Inside source: true *** True Line Result - b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png'] -** Processing line: ~ end~ + 60,2780,180,2800 +** Processing line: ~ -60,2800,60,2780~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -60,2800,60,2780 +** Processing line: ~ -160,2760,-60,2800~ - Inside source: true *** True Line Result - -** Processing line: ~ state.banana = nil~ + -160,2760,-60,2800 +** Processing line: ~ -260,2740,-160,2760~ - Inside source: true *** True Line Result - state.banana = nil -** Processing line: ~ end~ + -260,2740,-160,2760 +** Processing line: ~ -300,2640,-260,2740~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -300,2640,-260,2740 +** Processing line: ~ -360,2560,-300,2640~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs_main~ + -360,2560,-300,2640 +** Processing line: ~ -380,2460,-360,2560~ - Inside source: true *** True Line Result - def process_inputs_main -** Processing line: ~ return if state.banana~ + -380,2460,-360,2560 +** Processing line: ~ -380,2460,-300,2380~ - Inside source: true *** True Line Result - return if state.banana -** Processing line: ~ return if state.over~ + -380,2460,-300,2380 +** Processing line: ~ -300,2300,-300,2380~ - Inside source: true *** True Line Result - return if state.over -** Processing line: ~~ + -300,2300,-300,2380 +** Processing line: ~ -300,2300,-300,2220~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.key_down.enter~ + -300,2300,-300,2220 +** Processing line: ~ -300,2100,-300,2220~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.enter -** Processing line: ~ input_execute_turn~ + -300,2100,-300,2220 +** Processing line: ~ -300,2100,-300,2040~ - Inside source: true *** True Line Result - input_execute_turn -** Processing line: ~ elsif inputs.keyboard.key_down.backspace~ + -300,2100,-300,2040 +** Processing line: ~ -300,2040,-160,2040~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.backspace -** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ + -300,2040,-160,2040 +** Processing line: ~ -160,2040,-60,2040~ - Inside source: true *** True Line Result - state.as_hash[state.current_turn] ||= "" -** Processing line: ~ state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2]~ + -160,2040,-60,2040 +** Processing line: ~ -60,2040,60,2040~ - Inside source: true *** True Line Result - state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2] -** Processing line: ~ elsif inputs.keyboard.key_down.char~ + -60,2040,60,2040 +** Processing line: ~ 60,2040,180,2040~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.char -** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ + 60,2040,180,2040 +** Processing line: ~ 180,2040,360,2040~ - Inside source: true *** True Line Result - state.as_hash[state.current_turn] ||= "" -** Processing line: ~ state.as_hash[state.current_turn] += inputs.keyboard.key_down.char~ + 180,2040,360,2040 +** Processing line: ~ 360,2040,540,2040~ - Inside source: true *** True Line Result - state.as_hash[state.current_turn] += inputs.keyboard.key_down.char -** Processing line: ~ end~ + 360,2040,540,2040 +** Processing line: ~ 540,2040,700,2080~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 540,2040,700,2080 +** Processing line: ~ 660,2160,700,2080~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 660,2160,700,2080 +** Processing line: ~ 660,2160,700,2260~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs_game_over~ + 660,2160,700,2260 +** Processing line: ~ 660,2380,700,2260~ - Inside source: true *** True Line Result - def process_inputs_game_over -** Processing line: ~ return unless state.over~ + 660,2380,700,2260 +** Processing line: ~ 500,2340,660,2380~ - Inside source: true *** True Line Result - return unless state.over -** Processing line: ~ return unless inputs.keyboard.key_down.truthy_keys.any?~ + 500,2340,660,2380 +** Processing line: ~ 360,2340,500,2340~ - Inside source: true *** True Line Result - return unless inputs.keyboard.key_down.truthy_keys.any? -** Processing line: ~ state.over = false~ + 360,2340,500,2340 +** Processing line: ~ 240,2340,360,2340~ - Inside source: true *** True Line Result - state.over = false -** Processing line: ~ outputs.static_solids.clear~ + 240,2340,360,2340 +** Processing line: ~ 40,2320,240,2340~ - Inside source: true *** True Line Result - outputs.static_solids.clear -** Processing line: ~ state.buildings.clear~ + 40,2320,240,2340 +** Processing line: ~ -60,2320,40,2320~ - Inside source: true *** True Line Result - state.buildings.clear -** Processing line: ~ state.holes.clear~ + -60,2320,40,2320 +** Processing line: ~ -100,2380,-60,2320~ - Inside source: true *** True Line Result - state.holes.clear -** Processing line: ~ state.stage_generated = false~ + -100,2380,-60,2320 +** Processing line: ~ -100,2380,-100,2460~ - Inside source: true *** True Line Result - state.stage_generated = false -** Processing line: ~ state.stage_rendered = false~ + -100,2380,-100,2460 +** Processing line: ~ -100,2460,-100,2540~ - Inside source: true *** True Line Result - state.stage_rendered = false -** Processing line: ~ if state.first_strike == :player_1~ + -100,2460,-100,2540 +** Processing line: ~ -100,2540,0,2560~ - Inside source: true *** True Line Result - if state.first_strike == :player_1 -** Processing line: ~ state.first_strike = :player_2~ + -100,2540,0,2560 +** Processing line: ~ 0,2560,140,2600~ - Inside source: true *** True Line Result - state.first_strike = :player_2 -** Processing line: ~ else~ + 0,2560,140,2600 +** Processing line: ~ 140,2600,300,2600~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.first_strike = :player_1~ + 140,2600,300,2600 +** Processing line: ~ 300,2600,460,2600~ - Inside source: true *** True Line Result - state.first_strike = :player_1 -** Processing line: ~ end~ + 300,2600,460,2600 +** Processing line: ~ 460,2600,640,2600~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 460,2600,640,2600 +** Processing line: ~ 640,2600,760,2580~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 640,2600,760,2580 +** Processing line: ~ 760,2580,820,2560~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs~ + 760,2580,820,2560 +** Processing line: ~ 820,2560,820,2500~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ process_inputs_main~ + 820,2560,820,2500 +** Processing line: ~ 820,2500,820,2400~ - Inside source: true *** True Line Result - process_inputs_main -** Processing line: ~ process_inputs_game_over~ + 820,2500,820,2400 +** Processing line: ~ 820,2400,840,2320~ - Inside source: true *** True Line Result - process_inputs_game_over -** Processing line: ~ end~ + 820,2400,840,2320 +** Processing line: ~ 840,2320,840,2240~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 840,2320,840,2240 +** Processing line: ~ 820,2120,840,2240~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_execute_turn~ + 820,2120,840,2240 +** Processing line: ~ 820,2020,820,2120~ - Inside source: true *** True Line Result - def input_execute_turn -** Processing line: ~ return if state.banana~ + 820,2020,820,2120 +** Processing line: ~ 820,1900,820,2020~ - Inside source: true *** True Line Result - return if state.banana -** Processing line: ~~ + 820,1900,820,2020 +** Processing line: ~ 760,1840,820,1900~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)~ + 760,1840,820,1900 +** Processing line: ~ 640,1840,760,1840~ - Inside source: true *** True Line Result - if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle) -** Processing line: ~ state.current_turn = :player_1_velocity~ + 640,1840,760,1840 +** Processing line: ~ 500,1840,640,1840~ - Inside source: true *** True Line Result - state.current_turn = :player_1_velocity -** Processing line: ~ elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)~ + 500,1840,640,1840 +** Processing line: ~ 300,1860,420,1880~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity) -** Processing line: ~ state.current_turn = :player_2_angle~ + 300,1860,420,1880 +** Processing line: ~ 180,1840,300,1860~ - Inside source: true *** True Line Result - state.current_turn = :player_2_angle -** Processing line: ~ state.banana =~ + 180,1840,300,1860 +** Processing line: ~ 420,1880,500,1840~ - Inside source: true *** True Line Result - state.banana = -** Processing line: ~ new_banana(state.player_1,~ + 420,1880,500,1840 +** Processing line: ~ 0,1840,180,1840~ - Inside source: true *** True Line Result - new_banana(state.player_1, -** Processing line: ~ state.player_1.x + 25,~ + 0,1840,180,1840 +** Processing line: ~ -60,1860,0,1840~ - Inside source: true *** True Line Result - state.player_1.x + 25, -** Processing line: ~ state.player_1.y + 60,~ + -60,1860,0,1840 +** Processing line: ~ -160,1840,-60,1860~ - Inside source: true *** True Line Result - state.player_1.y + 60, -** Processing line: ~ state.player_1_angle,~ + -160,1840,-60,1860 +** Processing line: ~ -200,1800,-160,1840~ - Inside source: true *** True Line Result - state.player_1_angle, -** Processing line: ~ state.player_1_velocity)~ + -200,1800,-160,1840 +** Processing line: ~ -260,1760,-200,1800~ - Inside source: true *** True Line Result - state.player_1_velocity) -** Processing line: ~ elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)~ + -260,1760,-200,1800 +** Processing line: ~ -260,1680,-260,1760~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle) -** Processing line: ~ state.current_turn = :player_2_velocity~ + -260,1680,-260,1760 +** Processing line: ~ -260,1620,-260,1680~ - Inside source: true *** True Line Result - state.current_turn = :player_2_velocity -** Processing line: ~ elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)~ + -260,1620,-260,1680 +** Processing line: ~ -260,1540,-260,1620~ - Inside source: true *** True Line Result - elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity) -** Processing line: ~ state.current_turn = :player_1_angle~ + -260,1540,-260,1620 +** Processing line: ~ -260,1540,-260,1460~ - Inside source: true *** True Line Result - state.current_turn = :player_1_angle -** Processing line: ~ state.banana =~ + -260,1540,-260,1460 +** Processing line: ~ -300,1420,-260,1460~ - Inside source: true *** True Line Result - state.banana = -** Processing line: ~ new_banana(state.player_2,~ + -300,1420,-260,1460 +** Processing line: ~ -300,1420,-300,1340~ - Inside source: true *** True Line Result - new_banana(state.player_2, -** Processing line: ~ state.player_2.x + 25,~ + -300,1420,-300,1340 +** Processing line: ~ -300,1340,-260,1260~ - Inside source: true *** True Line Result - state.player_2.x + 25, -** Processing line: ~ state.player_2.y + 60,~ + -300,1340,-260,1260 +** Processing line: ~ -260,1260,-260,1160~ - Inside source: true *** True Line Result - state.player_2.y + 60, -** Processing line: ~ 180 - state.player_2_angle,~ + -260,1260,-260,1160 +** Processing line: ~ -260,1060,-260,1160~ - Inside source: true *** True Line Result - 180 - state.player_2_angle, -** Processing line: ~ state.player_2_velocity)~ + -260,1060,-260,1160 +** Processing line: ~ -260,1060,-260,960~ - Inside source: true *** True Line Result - state.player_2_velocity) -** Processing line: ~ end~ + -260,1060,-260,960 +** Processing line: ~ -260,880,-260,960~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -260,880,-260,960 +** Processing line: ~ -260,880,-260,780~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.banana~ + -260,880,-260,780 +** Processing line: ~ -260,780,-260,680~ - Inside source: true *** True Line Result - if state.banana -** Processing line: ~ state.player_1_angle = nil~ + -260,780,-260,680 +** Processing line: ~ -300,580,-260,680~ - Inside source: true *** True Line Result - state.player_1_angle = nil -** Processing line: ~ state.player_1_velocity = nil~ + -300,580,-260,680 +** Processing line: ~ -300,580,-300,480~ - Inside source: true *** True Line Result - state.player_1_velocity = nil -** Processing line: ~ state.player_2_angle = nil~ + -300,580,-300,480 +** Processing line: ~ -300,480,-260,400~ - Inside source: true *** True Line Result - state.player_2_angle = nil -** Processing line: ~ state.player_2_velocity = nil~ + -300,480,-260,400 +** Processing line: ~ -300,320,-260,400~ - Inside source: true *** True Line Result - state.player_2_velocity = nil -** Processing line: ~ end~ + -300,320,-260,400 +** Processing line: ~ -300,320,-300,240~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + -300,320,-300,240 +** Processing line: ~ -300,240,-200,220~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -300,240,-200,220 +** Processing line: ~ -200,220,-200,160~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_building_size~ + -200,220,-200,160 +** Processing line: ~ -200,160,-100,140~ - Inside source: true *** True Line Result - def random_building_size -** Processing line: ~ [state.building_heights.sample, state.building_room_sizes.sample]~ + -200,160,-100,140 +** Processing line: ~ -100,140,0,120~ - Inside source: true *** True Line Result - [state.building_heights.sample, state.building_room_sizes.sample] -** Processing line: ~ end~ + -100,140,0,120 +** Processing line: ~ 0,120,60,120~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 0,120,60,120 +** Processing line: ~ 60,120,180,120~ - Inside source: true *** True Line Result - -** Processing line: ~ def int? v~ + 60,120,180,120 +** Processing line: ~ 180,120,300,120~ - Inside source: true *** True Line Result - def int? v -** Processing line: ~ v.to_i.to_s == v.to_s~ + 180,120,300,120 +** Processing line: ~ 300,120,420,140~ - Inside source: true *** True Line Result - v.to_i.to_s == v.to_s -** Processing line: ~ end~ + 300,120,420,140 +** Processing line: ~ 420,140,580,180~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 420,140,580,180 +** Processing line: ~ 580,180,760,180~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_building_color~ + 580,180,760,180 +** Processing line: ~ 760,180,900,180~ - Inside source: true *** True Line Result - def random_building_color -** Processing line: ~ [[ 99, 0, 107],~ + 760,180,900,180 +** Processing line: ~ 960,180,1100,180~ - Inside source: true *** True Line Result - [[ 99, 0, 107], -** Processing line: ~ [ 35, 64, 124],~ + 960,180,1100,180 +** Processing line: ~ 1100,180,1340,200~ - Inside source: true *** True Line Result - [ 35, 64, 124], -** Processing line: ~ [ 35, 136, 162],~ + 1100,180,1340,200 +** Processing line: ~ 1340,200,1580,200~ - Inside source: true *** True Line Result - [ 35, 136, 162], -** Processing line: ~ ].sample~ + 1340,200,1580,200 +** Processing line: ~ 1580,200,1720,180~ - Inside source: true *** True Line Result - ].sample -** Processing line: ~ end~ + 1580,200,1720,180 +** Processing line: ~ 1720,180,2000,140~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1720,180,2000,140 +** Processing line: ~ 2000,140,2240,140~ - Inside source: true *** True Line Result - -** Processing line: ~ def random_window_color~ + 2000,140,2240,140 +** Processing line: ~ 2240,140,2480,140~ - Inside source: true *** True Line Result - def random_window_color -** Processing line: ~ [[ 88, 62, 104],~ + 2240,140,2480,140 +** Processing line: ~ 2520,140,2800,160~ - Inside source: true *** True Line Result - [[ 88, 62, 104], -** Processing line: ~ [253, 224, 187]].sample~ + 2520,140,2800,160 +** Processing line: ~ 2800,160,3000,160~ - Inside source: true *** True Line Result - [253, 224, 187]].sample -** Processing line: ~ end~ + 2800,160,3000,160 +** Processing line: ~ 3000,160,3140,160~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3000,160,3140,160 +** Processing line: ~ 3140,260,3140,160~ - Inside source: true *** True Line Result - -** Processing line: ~ def windows_for_building starting_x, floors, rooms~ + 3140,260,3140,160 +** Processing line: ~ 3140,260,3140,380~ - Inside source: true *** True Line Result - def windows_for_building starting_x, floors, rooms -** Processing line: ~ floors.-(1).combinations(rooms - 1).map do |floor, room|~ + 3140,260,3140,380 +** Processing line: ~ 3080,500,3140,380~ - Inside source: true *** True Line Result - floors.-(1).combinations(rooms - 1).map do |floor, room| -** Processing line: ~ [starting_x +~ + 3080,500,3140,380 +** Processing line: ~ 3080,620,3080,500~ - Inside source: true *** True Line Result - [starting_x + -** Processing line: ~ state.building_room_width.*(room) +~ + 3080,620,3080,500 +** Processing line: ~ 3080,620,3080,740~ - Inside source: true *** True Line Result - state.building_room_width.*(room) + -** Processing line: ~ state.building_room_spacing.*(room + 1),~ + 3080,620,3080,740 +** Processing line: ~ 3080,740,3080,840~ - Inside source: true *** True Line Result - state.building_room_spacing.*(room + 1), -** Processing line: ~ state.building_room_height.*(floor) +~ + 3080,740,3080,840 +** Processing line: ~ 3080,960,3080,840~ - Inside source: true *** True Line Result - state.building_room_height.*(floor) + -** Processing line: ~ state.building_room_spacing.*(floor + 1),~ + 3080,960,3080,840 +** Processing line: ~ 3080,1080,3080,960~ - Inside source: true *** True Line Result - state.building_room_spacing.*(floor + 1), -** Processing line: ~ state.building_room_width,~ + 3080,1080,3080,960 +** Processing line: ~ 3080,1080,3080,1200~ - Inside source: true *** True Line Result - state.building_room_width, -** Processing line: ~ state.building_room_height,~ + 3080,1080,3080,1200 +** Processing line: ~ 3080,1200,3080,1340~ - Inside source: true *** True Line Result - state.building_room_height, -** Processing line: ~ random_window_color]~ + 3080,1200,3080,1340 +** Processing line: ~ 3080,1340,3080,1460~ - Inside source: true *** True Line Result - random_window_color] -** Processing line: ~ end~ + 3080,1340,3080,1460 +** Processing line: ~ 3080,1580,3080,1460~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3080,1580,3080,1460 +** Processing line: ~ 3080,1700,3080,1580~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3080,1700,3080,1580 +** Processing line: ~ 3080,1700,3080,1760~ - Inside source: true *** True Line Result - -** Processing line: ~ def building_prefab starting_x, floors, rooms~ + 3080,1700,3080,1760 +** Processing line: ~ 3080,1760,3200,1760~ - Inside source: true *** True Line Result - def building_prefab starting_x, floors, rooms -** Processing line: ~ state.new_entity(:building) do |b|~ + 3080,1760,3200,1760 +** Processing line: ~ 3200,1760,3320,1760~ - Inside source: true *** True Line Result - state.new_entity(:building) do |b| -** Processing line: ~ b.x = starting_x~ + 3200,1760,3320,1760 +** Processing line: ~ 3320,1760,3520,1760~ - Inside source: true *** True Line Result - b.x = starting_x -** Processing line: ~ b.y = 0~ + 3320,1760,3520,1760 +** Processing line: ~ 3520,1760,3680,1740~ - Inside source: true *** True Line Result - b.y = 0 -** Processing line: ~ b.w = state.building_room_width.*(rooms) +~ + 3520,1760,3680,1740 +** Processing line: ~ 3680,1740,3780,1700~ - Inside source: true *** True Line Result - b.w = state.building_room_width.*(rooms) + -** Processing line: ~ state.building_room_spacing.*(rooms + 1)~ + 3680,1740,3780,1700 +** Processing line: ~ 3780,1700,3840,1620~ - Inside source: true *** True Line Result - state.building_room_spacing.*(rooms + 1) -** Processing line: ~ b.h = state.building_room_height.*(floors) +~ + 3780,1700,3840,1620 +** Processing line: ~ 3840,1620,3840,1520~ - Inside source: true *** True Line Result - b.h = state.building_room_height.*(floors) + -** Processing line: ~ state.building_room_spacing.*(floors + 1)~ + 3840,1620,3840,1520 +** Processing line: ~ 3840,1520,3840,1420~ - Inside source: true *** True Line Result - state.building_room_spacing.*(floors + 1) -** Processing line: ~ b.right = b.x + b.w~ + 3840,1520,3840,1420 +** Processing line: ~ 3840,1320,3840,1420~ - Inside source: true *** True Line Result - b.right = b.x + b.w -** Processing line: ~ b.rect = [b.x, b.y, b.w, b.h]~ + 3840,1320,3840,1420 +** Processing line: ~ 3840,1120,3840,1320~ - Inside source: true *** True Line Result - b.rect = [b.x, b.y, b.w, b.h] -** Processing line: ~ b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],~ + 3840,1120,3840,1320 +** Processing line: ~ 3840,1120,3840,940~ - Inside source: true *** True Line Result - b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white], -** Processing line: ~ [b.x, b.y, b.w, b.h, random_building_color],~ + 3840,1120,3840,940 +** Processing line: ~ 3840,940,3840,760~ - Inside source: true *** True Line Result - [b.x, b.y, b.w, b.h, random_building_color], -** Processing line: ~ windows_for_building(b.x, floors, rooms)]~ + 3840,940,3840,760 +** Processing line: ~ 3780,600,3840,760~ - Inside source: true *** True Line Result - windows_for_building(b.x, floors, rooms)] -** Processing line: ~ end~ + 3780,600,3840,760 +** Processing line: ~ 3780,600,3780,440~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3780,600,3780,440 +** Processing line: ~ 3780,320,3780,440~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3780,320,3780,440 +** Processing line: ~ 3780,320,3780,160~ - Inside source: true *** True Line Result - -** Processing line: ~ def parse_or_clear! game_prop~ + 3780,320,3780,160 +** Processing line: ~ 3780,60,3780,160~ - Inside source: true *** True Line Result - def parse_or_clear! game_prop -** Processing line: ~ if int? state.as_hash[game_prop]~ + 3780,60,3780,160 +** Processing line: ~ 3780,60,4020,60~ - Inside source: true *** True Line Result - if int? state.as_hash[game_prop] -** Processing line: ~ state.as_hash[game_prop] = state.as_hash[game_prop].to_i~ + 3780,60,4020,60 +** Processing line: ~ 4020,60,4260,40~ - Inside source: true *** True Line Result - state.as_hash[game_prop] = state.as_hash[game_prop].to_i -** Processing line: ~ return true~ + 4020,60,4260,40 +** Processing line: ~ 4260,40,4500,40~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + 4260,40,4500,40 +** Processing line: ~ 4500,40,4740,40~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4500,40,4740,40 +** Processing line: ~ 4740,40,4840,20~ - Inside source: true *** True Line Result - -** Processing line: ~ state.as_hash[game_prop] = nil~ + 4740,40,4840,20 +** Processing line: ~ 4840,20,4880,80~ - Inside source: true *** True Line Result - state.as_hash[game_prop] = nil -** Processing line: ~ return false~ + 4840,20,4880,80 +** Processing line: ~ 4880,80,5080,40~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + 4880,80,5080,40 +** Processing line: ~ 5080,40,5280,20~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5080,40,5280,20 +** Processing line: ~ 5280,20,5500,0~ - Inside source: true *** True Line Result - -** Processing line: ~ def new_banana owner, x, y, angle, velocity~ + 5280,20,5500,0 +** Processing line: ~ 5500,0,5720,0~ - Inside source: true *** True Line Result - def new_banana owner, x, y, angle, velocity -** Processing line: ~ state.new_entity(:banana) do |b|~ + 5500,0,5720,0 +** Processing line: ~ 5720,0,5940,60~ - Inside source: true *** True Line Result - state.new_entity(:banana) do |b| -** Processing line: ~ b.owner = owner~ + 5720,0,5940,60 +** Processing line: ~ 5940,60,6240,60~ - Inside source: true *** True Line Result - b.owner = owner -** Processing line: ~ b.x = x~ + 5940,60,6240,60 +** Processing line: ~ 6240,60,6540,20~ - Inside source: true *** True Line Result - b.x = x -** Processing line: ~ b.y = y~ + 6240,60,6540,20 +** Processing line: ~ 6540,20,6840,20~ - Inside source: true *** True Line Result - b.y = y -** Processing line: ~ b.angle = angle % 360~ + 6540,20,6840,20 +** Processing line: ~ 6840,20,7040,0~ - Inside source: true *** True Line Result - b.angle = angle % 360 -** Processing line: ~ b.velocity = velocity / 5~ + 6840,20,7040,0 +** Processing line: ~ 7040,0,7140,0~ - Inside source: true *** True Line Result - b.velocity = velocity / 5 -** Processing line: ~ b.dx = b.angle.vector_x(b.velocity)~ + 7040,0,7140,0 +** Processing line: ~ 7140,0,7400,20~ - Inside source: true *** True Line Result - b.dx = b.angle.vector_x(b.velocity) -** Processing line: ~ b.dy = b.angle.vector_y(b.velocity)~ + 7140,0,7400,20 +** Processing line: ~ 7400,20,7680,0~ - Inside source: true *** True Line Result - b.dy = b.angle.vector_y(b.velocity) -** Processing line: ~ end~ + 7400,20,7680,0 +** Processing line: ~ 7680,0,7940,0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 7680,0,7940,0 +** Processing line: ~ 7940,0,8200,-20~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7940,0,8200,-20 +** Processing line: ~ 8200,-20,8360,20~ - Inside source: true *** True Line Result - -** Processing line: ~ def fancy_white~ + 8200,-20,8360,20 +** Processing line: ~ 8360,20,8560,-40~ - Inside source: true *** True Line Result - def fancy_white -** Processing line: ~ [253, 252, 253]~ + 8360,20,8560,-40 +** Processing line: ~ 8560,-40,8760,0~ - Inside source: true *** True Line Result - [253, 252, 253] -** Processing line: ~ end~ + 8560,-40,8760,0 +** Processing line: ~ 8760,0,8880,40~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 8760,0,8880,40 +** Processing line: ~ 8880,120,8880,40~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8880,120,8880,40 +** Processing line: ~ 8840,220,8840,120~ - Inside source: true *** True Line Result - -** Processing line: ~ $you_so_basic_gorillas = YouSoBasicGorillas.new~ + 8840,220,8840,120 +** Processing line: ~ 8620,240,8840,220~ - Inside source: true *** True Line Result - $you_so_basic_gorillas = YouSoBasicGorillas.new -** Processing line: ~~ + 8620,240,8840,220 +** Processing line: ~ 8420,260,8620,240~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + 8420,260,8620,240 +** Processing line: ~ 8200,280,8420,260~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $you_so_basic_gorillas.outputs = args.outputs~ + 8200,280,8420,260 +** Processing line: ~ 7940,280,8200,280~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.outputs = args.outputs -** Processing line: ~ $you_so_basic_gorillas.grid = args.grid~ + 7940,280,8200,280 +** Processing line: ~ 7760,240,7940,280~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.grid = args.grid -** Processing line: ~ $you_so_basic_gorillas.state = args.state~ + 7760,240,7940,280 +** Processing line: ~ 7560,220,7760,240~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.state = args.state -** Processing line: ~ $you_so_basic_gorillas.inputs = args.inputs~ + 7560,220,7760,240 +** Processing line: ~ 7360,280,7560,220~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.inputs = args.inputs -** Processing line: ~ $you_so_basic_gorillas.tick~ + 7360,280,7560,220 +** Processing line: ~ 7140,260,7360,280~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.tick -** Processing line: ~ end~ + 7140,260,7360,280 +** Processing line: ~ 6940,240,7140,260~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6940,240,7140,260 +** Processing line: ~ 6720,220,6940,240~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 6720,220,6940,240 +** Processing line: ~ 6480,220,6720,220~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 6480,220,6720,220 +** Processing line: ~ 6360,300,6480,220~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/repl.rb~ -- Header detected. + 6360,300,6480,220 +** Processing line: ~ 6240,300,6360,300~ +- Inside source: true *** True Line Result - + 6240,300,6360,300 +** Processing line: ~ 6200,500,6240,300~ +- Inside source: true *** True Line Result -* 99_genre_platformer/gorillas_basic/app/repl.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 6200,500,6240,300 +** Processing line: ~ 6200,500,6360,540~ +- Inside source: true *** True Line Result - + 6200,500,6360,540 +** Processing line: ~ 6360,540,6540,520~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ begin~ + 6360,540,6540,520 +** Processing line: ~ 6540,520,6720,480~ - Inside source: true *** True Line Result - begin -** Processing line: ~ if $gtk.args.state.current_turn == :player_1_angle~ + 6540,520,6720,480 +** Processing line: ~ 6720,480,6880,460~ - Inside source: true *** True Line Result - if $gtk.args.state.current_turn == :player_1_angle -** Processing line: ~ $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"~ + 6720,480,6880,460 +** Processing line: ~ 6880,460,7080,500~ - Inside source: true *** True Line Result - $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}" -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ + 6880,460,7080,500 +** Processing line: ~ 7080,500,7320,500~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.input_execute_turn -** Processing line: ~ $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ + 7080,500,7320,500 +** Processing line: ~ 7320,500,7680,500~ - Inside source: true *** True Line Result - $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}" -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ + 7320,500,7680,500 +** Processing line: ~ 7680,620,7680,500~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.input_execute_turn -** Processing line: ~ elsif $gtk.args.state.current_turn == :player_2_angle~ + 7680,620,7680,500 +** Processing line: ~ 7520,640,7680,620~ - Inside source: true *** True Line Result - elsif $gtk.args.state.current_turn == :player_2_angle -** Processing line: ~ $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"~ + 7520,640,7680,620 +** Processing line: ~ 7360,640,7520,640~ - Inside source: true *** True Line Result - $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}" -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ + 7360,640,7520,640 +** Processing line: ~ 7200,640,7360,640~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.input_execute_turn -** Processing line: ~ $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ + 7200,640,7360,640 +** Processing line: ~ 7040,660,7200,640~ - Inside source: true *** True Line Result - $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}" -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ + 7040,660,7200,640 +** Processing line: ~ 6880,720,7040,660~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.input_execute_turn -** Processing line: ~ else~ + 6880,720,7040,660 +** Processing line: ~ 6720,700,6880,720~ - Inside source: true *** True Line Result - else -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ + 6720,700,6880,720 +** Processing line: ~ 6540,700,6720,700~ - Inside source: true *** True Line Result - $you_so_basic_gorillas.input_execute_turn -** Processing line: ~ end~ + 6540,700,6720,700 +** Processing line: ~ 6420,760,6540,700~ - Inside source: true *** True Line Result - end -** Processing line: ~ rescue Exception => e~ + 6420,760,6540,700 +** Processing line: ~ 6280,740,6420,760~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ puts e~ + 6280,740,6420,760 +** Processing line: ~ 6240,760,6280,740~ - Inside source: true *** True Line Result - puts e -** Processing line: ~ end~ + 6240,760,6280,740 +** Processing line: ~ 6200,920,6240,760~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6200,920,6240,760 +** Processing line: ~ 6200,920,6360,960~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 6200,920,6360,960 +** Processing line: ~ 6360,960,6540,960~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 6360,960,6540,960 +** Processing line: ~ 6540,960,6720,960~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/tests.rb~ -- Header detected. + 6540,960,6720,960 +** Processing line: ~ 6720,960,6760,980~ +- Inside source: true *** True Line Result - + 6720,960,6760,980 +** Processing line: ~ 6760,980,6880,940~ +- Inside source: true *** True Line Result -* 99_genre_platformer/gorillas_basic/app/tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 6760,980,6880,940 +** Processing line: ~ 6880,940,7080,940~ +- Inside source: true *** True Line Result - + 6880,940,7080,940 +** Processing line: ~ 7080,940,7280,940~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ $gtk.reset 100~ + 7080,940,7280,940 +** Processing line: ~ 7280,940,7520,920~ - Inside source: true *** True Line Result - $gtk.reset 100 -** Processing line: ~ $gtk.supress_framerate_warning = true~ + 7280,940,7520,920 +** Processing line: ~ 7520,920,7760,900~ - Inside source: true *** True Line Result - $gtk.supress_framerate_warning = true -** Processing line: ~ $gtk.require 'app/tests/building_generation_tests.rb'~ + 7520,920,7760,900 +** Processing line: ~ 7760,900,7980,860~ - Inside source: true *** True Line Result - $gtk.require 'app/tests/building_generation_tests.rb' -** Processing line: ~ $gtk.tests.start~ + 7760,900,7980,860 +** Processing line: ~ 7980,860,8100,880~ - Inside source: true *** True Line Result - $gtk.tests.start -** Processing line: ~~ + 7980,860,8100,880 +** Processing line: ~ 8100,880,8280,900~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 8100,880,8280,900 +** Processing line: ~ 8280,900,8500,820~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 8280,900,8500,820 +** Processing line: ~ 8500,820,8700,820~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb~ -- Header detected. + 8500,820,8700,820 +** Processing line: ~ 8700,820,8760,840~ +- Inside source: true *** True Line Result - + 8700,820,8760,840 +** Processing line: ~ 8760,960,8760,840~ +- Inside source: true *** True Line Result -* 99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 8760,960,8760,840 +** Processing line: ~ 8700,1040,8760,960~ +- Inside source: true *** True Line Result - + 8700,1040,8760,960 +** Processing line: ~ 8560,1060,8700,1040~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def test_solids args, assert~ + 8560,1060,8700,1040 +** Processing line: ~ 8460,1080,8560,1060~ - Inside source: true *** True Line Result - def test_solids args, assert -** Processing line: ~ game = YouSoBasicGorillas.new~ + 8460,1080,8560,1060 +** Processing line: ~ 8360,1040,8460,1080~ - Inside source: true *** True Line Result - game = YouSoBasicGorillas.new -** Processing line: ~ game.outputs = args.outputs~ + 8360,1040,8460,1080 +** Processing line: ~ 8280,1080,8360,1040~ - Inside source: true *** True Line Result - game.outputs = args.outputs -** Processing line: ~ game.grid = args.grid~ + 8280,1080,8360,1040 +** Processing line: ~ 8160,1120,8280,1080~ - Inside source: true *** True Line Result - game.grid = args.grid -** Processing line: ~ game.state = args.state~ + 8160,1120,8280,1080 +** Processing line: ~ 8040,1120,8160,1120~ - Inside source: true *** True Line Result - game.state = args.state -** Processing line: ~ game.inputs = args.inputs~ + 8040,1120,8160,1120 +** Processing line: ~ 7940,1100,8040,1120~ - Inside source: true *** True Line Result - game.inputs = args.inputs -** Processing line: ~ game.tick~ + 7940,1100,8040,1120 +** Processing line: ~ 7800,1120,7940,1100~ - Inside source: true *** True Line Result - game.tick -** Processing line: ~ assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"~ + 7800,1120,7940,1100 +** Processing line: ~ 7680,1120,7800,1120~ - Inside source: true *** True Line Result - assert.true! args.state.stage_generated, "stage wasn't generated but it should have been" -** Processing line: ~ game.tick~ + 7680,1120,7800,1120 +** Processing line: ~ 7520,1100,7680,1120~ - Inside source: true *** True Line Result - game.tick -** Processing line: ~ assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"~ + 7520,1100,7680,1120 +** Processing line: ~ 7360,1100,7520,1100~ - Inside source: true *** True Line Result - assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered" -** Processing line: ~ number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)~ + 7360,1100,7520,1100 +** Processing line: ~ 7200,1120,7360,1100~ - Inside source: true *** True Line Result - number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end) -** Processing line: ~ the_only_background = 1~ + 7200,1120,7360,1100 +** Processing line: ~ 7040,1180,7200,1120~ - Inside source: true *** True Line Result - the_only_background = 1 -** Processing line: ~ static_solids = args.outputs.static_solids.length~ + 7040,1180,7200,1120 +** Processing line: ~ 6880,1160,7040,1180~ - Inside source: true *** True Line Result - static_solids = args.outputs.static_solids.length -** Processing line: ~ assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"~ + 6880,1160,7040,1180 +** Processing line: ~ 6720,1160,6880,1160~ - Inside source: true *** True Line Result - assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered" -** Processing line: ~ end~ + 6720,1160,6880,1160 +** Processing line: ~ 6540,1160,6720,1160~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6540,1160,6720,1160 +** Processing line: ~ 6360,1160,6540,1160~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 6360,1160,6540,1160 +** Processing line: ~ 6200,1160,6360,1160~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 6200,1160,6360,1160 +** Processing line: ~ 6040,1220,6200,1160~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_platformer/the_little_probe/app/main.rb~ -- Header detected. + 6040,1220,6200,1160 +** Processing line: ~ 6040,1220,6040,1400~ +- Inside source: true *** True Line Result - + 6040,1220,6040,1400 +** Processing line: ~ 6040,1400,6200,1440~ +- Inside source: true *** True Line Result -* 99_genre_platformer/the_little_probe/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 6040,1400,6200,1440 +** Processing line: ~ 6200,1440,6320,1440~ +- Inside source: true *** True Line Result - + 6200,1440,6320,1440 +** Processing line: ~ 6320,1440,6440,1440~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ class FallingCircle~ + 6320,1440,6440,1440 +** Processing line: ~ 6600,1440,6760,1440~ - Inside source: true *** True Line Result - class FallingCircle -** Processing line: ~ attr_gtk~ + 6600,1440,6760,1440 +** Processing line: ~ 6760,1440,6940,1420~ - Inside source: true *** True Line Result - attr_gtk -** Processing line: ~~ + 6760,1440,6940,1420 +** Processing line: ~ 6440,1440,6600,1440~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick~ + 6440,1440,6600,1440 +** Processing line: ~ 6940,1420,7280,1400~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ fiddle~ + 6940,1420,7280,1400 +** Processing line: ~ 7280,1400,7560,1400~ - Inside source: true *** True Line Result - fiddle -** Processing line: ~ defaults~ + 7280,1400,7560,1400 +** Processing line: ~ 7560,1400,7760,1400~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + 7560,1400,7760,1400 +** Processing line: ~ 7760,1400,7940,1360~ - Inside source: true *** True Line Result - render -** Processing line: ~ input~ + 7760,1400,7940,1360 +** Processing line: ~ 7940,1360,8100,1380~ - Inside source: true *** True Line Result - input -** Processing line: ~ calc~ + 7940,1360,8100,1380 +** Processing line: ~ 8100,1380,8280,1340~ - Inside source: true *** True Line Result - calc -** Processing line: ~ end~ + 8100,1380,8280,1340 +** Processing line: ~ 8280,1340,8460,1320~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8280,1340,8460,1320 +** Processing line: ~ 8660,1300,8760,1360~ - Inside source: true *** True Line Result - -** Processing line: ~ def fiddle~ + 8660,1300,8760,1360 +** Processing line: ~ 8460,1320,8660,1300~ - Inside source: true *** True Line Result - def fiddle -** Processing line: ~ state.gravity = -0.02~ + 8460,1320,8660,1300 +** Processing line: ~ 8760,1360,8800,1500~ - Inside source: true *** True Line Result - state.gravity = -0.02 -** Processing line: ~ circle.radius = 15~ + 8760,1360,8800,1500 +** Processing line: ~ 8800,1660,8800,1500~ - Inside source: true *** True Line Result - circle.radius = 15 -** Processing line: ~ circle.elasticity = 0.4~ + 8800,1660,8800,1500 +** Processing line: ~ 8800,1660,8800,1820~ - Inside source: true *** True Line Result - circle.elasticity = 0.4 -** Processing line: ~ camera.follow_speed = 0.4 * 0.4~ + 8800,1660,8800,1820 +** Processing line: ~ 8700,1840,8800,1820~ - Inside source: true *** True Line Result - camera.follow_speed = 0.4 * 0.4 -** Processing line: ~ end~ + 8700,1840,8800,1820 +** Processing line: ~ 8620,1860,8700,1840~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8620,1860,8700,1840 +** Processing line: ~ 8560,1800,8620,1860~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + 8560,1800,8620,1860 +** Processing line: ~ 8560,1800,8620,1680~ - Inside source: true *** True Line Result - def render -** Processing line: ~ render_stage_editor~ + 8560,1800,8620,1680 +** Processing line: ~ 8500,1640,8620,1680~ - Inside source: true *** True Line Result - render_stage_editor -** Processing line: ~ render_debug~ + 8500,1640,8620,1680 +** Processing line: ~ 8420,1680,8500,1640~ - Inside source: true *** True Line Result - render_debug -** Processing line: ~ render_game~ + 8420,1680,8500,1640 +** Processing line: ~ 8280,1680,8420,1680~ - Inside source: true *** True Line Result - render_game -** Processing line: ~ end~ + 8280,1680,8420,1680 +** Processing line: ~ 8160,1680,8280,1680~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8160,1680,8280,1680 +** Processing line: ~ 7900,1680,8160,1680~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults~ + 7900,1680,8160,1680 +** Processing line: ~ 7680,1680,7900,1680~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ if state.tick_count == 0~ + 7680,1680,7900,1680 +** Processing line: ~ 7400,1660,7680,1680~ - Inside source: true *** True Line Result - if state.tick_count == 0 -** Processing line: ~ outputs.sounds << "sounds/bg.ogg"~ + 7400,1660,7680,1680 +** Processing line: ~ 7140,1680,7400,1660~ - Inside source: true *** True Line Result - outputs.sounds << "sounds/bg.ogg" -** Processing line: ~ end~ + 7140,1680,7400,1660 +** Processing line: ~ 6880,1640,7140,1680~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6880,1640,7140,1680 +** Processing line: ~ 6040,1820,6320,1780~ - Inside source: true *** True Line Result - -** Processing line: ~ state.storyline ||= [~ + 6040,1820,6320,1780 +** Processing line: ~ 5900,1840,6040,1820~ - Inside source: true *** True Line Result - state.storyline ||= [ -** Processing line: ~ { text: "<- -> to aim, hold space to charge", distance_gate: 0 },~ + 5900,1840,6040,1820 +** Processing line: ~ 6640,1700,6880,1640~ - Inside source: true *** True Line Result - { text: "<- -> to aim, hold space to charge", distance_gate: 0 }, -** Processing line: ~ { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },~ + 6640,1700,6880,1640 +** Processing line: ~ 6320,1780,6640,1700~ - Inside source: true *** True Line Result - { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 }, -** Processing line: ~ { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },~ + 6320,1780,6640,1700 +** Processing line: ~ 5840,2040,5900,1840~ - Inside source: true *** True Line Result - { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 }, -** Processing line: ~ { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 },~ + 5840,2040,5900,1840 +** Processing line: ~ 5840,2040,5840,2220~ - Inside source: true *** True Line Result - { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 }, -** Processing line: ~ { text: "jupiter's sure is beautiful...", distance_gate: 4000 },~ + 5840,2040,5840,2220 +** Processing line: ~ 5840,2220,5840,2320~ - Inside source: true *** True Line Result - { text: "jupiter's sure is beautiful...", distance_gate: 4000 }, -** Processing line: ~ { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 },~ + 5840,2220,5840,2320 +** Processing line: ~ 5840,2460,5840,2320~ - Inside source: true *** True Line Result - { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 }, -** Processing line: ~ { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 },~ + 5840,2460,5840,2320 +** Processing line: ~ 5840,2560,5840,2460~ - Inside source: true *** True Line Result - { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 }, -** Processing line: ~ { text: "#todo... look i ran out of time -_-", distance_gate: 9000 },~ + 5840,2560,5840,2460 +** Processing line: ~ 5840,2560,5960,2620~ - Inside source: true *** True Line Result - { text: "#todo... look i ran out of time -_-", distance_gate: 9000 }, -** Processing line: ~ { text: "there's never enough time", distance_gate: 9000 },~ + 5840,2560,5960,2620 +** Processing line: ~ 5960,2620,6200,2620~ - Inside source: true *** True Line Result - { text: "there's never enough time", distance_gate: 9000 }, -** Processing line: ~ { text: "the game jam was fun though ^_^", distance_gate: 10000 },~ + 5960,2620,6200,2620 +** Processing line: ~ 6200,2620,6380,2600~ - Inside source: true *** True Line Result - { text: "the game jam was fun though ^_^", distance_gate: 10000 }, -** Processing line: ~ ]~ + 6200,2620,6380,2600 +** Processing line: ~ 6380,2600,6600,2580~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + 6380,2600,6600,2580 +** Processing line: ~ 6600,2580,6800,2600~ - Inside source: true *** True Line Result - -** Processing line: ~ load_level force: args.state.tick_count == 0~ + 6600,2580,6800,2600 +** Processing line: ~ 6800,2600,7040,2580~ - Inside source: true *** True Line Result - load_level force: args.state.tick_count == 0 -** Processing line: ~ state.line_mode ||= :terrain~ + 6800,2600,7040,2580 +** Processing line: ~ 7040,2580,7280,2580~ - Inside source: true *** True Line Result - state.line_mode ||= :terrain -** Processing line: ~~ + 7040,2580,7280,2580 +** Processing line: ~ 7280,2580,7480,2560~ - Inside source: true *** True Line Result - -** Processing line: ~ state.sound_index ||= 1~ + 7280,2580,7480,2560 +** Processing line: ~ 7760,2540,7980,2520~ - Inside source: true *** True Line Result - state.sound_index ||= 1 -** Processing line: ~ circle.potential_lift ||= 0~ + 7760,2540,7980,2520 +** Processing line: ~ 7980,2520,8160,2500~ - Inside source: true *** True Line Result - circle.potential_lift ||= 0 -** Processing line: ~ circle.angle ||= 90~ + 7980,2520,8160,2500 +** Processing line: ~ 7480,2560,7760,2540~ - Inside source: true *** True Line Result - circle.angle ||= 90 -** Processing line: ~ circle.check_point_at ||= -1000~ + 7480,2560,7760,2540 +** Processing line: ~ 8160,2500,8160,2420~ - Inside source: true *** True Line Result - circle.check_point_at ||= -1000 -** Processing line: ~ circle.game_over_at ||= -1000~ + 8160,2500,8160,2420 +** Processing line: ~ 8160,2420,8160,2320~ - Inside source: true *** True Line Result - circle.game_over_at ||= -1000 -** Processing line: ~ circle.x ||= -485~ + 8160,2420,8160,2320 +** Processing line: ~ 8160,2180,8160,2320~ - Inside source: true *** True Line Result - circle.x ||= -485 -** Processing line: ~ circle.y ||= 12226~ + 8160,2180,8160,2320 +** Processing line: ~ 7980,2160,8160,2180~ - Inside source: true *** True Line Result - circle.y ||= 12226 -** Processing line: ~ circle.check_point_x ||= circle.x~ + 7980,2160,8160,2180 +** Processing line: ~ 7800,2180,7980,2160~ - Inside source: true *** True Line Result - circle.check_point_x ||= circle.x -** Processing line: ~ circle.check_point_y ||= circle.y~ + 7800,2180,7980,2160 +** Processing line: ~ 7600,2200,7800,2180~ - Inside source: true *** True Line Result - circle.check_point_y ||= circle.y -** Processing line: ~ circle.dy ||= 0~ + 7600,2200,7800,2180 +** Processing line: ~ 7400,2200,7600,2200~ - Inside source: true *** True Line Result - circle.dy ||= 0 -** Processing line: ~ circle.dx ||= 0~ + 7400,2200,7600,2200 +** Processing line: ~ 6960,2200,7200,2200~ - Inside source: true *** True Line Result - circle.dx ||= 0 -** Processing line: ~ circle.previous_dy ||= 0~ + 6960,2200,7200,2200 +** Processing line: ~ 7200,2200,7400,2200~ - Inside source: true *** True Line Result - circle.previous_dy ||= 0 -** Processing line: ~ circle.previous_dx ||= 0~ + 7200,2200,7400,2200 +** Processing line: ~ 6720,2200,6960,2200~ - Inside source: true *** True Line Result - circle.previous_dx ||= 0 -** Processing line: ~ circle.angle ||= 0~ + 6720,2200,6960,2200 +** Processing line: ~ 6540,2180,6720,2200~ - Inside source: true *** True Line Result - circle.angle ||= 0 -** Processing line: ~ circle.after_images ||= []~ + 6540,2180,6720,2200 +** Processing line: ~ 6320,2200,6540,2180~ - Inside source: true *** True Line Result - circle.after_images ||= [] -** Processing line: ~ circle.terrains_to_monitor ||= {}~ + 6320,2200,6540,2180 +** Processing line: ~ 6240,2160,6320,2200~ - Inside source: true *** True Line Result - circle.terrains_to_monitor ||= {} -** Processing line: ~ circle.impact_history ||= []~ + 6240,2160,6320,2200 +** Processing line: ~ 6240,2160,6240,2040~ - Inside source: true *** True Line Result - circle.impact_history ||= [] -** Processing line: ~~ + 6240,2160,6240,2040 +** Processing line: ~ 6240,2040,6240,1940~ - Inside source: true *** True Line Result - -** Processing line: ~ camera.x ||= 0~ + 6240,2040,6240,1940 +** Processing line: ~ 6240,1940,6440,1940~ - Inside source: true *** True Line Result - camera.x ||= 0 -** Processing line: ~ camera.y ||= 0~ + 6240,1940,6440,1940 +** Processing line: ~ 6440,1940,6720,1940~ - Inside source: true *** True Line Result - camera.y ||= 0 -** Processing line: ~ camera.target_x ||= 0~ + 6440,1940,6720,1940 +** Processing line: ~ 6720,1940,6940,1920~ - Inside source: true *** True Line Result - camera.target_x ||= 0 -** Processing line: ~ camera.target_y ||= 0~ + 6720,1940,6940,1920 +** Processing line: ~ 7520,1920,7760,1920~ - Inside source: true *** True Line Result - camera.target_y ||= 0 -** Processing line: ~ state.snaps ||= { }~ + 7520,1920,7760,1920 +** Processing line: ~ 6940,1920,7280,1920~ - Inside source: true *** True Line Result - state.snaps ||= { } -** Processing line: ~ state.snap_number = 10~ + 6940,1920,7280,1920 +** Processing line: ~ 7280,1920,7520,1920~ - Inside source: true *** True Line Result - state.snap_number = 10 -** Processing line: ~~ + 7280,1920,7520,1920 +** Processing line: ~ 7760,1920,8100,1900~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.storyline_x ||= -1000~ + 7760,1920,8100,1900 +** Processing line: ~ 8100,1900,8420,1900~ - Inside source: true *** True Line Result - args.state.storyline_x ||= -1000 -** Processing line: ~ args.state.storyline_y ||= -1000~ + 8100,1900,8420,1900 +** Processing line: ~ 8420,1900,8460,1940~ - Inside source: true *** True Line Result - args.state.storyline_y ||= -1000 -** Processing line: ~ end~ + 8420,1900,8460,1940 +** Processing line: ~ 8460,2120,8460,1940~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8460,2120,8460,1940 +** Processing line: ~ 8460,2280,8460,2120~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_game~ + 8460,2280,8460,2120 +** Processing line: ~ 8460,2280,8560,2420~ - Inside source: true *** True Line Result - def render_game -** Processing line: ~ outputs.background_color = [0, 0, 0]~ + 8460,2280,8560,2420 +** Processing line: ~ 8560,2420,8660,2380~ - Inside source: true *** True Line Result - outputs.background_color = [0, 0, 0] -** Processing line: ~ outputs.sprites << [-circle.x + 1100,~ + 8560,2420,8660,2380 +** Processing line: ~ 8660,2380,8800,2340~ - Inside source: true *** True Line Result - outputs.sprites << [-circle.x + 1100, -** Processing line: ~ -circle.y - 100,~ + 8660,2380,8800,2340 +** Processing line: ~ 8800,2340,8840,2400~ - Inside source: true *** True Line Result - -circle.y - 100, -** Processing line: ~ 2416 * 4,~ + 8800,2340,8840,2400 +** Processing line: ~ 8840,2520,8840,2400~ - Inside source: true *** True Line Result - 2416 * 4, -** Processing line: ~ 3574 * 4,~ + 8840,2520,8840,2400 +** Processing line: ~ 8800,2620,8840,2520~ - Inside source: true *** True Line Result - 3574 * 4, -** Processing line: ~ 'sprites/jupiter.png']~ + 8800,2620,8840,2520 +** Processing line: ~ 8800,2740,8800,2620~ - Inside source: true *** True Line Result - 'sprites/jupiter.png'] -** Processing line: ~ outputs.sprites << [-circle.x,~ + 8800,2740,8800,2620 +** Processing line: ~ 8800,2860,8800,2740~ - Inside source: true *** True Line Result - outputs.sprites << [-circle.x, -** Processing line: ~ -circle.y,~ + 8800,2860,8800,2740 +** Processing line: ~ 8800,2940,8800,2860~ - Inside source: true *** True Line Result - -circle.y, -** Processing line: ~ 2416 * 4,~ + 8800,2940,8800,2860 +** Processing line: ~ 8760,2980,8800,2940~ - Inside source: true *** True Line Result - 2416 * 4, -** Processing line: ~ 3574 * 4,~ + 8760,2980,8800,2940 +** Processing line: ~ 8660,2980,8760,2980~ - Inside source: true *** True Line Result - 3574 * 4, -** Processing line: ~ 'sprites/level.png']~ + 8660,2980,8760,2980 +** Processing line: ~ 8620,2960,8660,2980~ - Inside source: true *** True Line Result - 'sprites/level.png'] -** Processing line: ~ outputs.sprites << state.whisp_queue~ + 8620,2960,8660,2980 +** Processing line: ~ 8560,2880,8620,2960~ - Inside source: true *** True Line Result - outputs.sprites << state.whisp_queue -** Processing line: ~ render_aiming_retical~ + 8560,2880,8620,2960 +** Processing line: ~ 8560,2880,8560,2780~ - Inside source: true *** True Line Result - render_aiming_retical -** Processing line: ~ render_circle~ + 8560,2880,8560,2780 +** Processing line: ~ 8500,2740,8560,2780~ - Inside source: true *** True Line Result - render_circle -** Processing line: ~ render_notification~ + 8500,2740,8560,2780 +** Processing line: ~ 8420,2760,8500,2740~ - Inside source: true *** True Line Result - render_notification -** Processing line: ~ end~ + 8420,2760,8500,2740 +** Processing line: ~ 8420,2840,8420,2760~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8420,2840,8420,2760 +** Processing line: ~ 8420,2840,8420,2940~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_notification~ + 8420,2840,8420,2940 +** Processing line: ~ 8420,3040,8420,2940~ - Inside source: true *** True Line Result - def render_notification -** Processing line: ~ toast_length = 500~ + 8420,3040,8420,2940 +** Processing line: ~ 8420,3160,8420,3040~ - Inside source: true *** True Line Result - toast_length = 500 -** Processing line: ~ if circle.game_over_at.elapsed_time < toast_length~ + 8420,3160,8420,3040 +** Processing line: ~ 8420,3280,8420,3380~ - Inside source: true *** True Line Result - if circle.game_over_at.elapsed_time < toast_length -** Processing line: ~ label_text = "..."~ + 8420,3280,8420,3380 +** Processing line: ~ 8420,3280,8420,3160~ - Inside source: true *** True Line Result - label_text = "..." -** Processing line: ~ elsif circle.check_point_at.elapsed_time > toast_length~ + 8420,3280,8420,3160 +** Processing line: ~ 8420,3380,8620,3460~ - Inside source: true *** True Line Result - elsif circle.check_point_at.elapsed_time > toast_length -** Processing line: ~ args.state.current_storyline = nil~ + 8420,3380,8620,3460 +** Processing line: ~ 8620,3460,8760,3460~ - Inside source: true *** True Line Result - args.state.current_storyline = nil -** Processing line: ~ return~ + 8620,3460,8760,3460 +** Processing line: ~ 8760,3460,8840,3400~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 8760,3460,8840,3400 +** Processing line: ~ 8840,3400,8960,3400~ - Inside source: true *** True Line Result - end -** Processing line: ~ if circle.check_point_at &&~ + 8840,3400,8960,3400 +** Processing line: ~ 8960,3400,9000,3500~ - Inside source: true *** True Line Result - if circle.check_point_at && -** Processing line: ~ circle.check_point_at.elapsed_time == 1 &&~ + 8960,3400,9000,3500 +** Processing line: ~ 9000,3700,9000,3500~ - Inside source: true *** True Line Result - circle.check_point_at.elapsed_time == 1 && -** Processing line: ~ !args.state.current_storyline~ + 9000,3700,9000,3500 +** Processing line: ~ 9000,3900,9000,3700~ - Inside source: true *** True Line Result - !args.state.current_storyline -** Processing line: ~ if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]~ + 9000,3900,9000,3700 +** Processing line: ~ 9000,4080,9000,3900~ - Inside source: true *** True Line Result - if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate] -** Processing line: ~ args.state.current_storyline = args.state.storyline.shift[:text]~ + 9000,4080,9000,3900 +** Processing line: ~ 9000,4280,9000,4080~ - Inside source: true *** True Line Result - args.state.current_storyline = args.state.storyline.shift[:text] -** Processing line: ~ args.state.distance_traveled ||= 0~ + 9000,4280,9000,4080 +** Processing line: ~ 9000,4500,9000,4280~ - Inside source: true *** True Line Result - args.state.distance_traveled ||= 0 -** Processing line: ~ args.state.storyline_x = circle.x~ + 9000,4500,9000,4280 +** Processing line: ~ 9000,4620,9000,4500~ - Inside source: true *** True Line Result - args.state.storyline_x = circle.x -** Processing line: ~ args.state.storyline_y = circle.y~ + 9000,4620,9000,4500 +** Processing line: ~ 9000,4780,9000,4620~ - Inside source: true *** True Line Result - args.state.storyline_y = circle.y -** Processing line: ~ end~ + 9000,4780,9000,4620 +** Processing line: ~ 9000,4780,9000,4960~ - Inside source: true *** True Line Result - end -** Processing line: ~ return unless args.state.current_storyline~ + 9000,4780,9000,4960 +** Processing line: ~ 9000,5120,9000,4960~ - Inside source: true *** True Line Result - return unless args.state.current_storyline -** Processing line: ~ end~ + 9000,5120,9000,4960 +** Processing line: ~ 9000,5120,9000,5300~ - Inside source: true *** True Line Result - end -** Processing line: ~ label_text = args.state.current_storyline~ + 9000,5120,9000,5300 +** Processing line: ~ 8960,5460,9000,5300~ - Inside source: true *** True Line Result - label_text = args.state.current_storyline -** Processing line: ~ return unless label_text~ + 8960,5460,9000,5300 +** Processing line: ~ 8920,5620,8960,5460~ - Inside source: true *** True Line Result - return unless label_text -** Processing line: ~ x = circle.x + camera.x~ + 8920,5620,8960,5460 +** Processing line: ~ 8920,5620,8920,5800~ - Inside source: true *** True Line Result - x = circle.x + camera.x -** Processing line: ~ y = circle.y + camera.y - 40~ + 8920,5620,8920,5800 +** Processing line: ~ 8920,5800,8920,5960~ - Inside source: true *** True Line Result - y = circle.y + camera.y - 40 -** Processing line: ~ w = 900~ + 8920,5800,8920,5960 +** Processing line: ~ 8920,5960,8920,6120~ - Inside source: true *** True Line Result - w = 900 -** Processing line: ~ h = 30~ + 8920,5960,8920,6120 +** Processing line: ~ 8920,6120,8960,6300~ - Inside source: true *** True Line Result - h = 30 -** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid~ + 8920,6120,8960,6300 +** Processing line: ~ 8960,6300,8960,6480~ - Inside source: true *** True Line Result - outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid -** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border~ + 8960,6300,8960,6480 +** Processing line: ~ 8960,6660,8960,6480~ - Inside source: true *** True Line Result - outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border -** Processing line: ~ outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]~ + 8960,6660,8960,6480 +** Processing line: ~ 8960,6860,8960,6660~ - Inside source: true *** True Line Result - outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255] -** Processing line: ~ end~ + 8960,6860,8960,6660 +** Processing line: ~ 8960,7040,8960,6860~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8960,7040,8960,6860 +** Processing line: ~ 8920,7420,8920,7220~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_aiming_retical~ + 8920,7420,8920,7220 +** Processing line: ~ 8920,7420,8960,7620~ - Inside source: true *** True Line Result - def render_aiming_retical -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,~ + 8920,7420,8960,7620 +** Processing line: ~ 8960,7620,8960,7800~ - Inside source: true *** True Line Result - outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5, -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,~ + 8960,7620,8960,7800 +** Processing line: ~ 8960,7800,8960,8000~ - Inside source: true *** True Line Result - state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5, -** Processing line: ~ 10, 10, 'sprites/circle-orange.png']~ + 8960,7800,8960,8000 +** Processing line: ~ 8960,8000,8960,8180~ - Inside source: true *** True Line Result - 10, 10, 'sprites/circle-orange.png'] -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ + 8960,8000,8960,8180 +** Processing line: ~ 8960,8180,8960,8380~ - Inside source: true *** True Line Result - outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ + 8960,8180,8960,8380 +** Processing line: ~ 8960,8580,8960,8380~ - Inside source: true *** True Line Result - state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, -** Processing line: ~ 10, 10, 'sprites/circle-orange.png', 0, 128]~ + 8960,8580,8960,8380 +** Processing line: ~ 8920,8800,8960,8580~ - Inside source: true *** True Line Result - 10, 10, 'sprites/circle-orange.png', 0, 128] -** Processing line: ~ if rand > 0.9~ + 8920,8800,8960,8580 +** Processing line: ~ 8880,9000,8920,8800~ - Inside source: true *** True Line Result - if rand > 0.9 -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ + 8880,9000,8920,8800 +** Processing line: ~ 8840,9180,8880,9000~ - Inside source: true *** True Line Result - outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ + 8840,9180,8880,9000 +** Processing line: ~ 8800,9220,8840,9180~ - Inside source: true *** True Line Result - state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, -** Processing line: ~ 10, 10, 'sprites/circle-white.png', 0, 128]~ + 8800,9220,8840,9180 +** Processing line: ~ 8800,9220,8840,9340~ - Inside source: true *** True Line Result - 10, 10, 'sprites/circle-white.png', 0, 128] -** Processing line: ~ end~ + 8800,9220,8840,9340 +** Processing line: ~ 8760,9380,8840,9340~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 8760,9380,8840,9340 +** Processing line: ~ 8560,9340,8760,9380~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8560,9340,8760,9380 +** Processing line: ~ 8360,9360,8560,9340~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_circle~ + 8360,9360,8560,9340 +** Processing line: ~ 8160,9360,8360,9360~ - Inside source: true *** True Line Result - def render_circle -** Processing line: ~ outputs.sprites << circle.after_images.map do |ai|~ + 8160,9360,8360,9360 +** Processing line: ~ 8040,9340,8160,9360~ - Inside source: true *** True Line Result - outputs.sprites << circle.after_images.map do |ai| -** Processing line: ~ ai.merge(x: ai.x + state.camera.x - circle.radius,~ + 8040,9340,8160,9360 +** Processing line: ~ 7860,9360,8040,9340~ - Inside source: true *** True Line Result - ai.merge(x: ai.x + state.camera.x - circle.radius, -** Processing line: ~ y: ai.y + state.camera.y - circle.radius,~ + 7860,9360,8040,9340 +** Processing line: ~ 7680,9360,7860,9360~ - Inside source: true *** True Line Result - y: ai.y + state.camera.y - circle.radius, -** Processing line: ~ w: circle.radius * 2,~ + 7680,9360,7860,9360 +** Processing line: ~ 7520,9360,7680,9360~ - Inside source: true *** True Line Result - w: circle.radius * 2, -** Processing line: ~ h: circle.radius * 2,~ + 7520,9360,7680,9360 +** Processing line: ~ 7420,9260,7520,9360~ - Inside source: true *** True Line Result - h: circle.radius * 2, -** Processing line: ~ path: 'sprites/circle-white.png')~ + 7420,9260,7520,9360 +** Processing line: ~ 7400,9080,7420,9260~ - Inside source: true *** True Line Result - path: 'sprites/circle-white.png') -** Processing line: ~ end~ + 7400,9080,7420,9260 +** Processing line: ~ 7400,9080,7420,8860~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7400,9080,7420,8860 +** Processing line: ~ 7420,8860,7440,8720~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.sprites << [(circle.x - circle.radius) + state.camera.x,~ + 7420,8860,7440,8720 +** Processing line: ~ 7440,8720,7480,8660~ - Inside source: true *** True Line Result - outputs.sprites << [(circle.x - circle.radius) + state.camera.x, -** Processing line: ~ (circle.y - circle.radius) + state.camera.y,~ + 7440,8720,7480,8660 +** Processing line: ~ 7480,8660,7520,8540~ - Inside source: true *** True Line Result - (circle.y - circle.radius) + state.camera.y, -** Processing line: ~ circle.radius * 2,~ + 7480,8660,7520,8540 +** Processing line: ~ 7520,8540,7600,8460~ - Inside source: true *** True Line Result - circle.radius * 2, -** Processing line: ~ circle.radius * 2,~ + 7520,8540,7600,8460 +** Processing line: ~ 7600,8460,7800,8480~ - Inside source: true *** True Line Result - circle.radius * 2, -** Processing line: ~ 'sprites/probe.png']~ + 7600,8460,7800,8480 +** Processing line: ~ 7800,8480,8040,8480~ - Inside source: true *** True Line Result - 'sprites/probe.png'] -** Processing line: ~ end~ + 7800,8480,8040,8480 +** Processing line: ~ 8040,8480,8280,8480~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8040,8480,8280,8480 +** Processing line: ~ 8280,8480,8500,8460~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_debug~ + 8280,8480,8500,8460 +** Processing line: ~ 8500,8460,8620,8440~ - Inside source: true *** True Line Result - def render_debug -** Processing line: ~ return unless state.debug_mode~ + 8500,8460,8620,8440 +** Processing line: ~ 8620,8440,8660,8340~ - Inside source: true *** True Line Result - return unless state.debug_mode -** Processing line: ~~ + 8620,8440,8660,8340 +** Processing line: ~ 8660,8340,8660,8220~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]~ + 8660,8340,8660,8220 +** Processing line: ~ 8660,8220,8700,8080~ - Inside source: true *** True Line Result - outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0] -** Processing line: ~ outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]~ + 8660,8220,8700,8080 +** Processing line: ~ 8700,8080,8700,7920~ - Inside source: true *** True Line Result - outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255] -** Processing line: ~~ + 8700,8080,8700,7920 +** Processing line: ~ 8700,7920,8700,7760~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|~ + 8700,7920,8700,7760 +** Processing line: ~ 8700,7760,8700,7620~ - Inside source: true *** True Line Result - args.outputs.lines << trajectory(circle).line.to_hash.tap do |h| -** Processing line: ~ h[:x] += state.camera.x~ + 8700,7760,8700,7620 +** Processing line: ~ 8700,7480,8700,7620~ - Inside source: true *** True Line Result - h[:x] += state.camera.x -** Processing line: ~ h[:y] += state.camera.y~ + 8700,7480,8700,7620 +** Processing line: ~ 8700,7480,8700,7320~ - Inside source: true *** True Line Result - h[:y] += state.camera.y -** Processing line: ~ h[:x2] += state.camera.x~ + 8700,7480,8700,7320 +** Processing line: ~ 8700,7160,8700,7320~ - Inside source: true *** True Line Result - h[:x2] += state.camera.x -** Processing line: ~ h[:y2] += state.camera.y~ + 8700,7160,8700,7320 +** Processing line: ~ 8920,7220,8960,7040~ - Inside source: true *** True Line Result - h[:y2] += state.camera.y -** Processing line: ~ end~ + 8920,7220,8960,7040 +** Processing line: ~ 8660,7040,8700,7160~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8660,7040,8700,7160 +** Processing line: ~ 8660,7040,8700,6880~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.primitives << state.terrain.find_all do |t|~ + 8660,7040,8700,6880 +** Processing line: ~ 8660,6700,8700,6880~ - Inside source: true *** True Line Result - outputs.primitives << state.terrain.find_all do |t| -** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ + 8660,6700,8700,6880 +** Processing line: ~ 8660,6700,8700,6580~ - Inside source: true *** True Line Result - circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) -** Processing line: ~ end.map do |t|~ + 8660,6700,8700,6580 +** Processing line: ~ 8700,6460,8700,6580~ - Inside source: true *** True Line Result - end.map do |t| -** Processing line: ~ [~ + 8700,6460,8700,6580 +** Processing line: ~ 8700,6460,8700,6320~ - Inside source: true *** True Line Result - [ -** Processing line: ~ t.line.associate(r: 0, g: 255, b: 0) do |h|~ + 8700,6460,8700,6320 +** Processing line: ~ 8700,6160,8700,6320~ - Inside source: true *** True Line Result - t.line.associate(r: 0, g: 255, b: 0) do |h| -** Processing line: ~ h.x += state.camera.x~ + 8700,6160,8700,6320 +** Processing line: ~ 8700,6160,8760,6020~ - Inside source: true *** True Line Result - h.x += state.camera.x -** Processing line: ~ h.y += state.camera.y~ + 8700,6160,8760,6020 +** Processing line: ~ 8760,6020,8760,5860~ - Inside source: true *** True Line Result - h.y += state.camera.y -** Processing line: ~ h.x2 += state.camera.x~ + 8760,6020,8760,5860 +** Processing line: ~ 8760,5860,8760,5700~ - Inside source: true *** True Line Result - h.x2 += state.camera.x -** Processing line: ~ h.y2 += state.camera.y~ + 8760,5860,8760,5700 +** Processing line: ~ 8760,5700,8760,5540~ - Inside source: true *** True Line Result - h.y2 += state.camera.y -** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ + 8760,5700,8760,5540 +** Processing line: ~ 8760,5540,8760,5360~ - Inside source: true *** True Line Result - if circle.rect.intersect_rect? t[:rect] -** Processing line: ~ h[:r] = 255~ + 8760,5540,8760,5360 +** Processing line: ~ 8760,5360,8760,5180~ - Inside source: true *** True Line Result - h[:r] = 255 -** Processing line: ~ h[:g] = 0~ + 8760,5360,8760,5180 +** Processing line: ~ 8760,5000,8760,5180~ - Inside source: true *** True Line Result - h[:g] = 0 -** Processing line: ~ end~ + 8760,5000,8760,5180 +** Processing line: ~ 8700,4820,8760,5000~ - Inside source: true *** True Line Result - end -** Processing line: ~ h~ + 8700,4820,8760,5000 +** Processing line: ~ 8560,4740,8700,4820~ - Inside source: true *** True Line Result - h -** Processing line: ~ end,~ + 8560,4740,8700,4820 +** Processing line: ~ 8420,4700,8560,4740~ - Inside source: true *** True Line Result - end, -** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ + 8420,4700,8560,4740 +** Processing line: ~ 8280,4700,8420,4700~ - Inside source: true *** True Line Result - t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| -** Processing line: ~ h.x += state.camera.x~ + 8280,4700,8420,4700 +** Processing line: ~ 8100,4700,8280,4700~ - Inside source: true *** True Line Result - h.x += state.camera.x -** Processing line: ~ h.y += state.camera.y~ + 8100,4700,8280,4700 +** Processing line: ~ 7980,4700,8100,4700~ - Inside source: true *** True Line Result - h.y += state.camera.y -** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ + 7980,4700,8100,4700 +** Processing line: ~ 7820,4740,7980,4700~ - Inside source: true *** True Line Result - h.b = 255 if line_near_rect? circle.rect, t -** Processing line: ~ h~ + 7820,4740,7980,4700 +** Processing line: ~ 7800,4920,7820,4740~ - Inside source: true *** True Line Result - h -** Processing line: ~ end~ + 7800,4920,7820,4740 +** Processing line: ~ 7800,4920,7900,4960~ - Inside source: true *** True Line Result - end -** Processing line: ~ ]~ + 7800,4920,7900,4960 +** Processing line: ~ 7900,4960,8060,4980~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + 7900,4960,8060,4980 +** Processing line: ~ 8060,4980,8220,5000~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8060,4980,8220,5000 +** Processing line: ~ 8220,5000,8420,5040~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.primitives << state.lava.find_all do |t|~ + 8220,5000,8420,5040 +** Processing line: ~ 8420,5040,8460,5120~ - Inside source: true *** True Line Result - outputs.primitives << state.lava.find_all do |t| -** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ + 8420,5040,8460,5120 +** Processing line: ~ 8460,5180,8460,5120~ - Inside source: true *** True Line Result - circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) -** Processing line: ~ end.map do |t|~ + 8460,5180,8460,5120 +** Processing line: ~ 8360,5200,8460,5180~ - Inside source: true *** True Line Result - end.map do |t| -** Processing line: ~ [~ + 8360,5200,8460,5180 +** Processing line: ~ 8360,5280,8360,5200~ - Inside source: true *** True Line Result - [ -** Processing line: ~ t.line.associate(r: 0, g: 0, b: 255) do |h|~ + 8360,5280,8360,5200 +** Processing line: ~ 8160,5300,8360,5280~ - Inside source: true *** True Line Result - t.line.associate(r: 0, g: 0, b: 255) do |h| -** Processing line: ~ h.x += state.camera.x~ + 8160,5300,8360,5280 +** Processing line: ~ 8040,5260,8160,5300~ - Inside source: true *** True Line Result - h.x += state.camera.x -** Processing line: ~ h.y += state.camera.y~ + 8040,5260,8160,5300 +** Processing line: ~ 7860,5220,8040,5260~ - Inside source: true *** True Line Result - h.y += state.camera.y -** Processing line: ~ h.x2 += state.camera.x~ + 7860,5220,8040,5260 +** Processing line: ~ 7720,5160,7860,5220~ - Inside source: true *** True Line Result - h.x2 += state.camera.x -** Processing line: ~ h.y2 += state.camera.y~ + 7720,5160,7860,5220 +** Processing line: ~ 7640,5120,7720,5160~ - Inside source: true *** True Line Result - h.y2 += state.camera.y -** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ + 7640,5120,7720,5160 +** Processing line: ~ 7480,5120,7640,5120~ - Inside source: true *** True Line Result - if circle.rect.intersect_rect? t[:rect] -** Processing line: ~ h[:r] = 255~ + 7480,5120,7640,5120 +** Processing line: ~ 7240,5120,7480,5120~ - Inside source: true *** True Line Result - h[:r] = 255 -** Processing line: ~ h[:b] = 0~ + 7240,5120,7480,5120 +** Processing line: ~ 7000,5120,7240,5120~ - Inside source: true *** True Line Result - h[:b] = 0 -** Processing line: ~ end~ + 7000,5120,7240,5120 +** Processing line: ~ 6800,5160,7000,5120~ - Inside source: true *** True Line Result - end -** Processing line: ~ h~ + 6800,5160,7000,5120 +** Processing line: ~ 6640,5220,6800,5160~ - Inside source: true *** True Line Result - h -** Processing line: ~ end,~ + 6640,5220,6800,5160 +** Processing line: ~ 6600,5360,6640,5220~ - Inside source: true *** True Line Result - end, -** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ + 6600,5360,6640,5220 +** Processing line: ~ 6600,5460,6600,5360~ - Inside source: true *** True Line Result - t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| -** Processing line: ~ h.x += state.camera.x~ + 6600,5460,6600,5360 +** Processing line: ~ 6480,5520,6600,5460~ - Inside source: true *** True Line Result - h.x += state.camera.x -** Processing line: ~ h.y += state.camera.y~ + 6480,5520,6600,5460 +** Processing line: ~ 6240,5540,6480,5520~ - Inside source: true *** True Line Result - h.y += state.camera.y -** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ + 6240,5540,6480,5520 +** Processing line: ~ 5980,5540,6240,5540~ - Inside source: true *** True Line Result - h.b = 255 if line_near_rect? circle.rect, t -** Processing line: ~ h~ + 5980,5540,6240,5540 +** Processing line: ~ 5740,5540,5980,5540~ - Inside source: true *** True Line Result - h -** Processing line: ~ end~ + 5740,5540,5980,5540 +** Processing line: ~ 5500,5520,5740,5540~ - Inside source: true *** True Line Result - end -** Processing line: ~ ]~ + 5500,5520,5740,5540 +** Processing line: ~ 5400,5520,5500,5520~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + 5400,5520,5500,5520 +** Processing line: ~ 5280,5540,5400,5520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5280,5540,5400,5520 +** Processing line: ~ 5080,5540,5280,5540~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.god_mode~ + 5080,5540,5280,5540 +** Processing line: ~ 4940,5540,5080,5540~ - Inside source: true *** True Line Result - if state.god_mode -** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ + 4940,5540,5080,5540 +** Processing line: ~ 4760,5540,4940,5540~ - Inside source: true *** True Line Result - border = circle.rect.merge(x: circle.rect.x + state.camera.x, -** Processing line: ~ y: circle.rect.y + state.camera.y,~ + 4760,5540,4940,5540 +** Processing line: ~ 4600,5540,4760,5540~ - Inside source: true *** True Line Result - y: circle.rect.y + state.camera.y, -** Processing line: ~ g: 255)~ + 4600,5540,4760,5540 +** Processing line: ~ 4440,5560,4600,5540~ - Inside source: true *** True Line Result - g: 255) -** Processing line: ~ else~ + 4440,5560,4600,5540 +** Processing line: ~ 4040,5580,4120,5520~ - Inside source: true *** True Line Result - else -** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ + 4040,5580,4120,5520 +** Processing line: ~ 4260,5540,4440,5560~ - Inside source: true *** True Line Result - border = circle.rect.merge(x: circle.rect.x + state.camera.x, -** Processing line: ~ y: circle.rect.y + state.camera.y,~ + 4260,5540,4440,5560 +** Processing line: ~ 4120,5520,4260,5540~ - Inside source: true *** True Line Result - y: circle.rect.y + state.camera.y, -** Processing line: ~ b: 255)~ + 4120,5520,4260,5540 +** Processing line: ~ 4020,5720,4040,5580~ - Inside source: true *** True Line Result - b: 255) -** Processing line: ~ end~ + 4020,5720,4040,5580 +** Processing line: ~ 4020,5840,4020,5720~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4020,5840,4020,5720 +** Processing line: ~ 4020,5840,4080,5940~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.borders << border~ + 4020,5840,4080,5940 +** Processing line: ~ 4080,5940,4120,6040~ - Inside source: true *** True Line Result - outputs.borders << border -** Processing line: ~~ + 4080,5940,4120,6040 +** Processing line: ~ 4120,6040,4200,6080~ - Inside source: true *** True Line Result - -** Processing line: ~ overlapping ||= {}~ + 4120,6040,4200,6080 +** Processing line: ~ 4200,6080,4340,6080~ - Inside source: true *** True Line Result - overlapping ||= {} -** Processing line: ~~ + 4200,6080,4340,6080 +** Processing line: ~ 4340,6080,4500,6060~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.impact_history.each do |h|~ + 4340,6080,4500,6060 +** Processing line: ~ 4500,6060,4700,6060~ - Inside source: true *** True Line Result - circle.impact_history.each do |h| -** Processing line: ~ label_mod = 300~ + 4500,6060,4700,6060 +** Processing line: ~ 4700,6060,4880,6060~ - Inside source: true *** True Line Result - label_mod = 300 -** Processing line: ~ x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x~ + 4700,6060,4880,6060 +** Processing line: ~ 4880,6060,5080,6060~ - Inside source: true *** True Line Result - x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x -** Processing line: ~ y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y~ + 4880,6060,5080,6060 +** Processing line: ~ 5080,6060,5280,6080~ - Inside source: true *** True Line Result - y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y -** Processing line: ~ 10.times do~ + 5080,6060,5280,6080 +** Processing line: ~ 5280,6080,5440,6100~ - Inside source: true *** True Line Result - 10.times do -** Processing line: ~ if overlapping[x] && overlapping[x][y]~ + 5280,6080,5440,6100 +** Processing line: ~ 5440,6100,5660,6100~ - Inside source: true *** True Line Result - if overlapping[x] && overlapping[x][y] -** Processing line: ~ y -= 52~ + 5440,6100,5660,6100 +** Processing line: ~ 5660,6100,5900,6080~ - Inside source: true *** True Line Result - y -= 52 -** Processing line: ~ else~ + 5660,6100,5900,6080 +** Processing line: ~ 5900,6080,6120,6080~ - Inside source: true *** True Line Result - else -** Processing line: ~ break~ + 5900,6080,6120,6080 +** Processing line: ~ 6120,6080,6360,6080~ - Inside source: true *** True Line Result - break -** Processing line: ~ end~ + 6120,6080,6360,6080 +** Processing line: ~ 6360,6080,6480,6100~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 6360,6080,6480,6100 +** Processing line: ~ 6480,6100,6540,6060~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6480,6100,6540,6060 +** Processing line: ~ 6540,6060,6720,6060~ - Inside source: true *** True Line Result - -** Processing line: ~ overlapping[x] ||= {}~ + 6540,6060,6720,6060 +** Processing line: ~ 6720,6060,6940,6060~ - Inside source: true *** True Line Result - overlapping[x] ||= {} -** Processing line: ~ overlapping[x][y] ||= true~ + 6720,6060,6940,6060 +** Processing line: ~ 6940,6060,7140,6060~ - Inside source: true *** True Line Result - overlapping[x][y] ||= true -** Processing line: ~ outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid~ + 6940,6060,7140,6060 +** Processing line: ~ 7400,6060,7600,6060~ - Inside source: true *** True Line Result - outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid -** Processing line: ~ outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]~ + 7400,6060,7600,6060 +** Processing line: ~ 7140,6060,7400,6060~ - Inside source: true *** True Line Result - outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]~ + 7140,6060,7400,6060 +** Processing line: ~ 7600,6060,7800,6060~ - Inside source: true *** True Line Result - outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]~ + 7600,6060,7800,6060 +** Processing line: ~ 7800,6060,7860,6080~ - Inside source: true *** True Line Result - outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255] -** Processing line: ~~ + 7800,6060,7860,6080 +** Processing line: ~ 7860,6080,8060,6080~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]~ + 7860,6080,8060,6080 +** Processing line: ~ 8060,6080,8220,6080~ - Inside source: true *** True Line Result - outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]~ + 8060,6080,8220,6080 +** Processing line: ~ 8220,6080,8320,6140~ - Inside source: true *** True Line Result - outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]~ + 8220,6080,8320,6140 +** Processing line: ~ 8320,6140,8360,6300~ - Inside source: true *** True Line Result - outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255] -** Processing line: ~~ + 8320,6140,8360,6300 +** Processing line: ~ 8320,6460,8360,6300~ - Inside source: true *** True Line Result - -** Processing line: ~ outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]~ + 8320,6460,8360,6300 +** Processing line: ~ 8320,6620,8320,6460~ - Inside source: true *** True Line Result - outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]~ + 8320,6620,8320,6460 +** Processing line: ~ 8320,6800,8320,6620~ - Inside source: true *** True Line Result - outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]~ + 8320,6800,8320,6620 +** Processing line: ~ 8320,6960,8320,6800~ - Inside source: true *** True Line Result - outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255] -** Processing line: ~ end~ + 8320,6960,8320,6800 +** Processing line: ~ 8320,6960,8360,7120~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8320,6960,8360,7120 +** Processing line: ~ 8320,7280,8360,7120~ - Inside source: true *** True Line Result - -** Processing line: ~ if circle.floor~ + 8320,7280,8360,7120 +** Processing line: ~ 8320,7440,8320,7280~ - Inside source: true *** True Line Result - if circle.floor -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]~ + 8320,7440,8320,7280 +** Processing line: ~ 8320,7600,8320,7440~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0] -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ + 8320,7600,8320,7440 +** Processing line: ~ 8100,7580,8220,7600~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0]~ + 8100,7580,8220,7600 +** Processing line: ~ 8220,7600,8320,7600~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0] -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ + 8220,7600,8320,7600 +** Processing line: ~ 7900,7560,8100,7580~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]~ + 7900,7560,8100,7580 +** Processing line: ~ 7680,7560,7900,7560~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0] -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]~ + 7680,7560,7900,7560 +** Processing line: ~ 7480,7580,7680,7560~ - Inside source: true *** True Line Result - outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255] -** Processing line: ~ end~ + 7480,7580,7680,7560 +** Processing line: ~ 7280,7580,7480,7580~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 7280,7580,7480,7580 +** Processing line: ~ 7080,7580,7280,7580~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7080,7580,7280,7580 +** Processing line: ~ 7000,7600,7080,7580~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_stage_editor~ + 7000,7600,7080,7580 +** Processing line: ~ 6880,7600,7000,7600~ - Inside source: true *** True Line Result - def render_stage_editor -** Processing line: ~ return unless state.god_mode~ + 6880,7600,7000,7600 +** Processing line: ~ 6800,7580,6880,7600~ - Inside source: true *** True Line Result - return unless state.god_mode -** Processing line: ~ return unless state.point_one~ + 6800,7580,6880,7600 +** Processing line: ~ 6640,7580,6800,7580~ - Inside source: true *** True Line Result - return unless state.point_one -** Processing line: ~ args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]~ + 6640,7580,6800,7580 +** Processing line: ~ 6540,7580,6640,7580~ - Inside source: true *** True Line Result - args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255] -** Processing line: ~ end~ + 6540,7580,6640,7580 +** Processing line: ~ 6380,7600,6540,7580~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6380,7600,6540,7580 +** Processing line: ~ 6280,7620,6380,7600~ - Inside source: true *** True Line Result - -** Processing line: ~ def trajectory body~ + 6280,7620,6380,7600 +** Processing line: ~ 6240,7700,6280,7620~ - Inside source: true *** True Line Result - def trajectory body -** Processing line: ~ [body.x + body.dx,~ + 6240,7700,6280,7620 +** Processing line: ~ 6240,7700,6240,7800~ - Inside source: true *** True Line Result - [body.x + body.dx, -** Processing line: ~ body.y + body.dy,~ + 6240,7700,6240,7800 +** Processing line: ~ 6240,7840,6240,7800~ - Inside source: true *** True Line Result - body.y + body.dy, -** Processing line: ~ body.x + body.dx * 1000,~ + 6240,7840,6240,7800 +** Processing line: ~ 6080,7840,6240,7840~ - Inside source: true *** True Line Result - body.x + body.dx * 1000, -** Processing line: ~ body.y + body.dy * 1000,~ + 6080,7840,6240,7840 +** Processing line: ~ 5960,7820,6080,7840~ - Inside source: true *** True Line Result - body.y + body.dy * 1000, -** Processing line: ~ 0, 255, 255]~ + 5960,7820,6080,7840 +** Processing line: ~ 5660,7840,5800,7840~ - Inside source: true *** True Line Result - 0, 255, 255] -** Processing line: ~ end~ + 5660,7840,5800,7840 +** Processing line: ~ 5500,7800,5660,7840~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5500,7800,5660,7840 +** Processing line: ~ 5440,7700,5500,7800~ - Inside source: true *** True Line Result - -** Processing line: ~ def lengthen_line line, num~ + 5440,7700,5500,7800 +** Processing line: ~ 5800,7840,5960,7820~ - Inside source: true *** True Line Result - def lengthen_line line, num -** Processing line: ~ line = normalize_line(line)~ + 5800,7840,5960,7820 +** Processing line: ~ 5440,7540,5440,7700~ - Inside source: true *** True Line Result - line = normalize_line(line) -** Processing line: ~ slope = geometry.line_slope(line, replace_infinity: 10).abs~ + 5440,7540,5440,7700 +** Processing line: ~ 5440,7440,5440,7540~ - Inside source: true *** True Line Result - slope = geometry.line_slope(line, replace_infinity: 10).abs -** Processing line: ~ if slope < 2~ + 5440,7440,5440,7540 +** Processing line: ~ 5440,7320,5440,7440~ - Inside source: true *** True Line Result - if slope < 2 -** Processing line: ~ [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash~ + 5440,7320,5440,7440 +** Processing line: ~ 5400,7320,5440,7320~ - Inside source: true *** True Line Result - [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash -** Processing line: ~ else~ + 5400,7320,5440,7320 +** Processing line: ~ 5340,7400,5400,7320~ - Inside source: true *** True Line Result - else -** Processing line: ~ [line.x, line.y, line.x2, line.y2].line.to_hash~ + 5340,7400,5400,7320 +** Processing line: ~ 5340,7400,5340,7500~ - Inside source: true *** True Line Result - [line.x, line.y, line.x2, line.y2].line.to_hash -** Processing line: ~ end~ + 5340,7400,5340,7500 +** Processing line: ~ 5340,7600,5340,7500~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 5340,7600,5340,7500 +** Processing line: ~ 5340,7600,5340,7720~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5340,7600,5340,7720 +** Processing line: ~ 5340,7720,5340,7860~ - Inside source: true *** True Line Result - -** Processing line: ~ def normalize_line line~ + 5340,7720,5340,7860 +** Processing line: ~ 5340,7860,5340,7960~ - Inside source: true *** True Line Result - def normalize_line line -** Processing line: ~ if line.x > line.x2~ + 5340,7860,5340,7960 +** Processing line: ~ 5340,7960,5440,8020~ - Inside source: true *** True Line Result - if line.x > line.x2 -** Processing line: ~ x = line.x2~ + 5340,7960,5440,8020 +** Processing line: ~ 5440,8020,5560,8020~ - Inside source: true *** True Line Result - x = line.x2 -** Processing line: ~ y = line.y2~ + 5440,8020,5560,8020 +** Processing line: ~ 5560,8020,5720,8040~ - Inside source: true *** True Line Result - y = line.y2 -** Processing line: ~ x2 = line.x~ + 5560,8020,5720,8040 +** Processing line: ~ 5720,8040,5900,8060~ - Inside source: true *** True Line Result - x2 = line.x -** Processing line: ~ y2 = line.y~ + 5720,8040,5900,8060 +** Processing line: ~ 5900,8060,6080,8060~ - Inside source: true *** True Line Result - y2 = line.y -** Processing line: ~ else~ + 5900,8060,6080,8060 +** Processing line: ~ 6080,8060,6240,8060~ - Inside source: true *** True Line Result - else -** Processing line: ~ x = line.x~ + 6080,8060,6240,8060 +** Processing line: ~ 6720,8040,6840,8060~ - Inside source: true *** True Line Result - x = line.x -** Processing line: ~ y = line.y~ + 6720,8040,6840,8060 +** Processing line: ~ 6240,8060,6480,8040~ - Inside source: true *** True Line Result - y = line.y -** Processing line: ~ x2 = line.x2~ + 6240,8060,6480,8040 +** Processing line: ~ 6480,8040,6720,8040~ - Inside source: true *** True Line Result - x2 = line.x2 -** Processing line: ~ y2 = line.y2~ + 6480,8040,6720,8040 +** Processing line: ~ 6840,8060,6940,8060~ - Inside source: true *** True Line Result - y2 = line.y2 -** Processing line: ~ end~ + 6840,8060,6940,8060 +** Processing line: ~ 6940,8060,7080,8120~ - Inside source: true *** True Line Result - end -** Processing line: ~ [x, y, x2, y2]~ + 6940,8060,7080,8120 +** Processing line: ~ 7080,8120,7140,8180~ - Inside source: true *** True Line Result - [x, y, x2, y2] -** Processing line: ~ end~ + 7080,8120,7140,8180 +** Processing line: ~ 7140,8460,7140,8320~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7140,8460,7140,8320 +** Processing line: ~ 7140,8620,7140,8460~ - Inside source: true *** True Line Result - -** Processing line: ~ def rect_for_line line~ + 7140,8620,7140,8460 +** Processing line: ~ 7140,8620,7140,8740~ - Inside source: true *** True Line Result - def rect_for_line line -** Processing line: ~ if line.x > line.x2~ + 7140,8620,7140,8740 +** Processing line: ~ 7140,8860,7140,8740~ - Inside source: true *** True Line Result - if line.x > line.x2 -** Processing line: ~ x = line.x2~ + 7140,8860,7140,8740 +** Processing line: ~ 7140,8960,7140,8860~ - Inside source: true *** True Line Result - x = line.x2 -** Processing line: ~ y = line.y2~ + 7140,8960,7140,8860 +** Processing line: ~ 7140,8960,7200,9080~ - Inside source: true *** True Line Result - y = line.y2 -** Processing line: ~ x2 = line.x~ + 7140,8960,7200,9080 +** Processing line: ~ 7140,9200,7200,9080~ - Inside source: true *** True Line Result - x2 = line.x -** Processing line: ~ y2 = line.y~ + 7140,9200,7200,9080 +** Processing line: ~ 7140,9200,7200,9320~ - Inside source: true *** True Line Result - y2 = line.y -** Processing line: ~ else~ + 7140,9200,7200,9320 +** Processing line: ~ 7200,9320,7200,9460~ - Inside source: true *** True Line Result - else -** Processing line: ~ x = line.x~ + 7200,9320,7200,9460 +** Processing line: ~ 7200,9760,7200,9900~ - Inside source: true *** True Line Result - x = line.x -** Processing line: ~ y = line.y~ + 7200,9760,7200,9900 +** Processing line: ~ 7200,9620,7200,9460~ - Inside source: true *** True Line Result - y = line.y -** Processing line: ~ x2 = line.x2~ + 7200,9620,7200,9460 +** Processing line: ~ 7200,9620,7200,9760~ - Inside source: true *** True Line Result - x2 = line.x2 -** Processing line: ~ y2 = line.y2~ + 7200,9620,7200,9760 +** Processing line: ~ 7200,9900,7200,10060~ - Inside source: true *** True Line Result - y2 = line.y2 -** Processing line: ~ end~ + 7200,9900,7200,10060 +** Processing line: ~ 7200,10220,7200,10060~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7200,10220,7200,10060 +** Processing line: ~ 7200,10360,7200,10220~ - Inside source: true *** True Line Result - -** Processing line: ~ w = x2 - x~ + 7200,10360,7200,10220 +** Processing line: ~ 7140,10400,7200,10360~ - Inside source: true *** True Line Result - w = x2 - x -** Processing line: ~ h = y2 - y~ + 7140,10400,7200,10360 +** Processing line: ~ 6880,10400,7140,10400~ - Inside source: true *** True Line Result - h = y2 - y -** Processing line: ~~ + 6880,10400,7140,10400 +** Processing line: ~ 6640,10360,6880,10400~ - Inside source: true *** True Line Result - -** Processing line: ~ if h < 0~ + 6640,10360,6880,10400 +** Processing line: ~ 6420,10360,6640,10360~ - Inside source: true *** True Line Result - if h < 0 -** Processing line: ~ y += h~ + 6420,10360,6640,10360 +** Processing line: ~ 6160,10380,6420,10360~ - Inside source: true *** True Line Result - y += h -** Processing line: ~ h = h.abs~ + 6160,10380,6420,10360 +** Processing line: ~ 5940,10340,6160,10380~ - Inside source: true *** True Line Result - h = h.abs -** Processing line: ~ end~ + 5940,10340,6160,10380 +** Processing line: ~ 5720,10320,5940,10340~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5720,10320,5940,10340 +** Processing line: ~ 5500,10340,5720,10320~ - Inside source: true *** True Line Result - -** Processing line: ~ if w < circle.radius~ + 5500,10340,5720,10320 +** Processing line: ~ 5280,10300,5500,10340~ - Inside source: true *** True Line Result - if w < circle.radius -** Processing line: ~ x -= circle.radius~ + 5280,10300,5500,10340 +** Processing line: ~ 5080,10300,5280,10300~ - Inside source: true *** True Line Result - x -= circle.radius -** Processing line: ~ w = circle.radius * 2~ + 5080,10300,5280,10300 +** Processing line: ~ 4840,10280,5080,10300~ - Inside source: true *** True Line Result - w = circle.radius * 2 -** Processing line: ~ end~ + 4840,10280,5080,10300 +** Processing line: ~ 4700,10280,4840,10280~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4700,10280,4840,10280 +** Processing line: ~ 4540,10280,4700,10280~ - Inside source: true *** True Line Result - -** Processing line: ~ if h < circle.radius~ + 4540,10280,4700,10280 +** Processing line: ~ 4360,10280,4540,10280~ - Inside source: true *** True Line Result - if h < circle.radius -** Processing line: ~ y -= circle.radius~ + 4360,10280,4540,10280 +** Processing line: ~ 4200,10300,4360,10280~ - Inside source: true *** True Line Result - y -= circle.radius -** Processing line: ~ h = circle.radius * 2~ + 4200,10300,4360,10280 +** Processing line: ~ 4040,10380,4200,10300~ - Inside source: true *** True Line Result - h = circle.radius * 2 -** Processing line: ~ end~ + 4040,10380,4200,10300 +** Processing line: ~ 4020,10500,4040,10380~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4020,10500,4040,10380 +** Processing line: ~ 3980,10640,4020,10500~ - Inside source: true *** True Line Result - -** Processing line: ~ { x: x, y: y, w: w, h: h }~ + 3980,10640,4020,10500 +** Processing line: ~ 3980,10640,3980,10760~ - Inside source: true *** True Line Result - { x: x, y: y, w: w, h: h } -** Processing line: ~ end~ + 3980,10640,3980,10760 +** Processing line: ~ 3980,10760,4020,10920~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3980,10760,4020,10920 +** Processing line: ~ 4020,10920,4080,11000~ - Inside source: true *** True Line Result - -** Processing line: ~ def snap_to_grid x, y, snaps~ + 4020,10920,4080,11000 +** Processing line: ~ 4080,11000,4340,11020~ - Inside source: true *** True Line Result - def snap_to_grid x, y, snaps -** Processing line: ~ snap_number = 10~ + 4080,11000,4340,11020 +** Processing line: ~ 4340,11020,4600,11060~ - Inside source: true *** True Line Result - snap_number = 10 -** Processing line: ~ x = x.to_i~ + 4340,11020,4600,11060 +** Processing line: ~ 4600,11060,4840,11040~ - Inside source: true *** True Line Result - x = x.to_i -** Processing line: ~ y = y.to_i~ + 4600,11060,4840,11040 +** Processing line: ~ 4840,11040,4880,10960~ - Inside source: true *** True Line Result - y = y.to_i -** Processing line: ~~ + 4840,11040,4880,10960 +** Processing line: ~ 4880,10740,4880,10960~ - Inside source: true *** True Line Result - -** Processing line: ~ x_floor = x.idiv(snap_number) * snap_number~ + 4880,10740,4880,10960 +** Processing line: ~ 4880,10740,4880,10600~ - Inside source: true *** True Line Result - x_floor = x.idiv(snap_number) * snap_number -** Processing line: ~ x_mod = x % snap_number~ + 4880,10740,4880,10600 +** Processing line: ~ 4880,10600,5080,10560~ - Inside source: true *** True Line Result - x_mod = x % snap_number -** Processing line: ~ x_ceil = (x.idiv(snap_number) + 1) * snap_number~ + 4880,10600,5080,10560 +** Processing line: ~ 5080,10560,5340,10620~ - Inside source: true *** True Line Result - x_ceil = (x.idiv(snap_number) + 1) * snap_number -** Processing line: ~~ + 5080,10560,5340,10620 +** Processing line: ~ 5340,10620,5660,10620~ - Inside source: true *** True Line Result - -** Processing line: ~ y_floor = y.idiv(snap_number) * snap_number~ + 5340,10620,5660,10620 +** Processing line: ~ 5660,10620,6040,10600~ - Inside source: true *** True Line Result - y_floor = y.idiv(snap_number) * snap_number -** Processing line: ~ y_mod = y % snap_number~ + 5660,10620,6040,10600 +** Processing line: ~ 6040,10600,6120,10620~ - Inside source: true *** True Line Result - y_mod = y % snap_number -** Processing line: ~ y_ceil = (y.idiv(snap_number) + 1) * snap_number~ + 6040,10600,6120,10620 +** Processing line: ~ 6120,10620,6240,10720~ - Inside source: true *** True Line Result - y_ceil = (y.idiv(snap_number) + 1) * snap_number -** Processing line: ~~ + 6120,10620,6240,10720 +** Processing line: ~ 6240,10720,6420,10740~ - Inside source: true *** True Line Result - -** Processing line: ~ if snaps[x_floor]~ + 6240,10720,6420,10740 +** Processing line: ~ 6420,10740,6640,10760~ - Inside source: true *** True Line Result - if snaps[x_floor] -** Processing line: ~ x_result = x_floor~ + 6420,10740,6640,10760 +** Processing line: ~ 6640,10760,6880,10780~ - Inside source: true *** True Line Result - x_result = x_floor -** Processing line: ~ elsif snaps[x_ceil]~ + 6640,10760,6880,10780 +** Processing line: ~ 7140,10780,7400,10780~ - Inside source: true *** True Line Result - elsif snaps[x_ceil] -** Processing line: ~ x_result = x_ceil~ + 7140,10780,7400,10780 +** Processing line: ~ 6880,10780,7140,10780~ - Inside source: true *** True Line Result - x_result = x_ceil -** Processing line: ~ elsif x_mod < snap_number.idiv(2)~ + 6880,10780,7140,10780 +** Processing line: ~ 7400,10780,7680,10780~ - Inside source: true *** True Line Result - elsif x_mod < snap_number.idiv(2) -** Processing line: ~ x_result = x_floor~ + 7400,10780,7680,10780 +** Processing line: ~ 7680,10780,8100,10760~ - Inside source: true *** True Line Result - x_result = x_floor -** Processing line: ~ else~ + 7680,10780,8100,10760 +** Processing line: ~ 8100,10760,8460,10740~ - Inside source: true *** True Line Result - else -** Processing line: ~ x_result = x_ceil~ + 8100,10760,8460,10740 +** Processing line: ~ 8460,10740,8700,10760~ - Inside source: true *** True Line Result - x_result = x_ceil -** Processing line: ~ end~ + 8460,10740,8700,10760 +** Processing line: ~ 8800,10840,8800,10980~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8800,10840,8800,10980 +** Processing line: ~ 8700,10760,8800,10840~ - Inside source: true *** True Line Result - -** Processing line: ~ snaps[x_result] ||= {}~ + 8700,10760,8800,10840 +** Processing line: ~ 8760,11200,8800,10980~ - Inside source: true *** True Line Result - snaps[x_result] ||= {} -** Processing line: ~~ + 8760,11200,8800,10980 +** Processing line: ~ 8760,11200,8760,11380~ - Inside source: true *** True Line Result - -** Processing line: ~ if snaps[x_result][y_floor]~ + 8760,11200,8760,11380 +** Processing line: ~ 8760,11380,8800,11560~ - Inside source: true *** True Line Result - if snaps[x_result][y_floor] -** Processing line: ~ y_result = y_floor~ + 8760,11380,8800,11560 +** Processing line: ~ 8760,11680,8800,11560~ - Inside source: true *** True Line Result - y_result = y_floor -** Processing line: ~ elsif snaps[x_result][y_ceil]~ + 8760,11680,8800,11560 +** Processing line: ~ 8760,11760,8760,11680~ - Inside source: true *** True Line Result - elsif snaps[x_result][y_ceil] -** Processing line: ~ y_result = y_ceil~ + 8760,11760,8760,11680 +** Processing line: ~ 8760,11760,8760,11920~ - Inside source: true *** True Line Result - y_result = y_ceil -** Processing line: ~ elsif y_mod < snap_number.idiv(2)~ + 8760,11760,8760,11920 +** Processing line: ~ 8760,11920,8800,12080~ - Inside source: true *** True Line Result - elsif y_mod < snap_number.idiv(2) -** Processing line: ~ y_result = y_floor~ + 8760,11920,8800,12080 +** Processing line: ~ 8800,12200,8800,12080~ - Inside source: true *** True Line Result - y_result = y_floor -** Processing line: ~ else~ + 8800,12200,8800,12080 +** Processing line: ~ 8700,12240,8800,12200~ - Inside source: true *** True Line Result - else -** Processing line: ~ y_result = y_ceil~ + 8700,12240,8800,12200 +** Processing line: ~ 8560,12220,8700,12240~ - Inside source: true *** True Line Result - y_result = y_ceil -** Processing line: ~ end~ + 8560,12220,8700,12240 +** Processing line: ~ 8360,12220,8560,12220~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8360,12220,8560,12220 +** Processing line: ~ 8160,12240,8360,12220~ - Inside source: true *** True Line Result - -** Processing line: ~ snaps[x_result][y_result] = true~ + 8160,12240,8360,12220 +** Processing line: ~ 7720,12220,7980,12220~ - Inside source: true *** True Line Result - snaps[x_result][y_result] = true -** Processing line: ~ return [x_result, y_result]~ + 7720,12220,7980,12220 +** Processing line: ~ 7980,12220,8160,12240~ - Inside source: true *** True Line Result - return [x_result, y_result] -** Processing line: ~~ + 7980,12220,8160,12240 +** Processing line: ~ 7400,12200,7720,12220~ - Inside source: true *** True Line Result - -** Processing line: ~ end~ + 7400,12200,7720,12220 +** Processing line: ~ 7200,12180,7400,12200~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7200,12180,7400,12200 +** Processing line: ~ 7000,12160,7200,12180~ - Inside source: true *** True Line Result - -** Processing line: ~ def snap_line line~ + 7000,12160,7200,12180 +** Processing line: ~ 6800,12160,7000,12160~ - Inside source: true *** True Line Result - def snap_line line -** Processing line: ~ x, y, x2, y2 = line~ + 6800,12160,7000,12160 +** Processing line: ~ 6280,12140,6380,12180~ - Inside source: true *** True Line Result - x, y, x2, y2 = line -** Processing line: ~ end~ + 6280,12140,6380,12180 +** Processing line: ~ 6120,12180,6280,12140~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6120,12180,6280,12140 +** Processing line: ~ 6540,12180,6800,12160~ - Inside source: true *** True Line Result - -** Processing line: ~ def string_to_line s~ + 6540,12180,6800,12160 +** Processing line: ~ 6380,12180,6540,12180~ - Inside source: true *** True Line Result - def string_to_line s -** Processing line: ~ x, y, x2, y2 = s.split(',').map(&:to_f)~ + 6380,12180,6540,12180 +** Processing line: ~ 5900,12200,6120,12180~ - Inside source: true *** True Line Result - x, y, x2, y2 = s.split(',').map(&:to_f) -** Processing line: ~~ + 5900,12200,6120,12180 +** Processing line: ~ 5620,12180,5900,12200~ - Inside source: true *** True Line Result - -** Processing line: ~ if x > x2~ + 5620,12180,5900,12200 +** Processing line: ~ 5340,12120,5620,12180~ - Inside source: true *** True Line Result - if x > x2 -** Processing line: ~ x2, x = x, x2~ + 5340,12120,5620,12180 +** Processing line: ~ 5140,12100,5340,12120~ - Inside source: true *** True Line Result - x2, x = x, x2 -** Processing line: ~ y2, y = y, y2~ + 5140,12100,5340,12120 +** Processing line: ~ 4980,12120,5140,12100~ - Inside source: true *** True Line Result - y2, y = y, y2 -** Processing line: ~ end~ + 4980,12120,5140,12100 +** Processing line: ~ 4840,12120,4980,12120~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4840,12120,4980,12120 +** Processing line: ~ 4700,12200,4840,12120~ - Inside source: true *** True Line Result - -** Processing line: ~ x, y = snap_to_grid x, y, state.snaps~ + 4700,12200,4840,12120 +** Processing line: ~ 4700,12380,4700,12200~ - Inside source: true *** True Line Result - x, y = snap_to_grid x, y, state.snaps -** Processing line: ~ x2, y2 = snap_to_grid x2, y2, state.snaps~ + 4700,12380,4700,12200 +** Processing line: ~ 4740,12480,4940,12520~ - Inside source: true *** True Line Result - x2, y2 = snap_to_grid x2, y2, state.snaps -** Processing line: ~ [x, y, x2, y2].line.to_hash~ + 4740,12480,4940,12520 +** Processing line: ~ 4700,12380,4740,12480~ - Inside source: true *** True Line Result - [x, y, x2, y2].line.to_hash -** Processing line: ~ end~ + 4700,12380,4740,12480 +** Processing line: ~ 4940,12520,5160,12560~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4940,12520,5160,12560 +** Processing line: ~ 5160,12560,5340,12600~ - Inside source: true *** True Line Result - -** Processing line: ~ def load_lines file~ + 5160,12560,5340,12600 +** Processing line: ~ 5340,12600,5400,12600~ - Inside source: true *** True Line Result - def load_lines file -** Processing line: ~ data = gtk.read_file(file) || ""~ + 5340,12600,5400,12600 +** Processing line: ~ 5400,12600,5500,12600~ - Inside source: true *** True Line Result - data = gtk.read_file(file) || "" -** Processing line: ~ data.each_line~ + 5400,12600,5500,12600 +** Processing line: ~ 5500,12600,5620,12600~ - Inside source: true *** True Line Result - data.each_line -** Processing line: ~ .reject { |l| l.strip.length == 0 }~ + 5500,12600,5620,12600 +** Processing line: ~ 5620,12600,5720,12560~ - Inside source: true *** True Line Result - .reject { |l| l.strip.length == 0 } -** Processing line: ~ .map { |l| string_to_line l }~ + 5620,12600,5720,12560 +** Processing line: ~ 5720,12560,5800,12440~ - Inside source: true *** True Line Result - .map { |l| string_to_line l } -** Processing line: ~ .map { |h| h.merge(rect: rect_for_line(h)) }~ + 5720,12560,5800,12440 +** Processing line: ~ 5800,12440,5900,12380~ - Inside source: true *** True Line Result - .map { |h| h.merge(rect: rect_for_line(h)) } -** Processing line: ~ end~ + 5800,12440,5900,12380 +** Processing line: ~ 5900,12380,6120,12420~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5900,12380,6120,12420 +** Processing line: ~ 6120,12420,6380,12440~ - Inside source: true *** True Line Result - -** Processing line: ~ def load_terrain~ + 6120,12420,6380,12440 +** Processing line: ~ 6380,12440,6600,12460~ - Inside source: true *** True Line Result - def load_terrain -** Processing line: ~ load_lines 'level.txt'~ + 6380,12440,6600,12460 +** Processing line: ~ 6720,12460,6840,12520~ - Inside source: true *** True Line Result - load_lines 'level.txt' -** Processing line: ~ end~ + 6720,12460,6840,12520 +** Processing line: ~ 6840,12520,6960,12520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6840,12520,6960,12520 +** Processing line: ~ 6600,12460,6720,12460~ - Inside source: true *** True Line Result - -** Processing line: ~ def load_lava~ + 6600,12460,6720,12460 +** Processing line: ~ 6960,12520,7040,12500~ - Inside source: true *** True Line Result - def load_lava -** Processing line: ~ load_lines 'level_lava.txt'~ + 6960,12520,7040,12500 +** Processing line: ~ 7040,12500,7140,12440~ - Inside source: true *** True Line Result - load_lines 'level_lava.txt' -** Processing line: ~ end~ + 7040,12500,7140,12440 +** Processing line: ~ 7200,12440,7360,12500~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7200,12440,7360,12500 +** Processing line: ~ 7360,12500,7600,12560~ - Inside source: true *** True Line Result - -** Processing line: ~ def load_level force: false~ + 7360,12500,7600,12560 +** Processing line: ~ 7600,12560,7860,12600~ - Inside source: true *** True Line Result - def load_level force: false -** Processing line: ~ if force~ + 7600,12560,7860,12600 +** Processing line: ~ 7860,12600,8060,12500~ - Inside source: true *** True Line Result - if force -** Processing line: ~ state.snaps = {}~ + 7860,12600,8060,12500 +** Processing line: ~ 8100,12500,8200,12340~ - Inside source: true *** True Line Result - state.snaps = {} -** Processing line: ~ state.terrain = load_terrain~ + 8100,12500,8200,12340 +** Processing line: ~ 8200,12340,8360,12360~ - Inside source: true *** True Line Result - state.terrain = load_terrain -** Processing line: ~ state.lava = load_lava~ + 8200,12340,8360,12360 +** Processing line: ~ 8360,12360,8560,12400~ - Inside source: true *** True Line Result - state.lava = load_lava -** Processing line: ~ else~ + 8360,12360,8560,12400 +** Processing line: ~ 8560,12400,8660,12420~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.terrain ||= load_terrain~ + 8560,12400,8660,12420 +** Processing line: ~ 8660,12420,8840,12400~ - Inside source: true *** True Line Result - state.terrain ||= load_terrain -** Processing line: ~ state.lava ||= load_lava~ + 8660,12420,8840,12400 +** Processing line: ~ 8840,12400,9000,12360~ - Inside source: true *** True Line Result - state.lava ||= load_lava -** Processing line: ~ end~ + 8840,12400,9000,12360 +** Processing line: ~ 9000,12360,9000,12360~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 9000,12360,9000,12360 +** Processing line: ~ 2900,4400,2900,4280~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2900,4400,2900,4280 +** Processing line: ~ 900,7320,1000,7220~ - Inside source: true *** True Line Result - -** Processing line: ~ def save_lines lines, file~ + 900,7320,1000,7220 +** Processing line: ~ 2640,13040,2900,12920~ - Inside source: true *** True Line Result - def save_lines lines, file -** Processing line: ~ s = lines.map do |l|~ + 2640,13040,2900,12920 +** Processing line: ~ 2900,12920,3160,12840~ - Inside source: true *** True Line Result - s = lines.map do |l| -** Processing line: ~ "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"~ + 2900,12920,3160,12840 +** Processing line: ~ 3480,12760,3780,12620~ - Inside source: true *** True Line Result - "#{l.x1},#{l.y1},#{l.x2},#{l.y2}" -** Processing line: ~ end.join("\n")~ + 3480,12760,3780,12620 +** Processing line: ~ 3780,12620,4020,12460~ - Inside source: true *** True Line Result - end.join("\n") -** Processing line: ~ gtk.write_file(file, s)~ + 3780,12620,4020,12460 +** Processing line: ~ 4300,12360,4440,12260~ - Inside source: true *** True Line Result - gtk.write_file(file, s) -** Processing line: ~ end~ + 4300,12360,4440,12260 +** Processing line: ~ 4020,12460,4300,12360~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4020,12460,4300,12360 +** Processing line: ~ 3160,12840,3480,12760~ - Inside source: true *** True Line Result - -** Processing line: ~ def save_level~ + 3160,12840,3480,12760 +** Processing line: ~ 4440,12080,4440,12260~ - Inside source: true *** True Line Result - def save_level -** Processing line: ~ save_lines(state.terrain, 'level.txt')~ + 4440,12080,4440,12260 +** Processing line: ~ 4440,12080,4440,11880~ - Inside source: true *** True Line Result - save_lines(state.terrain, 'level.txt') -** Processing line: ~ save_lines(state.lava, 'level_lava.txt')~ + 4440,12080,4440,11880 +** Processing line: ~ 4440,11880,4440,11720~ - Inside source: true *** True Line Result - save_lines(state.lava, 'level_lava.txt') -** Processing line: ~ load_level force: true~ + 4440,11880,4440,11720 +** Processing line: ~ 4440,11720,4600,11720~ - Inside source: true *** True Line Result - load_level force: true -** Processing line: ~ end~ + 4440,11720,4600,11720 +** Processing line: ~ 4600,11720,4760,11740~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4600,11720,4760,11740 +** Processing line: ~ 4760,11740,4980,11760~ - Inside source: true *** True Line Result - -** Processing line: ~ def line_near_rect? rect, terrain~ + 4760,11740,4980,11760 +** Processing line: ~ 4980,11760,5160,11760~ - Inside source: true *** True Line Result - def line_near_rect? rect, terrain -** Processing line: ~ geometry.intersect_rect?(rect, terrain[:rect])~ + 4980,11760,5160,11760 +** Processing line: ~ 5160,11760,5340,11780~ - Inside source: true *** True Line Result - geometry.intersect_rect?(rect, terrain[:rect]) -** Processing line: ~ end~ + 5160,11760,5340,11780 +** Processing line: ~ 6000,11860,6120,11820~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6000,11860,6120,11820 +** Processing line: ~ 5340,11780,5620,11820~ - Inside source: true *** True Line Result - -** Processing line: ~ def point_within_line? point, line~ + 5340,11780,5620,11820 +** Processing line: ~ 5620,11820,6000,11860~ - Inside source: true *** True Line Result - def point_within_line? point, line -** Processing line: ~ return false if !point~ + 5620,11820,6000,11860 +** Processing line: ~ 6120,11820,6360,11820~ - Inside source: true *** True Line Result - return false if !point -** Processing line: ~ return false if !line~ + 6120,11820,6360,11820 +** Processing line: ~ 6360,11820,6640,11860~ - Inside source: true *** True Line Result - return false if !line -** Processing line: ~ return true~ + 6360,11820,6640,11860 +** Processing line: ~ 6940,11920,7240,11940~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + 6940,11920,7240,11940 +** Processing line: ~ 7240,11940,7520,11960~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7240,11940,7520,11960 +** Processing line: ~ 7520,11960,7860,11960~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_impacts x, dx, y, dy, radius~ + 7520,11960,7860,11960 +** Processing line: ~ 7860,11960,8100,11920~ - Inside source: true *** True Line Result - def calc_impacts x, dx, y, dy, radius -** Processing line: ~ results = { }~ + 7860,11960,8100,11920 +** Processing line: ~ 8100,11920,8420,11940~ - Inside source: true *** True Line Result - results = { } -** Processing line: ~ results[:x] = x~ + 8100,11920,8420,11940 +** Processing line: ~ 8420,11940,8460,11960~ - Inside source: true *** True Line Result - results[:x] = x -** Processing line: ~ results[:y] = y~ + 8420,11940,8460,11960 +** Processing line: ~ 8460,11960,8500,11860~ - Inside source: true *** True Line Result - results[:y] = y -** Processing line: ~ results[:dx] = x~ + 8460,11960,8500,11860 +** Processing line: ~ 8460,11760,8500,11860~ - Inside source: true *** True Line Result - results[:dx] = x -** Processing line: ~ results[:dy] = y~ + 8460,11760,8500,11860 +** Processing line: ~ 8320,11720,8460,11760~ - Inside source: true *** True Line Result - results[:dy] = y -** Processing line: ~ results[:point] = { x: x, y: y }~ + 8320,11720,8460,11760 +** Processing line: ~ 8160,11720,8320,11720~ - Inside source: true *** True Line Result - results[:point] = { x: x, y: y } -** Processing line: ~ results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }~ + 8160,11720,8320,11720 +** Processing line: ~ 7940,11720,8160,11720~ - Inside source: true *** True Line Result - results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 } -** Processing line: ~ results[:trajectory] = trajectory(results)~ + 7940,11720,8160,11720 +** Processing line: ~ 7720,11700,7940,11720~ - Inside source: true *** True Line Result - results[:trajectory] = trajectory(results) -** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ + 7720,11700,7940,11720 +** Processing line: ~ 7520,11680,7720,11700~ - Inside source: true *** True Line Result - results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| -** Processing line: ~ {~ + 7520,11680,7720,11700 +** Processing line: ~ 7320,11680,7520,11680~ - Inside source: true *** True Line Result - { -** Processing line: ~ terrain: t,~ + 7320,11680,7520,11680 +** Processing line: ~ 7200,11620,7320,11680~ - Inside source: true *** True Line Result - terrain: t, -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ + 7200,11620,7320,11680 +** Processing line: ~ 7200,11620,7200,11500~ - Inside source: true *** True Line Result - point: geometry.line_intersect(results[:trajectory], t), -** Processing line: ~ type: :terrain~ + 7200,11620,7200,11500 +** Processing line: ~ 7200,11500,7280,11440~ - Inside source: true *** True Line Result - type: :terrain -** Processing line: ~ }~ + 7200,11500,7280,11440 +** Processing line: ~ 7280,11440,7420,11440~ - Inside source: true *** True Line Result - } -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ + 7280,11440,7420,11440 +** Processing line: ~ 7420,11440,7600,11440~ - Inside source: true *** True Line Result - end.reject { |t| !point_within_line? t[:point], t[:terrain] } -** Processing line: ~~ + 7420,11440,7600,11440 +** Processing line: ~ 7600,11440,7980,11460~ - Inside source: true *** True Line Result - -** Processing line: ~ results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ + 7600,11440,7980,11460 +** Processing line: ~ 7980,11460,8160,11460~ - Inside source: true *** True Line Result - results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t| -** Processing line: ~ {~ + 7980,11460,8160,11460 +** Processing line: ~ 8160,11460,8360,11460~ - Inside source: true *** True Line Result - { -** Processing line: ~ terrain: t,~ + 8160,11460,8360,11460 +** Processing line: ~ 8360,11460,8460,11400~ - Inside source: true *** True Line Result - terrain: t, -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ + 8360,11460,8460,11400 +** Processing line: ~ 8420,11060,8500,11200~ - Inside source: true *** True Line Result - point: geometry.line_intersect(results[:trajectory], t), -** Processing line: ~ type: :lava~ + 8420,11060,8500,11200 +** Processing line: ~ 8280,11040,8420,11060~ - Inside source: true *** True Line Result - type: :lava -** Processing line: ~ }~ + 8280,11040,8420,11060 +** Processing line: ~ 8100,11060,8280,11040~ - Inside source: true *** True Line Result - } -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ + 8100,11060,8280,11040 +** Processing line: ~ 8460,11400,8500,11200~ - Inside source: true *** True Line Result - end.reject { |t| !point_within_line? t[:point], t[:terrain] } -** Processing line: ~~ + 8460,11400,8500,11200 +** Processing line: ~ 7800,11060,8100,11060~ - Inside source: true *** True Line Result - -** Processing line: ~ results~ + 7800,11060,8100,11060 +** Processing line: ~ 7520,11060,7800,11060~ - Inside source: true *** True Line Result - results -** Processing line: ~ end~ + 7520,11060,7800,11060 +** Processing line: ~ 7240,11060,7520,11060~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7240,11060,7520,11060 +** Processing line: ~ 6940,11040,7240,11060~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_potential_impacts~ + 6940,11040,7240,11060 +** Processing line: ~ 6640,11000,6940,11040~ - Inside source: true *** True Line Result - def calc_potential_impacts -** Processing line: ~ impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius~ + 6640,11000,6940,11040 +** Processing line: ~ 6420,10980,6640,11000~ - Inside source: true *** True Line Result - impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius -** Processing line: ~ circle.rect = impact_results[:rect]~ + 6420,10980,6640,11000 +** Processing line: ~ 6360,11060,6420,10980~ - Inside source: true *** True Line Result - circle.rect = impact_results[:rect] -** Processing line: ~ circle.trajectory = impact_results[:trajectory]~ + 6360,11060,6420,10980 +** Processing line: ~ 6360,11180,6360,11060~ - Inside source: true *** True Line Result - circle.trajectory = impact_results[:trajectory] -** Processing line: ~ circle.impacts = impact_results[:impacts]~ + 6360,11180,6360,11060 +** Processing line: ~ 6200,11280,6360,11180~ - Inside source: true *** True Line Result - circle.impacts = impact_results[:impacts] -** Processing line: ~ end~ + 6200,11280,6360,11180 +** Processing line: ~ 5960,11300,6200,11280~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5960,11300,6200,11280 +** Processing line: ~ 5720,11280,5960,11300~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_terrains_to_monitor~ + 5720,11280,5960,11300 +** Processing line: ~ 5500,11280,5720,11280~ - Inside source: true *** True Line Result - def calc_terrains_to_monitor -** Processing line: ~ circle.impact = nil~ + 5500,11280,5720,11280 +** Processing line: ~ 4940,11300,5200,11280~ - Inside source: true *** True Line Result - circle.impact = nil -** Processing line: ~ circle.impacts.each do |i|~ + 4940,11300,5200,11280 +** Processing line: ~ 4660,11260,4940,11300~ - Inside source: true *** True Line Result - circle.impacts.each do |i| -** Processing line: ~ circle.terrains_to_monitor[i[:terrain]] ||= {~ + 4660,11260,4940,11300 +** Processing line: ~ 4440,11280,4660,11260~ - Inside source: true *** True Line Result - circle.terrains_to_monitor[i[:terrain]] ||= { -** Processing line: ~ ray_start: geometry.ray_test(circle, i[:terrain]),~ + 4440,11280,4660,11260 +** Processing line: ~ 4260,11280,4440,11280~ - Inside source: true *** True Line Result - ray_start: geometry.ray_test(circle, i[:terrain]), -** Processing line: ~ }~ + 4260,11280,4440,11280 +** Processing line: ~ 4220,11220,4260,11280~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + 4220,11220,4260,11280 +** Processing line: ~ 4080,11280,4220,11220~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])~ + 4080,11280,4220,11220 +** Processing line: ~ 3980,11420,4080,11280~ - Inside source: true *** True Line Result - circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain]) -** Processing line: ~ if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]~ + 3980,11420,4080,11280 +** Processing line: ~ 3980,11420,4040,11620~ - Inside source: true *** True Line Result - if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current] -** Processing line: ~ if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)~ + 3980,11420,4040,11620 +** Processing line: ~ 4040,11620,4040,11820~ - Inside source: true *** True Line Result - if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2) -** Processing line: ~ circle.impact = i~ + 4040,11620,4040,11820 +** Processing line: ~ 3980,11960,4040,11820~ - Inside source: true *** True Line Result - circle.impact = i -** Processing line: ~ circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]~ + 3980,11960,4040,11820 +** Processing line: ~ 3840,12000,3980,11960~ - Inside source: true *** True Line Result - circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current] -** Processing line: ~ end~ + 3840,12000,3980,11960 +** Processing line: ~ 3720,11940,3840,12000~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3720,11940,3840,12000 +** Processing line: ~ 3680,11800,3720,11940~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3680,11800,3720,11940 +** Processing line: ~ 3680,11580,3680,11800~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3680,11580,3680,11800 +** Processing line: ~ 3680,11360,3680,11580~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3680,11360,3680,11580 +** Processing line: ~ 3680,11360,3680,11260~ - Inside source: true *** True Line Result - -** Processing line: ~ def impact_result body, impact~ + 3680,11360,3680,11260 +** Processing line: ~ 3680,11080,3680,11260~ - Inside source: true *** True Line Result - def impact_result body, impact -** Processing line: ~ infinity_alias = 1000~ + 3680,11080,3680,11260 +** Processing line: ~ 3680,11080,3680,10880~ - Inside source: true *** True Line Result - infinity_alias = 1000 -** Processing line: ~ r = {~ + 3680,11080,3680,10880 +** Processing line: ~ 3680,10700,3680,10880~ - Inside source: true *** True Line Result - r = { -** Processing line: ~ body: {},~ + 3680,10700,3680,10880 +** Processing line: ~ 3680,10700,3680,10620~ - Inside source: true *** True Line Result - body: {}, -** Processing line: ~ terrain: {},~ + 3680,10700,3680,10620 +** Processing line: ~ 3680,10480,3680,10620~ - Inside source: true *** True Line Result - terrain: {}, -** Processing line: ~ impact: {}~ + 3680,10480,3680,10620 +** Processing line: ~ 3680,10480,3680,10300~ - Inside source: true *** True Line Result - impact: {} -** Processing line: ~ }~ + 3680,10480,3680,10300 +** Processing line: ~ 3680,10300,3680,10100~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + 3680,10300,3680,10100 +** Processing line: ~ 3680,10100,3680,9940~ - Inside source: true *** True Line Result - -** Processing line: ~ r[:body][:line] = body.trajectory.dup~ + 3680,10100,3680,9940 +** Processing line: ~ 3680,9940,3720,9860~ - Inside source: true *** True Line Result - r[:body][:line] = body.trajectory.dup -** Processing line: ~ r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)~ + 3680,9940,3720,9860 +** Processing line: ~ 3720,9860,3920,9900~ - Inside source: true *** True Line Result - r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias) -** Processing line: ~ r[:body][:slope_sign] = r[:body][:slope].sign~ + 3720,9860,3920,9900 +** Processing line: ~ 3920,9900,4220,9880~ - Inside source: true *** True Line Result - r[:body][:slope_sign] = r[:body][:slope].sign -** Processing line: ~ r[:body][:x] = body.x~ + 3920,9900,4220,9880 +** Processing line: ~ 4980,9940,5340,9960~ - Inside source: true *** True Line Result - r[:body][:x] = body.x -** Processing line: ~ r[:body][:y] = body.y~ + 4980,9940,5340,9960 +** Processing line: ~ 4220,9880,4540,9900~ - Inside source: true *** True Line Result - r[:body][:y] = body.y -** Processing line: ~ r[:body][:dy] = body.dy~ + 4220,9880,4540,9900 +** Processing line: ~ 4540,9900,4980,9940~ - Inside source: true *** True Line Result - r[:body][:dy] = body.dy -** Processing line: ~ r[:body][:dx] = body.dx~ + 4540,9900,4980,9940 +** Processing line: ~ 5340,9960,5620,9960~ - Inside source: true *** True Line Result - r[:body][:dx] = body.dx -** Processing line: ~~ + 5340,9960,5620,9960 +** Processing line: ~ 5620,9960,5900,9960~ - Inside source: true *** True Line Result - -** Processing line: ~ r[:terrain][:line] = impact[:terrain].dup~ + 5620,9960,5900,9960 +** Processing line: ~ 5900,9960,6160,10000~ - Inside source: true *** True Line Result - r[:terrain][:line] = impact[:terrain].dup -** Processing line: ~ r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)~ + 5900,9960,6160,10000 +** Processing line: ~ 6160,10000,6480,10000~ - Inside source: true *** True Line Result - r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias) -** Processing line: ~ r[:terrain][:slope_sign] = r[:terrain][:slope].sign~ + 6160,10000,6480,10000 +** Processing line: ~ 6480,10000,6720,10000~ - Inside source: true *** True Line Result - r[:terrain][:slope_sign] = r[:terrain][:slope].sign -** Processing line: ~~ + 6480,10000,6720,10000 +** Processing line: ~ 6720,10000,6880,9860~ - Inside source: true *** True Line Result - -** Processing line: ~ r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)~ + 6720,10000,6880,9860 +** Processing line: ~ 6880,9860,6880,9520~ - Inside source: true *** True Line Result - r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias) -** Processing line: ~ r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }~ + 6880,9860,6880,9520 +** Processing line: ~ 6880,9520,6940,9340~ - Inside source: true *** True Line Result - r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y } -** Processing line: ~ r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]~ + 6880,9520,6940,9340 +** Processing line: ~ 6940,9120,6940,9340~ - Inside source: true *** True Line Result - r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign] -** Processing line: ~ r[:impact][:ray] = body.ray_current~ + 6940,9120,6940,9340 +** Processing line: ~ 6940,9120,6940,8920~ - Inside source: true *** True Line Result - r[:impact][:ray] = body.ray_current -** Processing line: ~ r[:body][:new_on_floor] = body.on_floor~ + 6940,9120,6940,8920 +** Processing line: ~ 6940,8700,6940,8920~ - Inside source: true *** True Line Result - r[:body][:new_on_floor] = body.on_floor -** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ + 6940,8700,6940,8920 +** Processing line: ~ 6880,8500,6940,8700~ - Inside source: true *** True Line Result - r[:body][:new_floor] = r[:terrain][:line] -** Processing line: ~~ + 6880,8500,6940,8700 +** Processing line: ~ 6880,8320,6880,8500~ - Inside source: true *** True Line Result - -** Processing line: ~ if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3~ + 6880,8320,6880,8500 +** Processing line: ~ 7140,8320,7140,8180~ - Inside source: true *** True Line Result - if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3 -** Processing line: ~ play_sound~ + 7140,8320,7140,8180 +** Processing line: ~ 6760,8260,6880,8320~ - Inside source: true *** True Line Result - play_sound -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1~ + 6760,8260,6880,8320 +** Processing line: ~ 6540,8240,6760,8260~ - Inside source: true *** True Line Result - r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1 -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * circle.elasticity~ + 6540,8240,6760,8260 +** Processing line: ~ 6420,8180,6540,8240~ - Inside source: true *** True Line Result - r[:body][:new_dx] = r[:body][:dx] * circle.elasticity -** Processing line: ~ r[:impact][:type] = :horizontal~ + 6420,8180,6540,8240 +** Processing line: ~ 6280,8240,6420,8180~ - Inside source: true *** True Line Result - r[:impact][:type] = :horizontal -** Processing line: ~ r[:body][:new_reason] = "-"~ + 6280,8240,6420,8180 +** Processing line: ~ 6160,8300,6280,8240~ - Inside source: true *** True Line Result - r[:body][:new_reason] = "-" -** Processing line: ~ elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3~ + 6160,8300,6280,8240 +** Processing line: ~ 6120,8400,6160,8300~ - Inside source: true *** True Line Result - elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3 -** Processing line: ~ play_sound~ + 6120,8400,6160,8300 +** Processing line: ~ 6080,8520,6120,8400~ - Inside source: true *** True Line Result - play_sound -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * 1.1~ + 6080,8520,6120,8400 +** Processing line: ~ 5840,8480,6080,8520~ - Inside source: true *** True Line Result - r[:body][:new_dy] = r[:body][:dy] * 1.1 -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ + 5840,8480,6080,8520 +** Processing line: ~ 5620,8500,5840,8480~ - Inside source: true *** True Line Result - r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity -** Processing line: ~ r[:impact][:type] = :vertical~ + 5620,8500,5840,8480 +** Processing line: ~ 5500,8500,5620,8500~ - Inside source: true *** True Line Result - r[:impact][:type] = :vertical -** Processing line: ~ r[:body][:new_reason] = "|"~ + 5500,8500,5620,8500 +** Processing line: ~ 5340,8560,5500,8500~ - Inside source: true *** True Line Result - r[:body][:new_reason] = "|" -** Processing line: ~ else~ + 5340,8560,5500,8500 +** Processing line: ~ 5160,8540,5340,8560~ - Inside source: true *** True Line Result - else -** Processing line: ~ play_sound~ + 5160,8540,5340,8560 +** Processing line: ~ 4620,8520,4880,8520~ - Inside source: true *** True Line Result - play_sound -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ + 4620,8520,4880,8520 +** Processing line: ~ 4360,8480,4620,8520~ - Inside source: true *** True Line Result - r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity~ + 4360,8480,4620,8520 +** Processing line: ~ 4880,8520,5160,8540~ - Inside source: true *** True Line Result - r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity -** Processing line: ~ r[:impact][:type] = :slanted~ + 4880,8520,5160,8540 +** Processing line: ~ 4140,8440,4360,8480~ - Inside source: true *** True Line Result - r[:impact][:type] = :slanted -** Processing line: ~ r[:body][:new_reason] = "/"~ + 4140,8440,4360,8480 +** Processing line: ~ 3920,8460,4140,8440~ - Inside source: true *** True Line Result - r[:body][:new_reason] = "/" -** Processing line: ~ end~ + 3920,8460,4140,8440 +** Processing line: ~ 3720,8380,3920,8460~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3720,8380,3920,8460 +** Processing line: ~ 3680,8160,3720,8380~ - Inside source: true *** True Line Result - -** Processing line: ~ r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs~ + 3680,8160,3720,8380 +** Processing line: ~ 3680,8160,3720,7940~ - Inside source: true *** True Line Result - r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs -** Processing line: ~~ + 3680,8160,3720,7940 +** Processing line: ~ 3720,7720,3720,7940~ - Inside source: true *** True Line Result - -** Processing line: ~ if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4~ + 3720,7720,3720,7940 +** Processing line: ~ 3680,7580,3720,7720~ - Inside source: true *** True Line Result - if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4 -** Processing line: ~ r[:body][:new_dx] = 0~ + 3680,7580,3720,7720 +** Processing line: ~ 3680,7580,3720,7440~ - Inside source: true *** True Line Result - r[:body][:new_dx] = 0 -** Processing line: ~ r[:body][:new_dy] = 0~ + 3680,7580,3720,7440 +** Processing line: ~ 3720,7440,3720,7300~ - Inside source: true *** True Line Result - r[:body][:new_dy] = 0 -** Processing line: ~ r[:impact][:energy] = 0~ + 3720,7440,3720,7300 +** Processing line: ~ 3720,7160,3720,7300~ - Inside source: true *** True Line Result - r[:impact][:energy] = 0 -** Processing line: ~ r[:body][:new_on_floor] = true~ + 3720,7160,3720,7300 +** Processing line: ~ 3720,7160,3720,7020~ - Inside source: true *** True Line Result - r[:body][:new_on_floor] = true -** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ + 3720,7160,3720,7020 +** Processing line: ~ 3720,7020,3780,6900~ - Inside source: true *** True Line Result - r[:body][:new_floor] = r[:terrain][:line] -** Processing line: ~ r[:body][:new_reason] = "0"~ + 3720,7020,3780,6900 +** Processing line: ~ 3780,6900,4080,6940~ - Inside source: true *** True Line Result - r[:body][:new_reason] = "0" -** Processing line: ~ end~ + 3780,6900,4080,6940 +** Processing line: ~ 4080,6940,4340,6980~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4080,6940,4340,6980 +** Processing line: ~ 4340,6980,4600,6980~ - Inside source: true *** True Line Result - -** Processing line: ~ r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],~ + 4340,6980,4600,6980 +** Processing line: ~ 4600,6980,4880,6980~ - Inside source: true *** True Line Result - r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx], -** Processing line: ~ y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },~ + 4600,6980,4880,6980 +** Processing line: ~ 4880,6980,5160,6980~ - Inside source: true *** True Line Result - y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity }, -** Processing line: ~ r[:terrain][:line])~ + 4880,6980,5160,6980 +** Processing line: ~ 5160,6980,5400,7000~ - Inside source: true *** True Line Result - r[:terrain][:line]) -** Processing line: ~~ + 5160,6980,5400,7000 +** Processing line: ~ 5400,7000,5560,7020~ - Inside source: true *** True Line Result - -** Processing line: ~ if r[:impact][:ray_next] == r[:impact][:ray]~ + 5400,7000,5560,7020 +** Processing line: ~ 5560,7020,5660,7080~ - Inside source: true *** True Line Result - if r[:impact][:ray_next] == r[:impact][:ray] -** Processing line: ~ r[:body][:new_dx] *= -1~ + 5560,7020,5660,7080 +** Processing line: ~ 5660,7080,5660,7280~ - Inside source: true *** True Line Result - r[:body][:new_dx] *= -1 -** Processing line: ~ r[:body][:new_dy] *= -1~ + 5660,7080,5660,7280 +** Processing line: ~ 5660,7280,5660,7440~ - Inside source: true *** True Line Result - r[:body][:new_dy] *= -1 -** Processing line: ~ r[:body][:new_reason] = "clip"~ + 5660,7280,5660,7440 +** Processing line: ~ 5660,7440,5740,7520~ - Inside source: true *** True Line Result - r[:body][:new_reason] = "clip" -** Processing line: ~ end~ + 5660,7440,5740,7520 +** Processing line: ~ 5740,7520,5740,7600~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5740,7520,5740,7600 +** Processing line: ~ 5740,7600,5900,7600~ - Inside source: true *** True Line Result - -** Processing line: ~ r~ + 5740,7600,5900,7600 +** Processing line: ~ 5900,7600,6040,7540~ - Inside source: true *** True Line Result - r -** Processing line: ~ end~ + 5900,7600,6040,7540 +** Processing line: ~ 6040,7540,6040,7320~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6040,7540,6040,7320 +** Processing line: ~ 6040,7320,6120,7200~ - Inside source: true *** True Line Result - -** Processing line: ~ def game_over!~ + 6040,7320,6120,7200 +** Processing line: ~ 6120,7200,6120,7040~ - Inside source: true *** True Line Result - def game_over! -** Processing line: ~ circle.x = circle.check_point_x~ + 6120,7200,6120,7040 +** Processing line: ~ 6120,7040,6240,7000~ - Inside source: true *** True Line Result - circle.x = circle.check_point_x -** Processing line: ~ circle.y = circle.check_point_y~ + 6120,7040,6240,7000 +** Processing line: ~ 6240,7000,6480,7060~ - Inside source: true *** True Line Result - circle.y = circle.check_point_y -** Processing line: ~ circle.dx = 0~ + 6240,7000,6480,7060 +** Processing line: ~ 6480,7060,6800,7060~ - Inside source: true *** True Line Result - circle.dx = 0 -** Processing line: ~ circle.dy = 0~ + 6480,7060,6800,7060 +** Processing line: ~ 6800,7060,7080,7080~ - Inside source: true *** True Line Result - circle.dy = 0 -** Processing line: ~ circle.game_over_at = state.tick_count~ + 6800,7060,7080,7080 +** Processing line: ~ 7080,7080,7320,7100~ - Inside source: true *** True Line Result - circle.game_over_at = state.tick_count -** Processing line: ~ end~ + 7080,7080,7320,7100 +** Processing line: ~ 7940,7100,7980,6920~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7940,7100,7980,6920 +** Processing line: ~ 7860,6860,7980,6920~ - Inside source: true *** True Line Result - -** Processing line: ~ def not_game_over!~ + 7860,6860,7980,6920 +** Processing line: ~ 7640,6860,7860,6860~ - Inside source: true *** True Line Result - def not_game_over! -** Processing line: ~ impact_history_entry = impact_result circle, circle.impact~ + 7640,6860,7860,6860 +** Processing line: ~ 7400,6840,7640,6860~ - Inside source: true *** True Line Result - impact_history_entry = impact_result circle, circle.impact -** Processing line: ~ circle.impact_history << impact_history_entry~ + 7400,6840,7640,6860 +** Processing line: ~ 7320,7100,7560,7120~ - Inside source: true *** True Line Result - circle.impact_history << impact_history_entry -** Processing line: ~ circle.x -= circle.dx * 1.1~ + 7320,7100,7560,7120 +** Processing line: ~ 7560,7120,7760,7120~ - Inside source: true *** True Line Result - circle.x -= circle.dx * 1.1 -** Processing line: ~ circle.y -= circle.dy * 1.1~ + 7560,7120,7760,7120 +** Processing line: ~ 7760,7120,7940,7100~ - Inside source: true *** True Line Result - circle.y -= circle.dy * 1.1 -** Processing line: ~ circle.dx = impact_history_entry[:body][:new_dx]~ + 7760,7120,7940,7100 +** Processing line: ~ 7200,6820,7400,6840~ - Inside source: true *** True Line Result - circle.dx = impact_history_entry[:body][:new_dx] -** Processing line: ~ circle.dy = impact_history_entry[:body][:new_dy]~ + 7200,6820,7400,6840 +** Processing line: ~ 7040,6820,7200,6820~ - Inside source: true *** True Line Result - circle.dy = impact_history_entry[:body][:new_dy] -** Processing line: ~ circle.on_floor = impact_history_entry[:body][:new_on_floor]~ + 7040,6820,7200,6820 +** Processing line: ~ 6600,6840,6840,6840~ - Inside source: true *** True Line Result - circle.on_floor = impact_history_entry[:body][:new_on_floor] -** Processing line: ~~ + 6600,6840,6840,6840 +** Processing line: ~ 6380,6800,6600,6840~ - Inside source: true *** True Line Result - -** Processing line: ~ if circle.on_floor~ + 6380,6800,6600,6840 +** Processing line: ~ 6120,6800,6380,6800~ - Inside source: true *** True Line Result - if circle.on_floor -** Processing line: ~ circle.check_point_at = state.tick_count~ + 6120,6800,6380,6800 +** Processing line: ~ 5900,6840,6120,6800~ - Inside source: true *** True Line Result - circle.check_point_at = state.tick_count -** Processing line: ~ circle.check_point_x = circle.x~ + 5900,6840,6120,6800 +** Processing line: ~ 5620,6820,5900,6840~ - Inside source: true *** True Line Result - circle.check_point_x = circle.x -** Processing line: ~ circle.check_point_y = circle.y~ + 5620,6820,5900,6840 +** Processing line: ~ 5400,6800,5620,6820~ - Inside source: true *** True Line Result - circle.check_point_y = circle.y -** Processing line: ~ end~ + 5400,6800,5620,6820 +** Processing line: ~ 5140,6800,5400,6800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5140,6800,5400,6800 +** Processing line: ~ 4880,6780,5140,6800~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.previous_floor = circle.floor || {}~ + 4880,6780,5140,6800 +** Processing line: ~ 4600,6760,4880,6780~ - Inside source: true *** True Line Result - circle.previous_floor = circle.floor || {} -** Processing line: ~ circle.floor = impact_history_entry[:body][:new_floor] || {}~ + 4600,6760,4880,6780 +** Processing line: ~ 4340,6760,4600,6760~ - Inside source: true *** True Line Result - circle.floor = impact_history_entry[:body][:new_floor] || {} -** Processing line: ~ circle.floor_point = impact_history_entry[:impact][:point]~ + 4340,6760,4600,6760 +** Processing line: ~ 4080,6760,4340,6760~ - Inside source: true *** True Line Result - circle.floor_point = impact_history_entry[:impact][:point] -** Processing line: ~ if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)~ + 4080,6760,4340,6760 +** Processing line: ~ 3840,6740,4080,6760~ - Inside source: true *** True Line Result - if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2) -** Processing line: ~ new_relative_x = if circle.dx > 0~ + 3840,6740,4080,6760 +** Processing line: ~ 3680,6720,3840,6740~ - Inside source: true *** True Line Result - new_relative_x = if circle.dx > 0 -** Processing line: ~ :right~ + 3680,6720,3840,6740 +** Processing line: ~ 3680,6720,3680,6560~ - Inside source: true *** True Line Result - :right -** Processing line: ~ elsif circle.dx < 0~ + 3680,6720,3680,6560 +** Processing line: ~ 3680,6560,3720,6400~ - Inside source: true *** True Line Result - elsif circle.dx < 0 -** Processing line: ~ :left~ + 3680,6560,3720,6400 +** Processing line: ~ 3720,6400,3720,6200~ - Inside source: true *** True Line Result - :left -** Processing line: ~ else~ + 3720,6400,3720,6200 +** Processing line: ~ 3720,6200,3780,6000~ - Inside source: true *** True Line Result - else -** Processing line: ~ nil~ + 3720,6200,3780,6000 +** Processing line: ~ 3720,5780,3780,6000~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + 3720,5780,3780,6000 +** Processing line: ~ 3720,5580,3720,5780~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3720,5580,3720,5780 +** Processing line: ~ 3720,5360,3720,5580~ - Inside source: true *** True Line Result - -** Processing line: ~ new_relative_y = if circle.dy > 0~ + 3720,5360,3720,5580 +** Processing line: ~ 3720,5360,3840,5240~ - Inside source: true *** True Line Result - new_relative_y = if circle.dy > 0 -** Processing line: ~ :above~ + 3720,5360,3840,5240 +** Processing line: ~ 3840,5240,4200,5260~ - Inside source: true *** True Line Result - :above -** Processing line: ~ elsif circle.dy < 0~ + 3840,5240,4200,5260 +** Processing line: ~ 4200,5260,4600,5280~ - Inside source: true *** True Line Result - elsif circle.dy < 0 -** Processing line: ~ :below~ + 4200,5260,4600,5280 +** Processing line: ~ 4600,5280,4880,5280~ - Inside source: true *** True Line Result - :below -** Processing line: ~ else~ + 4600,5280,4880,5280 +** Processing line: ~ 4880,5280,5140,5200~ - Inside source: true *** True Line Result - else -** Processing line: ~ nil~ + 4880,5280,5140,5200 +** Processing line: ~ 5140,5200,5220,5100~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + 5140,5200,5220,5100 +** Processing line: ~ 5220,5100,5280,4900~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5220,5100,5280,4900 +** Processing line: ~ 5280,4900,5340,4840~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.floor_relative_x = new_relative_x~ + 5280,4900,5340,4840 +** Processing line: ~ 5340,4840,5720,4880~ - Inside source: true *** True Line Result - circle.floor_relative_x = new_relative_x -** Processing line: ~ circle.floor_relative_y = new_relative_y~ + 5340,4840,5720,4880 +** Processing line: ~ 6120,4880,6480,4860~ - Inside source: true *** True Line Result - circle.floor_relative_y = new_relative_y -** Processing line: ~ end~ + 6120,4880,6480,4860 +** Processing line: ~ 6880,4840,7200,4860~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6880,4840,7200,4860 +** Processing line: ~ 6480,4860,6880,4840~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.impact = nil~ + 6480,4860,6880,4840 +** Processing line: ~ 7200,4860,7320,4860~ - Inside source: true *** True Line Result - circle.impact = nil -** Processing line: ~ circle.terrains_to_monitor.clear~ + 7200,4860,7320,4860 +** Processing line: ~ 7320,4860,7360,4740~ - Inside source: true *** True Line Result - circle.terrains_to_monitor.clear -** Processing line: ~ end~ + 7320,4860,7360,4740 +** Processing line: ~ 7360,4600,7440,4520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7360,4600,7440,4520 +** Processing line: ~ 7360,4600,7360,4740~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_physics~ + 7360,4600,7360,4740 +** Processing line: ~ 7440,4520,7640,4520~ - Inside source: true *** True Line Result - def calc_physics -** Processing line: ~ if args.state.god_mode~ + 7440,4520,7640,4520 +** Processing line: ~ 7640,4520,7800,4480~ - Inside source: true *** True Line Result - if args.state.god_mode -** Processing line: ~ calc_potential_impacts~ + 7640,4520,7800,4480 +** Processing line: ~ 7800,4480,7800,4280~ - Inside source: true *** True Line Result - calc_potential_impacts -** Processing line: ~ calc_terrains_to_monitor~ + 7800,4480,7800,4280 +** Processing line: ~ 7800,4280,7800,4040~ - Inside source: true *** True Line Result - calc_terrains_to_monitor -** Processing line: ~ return~ + 7800,4280,7800,4040 +** Processing line: ~ 7800,4040,7800,3780~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 7800,4040,7800,3780 +** Processing line: ~ 7800,3560,7800,3780~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7800,3560,7800,3780 +** Processing line: ~ 7800,3560,7860,3440~ - Inside source: true *** True Line Result - -** Processing line: ~ if circle.y < -700~ + 7800,3560,7860,3440 +** Processing line: ~ 7860,3440,8060,3460~ - Inside source: true *** True Line Result - if circle.y < -700 -** Processing line: ~ game_over~ + 7860,3440,8060,3460 +** Processing line: ~ 8060,3460,8160,3340~ - Inside source: true *** True Line Result - game_over -** Processing line: ~ return~ + 8060,3460,8160,3340 +** Processing line: ~ 8160,3340,8160,3140~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 8160,3340,8160,3140 +** Processing line: ~ 8160,3140,8160,2960~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 8160,3140,8160,2960 +** Processing line: ~ 8000,2900,8160,2960~ - Inside source: true *** True Line Result - -** Processing line: ~ return if state.game_over~ + 8000,2900,8160,2960 +** Processing line: ~ 7860,2900,8000,2900~ - Inside source: true *** True Line Result - return if state.game_over -** Processing line: ~ return if circle.on_floor~ + 7860,2900,8000,2900 +** Processing line: ~ 7640,2940,7860,2900~ - Inside source: true *** True Line Result - return if circle.on_floor -** Processing line: ~ circle.previous_dy = circle.dy~ + 7640,2940,7860,2900 +** Processing line: ~ 7400,2980,7640,2940~ - Inside source: true *** True Line Result - circle.previous_dy = circle.dy -** Processing line: ~ circle.previous_dx = circle.dx~ + 7400,2980,7640,2940 +** Processing line: ~ 7100,2980,7400,2980~ - Inside source: true *** True Line Result - circle.previous_dx = circle.dx -** Processing line: ~ circle.x += circle.dx~ + 7100,2980,7400,2980 +** Processing line: ~ 6840,3000,7100,2980~ - Inside source: true *** True Line Result - circle.x += circle.dx -** Processing line: ~ circle.y += circle.dy~ + 6840,3000,7100,2980 +** Processing line: ~ 5620,2980,5840,2980~ - Inside source: true *** True Line Result - circle.y += circle.dy -** Processing line: ~ args.state.distance_traveled ||= 0~ + 5620,2980,5840,2980 +** Processing line: ~ 5840,2980,6500,3000~ - Inside source: true *** True Line Result - args.state.distance_traveled ||= 0 -** Processing line: ~ args.state.distance_traveled += circle.dx.abs + circle.dy.abs~ + 5840,2980,6500,3000 +** Processing line: ~ 6500,3000,6840,3000~ - Inside source: true *** True Line Result - args.state.distance_traveled += circle.dx.abs + circle.dy.abs -** Processing line: ~ circle.dy += state.gravity~ + 6500,3000,6840,3000 +** Processing line: ~ 5560,2780,5620,2980~ - Inside source: true *** True Line Result - circle.dy += state.gravity -** Processing line: ~ calc_potential_impacts~ + 5560,2780,5620,2980 +** Processing line: ~ 5560,2780,5560,2580~ - Inside source: true *** True Line Result - calc_potential_impacts -** Processing line: ~ calc_terrains_to_monitor~ + 5560,2780,5560,2580 +** Processing line: ~ 5560,2580,5560,2380~ - Inside source: true *** True Line Result - calc_terrains_to_monitor -** Processing line: ~ return unless circle.impact~ + 5560,2580,5560,2380 +** Processing line: ~ 5560,2140,5560,2380~ - Inside source: true *** True Line Result - return unless circle.impact -** Processing line: ~ if circle.impact && circle.impact[:type] == :lava~ + 5560,2140,5560,2380 +** Processing line: ~ 5560,2140,5560,1900~ - Inside source: true *** True Line Result - if circle.impact && circle.impact[:type] == :lava -** Processing line: ~ game_over!~ + 5560,2140,5560,1900 +** Processing line: ~ 5560,1900,5620,1660~ - Inside source: true *** True Line Result - game_over! -** Processing line: ~ else~ + 5560,1900,5620,1660 +** Processing line: ~ 5620,1660,5660,1460~ - Inside source: true *** True Line Result - else -** Processing line: ~ not_game_over!~ + 5620,1660,5660,1460 +** Processing line: ~ 5660,1460,5660,1300~ - Inside source: true *** True Line Result - not_game_over! -** Processing line: ~ end~ + 5660,1460,5660,1300 +** Processing line: ~ 5500,1260,5660,1300~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 5500,1260,5660,1300 +** Processing line: ~ 5340,1260,5500,1260~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5340,1260,5500,1260 +** Processing line: ~ 4600,1220,4840,1240~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_god_mode~ + 4600,1220,4840,1240 +** Processing line: ~ 4440,1220,4600,1220~ - Inside source: true *** True Line Result - def input_god_mode -** Processing line: ~ state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash~ + 4440,1220,4600,1220 +** Processing line: ~ 4440,1080,4440,1220~ - Inside source: true *** True Line Result - state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash -** Processing line: ~~ + 4440,1080,4440,1220 +** Processing line: ~ 4440,1080,4600,1020~ - Inside source: true *** True Line Result - -** Processing line: ~ # toggle god mode~ + 4440,1080,4600,1020 +** Processing line: ~ 5080,1260,5340,1260~ - Inside source: true *** True Line Result - # toggle god mode -** Processing line: ~ if inputs.keyboard.key_down.g~ + 5080,1260,5340,1260 +** Processing line: ~ 4840,1240,5080,1260~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.g -** Processing line: ~ state.god_mode = !state.god_mode~ + 4840,1240,5080,1260 +** Processing line: ~ 4600,1020,4940,1020~ - Inside source: true *** True Line Result - state.god_mode = !state.god_mode -** Processing line: ~ state.potential_lift = 0~ + 4600,1020,4940,1020 +** Processing line: ~ 4940,1020,5220,1020~ - Inside source: true *** True Line Result - state.potential_lift = 0 -** Processing line: ~ circle.floor = nil~ + 4940,1020,5220,1020 +** Processing line: ~ 5220,1020,5560,960~ - Inside source: true *** True Line Result - circle.floor = nil -** Processing line: ~ circle.floor_point = nil~ + 5220,1020,5560,960 +** Processing line: ~ 5560,960,5660,860~ - Inside source: true *** True Line Result - circle.floor_point = nil -** Processing line: ~ circle.floor_relative_x = nil~ + 5560,960,5660,860 +** Processing line: ~ 5660,740,5660,860~ - Inside source: true *** True Line Result - circle.floor_relative_x = nil -** Processing line: ~ circle.floor_relative_y = nil~ + 5660,740,5660,860 +** Processing line: ~ 5280,740,5660,740~ - Inside source: true *** True Line Result - circle.floor_relative_y = nil -** Processing line: ~ circle.impact = nil~ + 5280,740,5660,740 +** Processing line: ~ 4940,780,5280,740~ - Inside source: true *** True Line Result - circle.impact = nil -** Processing line: ~ circle.terrains_to_monitor.clear~ + 4940,780,5280,740 +** Processing line: ~ 4660,760,4940,780~ - Inside source: true *** True Line Result - circle.terrains_to_monitor.clear -** Processing line: ~ return~ + 4660,760,4940,780 +** Processing line: ~ 4500,700,4660,760~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 4500,700,4660,760 +** Processing line: ~ 4500,520,4500,700~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4500,520,4500,700 +** Processing line: ~ 4500,520,4700,460~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless state.god_mode~ + 4500,520,4700,460 +** Processing line: ~ 4700,460,5080,440~ - Inside source: true *** True Line Result - return unless state.god_mode -** Processing line: ~~ + 4700,460,5080,440 +** Processing line: ~ 5440,420,5740,420~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.x = circle.x.to_i~ + 5440,420,5740,420 +** Processing line: ~ 5080,440,5440,420~ - Inside source: true *** True Line Result - circle.x = circle.x.to_i -** Processing line: ~ circle.y = circle.y.to_i~ + 5080,440,5440,420 +** Processing line: ~ 5740,420,5840,360~ - Inside source: true *** True Line Result - circle.y = circle.y.to_i -** Processing line: ~~ + 5740,420,5840,360 +** Processing line: ~ 5800,280,5840,360~ - Inside source: true *** True Line Result - -** Processing line: ~ # move god circle~ + 5800,280,5840,360 +** Processing line: ~ 5560,280,5800,280~ - Inside source: true *** True Line Result - # move god circle -** Processing line: ~ if inputs.keyboard.left || inputs.keyboard.a~ + 5560,280,5800,280 +** Processing line: ~ 4980,300,5280,320~ - Inside source: true *** True Line Result - if inputs.keyboard.left || inputs.keyboard.a -** Processing line: ~ circle.x -= 20~ + 4980,300,5280,320 +** Processing line: ~ 4360,320,4660,300~ - Inside source: true *** True Line Result - circle.x -= 20 -** Processing line: ~ elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f~ + 4360,320,4660,300 +** Processing line: ~ 4200,360,4360,320~ - Inside source: true *** True Line Result - elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f -** Processing line: ~ circle.x += 20~ + 4200,360,4360,320 +** Processing line: ~ 5280,320,5560,280~ - Inside source: true *** True Line Result - circle.x += 20 -** Processing line: ~ end~ + 5280,320,5560,280 +** Processing line: ~ 4660,300,4980,300~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4660,300,4980,300 +** Processing line: ~ 4140,480,4200,360~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.keyboard.up || inputs.keyboard.w~ + 4140,480,4200,360 +** Processing line: ~ 4140,480,4140,640~ - Inside source: true *** True Line Result - if inputs.keyboard.up || inputs.keyboard.w -** Processing line: ~ circle.y += 20~ + 4140,480,4140,640 +** Processing line: ~ 4140,640,4200,780~ - Inside source: true *** True Line Result - circle.y += 20 -** Processing line: ~ elsif inputs.keyboard.down || inputs.keyboard.s~ + 4140,640,4200,780 +** Processing line: ~ 4200,780,4200,980~ - Inside source: true *** True Line Result - elsif inputs.keyboard.down || inputs.keyboard.s -** Processing line: ~ circle.y -= 20~ + 4200,780,4200,980 +** Processing line: ~ 4200,980,4220,1180~ - Inside source: true *** True Line Result - circle.y -= 20 -** Processing line: ~ end~ + 4200,980,4220,1180 +** Processing line: ~ 4220,1400,4220,1180~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4220,1400,4220,1180 +** Processing line: ~ 4220,1400,4260,1540~ - Inside source: true *** True Line Result - -** Processing line: ~ # delete terrain~ + 4220,1400,4260,1540 +** Processing line: ~ 4260,1540,4500,1540~ - Inside source: true *** True Line Result - # delete terrain -** Processing line: ~ if inputs.keyboard.key_down.x~ + 4260,1540,4500,1540 +** Processing line: ~ 4500,1540,4700,1520~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.x -** Processing line: ~ calc_terrains_to_monitor~ + 4500,1540,4700,1520 +** Processing line: ~ 4700,1520,4980,1540~ - Inside source: true *** True Line Result - calc_terrains_to_monitor -** Processing line: ~ state.terrain = state.terrain.reject do |t|~ + 4700,1520,4980,1540 +** Processing line: ~ 5280,1560,5400,1560~ - Inside source: true *** True Line Result - state.terrain = state.terrain.reject do |t| -** Processing line: ~ t[:rect].intersect_rect? circle.rect~ + 5280,1560,5400,1560 +** Processing line: ~ 4980,1540,5280,1560~ - Inside source: true *** True Line Result - t[:rect].intersect_rect? circle.rect -** Processing line: ~ end~ + 4980,1540,5280,1560 +** Processing line: ~ 5400,1560,5400,1700~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5400,1560,5400,1700 +** Processing line: ~ 5400,1780,5400,1700~ - Inside source: true *** True Line Result - -** Processing line: ~ state.lava = state.lava.reject do |t|~ + 5400,1780,5400,1700 +** Processing line: ~ 5340,1900,5400,1780~ - Inside source: true *** True Line Result - state.lava = state.lava.reject do |t| -** Processing line: ~ t[:rect].intersect_rect? circle.rect~ + 5340,1900,5400,1780 +** Processing line: ~ 5340,2020,5340,1900~ - Inside source: true *** True Line Result - t[:rect].intersect_rect? circle.rect -** Processing line: ~ end~ + 5340,2020,5340,1900 +** Processing line: ~ 5340,2220,5340,2020~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5340,2220,5340,2020 +** Processing line: ~ 5340,2220,5340,2420~ - Inside source: true *** True Line Result - -** Processing line: ~ calc_potential_impacts~ + 5340,2220,5340,2420 +** Processing line: ~ 5340,2420,5340,2520~ - Inside source: true *** True Line Result - calc_potential_impacts -** Processing line: ~ save_level~ + 5340,2420,5340,2520 +** Processing line: ~ 5080,2600,5220,2580~ - Inside source: true *** True Line Result - save_level -** Processing line: ~ end~ + 5080,2600,5220,2580 +** Processing line: ~ 5220,2580,5340,2520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 5220,2580,5340,2520 +** Processing line: ~ 4900,2580,5080,2600~ - Inside source: true *** True Line Result - -** Processing line: ~ # change terrain type~ + 4900,2580,5080,2600 +** Processing line: ~ 4700,2540,4900,2580~ - Inside source: true *** True Line Result - # change terrain type -** Processing line: ~ if inputs.keyboard.key_down.l~ + 4700,2540,4900,2580 +** Processing line: ~ 4500,2540,4700,2540~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.l -** Processing line: ~ if state.line_mode == :terrain~ + 4500,2540,4700,2540 +** Processing line: ~ 4220,2580,4340,2540~ - Inside source: true *** True Line Result - if state.line_mode == :terrain -** Processing line: ~ state.line_mode = :lava~ + 4220,2580,4340,2540 +** Processing line: ~ 4200,2700,4220,2580~ - Inside source: true *** True Line Result - state.line_mode = :lava -** Processing line: ~ else~ + 4200,2700,4220,2580 +** Processing line: ~ 4340,2540,4500,2540~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.line_mode = :terrain~ + 4340,2540,4500,2540 +** Processing line: ~ 3980,2740,4200,2700~ - Inside source: true *** True Line Result - state.line_mode = :terrain -** Processing line: ~ end~ + 3980,2740,4200,2700 +** Processing line: ~ 3840,2740,3980,2740~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 3840,2740,3980,2740 +** Processing line: ~ 3780,2640,3840,2740~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3780,2640,3840,2740 +** Processing line: ~ 3780,2640,3780,2460~ - Inside source: true *** True Line Result - -** Processing line: ~ if inputs.mouse.click && !state.point_one~ + 3780,2640,3780,2460 +** Processing line: ~ 3780,2280,3780,2460~ - Inside source: true *** True Line Result - if inputs.mouse.click && !state.point_one -** Processing line: ~ state.point_one = inputs.mouse.click.point~ + 3780,2280,3780,2460 +** Processing line: ~ 3620,2020,3780,2100~ - Inside source: true *** True Line Result - state.point_one = inputs.mouse.click.point -** Processing line: ~ elsif inputs.mouse.click && state.point_one~ + 3620,2020,3780,2100 +** Processing line: ~ 3780,2280,3780,2100~ - Inside source: true *** True Line Result - elsif inputs.mouse.click && state.point_one -** Processing line: ~ l = [*state.point_one, *inputs.mouse.click.point]~ + 3780,2280,3780,2100 +** Processing line: ~ 3360,2040,3620,2020~ - Inside source: true *** True Line Result - l = [*state.point_one, *inputs.mouse.click.point] -** Processing line: ~ l = [l.x - state.camera.x,~ + 3360,2040,3620,2020 +** Processing line: ~ 3080,2040,3360,2040~ - Inside source: true *** True Line Result - l = [l.x - state.camera.x, -** Processing line: ~ l.y - state.camera.y,~ + 3080,2040,3360,2040 +** Processing line: ~ 2840,2020,3080,2040~ - Inside source: true *** True Line Result - l.y - state.camera.y, -** Processing line: ~ l.x2 - state.camera.x,~ + 2840,2020,3080,2040 +** Processing line: ~ 2740,1940,2840,2020~ - Inside source: true *** True Line Result - l.x2 - state.camera.x, -** Processing line: ~ l.y2 - state.camera.y].line.to_hash~ + 2740,1940,2840,2020 +** Processing line: ~ 2740,1940,2800,1800~ - Inside source: true *** True Line Result - l.y2 - state.camera.y].line.to_hash -** Processing line: ~ l[:rect] = rect_for_line l~ + 2740,1940,2800,1800 +** Processing line: ~ 2800,1640,2800,1800~ - Inside source: true *** True Line Result - l[:rect] = rect_for_line l -** Processing line: ~ if state.line_mode == :terrain~ + 2800,1640,2800,1800 +** Processing line: ~ 2800,1640,2800,1460~ - Inside source: true *** True Line Result - if state.line_mode == :terrain -** Processing line: ~ state.terrain << l~ + 2800,1640,2800,1460 +** Processing line: ~ 2800,1300,2800,1460~ - Inside source: true *** True Line Result - state.terrain << l -** Processing line: ~ else~ + 2800,1300,2800,1460 +** Processing line: ~ 2700,1180,2800,1300~ - Inside source: true *** True Line Result - else -** Processing line: ~ state.lava << l~ + 2700,1180,2800,1300 +** Processing line: ~ 2480,1140,2700,1180~ - Inside source: true *** True Line Result - state.lava << l -** Processing line: ~ end~ + 2480,1140,2700,1180 +** Processing line: ~ 1580,1200,1720,1200~ - Inside source: true *** True Line Result - end -** Processing line: ~ save_level~ + 1580,1200,1720,1200 +** Processing line: ~ 2240,1180,2480,1140~ - Inside source: true *** True Line Result - save_level -** Processing line: ~ next_x = inputs.mouse.click.point.x - 640~ + 2240,1180,2480,1140 +** Processing line: ~ 1960,1180,2240,1180~ - Inside source: true *** True Line Result - next_x = inputs.mouse.click.point.x - 640 -** Processing line: ~ next_y = inputs.mouse.click.point.y - 360~ + 1960,1180,2240,1180 +** Processing line: ~ 1720,1200,1960,1180~ - Inside source: true *** True Line Result - next_y = inputs.mouse.click.point.y - 360 -** Processing line: ~ circle.x += next_x~ + 1720,1200,1960,1180 +** Processing line: ~ 1500,1320,1580,1200~ - Inside source: true *** True Line Result - circle.x += next_x -** Processing line: ~ circle.y += next_y~ + 1500,1320,1580,1200 +** Processing line: ~ 1500,1440,1500,1320~ - Inside source: true *** True Line Result - circle.y += next_y -** Processing line: ~ state.point_one = nil~ + 1500,1440,1500,1320 +** Processing line: ~ 1500,1440,1760,1480~ - Inside source: true *** True Line Result - state.point_one = nil -** Processing line: ~ elsif inputs.keyboard.one~ + 1500,1440,1760,1480 +** Processing line: ~ 1760,1480,1940,1480~ - Inside source: true *** True Line Result - elsif inputs.keyboard.one -** Processing line: ~ state.point_one = [circle.x + camera.x, circle.y+ camera.y]~ + 1760,1480,1940,1480 +** Processing line: ~ 1940,1480,2140,1500~ - Inside source: true *** True Line Result - state.point_one = [circle.x + camera.x, circle.y+ camera.y] -** Processing line: ~ end~ + 1940,1480,2140,1500 +** Processing line: ~ 2140,1500,2320,1520~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2140,1500,2320,1520 +** Processing line: ~ 2400,1560,2400,1700~ - Inside source: true *** True Line Result - -** Processing line: ~ # cancel chain lines~ + 2400,1560,2400,1700 +** Processing line: ~ 2280,1820,2380,1780~ - Inside source: true *** True Line Result - # cancel chain lines -** Processing line: ~ if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one~ + 2280,1820,2380,1780 +** Processing line: ~ 2320,1520,2400,1560~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one -** Processing line: ~ state.point_one = nil~ + 2320,1520,2400,1560 +** Processing line: ~ 2380,1780,2400,1700~ - Inside source: true *** True Line Result - state.point_one = nil -** Processing line: ~ end~ + 2380,1780,2400,1700 +** Processing line: ~ 2080,1840,2280,1820~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 2080,1840,2280,1820 +** Processing line: ~ 1720,1820,2080,1840~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1720,1820,2080,1840 +** Processing line: ~ 1420,1800,1720,1820~ - Inside source: true *** True Line Result - -** Processing line: ~ def play_sound~ + 1420,1800,1720,1820 +** Processing line: ~ 1280,1800,1420,1800~ - Inside source: true *** True Line Result - def play_sound -** Processing line: ~ return if state.sound_debounce > 0~ + 1280,1800,1420,1800 +** Processing line: ~ 1240,1720,1280,1800~ - Inside source: true *** True Line Result - return if state.sound_debounce > 0 -** Processing line: ~ state.sound_debounce = 5~ + 1240,1720,1280,1800 +** Processing line: ~ 1240,1720,1240,1600~ - Inside source: true *** True Line Result - state.sound_debounce = 5 -** Processing line: ~ outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"~ + 1240,1720,1240,1600 +** Processing line: ~ 1240,1600,1280,1480~ - Inside source: true *** True Line Result - outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav" -** Processing line: ~ state.sound_index += 1~ + 1240,1600,1280,1480 +** Processing line: ~ 1280,1340,1280,1480~ - Inside source: true *** True Line Result - state.sound_index += 1 -** Processing line: ~ if state.sound_index > 21~ + 1280,1340,1280,1480 +** Processing line: ~ 1180,1280,1280,1340~ - Inside source: true *** True Line Result - if state.sound_index > 21 -** Processing line: ~ state.sound_index = 1~ + 1180,1280,1280,1340 +** Processing line: ~ 1000,1280,1180,1280~ - Inside source: true *** True Line Result - state.sound_index = 1 -** Processing line: ~ end~ + 1000,1280,1180,1280 +** Processing line: ~ 760,1280,1000,1280~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 760,1280,1000,1280 +** Processing line: ~ 360,1240,540,1260~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 360,1240,540,1260 +** Processing line: ~ 180,1220,360,1240~ - Inside source: true *** True Line Result - -** Processing line: ~ def input_game~ + 180,1220,360,1240 +** Processing line: ~ 540,1260,760,1280~ - Inside source: true *** True Line Result - def input_game -** Processing line: ~ if inputs.keyboard.down || inputs.keyboard.space~ + 540,1260,760,1280 +** Processing line: ~ 180,1080,180,1220~ - Inside source: true *** True Line Result - if inputs.keyboard.down || inputs.keyboard.space -** Processing line: ~ circle.potential_lift += 0.03~ + 180,1080,180,1220 +** Processing line: ~ 180,1080,180,1000~ - Inside source: true *** True Line Result - circle.potential_lift += 0.03 -** Processing line: ~ circle.potential_lift = circle.potential_lift.lesser(10)~ + 180,1080,180,1000 +** Processing line: ~ 180,1000,360,940~ - Inside source: true *** True Line Result - circle.potential_lift = circle.potential_lift.lesser(10) -** Processing line: ~ elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space~ + 180,1000,360,940 +** Processing line: ~ 360,940,540,960~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space -** Processing line: ~ play_sound~ + 360,940,540,960 +** Processing line: ~ 540,960,820,980~ - Inside source: true *** True Line Result - play_sound -** Processing line: ~ circle.dy += circle.angle.vector_y circle.potential_lift~ + 540,960,820,980 +** Processing line: ~ 1100,980,1200,920~ - Inside source: true *** True Line Result - circle.dy += circle.angle.vector_y circle.potential_lift -** Processing line: ~ circle.dx += circle.angle.vector_x circle.potential_lift~ + 1100,980,1200,920 +** Processing line: ~ 820,980,1100,980~ - Inside source: true *** True Line Result - circle.dx += circle.angle.vector_x circle.potential_lift -** Processing line: ~~ + 820,980,1100,980 +** Processing line: ~ 6640,11860,6940,11920~ - Inside source: true *** True Line Result - -** Processing line: ~ if circle.on_floor~ + 6640,11860,6940,11920 +** Processing line: ~ 5200,11280,5500,11280~ - Inside source: true *** True Line Result - if circle.on_floor -** Processing line: ~ if circle.floor_relative_y == :above~ + 5200,11280,5500,11280 +** Processing line: ~ 4120,7330,4120,7230~ - Inside source: true *** True Line Result - if circle.floor_relative_y == :above -** Processing line: ~ circle.y += circle.potential_lift.abs * 2~ + 4120,7330,4120,7230 +** Processing line: ~ 4120,7230,4660,7250~ - Inside source: true *** True Line Result - circle.y += circle.potential_lift.abs * 2 -** Processing line: ~ elsif circle.floor_relative_y == :below~ + 4120,7230,4660,7250 +** Processing line: ~ 4660,7250,4940,7250~ - Inside source: true *** True Line Result - elsif circle.floor_relative_y == :below -** Processing line: ~ circle.y -= circle.potential_lift.abs * 2~ + 4660,7250,4940,7250 +** Processing line: ~ 4940,7250,5050,7340~ - Inside source: true *** True Line Result - circle.y -= circle.potential_lift.abs * 2 -** Processing line: ~ end~ + 4940,7250,5050,7340 +** Processing line: ~ 5010,7400,5050,7340~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 5010,7400,5050,7340 +** Processing line: ~ 4680,7380,5010,7400~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4680,7380,5010,7400 +** Processing line: ~ 4380,7370,4680,7380~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.on_floor = false~ + 4380,7370,4680,7380 +** Processing line: ~ 4120,7330,4360,7370~ - Inside source: true *** True Line Result - circle.on_floor = false -** Processing line: ~ circle.potential_lift = 0~ + 4120,7330,4360,7370 +** Processing line: ~ 4120,7670,4120,7760~ - Inside source: true *** True Line Result - circle.potential_lift = 0 -** Processing line: ~ circle.terrains_to_monitor.clear~ + 4120,7670,4120,7760 +** Processing line: ~ 4120,7670,4280,7650~ - Inside source: true *** True Line Result - circle.terrains_to_monitor.clear -** Processing line: ~ circle.impact_history.clear~ + 4120,7670,4280,7650 +** Processing line: ~ 4280,7650,4540,7660~ - Inside source: true *** True Line Result - circle.impact_history.clear -** Processing line: ~ circle.impact = nil~ + 4280,7650,4540,7660 +** Processing line: ~ 4550,7660,4820,7680~ - Inside source: true *** True Line Result - circle.impact = nil -** Processing line: ~ calc_physics~ + 4550,7660,4820,7680 +** Processing line: ~ 4820,7680,4900,7730~ - Inside source: true *** True Line Result - calc_physics -** Processing line: ~ end~ + 4820,7680,4900,7730 +** Processing line: ~ 4880,7800,4900,7730~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4880,7800,4900,7730 +** Processing line: ~ 4620,7820,4880,7800~ - Inside source: true *** True Line Result - -** Processing line: ~ # aim probe~ + 4620,7820,4880,7800 +** Processing line: ~ 4360,7790,4620,7820~ - Inside source: true *** True Line Result - # aim probe -** Processing line: ~ if inputs.keyboard.right || inputs.keyboard.a~ + 4360,7790,4620,7820 +** Processing line: ~ 4120,7760,4360,7790~ - Inside source: true *** True Line Result - if inputs.keyboard.right || inputs.keyboard.a -** Processing line: ~ circle.angle -= 2~ + 4120,7760,4360,7790 +** Processing line: ~ 6840,6840,7040,6820~ - Inside source: true *** True Line Result - circle.angle -= 2 -** Processing line: ~ elsif inputs.keyboard.left || inputs.keyboard.d~ + 6840,6840,7040,6820 +** Processing line: ~ 5720,4880,6120,4880~ - Inside source: true *** True Line Result - elsif inputs.keyboard.left || inputs.keyboard.d -** Processing line: ~ circle.angle += 2~ + 5720,4880,6120,4880 +** Processing line: ~ 1200,920,1340,810~ - Inside source: true *** True Line Result - circle.angle += 2 -** Processing line: ~ end~ + 1200,920,1340,810 +** Processing line: ~ 1340,810,1520,790~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 1340,810,1520,790 +** Processing line: ~ 1520,790,1770,800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1520,790,1770,800 +** Processing line: ~ 2400,790,2600,750~ - Inside source: true *** True Line Result - -** Processing line: ~ def input~ + 2400,790,2600,750 +** Processing line: ~ 2600,750,2640,520~ - Inside source: true *** True Line Result - def input -** Processing line: ~ input_god_mode~ + 2600,750,2640,520 +** Processing line: ~ 2520,470,2640,520~ - Inside source: true *** True Line Result - input_god_mode -** Processing line: ~ input_game~ + 2520,470,2640,520 +** Processing line: ~ 2140,470,2520,470~ - Inside source: true *** True Line Result - input_game -** Processing line: ~ end~ + 2140,470,2520,470 +** Processing line: ~ 1760,800,2090,800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1760,800,2090,800 +** Processing line: ~ 2080,800,2400,790~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_camera~ + 2080,800,2400,790 +** Processing line: ~ 1760,450,2140,470~ - Inside source: true *** True Line Result - def calc_camera -** Processing line: ~ state.camera.target_x = 640 - circle.x~ + 1760,450,2140,470 +** Processing line: ~ 1420,450,1760,450~ - Inside source: true *** True Line Result - state.camera.target_x = 640 - circle.x -** Processing line: ~ state.camera.target_y = 360 - circle.y~ + 1420,450,1760,450 +** Processing line: ~ 1180,440,1420,450~ - Inside source: true *** True Line Result - state.camera.target_y = 360 - circle.y -** Processing line: ~ xdiff = state.camera.target_x - state.camera.x~ + 1180,440,1420,450 +** Processing line: ~ 900,480,1180,440~ - Inside source: true *** True Line Result - xdiff = state.camera.target_x - state.camera.x -** Processing line: ~ ydiff = state.camera.target_y - state.camera.y~ + 900,480,1180,440 +** Processing line: ~ 640,450,900,480~ - Inside source: true *** True Line Result - ydiff = state.camera.target_y - state.camera.y -** Processing line: ~ state.camera.x += xdiff * camera.follow_speed~ + 640,450,900,480 +** Processing line: ~ 360,440,620,450~ - Inside source: true *** True Line Result - state.camera.x += xdiff * camera.follow_speed -** Processing line: ~ state.camera.y += ydiff * camera.follow_speed~ + 360,440,620,450 +** Processing line: ~ 120,430,360,440~ - Inside source: true *** True Line Result - state.camera.y += ydiff * camera.follow_speed -** Processing line: ~ end~ + 120,430,360,440 +** Processing line: ~ 0,520,120,430~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 0,520,120,430 +** Processing line: ~ -20,780,0,520~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc~ + -20,780,0,520 +** Processing line: ~ -20,780,-20,1020~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ state.sound_debounce ||= 0~ + -20,780,-20,1020 +** Processing line: ~ -20,1020,-20,1150~ - Inside source: true *** True Line Result - state.sound_debounce ||= 0 -** Processing line: ~ state.sound_debounce -= 1~ + -20,1020,-20,1150 +** Processing line: ~ -20,1150,0,1300~ - Inside source: true *** True Line Result - state.sound_debounce -= 1 -** Processing line: ~ state.sound_debounce = 0 if state.sound_debounce < 0~ + -20,1150,0,1300 +** Processing line: ~ 0,1470,60,1530~ - Inside source: true *** True Line Result - state.sound_debounce = 0 if state.sound_debounce < 0 -** Processing line: ~ if state.god_mode~ + 0,1470,60,1530 +** Processing line: ~ 0,1300,0,1470~ - Inside source: true *** True Line Result - if state.god_mode -** Processing line: ~ circle.dy *= 0.1~ + 0,1300,0,1470 +** Processing line: ~ 60,1530,360,1530~ - Inside source: true *** True Line Result - circle.dy *= 0.1 -** Processing line: ~ circle.dx *= 0.1~ + 60,1530,360,1530 +** Processing line: ~ 360,1530,660,1520~ - Inside source: true *** True Line Result - circle.dx *= 0.1 -** Processing line: ~ end~ + 360,1530,660,1520 +** Processing line: ~ 660,1520,980,1520~ - Inside source: true *** True Line Result - end -** Processing line: ~ calc_camera~ + 660,1520,980,1520 +** Processing line: ~ 980,1520,1040,1520~ - Inside source: true *** True Line Result - calc_camera -** Processing line: ~ state.whisp_queue ||= []~ + 980,1520,1040,1520 +** Processing line: ~ 1040,1520,1070,1560~ - Inside source: true *** True Line Result - state.whisp_queue ||= [] -** Processing line: ~ if state.tick_count.mod_zero?(4)~ + 1040,1520,1070,1560 +** Processing line: ~ 1070,1770,1070,1560~ - Inside source: true *** True Line Result - if state.tick_count.mod_zero?(4) -** Processing line: ~ state.whisp_queue << {~ + 1070,1770,1070,1560 +** Processing line: ~ 1070,1770,1100,2010~ - Inside source: true *** True Line Result - state.whisp_queue << { -** Processing line: ~ x: -300,~ + 1070,1770,1100,2010 +** Processing line: ~ 1070,2230,1100,2010~ - Inside source: true *** True Line Result - x: -300, -** Processing line: ~ y: 1400 * rand,~ + 1070,2230,1100,2010 +** Processing line: ~ 1070,2240,1180,2340~ - Inside source: true *** True Line Result - y: 1400 * rand, -** Processing line: ~ speed: 2.randomize(:ratio) + 3,~ + 1070,2240,1180,2340 +** Processing line: ~ 1180,2340,1580,2340~ - Inside source: true *** True Line Result - speed: 2.randomize(:ratio) + 3, -** Processing line: ~ w: 20,~ + 1180,2340,1580,2340 +** Processing line: ~ 1580,2340,1940,2350~ - Inside source: true *** True Line Result - w: 20, -** Processing line: ~ h: 20, path: 'sprites/whisp.png',~ + 1580,2340,1940,2350 +** Processing line: ~ 1940,2350,2440,2350~ - Inside source: true *** True Line Result - h: 20, path: 'sprites/whisp.png', -** Processing line: ~ a: 0,~ + 1940,2350,2440,2350 +** Processing line: ~ 2440,2350,2560,2380~ - Inside source: true *** True Line Result - a: 0, -** Processing line: ~ created_at: state.tick_count,~ + 2440,2350,2560,2380 +** Processing line: ~ 2560,2380,2600,2540~ - Inside source: true *** True Line Result - created_at: state.tick_count, -** Processing line: ~ angle: 0,~ + 2560,2380,2600,2540 +** Processing line: ~ 2810,2640,3140,2680~ - Inside source: true *** True Line Result - angle: 0, -** Processing line: ~ r: 100,~ + 2810,2640,3140,2680 +** Processing line: ~ 2600,2540,2810,2640~ - Inside source: true *** True Line Result - r: 100, -** Processing line: ~ g: 128 + 128 * rand,~ + 2600,2540,2810,2640 +** Processing line: ~ 3140,2680,3230,2780~ - Inside source: true *** True Line Result - g: 128 + 128 * rand, -** Processing line: ~ b: 128 + 128 * rand~ + 3140,2680,3230,2780 +** Processing line: ~ 3230,2780,3260,2970~ - Inside source: true *** True Line Result - b: 128 + 128 * rand -** Processing line: ~ }~ + 3230,2780,3260,2970 +** Processing line: ~ 3230,3220,3260,2970~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + 3230,3220,3260,2970 +** Processing line: ~ 3200,3470,3230,3220~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3200,3470,3230,3220 +** Processing line: ~ 3200,3480,3210,3760~ - Inside source: true *** True Line Result - -** Processing line: ~ state.whisp_queue.each do |w|~ + 3200,3480,3210,3760 +** Processing line: ~ 3210,3760,3210,4040~ - Inside source: true *** True Line Result - state.whisp_queue.each do |w| -** Processing line: ~ w.x += w[:speed] * 2~ + 3210,3760,3210,4040 +** Processing line: ~ 3200,4040,3230,4310~ - Inside source: true *** True Line Result - w.x += w[:speed] * 2 -** Processing line: ~ w.x -= circle.dx * 0.3~ + 3200,4040,3230,4310 +** Processing line: ~ 3210,4530,3230,4310~ - Inside source: true *** True Line Result - w.x -= circle.dx * 0.3 -** Processing line: ~ w.y -= w[:speed]~ + 3210,4530,3230,4310 +** Processing line: ~ 3210,4530,3230,4730~ - Inside source: true *** True Line Result - w.y -= w[:speed] -** Processing line: ~ w.y -= circle.dy * 0.3~ + 3210,4530,3230,4730 +** Processing line: ~ 3230,4960,3230,4730~ - Inside source: true *** True Line Result - w.y -= circle.dy * 0.3 -** Processing line: ~ w.angle += w[:speed]~ + 3230,4960,3230,4730 +** Processing line: ~ 3230,4960,3260,5190~ - Inside source: true *** True Line Result - w.angle += w[:speed] -** Processing line: ~ w.a = w[:created_at].ease(30) * 255~ + 3230,4960,3260,5190 +** Processing line: ~ 3170,5330,3260,5190~ - Inside source: true *** True Line Result - w.a = w[:created_at].ease(30) * 255 -** Processing line: ~ end~ + 3170,5330,3260,5190 +** Processing line: ~ 2920,5330,3170,5330~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2920,5330,3170,5330 +** Processing line: ~ 2660,5360,2920,5330~ - Inside source: true *** True Line Result - -** Processing line: ~ state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }~ + 2660,5360,2920,5330 +** Processing line: ~ 2420,5330,2660,5360~ - Inside source: true *** True Line Result - state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 } -** Processing line: ~~ + 2420,5330,2660,5360 +** Processing line: ~ 2200,5280,2400,5330~ - Inside source: true *** True Line Result - -** Processing line: ~ if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)~ + 2200,5280,2400,5330 +** Processing line: ~ 2020,5280,2200,5280~ - Inside source: true *** True Line Result - if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0) -** Processing line: ~ circle.after_images << {~ + 2020,5280,2200,5280 +** Processing line: ~ 1840,5260,2020,5280~ - Inside source: true *** True Line Result - circle.after_images << { -** Processing line: ~ x: circle.x,~ + 1840,5260,2020,5280 +** Processing line: ~ 1660,5280,1840,5260~ - Inside source: true *** True Line Result - x: circle.x, -** Processing line: ~ y: circle.y,~ + 1660,5280,1840,5260 +** Processing line: ~ 1500,5300,1660,5280~ - Inside source: true *** True Line Result - y: circle.y, -** Processing line: ~ w: circle.radius,~ + 1500,5300,1660,5280 +** Processing line: ~ 1360,5270,1500,5300~ - Inside source: true *** True Line Result - w: circle.radius, -** Processing line: ~ h: circle.radius,~ + 1360,5270,1500,5300 +** Processing line: ~ 1200,5290,1340,5270~ - Inside source: true *** True Line Result - h: circle.radius, -** Processing line: ~ a: 255,~ + 1200,5290,1340,5270 +** Processing line: ~ 1070,5400,1200,5290~ - Inside source: true *** True Line Result - a: 255, -** Processing line: ~ created_at: state.tick_count~ + 1070,5400,1200,5290 +** Processing line: ~ 1040,5630,1070,5400~ - Inside source: true *** True Line Result - created_at: state.tick_count -** Processing line: ~ }~ + 1040,5630,1070,5400 +** Processing line: ~ 1000,5900,1040,5630~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + 1000,5900,1040,5630 +** Processing line: ~ 980,6170,1000,5900~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 980,6170,1000,5900 +** Processing line: ~ 980,6280,980,6170~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.after_images.each do |ai|~ + 980,6280,980,6170 +** Processing line: ~ 980,6540,980,6280~ - Inside source: true *** True Line Result - circle.after_images.each do |ai| -** Processing line: ~ ai.a = ai[:created_at].ease(10, :flip) * 255~ + 980,6540,980,6280 +** Processing line: ~ 980,6540,1040,6720~ - Inside source: true *** True Line Result - ai.a = ai[:created_at].ease(10, :flip) * 255 -** Processing line: ~ end~ + 980,6540,1040,6720 +** Processing line: ~ 1040,6720,1360,6730~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1040,6720,1360,6730 +** Processing line: ~ 1360,6730,1760,6710~ - Inside source: true *** True Line Result - -** Processing line: ~ circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }~ + 1360,6730,1760,6710 +** Processing line: ~ 2110,6720,2420,6730~ - Inside source: true *** True Line Result - circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 } -** Processing line: ~ calc_physics~ + 2110,6720,2420,6730 +** Processing line: ~ 1760,6710,2110,6720~ - Inside source: true *** True Line Result - calc_physics -** Processing line: ~ end~ + 1760,6710,2110,6720 +** Processing line: ~ 2420,6730,2640,6720~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2420,6730,2640,6720 +** Processing line: ~ 2640,6720,2970,6720~ - Inside source: true *** True Line Result - -** Processing line: ~ def circle~ + 2640,6720,2970,6720 +** Processing line: ~ 2970,6720,3160,6700~ - Inside source: true *** True Line Result - def circle -** Processing line: ~ state.circle~ + 2970,6720,3160,6700 +** Processing line: ~ 3160,6700,3240,6710~ - Inside source: true *** True Line Result - state.circle -** Processing line: ~ end~ + 3160,6700,3240,6710 +** Processing line: ~ 3240,6710,3260,6890~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3240,6710,3260,6890 +** Processing line: ~ 3260,7020,3260,6890~ - Inside source: true *** True Line Result - -** Processing line: ~ def camera~ + 3260,7020,3260,6890 +** Processing line: ~ 3230,7180,3260,7020~ - Inside source: true *** True Line Result - def camera -** Processing line: ~ state.camera~ + 3230,7180,3260,7020 +** Processing line: ~ 3230,7350,3230,7180~ - Inside source: true *** True Line Result - state.camera -** Processing line: ~ end~ + 3230,7350,3230,7180 +** Processing line: ~ 3210,7510,3230,7350~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3210,7510,3230,7350 +** Processing line: ~ 3210,7510,3210,7690~ - Inside source: true *** True Line Result - -** Processing line: ~ def terrain~ + 3210,7510,3210,7690 +** Processing line: ~ 3210,7870,3210,7690~ - Inside source: true *** True Line Result - def terrain -** Processing line: ~ state.terrain~ + 3210,7870,3210,7690 +** Processing line: ~ 3210,7870,3210,7980~ - Inside source: true *** True Line Result - state.terrain -** Processing line: ~ end~ + 3210,7870,3210,7980 +** Processing line: ~ 3200,8120,3210,7980~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3200,8120,3210,7980 +** Processing line: ~ 3200,8330,3200,8120~ - Inside source: true *** True Line Result - -** Processing line: ~ def lava~ + 3200,8330,3200,8120 +** Processing line: ~ 3160,8520,3200,8330~ - Inside source: true *** True Line Result - def lava -** Processing line: ~ state.lava~ + 3160,8520,3200,8330 +** Processing line: ~ 2460,11100,2480,11020~ - Inside source: true *** True Line Result - state.lava -** Processing line: ~ end~ + 2460,11100,2480,11020 +** Processing line: ~ 2200,11180,2460,11100~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 2200,11180,2460,11100 +** Processing line: ~ 1260,11350,1600,11320~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 1260,11350,1600,11320 +** Processing line: ~ 600,11430,930,11400~ - Inside source: true *** True Line Result - -** Processing line: ~ # $gtk.reset~ + 600,11430,930,11400 +** Processing line: ~ 180,11340,620,11430~ - Inside source: true *** True Line Result - # $gtk.reset -** Processing line: ~~ + 180,11340,620,11430 +** Processing line: ~ 1600,11320,1910,11280~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + 1600,11320,1910,11280 +** Processing line: ~ 1910,11280,2200,11180~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ + 1910,11280,2200,11180 +** Processing line: ~ 923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157~ - Inside source: true *** True Line Result - args.outputs.background_color = [0, 0, 0] -** Processing line: ~ if args.inputs.keyboard.r~ + 923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157 +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Platformer - The Little Probe - Data - level_lava.txt~ +- Header detected. +*** True Line Result + +*** True Line Result +* Platformer - The Little Probe - Data - level_lava.txt +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt~ - Inside source: true *** True Line Result - if args.inputs.keyboard.r -** Processing line: ~ args.gtk.reset~ + # ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt +** Processing line: ~ 100,10740,500,10780~ - Inside source: true *** True Line Result - args.gtk.reset -** Processing line: ~ return~ + 100,10740,500,10780 +** Processing line: ~ 500,10780,960,10760~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + 500,10780,960,10760 +** Processing line: ~ 960,10760,1340,10760~ - Inside source: true *** True Line Result - end -** Processing line: ~ # uncomment the line below to slow down the game so you~ + 960,10760,1340,10760 +** Processing line: ~ 1380,10760,1820,10780~ - Inside source: true *** True Line Result - # uncomment the line below to slow down the game so you -** Processing line: ~ # can see each tick as it passes~ + 1380,10760,1820,10780 +** Processing line: ~ 1820,10780,2240,10780~ - Inside source: true *** True Line Result - # can see each tick as it passes -** Processing line: ~ # args.gtk.slowmo! 30~ + 1820,10780,2240,10780 +** Processing line: ~ 2280,10780,2740,10740~ - Inside source: true *** True Line Result - # args.gtk.slowmo! 30 -** Processing line: ~ $game ||= FallingCircle.new~ + 2280,10780,2740,10740 +** Processing line: ~ 2740,10740,3000,10780~ - Inside source: true *** True Line Result - $game ||= FallingCircle.new -** Processing line: ~ $game.args = args~ + 2740,10740,3000,10780 +** Processing line: ~ 3000,10780,3140,11020~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + 3000,10780,3140,11020 +** Processing line: ~ -520,8820,-480,9160~ - Inside source: true *** True Line Result - $game.tick -** Processing line: ~ end~ + -520,8820,-480,9160 +** Processing line: ~ -520,8480,-520,8820~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -520,8480,-520,8820 +** Processing line: ~ -520,8480,-480,8180~ - Inside source: true *** True Line Result - -** Processing line: ~ def reset~ + -520,8480,-480,8180 +** Processing line: ~ -480,8180,-200,8120~ - Inside source: true *** True Line Result - def reset -** Processing line: ~ $game = nil~ + -480,8180,-200,8120 +** Processing line: ~ -200,8120,100,8220~ - Inside source: true *** True Line Result - $game = nil -** Processing line: ~ end~ + -200,8120,100,8220 +** Processing line: ~ 100,8220,420,8240~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 100,8220,420,8240 +** Processing line: ~ 420,8240,760,8260~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 420,8240,760,8260 +** Processing line: ~ 760,8260,1140,8280~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 760,8260,1140,8280 +** Processing line: ~ 1140,8280,1500,8200~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/constants.rb~ -- Header detected. + 1140,8280,1500,8200 +** Processing line: ~ 1500,8200,1880,8240~ +- Inside source: true *** True Line Result - + 1500,8200,1880,8240 +** Processing line: ~ 1880,8240,2240,8260~ +- Inside source: true *** True Line Result -* 99_genre_roguelike/roguelike_line_of_sight/app/constants.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 1880,8240,2240,8260 +** Processing line: ~ 2240,8260,2320,8480~ +- Inside source: true *** True Line Result - + 2240,8260,2320,8480 +** Processing line: ~ 2320,8480,2380,8680~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ SHOW_LEGEND = true~ + 2320,8480,2380,8680 +** Processing line: ~ 2240,8860,2380,8680~ - Inside source: true *** True Line Result - SHOW_LEGEND = true -** Processing line: ~ SOURCE_TILE_SIZE = 16~ + 2240,8860,2380,8680 +** Processing line: ~ 2240,9080,2240,8860~ - Inside source: true *** True Line Result - SOURCE_TILE_SIZE = 16 -** Processing line: ~ DESTINATION_TILE_SIZE = 16~ + 2240,9080,2240,8860 +** Processing line: ~ 2240,9080,2320,9260~ - Inside source: true *** True Line Result - DESTINATION_TILE_SIZE = 16 -** Processing line: ~ TILE_SHEET_SIZE = 256~ + 2240,9080,2320,9260 +** Processing line: ~ 2320,9260,2480,9440~ - Inside source: true *** True Line Result - TILE_SHEET_SIZE = 256 -** Processing line: ~ TILE_R = 0~ + 2320,9260,2480,9440 +** Processing line: ~ 2480,9440,2600,9640~ - Inside source: true *** True Line Result - TILE_R = 0 -** Processing line: ~ TILE_G = 0~ + 2480,9440,2600,9640 +** Processing line: ~ 2480,9840,2600,9640~ - Inside source: true *** True Line Result - TILE_G = 0 -** Processing line: ~ TILE_B = 0~ + 2480,9840,2600,9640 +** Processing line: ~ 2400,10020,2480,9840~ - Inside source: true *** True Line Result - TILE_B = 0 -** Processing line: ~ TILE_A = 255~ + 2400,10020,2480,9840 +** Processing line: ~ 2240,10080,2400,10020~ - Inside source: true *** True Line Result - TILE_A = 255 -** Processing line: ~~ + 2240,10080,2400,10020 +** Processing line: ~ 1960,10080,2240,10080~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + 1960,10080,2240,10080 +** Processing line: ~ 1720,10080,1960,10080~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 1720,10080,1960,10080 +** Processing line: ~ 1460,10080,1720,10080~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/legend.rb~ -- Header detected. + 1460,10080,1720,10080 +** Processing line: ~ 1180,10080,1420,10080~ +- Inside source: true *** True Line Result - + 1180,10080,1420,10080 +** Processing line: ~ 900,10080,1180,10080~ +- Inside source: true *** True Line Result -* 99_genre_roguelike/roguelike_line_of_sight/app/legend.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 900,10080,1180,10080 +** Processing line: ~ 640,10080,900,10080~ +- Inside source: true *** True Line Result - + 640,10080,900,10080 +** Processing line: ~ 640,10080,640,9900~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ def tick_legend args~ + 640,10080,640,9900 +** Processing line: ~ 60,10520,100,10740~ - Inside source: true *** True Line Result - def tick_legend args -** Processing line: ~ return unless SHOW_LEGEND~ + 60,10520,100,10740 +** Processing line: ~ 40,10240,60,10520~ - Inside source: true *** True Line Result - return unless SHOW_LEGEND -** Processing line: ~~ + 40,10240,60,10520 +** Processing line: ~ 40,10240,40,9960~ - Inside source: true *** True Line Result - -** Processing line: ~ legend_padding = 16~ + 40,10240,40,9960 +** Processing line: ~ 40,9960,40,9680~ - Inside source: true *** True Line Result - legend_padding = 16 -** Processing line: ~ legend_x = 1280 - TILE_SHEET_SIZE - legend_padding~ + 40,9960,40,9680 +** Processing line: ~ 40,9680,40,9360~ - Inside source: true *** True Line Result - legend_x = 1280 - TILE_SHEET_SIZE - legend_padding -** Processing line: ~ legend_y = 720 - TILE_SHEET_SIZE - legend_padding~ + 40,9680,40,9360 +** Processing line: ~ 40,9360,60,9080~ - Inside source: true *** True Line Result - legend_y = 720 - TILE_SHEET_SIZE - legend_padding -** Processing line: ~ tile_sheet_sprite = [legend_x,~ + 40,9360,60,9080 +** Processing line: ~ 60,9080,100,8860~ - Inside source: true *** True Line Result - tile_sheet_sprite = [legend_x, -** Processing line: ~ legend_y,~ + 60,9080,100,8860 +** Processing line: ~ 100,8860,460,9040~ - Inside source: true *** True Line Result - legend_y, -** Processing line: ~ TILE_SHEET_SIZE,~ + 100,8860,460,9040 +** Processing line: ~ 460,9040,760,9220~ - Inside source: true *** True Line Result - TILE_SHEET_SIZE, -** Processing line: ~ TILE_SHEET_SIZE,~ + 460,9040,760,9220 +** Processing line: ~ 760,9220,1140,9220~ - Inside source: true *** True Line Result - TILE_SHEET_SIZE, -** Processing line: ~ 'sprites/simple-mood-16x16.png', 0,~ + 760,9220,1140,9220 +** Processing line: ~ 1140,9220,1720,9200~ - Inside source: true *** True Line Result - 'sprites/simple-mood-16x16.png', 0, -** Processing line: ~ TILE_A,~ + 1140,9220,1720,9200 +** Processing line: ~ -660,11580,-600,11420~ - Inside source: true *** True Line Result - TILE_A, -** Processing line: ~ TILE_R,~ + -660,11580,-600,11420 +** Processing line: ~ -660,11800,-660,11580~ - Inside source: true *** True Line Result - TILE_R, -** Processing line: ~ TILE_G,~ + -660,11800,-660,11580 +** Processing line: ~ -660,12000,-660,11800~ - Inside source: true *** True Line Result - TILE_G, -** Processing line: ~ TILE_B]~ + -660,12000,-660,11800 +** Processing line: ~ -660,12000,-600,12220~ - Inside source: true *** True Line Result - TILE_B] -** Processing line: ~~ + -660,12000,-600,12220 +** Processing line: ~ -600,12220,-600,12440~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.mouse.point.inside_rect? tile_sheet_sprite~ + -600,12220,-600,12440 +** Processing line: ~ -600,12440,-600,12640~ - Inside source: true *** True Line Result - if args.inputs.mouse.point.inside_rect? tile_sheet_sprite -** Processing line: ~ mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE)~ + -600,12440,-600,12640 +** Processing line: ~ -600,11240,-260,11280~ - Inside source: true *** True Line Result - mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE) -** Processing line: ~ tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE))~ + -600,11240,-260,11280 +** Processing line: ~ -260,11280,100,11240~ - Inside source: true *** True Line Result - tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE)) -** Processing line: ~~ + -260,11280,100,11240 +** Processing line: ~ 9000,12360,9020,12400~ - Inside source: true *** True Line Result - -** Processing line: ~ mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE)~ + 9000,12360,9020,12400 +** Processing line: ~ 9020,12620,9020,12400~ - Inside source: true *** True Line Result - mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE) -** Processing line: ~ tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE))~ + 9020,12620,9020,12400 +** Processing line: ~ 9020,12840,9020,12620~ - Inside source: true *** True Line Result - tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE)) -** Processing line: ~~ + 9020,12840,9020,12620 +** Processing line: ~ 9020,13060,9020,12840~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.primitives << [legend_x - legend_padding * 2,~ + 9020,13060,9020,12840 +** Processing line: ~ 9020,13060,9020,13240~ - Inside source: true *** True Line Result - args.outputs.primitives << [legend_x - legend_padding * 2, -** Processing line: ~ mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid~ + 9020,13060,9020,13240 +** Processing line: ~ 9020,13240,9020,13420~ - Inside source: true *** True Line Result - mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid -** Processing line: ~~ + 9020,13240,9020,13420 +** Processing line: ~ 9020,13420,9020,13600~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE,~ + 9020,13420,9020,13600 +** Processing line: ~ 9020,13600,9020,13780~ - Inside source: true *** True Line Result - args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE, -** Processing line: ~ legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid~ + 9020,13600,9020,13780 +** Processing line: ~ 8880,13900,9020,13780~ - Inside source: true *** True Line Result - legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid -** Processing line: ~~ + 8880,13900,9020,13780 +** Processing line: ~ 8560,13800,8880,13900~ - Inside source: true *** True Line Result - -** Processing line: ~ sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] }~ + 8560,13800,8880,13900 +** Processing line: ~ 8220,13780,8560,13800~ - Inside source: true *** True Line Result - sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] } -** Processing line: ~ if sprite_key~ + 8220,13780,8560,13800 +** Processing line: ~ 7860,13760,8220,13780~ - Inside source: true *** True Line Result - if sprite_key -** Processing line: ~ member_name, _ = sprite_key~ + 7860,13760,8220,13780 +** Processing line: ~ 7640,13780,7860,13760~ - Inside source: true *** True Line Result - member_name, _ = sprite_key -** Processing line: ~ member_name = member_name_as_code member_name~ + 7640,13780,7860,13760 +** Processing line: ~ 7360,13800,7640,13780~ - Inside source: true *** True Line Result - member_name = member_name_as_code member_name -** Processing line: ~ args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0]~ + 7360,13800,7640,13780 +** Processing line: ~ 7100,13800,7360,13800~ - Inside source: true *** True Line Result - args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0] -** Processing line: ~ args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0]~ + 7100,13800,7360,13800 +** Processing line: ~ 6540,13760,6800,13780~ - Inside source: true *** True Line Result - args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0] -** Processing line: ~ args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0]~ + 6540,13760,6800,13780 +** Processing line: ~ 6800,13780,7100,13800~ - Inside source: true *** True Line Result - args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0] -** Processing line: ~ else~ + 6800,13780,7100,13800 +** Processing line: ~ 6280,13760,6540,13760~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0]~ + 6280,13760,6540,13760 +** Processing line: ~ 5760,13760,6280,13760~ - Inside source: true *** True Line Result - args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0] -** Processing line: ~ args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0]~ + 5760,13760,6280,13760 +** Processing line: ~ 5220,13780,5760,13760~ - Inside source: true *** True Line Result - args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0] -** Processing line: ~ end~ + 5220,13780,5760,13760 +** Processing line: ~ 4700,13760,5220,13780~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4700,13760,5220,13780 +** Processing line: ~ 4200,13740,4700,13760~ - Inside source: true *** True Line Result - -** Processing line: ~ end~ + 4200,13740,4700,13760 +** Processing line: ~ 3680,13720,4200,13740~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 3680,13720,4200,13740 +** Processing line: ~ 3140,13700,3680,13720~ - Inside source: true *** True Line Result - -** Processing line: ~ # render the sprite in the top right with a padding to the top and right so it's~ + 3140,13700,3680,13720 +** Processing line: ~ 2600,13680,3140,13700~ - Inside source: true *** True Line Result - # render the sprite in the top right with a padding to the top and right so it's -** Processing line: ~ # not flush against the edge~ + 2600,13680,3140,13700 +** Processing line: ~ 2040,13940,2600,13680~ - Inside source: true *** True Line Result - # not flush against the edge -** Processing line: ~ args.outputs.sprites << tile_sheet_sprite~ + 2040,13940,2600,13680 +** Processing line: ~ 1640,13940,2040,13940~ - Inside source: true *** True Line Result - args.outputs.sprites << tile_sheet_sprite -** Processing line: ~~ + 1640,13940,2040,13940 +** Processing line: ~ 1200,13960,1640,13940~ - Inside source: true *** True Line Result - -** Processing line: ~ # carefully place some ascii arrows to show the legend labels~ + 1200,13960,1640,13940 +** Processing line: ~ 840,14000,1200,13960~ - Inside source: true *** True Line Result - # carefully place some ascii arrows to show the legend labels -** Processing line: ~ args.outputs.labels << [895, 707, "ROW --->"]~ + 840,14000,1200,13960 +** Processing line: ~ 300,13960,840,14000~ - Inside source: true *** True Line Result - args.outputs.labels << [895, 707, "ROW --->"] -** Processing line: ~ args.outputs.labels << [943, 412, " ^"]~ + 300,13960,840,14000 +** Processing line: ~ -200,13900,300,13960~ - Inside source: true *** True Line Result - args.outputs.labels << [943, 412, " ^"] -** Processing line: ~ args.outputs.labels << [943, 412, " |"]~ + -200,13900,300,13960 +** Processing line: ~ -600,12840,-600,12640~ - Inside source: true *** True Line Result - args.outputs.labels << [943, 412, " |"] -** Processing line: ~ args.outputs.labels << [943, 394, "COL ---+"]~ + -600,12840,-600,12640 +** Processing line: ~ -600,13140,-600,12840~ - Inside source: true *** True Line Result - args.outputs.labels << [943, 394, "COL ---+"] -** Processing line: ~~ + -600,13140,-600,12840 +** Processing line: ~ -600,13140,-600,13420~ - Inside source: true *** True Line Result - -** Processing line: ~ # use the tile sheet to print out row and column numbers~ + -600,13140,-600,13420 +** Processing line: ~ -600,13700,-600,13420~ - Inside source: true *** True Line Result - # use the tile sheet to print out row and column numbers -** Processing line: ~ args.outputs.sprites << 16.map_with_index do |i|~ + -600,13700,-600,13420 +** Processing line: ~ -600,13700,-600,13820~ - Inside source: true *** True Line Result - args.outputs.sprites << 16.map_with_index do |i| -** Processing line: ~ sprite_key = i % 10~ + -600,13700,-600,13820 +** Processing line: ~ -600,13820,-200,13900~ - Inside source: true *** True Line Result - sprite_key = i % 10 -** Processing line: ~ [~ + -600,13820,-200,13900 +** Processing line: ~ -600,11240,-560,11000~ - Inside source: true *** True Line Result - [ -** Processing line: ~ tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE,~ + -600,11240,-560,11000 +** Processing line: ~ -560,11000,-480,10840~ - Inside source: true *** True Line Result - tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE, -** Processing line: ~ 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i),~ + -560,11000,-480,10840 +** Processing line: ~ -520,10660,-480,10840~ - Inside source: true *** True Line Result - 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i), -** Processing line: ~ sprite(sprite_key)),~ + -520,10660,-480,10840 +** Processing line: ~ -520,10660,-520,10480~ - Inside source: true *** True Line Result - sprite(sprite_key)), -** Processing line: ~ tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i),~ + -520,10660,-520,10480 +** Processing line: ~ -520,10480,-520,10300~ - Inside source: true *** True Line Result - tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i), -** Processing line: ~ 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key))~ + -520,10480,-520,10300 +** Processing line: ~ -520,10260,-480,10080~ - Inside source: true *** True Line Result - 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key)) -** Processing line: ~ ]~ + -520,10260,-480,10080 +** Processing line: ~ -480,9880,-440,10060~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + -480,9880,-440,10060 +** Processing line: ~ -520,9680,-480,9880~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + -520,9680,-480,9880 +** Processing line: ~ -520,9680,-480,9400~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + -520,9680,-480,9400 +** Processing line: ~ -480,9400,-480,9160~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + -480,9400,-480,9160 +** Processing line: ~ 1820,9880,2140,9800~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + 1820,9880,2140,9800 +** Processing line: ~ 1540,9880,1820,9880~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/main.rb~ -- Header detected. + 1540,9880,1820,9880 +** Processing line: ~ 1200,9920,1500,9880~ +- Inside source: true *** True Line Result - + 1200,9920,1500,9880 +** Processing line: ~ 900,9880,1200,9920~ +- Inside source: true *** True Line Result -* 99_genre_roguelike/roguelike_line_of_sight/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + 900,9880,1200,9920 +** Processing line: ~ 640,9900,840,9880~ +- Inside source: true *** True Line Result - + 640,9900,840,9880 +** Processing line: ~ 2380,8760,2800,8760~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ require 'app/constants.rb'~ + 2380,8760,2800,8760 +** Processing line: ~ 2800,8760,2840,8660~ - Inside source: true *** True Line Result - require 'app/constants.rb' -** Processing line: ~ require 'app/sprite_lookup.rb'~ + 2800,8760,2840,8660 +** Processing line: ~ 2840,8660,2840,8420~ - Inside source: true *** True Line Result - require 'app/sprite_lookup.rb' -** Processing line: ~ require 'app/legend.rb'~ + 2840,8660,2840,8420 +** Processing line: ~ 2840,8160,2840,8420~ - Inside source: true *** True Line Result - require 'app/legend.rb' -** Processing line: ~~ + 2840,8160,2840,8420 +** Processing line: ~ 2800,7900,2840,8160~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + 2800,7900,2840,8160 +** Processing line: ~ 2800,7900,2800,7720~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ tick_game args~ + 2800,7900,2800,7720 +** Processing line: ~ 2800,7540,2800,7720~ - Inside source: true *** True Line Result - tick_game args -** Processing line: ~ tick_legend args~ + 2800,7540,2800,7720 +** Processing line: ~ 2800,7540,2800,7360~ - Inside source: true *** True Line Result - tick_legend args -** Processing line: ~ end~ + 2800,7540,2800,7360 +** Processing line: ~ 2700,7220,2800,7360~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2700,7220,2800,7360 +** Processing line: ~ 2400,7220,2700,7220~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_game args~ + 2400,7220,2700,7220 +** Processing line: ~ 2080,7240,2400,7220~ - Inside source: true *** True Line Result - def tick_game args -** Processing line: ~ # setup the grid~ + 2080,7240,2400,7220 +** Processing line: ~ 1760,7320,2080,7240~ - Inside source: true *** True Line Result - # setup the grid -** Processing line: ~ args.state.grid.padding = 104~ + 1760,7320,2080,7240 +** Processing line: ~ 1380,7360,1720,7320~ - Inside source: true *** True Line Result - args.state.grid.padding = 104 -** Processing line: ~ args.state.grid.size = 512~ + 1380,7360,1720,7320 +** Processing line: ~ 1040,7400,1340,7360~ - Inside source: true *** True Line Result - args.state.grid.size = 512 -** Processing line: ~~ + 1040,7400,1340,7360 +** Processing line: ~ 640,7400,1000,7420~ - Inside source: true *** True Line Result - -** Processing line: ~ # set up your game~ + 640,7400,1000,7420 +** Processing line: ~ 300,7380,640,7400~ - Inside source: true *** True Line Result - # set up your game -** Processing line: ~ # initialize the game/game defaults. ||= means that you only initialize it if~ + 300,7380,640,7400 +** Processing line: ~ 0,7300,240,7380~ - Inside source: true *** True Line Result - # initialize the game/game defaults. ||= means that you only initialize it if -** Processing line: ~ # the value isn't alread initialized~ + 0,7300,240,7380 +** Processing line: ~ -300,7180,-60,7300~ - Inside source: true *** True Line Result - # the value isn't alread initialized -** Processing line: ~ args.state.player.x ||= 0~ + -300,7180,-60,7300 +** Processing line: ~ -380,6860,-360,7180~ - Inside source: true *** True Line Result - args.state.player.x ||= 0 -** Processing line: ~ args.state.player.y ||= 0~ + -380,6860,-360,7180 +** Processing line: ~ -380,6880,-360,6700~ - Inside source: true *** True Line Result - args.state.player.y ||= 0 -** Processing line: ~~ + -380,6880,-360,6700 +** Processing line: ~ -360,6700,-260,6540~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.enemies ||= [~ + -360,6700,-260,6540 +** Processing line: ~ -260,6540,0,6520~ - Inside source: true *** True Line Result - args.state.enemies ||= [ -** Processing line: ~ { x: 10, y: 10, type: :goblin, tile_key: :G },~ + -260,6540,0,6520 +** Processing line: ~ 0,6520,240,6640~ - Inside source: true *** True Line Result - { x: 10, y: 10, type: :goblin, tile_key: :G }, -** Processing line: ~ { x: 15, y: 30, type: :rat, tile_key: :R }~ + 0,6520,240,6640 +** Processing line: ~ 240,6640,460,6640~ - Inside source: true *** True Line Result - { x: 15, y: 30, type: :rat, tile_key: :R } -** Processing line: ~ ]~ + 240,6640,460,6640 +** Processing line: ~ 460,6640,500,6480~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + 460,6640,500,6480 +** Processing line: ~ 500,6260,500,6480~ - Inside source: true *** True Line Result - -** Processing line: ~ args.state.info_message ||= "Use arrow keys to move around."~ + 500,6260,500,6480 +** Processing line: ~ 460,6060,500,6260~ - Inside source: true *** True Line Result - args.state.info_message ||= "Use arrow keys to move around." -** Processing line: ~~ + 460,6060,500,6260 +** Processing line: ~ 460,5860,460,6060~ - Inside source: true *** True Line Result - -** Processing line: ~ # handle keyboard input~ + 460,5860,460,6060 +** Processing line: ~ 460,5860,500,5640~ - Inside source: true *** True Line Result - # handle keyboard input -** Processing line: ~ # keyboard input (arrow keys to move player)~ + 460,5860,500,5640 +** Processing line: ~ 500,5640,540,5440~ - Inside source: true *** True Line Result - # keyboard input (arrow keys to move player) -** Processing line: ~ new_player_x = args.state.player.x~ + 500,5640,540,5440 +** Processing line: ~ 540,5440,580,5220~ - Inside source: true *** True Line Result - new_player_x = args.state.player.x -** Processing line: ~ new_player_y = args.state.player.y~ + 540,5440,580,5220 +** Processing line: ~ 580,5220,580,5000~ - Inside source: true *** True Line Result - new_player_y = args.state.player.y -** Processing line: ~ player_direction = ""~ + 580,5220,580,5000 +** Processing line: ~ 580,4960,580,4740~ - Inside source: true *** True Line Result - player_direction = "" -** Processing line: ~ player_moved = false~ + 580,4960,580,4740 +** Processing line: ~ 580,4740,960,4700~ - Inside source: true *** True Line Result - player_moved = false -** Processing line: ~ if args.inputs.keyboard.key_down.up~ + 580,4740,960,4700 +** Processing line: ~ 960,4700,1140,4760~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.up -** Processing line: ~ new_player_y += 1~ + 960,4700,1140,4760 +** Processing line: ~ 1140,4760,1420,4740~ - Inside source: true *** True Line Result - new_player_y += 1 -** Processing line: ~ player_direction = "north"~ + 1140,4760,1420,4740 +** Processing line: ~ 1420,4740,1720,4700~ - Inside source: true *** True Line Result - player_direction = "north" -** Processing line: ~ player_moved = true~ + 1420,4740,1720,4700 +** Processing line: ~ 1720,4700,2000,4740~ - Inside source: true *** True Line Result - player_moved = true -** Processing line: ~ elsif args.inputs.keyboard.key_down.down~ + 1720,4700,2000,4740 +** Processing line: ~ 2000,4740,2380,4760~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.down -** Processing line: ~ new_player_y -= 1~ + 2000,4740,2380,4760 +** Processing line: ~ 2380,4760,2700,4800~ - Inside source: true *** True Line Result - new_player_y -= 1 -** Processing line: ~ player_direction = "south"~ + 2380,4760,2700,4800 +** Processing line: ~ 1720,4600,1760,4300~ - Inside source: true *** True Line Result - player_direction = "south" -** Processing line: ~ player_moved = true~ + 1720,4600,1760,4300 +** Processing line: ~ 1760,4300,2200,4340~ - Inside source: true *** True Line Result - player_moved = true -** Processing line: ~ elsif args.inputs.keyboard.key_down.right~ + 1760,4300,2200,4340 +** Processing line: ~ 2200,4340,2560,4340~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.right -** Processing line: ~ new_player_x += 1~ + 2200,4340,2560,4340 +** Processing line: ~ 2560,4340,2740,4340~ - Inside source: true *** True Line Result - new_player_x += 1 -** Processing line: ~ player_direction = "east"~ + 2560,4340,2740,4340 +** Processing line: ~ 2160,12580,2440,12400~ - Inside source: true *** True Line Result - player_direction = "east" -** Processing line: ~ player_moved = true~ + 2160,12580,2440,12400 +** Processing line: ~ 1820,12840,2160,12580~ - Inside source: true *** True Line Result - player_moved = true -** Processing line: ~ elsif args.inputs.keyboard.key_down.left~ + 1820,12840,2160,12580 +** Processing line: ~ 1500,13080,1820,12840~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.left -** Processing line: ~ new_player_x -= 1~ + 1500,13080,1820,12840 +** Processing line: ~ 1140,13340,1500,13080~ - Inside source: true *** True Line Result - new_player_x -= 1 -** Processing line: ~ player_direction = "west"~ + 1140,13340,1500,13080 +** Processing line: ~ 1140,13340,1580,13220~ - Inside source: true *** True Line Result - player_direction = "west" -** Processing line: ~ player_moved = true~ + 1140,13340,1580,13220 +** Processing line: ~ 2110,13080,2520,13000~ - Inside source: true *** True Line Result - player_moved = true -** Processing line: ~ end~ + 2110,13080,2520,13000 +** Processing line: ~ 2520,13000,2900,12800~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 2520,13000,2900,12800 +** Processing line: ~ 1580,13220,2110,13080~ - Inside source: true *** True Line Result - -** Processing line: ~ #handle game logic~ + 1580,13220,2110,13080 +** Processing line: ~ 2900,12800,3200,12680~ - Inside source: true *** True Line Result - #handle game logic -** Processing line: ~ # determine if there is an enemy on that square,~ + 2900,12800,3200,12680 +** Processing line: ~ 3200,12680,3440,12640~ - Inside source: true *** True Line Result - # determine if there is an enemy on that square, -** Processing line: ~ # if so, don't let the player move there~ + 3200,12680,3440,12640 +** Processing line: ~ 3440,12640,3720,12460~ - Inside source: true *** True Line Result - # if so, don't let the player move there -** Processing line: ~ if player_moved~ + 3440,12640,3720,12460 +** Processing line: ~ 3720,12460,4040,12320~ - Inside source: true *** True Line Result - if player_moved -** Processing line: ~ found_enemy = args.state.enemies.find do |e|~ + 3720,12460,4040,12320 +** Processing line: ~ 4040,12320,4360,12200~ - Inside source: true *** True Line Result - found_enemy = args.state.enemies.find do |e| -** Processing line: ~ e[:x] == new_player_x && e[:y] == new_player_y~ + 4040,12320,4360,12200 +** Processing line: ~ 4360,11940,4380,12180~ - Inside source: true *** True Line Result - e[:x] == new_player_x && e[:y] == new_player_y -** Processing line: ~ end~ + 4360,11940,4380,12180 +** Processing line: ~ 4360,11700,4360,11940~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4360,11700,4360,11940 +** Processing line: ~ 4360,11700,4540,11500~ - Inside source: true *** True Line Result - -** Processing line: ~ if !found_enemy~ + 4360,11700,4540,11500 +** Processing line: ~ 4540,11500,4880,11540~ - Inside source: true *** True Line Result - if !found_enemy -** Processing line: ~ args.state.player.x = new_player_x~ + 4540,11500,4880,11540 +** Processing line: ~ 6000,11660,6280,11640~ - Inside source: true *** True Line Result - args.state.player.x = new_player_x -** Processing line: ~ args.state.player.y = new_player_y~ + 6000,11660,6280,11640 +** Processing line: ~ 5440,11600,5720,11610~ - Inside source: true *** True Line Result - args.state.player.y = new_player_y -** Processing line: ~ args.state.info_message = "You moved #{player_direction}."~ + 5440,11600,5720,11610 +** Processing line: ~ 5720,11610,6000,11660~ - Inside source: true *** True Line Result - args.state.info_message = "You moved #{player_direction}." -** Processing line: ~ else~ + 5720,11610,6000,11660 +** Processing line: ~ 6280,11640,6760,11720~ - Inside source: true *** True Line Result - else -** Processing line: ~ args.state.info_message = "You cannot move into a square an enemy occupies."~ + 6280,11640,6760,11720 +** Processing line: ~ 6760,11720,7060,11780~ - Inside source: true *** True Line Result - args.state.info_message = "You cannot move into a square an enemy occupies." -** Processing line: ~ end~ + 6760,11720,7060,11780 +** Processing line: ~ 7060,11780,7360,11810~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + 7060,11780,7360,11810 +** Processing line: ~ 7360,11810,7640,11840~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7360,11810,7640,11840 +** Processing line: ~ 7640,11840,8000,11830~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.sprites << tile_in_game(args.state.player.x,~ + 7640,11840,8000,11830 +** Processing line: ~ 8000,11830,8320,11850~ - Inside source: true *** True Line Result - args.outputs.sprites << tile_in_game(args.state.player.x, -** Processing line: ~ args.state.player.y, '@')~ + 8000,11830,8320,11850 +** Processing line: ~ 8320,11850,8390,11800~ - Inside source: true *** True Line Result - args.state.player.y, '@') -** Processing line: ~~ + 8320,11850,8390,11800 +** Processing line: ~ 8330,11760,8390,11800~ - Inside source: true *** True Line Result - -** Processing line: ~ # render game~ + 8330,11760,8390,11800 +** Processing line: ~ 8160,11760,8330,11760~ - Inside source: true *** True Line Result - # render game -** Processing line: ~ # render enemies at locations~ + 8160,11760,8330,11760 +** Processing line: ~ 7910,11750,8160,11760~ - Inside source: true *** True Line Result - # render enemies at locations -** Processing line: ~ args.outputs.sprites << args.state.enemies.map do |e|~ + 7910,11750,8160,11760 +** Processing line: ~ 7660,11740,7900,11750~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state.enemies.map do |e| -** Processing line: ~ tile_in_game(e[:x], e[:y], e[:tile_key])~ + 7660,11740,7900,11750 +** Processing line: ~ 7400,11730,7660,11740~ - Inside source: true *** True Line Result - tile_in_game(e[:x], e[:y], e[:tile_key]) -** Processing line: ~ end~ + 7400,11730,7660,11740 +** Processing line: ~ 7160,11680,7400,11730~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 7160,11680,7400,11730 +** Processing line: ~ 7080,11570,7160,11680~ - Inside source: true *** True Line Result - -** Processing line: ~ # render the border~ + 7080,11570,7160,11680 +** Processing line: ~ 7080,11570,7100,11350~ - Inside source: true *** True Line Result - # render the border -** Processing line: ~ border_x = args.state.grid.padding - DESTINATION_TILE_SIZE~ + 7080,11570,7100,11350 +** Processing line: ~ 7100,11350,7440,11280~ - Inside source: true *** True Line Result - border_x = args.state.grid.padding - DESTINATION_TILE_SIZE -** Processing line: ~ border_y = args.state.grid.padding - DESTINATION_TILE_SIZE~ + 7100,11350,7440,11280 +** Processing line: ~ 7440,11280,7940,11280~ - Inside source: true *** True Line Result - border_y = args.state.grid.padding - DESTINATION_TILE_SIZE -** Processing line: ~ border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2~ + 7440,11280,7940,11280 +** Processing line: ~ 7960,11280,8360,11280~ - Inside source: true *** True Line Result - border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2 -** Processing line: ~~ + 7960,11280,8360,11280 +** Processing line: ~ 5840,11540,6650,11170~ - Inside source: true *** True Line Result - -** Processing line: ~ args.outputs.borders << [border_x,~ + 5840,11540,6650,11170 +** Processing line: ~ 4880,11540,5440,11600~ - Inside source: true *** True Line Result - args.outputs.borders << [border_x, -** Processing line: ~ border_y,~ + 4880,11540,5440,11600 +** Processing line: ~ 3410,11830,3420,11300~ - Inside source: true *** True Line Result - border_y, -** Processing line: ~ border_size,~ + 3410,11830,3420,11300 +** Processing line: ~ 3410,11260,3520,10920~ - Inside source: true *** True Line Result - border_size, -** Processing line: ~ border_size]~ + 3410,11260,3520,10920 +** Processing line: ~ 3520,10590,3520,10920~ - Inside source: true *** True Line Result - border_size] -** Processing line: ~~ + 3520,10590,3520,10920 +** Processing line: ~ 3520,10590,3540,10260~ - Inside source: true *** True Line Result - -** Processing line: ~ # render label stuff~ + 3520,10590,3540,10260 +** Processing line: ~ 3520,9900,3540,10240~ - Inside source: true *** True Line Result - # render label stuff -** Processing line: ~ args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"]~ + 3520,9900,3540,10240 +** Processing line: ~ 3520,9900,3640,9590~ - Inside source: true *** True Line Result - args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"] -** Processing line: ~ args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message]~ + 3520,9900,3640,9590 +** Processing line: ~ 3640,9570,4120,9590~ - Inside source: true *** True Line Result - args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message] -** Processing line: ~ end~ + 3640,9570,4120,9590 +** Processing line: ~ 4140,9590,4600,9680~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 4140,9590,4600,9680 +** Processing line: ~ 4620,9680,5030,9730~ - Inside source: true *** True Line Result - -** Processing line: ~ def tile_in_game x, y, tile_key~ + 4620,9680,5030,9730 +** Processing line: ~ 5120,9750,5520,9800~ - Inside source: true *** True Line Result - def tile_in_game x, y, tile_key -** Processing line: ~ tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE,~ + 5120,9750,5520,9800 +** Processing line: ~ 5620,9820,6080,9800~ - Inside source: true *** True Line Result - tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE, -** Processing line: ~ $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE,~ + 5620,9820,6080,9800 +** Processing line: ~ 6130,9810,6580,9820~ - Inside source: true *** True Line Result - $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE, -** Processing line: ~ tile_key)~ + 6130,9810,6580,9820 +** Processing line: ~ 6640,9820,6800,9700~ - Inside source: true *** True Line Result - tile_key) -** Processing line: ~ end~ + 6640,9820,6800,9700 +** Processing line: ~ 6780,9400,6800,9700~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 6780,9400,6800,9700 +** Processing line: ~ 6780,9400,6840,9140~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ def sprite_lookup~ + 6780,9400,6840,9140 +** Processing line: ~ 6820,8860,6840,9120~ - Inside source: true *** True Line Result - def sprite_lookup -** Processing line: ~ {~ + 6820,8860,6840,9120 +** Processing line: ~ 6780,8600,6820,8830~ - Inside source: true *** True Line Result - { -** Processing line: ~ 0 => [3, 0],~ + 6780,8600,6820,8830 +** Processing line: ~ 6720,8350,6780,8570~ - Inside source: true *** True Line Result - 0 => [3, 0], -** Processing line: ~ 1 => [3, 1],~ + 6720,8350,6780,8570 +** Processing line: ~ 6480,8340,6720,8320~ - Inside source: true *** True Line Result - 1 => [3, 1], -** Processing line: ~ 2 => [3, 2],~ + 6480,8340,6720,8320 +** Processing line: ~ 6260,8400,6480,8340~ - Inside source: true *** True Line Result - 2 => [3, 2], -** Processing line: ~ 3 => [3, 3],~ + 6260,8400,6480,8340 +** Processing line: ~ 6050,8580,6240,8400~ - Inside source: true *** True Line Result - 3 => [3, 3], -** Processing line: ~ 4 => [3, 4],~ + 6050,8580,6240,8400 +** Processing line: ~ 5760,8630,6040,8590~ - Inside source: true *** True Line Result - 4 => [3, 4], -** Processing line: ~ 5 => [3, 5],~ + 5760,8630,6040,8590 +** Processing line: ~ 5520,8690,5740,8630~ - Inside source: true *** True Line Result - 5 => [3, 5], -** Processing line: ~ 6 => [3, 6],~ + 5520,8690,5740,8630 +** Processing line: ~ 5120,8690,5450,8700~ - Inside source: true *** True Line Result - 6 => [3, 6], -** Processing line: ~ 7 => [3, 7],~ + 5120,8690,5450,8700 +** Processing line: ~ 4570,8670,5080,8690~ - Inside source: true *** True Line Result - 7 => [3, 7], -** Processing line: ~ 8 => [3, 8],~ + 4570,8670,5080,8690 +** Processing line: ~ 4020,8610,4540,8670~ - Inside source: true *** True Line Result - 8 => [3, 8], -** Processing line: ~ 9 => [3, 9],~ + 4020,8610,4540,8670 +** Processing line: ~ 3540,8480,4020,8610~ - Inside source: true *** True Line Result - 9 => [3, 9], -** Processing line: ~ '@' => [4, 0],~ + 3540,8480,4020,8610 +** Processing line: ~ 3520,8230,3520,8480~ - Inside source: true *** True Line Result - '@' => [4, 0], -** Processing line: ~ A: [ 4, 1],~ + 3520,8230,3520,8480 +** Processing line: ~ 3520,7930,3520,8230~ - Inside source: true *** True Line Result - A: [ 4, 1], -** Processing line: ~ B: [ 4, 2],~ + 3520,7930,3520,8230 +** Processing line: ~ 3520,7930,3540,7630~ - Inside source: true *** True Line Result - B: [ 4, 2], -** Processing line: ~ C: [ 4, 3],~ + 3520,7930,3540,7630 +** Processing line: ~ 3480,7320,3540,7610~ - Inside source: true *** True Line Result - C: [ 4, 3], -** Processing line: ~ D: [ 4, 4],~ + 3480,7320,3540,7610 +** Processing line: ~ 3480,7280,3500,7010~ - Inside source: true *** True Line Result - D: [ 4, 4], -** Processing line: ~ E: [ 4, 5],~ + 3480,7280,3500,7010 +** Processing line: ~ 3500,6980,3680,6850~ - Inside source: true *** True Line Result - E: [ 4, 5], -** Processing line: ~ F: [ 4, 6],~ + 3500,6980,3680,6850 +** Processing line: ~ 3680,6850,4220,6840~ - Inside source: true *** True Line Result - F: [ 4, 6], -** Processing line: ~ G: [ 4, 7],~ + 3680,6850,4220,6840 +** Processing line: ~ 4230,6840,4760,6850~ - Inside source: true *** True Line Result - G: [ 4, 7], -** Processing line: ~ H: [ 4, 8],~ + 4230,6840,4760,6850 +** Processing line: ~ 4780,6850,5310,6860~ - Inside source: true *** True Line Result - H: [ 4, 8], -** Processing line: ~ I: [ 4, 9],~ + 4780,6850,5310,6860 +** Processing line: ~ 5310,6860,5720,6940~ - Inside source: true *** True Line Result - I: [ 4, 9], -** Processing line: ~ J: [ 4, 10],~ + 5310,6860,5720,6940 +** Processing line: ~ 5720,6940,5880,7250~ - Inside source: true *** True Line Result - J: [ 4, 10], -** Processing line: ~ K: [ 4, 11],~ + 5720,6940,5880,7250 +** Processing line: ~ 5880,7250,5900,7520~ - Inside source: true *** True Line Result - K: [ 4, 11], -** Processing line: ~ L: [ 4, 12],~ + 5880,7250,5900,7520 +** Processing line: ~ 100,11240,440,11300~ - Inside source: true *** True Line Result - L: [ 4, 12], -** Processing line: ~ M: [ 4, 13],~ + 100,11240,440,11300 +** Processing line: ~ 440,11300,760,11330~ - Inside source: true *** True Line Result - M: [ 4, 13], -** Processing line: ~ N: [ 4, 14],~ + 440,11300,760,11330 +** Processing line: ~ 1480,11280,1840,11230~ - Inside source: true *** True Line Result - N: [ 4, 14], -** Processing line: ~ O: [ 4, 15],~ + 1480,11280,1840,11230 +** Processing line: ~ 2200,11130,2360,11090~ - Inside source: true *** True Line Result - O: [ 4, 15], -** Processing line: ~ P: [ 5, 0],~ + 2200,11130,2360,11090 +** Processing line: ~ 1840,11230,2200,11130~ - Inside source: true *** True Line Result - P: [ 5, 0], -** Processing line: ~ Q: [ 5, 1],~ -- Inside source: true + 1840,11230,2200,11130 +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - Q: [ 5, 1], -** Processing line: ~ R: [ 5, 2],~ +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Choose Your Own Adventure - decision.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Choose Your Own Adventure - decision.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb~ - Inside source: true *** True Line Result - R: [ 5, 2], -** Processing line: ~ S: [ 5, 3],~ + # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb +** Processing line: ~ # Hey there! Welcome to Four Decisions. Here is how you~ - Inside source: true *** True Line Result - S: [ 5, 3], -** Processing line: ~ T: [ 5, 4],~ + # Hey there! Welcome to Four Decisions. Here is how you +** Processing line: ~ # create your decision tree. Remove =being and =end from the text to~ - Inside source: true *** True Line Result - T: [ 5, 4], -** Processing line: ~ U: [ 5, 5],~ + # create your decision tree. Remove =being and =end from the text to +** Processing line: ~ # enable the game (just save the file). Change stuff and see what happens!~ - Inside source: true *** True Line Result - U: [ 5, 5], -** Processing line: ~ V: [ 5, 6],~ + # enable the game (just save the file). Change stuff and see what happens! +** Processing line: ~~ - Inside source: true *** True Line Result - V: [ 5, 6], -** Processing line: ~ W: [ 5, 7],~ + +** Processing line: ~ def game~ - Inside source: true *** True Line Result - W: [ 5, 7], -** Processing line: ~ X: [ 5, 8],~ + def game +** Processing line: ~ {~ - Inside source: true *** True Line Result - X: [ 5, 8], -** Processing line: ~ Y: [ 5, 9],~ + { +** Processing line: ~ starting_decision: :stormy_night,~ - Inside source: true *** True Line Result - Y: [ 5, 9], -** Processing line: ~ Z: [ 5, 10],~ + starting_decision: :stormy_night, +** Processing line: ~ decisions: {~ - Inside source: true *** True Line Result - Z: [ 5, 10], -** Processing line: ~ a: [ 6, 1],~ + decisions: { +** Processing line: ~ stormy_night: {~ - Inside source: true *** True Line Result - a: [ 6, 1], -** Processing line: ~ b: [ 6, 2],~ + stormy_night: { +** Processing line: ~ description: 'It was a dark and stormy night. (storyline located in decision.rb)',~ - Inside source: true *** True Line Result - b: [ 6, 2], -** Processing line: ~ c: [ 6, 3],~ + description: 'It was a dark and stormy night. (storyline located in decision.rb)', +** Processing line: ~ option_one: {~ - Inside source: true *** True Line Result - c: [ 6, 3], -** Processing line: ~ d: [ 6, 4],~ + option_one: { +** Processing line: ~ description: 'Go to sleep.',~ - Inside source: true *** True Line Result - d: [ 6, 4], -** Processing line: ~ e: [ 6, 5],~ + description: 'Go to sleep.', +** Processing line: ~ decision: :nap~ - Inside source: true *** True Line Result - e: [ 6, 5], -** Processing line: ~ f: [ 6, 6],~ + decision: :nap +** Processing line: ~ },~ - Inside source: true *** True Line Result - f: [ 6, 6], -** Processing line: ~ g: [ 6, 7],~ + }, +** Processing line: ~ option_two: {~ - Inside source: true *** True Line Result - g: [ 6, 7], -** Processing line: ~ h: [ 6, 8],~ + option_two: { +** Processing line: ~ description: 'Watch a movie.',~ - Inside source: true *** True Line Result - h: [ 6, 8], -** Processing line: ~ i: [ 6, 9],~ + description: 'Watch a movie.', +** Processing line: ~ decision: :movie~ - Inside source: true *** True Line Result - i: [ 6, 9], -** Processing line: ~ j: [ 6, 10],~ + decision: :movie +** Processing line: ~ },~ - Inside source: true *** True Line Result - j: [ 6, 10], -** Processing line: ~ k: [ 6, 11],~ + }, +** Processing line: ~ option_three: {~ - Inside source: true *** True Line Result - k: [ 6, 11], -** Processing line: ~ l: [ 6, 12],~ + option_three: { +** Processing line: ~ description: 'Go outside.',~ - Inside source: true *** True Line Result - l: [ 6, 12], -** Processing line: ~ m: [ 6, 13],~ + description: 'Go outside.', +** Processing line: ~ decision: :go_outside~ - Inside source: true *** True Line Result - m: [ 6, 13], -** Processing line: ~ n: [ 6, 14],~ + decision: :go_outside +** Processing line: ~ },~ - Inside source: true *** True Line Result - n: [ 6, 14], -** Processing line: ~ o: [ 6, 15],~ + }, +** Processing line: ~ option_four: {~ - Inside source: true *** True Line Result - o: [ 6, 15], -** Processing line: ~ p: [ 7, 0],~ + option_four: { +** Processing line: ~ description: 'Get a snack.',~ - Inside source: true *** True Line Result - p: [ 7, 0], -** Processing line: ~ q: [ 7, 1],~ + description: 'Get a snack.', +** Processing line: ~ decision: :get_a_snack~ - Inside source: true *** True Line Result - q: [ 7, 1], -** Processing line: ~ r: [ 7, 2],~ + decision: :get_a_snack +** Processing line: ~ }~ - Inside source: true *** True Line Result - r: [ 7, 2], -** Processing line: ~ s: [ 7, 3],~ + } +** Processing line: ~ },~ - Inside source: true *** True Line Result - s: [ 7, 3], -** Processing line: ~ t: [ 7, 4],~ + }, +** Processing line: ~ nap: {~ - Inside source: true *** True Line Result - t: [ 7, 4], -** Processing line: ~ u: [ 7, 5],~ + nap: { +** Processing line: ~ description: 'You took a nap. The end.',~ - Inside source: true *** True Line Result - u: [ 7, 5], -** Processing line: ~ v: [ 7, 6],~ + description: 'You took a nap. The end.', +** Processing line: ~ option_one: {~ - Inside source: true *** True Line Result - v: [ 7, 6], -** Processing line: ~ w: [ 7, 7],~ + option_one: { +** Processing line: ~ description: 'Start over.',~ - Inside source: true *** True Line Result - w: [ 7, 7], -** Processing line: ~ x: [ 7, 8],~ + description: 'Start over.', +** Processing line: ~ decision: :stormy_night~ - Inside source: true *** True Line Result - x: [ 7, 8], -** Processing line: ~ y: [ 7, 9],~ + decision: :stormy_night +** Processing line: ~ }~ - Inside source: true *** True Line Result - y: [ 7, 9], -** Processing line: ~ z: [ 7, 10],~ + } +** Processing line: ~ }~ - Inside source: true *** True Line Result - z: [ 7, 10], -** Processing line: ~ '|' => [ 7, 12]~ + } +** Processing line: ~ }~ - Inside source: true *** True Line Result - '|' => [ 7, 12] + } ** Processing line: ~ }~ - Inside source: true *** True Line Result @@ -72773,410 +73004,390 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def sprite key~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def sprite key -** Processing line: ~ $gtk.args.state.reserved.sprite_lookup[key]~ +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Choose Your Own Adventure - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Choose Your Own Adventure - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb~ - Inside source: true *** True Line Result - $gtk.args.state.reserved.sprite_lookup[key] -** Processing line: ~ end~ + # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def member_name_as_code raw_member_name~ +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - def member_name_as_code raw_member_name -** Processing line: ~ if raw_member_name.is_a? Symbol~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - if raw_member_name.is_a? Symbol -** Processing line: ~ ":#{raw_member_name}"~ + +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The values can be found~ - Inside source: true *** True Line Result - ":#{raw_member_name}" -** Processing line: ~ elsif raw_member_name.is_a? String~ + - Hashes: Collection of unique keys and their corresponding values. The values can be found +** Processing line: ~ using their keys.~ - Inside source: true *** True Line Result - elsif raw_member_name.is_a? String -** Processing line: ~ "'#{raw_member_name}'"~ + using their keys. +** Processing line: ~~ - Inside source: true *** True Line Result - "'#{raw_member_name}'" -** Processing line: ~ elsif raw_member_name.is_a? Fixnum~ + +** Processing line: ~ In this sample app, the decisions needed for the game are stored in a hash. In fact, the~ - Inside source: true *** True Line Result - elsif raw_member_name.is_a? Fixnum -** Processing line: ~ "#{raw_member_name}"~ + In this sample app, the decisions needed for the game are stored in a hash. In fact, the +** Processing line: ~ decision.rb file contains hashes inside of other hashes!~ - Inside source: true *** True Line Result - "#{raw_member_name}" -** Processing line: ~ else~ + decision.rb file contains hashes inside of other hashes! +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ "UNKNOWN: #{raw_member_name}"~ + +** Processing line: ~ Each option is a key in the first hash, but also contains a hash (description and~ - Inside source: true *** True Line Result - "UNKNOWN: #{raw_member_name}" -** Processing line: ~ end~ + Each option is a key in the first hash, but also contains a hash (description and +** Processing line: ~ decision being its keys) as its value.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + decision being its keys) as its value. +** Processing line: ~ Go into the decision.rb file and take a look before diving into the code below.~ - Inside source: true *** True Line Result - end + Go into the decision.rb file and take a look before diving into the code below. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tile x, y, tile_row_column_or_key~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - def tile x, y, tile_row_column_or_key -** Processing line: ~ tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key -** Processing line: ~ end~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key~ -- Inside source: true -*** True Line Result - def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key -** Processing line: ~ row_or_key, column = tile_row_column_or_key~ -- Inside source: true -*** True Line Result - row_or_key, column = tile_row_column_or_key -** Processing line: ~ if !column~ +** Processing line: ~ - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.~ - Inside source: true *** True Line Result - if !column -** Processing line: ~ row, column = sprite row_or_key~ + - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ - Inside source: true *** True Line Result - row, column = sprite row_or_key -** Processing line: ~ else~ + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ row, column = row_or_key, column~ + +** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ - Inside source: true *** True Line Result - row, column = row_or_key, column -** Processing line: ~ end~ + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ - Inside source: true *** True Line Result - end + as Ruby code, and the placeholder is replaced with its corresponding value or result. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !row~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - if !row -** Processing line: ~ member_name = member_name_as_code tile_row_column_or_key~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - member_name = member_name_as_code tile_row_column_or_key -** Processing line: ~ raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb."~ + +** Processing line: ~ # This sample app provides users with a story and multiple decisions that they can choose to make.~ - Inside source: true *** True Line Result - raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb." -** Processing line: ~ end~ + # This sample app provides users with a story and multiple decisions that they can choose to make. +** Processing line: ~ # Users can make a decision using their keyboard, and the story will move forward based on user choices.~ - Inside source: true *** True Line Result - end + # Users can make a decision using their keyboard, and the story will move forward based on user choices. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sprite provided by Rogue Yun~ +** Processing line: ~ # The decisions available to users are stored in the decision.rb file.~ - Inside source: true *** True Line Result - # Sprite provided by Rogue Yun -** Processing line: ~ # http://www.bay12forums.com/smf/index.php?topic=144897.0~ + # The decisions available to users are stored in the decision.rb file. +** Processing line: ~ # We must have access to it for the game to function properly.~ - Inside source: true *** True Line Result - # http://www.bay12forums.com/smf/index.php?topic=144897.0 -** Processing line: ~ # License: Public Domain~ + # We must have access to it for the game to function properly. +** Processing line: ~ GAME_FILE = 'app/decision.rb' # found in app folder~ - Inside source: true *** True Line Result - # License: Public Domain + GAME_FILE = 'app/decision.rb' # found in app folder ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ {~ +** Processing line: ~ require GAME_FILE # require used to load another file, import class/method definitions~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: x,~ + require GAME_FILE # require used to load another file, import class/method definitions +** Processing line: ~~ - Inside source: true *** True Line Result - x: x, -** Processing line: ~ y: y,~ + +** Processing line: ~ # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.~ - Inside source: true *** True Line Result - y: y, -** Processing line: ~ w: w,~ + # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. +** Processing line: ~ # Otherwise, the game is run.~ - Inside source: true *** True Line Result - w: w, -** Processing line: ~ h: h,~ + # Otherwise, the game is run. +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - h: h, -** Processing line: ~ tile_x: column * 16,~ + def tick args +** Processing line: ~ if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method~ - Inside source: true *** True Line Result - tile_x: column * 16, -** Processing line: ~ tile_y: (row * 16),~ + if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method +** Processing line: ~ args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown~ - Inside source: true *** True Line Result - tile_y: (row * 16), -** Processing line: ~ tile_w: 16,~ + args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown +** Processing line: ~ args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]~ - Inside source: true *** True Line Result - tile_w: 16, -** Processing line: ~ tile_h: 16,~ + args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] +** Processing line: ~ elsif respond_to?(:game) # otherwise, if responds to game~ - Inside source: true *** True Line Result - tile_h: 16, -** Processing line: ~ r: r,~ + elsif respond_to?(:game) # otherwise, if responds to game +** Processing line: ~ args.state.loaded = true~ - Inside source: true *** True Line Result - r: r, -** Processing line: ~ g: g,~ + args.state.loaded = true +** Processing line: ~ tick_game args # calls tick_game method, runs game~ - Inside source: true *** True Line Result - g: g, -** Processing line: ~ b: b,~ + tick_game args # calls tick_game method, runs game +** Processing line: ~ end~ - Inside source: true *** True Line Result - b: b, -** Processing line: ~ a: a,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - a: a, -** Processing line: ~ path: 'sprites/simple-mood-16x16.png'~ + +** Processing line: ~ if args.state.tick_count.mod_zero? 60 # update every 60 frames~ - Inside source: true *** True Line Result - path: 'sprites/simple-mood-16x16.png' -** Processing line: ~ }~ + if args.state.tick_count.mod_zero? 60 # update every 60 frames +** Processing line: ~ t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file +** Processing line: ~ if t != args.state.mtime~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if t != args.state.mtime +** Processing line: ~ args.state.mtime = t~ - Inside source: true *** True Line Result - -** Processing line: ~ $gtk.args.state.reserved.sprite_lookup = sprite_lookup~ + args.state.mtime = t +** Processing line: ~ require GAME_FILE # require used to load file~ - Inside source: true *** True Line Result - $gtk.args.state.reserved.sprite_lookup = sprite_lookup -** Processing line: ~~ + require GAME_FILE # require used to load file +** Processing line: ~ args.state.game_definition = nil # game definition and decision are empty~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* 99_genre_roguelike/roguelike_starting_point/app/main.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* 99_genre_roguelike/roguelike_starting_point/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - + args.state.game_definition = nil # game definition and decision are empty +** Processing line: ~ args.state.decision_id = nil~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ =begin~ + args.state.decision_id = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - lambda: A way to define a block and its parameters with special syntax.~ +** Processing line: ~ # Runs methods needed for game to function properly~ - Inside source: true *** True Line Result - - lambda: A way to define a block and its parameters with special syntax. -** Processing line: ~ For example, the syntax of lambda looks like this:~ + # Runs methods needed for game to function properly +** Processing line: ~ # Creates a rectangular border around the screen~ - Inside source: true *** True Line Result - For example, the syntax of lambda looks like this: -** Processing line: ~ my_lambda = -> { puts "This is my lambda" }~ + # Creates a rectangular border around the screen +** Processing line: ~ def tick_game args~ - Inside source: true *** True Line Result - my_lambda = -> { puts "This is my lambda" } -** Processing line: ~~ + def tick_game args +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + defaults args +** Processing line: ~ args.borders << args.grid.rect~ - Inside source: true *** True Line Result - Reminders: -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ + args.borders << args.grid.rect +** Processing line: ~ render_decision args~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + render_decision args +** Processing line: ~ process_inputs args~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ + process_inputs args +** Processing line: ~ end~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#inside_rect?: Returns whether or not the point is inside a rect.~ -- Inside source: true -*** True Line Result - - ARRAY#inside_rect?: Returns whether or not the point is inside a rect. -** Processing line: ~~ +** Processing line: ~ # Sets default values and uses decision.rb file to define game and decision_id~ - Inside source: true *** True Line Result - -** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ + # Sets default values and uses decision.rb file to define game and decision_id +** Processing line: ~ # variable using the starting decision~ - Inside source: true *** True Line Result - - product: Returns an array of all combinations of elements from all arrays. -** Processing line: ~~ + # variable using the starting decision +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - -** Processing line: ~ - find: Finds all elements of a collection that meet requirements.~ + def defaults args +** Processing line: ~ args.state.game_definition ||= game~ - Inside source: true *** True Line Result - - find: Finds all elements of a collection that meet requirements. -** Processing line: ~~ + args.state.game_definition ||= game +** Processing line: ~ args.state.decision_id ||= args.state.game_definition[:starting_decision]~ - Inside source: true *** True Line Result - -** Processing line: ~ - abs: Returns the absolute value.~ + args.state.decision_id ||= args.state.game_definition[:starting_decision] +** Processing line: ~ end~ - Inside source: true *** True Line Result - - abs: Returns the absolute value. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ =end~ -- Inside source: true -*** True Line Result - =end -** Processing line: ~~ +** Processing line: ~ # Outputs the possible decision descriptions the user can choose onto the screen~ - Inside source: true *** True Line Result - -** Processing line: ~ # This sample app allows the player to move around in the dungeon, which becomes more or less visible~ + # Outputs the possible decision descriptions the user can choose onto the screen +** Processing line: ~ # as well as what key to press on their keyboard to make their decision~ - Inside source: true *** True Line Result - # This sample app allows the player to move around in the dungeon, which becomes more or less visible -** Processing line: ~ # depending on the player's location, and also has enemies.~ + # as well as what key to press on their keyboard to make their decision +** Processing line: ~ def render_decision args~ - Inside source: true *** True Line Result - # depending on the player's location, and also has enemies. -** Processing line: ~~ + def render_decision args +** Processing line: ~ decision = current_decision args~ - Inside source: true *** True Line Result - -** Processing line: ~ class Game~ + decision = current_decision args +** Processing line: ~ # text is either the value of decision's description key or warning that no description exists~ - Inside source: true *** True Line Result - class Game -** Processing line: ~ attr_accessor :args, :state, :inputs, :outputs, :grid~ + # text is either the value of decision's description key or warning that no description exists +** Processing line: ~ args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation~ - Inside source: true *** True Line Result - attr_accessor :args, :state, :inputs, :outputs, :grid + args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Calls all the methods needed for the game to run properly.~ -- Inside source: true -*** True Line Result - # Calls all the methods needed for the game to run properly. -** Processing line: ~ def tick~ +** Processing line: ~ # All decisions are stored in a hash~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + # All decisions are stored in a hash +** Processing line: ~ # The descriptions output onto the screen are the values for the description keys of the hash.~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render_canvas~ + # The descriptions output onto the screen are the values for the description keys of the hash. +** Processing line: ~ if decision[:option_one]~ - Inside source: true *** True Line Result - render_canvas -** Processing line: ~ render_dungeon~ + if decision[:option_one] +** Processing line: ~ args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label~ - Inside source: true *** True Line Result - render_dungeon -** Processing line: ~ render_player~ + args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label +** Processing line: ~ args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision~ - Inside source: true *** True Line Result - render_player -** Processing line: ~ render_enemies~ + args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_enemies -** Processing line: ~ print_cell_coordinates~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - print_cell_coordinates -** Processing line: ~ calc_canvas~ + +** Processing line: ~ if decision[:option_two]~ - Inside source: true *** True Line Result - calc_canvas -** Processing line: ~ input_move~ + if decision[:option_two] +** Processing line: ~ args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description~ - Inside source: true *** True Line Result - input_move -** Processing line: ~ input_click_map~ + args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description +** Processing line: ~ args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]~ - Inside source: true *** True Line Result - input_click_map + args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -73185,602 +73396,630 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets default values and initializes variables~ +** Processing line: ~ if decision[:option_three]~ - Inside source: true *** True Line Result - # Sets default values and initializes variables -** Processing line: ~ def defaults~ + if decision[:option_three] +** Processing line: ~ args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ outputs.background_color = [0, 0, 0] # black background~ + args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description +** Processing line: ~ args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]~ - Inside source: true *** True Line Result - outputs.background_color = [0, 0, 0] # black background + args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Initializes empty canvas, dungeon, and enemies collections.~ +** Processing line: ~ if decision[:option_four]~ - Inside source: true *** True Line Result - # Initializes empty canvas, dungeon, and enemies collections. -** Processing line: ~ state.canvas ||= []~ + if decision[:option_four] +** Processing line: ~ args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description~ - Inside source: true *** True Line Result - state.canvas ||= [] -** Processing line: ~ state.dungeon ||= []~ + args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description +** Processing line: ~ args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]~ - Inside source: true *** True Line Result - state.dungeon ||= [] -** Processing line: ~ state.enemies ||= []~ + args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.enemies ||= [] + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called~ +** Processing line: ~ # Uses keyboard input from the user to make a decision~ - Inside source: true *** True Line Result - # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called -** Processing line: ~ if !state.area~ + # Uses keyboard input from the user to make a decision +** Processing line: ~ # Assigns the decision as the value of the decision_id variable~ - Inside source: true *** True Line Result - if !state.area -** Processing line: ~ load_area_one~ + # Assigns the decision as the value of the decision_id variable +** Processing line: ~ def process_inputs args~ - Inside source: true *** True Line Result - load_area_one -** Processing line: ~ derive_dungeon_from_area~ + def process_inputs args +** Processing line: ~ decision = current_decision args # calls current_decision method~ - Inside source: true *** True Line Result - derive_dungeon_from_area + decision = current_decision args # calls current_decision method ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Changing these values will change the position of player~ +** Processing line: ~ if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists~ - Inside source: true *** True Line Result - # Changing these values will change the position of player -** Processing line: ~ state.x = 7~ + if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists +** Processing line: ~ args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id~ - Inside source: true *** True Line Result - state.x = 7 -** Processing line: ~ state.y = 5~ + args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.y = 5 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates new enemies, sets their values, and adds them to the enemies collection.~ -- Inside source: true -*** True Line Result - # Creates new enemies, sets their values, and adds them to the enemies collection. -** Processing line: ~ state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity~ -- Inside source: true -*** True Line Result - state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity -** Processing line: ~ e.x = 13 # position~ +** Processing line: ~ if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists~ - Inside source: true *** True Line Result - e.x = 13 # position -** Processing line: ~ e.y = 5~ + if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists +** Processing line: ~ args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id~ - Inside source: true *** True Line Result - e.y = 5 -** Processing line: ~ e.previous_hp = 3~ + args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id +** Processing line: ~ end~ - Inside source: true *** True Line Result - e.previous_hp = 3 -** Processing line: ~ e.hp = 3~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - e.hp = 3 -** Processing line: ~ e.max_hp = 3~ + +** Processing line: ~ if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists~ - Inside source: true *** True Line Result - e.max_hp = 3 -** Processing line: ~ e.is_dead = false # the enemy is alive~ + if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists +** Processing line: ~ args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id~ - Inside source: true *** True Line Result - e.is_dead = false # the enemy is alive -** Processing line: ~ end~ + args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ update_line_of_sight # updates line of sight by adding newly visible cells~ +** Processing line: ~ if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists~ - Inside source: true *** True Line Result - update_line_of_sight # updates line of sight by adding newly visible cells -** Processing line: ~ end~ + if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists +** Processing line: ~ args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id~ - Inside source: true *** True Line Result - end + args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Adds elements into the state.area collection~ +** Processing line: ~ # Uses decision_id's value to keep track of current decision being made~ - Inside source: true *** True Line Result - # Adds elements into the state.area collection -** Processing line: ~ # The dungeon is derived using the coordinates of this collection~ + # Uses decision_id's value to keep track of current decision being made +** Processing line: ~ def current_decision args~ - Inside source: true *** True Line Result - # The dungeon is derived using the coordinates of this collection -** Processing line: ~ def load_area_one~ + def current_decision args +** Processing line: ~ args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty~ - Inside source: true *** True Line Result - def load_area_one -** Processing line: ~ state.area ||= []~ + args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area ||= [] -** Processing line: ~ state.area << [8, 6]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [8, 6] -** Processing line: ~ state.area << [7, 6]~ + +** Processing line: ~ # Resets the game.~ - Inside source: true *** True Line Result - state.area << [7, 6] -** Processing line: ~ state.area << [7, 7]~ + # Resets the game. +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - state.area << [7, 7] -** Processing line: ~ state.area << [8, 9]~ + $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [8, 9] -** Processing line: ~ state.area << [7, 8]~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - state.area << [7, 8] -** Processing line: ~ state.area << [7, 9]~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - state.area << [7, 9] -** Processing line: ~ state.area << [6, 4]~ -- Inside source: true + +** Processing line: ~* Rpg Narrative - Return Of Serenity - lowrez_simulator.rb~ +- Header detected. *** True Line Result - state.area << [6, 4] -** Processing line: ~ state.area << [7, 3]~ -- Inside source: true + *** True Line Result - state.area << [7, 3] -** Processing line: ~ state.area << [7, 4]~ -- Inside source: true +* Rpg Narrative - Return Of Serenity - lowrez_simulator.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - state.area << [7, 4] -** Processing line: ~ state.area << [6, 5]~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb~ - Inside source: true *** True Line Result - state.area << [6, 5] -** Processing line: ~ state.area << [7, 5]~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb +** Processing line: ~ ###################################################################################~ - Inside source: true *** True Line Result - state.area << [7, 5] -** Processing line: ~ state.area << [8, 5]~ + ################################################################################### +** Processing line: ~ # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES~ - Inside source: true *** True Line Result - state.area << [8, 5] -** Processing line: ~ state.area << [8, 4]~ + # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES +** Processing line: ~ # THE 64x64 CANVAS.~ - Inside source: true *** True Line Result - state.area << [8, 4] -** Processing line: ~ state.area << [1, 1]~ + # THE 64x64 CANVAS. +** Processing line: ~ ###################################################################################~ - Inside source: true *** True Line Result - state.area << [1, 1] -** Processing line: ~ state.area << [0, 1]~ + ################################################################################### +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [0, 1] -** Processing line: ~ state.area << [0, 2]~ + +** Processing line: ~ TINY_RESOLUTION = 64~ - Inside source: true *** True Line Result - state.area << [0, 2] -** Processing line: ~ state.area << [1, 2]~ + TINY_RESOLUTION = 64 +** Processing line: ~ TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5)~ - Inside source: true *** True Line Result - state.area << [1, 2] -** Processing line: ~ state.area << [2, 2]~ + TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) +** Processing line: ~ CENTER_OFFSET = 10~ - Inside source: true *** True Line Result - state.area << [2, 2] -** Processing line: ~ state.area << [2, 1]~ + CENTER_OFFSET = 10 +** Processing line: ~ EMULATED_FONT_SIZE = 20~ - Inside source: true *** True Line Result - state.area << [2, 1] -** Processing line: ~ state.area << [2, 3]~ + EMULATED_FONT_SIZE = 20 +** Processing line: ~ EMULATED_FONT_X_ZERO = 0~ - Inside source: true *** True Line Result - state.area << [2, 3] -** Processing line: ~ state.area << [1, 3]~ + EMULATED_FONT_X_ZERO = 0 +** Processing line: ~ EMULATED_FONT_Y_ZERO = 46~ - Inside source: true *** True Line Result - state.area << [1, 3] -** Processing line: ~ state.area << [1, 4]~ + EMULATED_FONT_Y_ZERO = 46 +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [1, 4] -** Processing line: ~ state.area << [2, 4]~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - state.area << [2, 4] -** Processing line: ~ state.area << [2, 5]~ + def tick args +** Processing line: ~ sprites = []~ - Inside source: true *** True Line Result - state.area << [2, 5] -** Processing line: ~ state.area << [1, 5]~ + sprites = [] +** Processing line: ~ labels = []~ - Inside source: true *** True Line Result - state.area << [1, 5] -** Processing line: ~ state.area << [2, 6]~ + labels = [] +** Processing line: ~ borders = []~ - Inside source: true *** True Line Result - state.area << [2, 6] -** Processing line: ~ state.area << [3, 6]~ + borders = [] +** Processing line: ~ solids = []~ - Inside source: true *** True Line Result - state.area << [3, 6] -** Processing line: ~ state.area << [4, 6]~ + solids = [] +** Processing line: ~ mouse = emulate_lowrez_mouse args~ - Inside source: true *** True Line Result - state.area << [4, 6] -** Processing line: ~ state.area << [4, 7]~ + mouse = emulate_lowrez_mouse args +** Processing line: ~ args.state.show_gridlines = false~ - Inside source: true *** True Line Result - state.area << [4, 7] -** Processing line: ~ state.area << [4, 8]~ + args.state.show_gridlines = false +** Processing line: ~ lowrez_tick args, sprites, labels, borders, solids, mouse~ - Inside source: true *** True Line Result - state.area << [4, 8] -** Processing line: ~ state.area << [5, 8]~ + lowrez_tick args, sprites, labels, borders, solids, mouse +** Processing line: ~ render_gridlines_if_needed args~ - Inside source: true *** True Line Result - state.area << [5, 8] -** Processing line: ~ state.area << [5, 9]~ + render_gridlines_if_needed args +** Processing line: ~ render_mouse_crosshairs args, mouse~ - Inside source: true *** True Line Result - state.area << [5, 9] -** Processing line: ~ state.area << [6, 9]~ + render_mouse_crosshairs args, mouse +** Processing line: ~ emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ - Inside source: true *** True Line Result - state.area << [6, 9] -** Processing line: ~ state.area << [7, 10]~ + emulate_lowrez_scene args, sprites, labels, borders, solids, mouse +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area << [7, 10] -** Processing line: ~ state.area << [7, 11]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [7, 11] -** Processing line: ~ state.area << [7, 12]~ + +** Processing line: ~ def emulate_lowrez_mouse args~ - Inside source: true *** True Line Result - state.area << [7, 12] -** Processing line: ~ state.area << [7, 12]~ + def emulate_lowrez_mouse args +** Processing line: ~ args.state.new_entity_strict(:lowrez_mouse) do |m|~ - Inside source: true *** True Line Result - state.area << [7, 12] -** Processing line: ~ state.area << [7, 13]~ + args.state.new_entity_strict(:lowrez_mouse) do |m| +** Processing line: ~ m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1~ - Inside source: true *** True Line Result - state.area << [7, 13] -** Processing line: ~ state.area << [8, 13]~ + m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1 +** Processing line: ~ m.y = args.mouse.y.idiv(TINY_SCALE)~ - Inside source: true *** True Line Result - state.area << [8, 13] -** Processing line: ~ state.area << [9, 13]~ + m.y = args.mouse.y.idiv(TINY_SCALE) +** Processing line: ~ if args.mouse.click~ - Inside source: true *** True Line Result - state.area << [9, 13] -** Processing line: ~ state.area << [10, 13]~ + if args.mouse.click +** Processing line: ~ m.click = [~ - Inside source: true *** True Line Result - state.area << [10, 13] -** Processing line: ~ state.area << [11, 13]~ + m.click = [ +** Processing line: ~ args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ - Inside source: true *** True Line Result - state.area << [11, 13] -** Processing line: ~ state.area << [12, 13]~ + args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, +** Processing line: ~ args.mouse.click.point.y.idiv(TINY_SCALE)~ - Inside source: true *** True Line Result - state.area << [12, 13] -** Processing line: ~ state.area << [12, 12]~ + args.mouse.click.point.y.idiv(TINY_SCALE) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - state.area << [12, 12] -** Processing line: ~ state.area << [8, 12]~ + ] +** Processing line: ~ m.down = m.click~ - Inside source: true *** True Line Result - state.area << [8, 12] -** Processing line: ~ state.area << [9, 12]~ + m.down = m.click +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.area << [9, 12] -** Processing line: ~ state.area << [10, 12]~ + else +** Processing line: ~ m.click = nil~ - Inside source: true *** True Line Result - state.area << [10, 12] -** Processing line: ~ state.area << [11, 12]~ + m.click = nil +** Processing line: ~ m.down = nil~ - Inside source: true *** True Line Result - state.area << [11, 12] -** Processing line: ~ state.area << [12, 11]~ + m.down = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area << [12, 11] -** Processing line: ~ state.area << [13, 11]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [13, 11] -** Processing line: ~ state.area << [13, 10]~ + +** Processing line: ~ if args.mouse.up~ - Inside source: true *** True Line Result - state.area << [13, 10] -** Processing line: ~ state.area << [13, 9]~ + if args.mouse.up +** Processing line: ~ m.up = [~ - Inside source: true *** True Line Result - state.area << [13, 9] -** Processing line: ~ state.area << [13, 8]~ + m.up = [ +** Processing line: ~ args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ - Inside source: true *** True Line Result - state.area << [13, 8] -** Processing line: ~ state.area << [13, 7]~ + args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, +** Processing line: ~ args.mouse.up.point.y.idiv(TINY_SCALE)~ - Inside source: true *** True Line Result - state.area << [13, 7] -** Processing line: ~ state.area << [13, 6]~ -- Inside source: true -*** True Line Result - state.area << [13, 6] -** Processing line: ~ state.area << [12, 6]~ + args.mouse.up.point.y.idiv(TINY_SCALE) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - state.area << [12, 6] -** Processing line: ~ state.area << [14, 6]~ + ] +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.area << [14, 6] -** Processing line: ~ state.area << [14, 5]~ + else +** Processing line: ~ m.up = nil~ - Inside source: true *** True Line Result - state.area << [14, 5] -** Processing line: ~ state.area << [13, 5]~ + m.up = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area << [13, 5] -** Processing line: ~ state.area << [12, 5]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area << [12, 5] -** Processing line: ~ state.area << [12, 4]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.area << [12, 4] -** Processing line: ~ state.area << [13, 4]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.area << [13, 4] -** Processing line: ~ state.area << [14, 4]~ + +** Processing line: ~ def render_mouse_crosshairs args, mouse~ - Inside source: true *** True Line Result - state.area << [14, 4] -** Processing line: ~ state.area << [1, 6]~ + def render_mouse_crosshairs args, mouse +** Processing line: ~ return unless args.state.show_gridlines~ - Inside source: true *** True Line Result - state.area << [1, 6] -** Processing line: ~ state.area << [6, 6]~ + return unless args.state.show_gridlines +** Processing line: ~ args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]~ - Inside source: true *** True Line Result - state.area << [6, 6] -** Processing line: ~ end~ + args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Starts with an empty dungeon collection, and adds dungeon cells into it.~ +** Processing line: ~ def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ - Inside source: true *** True Line Result - # Starts with an empty dungeon collection, and adds dungeon cells into it. -** Processing line: ~ def derive_dungeon_from_area~ + def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse +** Processing line: ~ args.render_target(:lowrez).solids << [0, 0, 1280, 720]~ - Inside source: true *** True Line Result - def derive_dungeon_from_area -** Processing line: ~ state.dungeon = [] # starts as empty collection~ + args.render_target(:lowrez).solids << [0, 0, 1280, 720] +** Processing line: ~ args.render_target(:lowrez).sprites << sprites~ - Inside source: true *** True Line Result - state.dungeon = [] # starts as empty collection -** Processing line: ~~ + args.render_target(:lowrez).sprites << sprites +** Processing line: ~ args.render_target(:lowrez).borders << borders~ - Inside source: true *** True Line Result - -** Processing line: ~ state.area.each do |a| # for each element of the area collection~ + args.render_target(:lowrez).borders << borders +** Processing line: ~ args.render_target(:lowrez).solids << solids~ - Inside source: true *** True Line Result - state.area.each do |a| # for each element of the area collection -** Processing line: ~ state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity~ + args.render_target(:lowrez).solids << solids +** Processing line: ~ args.outputs.primitives << labels.map do |l|~ - Inside source: true *** True Line Result - state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity -** Processing line: ~ d.x = a.x # dungeon cell position using coordinates from area~ + args.outputs.primitives << labels.map do |l| +** Processing line: ~ as_label = l.label~ - Inside source: true *** True Line Result - d.x = a.x # dungeon cell position using coordinates from area -** Processing line: ~ d.y = a.y~ + as_label = l.label +** Processing line: ~ l.text.each_char.each_with_index.map do |char, i|~ - Inside source: true *** True Line Result - d.y = a.y -** Processing line: ~ d.is_visible = false # cell is not visible~ + l.text.each_char.each_with_index.map do |char, i| +** Processing line: ~ [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,~ - Inside source: true *** True Line Result - d.is_visible = false # cell is not visible -** Processing line: ~ d.alpha = 0 # not transparent at all~ + [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE, +** Processing line: ~ EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,~ - Inside source: true *** True Line Result - d.alpha = 0 # not transparent at all -** Processing line: ~ d.border = [left_margin + a.x * grid_size,~ + EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char, +** Processing line: ~ EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label~ - Inside source: true *** True Line Result - d.border = [left_margin + a.x * grid_size, -** Processing line: ~ bottom_margin + a.y * grid_size,~ + EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label +** Processing line: ~ end~ - Inside source: true *** True Line Result - bottom_margin + a.y * grid_size, -** Processing line: ~ grid_size,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ grid_size,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ *blue,~ + +** Processing line: ~ args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]~ - Inside source: true *** True Line Result - *blue, -** Processing line: ~ 255] # sets border definition for dungeon cell~ + args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] +** Processing line: ~ end~ - Inside source: true *** True Line Result - 255] # sets border definition for dungeon cell -** Processing line: ~ d # returns dungeon cell~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - d # returns dungeon cell -** Processing line: ~ end~ + +** Processing line: ~ def render_gridlines_if_needed args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def render_gridlines_if_needed args +** Processing line: ~ if args.state.show_gridlines && args.static_lines.length == 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if args.state.show_gridlines && args.static_lines.length == 0 +** Processing line: ~ args.static_lines << 65.times.map do |i|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.static_lines << 65.times.map do |i| +** Processing line: ~ [~ - Inside source: true *** True Line Result - -** Processing line: ~ def left_margin~ + [ +** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE + 1, 0,~ - Inside source: true *** True Line Result - def left_margin -** Processing line: ~ 40 # sets left margin~ + [CENTER_OFFSET + i * TINY_SCALE + 1, 0, +** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],~ - Inside source: true *** True Line Result - 40 # sets left margin -** Processing line: ~ end~ + CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], +** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE, 0,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [CENTER_OFFSET + i * TINY_SCALE, 0, +** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],~ - Inside source: true *** True Line Result - -** Processing line: ~ def bottom_margin~ + CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], +** Processing line: ~ [CENTER_OFFSET, 0 + i * TINY_SCALE,~ - Inside source: true *** True Line Result - def bottom_margin -** Processing line: ~ 60 # sets bottom margin~ + [CENTER_OFFSET, 0 + i * TINY_SCALE, +** Processing line: ~ CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],~ - Inside source: true *** True Line Result - 60 # sets bottom margin -** Processing line: ~ end~ + CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], +** Processing line: ~ [CENTER_OFFSET, 1 + i * TINY_SCALE,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [CENTER_OFFSET, 1 + i * TINY_SCALE, +** Processing line: ~ CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]~ - Inside source: true *** True Line Result - -** Processing line: ~ def grid_size~ + CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def grid_size -** Processing line: ~ 40 # sets size of grid square~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - 40 # sets size of grid square + end +** Processing line: ~ elsif !args.state.show_gridlines~ +- Inside source: true +*** True Line Result + elsif !args.state.show_gridlines +** Processing line: ~ args.static_lines.clear~ +- Inside source: true +*** True Line Result + args.static_lines.clear ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Updates the line of sight by calling the thick_line_of_sight method and~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - # Updates the line of sight by calling the thick_line_of_sight method and -** Processing line: ~ # adding dungeon cells to the newly_visible collection~ +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Return Of Serenity - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Return Of Serenity - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb~ - Inside source: true *** True Line Result - # adding dungeon cells to the newly_visible collection -** Processing line: ~ def update_line_of_sight~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb +** Processing line: ~ require 'app/require.rb'~ - Inside source: true *** True Line Result - def update_line_of_sight -** Processing line: ~ variations = [-1, 0, 1]~ + require 'app/require.rb' +** Processing line: ~~ - Inside source: true *** True Line Result - variations = [-1, 0, 1] -** Processing line: ~ # creates collection of newly visible dungeon cells~ + +** Processing line: ~ def defaults args~ - Inside source: true *** True Line Result - # creates collection of newly visible dungeon cells -** Processing line: ~ newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements~ + def defaults args +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ - Inside source: true *** True Line Result - newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements -** Processing line: ~ thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method~ + args.outputs.background_color = [0, 0, 0] +** Processing line: ~ args.state.last_story_line_text ||= ""~ - Inside source: true *** True Line Result - thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method -** Processing line: ~ lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists~ + args.state.last_story_line_text ||= "" +** Processing line: ~ args.state.scene_history ||= []~ - Inside source: true *** True Line Result - lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists -** Processing line: ~ end.uniq# removes duplicates~ + args.state.scene_history ||= [] +** Processing line: ~ args.state.storyline_history ||= []~ - Inside source: true *** True Line Result - end.uniq# removes duplicates -** Processing line: ~~ + args.state.storyline_history ||= [] +** Processing line: ~ args.state.word_delay ||= 8~ - Inside source: true *** True Line Result - -** Processing line: ~ state.dungeon.each do |d| # perform action on each element of dungeons collection~ + args.state.word_delay ||= 8 +** Processing line: ~ if args.state.tick_count == 0~ - Inside source: true *** True Line Result - state.dungeon.each do |d| # perform action on each element of dungeons collection -** Processing line: ~ d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection~ + if args.state.tick_count == 0 +** Processing line: ~ args.gtk.stop_music~ - Inside source: true *** True Line Result - d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection -** Processing line: ~ end~ + args.gtk.stop_music +** Processing line: ~ args.outputs.sounds << 'sounds/static-loop.ogg'~ - Inside source: true *** True Line Result - end + args.outputs.sounds << 'sounds/static-loop.ogg' ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -73789,238 +74028,214 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ #Returns a boolean value~ +** Processing line: ~ if args.state.last_story_line_text~ - Inside source: true *** True Line Result - #Returns a boolean value -** Processing line: ~ def dungeon_cell_exists? x, y~ + if args.state.last_story_line_text +** Processing line: ~ lines = args.state~ - Inside source: true *** True Line Result - def dungeon_cell_exists? x, y -** Processing line: ~ # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists~ + lines = args.state +** Processing line: ~ .last_story_line_text~ - Inside source: true *** True Line Result - # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists -** Processing line: ~ state.dungeon.find { |d| d.x == x && d.y == y }~ + .last_story_line_text +** Processing line: ~ .gsub("-", "")~ - Inside source: true *** True Line Result - state.dungeon.find { |d| d.x == x && d.y == y } -** Processing line: ~ end~ + .gsub("-", "") +** Processing line: ~ .gsub("~", "")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + .gsub("~", "") +** Processing line: ~ .wrapped_lines(50)~ - Inside source: true *** True Line Result - -** Processing line: ~ # Calls line_of_sight method to add elements to result collection~ + .wrapped_lines(50) +** Processing line: ~~ - Inside source: true *** True Line Result - # Calls line_of_sight method to add elements to result collection -** Processing line: ~ def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ + +** Processing line: ~ args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }~ - Inside source: true *** True Line Result - def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda -** Processing line: ~ result = []~ + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } +** Processing line: ~ elsif args.state.storyline_history[-1]~ - Inside source: true *** True Line Result - result = [] -** Processing line: ~ result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ + elsif args.state.storyline_history[-1] +** Processing line: ~ lines = args.state~ - Inside source: true *** True Line Result - result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda -** Processing line: ~ result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left~ + lines = args.state +** Processing line: ~ .storyline_history[-1]~ - Inside source: true *** True Line Result - result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left -** Processing line: ~ result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right~ + .storyline_history[-1] +** Processing line: ~ .gsub("-", "")~ - Inside source: true *** True Line Result - result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right -** Processing line: ~ result~ + .gsub("-", "") +** Processing line: ~ .gsub("~", "")~ - Inside source: true *** True Line Result - result -** Processing line: ~ end~ + .gsub("~", "") +** Processing line: ~ .wrapped_lines(50)~ - Inside source: true *** True Line Result - end + .wrapped_lines(50) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Adds points to the result collection to create the player's line of sight~ +** Processing line: ~ args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }~ - Inside source: true *** True Line Result - # Adds points to the result collection to create the player's line of sight -** Processing line: ~ def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } +** Processing line: ~ end~ - Inside source: true *** True Line Result - def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda -** Processing line: ~ result = [] # starts as empty collection~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - result = [] # starts as empty collection -** Processing line: ~ points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method~ + +** Processing line: ~ return if args.state.current_scene~ - Inside source: true *** True Line Result - points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method -** Processing line: ~ points.each do |p| # for each point in collection~ + return if args.state.current_scene +** Processing line: ~ set_scene(args, day_one_beginning(args))~ - Inside source: true *** True Line Result - points.each do |p| # for each point in collection -** Processing line: ~ if cell_exists_lambda.call(p.x, p.y) # if the cell exists~ + set_scene(args, day_one_beginning(args)) +** Processing line: ~ end~ - Inside source: true *** True Line Result - if cell_exists_lambda.call(p.x, p.y) # if the cell exists -** Processing line: ~ result << p # add it to result collection~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - result << p # add it to result collection -** Processing line: ~ else # if cell does not exist~ + +** Processing line: ~ def inputs_move_player args~ - Inside source: true *** True Line Result - else # if cell does not exist -** Processing line: ~ return result # return result collection as it is~ + def inputs_move_player args +** Processing line: ~ if args.state.scene_changed_at.elapsed_time > 5~ - Inside source: true *** True Line Result - return result # return result collection as it is -** Processing line: ~ end~ + if args.state.scene_changed_at.elapsed_time > 5 +** Processing line: ~ if args.keyboard.down || args.keyboard.s || args.keyboard.j~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if args.keyboard.down || args.keyboard.s || args.keyboard.j +** Processing line: ~ args.state.player.y -= 0.25~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.player.y -= 0.25 +** Processing line: ~ elsif args.keyboard.up || args.keyboard.w || args.keyboard.k~ - Inside source: true *** True Line Result - -** Processing line: ~ result # return result collection~ + elsif args.keyboard.up || args.keyboard.w || args.keyboard.k +** Processing line: ~ args.state.player.y += 0.25~ - Inside source: true *** True Line Result - result # return result collection -** Processing line: ~ end~ + args.state.player.y += 0.25 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Finds the coordinates of the points on the line by performing calculations~ +** Processing line: ~ if args.keyboard.left || args.keyboard.a || args.keyboard.h~ - Inside source: true *** True Line Result - # Finds the coordinates of the points on the line by performing calculations -** Processing line: ~ def points_on_line start_x, start_y, rise, run, distance~ + if args.keyboard.left || args.keyboard.a || args.keyboard.h +** Processing line: ~ args.state.player.x -= 0.25~ - Inside source: true *** True Line Result - def points_on_line start_x, start_y, rise, run, distance -** Processing line: ~ distance.times.map do |i| # perform an action~ + args.state.player.x -= 0.25 +** Processing line: ~ elsif args.keyboard.right || args.keyboard.d || args.keyboard.l~ - Inside source: true *** True Line Result - distance.times.map do |i| # perform an action -** Processing line: ~ [start_x + run * i, start_y + rise * i] # definition of point~ + elsif args.keyboard.right || args.keyboard.d || args.keyboard.l +** Processing line: ~ args.state.player.x += 0.25~ - Inside source: true *** True Line Result - [start_x + run * i, start_y + rise * i] # definition of point + args.state.player.x += 0.25 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_canvas~ -- Inside source: true -*** True Line Result - def render_canvas -** Processing line: ~ return~ +** Processing line: ~ args.state.player.y = 60 if args.state.player.y > 63~ - Inside source: true *** True Line Result - return -** Processing line: ~ outputs.borders << state.canvas.map do |c| # on each element of canvas collection~ + args.state.player.y = 60 if args.state.player.y > 63 +** Processing line: ~ args.state.player.y = 0 if args.state.player.y < -3~ - Inside source: true *** True Line Result - outputs.borders << state.canvas.map do |c| # on each element of canvas collection -** Processing line: ~ c.border # outputs border~ + args.state.player.y = 0 if args.state.player.y < -3 +** Processing line: ~ args.state.player.x = 60 if args.state.player.x > 63~ - Inside source: true *** True Line Result - c.border # outputs border -** Processing line: ~ end~ + args.state.player.x = 60 if args.state.player.x > 63 +** Processing line: ~ args.state.player.x = 0 if args.state.player.x < -3~ - Inside source: true *** True Line Result - end + args.state.player.x = 0 if args.state.player.x < -3 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # Outputs the dungeon cells.~ -- Inside source: true -*** True Line Result - # Outputs the dungeon cells. -** Processing line: ~ def render_dungeon~ -- Inside source: true -*** True Line Result - def render_dungeon -** Processing line: ~ outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method.~ -- Inside source: true -*** True Line Result - # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method. -** Processing line: ~ outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection~ +** Processing line: ~ def null_or_empty? ary~ - Inside source: true *** True Line Result - outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection -** Processing line: ~ d.alpha += if d.is_visible # if cell is visible~ + def null_or_empty? ary +** Processing line: ~ return true unless ary~ - Inside source: true *** True Line Result - d.alpha += if d.is_visible # if cell is visible -** Processing line: ~ 255.fdiv(30) # increment opacity (transparency)~ + return true unless ary +** Processing line: ~ return true if ary.length == 0~ - Inside source: true *** True Line Result - 255.fdiv(30) # increment opacity (transparency) -** Processing line: ~ else # if cell is not visible~ + return true if ary.length == 0 +** Processing line: ~ return false~ - Inside source: true *** True Line Result - else # if cell is not visible -** Processing line: ~ 255.fdiv(600) * -1 # decrease opacity~ + return false +** Processing line: ~ end~ - Inside source: true *** True Line Result - 255.fdiv(600) * -1 # decrease opacity -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ d.alpha = d.alpha.cap_min_max(0, 255)~ + +** Processing line: ~ def calc_storyline_hotspot args~ - Inside source: true *** True Line Result - d.alpha = d.alpha.cap_min_max(0, 255) -** Processing line: ~ cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value~ + def calc_storyline_hotspot args +** Processing line: ~ hotspots = args.state.storylines.find_all do |hs|~ - Inside source: true *** True Line Result - cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value -** Processing line: ~ end.reject_nil~ + hotspots = args.state.storylines.find_all do |hs| +** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ - Inside source: true *** True Line Result - end.reject_nil + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -74029,66 +74244,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets definition of a cell border using the parameters~ +** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot~ - Inside source: true *** True Line Result - # Sets definition of a cell border using the parameters -** Processing line: ~ def cell_border x, y, color = nil~ + if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot +** Processing line: ~ _, _, _, _, storyline = hotspots.first~ - Inside source: true *** True Line Result - def cell_border x, y, color = nil -** Processing line: ~ [left_margin + x * grid_size,~ + _, _, _, _, storyline = hotspots.first +** Processing line: ~ queue_storyline_text(args, storyline)~ - Inside source: true *** True Line Result - [left_margin + x * grid_size, -** Processing line: ~ bottom_margin + y * grid_size,~ + queue_storyline_text(args, storyline) +** Processing line: ~ args.state.inside_storyline_hotspot = true~ - Inside source: true *** True Line Result - bottom_margin + y * grid_size, -** Processing line: ~ grid_size,~ + args.state.inside_storyline_hotspot = true +** Processing line: ~ elsif null_or_empty?(hotspots)~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ grid_size,~ + elsif null_or_empty?(hotspots) +** Processing line: ~ args.state.inside_storyline_hotspot = false~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ *color]~ + args.state.inside_storyline_hotspot = false +** Processing line: ~~ - Inside source: true *** True Line Result - *color] -** Processing line: ~ end~ + +** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.storyline_queue_empty_at ||= args.state.tick_count +** Processing line: ~ args.state.is_storyline_dialog_active = false~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets the values for the player and outputs it as a label~ + args.state.is_storyline_dialog_active = false +** Processing line: ~ args.state.scene_storyline_queue.clear~ - Inside source: true *** True Line Result - # Sets the values for the player and outputs it as a label -** Processing line: ~ def render_player~ + args.state.scene_storyline_queue.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - def render_player -** Processing line: ~ outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square -** Processing line: ~ grid_y(state.y) + 35,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - grid_y(state.y) + 35, -** Processing line: ~ "@", # player is represented by a white "@" character~ + +** Processing line: ~ def calc_scenes args~ - Inside source: true *** True Line Result - "@", # player is represented by a white "@" character -** Processing line: ~ 1, 1, *white]~ + def calc_scenes args +** Processing line: ~ hotspots = args.state.scenes.find_all do |hs|~ - Inside source: true *** True Line Result - 1, 1, *white] + hotspots = args.state.scenes.find_all do |hs| +** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ +- Inside source: true +*** True Line Result + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -74097,262 +74316,314 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def grid_x x~ +** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot~ - Inside source: true *** True Line Result - def grid_x x -** Processing line: ~ left_margin + x * grid_size # positions horizontally on grid~ + if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot +** Processing line: ~ _, _, _, _, scene_method_or_hash = hotspots.first~ - Inside source: true *** True Line Result - left_margin + x * grid_size # positions horizontally on grid -** Processing line: ~ end~ + _, _, _, _, scene_method_or_hash = hotspots.first +** Processing line: ~ if scene_method_or_hash.is_a? Symbol~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if scene_method_or_hash.is_a? Symbol +** Processing line: ~ set_scene(args, send(scene_method_or_hash, args))~ - Inside source: true *** True Line Result - -** Processing line: ~ def grid_y y~ + set_scene(args, send(scene_method_or_hash, args)) +** Processing line: ~ args.state.last_hotspot_scene = scene_method_or_hash~ - Inside source: true *** True Line Result - def grid_y y -** Processing line: ~ bottom_margin + y * grid_size # positions vertically on grid~ + args.state.last_hotspot_scene = scene_method_or_hash +** Processing line: ~ args.state.scene_history << scene_method_or_hash~ - Inside source: true *** True Line Result - bottom_margin + y * grid_size # positions vertically on grid + args.state.scene_history << scene_method_or_hash +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ set_scene(args, scene_method_or_hash)~ +- Inside source: true +*** True Line Result + set_scene(args, scene_method_or_hash) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ args.state.inside_scene_hotspot = true~ +- Inside source: true +*** True Line Result + args.state.inside_scene_hotspot = true +** Processing line: ~ elsif null_or_empty?(hotspots)~ +- Inside source: true +*** True Line Result + elsif null_or_empty?(hotspots) +** Processing line: ~ args.state.inside_scene_hotspot = false~ +- Inside source: true +*** True Line Result + args.state.inside_scene_hotspot = false ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs enemies onto the screen.~ +** Processing line: ~ def null_or_whitespace? word~ - Inside source: true *** True Line Result - # Outputs enemies onto the screen. -** Processing line: ~ def render_enemies~ + def null_or_whitespace? word +** Processing line: ~ return true if !word~ - Inside source: true *** True Line Result - def render_enemies -** Processing line: ~ state.enemies.map do |e| # for each enemy in the collection~ + return true if !word +** Processing line: ~ return true if word.strip.length == 0~ - Inside source: true *** True Line Result - state.enemies.map do |e| # for each enemy in the collection -** Processing line: ~ alpha = 255 # set opacity (full transparency)~ + return true if word.strip.length == 0 +** Processing line: ~ return false~ - Inside source: true *** True Line Result - alpha = 255 # set opacity (full transparency) + return false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Outputs an enemy using a label.~ +** Processing line: ~ def calc_storyline_presentation args~ - Inside source: true *** True Line Result - # Outputs an enemy using a label. -** Processing line: ~ outputs.labels << [~ + def calc_storyline_presentation args +** Processing line: ~ return unless args.state.tick_count > args.state.next_storyline~ - Inside source: true *** True Line Result - outputs.labels << [ -** Processing line: ~ left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square~ + return unless args.state.tick_count > args.state.next_storyline +** Processing line: ~ return unless args.state.scene_storyline_queue~ - Inside source: true *** True Line Result - left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square -** Processing line: ~ bottom_margin + 35 + e.y * grid_size,~ + return unless args.state.scene_storyline_queue +** Processing line: ~ next_storyline = args.state.scene_storyline_queue.shift~ - Inside source: true *** True Line Result - bottom_margin + 35 + e.y * grid_size, -** Processing line: ~ "r", # enemy's text~ + next_storyline = args.state.scene_storyline_queue.shift +** Processing line: ~ if null_or_whitespace? next_storyline~ - Inside source: true *** True Line Result - "r", # enemy's text -** Processing line: ~ 1, 1, *white, alpha]~ + if null_or_whitespace? next_storyline +** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ - Inside source: true *** True Line Result - 1, 1, *white, alpha] -** Processing line: ~~ + args.state.storyline_queue_empty_at ||= args.state.tick_count +** Processing line: ~ args.state.is_storyline_dialog_active = false~ - Inside source: true *** True Line Result - -** Processing line: ~ # Creates a red border around an enemy.~ + args.state.is_storyline_dialog_active = false +** Processing line: ~ return~ - Inside source: true *** True Line Result - # Creates a red border around an enemy. -** Processing line: ~ outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red]~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red] -** Processing line: ~ end~ + end +** Processing line: ~ args.state.storyline_to_show = next_storyline~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.storyline_to_show = next_storyline +** Processing line: ~ args.state.is_storyline_dialog_active = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.is_storyline_dialog_active = true +** Processing line: ~ args.state.storyline_queue_empty_at = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ #White labels are output for the cell coordinates of each element in the dungeon collection.~ + args.state.storyline_queue_empty_at = nil +** Processing line: ~ if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")~ - Inside source: true *** True Line Result - #White labels are output for the cell coordinates of each element in the dungeon collection. -** Processing line: ~ def print_cell_coordinates~ + if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") +** Processing line: ~ args.state.next_storyline += 60~ - Inside source: true *** True Line Result - def print_cell_coordinates -** Processing line: ~ return unless state.debug~ + args.state.next_storyline += 60 +** Processing line: ~ elsif next_storyline.end_with?(",")~ - Inside source: true *** True Line Result - return unless state.debug -** Processing line: ~ state.dungeon.each do |d|~ + elsif next_storyline.end_with?(",") +** Processing line: ~ args.state.next_storyline += 50~ - Inside source: true *** True Line Result - state.dungeon.each do |d| -** Processing line: ~ outputs.labels << [grid_x(d.x) + 2,~ + args.state.next_storyline += 50 +** Processing line: ~ elsif next_storyline.end_with?(":")~ - Inside source: true *** True Line Result - outputs.labels << [grid_x(d.x) + 2, -** Processing line: ~ grid_y(d.y) - 2,~ + elsif next_storyline.end_with?(":") +** Processing line: ~ args.state.next_storyline += 60~ - Inside source: true *** True Line Result - grid_y(d.y) - 2, -** Processing line: ~ "#{d.x},#{d.y}",~ + args.state.next_storyline += 60 +** Processing line: ~ else~ - Inside source: true *** True Line Result - "#{d.x},#{d.y}", -** Processing line: ~ -2, 0, *white]~ + else +** Processing line: ~ default_word_delay = 13 + args.state.word_delay - 8~ - Inside source: true *** True Line Result - -2, 0, *white] + default_word_delay = 13 + args.state.word_delay - 8 +** Processing line: ~ if next_storyline.gsub("-", "").gsub("~", "").length <= 4~ +- Inside source: true +*** True Line Result + if next_storyline.gsub("-", "").gsub("~", "").length <= 4 +** Processing line: ~ default_word_delay = 11 + args.state.word_delay - 8~ +- Inside source: true +*** True Line Result + default_word_delay = 11 + args.state.word_delay - 8 ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length~ +- Inside source: true +*** True Line Result + number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length +** Processing line: ~ args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)~ +- Inside source: true +*** True Line Result + args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Adds new elements into the canvas collection and sets their values.~ +** Processing line: ~ def inputs_reload_current_scene args~ - Inside source: true *** True Line Result - # Adds new elements into the canvas collection and sets their values. -** Processing line: ~ def calc_canvas~ + def inputs_reload_current_scene args +** Processing line: ~ return~ - Inside source: true *** True Line Result - def calc_canvas -** Processing line: ~ return if state.canvas.length > 0 # return if canvas collection has at least one element~ + return +** Processing line: ~ if args.inputs.keyboard.key_down.r!~ - Inside source: true *** True Line Result - return if state.canvas.length > 0 # return if canvas collection has at least one element -** Processing line: ~ 15.times do |x| # 15 times perform an action~ + if args.inputs.keyboard.key_down.r! +** Processing line: ~ reload_current_scene~ - Inside source: true *** True Line Result - 15.times do |x| # 15 times perform an action -** Processing line: ~ 15.times do |y|~ + reload_current_scene +** Processing line: ~ end~ - Inside source: true *** True Line Result - 15.times do |y| -** Processing line: ~ state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity -** Processing line: ~ c.x = x # set position~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - c.x = x # set position -** Processing line: ~ c.y = y~ + +** Processing line: ~ def inputs_dismiss_current_storyline args~ - Inside source: true *** True Line Result - c.y = y -** Processing line: ~ c.border = [left_margin + x * grid_size,~ + def inputs_dismiss_current_storyline args +** Processing line: ~ if args.inputs.keyboard.key_down.x!~ - Inside source: true *** True Line Result - c.border = [left_margin + x * grid_size, -** Processing line: ~ bottom_margin + y * grid_size,~ + if args.inputs.keyboard.key_down.x! +** Processing line: ~ args.state.scene_storyline_queue.clear~ - Inside source: true *** True Line Result - bottom_margin + y * grid_size, -** Processing line: ~ grid_size,~ + args.state.scene_storyline_queue.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ grid_size,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - grid_size, -** Processing line: ~ *white, 30] # sets border definition~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - *white, 30] # sets border definition -** Processing line: ~ end~ + +** Processing line: ~ def inputs_restart_game args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def inputs_restart_game args +** Processing line: ~ if args.inputs.keyboard.exclamation_point~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if args.inputs.keyboard.exclamation_point +** Processing line: ~ args.gtk.reset_state~ - Inside source: true *** True Line Result - end + args.gtk.reset_state ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Updates x and y values of the player, and updates player's line of sight~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Updates x and y values of the player, and updates player's line of sight -** Processing line: ~ def input_move~ + +** Processing line: ~ def inputs_change_word_delay args~ - Inside source: true *** True Line Result - def input_move -** Processing line: ~ x, y, x_diff, y_diff = input_target_cell~ + def inputs_change_word_delay args +** Processing line: ~ if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign~ - Inside source: true *** True Line Result - x, y, x_diff, y_diff = input_target_cell -** Processing line: ~~ + if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign +** Processing line: ~ args.state.word_delay -= 2~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location~ + args.state.word_delay -= 2 +** Processing line: ~ if args.state.word_delay < 0~ - Inside source: true *** True Line Result - return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location -** Processing line: ~ return if enemy_at x, y # player can't move there if there is an enemy in that location~ + if args.state.word_delay < 0 +** Processing line: ~ args.state.word_delay = 0~ - Inside source: true *** True Line Result - return if enemy_at x, y # player can't move there if there is an enemy in that location -** Processing line: ~~ + args.state.word_delay = 0 +** Processing line: ~ # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"~ - Inside source: true *** True Line Result - -** Processing line: ~ state.x += x_diff # increments x by x_diff (so player moves left or right)~ + # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.x += x_diff # increments x by x_diff (so player moves left or right) -** Processing line: ~ state.y += y_diff # same with y and y_diff ( so player moves up or down)~ + else +** Processing line: ~ # queue_storyline_text args, "Text speed INCREASED."~ - Inside source: true *** True Line Result - state.y += y_diff # same with y and y_diff ( so player moves up or down) -** Processing line: ~ update_line_of_sight # updates visible cells~ + # queue_storyline_text args, "Text speed INCREASED." +** Processing line: ~ end~ - Inside source: true *** True Line Result - update_line_of_sight # updates visible cells + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -74361,306 +74632,318 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def enemy_at x, y~ +** Processing line: ~ if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore~ - Inside source: true *** True Line Result - def enemy_at x, y -** Processing line: ~ # Finds if coordinates exist in enemies collection and enemy is not dead~ + if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore +** Processing line: ~ args.state.word_delay += 2~ - Inside source: true *** True Line Result - # Finds if coordinates exist in enemies collection and enemy is not dead -** Processing line: ~ state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead }~ + args.state.word_delay += 2 +** Processing line: ~ # queue_storyline_text args, "Text speed DECREASED."~ - Inside source: true *** True Line Result - state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead } + # queue_storyline_text args, "Text speed DECREASED." ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ #M oves the user based on their keyboard input and sets values for target cell~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - #M oves the user based on their keyboard input and sets values for target cell -** Processing line: ~ def input_target_cell~ + +** Processing line: ~ def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil~ - Inside source: true *** True Line Result - def input_target_cell -** Processing line: ~ if inputs.keyboard.key_down.up # if "up" key is in "down" state~ + def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil +** Processing line: ~ texts.each_with_index.map do |t, i|~ - Inside source: true *** True Line Result - if inputs.keyboard.key_down.up # if "up" key is in "down" state -** Processing line: ~ [state.x, state.y + 1, 0, 1] # user moves up~ + texts.each_with_index.map do |t, i| +** Processing line: ~ [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]~ - Inside source: true *** True Line Result - [state.x, state.y + 1, 0, 1] # user moves up -** Processing line: ~ elsif inputs.keyboard.key_down.down # if "down" key is pressed~ + [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.down # if "down" key is pressed -** Processing line: ~ [state.x, state.y - 1, 0, -1] # user moves down~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [state.x, state.y - 1, 0, -1] # user moves down -** Processing line: ~ elsif inputs.keyboard.key_down.left # if "left" key is pressed~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.left # if "left" key is pressed -** Processing line: ~ [state.x - 1, state.y, -1, 0] # user moves left~ + +** Processing line: ~ def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse~ - Inside source: true *** True Line Result - [state.x - 1, state.y, -1, 0] # user moves left -** Processing line: ~ elsif inputs.keyboard.key_down.right # if "right" key is pressed~ + def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse +** Processing line: ~ # args.state.show_gridlines = true~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_down.right # if "right" key is pressed -** Processing line: ~ [state.x + 1, state.y, 1, 0] # user moves right~ + # args.state.show_gridlines = true +** Processing line: ~ defaults args~ - Inside source: true *** True Line Result - [state.x + 1, state.y, 1, 0] # user moves right -** Processing line: ~ else~ + defaults args +** Processing line: ~ render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - else -** Processing line: ~ nil # otherwise, empty~ + render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ render_controller args, lowrez_borders~ - Inside source: true *** True Line Result - nil # otherwise, empty -** Processing line: ~ end~ + render_controller args, lowrez_borders +** Processing line: ~ lowrez_solids << [0, 0, 64, 64, 0, 0, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + lowrez_solids << [0, 0, 64, 64, 0, 0, 0] +** Processing line: ~ calc_storyline_presentation args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + calc_storyline_presentation args +** Processing line: ~ calc_scenes args~ - Inside source: true *** True Line Result - -** Processing line: ~ # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element.~ + calc_scenes args +** Processing line: ~ calc_storyline_hotspot args~ - Inside source: true *** True Line Result - # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element. -** Processing line: ~ def input_click_map~ + calc_storyline_hotspot args +** Processing line: ~ inputs_move_player args~ - Inside source: true *** True Line Result - def input_click_map -** Processing line: ~ return unless inputs.mouse.click # return unless the mouse is clicked~ + inputs_move_player args +** Processing line: ~ inputs_print_mouse_rect args, lowrez_mouse~ - Inside source: true *** True Line Result - return unless inputs.mouse.click # return unless the mouse is clicked -** Processing line: ~ canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements~ + inputs_print_mouse_rect args, lowrez_mouse +** Processing line: ~ inputs_reload_current_scene args~ - Inside source: true *** True Line Result - canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements -** Processing line: ~ inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of~ + inputs_reload_current_scene args +** Processing line: ~ inputs_dismiss_current_storyline args~ - Inside source: true *** True Line Result - inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of -** Processing line: ~ end~ + inputs_dismiss_current_storyline args +** Processing line: ~ inputs_change_word_delay args~ - Inside source: true *** True Line Result - end -** Processing line: ~ puts canvas_entry # prints canvas_entry value~ + inputs_change_word_delay args +** Processing line: ~ inputs_restart_game args~ - Inside source: true *** True Line Result - puts canvas_entry # prints canvas_entry value -** Processing line: ~ end~ + inputs_restart_game args +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the definition of a label using the parameters.~ +** Processing line: ~ def render_controller args, lowrez_borders~ - Inside source: true *** True Line Result - # Sets the definition of a label using the parameters. -** Processing line: ~ def label text, x, y, color = nil~ + def render_controller args, lowrez_borders +** Processing line: ~ args.state.up_button = [85, 40, 15, 15, 255, 255, 255]~ - Inside source: true *** True Line Result - def label text, x, y, color = nil -** Processing line: ~ color ||= white # color is initialized to white~ + args.state.up_button = [85, 40, 15, 15, 255, 255, 255] +** Processing line: ~ args.state.down_button = [85, 20, 15, 15, 255, 255, 255]~ - Inside source: true *** True Line Result - color ||= white # color is initialized to white -** Processing line: ~ [x, y, text, 1, 1, *color] # sets label definition~ + args.state.down_button = [85, 20, 15, 15, 255, 255, 255] +** Processing line: ~ args.state.left_button = [65, 20, 15, 15, 255, 255, 255]~ - Inside source: true *** True Line Result - [x, y, text, 1, 1, *color] # sets label definition -** Processing line: ~ end~ + args.state.left_button = [65, 20, 15, 15, 255, 255, 255] +** Processing line: ~ args.state.right_button = [105, 20, 15, 15, 255, 255, 255]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.right_button = [105, 20, 15, 15, 255, 255, 255] +** Processing line: ~ lowrez_borders << args.state.up_button~ - Inside source: true *** True Line Result - -** Processing line: ~ def green~ + lowrez_borders << args.state.up_button +** Processing line: ~ lowrez_borders << args.state.down_button~ - Inside source: true *** True Line Result - def green -** Processing line: ~ [60, 200, 100] # sets color saturation to shade of green~ + lowrez_borders << args.state.down_button +** Processing line: ~ lowrez_borders << args.state.left_button~ - Inside source: true *** True Line Result - [60, 200, 100] # sets color saturation to shade of green -** Processing line: ~ end~ + lowrez_borders << args.state.left_button +** Processing line: ~ lowrez_borders << args.state.right_button~ - Inside source: true *** True Line Result - end + lowrez_borders << args.state.right_button +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def blue~ +** Processing line: ~ def inputs_print_mouse_rect args, lowrez_mouse~ - Inside source: true *** True Line Result - def blue -** Processing line: ~ [50, 50, 210] # sets color saturation to shade of blue~ + def inputs_print_mouse_rect args, lowrez_mouse +** Processing line: ~ if lowrez_mouse.up~ - Inside source: true *** True Line Result - [50, 50, 210] # sets color saturation to shade of blue -** Processing line: ~ end~ + if lowrez_mouse.up +** Processing line: ~ args.state.mouse_held = false~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + args.state.mouse_held = false +** Processing line: ~ elsif lowrez_mouse.click~ - Inside source: true *** True Line Result - -** Processing line: ~ def white~ + elsif lowrez_mouse.click +** Processing line: ~ mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]~ - Inside source: true *** True Line Result - def white -** Processing line: ~ [255, 255, 255] # sets color saturation to white~ + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] +** Processing line: ~ if args.state.up_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - [255, 255, 255] # sets color saturation to white -** Processing line: ~ end~ + if args.state.up_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.y += 1~ - Inside source: true *** True Line Result - end + args.state.player.y += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def red~ +** Processing line: ~ if args.state.down_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - def red -** Processing line: ~ [230, 80, 80] # sets color saturation to shade of red~ + if args.state.down_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.y -= 1~ - Inside source: true *** True Line Result - [230, 80, 80] # sets color saturation to shade of red -** Processing line: ~ end~ + args.state.player.y -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def orange~ +** Processing line: ~ if args.state.left_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - def orange -** Processing line: ~ [255, 80, 60] # sets color saturation to shade of orange~ + if args.state.left_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.x -= 1~ - Inside source: true *** True Line Result - [255, 80, 60] # sets color saturation to shade of orange -** Processing line: ~ end~ + args.state.player.x -= 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def pink~ +** Processing line: ~ if args.state.right_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - def pink -** Processing line: ~ [255, 0, 200] # sets color saturation to shade of pink~ + if args.state.right_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.x += 1~ - Inside source: true *** True Line Result - [255, 0, 200] # sets color saturation to shade of pink -** Processing line: ~ end~ + args.state.player.x += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ args.state.mouse_held = true~ - Inside source: true *** True Line Result - -** Processing line: ~ def gray~ + args.state.mouse_held = true +** Processing line: ~ elsif args.state.mouse_held~ - Inside source: true *** True Line Result - def gray -** Processing line: ~ [75, 75, 75] # sets color saturation to shade of gray~ + elsif args.state.mouse_held +** Processing line: ~ mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]~ - Inside source: true *** True Line Result - [75, 75, 75] # sets color saturation to shade of gray -** Processing line: ~ end~ + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] +** Processing line: ~ if args.state.up_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - end + if args.state.up_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.y += 0.25~ +- Inside source: true +*** True Line Result + args.state.player.y += 0.25 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Recolors the border using the parameters.~ +** Processing line: ~ if args.state.down_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - # Recolors the border using the parameters. -** Processing line: ~ def recolor_border border, r, g, b~ + if args.state.down_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.y -= 0.25~ - Inside source: true *** True Line Result - def recolor_border border, r, g, b -** Processing line: ~ border[4] = r~ + args.state.player.y -= 0.25 +** Processing line: ~ end~ - Inside source: true *** True Line Result - border[4] = r -** Processing line: ~ border[5] = g~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - border[5] = g -** Processing line: ~ border[6] = b~ + +** Processing line: ~ if args.state.left_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - border[6] = b -** Processing line: ~ border~ + if args.state.left_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.x -= 0.25~ - Inside source: true *** True Line Result - border -** Processing line: ~ end~ + args.state.player.x -= 0.25 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns a boolean value.~ -- Inside source: true -*** True Line Result - # Returns a boolean value. -** Processing line: ~ def visible? cell~ +** Processing line: ~ if args.state.right_button.intersect_rect? mouse_rect~ - Inside source: true *** True Line Result - def visible? cell -** Processing line: ~ # finds cell's coordinates inside visible_cells collections to determine if cell is visible~ + if args.state.right_button.intersect_rect? mouse_rect +** Processing line: ~ args.state.player.x += 0.25~ - Inside source: true *** True Line Result - # finds cell's coordinates inside visible_cells collections to determine if cell is visible -** Processing line: ~ state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y}~ + args.state.player.x += 0.25 +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y} + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -74669,106 +74952,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Exports dungeon by printing dungeon cell coordinates~ +** Processing line: ~ if lowrez_mouse.click~ - Inside source: true *** True Line Result - # Exports dungeon by printing dungeon cell coordinates -** Processing line: ~ def export_dungeon~ + if lowrez_mouse.click +** Processing line: ~ dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x~ - Inside source: true *** True Line Result - def export_dungeon -** Processing line: ~ state.dungeon.each do |d| # on each element of dungeon collection~ + dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x +** Processing line: ~ dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y~ - Inside source: true *** True Line Result - state.dungeon.each do |d| # on each element of dungeon collection -** Processing line: ~ puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates~ + dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y +** Processing line: ~ x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy~ - Inside source: true *** True Line Result - puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates -** Processing line: ~ end~ + x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy +** Processing line: ~ puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}"~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}" +** Processing line: ~ if args.state.previous_mouse_click~ - Inside source: true *** True Line Result - end + if args.state.previous_mouse_click ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def distance_to_cell cell~ -- Inside source: true -*** True Line Result - def distance_to_cell cell -** Processing line: ~ distance_to state.x, cell.x, state.y, cell.y # calls distance_to method~ -- Inside source: true -*** True Line Result - distance_to state.x, cell.x, state.y, cell.y # calls distance_to method -** Processing line: ~ end~ +** Processing line: ~ if dx < 0 && dx < 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if dx < 0 && dx < 0 +** Processing line: ~ x = x + w~ - Inside source: true *** True Line Result - -** Processing line: ~ def distance_to from_x, x, from_y, y~ + x = x + w +** Processing line: ~ w = w.abs~ - Inside source: true *** True Line Result - def distance_to from_x, x, from_y, y -** Processing line: ~ (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates~ + w = w.abs +** Processing line: ~ y = y + h~ - Inside source: true *** True Line Result - (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates -** Processing line: ~ end~ + y = y + h +** Processing line: ~ h = h.abs~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + h = h.abs +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $game = Game.new~ +** Processing line: ~ w += 1~ - Inside source: true *** True Line Result - $game = Game.new -** Processing line: ~~ + w += 1 +** Processing line: ~ h += 1~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + h += 1 +** Processing line: ~~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $game.args = args~ + +** Processing line: ~ args.state.previous_mouse_click = nil~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.state = args.state~ + args.state.previous_mouse_click = nil +** Processing line: ~ else~ - Inside source: true *** True Line Result - $game.state = args.state -** Processing line: ~ $game.inputs = args.inputs~ + else +** Processing line: ~ args.state.previous_mouse_click = lowrez_mouse.click~ - Inside source: true *** True Line Result - $game.inputs = args.inputs -** Processing line: ~ $game.outputs = args.outputs~ + args.state.previous_mouse_click = lowrez_mouse.click +** Processing line: ~ square_x, square_y = lowrez_mouse.click~ - Inside source: true *** True Line Result - $game.outputs = args.outputs -** Processing line: ~ $game.grid = args.grid~ + square_x, square_y = lowrez_mouse.click +** Processing line: ~ end~ - Inside source: true *** True Line Result - $game.grid = args.grid -** Processing line: ~ $game.tick~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - $game.tick + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -74777,286 +75052,310 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ def try_centering! word~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + def try_centering! word +** Processing line: ~ word ||= ""~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_tactical_rpg/hexagonal_grid/app/main.rb~ -- Header detected. + word ||= "" +** Processing line: ~ just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")~ +- Inside source: true *** True Line Result - + just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") +** Processing line: ~ return word if just_word.strip.length == 0~ +- Inside source: true *** True Line Result -* 99_genre_tactical_rpg/hexagonal_grid/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + return word if just_word.strip.length == 0 +** Processing line: ~ return word if just_word.include? "~"~ +- Inside source: true *** True Line Result - + return word if just_word.include? "~" +** Processing line: ~ return "~#{word}" if just_word.length <= 2~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ class HexagonTileGame~ + return "~#{word}" if just_word.length <= 2 +** Processing line: ~ if just_word.length.mod_zero? 2~ - Inside source: true *** True Line Result - class HexagonTileGame -** Processing line: ~ attr_gtk~ + if just_word.length.mod_zero? 2 +** Processing line: ~ center_index = just_word.length.idiv(2) - 1~ - Inside source: true *** True Line Result - attr_gtk -** Processing line: ~~ + center_index = just_word.length.idiv(2) - 1 +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults~ + else +** Processing line: ~ center_index = (just_word.length - 1).idiv(2)~ - Inside source: true *** True Line Result - def defaults -** Processing line: ~ state.tile_scale = 1.3~ + center_index = (just_word.length - 1).idiv(2) +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tile_scale = 1.3 -** Processing line: ~ state.tile_size = 80~ + end +** Processing line: ~ return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"~ - Inside source: true *** True Line Result - state.tile_size = 80 -** Processing line: ~ state.tile_w = Math.sqrt(3) * state.tile_size.half~ + return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tile_w = Math.sqrt(3) * state.tile_size.half -** Processing line: ~ state.tile_h = state.tile_size * 3/4~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.tile_h = state.tile_size * 3/4 -** Processing line: ~ state.tiles_x_count = 1280.idiv(state.tile_w) - 1~ + +** Processing line: ~ def queue_storyline args, scene~ - Inside source: true *** True Line Result - state.tiles_x_count = 1280.idiv(state.tile_w) - 1 -** Processing line: ~ state.tiles_y_count = 720.idiv(state.tile_h) - 1~ + def queue_storyline args, scene +** Processing line: ~ queue_storyline_text args, scene[:storyline]~ - Inside source: true *** True Line Result - state.tiles_y_count = 720.idiv(state.tile_h) - 1 -** Processing line: ~ state.world_width_px = state.tiles_x_count * state.tile_w~ + queue_storyline_text args, scene[:storyline] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.world_width_px = state.tiles_x_count * state.tile_w -** Processing line: ~ state.world_height_px = state.tiles_y_count * state.tile_h~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - state.world_height_px = state.tiles_y_count * state.tile_h -** Processing line: ~ state.world_x_offset = (1280 - state.world_width_px).half~ + +** Processing line: ~ def queue_storyline_text args, text~ - Inside source: true *** True Line Result - state.world_x_offset = (1280 - state.world_width_px).half -** Processing line: ~ state.world_y_offset = (720 - state.world_height_px).half~ + def queue_storyline_text args, text +** Processing line: ~ args.state.last_story_line_text = text~ - Inside source: true *** True Line Result - state.world_y_offset = (720 - state.world_height_px).half -** Processing line: ~ state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y|~ + args.state.last_story_line_text = text +** Processing line: ~ args.state.storyline_history << text if text~ - Inside source: true *** True Line Result - state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y| -** Processing line: ~ {~ + args.state.storyline_history << text if text +** Processing line: ~ words = (text || "").split(" ")~ - Inside source: true *** True Line Result - { -** Processing line: ~ ordinal_x: ordinal_x,~ + words = (text || "").split(" ") +** Processing line: ~ words = words.map { |w| try_centering! w }~ - Inside source: true *** True Line Result - ordinal_x: ordinal_x, -** Processing line: ~ ordinal_y: ordinal_y,~ + words = words.map { |w| try_centering! w } +** Processing line: ~ args.state.scene_storyline_queue = words~ - Inside source: true *** True Line Result - ordinal_y: ordinal_y, -** Processing line: ~ offset_x: (ordinal_y.even?) ?~ + args.state.scene_storyline_queue = words +** Processing line: ~ if args.state.scene_storyline_queue.length != 0~ - Inside source: true *** True Line Result - offset_x: (ordinal_y.even?) ? -** Processing line: ~ (state.world_x_offset + state.tile_w.half.half) :~ + if args.state.scene_storyline_queue.length != 0 +** Processing line: ~ args.state.scene_storyline_queue.unshift "~$--"~ - Inside source: true *** True Line Result - (state.world_x_offset + state.tile_w.half.half) : -** Processing line: ~ (state.world_x_offset - state.tile_w.half.half),~ + args.state.scene_storyline_queue.unshift "~$--" +** Processing line: ~ args.state.storyline_to_show = "~."~ - Inside source: true *** True Line Result - (state.world_x_offset - state.tile_w.half.half), -** Processing line: ~ offset_y: state.world_y_offset,~ + args.state.storyline_to_show = "~." +** Processing line: ~ else~ - Inside source: true *** True Line Result - offset_y: state.world_y_offset, -** Processing line: ~ w: state.tile_w,~ + else +** Processing line: ~ args.state.storyline_to_show = ""~ - Inside source: true *** True Line Result - w: state.tile_w, -** Processing line: ~ h: state.tile_h,~ + args.state.storyline_to_show = "" +** Processing line: ~ end~ - Inside source: true *** True Line Result - h: state.tile_h, -** Processing line: ~ type: :blank,~ + end +** Processing line: ~ args.state.scene_storyline_queue << ""~ - Inside source: true *** True Line Result - type: :blank, -** Processing line: ~ path: "sprites/hexagon-gray.png",~ + args.state.scene_storyline_queue << "" +** Processing line: ~ args.state.next_storyline = args.state.tick_count~ - Inside source: true *** True Line Result - path: "sprites/hexagon-gray.png", -** Processing line: ~ a: 20~ + args.state.next_storyline = args.state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - a: 20 -** Processing line: ~ }.associate do |h|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - }.associate do |h| -** Processing line: ~ h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w],~ + +** Processing line: ~ def set_scene args, scene~ - Inside source: true *** True Line Result - h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w], -** Processing line: ~ y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale)~ + def set_scene args, scene +** Processing line: ~ args.state.current_scene = scene~ - Inside source: true *** True Line Result - y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale) -** Processing line: ~ end.associate do |h|~ + args.state.current_scene = scene +** Processing line: ~ args.state.background = scene[:background] || 'sprites/todo.png'~ - Inside source: true *** True Line Result - end.associate do |h| -** Processing line: ~ h.merge(center: {~ + args.state.background = scene[:background] || 'sprites/todo.png' +** Processing line: ~ args.state.scene_fade = scene[:fade] || 0~ - Inside source: true *** True Line Result - h.merge(center: { -** Processing line: ~ x: h[:x] + h[:w].half,~ + args.state.scene_fade = scene[:fade] || 0 +** Processing line: ~ args.state.scenes = (scene[:scenes] || []).reject { |s| !s }~ - Inside source: true *** True Line Result - x: h[:x] + h[:w].half, -** Processing line: ~ y: h[:y] + h[:h].half~ + args.state.scenes = (scene[:scenes] || []).reject { |s| !s } +** Processing line: ~ args.state.scene_render_override = scene[:render_override]~ - Inside source: true *** True Line Result - y: h[:y] + h[:h].half -** Processing line: ~ }, radius: [h[:w].half, h[:h].half].max)~ + args.state.scene_render_override = scene[:render_override] +** Processing line: ~ args.state.storylines = (scene[:storylines] || []).reject { |s| !s }~ - Inside source: true *** True Line Result - }, radius: [h[:w].half, h[:h].half].max) -** Processing line: ~ end~ + args.state.storylines = (scene[:storylines] || []).reject { |s| !s } +** Processing line: ~ args.state.scene_changed_at = args.state.tick_count~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.state.scene_changed_at = args.state.tick_count +** Processing line: ~ if scene[:player]~ - Inside source: true *** True Line Result - end + if scene[:player] +** Processing line: ~ args.state.player = scene[:player]~ +- Inside source: true +*** True Line Result + args.state.player = scene[:player] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ args.state.inside_scene_hotspot = false~ - Inside source: true *** True Line Result - -** Processing line: ~ def input~ + args.state.inside_scene_hotspot = false +** Processing line: ~ args.state.inside_storyline_hotspot = false~ - Inside source: true *** True Line Result - def input -** Processing line: ~ if inputs.click~ + args.state.inside_storyline_hotspot = false +** Processing line: ~ queue_storyline args, scene~ - Inside source: true *** True Line Result - if inputs.click -** Processing line: ~ tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] }~ + queue_storyline args, scene +** Processing line: ~ end~ - Inside source: true *** True Line Result - tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] } -** Processing line: ~ if tile~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if tile -** Processing line: ~ tile[:a] = 255~ + +** Processing line: ~ def replay_storyline_rect~ - Inside source: true *** True Line Result - tile[:a] = 255 -** Processing line: ~ tile[:path] = "sprites/hexagon-black.png"~ + def replay_storyline_rect +** Processing line: ~ [26, -1, 7, 4]~ - Inside source: true *** True Line Result - tile[:path] = "sprites/hexagon-black.png" -** Processing line: ~ end~ + [26, -1, 7, 4] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def labels_for_word word~ - Inside source: true *** True Line Result - end + def labels_for_word word +** Processing line: ~ left_side_of_word = ""~ +- Inside source: true +*** True Line Result + left_side_of_word = "" +** Processing line: ~ center_letter = ""~ +- Inside source: true +*** True Line Result + center_letter = "" +** Processing line: ~ right_side_of_word = ""~ +- Inside source: true +*** True Line Result + right_side_of_word = "" ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick~ +** Processing line: ~ if word[0] == "~"~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ defaults~ + if word[0] == "~" +** Processing line: ~ left_side_of_word = ""~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ input~ + left_side_of_word = "" +** Processing line: ~ center_letter = word[1]~ - Inside source: true *** True Line Result - input -** Processing line: ~ render~ + center_letter = word[1] +** Processing line: ~ right_side_of_word = word[2..-1]~ - Inside source: true *** True Line Result - render -** Processing line: ~ end~ + right_side_of_word = word[2..-1] +** Processing line: ~ elsif word.length > 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif word.length > 0 +** Processing line: ~ left_side_of_word, right_side_of_word = word.split("~")~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + left_side_of_word, right_side_of_word = word.split("~") +** Processing line: ~ center_letter = right_side_of_word[0]~ - Inside source: true *** True Line Result - def render -** Processing line: ~ outputs.sprites << state.tiles~ + center_letter = right_side_of_word[0] +** Processing line: ~ right_side_of_word = right_side_of_word[1..-1]~ - Inside source: true *** True Line Result - outputs.sprites << state.tiles + right_side_of_word = right_side_of_word[1..-1] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ $game = HexagonTileGame.new~ +** Processing line: ~ right_side_of_word = right_side_of_word.gsub("-", "")~ - Inside source: true *** True Line Result - $game = HexagonTileGame.new + right_side_of_word = right_side_of_word.gsub("-", "") ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ {~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $game.args = args~ + { +** Processing line: ~ left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],~ - Inside source: true *** True Line Result - $game.args = args -** Processing line: ~ $game.tick~ + left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], +** Processing line: ~ center: [29, 2, center_letter, 255, 0, 0],~ - Inside source: true *** True Line Result - $game.tick + center: [29, 2, center_letter, 255, 0, 0], +** Processing line: ~ right: [34, 2, right_side_of_word]~ +- Inside source: true +*** True Line Result + right: [34, 2, right_side_of_word] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -75065,1038 +75364,1142 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $gtk.reset~ +** Processing line: ~ def render_scenes args, lowrez_sprites~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~~ + def render_scenes args, lowrez_sprites +** Processing line: ~ lowrez_sprites << args.state.scenes.flat_map do |hs|~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + lowrez_sprites << args.state.scenes.flat_map do |hs| +** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + hotspot_square args, hs.x, hs.y, hs.w, hs.h +** Processing line: ~ end~ +- Inside source: true *** True Line Result - -** Processing line: ~* 99_genre_tactical_rpg/isometric_grid/app/main.rb~ -- Header detected. + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ def render_storylines args, lowrez_sprites~ +- Inside source: true *** True Line Result -* 99_genre_tactical_rpg/isometric_grid/app/main.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + def render_storylines args, lowrez_sprites +** Processing line: ~ lowrez_sprites << args.state.storylines.flat_map do |hs|~ +- Inside source: true *** True Line Result - + lowrez_sprites << args.state.storylines.flat_map do |hs| +** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ class Isometric~ + hotspot_square args, hs.x, hs.y, hs.w, hs.h +** Processing line: ~ end~ - Inside source: true *** True Line Result - class Isometric -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :grid, :inputs, :state, :outputs + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick~ -- Inside source: true -*** True Line Result - def tick -** Processing line: ~ defaults~ +** Processing line: ~ def adornments_alpha args, target_alpha = nil, minimum_alpha = nil~ - Inside source: true *** True Line Result - defaults -** Processing line: ~ render~ + def adornments_alpha args, target_alpha = nil, minimum_alpha = nil +** Processing line: ~ return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at~ - Inside source: true *** True Line Result - render -** Processing line: ~ calc~ + return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at +** Processing line: ~ target_alpha ||= 255~ - Inside source: true *** True Line Result - calc -** Processing line: ~ process_inputs~ + target_alpha ||= 255 +** Processing line: ~ target_alpha * args.state.storyline_queue_empty_at.ease(60)~ - Inside source: true *** True Line Result - process_inputs -** Processing line: ~ end~ + target_alpha * args.state.storyline_queue_empty_at.ease(60) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def defaults~ -- Inside source: true -*** True Line Result - def defaults -** Processing line: ~ state.quantity ||= 6 #Size of grid~ +** Processing line: ~ def hotspot_square args, x, y, w, h~ - Inside source: true *** True Line Result - state.quantity ||= 6 #Size of grid -** Processing line: ~ state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles~ + def hotspot_square args, x, y, w, h +** Processing line: ~ if w >= 3 && h >= 3~ - Inside source: true *** True Line Result - state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles -** Processing line: ~ state.tileGrid ||= [] #Holds ordering of tiles~ + if w >= 3 && h >= 3 +** Processing line: ~ [~ - Inside source: true *** True Line Result - state.tileGrid ||= [] #Holds ordering of tiles -** Processing line: ~ state.currentSpriteLocation ||= -1 #Current Sprite hovering location~ + [ +** Processing line: ~ [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],~ - Inside source: true *** True Line Result - state.currentSpriteLocation ||= -1 #Current Sprite hovering location -** Processing line: ~ state.tileCords ||= [] #Physical, rendering cordinates~ + [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], +** Processing line: ~ [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],~ - Inside source: true *** True Line Result - state.tileCords ||= [] #Physical, rendering cordinates -** Processing line: ~ state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0)~ + [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], +** Processing line: ~ [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],~ - Inside source: true *** True Line Result - state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0) -** Processing line: ~ state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size~ + [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size -** Processing line: ~ state.mode ||= :delete #Switches between :delete and :insert~ + ] +** Processing line: ~ else~ - Inside source: true *** True Line Result - state.mode ||= :delete #Switches between :delete and :insert -** Processing line: ~ state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2],~ + else +** Processing line: ~ [~ - Inside source: true *** True Line Result - state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2], -** Processing line: ~ ['mountain', 0, 0, 262 / 2, 245 / 2],~ + [ +** Processing line: ~ [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],~ - Inside source: true *** True Line Result - ['mountain', 0, 0, 262 / 2, 245 / 2], -** Processing line: ~ ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information~ + [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information -** Processing line: ~ #['name', deltaX, deltaY, sizeW, sizeH]~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - #['name', deltaX, deltaY, sizeW, sizeH] -** Processing line: ~ #^delta refers to distance from tile cords~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - #^delta refers to distance from tile cords + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc~ +** Processing line: ~ def render_storyline_dialog args, lowrez_labels, lowrez_sprites~ - Inside source: true *** True Line Result - #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc -** Processing line: ~ if state.tileGrid == []~ + def render_storyline_dialog args, lowrez_labels, lowrez_sprites +** Processing line: ~ return unless args.state.is_storyline_dialog_active~ - Inside source: true *** True Line Result - if state.tileGrid == [] -** Processing line: ~ tempX = 0~ + return unless args.state.is_storyline_dialog_active +** Processing line: ~ return unless args.state.storyline_to_show~ - Inside source: true *** True Line Result - tempX = 0 -** Processing line: ~ tempY = 0~ + return unless args.state.storyline_to_show +** Processing line: ~ labels = labels_for_word args.state.storyline_to_show~ - Inside source: true *** True Line Result - tempY = 0 -** Processing line: ~ tempLeft = false~ + labels = labels_for_word args.state.storyline_to_show +** Processing line: ~ if true # high rez version~ - Inside source: true *** True Line Result - tempLeft = false -** Processing line: ~ tempRight = false~ + if true # high rez version +** Processing line: ~ scale = 8.88~ - Inside source: true *** True Line Result - tempRight = false -** Processing line: ~ count = 0~ + scale = 8.88 +** Processing line: ~ offset = 45~ - Inside source: true *** True Line Result - count = 0 -** Processing line: ~ (state.quantity * state.quantity).times do~ + offset = 45 +** Processing line: ~ size = 25~ - Inside source: true *** True Line Result - (state.quantity * state.quantity).times do -** Processing line: ~ if tempY == 0~ + size = 25 +** Processing line: ~ args.outputs.labels << [offset + labels[:left].x.-(1) * scale,~ - Inside source: true *** True Line Result - if tempY == 0 -** Processing line: ~ tempLeft = true~ + args.outputs.labels << [offset + labels[:left].x.-(1) * scale, +** Processing line: ~ labels[:left].y * TINY_SCALE + 55,~ - Inside source: true *** True Line Result - tempLeft = true -** Processing line: ~ end~ + labels[:left].y * TINY_SCALE + 55, +** Processing line: ~ labels[:left].text, size, 0, 0, 0, 0, 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~ if tempX == (state.quantity - 1)~ + labels[:left].text, size, 0, 0, 0, 0, 255, +** Processing line: ~ 'fonts/manaspc.ttf']~ - Inside source: true *** True Line Result - if tempX == (state.quantity - 1) -** Processing line: ~ tempRight = true~ + 'fonts/manaspc.ttf'] +** Processing line: ~ center_text = labels[:center].text~ - Inside source: true *** True Line Result - tempRight = true -** Processing line: ~ end~ + center_text = labels[:center].text +** Processing line: ~ center_text = "|" if center_text == "$"~ - Inside source: true *** True Line Result - end -** Processing line: ~ state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count])~ + center_text = "|" if center_text == "$" +** Processing line: ~ args.outputs.labels << [offset + labels[:center].x * scale,~ - Inside source: true *** True Line Result - state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count]) -** Processing line: ~ #orderX, orderY, exists?, leftSide, rightSide, order~ + args.outputs.labels << [offset + labels[:center].x * scale, +** Processing line: ~ labels[:center].y * TINY_SCALE + 55,~ - Inside source: true *** True Line Result - #orderX, orderY, exists?, leftSide, rightSide, order -** Processing line: ~ tempX += 1~ + labels[:center].y * TINY_SCALE + 55, +** Processing line: ~ center_text, size, 0, 255, 0, 0, 255,~ - Inside source: true *** True Line Result - tempX += 1 -** Processing line: ~ if tempX == state.quantity~ + center_text, size, 0, 255, 0, 0, 255, +** Processing line: ~ 'fonts/manaspc.ttf']~ - Inside source: true *** True Line Result - if tempX == state.quantity -** Processing line: ~ tempX = 0~ + 'fonts/manaspc.ttf'] +** Processing line: ~ args.outputs.labels << [offset + labels[:right].x * scale,~ - Inside source: true *** True Line Result - tempX = 0 -** Processing line: ~ tempY += 1~ + args.outputs.labels << [offset + labels[:right].x * scale, +** Processing line: ~ labels[:right].y * TINY_SCALE + 55,~ - Inside source: true *** True Line Result - tempY += 1 -** Processing line: ~ end~ + labels[:right].y * TINY_SCALE + 55, +** Processing line: ~ labels[:right].text, size, 0, 0, 0, 0, 255,~ - Inside source: true *** True Line Result - end -** Processing line: ~ tempLeft = false~ + labels[:right].text, size, 0, 0, 0, 0, 255, +** Processing line: ~ 'fonts/manaspc.ttf']~ - Inside source: true *** True Line Result - tempLeft = false -** Processing line: ~ tempRight = false~ + 'fonts/manaspc.ttf'] +** Processing line: ~ else~ - Inside source: true *** True Line Result - tempRight = false -** Processing line: ~ count += 1~ + else +** Processing line: ~ lowrez_labels << labels[:left]~ - Inside source: true *** True Line Result - count += 1 -** Processing line: ~ end~ + lowrez_labels << labels[:left] +** Processing line: ~ lowrez_labels << labels[:center]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + lowrez_labels << labels[:center] +** Processing line: ~ lowrez_labels << labels[:right]~ - Inside source: true *** True Line Result - end + lowrez_labels << labels[:right] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ args.state.is_storyline_dialog_active = true~ +- Inside source: true +*** True Line Result + args.state.is_storyline_dialog_active = true +** Processing line: ~ render_player args, lowrez_sprites~ +- Inside source: true +*** True Line Result + render_player args, lowrez_sprites +** Processing line: ~ lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png']~ +- Inside source: true +*** True Line Result + lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #Calculates physical cordinates for tiles~ +** Processing line: ~ def render_player args, lowrez_sprites~ - Inside source: true *** True Line Result - #Calculates physical cordinates for tiles -** Processing line: ~ if state.tileCords == []~ + def render_player args, lowrez_sprites +** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ - Inside source: true *** True Line Result - if state.tileCords == [] -** Processing line: ~ state.tileCords = state.tileGrid.map do~ + lowrez_sprites << player_md_down(args, *args.state.player) +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.tileCords = state.tileGrid.map do -** Processing line: ~ |val|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2)~ + +** Processing line: ~ def render_adornments args, lowrez_sprites~ - Inside source: true *** True Line Result - x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2) -** Processing line: ~ y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2)~ + def render_adornments args, lowrez_sprites +** Processing line: ~ render_scenes args, lowrez_sprites~ - Inside source: true *** True Line Result - y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2) -** Processing line: ~ [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now~ + render_scenes args, lowrez_sprites +** Processing line: ~ render_storylines args, lowrez_sprites~ - Inside source: true *** True Line Result - [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now -** Processing line: ~ end~ + render_storylines args, lowrez_sprites +** Processing line: ~ return if args.state.is_storyline_dialog_active~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + return if args.state.is_storyline_dialog_active +** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ - Inside source: true *** True Line Result - end + lowrez_sprites << player_md_down(args, *args.state.player) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ end~ +** Processing line: ~ def global_alpha_percentage args, max_alpha = 255~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def global_alpha_percentage args, max_alpha = 255 +** Processing line: ~ return 255 unless args.state.scene_changed_at~ - Inside source: true *** True Line Result - -** Processing line: ~ def render~ + return 255 unless args.state.scene_changed_at +** Processing line: ~ return 255 unless args.state.scene_fade~ - Inside source: true *** True Line Result - def render -** Processing line: ~ renderBackground~ + return 255 unless args.state.scene_fade +** Processing line: ~ return 255 unless args.state.scene_fade > 0~ - Inside source: true *** True Line Result - renderBackground -** Processing line: ~ renderLeft~ + return 255 unless args.state.scene_fade > 0 +** Processing line: ~ return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)~ - Inside source: true *** True Line Result - renderLeft -** Processing line: ~ renderRight~ + return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) +** Processing line: ~ end~ - Inside source: true *** True Line Result - renderRight -** Processing line: ~ renderTiles~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - renderTiles -** Processing line: ~ renderObjects~ + +** Processing line: ~ def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - renderObjects -** Processing line: ~ renderLabels~ + def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - renderLabels -** Processing line: ~ end~ + lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] +** Processing line: ~ if args.state.scene_render_override~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if args.state.scene_render_override +** Processing line: ~ send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - -** Processing line: ~ def renderBackground~ + send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ end~ - Inside source: true *** True Line Result - def renderBackground -** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color~ + end +** Processing line: ~ storyline_to_show = args.state.storyline_to_show || ""~ - Inside source: true *** True Line Result - outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color -** Processing line: ~ end~ + storyline_to_show = args.state.storyline_to_show || "" +** Processing line: ~ render_adornments args, lowrez_sprites~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render_adornments args, lowrez_sprites +** Processing line: ~ render_storyline_dialog args, lowrez_labels, lowrez_sprites~ - Inside source: true *** True Line Result - -** Processing line: ~ def renderLeft~ + render_storyline_dialog args, lowrez_labels, lowrez_sprites +** Processing line: ~~ - Inside source: true *** True Line Result - def renderLeft -** Processing line: ~ #Shows the pink left cube face~ + +** Processing line: ~ if args.state.background == 'sprites/tribute-game-over.png'~ - Inside source: true *** True Line Result - #Shows the pink left cube face -** Processing line: ~ outputs.sprites << state.tileCords.map do~ + if args.state.background == 'sprites/tribute-game-over.png' +** Processing line: ~ lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]~ - Inside source: true *** True Line Result - outputs.sprites << state.tileCords.map do -** Processing line: ~ |val|~ + lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] +** Processing line: ~ lowrez_labels << [9, 6, 'Return of', 255, 255, 255]~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered~ + lowrez_labels << [9, 6, 'Return of', 255, 255, 255] +** Processing line: ~ lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]~ - Inside source: true *** True Line Result - if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered -** Processing line: ~ [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0],~ + lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] +** Processing line: ~ if !args.state.ended~ - Inside source: true *** True Line Result - [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], -** Processing line: ~ state.sideSize[1], 'sprites/leftSide.png']~ + if !args.state.ended +** Processing line: ~ args.gtk.stop_music~ - Inside source: true *** True Line Result - state.sideSize[1], 'sprites/leftSide.png'] -** Processing line: ~ end~ + args.gtk.stop_music +** Processing line: ~ args.outputs.sounds << 'sounds/music-loop.ogg'~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.sounds << 'sounds/music-loop.ogg' +** Processing line: ~ args.state.ended = true~ - Inside source: true *** True Line Result - end + args.state.ended = true ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def renderRight~ +** Processing line: ~ def player_md_right args, x, y~ - Inside source: true *** True Line Result - def renderRight -** Processing line: ~ #Shows the green right cube face~ + def player_md_right args, x, y +** Processing line: ~ [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - #Shows the green right cube face -** Processing line: ~ outputs.sprites << state.tileCords.map do~ + [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.sprites << state.tileCords.map do -** Processing line: ~ |val|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered~ + +** Processing line: ~ def player_md_left args, x, y~ - Inside source: true *** True Line Result - if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered -** Processing line: ~ [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0],~ + def player_md_left args, x, y +** Processing line: ~ [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], -** Processing line: ~ state.sideSize[1], 'sprites/rightSide.png']~ + [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - state.sideSize[1], 'sprites/rightSide.png'] -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def player_md_up args, x, y~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def player_md_up args, x, y +** Processing line: ~ [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - end + [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def renderTiles~ +** Processing line: ~ def player_md_down args, x, y~ - Inside source: true *** True Line Result - def renderTiles -** Processing line: ~ #Shows the tile itself. Important that it's rendered after the two above!~ + def player_md_down args, x, y +** Processing line: ~ [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - #Shows the tile itself. Important that it's rendered after the two above! -** Processing line: ~ outputs.sprites << state.tileCords.map do~ + [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - outputs.sprites << state.tileCords.map do -** Processing line: ~ |val|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ if val[2] == true #Chcekcs if tile needs to be rendered~ + +** Processing line: ~ def player_sm args, x, y~ - Inside source: true *** True Line Result - if val[2] == true #Chcekcs if tile needs to be rendered -** Processing line: ~ if val[5] == state.currentSpriteLocation~ + def player_sm args, x, y +** Processing line: ~ [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - if val[5] == state.currentSpriteLocation -** Processing line: ~ [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png']~ + [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png'] -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png']~ + +** Processing line: ~ def player_xs args, x, y~ - Inside source: true *** True Line Result - [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png'] -** Processing line: ~ end~ + def player_xs args, x, y +** Processing line: ~ [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def renderObjects~ -- Inside source: true +** Processing line: ~* Rpg Narrative - Return Of Serenity - repl.rb~ +- Header detected. *** True Line Result - def renderObjects -** Processing line: ~ #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner~ -- Inside source: true + *** True Line Result - #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner -** Processing line: ~ #to bottom corner.~ -- Inside source: true +* Rpg Narrative - Return Of Serenity - repl.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - #to bottom corner. -** Processing line: ~ a = (state.quantity * state.quantity) - state.quantity~ -- Inside source: true + *** True Line Result - a = (state.quantity * state.quantity) - state.quantity -** Processing line: ~ iter = 0~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb~ - Inside source: true *** True Line Result - iter = 0 -** Processing line: ~ loop do~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb +** Processing line: ~ puts $gtk.args.state.current_scene~ - Inside source: true *** True Line Result - loop do -** Processing line: ~ if state.tileCords[a][2] == true && state.tileCords[a][6] != -1~ + puts $gtk.args.state.current_scene +** Processing line: ~~ - Inside source: true *** True Line Result - if state.tileCords[a][2] == true && state.tileCords[a][6] != -1 -** Processing line: ~ outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1],~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Return Of Serenity - require.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Return Of Serenity - require.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb~ - Inside source: true *** True Line Result - outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1], -** Processing line: ~ state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2],~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb +** Processing line: ~ require 'app/lowrez_simulator.rb'~ - Inside source: true *** True Line Result - state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2], -** Processing line: ~ state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4],~ + require 'app/lowrez_simulator.rb' +** Processing line: ~ require 'app/storyline_day_one.rb'~ - Inside source: true *** True Line Result - state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4], -** Processing line: ~ 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png']~ + require 'app/storyline_day_one.rb' +** Processing line: ~ require 'app/storyline_blinking_light.rb'~ - Inside source: true *** True Line Result - 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png'] -** Processing line: ~ end~ + require 'app/storyline_blinking_light.rb' +** Processing line: ~ require 'app/storyline_serenity_introduction.rb'~ - Inside source: true *** True Line Result - end -** Processing line: ~ iter += 1~ + require 'app/storyline_serenity_introduction.rb' +** Processing line: ~ require 'app/storyline_speed_of_light.rb'~ - Inside source: true *** True Line Result - iter += 1 -** Processing line: ~ a += 1~ + require 'app/storyline_speed_of_light.rb' +** Processing line: ~ require 'app/storyline_serenity_alive.rb'~ - Inside source: true *** True Line Result - a += 1 -** Processing line: ~ a -= state.quantity * 2 if iter == state.quantity~ + require 'app/storyline_serenity_alive.rb' +** Processing line: ~ require 'app/storyline_serenity_bio.rb'~ - Inside source: true *** True Line Result - a -= state.quantity * 2 if iter == state.quantity -** Processing line: ~ iter = 0 if iter == state.quantity~ + require 'app/storyline_serenity_bio.rb' +** Processing line: ~ require 'app/storyline_anka.rb'~ - Inside source: true *** True Line Result - iter = 0 if iter == state.quantity -** Processing line: ~ break if a < 0~ + require 'app/storyline_anka.rb' +** Processing line: ~ require 'app/storyline_final_message.rb'~ - Inside source: true *** True Line Result - break if a < 0 -** Processing line: ~ end~ + require 'app/storyline_final_message.rb' +** Processing line: ~ require 'app/storyline_final_decision.rb'~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + require 'app/storyline_final_decision.rb' +** Processing line: ~ require 'app/storyline.rb'~ - Inside source: true *** True Line Result - end + require 'app/storyline.rb' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def renderLabels~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def renderLabels -** Processing line: ~ #Labels~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - #Labels -** Processing line: ~ outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete~ -- Inside source: true + +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline.rb~ +- Header detected. *** True Line Result - outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete -** Processing line: ~ outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete~ + +*** True Line Result +* Rpg Narrative - Return Of Serenity - storyline.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb~ - Inside source: true *** True Line Result - outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete -** Processing line: ~ outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb +** Processing line: ~ def hotspot_top~ - Inside source: true *** True Line Result - outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert -** Processing line: ~ outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert~ + def hotspot_top +** Processing line: ~ [4, 61, 56, 3]~ - Inside source: true *** True Line Result - outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert -** Processing line: ~ end~ + [4, 61, 56, 3] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc~ +** Processing line: ~ def hotspot_bottom~ - Inside source: true *** True Line Result - def calc -** Processing line: ~ calcCurrentHover~ + def hotspot_bottom +** Processing line: ~ [4, 0, 56, 3]~ - Inside source: true *** True Line Result - calcCurrentHover -** Processing line: ~ end~ + [4, 0, 56, 3] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calcCurrentHover~ +** Processing line: ~ def hotspot_top_right~ - Inside source: true *** True Line Result - def calcCurrentHover -** Processing line: ~ #This determines what tile the mouse is hovering (or last hovering) over~ + def hotspot_top_right +** Processing line: ~ [62, 35, 3, 25]~ - Inside source: true *** True Line Result - #This determines what tile the mouse is hovering (or last hovering) over -** Processing line: ~ x = inputs.mouse.position.x~ + [62, 35, 3, 25] +** Processing line: ~ end~ - Inside source: true *** True Line Result - x = inputs.mouse.position.x -** Processing line: ~ y = inputs.mouse.position.y~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y = inputs.mouse.position.y -** Processing line: ~ m = (state.tileSize[1] / state.tileSize[0]) #slope~ + +** Processing line: ~ def hotspot_bottom_right~ - Inside source: true *** True Line Result - m = (state.tileSize[1] / state.tileSize[0]) #slope -** Processing line: ~ state.tileCords.map do~ + def hotspot_bottom_right +** Processing line: ~ [62, 0, 3, 25]~ - Inside source: true *** True Line Result - state.tileCords.map do -** Processing line: ~ |val|~ + [62, 0, 3, 25] +** Processing line: ~ end~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) -** Processing line: ~ next unless val[0] < x && x < val[0] + state.tileSize[0]~ + +** Processing line: ~ def storyline_history_include? args, text~ - Inside source: true *** True Line Result - next unless val[0] < x && x < val[0] + state.tileSize[0] -** Processing line: ~ next unless val[1] < y && y < val[1] + state.tileSize[1]~ + def storyline_history_include? args, text +** Processing line: ~ args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }~ - Inside source: true *** True Line Result - next unless val[1] < y && y < val[1] + state.tileSize[1] -** Processing line: ~ next unless val[2] == true~ + args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } +** Processing line: ~ end~ - Inside source: true *** True Line Result - next unless val[2] == true -** Processing line: ~ tempBool = false~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - tempBool = false -** Processing line: ~ if x == val[0] + (state.tileSize[0] / 2)~ + +** Processing line: ~ def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - if x == val[0] + (state.tileSize[0] / 2) -** Processing line: ~ #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond~ + def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond -** Processing line: ~ tempBool = true~ + lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - tempBool = true -** Processing line: ~ elsif x < state.tileSize[0] / 2 + val[0]~ + lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - elsif x < state.tileSize[0] / 2 + val[0] -** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond~ + lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond -** Processing line: ~ tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) -** Processing line: ~ tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ + +** Processing line: ~ def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) -** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ + def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - #Checks to see if the mouse click y value is between those temp y values -** Processing line: ~ tempBool = true if y < tempY1 && y > tempY2~ + lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - tempBool = true if y < tempY1 && y > tempY2 -** Processing line: ~ elsif x > state.tileSize[0] / 2 + val[0]~ + lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - elsif x > state.tileSize[0] / 2 + val[0] -** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond~ + lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond -** Processing line: ~ tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] -** Processing line: ~ tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1]~ + +** Processing line: ~ def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] -** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ + def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - #Checks to see if the mouse click y value is between those temp y values -** Processing line: ~ tempBool = true if y > tempY1 && y < tempY2~ + lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - tempBool = true if y > tempY1 && y < tempY2 -** Processing line: ~ end~ + lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - end + lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if tempBool == true~ +** Processing line: ~ def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - if tempBool == true -** Processing line: ~ state.currentSpriteLocation = val[5] #Current sprite location set to the order value~ + def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - state.currentSpriteLocation = val[5] #Current sprite location set to the order value -** Processing line: ~ end~ + lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def process_inputs~ +** Processing line: ~ def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ - Inside source: true *** True Line Result - def process_inputs -** Processing line: ~ #Makes development much faster and easier~ + def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids +** Processing line: ~ lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - #Makes development much faster and easier -** Processing line: ~ if inputs.keyboard.key_up.r~ + lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - if inputs.keyboard.key_up.r -** Processing line: ~ $dragon.reset~ + lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ - Inside source: true *** True Line Result - $dragon.reset -** Processing line: ~ end~ + lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ checkTileSelected~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - checkTileSelected -** Processing line: ~ switchModes~ + +** Processing line: ~ def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []~ - Inside source: true *** True Line Result - switchModes -** Processing line: ~ end~ + def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] +** Processing line: ~ result_one_scene, result_one_label, result_one_text = context_result_one~ - Inside source: true *** True Line Result - end + result_one_scene, result_one_label, result_one_text = context_result_one +** Processing line: ~ result_two_scene, result_two_label, result_two_text = context_result_two~ +- Inside source: true +*** True Line Result + result_two_scene, result_two_label, result_two_text = context_result_two +** Processing line: ~ result_three_scene, result_three_label, result_three_text = context_result_three~ +- Inside source: true +*** True Line Result + result_three_scene, result_three_label, result_three_text = context_result_three +** Processing line: ~ result_four_scene, result_four_label, result_four_text = context_result_four~ +- Inside source: true +*** True Line Result + result_four_scene, result_four_label, result_four_text = context_result_four ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def checkTileSelected~ +** Processing line: ~ top_level_hash = {~ - Inside source: true *** True Line Result - def checkTileSelected -** Processing line: ~ if inputs.mouse.down~ + top_level_hash = { +** Processing line: ~ background: 'sprites/decision.png',~ - Inside source: true *** True Line Result - if inputs.mouse.down -** Processing line: ~ x = inputs.mouse.down.point.x~ + background: 'sprites/decision.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - x = inputs.mouse.down.point.x -** Processing line: ~ y = inputs.mouse.down.point.y~ + fade: 60, +** Processing line: ~ player: [20, 36],~ - Inside source: true *** True Line Result - y = inputs.mouse.down.point.y -** Processing line: ~ m = (state.tileSize[1] / state.tileSize[0]) #slope~ + player: [20, 36], +** Processing line: ~ storylines: [ ],~ - Inside source: true *** True Line Result - m = (state.tileSize[1] / state.tileSize[0]) #slope -** Processing line: ~ state.tileCords.map do~ + storylines: [ ], +** Processing line: ~ scenes: [ ]~ - Inside source: true *** True Line Result - state.tileCords.map do -** Processing line: ~ |val|~ + scenes: [ ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - |val| -** Processing line: ~ #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision)~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) -** Processing line: ~ next unless val[0] < x && x < val[0] + state.tileSize[0]~ + +** Processing line: ~ confirmation_result_one_hash = {~ - Inside source: true *** True Line Result - next unless val[0] < x && x < val[0] + state.tileSize[0] -** Processing line: ~ next unless val[1] < y && y < val[1] + state.tileSize[1]~ + confirmation_result_one_hash = { +** Processing line: ~ background: 'sprites/decision.png',~ - Inside source: true *** True Line Result - next unless val[1] < y && y < val[1] + state.tileSize[1] -** Processing line: ~ next unless val[2] == true~ + background: 'sprites/decision.png', +** Processing line: ~ scenes: [ ],~ - Inside source: true *** True Line Result - next unless val[2] == true -** Processing line: ~ tempBool = false~ + scenes: [ ], +** Processing line: ~ storylines: [ ]~ - Inside source: true *** True Line Result - tempBool = false -** Processing line: ~ if x == val[0] + (state.tileSize[0] / 2)~ + storylines: [ ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - if x == val[0] + (state.tileSize[0] / 2) -** Processing line: ~ #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond -** Processing line: ~ tempBool = true~ + +** Processing line: ~ confirmation_result_two_hash = {~ - Inside source: true *** True Line Result - tempBool = true -** Processing line: ~ elsif x < state.tileSize[0] / 2 + val[0]~ + confirmation_result_two_hash = { +** Processing line: ~ background: 'sprites/decision.png',~ - Inside source: true *** True Line Result - elsif x < state.tileSize[0] / 2 + val[0] -** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond~ + background: 'sprites/decision.png', +** Processing line: ~ scenes: [ ],~ - Inside source: true *** True Line Result - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond -** Processing line: ~ tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ + scenes: [ ], +** Processing line: ~ storylines: [ ]~ - Inside source: true *** True Line Result - tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) -** Processing line: ~ tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ + storylines: [ ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) -** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - #Checks to see if the mouse click y value is between those temp y values -** Processing line: ~ tempBool = true if y < tempY1 && y > tempY2~ + +** Processing line: ~ confirmation_result_three_hash = {~ - Inside source: true *** True Line Result - tempBool = true if y < tempY1 && y > tempY2 -** Processing line: ~ elsif x > state.tileSize[0] / 2 + val[0]~ + confirmation_result_three_hash = { +** Processing line: ~ background: 'sprites/decision.png',~ - Inside source: true *** True Line Result - elsif x > state.tileSize[0] / 2 + val[0] -** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond~ + background: 'sprites/decision.png', +** Processing line: ~ scenes: [ ],~ - Inside source: true *** True Line Result - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond -** Processing line: ~ tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1]~ + scenes: [ ], +** Processing line: ~ storylines: [ ]~ - Inside source: true *** True Line Result - tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] -** Processing line: ~ tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1]~ + storylines: [ ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] -** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - #Checks to see if the mouse click y value is between those temp y values -** Processing line: ~ tempBool = true if y > tempY1 && y < tempY2~ + +** Processing line: ~ confirmation_result_four_hash = {~ - Inside source: true *** True Line Result - tempBool = true if y > tempY1 && y < tempY2 -** Processing line: ~ end~ + confirmation_result_four_hash = { +** Processing line: ~ background: 'sprites/decision.png',~ - Inside source: true *** True Line Result - end + background: 'sprites/decision.png', +** Processing line: ~ scenes: [ ],~ +- Inside source: true +*** True Line Result + scenes: [ ], +** Processing line: ~ storylines: [ ]~ +- Inside source: true +*** True Line Result + storylines: [ ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if tempBool == true~ +** Processing line: ~ top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]~ - Inside source: true *** True Line Result - if tempBool == true -** Processing line: ~ if state.mode == :delete~ + top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] +** Processing line: ~ top_level_hash[:storylines] << [20, 35, 4, 4, context_action]~ - Inside source: true *** True Line Result - if state.mode == :delete -** Processing line: ~ val[2] = false~ + top_level_hash[:storylines] << [20, 35, 4, 4, context_action] +** Processing line: ~~ - Inside source: true *** True Line Result - val[2] = false -** Processing line: ~ state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency~ + +** Processing line: ~ confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ - Inside source: true *** True Line Result - state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency -** Processing line: ~ state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered~ + confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] +** Processing line: ~ confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene]~ - Inside source: true *** True Line Result - state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered -** Processing line: ~ unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered~ + confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] +** Processing line: ~ confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]~ - Inside source: true *** True Line Result - unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered -** Processing line: ~ state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing~ + confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ - Inside source: true *** True Line Result - state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing -** Processing line: ~ state.tileCords[val[5] - 1][4] = true~ + confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ - Inside source: true *** True Line Result - state.tileCords[val[5] - 1][4] = true -** Processing line: ~ end~ + confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ - Inside source: true *** True Line Result - end -** Processing line: ~ unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side~ + confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] +** Processing line: ~~ - Inside source: true *** True Line Result - unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side -** Processing line: ~ state.tileGrid[val[5] + state.quantity][3] = true~ + +** Processing line: ~ confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ - Inside source: true *** True Line Result - state.tileGrid[val[5] + state.quantity][3] = true -** Processing line: ~ state.tileCords[val[5] + state.quantity][3] = true~ + confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ - Inside source: true *** True Line Result - state.tileCords[val[5] + state.quantity][3] = true -** Processing line: ~ end~ + confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif state.mode == :insert~ + confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ - Inside source: true *** True Line Result - elsif state.mode == :insert -** Processing line: ~ #adds the current sprite value selected to tileCords. (changes from the -1 earlier)~ + confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene +** Processing line: ~ confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene]~ - Inside source: true *** True Line Result - #adds the current sprite value selected to tileCords. (changes from the -1 earlier) -** Processing line: ~ val[6] = rand(state.spriteSelection.length)~ + confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] +** Processing line: ~ confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]~ - Inside source: true *** True Line Result - val[6] = rand(state.spriteSelection.length) -** Processing line: ~ end~ + confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] +** Processing line: ~ confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene]~ - Inside source: true *** True Line Result - end + confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] +** Processing line: ~ confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]~ +- Inside source: true +*** True Line Result + confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +- Inside source: true +*** True Line Result + confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def switchModes~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ - Inside source: true *** True Line Result - def switchModes -** Processing line: ~ #Switches between insert and delete modes~ + confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ - Inside source: true *** True Line Result - #Switches between insert and delete modes -** Processing line: ~ if inputs.keyboard.key_up.i && state.mode == :delete~ + confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] +** Processing line: ~ confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene]~ - Inside source: true *** True Line Result - if inputs.keyboard.key_up.i && state.mode == :delete -** Processing line: ~ state.mode = :insert~ + confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] +** Processing line: ~ confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]~ - Inside source: true *** True Line Result - state.mode = :insert -** Processing line: ~ inputs.keyboard.clear~ + confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash]~ - Inside source: true *** True Line Result - inputs.keyboard.clear -** Processing line: ~ elsif inputs.keyboard.key_up.d && state.mode == :insert~ + confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ - Inside source: true *** True Line Result - elsif inputs.keyboard.key_up.d && state.mode == :insert -** Processing line: ~ state.mode = :delete~ + confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] +** Processing line: ~~ - Inside source: true *** True Line Result - state.mode = :delete -** Processing line: ~ inputs.keyboard.clear~ + +** Processing line: ~ top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ - Inside source: true *** True Line Result - inputs.keyboard.clear -** Processing line: ~ end~ + top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] +** Processing line: ~ top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene +** Processing line: ~ top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ - Inside source: true *** True Line Result - end + top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene +** Processing line: ~ top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +- Inside source: true +*** True Line Result + top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] ** Processing line: ~~ - Inside source: true *** True Line Result +** Processing line: ~ top_level_hash~ +- Inside source: true +*** True Line Result + top_level_hash ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76105,38 +76508,78 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ $isometric = Isometric.new~ +** Processing line: ~ def ship_control_hotspot offset_x, offset_y, a, b, c, d~ - Inside source: true *** True Line Result - $isometric = Isometric.new + def ship_control_hotspot offset_x, offset_y, a, b, c, d +** Processing line: ~ results = []~ +- Inside source: true +*** True Line Result + results = [] +** Processing line: ~ results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a~ +- Inside source: true +*** True Line Result + results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a +** Processing line: ~ results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b~ +- Inside source: true +*** True Line Result + results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b +** Processing line: ~ results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c~ +- Inside source: true +*** True Line Result + results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c +** Processing line: ~ results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d~ +- Inside source: true +*** True Line Result + results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d +** Processing line: ~ results~ +- Inside source: true +*** True Line Result + results +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def reload_current_scene~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ $isometric.grid = args.grid~ + def reload_current_scene +** Processing line: ~ if $gtk.args.state.last_hotspot_scene~ - Inside source: true *** True Line Result - $isometric.grid = args.grid -** Processing line: ~ $isometric.inputs = args.inputs~ + if $gtk.args.state.last_hotspot_scene +** Processing line: ~ set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)~ - Inside source: true *** True Line Result - $isometric.inputs = args.inputs -** Processing line: ~ $isometric.state = args.state~ + set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) +** Processing line: ~ tick $gtk.args~ - Inside source: true *** True Line Result - $isometric.state = args.state -** Processing line: ~ $isometric.outputs = args.outputs~ + tick $gtk.args +** Processing line: ~ elsif respond_to? :set_scene~ - Inside source: true *** True Line Result - $isometric.outputs = args.outputs -** Processing line: ~ $isometric.tick~ + elsif respond_to? :set_scene +** Processing line: ~ set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)~ - Inside source: true *** True Line Result - $isometric.tick + set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) +** Processing line: ~ tick $gtk.args~ +- Inside source: true +*** True Line Result + tick $gtk.args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ $gtk.console.close~ +- Inside source: true +*** True Line Result + $gtk.console.close ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76153,202 +76596,214 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* 99_genre_topdown_rpg/topdown_starting_point/app/main.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_anka.rb~ - Header detected. *** True Line Result *** True Line Result -* 99_genre_topdown_rpg/topdown_starting_point/app/main.rb +* Rpg Narrative - Return Of Serenity - storyline_anka.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb~ - Inside source: true *** True Line Result - =begin -** Processing line: ~~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb +** Processing line: ~ def anka_inside_room args~ - Inside source: true *** True Line Result - -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ + def anka_inside_room args +** Processing line: ~ {~ - Inside source: true *** True Line Result - APIs listing that haven't been encountered in previous sample apps: -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ - reverse: Returns a new string with the characters from original string in reverse order.~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 35],~ - Inside source: true *** True Line Result - - reverse: Returns a new string with the characters from original string in reverse order. -** Processing line: ~ For example, the command~ + player: [34, 35], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - For example, the command -** Processing line: ~ "dragonruby".reverse~ + storylines: [ +** Processing line: ~ [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],~ - Inside source: true *** True Line Result - "dragonruby".reverse -** Processing line: ~ would return the string~ + [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - would return the string -** Processing line: ~ "yburnogard".~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - "yburnogard". -** Processing line: ~ Reverse is not only limited to strings, but can be applied to arrays and other collections.~ + scenes: [ +** Processing line: ~ [32, -1, 8, 3, :anka_observatory]~ - Inside source: true *** True Line Result - Reverse is not only limited to strings, but can be applied to arrays and other collections. -** Processing line: ~~ + [32, -1, 8, 3, :anka_observatory] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ Reminders:~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - Reminders: + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ +** Processing line: ~ def anka_observatory args~ - Inside source: true *** True Line Result - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. -** Processing line: ~~ + def anka_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - - args.outputs.labels: An array. The values generate a label. -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ + fade: 60, +** Processing line: ~ player: [51, 12],~ - Inside source: true *** True Line Result - For more information about labels, go to mygame/documentation/02-labels.md. -** Processing line: ~~ + player: [51, 12], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ =end~ + storylines: [ +** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ - Inside source: true *** True Line Result - =end -** Processing line: ~~ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # This code shows a maze and uses input from the keyboard to move the user around the screen.~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # This code shows a maze and uses input from the keyboard to move the user around the screen. -** Processing line: ~ # The objective is to reach the goal.~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :anka_inside_mainframe]~ - Inside source: true *** True Line Result - # The objective is to reach the goal. -** Processing line: ~~ + [30, 18, 5, 12, :anka_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Sets values of tile size and player's movement speed~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - # Sets values of tile size and player's movement speed -** Processing line: ~ # Also creates tile or box for player and generates map~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - # Also creates tile or box for player and generates map -** Processing line: ~ def tick args~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ args.state.tile_size = 80~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.tile_size = 80 -** Processing line: ~ args.state.player_speed = 4~ + +** Processing line: ~ def anka_inside_mainframe args~ - Inside source: true *** True Line Result - args.state.player_speed = 4 -** Processing line: ~ args.state.player ||= tile(args, 7, 3, 0, 128, 180)~ + def anka_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - args.state.player ||= tile(args, 7, 3, 0, 128, 180) -** Processing line: ~ generate_map args~ + { +** Processing line: ~ player: [32, 4],~ - Inside source: true *** True Line Result - generate_map args -** Processing line: ~~ + player: [32, 4], +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ # Adds walls, goal, and player to args.outputs.solids so they appear on screen~ + background: 'sprites/mainframe.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - # Adds walls, goal, and player to args.outputs.solids so they appear on screen -** Processing line: ~ args.outputs.solids << args.state.walls~ + fade: 60, +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.walls -** Processing line: ~ args.outputs.solids << args.state.goal~ + storylines: [ +** Processing line: ~ [22, 45, 17, 4, (anka_last_reply args)],~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.goal -** Processing line: ~ args.outputs.solids << args.state.player~ + [22, 45, 17, 4, (anka_last_reply args)], +** Processing line: ~ [45, 45, 4, 4, (anka_current_reply args)],~ - Inside source: true *** True Line Result - args.outputs.solids << args.state.player -** Processing line: ~~ + [45, 45, 4, 4, (anka_current_reply args)], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # If player's box intersects with goal, a label is output onto the screen~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # If player's box intersects with goal, a label is output onto the screen -** Processing line: ~ if args.state.player.intersect_rect? args.state.goal~ + scenes: [ +** Processing line: ~ [*hotspot_top_right, :reply_to_anka]~ - Inside source: true *** True Line Result - if args.state.player.intersect_rect? args.state.goal -** Processing line: ~ args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen~ + [*hotspot_top_right, :reply_to_anka] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed~ +** Processing line: ~ def reply_to_anka args~ - Inside source: true *** True Line Result - move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed -** Processing line: ~ move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed~ + def reply_to_anka args +** Processing line: ~ decision_graph anka_current_reply(args),~ - Inside source: true *** True Line Result - move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed -** Processing line: ~ move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed~ + decision_graph anka_current_reply(args), +** Processing line: ~ "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",~ - Inside source: true *** True Line Result - move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed -** Processing line: ~ move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed~ + "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", +** Processing line: ~ [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],~ - Inside source: true *** True Line Result - move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed + [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], +** Processing line: ~ [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]~ +- Inside source: true +*** True Line Result + [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76357,34 +76812,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Sets position, size, and color of the tile~ -- Inside source: true -*** True Line Result - # Sets position, size, and color of the tile -** Processing line: ~ def tile args, x, y, *color~ +** Processing line: ~ def anka_last_reply args~ - Inside source: true *** True Line Result - def tile args, x, y, *color -** Processing line: ~ [x * args.state.tile_size, # sets definition for array using method parameters~ + def anka_last_reply args +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ - Inside source: true *** True Line Result - [x * args.state.tile_size, # sets definition for array using method parameters -** Processing line: ~ y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values~ + if args.state.scene_history.include? :replied_to_serenity_alive_firmly +** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ - Inside source: true *** True Line Result - y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values -** Processing line: ~ args.state.tile_size,~ + return "Buffer--: #{serenity_alive_firm_reply.quote}" +** Processing line: ~ else~ - Inside source: true *** True Line Result - args.state.tile_size, -** Processing line: ~ args.state.tile_size,~ + else +** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ - Inside source: true *** True Line Result - args.state.tile_size, -** Processing line: ~ *color]~ + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - *color] + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76393,142 +76844,162 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach)~ +** Processing line: ~ def anka_reply_whole_truth~ - Inside source: true *** True Line Result - # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) -** Processing line: ~ def generate_map args~ + def anka_reply_whole_truth +** Processing line: ~ "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."~ - Inside source: true *** True Line Result - def generate_map args -** Processing line: ~ return if args.state.area~ + "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if args.state.area + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Creates the area of the map. There are 9 rows running horizontally across the screen~ +** Processing line: ~ def anka_reply_half_truth~ - Inside source: true *** True Line Result - # Creates the area of the map. There are 9 rows running horizontally across the screen -** Processing line: ~ # and 16 columns running vertically on the screen. Any spot with a "1" is not~ + def anka_reply_half_truth +** Processing line: ~ "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."~ - Inside source: true *** True Line Result - # and 16 columns running vertically on the screen. Any spot with a "1" is not -** Processing line: ~ # open for the player to move into (and is green), and any spot with a "0" is available~ + "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # open for the player to move into (and is green), and any spot with a "0" is available -** Processing line: ~ # for the player to move in.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # for the player to move in. -** Processing line: ~ args.state.area = [~ + +** Processing line: ~ def replied_with_whole_truth args~ - Inside source: true *** True Line Result - args.state.area = [ -** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ + def replied_with_whole_truth args +** Processing line: ~ {~ - Inside source: true *** True Line Result - [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], -** Processing line: ~ [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal -** Processing line: ~ [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], -** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], -** Processing line: ~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],~ + player: [32, 21], +** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ - Inside source: true *** True Line Result - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,], -** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,],~ + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], -** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,],~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],~ - Inside source: true *** True Line Result - [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], -** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], +** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],~ - Inside source: true *** True Line Result - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], -** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],~ + [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], -** Processing line: ~ ].reverse # reverses the order of the area collection~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - ].reverse # reverses the order of the area collection + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # By reversing the order, the way that the area appears above is how it appears~ +** Processing line: ~ def replied_with_half_truth args~ - Inside source: true *** True Line Result - # By reversing the order, the way that the area appears above is how it appears -** Processing line: ~ # on the screen in the game. If we did not reverse, the map would appear inverted.~ + def replied_with_half_truth args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # on the screen in the game. If we did not reverse, the map would appear inverted. -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ #The wall starts off with no tiles.~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - #The wall starts off with no tiles. -** Processing line: ~ args.state.walls = []~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - args.state.walls = [] -** Processing line: ~~ + player: [32, 21], +** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ - Inside source: true *** True Line Result - -** Processing line: ~ # If v is 1, a green tile is added to args.state.walls.~ + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - # If v is 1, a green tile is added to args.state.walls. -** Processing line: ~ # If v is 2, a black tile is created as the goal.~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],~ - Inside source: true *** True Line Result - # If v is 2, a black tile is created as the goal. -** Processing line: ~ args.state.area.map_2d do |y, x, v|~ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], +** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],~ - Inside source: true *** True Line Result - args.state.area.map_2d do |y, x, v| -** Processing line: ~ if v == 1~ + [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - if v == 1 -** Processing line: ~ args.state.walls << tile(args, x, y, 0, 255, 0) # green tile~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.state.walls << tile(args, x, y, 0, 255, 0) # green tile -** Processing line: ~ elsif v == 2 # notice there is only one "2" above because there is only one single goal~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif v == 2 # notice there is only one "2" above because there is only one single goal -** Processing line: ~ args.state.goal = tile(args, x, y, 0, 0, 0) # black tile~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.state.goal = tile(args, x, y, 0, 0, 0) # black tile -** Processing line: ~ end~ + +** Processing line: ~ def anka_current_reply args~ - Inside source: true *** True Line Result - end + def anka_current_reply args +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ +- Inside source: true +*** True Line Result + if args.state.scene_history.include? :replied_to_serenity_alive_firmly +** Processing line: ~ return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ +- Inside source: true +*** True Line Result + return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ +- Inside source: true +*** True Line Result + return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76541,58 +77012,110 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Allows the player to move their box around the screen~ +** Processing line: ~ def replied_to_anka_back_home args~ - Inside source: true *** True Line Result - # Allows the player to move their box around the screen -** Processing line: ~ def move_player args, *vector~ + def replied_to_anka_back_home args +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ - Inside source: true *** True Line Result - def move_player args, *vector -** Processing line: ~ box = args.state.player.shift_rect(vector) # box is able to move at an angle~ + if args.state.scene_history.include? :replied_with_whole_truth +** Processing line: ~ return {~ - Inside source: true *** True Line Result - box = args.state.player.shift_rect(vector) # box is able to move at an angle -** Processing line: ~~ + return { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ # If the player's box hits a wall, it is not able to move further in that direction~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - # If the player's box hits a wall, it is not able to move further in that direction -** Processing line: ~ return if args.state.walls~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 4],~ - Inside source: true *** True Line Result - return if args.state.walls -** Processing line: ~ .any_intersect_rect?(box)~ + player: [34, 4], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - .any_intersect_rect?(box) -** Processing line: ~~ + storylines: [ +** Processing line: ~ [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Player's box is able to move at angles (not just the four general directions) fast~ + [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # Player's box is able to move at angles (not just the four general directions) fast -** Processing line: ~ args.state.player =~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - args.state.player = -** Processing line: ~ args.state.player~ + scenes: [ +** Processing line: ~ [30, 38, 12, 13, :final_message_sad],~ - Inside source: true *** True Line Result - args.state.player -** Processing line: ~ .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then~ + [30, 38, 12, 13, :final_message_sad], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then -** Processing line: ~ vector.y * args.state.player_speed) # the box will move extremely slow~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - vector.y * args.state.player_speed) # the box will move extremely slow + } +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ return {~ +- Inside source: true +*** True Line Result + return { +** Processing line: ~ fade: 60,~ +- Inside source: true +*** True Line Result + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ +- Inside source: true +*** True Line Result + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 4],~ +- Inside source: true +*** True Line Result + player: [34, 4], +** Processing line: ~ storylines: [~ +- Inside source: true +*** True Line Result + storylines: [ +** Processing line: ~ [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],~ +- Inside source: true +*** True Line Result + [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], +** Processing line: ~ ],~ +- Inside source: true +*** True Line Result + ], +** Processing line: ~ scenes: [~ +- Inside source: true +*** True Line Result + scenes: [ +** Processing line: ~ [30, 38, 12, 13, :final_message_happy],~ +- Inside source: true +*** True Line Result + [30, 38, 12, 13, :final_message_happy], +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -76609,798 +77132,830 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/args.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/args.rb +* Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb +** Processing line: ~ def the_blinking_light args~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + def the_blinking_light args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # args.rb has been released under MIT (*only this file*).~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - # args.rb has been released under MIT (*only this file*). -** Processing line: ~~ + fade: 60, +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [16, 13],~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ # This class is the one you'll interact with the most. It's~ + player: [16, 13], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # This class is the one you'll interact with the most. It's -** Processing line: ~ # constructed by the DragonRuby Runtime and is provided to you on~ + scenes: [ +** Processing line: ~ [52, 24, 11, 5, :blinking_light_mountain_pass],~ - Inside source: true *** True Line Result - # constructed by the DragonRuby Runtime and is provided to you on -** Processing line: ~ # each tick.~ + [52, 24, 11, 5, :blinking_light_mountain_pass], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # each tick. -** Processing line: ~ class Args~ + ], +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ - Inside source: true *** True Line Result - class Args -** Processing line: ~ include ArgsDeprecated~ + render_override: :blinking_light_side_of_home_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - include ArgsDeprecated -** Processing line: ~ include Serialize~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - include Serialize + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains information related to input devices and input events.~ +** Processing line: ~ def blinking_light_mountain_pass args~ - Inside source: true *** True Line Result - # Contains information related to input devices and input events. -** Processing line: ~ #~ + def blinking_light_mountain_pass args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Inputs]~ + { +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ - Inside source: true *** True Line Result - # @return [Inputs] -** Processing line: ~ attr_accessor :inputs~ + background: 'sprites/mountain-pass-zoomed-out.png', +** Processing line: ~ player: [4, 4],~ - Inside source: true *** True Line Result - attr_accessor :inputs -** Processing line: ~~ + player: [4, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ # Contains the means to interact with output devices such as the screen.~ + scenes: [ +** Processing line: ~ [18, 47, 5, 5, :blinking_light_path_to_observatory]~ - Inside source: true *** True Line Result - # Contains the means to interact with output devices such as the screen. -** Processing line: ~ #~ + [18, 47, 5, 5, :blinking_light_path_to_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Outputs]~ + ], +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ - Inside source: true *** True Line Result - # @return [Outputs] -** Processing line: ~ attr_accessor :outputs~ + render_override: :blinking_light_mountain_pass_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - attr_accessor :outputs + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contains display size information to assist in positioning things on the screen.~ +** Processing line: ~ def blinking_light_path_to_observatory args~ - Inside source: true *** True Line Result - # Contains display size information to assist in positioning things on the screen. -** Processing line: ~ #~ + def blinking_light_path_to_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Grid]~ + { +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - # @return [Grid] -** Processing line: ~ attr_accessor :grid~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [60, 4],~ - Inside source: true *** True Line Result - attr_accessor :grid -** Processing line: ~~ + player: [60, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ # Provides access to game play recording facilities within Game Toolkit.~ + scenes: [ +** Processing line: ~ [0, 26, 5, 5, :blinking_light_observatory]~ - Inside source: true *** True Line Result - # Provides access to game play recording facilities within Game Toolkit. -** Processing line: ~ #~ + [0, 26, 5, 5, :blinking_light_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Recording]~ + ], +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ - Inside source: true *** True Line Result - # @return [Recording] -** Processing line: ~ attr_accessor :recording~ + render_override: :blinking_light_path_to_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - attr_accessor :recording + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Gives you access to geometry related functions.~ +** Processing line: ~ def blinking_light_observatory args~ - Inside source: true *** True Line Result - # Gives you access to geometry related functions. -** Processing line: ~ #~ + def blinking_light_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Geometry]~ + { +** Processing line: ~ background: 'sprites/observatory.png',~ - Inside source: true *** True Line Result - # @return [Geometry] -** Processing line: ~ attr_accessor :geometry~ + background: 'sprites/observatory.png', +** Processing line: ~ player: [60, 2],~ - Inside source: true *** True Line Result - attr_accessor :geometry -** Processing line: ~~ + player: [60, 2], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ # This is where you'll put state associated with your video game.~ + scenes: [ +** Processing line: ~ [28, 39, 4, 10, :blinking_light_inside_observatory]~ - Inside source: true *** True Line Result - # This is where you'll put state associated with your video game. -** Processing line: ~ #~ + [28, 39, 4, 10, :blinking_light_inside_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [OpenEntity]~ + ], +** Processing line: ~ render_override: :blinking_light_observatory_render~ - Inside source: true *** True Line Result - # @return [OpenEntity] -** Processing line: ~ attr_accessor :state~ + render_override: :blinking_light_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - attr_accessor :state + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Gives you access to the top level DragonRuby runtime.~ +** Processing line: ~ def blinking_light_inside_observatory args~ - Inside source: true *** True Line Result - # Gives you access to the top level DragonRuby runtime. -** Processing line: ~ #~ + def blinking_light_inside_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Runtime]~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - # @return [Runtime] -** Processing line: ~ attr_accessor :runtime~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ player: [60, 2],~ - Inside source: true *** True Line Result - attr_accessor :runtime -** Processing line: ~ alias_method :gtk, :runtime~ + player: [60, 2], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - alias_method :gtk, :runtime -** Processing line: ~~ + storylines: [ +** Processing line: ~ [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."]~ - Inside source: true *** True Line Result - -** Processing line: ~ attr_accessor :passes~ + [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - attr_accessor :passes -** Processing line: ~~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ attr_accessor :wizards~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :blinking_light_inside_mainframe]~ - Inside source: true *** True Line Result - attr_accessor :wizards -** Processing line: ~~ + [30, 18, 5, 12, :blinking_light_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize runtime, recording~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - def initialize runtime, recording -** Processing line: ~ @inputs = Inputs.new~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - @inputs = Inputs.new -** Processing line: ~ @outputs = Outputs.new args: self~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @outputs = Outputs.new args: self -** Processing line: ~ @passes = []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @passes = [] -** Processing line: ~ @state = OpenEntity.new~ + +** Processing line: ~ def blinking_light_inside_mainframe args~ - Inside source: true *** True Line Result - @state = OpenEntity.new -** Processing line: ~ @state.tick_count = -1~ + def blinking_light_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @state.tick_count = -1 -** Processing line: ~ @runtime = runtime~ + { +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - @runtime = runtime -** Processing line: ~ @recording = recording~ + background: 'sprites/mainframe.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - @recording = recording -** Processing line: ~ @grid = Grid.new runtime~ + fade: 60, +** Processing line: ~ player: [30, 4],~ - Inside source: true *** True Line Result - @grid = Grid.new runtime -** Processing line: ~ @render_targets = {}~ + player: [30, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @render_targets = {} -** Processing line: ~ @all_tests = []~ + scenes: [ +** Processing line: ~ [62, 32, 4, 32, :reply_to_introduction]~ - Inside source: true *** True Line Result - @all_tests = [] -** Processing line: ~ @geometry = GTK::Geometry~ + [62, 32, 4, 32, :reply_to_introduction] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @geometry = GTK::Geometry -** Processing line: ~ @wizards = Wizards.new~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @wizards = Wizards.new -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], +** Processing line: ~ [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],~ - Inside source: true *** True Line Result - -** Processing line: ~~ + [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], +** Processing line: ~ [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],~ - Inside source: true *** True Line Result - -** Processing line: ~ # The number of ticks since the start of the game.~ + [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], +** Processing line: ~ [14, 20, 24, 4, "What the heck activated--- this thing- though?"]~ - Inside source: true *** True Line Result - # The number of ticks since the start of the game. -** Processing line: ~ #~ + [14, 20, 24, 4, "What the heck activated--- this thing- though?"] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Integer]~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - # @return [Integer] -** Processing line: ~ def tick_count~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - def tick_count -** Processing line: ~ @state.tick_count~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @state.tick_count -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def tick_count= value~ -- Inside source: true -*** True Line Result - def tick_count= value -** Processing line: ~ @state.tick_count = value~ -- Inside source: true +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_day_one.rb~ +- Header detected. *** True Line Result - @state.tick_count = value -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ -- Inside source: true +* Rpg Narrative - Return Of Serenity - storyline_day_one.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def serialize~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ {~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb +** Processing line: ~ def day_one_beginning args~ - Inside source: true *** True Line Result - { -** Processing line: ~ state: state.as_hash,~ + def day_one_beginning args +** Processing line: ~ {~ - Inside source: true *** True Line Result - state: state.as_hash, -** Processing line: ~ inputs: inputs.serialize,~ + { +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - inputs: inputs.serialize, -** Processing line: ~ passes: passes.serialize,~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [16, 13],~ - Inside source: true *** True Line Result - passes: passes.serialize, -** Processing line: ~ outputs: outputs.serialize,~ + player: [16, 13], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - outputs: outputs.serialize, -** Processing line: ~ grid: grid.serialize~ + scenes: [ +** Processing line: ~ [0, 0, 64, 2, :day_one_infront_of_home],~ - Inside source: true *** True Line Result - grid: grid.serialize -** Processing line: ~ }~ + [0, 0, 64, 2, :day_one_infront_of_home], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]~ - Inside source: true *** True Line Result - -** Processing line: ~ def destructure~ + [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def destructure -** Processing line: ~ [grid, inputs, state, outputs, runtime, passes]~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - [grid, inputs, state, outputs, runtime, passes] -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def clear_render_targets~ +** Processing line: ~ def day_one_infront_of_home args~ - Inside source: true *** True Line Result - def clear_render_targets -** Processing line: ~ render_targets_clear~ + def day_one_infront_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - render_targets_clear -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/front-of-home.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/front-of-home.png', +** Processing line: ~ player: [56, 23],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_targets_clear~ + player: [56, 23], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def render_targets_clear -** Processing line: ~ @render_targets = {}~ + scenes: [ +** Processing line: ~ [43, 34, 10, 16, :day_one_home],~ - Inside source: true *** True Line Result - @render_targets = {} -** Processing line: ~ end~ + [43, 34, 10, 16, :day_one_home], +** Processing line: ~ [62, 0, 3, 40, :day_one_beginning],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [62, 0, 3, 40, :day_one_beginning], +** Processing line: ~ [0, 4, 3, 20, :day_one_ceremony]~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_targets~ + [0, 4, 3, 20, :day_one_ceremony] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def render_targets -** Processing line: ~ @render_targets~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @render_targets -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ def render_target name~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - def render_target name -** Processing line: ~ name = name.to_s~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - name = name.to_s -** Processing line: ~ if !@render_targets[name]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if !@render_targets[name] -** Processing line: ~ @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0])~ + +** Processing line: ~ def day_one_home args~ - Inside source: true *** True Line Result - @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0]) -** Processing line: ~ @passes << @render_targets[name]~ + def day_one_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @passes << @render_targets[name] -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~ @render_targets[name]~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 3],~ - Inside source: true *** True Line Result - @render_targets[name] -** Processing line: ~ end~ + player: [34, 3], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [28, 0, 12, 2, :day_one_infront_of_home]~ - Inside source: true *** True Line Result - -** Processing line: ~ def solids~ + [28, 0, 12, 2, :day_one_infront_of_home] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def solids -** Processing line: ~ @outputs.solids~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @outputs.solids -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ +** Processing line: ~ 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."~ - Inside source: true *** True Line Result - -** Processing line: ~ def static_solids~ + 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def static_solids -** Processing line: ~ @outputs.static_solids~ + ], +** Processing line: ~ [~ - Inside source: true *** True Line Result - @outputs.static_solids -** Processing line: ~ end~ + [ +** Processing line: ~ 28, 7, 4, 7,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 28, 7, 4, 7, +** Processing line: ~ "Ahhh. My reading- couch. It's so comfortable--."~ - Inside source: true *** True Line Result - -** Processing line: ~ def sprites~ + "Ahhh. My reading- couch. It's so comfortable--." +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def sprites -** Processing line: ~ @outputs.sprites~ + ], +** Processing line: ~ [~ - Inside source: true *** True Line Result - @outputs.sprites -** Processing line: ~ end~ + [ +** Processing line: ~ 38, 21, 4, 4,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 38, 21, 4, 4, +** Processing line: ~ "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."~ - Inside source: true *** True Line Result - -** Processing line: ~ def static_sprites~ + "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def static_sprites -** Processing line: ~ @outputs.static_sprites~ + ], +** Processing line: ~ [~ - Inside source: true *** True Line Result - @outputs.static_sprites -** Processing line: ~ end~ + [ +** Processing line: ~ 45, 37, 4, 8,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 45, 37, 4, 8, +** Processing line: ~ "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."~ - Inside source: true *** True Line Result - -** Processing line: ~ def labels~ + "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def labels -** Processing line: ~ @outputs.labels~ + ], +** Processing line: ~ [~ - Inside source: true *** True Line Result - @outputs.labels -** Processing line: ~ end~ + [ +** Processing line: ~ 32, 40, 8, 10,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 32, 40, 8, 10, +** Processing line: ~ "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."~ - Inside source: true *** True Line Result - -** Processing line: ~ def static_labels~ + "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def static_labels -** Processing line: ~ @outputs.static_labels~ + ], +** Processing line: ~ [~ - Inside source: true *** True Line Result - @outputs.static_labels -** Processing line: ~ end~ + [ +** Processing line: ~ 25, 21, 5, 12,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + 25, 21, 5, 12, +** Processing line: ~ "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."~ - Inside source: true *** True Line Result - -** Processing line: ~ def lines~ + "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def lines -** Processing line: ~ @outputs.lines~ + ] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @outputs.lines -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def static_lines~ +** Processing line: ~ def day_one_ceremony args~ - Inside source: true *** True Line Result - def static_lines -** Processing line: ~ @outputs.static_lines~ + def day_one_ceremony args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @outputs.static_lines -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/tribute.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/tribute.png', +** Processing line: ~ player: [57, 21],~ - Inside source: true *** True Line Result - -** Processing line: ~ def borders~ + player: [57, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def borders -** Processing line: ~ @outputs.borders~ + scenes: [ +** Processing line: ~ [62, 0, 2, 40, :day_one_infront_of_home],~ - Inside source: true *** True Line Result - @outputs.borders -** Processing line: ~ end~ + [62, 0, 2, 40, :day_one_infront_of_home], +** Processing line: ~ [0, 24, 2, 40, :day_one_infront_of_library]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [0, 24, 2, 40, :day_one_infront_of_library] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def static_borders~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def static_borders -** Processing line: ~ @outputs.static_borders~ + storylines: [ +** Processing line: ~ [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],~ - Inside source: true *** True Line Result - @outputs.static_borders -** Processing line: ~ end~ + [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], +** Processing line: ~ [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], +** Processing line: ~ [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],~ - Inside source: true *** True Line Result - -** Processing line: ~ def primitives~ + [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], +** Processing line: ~ [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],~ - Inside source: true *** True Line Result - def primitives -** Processing line: ~ @outputs.primitives~ + [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @outputs.primitives -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def static_primitives~ +** Processing line: ~ def day_one_infront_of_library args~ - Inside source: true *** True Line Result - def static_primitives -** Processing line: ~ @outputs.static_primitives~ + def day_one_infront_of_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @outputs.static_primitives -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/outside-library.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/outside-library.png', +** Processing line: ~ player: [57, 21],~ - Inside source: true *** True Line Result - -** Processing line: ~ def keyboard~ + player: [57, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def keyboard -** Processing line: ~ @inputs.keyboard~ + scenes: [ +** Processing line: ~ [62, 0, 2, 40, :day_one_ceremony],~ - Inside source: true *** True Line Result - @inputs.keyboard -** Processing line: ~ end~ + [62, 0, 2, 40, :day_one_ceremony], +** Processing line: ~ [49, 39, 6, 9, :day_one_library]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [49, 39, 6, 9, :day_one_library] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def click~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def click -** Processing line: ~ return nil unless @inputs.mouse.click~ + storylines: [ +** Processing line: ~ [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]~ - Inside source: true *** True Line Result - return nil unless @inputs.mouse.click -** Processing line: ~~ + [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ @inputs.mouse.click.point~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @inputs.mouse.click.point -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def click_at~ +** Processing line: ~ def day_one_library args~ - Inside source: true *** True Line Result - def click_at -** Processing line: ~ return nil unless @inputs.mouse.click~ + def day_one_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - return nil unless @inputs.mouse.click -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/library.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ @inputs.mouse.click.created_at~ + background: 'sprites/library.png', +** Processing line: ~ player: [27, 4],~ - Inside source: true *** True Line Result - @inputs.mouse.click.created_at -** Processing line: ~ end~ + player: [27, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [0, 0, 64, 2, :end_day_one_infront_of_library]~ - Inside source: true *** True Line Result - -** Processing line: ~ def mouse~ + [0, 0, 64, 2, :end_day_one_infront_of_library] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def mouse -** Processing line: ~ @inputs.mouse~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @inputs.mouse -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],~ - Inside source: true *** True Line Result - end + [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], +** Processing line: ~ [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]~ +- Inside source: true +*** True Line Result + [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @see Inputs#controller_one~ +** Processing line: ~ def end_day_one_infront_of_library args~ - Inside source: true *** True Line Result - # @see Inputs#controller_one -** Processing line: ~ # @return (see Inputs#controller_one)~ + def end_day_one_infront_of_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # @return (see Inputs#controller_one) -** Processing line: ~ def controller_one~ + { +** Processing line: ~ background: 'sprites/outside-library.png',~ - Inside source: true *** True Line Result - def controller_one -** Processing line: ~ @inputs.controller_one~ + background: 'sprites/outside-library.png', +** Processing line: ~ player: [51, 33],~ - Inside source: true *** True Line Result - @inputs.controller_one -** Processing line: ~ end~ + player: [51, 33], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [49, 39, 6, 9, :day_one_library],~ - Inside source: true *** True Line Result - -** Processing line: ~ # @see Inputs#controller_two~ + [49, 39, 6, 9, :day_one_library], +** Processing line: ~ [62, 0, 2, 40, :end_day_one_monument],~ - Inside source: true *** True Line Result - # @see Inputs#controller_two -** Processing line: ~ # @return (see Inputs#controller_two)~ + [62, 0, 2, 40, :end_day_one_monument], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # @return (see Inputs#controller_two) -** Processing line: ~ def controller_two~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def controller_two -** Processing line: ~ @inputs.controller_two~ + storylines: [ +** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."]~ - Inside source: true *** True Line Result - @inputs.controller_two -** Processing line: ~ end~ + [50, 27, 4, 4, "It's getting late. Better get some sleep."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -77409,534 +77964,554 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/assert.rb~ -- Header detected. +** Processing line: ~ def end_day_one_monument args~ +- Inside source: true *** True Line Result - + def end_day_one_monument args +** Processing line: ~ {~ +- Inside source: true *** True Line Result -* ./dragon/assert.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + { +** Processing line: ~ background: 'sprites/tribute.png',~ +- Inside source: true *** True Line Result - + background: 'sprites/tribute.png', +** Processing line: ~ player: [2, 36],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + player: [2, 36], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + scenes: [ +** Processing line: ~ [62, 0, 2, 40, :end_day_one_infront_of_home],~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + [62, 0, 2, 40, :end_day_one_infront_of_home], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # assert.rb has been released under MIT (*only this file*).~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - # assert.rb has been released under MIT (*only this file*). -** Processing line: ~~ + storylines: [ +** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."],~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + [50, 27, 4, 4, "It's getting late. Better get some sleep."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ =begin~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ This is a tiny assertion api for the unit testing portion of Game Toolkit.~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - This is a tiny assertion api for the unit testing portion of Game Toolkit. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @example~ +** Processing line: ~ def end_day_one_infront_of_home args~ - Inside source: true *** True Line Result - @example -** Processing line: ~~ + def end_day_one_infront_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ 1. Create a file called tests.rb under mygame.~ + { +** Processing line: ~ background: 'sprites/front-of-home.png',~ - Inside source: true *** True Line Result - 1. Create a file called tests.rb under mygame. -** Processing line: ~ 2. Any method that begins with the word test_ will be considered a test.~ + background: 'sprites/front-of-home.png', +** Processing line: ~ player: [1, 17],~ - Inside source: true *** True Line Result - 2. Any method that begins with the word test_ will be considered a test. -** Processing line: ~~ + player: [1, 17], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_this_works args, assert~ + scenes: [ +** Processing line: ~ [43, 34, 10, 16, :end_day_one_home],~ - Inside source: true *** True Line Result - def test_this_works args, assert -** Processing line: ~ assert.equal! 1, 1~ + [43, 34, 10, 16, :end_day_one_home], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - assert.equal! 1, 1 -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [20, 10, 4, 4, "It's getting late. Better get some sleep."],~ - Inside source: true *** True Line Result - -** Processing line: ~ 3. To run a test, save the file while the game is running.~ + [20, 10, 4, 4, "It's getting late. Better get some sleep."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - 3. To run a test, save the file while the game is running. -** Processing line: ~~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ @example~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @example + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ To add an assertion open up this class and write:~ +** Processing line: ~ def end_day_one_home args~ - Inside source: true *** True Line Result - To add an assertion open up this class and write: -** Processing line: ~~ + def end_day_one_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ class Assert~ + { +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - class Assert -** Processing line: ~ def custom_assertion actual, expected, message = nil~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 3],~ - Inside source: true *** True Line Result - def custom_assertion actual, expected, message = nil -** Processing line: ~ # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ + player: [34, 3], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). -** Processing line: ~ @assertion_performed = true~ + scenes: [ +** Processing line: ~ [32, 40, 8, 10, :end_day_one_dream],~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~~ + [32, 40, 8, 10, :end_day_one_dream], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # perform your custom logic here and rais an exception to denote a failure.~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - # perform your custom logic here and rais an exception to denote a failure. -** Processing line: ~~ + storylines: [ +** Processing line: ~ [38, 4, 4, 4, "It's getting late. Better get some sleep."],~ - Inside source: true *** True Line Result - -** Processing line: ~ raise "Some Error. #{message}."~ + [38, 4, 4, 4, "It's getting late. Better get some sleep."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - raise "Some Error. #{message}." -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ =end~ +** Processing line: ~~ - Inside source: true *** True Line Result - =end -** Processing line: ~ class Assert~ + +** Processing line: ~ def end_day_one_dream args~ - Inside source: true *** True Line Result - class Assert -** Processing line: ~ attr :assertion_performed~ + def end_day_one_dream args +** Processing line: ~ {~ - Inside source: true *** True Line Result - attr :assertion_performed -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/dream.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ =begin~ + background: 'sprites/dream.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ + fade: 60, +** Processing line: ~ player: [4, 4],~ - Inside source: true *** True Line Result - Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). -** Processing line: ~ =end~ + player: [4, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - =end -** Processing line: ~ def ok!~ + scenes: [ +** Processing line: ~ [62, 0, 2, 64, :explaining_the_special_power]~ - Inside source: true *** True Line Result - def ok! -** Processing line: ~ @assertion_performed = true~ + [62, 0, 2, 64, :explaining_the_special_power] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],~ - Inside source: true *** True Line Result - -** Processing line: ~ =begin~ + [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], +** Processing line: ~ [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user.~ + [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], +** Processing line: ~ [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]~ - Inside source: true *** True Line Result - Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. -** Processing line: ~~ + [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ @example~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @example + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def test_does_this_work args, assert~ +** Processing line: ~ def explaining_the_special_power args~ - Inside source: true *** True Line Result - def test_does_this_work args, assert -** Processing line: ~ some_result = Person.new~ + def explaining_the_special_power args +** Processing line: ~ {~ - Inside source: true *** True Line Result - some_result = Person.new -** Processing line: ~ assert.true! some_result~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - assert.true! some_result -** Processing line: ~ # OR~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - # OR -** Processing line: ~ assert.true! some_result, "Person was not created."~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [32, 30],~ - Inside source: true *** True Line Result - assert.true! some_result, "Person was not created." -** Processing line: ~ end~ + player: [32, 30], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ =end~ + scenes: [ +** Processing line: ~ [~ - Inside source: true *** True Line Result - =end -** Processing line: ~ def true! value, message = nil~ + [ +** Processing line: ~ 38, 21, 4, 4, :explaining_the_special_power_inside_computer~ - Inside source: true *** True Line Result - def true! value, message = nil -** Processing line: ~ @assertion_performed = true~ + 38, 21, 4, 4, :explaining_the_special_power_inside_computer +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~ if !value~ + ], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - if !value -** Processing line: ~ message = "#{value} was not truthy.\n#{message}"~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - message = "#{value} was not truthy.\n#{message}" -** Processing line: ~ raise "#{message}"~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - raise "#{message}" -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ nil~ + +** Processing line: ~ def explaining_the_special_power_inside_computer args~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + def explaining_the_special_power_inside_computer args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/pc.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ =begin~ + background: 'sprites/pc.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ Assert if a value is a falsey value.~ + fade: 60, +** Processing line: ~ player: [34, 4],~ - Inside source: true *** True Line Result - Assert if a value is a falsey value. -** Processing line: ~~ + player: [34, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ @example~ + scenes: [ +** Processing line: ~ [0, 62, 64, 3, :the_blinking_light]~ - Inside source: true *** True Line Result - @example -** Processing line: ~~ + [0, 62, 64, 3, :the_blinking_light] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_does_this_work args, assert~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def test_does_this_work args, assert -** Processing line: ~ some_result = nil~ + storylines: [ +** Processing line: ~ [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],~ - Inside source: true *** True Line Result - some_result = nil -** Processing line: ~ assert.false! some_result~ + [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], +** Processing line: ~ [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],~ - Inside source: true *** True Line Result - assert.false! some_result -** Processing line: ~ end~ + [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], +** Processing line: ~ [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],~ - Inside source: true *** True Line Result - end -** Processing line: ~ =end~ + [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], +** Processing line: ~ [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]~ - Inside source: true *** True Line Result - =end -** Processing line: ~ def false! value, message = nil~ + [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def false! value, message = nil -** Processing line: ~ @assertion_performed = true~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~ if value~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - if value -** Processing line: ~ message = "#{value} was not falsey.\n#{message}"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - message = "#{value} was not falsey.\n#{message}" -** Processing line: ~ raise message~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_final_decision.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Return Of Serenity - storyline_final_decision.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb~ - Inside source: true *** True Line Result - raise message -** Processing line: ~ end~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb +** Processing line: ~ def final_decision_side_of_home args~ - Inside source: true *** True Line Result - end -** Processing line: ~ nil~ + def final_decision_side_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + { +** Processing line: ~ fade: 120,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + fade: 120, +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ =begin~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [16, 13],~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ Assert if two values are equal.~ + player: [16, 13], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - Assert if two values are equal. -** Processing line: ~~ + scenes: [ +** Processing line: ~ [52, 24, 11, 5, :final_decision_mountain_pass],~ - Inside source: true *** True Line Result - -** Processing line: ~ @example~ + [52, 24, 11, 5, :final_decision_mountain_pass], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @example -** Processing line: ~~ + ], +** Processing line: ~ render_override: :blinking_light_side_of_home_render,~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_does_this_work args, assert~ + render_override: :blinking_light_side_of_home_render, +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def test_does_this_work args, assert -** Processing line: ~ a = 1~ + storylines: [ +** Processing line: ~ [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]~ - Inside source: true *** True Line Result - a = 1 -** Processing line: ~ b = 1~ + [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - b = 1 -** Processing line: ~ assert.equal! a, b~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - assert.equal! a, b + } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ =end~ +** Processing line: ~~ - Inside source: true *** True Line Result - =end -** Processing line: ~ def equal! actual, expected, message = nil~ + +** Processing line: ~ def final_decision_mountain_pass args~ - Inside source: true *** True Line Result - def equal! actual, expected, message = nil -** Processing line: ~ @assertion_performed = true~ + def final_decision_mountain_pass args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~ if actual != expected~ + { +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ - Inside source: true *** True Line Result - if actual != expected -** Processing line: ~ actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip~ + background: 'sprites/mountain-pass-zoomed-out.png', +** Processing line: ~ player: [4, 4],~ - Inside source: true *** True Line Result - actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip -** Processing line: ~ message = "actual:\n#{actual_string} did not equal\nexpected:\n#{expected}.\n#{message}"~ + player: [4, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - message = "actual:\n#{actual_string} did not equal\nexpected:\n#{expected}.\n#{message}" -** Processing line: ~ raise message~ + scenes: [ +** Processing line: ~ [18, 47, 5, 5, :final_decision_path_to_observatory]~ - Inside source: true *** True Line Result - raise message -** Processing line: ~ end~ + [18, 47, 5, 5, :final_decision_path_to_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~ nil~ + ], +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + render_override: :blinking_light_mountain_pass_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ =begin~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - =begin -** Processing line: ~ Assert if a value is explicitly nil (not false).~ + +** Processing line: ~ def final_decision_path_to_observatory args~ - Inside source: true *** True Line Result - Assert if a value is explicitly nil (not false). -** Processing line: ~~ + def final_decision_path_to_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ @example~ + { +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - @example -** Processing line: ~~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [60, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_does_this_work args, assert~ + player: [60, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def test_does_this_work args, assert -** Processing line: ~ a = nil~ + scenes: [ +** Processing line: ~ [0, 26, 5, 5, :final_decision_observatory]~ - Inside source: true *** True Line Result - a = nil -** Processing line: ~ b = false~ + [0, 26, 5, 5, :final_decision_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - b = false -** Processing line: ~ assert.nil! a # this will pass~ + ], +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ - Inside source: true *** True Line Result - assert.nil! a # this will pass -** Processing line: ~ assert.nil! b # this will throw an exception.~ + render_override: :blinking_light_path_to_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - assert.nil! b # this will throw an exception. + } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ =end~ +** Processing line: ~~ - Inside source: true *** True Line Result - =end -** Processing line: ~ def nil! value, message = nil~ + +** Processing line: ~ def final_decision_observatory args~ - Inside source: true *** True Line Result - def nil! value, message = nil -** Processing line: ~ @assertion_performed = true~ + def final_decision_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @assertion_performed = true -** Processing line: ~ if !value.nil?~ + { +** Processing line: ~ background: 'sprites/observatory.png',~ - Inside source: true *** True Line Result - if !value.nil? -** Processing line: ~ message = "#{value} was supposed to be nil, but wasn't.\n#{message}"~ + background: 'sprites/observatory.png', +** Processing line: ~ player: [60, 2],~ - Inside source: true *** True Line Result - message = "#{value} was supposed to be nil, but wasn't.\n#{message}" -** Processing line: ~ raise message~ + player: [60, 2], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - raise message -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [28, 39, 4, 10, :final_decision_inside_observatory]~ - Inside source: true *** True Line Result - end -** Processing line: ~ nil~ + [28, 39, 4, 10, :final_decision_inside_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + ], +** Processing line: ~ render_override: :blinking_light_observatory_render~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_override: :blinking_light_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -77945,186 +78520,186 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ def final_decision_inside_observatory args~ +- Inside source: true *** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + def final_decision_inside_observatory args +** Processing line: ~ {~ +- Inside source: true *** True Line Result - -** Processing line: ~* ./dragon/attr_gtk.rb~ -- Header detected. + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +- Inside source: true *** True Line Result - + background: 'sprites/inside-observatory.png', +** Processing line: ~ player: [60, 2],~ +- Inside source: true *** True Line Result -* ./dragon/attr_gtk.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + player: [60, 2], +** Processing line: ~ storylines: [],~ +- Inside source: true *** True Line Result - + storylines: [], +** Processing line: ~ scenes: [~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :final_decision_inside_mainframe]~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + [30, 18, 5, 12, :final_decision_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # attr_gtk.rb has been released under MIT (*only this file*).~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - # attr_gtk.rb has been released under MIT (*only this file*). -** Processing line: ~~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # @private~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # @private -** Processing line: ~ module AttrGTK~ + +** Processing line: ~ def final_decision_inside_mainframe args~ - Inside source: true *** True Line Result - module AttrGTK -** Processing line: ~ attr_accessor :args~ + def final_decision_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - attr_accessor :args -** Processing line: ~~ + { +** Processing line: ~ player: [32, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ def keyboard~ + player: [32, 4], +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - def keyboard -** Processing line: ~ args.inputs.keyboard~ + background: 'sprites/mainframe.png', +** Processing line: ~ storylines: [],~ - Inside source: true *** True Line Result - args.inputs.keyboard -** Processing line: ~ end~ + storylines: [], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [*hotspot_top, :final_decision_ship_status],~ - Inside source: true *** True Line Result - -** Processing line: ~ def grid~ + [*hotspot_top, :final_decision_ship_status], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def grid -** Processing line: ~ args.grid~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.grid -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def state~ -- Inside source: true -*** True Line Result - def state -** Processing line: ~ args.state~ +** Processing line: ~ def final_decision_ship_status args~ - Inside source: true *** True Line Result - args.state -** Processing line: ~ end~ + def final_decision_ship_status args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/serenity.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs~ + background: 'sprites/serenity.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - def inputs -** Processing line: ~ args.inputs~ + fade: 60, +** Processing line: ~ player: [30, 10],~ - Inside source: true *** True Line Result - args.inputs -** Processing line: ~ end~ + player: [30, 10], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [*hotspot_top_right, :final_decision]~ - Inside source: true *** True Line Result - -** Processing line: ~ def outputs~ + [*hotspot_top_right, :final_decision] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def outputs -** Processing line: ~ args.outputs~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - args.outputs -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [30, 8, 4, 4, "????"],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [30, 8, 4, 4, "????"], +** Processing line: ~ *final_decision_ship_status_shared(args)~ - Inside source: true *** True Line Result - -** Processing line: ~ def gtk~ + *final_decision_ship_status_shared(args) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def gtk -** Processing line: ~ args.gtk~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.gtk -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def passes~ +** Processing line: ~ def final_decision args~ - Inside source: true *** True Line Result - def passes -** Processing line: ~ args.passes~ + def final_decision args +** Processing line: ~ decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",~ - Inside source: true *** True Line Result - args.passes -** Processing line: ~ end~ + decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", +** Processing line: ~ "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", +** Processing line: ~ [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def geometry~ + [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], +** Processing line: ~ [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],~ - Inside source: true *** True Line Result - def geometry -** Processing line: ~ args.geometry~ + [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], +** Processing line: ~ [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],~ - Inside source: true *** True Line Result - args.geometry -** Processing line: ~ end~ + [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], +** Processing line: ~ [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]~ - Inside source: true *** True Line Result - end + [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -78133,110 +78708,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/attr_sprite.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* ./dragon/attr_sprite.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +** Processing line: ~ def final_decision_game_over_noone args~ +- Inside source: true *** True Line Result - + def final_decision_game_over_noone args +** Processing line: ~ {~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + { +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + background: 'sprites/tribute-game-over.png', +** Processing line: ~ player: [53, 14],~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # attr_sprite.rb has been released under MIT (*only this file*).~ + player: [53, 14], +** Processing line: ~ fade: 600~ - Inside source: true *** True Line Result - # attr_sprite.rb has been released under MIT (*only this file*). -** Processing line: ~~ + fade: 600 +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ # @private~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @private -** Processing line: ~ module AttrRect~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - module AttrRect -** Processing line: ~ def left~ + +** Processing line: ~ def final_decision_game_over_matthew args~ - Inside source: true *** True Line Result - def left -** Processing line: ~ @x~ + def final_decision_game_over_matthew args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @x -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/tribute-game-over.png', +** Processing line: ~ player: [53, 14],~ - Inside source: true *** True Line Result - -** Processing line: ~ def right~ + player: [53, 14], +** Processing line: ~ fade: 600~ - Inside source: true *** True Line Result - def right -** Processing line: ~ @x + @w~ + fade: 600 +** Processing line: ~ }~ - Inside source: true *** True Line Result - @x + @w -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def bottom~ -- Inside source: true -*** True Line Result - def bottom -** Processing line: ~ @y~ +** Processing line: ~ def final_decision_game_over_anka args~ - Inside source: true *** True Line Result - @y -** Processing line: ~ end~ + def final_decision_game_over_anka args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ def top~ + background: 'sprites/tribute-game-over.png', +** Processing line: ~ player: [53, 14],~ - Inside source: true *** True Line Result - def top -** Processing line: ~ @y + @h~ + player: [53, 14], +** Processing line: ~ fade: 600~ - Inside source: true *** True Line Result - @y + @h -** Processing line: ~ end~ + fade: 600 +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -78245,134 +78804,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ module AttrSprite~ +** Processing line: ~ def final_decision_game_over_sasha args~ - Inside source: true *** True Line Result - module AttrSprite -** Processing line: ~ include AttrRect~ + def final_decision_game_over_sasha args +** Processing line: ~ {~ - Inside source: true *** True Line Result - include AttrRect -** Processing line: ~ include GTK::Geometry~ -- Inside source: true -*** True Line Result - include GTK::Geometry -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x,~ -- Inside source: true -*** True Line Result - attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, -** Processing line: ~ :tile_y, :tile_w, :tile_h, :flip_horizontally,~ -- Inside source: true -*** True Line Result - :tile_y, :tile_w, :tile_h, :flip_horizontally, -** Processing line: ~ :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id,~ -- Inside source: true -*** True Line Result - :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, -** Processing line: ~ :source_x, :source_y, :source_w, :source_h~ -- Inside source: true -*** True Line Result - :source_x, :source_y, :source_w, :source_h -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def primitive_marker~ -- Inside source: true -*** True Line Result - def primitive_marker -** Processing line: ~ :sprite~ -- Inside source: true -*** True Line Result - :sprite -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def sprite~ -- Inside source: true -*** True Line Result - def sprite -** Processing line: ~ self~ -- Inside source: true -*** True Line Result - self -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/tribute-game-over.png', +** Processing line: ~ player: [53, 14],~ - Inside source: true *** True Line Result - -** Processing line: ~ def x1~ + player: [53, 14], +** Processing line: ~ fade: 600~ - Inside source: true *** True Line Result - def x1 -** Processing line: ~ @x~ + fade: 600 +** Processing line: ~ }~ - Inside source: true *** True Line Result - @x -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def x1= value~ -- Inside source: true -*** True Line Result - def x1= value -** Processing line: ~ @x = value~ -- Inside source: true -*** True Line Result - @x = value -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ +** Processing line: ~ def final_decision_ship_status_shared args~ - Inside source: true *** True Line Result - -** Processing line: ~ def y1~ + def final_decision_ship_status_shared args +** Processing line: ~ [~ - Inside source: true *** True Line Result - def y1 -** Processing line: ~ @y~ + [ +** Processing line: ~ *ship_control_hotspot(24, 22,~ - Inside source: true *** True Line Result - @y -** Processing line: ~ end~ + *ship_control_hotspot(24, 22, +** Processing line: ~ "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", +** Processing line: ~ "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ - Inside source: true *** True Line Result - -** Processing line: ~ def y1= value~ + "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", +** Processing line: ~ "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ - Inside source: true *** True Line Result - def y1= value -** Processing line: ~ @y = value~ + "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", +** Processing line: ~ "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),~ - Inside source: true *** True Line Result - @y = value -** Processing line: ~ end~ + "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -78389,3290 +78884,3334 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/console.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_final_message.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/console.rb +* Rpg Narrative - Return Of Serenity - storyline_final_message.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ -- Inside source: true -*** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ -- Inside source: true -*** True Line Result - # MIT License -** Processing line: ~ # console.rb has been released under MIT (*only this file*).~ -- Inside source: true -*** True Line Result - # console.rb has been released under MIT (*only this file*). -** Processing line: ~~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb~ - Inside source: true *** True Line Result - -** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb +** Processing line: ~ def final_message_sad args~ - Inside source: true *** True Line Result - # Contributors outside of DragonRuby who also hold Copyright: -** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ + def final_message_sad args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # - Kevin Fischer: https://github.com/kfischer-okarin -** Processing line: ~~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Console~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 35],~ - Inside source: true *** True Line Result - class Console -** Processing line: ~ attr_accessor :show_reason, :log, :logo, :background_color,~ + player: [34, 35], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - attr_accessor :show_reason, :log, :logo, :background_color, -** Processing line: ~ :text_color, :animation_duration,~ + storylines: [ +** Processing line: ~ [34, 34, 4, 4, "Another-- sleepless-- night..."],~ - Inside source: true *** True Line Result - :text_color, :animation_duration, -** Processing line: ~ :max_log_lines, :max_history, :log,~ + [34, 34, 4, 4, "Another-- sleepless-- night..."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - :max_log_lines, :max_history, :log, -** Processing line: ~ :last_command_errored, :last_command, :error_color, :shown_at,~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - :last_command_errored, :last_command, :error_color, :shown_at, -** Processing line: ~ :header_color, :archived_log, :last_log_lines, :last_log_lines_count,~ + scenes: [ +** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ - Inside source: true *** True Line Result - :header_color, :archived_log, :last_log_lines, :last_log_lines_count, -** Processing line: ~ :suppress_left_arrow_behavior, :command_set_at,~ + [32, -1, 8, 3, :final_message_observatory] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - :suppress_left_arrow_behavior, :command_set_at, -** Processing line: ~ :toast_ids, :bottom,~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - :toast_ids, :bottom, -** Processing line: ~ :font_style, :menu~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - :font_style, :menu + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize~ +** Processing line: ~ def final_message_happy args~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1)~ + def final_message_happy args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) -** Processing line: ~ @menu = Menu.new self~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - @menu = Menu.new self -** Processing line: ~ @disabled = false~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - @disabled = false -** Processing line: ~ @log_offset = 0~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 35],~ - Inside source: true *** True Line Result - @log_offset = 0 -** Processing line: ~ @visible = false~ + player: [34, 35], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @visible = false -** Processing line: ~ @toast_ids = []~ + storylines: [ +** Processing line: ~ [34, 34, 4, 4, "Oh man, I slept like rock!"],~ - Inside source: true *** True Line Result - @toast_ids = [] -** Processing line: ~ @archived_log = []~ + [34, 34, 4, 4, "Oh man, I slept like rock!"], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @archived_log = [] -** Processing line: ~ @log = [ 'Console ready.' ]~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @log = [ 'Console ready.' ] -** Processing line: ~ @max_log_lines = 1000 # I guess...?~ + scenes: [ +** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ - Inside source: true *** True Line Result - @max_log_lines = 1000 # I guess...? -** Processing line: ~ @max_history = 1000 # I guess...?~ + [32, -1, 8, 3, :final_message_observatory] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @max_history = 1000 # I guess...? -** Processing line: ~ @log_invocation_count = 0~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @log_invocation_count = 0 -** Processing line: ~ @command_history = []~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @command_history = [] -** Processing line: ~ @command_history_index = -1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @command_history_index = -1 -** Processing line: ~ @nonhistory_input = ''~ + +** Processing line: ~ def final_message_side_of_home args~ - Inside source: true *** True Line Result - @nonhistory_input = '' -** Processing line: ~ @logo = 'console-logo.png'~ + def final_message_side_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @logo = 'console-logo.png' -** Processing line: ~ @history_fname = 'console_history.txt'~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - @history_fname = 'console_history.txt' -** Processing line: ~ @background_color = Color.new [0, 0, 0, 224]~ + fade: 60, +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - @background_color = Color.new [0, 0, 0, 224] -** Processing line: ~ @text_color = Color.new [255, 255, 255]~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [16, 13],~ - Inside source: true *** True Line Result - @text_color = Color.new [255, 255, 255] -** Processing line: ~ @error_color = Color.new [200, 50, 50]~ + player: [16, 13], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @error_color = Color.new [200, 50, 50] -** Processing line: ~ @header_color = Color.new [100, 200, 220]~ + scenes: [ +** Processing line: ~ [52, 24, 11, 5, :final_message_mountain_pass],~ - Inside source: true *** True Line Result - @header_color = Color.new [100, 200, 220] -** Processing line: ~ @animation_duration = 1.seconds~ + [52, 24, 11, 5, :final_message_mountain_pass], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @animation_duration = 1.seconds -** Processing line: ~ @shown_at = -1~ + ], +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ - Inside source: true *** True Line Result - @shown_at = -1 -** Processing line: ~ load_history~ + render_override: :blinking_light_side_of_home_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - load_history -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def console_text_width~ +** Processing line: ~ def final_message_mountain_pass args~ - Inside source: true *** True Line Result - def console_text_width -** Processing line: ~ @console_text_width ||= ($gtk.logical_width - 20).idiv(font_style.letter_size.x)~ + def final_message_mountain_pass args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @console_text_width ||= ($gtk.logical_width - 20).idiv(font_style.letter_size.x) -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/mountain-pass-zoomed-out.png', +** Processing line: ~ player: [4, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ def save_history~ + player: [4, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def save_history -** Processing line: ~ $gtk.ffi_file.storefile(@history_fname, @command_history.reverse.join("\n"))~ + scenes: [ +** Processing line: ~ [18, 47, 5, 5, :final_message_path_to_observatory],~ - Inside source: true *** True Line Result - $gtk.ffi_file.storefile(@history_fname, @command_history.reverse.join("\n")) -** Processing line: ~ end~ + [18, 47, 5, 5, :final_message_path_to_observatory], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def load_history~ + storylines: [ +** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ - Inside source: true *** True Line Result - def load_history -** Processing line: ~ @command_history.clear~ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @command_history.clear -** Processing line: ~ str = $gtk.ffi_file.loadfile(@history_fname)~ + ], +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ - Inside source: true *** True Line Result - str = $gtk.ffi_file.loadfile(@history_fname) -** Processing line: ~ return if str.nil? # no history to load.~ + render_override: :blinking_light_mountain_pass_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - return if str.nil? # no history to load. + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ str.chomp!("\n") # Don't let endlines at the end cause extra blank line.~ +** Processing line: ~ def final_message_path_to_observatory args~ - Inside source: true *** True Line Result - str.chomp!("\n") # Don't let endlines at the end cause extra blank line. -** Processing line: ~ str.chomp!("\r")~ + def final_message_path_to_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - str.chomp!("\r") -** Processing line: ~ str.each_line { |s|~ + { +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - str.each_line { |s| -** Processing line: ~ s.chomp!("\n")~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [60, 4],~ - Inside source: true *** True Line Result - s.chomp!("\n") -** Processing line: ~ s.chomp!("\r")~ + player: [60, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - s.chomp!("\r") -** Processing line: ~ if s.length > 0~ + scenes: [ +** Processing line: ~ [0, 26, 5, 5, :final_message_observatory]~ - Inside source: true *** True Line Result - if s.length > 0 -** Processing line: ~ @command_history.unshift s~ + [0, 26, 5, 5, :final_message_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @command_history.unshift s -** Processing line: ~ break if @command_history.length >= @max_history~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - break if @command_history.length >= @max_history -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ - Inside source: true *** True Line Result - end -** Processing line: ~ }~ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - } -** Processing line: ~~ + ], +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ - Inside source: true *** True Line Result - -** Processing line: ~ @command_history.uniq!~ + render_override: :blinking_light_path_to_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - @command_history.uniq! -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def disable~ +** Processing line: ~ def final_message_observatory args~ - Inside source: true *** True Line Result - def disable -** Processing line: ~ @disabled = true~ + def final_message_observatory args +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ - Inside source: true *** True Line Result - @disabled = true -** Processing line: ~ end~ + if args.state.scene_history.include? :replied_with_whole_truth +** Processing line: ~ return {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ def enable~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - def enable -** Processing line: ~ @disabled = false~ + fade: 60, +** Processing line: ~ player: [51, 12],~ - Inside source: true *** True Line Result - @disabled = false -** Processing line: ~ end~ + player: [51, 12], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [50, 10, 4, 4, "Here-- we- go..."]~ - Inside source: true *** True Line Result - -** Processing line: ~ def addsprite obj~ + [50, 10, 4, 4, "Here-- we- go..."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def addsprite obj -** Processing line: ~ @log_invocation_count += 1~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @log_invocation_count += 1 -** Processing line: ~ obj[:id] ||= "id_#{obj[:path]}_#{Time.now.to_i}".to_sym~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ - Inside source: true *** True Line Result - obj[:id] ||= "id_#{obj[:path]}_#{Time.now.to_i}".to_sym -** Processing line: ~~ + [30, 18, 5, 12, :final_message_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ if @last_line_log_index &&~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - if @last_line_log_index && -** Processing line: ~ @last_sprite_line.is_a?(Hash) &&~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - @last_sprite_line.is_a?(Hash) && -** Processing line: ~ @last_sprite_line[:id] == obj[:id]~ + } +** Processing line: ~ else~ - Inside source: true *** True Line Result - @last_sprite_line[:id] == obj[:id] -** Processing line: ~~ + else +** Processing line: ~ return {~ - Inside source: true *** True Line Result - -** Processing line: ~ @log[@last_line_log_index] = obj~ + return { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - @log[@last_line_log_index] = obj -** Processing line: ~ return~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + fade: 60, +** Processing line: ~ player: [51, 12],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + player: [51, 12], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ @log << obj~ + storylines: [ +** Processing line: ~ [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]~ - Inside source: true *** True Line Result - @log << obj -** Processing line: ~ @last_line_log_index = @log.length - 1~ + [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @last_line_log_index = @log.length - 1 -** Processing line: ~ @last_sprite_line = obj~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @last_sprite_line = obj -** Processing line: ~ nil~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + [30, 18, 5, 12, :final_message_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - -** Processing line: ~ def add_primitive obj~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - def add_primitive obj -** Processing line: ~ if obj.is_a? Hash~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - if obj.is_a? Hash -** Processing line: ~ addsprite obj~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - addsprite obj -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ addtext obj~ + +** Processing line: ~ def final_message_inside_mainframe args~ - Inside source: true *** True Line Result - addtext obj -** Processing line: ~ end~ + def final_message_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~ nil~ + { +** Processing line: ~ player: [32, 4],~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + player: [32, 4], +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/mainframe.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ def addtext obj~ + fade: 60, +** Processing line: ~ scenes: [[45, 45, 4, 4, :final_message_check_ship_status]]~ - Inside source: true *** True Line Result - def addtext obj -** Processing line: ~ @last_log_lines_count ||= 1~ + scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @last_log_lines_count ||= 1 -** Processing line: ~ @log_invocation_count += 1~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @log_invocation_count += 1 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ str = obj.to_s~ +** Processing line: ~ def final_message_check_ship_status args~ - Inside source: true *** True Line Result - str = obj.to_s -** Processing line: ~~ + def final_message_check_ship_status args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ log_lines = []~ + { +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - log_lines = [] -** Processing line: ~~ + background: 'sprites/mainframe.png', +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ str.each_line do |s|~ + storylines: [ +** Processing line: ~ [45, 45, 4, 4, (final_message_current args)],~ - Inside source: true *** True Line Result - str.each_line do |s| -** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ + [45, 45, 4, 4, (final_message_current args)], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - s.wrapped_lines(self.console_text_width).each do |l| -** Processing line: ~ log_lines << l~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - log_lines << l -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [*hotspot_top, :final_message_ship_status],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [*hotspot_top, :final_message_ship_status], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ if log_lines == @last_log_lines~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - if log_lines == @last_log_lines -** Processing line: ~ @last_log_lines_count += 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @last_log_lines_count += 1 -** Processing line: ~ new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})"~ + +** Processing line: ~ def final_message_ship_status args~ - Inside source: true *** True Line Result - new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})" -** Processing line: ~ if log_lines.length > 1~ + def final_message_ship_status args +** Processing line: ~ {~ - Inside source: true *** True Line Result - if log_lines.length > 1 -** Processing line: ~ @log = @log[0..-(@log.length - log_lines.length)] + log_lines[0..-2] + [new_log_line_with_count]~ + { +** Processing line: ~ background: 'sprites/serenity.png',~ - Inside source: true *** True Line Result - @log = @log[0..-(@log.length - log_lines.length)] + log_lines[0..-2] + [new_log_line_with_count] -** Processing line: ~ else~ + background: 'sprites/serenity.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - else -** Processing line: ~ @log = @log[0..-2] + [new_log_line_with_count]~ + fade: 60, +** Processing line: ~ player: [30, 10],~ - Inside source: true *** True Line Result - @log = @log[0..-2] + [new_log_line_with_count] -** Processing line: ~ end~ + player: [30, 10], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ return~ + scenes: [ +** Processing line: ~ [30, 50, 4, 4, :final_message_ship_status_reviewed]~ - Inside source: true *** True Line Result - return -** Processing line: ~ end~ + [30, 50, 4, 4, :final_message_ship_status_reviewed] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ log_lines.each do |l|~ + storylines: [ +** Processing line: ~ [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],~ - Inside source: true *** True Line Result - log_lines.each do |l| -** Processing line: ~ @log.shift if @log.length > @max_log_lines~ + [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], +** Processing line: ~ *final_message_ship_status_shared(args)~ - Inside source: true *** True Line Result - @log.shift if @log.length > @max_log_lines -** Processing line: ~ @log << l~ + *final_message_ship_status_shared(args) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @log << l -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @last_log_lines_count = 1~ +** Processing line: ~ def final_message_ship_status_reviewed args~ - Inside source: true *** True Line Result - @last_log_lines_count = 1 -** Processing line: ~ @last_log_lines = log_lines~ + def final_message_ship_status_reviewed args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @last_log_lines = log_lines -** Processing line: ~ nil~ + { +** Processing line: ~ background: 'sprites/serenity.png',~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + background: 'sprites/serenity.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + fade: 60, +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def ready?~ + scenes: [ +** Processing line: ~ [*hotspot_bottom, :final_message_summary]~ - Inside source: true *** True Line Result - def ready? -** Processing line: ~ visible? && @toggled_at.elapsed?(@animation_duration, Kernel.global_tick_count)~ + [*hotspot_bottom, :final_message_summary] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - visible? && @toggled_at.elapsed?(@animation_duration, Kernel.global_tick_count) -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],~ - Inside source: true *** True Line Result - -** Processing line: ~ def hidden?~ + [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def hidden? -** Processing line: ~ !@visible~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - !@visible -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def visible?~ -- Inside source: true -*** True Line Result - def visible? -** Processing line: ~ @visible~ +** Processing line: ~ def final_message_ship_status_shared args~ - Inside source: true *** True Line Result - @visible -** Processing line: ~ end~ + def final_message_ship_status_shared args +** Processing line: ~ [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ +** Processing line: ~ *ship_control_hotspot( 0, 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + *ship_control_hotspot( 0, 50, +** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def show reason = nil~ + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", +** Processing line: ~ "Matthew's--- Chamber--: OCCUPIED----",~ - Inside source: true *** True Line Result - def show reason = nil -** Processing line: ~ @shown_at = Kernel.global_tick_count~ + "Matthew's--- Chamber--: OCCUPIED----", +** Processing line: ~ "Aanka's--- Chamber--: OCCUPIED----",~ - Inside source: true *** True Line Result - @shown_at = Kernel.global_tick_count -** Processing line: ~ @show_reason = reason~ + "Aanka's--- Chamber--: OCCUPIED----", +** Processing line: ~ "Sasha's--- Chamber--: OCCUPIED----"),~ - Inside source: true *** True Line Result - @show_reason = reason -** Processing line: ~ toggle if hidden?~ + "Sasha's--- Chamber--: OCCUPIED----"), +** Processing line: ~ *ship_control_hotspot(12, 35,~ - Inside source: true *** True Line Result - toggle if hidden? -** Processing line: ~ end~ + *ship_control_hotspot(12, 35, +** Processing line: ~ "Life- Support--: Not-- Needed---",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Life- Support--: Not-- Needed---", +** Processing line: ~ "O2--- Production---: OFF---",~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + "O2--- Production---: OFF---", +** Processing line: ~ "CO2--- Scrubbers---: OFF---",~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def hide~ + "CO2--- Scrubbers---: OFF---", +** Processing line: ~ "H2O--- Production---: OFF---"),~ - Inside source: true *** True Line Result - def hide -** Processing line: ~ if visible?~ + "H2O--- Production---: OFF---"), +** Processing line: ~ *ship_control_hotspot(24, 20,~ - Inside source: true *** True Line Result - if visible? -** Processing line: ~ toggle~ + *ship_control_hotspot(24, 20, +** Processing line: ~ "Navigation: Offline---",~ - Inside source: true *** True Line Result - toggle -** Processing line: ~ @archived_log += @log~ + "Navigation: Offline---", +** Processing line: ~ "Sensor: OFF---",~ - Inside source: true *** True Line Result - @archived_log += @log -** Processing line: ~ if @archived_log.length > @max_log_lines~ + "Sensor: OFF---", +** Processing line: ~ "Heads- Up- Display: DAMAGED---",~ - Inside source: true *** True Line Result - if @archived_log.length > @max_log_lines -** Processing line: ~ @archived_log = @archived_log.drop(@archived_log.length - @max_log_lines)~ + "Heads- Up- Display: DAMAGED---", +** Processing line: ~ "Arithmetic--- Unit: DAMAGED----"),~ - Inside source: true *** True Line Result - @archived_log = @archived_log.drop(@archived_log.length - @max_log_lines) -** Processing line: ~ end~ + "Arithmetic--- Unit: DAMAGED----"), +** Processing line: ~ *ship_control_hotspot(36, 35,~ - Inside source: true *** True Line Result - end -** Processing line: ~ @log.clear~ + *ship_control_hotspot(36, 35, +** Processing line: ~ "COMM: Underpowered----",~ - Inside source: true *** True Line Result - @log.clear -** Processing line: ~ @show_reason = nil~ + "COMM: Underpowered----", +** Processing line: ~ "Text: ON---",~ - Inside source: true *** True Line Result - @show_reason = nil -** Processing line: ~ clear_toast~ + "Text: ON---", +** Processing line: ~ "Audio: SEGFAULT---",~ - Inside source: true *** True Line Result - clear_toast -** Processing line: ~ end~ + "Audio: SEGFAULT---", +** Processing line: ~ "Video: DAMAGED---"),~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + "Video: DAMAGED---"), +** Processing line: ~ *ship_control_hotspot(48, 50,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + *ship_control_hotspot(48, 50, +** Processing line: ~ "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",~ - Inside source: true *** True Line Result - -** Processing line: ~ def close~ + "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", +** Processing line: ~ "Engine I: ON---",~ - Inside source: true *** True Line Result - def close -** Processing line: ~ hide~ + "Engine I: ON---", +** Processing line: ~ "Engine II: ON---",~ - Inside source: true *** True Line Result - hide -** Processing line: ~ end~ + "Engine II: ON---", +** Processing line: ~ "Engine III: ON---")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Engine III: ON---") +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ def clear_toast~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - def clear_toast -** Processing line: ~ @toasted_at = nil~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @toasted_at = nil -** Processing line: ~ @toast_duration = 0~ + +** Processing line: ~ def final_message_last_reply args~ - Inside source: true *** True Line Result - @toast_duration = 0 -** Processing line: ~ end~ + def final_message_last_reply args +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if args.state.scene_history.include? :replied_with_whole_truth +** Processing line: ~ return "Buffer--: #{anka_reply_whole_truth.quote}"~ - Inside source: true *** True Line Result - -** Processing line: ~ def toggle~ + return "Buffer--: #{anka_reply_whole_truth.quote}" +** Processing line: ~ else~ - Inside source: true *** True Line Result - def toggle -** Processing line: ~ @visible = !@visible~ + else +** Processing line: ~ return "Buffer--: #{anka_reply_half_truth.quote}"~ - Inside source: true *** True Line Result - @visible = !@visible -** Processing line: ~ @toggled_at = Kernel.global_tick_count~ + return "Buffer--: #{anka_reply_half_truth.quote}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - @toggled_at = Kernel.global_tick_count -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def currently_toasting?~ +** Processing line: ~ def final_message_current args~ - Inside source: true *** True Line Result - def currently_toasting? -** Processing line: ~ return false if hidden?~ + def final_message_current args +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ - Inside source: true *** True Line Result - return false if hidden? -** Processing line: ~ return false unless @show_reason == :toast~ + if args.state.scene_history.include? :replied_with_whole_truth +** Processing line: ~ return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."~ - Inside source: true *** True Line Result - return false unless @show_reason == :toast -** Processing line: ~ return false unless @toasted_at~ + return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." +** Processing line: ~ else~ - Inside source: true *** True Line Result - return false unless @toasted_at -** Processing line: ~ return false if @toasted_at.elapsed?(5.seconds, Kernel.global_tick_count)~ + else +** Processing line: ~ return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"~ - Inside source: true *** True Line Result - return false if @toasted_at.elapsed?(5.seconds, Kernel.global_tick_count) -** Processing line: ~ return true~ + return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" +** Processing line: ~ end~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def toast_extended id = nil, duration = nil, *messages~ +** Processing line: ~ def final_message_summary args~ - Inside source: true *** True Line Result - def toast_extended id = nil, duration = nil, *messages -** Processing line: ~ if !id.is_a?(Symbol)~ + def final_message_summary args +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ - Inside source: true *** True Line Result - if !id.is_a?(Symbol) -** Processing line: ~ raise <<-S~ + if args.state.scene_history.include? :replied_with_whole_truth +** Processing line: ~ return {~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + return { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ args.gtk.console.toast has the following signature:~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - args.gtk.console.toast has the following signature: -** Processing line: ~~ + fade: 60, +** Processing line: ~ player: [31, 11],~ - Inside source: true *** True Line Result - -** Processing line: ~ def toast id, *messages~ + player: [31, 11], +** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ - Inside source: true *** True Line Result - def toast id, *messages -** Processing line: ~ end~ + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],~ - Inside source: true *** True Line Result - -** Processing line: ~ The id property uniquely defines the message and must be~ + [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - The id property uniquely defines the message and must be -** Processing line: ~ a symbol.~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - a symbol. -** Processing line: ~~ + } +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ After that, you can provide all the objects you want to~ + else +** Processing line: ~ return {~ - Inside source: true *** True Line Result - After that, you can provide all the objects you want to -** Processing line: ~ look at.~ + return { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - look at. -** Processing line: ~~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ Example:~ + fade: 60, +** Processing line: ~ player: [31, 11],~ - Inside source: true *** True Line Result - Example: -** Processing line: ~~ + player: [31, 11], +** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ - Inside source: true *** True Line Result - -** Processing line: ~ args.gtk.console.toast :say_hello,~ + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - args.gtk.console.toast :say_hello, -** Processing line: ~ \"Hello world.\",~ + storylines: [ +** Processing line: ~ [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],~ - Inside source: true *** True Line Result - \"Hello world.\", -** Processing line: ~ args.state.tick_count~ + [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.state.tick_count -** Processing line: ~~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ Toast messages autohide after 5 seconds.~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - Toast messages autohide after 5 seconds. -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ If you need to look at something for longer, use~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - If you need to look at something for longer, use -** Processing line: ~ args.gtk.console.perma_toast instead (which you can manually dismiss).~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - args.gtk.console.perma_toast instead (which you can manually dismiss). +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ S~ -- Inside source: true +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb~ +- Header detected. *** True Line Result - S -** Processing line: ~ end~ -- Inside source: true + *** True Line Result - end -** Processing line: ~~ -- Inside source: true +* Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ return if currently_toasting?~ -- Inside source: true *** True Line Result - return if currently_toasting? -** Processing line: ~ return if @toast_ids.include? id~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb~ - Inside source: true *** True Line Result - return if @toast_ids.include? id -** Processing line: ~ @toasted_at = Kernel.global_tick_count~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb +** Processing line: ~ def serenity_alive_side_of_home args~ - Inside source: true *** True Line Result - @toasted_at = Kernel.global_tick_count -** Processing line: ~ log_once_info :perma_toast_tip, "Use console.perma_toast to show the toast for longer."~ + def serenity_alive_side_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - log_once_info :perma_toast_tip, "Use console.perma_toast to show the toast for longer." -** Processing line: ~ dwim_duration = 5.seconds~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - dwim_duration = 5.seconds -** Processing line: ~ addtext "* toast :#{id}"~ + fade: 60, +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - addtext "* toast :#{id}" -** Processing line: ~ puts "* TOAST: :#{id}"~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [16, 13],~ - Inside source: true *** True Line Result - puts "* TOAST: :#{id}" -** Processing line: ~ messages.each do |message|~ + player: [16, 13], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - messages.each do |message| -** Processing line: ~ lines = message.to_s.wrapped_lines(self.console_text_width)~ + scenes: [ +** Processing line: ~ [52, 24, 11, 5, :serenity_alive_mountain_pass],~ - Inside source: true *** True Line Result - lines = message.to_s.wrapped_lines(self.console_text_width) -** Processing line: ~ dwim_duration += lines.length.seconds~ + [52, 24, 11, 5, :serenity_alive_mountain_pass], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - dwim_duration += lines.length.seconds -** Processing line: ~ addtext "** #{message}"~ + ], +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ - Inside source: true *** True Line Result - addtext "** #{message}" -** Processing line: ~ puts "** #{message}"~ + render_override: :blinking_light_side_of_home_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - puts "** #{message}" -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ show :toast~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - show :toast -** Processing line: ~ @toast_duration += duration || dwim_duration~ + +** Processing line: ~ def serenity_alive_mountain_pass args~ - Inside source: true *** True Line Result - @toast_duration += duration || dwim_duration -** Processing line: ~ @toast_ids << id~ + def serenity_alive_mountain_pass args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @toast_ids << id -** Processing line: ~ set_command "$gtk.console.hide"~ + { +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ - Inside source: true *** True Line Result - set_command "$gtk.console.hide" -** Processing line: ~ end~ + background: 'sprites/mountain-pass-zoomed-out.png', +** Processing line: ~ player: [4, 4],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + player: [4, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def perma_toast id = nil, messages~ + scenes: [ +** Processing line: ~ [18, 47, 5, 5, :serenity_alive_path_to_observatory],~ - Inside source: true *** True Line Result - def perma_toast id = nil, messages -** Processing line: ~ toast_extended id, 600.seconds, *messages~ + [18, 47, 5, 5, :serenity_alive_path_to_observatory], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - toast_extended id, 600.seconds, *messages -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ - Inside source: true *** True Line Result - -** Processing line: ~ def toast id = nil, *messages~ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def toast id = nil, *messages -** Processing line: ~ toast_extended id, nil, *messages~ + ], +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ - Inside source: true *** True Line Result - toast_extended id, nil, *messages -** Processing line: ~ end~ + render_override: :blinking_light_mountain_pass_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def console_toggle_keys~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def console_toggle_keys -** Processing line: ~ [~ + +** Processing line: ~ def serenity_alive_path_to_observatory args~ - Inside source: true *** True Line Result - [ -** Processing line: ~ :backtick!,~ + def serenity_alive_path_to_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - :backtick!, -** Processing line: ~ :tilde!,~ + { +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - :tilde!, -** Processing line: ~ :superscript_two!,~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [60, 4],~ - Inside source: true *** True Line Result - :superscript_two!, -** Processing line: ~ :section_sign!,~ + player: [60, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - :section_sign!, -** Processing line: ~ :ordinal_indicator!,~ + scenes: [ +** Processing line: ~ [0, 26, 5, 5, :serenity_alive_observatory]~ - Inside source: true *** True Line Result - :ordinal_indicator!, -** Processing line: ~ :circumflex!,~ + [0, 26, 5, 5, :serenity_alive_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - :circumflex!, -** Processing line: ~ ]~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + storylines: [ +** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def console_toggle_key_down? args~ + ], +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ - Inside source: true *** True Line Result - def console_toggle_key_down? args -** Processing line: ~ args.inputs.keyboard.key_down.any? console_toggle_keys~ + render_override: :blinking_light_path_to_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.any? console_toggle_keys -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def eval_the_set_command~ +** Processing line: ~ def serenity_alive_observatory args~ - Inside source: true *** True Line Result - def eval_the_set_command -** Processing line: ~ cmd = current_input_str.strip~ + def serenity_alive_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - cmd = current_input_str.strip -** Processing line: ~ if cmd.length != 0~ + { +** Processing line: ~ background: 'sprites/observatory.png',~ - Inside source: true *** True Line Result - if cmd.length != 0 -** Processing line: ~ @log_offset = 0~ + background: 'sprites/observatory.png', +** Processing line: ~ player: [60, 2],~ - Inside source: true *** True Line Result - @log_offset = 0 -** Processing line: ~ prompt.clear~ + player: [60, 2], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - prompt.clear -** Processing line: ~~ + scenes: [ +** Processing line: ~ [28, 39, 4, 10, :serenity_alive_inside_observatory]~ - Inside source: true *** True Line Result - -** Processing line: ~ @command_history.pop while @command_history.length >= @max_history~ + [28, 39, 4, 10, :serenity_alive_inside_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @command_history.pop while @command_history.length >= @max_history -** Processing line: ~ @command_history.unshift cmd~ + ], +** Processing line: ~ render_override: :blinking_light_observatory_render~ - Inside source: true *** True Line Result - @command_history.unshift cmd -** Processing line: ~ @command_history_index = -1~ + render_override: :blinking_light_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - @command_history_index = -1 -** Processing line: ~ @nonhistory_input = ''~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @nonhistory_input = '' + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa'~ +** Processing line: ~ def serenity_alive_inside_observatory args~ - Inside source: true *** True Line Result - if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa' -** Processing line: ~ $gtk.request_quit~ + def serenity_alive_inside_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - $gtk.request_quit -** Processing line: ~ else~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - else -** Processing line: ~ puts "-> #{cmd}"~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ player: [60, 2],~ - Inside source: true *** True Line Result - puts "-> #{cmd}" -** Processing line: ~ begin~ + player: [60, 2], +** Processing line: ~ storylines: [],~ - Inside source: true *** True Line Result - begin -** Processing line: ~ @last_command = cmd~ + storylines: [], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @last_command = cmd -** Processing line: ~ Kernel.eval("$results = (#{cmd})")~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :serenity_alive_inside_mainframe]~ - Inside source: true *** True Line Result - Kernel.eval("$results = (#{cmd})") -** Processing line: ~ if $results.nil?~ + [30, 18, 5, 12, :serenity_alive_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - if $results.nil? -** Processing line: ~ puts "=> nil"~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - puts "=> nil" -** Processing line: ~ elsif $results == :console_silent_eval~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - elsif $results == :console_silent_eval -** Processing line: ~ else~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - else -** Processing line: ~ puts "=> #{$results}"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - puts "=> #{$results}" -** Processing line: ~ end~ + +** Processing line: ~ def serenity_alive_inside_mainframe args~ - Inside source: true *** True Line Result - end -** Processing line: ~ @last_command_errored = false~ + def serenity_alive_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @last_command_errored = false -** Processing line: ~ rescue Exception => e~ + { +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ string_e = "#{e}"~ + background: 'sprites/mainframe.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - string_e = "#{e}" -** Processing line: ~ @last_command_errored = true~ + fade: 60, +** Processing line: ~ player: [30, 4],~ - Inside source: true *** True Line Result - @last_command_errored = true -** Processing line: ~ if (string_e.include? "wrong number of arguments")~ + player: [30, 4], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - if (string_e.include? "wrong number of arguments") -** Processing line: ~ method_name = (string_e.split ":")[0].gsub "'", ""~ + scenes: [ +** Processing line: ~ [*hotspot_top, :serenity_alive_ship_status],~ - Inside source: true *** True Line Result - method_name = (string_e.split ":")[0].gsub "'", "" -** Processing line: ~ results = Kernel.docs_search method_name~ + [*hotspot_top, :serenity_alive_ship_status], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - results = Kernel.docs_search method_name -** Processing line: ~ if !results.include "* DOCS: No results found."~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - if !results.include "* DOCS: No results found." -** Processing line: ~ puts results~ + storylines: [ +** Processing line: ~ [22, 45, 17, 4, (serenity_alive_last_reply args)],~ - Inside source: true *** True Line Result - puts results -** Processing line: ~ log results~ + [22, 45, 17, 4, (serenity_alive_last_reply args)], +** Processing line: ~ [45, 45, 4, 4, (serenity_alive_current_message args)],~ - Inside source: true *** True Line Result - log results -** Processing line: ~ end~ + [45, 45, 4, 4, (serenity_alive_current_message args)], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ puts "#{e}"~ +** Processing line: ~ def serenity_alive_ship_status args~ - Inside source: true *** True Line Result - puts "#{e}" -** Processing line: ~ log "#{e}"~ + def serenity_alive_ship_status args +** Processing line: ~ {~ - Inside source: true *** True Line Result - log "#{e}" -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/serenity.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + background: 'sprites/serenity.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + fade: 60, +** Processing line: ~ player: [30, 10],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + player: [30, 10], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_scroll_up_full? args~ + [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def inputs_scroll_up_full? args -** Processing line: ~ return false if @disabled~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ args.inputs.keyboard.key_down.pageup ||~ + storylines: [ +** Processing line: ~ [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.pageup || -** Processing line: ~ (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control)~ + [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], +** Processing line: ~ [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],~ - Inside source: true *** True Line Result - (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control) -** Processing line: ~ end~ + [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], +** Processing line: ~ *serenity_alive_shared_ship_status(args)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + *serenity_alive_shared_ship_status(args) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ def scroll_up_full~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - def scroll_up_full -** Processing line: ~ @log_offset += lines_on_one_page~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @log_offset += lines_on_one_page -** Processing line: ~ @log_offset = @log.size if @log_offset > @log.size~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @log_offset = @log.size if @log_offset > @log.size -** Processing line: ~ end~ + +** Processing line: ~ def serenity_alive_ship_status_reviewed args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def serenity_alive_ship_status_reviewed args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_scroll_up_half? args~ + { +** Processing line: ~ background: 'sprites/serenity.png',~ - Inside source: true *** True Line Result - def inputs_scroll_up_half? args -** Processing line: ~ return false if @disabled~ + background: 'sprites/serenity.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ args.inputs.keyboard.ctrl_u~ + fade: 60, +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - args.inputs.keyboard.ctrl_u -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [*hotspot_bottom, :serenity_alive_time_to_reply]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [*hotspot_bottom, :serenity_alive_time_to_reply] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def scroll_up_half~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def scroll_up_half -** Processing line: ~ @log_offset += lines_on_one_page.idiv(2)~ + storylines: [ +** Processing line: ~ [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],~ - Inside source: true *** True Line Result - @log_offset += lines_on_one_page.idiv(2) -** Processing line: ~ @log_offset = @log.size if @log_offset > @log.size~ + [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @log_offset = @log.size if @log_offset > @log.size -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def inputs_scroll_down_full? args~ +** Processing line: ~ def serenity_alive_time_to_reply args~ - Inside source: true *** True Line Result - def inputs_scroll_down_full? args -** Processing line: ~ return false if @disabled~ + def serenity_alive_time_to_reply args +** Processing line: ~ decision_graph serenity_alive_current_message(args),~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ args.inputs.keyboard.key_down.pagedown ||~ + decision_graph serenity_alive_current_message(args), +** Processing line: ~ "Okay... time to deliver the bad news...",~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.pagedown || -** Processing line: ~ (args.inputs.keyboard.key_up.f && args.inputs.keyboard.key_up.control)~ + "Okay... time to deliver the bad news...", +** Processing line: ~ [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],~ - Inside source: true *** True Line Result - (args.inputs.keyboard.key_up.f && args.inputs.keyboard.key_up.control) -** Processing line: ~ end~ + [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], +** Processing line: ~ [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]~ - Inside source: true *** True Line Result - end + [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def scroll_down_full~ +** Processing line: ~ def serenity_alive_shared_ship_status args~ - Inside source: true *** True Line Result - def scroll_down_full -** Processing line: ~ @log_offset -= lines_on_one_page~ + def serenity_alive_shared_ship_status args +** Processing line: ~ [~ - Inside source: true *** True Line Result - @log_offset -= lines_on_one_page -** Processing line: ~ @log_offset = 0 if @log_offset < 0~ + [ +** Processing line: ~ *ship_control_hotspot( 0, 50,~ - Inside source: true *** True Line Result - @log_offset = 0 if @log_offset < 0 -** Processing line: ~ end~ + *ship_control_hotspot( 0, 50, +** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_scroll_down_half? args~ + nil, +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - def inputs_scroll_down_half? args -** Processing line: ~ return false if @disabled~ + nil, +** Processing line: ~ nil),~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ args.inputs.keyboard.ctrl_d~ + nil), +** Processing line: ~ *ship_control_hotspot(12, 35,~ - Inside source: true *** True Line Result - args.inputs.keyboard.ctrl_d -** Processing line: ~ end~ + *ship_control_hotspot(12, 35, +** Processing line: ~ "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - -** Processing line: ~ def inputs_clear_command? args~ + nil, +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - def inputs_clear_command? args -** Processing line: ~ return false if @disabled~ + nil, +** Processing line: ~ nil),~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ args.inputs.keyboard.escape || args.inputs.keyboard.ctrl_g~ + nil), +** Processing line: ~ *ship_control_hotspot(24, 20,~ - Inside source: true *** True Line Result - args.inputs.keyboard.escape || args.inputs.keyboard.ctrl_g -** Processing line: ~ end~ + *ship_control_hotspot(24, 20, +** Processing line: ~ "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - -** Processing line: ~ def scroll_down_half~ + nil, +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - def scroll_down_half -** Processing line: ~ @log_offset -= lines_on_one_page.idiv(2)~ + nil, +** Processing line: ~ nil),~ - Inside source: true *** True Line Result - @log_offset -= lines_on_one_page.idiv(2) -** Processing line: ~ @log_offset = 0 if @log_offset < 0~ + nil), +** Processing line: ~ *ship_control_hotspot(36, 35,~ - Inside source: true *** True Line Result - @log_offset = 0 if @log_offset < 0 -** Processing line: ~ end~ + *ship_control_hotspot(36, 35, +** Processing line: ~ "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - -** Processing line: ~ def mouse_wheel_scroll args~ + nil, +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - def mouse_wheel_scroll args -** Processing line: ~ @inertia ||= 0~ + nil, +** Processing line: ~ nil),~ - Inside source: true *** True Line Result - @inertia ||= 0 -** Processing line: ~~ + nil), +** Processing line: ~ *ship_control_hotspot(48, 50,~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0~ + *ship_control_hotspot(48, 50, +** Processing line: ~ "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",~ - Inside source: true *** True Line Result - if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 -** Processing line: ~ @inertia = 1~ + "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - @inertia = 1 -** Processing line: ~ elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0~ + nil, +** Processing line: ~ nil,~ - Inside source: true *** True Line Result - elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 -** Processing line: ~ @inertia = -1~ + nil, +** Processing line: ~ nil)~ - Inside source: true *** True Line Result - @inertia = -1 -** Processing line: ~ end~ + nil) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ def serenity_alive_firm_reply~ - Inside source: true *** True Line Result - if args.inputs.mouse.click -** Processing line: ~ @inertia = 0~ + def serenity_alive_firm_reply +** Processing line: ~ "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."~ - Inside source: true *** True Line Result - @inertia = 0 -** Processing line: ~ end~ + "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return if @inertia == 0~ +** Processing line: ~ def serenity_alive_sugarcoated_reply~ - Inside source: true *** True Line Result - return if @inertia == 0 + def serenity_alive_sugarcoated_reply +** Processing line: ~ "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."~ +- Inside source: true +*** True Line Result + "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if @inertia != 0~ +** Processing line: ~ def replied_to_serenity_alive_firmly args~ - Inside source: true *** True Line Result - if @inertia != 0 -** Processing line: ~ @inertia = (@inertia * 0.7)~ + def replied_to_serenity_alive_firmly args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @inertia = (@inertia * 0.7) -** Processing line: ~ if @inertia > 0~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - if @inertia > 0 -** Processing line: ~ @log_offset -= 1~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - @log_offset -= 1 -** Processing line: ~ elsif @inertia < 0~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - elsif @inertia < 0 -** Processing line: ~ @log_offset += 1~ + player: [32, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @log_offset += 1 -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - -** Processing line: ~ if @inertia.abs < 0.01~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],~ - Inside source: true *** True Line Result - if @inertia.abs < 0.01 -** Processing line: ~ @inertia = 0~ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], +** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ - Inside source: true *** True Line Result - @inertia = 0 -** Processing line: ~ end~ + *serenity_alive_reply_completed_shared_hotspots(args), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end + ] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if @log_offset > @log.size~ +** Processing line: ~ def replied_to_serenity_alive_kindly args~ - Inside source: true *** True Line Result - if @log_offset > @log.size -** Processing line: ~ @log_offset = @log.size~ + def replied_to_serenity_alive_kindly args +** Processing line: ~ {~ - Inside source: true *** True Line Result - @log_offset = @log.size -** Processing line: ~ elsif @log_offset < 0~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - elsif @log_offset < 0 -** Processing line: ~ @log_offset = 0~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - @log_offset = 0 -** Processing line: ~ end~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + player: [32, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ - Inside source: true *** True Line Result - -** Processing line: ~ def process_inputs args~ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - def process_inputs args -** Processing line: ~ if console_toggle_key_down? args~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - if console_toggle_key_down? args -** Processing line: ~ args.inputs.text.clear~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],~ - Inside source: true *** True Line Result - args.inputs.text.clear -** Processing line: ~ toggle~ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], +** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ - Inside source: true *** True Line Result - toggle -** Processing line: ~ end~ + *serenity_alive_reply_completed_shared_hotspots(args), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ return unless visible?~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - return unless visible? + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.inputs.text.each { |str| prompt << str }~ +** Processing line: ~ def serenity_alive_path_from_observatory args~ - Inside source: true *** True Line Result - args.inputs.text.each { |str| prompt << str } -** Processing line: ~ args.inputs.text.clear~ + def serenity_alive_path_from_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - args.inputs.text.clear -** Processing line: ~ mouse_wheel_scroll args~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - mouse_wheel_scroll args -** Processing line: ~~ + fade: 60, +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ @log_offset = 0 if @log_offset < 0~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [4, 21],~ - Inside source: true *** True Line Result - @log_offset = 0 if @log_offset < 0 -** Processing line: ~~ + player: [4, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.keyboard.key_down.enter~ + scenes: [ +** Processing line: ~ [*hotspot_bottom_right, :serenity_bio_infront_of_home]~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.enter -** Processing line: ~ eval_the_set_command~ + [*hotspot_bottom_right, :serenity_bio_infront_of_home] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - eval_the_set_command -** Processing line: ~ elsif args.inputs.keyboard.key_down.v~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.v -** Processing line: ~ if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta~ + storylines: [ +** Processing line: ~ [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta -** Processing line: ~ prompt << $gtk.ffi_misc.getclipboard~ + [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - prompt << $gtk.ffi_misc.getclipboard -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif args.inputs.keyboard.key_down.up~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.up -** Processing line: ~ if @command_history_index == -1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if @command_history_index == -1 -** Processing line: ~ @nonhistory_input = current_input_str~ + +** Processing line: ~ def serenity_alive_reply_completed_shared_hotspots args~ - Inside source: true *** True Line Result - @nonhistory_input = current_input_str -** Processing line: ~ end~ + def serenity_alive_reply_completed_shared_hotspots args +** Processing line: ~ [~ - Inside source: true *** True Line Result - end -** Processing line: ~ if @command_history_index < (@command_history.length - 1)~ + [ +** Processing line: ~ [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],~ - Inside source: true *** True Line Result - if @command_history_index < (@command_history.length - 1) -** Processing line: ~ @command_history_index += 1~ + [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], +** Processing line: ~ [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],~ - Inside source: true *** True Line Result - @command_history_index += 1 -** Processing line: ~ self.current_input_str = @command_history[@command_history_index].dup~ + [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], +** Processing line: ~ [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]~ - Inside source: true *** True Line Result - self.current_input_str = @command_history[@command_history_index].dup -** Processing line: ~ end~ + [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif args.inputs.keyboard.key_down.down~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.down -** Processing line: ~ if @command_history_index == 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if @command_history_index == 0 -** Processing line: ~ @command_history_index = -1~ + +** Processing line: ~ def serenity_alive_last_reply args~ - Inside source: true *** True Line Result - @command_history_index = -1 -** Processing line: ~ self.current_input_str = @nonhistory_input~ + def serenity_alive_last_reply args +** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ - Inside source: true *** True Line Result - self.current_input_str = @nonhistory_input -** Processing line: ~ @nonhistory_input = ''~ + if args.state.scene_history.include? :replied_to_introduction_seriously +** Processing line: ~ return "Buffer--: \"Hello, Who- is sending-- this message--?\""~ - Inside source: true *** True Line Result - @nonhistory_input = '' -** Processing line: ~ elsif @command_history_index > 0~ + return "Buffer--: \"Hello, Who- is sending-- this message--?\"" +** Processing line: ~ else~ - Inside source: true *** True Line Result - elsif @command_history_index > 0 -** Processing line: ~ @command_history_index -= 1~ + else +** Processing line: ~ return "Buffer--: \"New- phone. Who dis?\""~ - Inside source: true *** True Line Result - @command_history_index -= 1 -** Processing line: ~ self.current_input_str = @command_history[@command_history_index].dup~ + return "Buffer--: \"New- phone. Who dis?\"" +** Processing line: ~ end~ - Inside source: true *** True Line Result - self.current_input_str = @command_history[@command_history_index].dup -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif inputs_scroll_up_full? args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs_scroll_up_full? args -** Processing line: ~ scroll_up_full~ + +** Processing line: ~ def serenity_alive_current_message args~ - Inside source: true *** True Line Result - scroll_up_full -** Processing line: ~ elsif inputs_scroll_down_full? args~ + def serenity_alive_current_message args +** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ - Inside source: true *** True Line Result - elsif inputs_scroll_down_full? args -** Processing line: ~ scroll_down_full~ + if args.state.scene_history.include? :replied_to_introduction_seriously +** Processing line: ~ "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote~ - Inside source: true *** True Line Result - scroll_down_full -** Processing line: ~ elsif inputs_scroll_up_half? args~ + "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote +** Processing line: ~ else~ - Inside source: true *** True Line Result - elsif inputs_scroll_up_half? args -** Processing line: ~ scroll_up_half~ + else +** Processing line: ~ "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote~ - Inside source: true *** True Line Result - scroll_up_half -** Processing line: ~ elsif inputs_scroll_down_half? args~ + "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif inputs_scroll_down_half? args -** Processing line: ~ scroll_down_half~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - scroll_down_half -** Processing line: ~ elsif inputs_clear_command? args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif inputs_clear_command? args -** Processing line: ~ prompt.clear~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - prompt.clear -** Processing line: ~ @command_history_index = -1~ +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb~ - Inside source: true *** True Line Result - @command_history_index = -1 -** Processing line: ~ @nonhistory_input = ''~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb +** Processing line: ~ def serenity_bio_infront_of_home args~ - Inside source: true *** True Line Result - @nonhistory_input = '' -** Processing line: ~ elsif args.inputs.keyboard.key_down.backspace || args.inputs.keyboard.key_down.delete~ + def serenity_bio_infront_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.backspace || args.inputs.keyboard.key_down.delete -** Processing line: ~ prompt.backspace~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - prompt.backspace -** Processing line: ~ elsif args.inputs.keyboard.key_down.tab~ + fade: 60, +** Processing line: ~ background: 'sprites/front-of-home.png',~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.tab -** Processing line: ~ prompt.autocomplete~ + background: 'sprites/front-of-home.png', +** Processing line: ~ player: [54, 23],~ - Inside source: true *** True Line Result - prompt.autocomplete -** Processing line: ~ end~ + player: [54, 23], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [44, 34, 8, 14, :serenity_bio_inside_home],~ - Inside source: true *** True Line Result - -** Processing line: ~ args.inputs.keyboard.key_down.clear~ + [44, 34, 8, 14, :serenity_bio_inside_home], +** Processing line: ~ [0, 3, 3, 22, :serenity_bio_library]~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_down.clear -** Processing line: ~ args.inputs.keyboard.key_up.clear~ + [0, 3, 3, 22, :serenity_bio_library] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_up.clear -** Processing line: ~ args.inputs.keyboard.key_held.clear~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - args.inputs.keyboard.key_held.clear -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def write_primitive_and_return_offset(args, left, y, str, archived: false)~ -- Inside source: true -*** True Line Result - def write_primitive_and_return_offset(args, left, y, str, archived: false) -** Processing line: ~ if str.is_a?(Hash)~ +** Processing line: ~ def serenity_bio_inside_home args~ - Inside source: true *** True Line Result - if str.is_a?(Hash) -** Processing line: ~ padding = 10~ + def serenity_bio_inside_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - padding = 10 -** Processing line: ~ args.outputs.reserved << [left + 10, y + 5, str[:w], str[:h], str[:path]].sprite~ + { +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - args.outputs.reserved << [left + 10, y + 5, str[:w], str[:h], str[:path]].sprite -** Processing line: ~ return str[:h] + padding~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 4],~ - Inside source: true *** True Line Result - return str[:h] + padding -** Processing line: ~ else~ + player: [34, 4], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - else -** Processing line: ~ write_line args, left, y, str, archived: archived~ + storylines: [ +** Processing line: ~ [34, 4, 4, 4, "I'm--- completely--- exhausted."],~ - Inside source: true *** True Line Result - write_line args, left, y, str, archived: archived -** Processing line: ~ return line_height_px~ + [34, 4, 4, 4, "I'm--- completely--- exhausted."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - return line_height_px -** Processing line: ~ end~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [30, 38, 12, 13, :serenity_bio_restless_sleep],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [30, 38, 12, 13, :serenity_bio_restless_sleep], +** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ - Inside source: true *** True Line Result - -** Processing line: ~ def write_line(args, left, y, str, archived: false)~ + [32, 0, 8, 3, :serenity_bio_infront_of_home], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def write_line(args, left, y, str, archived: false) -** Processing line: ~ color = color_for_log_entry(str)~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - color = color_for_log_entry(str) -** Processing line: ~ color = color.mult_alpha(0.5) if archived~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - color = color.mult_alpha(0.5) if archived + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color)~ -- Inside source: true -*** True Line Result - args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color) -** Processing line: ~ end~ +** Processing line: ~ def serenity_bio_restless_sleep args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def serenity_bio_restless_sleep args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ def should_tick?~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - def should_tick? -** Processing line: ~ return false if !@toggled_at~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - return false if !@toggled_at -** Processing line: ~ return false if slide_progress == 0~ + background: 'sprites/inside-home.png', +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - return false if slide_progress == 0 -** Processing line: ~ return false if @disabled~ + storylines: [ +** Processing line: ~ [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],~ - Inside source: true *** True Line Result - return false if @disabled -** Processing line: ~ return visible?~ + [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - return visible? -** Processing line: ~ end~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ - Inside source: true *** True Line Result - -** Processing line: ~ def render args~ + [32, 0, 8, 3, :serenity_bio_infront_of_home], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def render args -** Processing line: ~ return if !@toggled_at~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - return if !@toggled_at -** Processing line: ~ return if slide_progress == 0~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if slide_progress == 0 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @bottom = top - (h * slide_progress)~ +** Processing line: ~ def serenity_bio_library args~ - Inside source: true *** True Line Result - @bottom = top - (h * slide_progress) -** Processing line: ~ args.outputs.reserved << [left, @bottom, w, h, *@background_color.mult_alpha(slide_progress)].solid~ + def serenity_bio_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - args.outputs.reserved << [left, @bottom, w, h, *@background_color.mult_alpha(slide_progress)].solid -** Processing line: ~ args.outputs.reserved << [right.shift_left(110), @bottom.shift_up(630), 100, 100, @logo, 0, (80.0 * slide_progress).to_i].sprite~ + { +** Processing line: ~ background: 'sprites/library.png',~ - Inside source: true *** True Line Result - args.outputs.reserved << [right.shift_left(110), @bottom.shift_up(630), 100, 100, @logo, 0, (80.0 * slide_progress).to_i].sprite -** Processing line: ~~ + background: 'sprites/library.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ y = @bottom + 2 # just give us a little padding at the bottom.~ + fade: 60, +** Processing line: ~ player: [30, 7],~ - Inside source: true *** True Line Result - y = @bottom + 2 # just give us a little padding at the bottom. -** Processing line: ~ prompt.render args, x: left.shift_right(10), y: y~ + player: [30, 7], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - prompt.render args, x: left.shift_right(10), y: y -** Processing line: ~ y += line_height_px * 1.5~ + scenes: [ +** Processing line: ~ [21, 35, 3, 18, :serenity_bio_book]~ - Inside source: true *** True Line Result - y += line_height_px * 1.5 -** Processing line: ~ args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(slide_progress))~ + [21, 35, 3, 18, :serenity_bio_book] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(slide_progress)) -** Processing line: ~ y += line_height_px.to_f / 2.0~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - y += line_height_px.to_f / 2.0 + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ((@log.size - @log_offset) - 1).downto(0) do |idx|~ +** Processing line: ~ def serenity_bio_book args~ - Inside source: true *** True Line Result - ((@log.size - @log_offset) - 1).downto(0) do |idx| -** Processing line: ~ offset_after_write = write_primitive_and_return_offset args, left, y, @log[idx]~ + def serenity_bio_book args +** Processing line: ~ {~ - Inside source: true *** True Line Result - offset_after_write = write_primitive_and_return_offset args, left, y, @log[idx] -** Processing line: ~ y += offset_after_write~ + { +** Processing line: ~ background: 'sprites/book.png',~ - Inside source: true *** True Line Result - y += offset_after_write -** Processing line: ~ break if y > top~ + background: 'sprites/book.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - break if y > top -** Processing line: ~ end~ + fade: 60, +** Processing line: ~ player: [6, 52],~ - Inside source: true *** True Line Result - end + player: [6, 52], +** Processing line: ~ storylines: [~ +- Inside source: true +*** True Line Result + storylines: [ +** Processing line: ~ [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],~ +- Inside source: true +*** True Line Result + [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # past log separator~ +** Processing line: ~ [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],~ - Inside source: true *** True Line Result - # past log separator -** Processing line: ~ args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * slide_progress))~ + [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], +** Processing line: ~ [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],~ - Inside source: true *** True Line Result - args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * slide_progress)) + [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ y += line_height_px~ +** Processing line: ~ [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],~ - Inside source: true *** True Line Result - y += line_height_px + [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], +** Processing line: ~ [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],~ +- Inside source: true +*** True Line Result + [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ((@archived_log.size - @log_offset) - 1).downto(0) do |idx|~ +** Processing line: ~ [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],~ - Inside source: true *** True Line Result - ((@archived_log.size - @log_offset) - 1).downto(0) do |idx| -** Processing line: ~ offset_after_write = write_primitive_and_return_offset args, left, y, @archived_log[idx], archived: true~ + [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], +** Processing line: ~ [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],~ - Inside source: true *** True Line Result - offset_after_write = write_primitive_and_return_offset args, left, y, @archived_log[idx], archived: true -** Processing line: ~ y += offset_after_write~ + [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - y += offset_after_write -** Processing line: ~ break if y > top~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - break if y > top -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [*hotspot_bottom, :serenity_bio_finally_to_bed]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [*hotspot_bottom, :serenity_bio_finally_to_bed] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ render_log_offset args~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - render_log_offset args -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick_help args~ +** Processing line: ~ def serenity_bio_finally_to_bed args~ - Inside source: true *** True Line Result - def tick_help args -** Processing line: ~ tick_help_debounce args~ + def serenity_bio_finally_to_bed args +** Processing line: ~ {~ - Inside source: true *** True Line Result - tick_help_debounce args -** Processing line: ~ alpha_rate = 20~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - alpha_rate = 20 -** Processing line: ~ @render_help_target_alpha ||= 255~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - @render_help_target_alpha ||= 255 -** Processing line: ~ @render_help_current_alpha ||= 255~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [35, 3],~ - Inside source: true *** True Line Result - @render_help_current_alpha ||= 255 -** Processing line: ~ @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha~ + player: [35, 3], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha -** Processing line: ~ @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20)~ + storylines: [ +** Processing line: ~ [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],~ - Inside source: true *** True Line Result - @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20) -** Processing line: ~~ + [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255)~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255) -** Processing line: ~ @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255)~ + scenes: [ +** Processing line: ~ [32, 38, 10, 13, :bad_dream],~ - Inside source: true *** True Line Result - @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255) -** Processing line: ~~ + [32, 38, 10, 13, :bad_dream], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ [~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - [ -** Processing line: ~ "* Prompt Commands: ",~ + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ - Inside source: true *** True Line Result - "* Prompt Commands: ", -** Processing line: ~ "You can type any of the following ",~ + +** Processing line: ~ def bad_dream args~ - Inside source: true *** True Line Result - "You can type any of the following ", -** Processing line: ~ "commands in the command prompt. ",~ + def bad_dream args +** Processing line: ~ {~ - Inside source: true *** True Line Result - "commands in the command prompt. ", -** Processing line: ~ "** docs: Provides API docs. ",~ + { +** Processing line: ~ fade: 120,~ - Inside source: true *** True Line Result - "** docs: Provides API docs. ", -** Processing line: ~ "** $gtk: Accesses the global runtime.",~ + fade: 120, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - "** $gtk: Accesses the global runtime.", -** Processing line: ~ "* Shortcut Keys: ",~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [34, 35],~ - Inside source: true *** True Line Result - "* Shortcut Keys: ", -** Processing line: ~ "** full page up: ctrl + b ",~ + player: [34, 35], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - "** full page up: ctrl + b ", -** Processing line: ~ "** full page down: ctrl + f ",~ + storylines: [ +** Processing line: ~ [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],~ - Inside source: true *** True Line Result - "** full page down: ctrl + f ", -** Processing line: ~ "** half page up: ctrl + u ",~ + [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - "** half page up: ctrl + u ", -** Processing line: ~ "** half page down: ctrl + d ",~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - "** half page down: ctrl + d ", -** Processing line: ~ "** clear prompt: ctrl + g ",~ + scenes: [ +** Processing line: ~ [32, -1, 8, 3, :bad_dream_observatory]~ - Inside source: true *** True Line Result - "** clear prompt: ctrl + g ", -** Processing line: ~ "** up arrow: next command ",~ + [32, -1, 8, 3, :bad_dream_observatory] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - "** up arrow: next command ", -** Processing line: ~ "** down arrow: prev command ",~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - "** down arrow: prev command ", -** Processing line: ~ ].each_with_index do |s, i|~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - ].each_with_index do |s, i| -** Processing line: ~ args.outputs.reserved << [args.grid.right - 10,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.reserved << [args.grid.right - 10, -** Processing line: ~ top - 100 - line_height_px * i * 0.8,~ + +** Processing line: ~ def bad_dream_observatory args~ - Inside source: true *** True Line Result - top - 100 - line_height_px * i * 0.8, -** Processing line: ~ s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label~ + def bad_dream_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 120,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + fade: 120, +** Processing line: ~ player: [51, 12],~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick_help_debounce args~ + player: [51, 12], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def tick_help_debounce args -** Processing line: ~ hide_log_alpha = -255~ + storylines: [ +** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ - Inside source: true *** True Line Result - hide_log_alpha = -255 -** Processing line: ~ if hidden?~ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - if hidden? -** Processing line: ~ @render_help_current_alpha = -255~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @render_help_current_alpha = -255 -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [30, 18, 5, 12, :bad_dream_inside_mainframe]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [30, 18, 5, 12, :bad_dream_inside_mainframe] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ if prompt.last_input_str_changed~ + ], +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ - Inside source: true *** True Line Result - if prompt.last_input_str_changed -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ + render_override: :blinking_light_inside_observatory_render +** Processing line: ~ }~ - Inside source: true *** True Line Result - @render_help_target_alpha = hide_log_alpha -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.mouse.moved~ -- Inside source: true -*** True Line Result - if args.inputs.mouse.moved -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ +** Processing line: ~ def bad_dream_inside_mainframe args~ - Inside source: true *** True Line Result - @render_help_target_alpha = hide_log_alpha -** Processing line: ~ end~ + def bad_dream_inside_mainframe args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ player: [32, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ if args.inputs.mouse.wheel~ + player: [32, 4], +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - if args.inputs.mouse.wheel -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ + background: 'sprites/mainframe.png', +** Processing line: ~ fade: 120,~ - Inside source: true *** True Line Result - @render_help_target_alpha = hide_log_alpha -** Processing line: ~ end~ + fade: 120, +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ - Inside source: true *** True Line Result - -** Processing line: ~ if @render_help_last_log_invocation_count != @log_invocation_count~ + [22, 45, 17, 4, (bad_dream_last_reply args)], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - if @render_help_last_log_invocation_count != @log_invocation_count -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @render_help_target_alpha = hide_log_alpha -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [45, 45, 4, 4, :bad_dream_everyone_dead],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [45, 45, 4, 4, :bad_dream_everyone_dead], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ @render_help_last_log_invocation_count = @log_invocation_count~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - @render_help_last_log_invocation_count = @log_invocation_count -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_log_offset args~ -- Inside source: true -*** True Line Result - def render_log_offset args -** Processing line: ~ return if @log_offset <= 0~ +** Processing line: ~ def bad_dream_everyone_dead args~ - Inside source: true *** True Line Result - return if @log_offset <= 0 -** Processing line: ~ args.outputs.reserved << font_style.label(~ + def bad_dream_everyone_dead args +** Processing line: ~ {~ - Inside source: true *** True Line Result - args.outputs.reserved << font_style.label( -** Processing line: ~ x: right.shift_left(5),~ + { +** Processing line: ~ background: 'sprites/mainframe.png',~ - Inside source: true *** True Line Result - x: right.shift_left(5), -** Processing line: ~ y: top.shift_down(5 + line_height_px),~ + background: 'sprites/mainframe.png', +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - y: top.shift_down(5 + line_height_px), -** Processing line: ~ text: "[#{@log_offset}/#{@log.size}]",~ + storylines: [ +** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ - Inside source: true *** True Line Result - text: "[#{@log_offset}/#{@log.size}]", -** Processing line: ~ color: @text_color,~ + [22, 45, 17, 4, (bad_dream_last_reply args)], +** Processing line: ~ [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],~ - Inside source: true *** True Line Result - color: @text_color, -** Processing line: ~ alignment_enum: 2~ + [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], +** Processing line: ~ [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],~ - Inside source: true *** True Line Result - alignment_enum: 2 -** Processing line: ~ )~ + [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], +** Processing line: ~ ],~ - Inside source: true *** True Line Result - ) -** Processing line: ~ end~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + scenes: [ +** Processing line: ~ [*hotspot_bottom, :anka_inside_room]~ - Inside source: true *** True Line Result - -** Processing line: ~ def include_error_marker? text~ + [*hotspot_bottom, :anka_inside_room] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - def include_error_marker? text -** Processing line: ~ include_any_words?(text.gsub('OutputsDeprecated', ''), error_markers)~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - include_any_words?(text.gsub('OutputsDeprecated', ''), error_markers) -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def error_markers~ +** Processing line: ~ def bad_dream_last_reply args~ - Inside source: true *** True Line Result - def error_markers -** Processing line: ~ ["exception", "error", "undefined method", "failed", "syntax", "deprecated"]~ + def bad_dream_last_reply args +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ - Inside source: true *** True Line Result - ["exception", "error", "undefined method", "failed", "syntax", "deprecated"] -** Processing line: ~ end~ + if args.state.scene_history.include? :replied_to_serenity_alive_firmly +** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return "Buffer--: #{serenity_alive_firm_reply.quote}" +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ def include_subdued_markers? text~ + else +** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ - Inside source: true *** True Line Result - def include_subdued_markers? text -** Processing line: ~ include_any_words? text, subdued_markers~ + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - include_any_words? text, subdued_markers -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def include_any_words? text, words~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def include_any_words? text, words -** Processing line: ~ words.any? { |w| text.downcase.include?(w) && !text.downcase.include?(":#{w}") }~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - words.any? { |w| text.downcase.include?(w) && !text.downcase.include?(":#{w}") } -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb~ +- Header detected. *** True Line Result - end -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def subdued_markers~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb~ - Inside source: true *** True Line Result - def subdued_markers -** Processing line: ~ ["reloaded", "exported the"]~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb +** Processing line: ~ # decision_graph "Message from Sasha",~ - Inside source: true *** True Line Result - ["reloaded", "exported the"] -** Processing line: ~ end~ + # decision_graph "Message from Sasha", +** Processing line: ~ # "I should reply.",~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # "I should reply.", +** Processing line: ~ # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc args~ + # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], +** Processing line: ~ # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]~ - Inside source: true *** True Line Result - def calc args -** Processing line: ~ if visible? &&~ + # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] +** Processing line: ~ def reply_to_introduction args~ - Inside source: true *** True Line Result - if visible? && -** Processing line: ~ @show_reason == :toast &&~ + def reply_to_introduction args +** Processing line: ~ decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",~ - Inside source: true *** True Line Result - @show_reason == :toast && -** Processing line: ~ @toasted_at &&~ + decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", +** Processing line: ~ "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",~ - Inside source: true *** True Line Result - @toasted_at && -** Processing line: ~ @toasted_at.elapsed?(@toast_duration, Kernel.global_tick_count)~ + "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", +** Processing line: ~ [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"],~ - Inside source: true *** True Line Result - @toasted_at.elapsed?(@toast_duration, Kernel.global_tick_count) -** Processing line: ~ hide~ + [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], +** Processing line: ~ [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]~ - Inside source: true *** True Line Result - hide -** Processing line: ~ end~ + [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if !$gtk.paused? && visible? && (show_reason == :exception || show_reason == :exception_on_load)~ -- Inside source: true -*** True Line Result - if !$gtk.paused? && visible? && (show_reason == :exception || show_reason == :exception_on_load) -** Processing line: ~ hide~ -- Inside source: true -*** True Line Result - hide -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_seriously args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def replied_to_introduction_seriously args +** Processing line: ~ {~ - Inside source: true *** True Line Result - -** Processing line: ~ if $gtk.files_reloaded.length > 0~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - if $gtk.files_reloaded.length > 0 -** Processing line: ~ clear_toast~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - clear_toast -** Processing line: ~ @toast_ids.clear~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - @toast_ids.clear -** Processing line: ~ end~ + player: [32, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + *replied_to_introduction_shared_scenes(args) +** Processing line: ~ ],~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ begin~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],~ - Inside source: true *** True Line Result - begin -** Processing line: ~ return if @disabled~ + [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], +** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ - Inside source: true *** True Line Result - return if @disabled -** Processing line: ~ render args~ + *replied_to_introduction_shared_storylines(args) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - render args -** Processing line: ~ process_inputs args~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - process_inputs args -** Processing line: ~ return unless should_tick?~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - return unless should_tick? -** Processing line: ~ calc args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - calc args -** Processing line: ~ tick_help args~ + +** Processing line: ~ def replied_to_introduction_humorously args~ - Inside source: true *** True Line Result - tick_help args -** Processing line: ~ prompt.tick~ + def replied_to_introduction_humorously args +** Processing line: ~ {~ - Inside source: true *** True Line Result - prompt.tick -** Processing line: ~ menu.tick args~ + { +** Processing line: ~ background: 'sprites/inside-observatory.png',~ - Inside source: true *** True Line Result - menu.tick args -** Processing line: ~ rescue Exception => e~ + background: 'sprites/inside-observatory.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ begin~ + fade: 60, +** Processing line: ~ player: [32, 21],~ - Inside source: true *** True Line Result - begin -** Processing line: ~ puts "#{e}"~ + player: [32, 21], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - puts "#{e}" -** Processing line: ~ puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby."~ + scenes: [ +** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ - Inside source: true *** True Line Result - puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." -** Processing line: ~ rescue~ + *replied_to_introduction_shared_scenes(args) +** Processing line: ~ ],~ - Inside source: true *** True Line Result - rescue -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ @disabled = true~ + storylines: [ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],~ - Inside source: true *** True Line Result - @disabled = true -** Processing line: ~ $stdout.puts e~ + [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], +** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ - Inside source: true *** True Line Result - $stdout.puts e -** Processing line: ~ $stdout.puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby."~ + *replied_to_introduction_shared_storylines(args) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - $stdout.puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_command_with_history_silent command, histories, show_reason = nil~ +** Processing line: ~ def replied_to_introduction_shared_storylines args~ - Inside source: true *** True Line Result - def set_command_with_history_silent command, histories, show_reason = nil -** Processing line: ~ set_command_extended command: command, histories: histories, show_reason: show_reason~ + def replied_to_introduction_shared_storylines args +** Processing line: ~ [~ - Inside source: true *** True Line Result - set_command_extended command: command, histories: histories, show_reason: show_reason -** Processing line: ~ end~ + [ +** Processing line: ~ [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], +** Processing line: ~ [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],~ - Inside source: true *** True Line Result - -** Processing line: ~ def defaults_set_command_extended~ + [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], +** Processing line: ~ [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]~ - Inside source: true *** True Line Result - def defaults_set_command_extended -** Processing line: ~ {~ + [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - { -** Processing line: ~ command: "puts 'Hello World'",~ -- Inside source: true -*** True Line Result - command: "puts 'Hello World'", -** Processing line: ~ histories: [],~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - histories: [], -** Processing line: ~ show_reason: nil,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - show_reason: nil, -** Processing line: ~ force: false~ + +** Processing line: ~ def replied_to_introduction_shared_scenes args~ - Inside source: true *** True Line Result - force: false -** Processing line: ~ }~ + def replied_to_introduction_shared_scenes args +** Processing line: ~ [[60, 0, 4, 32, :replied_to_introduction_observatory]]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + [[60, 0, 4, 32, :replied_to_introduction_observatory]] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_command_extended opts~ +** Processing line: ~ def replied_to_introduction_observatory args~ - Inside source: true *** True Line Result - def set_command_extended opts -** Processing line: ~ opts = defaults_set_command_extended.merge opts~ + def replied_to_introduction_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - opts = defaults_set_command_extended.merge opts -** Processing line: ~ @command_history.concat opts[:histories]~ + { +** Processing line: ~ background: 'sprites/observatory.png',~ - Inside source: true *** True Line Result - @command_history.concat opts[:histories] -** Processing line: ~ @command_history << opts[:command] if @command_history[-1] != opts[:command]~ + background: 'sprites/observatory.png', +** Processing line: ~ player: [28, 39],~ - Inside source: true *** True Line Result - @command_history << opts[:command] if @command_history[-1] != opts[:command] -** Processing line: ~ self.current_input_str = opts[:command] if @command_set_at != Kernel.global_tick_count || opts[:force]~ + player: [28, 39], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - self.current_input_str = opts[:command] if @command_set_at != Kernel.global_tick_count || opts[:force] -** Processing line: ~ @command_set_at = Kernel.global_tick_count~ + scenes: [ +** Processing line: ~ [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]~ - Inside source: true *** True Line Result - @command_set_at = Kernel.global_tick_count -** Processing line: ~ @command_history_index = -1~ + [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @command_history_index = -1 -** Processing line: ~ save_history~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - save_history -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_command_with_history command, histories, show_reason = nil~ -- Inside source: true -*** True Line Result - def set_command_with_history command, histories, show_reason = nil -** Processing line: ~ set_command_with_history_silent command, histories, show_reason~ +** Processing line: ~ def replied_to_introduction_path_to_observatory args~ - Inside source: true *** True Line Result - set_command_with_history_silent command, histories, show_reason -** Processing line: ~ show show_reason~ + def replied_to_introduction_path_to_observatory args +** Processing line: ~ {~ - Inside source: true *** True Line Result - show show_reason -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/path-to-observatory.png', +** Processing line: ~ player: [0, 26],~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + player: [0, 26], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def set_command command, show_reason = nil~ + scenes: [ +** Processing line: ~ [60, 0, 4, 20, :replied_to_introduction_mountain_pass]~ - Inside source: true *** True Line Result - def set_command command, show_reason = nil -** Processing line: ~ set_command_silent command, show_reason~ + [60, 0, 4, 20, :replied_to_introduction_mountain_pass] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - set_command_silent command, show_reason -** Processing line: ~ show show_reason~ + ], +** Processing line: ~ }~ - Inside source: true *** True Line Result - show show_reason -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_command_silent command, show_reason = nil~ +** Processing line: ~ def replied_to_introduction_mountain_pass args~ - Inside source: true *** True Line Result - def set_command_silent command, show_reason = nil -** Processing line: ~ set_command_with_history_silent command, [], show_reason~ + def replied_to_introduction_mountain_pass args +** Processing line: ~ {~ - Inside source: true *** True Line Result - set_command_with_history_silent command, [], show_reason -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/mountain-pass-zoomed-out.png', +** Processing line: ~ player: [21, 48],~ - Inside source: true *** True Line Result - -** Processing line: ~ def set_system_command command, show_reason = nil~ + player: [21, 48], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - def set_system_command command, show_reason = nil -** Processing line: ~ if $gtk.platform == "Mac OS X"~ + scenes: [ +** Processing line: ~ [0, 0, 15, 4, :replied_to_introduction_side_of_home]~ - Inside source: true *** True Line Result - if $gtk.platform == "Mac OS X" -** Processing line: ~ set_command_silent "$gtk.system \"open #{command}\""~ + [0, 0, 15, 4, :replied_to_introduction_side_of_home] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - set_command_silent "$gtk.system \"open #{command}\"" -** Processing line: ~ else~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - else -** Processing line: ~ set_command_silent "$gtk.system \"start #{command}\""~ + storylines: [ +** Processing line: ~ [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]~ - Inside source: true *** True Line Result - set_command_silent "$gtk.system \"start #{command}\"" -** Processing line: ~ end~ + [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def system_command~ +** Processing line: ~ def replied_to_introduction_side_of_home args~ - Inside source: true *** True Line Result - def system_command -** Processing line: ~ if $gtk.platform == "Mac OS X"~ + def replied_to_introduction_side_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - if $gtk.platform == "Mac OS X" -** Processing line: ~ "open"~ + { +** Processing line: ~ background: 'sprites/side-of-home.png',~ - Inside source: true *** True Line Result - "open" -** Processing line: ~ else~ + background: 'sprites/side-of-home.png', +** Processing line: ~ player: [58, 29],~ - Inside source: true *** True Line Result - else -** Processing line: ~ "start"~ + player: [58, 29], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - "start" -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [2, 0, 61, 2, :speed_of_light_front_of_home]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [2, 0, 61, 2, :speed_of_light_front_of_home] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ }~ - Inside source: true *** True Line Result - -** Processing line: ~ private~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - private + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def w~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def w -** Processing line: ~ $gtk.logical_width~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - $gtk.logical_width -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb~ +- Header detected. *** True Line Result - end -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def h~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb~ - Inside source: true *** True Line Result - def h -** Processing line: ~ $gtk.logical_height~ + # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb +** Processing line: ~ def speed_of_light_front_of_home args~ - Inside source: true *** True Line Result - $gtk.logical_height -** Processing line: ~ end~ + def speed_of_light_front_of_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/front-of-home.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ # methods top; left; right~ + background: 'sprites/front-of-home.png', +** Processing line: ~ player: [54, 23],~ - Inside source: true *** True Line Result - # methods top; left; right -** Processing line: ~ # Forward to grid~ + player: [54, 23], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - # Forward to grid -** Processing line: ~ %i[top left right].each do |method|~ + scenes: [ +** Processing line: ~ [44, 34, 8, 14, :speed_of_light_inside_home],~ - Inside source: true *** True Line Result - %i[top left right].each do |method| -** Processing line: ~ define_method method do~ + [44, 34, 8, 14, :speed_of_light_inside_home], +** Processing line: ~ [0, 3, 3, 22, :speed_of_light_outside_library]~ - Inside source: true *** True Line Result - define_method method do -** Processing line: ~ $gtk.args.grid.send(method)~ + [0, 3, 3, 22, :speed_of_light_outside_library] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - $gtk.args.grid.send(method) -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def line_height_px~ +** Processing line: ~ def speed_of_light_inside_home args~ - Inside source: true *** True Line Result - def line_height_px -** Processing line: ~ font_style.line_height_px~ + def speed_of_light_inside_home args +** Processing line: ~ {~ - Inside source: true *** True Line Result - font_style.line_height_px -** Processing line: ~ end~ + { +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [35, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ def lines_on_one_page~ + player: [35, 4], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - def lines_on_one_page -** Processing line: ~ (h - 4).idiv(line_height_px)~ + storylines: [ +** Processing line: ~ [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]~ - Inside source: true *** True Line Result - (h - 4).idiv(line_height_px) -** Processing line: ~ end~ + [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def line(y:, color:)~ + scenes: [ +** Processing line: ~ [32, 0, 8, 3, :speed_of_light_front_of_home],~ - Inside source: true *** True Line Result - def line(y:, color:) -** Processing line: ~ [left, y, right, y, *color].line~ + [32, 0, 8, 3, :speed_of_light_front_of_home], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - [left, y, right, y, *color].line -** Processing line: ~ end~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def include_row_marker? log_entry~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def include_row_marker? log_entry -** Processing line: ~ log_entry[0] == "|"~ + +** Processing line: ~ def speed_of_light_outside_library args~ - Inside source: true *** True Line Result - log_entry[0] == "|" -** Processing line: ~ end~ + def speed_of_light_outside_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ background: 'sprites/outside-library.png',~ - Inside source: true *** True Line Result - -** Processing line: ~ def include_header_marker? log_entry~ + background: 'sprites/outside-library.png', +** Processing line: ~ player: [55, 19],~ - Inside source: true *** True Line Result - def include_header_marker? log_entry -** Processing line: ~ return false if (log_entry.strip.include? ".rb")~ + player: [55, 19], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - return false if (log_entry.strip.include? ".rb") -** Processing line: ~ (log_entry.start_with? "* ") ||~ + scenes: [ +** Processing line: ~ [49, 39, 6, 10, :speed_of_light_library],~ - Inside source: true *** True Line Result - (log_entry.start_with? "* ") || -** Processing line: ~ (log_entry.start_with? "** ") ||~ + [49, 39, 6, 10, :speed_of_light_library], +** Processing line: ~ [61, 11, 3, 20, :speed_of_light_front_of_home]~ - Inside source: true *** True Line Result - (log_entry.start_with? "** ") || -** Processing line: ~ (log_entry.start_with? "*** ") ||~ + [61, 11, 3, 20, :speed_of_light_front_of_home] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - (log_entry.start_with? "*** ") || -** Processing line: ~ (log_entry.start_with? "**** ")~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - (log_entry.start_with? "**** ") -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def color_for_log_entry(log_entry)~ +** Processing line: ~ def speed_of_light_library args~ - Inside source: true *** True Line Result - def color_for_log_entry(log_entry) -** Processing line: ~ if include_row_marker? log_entry~ + def speed_of_light_library args +** Processing line: ~ {~ - Inside source: true *** True Line Result - if include_row_marker? log_entry -** Processing line: ~ @text_color~ + { +** Processing line: ~ background: 'sprites/library.png',~ - Inside source: true *** True Line Result - @text_color -** Processing line: ~ elsif include_error_marker? log_entry~ + background: 'sprites/library.png', +** Processing line: ~ player: [30, 7],~ - Inside source: true *** True Line Result - elsif include_error_marker? log_entry -** Processing line: ~ @error_color~ + player: [30, 7], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @error_color -** Processing line: ~ elsif include_subdued_markers? log_entry~ + scenes: [ +** Processing line: ~ [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]~ - Inside source: true *** True Line Result - elsif include_subdued_markers? log_entry -** Processing line: ~ @text_color.mult_alpha(0.5)~ + [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @text_color.mult_alpha(0.5) -** Processing line: ~ elsif include_header_marker? log_entry~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - elsif include_header_marker? log_entry -** Processing line: ~ @header_color~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @header_color -** Processing line: ~ elsif log_entry.start_with?("====")~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - elsif log_entry.start_with?("====") -** Processing line: ~ @header_color~ + +** Processing line: ~ def speed_of_light_celestial_bodies_diagram args~ - Inside source: true *** True Line Result - @header_color -** Processing line: ~ else~ + def speed_of_light_celestial_bodies_diagram args +** Processing line: ~ {~ - Inside source: true *** True Line Result - else -** Processing line: ~ @text_color~ + { +** Processing line: ~ background: 'sprites/planets.png',~ - Inside source: true *** True Line Result - @text_color -** Processing line: ~ end~ + background: 'sprites/planets.png', +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + fade: 60, +** Processing line: ~ player: [30, 3],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + player: [30, 3], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - -** Processing line: ~ def prompt~ + scenes: [ +** Processing line: ~ [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]~ - Inside source: true *** True Line Result - def prompt -** Processing line: ~ @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width)~ + [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width) -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + storylines: [ +** Processing line: ~ [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],~ - Inside source: true *** True Line Result - -** Processing line: ~ def current_input_str~ + [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], +** Processing line: ~~ - Inside source: true *** True Line Result - def current_input_str -** Processing line: ~ prompt.current_input_str~ + +** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ - Inside source: true *** True Line Result - prompt.current_input_str -** Processing line: ~ end~ + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], +** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], +** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ - Inside source: true *** True Line Result - -** Processing line: ~ def current_input_str=(str)~ + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], +** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ - Inside source: true *** True Line Result - def current_input_str=(str) -** Processing line: ~ prompt.current_input_str = str~ + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], +** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ - Inside source: true *** True Line Result - prompt.current_input_str = str -** Processing line: ~ end~ + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], +** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], +** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ - Inside source: true *** True Line Result - -** Processing line: ~ def clear~ + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], +** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ @archived_log.clear~ + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], +** Processing line: ~ # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],~ - Inside source: true *** True Line Result - @archived_log.clear -** Processing line: ~ @log.clear~ + # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], +** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],~ - Inside source: true *** True Line Result - @log.clear -** Processing line: ~ @prompt.clear~ + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @prompt.clear -** Processing line: ~ :console_silent_eval~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - :console_silent_eval -** Processing line: ~ end~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def slide_progress~ +** Processing line: ~ def speed_of_light_distance_discovered args~ - Inside source: true *** True Line Result - def slide_progress -** Processing line: ~ return 0 if !@toggled_at~ + def speed_of_light_distance_discovered args +** Processing line: ~ {~ - Inside source: true *** True Line Result - return 0 if !@toggled_at -** Processing line: ~ if visible?~ + { +** Processing line: ~ background: 'sprites/planets.png',~ - Inside source: true *** True Line Result - if visible? -** Processing line: ~ @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip)~ + background: 'sprites/planets.png', +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) -** Processing line: ~ else~ + scenes: [ +** Processing line: ~ [13, 0, 44, 3, :speed_of_light_end_of_day]~ - Inside source: true *** True Line Result - else -** Processing line: ~ @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint)~ + [13, 0, 44, 3, :speed_of_light_end_of_day] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint) -** Processing line: ~ end~ + ], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - end -** Processing line: ~ @slide_progress~ + storylines: [ +** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ - Inside source: true *** True Line Result - @slide_progress -** Processing line: ~ end~ + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], +** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], +** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], +** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], +** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], +** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ +- Inside source: true *** True Line Result - -** Processing line: ~* ./dragon/console_color.rb~ -- Header detected. + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], +** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ +- Inside source: true *** True Line Result - + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], +** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ +- Inside source: true *** True Line Result -* ./dragon/console_color.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], +** Processing line: ~ [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],~ +- Inside source: true *** True Line Result - + [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], +** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # console_color.rb has been released under MIT (*only this file*).~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # console_color.rb has been released under MIT (*only this file*). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ +** Processing line: ~ def speed_of_light_end_of_day args~ - Inside source: true *** True Line Result - # Contributors outside of DragonRuby who also hold Copyright: -** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ + def speed_of_light_end_of_day args +** Processing line: ~ {~ - Inside source: true *** True Line Result - # - Kevin Fischer: https://github.com/kfischer-okarin -** Processing line: ~~ + { +** Processing line: ~ fade: 60,~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + fade: 60, +** Processing line: ~ background: 'sprites/inside-home.png',~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Console~ + background: 'sprites/inside-home.png', +** Processing line: ~ player: [35, 0],~ - Inside source: true *** True Line Result - class Console -** Processing line: ~ class Color~ + player: [35, 0], +** Processing line: ~ storylines: [~ - Inside source: true *** True Line Result - class Color -** Processing line: ~ def initialize(color)~ + storylines: [ +** Processing line: ~ [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]~ - Inside source: true *** True Line Result - def initialize(color) -** Processing line: ~ @color = color~ + [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] +** Processing line: ~ ],~ - Inside source: true *** True Line Result - @color = color -** Processing line: ~ @color << 255 if @color.size == 3~ + ], +** Processing line: ~ scenes: [~ - Inside source: true *** True Line Result - @color << 255 if @color.size == 3 -** Processing line: ~ end~ + scenes: [ +** Processing line: ~ [31, 38, 10, 12, :serenity_alive_side_of_home]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [31, 38, 10, 12, :serenity_alive_side_of_home] +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ def mult_alpha(alpha_modifier)~ + ] +** Processing line: ~ }~ - Inside source: true *** True Line Result - def mult_alpha(alpha_modifier) -** Processing line: ~ Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i]~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i] -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # Support splat operator~ -- Inside source: true +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - constants.rb~ +- Header detected. *** True Line Result - # Support splat operator -** Processing line: ~ def to_a~ -- Inside source: true + *** True Line Result - def to_a -** Processing line: ~ @color~ +* Rpg Roguelike - Roguelike Line Of Sight - constants.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb~ - Inside source: true *** True Line Result - @color -** Processing line: ~ end~ + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb +** Processing line: ~ SHOW_LEGEND = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + SHOW_LEGEND = true +** Processing line: ~ SOURCE_TILE_SIZE = 16~ - Inside source: true *** True Line Result - -** Processing line: ~ def to_h~ + SOURCE_TILE_SIZE = 16 +** Processing line: ~ DESTINATION_TILE_SIZE = 16~ - Inside source: true *** True Line Result - def to_h -** Processing line: ~ { r: @color[0], g: @color[1], b: @color[2], a: @color[3] }~ + DESTINATION_TILE_SIZE = 16 +** Processing line: ~ TILE_SHEET_SIZE = 256~ - Inside source: true *** True Line Result - { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } -** Processing line: ~ end~ + TILE_SHEET_SIZE = 256 +** Processing line: ~ TILE_R = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + TILE_R = 0 +** Processing line: ~ TILE_G = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + TILE_G = 0 +** Processing line: ~ TILE_B = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + TILE_B = 0 +** Processing line: ~ TILE_A = 255~ - Inside source: true *** True Line Result - end + TILE_A = 255 ** Processing line: ~~ - Inside source: true *** True Line Result @@ -81685,678 +82224,694 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/console_font_style.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - legend.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/console_font_style.rb +* Rpg Roguelike - Roguelike Line Of Sight - legend.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb +** Processing line: ~ def tick_legend args~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # console_font_style.rb has been released under MIT (*only this file*).~ + def tick_legend args +** Processing line: ~ return unless SHOW_LEGEND~ - Inside source: true *** True Line Result - # console_font_style.rb has been released under MIT (*only this file*). + return unless SHOW_LEGEND ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ -- Inside source: true -*** True Line Result - # Contributors outside of DragonRuby who also hold Copyright: -** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ +** Processing line: ~ legend_padding = 16~ - Inside source: true *** True Line Result - # - Kevin Fischer: https://github.com/kfischer-okarin -** Processing line: ~~ + legend_padding = 16 +** Processing line: ~ legend_x = 1280 - TILE_SHEET_SIZE - legend_padding~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + legend_x = 1280 - TILE_SHEET_SIZE - legend_padding +** Processing line: ~ legend_y = 720 - TILE_SHEET_SIZE - legend_padding~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Console~ + legend_y = 720 - TILE_SHEET_SIZE - legend_padding +** Processing line: ~ tile_sheet_sprite = [legend_x,~ - Inside source: true *** True Line Result - class Console -** Processing line: ~ class FontStyle~ + tile_sheet_sprite = [legend_x, +** Processing line: ~ legend_y,~ - Inside source: true *** True Line Result - class FontStyle -** Processing line: ~ attr_reader :font, :size_enum, :line_height~ + legend_y, +** Processing line: ~ TILE_SHEET_SIZE,~ - Inside source: true *** True Line Result - attr_reader :font, :size_enum, :line_height -** Processing line: ~~ + TILE_SHEET_SIZE, +** Processing line: ~ TILE_SHEET_SIZE,~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize(font:, size_enum:, line_height:)~ + TILE_SHEET_SIZE, +** Processing line: ~ 'sprites/simple-mood-16x16.png', 0,~ - Inside source: true *** True Line Result - def initialize(font:, size_enum:, line_height:) -** Processing line: ~ @font = font~ + 'sprites/simple-mood-16x16.png', 0, +** Processing line: ~ TILE_A,~ - Inside source: true *** True Line Result - @font = font -** Processing line: ~ @size_enum = size_enum~ + TILE_A, +** Processing line: ~ TILE_R,~ - Inside source: true *** True Line Result - @size_enum = size_enum -** Processing line: ~ @line_height = line_height~ + TILE_R, +** Processing line: ~ TILE_G,~ - Inside source: true *** True Line Result - @line_height = line_height -** Processing line: ~ end~ + TILE_G, +** Processing line: ~ TILE_B]~ - Inside source: true *** True Line Result - end + TILE_B] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def letter_size~ +** Processing line: ~ if args.inputs.mouse.point.inside_rect? tile_sheet_sprite~ - Inside source: true *** True Line Result - def letter_size -** Processing line: ~ @letter_size ||= $gtk.calcstringbox 'W', size_enum, font~ + if args.inputs.mouse.point.inside_rect? tile_sheet_sprite +** Processing line: ~ mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE)~ - Inside source: true *** True Line Result - @letter_size ||= $gtk.calcstringbox 'W', size_enum, font -** Processing line: ~ end~ + mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE) +** Processing line: ~ tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE))~ - Inside source: true *** True Line Result - end + tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE)) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def line_height_px~ +** Processing line: ~ mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE)~ - Inside source: true *** True Line Result - def line_height_px -** Processing line: ~ @line_height_px ||= letter_size.y * line_height~ + mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE) +** Processing line: ~ tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE))~ - Inside source: true *** True Line Result - @line_height_px ||= letter_size.y * line_height -** Processing line: ~ end~ + tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE)) +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ args.outputs.primitives << [legend_x - legend_padding * 2,~ +- Inside source: true +*** True Line Result + args.outputs.primitives << [legend_x - legend_padding * 2, +** Processing line: ~ mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid~ +- Inside source: true +*** True Line Result + mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def label(x:, y:, text:, color:, alignment_enum: 0)~ +** Processing line: ~ args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE,~ - Inside source: true *** True Line Result - def label(x:, y:, text:, color:, alignment_enum: 0) -** Processing line: ~ {~ + args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE, +** Processing line: ~ legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: x,~ + legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid +** Processing line: ~~ - Inside source: true *** True Line Result - x: x, -** Processing line: ~ y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels.~ + +** Processing line: ~ sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] }~ - Inside source: true *** True Line Result - y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels. -** Processing line: ~ text: text,~ + sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] } +** Processing line: ~ if sprite_key~ - Inside source: true *** True Line Result - text: text, -** Processing line: ~ font: font,~ + if sprite_key +** Processing line: ~ member_name, _ = sprite_key~ - Inside source: true *** True Line Result - font: font, -** Processing line: ~ size_enum: size_enum,~ + member_name, _ = sprite_key +** Processing line: ~ member_name = member_name_as_code member_name~ - Inside source: true *** True Line Result - size_enum: size_enum, -** Processing line: ~ alignment_enum: alignment_enum,~ + member_name = member_name_as_code member_name +** Processing line: ~ args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0]~ - Inside source: true *** True Line Result - alignment_enum: alignment_enum, -** Processing line: ~ **color.to_h,~ + args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0] +** Processing line: ~ args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0]~ - Inside source: true *** True Line Result - **color.to_h, -** Processing line: ~ }.label~ + args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0] +** Processing line: ~ args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0]~ - Inside source: true *** True Line Result - }.label -** Processing line: ~ end~ + args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0] +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + else +** Processing line: ~ args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0] +** Processing line: ~ args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0]~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/console_menu.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* ./dragon/console_menu.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +- Inside source: true *** True Line Result -*** True Line Result -#+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # render the sprite in the top right with a padding to the top and right so it's~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + # render the sprite in the top right with a padding to the top and right so it's +** Processing line: ~ # not flush against the edge~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # console_menu.rb has been released under MIT (*only this file*).~ + # not flush against the edge +** Processing line: ~ args.outputs.sprites << tile_sheet_sprite~ - Inside source: true *** True Line Result - # console_menu.rb has been released under MIT (*only this file*). + args.outputs.sprites << tile_sheet_sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ -- Inside source: true -*** True Line Result - module GTK -** Processing line: ~ class Console~ +** Processing line: ~ # carefully place some ascii arrows to show the legend labels~ - Inside source: true *** True Line Result - class Console -** Processing line: ~ class Menu~ + # carefully place some ascii arrows to show the legend labels +** Processing line: ~ args.outputs.labels << [895, 707, "ROW --->"]~ - Inside source: true *** True Line Result - class Menu -** Processing line: ~ def initialize console~ + args.outputs.labels << [895, 707, "ROW --->"] +** Processing line: ~ args.outputs.labels << [943, 412, " ^"]~ - Inside source: true *** True Line Result - def initialize console -** Processing line: ~ @console = console~ + args.outputs.labels << [943, 412, " ^"] +** Processing line: ~ args.outputs.labels << [943, 412, " |"]~ - Inside source: true *** True Line Result - @console = console -** Processing line: ~ end~ + args.outputs.labels << [943, 412, " |"] +** Processing line: ~ args.outputs.labels << [943, 394, "COL ---+"]~ - Inside source: true *** True Line Result - end + args.outputs.labels << [943, 394, "COL ---+"] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def record_clicked~ +** Processing line: ~ # use the tile sheet to print out row and column numbers~ - Inside source: true *** True Line Result - def record_clicked -** Processing line: ~ $recording.start 100~ + # use the tile sheet to print out row and column numbers +** Processing line: ~ args.outputs.sprites << 16.map_with_index do |i|~ - Inside source: true *** True Line Result - $recording.start 100 -** Processing line: ~ end~ + args.outputs.sprites << 16.map_with_index do |i| +** Processing line: ~ sprite_key = i % 10~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + sprite_key = i % 10 +** Processing line: ~ [~ - Inside source: true *** True Line Result - -** Processing line: ~ def replay_clicked~ + [ +** Processing line: ~ tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE,~ - Inside source: true *** True Line Result - def replay_clicked -** Processing line: ~ $replay.start 'replay.txt'~ + tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE, +** Processing line: ~ 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i),~ - Inside source: true *** True Line Result - $replay.start 'replay.txt' -** Processing line: ~ end~ + 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i), +** Processing line: ~ sprite(sprite_key)),~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + sprite(sprite_key)), +** Processing line: ~ tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i),~ - Inside source: true *** True Line Result - -** Processing line: ~ def reset_clicked~ + tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i), +** Processing line: ~ 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key))~ - Inside source: true *** True Line Result - def reset_clicked -** Processing line: ~ $gtk.reset~ + 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key)) +** Processing line: ~ ]~ - Inside source: true *** True Line Result - $gtk.reset -** Processing line: ~ end~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def scroll_up_clicked~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def scroll_up_clicked -** Processing line: ~ @console.scroll_up_half~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - @console.scroll_up_half -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - main.rb~ +- Header detected. *** True Line Result - end -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Rpg Roguelike - Roguelike Line Of Sight - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def scroll_down_clicked~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb~ - Inside source: true *** True Line Result - def scroll_down_clicked -** Processing line: ~ @console.scroll_down_half~ + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb +** Processing line: ~ require 'app/constants.rb'~ - Inside source: true *** True Line Result - @console.scroll_down_half -** Processing line: ~ end~ + require 'app/constants.rb' +** Processing line: ~ require 'app/sprite_lookup.rb'~ - Inside source: true *** True Line Result - end + require 'app/sprite_lookup.rb' +** Processing line: ~ require 'app/legend.rb'~ +- Inside source: true +*** True Line Result + require 'app/legend.rb' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def show_menu_clicked~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - def show_menu_clicked -** Processing line: ~ @menu_shown = :visible~ + def tick args +** Processing line: ~ tick_game args~ - Inside source: true *** True Line Result - @menu_shown = :visible -** Processing line: ~ end~ + tick_game args +** Processing line: ~ tick_legend args~ - Inside source: true *** True Line Result - end + tick_legend args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def close_clicked~ +** Processing line: ~ def tick_game args~ - Inside source: true *** True Line Result - def close_clicked -** Processing line: ~ @menu_shown = :hidden~ + def tick_game args +** Processing line: ~ # setup the grid~ - Inside source: true *** True Line Result - @menu_shown = :hidden -** Processing line: ~ @console.hide~ + # setup the grid +** Processing line: ~ args.state.grid.padding = 104~ - Inside source: true *** True Line Result - @console.hide -** Processing line: ~ end~ + args.state.grid.padding = 104 +** Processing line: ~ args.state.grid.size = 512~ - Inside source: true *** True Line Result - end + args.state.grid.size = 512 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def framerate_diagnostics_clicked~ -- Inside source: true -*** True Line Result - def framerate_diagnostics_clicked -** Processing line: ~ $gtk.framerate_diagnostics~ +** Processing line: ~ # set up your game~ - Inside source: true *** True Line Result - $gtk.framerate_diagnostics -** Processing line: ~ end~ + # set up your game +** Processing line: ~ # initialize the game/game defaults. ||= means that you only initialize it if~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # initialize the game/game defaults. ||= means that you only initialize it if +** Processing line: ~ # the value isn't alread initialized~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick args~ + # the value isn't alread initialized +** Processing line: ~ args.state.player.x ||= 0~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ return unless @console.visible?~ + args.state.player.x ||= 0 +** Processing line: ~ args.state.player.y ||= 0~ - Inside source: true *** True Line Result - return unless @console.visible? + args.state.player.y ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @menu_shown ||= :hidden~ +** Processing line: ~ args.state.enemies ||= [~ - Inside source: true *** True Line Result - @menu_shown ||= :hidden -** Processing line: ~~ + args.state.enemies ||= [ +** Processing line: ~ { x: 10, y: 10, type: :goblin, tile_key: :G },~ - Inside source: true *** True Line Result - -** Processing line: ~ if @menu_shown == :hidden~ + { x: 10, y: 10, type: :goblin, tile_key: :G }, +** Processing line: ~ { x: 15, y: 30, type: :rat, tile_key: :R }~ - Inside source: true *** True Line Result - if @menu_shown == :hidden -** Processing line: ~ @buttons = [~ + { x: 15, y: 30, type: :rat, tile_key: :R } +** Processing line: ~ ]~ - Inside source: true *** True Line Result - @buttons = [ -** Processing line: ~ (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked),~ + ] +** Processing line: ~~ - Inside source: true *** True Line Result - (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked), -** Processing line: ~ ]~ + +** Processing line: ~ args.state.info_message ||= "Use arrow keys to move around."~ - Inside source: true *** True Line Result - ] -** Processing line: ~ else~ + args.state.info_message ||= "Use arrow keys to move around." +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ @buttons = [~ + +** Processing line: ~ # handle keyboard input~ - Inside source: true *** True Line Result - @buttons = [ -** Processing line: ~ (button id: :record, row: 0, col: 4, text: "framerate diagnostics", method: :framerate_diagnostics_clicked),~ + # handle keyboard input +** Processing line: ~ # keyboard input (arrow keys to move player)~ - Inside source: true *** True Line Result - (button id: :record, row: 0, col: 4, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), -** Processing line: ~ (button id: :record, row: 0, col: 5, text: "record", method: :record_clicked),~ + # keyboard input (arrow keys to move player) +** Processing line: ~ new_player_x = args.state.player.x~ - Inside source: true *** True Line Result - (button id: :record, row: 0, col: 5, text: "record", method: :record_clicked), -** Processing line: ~ (button id: :replay, row: 0, col: 6, text: "replay", method: :replay_clicked),~ + new_player_x = args.state.player.x +** Processing line: ~ new_player_y = args.state.player.y~ - Inside source: true *** True Line Result - (button id: :replay, row: 0, col: 6, text: "replay", method: :replay_clicked), -** Processing line: ~ (button id: :reset, row: 0, col: 7, text: "reset", method: :reset_clicked),~ + new_player_y = args.state.player.y +** Processing line: ~ player_direction = ""~ - Inside source: true *** True Line Result - (button id: :reset, row: 0, col: 7, text: "reset", method: :reset_clicked), -** Processing line: ~ (button id: :scroll_up, row: 0, col: 8, text: "scroll up", method: :scroll_up_clicked),~ + player_direction = "" +** Processing line: ~ player_moved = false~ - Inside source: true *** True Line Result - (button id: :scroll_up, row: 0, col: 8, text: "scroll up", method: :scroll_up_clicked), -** Processing line: ~ (button id: :scroll_down, row: 0, col: 9, text: "scroll down", method: :scroll_down_clicked),~ + player_moved = false +** Processing line: ~ if args.inputs.keyboard.key_down.up~ - Inside source: true *** True Line Result - (button id: :scroll_down, row: 0, col: 9, text: "scroll down", method: :scroll_down_clicked), -** Processing line: ~ (button id: :close, row: 0, col: 10, text: "close", method: :close_clicked),~ + if args.inputs.keyboard.key_down.up +** Processing line: ~ new_player_y += 1~ - Inside source: true *** True Line Result - (button id: :close, row: 0, col: 10, text: "close", method: :close_clicked), -** Processing line: ~ ]~ + new_player_y += 1 +** Processing line: ~ player_direction = "north"~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + player_direction = "north" +** Processing line: ~ player_moved = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + player_moved = true +** Processing line: ~ elsif args.inputs.keyboard.key_down.down~ - Inside source: true *** True Line Result - -** Processing line: ~ # render~ + elsif args.inputs.keyboard.key_down.down +** Processing line: ~ new_player_y -= 1~ - Inside source: true *** True Line Result - # render -** Processing line: ~ args.outputs.reserved << @buttons.map { |b| b[:primitives] }~ + new_player_y -= 1 +** Processing line: ~ player_direction = "south"~ - Inside source: true *** True Line Result - args.outputs.reserved << @buttons.map { |b| b[:primitives] } -** Processing line: ~~ + player_direction = "south" +** Processing line: ~ player_moved = true~ - Inside source: true *** True Line Result - -** Processing line: ~ # inputs~ + player_moved = true +** Processing line: ~ elsif args.inputs.keyboard.key_down.right~ - Inside source: true *** True Line Result - # inputs -** Processing line: ~ if args.inputs.mouse.click~ + elsif args.inputs.keyboard.key_down.right +** Processing line: ~ new_player_x += 1~ - Inside source: true *** True Line Result - if args.inputs.mouse.click -** Processing line: ~ clicked = @buttons.find { |b| args.inputs.mouse.inside_rect? b[:rect] }~ + new_player_x += 1 +** Processing line: ~ player_direction = "east"~ - Inside source: true *** True Line Result - clicked = @buttons.find { |b| args.inputs.mouse.inside_rect? b[:rect] } -** Processing line: ~ if clicked~ + player_direction = "east" +** Processing line: ~ player_moved = true~ - Inside source: true *** True Line Result - if clicked -** Processing line: ~ send clicked[:method]~ + player_moved = true +** Processing line: ~ elsif args.inputs.keyboard.key_down.left~ - Inside source: true *** True Line Result - send clicked[:method] -** Processing line: ~ end~ + elsif args.inputs.keyboard.key_down.left +** Processing line: ~ new_player_x -= 1~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + new_player_x -= 1 +** Processing line: ~ player_direction = "west"~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + player_direction = "west" +** Processing line: ~ player_moved = true~ - Inside source: true *** True Line Result - end + player_moved = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rect_for_layout row, col~ +** Processing line: ~ #handle game logic~ - Inside source: true *** True Line Result - def rect_for_layout row, col -** Processing line: ~ col_width = 100~ + #handle game logic +** Processing line: ~ # determine if there is an enemy on that square,~ - Inside source: true *** True Line Result - col_width = 100 -** Processing line: ~ row_height = 50~ + # determine if there is an enemy on that square, +** Processing line: ~ # if so, don't let the player move there~ - Inside source: true *** True Line Result - row_height = 50 -** Processing line: ~ col_margin = 5~ + # if so, don't let the player move there +** Processing line: ~ if player_moved~ - Inside source: true *** True Line Result - col_margin = 5 -** Processing line: ~ row_margin = 5~ + if player_moved +** Processing line: ~ found_enemy = args.state.enemies.find do |e|~ - Inside source: true *** True Line Result - row_margin = 5 -** Processing line: ~ x = (col_margin + (col * col_width) + (col * col_margin))~ + found_enemy = args.state.enemies.find do |e| +** Processing line: ~ e[:x] == new_player_x && e[:y] == new_player_y~ - Inside source: true *** True Line Result - x = (col_margin + (col * col_width) + (col * col_margin)) -** Processing line: ~ y = (row_margin + (row * row_height) + (row * row_margin) + row_height).from_top~ + e[:x] == new_player_x && e[:y] == new_player_y +** Processing line: ~ end~ - Inside source: true *** True Line Result - y = (row_margin + (row * row_height) + (row * row_margin) + row_height).from_top -** Processing line: ~ { x: x, y: y, w: col_width, h: row_height }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { x: x, y: y, w: col_width, h: row_height } -** Processing line: ~ end~ + +** Processing line: ~ if !found_enemy~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if !found_enemy +** Processing line: ~ args.state.player.x = new_player_x~ - Inside source: true *** True Line Result - -** Processing line: ~ def button args~ + args.state.player.x = new_player_x +** Processing line: ~ args.state.player.y = new_player_y~ - Inside source: true *** True Line Result - def button args -** Processing line: ~ id, row, col, text, method = args[:id], args[:row], args[:col], args[:text], args[:method]~ + args.state.player.y = new_player_y +** Processing line: ~ args.state.info_message = "You moved #{player_direction}."~ - Inside source: true *** True Line Result - id, row, col, text, method = args[:id], args[:row], args[:col], args[:text], args[:method] -** Processing line: ~~ + args.state.info_message = "You moved #{player_direction}." +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ font_height = @console.font_style.line_height_px.half~ + else +** Processing line: ~ args.state.info_message = "You cannot move into a square an enemy occupies."~ - Inside source: true *** True Line Result - font_height = @console.font_style.line_height_px.half -** Processing line: ~ {~ + args.state.info_message = "You cannot move into a square an enemy occupies." +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ id: id,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - id: id, -** Processing line: ~ rect: (rect_for_layout row, col),~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rect: (rect_for_layout row, col), -** Processing line: ~ method: method~ + +** Processing line: ~ args.outputs.sprites << tile_in_game(args.state.player.x,~ - Inside source: true *** True Line Result - method: method -** Processing line: ~ }.let do |entity|~ + args.outputs.sprites << tile_in_game(args.state.player.x, +** Processing line: ~ args.state.player.y, '@')~ - Inside source: true *** True Line Result - }.let do |entity| -** Processing line: ~ primitives = []~ + args.state.player.y, '@') +** Processing line: ~~ - Inside source: true *** True Line Result - primitives = [] -** Processing line: ~ primitives << entity[:rect].merge(a: 80).solid~ + +** Processing line: ~ # render game~ - Inside source: true *** True Line Result - primitives << entity[:rect].merge(a: 80).solid -** Processing line: ~ primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border~ + # render game +** Processing line: ~ # render enemies at locations~ - Inside source: true *** True Line Result - primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border -** Processing line: ~ primitives << text.wrapped_lines(5)~ + # render enemies at locations +** Processing line: ~ args.outputs.sprites << args.state.enemies.map do |e|~ - Inside source: true *** True Line Result - primitives << text.wrapped_lines(5) -** Processing line: ~ .map_with_index do |l, i|~ + args.outputs.sprites << args.state.enemies.map do |e| +** Processing line: ~ tile_in_game(e[:x], e[:y], e[:tile_key])~ - Inside source: true *** True Line Result - .map_with_index do |l, i| -** Processing line: ~ [~ + tile_in_game(e[:x], e[:y], e[:tile_key]) +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ -** Processing line: ~ entity[:rect][:x] + entity[:rect][:w].half,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - entity[:rect][:x] + entity[:rect][:w].half, -** Processing line: ~ entity[:rect][:y] + entity[:rect][:h].half + font_height - (i * (font_height + 2)),~ + +** Processing line: ~ # render the border~ - Inside source: true *** True Line Result - entity[:rect][:y] + entity[:rect][:h].half + font_height - (i * (font_height + 2)), -** Processing line: ~ l, -3, 1, 255, 255, 255~ + # render the border +** Processing line: ~ border_x = args.state.grid.padding - DESTINATION_TILE_SIZE~ - Inside source: true *** True Line Result - l, -3, 1, 255, 255, 255 -** Processing line: ~ ]~ + border_x = args.state.grid.padding - DESTINATION_TILE_SIZE +** Processing line: ~ border_y = args.state.grid.padding - DESTINATION_TILE_SIZE~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end.labels~ + border_y = args.state.grid.padding - DESTINATION_TILE_SIZE +** Processing line: ~ border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2~ - Inside source: true *** True Line Result - end.labels + border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ entity.merge(primitives: primitives)~ +** Processing line: ~ args.outputs.borders << [border_x,~ - Inside source: true *** True Line Result - entity.merge(primitives: primitives) -** Processing line: ~ end~ + args.outputs.borders << [border_x, +** Processing line: ~ border_y,~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + border_y, +** Processing line: ~ border_size,~ - Inside source: true *** True Line Result - end + border_size, +** Processing line: ~ border_size]~ +- Inside source: true +*** True Line Result + border_size] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ # render label stuff~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ {~ + # render label stuff +** Processing line: ~ args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"]~ - Inside source: true *** True Line Result - { -** Processing line: ~ not_supported: "#{self}"~ + args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"] +** Processing line: ~ args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message]~ - Inside source: true *** True Line Result - not_supported: "#{self}" -** Processing line: ~ }~ + args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message] +** Processing line: ~ end~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def tile_in_game x, y, tile_key~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def tile_in_game x, y, tile_key +** Processing line: ~ tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE,~ - Inside source: true *** True Line Result - end + tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE, +** Processing line: ~ $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE,~ +- Inside source: true +*** True Line Result + $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE, +** Processing line: ~ tile_key)~ +- Inside source: true +*** True Line Result + tile_key) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -82373,3234 +82928,3154 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/console_prompt.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/console_prompt.rb +* Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb +** Processing line: ~ def sprite_lookup~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # console_prompt.rb has been released under MIT (*only this file*).~ + def sprite_lookup +** Processing line: ~ {~ - Inside source: true *** True Line Result - # console_prompt.rb has been released under MIT (*only this file*). -** Processing line: ~~ + { +** Processing line: ~ 0 => [3, 0],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ + 0 => [3, 0], +** Processing line: ~ 1 => [3, 1],~ - Inside source: true *** True Line Result - # Contributors outside of DragonRuby who also hold Copyright: -** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ + 1 => [3, 1], +** Processing line: ~ 2 => [3, 2],~ - Inside source: true *** True Line Result - # - Kevin Fischer: https://github.com/kfischer-okarin -** Processing line: ~~ + 2 => [3, 2], +** Processing line: ~ 3 => [3, 3],~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + 3 => [3, 3], +** Processing line: ~ 4 => [3, 4],~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Console~ + 4 => [3, 4], +** Processing line: ~ 5 => [3, 5],~ - Inside source: true *** True Line Result - class Console -** Processing line: ~ class Prompt~ + 5 => [3, 5], +** Processing line: ~ 6 => [3, 6],~ - Inside source: true *** True Line Result - class Prompt -** Processing line: ~ attr_accessor :current_input_str, :font_style, :console_text_width, :last_input_str, :last_input_str_changed~ + 6 => [3, 6], +** Processing line: ~ 7 => [3, 7],~ - Inside source: true *** True Line Result - attr_accessor :current_input_str, :font_style, :console_text_width, :last_input_str, :last_input_str_changed -** Processing line: ~~ + 7 => [3, 7], +** Processing line: ~ 8 => [3, 8],~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize(font_style:, text_color:, console_text_width:)~ + 8 => [3, 8], +** Processing line: ~ 9 => [3, 9],~ - Inside source: true *** True Line Result - def initialize(font_style:, text_color:, console_text_width:) -** Processing line: ~ @prompt = '-> '~ + 9 => [3, 9], +** Processing line: ~ '@' => [4, 0],~ - Inside source: true *** True Line Result - @prompt = '-> ' -** Processing line: ~ @current_input_str = ''~ + '@' => [4, 0], +** Processing line: ~ A: [ 4, 1],~ - Inside source: true *** True Line Result - @current_input_str = '' -** Processing line: ~ @font_style = font_style~ + A: [ 4, 1], +** Processing line: ~ B: [ 4, 2],~ - Inside source: true *** True Line Result - @font_style = font_style -** Processing line: ~ @text_color = text_color~ + B: [ 4, 2], +** Processing line: ~ C: [ 4, 3],~ - Inside source: true *** True Line Result - @text_color = text_color -** Processing line: ~ @cursor_color = Color.new [187, 21, 6]~ + C: [ 4, 3], +** Processing line: ~ D: [ 4, 4],~ - Inside source: true *** True Line Result - @cursor_color = Color.new [187, 21, 6] -** Processing line: ~ @console_text_width = console_text_width~ + D: [ 4, 4], +** Processing line: ~ E: [ 4, 5],~ - Inside source: true *** True Line Result - @console_text_width = console_text_width -** Processing line: ~~ + E: [ 4, 5], +** Processing line: ~ F: [ 4, 6],~ - Inside source: true *** True Line Result - -** Processing line: ~ @last_autocomplete_prefix = nil~ + F: [ 4, 6], +** Processing line: ~ G: [ 4, 7],~ - Inside source: true *** True Line Result - @last_autocomplete_prefix = nil -** Processing line: ~ @next_candidate_index = 0~ + G: [ 4, 7], +** Processing line: ~ H: [ 4, 8],~ - Inside source: true *** True Line Result - @next_candidate_index = 0 -** Processing line: ~ end~ + H: [ 4, 8], +** Processing line: ~ I: [ 4, 9],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + I: [ 4, 9], +** Processing line: ~ J: [ 4, 10],~ - Inside source: true *** True Line Result - -** Processing line: ~ def <<(str)~ + J: [ 4, 10], +** Processing line: ~ K: [ 4, 11],~ - Inside source: true *** True Line Result - def <<(str) -** Processing line: ~ @current_input_str << str~ + K: [ 4, 11], +** Processing line: ~ L: [ 4, 12],~ - Inside source: true *** True Line Result - @current_input_str << str -** Processing line: ~ @current_input_changed_at = Kernel.global_tick_count~ + L: [ 4, 12], +** Processing line: ~ M: [ 4, 13],~ - Inside source: true *** True Line Result - @current_input_changed_at = Kernel.global_tick_count -** Processing line: ~ reset_autocomplete~ + M: [ 4, 13], +** Processing line: ~ N: [ 4, 14],~ - Inside source: true *** True Line Result - reset_autocomplete -** Processing line: ~ end~ + N: [ 4, 14], +** Processing line: ~ O: [ 4, 15],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + O: [ 4, 15], +** Processing line: ~ P: [ 5, 0],~ - Inside source: true *** True Line Result - -** Processing line: ~ def backspace~ + P: [ 5, 0], +** Processing line: ~ Q: [ 5, 1],~ - Inside source: true *** True Line Result - def backspace -** Processing line: ~ @current_input_str.chop!~ + Q: [ 5, 1], +** Processing line: ~ R: [ 5, 2],~ - Inside source: true *** True Line Result - @current_input_str.chop! -** Processing line: ~ reset_autocomplete~ + R: [ 5, 2], +** Processing line: ~ S: [ 5, 3],~ - Inside source: true *** True Line Result - reset_autocomplete -** Processing line: ~ end~ + S: [ 5, 3], +** Processing line: ~ T: [ 5, 4],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + T: [ 5, 4], +** Processing line: ~ U: [ 5, 5],~ - Inside source: true *** True Line Result - -** Processing line: ~ def clear~ + U: [ 5, 5], +** Processing line: ~ V: [ 5, 6],~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ @current_input_str = ''~ + V: [ 5, 6], +** Processing line: ~ W: [ 5, 7],~ - Inside source: true *** True Line Result - @current_input_str = '' -** Processing line: ~ reset_autocomplete~ + W: [ 5, 7], +** Processing line: ~ X: [ 5, 8],~ - Inside source: true *** True Line Result - reset_autocomplete -** Processing line: ~ end~ + X: [ 5, 8], +** Processing line: ~ Y: [ 5, 9],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + Y: [ 5, 9], +** Processing line: ~ Z: [ 5, 10],~ - Inside source: true *** True Line Result - -** Processing line: ~ def autocomplete~ + Z: [ 5, 10], +** Processing line: ~ a: [ 6, 1],~ - Inside source: true *** True Line Result - def autocomplete -** Processing line: ~ if !@last_autocomplete_prefix~ + a: [ 6, 1], +** Processing line: ~ b: [ 6, 2],~ - Inside source: true *** True Line Result - if !@last_autocomplete_prefix -** Processing line: ~ @last_autocomplete_prefix = calc_autocomplete_prefix~ + b: [ 6, 2], +** Processing line: ~ c: [ 6, 3],~ - Inside source: true *** True Line Result - @last_autocomplete_prefix = calc_autocomplete_prefix -** Processing line: ~~ + c: [ 6, 3], +** Processing line: ~ d: [ 6, 4],~ - Inside source: true *** True Line Result - -** Processing line: ~ puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.."~ + d: [ 6, 4], +** Processing line: ~ e: [ 6, 5],~ - Inside source: true *** True Line Result - puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.." -** Processing line: ~ pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix)~ + e: [ 6, 5], +** Processing line: ~ f: [ 6, 6],~ - Inside source: true *** True Line Result - pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix) -** Processing line: ~ else~ + f: [ 6, 6], +** Processing line: ~ g: [ 6, 7],~ - Inside source: true *** True Line Result - else -** Processing line: ~ candidates = method_candidates(@last_autocomplete_prefix)~ + g: [ 6, 7], +** Processing line: ~ h: [ 6, 8],~ - Inside source: true *** True Line Result - candidates = method_candidates(@last_autocomplete_prefix) -** Processing line: ~ return if candidates.empty?~ + h: [ 6, 8], +** Processing line: ~ i: [ 6, 9],~ - Inside source: true *** True Line Result - return if candidates.empty? -** Processing line: ~~ + i: [ 6, 9], +** Processing line: ~ j: [ 6, 10],~ - Inside source: true *** True Line Result - -** Processing line: ~ candidate = candidates[@next_candidate_index]~ + j: [ 6, 10], +** Processing line: ~ k: [ 6, 11],~ - Inside source: true *** True Line Result - candidate = candidates[@next_candidate_index] -** Processing line: ~ candidate = candidate[0..-2] + " = " if candidate.end_with? '='~ + k: [ 6, 11], +** Processing line: ~ l: [ 6, 12],~ - Inside source: true *** True Line Result - candidate = candidate[0..-2] + " = " if candidate.end_with? '=' -** Processing line: ~ @next_candidate_index += 1~ + l: [ 6, 12], +** Processing line: ~ m: [ 6, 13],~ - Inside source: true *** True Line Result - @next_candidate_index += 1 -** Processing line: ~ @next_candidate_index = 0 if @next_candidate_index >= candidates.length~ + m: [ 6, 13], +** Processing line: ~ n: [ 6, 14],~ - Inside source: true *** True Line Result - @next_candidate_index = 0 if @next_candidate_index >= candidates.length -** Processing line: ~ self.current_input_str = display_autocomplete_candidate(candidate)~ + n: [ 6, 14], +** Processing line: ~ o: [ 6, 15],~ - Inside source: true *** True Line Result - self.current_input_str = display_autocomplete_candidate(candidate) -** Processing line: ~ end~ + o: [ 6, 15], +** Processing line: ~ p: [ 7, 0],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + p: [ 7, 0], +** Processing line: ~ q: [ 7, 1],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + q: [ 7, 1], +** Processing line: ~ r: [ 7, 2],~ - Inside source: true *** True Line Result - -** Processing line: ~ def pretty_print_strings_as_table items~ + r: [ 7, 2], +** Processing line: ~ s: [ 7, 3],~ - Inside source: true *** True Line Result - def pretty_print_strings_as_table items -** Processing line: ~ if items.length == 0~ + s: [ 7, 3], +** Processing line: ~ t: [ 7, 4],~ - Inside source: true *** True Line Result - if items.length == 0 -** Processing line: ~ puts <<-S.strip~ + t: [ 7, 4], +** Processing line: ~ u: [ 7, 5],~ - Inside source: true *** True Line Result - puts <<-S.strip -** Processing line: ~ +--------+~ + u: [ 7, 5], +** Processing line: ~ v: [ 7, 6],~ - Inside source: true *** True Line Result - +--------+ -** Processing line: ~ | (none) |~ + v: [ 7, 6], +** Processing line: ~ w: [ 7, 7],~ - Inside source: true *** True Line Result - | (none) | -** Processing line: ~ +--------+~ + w: [ 7, 7], +** Processing line: ~ x: [ 7, 8],~ - Inside source: true *** True Line Result - +--------+ -** Processing line: ~ S~ + x: [ 7, 8], +** Processing line: ~ y: [ 7, 9],~ - Inside source: true *** True Line Result - S -** Processing line: ~ else~ + y: [ 7, 9], +** Processing line: ~ z: [ 7, 10],~ - Inside source: true *** True Line Result - else -** Processing line: ~ # figure out the largest string~ + z: [ 7, 10], +** Processing line: ~ '|' => [ 7, 12]~ - Inside source: true *** True Line Result - # figure out the largest string -** Processing line: ~ string_width = items.sort_by { |c| -c.to_s.length }.first~ + '|' => [ 7, 12] +** Processing line: ~ }~ - Inside source: true *** True Line Result - string_width = items.sort_by { |c| -c.to_s.length }.first + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # add spacing to each side of the string which represents the cell width~ +** Processing line: ~ def sprite key~ - Inside source: true *** True Line Result - # add spacing to each side of the string which represents the cell width -** Processing line: ~ cell_width = string_width.length + 2~ + def sprite key +** Processing line: ~ $gtk.args.state.reserved.sprite_lookup[key]~ - Inside source: true *** True Line Result - cell_width = string_width.length + 2 -** Processing line: ~~ + $gtk.args.state.reserved.sprite_lookup[key] +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # add spacing to each side of the cell to represent the column width~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # add spacing to each side of the cell to represent the column width -** Processing line: ~ column_width = cell_width + 2~ + +** Processing line: ~ def member_name_as_code raw_member_name~ - Inside source: true *** True Line Result - column_width = cell_width + 2 -** Processing line: ~~ + def member_name_as_code raw_member_name +** Processing line: ~ if raw_member_name.is_a? Symbol~ - Inside source: true *** True Line Result - -** Processing line: ~ # determine the max number of columns that can fit on the screen~ + if raw_member_name.is_a? Symbol +** Processing line: ~ ":#{raw_member_name}"~ - Inside source: true *** True Line Result - # determine the max number of columns that can fit on the screen -** Processing line: ~ columns = @console_text_width.idiv column_width~ + ":#{raw_member_name}" +** Processing line: ~ elsif raw_member_name.is_a? String~ - Inside source: true *** True Line Result - columns = @console_text_width.idiv column_width -** Processing line: ~ columns = items.length if items.length < columns~ + elsif raw_member_name.is_a? String +** Processing line: ~ "'#{raw_member_name}'"~ - Inside source: true *** True Line Result - columns = items.length if items.length < columns -** Processing line: ~~ + "'#{raw_member_name}'" +** Processing line: ~ elsif raw_member_name.is_a? Fixnum~ - Inside source: true *** True Line Result - -** Processing line: ~ # partition the original list of items into a string to be printed~ + elsif raw_member_name.is_a? Fixnum +** Processing line: ~ "#{raw_member_name}"~ - Inside source: true *** True Line Result - # partition the original list of items into a string to be printed -** Processing line: ~ items.each_slice(columns).each_with_index do |cells, i|~ + "#{raw_member_name}" +** Processing line: ~ else~ - Inside source: true *** True Line Result - items.each_slice(columns).each_with_index do |cells, i| -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ + else +** Processing line: ~ "UNKNOWN: #{raw_member_name}"~ - Inside source: true *** True Line Result - pretty_print_row_seperator string_width, cell_width, column_width, columns -** Processing line: ~ pretty_print_row cells, string_width, cell_width, column_width, columns~ + "UNKNOWN: #{raw_member_name}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - pretty_print_row cells, string_width, cell_width, column_width, columns -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ def tile x, y, tile_row_column_or_key~ - Inside source: true *** True Line Result - pretty_print_row_seperator string_width, cell_width, column_width, columns -** Processing line: ~ end~ + def tile x, y, tile_row_column_or_key +** Processing line: ~ tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def pretty_print_row cells, string_width, cell_width, column_width, columns~ -- Inside source: true -*** True Line Result - def pretty_print_row cells, string_width, cell_width, column_width, columns -** Processing line: ~ # if the number of cells doesn't match the number of columns, then pad the array with empty values~ +** Processing line: ~ def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key~ - Inside source: true *** True Line Result - # if the number of cells doesn't match the number of columns, then pad the array with empty values -** Processing line: ~ cells += (columns - cells.length).map { "" }~ + def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key +** Processing line: ~ row_or_key, column = tile_row_column_or_key~ - Inside source: true *** True Line Result - cells += (columns - cells.length).map { "" } -** Processing line: ~~ + row_or_key, column = tile_row_column_or_key +** Processing line: ~ if !column~ - Inside source: true *** True Line Result - -** Processing line: ~ # right align each cell value~ + if !column +** Processing line: ~ row, column = sprite row_or_key~ - Inside source: true *** True Line Result - # right align each cell value -** Processing line: ~ formated_row = "|" + cells.map do |c|~ + row, column = sprite row_or_key +** Processing line: ~ else~ - Inside source: true *** True Line Result - formated_row = "|" + cells.map do |c| -** Processing line: ~ "#{" " * (string_width.length - c.length) } #{c} |"~ + else +** Processing line: ~ row, column = row_or_key, column~ - Inside source: true *** True Line Result - "#{" " * (string_width.length - c.length) } #{c} |" -** Processing line: ~ end.join~ + row, column = row_or_key, column +** Processing line: ~ end~ - Inside source: true *** True Line Result - end.join + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # remove seperators between empty values~ -- Inside source: true -*** True Line Result - # remove seperators between empty values -** Processing line: ~ formated_row = formated_row.gsub(" | ", " ")~ +** Processing line: ~ if !row~ - Inside source: true *** True Line Result - formated_row = formated_row.gsub(" | ", " ") -** Processing line: ~~ + if !row +** Processing line: ~ member_name = member_name_as_code tile_row_column_or_key~ - Inside source: true *** True Line Result - -** Processing line: ~ puts formated_row~ + member_name = member_name_as_code tile_row_column_or_key +** Processing line: ~ raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb."~ - Inside source: true *** True Line Result - puts formated_row -** Processing line: ~ end~ + raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb." +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def pretty_print_row_seperator string_width, cell_width, column_width, columns~ +** Processing line: ~ # Sprite provided by Rogue Yun~ - Inside source: true *** True Line Result - def pretty_print_row_seperator string_width, cell_width, column_width, columns -** Processing line: ~ # this is a joint: +--------~ + # Sprite provided by Rogue Yun +** Processing line: ~ # http://www.bay12forums.com/smf/index.php?topic=144897.0~ - Inside source: true *** True Line Result - # this is a joint: +-------- -** Processing line: ~ column_joint = "+#{"-" * cell_width}"~ + # http://www.bay12forums.com/smf/index.php?topic=144897.0 +** Processing line: ~ # License: Public Domain~ - Inside source: true *** True Line Result - column_joint = "+#{"-" * cell_width}" + # License: Public Domain ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # multiple joints create a row seperator: +----+----+~ +** Processing line: ~ {~ - Inside source: true *** True Line Result - # multiple joints create a row seperator: +----+----+ -** Processing line: ~ puts (column_joint * columns) + "+"~ + { +** Processing line: ~ x: x,~ - Inside source: true *** True Line Result - puts (column_joint * columns) + "+" -** Processing line: ~ end~ + x: x, +** Processing line: ~ y: y,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + y: y, +** Processing line: ~ w: w,~ - Inside source: true *** True Line Result - -** Processing line: ~ def render(args, x:, y:)~ + w: w, +** Processing line: ~ h: h,~ - Inside source: true *** True Line Result - def render(args, x:, y:) -** Processing line: ~ args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color)~ + h: h, +** Processing line: ~ tile_x: column * 16,~ - Inside source: true *** True Line Result - args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color) -** Processing line: ~ args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color)~ + tile_x: column * 16, +** Processing line: ~ tile_y: (row * 16),~ - Inside source: true *** True Line Result - args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color) -** Processing line: ~ end~ + tile_y: (row * 16), +** Processing line: ~ tile_w: 16,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + tile_w: 16, +** Processing line: ~ tile_h: 16,~ - Inside source: true *** True Line Result - -** Processing line: ~ def tick~ + tile_h: 16, +** Processing line: ~ r: r,~ - Inside source: true *** True Line Result - def tick -** Processing line: ~ if (@current_input_changed_at) &&~ + r: r, +** Processing line: ~ g: g,~ - Inside source: true *** True Line Result - if (@current_input_changed_at) && -** Processing line: ~ (@current_input_changed_at < Kernel.global_tick_count) &&~ + g: g, +** Processing line: ~ b: b,~ - Inside source: true *** True Line Result - (@current_input_changed_at < Kernel.global_tick_count) && -** Processing line: ~ (@last_input_str != @current_input_str)~ + b: b, +** Processing line: ~ a: a,~ - Inside source: true *** True Line Result - (@last_input_str != @current_input_str) -** Processing line: ~ @last_input_str_changed = true~ + a: a, +** Processing line: ~ path: 'sprites/simple-mood-16x16.png'~ - Inside source: true *** True Line Result - @last_input_str_changed = true -** Processing line: ~ @last_input_str = "#{@current_input_str}"~ + path: 'sprites/simple-mood-16x16.png' +** Processing line: ~ }~ - Inside source: true *** True Line Result - @last_input_str = "#{@current_input_str}" -** Processing line: ~ @current_input_changed_at = nil~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - @current_input_changed_at = nil -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ @last_input_str_changed = false~ + +** Processing line: ~ $gtk.args.state.reserved.sprite_lookup = sprite_lookup~ - Inside source: true *** True Line Result - @last_input_str_changed = false -** Processing line: ~ end~ + $gtk.args.state.reserved.sprite_lookup = sprite_lookup +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ private~ -- Inside source: true +** Processing line: ~* Rpg Roguelike - Roguelike Starting Point - main.rb~ +- Header detected. *** True Line Result - private -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* Rpg Roguelike - Roguelike Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ def last_period_index~ -- Inside source: true *** True Line Result - def last_period_index -** Processing line: ~ current_input_str.rindex('.')~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb~ - Inside source: true *** True Line Result - current_input_str.rindex('.') -** Processing line: ~ end~ + # ./samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - end + =begin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def calc_autocomplete_prefix~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - def calc_autocomplete_prefix -** Processing line: ~ if last_period_index~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - if last_period_index -** Processing line: ~ current_input_str[(last_period_index + 1)..-1]~ + +** Processing line: ~ - lambda: A way to define a block and its parameters with special syntax.~ - Inside source: true *** True Line Result - current_input_str[(last_period_index + 1)..-1] -** Processing line: ~ else~ + - lambda: A way to define a block and its parameters with special syntax. +** Processing line: ~ For example, the syntax of lambda looks like this:~ - Inside source: true *** True Line Result - else -** Processing line: ~ current_input_str~ + For example, the syntax of lambda looks like this: +** Processing line: ~ my_lambda = -> { puts "This is my lambda" }~ - Inside source: true *** True Line Result - current_input_str -** Processing line: ~ end~ + my_lambda = -> { puts "This is my lambda" } +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + Reminders: +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - -** Processing line: ~ def current_object~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - def current_object -** Processing line: ~ return Kernel unless last_period_index~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ - Inside source: true *** True Line Result - return Kernel unless last_period_index + For more information about labels, go to mygame/documentation/02-labels. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Kernel.eval(current_input_str[0...last_period_index])~ -- Inside source: true -*** True Line Result - Kernel.eval(current_input_str[0...last_period_index]) -** Processing line: ~ rescue NameError~ +** Processing line: ~ - ARRAY#inside_rect?: Returns whether or not the point is inside a rect.~ - Inside source: true *** True Line Result - rescue NameError -** Processing line: ~ nil~ + - ARRAY#inside_rect?: Returns whether or not the point is inside a rect. +** Processing line: ~~ - Inside source: true *** True Line Result - nil -** Processing line: ~ end~ + +** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ - Inside source: true *** True Line Result - end + - product: Returns an array of all combinations of elements from all arrays. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def method_candidates(prefix)~ +** Processing line: ~ - find: Finds all elements of a collection that meet requirements.~ - Inside source: true *** True Line Result - def method_candidates(prefix) -** Processing line: ~ current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix }~ + - find: Finds all elements of a collection that meet requirements. +** Processing line: ~~ - Inside source: true *** True Line Result - current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix } -** Processing line: ~ end~ + +** Processing line: ~ - abs: Returns the absolute value.~ - Inside source: true *** True Line Result - end + - abs: Returns the absolute value. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def display_autocomplete_candidate(candidate)~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - def display_autocomplete_candidate(candidate) -** Processing line: ~ if last_period_index~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - if last_period_index -** Processing line: ~ @current_input_str[0..last_period_index] + candidate.to_s~ + +** Processing line: ~ # This sample app allows the player to move around in the dungeon, which becomes more or less visible~ - Inside source: true *** True Line Result - @current_input_str[0..last_period_index] + candidate.to_s -** Processing line: ~ else~ + # This sample app allows the player to move around in the dungeon, which becomes more or less visible +** Processing line: ~ # depending on the player's location, and also has enemies.~ - Inside source: true *** True Line Result - else -** Processing line: ~ candidate.to_s~ + # depending on the player's location, and also has enemies. +** Processing line: ~~ - Inside source: true *** True Line Result - candidate.to_s -** Processing line: ~ end~ + +** Processing line: ~ class Game~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + class Game +** Processing line: ~ attr_accessor :args, :state, :inputs, :outputs, :grid~ - Inside source: true *** True Line Result - end + attr_accessor :args, :state, :inputs, :outputs, :grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def reset_autocomplete~ +** Processing line: ~ # Calls all the methods needed for the game to run properly.~ - Inside source: true *** True Line Result - def reset_autocomplete -** Processing line: ~ @last_autocomplete_prefix = nil~ + # Calls all the methods needed for the game to run properly. +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - @last_autocomplete_prefix = nil -** Processing line: ~ @next_candidate_index = 0~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - @next_candidate_index = 0 -** Processing line: ~ end~ + defaults +** Processing line: ~ render_canvas~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_canvas +** Processing line: ~ render_dungeon~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_dungeon +** Processing line: ~ render_player~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + render_player +** Processing line: ~ render_enemies~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render_enemies +** Processing line: ~ print_cell_coordinates~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/controller.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* ./dragon/controller.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. -*** True Line Result - -*** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + print_cell_coordinates +** Processing line: ~ calc_canvas~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + calc_canvas +** Processing line: ~ input_move~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + input_move +** Processing line: ~ input_click_map~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # controller.rb has been released under MIT (*only this file*).~ + input_click_map +** Processing line: ~ end~ - Inside source: true *** True Line Result - # controller.rb has been released under MIT (*only this file*). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ +** Processing line: ~ # Sets default values and initializes variables~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ # @gtk~ + # Sets default values and initializes variables +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ class Controller~ + def defaults +** Processing line: ~ outputs.background_color = [0, 0, 0] # black background~ - Inside source: true *** True Line Result - class Controller -** Processing line: ~ # Access to keys that have been pressed down.~ + outputs.background_color = [0, 0, 0] # black background +** Processing line: ~~ - Inside source: true *** True Line Result - # Access to keys that have been pressed down. -** Processing line: ~ #~ + +** Processing line: ~ # Initializes empty canvas, dungeon, and enemies collections.~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Controller::Keys]~ + # Initializes empty canvas, dungeon, and enemies collections. +** Processing line: ~ state.canvas ||= []~ - Inside source: true *** True Line Result - # @return [Controller::Keys] -** Processing line: ~ # @gtk~ + state.canvas ||= [] +** Processing line: ~ state.dungeon ||= []~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :key_down~ + state.dungeon ||= [] +** Processing line: ~ state.enemies ||= []~ - Inside source: true *** True Line Result - attr_reader :key_down + state.enemies ||= [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Access to keys that have been released up.~ -- Inside source: true -*** True Line Result - # Access to keys that have been released up. -** Processing line: ~ #~ +** Processing line: ~ # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Controller::Keys]~ + # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called +** Processing line: ~ if !state.area~ - Inside source: true *** True Line Result - # @return [Controller::Keys] -** Processing line: ~ # @gtk~ + if !state.area +** Processing line: ~ load_area_one~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :key_up~ + load_area_one +** Processing line: ~ derive_dungeon_from_area~ - Inside source: true *** True Line Result - attr_reader :key_up + derive_dungeon_from_area ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Access to keys that have been held down.~ -- Inside source: true -*** True Line Result - # Access to keys that have been held down. -** Processing line: ~ #~ -- Inside source: true -*** True Line Result - # -** Processing line: ~ # @return [Controller::Keys]~ +** Processing line: ~ # Changing these values will change the position of player~ - Inside source: true *** True Line Result - # @return [Controller::Keys] -** Processing line: ~ # @gtk~ + # Changing these values will change the position of player +** Processing line: ~ state.x = 7~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :key_held~ + state.x = 7 +** Processing line: ~ state.y = 5~ - Inside source: true *** True Line Result - attr_reader :key_held + state.y = 5 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ # Creates new enemies, sets their values, and adds them to the enemies collection.~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :left_analog_x_raw,~ + # Creates new enemies, sets their values, and adds them to the enemies collection. +** Processing line: ~ state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity~ - Inside source: true *** True Line Result - attr_accessor :left_analog_x_raw, -** Processing line: ~ :left_analog_y_raw,~ + state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity +** Processing line: ~ e.x = 13 # position~ - Inside source: true *** True Line Result - :left_analog_y_raw, -** Processing line: ~ :left_analog_x_perc,~ + e.x = 13 # position +** Processing line: ~ e.y = 5~ - Inside source: true *** True Line Result - :left_analog_x_perc, -** Processing line: ~ :left_analog_y_perc,~ + e.y = 5 +** Processing line: ~ e.previous_hp = 3~ - Inside source: true *** True Line Result - :left_analog_y_perc, -** Processing line: ~ :right_analog_x_raw,~ + e.previous_hp = 3 +** Processing line: ~ e.hp = 3~ - Inside source: true *** True Line Result - :right_analog_x_raw, -** Processing line: ~ :right_analog_y_raw,~ + e.hp = 3 +** Processing line: ~ e.max_hp = 3~ - Inside source: true *** True Line Result - :right_analog_y_raw, -** Processing line: ~ :right_analog_x_perc,~ + e.max_hp = 3 +** Processing line: ~ e.is_dead = false # the enemy is alive~ - Inside source: true *** True Line Result - :right_analog_x_perc, -** Processing line: ~ :right_analog_y_perc~ + e.is_dead = false # the enemy is alive +** Processing line: ~ end~ - Inside source: true *** True Line Result - :right_analog_y_perc + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~~ +** Processing line: ~ update_line_of_sight # updates line of sight by adding newly visible cells~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize~ + update_line_of_sight # updates line of sight by adding newly visible cells +** Processing line: ~ end~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @key_down = Controller::Keys.new~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @key_down = Controller::Keys.new -** Processing line: ~ @key_up = Controller::Keys.new~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @key_up = Controller::Keys.new -** Processing line: ~ @key_held = Controller::Keys.new~ + +** Processing line: ~ # Adds elements into the state.area collection~ - Inside source: true *** True Line Result - @key_held = Controller::Keys.new -** Processing line: ~ @left_analog_x_raw = 0~ + # Adds elements into the state.area collection +** Processing line: ~ # The dungeon is derived using the coordinates of this collection~ - Inside source: true *** True Line Result - @left_analog_x_raw = 0 -** Processing line: ~ @left_analog_y_raw = 0~ + # The dungeon is derived using the coordinates of this collection +** Processing line: ~ def load_area_one~ - Inside source: true *** True Line Result - @left_analog_y_raw = 0 -** Processing line: ~ @left_analog_x_perc = 0~ + def load_area_one +** Processing line: ~ state.area ||= []~ - Inside source: true *** True Line Result - @left_analog_x_perc = 0 -** Processing line: ~ @left_analog_y_perc = 0~ + state.area ||= [] +** Processing line: ~ state.area << [8, 6]~ - Inside source: true *** True Line Result - @left_analog_y_perc = 0 -** Processing line: ~ @right_analog_x_raw = 0~ + state.area << [8, 6] +** Processing line: ~ state.area << [7, 6]~ - Inside source: true *** True Line Result - @right_analog_x_raw = 0 -** Processing line: ~ @right_analog_y_raw = 0~ + state.area << [7, 6] +** Processing line: ~ state.area << [7, 7]~ - Inside source: true *** True Line Result - @right_analog_y_raw = 0 -** Processing line: ~ @right_analog_x_perc = 0~ + state.area << [7, 7] +** Processing line: ~ state.area << [8, 9]~ - Inside source: true *** True Line Result - @right_analog_x_perc = 0 -** Processing line: ~ @right_analog_y_perc = 0~ + state.area << [8, 9] +** Processing line: ~ state.area << [7, 8]~ - Inside source: true *** True Line Result - @right_analog_y_perc = 0 -** Processing line: ~ end~ + state.area << [7, 8] +** Processing line: ~ state.area << [7, 9]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [7, 9] +** Processing line: ~ state.area << [6, 4]~ - Inside source: true *** True Line Result - -** Processing line: ~ def serialize~ + state.area << [6, 4] +** Processing line: ~ state.area << [7, 3]~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ {~ + state.area << [7, 3] +** Processing line: ~ state.area << [7, 4]~ - Inside source: true *** True Line Result - { -** Processing line: ~ key_down: @key_down.serialize,~ + state.area << [7, 4] +** Processing line: ~ state.area << [6, 5]~ - Inside source: true *** True Line Result - key_down: @key_down.serialize, -** Processing line: ~ key_held: @key_held.serialize,~ + state.area << [6, 5] +** Processing line: ~ state.area << [7, 5]~ - Inside source: true *** True Line Result - key_held: @key_held.serialize, -** Processing line: ~ key_up: @key_up.serialize~ + state.area << [7, 5] +** Processing line: ~ state.area << [8, 5]~ - Inside source: true *** True Line Result - key_up: @key_up.serialize -** Processing line: ~ }~ + state.area << [8, 5] +** Processing line: ~ state.area << [8, 4]~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + state.area << [8, 4] +** Processing line: ~ state.area << [1, 1]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [1, 1] +** Processing line: ~ state.area << [0, 1]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Clear all current key presses.~ + state.area << [0, 1] +** Processing line: ~ state.area << [0, 2]~ - Inside source: true *** True Line Result - # Clear all current key presses. -** Processing line: ~ #~ + state.area << [0, 2] +** Processing line: ~ state.area << [1, 2]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + state.area << [1, 2] +** Processing line: ~ state.area << [2, 2]~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def clear~ + state.area << [2, 2] +** Processing line: ~ state.area << [2, 1]~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ @key_down.clear~ + state.area << [2, 1] +** Processing line: ~ state.area << [2, 3]~ - Inside source: true *** True Line Result - @key_down.clear -** Processing line: ~ @key_up.clear~ + state.area << [2, 3] +** Processing line: ~ state.area << [1, 3]~ - Inside source: true *** True Line Result - @key_up.clear -** Processing line: ~ @key_held.clear~ + state.area << [1, 3] +** Processing line: ~ state.area << [1, 4]~ - Inside source: true *** True Line Result - @key_held.clear -** Processing line: ~ end~ + state.area << [1, 4] +** Processing line: ~ state.area << [2, 4]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [2, 4] +** Processing line: ~ state.area << [2, 5]~ - Inside source: true *** True Line Result - -** Processing line: ~ def up~ + state.area << [2, 5] +** Processing line: ~ state.area << [1, 5]~ - Inside source: true *** True Line Result - def up -** Processing line: ~ @key_up.up || @key_held.up~ + state.area << [1, 5] +** Processing line: ~ state.area << [2, 6]~ - Inside source: true *** True Line Result - @key_up.up || @key_held.up -** Processing line: ~ end~ + state.area << [2, 6] +** Processing line: ~ state.area << [3, 6]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [3, 6] +** Processing line: ~ state.area << [4, 6]~ - Inside source: true *** True Line Result - -** Processing line: ~ def down~ + state.area << [4, 6] +** Processing line: ~ state.area << [4, 7]~ - Inside source: true *** True Line Result - def down -** Processing line: ~ @key_up.down || @key_held.down~ + state.area << [4, 7] +** Processing line: ~ state.area << [4, 8]~ - Inside source: true *** True Line Result - @key_up.down || @key_held.down -** Processing line: ~ end~ + state.area << [4, 8] +** Processing line: ~ state.area << [5, 8]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [5, 8] +** Processing line: ~ state.area << [5, 9]~ - Inside source: true *** True Line Result - -** Processing line: ~ def left~ + state.area << [5, 9] +** Processing line: ~ state.area << [6, 9]~ - Inside source: true *** True Line Result - def left -** Processing line: ~ @key_up.left || @key_held.left~ + state.area << [6, 9] +** Processing line: ~ state.area << [7, 10]~ - Inside source: true *** True Line Result - @key_up.left || @key_held.left -** Processing line: ~ end~ + state.area << [7, 10] +** Processing line: ~ state.area << [7, 11]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [7, 11] +** Processing line: ~ state.area << [7, 12]~ - Inside source: true *** True Line Result - -** Processing line: ~ def right~ + state.area << [7, 12] +** Processing line: ~ state.area << [7, 12]~ - Inside source: true *** True Line Result - def right -** Processing line: ~ @key_up.right || @key_held.right~ + state.area << [7, 12] +** Processing line: ~ state.area << [7, 13]~ - Inside source: true *** True Line Result - @key_up.right || @key_held.right -** Processing line: ~ end~ + state.area << [7, 13] +** Processing line: ~ state.area << [8, 13]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [8, 13] +** Processing line: ~ state.area << [9, 13]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Activates a key into the down position.~ + state.area << [9, 13] +** Processing line: ~ state.area << [10, 13]~ - Inside source: true *** True Line Result - # Activates a key into the down position. -** Processing line: ~ #~ + state.area << [10, 13] +** Processing line: ~ state.area << [11, 13]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @param key [Symbol] The key to press down.~ + state.area << [11, 13] +** Processing line: ~ state.area << [12, 13]~ - Inside source: true *** True Line Result - # @param key [Symbol] The key to press down. -** Processing line: ~ #~ + state.area << [12, 13] +** Processing line: ~ state.area << [12, 12]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + state.area << [12, 12] +** Processing line: ~ state.area << [8, 12]~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def activate_down(key)~ + state.area << [8, 12] +** Processing line: ~ state.area << [9, 12]~ - Inside source: true *** True Line Result - def activate_down(key) -** Processing line: ~ key_down.activate(key)~ + state.area << [9, 12] +** Processing line: ~ state.area << [10, 12]~ - Inside source: true *** True Line Result - key_down.activate(key) -** Processing line: ~ key_held.deactivate(key)~ + state.area << [10, 12] +** Processing line: ~ state.area << [11, 12]~ - Inside source: true *** True Line Result - key_held.deactivate(key) -** Processing line: ~ key_up.deactivate(key)~ + state.area << [11, 12] +** Processing line: ~ state.area << [12, 11]~ - Inside source: true *** True Line Result - key_up.deactivate(key) -** Processing line: ~ end~ + state.area << [12, 11] +** Processing line: ~ state.area << [13, 11]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [13, 11] +** Processing line: ~ state.area << [13, 10]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Activates a key into the held down position.~ + state.area << [13, 10] +** Processing line: ~ state.area << [13, 9]~ - Inside source: true *** True Line Result - # Activates a key into the held down position. -** Processing line: ~ #~ + state.area << [13, 9] +** Processing line: ~ state.area << [13, 8]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @param key [Symbol] The key to hold down.~ + state.area << [13, 8] +** Processing line: ~ state.area << [13, 7]~ - Inside source: true *** True Line Result - # @param key [Symbol] The key to hold down. -** Processing line: ~ #~ + state.area << [13, 7] +** Processing line: ~ state.area << [13, 6]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + state.area << [13, 6] +** Processing line: ~ state.area << [12, 6]~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def activate_held(key)~ + state.area << [12, 6] +** Processing line: ~ state.area << [14, 6]~ - Inside source: true *** True Line Result - def activate_held(key) -** Processing line: ~ key_down.deactivate(key)~ + state.area << [14, 6] +** Processing line: ~ state.area << [14, 5]~ - Inside source: true *** True Line Result - key_down.deactivate(key) -** Processing line: ~ key_held.activate(key) unless key_held.send(key)~ + state.area << [14, 5] +** Processing line: ~ state.area << [13, 5]~ - Inside source: true *** True Line Result - key_held.activate(key) unless key_held.send(key) -** Processing line: ~ key_up.deactivate(key)~ + state.area << [13, 5] +** Processing line: ~ state.area << [12, 5]~ - Inside source: true *** True Line Result - key_up.deactivate(key) -** Processing line: ~ end~ + state.area << [12, 5] +** Processing line: ~ state.area << [12, 4]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.area << [12, 4] +** Processing line: ~ state.area << [13, 4]~ - Inside source: true *** True Line Result - -** Processing line: ~~ + state.area << [13, 4] +** Processing line: ~ state.area << [14, 4]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Activates a key release into the up position.~ + state.area << [14, 4] +** Processing line: ~ state.area << [1, 6]~ - Inside source: true *** True Line Result - # Activates a key release into the up position. -** Processing line: ~ #~ + state.area << [1, 6] +** Processing line: ~ state.area << [6, 6]~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @param key [Symbol] The key release up.~ + state.area << [6, 6] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @param key [Symbol] The key release up. -** Processing line: ~ #~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + +** Processing line: ~ # Starts with an empty dungeon collection, and adds dungeon cells into it.~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def activate_up(key)~ + # Starts with an empty dungeon collection, and adds dungeon cells into it. +** Processing line: ~ def derive_dungeon_from_area~ - Inside source: true *** True Line Result - def activate_up(key) -** Processing line: ~ key_down.deactivate(key)~ + def derive_dungeon_from_area +** Processing line: ~ state.dungeon = [] # starts as empty collection~ - Inside source: true *** True Line Result - key_down.deactivate(key) -** Processing line: ~ key_held.deactivate(key)~ + state.dungeon = [] # starts as empty collection +** Processing line: ~~ - Inside source: true *** True Line Result - key_held.deactivate(key) -** Processing line: ~ key_up.activate(key)~ + +** Processing line: ~ state.area.each do |a| # for each element of the area collection~ - Inside source: true *** True Line Result - key_up.activate(key) -** Processing line: ~ end~ + state.area.each do |a| # for each element of the area collection +** Processing line: ~ state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity +** Processing line: ~ d.x = a.x # dungeon cell position using coordinates from area~ - Inside source: true *** True Line Result - -** Processing line: ~ include DirectionalInputHelperMethods~ + d.x = a.x # dungeon cell position using coordinates from area +** Processing line: ~ d.y = a.y~ - Inside source: true *** True Line Result - include DirectionalInputHelperMethods -** Processing line: ~ end~ + d.y = a.y +** Processing line: ~ d.is_visible = false # cell is not visible~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + d.is_visible = false # cell is not visible +** Processing line: ~ d.alpha = 0 # not transparent at all~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + d.alpha = 0 # not transparent at all +** Processing line: ~ d.border = [left_margin + a.x * grid_size,~ - Inside source: true *** True Line Result - -** Processing line: ~~ + d.border = [left_margin + a.x * grid_size, +** Processing line: ~ bottom_margin + a.y * grid_size,~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/controller/config.rb~ -- Header detected. + bottom_margin + a.y * grid_size, +** Processing line: ~ grid_size,~ +- Inside source: true *** True Line Result - + grid_size, +** Processing line: ~ grid_size,~ +- Inside source: true *** True Line Result -* ./dragon/controller/config.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + grid_size, +** Processing line: ~ *blue,~ +- Inside source: true *** True Line Result - + *blue, +** Processing line: ~ 255] # sets border definition for dungeon cell~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + 255] # sets border definition for dungeon cell +** Processing line: ~ d # returns dungeon cell~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + d # returns dungeon cell +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # controller/config.rb has been released under MIT (*only this file*).~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # controller/config.rb has been released under MIT (*only this file*). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # !!! FIXME: add console command to forget custom binding(s)~ +** Processing line: ~ def left_margin~ - Inside source: true *** True Line Result - # !!! FIXME: add console command to forget custom binding(s) -** Processing line: ~ # !!! FIXME: add console command to forget replace existing binding(s)~ + def left_margin +** Processing line: ~ 40 # sets left margin~ - Inside source: true *** True Line Result - # !!! FIXME: add console command to forget replace existing binding(s) -** Processing line: ~ # !!! FIXME: add console command go into play_around mode to make sure controller isn't wonky.~ + 40 # sets left margin +** Processing line: ~ end~ - Inside source: true *** True Line Result - # !!! FIXME: add console command go into play_around mode to make sure controller isn't wonky. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ +** Processing line: ~ def bottom_margin~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Controller~ + def bottom_margin +** Processing line: ~ 60 # sets bottom margin~ - Inside source: true *** True Line Result - class Controller -** Processing line: ~ class Config~ + 60 # sets bottom margin +** Processing line: ~ end~ - Inside source: true *** True Line Result - class Config -** Processing line: ~ def initialize runtime~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def initialize runtime -** Processing line: ~ @runtime = runtime~ + +** Processing line: ~ def grid_size~ - Inside source: true *** True Line Result - @runtime = runtime -** Processing line: ~ @raw_joysticks = {} # things that aren't game controllers to try to configure.~ + def grid_size +** Processing line: ~ 40 # sets size of grid square~ - Inside source: true *** True Line Result - @raw_joysticks = {} # things that aren't game controllers to try to configure. -** Processing line: ~ @target = nil~ + 40 # sets size of grid square +** Processing line: ~ end~ - Inside source: true *** True Line Result - @target = nil -** Processing line: ~ @animation_duration = (1.5).seconds~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @animation_duration = (1.5).seconds -** Processing line: ~ @toggled_at = 0~ + +** Processing line: ~ # Updates the line of sight by calling the thick_line_of_sight method and~ - Inside source: true *** True Line Result - @toggled_at = 0 -** Processing line: ~ @fading = 0~ + # Updates the line of sight by calling the thick_line_of_sight method and +** Processing line: ~ # adding dungeon cells to the newly_visible collection~ - Inside source: true *** True Line Result - @fading = 0 -** Processing line: ~ @current_part = 0~ + # adding dungeon cells to the newly_visible collection +** Processing line: ~ def update_line_of_sight~ - Inside source: true *** True Line Result - @current_part = 0 -** Processing line: ~ @part_alpha = 0~ + def update_line_of_sight +** Processing line: ~ variations = [-1, 0, 1]~ - Inside source: true *** True Line Result - @part_alpha = 0 -** Processing line: ~ @part_alpha_increment = 10~ + variations = [-1, 0, 1] +** Processing line: ~ # creates collection of newly visible dungeon cells~ - Inside source: true *** True Line Result - @part_alpha_increment = 10 -** Processing line: ~ @joystick_state = {}~ + # creates collection of newly visible dungeon cells +** Processing line: ~ newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements~ - Inside source: true *** True Line Result - @joystick_state = {} -** Processing line: ~ @playing_around = false~ + newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements +** Processing line: ~ thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method~ - Inside source: true *** True Line Result - @playing_around = false -** Processing line: ~ @used_bindings = {}~ + thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method +** Processing line: ~ lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists~ - Inside source: true *** True Line Result - @used_bindings = {} -** Processing line: ~ @bindings = []~ + lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists +** Processing line: ~ end.uniq# removes duplicates~ - Inside source: true *** True Line Result - @bindings = [] -** Processing line: ~ @parts = [~ + end.uniq# removes duplicates +** Processing line: ~~ - Inside source: true *** True Line Result - @parts = [ -** Processing line: ~ [ 919, 282, 'A button', 'a' ],~ + +** Processing line: ~ state.dungeon.each do |d| # perform action on each element of dungeons collection~ - Inside source: true *** True Line Result - [ 919, 282, 'A button', 'a' ], -** Processing line: ~ [ 960, 323, 'B button', 'b' ],~ + state.dungeon.each do |d| # perform action on each element of dungeons collection +** Processing line: ~ d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection~ - Inside source: true *** True Line Result - [ 960, 323, 'B button', 'b' ], -** Processing line: ~ [ 878, 323, 'X button', 'x' ],~ + d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ 878, 323, 'X button', 'x' ], -** Processing line: ~ [ 919, 365, 'Y button', 'y' ],~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ 919, 365, 'Y button', 'y' ], -** Processing line: ~ [ 433, 246, 'left stick left', '-leftx' ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [ 433, 246, 'left stick left', '-leftx' ], -** Processing line: ~ [ 497, 246, 'left stick right', '+leftx' ],~ + +** Processing line: ~ #Returns a boolean value~ - Inside source: true *** True Line Result - [ 497, 246, 'left stick right', '+leftx' ], -** Processing line: ~ [ 466, 283, 'left stick up', '-lefty' ],~ + #Returns a boolean value +** Processing line: ~ def dungeon_cell_exists? x, y~ - Inside source: true *** True Line Result - [ 466, 283, 'left stick up', '-lefty' ], -** Processing line: ~ [ 466, 218, 'left stick down', '+lefty' ],~ + def dungeon_cell_exists? x, y +** Processing line: ~ # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists~ - Inside source: true *** True Line Result - [ 466, 218, 'left stick down', '+lefty' ], -** Processing line: ~ [ 466, 246, 'left stick button', 'leftstick' ],~ + # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists +** Processing line: ~ state.dungeon.find { |d| d.x == x && d.y == y }~ - Inside source: true *** True Line Result - [ 466, 246, 'left stick button', 'leftstick' ], -** Processing line: ~ [ 741, 246, 'right stick left', '-rightx' ],~ + state.dungeon.find { |d| d.x == x && d.y == y } +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ 741, 246, 'right stick left', '-rightx' ], -** Processing line: ~ [ 802, 246, 'right stick right', '+rightx' ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [ 802, 246, 'right stick right', '+rightx' ], -** Processing line: ~ [ 773, 283, 'right stick up', '-righty' ],~ + +** Processing line: ~ # Calls line_of_sight method to add elements to result collection~ - Inside source: true *** True Line Result - [ 773, 283, 'right stick up', '-righty' ], -** Processing line: ~ [ 773, 218, 'right stick down', '+righty' ],~ + # Calls line_of_sight method to add elements to result collection +** Processing line: ~ def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ - Inside source: true *** True Line Result - [ 773, 218, 'right stick down', '+righty' ], -** Processing line: ~ [ 772, 246, 'right stick button', 'rightstick' ],~ + def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda +** Processing line: ~ result = []~ - Inside source: true *** True Line Result - [ 772, 246, 'right stick button', 'rightstick' ], -** Processing line: ~ [ 263, 465, 'left shoulder button', 'leftshoulder' ],~ + result = [] +** Processing line: ~ result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ - Inside source: true *** True Line Result - [ 263, 465, 'left shoulder button', 'leftshoulder' ], -** Processing line: ~ [ 263, 503, 'left trigger', 'lefttrigger' ],~ + result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda +** Processing line: ~ result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left~ - Inside source: true *** True Line Result - [ 263, 503, 'left trigger', 'lefttrigger' ], -** Processing line: ~ [ 977, 465, 'right shoulder button', 'rightshoulder' ],~ + result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left +** Processing line: ~ result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right~ - Inside source: true *** True Line Result - [ 977, 465, 'right shoulder button', 'rightshoulder' ], -** Processing line: ~ [ 977, 503, 'right trigger', 'righttrigger' ],~ + result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right +** Processing line: ~ result~ - Inside source: true *** True Line Result - [ 977, 503, 'right trigger', 'righttrigger' ], -** Processing line: ~ [ 318, 365, 'D-pad up', 'dpup' ],~ + result +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ 318, 365, 'D-pad up', 'dpup' ], -** Processing line: ~ [ 360, 322, 'D-pad right', 'dpright' ],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - [ 360, 322, 'D-pad right', 'dpright' ], -** Processing line: ~ [ 318, 280, 'D-pad down', 'dpdown' ],~ + +** Processing line: ~ # Adds points to the result collection to create the player's line of sight~ - Inside source: true *** True Line Result - [ 318, 280, 'D-pad down', 'dpdown' ], -** Processing line: ~ [ 275, 322, 'D-pad left', 'dpleft' ],~ + # Adds points to the result collection to create the player's line of sight +** Processing line: ~ def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda~ - Inside source: true *** True Line Result - [ 275, 322, 'D-pad left', 'dpleft' ], -** Processing line: ~ [ 570, 402, 'select/back button', 'back'],~ + def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda +** Processing line: ~ result = [] # starts as empty collection~ - Inside source: true *** True Line Result - [ 570, 402, 'select/back button', 'back'], -** Processing line: ~ [ 619, 448, 'guide/home button', 'guide' ],~ + result = [] # starts as empty collection +** Processing line: ~ points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method~ - Inside source: true *** True Line Result - [ 619, 448, 'guide/home button', 'guide' ], -** Processing line: ~ [ 669, 402, 'start button', 'start' ],~ + points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method +** Processing line: ~ points.each do |p| # for each point in collection~ - Inside source: true *** True Line Result - [ 669, 402, 'start button', 'start' ], -** Processing line: ~ ]~ + points.each do |p| # for each point in collection +** Processing line: ~ if cell_exists_lambda.call(p.x, p.y) # if the cell exists~ - Inside source: true *** True Line Result - ] -** Processing line: ~ end~ + if cell_exists_lambda.call(p.x, p.y) # if the cell exists +** Processing line: ~ result << p # add it to result collection~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + result << p # add it to result collection +** Processing line: ~ else # if cell does not exist~ - Inside source: true *** True Line Result - -** Processing line: ~ def rawjoystick_connected jid, joystickname, guid~ + else # if cell does not exist +** Processing line: ~ return result # return result collection as it is~ - Inside source: true *** True Line Result - def rawjoystick_connected jid, joystickname, guid -** Processing line: ~ return if jid < 0~ + return result # return result collection as it is +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if jid < 0 -** Processing line: ~ @raw_joysticks[jid] = { name: joystickname, guid: guid }~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @raw_joysticks[jid] = { name: joystickname, guid: guid } -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end + +** Processing line: ~ result # return result collection~ +- Inside source: true +*** True Line Result + result # return result collection +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rawjoystick_disconnected jid~ +** Processing line: ~ # Finds the coordinates of the points on the line by performing calculations~ - Inside source: true *** True Line Result - def rawjoystick_disconnected jid -** Processing line: ~ return if jid < 0~ + # Finds the coordinates of the points on the line by performing calculations +** Processing line: ~ def points_on_line start_x, start_y, rise, run, distance~ - Inside source: true *** True Line Result - return if jid < 0 -** Processing line: ~ if @raw_joysticks[jid] != nil~ + def points_on_line start_x, start_y, rise, run, distance +** Processing line: ~ distance.times.map do |i| # perform an action~ - Inside source: true *** True Line Result - if @raw_joysticks[jid] != nil -** Processing line: ~ @raw_joysticks.delete(jid)~ + distance.times.map do |i| # perform an action +** Processing line: ~ [start_x + run * i, start_y + rise * i] # definition of point~ - Inside source: true *** True Line Result - @raw_joysticks.delete(jid) -** Processing line: ~ @runtime.ffi_misc.close_raw_joystick(jid)~ + [start_x + run * i, start_y + rise * i] # definition of point +** Processing line: ~ end~ - Inside source: true *** True Line Result - @runtime.ffi_misc.close_raw_joystick(jid) -** Processing line: ~ # Fade out the config screen if we were literally configuring this controller right now.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Fade out the config screen if we were literally configuring this controller right now. -** Processing line: ~ if !@target.nil? && @target[0] == jid~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if !@target.nil? && @target[0] == jid -** Processing line: ~ @target[0] = nil~ + +** Processing line: ~ def render_canvas~ - Inside source: true *** True Line Result - @target[0] = nil -** Processing line: ~ @toggled_at = Kernel.global_tick_count~ + def render_canvas +** Processing line: ~ return~ - Inside source: true *** True Line Result - @toggled_at = Kernel.global_tick_count -** Processing line: ~ @fading = -1~ + return +** Processing line: ~ outputs.borders << state.canvas.map do |c| # on each element of canvas collection~ - Inside source: true *** True Line Result - @fading = -1 -** Processing line: ~ end~ + outputs.borders << state.canvas.map do |c| # on each element of canvas collection +** Processing line: ~ c.border # outputs border~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + c.border # outputs border +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def build_binding_string~ +** Processing line: ~ # Outputs the dungeon cells.~ - Inside source: true *** True Line Result - def build_binding_string -** Processing line: ~ bindingstr = ''~ + # Outputs the dungeon cells. +** Processing line: ~ def render_dungeon~ - Inside source: true *** True Line Result - bindingstr = '' -** Processing line: ~ skip = false~ + def render_dungeon +** Processing line: ~ outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid~ - Inside source: true *** True Line Result - skip = false + outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ for i in 0..@parts.length-1~ +** Processing line: ~ # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method.~ - Inside source: true *** True Line Result - for i in 0..@parts.length-1 -** Processing line: ~ if skip ; skip = false ; next ; end~ + # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method. +** Processing line: ~ outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection~ - Inside source: true *** True Line Result - if skip ; skip = false ; next ; end -** Processing line: ~~ + outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection +** Processing line: ~ d.alpha += if d.is_visible # if cell is visible~ - Inside source: true *** True Line Result - -** Processing line: ~ binding = @bindings[i]~ + d.alpha += if d.is_visible # if cell is visible +** Processing line: ~ 255.fdiv(30) # increment opacity (transparency)~ - Inside source: true *** True Line Result - binding = @bindings[i] -** Processing line: ~ next if binding.nil?~ + 255.fdiv(30) # increment opacity (transparency) +** Processing line: ~ else # if cell is not visible~ - Inside source: true *** True Line Result - next if binding.nil? -** Processing line: ~~ + else # if cell is not visible +** Processing line: ~ 255.fdiv(600) * -1 # decrease opacity~ - Inside source: true *** True Line Result - -** Processing line: ~ part = @parts[i][3]~ + 255.fdiv(600) * -1 # decrease opacity +** Processing line: ~ end~ - Inside source: true *** True Line Result - part = @parts[i][3] -** Processing line: ~~ + end +** Processing line: ~ d.alpha = d.alpha.cap_min_max(0, 255)~ - Inside source: true *** True Line Result - -** Processing line: ~ # clean up string:~ + d.alpha = d.alpha.cap_min_max(0, 255) +** Processing line: ~ cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value~ - Inside source: true *** True Line Result - # clean up string: -** Processing line: ~ # if axis uses -a0 for negative and +a0 for positive, just make it "leftx:a0" instead of "-leftx:-a0,+leftx:+a0"~ + cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value +** Processing line: ~ end.reject_nil~ - Inside source: true *** True Line Result - # if axis uses -a0 for negative and +a0 for positive, just make it "leftx:a0" instead of "-leftx:-a0,+leftx:+a0" -** Processing line: ~ # if axis uses +a0 for negative and -a0 for positive, just make it "leftx:a0~" instead of "-leftx:+a0,+leftx:-a0"~ + end.reject_nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - # if axis uses +a0 for negative and -a0 for positive, just make it "leftx:a0~" instead of "-leftx:+a0,+leftx:-a0" -** Processing line: ~ if part == '-leftx' || part == '-lefty' || part == '-rightx' || part == '-righty'~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if part == '-leftx' || part == '-lefty' || part == '-rightx' || part == '-righty' -** Processing line: ~ nextbinding = @bindings[i+1]~ + +** Processing line: ~ # Sets definition of a cell border using the parameters~ - Inside source: true *** True Line Result - nextbinding = @bindings[i+1] -** Processing line: ~ if binding.start_with?('-a') && nextbinding.start_with?('+a') && binding[2..-1] == nextbinding[2..-1]~ + # Sets definition of a cell border using the parameters +** Processing line: ~ def cell_border x, y, color = nil~ - Inside source: true *** True Line Result - if binding.start_with?('-a') && nextbinding.start_with?('+a') && binding[2..-1] == nextbinding[2..-1] -** Processing line: ~ skip = true~ + def cell_border x, y, color = nil +** Processing line: ~ [left_margin + x * grid_size,~ - Inside source: true *** True Line Result - skip = true -** Processing line: ~ part = part[1..-1]~ + [left_margin + x * grid_size, +** Processing line: ~ bottom_margin + y * grid_size,~ - Inside source: true *** True Line Result - part = part[1..-1] -** Processing line: ~ binding = binding[1..-1]~ + bottom_margin + y * grid_size, +** Processing line: ~ grid_size,~ - Inside source: true *** True Line Result - binding = binding[1..-1] -** Processing line: ~ elsif binding.start_with?('+a') && nextbinding.start_with?('-a') && binding[2..-1] == nextbinding[2..-1]~ + grid_size, +** Processing line: ~ grid_size,~ - Inside source: true *** True Line Result - elsif binding.start_with?('+a') && nextbinding.start_with?('-a') && binding[2..-1] == nextbinding[2..-1] -** Processing line: ~ skip = true~ + grid_size, +** Processing line: ~ *color]~ - Inside source: true *** True Line Result - skip = true -** Processing line: ~ part = part[1..-1]~ + *color] +** Processing line: ~ end~ - Inside source: true *** True Line Result - part = part[1..-1] -** Processing line: ~ binding = "#{binding[1..-1]}~"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - binding = "#{binding[1..-1]}~" -** Processing line: ~ end~ + +** Processing line: ~ # Sets the values for the player and outputs it as a label~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Sets the values for the player and outputs it as a label +** Processing line: ~ def render_player~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def render_player +** Processing line: ~ outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square~ - Inside source: true *** True Line Result - -** Processing line: ~ bindingstr += "#{!bindingstr.empty? ? ',' : ''}#{part}:#{binding}"~ + outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square +** Processing line: ~ grid_y(state.y) + 35,~ - Inside source: true *** True Line Result - bindingstr += "#{!bindingstr.empty? ? ',' : ''}#{part}:#{binding}" -** Processing line: ~ end~ + grid_y(state.y) + 35, +** Processing line: ~ "@", # player is represented by a white "@" character~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + "@", # player is represented by a white "@" character +** Processing line: ~ 1, 1, *white]~ - Inside source: true *** True Line Result - -** Processing line: ~ details = @target[1]~ + 1, 1, *white] +** Processing line: ~ end~ - Inside source: true *** True Line Result - details = @target[1] + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # !!! FIXME: no String.delete in mRuby?!?! Maybe so when upgrading.~ +** Processing line: ~ def grid_x x~ - Inside source: true *** True Line Result - # !!! FIXME: no String.delete in mRuby?!?! Maybe so when upgrading. -** Processing line: ~ #name = details[:name].delete(',')~ + def grid_x x +** Processing line: ~ left_margin + x * grid_size # positions horizontally on grid~ - Inside source: true *** True Line Result - #name = details[:name].delete(',') -** Processing line: ~ # !!! FIXME: ...no regexp either... :/~ + left_margin + x * grid_size # positions horizontally on grid +** Processing line: ~ end~ - Inside source: true *** True Line Result - # !!! FIXME: ...no regexp either... :/ -** Processing line: ~ #name = details[:name].gsub(/,/, ' ') # !!! FIXME: will SDL let you escape these instead?~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - #name = details[:name].gsub(/,/, ' ') # !!! FIXME: will SDL let you escape these instead? -** Processing line: ~ unescaped = details[:name]~ + +** Processing line: ~ def grid_y y~ - Inside source: true *** True Line Result - unescaped = details[:name] -** Processing line: ~ name = ''~ + def grid_y y +** Processing line: ~ bottom_margin + y * grid_size # positions vertically on grid~ - Inside source: true *** True Line Result - name = '' -** Processing line: ~ for i in 0..unescaped.length-1~ + bottom_margin + y * grid_size # positions vertically on grid +** Processing line: ~ end~ - Inside source: true *** True Line Result - for i in 0..unescaped.length-1 -** Processing line: ~ ch = unescaped[i]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ch = unescaped[i] -** Processing line: ~ name += (ch == ',') ? ' ' : ch~ + +** Processing line: ~ # Outputs enemies onto the screen.~ - Inside source: true *** True Line Result - name += (ch == ',') ? ' ' : ch -** Processing line: ~ end~ + # Outputs enemies onto the screen. +** Processing line: ~ def render_enemies~ - Inside source: true *** True Line Result - end -** Processing line: ~ return "#{details[:guid]},#{name},platform:#{@runtime.platform},#{bindingstr}"~ + def render_enemies +** Processing line: ~ state.enemies.map do |e| # for each enemy in the collection~ - Inside source: true *** True Line Result - return "#{details[:guid]},#{name},platform:#{@runtime.platform},#{bindingstr}" -** Processing line: ~ end~ + state.enemies.map do |e| # for each enemy in the collection +** Processing line: ~ alpha = 255 # set opacity (full transparency)~ - Inside source: true *** True Line Result - end + alpha = 255 # set opacity (full transparency) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def move_to_different_part part~ +** Processing line: ~ # Outputs an enemy using a label.~ - Inside source: true *** True Line Result - def move_to_different_part part -** Processing line: ~ if !@joystick_state[:axes].nil?~ + # Outputs an enemy using a label. +** Processing line: ~ outputs.labels << [~ - Inside source: true *** True Line Result - if !@joystick_state[:axes].nil? -** Processing line: ~ @joystick_state[:axes].each { |i| i[:farthestval] = i[:startingval] if !i.nil? }~ + outputs.labels << [ +** Processing line: ~ left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square~ - Inside source: true *** True Line Result - @joystick_state[:axes].each { |i| i[:farthestval] = i[:startingval] if !i.nil? } -** Processing line: ~ end~ + left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square +** Processing line: ~ bottom_margin + 35 + e.y * grid_size,~ - Inside source: true *** True Line Result - end -** Processing line: ~ @current_part = part~ + bottom_margin + 35 + e.y * grid_size, +** Processing line: ~ "r", # enemy's text~ - Inside source: true *** True Line Result - @current_part = part -** Processing line: ~ end~ + "r", # enemy's text +** Processing line: ~ 1, 1, *white, alpha]~ - Inside source: true *** True Line Result - end + 1, 1, *white, alpha] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def previous_part~ -- Inside source: true -*** True Line Result - def previous_part -** Processing line: ~ if @current_part > 0~ -- Inside source: true -*** True Line Result - if @current_part > 0 -** Processing line: ~ # remove the binding that we previous had here so it can be reused.~ +** Processing line: ~ # Creates a red border around an enemy.~ - Inside source: true *** True Line Result - # remove the binding that we previous had here so it can be reused. -** Processing line: ~ bindstr = @bindings[@current_part - 1]~ + # Creates a red border around an enemy. +** Processing line: ~ outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red]~ - Inside source: true *** True Line Result - bindstr = @bindings[@current_part - 1] -** Processing line: ~ @bindings[@current_part - 1] = nil~ + outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red] +** Processing line: ~ end~ - Inside source: true *** True Line Result - @bindings[@current_part - 1] = nil -** Processing line: ~ @used_bindings[bindstr] = nil~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @used_bindings[bindstr] = nil -** Processing line: ~ move_to_different_part @current_part - 1~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - move_to_different_part @current_part - 1 -** Processing line: ~ end~ + +** Processing line: ~ #White labels are output for the cell coordinates of each element in the dungeon collection.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + #White labels are output for the cell coordinates of each element in the dungeon collection. +** Processing line: ~ def print_cell_coordinates~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def print_cell_coordinates +** Processing line: ~ return unless state.debug~ - Inside source: true *** True Line Result - -** Processing line: ~ def next_part~ + return unless state.debug +** Processing line: ~ state.dungeon.each do |d|~ - Inside source: true *** True Line Result - def next_part -** Processing line: ~ if @current_part < (@parts.length - 1)~ + state.dungeon.each do |d| +** Processing line: ~ outputs.labels << [grid_x(d.x) + 2,~ - Inside source: true *** True Line Result - if @current_part < (@parts.length - 1) -** Processing line: ~ move_to_different_part @current_part + 1~ + outputs.labels << [grid_x(d.x) + 2, +** Processing line: ~ grid_y(d.y) - 2,~ - Inside source: true *** True Line Result - move_to_different_part @current_part + 1 -** Processing line: ~ else~ + grid_y(d.y) - 2, +** Processing line: ~ "#{d.x},#{d.y}",~ - Inside source: true *** True Line Result - else -** Processing line: ~ @playing_around = true~ + "#{d.x},#{d.y}", +** Processing line: ~ -2, 0, *white]~ - Inside source: true *** True Line Result - @playing_around = true -** Processing line: ~ end~ + -2, 0, *white] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def set_binding bindstr~ +** Processing line: ~ # Adds new elements into the canvas collection and sets their values.~ - Inside source: true *** True Line Result - def set_binding bindstr -** Processing line: ~ return false if !@used_bindings[bindstr].nil?~ + # Adds new elements into the canvas collection and sets their values. +** Processing line: ~ def calc_canvas~ - Inside source: true *** True Line Result - return false if !@used_bindings[bindstr].nil? -** Processing line: ~ @used_bindings[bindstr] = @current_part~ + def calc_canvas +** Processing line: ~ return if state.canvas.length > 0 # return if canvas collection has at least one element~ - Inside source: true *** True Line Result - @used_bindings[bindstr] = @current_part -** Processing line: ~ @bindings[@current_part] = bindstr~ + return if state.canvas.length > 0 # return if canvas collection has at least one element +** Processing line: ~ 15.times do |x| # 15 times perform an action~ - Inside source: true *** True Line Result - @bindings[@current_part] = bindstr -** Processing line: ~ return true~ + 15.times do |x| # 15 times perform an action +** Processing line: ~ 15.times do |y|~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + 15.times do |y| +** Processing line: ~ state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity +** Processing line: ~ c.x = x # set position~ - Inside source: true *** True Line Result - -** Processing line: ~ # Called when a lowlevel joystick moves an axis.~ + c.x = x # set position +** Processing line: ~ c.y = y~ - Inside source: true *** True Line Result - # Called when a lowlevel joystick moves an axis. -** Processing line: ~ def rawjoystick_axis jid, axis, value~ + c.y = y +** Processing line: ~ c.border = [left_margin + x * grid_size,~ - Inside source: true *** True Line Result - def rawjoystick_axis jid, axis, value -** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ + c.border = [left_margin + x * grid_size, +** Processing line: ~ bottom_margin + y * grid_size,~ - Inside source: true *** True Line Result - return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. -** Processing line: ~~ + bottom_margin + y * grid_size, +** Processing line: ~ grid_size,~ - Inside source: true *** True Line Result - -** Processing line: ~ @joystick_state[:axes] ||= []~ + grid_size, +** Processing line: ~ grid_size,~ - Inside source: true *** True Line Result - @joystick_state[:axes] ||= [] -** Processing line: ~ @joystick_state[:axes][axis] ||= {~ + grid_size, +** Processing line: ~ *white, 30] # sets border definition~ - Inside source: true *** True Line Result - @joystick_state[:axes][axis] ||= { -** Processing line: ~ moving: false,~ + *white, 30] # sets border definition +** Processing line: ~ end~ - Inside source: true *** True Line Result - moving: false, -** Processing line: ~ startingval: 0,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - startingval: 0, -** Processing line: ~ currentval: 0,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - currentval: 0, -** Processing line: ~ farthestval: 0~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - farthestval: 0 -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # this is the logic from SDL's controllermap.c, more or less, since this is hard to get right from scratch.~ -- Inside source: true -*** True Line Result - # this is the logic from SDL's controllermap.c, more or less, since this is hard to get right from scratch. -** Processing line: ~ state = @joystick_state[:axes][axis]~ -- Inside source: true -*** True Line Result - state = @joystick_state[:axes][axis] -** Processing line: ~ state[:currentval] = value~ +** Processing line: ~ # Updates x and y values of the player, and updates player's line of sight~ - Inside source: true *** True Line Result - state[:currentval] = value -** Processing line: ~ if !state[:moving]~ + # Updates x and y values of the player, and updates player's line of sight +** Processing line: ~ def input_move~ - Inside source: true *** True Line Result - if !state[:moving] -** Processing line: ~ state[:moving] = true~ + def input_move +** Processing line: ~ x, y, x_diff, y_diff = input_target_cell~ - Inside source: true *** True Line Result - state[:moving] = true -** Processing line: ~ state[:startingval] = value~ + x, y, x_diff, y_diff = input_target_cell +** Processing line: ~~ - Inside source: true *** True Line Result - state[:startingval] = value -** Processing line: ~ state[:farthestval] = value~ + +** Processing line: ~ return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location~ - Inside source: true *** True Line Result - state[:farthestval] = value -** Processing line: ~ end~ + return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location +** Processing line: ~ return if enemy_at x, y # player can't move there if there is an enemy in that location~ - Inside source: true *** True Line Result - end + return if enemy_at x, y # player can't move there if there is an enemy in that location ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ current_distance = (value - state[:startingval]).abs~ -- Inside source: true -*** True Line Result - current_distance = (value - state[:startingval]).abs -** Processing line: ~ farthest_distance = (state[:farthestval] - state[:startingval]).abs~ -- Inside source: true -*** True Line Result - farthest_distance = (state[:farthestval] - state[:startingval]).abs -** Processing line: ~ if current_distance > farthest_distance~ +** Processing line: ~ state.x += x_diff # increments x by x_diff (so player moves left or right)~ - Inside source: true *** True Line Result - if current_distance > farthest_distance -** Processing line: ~ state[:farthestval] = value~ + state.x += x_diff # increments x by x_diff (so player moves left or right) +** Processing line: ~ state.y += y_diff # same with y and y_diff ( so player moves up or down)~ - Inside source: true *** True Line Result - state[:farthestval] = value -** Processing line: ~ farthest_distance = (state[:farthestval] - state[:startingval]).abs~ + state.y += y_diff # same with y and y_diff ( so player moves up or down) +** Processing line: ~ update_line_of_sight # updates visible cells~ - Inside source: true *** True Line Result - farthest_distance = (state[:farthestval] - state[:startingval]).abs -** Processing line: ~ end~ + update_line_of_sight # updates visible cells +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # If we've gone out far enough and started to come back, let's bind this axis~ -- Inside source: true -*** True Line Result - # If we've gone out far enough and started to come back, let's bind this axis -** Processing line: ~ if (farthest_distance >= 16000) && (current_distance <= 10000)~ +** Processing line: ~ def enemy_at x, y~ - Inside source: true *** True Line Result - if (farthest_distance >= 16000) && (current_distance <= 10000) -** Processing line: ~ next_part if set_binding("#{(state[:farthestval] < 0) ? '-' : '+'}a#{axis}")~ + def enemy_at x, y +** Processing line: ~ # Finds if coordinates exist in enemies collection and enemy is not dead~ - Inside source: true *** True Line Result - next_part if set_binding("#{(state[:farthestval] < 0) ? '-' : '+'}a#{axis}") -** Processing line: ~ end~ + # Finds if coordinates exist in enemies collection and enemy is not dead +** Processing line: ~ state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead }~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Called when a lowlevel joystick moves a hat.~ +** Processing line: ~ #M oves the user based on their keyboard input and sets values for target cell~ - Inside source: true *** True Line Result - # Called when a lowlevel joystick moves a hat. -** Processing line: ~ def rawjoystick_hat jid, hat, value~ + #M oves the user based on their keyboard input and sets values for target cell +** Processing line: ~ def input_target_cell~ - Inside source: true *** True Line Result - def rawjoystick_hat jid, hat, value -** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ + def input_target_cell +** Processing line: ~ if inputs.keyboard.key_down.up # if "up" key is in "down" state~ - Inside source: true *** True Line Result - return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. -** Processing line: ~~ + if inputs.keyboard.key_down.up # if "up" key is in "down" state +** Processing line: ~ [state.x, state.y + 1, 0, 1] # user moves up~ - Inside source: true *** True Line Result - -** Processing line: ~ @joystick_state[:hats] ||= []~ + [state.x, state.y + 1, 0, 1] # user moves up +** Processing line: ~ elsif inputs.keyboard.key_down.down # if "down" key is pressed~ - Inside source: true *** True Line Result - @joystick_state[:hats] ||= [] -** Processing line: ~ @joystick_state[:hats][hat] = value~ + elsif inputs.keyboard.key_down.down # if "down" key is pressed +** Processing line: ~ [state.x, state.y - 1, 0, -1] # user moves down~ - Inside source: true *** True Line Result - @joystick_state[:hats][hat] = value -** Processing line: ~~ + [state.x, state.y - 1, 0, -1] # user moves down +** Processing line: ~ elsif inputs.keyboard.key_down.left # if "left" key is pressed~ - Inside source: true *** True Line Result - -** Processing line: ~ return if value == 0 # 0 == centered, skip it~ + elsif inputs.keyboard.key_down.left # if "left" key is pressed +** Processing line: ~ [state.x - 1, state.y, -1, 0] # user moves left~ - Inside source: true *** True Line Result - return if value == 0 # 0 == centered, skip it -** Processing line: ~ next_part if set_binding("h#{hat}.#{value}")~ + [state.x - 1, state.y, -1, 0] # user moves left +** Processing line: ~ elsif inputs.keyboard.key_down.right # if "right" key is pressed~ - Inside source: true *** True Line Result - next_part if set_binding("h#{hat}.#{value}") -** Processing line: ~ end~ + elsif inputs.keyboard.key_down.right # if "right" key is pressed +** Processing line: ~ [state.x + 1, state.y, 1, 0] # user moves right~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [state.x + 1, state.y, 1, 0] # user moves right +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # Called when a lowlevel joystick moves a button.~ + else +** Processing line: ~ nil # otherwise, empty~ - Inside source: true *** True Line Result - # Called when a lowlevel joystick moves a button. -** Processing line: ~ def rawjoystick_button jid, button, pressed~ + nil # otherwise, empty +** Processing line: ~ end~ - Inside source: true *** True Line Result - def rawjoystick_button jid, button, pressed -** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @joystick_state[:buttons] ||= []~ -- Inside source: true -*** True Line Result - @joystick_state[:buttons] ||= [] -** Processing line: ~ @joystick_state[:buttons][button] = pressed~ +** Processing line: ~ # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element.~ - Inside source: true *** True Line Result - @joystick_state[:buttons][button] = pressed -** Processing line: ~~ + # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element. +** Processing line: ~ def input_click_map~ - Inside source: true *** True Line Result - -** Processing line: ~ return if !pressed~ + def input_click_map +** Processing line: ~ return unless inputs.mouse.click # return unless the mouse is clicked~ - Inside source: true *** True Line Result - return if !pressed -** Processing line: ~ next_part if set_binding("b#{button}")~ + return unless inputs.mouse.click # return unless the mouse is clicked +** Processing line: ~ canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements~ - Inside source: true *** True Line Result - next_part if set_binding("b#{button}") -** Processing line: ~ end~ + canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements +** Processing line: ~ inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def calc_fading~ + end +** Processing line: ~ puts canvas_entry # prints canvas_entry value~ - Inside source: true *** True Line Result - def calc_fading -** Processing line: ~ if @fading == 0~ + puts canvas_entry # prints canvas_entry value +** Processing line: ~ end~ - Inside source: true *** True Line Result - if @fading == 0 -** Processing line: ~ return 255~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return 255 -** Processing line: ~ elsif @fading > 0 # fading in~ + +** Processing line: ~ # Sets the definition of a label using the parameters.~ - Inside source: true *** True Line Result - elsif @fading > 0 # fading in -** Processing line: ~ percent = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip)~ + # Sets the definition of a label using the parameters. +** Processing line: ~ def label text, x, y, color = nil~ - Inside source: true *** True Line Result - percent = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) -** Processing line: ~ if percent >= 1.0~ + def label text, x, y, color = nil +** Processing line: ~ color ||= white # color is initialized to white~ - Inside source: true *** True Line Result - if percent >= 1.0 -** Processing line: ~ percent = 1.0~ + color ||= white # color is initialized to white +** Processing line: ~ [x, y, text, 1, 1, *color] # sets label definition~ - Inside source: true *** True Line Result - percent = 1.0 -** Processing line: ~ @fading = 0~ + [x, y, text, 1, 1, *color] # sets label definition +** Processing line: ~ end~ - Inside source: true *** True Line Result - @fading = 0 -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ else # fading out~ + +** Processing line: ~ def green~ - Inside source: true *** True Line Result - else # fading out -** Processing line: ~ percent = @toggled_at.global_ease(@animation_duration, :flip, :quint)~ + def green +** Processing line: ~ [60, 200, 100] # sets color saturation to shade of green~ - Inside source: true *** True Line Result - percent = @toggled_at.global_ease(@animation_duration, :flip, :quint) -** Processing line: ~ if percent <= 0.0~ + [60, 200, 100] # sets color saturation to shade of green +** Processing line: ~ end~ - Inside source: true *** True Line Result - if percent <= 0.0 -** Processing line: ~ percent = 0.0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - percent = 0.0 -** Processing line: ~ @fading = 0~ + +** Processing line: ~ def blue~ - Inside source: true *** True Line Result - @fading = 0 -** Processing line: ~ end~ + def blue +** Processing line: ~ [50, 50, 210] # sets color saturation to shade of blue~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [50, 50, 210] # sets color saturation to shade of blue +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return (percent * 255.0).to_i~ +** Processing line: ~ def white~ - Inside source: true *** True Line Result - return (percent * 255.0).to_i -** Processing line: ~ end~ + def white +** Processing line: ~ [255, 255, 255] # sets color saturation to white~ - Inside source: true *** True Line Result - end + [255, 255, 255] # sets color saturation to white +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_basics args, msg, fade=255~ +** Processing line: ~ def red~ - Inside source: true *** True Line Result - def render_basics args, msg, fade=255 -** Processing line: ~ joystickname = @target[1][:name]~ + def red +** Processing line: ~ [230, 80, 80] # sets color saturation to shade of red~ - Inside source: true *** True Line Result - joystickname = @target[1][:name] -** Processing line: ~ args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 255, 255, 255, fade].solid~ + [230, 80, 80] # sets color saturation to shade of red +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 255, 255, 255, fade].solid -** Processing line: ~ args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 'dragonruby-controller.png', 0, fade, 255, 255, 255].sprite~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 'dragonruby-controller.png', 0, fade, 255, 255, 255].sprite -** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 700, joystickname, 2, 1, 0, 0, 0, fade].label~ + +** Processing line: ~ def orange~ - Inside source: true *** True Line Result - args.outputs.primitives << [$gtk.logical_width / 2, 700, joystickname, 2, 1, 0, 0, 0, fade].label -** Processing line: ~ args.outputs.primitives << [$gtk.logical_height / 2, 650, msg, 0, 1, 0, 0, 0, 255].label if !msg.empty?~ + def orange +** Processing line: ~ [255, 80, 60] # sets color saturation to shade of orange~ - Inside source: true *** True Line Result - args.outputs.primitives << [$gtk.logical_height / 2, 650, msg, 0, 1, 0, 0, 0, 255].label if !msg.empty? -** Processing line: ~ end~ + [255, 80, 60] # sets color saturation to shade of orange +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_part_highlight args, part, alpha=255~ -- Inside source: true -*** True Line Result - def render_part_highlight args, part, alpha=255 -** Processing line: ~ partsize = 41~ +** Processing line: ~ def pink~ - Inside source: true *** True Line Result - partsize = 41 -** Processing line: ~ args.outputs.primitives << [part[0], part[1], partsize, partsize, 255, 0, 0, alpha].border~ + def pink +** Processing line: ~ [255, 0, 200] # sets color saturation to shade of pink~ - Inside source: true *** True Line Result - args.outputs.primitives << [part[0], part[1], partsize, partsize, 255, 0, 0, alpha].border -** Processing line: ~ args.outputs.primitives << [part[0]-1, part[1]-1, partsize+2, partsize+2, 255, 0, 0, alpha].border~ + [255, 0, 200] # sets color saturation to shade of pink +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.primitives << [part[0]-1, part[1]-1, partsize+2, partsize+2, 255, 0, 0, alpha].border -** Processing line: ~ args.outputs.primitives << [part[0]-2, part[1]-2, partsize+4, partsize+4, 255, 0, 0, alpha].border~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args.outputs.primitives << [part[0]-2, part[1]-2, partsize+4, partsize+4, 255, 0, 0, alpha].border -** Processing line: ~ end~ + +** Processing line: ~ def gray~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def gray +** Processing line: ~ [75, 75, 75] # sets color saturation to shade of gray~ - Inside source: true *** True Line Result - -** Processing line: ~ def choose_target~ + [75, 75, 75] # sets color saturation to shade of gray +** Processing line: ~ end~ - Inside source: true *** True Line Result - def choose_target -** Processing line: ~ if @target.nil?~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if @target.nil? -** Processing line: ~ while !@raw_joysticks.empty?~ + +** Processing line: ~ # Recolors the border using the parameters.~ - Inside source: true *** True Line Result - while !@raw_joysticks.empty? -** Processing line: ~ t = @raw_joysticks.shift # see if there's a joystick waiting on us.~ + # Recolors the border using the parameters. +** Processing line: ~ def recolor_border border, r, g, b~ - Inside source: true *** True Line Result - t = @raw_joysticks.shift # see if there's a joystick waiting on us. -** Processing line: ~ next if t[0] < 0 # just in case.~ + def recolor_border border, r, g, b +** Processing line: ~ border[4] = r~ - Inside source: true *** True Line Result - next if t[0] < 0 # just in case. -** Processing line: ~ next if t[1][:guid].nil? # did we already handle this guid? Dump it.~ + border[4] = r +** Processing line: ~ border[5] = g~ - Inside source: true *** True Line Result - next if t[1][:guid].nil? # did we already handle this guid? Dump it. -** Processing line: ~ @target = t~ + border[5] = g +** Processing line: ~ border[6] = b~ - Inside source: true *** True Line Result - @target = t -** Processing line: ~ break~ + border[6] = b +** Processing line: ~ border~ - Inside source: true *** True Line Result - break -** Processing line: ~ end~ + border +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ return false if @target.nil? # nothing to configure at the moment.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return false if @target.nil? # nothing to configure at the moment. -** Processing line: ~ @toggled_at = Kernel.global_tick_count~ + +** Processing line: ~ # Returns a boolean value.~ - Inside source: true *** True Line Result - @toggled_at = Kernel.global_tick_count -** Processing line: ~ @fading = 1~ + # Returns a boolean value. +** Processing line: ~ def visible? cell~ - Inside source: true *** True Line Result - @fading = 1 -** Processing line: ~ @current_part = 0~ + def visible? cell +** Processing line: ~ # finds cell's coordinates inside visible_cells collections to determine if cell is visible~ - Inside source: true *** True Line Result - @current_part = 0 -** Processing line: ~ @part_alpha = 0~ + # finds cell's coordinates inside visible_cells collections to determine if cell is visible +** Processing line: ~ state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y}~ - Inside source: true *** True Line Result - @part_alpha = 0 -** Processing line: ~ @part_alpha_increment = 10~ + state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y} +** Processing line: ~ end~ - Inside source: true *** True Line Result - @part_alpha_increment = 10 -** Processing line: ~ @joystick_state = {}~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @joystick_state = {} -** Processing line: ~ @used_bindings = {}~ + +** Processing line: ~ # Exports dungeon by printing dungeon cell coordinates~ - Inside source: true *** True Line Result - @used_bindings = {} -** Processing line: ~ @playing_around = false~ + # Exports dungeon by printing dungeon cell coordinates +** Processing line: ~ def export_dungeon~ - Inside source: true *** True Line Result - @playing_around = false -** Processing line: ~ @bindings = []~ + def export_dungeon +** Processing line: ~ state.dungeon.each do |d| # on each element of dungeon collection~ - Inside source: true *** True Line Result - @bindings = [] -** Processing line: ~ end~ + state.dungeon.each do |d| # on each element of dungeon collection +** Processing line: ~ puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates~ - Inside source: true *** True Line Result - end -** Processing line: ~ return true~ + puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates +** Processing line: ~ end~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def render_part_highlight_from_bindstr args, bindstr, alpha=255~ +** Processing line: ~ def distance_to_cell cell~ - Inside source: true *** True Line Result - def render_part_highlight_from_bindstr args, bindstr, alpha=255 -** Processing line: ~ partidx = @used_bindings[bindstr]~ + def distance_to_cell cell +** Processing line: ~ distance_to state.x, cell.x, state.y, cell.y # calls distance_to method~ - Inside source: true *** True Line Result - partidx = @used_bindings[bindstr] -** Processing line: ~ return if partidx.nil?~ + distance_to state.x, cell.x, state.y, cell.y # calls distance_to method +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if partidx.nil? -** Processing line: ~ render_part_highlight args, @parts[partidx], alpha~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - render_part_highlight args, @parts[partidx], alpha -** Processing line: ~ end~ + +** Processing line: ~ def distance_to from_x, x, from_y, y~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def distance_to from_x, x, from_y, y +** Processing line: ~ (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates~ - Inside source: true *** True Line Result - -** Processing line: ~ def play_around args~ + (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates +** Processing line: ~ end~ - Inside source: true *** True Line Result - def play_around args -** Processing line: ~ return false if !@playing_around~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - return false if !@playing_around + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if args.inputs.keyboard.key_down.escape~ +** Processing line: ~ $game = Game.new~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.escape -** Processing line: ~ @current_part = 0~ + $game = Game.new +** Processing line: ~~ - Inside source: true *** True Line Result - @current_part = 0 -** Processing line: ~ @part_alpha = 0~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - @part_alpha = 0 -** Processing line: ~ @part_alpha_increment = 10~ + def tick args +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - @part_alpha_increment = 10 -** Processing line: ~ @used_bindings = {}~ + $game.args = args +** Processing line: ~ $game.state = args.state~ - Inside source: true *** True Line Result - @used_bindings = {} -** Processing line: ~ @playing_around = false~ + $game.state = args.state +** Processing line: ~ $game.inputs = args.inputs~ - Inside source: true *** True Line Result - @playing_around = false -** Processing line: ~ @bindings = []~ + $game.inputs = args.inputs +** Processing line: ~ $game.outputs = args.outputs~ - Inside source: true *** True Line Result - @bindings = [] -** Processing line: ~ elsif args.inputs.keyboard.key_down.space~ + $game.outputs = args.outputs +** Processing line: ~ $game.grid = args.grid~ - Inside source: true *** True Line Result - elsif args.inputs.keyboard.key_down.space -** Processing line: ~ jid = @target[0]~ + $game.grid = args.grid +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - jid = @target[0] -** Processing line: ~ bindingstr = build_binding_string~ + $game.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - bindingstr = build_binding_string -** Processing line: ~ #puts("new controller binding: '#{bindingstr}'")~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - #puts("new controller binding: '#{bindingstr}'") -** Processing line: ~ @runtime.ffi_misc.add_controller_config bindingstr~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Rpg Tactical - Hexagonal Grid - main.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rpg Tactical - Hexagonal Grid - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb~ - Inside source: true *** True Line Result - @runtime.ffi_misc.add_controller_config bindingstr -** Processing line: ~ @runtime.ffi_misc.convert_rawjoystick_to_controller jid~ + # ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb +** Processing line: ~ class HexagonTileGame~ - Inside source: true *** True Line Result - @runtime.ffi_misc.convert_rawjoystick_to_controller jid -** Processing line: ~ @target[0] = -1 # Conversion closes the raw joystick.~ + class HexagonTileGame +** Processing line: ~ attr_gtk~ - Inside source: true *** True Line Result - @target[0] = -1 # Conversion closes the raw joystick. + attr_gtk ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Handle any other pending joysticks that have the same GUID (so if you plug in four of the same model, we're already done!)~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - # Handle any other pending joysticks that have the same GUID (so if you plug in four of the same model, we're already done!) -** Processing line: ~ guid = @target[1][:guid]~ + def defaults +** Processing line: ~ state.tile_scale = 1.3~ - Inside source: true *** True Line Result - guid = @target[1][:guid] -** Processing line: ~ @raw_joysticks.each { |jid, details|~ + state.tile_scale = 1.3 +** Processing line: ~ state.tile_size = 80~ - Inside source: true *** True Line Result - @raw_joysticks.each { |jid, details| -** Processing line: ~ if details[:guid] == guid~ + state.tile_size = 80 +** Processing line: ~ state.tile_w = Math.sqrt(3) * state.tile_size.half~ - Inside source: true *** True Line Result - if details[:guid] == guid -** Processing line: ~ @runtime.ffi_misc.convert_rawjoystick_to_controller jid~ + state.tile_w = Math.sqrt(3) * state.tile_size.half +** Processing line: ~ state.tile_h = state.tile_size * 3/4~ - Inside source: true *** True Line Result - @runtime.ffi_misc.convert_rawjoystick_to_controller jid -** Processing line: ~ details[:guid] = nil~ + state.tile_h = state.tile_size * 3/4 +** Processing line: ~ state.tiles_x_count = 1280.idiv(state.tile_w) - 1~ - Inside source: true *** True Line Result - details[:guid] = nil -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ }~ -- Inside source: true -*** True Line Result - } -** Processing line: ~~ + state.tiles_x_count = 1280.idiv(state.tile_w) - 1 +** Processing line: ~ state.tiles_y_count = 720.idiv(state.tile_h) - 1~ - Inside source: true *** True Line Result - -** Processing line: ~ # Done with this guy.~ + state.tiles_y_count = 720.idiv(state.tile_h) - 1 +** Processing line: ~ state.world_width_px = state.tiles_x_count * state.tile_w~ - Inside source: true *** True Line Result - # Done with this guy. -** Processing line: ~ @playing_around = false~ + state.world_width_px = state.tiles_x_count * state.tile_w +** Processing line: ~ state.world_height_px = state.tiles_y_count * state.tile_h~ - Inside source: true *** True Line Result - @playing_around = false -** Processing line: ~ @toggled_at = Kernel.global_tick_count~ + state.world_height_px = state.tiles_y_count * state.tile_h +** Processing line: ~ state.world_x_offset = (1280 - state.world_width_px).half~ - Inside source: true *** True Line Result - @toggled_at = Kernel.global_tick_count -** Processing line: ~ @fading = -1~ + state.world_x_offset = (1280 - state.world_width_px).half +** Processing line: ~ state.world_y_offset = (720 - state.world_height_px).half~ - Inside source: true *** True Line Result - @fading = -1 -** Processing line: ~ return false~ + state.world_y_offset = (720 - state.world_height_px).half +** Processing line: ~ state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y|~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y| +** Processing line: ~ {~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + { +** Processing line: ~ ordinal_x: ordinal_x,~ - Inside source: true *** True Line Result - -** Processing line: ~ render_basics args, 'Now play around with the controller, and make sure it feels right!'~ + ordinal_x: ordinal_x, +** Processing line: ~ ordinal_y: ordinal_y,~ - Inside source: true *** True Line Result - render_basics args, 'Now play around with the controller, and make sure it feels right!' -** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Reconfigure, [SPACE]: Save this configuration', 0, 1, 0, 0, 0, 255].label~ + ordinal_y: ordinal_y, +** Processing line: ~ offset_x: (ordinal_y.even?) ?~ - Inside source: true *** True Line Result - args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Reconfigure, [SPACE]: Save this configuration', 0, 1, 0, 0, 0, 255].label -** Processing line: ~~ + offset_x: (ordinal_y.even?) ? +** Processing line: ~ (state.world_x_offset + state.tile_w.half.half) :~ - Inside source: true *** True Line Result - -** Processing line: ~ axes = @joystick_state[:axes]~ + (state.world_x_offset + state.tile_w.half.half) : +** Processing line: ~ (state.world_x_offset - state.tile_w.half.half),~ - Inside source: true *** True Line Result - axes = @joystick_state[:axes] -** Processing line: ~ if !axes.nil?~ + (state.world_x_offset - state.tile_w.half.half), +** Processing line: ~ offset_y: state.world_y_offset,~ - Inside source: true *** True Line Result - if !axes.nil? -** Processing line: ~ for i in 0..axes.length-1~ + offset_y: state.world_y_offset, +** Processing line: ~ w: state.tile_w,~ - Inside source: true *** True Line Result - for i in 0..axes.length-1 -** Processing line: ~ next if axes[i].nil?~ + w: state.tile_w, +** Processing line: ~ h: state.tile_h,~ - Inside source: true *** True Line Result - next if axes[i].nil? -** Processing line: ~ value = axes[i][:currentval]~ + h: state.tile_h, +** Processing line: ~ type: :blank,~ - Inside source: true *** True Line Result - value = axes[i][:currentval] -** Processing line: ~ next if value.nil? || (value.abs < 16000)~ + type: :blank, +** Processing line: ~ path: "sprites/hexagon-gray.png",~ - Inside source: true *** True Line Result - next if value.nil? || (value.abs < 16000) -** Processing line: ~ render_part_highlight_from_bindstr args, "#{value < 0 ? '-' : '+'}a#{i}"~ + path: "sprites/hexagon-gray.png", +** Processing line: ~ a: 20~ - Inside source: true *** True Line Result - render_part_highlight_from_bindstr args, "#{value < 0 ? '-' : '+'}a#{i}" -** Processing line: ~ end~ + a: 20 +** Processing line: ~ }.associate do |h|~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + }.associate do |h| +** Processing line: ~ h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w], +** Processing line: ~ y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale)~ - Inside source: true *** True Line Result - -** Processing line: ~ hats = @joystick_state[:hats]~ + y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale) +** Processing line: ~ end.associate do |h|~ - Inside source: true *** True Line Result - hats = @joystick_state[:hats] -** Processing line: ~ if !hats.nil?~ + end.associate do |h| +** Processing line: ~ h.merge(center: {~ - Inside source: true *** True Line Result - if !hats.nil? -** Processing line: ~ for i in 0..hats.length-1~ + h.merge(center: { +** Processing line: ~ x: h[:x] + h[:w].half,~ - Inside source: true *** True Line Result - for i in 0..hats.length-1 -** Processing line: ~ value = hats[i]~ + x: h[:x] + h[:w].half, +** Processing line: ~ y: h[:y] + h[:h].half~ - Inside source: true *** True Line Result - value = hats[i] -** Processing line: ~ next if value.nil? || (value == 0)~ + y: h[:y] + h[:h].half +** Processing line: ~ }, radius: [h[:w].half, h[:h].half].max)~ - Inside source: true *** True Line Result - next if value.nil? || (value == 0) -** Processing line: ~ render_part_highlight_from_bindstr args, "h#{i}.#{value}"~ + }, radius: [h[:w].half, h[:h].half].max) +** Processing line: ~ end~ - Inside source: true *** True Line Result - render_part_highlight_from_bindstr args, "h#{i}.#{value}" -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ buttons = @joystick_state[:buttons]~ -- Inside source: true -*** True Line Result - buttons = @joystick_state[:buttons] -** Processing line: ~ if !buttons.nil?~ -- Inside source: true -*** True Line Result - if !buttons.nil? -** Processing line: ~ for i in 0..buttons.length-1~ +** Processing line: ~ def input~ - Inside source: true *** True Line Result - for i in 0..buttons.length-1 -** Processing line: ~ value = buttons[i]~ + def input +** Processing line: ~ if inputs.click~ - Inside source: true *** True Line Result - value = buttons[i] -** Processing line: ~ next if value.nil? || !value~ + if inputs.click +** Processing line: ~ tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] }~ - Inside source: true *** True Line Result - next if value.nil? || !value -** Processing line: ~ render_part_highlight_from_bindstr args, "b#{i}"~ + tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] } +** Processing line: ~ if tile~ - Inside source: true *** True Line Result - render_part_highlight_from_bindstr args, "b#{i}" -** Processing line: ~ end~ + if tile +** Processing line: ~ tile[:a] = 255~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + tile[:a] = 255 +** Processing line: ~ tile[:path] = "sprites/hexagon-black.png"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + tile[:path] = "sprites/hexagon-black.png" +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ return true~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def should_tick?~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - def should_tick? -** Processing line: ~ return true if @play_around~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - return true if @play_around -** Processing line: ~ return true if @target~ + defaults +** Processing line: ~ input~ - Inside source: true *** True Line Result - return true if @target -** Processing line: ~ return false~ + input +** Processing line: ~ render~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + render +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def tick args~ +** Processing line: ~ def render~ - Inside source: true *** True Line Result - def tick args -** Processing line: ~ return true if play_around args~ + def render +** Processing line: ~ outputs.sprites << state.tiles~ - Inside source: true *** True Line Result - return true if play_around args -** Processing line: ~ return false if !choose_target~ + outputs.sprites << state.tiles +** Processing line: ~ end~ - Inside source: true *** True Line Result - return false if !choose_target + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ jid = @target[0]~ +** Processing line: ~ $game = HexagonTileGame.new~ - Inside source: true *** True Line Result - jid = @target[0] + $game = HexagonTileGame.new ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if @fading == 0~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - if @fading == 0 -** Processing line: ~ # Cancel config?~ + def tick args +** Processing line: ~ $game.args = args~ - Inside source: true *** True Line Result - # Cancel config? -** Processing line: ~ if args.inputs.keyboard.key_down.escape~ + $game.args = args +** Processing line: ~ $game.tick~ - Inside source: true *** True Line Result - if args.inputs.keyboard.key_down.escape -** Processing line: ~ # !!! FIXME: prompt to ignore this joystick forever or just this run~ + $game.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - # !!! FIXME: prompt to ignore this joystick forever or just this run -** Processing line: ~ @toggled_at = Kernel.global_tick_count~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @toggled_at = Kernel.global_tick_count -** Processing line: ~ @fading = -1~ + +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - @fading = -1 -** Processing line: ~ end~ + $gtk.reset +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ if @fading == 0~ -- Inside source: true +** Processing line: ~* Rpg Tactical - Isometric Grid - main.rb~ +- Header detected. *** True Line Result - if @fading == 0 -** Processing line: ~ if args.inputs.keyboard.key_down.backspace~ -- Inside source: true + *** True Line Result - if args.inputs.keyboard.key_down.backspace -** Processing line: ~ previous_part~ -- Inside source: true +* Rpg Tactical - Isometric Grid - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - previous_part -** Processing line: ~ elsif args.inputs.keyboard.key_down.space~ -- Inside source: true + *** True Line Result - elsif args.inputs.keyboard.key_down.space -** Processing line: ~ next_part~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb~ - Inside source: true *** True Line Result - next_part -** Processing line: ~ end~ + # ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb +** Processing line: ~ class Isometric~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + class Isometric +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ - Inside source: true *** True Line Result - end + attr_accessor :grid, :inputs, :state, :outputs ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ fade = calc_fading~ +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - fade = calc_fading -** Processing line: ~ if (@fading < 0) && (fade == 0)~ + def tick +** Processing line: ~ defaults~ - Inside source: true *** True Line Result - if (@fading < 0) && (fade == 0) -** Processing line: ~ @runtime.ffi_misc.close_raw_joystick(jid) if jid >= 0~ + defaults +** Processing line: ~ render~ - Inside source: true *** True Line Result - @runtime.ffi_misc.close_raw_joystick(jid) if jid >= 0 -** Processing line: ~ @target = nil # done with this controller~ + render +** Processing line: ~ calc~ - Inside source: true *** True Line Result - @target = nil # done with this controller -** Processing line: ~ return false~ + calc +** Processing line: ~ process_inputs~ - Inside source: true *** True Line Result - return false -** Processing line: ~ end~ + process_inputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ render_basics args, (@fading >= 0) ? "We don't recognize this controller, so tell us about it!" : '', fade~ +** Processing line: ~ def defaults~ - Inside source: true *** True Line Result - render_basics args, (@fading >= 0) ? "We don't recognize this controller, so tell us about it!" : '', fade -** Processing line: ~~ + def defaults +** Processing line: ~ state.quantity ||= 6 #Size of grid~ - Inside source: true *** True Line Result - -** Processing line: ~ return true if fade < 255 # all done for now~ + state.quantity ||= 6 #Size of grid +** Processing line: ~ state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles~ - Inside source: true *** True Line Result - return true if fade < 255 # all done for now -** Processing line: ~~ + state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles +** Processing line: ~ state.tileGrid ||= [] #Holds ordering of tiles~ - Inside source: true *** True Line Result - -** Processing line: ~ part = @parts[@current_part]~ + state.tileGrid ||= [] #Holds ordering of tiles +** Processing line: ~ state.currentSpriteLocation ||= -1 #Current Sprite hovering location~ - Inside source: true *** True Line Result - part = @parts[@current_part] -** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 575, "Please press the #{part[2]}.", 0, 1, 0, 0, 0, 255].label~ + state.currentSpriteLocation ||= -1 #Current Sprite hovering location +** Processing line: ~ state.tileCords ||= [] #Physical, rendering cordinates~ - Inside source: true *** True Line Result - args.outputs.primitives << [$gtk.logical_width / 2, 575, "Please press the #{part[2]}.", 0, 1, 0, 0, 0, 255].label -** Processing line: ~ render_part_highlight args, part, @part_alpha~ + state.tileCords ||= [] #Physical, rendering cordinates +** Processing line: ~ state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0)~ - Inside source: true *** True Line Result - render_part_highlight args, part, @part_alpha -** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Ignore controller, [BACKSPACE]: Go back one button, [SPACE]: Skip this button', 0, 1, 0, 0, 0, 255].label~ + state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0) +** Processing line: ~ state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size~ - Inside source: true *** True Line Result - args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Ignore controller, [BACKSPACE]: Go back one button, [SPACE]: Skip this button', 0, 1, 0, 0, 0, 255].label -** Processing line: ~~ + state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size +** Processing line: ~ state.mode ||= :delete #Switches between :delete and :insert~ - Inside source: true *** True Line Result - -** Processing line: ~ @part_alpha += @part_alpha_increment~ + state.mode ||= :delete #Switches between :delete and :insert +** Processing line: ~ state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2],~ - Inside source: true *** True Line Result - @part_alpha += @part_alpha_increment -** Processing line: ~ if (@part_alpha_increment > 0) && (@part_alpha >= 255)~ + state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2], +** Processing line: ~ ['mountain', 0, 0, 262 / 2, 245 / 2],~ - Inside source: true *** True Line Result - if (@part_alpha_increment > 0) && (@part_alpha >= 255) -** Processing line: ~ @part_alpha = 255~ + ['mountain', 0, 0, 262 / 2, 245 / 2], +** Processing line: ~ ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information~ - Inside source: true *** True Line Result - @part_alpha = 255 -** Processing line: ~ @part_alpha_increment = -10~ + ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information +** Processing line: ~ #['name', deltaX, deltaY, sizeW, sizeH]~ - Inside source: true *** True Line Result - @part_alpha_increment = -10 -** Processing line: ~ elsif (@part_alpha_increment < 0) && (@part_alpha <= 0)~ + #['name', deltaX, deltaY, sizeW, sizeH] +** Processing line: ~ #^delta refers to distance from tile cords~ - Inside source: true *** True Line Result - elsif (@part_alpha_increment < 0) && (@part_alpha <= 0) -** Processing line: ~ @part_alpha = 0~ + #^delta refers to distance from tile cords +** Processing line: ~~ - Inside source: true *** True Line Result - @part_alpha = 0 -** Processing line: ~ @part_alpha_increment = 10~ + +** Processing line: ~ #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc~ - Inside source: true *** True Line Result - @part_alpha_increment = 10 -** Processing line: ~ end~ + #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc +** Processing line: ~ if state.tileGrid == []~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if state.tileGrid == [] +** Processing line: ~ tempX = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ return true~ + tempX = 0 +** Processing line: ~ tempY = 0~ - Inside source: true *** True Line Result - return true -** Processing line: ~ end~ + tempY = 0 +** Processing line: ~ tempLeft = false~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + tempLeft = false +** Processing line: ~ tempRight = false~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + tempRight = false +** Processing line: ~ count = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + count = 0 +** Processing line: ~ (state.quantity * state.quantity).times do~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + (state.quantity * state.quantity).times do +** Processing line: ~ if tempY == 0~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/controller/keys.rb~ -- Header detected. + if tempY == 0 +** Processing line: ~ tempLeft = true~ +- Inside source: true *** True Line Result - + tempLeft = true +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* ./dragon/controller/keys.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~ if tempX == (state.quantity - 1)~ +- Inside source: true *** True Line Result - + if tempX == (state.quantity - 1) +** Processing line: ~ tempRight = true~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + tempRight = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + end +** Processing line: ~ state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count])~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count]) +** Processing line: ~ #orderX, orderY, exists?, leftSide, rightSide, order~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # controller/keys.rb has been released under MIT (*only this file*).~ + #orderX, orderY, exists?, leftSide, rightSide, order +** Processing line: ~ tempX += 1~ - Inside source: true *** True Line Result - # controller/keys.rb has been released under MIT (*only this file*). -** Processing line: ~~ + tempX += 1 +** Processing line: ~ if tempX == state.quantity~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + if tempX == state.quantity +** Processing line: ~ tempX = 0~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Controller~ + tempX = 0 +** Processing line: ~ tempY += 1~ - Inside source: true *** True Line Result - class Controller -** Processing line: ~ class Keys~ + tempY += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - class Keys -** Processing line: ~ include Serialize~ + end +** Processing line: ~ tempLeft = false~ - Inside source: true *** True Line Result - include Serialize -** Processing line: ~~ + tempLeft = false +** Processing line: ~ tempRight = false~ - Inside source: true *** True Line Result - -** Processing line: ~ LABELS = [~ + tempRight = false +** Processing line: ~ count += 1~ - Inside source: true *** True Line Result - LABELS = [ -** Processing line: ~ :up, :down, :left, :right,~ + count += 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - :up, :down, :left, :right, -** Processing line: ~ :a, :b, :x, :y,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - :a, :b, :x, :y, -** Processing line: ~ :l1, :r1,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :l1, :r1, -** Processing line: ~ :l2, :r2,~ + +** Processing line: ~ #Calculates physical cordinates for tiles~ - Inside source: true *** True Line Result - :l2, :r2, -** Processing line: ~ :l3, :r3,~ + #Calculates physical cordinates for tiles +** Processing line: ~ if state.tileCords == []~ - Inside source: true *** True Line Result - :l3, :r3, -** Processing line: ~ :start, :select,~ + if state.tileCords == [] +** Processing line: ~ state.tileCords = state.tileGrid.map do~ - Inside source: true *** True Line Result - :start, :select, -** Processing line: ~ :directional_up, :directional_down, :directional_left, :directional_right~ + state.tileCords = state.tileGrid.map do +** Processing line: ~ |val|~ - Inside source: true *** True Line Result - :directional_up, :directional_down, :directional_left, :directional_right -** Processing line: ~ ].freeze~ + |val| +** Processing line: ~ x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2)~ - Inside source: true *** True Line Result - ].freeze -** Processing line: ~~ + x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2) +** Processing line: ~ y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2)~ - Inside source: true *** True Line Result - -** Processing line: ~ LABELS.each do |label|~ + y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2) +** Processing line: ~ [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now~ - Inside source: true *** True Line Result - LABELS.each do |label| -** Processing line: ~ attr_reader label~ + [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_reader label -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Activate a key.~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Activate a key. -** Processing line: ~ #~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + +** Processing line: ~ def render~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def activate key~ + def render +** Processing line: ~ renderBackground~ - Inside source: true *** True Line Result - def activate key -** Processing line: ~ instance_variable_set("@#{key}", Kernel.tick_count + 1)~ + renderBackground +** Processing line: ~ renderLeft~ - Inside source: true *** True Line Result - instance_variable_set("@#{key}", Kernel.tick_count + 1) -** Processing line: ~ end~ + renderLeft +** Processing line: ~ renderRight~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + renderRight +** Processing line: ~ renderTiles~ - Inside source: true *** True Line Result - -** Processing line: ~ # Deactivate a key.~ + renderTiles +** Processing line: ~ renderObjects~ - Inside source: true *** True Line Result - # Deactivate a key. -** Processing line: ~ #~ + renderObjects +** Processing line: ~ renderLabels~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + renderLabels +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def deactivate key~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def deactivate key -** Processing line: ~ instance_variable_set("@#{key}", nil)~ + +** Processing line: ~ def renderBackground~ - Inside source: true *** True Line Result - instance_variable_set("@#{key}", nil) -** Processing line: ~ end~ + def renderBackground +** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Clear all key inputs.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # Clear all key inputs. -** Processing line: ~ #~ + +** Processing line: ~ def renderLeft~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + def renderLeft +** Processing line: ~ #Shows the pink left cube face~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def clear~ + #Shows the pink left cube face +** Processing line: ~ outputs.sprites << state.tileCords.map do~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ LABELS.each { |label| deactivate(label) }~ + outputs.sprites << state.tileCords.map do +** Processing line: ~ |val|~ - Inside source: true *** True Line Result - LABELS.each { |label| deactivate(label) } -** Processing line: ~ end~ + |val| +** Processing line: ~ if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered +** Processing line: ~ [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0],~ - Inside source: true *** True Line Result - -** Processing line: ~ def truthy_keys~ + [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], +** Processing line: ~ state.sideSize[1], 'sprites/leftSide.png']~ - Inside source: true *** True Line Result - def truthy_keys -** Processing line: ~ LABELS.select { |label| send(label) }~ + state.sideSize[1], 'sprites/leftSide.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - LABELS.select { |label| send(label) } -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/directional_input_helper_methods.rb~ -- Header detected. +** Processing line: ~ def renderRight~ +- Inside source: true *** True Line Result - + def renderRight +** Processing line: ~ #Shows the green right cube face~ +- Inside source: true *** True Line Result -* ./dragon/directional_input_helper_methods.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + #Shows the green right cube face +** Processing line: ~ outputs.sprites << state.tileCords.map do~ +- Inside source: true *** True Line Result - + outputs.sprites << state.tileCords.map do +** Processing line: ~ |val|~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + |val| +** Processing line: ~ if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered +** Processing line: ~ [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0],~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], +** Processing line: ~ state.sideSize[1], 'sprites/rightSide.png']~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # directional_input_helper_methods.rb has been released under MIT (*only this file*).~ + state.sideSize[1], 'sprites/rightSide.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # directional_input_helper_methods.rb has been released under MIT (*only this file*). -** Processing line: ~~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ # This is a module that contains normalization of behavior related to `up`|`down`|`left`|`right` on keyboards and controllers.~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # This is a module that contains normalization of behavior related to `up`|`down`|`left`|`right` on keyboards and controllers. -** Processing line: ~ module DirectionalInputHelperMethods~ + +** Processing line: ~ def renderTiles~ - Inside source: true *** True Line Result - module DirectionalInputHelperMethods -** Processing line: ~ def self.included klass~ + def renderTiles +** Processing line: ~ #Shows the tile itself. Important that it's rendered after the two above!~ - Inside source: true *** True Line Result - def self.included klass -** Processing line: ~ key_state_methods = [:key_held, :key_down]~ + #Shows the tile itself. Important that it's rendered after the two above! +** Processing line: ~ outputs.sprites << state.tileCords.map do~ - Inside source: true *** True Line Result - key_state_methods = [:key_held, :key_down] -** Processing line: ~ directional_methods = [:up, :down, :left, :right]~ + outputs.sprites << state.tileCords.map do +** Processing line: ~ |val|~ - Inside source: true *** True Line Result - directional_methods = [:up, :down, :left, :right] -** Processing line: ~ method_results = (directional_methods + key_state_methods).map {|m| [m, klass.instance_methods.include?(m)] }~ + |val| +** Processing line: ~ if val[2] == true #Chcekcs if tile needs to be rendered~ - Inside source: true *** True Line Result - method_results = (directional_methods + key_state_methods).map {|m| [m, klass.instance_methods.include?(m)] } -** Processing line: ~~ + if val[2] == true #Chcekcs if tile needs to be rendered +** Processing line: ~ if val[5] == state.currentSpriteLocation~ - Inside source: true *** True Line Result - -** Processing line: ~ error_message = <<-S~ + if val[5] == state.currentSpriteLocation +** Processing line: ~ [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png']~ - Inside source: true *** True Line Result - error_message = <<-S -** Processing line: ~ * ERROR~ + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png'] +** Processing line: ~ else~ - Inside source: true *** True Line Result - * ERROR -** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy:~ + else +** Processing line: ~ [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png']~ - Inside source: true *** True Line Result - The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy: -** Processing line: ~~ + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ - (#{ directional_methods.join("|") })~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - - (#{ directional_methods.join("|") }) -** Processing line: ~ - key_held.(#{ directional_methods.join("|") })~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - - key_held.(#{ directional_methods.join("|") }) -** Processing line: ~ - key_down.(#{ directional_methods.join("|") })~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - - key_down.(#{ directional_methods.join("|") }) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #{klass} does not respond to all of these methods (here is the diagnostics):~ +** Processing line: ~ def renderObjects~ - Inside source: true *** True Line Result - #{klass} does not respond to all of these methods (here is the diagnostics): -** Processing line: ~ #{method_results.map {|m, r| "- #{m}: #{r}"}.join("\n")}~ + def renderObjects +** Processing line: ~ #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner~ - Inside source: true *** True Line Result - #{method_results.map {|m, r| "- #{m}: #{r}"}.join("\n")} -** Processing line: ~~ + #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner +** Processing line: ~ #to bottom corner.~ - Inside source: true *** True Line Result - -** Processing line: ~ Please implement the methods that returned false inthe list above.~ + #to bottom corner. +** Processing line: ~ a = (state.quantity * state.quantity) - state.quantity~ - Inside source: true *** True Line Result - Please implement the methods that returned false inthe list above. -** Processing line: ~ S~ + a = (state.quantity * state.quantity) - state.quantity +** Processing line: ~ iter = 0~ - Inside source: true *** True Line Result - S -** Processing line: ~ unless method_results.map {|m, result| result}.all?~ + iter = 0 +** Processing line: ~ loop do~ - Inside source: true *** True Line Result - unless method_results.map {|m, result| result}.all? -** Processing line: ~ raise error_message~ + loop do +** Processing line: ~ if state.tileCords[a][2] == true && state.tileCords[a][6] != -1~ - Inside source: true *** True Line Result - raise error_message -** Processing line: ~ end~ + if state.tileCords[a][2] == true && state.tileCords[a][6] != -1 +** Processing line: ~ outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1], +** Processing line: ~ state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2], +** Processing line: ~ state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4],~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns a signal indicating left (`-1`), right (`1`), or neither ('0').~ + state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4], +** Processing line: ~ 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png']~ - Inside source: true *** True Line Result - # Returns a signal indicating left (`-1`), right (`1`), or neither ('0'). -** Processing line: ~ #~ + 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png'] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Integer]~ + end +** Processing line: ~ iter += 1~ - Inside source: true *** True Line Result - # @return [Integer] -** Processing line: ~ def left_right~ + iter += 1 +** Processing line: ~ a += 1~ - Inside source: true *** True Line Result - def left_right -** Processing line: ~ return -1 if self.left~ + a += 1 +** Processing line: ~ a -= state.quantity * 2 if iter == state.quantity~ - Inside source: true *** True Line Result - return -1 if self.left -** Processing line: ~ return 1 if self.right~ + a -= state.quantity * 2 if iter == state.quantity +** Processing line: ~ iter = 0 if iter == state.quantity~ - Inside source: true *** True Line Result - return 1 if self.right -** Processing line: ~ return 0~ + iter = 0 if iter == state.quantity +** Processing line: ~ break if a < 0~ - Inside source: true *** True Line Result - return 0 + break if a < 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -85609,34 +86084,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns a signal indicating up (`1`), down (`-1`), or neither ('0').~ -- Inside source: true -*** True Line Result - # Returns a signal indicating up (`1`), down (`-1`), or neither ('0'). -** Processing line: ~ #~ +** Processing line: ~ def renderLabels~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Integer]~ + def renderLabels +** Processing line: ~ #Labels~ - Inside source: true *** True Line Result - # @return [Integer] -** Processing line: ~ def up_down~ + #Labels +** Processing line: ~ outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete~ - Inside source: true *** True Line Result - def up_down -** Processing line: ~ return 1 if self.up~ + outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete +** Processing line: ~ outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete~ - Inside source: true *** True Line Result - return 1 if self.up -** Processing line: ~ return -1 if self.down~ + outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete +** Processing line: ~ outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert~ - Inside source: true *** True Line Result - return -1 if self.down -** Processing line: ~ return 0~ + outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert +** Processing line: ~ outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert~ - Inside source: true *** True Line Result - return 0 + outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -85645,410 +86116,394 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns a normal vector (in the form of an Array with two values). If no directionals are held/down, the function returns nil.~ +** Processing line: ~ def calc~ - Inside source: true *** True Line Result - # Returns a normal vector (in the form of an Array with two values). If no directionals are held/down, the function returns nil. -** Processing line: ~ #~ + def calc +** Processing line: ~ calcCurrentHover~ - Inside source: true *** True Line Result - # -** Processing line: ~ # The possible results are:~ + calcCurrentHover +** Processing line: ~ end~ - Inside source: true *** True Line Result - # The possible results are: -** Processing line: ~ #~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # - ~nil~ which denotes that no directional input exists.~ + +** Processing line: ~ def calcCurrentHover~ - Inside source: true *** True Line Result - # - ~nil~ which denotes that no directional input exists. -** Processing line: ~ # - ~[ 0, 1]~ which denotes that only up is being held/pressed.~ + def calcCurrentHover +** Processing line: ~ #This determines what tile the mouse is hovering (or last hovering) over~ - Inside source: true *** True Line Result - # - ~[ 0, 1]~ which denotes that only up is being held/pressed. -** Processing line: ~ # - ~[ 0, -1]~ which denotes that only down is being held/pressed.~ + #This determines what tile the mouse is hovering (or last hovering) over +** Processing line: ~ x = inputs.mouse.position.x~ - Inside source: true *** True Line Result - # - ~[ 0, -1]~ which denotes that only down is being held/pressed. -** Processing line: ~ # - ~[ 0.5, 0.5]~ which denotes that right and up are being pressed/held.~ + x = inputs.mouse.position.x +** Processing line: ~ y = inputs.mouse.position.y~ - Inside source: true *** True Line Result - # - ~[ 0.5, 0.5]~ which denotes that right and up are being pressed/held. -** Processing line: ~ # - ~[-0.5, -0.5]~ which denotes that left and down are being pressed/held.~ + y = inputs.mouse.position.y +** Processing line: ~ m = (state.tileSize[1] / state.tileSize[0]) #slope~ - Inside source: true *** True Line Result - # - ~[-0.5, -0.5]~ which denotes that left and down are being pressed/held. -** Processing line: ~ #~ + m = (state.tileSize[1] / state.tileSize[0]) #slope +** Processing line: ~ state.tileCords.map do~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + state.tileCords.map do +** Processing line: ~ |val|~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def directional_vector~ + |val| +** Processing line: ~ #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision)~ - Inside source: true *** True Line Result - def directional_vector -** Processing line: ~ lr, ud = [self.left_right, self.up_down]~ + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) +** Processing line: ~ next unless val[0] < x && x < val[0] + state.tileSize[0]~ - Inside source: true *** True Line Result - lr, ud = [self.left_right, self.up_down] -** Processing line: ~~ + next unless val[0] < x && x < val[0] + state.tileSize[0] +** Processing line: ~ next unless val[1] < y && y < val[1] + state.tileSize[1]~ - Inside source: true *** True Line Result - -** Processing line: ~ if lr == 0 && ud == 0~ + next unless val[1] < y && y < val[1] + state.tileSize[1] +** Processing line: ~ next unless val[2] == true~ - Inside source: true *** True Line Result - if lr == 0 && ud == 0 -** Processing line: ~ return nil~ + next unless val[2] == true +** Processing line: ~ tempBool = false~ - Inside source: true *** True Line Result - return nil -** Processing line: ~ elsif lr.abs == ud.abs~ + tempBool = false +** Processing line: ~ if x == val[0] + (state.tileSize[0] / 2)~ - Inside source: true *** True Line Result - elsif lr.abs == ud.abs -** Processing line: ~ return [lr.half, ud.half]~ + if x == val[0] + (state.tileSize[0] / 2) +** Processing line: ~ #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond~ - Inside source: true *** True Line Result - return [lr.half, ud.half] -** Processing line: ~ else~ + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond +** Processing line: ~ tempBool = true~ - Inside source: true *** True Line Result - else -** Processing line: ~ return [lr, ud]~ + tempBool = true +** Processing line: ~ elsif x < state.tileSize[0] / 2 + val[0]~ - Inside source: true *** True Line Result - return [lr, ud] -** Processing line: ~ end~ + elsif x < state.tileSize[0] / 2 + val[0] +** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond +** Processing line: ~ tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) +** Processing line: ~ tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ - Inside source: true *** True Line Result - -** Processing line: ~ def method_missing m, *args~ + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) +** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ - Inside source: true *** True Line Result - def method_missing m, *args -** Processing line: ~ # combine the key with ctrl_~ + #Checks to see if the mouse click y value is between those temp y values +** Processing line: ~ tempBool = true if y < tempY1 && y > tempY2~ - Inside source: true *** True Line Result - # combine the key with ctrl_ -** Processing line: ~ if m.to_s.start_with?("ctrl_")~ + tempBool = true if y < tempY1 && y > tempY2 +** Processing line: ~ elsif x > state.tileSize[0] / 2 + val[0]~ - Inside source: true *** True Line Result - if m.to_s.start_with?("ctrl_") -** Processing line: ~ other_key = m.to_s.split("_").last~ + elsif x > state.tileSize[0] / 2 + val[0] +** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond~ - Inside source: true *** True Line Result - other_key = m.to_s.split("_").last -** Processing line: ~ define_singleton_method(m) do~ + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond +** Processing line: ~ tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1]~ - Inside source: true *** True Line Result - define_singleton_method(m) do -** Processing line: ~ return self.key_up.send(other_key.to_sym) && self.key_up.control~ + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] +** Processing line: ~ tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1]~ - Inside source: true *** True Line Result - return self.key_up.send(other_key.to_sym) && self.key_up.control -** Processing line: ~ end~ + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] +** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + #Checks to see if the mouse click y value is between those temp y values +** Processing line: ~ tempBool = true if y > tempY1 && y < tempY2~ - Inside source: true *** True Line Result - -** Processing line: ~ return send(m)~ + tempBool = true if y > tempY1 && y < tempY2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - return send(m) -** Processing line: ~ else~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ # see if the key is either held or down~ + +** Processing line: ~ if tempBool == true~ - Inside source: true *** True Line Result - # see if the key is either held or down -** Processing line: ~ define_singleton_method(m) do~ + if tempBool == true +** Processing line: ~ state.currentSpriteLocation = val[5] #Current sprite location set to the order value~ - Inside source: true *** True Line Result - define_singleton_method(m) do -** Processing line: ~ self.key_down.send(m) || self.key_held.send(m)~ + state.currentSpriteLocation = val[5] #Current sprite location set to the order value +** Processing line: ~ end~ - Inside source: true *** True Line Result - self.key_down.send(m) || self.key_held.send(m) + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ return send(m)~ +** Processing line: ~ def process_inputs~ - Inside source: true *** True Line Result - return send(m) -** Processing line: ~ end~ + def process_inputs +** Processing line: ~ #Makes development much faster and easier~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + #Makes development much faster and easier +** Processing line: ~ if inputs.keyboard.key_up.r~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if inputs.keyboard.key_up.r +** Processing line: ~ $dragon.reset~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + $dragon.reset +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ checkTileSelected~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/geometry.rb~ -- Header detected. + checkTileSelected +** Processing line: ~ switchModes~ +- Inside source: true *** True Line Result - + switchModes +** Processing line: ~ end~ +- Inside source: true *** True Line Result -* ./dragon/geometry.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + end +** Processing line: ~~ +- Inside source: true *** True Line Result +** Processing line: ~ def checkTileSelected~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + def checkTileSelected +** Processing line: ~ if inputs.mouse.down~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + if inputs.mouse.down +** Processing line: ~ x = inputs.mouse.down.point.x~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ -- Inside source: true -*** True Line Result - # MIT License -** Processing line: ~ # geometry.rb has been released under MIT (*only this file*).~ -- Inside source: true -*** True Line Result - # geometry.rb has been released under MIT (*only this file*). -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ module GTK~ -- Inside source: true -*** True Line Result - module GTK -** Processing line: ~ module Geometry~ + x = inputs.mouse.down.point.x +** Processing line: ~ y = inputs.mouse.down.point.y~ - Inside source: true *** True Line Result - module Geometry -** Processing line: ~ # Returns f(t) for a cubic Bezier curve.~ + y = inputs.mouse.down.point.y +** Processing line: ~ m = (state.tileSize[1] / state.tileSize[0]) #slope~ - Inside source: true *** True Line Result - # Returns f(t) for a cubic Bezier curve. -** Processing line: ~ def self.cubic_bezier t, a, b, c, d~ + m = (state.tileSize[1] / state.tileSize[0]) #slope +** Processing line: ~ state.tileCords.map do~ - Inside source: true *** True Line Result - def self.cubic_bezier t, a, b, c, d -** Processing line: ~ s = 1 - t~ + state.tileCords.map do +** Processing line: ~ |val|~ - Inside source: true *** True Line Result - s = 1 - t -** Processing line: ~ s0 = 1~ + |val| +** Processing line: ~ #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision)~ - Inside source: true *** True Line Result - s0 = 1 -** Processing line: ~ s1 = s~ + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) +** Processing line: ~ next unless val[0] < x && x < val[0] + state.tileSize[0]~ - Inside source: true *** True Line Result - s1 = s -** Processing line: ~ s2 = s * s~ + next unless val[0] < x && x < val[0] + state.tileSize[0] +** Processing line: ~ next unless val[1] < y && y < val[1] + state.tileSize[1]~ - Inside source: true *** True Line Result - s2 = s * s -** Processing line: ~ s3 = s * s * s~ + next unless val[1] < y && y < val[1] + state.tileSize[1] +** Processing line: ~ next unless val[2] == true~ - Inside source: true *** True Line Result - s3 = s * s * s -** Processing line: ~~ + next unless val[2] == true +** Processing line: ~ tempBool = false~ - Inside source: true *** True Line Result - -** Processing line: ~ t0 = 1~ + tempBool = false +** Processing line: ~ if x == val[0] + (state.tileSize[0] / 2)~ - Inside source: true *** True Line Result - t0 = 1 -** Processing line: ~ t1 = t~ + if x == val[0] + (state.tileSize[0] / 2) +** Processing line: ~ #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond~ - Inside source: true *** True Line Result - t1 = t -** Processing line: ~ t2 = t * t~ + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond +** Processing line: ~ tempBool = true~ - Inside source: true *** True Line Result - t2 = t * t -** Processing line: ~ t3 = t * t * t~ + tempBool = true +** Processing line: ~ elsif x < state.tileSize[0] / 2 + val[0]~ - Inside source: true *** True Line Result - t3 = t * t * t -** Processing line: ~~ + elsif x < state.tileSize[0] / 2 + val[0] +** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond~ - Inside source: true *** True Line Result - -** Processing line: ~ 1 * s3 * t0 * a +~ + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond +** Processing line: ~ tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ - Inside source: true *** True Line Result - 1 * s3 * t0 * a + -** Processing line: ~ 3 * s2 * t1 * b +~ + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) +** Processing line: ~ tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2)~ - Inside source: true *** True Line Result - 3 * s2 * t1 * b + -** Processing line: ~ 3 * s1 * t2 * c +~ + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) +** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ - Inside source: true *** True Line Result - 3 * s1 * t2 * c + -** Processing line: ~ 1 * s0 * t3 * d~ + #Checks to see if the mouse click y value is between those temp y values +** Processing line: ~ tempBool = true if y < tempY1 && y > tempY2~ - Inside source: true *** True Line Result - 1 * s0 * t3 * d -** Processing line: ~ end~ + tempBool = true if y < tempY1 && y > tempY2 +** Processing line: ~ elsif x > state.tileSize[0] / 2 + val[0]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif x > state.tileSize[0] / 2 + val[0] +** Processing line: ~ #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns true if a primitive's rectangle is entirely inside another primitive's rectangle.~ + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond +** Processing line: ~ tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1]~ - Inside source: true *** True Line Result - # Returns true if a primitive's rectangle is entirely inside another primitive's rectangle. -** Processing line: ~ # @gtk~ + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] +** Processing line: ~ tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1]~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def inside_rect? outer~ + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] +** Processing line: ~ #Checks to see if the mouse click y value is between those temp y values~ - Inside source: true *** True Line Result - def inside_rect? outer -** Processing line: ~ Geometry.inside_rect? self, outer~ + #Checks to see if the mouse click y value is between those temp y values +** Processing line: ~ tempBool = true if y > tempY1 && y < tempY2~ - Inside source: true *** True Line Result - Geometry.inside_rect? self, outer -** Processing line: ~ end~ + tempBool = true if y > tempY1 && y < tempY2 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns true if a primitive's rectangle overlaps another primitive's rectangle.~ +** Processing line: ~ if tempBool == true~ - Inside source: true *** True Line Result - # Returns true if a primitive's rectangle overlaps another primitive's rectangle. -** Processing line: ~ # @gtk~ + if tempBool == true +** Processing line: ~ if state.mode == :delete~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def intersect_rect? other, tolerance = 0.1~ + if state.mode == :delete +** Processing line: ~ val[2] = false~ - Inside source: true *** True Line Result - def intersect_rect? other, tolerance = 0.1 -** Processing line: ~ Geometry.intersect_rect? self, other, tolerance~ + val[2] = false +** Processing line: ~ state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency~ - Inside source: true *** True Line Result - Geometry.intersect_rect? self, other, tolerance -** Processing line: ~ end~ + state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency +** Processing line: ~ state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered +** Processing line: ~ unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered~ - Inside source: true *** True Line Result - -** Processing line: ~ def intersects_rect? *args~ + unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered +** Processing line: ~ state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing~ - Inside source: true *** True Line Result - def intersects_rect? *args -** Processing line: ~ Geometry.intersects_rect?(*args)~ + state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing +** Processing line: ~ state.tileCords[val[5] - 1][4] = true~ - Inside source: true *** True Line Result - Geometry.intersects_rect?(*args) -** Processing line: ~ end~ + state.tileCords[val[5] - 1][4] = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + end +** Processing line: ~ unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side~ - Inside source: true *** True Line Result - -** Processing line: ~ def scale_rect_extended percentage_x: percentage_x,~ + unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side +** Processing line: ~ state.tileGrid[val[5] + state.quantity][3] = true~ - Inside source: true *** True Line Result - def scale_rect_extended percentage_x: percentage_x, -** Processing line: ~ percentage_y: percentage_y,~ + state.tileGrid[val[5] + state.quantity][3] = true +** Processing line: ~ state.tileCords[val[5] + state.quantity][3] = true~ - Inside source: true *** True Line Result - percentage_y: percentage_y, -** Processing line: ~ anchor_x: anchor_x,~ + state.tileCords[val[5] + state.quantity][3] = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_x: anchor_x, -** Processing line: ~ anchor_y: anchor_y~ + end +** Processing line: ~ elsif state.mode == :insert~ - Inside source: true *** True Line Result - anchor_y: anchor_y -** Processing line: ~~ + elsif state.mode == :insert +** Processing line: ~ #adds the current sprite value selected to tileCords. (changes from the -1 earlier)~ - Inside source: true *** True Line Result - -** Processing line: ~ Geometry.scale_rect_extended self,~ + #adds the current sprite value selected to tileCords. (changes from the -1 earlier) +** Processing line: ~ val[6] = rand(state.spriteSelection.length)~ - Inside source: true *** True Line Result - Geometry.scale_rect_extended self, -** Processing line: ~ percentage_x: percentage_x,~ + val[6] = rand(state.spriteSelection.length) +** Processing line: ~ end~ - Inside source: true *** True Line Result - percentage_x: percentage_x, -** Processing line: ~ percentage_y: percentage_y,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - percentage_y: percentage_y, -** Processing line: ~ anchor_x: anchor_x,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_x: anchor_x, -** Processing line: ~ anchor_y: anchor_y~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_y: anchor_y + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -86057,46 +86512,42 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Scales a primitive rect by a percentage.~ -- Inside source: true -*** True Line Result - # Scales a primitive rect by a percentage. -** Processing line: ~ # @gtk~ +** Processing line: ~ def switchModes~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def scale_rect percentage, *anchors~ + def switchModes +** Processing line: ~ #Switches between insert and delete modes~ - Inside source: true *** True Line Result - def scale_rect percentage, *anchors -** Processing line: ~ Geometry.scale_rect self, percentage, *anchors~ + #Switches between insert and delete modes +** Processing line: ~ if inputs.keyboard.key_up.i && state.mode == :delete~ - Inside source: true *** True Line Result - Geometry.scale_rect self, percentage, *anchors -** Processing line: ~ end~ + if inputs.keyboard.key_up.i && state.mode == :delete +** Processing line: ~ state.mode = :insert~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + state.mode = :insert +** Processing line: ~ inputs.keyboard.clear~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns the angle from one primitive to another primitive.~ + inputs.keyboard.clear +** Processing line: ~ elsif inputs.keyboard.key_up.d && state.mode == :insert~ - Inside source: true *** True Line Result - # Returns the angle from one primitive to another primitive. -** Processing line: ~ # @gtk~ + elsif inputs.keyboard.key_up.d && state.mode == :insert +** Processing line: ~ state.mode = :delete~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def angle_to other_point~ + state.mode = :delete +** Processing line: ~ inputs.keyboard.clear~ - Inside source: true *** True Line Result - def angle_to other_point -** Processing line: ~ Geometry.angle_to self, other_point~ + inputs.keyboard.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - Geometry.angle_to self, other_point + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -86105,810 +86556,802 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns the angle to one primitive from another primitive.~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Returns the angle to one primitive from another primitive. -** Processing line: ~ # @gtk~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def angle_from other_point~ + +** Processing line: ~ $isometric = Isometric.new~ - Inside source: true *** True Line Result - def angle_from other_point -** Processing line: ~ Geometry.angle_from self, other_point~ + $isometric = Isometric.new +** Processing line: ~~ - Inside source: true *** True Line Result - Geometry.angle_from self, other_point -** Processing line: ~ end~ + +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def tick args +** Processing line: ~ $isometric.grid = args.grid~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns true if a primitive is within a circle specified by the circle's center and radius.~ + $isometric.grid = args.grid +** Processing line: ~ $isometric.inputs = args.inputs~ - Inside source: true *** True Line Result - # Returns true if a primitive is within a circle specified by the circle's center and radius. -** Processing line: ~ # @gtk~ + $isometric.inputs = args.inputs +** Processing line: ~ $isometric.state = args.state~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def point_inside_circle? circle_center_point, radius~ + $isometric.state = args.state +** Processing line: ~ $isometric.outputs = args.outputs~ - Inside source: true *** True Line Result - def point_inside_circle? circle_center_point, radius -** Processing line: ~ Geometry.point_inside_circle? self, circle_center_point, radius~ + $isometric.outputs = args.outputs +** Processing line: ~ $isometric.tick~ - Inside source: true *** True Line Result - Geometry.point_inside_circle? self, circle_center_point, radius -** Processing line: ~ end~ + $isometric.tick +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def center_inside_rect other_rect~ -- Inside source: true +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - def center_inside_rect other_rect -** Processing line: ~ offset_x = (other_rect.w - w).half~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - offset_x = (other_rect.w - w).half -** Processing line: ~ offset_y = (other_rect.h - h).half~ -- Inside source: true + +** Processing line: ~* Rpg Topdown - Topdown Starting Point - main.rb~ +- Header detected. *** True Line Result - offset_y = (other_rect.h - h).half -** Processing line: ~ new_rect = self.shift_rect(0, 0)~ -- Inside source: true + *** True Line Result - new_rect = self.shift_rect(0, 0) -** Processing line: ~ new_rect.x = other_rect.x + offset_x~ -- Inside source: true +* Rpg Topdown - Topdown Starting Point - main.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - new_rect.x = other_rect.x + offset_x -** Processing line: ~ new_rect.y = other_rect.y + offset_y~ -- Inside source: true + *** True Line Result - new_rect.y = other_rect.y + offset_y -** Processing line: ~ new_rect~ +#+begin_src ruby +** Processing line: ~ # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb~ - Inside source: true *** True Line Result - new_rect -** Processing line: ~ rescue Exception => e~ + # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, <<-S~ + =begin +** Processing line: ~~ - Inside source: true *** True Line Result - raise e, <<-S -** Processing line: ~ * ERROR:~ + +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ + APIs listing that haven't been encountered in previous sample apps: +** Processing line: ~~ - Inside source: true *** True Line Result - center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. -** Processing line: ~ S~ + +** Processing line: ~ - reverse: Returns a new string with the characters from original string in reverse order.~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + - reverse: Returns a new string with the characters from original string in reverse order. +** Processing line: ~ For example, the command~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + For example, the command +** Processing line: ~ "dragonruby".reverse~ - Inside source: true *** True Line Result - -** Processing line: ~ def center_inside_rect_y other_rect~ + "dragonruby".reverse +** Processing line: ~ would return the string~ - Inside source: true *** True Line Result - def center_inside_rect_y other_rect -** Processing line: ~ offset_y = (other_rect.h - h).half~ + would return the string +** Processing line: ~ "yburnogard".~ - Inside source: true *** True Line Result - offset_y = (other_rect.h - h).half -** Processing line: ~ new_rect = self.shift_rect(0, 0)~ + "yburnogard". +** Processing line: ~ Reverse is not only limited to strings, but can be applied to arrays and other collections.~ - Inside source: true *** True Line Result - new_rect = self.shift_rect(0, 0) -** Processing line: ~ new_rect.y = other_rect.y + offset_y~ + Reverse is not only limited to strings, but can be applied to arrays and other collections. +** Processing line: ~~ - Inside source: true *** True Line Result - new_rect.y = other_rect.y + offset_y -** Processing line: ~ new_rect~ + +** Processing line: ~ Reminders:~ - Inside source: true *** True Line Result - new_rect -** Processing line: ~ rescue Exception => e~ + Reminders: +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, <<-S~ + +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ - Inside source: true *** True Line Result - raise e, <<-S -** Processing line: ~ * ERROR:~ + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. +** Processing line: ~~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ + +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ - Inside source: true *** True Line Result - center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. -** Processing line: ~ S~ + - args.outputs.labels: An array. The values generate a label. +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ - Inside source: true *** True Line Result - end + For more information about labels, go to mygame/documentation/02-labels.md. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def center_inside_rect_x other_rect~ +** Processing line: ~ =end~ - Inside source: true *** True Line Result - def center_inside_rect_x other_rect -** Processing line: ~ offset_x = (other_rect.w - w).half~ + =end +** Processing line: ~~ - Inside source: true *** True Line Result - offset_x = (other_rect.w - w).half -** Processing line: ~ new_rect = self.shift_rect(0, 0)~ + +** Processing line: ~ # This code shows a maze and uses input from the keyboard to move the user around the screen.~ - Inside source: true *** True Line Result - new_rect = self.shift_rect(0, 0) -** Processing line: ~ new_rect.x = other_rect.x + offset_x~ + # This code shows a maze and uses input from the keyboard to move the user around the screen. +** Processing line: ~ # The objective is to reach the goal.~ - Inside source: true *** True Line Result - new_rect.x = other_rect.x + offset_x -** Processing line: ~ new_rect~ + # The objective is to reach the goal. +** Processing line: ~~ - Inside source: true *** True Line Result - new_rect -** Processing line: ~ rescue Exception => e~ + +** Processing line: ~ # Sets values of tile size and player's movement speed~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, <<-S~ + # Sets values of tile size and player's movement speed +** Processing line: ~ # Also creates tile or box for player and generates map~ - Inside source: true *** True Line Result - raise e, <<-S -** Processing line: ~ * ERROR:~ + # Also creates tile or box for player and generates map +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ + def tick args +** Processing line: ~ args.state.tile_size = 80~ - Inside source: true *** True Line Result - center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. -** Processing line: ~ S~ + args.state.tile_size = 80 +** Processing line: ~ args.state.player_speed = 4~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + args.state.player_speed = 4 +** Processing line: ~ args.state.player ||= tile(args, 7, 3, 0, 128, 180)~ - Inside source: true *** True Line Result - end + args.state.player ||= tile(args, 7, 3, 0, 128, 180) +** Processing line: ~ generate_map args~ +- Inside source: true +*** True Line Result + generate_map args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its retangle.~ +** Processing line: ~ # Adds walls, goal, and player to args.outputs.solids so they appear on screen~ - Inside source: true *** True Line Result - # Returns a primitive that is anchored/repositioned based off its retangle. -** Processing line: ~ # @gtk~ + # Adds walls, goal, and player to args.outputs.solids so they appear on screen +** Processing line: ~ args.outputs.solids << args.state.walls~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def anchor_rect anchor_x, anchor_y~ + args.outputs.solids << args.state.walls +** Processing line: ~ args.outputs.solids << args.state.goal~ - Inside source: true *** True Line Result - def anchor_rect anchor_x, anchor_y -** Processing line: ~ current_w = self.w~ + args.outputs.solids << args.state.goal +** Processing line: ~ args.outputs.solids << args.state.player~ - Inside source: true *** True Line Result - current_w = self.w -** Processing line: ~ current_h = self.h~ + args.outputs.solids << args.state.player +** Processing line: ~~ - Inside source: true *** True Line Result - current_h = self.h -** Processing line: ~ delta_x = -1 * (anchor_x * current_w)~ + +** Processing line: ~ # If player's box intersects with goal, a label is output onto the screen~ - Inside source: true *** True Line Result - delta_x = -1 * (anchor_x * current_w) -** Processing line: ~ delta_y = -1 * (anchor_y * current_h)~ + # If player's box intersects with goal, a label is output onto the screen +** Processing line: ~ if args.state.player.intersect_rect? args.state.goal~ - Inside source: true *** True Line Result - delta_y = -1 * (anchor_y * current_h) -** Processing line: ~ self.shift_rect(delta_x, delta_y)~ + if args.state.player.intersect_rect? args.state.goal +** Processing line: ~ args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen~ - Inside source: true *** True Line Result - self.shift_rect(delta_x, delta_y) -** Processing line: ~ end~ + args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def angle_given_point other_point~ +** Processing line: ~ move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed~ - Inside source: true *** True Line Result - def angle_given_point other_point -** Processing line: ~ raise ":angle_given_point has been deprecated use :angle_from instead."~ + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed +** Processing line: ~ move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed~ - Inside source: true *** True Line Result - raise ":angle_given_point has been deprecated use :angle_from instead." -** Processing line: ~ end~ + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed +** Processing line: ~ move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed +** Processing line: ~ move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.shift_line line, x, y~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def self.shift_line line, x, y -** Processing line: ~ if line.is_a?(Array) || line.is_a?(Hash)~ + +** Processing line: ~ # Sets position, size, and color of the tile~ - Inside source: true *** True Line Result - if line.is_a?(Array) || line.is_a?(Hash) -** Processing line: ~ new_line = line.dup~ + # Sets position, size, and color of the tile +** Processing line: ~ def tile args, x, y, *color~ - Inside source: true *** True Line Result - new_line = line.dup -** Processing line: ~ new_line.x += x~ + def tile args, x, y, *color +** Processing line: ~ [x * args.state.tile_size, # sets definition for array using method parameters~ - Inside source: true *** True Line Result - new_line.x += x -** Processing line: ~ new_line.x2 += x~ + [x * args.state.tile_size, # sets definition for array using method parameters +** Processing line: ~ y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values~ - Inside source: true *** True Line Result - new_line.x2 += x -** Processing line: ~ new_line.y += y~ + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values +** Processing line: ~ args.state.tile_size,~ - Inside source: true *** True Line Result - new_line.y += y -** Processing line: ~ new_line.y2 += y~ + args.state.tile_size, +** Processing line: ~ args.state.tile_size,~ - Inside source: true *** True Line Result - new_line.y2 += y -** Processing line: ~ new_line~ + args.state.tile_size, +** Processing line: ~ *color]~ - Inside source: true *** True Line Result - new_line -** Processing line: ~ else~ + *color] +** Processing line: ~ end~ - Inside source: true *** True Line Result - else -** Processing line: ~ raise "shift_line for #{line} is not supported."~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - raise "shift_line for #{line} is not supported." -** Processing line: ~ end~ + +** Processing line: ~ # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) +** Processing line: ~ def generate_map args~ - Inside source: true *** True Line Result - end + def generate_map args +** Processing line: ~ return if args.state.area~ +- Inside source: true +*** True Line Result + return if args.state.area ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.intersects_rect? *args~ +** Processing line: ~ # Creates the area of the map. There are 9 rows running horizontally across the screen~ - Inside source: true *** True Line Result - def self.intersects_rect? *args -** Processing line: ~ raise <<-S~ + # Creates the area of the map. There are 9 rows running horizontally across the screen +** Processing line: ~ # and 16 columns running vertically on the screen. Any spot with a "1" is not~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ intersects_rect? (with an \"s\") has been deprecated.~ + # and 16 columns running vertically on the screen. Any spot with a "1" is not +** Processing line: ~ # open for the player to move into (and is green), and any spot with a "0" is available~ - Inside source: true *** True Line Result - intersects_rect? (with an \"s\") has been deprecated. -** Processing line: ~ Use intersect_rect? instead (remove the \"s\").~ + # open for the player to move into (and is green), and any spot with a "0" is available +** Processing line: ~ # for the player to move in.~ - Inside source: true *** True Line Result - Use intersect_rect? instead (remove the \"s\"). -** Processing line: ~~ + # for the player to move in. +** Processing line: ~ args.state.area = [~ - Inside source: true *** True Line Result - -** Processing line: ~ * NOTE:~ + args.state.area = [ +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ - Inside source: true *** True Line Result - * NOTE: -** Processing line: ~ Ruby's naming convention is to *never* include the \"s\" for~ + [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal~ - Inside source: true *** True Line Result - Ruby's naming convention is to *never* include the \"s\" for -** Processing line: ~ interrogative method names (methods that end with a ?). It~ + [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal +** Processing line: ~ [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ - Inside source: true *** True Line Result - interrogative method names (methods that end with a ?). It -** Processing line: ~ doesn't sound grammatically correct, but that has been the~ + [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,],~ - Inside source: true *** True Line Result - doesn't sound grammatically correct, but that has been the -** Processing line: ~ rule for a long time (and why intersects_rect? has been deprecated).~ + [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],~ - Inside source: true *** True Line Result - rule for a long time (and why intersects_rect? has been deprecated). -** Processing line: ~~ + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,],~ - Inside source: true *** True Line Result - -** Processing line: ~ S~ + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], +** Processing line: ~ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,],~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], +** Processing line: ~ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], +** Processing line: ~ ].reverse # reverses the order of the area collection~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.line_y_intercept line~ + ].reverse # reverses the order of the area collection +** Processing line: ~~ - Inside source: true *** True Line Result - def self.line_y_intercept line -** Processing line: ~ line.y - line_slope(line) * line.x~ + +** Processing line: ~ # By reversing the order, the way that the area appears above is how it appears~ - Inside source: true *** True Line Result - line.y - line_slope(line) * line.x -** Processing line: ~ end~ + # By reversing the order, the way that the area appears above is how it appears +** Processing line: ~ # on the screen in the game. If we did not reverse, the map would appear inverted.~ - Inside source: true *** True Line Result - end + # on the screen in the game. If we did not reverse, the map would appear inverted. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ def self.angle_between_lines line_one, line_two, replace_infinity: nil~ +** Processing line: ~ #The wall starts off with no tiles.~ - Inside source: true *** True Line Result - def self.angle_between_lines line_one, line_two, replace_infinity: nil -** Processing line: ~ m_line_one = line_slope line_one, replace_infinity: replace_infinity~ + #The wall starts off with no tiles. +** Processing line: ~ args.state.walls = []~ - Inside source: true *** True Line Result - m_line_one = line_slope line_one, replace_infinity: replace_infinity -** Processing line: ~ m_line_two = line_slope line_two, replace_infinity: replace_infinity~ + args.state.walls = [] +** Processing line: ~~ - Inside source: true *** True Line Result - m_line_two = line_slope line_two, replace_infinity: replace_infinity -** Processing line: ~ Math.atan((m_line_one - m_line_two) / (1 + m_line_two * m_line_one)).to_degrees~ + +** Processing line: ~ # If v is 1, a green tile is added to args.state.walls.~ - Inside source: true *** True Line Result - Math.atan((m_line_one - m_line_two) / (1 + m_line_two * m_line_one)).to_degrees -** Processing line: ~ end~ + # If v is 1, a green tile is added to args.state.walls. +** Processing line: ~ # If v is 2, a black tile is created as the goal.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # If v is 2, a black tile is created as the goal. +** Processing line: ~ args.state.area.map_2d do |y, x, v|~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + args.state.area.map_2d do |y, x, v| +** Processing line: ~ if v == 1~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.line_slope line, replace_infinity: nil~ + if v == 1 +** Processing line: ~ args.state.walls << tile(args, x, y, 0, 255, 0) # green tile~ - Inside source: true *** True Line Result - def self.line_slope line, replace_infinity: nil -** Processing line: ~ (line.y2 - line.y).fdiv(line.x2 - line.x)~ + args.state.walls << tile(args, x, y, 0, 255, 0) # green tile +** Processing line: ~ elsif v == 2 # notice there is only one "2" above because there is only one single goal~ - Inside source: true *** True Line Result - (line.y2 - line.y).fdiv(line.x2 - line.x) -** Processing line: ~ .replace_infinity(replace_infinity)~ + elsif v == 2 # notice there is only one "2" above because there is only one single goal +** Processing line: ~ args.state.goal = tile(args, x, y, 0, 0, 0) # black tile~ - Inside source: true *** True Line Result - .replace_infinity(replace_infinity) + args.state.goal = tile(args, x, y, 0, 0, 0) # black tile ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ def self.ray_test point, line~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - def self.ray_test point, line -** Processing line: ~ slope = (line.y2 - line.y).fdiv(line.x2 - line.x)~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - slope = (line.y2 - line.y).fdiv(line.x2 - line.x) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if line.x > line.x2~ +** Processing line: ~ # Allows the player to move their box around the screen~ - Inside source: true *** True Line Result - if line.x > line.x2 -** Processing line: ~ point_two, point_one = [point_one, point_two]~ + # Allows the player to move their box around the screen +** Processing line: ~ def move_player args, *vector~ - Inside source: true *** True Line Result - point_two, point_one = [point_one, point_two] -** Processing line: ~ end~ + def move_player args, *vector +** Processing line: ~ box = args.state.player.shift_rect(vector) # box is able to move at an angle~ - Inside source: true *** True Line Result - end + box = args.state.player.shift_rect(vector) # box is able to move at an angle ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ r = ((line.x2 - line.x) * (point.y - line.y) -~ +** Processing line: ~ # If the player's box hits a wall, it is not able to move further in that direction~ - Inside source: true *** True Line Result - r = ((line.x2 - line.x) * (point.y - line.y) - -** Processing line: ~ (point.x - line.x) * (line.y2 - line.y))~ + # If the player's box hits a wall, it is not able to move further in that direction +** Processing line: ~ return if args.state.walls~ - Inside source: true *** True Line Result - (point.x - line.x) * (line.y2 - line.y)) + return if args.state.walls +** Processing line: ~ .any_intersect_rect?(box)~ +- Inside source: true +*** True Line Result + .any_intersect_rect?(box) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if r == 0~ +** Processing line: ~ # Player's box is able to move at angles (not just the four general directions) fast~ - Inside source: true *** True Line Result - if r == 0 -** Processing line: ~ return :on~ + # Player's box is able to move at angles (not just the four general directions) fast +** Processing line: ~ args.state.player =~ - Inside source: true *** True Line Result - return :on -** Processing line: ~ elsif r < 0~ + args.state.player = +** Processing line: ~ args.state.player~ - Inside source: true *** True Line Result - elsif r < 0 -** Processing line: ~ return :right if slope >= 0~ + args.state.player +** Processing line: ~ .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then~ - Inside source: true *** True Line Result - return :right if slope >= 0 -** Processing line: ~ return :left~ + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then +** Processing line: ~ vector.y * args.state.player_speed) # the box will move extremely slow~ - Inside source: true *** True Line Result - return :left -** Processing line: ~ elsif r > 0~ + vector.y * args.state.player_speed) # the box will move extremely slow +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif r > 0 -** Processing line: ~ return :left if slope >= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return :left if slope >= 0 -** Processing line: ~ return :right~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - return :right -** Processing line: ~ end~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - end -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~* args.rb~ +- Header detected. *** True Line Result - end -** Processing line: ~~ -- Inside source: true + +*** True Line Result +* args.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result -** Processing line: ~ # @gtk~ +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/args.rb~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.line_rect line~ + # ./dragon/args.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - def self.line_rect line -** Processing line: ~ if line.x > line.x2~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - if line.x > line.x2 -** Processing line: ~ x = line.x2~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - x = line.x2 -** Processing line: ~ y = line.y2~ + # MIT License +** Processing line: ~ # args.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - y = line.y2 -** Processing line: ~ x2 = line.x~ + # args.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - x2 = line.x -** Processing line: ~ y2 = line.y~ + +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - y2 = line.y -** Processing line: ~ else~ + module GTK +** Processing line: ~ # This class is the one you'll interact with the most. It's~ - Inside source: true *** True Line Result - else -** Processing line: ~ x = line.x~ + # This class is the one you'll interact with the most. It's +** Processing line: ~ # constructed by the DragonRuby Runtime and is provided to you on~ - Inside source: true *** True Line Result - x = line.x -** Processing line: ~ y = line.y~ + # constructed by the DragonRuby Runtime and is provided to you on +** Processing line: ~ # each tick.~ - Inside source: true *** True Line Result - y = line.y -** Processing line: ~ x2 = line.x2~ + # each tick. +** Processing line: ~ class Args~ - Inside source: true *** True Line Result - x2 = line.x2 -** Processing line: ~ y2 = line.y2~ + class Args +** Processing line: ~ include ArgsDeprecated~ - Inside source: true *** True Line Result - y2 = line.y2 -** Processing line: ~ end~ + include ArgsDeprecated +** Processing line: ~ include Serialize~ - Inside source: true *** True Line Result - end + include Serialize ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ w = x2 - x~ -- Inside source: true -*** True Line Result - w = x2 - x -** Processing line: ~ h = y2 - y~ +** Processing line: ~ # Contains information related to input devices and input events.~ - Inside source: true *** True Line Result - h = y2 - y -** Processing line: ~~ + # Contains information related to input devices and input events. +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ { x: x, y: y, w: w, h: h }~ + # +** Processing line: ~ # @return [Inputs]~ - Inside source: true *** True Line Result - { x: x, y: y, w: w, h: h } -** Processing line: ~ end~ + # @return [Inputs] +** Processing line: ~ attr_accessor :inputs~ - Inside source: true *** True Line Result - end + attr_accessor :inputs ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ def self.line_intersect line_one, line_two~ +** Processing line: ~ # Contains the means to interact with output devices such as the screen.~ - Inside source: true *** True Line Result - def self.line_intersect line_one, line_two -** Processing line: ~ m1 = line_slope(line_one)~ + # Contains the means to interact with output devices such as the screen. +** Processing line: ~ #~ - Inside source: true *** True Line Result - m1 = line_slope(line_one) -** Processing line: ~ m2 = line_slope(line_two)~ + # +** Processing line: ~ # @return [Outputs]~ - Inside source: true *** True Line Result - m2 = line_slope(line_two) -** Processing line: ~ b1 = line_y_intercept(line_one)~ + # @return [Outputs] +** Processing line: ~ attr_accessor :outputs~ - Inside source: true *** True Line Result - b1 = line_y_intercept(line_one) -** Processing line: ~ b2 = line_y_intercept(line_two)~ + attr_accessor :outputs +** Processing line: ~~ - Inside source: true *** True Line Result - b2 = line_y_intercept(line_two) -** Processing line: ~ x = (b1 - b2) / (m2 - m1)~ + +** Processing line: ~ # Contains display size information to assist in positioning things on the screen.~ - Inside source: true *** True Line Result - x = (b1 - b2) / (m2 - m1) -** Processing line: ~ y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2))~ + # Contains display size information to assist in positioning things on the screen. +** Processing line: ~ #~ - Inside source: true *** True Line Result - y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2)) -** Processing line: ~ [x, y]~ + # +** Processing line: ~ # @return [Grid]~ - Inside source: true *** True Line Result - [x, y] -** Processing line: ~ end~ + # @return [Grid] +** Processing line: ~ attr_accessor :grid~ - Inside source: true *** True Line Result - end + attr_accessor :grid ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.contract_intersect_rect?~ +** Processing line: ~ # Provides access to game play recording facilities within Game Toolkit.~ - Inside source: true *** True Line Result - def self.contract_intersect_rect? -** Processing line: ~ [:left, :right, :top, :bottom]~ + # Provides access to game play recording facilities within Game Toolkit. +** Processing line: ~ #~ - Inside source: true *** True Line Result - [:left, :right, :top, :bottom] -** Processing line: ~ end~ + # +** Processing line: ~ # @return [Recording]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # @return [Recording] +** Processing line: ~ attr_accessor :recording~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + attr_accessor :recording +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.intersect_rect? rect_one, rect_two, tolerance = 0.1~ + +** Processing line: ~ # Gives you access to geometry related functions.~ - Inside source: true *** True Line Result - def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 -** Processing line: ~ return false if rect_one.right - tolerance < rect_two.left + tolerance~ + # Gives you access to geometry related functions. +** Processing line: ~ #~ - Inside source: true *** True Line Result - return false if rect_one.right - tolerance < rect_two.left + tolerance -** Processing line: ~ return false if rect_one.left + tolerance > rect_two.right - tolerance~ + # +** Processing line: ~ # @return [Geometry]~ - Inside source: true *** True Line Result - return false if rect_one.left + tolerance > rect_two.right - tolerance -** Processing line: ~ return false if rect_one.top - tolerance < rect_two.bottom + tolerance~ + # @return [Geometry] +** Processing line: ~ attr_accessor :geometry~ - Inside source: true *** True Line Result - return false if rect_one.top - tolerance < rect_two.bottom + tolerance -** Processing line: ~ return false if rect_one.bottom + tolerance > rect_two.top - tolerance~ + attr_accessor :geometry +** Processing line: ~~ - Inside source: true *** True Line Result - return false if rect_one.bottom + tolerance > rect_two.top - tolerance -** Processing line: ~ return true~ + +** Processing line: ~ # This is where you'll put state associated with your video game.~ - Inside source: true *** True Line Result - return true -** Processing line: ~ rescue Exception => e~ + # This is where you'll put state associated with your video game. +** Processing line: ~ #~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ context_help_rect_one = (rect_one.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods]~ + # +** Processing line: ~ # @return [OpenEntity]~ - Inside source: true *** True Line Result - context_help_rect_one = (rect_one.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] -** Processing line: ~ context_help_rect_two = (rect_two.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods]~ + # @return [OpenEntity] +** Processing line: ~ attr_accessor :state~ - Inside source: true *** True Line Result - context_help_rect_two = (rect_two.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] -** Processing line: ~ context_help = ""~ + attr_accessor :state +** Processing line: ~~ - Inside source: true *** True Line Result - context_help = "" -** Processing line: ~ if context_help_rect_one && context_help_rect_one.length > 0~ + +** Processing line: ~ # Gives you access to the top level DragonRuby runtime.~ - Inside source: true *** True Line Result - if context_help_rect_one && context_help_rect_one.length > 0 -** Processing line: ~ context_help += <<-S~ + # Gives you access to the top level DragonRuby runtime. +** Processing line: ~ #~ - Inside source: true *** True Line Result - context_help += <<-S -** Processing line: ~ rect_one needs to implement the following methods: #{context_help_rect_one}~ + # +** Processing line: ~ # @return [Runtime]~ - Inside source: true *** True Line Result - rect_one needs to implement the following methods: #{context_help_rect_one} -** Processing line: ~~ + # @return [Runtime] +** Processing line: ~ attr_accessor :runtime~ - Inside source: true *** True Line Result - -** Processing line: ~ You may want to try include the ~AttrRect~ module which will give you these methods.~ + attr_accessor :runtime +** Processing line: ~ alias_method :gtk, :runtime~ - Inside source: true *** True Line Result - You may want to try include the ~AttrRect~ module which will give you these methods. -** Processing line: ~ S~ + alias_method :gtk, :runtime +** Processing line: ~~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + +** Processing line: ~ attr_accessor :passes~ - Inside source: true *** True Line Result - end + attr_accessor :passes ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if context_help_rect_two && context_help_rect_two.length > 0~ +** Processing line: ~ attr_accessor :wizards~ - Inside source: true *** True Line Result - if context_help_rect_two && context_help_rect_two.length > 0 -** Processing line: ~ context_help += <<-S~ + attr_accessor :wizards +** Processing line: ~~ - Inside source: true *** True Line Result - context_help += <<-S -** Processing line: ~ * FAILURE REASON:~ + +** Processing line: ~ def initialize runtime, recording~ - Inside source: true *** True Line Result - * FAILURE REASON: -** Processing line: ~ rect_two needs to implement the following methods: #{context_help_rect_two}~ + def initialize runtime, recording +** Processing line: ~ @inputs = Inputs.new~ - Inside source: true *** True Line Result - rect_two needs to implement the following methods: #{context_help_rect_two} -** Processing line: ~ NOTE: You may want to try include the ~GTK::Geometry~ module which will give you these methods.~ + @inputs = Inputs.new +** Processing line: ~ @outputs = Outputs.new args: self~ - Inside source: true *** True Line Result - NOTE: You may want to try include the ~GTK::Geometry~ module which will give you these methods. -** Processing line: ~ S~ + @outputs = Outputs.new args: self +** Processing line: ~ @passes = []~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + @passes = [] +** Processing line: ~ @state = OpenEntity.new~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @state = OpenEntity.new +** Processing line: ~ @state.tick_count = -1~ - Inside source: true *** True Line Result - -** Processing line: ~ raise e, <<-S~ + @state.tick_count = -1 +** Processing line: ~ @runtime = runtime~ - Inside source: true *** True Line Result - raise e, <<-S -** Processing line: ~ * ERROR:~ + @runtime = runtime +** Processing line: ~ @recording = recording~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ :intersect_rect? failed for~ + @recording = recording +** Processing line: ~ @grid = Grid.new runtime~ - Inside source: true *** True Line Result - :intersect_rect? failed for -** Processing line: ~ - rect_one: #{rect_one}~ + @grid = Grid.new runtime +** Processing line: ~ @render_targets = {}~ - Inside source: true *** True Line Result - - rect_one: #{rect_one} -** Processing line: ~ - rect_two: #{rect_two}~ + @render_targets = {} +** Processing line: ~ @all_tests = []~ - Inside source: true *** True Line Result - - rect_two: #{rect_two} -** Processing line: ~ #{context_help}~ + @all_tests = [] +** Processing line: ~ @geometry = GTK::Geometry~ - Inside source: true *** True Line Result - #{context_help} -** Processing line: ~ S~ + @geometry = GTK::Geometry +** Processing line: ~ @wizards = Wizards.new~ - Inside source: true *** True Line Result - S + @wizards = Wizards.new ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -86917,38 +87360,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.to_square size, x, y, anchor_x = 0.5, anchor_y = nil~ + +** Processing line: ~ # The number of ticks since the start of the game.~ - Inside source: true *** True Line Result - def self.to_square size, x, y, anchor_x = 0.5, anchor_y = nil -** Processing line: ~ anchor_y ||= anchor_x~ + # The number of ticks since the start of the game. +** Processing line: ~ #~ - Inside source: true *** True Line Result - anchor_y ||= anchor_x -** Processing line: ~ x = x.shift_left(size * anchor_x)~ + # +** Processing line: ~ # @return [Integer]~ - Inside source: true *** True Line Result - x = x.shift_left(size * anchor_x) -** Processing line: ~ y = y.shift_down(size * anchor_y)~ + # @return [Integer] +** Processing line: ~ def tick_count~ - Inside source: true *** True Line Result - y = y.shift_down(size * anchor_y) -** Processing line: ~ [x, y, size, size]~ + def tick_count +** Processing line: ~ @state.tick_count~ - Inside source: true *** True Line Result - [x, y, size, size] -** Processing line: ~ rescue Exception => e~ + @state.tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}."~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}." + +** Processing line: ~ def tick_count= value~ +- Inside source: true +*** True Line Result + def tick_count= value +** Processing line: ~ @state.tick_count = value~ +- Inside source: true +*** True Line Result + @state.tick_count = value ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -86957,26 +87408,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def serialize~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.distance point_one, point_two~ + def serialize +** Processing line: ~ {~ - Inside source: true *** True Line Result - def self.distance point_one, point_two -** Processing line: ~ Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2)~ + { +** Processing line: ~ state: state.as_hash,~ - Inside source: true *** True Line Result - Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2) -** Processing line: ~ rescue Exception => e~ + state: state.as_hash, +** Processing line: ~ inputs: inputs.serialize,~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}."~ + inputs: inputs.serialize, +** Processing line: ~ passes: passes.serialize,~ - Inside source: true *** True Line Result - raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}." + passes: passes.serialize, +** Processing line: ~ outputs: outputs.serialize,~ +- Inside source: true +*** True Line Result + outputs: outputs.serialize, +** Processing line: ~ grid: grid.serialize~ +- Inside source: true +*** True Line Result + grid: grid.serialize +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -86985,34 +87448,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def destructure~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.angle_from start_point, end_point~ + def destructure +** Processing line: ~ [grid, inputs, state, outputs, runtime, passes]~ - Inside source: true *** True Line Result - def self.angle_from start_point, end_point -** Processing line: ~ d_y = end_point.y - start_point.y~ + [grid, inputs, state, outputs, runtime, passes] +** Processing line: ~ end~ - Inside source: true *** True Line Result - d_y = end_point.y - start_point.y -** Processing line: ~ d_x = end_point.x - start_point.x~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - d_x = end_point.x - start_point.x -** Processing line: ~ Math::PI.+(Math.atan2(d_y, d_x)).to_degrees~ + +** Processing line: ~ def clear_render_targets~ - Inside source: true *** True Line Result - Math::PI.+(Math.atan2(d_y, d_x)).to_degrees -** Processing line: ~ rescue Exception => e~ + def clear_render_targets +** Processing line: ~ render_targets_clear~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}."~ + render_targets_clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}." + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def render_targets_clear~ +- Inside source: true +*** True Line Result + def render_targets_clear +** Processing line: ~ @render_targets = {}~ +- Inside source: true +*** True Line Result + @render_targets = {} ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87021,26 +87496,50 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def render_targets~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.angle_to start_point, end_point~ + def render_targets +** Processing line: ~ @render_targets~ - Inside source: true *** True Line Result - def self.angle_to start_point, end_point -** Processing line: ~ angle_from end_point, start_point~ + @render_targets +** Processing line: ~ end~ - Inside source: true *** True Line Result - angle_from end_point, start_point -** Processing line: ~ rescue Exception => e~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}."~ + +** Processing line: ~ def render_target name~ - Inside source: true *** True Line Result - raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}." + def render_target name +** Processing line: ~ name = name.to_s~ +- Inside source: true +*** True Line Result + name = name.to_s +** Processing line: ~ if !@render_targets[name]~ +- Inside source: true +*** True Line Result + if !@render_targets[name] +** Processing line: ~ @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0])~ +- Inside source: true +*** True Line Result + @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0]) +** Processing line: ~ @passes << @render_targets[name]~ +- Inside source: true +*** True Line Result + @passes << @render_targets[name] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ @render_targets[name]~ +- Inside source: true +*** True Line Result + @render_targets[name] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87049,26 +87548,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def solids~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.point_inside_circle? point, circle_center_point, radius~ + def solids +** Processing line: ~ @outputs.solids~ - Inside source: true *** True Line Result - def self.point_inside_circle? point, circle_center_point, radius -** Processing line: ~ (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2~ + @outputs.solids +** Processing line: ~ end~ - Inside source: true *** True Line Result - (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2 -** Processing line: ~ rescue Exception => e~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}"~ + +** Processing line: ~ def static_solids~ - Inside source: true *** True Line Result - raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}" + def static_solids +** Processing line: ~ @outputs.static_solids~ +- Inside source: true +*** True Line Result + @outputs.static_solids ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87077,38 +87580,46 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def sprites~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.inside_rect? inner_rect, outer_rect~ + def sprites +** Processing line: ~ @outputs.sprites~ - Inside source: true *** True Line Result - def self.inside_rect? inner_rect, outer_rect -** Processing line: ~ inner_rect.x >= outer_rect.x &&~ + @outputs.sprites +** Processing line: ~ end~ - Inside source: true *** True Line Result - inner_rect.x >= outer_rect.x && -** Processing line: ~ inner_rect.right <= outer_rect.right &&~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - inner_rect.right <= outer_rect.right && -** Processing line: ~ inner_rect.y >= outer_rect.y &&~ + +** Processing line: ~ def static_sprites~ - Inside source: true *** True Line Result - inner_rect.y >= outer_rect.y && -** Processing line: ~ inner_rect.top <= outer_rect.top~ + def static_sprites +** Processing line: ~ @outputs.static_sprites~ - Inside source: true *** True Line Result - inner_rect.top <= outer_rect.top -** Processing line: ~ rescue Exception => e~ + @outputs.static_sprites +** Processing line: ~ end~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}."~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}." + +** Processing line: ~ def labels~ +- Inside source: true +*** True Line Result + def labels +** Processing line: ~ @outputs.labels~ +- Inside source: true +*** True Line Result + @outputs.labels ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87117,138 +87628,150 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def static_labels~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.scale_rect_extended rect,~ + def static_labels +** Processing line: ~ @outputs.static_labels~ - Inside source: true *** True Line Result - def self.scale_rect_extended rect, -** Processing line: ~ percentage_x: percentage_x,~ + @outputs.static_labels +** Processing line: ~ end~ - Inside source: true *** True Line Result - percentage_x: percentage_x, -** Processing line: ~ percentage_y: percentage_y,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - percentage_y: percentage_y, -** Processing line: ~ anchor_x: anchor_x,~ + +** Processing line: ~ def lines~ - Inside source: true *** True Line Result - anchor_x: anchor_x, -** Processing line: ~ anchor_y: anchor_y~ + def lines +** Processing line: ~ @outputs.lines~ - Inside source: true *** True Line Result - anchor_y: anchor_y -** Processing line: ~ anchor_x ||= 0.0~ + @outputs.lines +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_x ||= 0.0 -** Processing line: ~ anchor_y ||= 0.0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - anchor_y ||= 0.0 -** Processing line: ~ percentage_x ||= 1.0~ + +** Processing line: ~ def static_lines~ - Inside source: true *** True Line Result - percentage_x ||= 1.0 -** Processing line: ~ percentage_y ||= 1.0~ + def static_lines +** Processing line: ~ @outputs.static_lines~ - Inside source: true *** True Line Result - percentage_y ||= 1.0 -** Processing line: ~ new_w = rect.w * percentage_x~ + @outputs.static_lines +** Processing line: ~ end~ - Inside source: true *** True Line Result - new_w = rect.w * percentage_x -** Processing line: ~ new_h = rect.h * percentage_y~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - new_h = rect.h * percentage_y -** Processing line: ~ new_x = rect.x + (rect.w - new_w) * anchor_x~ + +** Processing line: ~ def borders~ - Inside source: true *** True Line Result - new_x = rect.x + (rect.w - new_w) * anchor_x -** Processing line: ~ new_y = rect.y + (rect.h - new_h) * anchor_y~ + def borders +** Processing line: ~ @outputs.borders~ - Inside source: true *** True Line Result - new_y = rect.y + (rect.h - new_h) * anchor_y -** Processing line: ~ if rect.is_a? Array~ + @outputs.borders +** Processing line: ~ end~ - Inside source: true *** True Line Result - if rect.is_a? Array -** Processing line: ~ return [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return [ -** Processing line: ~ new_x,~ + +** Processing line: ~ def static_borders~ - Inside source: true *** True Line Result - new_x, -** Processing line: ~ new_y,~ + def static_borders +** Processing line: ~ @outputs.static_borders~ - Inside source: true *** True Line Result - new_y, -** Processing line: ~ new_w,~ + @outputs.static_borders +** Processing line: ~ end~ - Inside source: true *** True Line Result - new_w, -** Processing line: ~ new_h,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - new_h, -** Processing line: ~ *rect[4..-1]~ + +** Processing line: ~ def primitives~ - Inside source: true *** True Line Result - *rect[4..-1] -** Processing line: ~ ]~ + def primitives +** Processing line: ~ @outputs.primitives~ - Inside source: true *** True Line Result - ] -** Processing line: ~ elsif rect.is_a? Hash~ + @outputs.primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - elsif rect.is_a? Hash -** Processing line: ~ return rect.merge(x: new_x, y: new_y, w: new_w, h: new_h)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return rect.merge(x: new_x, y: new_y, w: new_w, h: new_h) -** Processing line: ~ else~ + +** Processing line: ~ def static_primitives~ - Inside source: true *** True Line Result - else -** Processing line: ~ rect.x = new_x~ + def static_primitives +** Processing line: ~ @outputs.static_primitives~ - Inside source: true *** True Line Result - rect.x = new_x -** Processing line: ~ rect.y = new_y~ + @outputs.static_primitives +** Processing line: ~ end~ - Inside source: true *** True Line Result - rect.y = new_y -** Processing line: ~ rect.w = new_w~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rect.w = new_w -** Processing line: ~ rect.h = new_h~ + +** Processing line: ~ def keyboard~ - Inside source: true *** True Line Result - rect.h = new_h -** Processing line: ~ return rect~ + def keyboard +** Processing line: ~ @inputs.keyboard~ - Inside source: true *** True Line Result - return rect -** Processing line: ~ end~ + @inputs.keyboard +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ rescue Exception => e~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}."~ + +** Processing line: ~ def click~ - Inside source: true *** True Line Result - raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}." + def click +** Processing line: ~ return nil unless @inputs.mouse.click~ +- Inside source: true +*** True Line Result + return nil unless @inputs.mouse.click +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @inputs.mouse.click.point~ +- Inside source: true +*** True Line Result + @inputs.mouse.click.point ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87257,66 +87780,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def click_at~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def self.scale_rect rect, percentage, *anchors~ + def click_at +** Processing line: ~ return nil unless @inputs.mouse.click~ - Inside source: true *** True Line Result - def self.scale_rect rect, percentage, *anchors -** Processing line: ~ anchor_x, anchor_y = *anchors.flatten~ + return nil unless @inputs.mouse.click +** Processing line: ~~ - Inside source: true *** True Line Result - anchor_x, anchor_y = *anchors.flatten -** Processing line: ~ anchor_x ||= 0~ + +** Processing line: ~ @inputs.mouse.click.created_at~ - Inside source: true *** True Line Result - anchor_x ||= 0 -** Processing line: ~ anchor_y ||= anchor_x~ + @inputs.mouse.click.created_at +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_y ||= anchor_x -** Processing line: ~ Geometry.scale_rect_extended rect,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - Geometry.scale_rect_extended rect, -** Processing line: ~ percentage_x: percentage,~ + +** Processing line: ~ def mouse~ - Inside source: true *** True Line Result - percentage_x: percentage, -** Processing line: ~ percentage_y: percentage,~ + def mouse +** Processing line: ~ @inputs.mouse~ - Inside source: true *** True Line Result - percentage_y: percentage, -** Processing line: ~ anchor_x: anchor_x,~ + @inputs.mouse +** Processing line: ~ end~ - Inside source: true *** True Line Result - anchor_x: anchor_x, -** Processing line: ~ anchor_y: anchor_y~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - anchor_y: anchor_y -** Processing line: ~ rescue Exception => e~ + +** Processing line: ~ # @see Inputs#controller_one~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]."~ + # @see Inputs#controller_one +** Processing line: ~ # @return (see Inputs#controller_one)~ - Inside source: true *** True Line Result - raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]." + # @return (see Inputs#controller_one) +** Processing line: ~ def controller_one~ +- Inside source: true +*** True Line Result + def controller_one +** Processing line: ~ @inputs.controller_one~ +- Inside source: true +*** True Line Result + @inputs.controller_one ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end # module Geometry~ +** Processing line: ~~ - Inside source: true *** True Line Result - end # module Geometry -** Processing line: ~ end # module GTK~ + +** Processing line: ~ # @see Inputs#controller_two~ - Inside source: true *** True Line Result - end # module GTK + # @see Inputs#controller_two +** Processing line: ~ # @return (see Inputs#controller_two)~ +- Inside source: true +*** True Line Result + # @return (see Inputs#controller_two) +** Processing line: ~ def controller_two~ +- Inside source: true +*** True Line Result + def controller_two +** Processing line: ~ @inputs.controller_two~ +- Inside source: true +*** True Line Result + @inputs.controller_two +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result @@ -87329,18 +87884,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/grid.rb~ +** Processing line: ~* assert.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/grid.rb +* assert.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./dragon/assert.rb~ +- Inside source: true +*** True Line Result + # ./dragon/assert.rb ** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result @@ -87353,10 +87912,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # grid.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # assert.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # grid.rb has been released under MIT (*only this file*). + # assert.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -87365,274 +87924,238 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result module GTK -** Processing line: ~ class Grid~ -- Inside source: true -*** True Line Result - class Grid -** Processing line: ~ include Serialize~ +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - include Serialize -** Processing line: ~ SCREEN_Y_DIRECTION = -1.0~ + =begin +** Processing line: ~ This is a tiny assertion api for the unit testing portion of Game Toolkit.~ - Inside source: true *** True Line Result - SCREEN_Y_DIRECTION = -1.0 + This is a tiny assertion api for the unit testing portion of Game Toolkit. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The coordinate system currently in use.~ +** Processing line: ~ @example~ - Inside source: true *** True Line Result - # The coordinate system currently in use. -** Processing line: ~ #~ + @example +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Symbol] `:bottom_left` or `:center`~ + +** Processing line: ~ 1. Create a file called tests.rb under mygame.~ - Inside source: true *** True Line Result - # @return [Symbol] `:bottom_left` or `:center` -** Processing line: ~ attr_accessor :name~ + 1. Create a file called tests.rb under mygame. +** Processing line: ~ 2. Any method that begins with the word test_ will be considered a test.~ - Inside source: true *** True Line Result - attr_accessor :name + 2. Any method that begins with the word test_ will be considered a test. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "x" coordinate indicating the bottom of the screen.~ -- Inside source: true -*** True Line Result - # Returns the "x" coordinate indicating the bottom of the screen. -** Processing line: ~ #~ +** Processing line: ~ def test_this_works args, assert~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + def test_this_works args, assert +** Processing line: ~ assert.equal! 1, 1~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :bottom~ + assert.equal! 1, 1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :bottom + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "x" coordinate indicating the top of the screen.~ -- Inside source: true -*** True Line Result - # Returns the "x" coordinate indicating the top of the screen. -** Processing line: ~ #~ +** Processing line: ~ 3. To run a test, save the file while the game is running.~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + 3. To run a test, save the file while the game is running. +** Processing line: ~~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :top~ + +** Processing line: ~ @example~ - Inside source: true *** True Line Result - attr_accessor :top + @example ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "y" coordinate indicating the left of the screen.~ +** Processing line: ~ To add an assertion open up this class and write:~ - Inside source: true *** True Line Result - # Returns the "y" coordinate indicating the left of the screen. -** Processing line: ~ #~ + To add an assertion open up this class and write: +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + +** Processing line: ~ class Assert~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :left~ -- Inside source: true -*** True Line Result - attr_accessor :left -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ # Returns the "y" coordinate indicating the right of the screen.~ -- Inside source: true -*** True Line Result - # Returns the "y" coordinate indicating the right of the screen. -** Processing line: ~ #~ + class Assert +** Processing line: ~ def custom_assertion actual, expected, message = nil~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + def custom_assertion actual, expected, message = nil +** Processing line: ~ # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive).~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :right~ + # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - attr_accessor :right + @assertion_performed = true ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "x" coordinate indicating the center of the screen.~ -- Inside source: true -*** True Line Result - # Returns the "x" coordinate indicating the center of the screen. -** Processing line: ~ #~ -- Inside source: true -*** True Line Result - # -** Processing line: ~ # @return [Float]~ -- Inside source: true -*** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :center_x~ +** Processing line: ~ # perform your custom logic here and rais an exception to denote a failure.~ - Inside source: true *** True Line Result - attr_accessor :center_x + # perform your custom logic here and rais an exception to denote a failure. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "y" coordinate indicating the center of the screen.~ -- Inside source: true -*** True Line Result - # Returns the "y" coordinate indicating the center of the screen. -** Processing line: ~ #~ +** Processing line: ~ raise "Some Error. #{message}."~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + raise "Some Error. #{message}." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :center_y~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :center_y -** Processing line: ~~ + end +** Processing line: ~ =end~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns the bottom left and top right coordinates in a single list.~ + =end +** Processing line: ~ class Assert~ - Inside source: true *** True Line Result - # Returns the bottom left and top right coordinates in a single list. -** Processing line: ~ #~ + class Assert +** Processing line: ~ attr :assertion_performed~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [[Float, Float, Float, Float]]~ + attr :assertion_performed +** Processing line: ~~ - Inside source: true *** True Line Result - # @return [[Float, Float, Float, Float]] -** Processing line: ~ attr_accessor :rect~ + +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - attr_accessor :rect -** Processing line: ~~ + =begin +** Processing line: ~ Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive).~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns the "x" coordinate of the origin.~ + Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). +** Processing line: ~ =end~ - Inside source: true *** True Line Result - # Returns the "x" coordinate of the origin. -** Processing line: ~ #~ + =end +** Processing line: ~ def ok!~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + def ok! +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :origin_x~ + @assertion_performed = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :origin_x + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the "y" coordinate of the origin.~ +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - # Returns the "y" coordinate of the origin. -** Processing line: ~ #~ + =begin +** Processing line: ~ Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user.~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. +** Processing line: ~~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ attr_accessor :origin_y~ + +** Processing line: ~ @example~ - Inside source: true *** True Line Result - attr_accessor :origin_y + @example ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ attr_accessor :left_margin, :bottom_margin~ +** Processing line: ~ def test_does_this_work args, assert~ - Inside source: true *** True Line Result - attr_accessor :left_margin, :bottom_margin -** Processing line: ~~ + def test_does_this_work args, assert +** Processing line: ~ some_result = Person.new~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize runtime~ + some_result = Person.new +** Processing line: ~ assert.true! some_result~ - Inside source: true *** True Line Result - def initialize runtime -** Processing line: ~ @runtime = runtime~ + assert.true! some_result +** Processing line: ~ # OR~ - Inside source: true *** True Line Result - @runtime = runtime -** Processing line: ~ @ffi_draw = runtime.ffi_draw~ + # OR +** Processing line: ~ assert.true! some_result, "Person was not created."~ - Inside source: true *** True Line Result - @ffi_draw = runtime.ffi_draw -** Processing line: ~ origin_bottom_left!~ + assert.true! some_result, "Person was not created." +** Processing line: ~ end~ - Inside source: true *** True Line Result - origin_bottom_left! -** Processing line: ~ end~ + end +** Processing line: ~ =end~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + =end +** Processing line: ~ def true! value, message = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns `x` plus the origin "x".~ + def true! value, message = nil +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - # Returns `x` plus the origin "x". -** Processing line: ~ #~ + @assertion_performed = true +** Processing line: ~ if !value~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + if !value +** Processing line: ~ message = "#{value} was not truthy.\n#{message}"~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def transform_x x~ + message = "#{value} was not truthy.\n#{message}" +** Processing line: ~ raise "#{message}"~ - Inside source: true *** True Line Result - def transform_x x -** Processing line: ~ @origin_x + x~ + raise "#{message}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - @origin_x + x + end +** Processing line: ~ nil~ +- Inside source: true +*** True Line Result + nil ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87641,82 +88164,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns `x` minus the origin "x".~ -- Inside source: true -*** True Line Result - # Returns `x` minus the origin "x". -** Processing line: ~ #~ -- Inside source: true -*** True Line Result - # -** Processing line: ~ # @return [Float]~ +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def untransform_x x~ + =begin +** Processing line: ~ Assert if a value is a falsey value.~ - Inside source: true *** True Line Result - def untransform_x x -** Processing line: ~ x - @origin_x~ + Assert if a value is a falsey value. +** Processing line: ~~ - Inside source: true *** True Line Result - x - @origin_x -** Processing line: ~ end~ + +** Processing line: ~ @example~ - Inside source: true *** True Line Result - end + @example ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns `y` plus the origin "y".~ +** Processing line: ~ def test_does_this_work args, assert~ - Inside source: true *** True Line Result - # Returns `y` plus the origin "y". -** Processing line: ~ #~ + def test_does_this_work args, assert +** Processing line: ~ some_result = nil~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + some_result = nil +** Processing line: ~ assert.false! some_result~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def transform_y y~ + assert.false! some_result +** Processing line: ~ end~ - Inside source: true *** True Line Result - def transform_y y -** Processing line: ~ @origin_y + y * SCREEN_Y_DIRECTION~ + end +** Processing line: ~ =end~ - Inside source: true *** True Line Result - @origin_y + y * SCREEN_Y_DIRECTION -** Processing line: ~ end~ + =end +** Processing line: ~ def false! value, message = nil~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def false! value, message = nil +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns `y` minus the origin "y".~ + @assertion_performed = true +** Processing line: ~ if value~ - Inside source: true *** True Line Result - # Returns `y` minus the origin "y". -** Processing line: ~ #~ + if value +** Processing line: ~ message = "#{value} was not falsey.\n#{message}"~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + message = "#{value} was not falsey.\n#{message}" +** Processing line: ~ raise message~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def untransform_y y~ + raise message +** Processing line: ~ end~ - Inside source: true *** True Line Result - def untransform_y y -** Processing line: ~ @origin_y + y * SCREEN_Y_DIRECTION~ + end +** Processing line: ~ nil~ - Inside source: true *** True Line Result - @origin_y + y * SCREEN_Y_DIRECTION + nil ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -87725,370 +88240,362 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def ffi_draw~ -- Inside source: true -*** True Line Result - def ffi_draw -** Processing line: ~ @ffi_draw~ +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - @ffi_draw -** Processing line: ~ end~ + =begin +** Processing line: ~ Assert if two values are equal.~ - Inside source: true *** True Line Result - end + Assert if two values are equal. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def ffi_draw= value~ -- Inside source: true -*** True Line Result - def ffi_draw= value -** Processing line: ~ @ffi_draw = value~ -- Inside source: true -*** True Line Result - @ffi_draw = value -** Processing line: ~ end~ +** Processing line: ~ @example~ - Inside source: true *** True Line Result - end + @example ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the rendering coordinate system to have its origin in the bottom left.~ -- Inside source: true -*** True Line Result - # Sets the rendering coordinate system to have its origin in the bottom left. -** Processing line: ~ #~ +** Processing line: ~ def test_does_this_work args, assert~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + def test_does_this_work args, assert +** Processing line: ~ a = 1~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ # @gtk~ + a = 1 +** Processing line: ~ b = 1~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def origin_bottom_left!~ + b = 1 +** Processing line: ~ assert.equal! a, b~ - Inside source: true *** True Line Result - def origin_bottom_left! -** Processing line: ~ return if @name == :bottom_left~ + assert.equal! a, b +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if @name == :bottom_left -** Processing line: ~ @name = :bottom_left~ + end +** Processing line: ~ =end~ - Inside source: true *** True Line Result - @name = :bottom_left -** Processing line: ~ @origin_x = 0.0~ + =end +** Processing line: ~ def equal! actual, expected, message = nil~ - Inside source: true *** True Line Result - @origin_x = 0.0 -** Processing line: ~ @origin_y = @runtime.logical_height~ + def equal! actual, expected, message = nil +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - @origin_y = @runtime.logical_height -** Processing line: ~ @left = 0.0~ + @assertion_performed = true +** Processing line: ~ if actual != expected~ - Inside source: true *** True Line Result - @left = 0.0 -** Processing line: ~ @right = @runtime.logical_width~ + if actual != expected +** Processing line: ~ actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip~ - Inside source: true *** True Line Result - @right = @runtime.logical_width -** Processing line: ~ @top = @runtime.logical_height~ + actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip +** Processing line: ~ message = "actual:\n#{actual_string} did not equal\nexpected:\n#{expected}.\n#{message}"~ - Inside source: true *** True Line Result - @top = @runtime.logical_height -** Processing line: ~ @bottom = 0.0~ + message = "actual:\n#{actual_string} did not equal\nexpected:\n#{expected}.\n#{message}" +** Processing line: ~ raise message~ - Inside source: true *** True Line Result - @bottom = 0.0 -** Processing line: ~ @left_margin = 0.0~ + raise message +** Processing line: ~ end~ - Inside source: true *** True Line Result - @left_margin = 0.0 -** Processing line: ~ @bottom_margin = 0.0~ + end +** Processing line: ~ nil~ - Inside source: true *** True Line Result - @bottom_margin = 0.0 -** Processing line: ~ @center_x = @runtime.logical_width.half~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - @center_x = @runtime.logical_width.half -** Processing line: ~ @center_y = @runtime.logical_height.half~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @center_y = @runtime.logical_height.half -** Processing line: ~ @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect~ + +** Processing line: ~ =begin~ - Inside source: true *** True Line Result - @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect -** Processing line: ~ @center = [@center_x, @center_y].point~ + =begin +** Processing line: ~ Assert if a value is explicitly nil (not false).~ - Inside source: true *** True Line Result - @center = [@center_x, @center_y].point -** Processing line: ~ @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION~ + Assert if a value is explicitly nil (not false). +** Processing line: ~~ - Inside source: true *** True Line Result - @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION -** Processing line: ~ end~ + +** Processing line: ~ @example~ - Inside source: true *** True Line Result - end + @example ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Sets the rendering coordinate system to have its origin in the center.~ +** Processing line: ~ def test_does_this_work args, assert~ - Inside source: true *** True Line Result - # Sets the rendering coordinate system to have its origin in the center. -** Processing line: ~ #~ + def test_does_this_work args, assert +** Processing line: ~ a = nil~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + a = nil +** Processing line: ~ b = false~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ # @gtk~ + b = false +** Processing line: ~ assert.nil! a # this will pass~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def origin_center!~ + assert.nil! a # this will pass +** Processing line: ~ assert.nil! b # this will throw an exception.~ - Inside source: true *** True Line Result - def origin_center! -** Processing line: ~ return if @name == :center~ + assert.nil! b # this will throw an exception. +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if @name == :center -** Processing line: ~ @name = :center~ + end +** Processing line: ~ =end~ - Inside source: true *** True Line Result - @name = :center -** Processing line: ~ @origin_x = @runtime.logical_width.half~ + =end +** Processing line: ~ def nil! value, message = nil~ - Inside source: true *** True Line Result - @origin_x = @runtime.logical_width.half -** Processing line: ~ @origin_y = @runtime.logical_height.half~ + def nil! value, message = nil +** Processing line: ~ @assertion_performed = true~ - Inside source: true *** True Line Result - @origin_y = @runtime.logical_height.half -** Processing line: ~ @left = -@runtime.logical_width.half~ + @assertion_performed = true +** Processing line: ~ if !value.nil?~ - Inside source: true *** True Line Result - @left = -@runtime.logical_width.half -** Processing line: ~ @right = @runtime.logical_width.half~ + if !value.nil? +** Processing line: ~ message = "#{value} was supposed to be nil, but wasn't.\n#{message}"~ - Inside source: true *** True Line Result - @right = @runtime.logical_width.half -** Processing line: ~ @top = @runtime.logical_height.half~ + message = "#{value} was supposed to be nil, but wasn't.\n#{message}" +** Processing line: ~ raise message~ - Inside source: true *** True Line Result - @top = @runtime.logical_height.half -** Processing line: ~ @bottom = -@runtime.logical_height.half~ + raise message +** Processing line: ~ end~ - Inside source: true *** True Line Result - @bottom = -@runtime.logical_height.half -** Processing line: ~ @center_x = 0.0~ + end +** Processing line: ~ nil~ - Inside source: true *** True Line Result - @center_x = 0.0 -** Processing line: ~ @center_y = 0.0~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - @center_y = 0.0 -** Processing line: ~ @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect -** Processing line: ~ @center = [@center_x, @center_y].point~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @center = [@center_x, @center_y].point -** Processing line: ~ @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # The logical width used for rendering.~ -- Inside source: true +** Processing line: ~* attr_gtk.rb~ +- Header detected. *** True Line Result - # The logical width used for rendering. -** Processing line: ~ #~ -- Inside source: true + *** True Line Result - # -** Processing line: ~ # @return [Float]~ -- Inside source: true +* attr_gtk.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - # @return [Float] -** Processing line: ~ def w~ -- Inside source: true + *** True Line Result - def w -** Processing line: ~ @runtime.logical_width~ +#+begin_src ruby +** Processing line: ~ # ./dragon/attr_gtk.rb~ - Inside source: true *** True Line Result - @runtime.logical_width -** Processing line: ~ end~ + # ./dragon/attr_gtk.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - -** Processing line: ~ # Half the logical width used for rendering.~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - # Half the logical width used for rendering. -** Processing line: ~ #~ + # MIT License +** Processing line: ~ # attr_gtk.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + # attr_gtk.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def w_half~ + +** Processing line: ~ # @private~ - Inside source: true *** True Line Result - def w_half -** Processing line: ~ w.half~ + # @private +** Processing line: ~ module AttrGTK~ - Inside source: true *** True Line Result - w.half -** Processing line: ~ end~ + module AttrGTK +** Processing line: ~ attr_accessor :args~ - Inside source: true *** True Line Result - end + attr_accessor :args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # The logical height used for rendering.~ +** Processing line: ~ def keyboard~ - Inside source: true *** True Line Result - # The logical height used for rendering. -** Processing line: ~ #~ + def keyboard +** Processing line: ~ args.inputs.keyboard~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + args.inputs.keyboard +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def h~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def h -** Processing line: ~ @runtime.logical_height~ + +** Processing line: ~ def grid~ - Inside source: true *** True Line Result - @runtime.logical_height -** Processing line: ~ end~ + def grid +** Processing line: ~ args.grid~ - Inside source: true *** True Line Result - end + args.grid +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Half the logical height used for rendering.~ +** Processing line: ~ def state~ - Inside source: true *** True Line Result - # Half the logical height used for rendering. -** Processing line: ~ #~ + def state +** Processing line: ~ args.state~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float]~ + args.state +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Float] -** Processing line: ~ def h_half~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def h_half -** Processing line: ~ h.half~ + +** Processing line: ~ def inputs~ - Inside source: true *** True Line Result - h.half -** Processing line: ~ end~ + def inputs +** Processing line: ~ args.inputs~ - Inside source: true *** True Line Result - end + args.inputs +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the coordinates indicating the center of the screen.~ +** Processing line: ~ def outputs~ - Inside source: true *** True Line Result - # Returns the coordinates indicating the center of the screen. -** Processing line: ~ #~ + def outputs +** Processing line: ~ args.outputs~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [[Float, Float]]~ + args.outputs +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [[Float, Float]] -** Processing line: ~ def center~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def center -** Processing line: ~ @center~ + +** Processing line: ~ def gtk~ - Inside source: true *** True Line Result - @center -** Processing line: ~ end~ + def gtk +** Processing line: ~ args.gtk~ - Inside source: true *** True Line Result - end + args.gtk +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the coordinates indicating the bottom right of the screen.~ +** Processing line: ~ def passes~ - Inside source: true *** True Line Result - # Returns the coordinates indicating the bottom right of the screen. -** Processing line: ~ #~ + def passes +** Processing line: ~ args.passes~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [[Float, Float]]~ + args.passes +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [[Float, Float]] -** Processing line: ~ def bottom_right~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def bottom_right -** Processing line: ~ [@right, @bottom].point~ + +** Processing line: ~ def geometry~ - Inside source: true *** True Line Result - [@right, @bottom].point -** Processing line: ~ end~ + def geometry +** Processing line: ~ args.geometry~ - Inside source: true *** True Line Result - end + args.geometry ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -88109,22 +88616,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/inputs.rb~ +** Processing line: ~* attr_sprite.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/inputs.rb +* attr_sprite.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby -** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # ./dragon/attr_sprite.rb~ - Inside source: true *** True Line Result - # coding: utf-8 + # ./dragon/attr_sprite.rb ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result @@ -88133,802 +88640,806 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # inputs.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # attr_sprite.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # inputs.rb has been released under MIT (*only this file*). + # attr_sprite.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ +** Processing line: ~ # @private~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ # Represents all the keys available on the keyboard.~ + # @private +** Processing line: ~ module AttrRect~ - Inside source: true *** True Line Result - # Represents all the keys available on the keyboard. -** Processing line: ~ # @gtk~ + module AttrRect +** Processing line: ~ def left~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ class KeyboardKeys~ + def left +** Processing line: ~ @x~ - Inside source: true *** True Line Result - class KeyboardKeys -** Processing line: ~ include Serialize~ + @x +** Processing line: ~ end~ - Inside source: true *** True Line Result - include Serialize + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ attr_accessor :exclamation_point,~ +** Processing line: ~ def right~ - Inside source: true *** True Line Result - attr_accessor :exclamation_point, -** Processing line: ~ :zero, :one, :two, :three, :four,~ + def right +** Processing line: ~ @x + @w~ - Inside source: true *** True Line Result - :zero, :one, :two, :three, :four, -** Processing line: ~ :five, :six, :seven, :eight, :nine,~ + @x + @w +** Processing line: ~ end~ - Inside source: true *** True Line Result - :five, :six, :seven, :eight, :nine, -** Processing line: ~ :backspace, :delete, :escape, :enter, :tab,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :backspace, :delete, :escape, :enter, :tab, -** Processing line: ~ :open_round_brace, :close_round_brace,~ + +** Processing line: ~ def bottom~ - Inside source: true *** True Line Result - :open_round_brace, :close_round_brace, -** Processing line: ~ :open_curly_brace, :close_curly_brace,~ + def bottom +** Processing line: ~ @y~ - Inside source: true *** True Line Result - :open_curly_brace, :close_curly_brace, -** Processing line: ~ :open_square_brace, :close_square_brace,~ + @y +** Processing line: ~ end~ - Inside source: true *** True Line Result - :open_square_brace, :close_square_brace, -** Processing line: ~ :colon, :semicolon, :equal_sign,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :colon, :semicolon, :equal_sign, -** Processing line: ~ :hyphen, :space, :dollar_sign,~ + +** Processing line: ~ def top~ - Inside source: true *** True Line Result - :hyphen, :space, :dollar_sign, -** Processing line: ~ :double_quotation_mark,~ + def top +** Processing line: ~ @y + @h~ - Inside source: true *** True Line Result - :double_quotation_mark, -** Processing line: ~ :single_quotation_mark,~ + @y + @h +** Processing line: ~ end~ - Inside source: true *** True Line Result - :single_quotation_mark, -** Processing line: ~ :backtick,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - :backtick, -** Processing line: ~ :tilde, :period, :comma, :pipe,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :tilde, :period, :comma, :pipe, -** Processing line: ~ :underscore,~ + +** Processing line: ~ module AttrSprite~ - Inside source: true *** True Line Result - :underscore, -** Processing line: ~ :a, :b, :c, :d, :e, :f, :g, :h,~ + module AttrSprite +** Processing line: ~ include AttrRect~ - Inside source: true *** True Line Result - :a, :b, :c, :d, :e, :f, :g, :h, -** Processing line: ~ :i, :j, :k, :l, :m, :n, :o, :p,~ + include AttrRect +** Processing line: ~ include GTK::Geometry~ - Inside source: true *** True Line Result - :i, :j, :k, :l, :m, :n, :o, :p, -** Processing line: ~ :q, :r, :s, :t, :u, :v, :w, :x,~ + include GTK::Geometry +** Processing line: ~~ - Inside source: true *** True Line Result - :q, :r, :s, :t, :u, :v, :w, :x, -** Processing line: ~ :y, :z,~ + +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x,~ - Inside source: true *** True Line Result - :y, :z, -** Processing line: ~ :shift, :control, :alt, :meta,~ + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, +** Processing line: ~ :tile_y, :tile_w, :tile_h, :flip_horizontally,~ - Inside source: true *** True Line Result - :shift, :control, :alt, :meta, -** Processing line: ~ :left, :right, :up, :down, :pageup, :pagedown,~ + :tile_y, :tile_w, :tile_h, :flip_horizontally, +** Processing line: ~ :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id,~ - Inside source: true *** True Line Result - :left, :right, :up, :down, :pageup, :pagedown, -** Processing line: ~ :char, :plus, :at, :forward_slash, :back_slash, :asterisk,~ + :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, +** Processing line: ~ :source_x, :source_y, :source_w, :source_h~ - Inside source: true *** True Line Result - :char, :plus, :at, :forward_slash, :back_slash, :asterisk, -** Processing line: ~ :less_than, :greater_than, :carat, :ampersand, :superscript_two,~ + :source_x, :source_y, :source_w, :source_h +** Processing line: ~~ - Inside source: true *** True Line Result - :less_than, :greater_than, :carat, :ampersand, :superscript_two, -** Processing line: ~ :circumflex,~ + +** Processing line: ~ def primitive_marker~ - Inside source: true *** True Line Result - :circumflex, -** Processing line: ~ :question_mark, :section_sign, :ordinal_indicator,~ + def primitive_marker +** Processing line: ~ :sprite~ - Inside source: true *** True Line Result - :question_mark, :section_sign, :ordinal_indicator, -** Processing line: ~ :raw_key~ + :sprite +** Processing line: ~ end~ - Inside source: true *** True Line Result - :raw_key + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.sdl_to_key raw_key, modifier~ -- Inside source: true -*** True Line Result - def self.sdl_to_key raw_key, modifier -** Processing line: ~ return nil unless (raw_key >= 0 && raw_key <= 255) ||~ +** Processing line: ~ def sprite~ - Inside source: true *** True Line Result - return nil unless (raw_key >= 0 && raw_key <= 255) || -** Processing line: ~ raw_key == 1073741903 ||~ + def sprite +** Processing line: ~ self~ - Inside source: true *** True Line Result - raw_key == 1073741903 || -** Processing line: ~ raw_key == 1073741904 ||~ + self +** Processing line: ~ end~ - Inside source: true *** True Line Result - raw_key == 1073741904 || -** Processing line: ~ raw_key == 1073741905 ||~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - raw_key == 1073741905 || -** Processing line: ~ raw_key == 1073741906 ||~ + +** Processing line: ~ def x1~ - Inside source: true *** True Line Result - raw_key == 1073741906 || -** Processing line: ~ raw_key == 1073741899 ||~ + def x1 +** Processing line: ~ @x~ - Inside source: true *** True Line Result - raw_key == 1073741899 || -** Processing line: ~ raw_key == 1073741902~ + @x +** Processing line: ~ end~ - Inside source: true *** True Line Result - raw_key == 1073741902 + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ char = KeyboardKeys.char_with_shift raw_key, modifier~ -- Inside source: true -*** True Line Result - char = KeyboardKeys.char_with_shift raw_key, modifier -** Processing line: ~ names = KeyboardKeys.char_to_method char, raw_key~ +** Processing line: ~ def x1= value~ - Inside source: true *** True Line Result - names = KeyboardKeys.char_to_method char, raw_key -** Processing line: ~ names << :alt if (modifier & (256|512)) != 0 # alt key~ + def x1= value +** Processing line: ~ @x = value~ - Inside source: true *** True Line Result - names << :alt if (modifier & (256|512)) != 0 # alt key -** Processing line: ~ names << :meta if (modifier & (1024|2048)) != 0 # meta key (command/apple/windows key)~ + @x = value +** Processing line: ~ end~ - Inside source: true *** True Line Result - names << :meta if (modifier & (1024|2048)) != 0 # meta key (command/apple/windows key) -** Processing line: ~ names << :control if (modifier & (64|128)) != 0 # ctrl key~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - names << :control if (modifier & (64|128)) != 0 # ctrl key -** Processing line: ~ names << :shift if (modifier & (1|2)) != 0 # shift key~ + +** Processing line: ~ def y1~ - Inside source: true *** True Line Result - names << :shift if (modifier & (1|2)) != 0 # shift key -** Processing line: ~ names~ + def y1 +** Processing line: ~ @y~ - Inside source: true *** True Line Result - names -** Processing line: ~ end~ + @y +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.utf_8_char raw_key~ +** Processing line: ~ def y1= value~ - Inside source: true *** True Line Result - def self.utf_8_char raw_key -** Processing line: ~ return "²" if raw_key == 178~ + def y1= value +** Processing line: ~ @y = value~ - Inside source: true *** True Line Result - return "²" if raw_key == 178 -** Processing line: ~ return "§" if raw_key == 167~ + @y = value +** Processing line: ~ end~ - Inside source: true *** True Line Result - return "§" if raw_key == 167 -** Processing line: ~ return "º" if raw_key == 186~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - return "º" if raw_key == 186 -** Processing line: ~ return raw_key.chr~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return raw_key.chr -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def self.char_with_shift raw_key, modifier~ -- Inside source: true +** Processing line: ~* console.rb~ +- Header detected. *** True Line Result - def self.char_with_shift raw_key, modifier -** Processing line: ~ return nil unless raw_key >= 0 && raw_key <= 255~ + +*** True Line Result +* console.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/console.rb~ - Inside source: true *** True Line Result - return nil unless raw_key >= 0 && raw_key <= 255 -** Processing line: ~ if modifier != 1 && modifier != 2 && modifier != 3~ + # ./dragon/console.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - if modifier != 1 && modifier != 2 && modifier != 3 -** Processing line: ~ return utf_8_char raw_key~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - return utf_8_char raw_key -** Processing line: ~ else~ + # MIT License +** Processing line: ~ # console.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - else -** Processing line: ~ @shift_keys ||= {~ + # console.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - @shift_keys ||= { -** Processing line: ~ '`' => '~', '-' => '_', "'" => '"', "1" => '!',~ + +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ - Inside source: true *** True Line Result - '`' => '~', '-' => '_', "'" => '"', "1" => '!', -** Processing line: ~ "2" => '@', "3" => '#', "4" => '$', "5" => '%',~ + # Contributors outside of DragonRuby who also hold Copyright: +** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ - Inside source: true *** True Line Result - "2" => '@', "3" => '#', "4" => '$', "5" => '%', -** Processing line: ~ "6" => '^', "7" => '&', "8" => '*', "9" => '(',~ + # - Kevin Fischer: https://github.com/kfischer-okarin +** Processing line: ~~ - Inside source: true *** True Line Result - "6" => '^', "7" => '&', "8" => '*', "9" => '(', -** Processing line: ~ "0" => ')', ";" => ":", "=" => "+", "[" => "{",~ + +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - "0" => ')', ";" => ":", "=" => "+", "[" => "{", -** Processing line: ~ "]" => "}", '\\'=> "|", '/' => "?", '.' => ">",~ + module GTK +** Processing line: ~ class Console~ - Inside source: true *** True Line Result - "]" => "}", '\\'=> "|", '/' => "?", '.' => ">", -** Processing line: ~ ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C',~ + class Console +** Processing line: ~ attr_accessor :show_reason, :log, :logo, :background_color,~ - Inside source: true *** True Line Result - ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C', -** Processing line: ~ 'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G',~ + attr_accessor :show_reason, :log, :logo, :background_color, +** Processing line: ~ :text_color, :animation_duration,~ - Inside source: true *** True Line Result - 'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G', -** Processing line: ~ 'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K',~ + :text_color, :animation_duration, +** Processing line: ~ :max_log_lines, :max_history, :log,~ - Inside source: true *** True Line Result - 'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K', -** Processing line: ~ 'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O',~ + :max_log_lines, :max_history, :log, +** Processing line: ~ :last_command_errored, :last_command, :error_color, :shown_at,~ - Inside source: true *** True Line Result - 'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O', -** Processing line: ~ 'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S',~ + :last_command_errored, :last_command, :error_color, :shown_at, +** Processing line: ~ :header_color, :archived_log, :last_log_lines, :last_log_lines_count,~ - Inside source: true *** True Line Result - 'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S', -** Processing line: ~ 't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W',~ + :header_color, :archived_log, :last_log_lines, :last_log_lines_count, +** Processing line: ~ :suppress_left_arrow_behavior, :command_set_at,~ - Inside source: true *** True Line Result - 't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W', -** Processing line: ~ 'x' => 'X', 'y' => 'Y', 'z' => 'Z'~ + :suppress_left_arrow_behavior, :command_set_at, +** Processing line: ~ :toast_ids, :bottom,~ - Inside source: true *** True Line Result - 'x' => 'X', 'y' => 'Y', 'z' => 'Z' -** Processing line: ~ }~ + :toast_ids, :bottom, +** Processing line: ~ :font_style, :menu~ - Inside source: true *** True Line Result - } + :font_style, :menu ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @shift_keys[raw_key.chr.to_s] || raw_key.chr.to_s~ +** Processing line: ~ def initialize~ - Inside source: true *** True Line Result - @shift_keys[raw_key.chr.to_s] || raw_key.chr.to_s -** Processing line: ~ end~ + def initialize +** Processing line: ~ @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) +** Processing line: ~ @menu = Menu.new self~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @menu = Menu.new self +** Processing line: ~ @disabled = false~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.char_to_method_hash~ + @disabled = false +** Processing line: ~ @log_offset = 0~ - Inside source: true *** True Line Result - def self.char_to_method_hash -** Processing line: ~ @char_to_method ||= {~ + @log_offset = 0 +** Processing line: ~ @visible = false~ - Inside source: true *** True Line Result - @char_to_method ||= { -** Processing line: ~ 'A' => [:a, :shift],~ + @visible = false +** Processing line: ~ @toast_ids = []~ - Inside source: true *** True Line Result - 'A' => [:a, :shift], -** Processing line: ~ 'B' => [:b, :shift],~ + @toast_ids = [] +** Processing line: ~ @archived_log = []~ - Inside source: true *** True Line Result - 'B' => [:b, :shift], -** Processing line: ~ 'C' => [:c, :shift],~ + @archived_log = [] +** Processing line: ~ @log = [ 'Console ready.' ]~ - Inside source: true *** True Line Result - 'C' => [:c, :shift], -** Processing line: ~ 'D' => [:d, :shift],~ + @log = [ 'Console ready.' ] +** Processing line: ~ @max_log_lines = 1000 # I guess...?~ - Inside source: true *** True Line Result - 'D' => [:d, :shift], -** Processing line: ~ 'E' => [:e, :shift],~ + @max_log_lines = 1000 # I guess...? +** Processing line: ~ @max_history = 1000 # I guess...?~ - Inside source: true *** True Line Result - 'E' => [:e, :shift], -** Processing line: ~ 'F' => [:f, :shift],~ + @max_history = 1000 # I guess...? +** Processing line: ~ @log_invocation_count = 0~ - Inside source: true *** True Line Result - 'F' => [:f, :shift], -** Processing line: ~ 'G' => [:g, :shift],~ + @log_invocation_count = 0 +** Processing line: ~ @command_history = []~ - Inside source: true *** True Line Result - 'G' => [:g, :shift], -** Processing line: ~ 'H' => [:h, :shift],~ + @command_history = [] +** Processing line: ~ @command_history_index = -1~ - Inside source: true *** True Line Result - 'H' => [:h, :shift], -** Processing line: ~ 'I' => [:i, :shift],~ + @command_history_index = -1 +** Processing line: ~ @nonhistory_input = ''~ - Inside source: true *** True Line Result - 'I' => [:i, :shift], -** Processing line: ~ 'J' => [:j, :shift],~ + @nonhistory_input = '' +** Processing line: ~ @logo = 'console-logo.png'~ - Inside source: true *** True Line Result - 'J' => [:j, :shift], -** Processing line: ~ 'K' => [:k, :shift],~ + @logo = 'console-logo.png' +** Processing line: ~ @history_fname = 'console_history.txt'~ - Inside source: true *** True Line Result - 'K' => [:k, :shift], -** Processing line: ~ 'L' => [:l, :shift],~ + @history_fname = 'console_history.txt' +** Processing line: ~ @background_color = Color.new [0, 0, 0, 224]~ - Inside source: true *** True Line Result - 'L' => [:l, :shift], -** Processing line: ~ 'M' => [:m, :shift],~ + @background_color = Color.new [0, 0, 0, 224] +** Processing line: ~ @text_color = Color.new [255, 255, 255]~ - Inside source: true *** True Line Result - 'M' => [:m, :shift], -** Processing line: ~ 'N' => [:n, :shift],~ + @text_color = Color.new [255, 255, 255] +** Processing line: ~ @error_color = Color.new [200, 50, 50]~ - Inside source: true *** True Line Result - 'N' => [:n, :shift], -** Processing line: ~ 'O' => [:o, :shift],~ + @error_color = Color.new [200, 50, 50] +** Processing line: ~ @header_color = Color.new [100, 200, 220]~ - Inside source: true *** True Line Result - 'O' => [:o, :shift], -** Processing line: ~ 'P' => [:p, :shift],~ + @header_color = Color.new [100, 200, 220] +** Processing line: ~ @animation_duration = 1.seconds~ - Inside source: true *** True Line Result - 'P' => [:p, :shift], -** Processing line: ~ 'Q' => [:q, :shift],~ + @animation_duration = 1.seconds +** Processing line: ~ @shown_at = -1~ - Inside source: true *** True Line Result - 'Q' => [:q, :shift], -** Processing line: ~ 'R' => [:r, :shift],~ + @shown_at = -1 +** Processing line: ~ load_history~ - Inside source: true *** True Line Result - 'R' => [:r, :shift], -** Processing line: ~ 'S' => [:s, :shift],~ + load_history +** Processing line: ~ end~ - Inside source: true *** True Line Result - 'S' => [:s, :shift], -** Processing line: ~ 'T' => [:t, :shift],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 'T' => [:t, :shift], -** Processing line: ~ 'U' => [:u, :shift],~ + +** Processing line: ~ def console_text_width~ - Inside source: true *** True Line Result - 'U' => [:u, :shift], -** Processing line: ~ 'V' => [:v, :shift],~ + def console_text_width +** Processing line: ~ @console_text_width ||= ($gtk.logical_width - 20).idiv(font_style.letter_size.x)~ - Inside source: true *** True Line Result - 'V' => [:v, :shift], -** Processing line: ~ 'W' => [:w, :shift],~ + @console_text_width ||= ($gtk.logical_width - 20).idiv(font_style.letter_size.x) +** Processing line: ~ end~ - Inside source: true *** True Line Result - 'W' => [:w, :shift], -** Processing line: ~ 'X' => [:x, :shift],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 'X' => [:x, :shift], -** Processing line: ~ 'Y' => [:y, :shift],~ + +** Processing line: ~ def save_history~ - Inside source: true *** True Line Result - 'Y' => [:y, :shift], -** Processing line: ~ 'Z' => [:z, :shift],~ + def save_history +** Processing line: ~ $gtk.ffi_file.storefile(@history_fname, @command_history.reverse.join("\n"))~ - Inside source: true *** True Line Result - 'Z' => [:z, :shift], -** Processing line: ~ "!" => [:exclamation_point],~ + $gtk.ffi_file.storefile(@history_fname, @command_history.reverse.join("\n")) +** Processing line: ~ end~ - Inside source: true *** True Line Result - "!" => [:exclamation_point], -** Processing line: ~ "0" => [:zero],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "0" => [:zero], -** Processing line: ~ "1" => [:one],~ + +** Processing line: ~ def load_history~ - Inside source: true *** True Line Result - "1" => [:one], -** Processing line: ~ "2" => [:two],~ + def load_history +** Processing line: ~ @command_history.clear~ - Inside source: true *** True Line Result - "2" => [:two], -** Processing line: ~ "3" => [:three],~ + @command_history.clear +** Processing line: ~ str = $gtk.ffi_file.loadfile(@history_fname)~ - Inside source: true *** True Line Result - "3" => [:three], -** Processing line: ~ "4" => [:four],~ + str = $gtk.ffi_file.loadfile(@history_fname) +** Processing line: ~ return if str.nil? # no history to load.~ - Inside source: true *** True Line Result - "4" => [:four], -** Processing line: ~ "5" => [:five],~ + return if str.nil? # no history to load. +** Processing line: ~~ - Inside source: true *** True Line Result - "5" => [:five], -** Processing line: ~ "6" => [:six],~ + +** Processing line: ~ str.chomp!("\n") # Don't let endlines at the end cause extra blank line.~ - Inside source: true *** True Line Result - "6" => [:six], -** Processing line: ~ "7" => [:seven],~ + str.chomp!("\n") # Don't let endlines at the end cause extra blank line. +** Processing line: ~ str.chomp!("\r")~ - Inside source: true *** True Line Result - "7" => [:seven], -** Processing line: ~ "8" => [:eight],~ + str.chomp!("\r") +** Processing line: ~ str.each_line { |s|~ - Inside source: true *** True Line Result - "8" => [:eight], -** Processing line: ~ "9" => [:nine],~ + str.each_line { |s| +** Processing line: ~ s.chomp!("\n")~ - Inside source: true *** True Line Result - "9" => [:nine], -** Processing line: ~ "\b" => [:backspace],~ + s.chomp!("\n") +** Processing line: ~ s.chomp!("\r")~ - Inside source: true *** True Line Result - "\b" => [:backspace], -** Processing line: ~ "\e" => [:escape],~ + s.chomp!("\r") +** Processing line: ~ if s.length > 0~ - Inside source: true *** True Line Result - "\e" => [:escape], -** Processing line: ~ "\r" => [:enter],~ + if s.length > 0 +** Processing line: ~ @command_history.unshift s~ - Inside source: true *** True Line Result - "\r" => [:enter], -** Processing line: ~ "\t" => [:tab],~ + @command_history.unshift s +** Processing line: ~ break if @command_history.length >= @max_history~ - Inside source: true *** True Line Result - "\t" => [:tab], -** Processing line: ~ "(" => [:open_round_brace],~ + break if @command_history.length >= @max_history +** Processing line: ~ end~ - Inside source: true *** True Line Result - "(" => [:open_round_brace], -** Processing line: ~ ")" => [:close_round_brace],~ + end +** Processing line: ~ }~ - Inside source: true *** True Line Result - ")" => [:close_round_brace], -** Processing line: ~ "{" => [:open_curly_brace],~ + } +** Processing line: ~~ - Inside source: true *** True Line Result - "{" => [:open_curly_brace], -** Processing line: ~ "}" => [:close_curly_brace],~ + +** Processing line: ~ @command_history.uniq!~ - Inside source: true *** True Line Result - "}" => [:close_curly_brace], -** Processing line: ~ "[" => [:open_square_brace],~ + @command_history.uniq! +** Processing line: ~ end~ - Inside source: true *** True Line Result - "[" => [:open_square_brace], -** Processing line: ~ "]" => [:close_square_brace],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "]" => [:close_square_brace], -** Processing line: ~ ":" => [:colon],~ + +** Processing line: ~ def disable~ - Inside source: true *** True Line Result - ":" => [:colon], -** Processing line: ~ ";" => [:semicolon],~ + def disable +** Processing line: ~ @disabled = true~ - Inside source: true *** True Line Result - ";" => [:semicolon], -** Processing line: ~ "=" => [:equal_sign],~ + @disabled = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - "=" => [:equal_sign], -** Processing line: ~ "-" => [:hyphen],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "-" => [:hyphen], -** Processing line: ~ " " => [:space],~ + +** Processing line: ~ def enable~ - Inside source: true *** True Line Result - " " => [:space], -** Processing line: ~ "$" => [:dollar_sign],~ + def enable +** Processing line: ~ @disabled = false~ - Inside source: true *** True Line Result - "$" => [:dollar_sign], -** Processing line: ~ "\"" => [:double_quotation_mark],~ + @disabled = false +** Processing line: ~ end~ - Inside source: true *** True Line Result - "\"" => [:double_quotation_mark], -** Processing line: ~ "'" => [:single_quotation_mark],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "'" => [:single_quotation_mark], -** Processing line: ~ "`" => [:backtick],~ + +** Processing line: ~ def addsprite obj~ - Inside source: true *** True Line Result - "`" => [:backtick], -** Processing line: ~ "~" => [:tilde],~ + def addsprite obj +** Processing line: ~ @log_invocation_count += 1~ - Inside source: true *** True Line Result - "~" => [:tilde], -** Processing line: ~ "." => [:period],~ + @log_invocation_count += 1 +** Processing line: ~ obj[:id] ||= "id_#{obj[:path]}_#{Time.now.to_i}".to_sym~ - Inside source: true *** True Line Result - "." => [:period], -** Processing line: ~ "," => [:comma],~ + obj[:id] ||= "id_#{obj[:path]}_#{Time.now.to_i}".to_sym +** Processing line: ~~ - Inside source: true *** True Line Result - "," => [:comma], -** Processing line: ~ "|" => [:pipe],~ + +** Processing line: ~ if @last_line_log_index &&~ - Inside source: true *** True Line Result - "|" => [:pipe], -** Processing line: ~ "_" => [:underscore],~ + if @last_line_log_index && +** Processing line: ~ @last_sprite_line.is_a?(Hash) &&~ - Inside source: true *** True Line Result - "_" => [:underscore], -** Processing line: ~ "#" => [:hash],~ + @last_sprite_line.is_a?(Hash) && +** Processing line: ~ @last_sprite_line[:id] == obj[:id]~ - Inside source: true *** True Line Result - "#" => [:hash], -** Processing line: ~ "+" => [:plus],~ + @last_sprite_line[:id] == obj[:id] +** Processing line: ~~ - Inside source: true *** True Line Result - "+" => [:plus], -** Processing line: ~ "@" => [:at],~ + +** Processing line: ~ @log[@last_line_log_index] = obj~ - Inside source: true *** True Line Result - "@" => [:at], -** Processing line: ~ "/" => [:forward_slash],~ + @log[@last_line_log_index] = obj +** Processing line: ~ return~ - Inside source: true *** True Line Result - "/" => [:forward_slash], -** Processing line: ~ "\\" => [:back_slash],~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - "\\" => [:back_slash], -** Processing line: ~ "*" => [:asterisk],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "*" => [:asterisk], -** Processing line: ~ "<" => [:less_than],~ + +** Processing line: ~ @log << obj~ - Inside source: true *** True Line Result - "<" => [:less_than], -** Processing line: ~ ">" => [:greater_than],~ + @log << obj +** Processing line: ~ @last_line_log_index = @log.length - 1~ - Inside source: true *** True Line Result - ">" => [:greater_than], -** Processing line: ~ "^" => [:circumflex],~ + @last_line_log_index = @log.length - 1 +** Processing line: ~ @last_sprite_line = obj~ - Inside source: true *** True Line Result - "^" => [:circumflex], -** Processing line: ~ "&" => [:ampersand],~ + @last_sprite_line = obj +** Processing line: ~ nil~ - Inside source: true *** True Line Result - "&" => [:ampersand], -** Processing line: ~ "²" => [:superscript_two],~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - "²" => [:superscript_two], -** Processing line: ~ "§" => [:section_sign],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - "§" => [:section_sign], -** Processing line: ~ "?" => [:question_mark],~ + +** Processing line: ~ def add_primitive obj~ - Inside source: true *** True Line Result - "?" => [:question_mark], -** Processing line: ~ '%' => [:percent_sign],~ + def add_primitive obj +** Processing line: ~ if obj.is_a? Hash~ - Inside source: true *** True Line Result - '%' => [:percent_sign], -** Processing line: ~ "º" => [:ordinal_indicator],~ + if obj.is_a? Hash +** Processing line: ~ addsprite obj~ - Inside source: true *** True Line Result - "º" => [:ordinal_indicator], -** Processing line: ~ 1073741903 => [:right],~ + addsprite obj +** Processing line: ~ else~ - Inside source: true *** True Line Result - 1073741903 => [:right], -** Processing line: ~ 1073741904 => [:left],~ + else +** Processing line: ~ addtext obj~ - Inside source: true *** True Line Result - 1073741904 => [:left], -** Processing line: ~ 1073741905 => [:down],~ + addtext obj +** Processing line: ~ end~ - Inside source: true *** True Line Result - 1073741905 => [:down], -** Processing line: ~ 1073741906 => [:up],~ + end +** Processing line: ~ nil~ - Inside source: true *** True Line Result - 1073741906 => [:up], -** Processing line: ~ 1073741899 => [:pageup],~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - 1073741899 => [:pageup], -** Processing line: ~ 1073741902 => [:pagedown],~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - 1073741902 => [:pagedown], -** Processing line: ~ 127 => [:delete]~ + +** Processing line: ~ def addtext obj~ - Inside source: true *** True Line Result - 127 => [:delete] -** Processing line: ~ }~ + def addtext obj +** Processing line: ~ @last_log_lines_count ||= 1~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + @last_log_lines_count ||= 1 +** Processing line: ~ @log_invocation_count += 1~ - Inside source: true *** True Line Result - end + @log_invocation_count += 1 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.char_to_method char, int = nil~ +** Processing line: ~ str = obj.to_s~ - Inside source: true *** True Line Result - def self.char_to_method char, int = nil -** Processing line: ~ char_to_method_hash[char] || char_to_method_hash[int] || [char.to_sym || int]~ + str = obj.to_s +** Processing line: ~~ - Inside source: true *** True Line Result - char_to_method_hash[char] || char_to_method_hash[int] || [char.to_sym || int] -** Processing line: ~ end~ + +** Processing line: ~ log_lines = []~ - Inside source: true *** True Line Result - end + log_lines = [] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def clear~ +** Processing line: ~ str.each_line do |s|~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ set truthy_keys, false~ + str.each_line do |s| +** Processing line: ~ s.wrapped_lines(self.console_text_width).each do |l|~ - Inside source: true *** True Line Result - set truthy_keys, false -** Processing line: ~ @scrubbed_ivars = nil~ + s.wrapped_lines(self.console_text_width).each do |l| +** Processing line: ~ log_lines << l~ - Inside source: true *** True Line Result - @scrubbed_ivars = nil -** Processing line: ~ end~ + log_lines << l +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ if log_lines == @last_log_lines~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def left_right~ + if log_lines == @last_log_lines +** Processing line: ~ @last_log_lines_count += 1~ - Inside source: true *** True Line Result - def left_right -** Processing line: ~ return -1 if self.left~ + @last_log_lines_count += 1 +** Processing line: ~ new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})"~ - Inside source: true *** True Line Result - return -1 if self.left -** Processing line: ~ return 1 if self.right~ + new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})" +** Processing line: ~ if log_lines.length > 1~ - Inside source: true *** True Line Result - return 1 if self.right -** Processing line: ~ return 0~ + if log_lines.length > 1 +** Processing line: ~ @log = @log[0..-(@log.length - log_lines.length)] + log_lines[0..-2] + [new_log_line_with_count]~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + @log = @log[0..-(@log.length - log_lines.length)] + log_lines[0..-2] + [new_log_line_with_count] +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + else +** Processing line: ~ @log = @log[0..-2] + [new_log_line_with_count]~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + @log = @log[0..-2] + [new_log_line_with_count] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def up_down~ + end +** Processing line: ~ return~ - Inside source: true *** True Line Result - def up_down -** Processing line: ~ return 1 if self.up~ + return +** Processing line: ~ end~ - Inside source: true *** True Line Result - return 1 if self.up -** Processing line: ~ return -1 if self.down~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return -1 if self.down -** Processing line: ~ return 0~ + +** Processing line: ~ log_lines.each do |l|~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + log_lines.each do |l| +** Processing line: ~ @log.shift if @log.length > @max_log_lines~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @log.shift if @log.length > @max_log_lines +** Processing line: ~ @log << l~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + @log << l +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def truthy_keys~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def truthy_keys -** Processing line: ~ get(all).find_all { |_, v| v }~ + +** Processing line: ~ @last_log_lines_count = 1~ - Inside source: true *** True Line Result - get(all).find_all { |_, v| v } -** Processing line: ~ .map { |k, _| k.to_sym }~ + @last_log_lines_count = 1 +** Processing line: ~ @last_log_lines = log_lines~ - Inside source: true *** True Line Result - .map { |k, _| k.to_sym } + @last_log_lines = log_lines +** Processing line: ~ nil~ +- Inside source: true +*** True Line Result + nil ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -88937,62 +89448,74 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def ready?~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def all? keys~ + def ready? +** Processing line: ~ visible? && @toggled_at.elapsed?(@animation_duration, Kernel.global_tick_count)~ - Inside source: true *** True Line Result - def all? keys -** Processing line: ~ values = get(keys.map { |k| k.without_ending_bang })~ + visible? && @toggled_at.elapsed?(@animation_duration, Kernel.global_tick_count) +** Processing line: ~ end~ - Inside source: true *** True Line Result - values = get(keys.map { |k| k.without_ending_bang }) -** Processing line: ~ all_true = values.all? do |k, v|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - all_true = values.all? do |k, v| -** Processing line: ~ v~ + +** Processing line: ~ def hidden?~ - Inside source: true *** True Line Result - v -** Processing line: ~ end~ + def hidden? +** Processing line: ~ !@visible~ - Inside source: true *** True Line Result - end + !@visible +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if all_true~ +** Processing line: ~ def visible?~ - Inside source: true *** True Line Result - if all_true -** Processing line: ~ keys.each do |k|~ + def visible? +** Processing line: ~ @visible~ - Inside source: true *** True Line Result - keys.each do |k| -** Processing line: ~ clear_key k if k.end_with_bang?~ + @visible +** Processing line: ~ end~ - Inside source: true *** True Line Result - clear_key k if k.end_with_bang? -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # @gtk +** Processing line: ~ def show reason = nil~ - Inside source: true *** True Line Result - -** Processing line: ~ all_true~ + def show reason = nil +** Processing line: ~ @shown_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - all_true + @shown_at = Kernel.global_tick_count +** Processing line: ~ @show_reason = reason~ +- Inside source: true +*** True Line Result + @show_reason = reason +** Processing line: ~ toggle if hidden?~ +- Inside source: true +*** True Line Result + toggle if hidden? ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89005,58 +89528,66 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # @gtk -** Processing line: ~ def any? keys~ +** Processing line: ~ def hide~ - Inside source: true *** True Line Result - def any? keys -** Processing line: ~ values = get(keys.map { |k| k.without_ending_bang })~ + def hide +** Processing line: ~ if visible?~ - Inside source: true *** True Line Result - values = get(keys.map { |k| k.without_ending_bang }) -** Processing line: ~ any_true = values.any? do |k, v|~ + if visible? +** Processing line: ~ toggle~ - Inside source: true *** True Line Result - any_true = values.any? do |k, v| -** Processing line: ~ v~ + toggle +** Processing line: ~ @archived_log += @log~ - Inside source: true *** True Line Result - v -** Processing line: ~ end~ + @archived_log += @log +** Processing line: ~ if @archived_log.length > @max_log_lines~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if @archived_log.length > @max_log_lines +** Processing line: ~ @archived_log = @archived_log.drop(@archived_log.length - @max_log_lines)~ - Inside source: true *** True Line Result - -** Processing line: ~ if any_true~ + @archived_log = @archived_log.drop(@archived_log.length - @max_log_lines) +** Processing line: ~ end~ - Inside source: true *** True Line Result - if any_true -** Processing line: ~ keys.each do |k|~ + end +** Processing line: ~ @log.clear~ - Inside source: true *** True Line Result - keys.each do |k| -** Processing line: ~ clear_key k if k.end_with_bang?~ + @log.clear +** Processing line: ~ @show_reason = nil~ - Inside source: true *** True Line Result - clear_key k if k.end_with_bang? -** Processing line: ~ end~ + @show_reason = nil +** Processing line: ~ clear_toast~ - Inside source: true *** True Line Result - end + clear_toast ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ any_true~ +** Processing line: ~ def close~ - Inside source: true *** True Line Result - any_true + def close +** Processing line: ~ hide~ +- Inside source: true +*** True Line Result + hide ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89065,22 +89596,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ def clear_key key~ +** Processing line: ~ def clear_toast~ - Inside source: true *** True Line Result - def clear_key key -** Processing line: ~ @scrubbed_ivars = nil~ + def clear_toast +** Processing line: ~ @toasted_at = nil~ - Inside source: true *** True Line Result - @scrubbed_ivars = nil -** Processing line: ~ self.instance_variable_set("@#{key.without_ending_bang}", false)~ + @toasted_at = nil +** Processing line: ~ @toast_duration = 0~ - Inside source: true *** True Line Result - self.instance_variable_set("@#{key.without_ending_bang}", false) + @toast_duration = 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89089,166 +89616,158 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ def all~ +** Processing line: ~ def toggle~ - Inside source: true *** True Line Result - def all -** Processing line: ~ @scrubbed_ivars ||= self.instance_variables~ + def toggle +** Processing line: ~ @visible = !@visible~ - Inside source: true *** True Line Result - @scrubbed_ivars ||= self.instance_variables -** Processing line: ~ .reject { |i| i == :@all || i == :@scrubbed_ivars }~ + @visible = !@visible +** Processing line: ~ @toggled_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - .reject { |i| i == :@all || i == :@scrubbed_ivars } -** Processing line: ~ .map { |i| i.to_s.gsub("@", "") }~ + @toggled_at = Kernel.global_tick_count +** Processing line: ~ end~ - Inside source: true *** True Line Result - .map { |i| i.to_s.gsub("@", "") } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ get(@scrubbed_ivars).map { |k, _| k }~ +** Processing line: ~ def currently_toasting?~ - Inside source: true *** True Line Result - get(@scrubbed_ivars).map { |k, _| k } -** Processing line: ~ end~ + def currently_toasting? +** Processing line: ~ return false if hidden?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return false if hidden? +** Processing line: ~ return false unless @show_reason == :toast~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + return false unless @show_reason == :toast +** Processing line: ~ return false unless @toasted_at~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def get collection~ + return false unless @toasted_at +** Processing line: ~ return false if @toasted_at.elapsed?(5.seconds, Kernel.global_tick_count)~ - Inside source: true *** True Line Result - def get collection -** Processing line: ~ return [] if collection.length == 0~ + return false if @toasted_at.elapsed?(5.seconds, Kernel.global_tick_count) +** Processing line: ~ return true~ - Inside source: true *** True Line Result - return [] if collection.length == 0 -** Processing line: ~ collection.map do |m|~ + return true +** Processing line: ~ end~ - Inside source: true *** True Line Result - collection.map do |m| -** Processing line: ~ if m.end_with_bang?~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - if m.end_with_bang? -** Processing line: ~ clear_after_return = true~ + +** Processing line: ~ def toast_extended id = nil, duration = nil, *messages~ - Inside source: true *** True Line Result - clear_after_return = true -** Processing line: ~ end~ + def toast_extended id = nil, duration = nil, *messages +** Processing line: ~ if !id.is_a?(Symbol)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if !id.is_a?(Symbol) +** Processing line: ~ raise <<-S~ - Inside source: true *** True Line Result - -** Processing line: ~ value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ + raise <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) -** Processing line: ~ clear_key m if clear_after_return~ + * ERROR: +** Processing line: ~ args.gtk.console.toast has the following signature:~ - Inside source: true *** True Line Result - clear_key m if clear_after_return -** Processing line: ~ [m.without_ending_bang, value]~ + args.gtk.console.toast has the following signature: +** Processing line: ~~ - Inside source: true *** True Line Result - [m.without_ending_bang, value] -** Processing line: ~ end~ + +** Processing line: ~ def toast id, *messages~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def toast id, *messages +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ The id property uniquely defines the message and must be~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def set collection, value = true~ + The id property uniquely defines the message and must be +** Processing line: ~ a symbol.~ - Inside source: true *** True Line Result - def set collection, value = true -** Processing line: ~ return if collection.length == 0~ + a symbol. +** Processing line: ~~ - Inside source: true *** True Line Result - return if collection.length == 0 -** Processing line: ~ @scrubbed_ivars = nil~ + +** Processing line: ~ After that, you can provide all the objects you want to~ - Inside source: true *** True Line Result - @scrubbed_ivars = nil -** Processing line: ~ value = Kernel.tick_count if value~ + After that, you can provide all the objects you want to +** Processing line: ~ look at.~ - Inside source: true *** True Line Result - value = Kernel.tick_count if value + look at. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ collection.each do |m|~ +** Processing line: ~ Example:~ - Inside source: true *** True Line Result - collection.each do |m| -** Processing line: ~ self.instance_variable_set("@#{m.to_s}".to_sym, value)~ + Example: +** Processing line: ~~ - Inside source: true *** True Line Result - self.instance_variable_set("@#{m.to_s}".to_sym, value) -** Processing line: ~ rescue Exception => e~ + +** Processing line: ~ args.gtk.console.toast :say_hello,~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise e, <<-S~ + args.gtk.console.toast :say_hello, +** Processing line: ~ \"Hello world.\",~ - Inside source: true *** True Line Result - raise e, <<-S -** Processing line: ~ * ERROR:~ + \"Hello world.\", +** Processing line: ~ args.state.tick_count~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ Attempted to set the a key on the DragonRuby GTK's Keyboard data~ + args.state.tick_count +** Processing line: ~~ - Inside source: true *** True Line Result - Attempted to set the a key on the DragonRuby GTK's Keyboard data -** Processing line: ~ structure, but the property isn't available for raw_key #{raw_key} #{m}.~ + +** Processing line: ~ Toast messages autohide after 5 seconds.~ - Inside source: true *** True Line Result - structure, but the property isn't available for raw_key #{raw_key} #{m}. + Toast messages autohide after 5 seconds. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ You should contact DragonRuby and tell them to associate the raw_key #{raw_key}~ -- Inside source: true -*** True Line Result - You should contact DragonRuby and tell them to associate the raw_key #{raw_key} -** Processing line: ~ with a friendly property name (we are open to suggestions if you have any).~ +** Processing line: ~ If you need to look at something for longer, use~ - Inside source: true *** True Line Result - with a friendly property name (we are open to suggestions if you have any). -** Processing line: ~ [GTK::KeyboardKeys#set, GTK::KeyboardKeys#char_to_method]~ + If you need to look at something for longer, use +** Processing line: ~ args.gtk.console.perma_toast instead (which you can manually dismiss).~ - Inside source: true *** True Line Result - [GTK::KeyboardKeys#set, GTK::KeyboardKeys#char_to_method] + args.gtk.console.perma_toast instead (which you can manually dismiss). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -89261,94 +89780,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def method_missing m, *args~ +** Processing line: ~ return if currently_toasting?~ - Inside source: true *** True Line Result - def method_missing m, *args -** Processing line: ~ begin~ + return if currently_toasting? +** Processing line: ~ return if @toast_ids.include? id~ - Inside source: true *** True Line Result - begin -** Processing line: ~ define_singleton_method(m) do~ + return if @toast_ids.include? id +** Processing line: ~ @toasted_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - define_singleton_method(m) do -** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ + @toasted_at = Kernel.global_tick_count +** Processing line: ~ log_once_info :perma_toast_tip, "Use console.perma_toast to show the toast for longer."~ - Inside source: true *** True Line Result - r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) -** Processing line: ~ clear_key m~ + log_once_info :perma_toast_tip, "Use console.perma_toast to show the toast for longer." +** Processing line: ~ dwim_duration = 5.seconds~ - Inside source: true *** True Line Result - clear_key m -** Processing line: ~ return r~ + dwim_duration = 5.seconds +** Processing line: ~ addtext "* toast :#{id}"~ - Inside source: true *** True Line Result - return r -** Processing line: ~ end~ + addtext "* toast :#{id}" +** Processing line: ~ puts "* TOAST: :#{id}"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + puts "* TOAST: :#{id}" +** Processing line: ~ messages.each do |message|~ - Inside source: true *** True Line Result - -** Processing line: ~ return self.send m~ + messages.each do |message| +** Processing line: ~ lines = message.to_s.wrapped_lines(self.console_text_width)~ - Inside source: true *** True Line Result - return self.send m -** Processing line: ~ rescue Exception => e~ + lines = message.to_s.wrapped_lines(self.console_text_width) +** Processing line: ~ dwim_duration += lines.length.seconds~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ log_important "#{e}"~ + dwim_duration += lines.length.seconds +** Processing line: ~ addtext "** #{message}"~ - Inside source: true *** True Line Result - log_important "#{e}" -** Processing line: ~ end~ + addtext "** #{message}" +** Processing line: ~ puts "** #{message}"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + puts "** #{message}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ raise <<-S~ + end +** Processing line: ~ show :toast~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + show :toast +** Processing line: ~ @toast_duration += duration || dwim_duration~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ There is no member on the keyboard called #{m}. Here is a to_s representation of what's available:~ + @toast_duration += duration || dwim_duration +** Processing line: ~ @toast_ids << id~ - Inside source: true *** True Line Result - There is no member on the keyboard called #{m}. Here is a to_s representation of what's available: -** Processing line: ~~ + @toast_ids << id +** Processing line: ~ set_command "$gtk.console.hide"~ - Inside source: true *** True Line Result - -** Processing line: ~ #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")}~ + set_command "$gtk.console.hide" +** Processing line: ~ end~ - Inside source: true *** True Line Result - #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")} + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ S~ +** Processing line: ~ def perma_toast id = nil, messages~ - Inside source: true *** True Line Result - S + def perma_toast id = nil, messages +** Processing line: ~ toast_extended id, 600.seconds, *messages~ +- Inside source: true +*** True Line Result + toast_extended id, 600.seconds, *messages ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89357,242 +89876,246 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ -- Inside source: true -*** True Line Result - def serialize -** Processing line: ~ hash = super~ -- Inside source: true -*** True Line Result - hash = super -** Processing line: ~ hash.delete(:scrubbed_ivars)~ -- Inside source: true -*** True Line Result - hash.delete(:scrubbed_ivars) -** Processing line: ~ hash[:truthy_keys] = self.truthy_keys~ +** Processing line: ~ def toast id = nil, *messages~ - Inside source: true *** True Line Result - hash[:truthy_keys] = self.truthy_keys -** Processing line: ~ hash~ + def toast id = nil, *messages +** Processing line: ~ toast_extended id, nil, *messages~ - Inside source: true *** True Line Result - hash + toast_extended id, nil, *messages ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def console_toggle_keys~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def console_toggle_keys +** Processing line: ~ [~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + [ +** Processing line: ~ :backtick!,~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ # @gtk~ + :backtick!, +** Processing line: ~ :tilde!,~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ class Keyboard~ + :tilde!, +** Processing line: ~ :superscript_two!,~ - Inside source: true *** True Line Result - class Keyboard -** Processing line: ~~ + :superscript_two!, +** Processing line: ~ :section_sign!,~ - Inside source: true *** True Line Result - -** Processing line: ~ # @return [KeyboardKeys]~ + :section_sign!, +** Processing line: ~ :ordinal_indicator!,~ - Inside source: true *** True Line Result - # @return [KeyboardKeys] -** Processing line: ~ # @gtk~ + :ordinal_indicator!, +** Processing line: ~ :circumflex!,~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :key_up~ + :circumflex!, +** Processing line: ~ ]~ - Inside source: true *** True Line Result - attr_accessor :key_up + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [KeyboardKeys]~ +** Processing line: ~ def console_toggle_key_down? args~ - Inside source: true *** True Line Result - # @return [KeyboardKeys] -** Processing line: ~ # @gtk~ + def console_toggle_key_down? args +** Processing line: ~ args.inputs.keyboard.key_down.any? console_toggle_keys~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :key_held~ + args.inputs.keyboard.key_down.any? console_toggle_keys +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :key_held + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [KeyboardKeys]~ +** Processing line: ~ def eval_the_set_command~ - Inside source: true *** True Line Result - # @return [KeyboardKeys] -** Processing line: ~ # @gtk~ + def eval_the_set_command +** Processing line: ~ cmd = current_input_str.strip~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :key_down~ + cmd = current_input_str.strip +** Processing line: ~ if cmd.length != 0~ - Inside source: true *** True Line Result - attr_accessor :key_down + if cmd.length != 0 +** Processing line: ~ @log_offset = 0~ +- Inside source: true +*** True Line Result + @log_offset = 0 +** Processing line: ~ prompt.clear~ +- Inside source: true +*** True Line Result + prompt.clear ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [Boolean]~ +** Processing line: ~ @command_history.pop while @command_history.length >= @max_history~ - Inside source: true *** True Line Result - # @return [Boolean] -** Processing line: ~ # @gtk~ + @command_history.pop while @command_history.length >= @max_history +** Processing line: ~ @command_history.unshift cmd~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :has_focus~ + @command_history.unshift cmd +** Processing line: ~ @command_history_index = -1~ - Inside source: true *** True Line Result - attr_accessor :has_focus + @command_history_index = -1 +** Processing line: ~ @nonhistory_input = ''~ +- Inside source: true +*** True Line Result + @nonhistory_input = '' ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize~ +** Processing line: ~ if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa'~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @key_up = KeyboardKeys.new~ + if cmd == 'quit' || cmd == ':wq' || cmd == ':q!' || cmd == ':q' || cmd == ':wqa' +** Processing line: ~ $gtk.request_quit~ - Inside source: true *** True Line Result - @key_up = KeyboardKeys.new -** Processing line: ~ @key_held = KeyboardKeys.new~ + $gtk.request_quit +** Processing line: ~ else~ - Inside source: true *** True Line Result - @key_held = KeyboardKeys.new -** Processing line: ~ @key_down = KeyboardKeys.new~ + else +** Processing line: ~ puts "-> #{cmd}"~ - Inside source: true *** True Line Result - @key_down = KeyboardKeys.new -** Processing line: ~ @has_focus = false~ + puts "-> #{cmd}" +** Processing line: ~ begin~ - Inside source: true *** True Line Result - @has_focus = false -** Processing line: ~ end~ + begin +** Processing line: ~ @last_command = cmd~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @last_command = cmd +** Processing line: ~ Kernel.eval("$results = (#{cmd})")~ - Inside source: true *** True Line Result - -** Processing line: ~ def p~ + Kernel.eval("$results = (#{cmd})") +** Processing line: ~ if $results.nil?~ - Inside source: true *** True Line Result - def p -** Processing line: ~ @key_down.p || @key_held.p~ + if $results.nil? +** Processing line: ~ puts "=> nil"~ - Inside source: true *** True Line Result - @key_down.p || @key_held.p -** Processing line: ~ end~ + puts "=> nil" +** Processing line: ~ elsif $results == :console_silent_eval~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif $results == :console_silent_eval +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # The left arrow or "a" was pressed.~ + else +** Processing line: ~ puts "=> #{$results}"~ - Inside source: true *** True Line Result - # The left arrow or "a" was pressed. -** Processing line: ~ #~ + puts "=> #{$results}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Boolean]~ + end +** Processing line: ~ @last_command_errored = false~ - Inside source: true *** True Line Result - # @return [Boolean] -** Processing line: ~ def left~ + @last_command_errored = false +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - def left -** Processing line: ~ @key_up.left || @key_held.left || a~ + rescue Exception => e +** Processing line: ~ string_e = "#{e}"~ - Inside source: true *** True Line Result - @key_up.left || @key_held.left || a -** Processing line: ~ end~ + string_e = "#{e}" +** Processing line: ~ puts "* EXCEPTION: #{e}"~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + puts "* EXCEPTION: #{e}" +** Processing line: ~ log "* EXCEPTION: #{e}"~ - Inside source: true *** True Line Result - -** Processing line: ~ # The right arrow or "d" was pressed.~ + log "* EXCEPTION: #{e}" +** Processing line: ~ @last_command_errored = true~ - Inside source: true *** True Line Result - # The right arrow or "d" was pressed. -** Processing line: ~ #~ + @last_command_errored = true +** Processing line: ~ if (string_e.include? "wrong number of arguments")~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Boolean]~ + if (string_e.include? "wrong number of arguments") +** Processing line: ~ method_name = (string_e.split ":")[0].gsub "'", ""~ - Inside source: true *** True Line Result - # @return [Boolean] -** Processing line: ~ def right~ + method_name = (string_e.split ":")[0].gsub "'", "" +** Processing line: ~ results = (Kernel.docs_search method_name).strip~ - Inside source: true *** True Line Result - def right -** Processing line: ~ @key_up.right || @key_held.right || d~ + results = (Kernel.docs_search method_name).strip +** Processing line: ~ if !results.include? "* DOCS: No results found."~ - Inside source: true *** True Line Result - @key_up.right || @key_held.right || d -** Processing line: ~ end~ + if !results.include? "* DOCS: No results found." +** Processing line: ~ puts results~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + puts results +** Processing line: ~ log results~ - Inside source: true *** True Line Result - -** Processing line: ~ # The up arrow or "w" was pressed.~ + log results +** Processing line: ~ end~ - Inside source: true *** True Line Result - # The up arrow or "w" was pressed. -** Processing line: ~ #~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Boolean]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Boolean] -** Processing line: ~ def up~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def up -** Processing line: ~ @key_up.up || @key_held.up || w~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - @key_up.up || @key_held.up || w + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89601,26 +90124,22 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # The down arrow or "s" was pressed.~ -- Inside source: true -*** True Line Result - # The down arrow or "s" was pressed. -** Processing line: ~ #~ +** Processing line: ~ def inputs_scroll_up_full? args~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Boolean]~ + def inputs_scroll_up_full? args +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - # @return [Boolean] -** Processing line: ~ def down~ + return false if @disabled +** Processing line: ~ args.inputs.keyboard.key_down.pageup ||~ - Inside source: true *** True Line Result - def down -** Processing line: ~ @key_up.down || @key_held.down || s~ + args.inputs.keyboard.key_down.pageup || +** Processing line: ~ (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control)~ - Inside source: true *** True Line Result - @key_up.down || @key_held.down || s + (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89629,34 +90148,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Clear all current key presses.~ +** Processing line: ~ def scroll_to_bottom~ - Inside source: true *** True Line Result - # Clear all current key presses. -** Processing line: ~ #~ + def scroll_to_bottom +** Processing line: ~ @log_offset = 0~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + @log_offset = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def clear~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ @key_up.clear~ + +** Processing line: ~ def scroll_up_full~ - Inside source: true *** True Line Result - @key_up.clear -** Processing line: ~ @key_held.clear~ + def scroll_up_full +** Processing line: ~ @log_offset += lines_on_one_page~ - Inside source: true *** True Line Result - @key_held.clear -** Processing line: ~ @key_down.clear~ + @log_offset += lines_on_one_page +** Processing line: ~ @log_offset = @log.size if @log_offset > @log.size~ - Inside source: true *** True Line Result - @key_down.clear + @log_offset = @log.size if @log_offset > @log.size ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89665,58 +90184,62 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ def inputs_scroll_up_half? args~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ {~ + def inputs_scroll_up_half? args +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - { -** Processing line: ~ key_up: @key_up.serialize,~ + return false if @disabled +** Processing line: ~ args.inputs.keyboard.ctrl_u~ - Inside source: true *** True Line Result - key_up: @key_up.serialize, -** Processing line: ~ key_held: @key_held.serialize,~ + args.inputs.keyboard.ctrl_u +** Processing line: ~ end~ - Inside source: true *** True Line Result - key_held: @key_held.serialize, -** Processing line: ~ key_down: @key_down.serialize,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - key_down: @key_down.serialize, -** Processing line: ~ has_focus: @has_focus~ + +** Processing line: ~ def scroll_up_half~ - Inside source: true *** True Line Result - has_focus: @has_focus -** Processing line: ~ }~ + def scroll_up_half +** Processing line: ~ @log_offset += lines_on_one_page.idiv(2)~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + @log_offset += lines_on_one_page.idiv(2) +** Processing line: ~ @log_offset = @log.size if @log_offset > @log.size~ - Inside source: true *** True Line Result - end -** Processing line: ~ alias_method :inspect, :serialize~ + @log_offset = @log.size if @log_offset > @log.size +** Processing line: ~ end~ - Inside source: true *** True Line Result - alias_method :inspect, :serialize + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [String]~ +** Processing line: ~ def inputs_scroll_down_full? args~ - Inside source: true *** True Line Result - # @return [String] -** Processing line: ~ def to_s~ + def inputs_scroll_down_full? args +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - def to_s -** Processing line: ~ serialize.to_s~ + return false if @disabled +** Processing line: ~ args.inputs.keyboard.key_down.pagedown ||~ - Inside source: true *** True Line Result - serialize.to_s + args.inputs.keyboard.key_down.pagedown || +** Processing line: ~ (args.inputs.keyboard.key_up.f && args.inputs.keyboard.key_up.control)~ +- Inside source: true +*** True Line Result + (args.inputs.keyboard.key_up.f && args.inputs.keyboard.key_up.control) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89725,174 +90248,218 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def key~ +** Processing line: ~ def scroll_down_full~ - Inside source: true *** True Line Result - def key -** Processing line: ~ {~ + def scroll_down_full +** Processing line: ~ @log_offset -= lines_on_one_page~ - Inside source: true *** True Line Result - { -** Processing line: ~ down: @key_down.truthy_keys,~ + @log_offset -= lines_on_one_page +** Processing line: ~ @log_offset = 0 if @log_offset < 0~ - Inside source: true *** True Line Result - down: @key_down.truthy_keys, -** Processing line: ~ held: @key_held.truthy_keys,~ + @log_offset = 0 if @log_offset < 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - held: @key_held.truthy_keys, -** Processing line: ~ down_or_held: (@key_down.truthy_keys + @key_held.truthy_keys).uniq,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - down_or_held: (@key_down.truthy_keys + @key_held.truthy_keys).uniq, -** Processing line: ~ up: @key_up.truthy_keys,~ + +** Processing line: ~ def inputs_scroll_down_half? args~ - Inside source: true *** True Line Result - up: @key_up.truthy_keys, -** Processing line: ~ }~ + def inputs_scroll_down_half? args +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + return false if @disabled +** Processing line: ~ args.inputs.keyboard.ctrl_d~ - Inside source: true *** True Line Result - end -** Processing line: ~ alias_method :keys, :key~ + args.inputs.keyboard.ctrl_d +** Processing line: ~ end~ - Inside source: true *** True Line Result - alias_method :keys, :key + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ include DirectionalInputHelperMethods~ +** Processing line: ~ def inputs_clear_command? args~ - Inside source: true *** True Line Result - include DirectionalInputHelperMethods -** Processing line: ~ end~ + def inputs_clear_command? args +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + return false if @disabled +** Processing line: ~ args.inputs.keyboard.escape || args.inputs.keyboard.ctrl_g~ - Inside source: true *** True Line Result - end + args.inputs.keyboard.escape || args.inputs.keyboard.ctrl_g +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ +** Processing line: ~ def scroll_down_half~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class MousePoint~ + def scroll_down_half +** Processing line: ~ @log_offset -= lines_on_one_page.idiv(2)~ - Inside source: true *** True Line Result - class MousePoint -** Processing line: ~ include GTK::Geometry~ + @log_offset -= lines_on_one_page.idiv(2) +** Processing line: ~ @log_offset = 0 if @log_offset < 0~ - Inside source: true *** True Line Result - include GTK::Geometry + @log_offset = 0 if @log_offset < 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def mouse_wheel_scroll args~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :x, :y, :point, :created_at, :global_created_at~ + def mouse_wheel_scroll args +** Processing line: ~ @inertia ||= 0~ - Inside source: true *** True Line Result - attr_accessor :x, :y, :point, :created_at, :global_created_at + @inertia ||= 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def initialize x, y~ +** Processing line: ~ if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0~ - Inside source: true *** True Line Result - def initialize x, y -** Processing line: ~ @x = x~ + if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 +** Processing line: ~ @inertia = 1~ - Inside source: true *** True Line Result - @x = x -** Processing line: ~ @y = y~ + @inertia = 1 +** Processing line: ~ elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0~ - Inside source: true *** True Line Result - @y = y -** Processing line: ~ @point = [x, y]~ + elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 +** Processing line: ~ @inertia = -1~ - Inside source: true *** True Line Result - @point = [x, y] -** Processing line: ~ @created_at = Kernel.tick_count~ + @inertia = -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - @created_at = Kernel.tick_count -** Processing line: ~ @global_created_at = Kernel.global_tick_count~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @global_created_at = Kernel.global_tick_count -** Processing line: ~ end~ + +** Processing line: ~ if args.inputs.mouse.click~ - Inside source: true *** True Line Result - end + if args.inputs.mouse.click +** Processing line: ~ @inertia = 0~ +- Inside source: true +*** True Line Result + @inertia = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def w; 0; end~ +** Processing line: ~ return if @inertia == 0~ - Inside source: true *** True Line Result - def w; 0; end -** Processing line: ~ def h; 0; end~ + return if @inertia == 0 +** Processing line: ~~ - Inside source: true *** True Line Result - def h; 0; end -** Processing line: ~ def left; x; end~ + +** Processing line: ~ if @inertia != 0~ - Inside source: true *** True Line Result - def left; x; end -** Processing line: ~ def right; x; end~ + if @inertia != 0 +** Processing line: ~ @inertia = (@inertia * 0.7)~ - Inside source: true *** True Line Result - def right; x; end -** Processing line: ~ def top; y; end~ + @inertia = (@inertia * 0.7) +** Processing line: ~ if @inertia > 0~ - Inside source: true *** True Line Result - def top; y; end -** Processing line: ~ def bottom; y; end~ + if @inertia > 0 +** Processing line: ~ @log_offset -= 1~ - Inside source: true *** True Line Result - def bottom; y; end + @log_offset -= 1 +** Processing line: ~ elsif @inertia < 0~ +- Inside source: true +*** True Line Result + elsif @inertia < 0 +** Processing line: ~ @log_offset += 1~ +- Inside source: true +*** True Line Result + @log_offset += 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def created_at_elapsed~ +** Processing line: ~ if @inertia.abs < 0.01~ - Inside source: true *** True Line Result - def created_at_elapsed -** Processing line: ~ @created_at.elapsed_time~ + if @inertia.abs < 0.01 +** Processing line: ~ @inertia = 0~ - Inside source: true *** True Line Result - @created_at.elapsed_time -** Processing line: ~ end~ + @inertia = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_hash~ +** Processing line: ~ if @log_offset > @log.size~ - Inside source: true *** True Line Result - def to_hash -** Processing line: ~ serialize~ + if @log_offset > @log.size +** Processing line: ~ @log_offset = @log.size~ - Inside source: true *** True Line Result - serialize + @log_offset = @log.size +** Processing line: ~ elsif @log_offset < 0~ +- Inside source: true +*** True Line Result + elsif @log_offset < 0 +** Processing line: ~ @log_offset = 0~ +- Inside source: true +*** True Line Result + @log_offset = 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -89901,234 +90468,238 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ -- Inside source: true -*** True Line Result - def serialize -** Processing line: ~ {~ +** Processing line: ~ def process_inputs args~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: @x,~ + def process_inputs args +** Processing line: ~ if console_toggle_key_down? args~ - Inside source: true *** True Line Result - x: @x, -** Processing line: ~ y: @y,~ + if console_toggle_key_down? args +** Processing line: ~ args.inputs.text.clear~ - Inside source: true *** True Line Result - y: @y, -** Processing line: ~ created_at: @created_at,~ + args.inputs.text.clear +** Processing line: ~ toggle~ - Inside source: true *** True Line Result - created_at: @created_at, -** Processing line: ~ global_created_at: @global_created_at~ + toggle +** Processing line: ~ end~ - Inside source: true *** True Line Result - global_created_at: @global_created_at -** Processing line: ~ }~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - } -** Processing line: ~ end~ + +** Processing line: ~ return unless visible?~ - Inside source: true *** True Line Result - end + return unless visible? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def inspect~ +** Processing line: ~ args.inputs.text.each { |str| prompt << str }~ - Inside source: true *** True Line Result - def inspect -** Processing line: ~ serialize.to_s~ + args.inputs.text.each { |str| prompt << str } +** Processing line: ~ args.inputs.text.clear~ - Inside source: true *** True Line Result - serialize.to_s -** Processing line: ~ end~ + args.inputs.text.clear +** Processing line: ~ mouse_wheel_scroll args~ - Inside source: true *** True Line Result - end + mouse_wheel_scroll args ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_s~ +** Processing line: ~ @log_offset = 0 if @log_offset < 0~ - Inside source: true *** True Line Result - def to_s -** Processing line: ~ serialize.to_s~ + @log_offset = 0 if @log_offset < 0 +** Processing line: ~~ - Inside source: true *** True Line Result - serialize.to_s -** Processing line: ~ end~ + +** Processing line: ~ if args.inputs.keyboard.key_down.enter~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if args.inputs.keyboard.key_down.enter +** Processing line: ~ eval_the_set_command~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + eval_the_set_command +** Processing line: ~ elsif args.inputs.keyboard.key_down.v~ - Inside source: true *** True Line Result - -** Processing line: ~ # Provides access to the mouse.~ + elsif args.inputs.keyboard.key_down.v +** Processing line: ~ if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta~ - Inside source: true *** True Line Result - # Provides access to the mouse. -** Processing line: ~ #~ + if args.inputs.keyboard.key_down.control || args.inputs.keyboard.key_down.meta +** Processing line: ~ prompt << $gtk.ffi_misc.getclipboard~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + prompt << $gtk.ffi_misc.getclipboard +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ class Mouse~ + end +** Processing line: ~ elsif args.inputs.keyboard.key_down.up~ - Inside source: true *** True Line Result - class Mouse -** Processing line: ~~ + elsif args.inputs.keyboard.key_down.up +** Processing line: ~ if @command_history_index == -1~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + if @command_history_index == -1 +** Processing line: ~ @nonhistory_input = current_input_str~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :moved,~ + @nonhistory_input = current_input_str +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :moved, -** Processing line: ~ :moved_at,~ + end +** Processing line: ~ if @command_history_index < (@command_history.length - 1)~ - Inside source: true *** True Line Result - :moved_at, -** Processing line: ~ :global_moved_at,~ + if @command_history_index < (@command_history.length - 1) +** Processing line: ~ @command_history_index += 1~ - Inside source: true *** True Line Result - :global_moved_at, -** Processing line: ~ :up, :has_focus,~ + @command_history_index += 1 +** Processing line: ~ self.current_input_str = @command_history[@command_history_index].dup~ - Inside source: true *** True Line Result - :up, :has_focus, -** Processing line: ~ :button_bits, :button_left,~ + self.current_input_str = @command_history[@command_history_index].dup +** Processing line: ~ end~ - Inside source: true *** True Line Result - :button_bits, :button_left, -** Processing line: ~ :button_middle, :button_right,~ + end +** Processing line: ~ elsif args.inputs.keyboard.key_down.down~ - Inside source: true *** True Line Result - :button_middle, :button_right, -** Processing line: ~ :button_x1, :button_x2,~ + elsif args.inputs.keyboard.key_down.down +** Processing line: ~ if @command_history_index == 0~ - Inside source: true *** True Line Result - :button_x1, :button_x2, -** Processing line: ~ :wheel~ + if @command_history_index == 0 +** Processing line: ~ @command_history_index = -1~ - Inside source: true *** True Line Result - :wheel -** Processing line: ~~ + @command_history_index = -1 +** Processing line: ~ self.current_input_str = @nonhistory_input~ - Inside source: true *** True Line Result - -** Processing line: ~ attr_accessor :click~ + self.current_input_str = @nonhistory_input +** Processing line: ~ @nonhistory_input = ''~ - Inside source: true *** True Line Result - attr_accessor :click -** Processing line: ~ attr_accessor :previous_click~ + @nonhistory_input = '' +** Processing line: ~ elsif @command_history_index > 0~ - Inside source: true *** True Line Result - attr_accessor :previous_click -** Processing line: ~ attr_accessor :x~ + elsif @command_history_index > 0 +** Processing line: ~ @command_history_index -= 1~ - Inside source: true *** True Line Result - attr_accessor :x -** Processing line: ~ attr_accessor :y~ + @command_history_index -= 1 +** Processing line: ~ self.current_input_str = @command_history[@command_history_index].dup~ - Inside source: true *** True Line Result - attr_accessor :y -** Processing line: ~~ + self.current_input_str = @command_history[@command_history_index].dup +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize~ + end +** Processing line: ~ elsif inputs_scroll_up_full? args~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @x = 0~ + elsif inputs_scroll_up_full? args +** Processing line: ~ scroll_up_full~ - Inside source: true *** True Line Result - @x = 0 -** Processing line: ~ @y = 0~ + scroll_up_full +** Processing line: ~ elsif inputs_scroll_down_full? args~ - Inside source: true *** True Line Result - @y = 0 -** Processing line: ~ @has_focus = false~ + elsif inputs_scroll_down_full? args +** Processing line: ~ scroll_down_full~ - Inside source: true *** True Line Result - @has_focus = false -** Processing line: ~ @button_bits = 0~ + scroll_down_full +** Processing line: ~ elsif inputs_scroll_up_half? args~ - Inside source: true *** True Line Result - @button_bits = 0 -** Processing line: ~ @button_left = false~ + elsif inputs_scroll_up_half? args +** Processing line: ~ scroll_up_half~ - Inside source: true *** True Line Result - @button_left = false -** Processing line: ~ @button_middle = false~ + scroll_up_half +** Processing line: ~ elsif inputs_scroll_down_half? args~ - Inside source: true *** True Line Result - @button_middle = false -** Processing line: ~ @button_right = false~ + elsif inputs_scroll_down_half? args +** Processing line: ~ scroll_down_half~ - Inside source: true *** True Line Result - @button_right = false -** Processing line: ~ @button_x1 = false~ + scroll_down_half +** Processing line: ~ elsif inputs_clear_command? args~ - Inside source: true *** True Line Result - @button_x1 = false -** Processing line: ~ @button_x2 = false~ + elsif inputs_clear_command? args +** Processing line: ~ prompt.clear~ - Inside source: true *** True Line Result - @button_x2 = false -** Processing line: ~ clear~ + prompt.clear +** Processing line: ~ @command_history_index = -1~ - Inside source: true *** True Line Result - clear -** Processing line: ~ end~ + @command_history_index = -1 +** Processing line: ~ @nonhistory_input = ''~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @nonhistory_input = '' +** Processing line: ~ elsif args.inputs.keyboard.key_down.backspace || args.inputs.keyboard.key_down.delete~ - Inside source: true *** True Line Result - -** Processing line: ~ def point~ + elsif args.inputs.keyboard.key_down.backspace || args.inputs.keyboard.key_down.delete +** Processing line: ~ prompt.backspace~ - Inside source: true *** True Line Result - def point -** Processing line: ~ [@x, @y].point~ + prompt.backspace +** Processing line: ~ elsif args.inputs.keyboard.key_down.tab~ - Inside source: true *** True Line Result - [@x, @y].point -** Processing line: ~ end~ + elsif args.inputs.keyboard.key_down.tab +** Processing line: ~ prompt.autocomplete~ - Inside source: true *** True Line Result - end + prompt.autocomplete +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def inside_rect? rect~ +** Processing line: ~ args.inputs.keyboard.key_down.clear~ - Inside source: true *** True Line Result - def inside_rect? rect -** Processing line: ~ point.inside_rect? rect~ + args.inputs.keyboard.key_down.clear +** Processing line: ~ args.inputs.keyboard.key_up.clear~ - Inside source: true *** True Line Result - point.inside_rect? rect + args.inputs.keyboard.key_up.clear +** Processing line: ~ args.inputs.keyboard.key_held.clear~ +- Inside source: true +*** True Line Result + args.inputs.keyboard.key_held.clear ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90137,58 +90708,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ alias_method :position, :point~ +** Processing line: ~ def write_primitive_and_return_offset(args, left, y, str, archived: false)~ - Inside source: true *** True Line Result - alias_method :position, :point -** Processing line: ~~ + def write_primitive_and_return_offset(args, left, y, str, archived: false) +** Processing line: ~ if str.is_a?(Hash)~ - Inside source: true *** True Line Result - -** Processing line: ~ def clear~ + if str.is_a?(Hash) +** Processing line: ~ padding = 10~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ if @click~ + padding = 10 +** Processing line: ~ args.outputs.reserved << [left + 10, y + 5, str[:w], str[:h], str[:path]].sprite~ - Inside source: true *** True Line Result - if @click -** Processing line: ~ @previous_click = MousePoint.new @click.point.x, @click.point.y~ + args.outputs.reserved << [left + 10, y + 5, str[:w], str[:h], str[:path]].sprite +** Processing line: ~ return str[:h] + padding~ - Inside source: true *** True Line Result - @previous_click = MousePoint.new @click.point.x, @click.point.y -** Processing line: ~ @previous_click.created_at = @click.created_at~ + return str[:h] + padding +** Processing line: ~ else~ - Inside source: true *** True Line Result - @previous_click.created_at = @click.created_at -** Processing line: ~ @previous_click.global_created_at = @click.global_created_at~ + else +** Processing line: ~ write_line args, left, y, str, archived: archived~ - Inside source: true *** True Line Result - @previous_click.global_created_at = @click.global_created_at + write_line args, left, y, str, archived: archived +** Processing line: ~ return line_height_px~ +- Inside source: true +*** True Line Result + return line_height_px ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ @click = nil~ +** Processing line: ~ def write_line(args, left, y, str, archived: false)~ - Inside source: true *** True Line Result - @click = nil -** Processing line: ~ @up = nil~ + def write_line(args, left, y, str, archived: false) +** Processing line: ~ color = color_for_log_entry(str)~ - Inside source: true *** True Line Result - @up = nil -** Processing line: ~ @moved = nil~ + color = color_for_log_entry(str) +** Processing line: ~ color = color.mult_alpha(0.5) if archived~ - Inside source: true *** True Line Result - @moved = nil -** Processing line: ~ @wheel = nil~ + color = color.mult_alpha(0.5) if archived +** Processing line: ~~ - Inside source: true *** True Line Result - @wheel = nil + +** Processing line: ~ args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color)~ +- Inside source: true +*** True Line Result + args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90197,30 +90780,26 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def up~ -- Inside source: true -*** True Line Result - def up -** Processing line: ~ @up~ +** Processing line: ~ def should_tick?~ - Inside source: true *** True Line Result - @up -** Processing line: ~ end~ + def should_tick? +** Processing line: ~ return false if !@toggled_at~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return false if !@toggled_at +** Processing line: ~ return false if slide_progress == 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def down~ + return false if slide_progress == 0 +** Processing line: ~ return false if @disabled~ - Inside source: true *** True Line Result - def down -** Processing line: ~ @click~ + return false if @disabled +** Processing line: ~ return visible?~ - Inside source: true *** True Line Result - @click + return visible? ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90229,214 +90808,194 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ def render args~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ result = {}~ + def render args +** Processing line: ~ return if !@toggled_at~ - Inside source: true *** True Line Result - result = {} + return if !@toggled_at +** Processing line: ~ return if slide_progress == 0~ +- Inside source: true +*** True Line Result + return if slide_progress == 0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if @click~ +** Processing line: ~ @bottom = top - (h * slide_progress)~ - Inside source: true *** True Line Result - if @click -** Processing line: ~ result[:click] = @click.to_hash~ + @bottom = top - (h * slide_progress) +** Processing line: ~ args.outputs.reserved << [left, @bottom, w, h, *@background_color.mult_alpha(slide_progress)].solid~ - Inside source: true *** True Line Result - result[:click] = @click.to_hash -** Processing line: ~ result[:down] = @click.to_hash~ + args.outputs.reserved << [left, @bottom, w, h, *@background_color.mult_alpha(slide_progress)].solid +** Processing line: ~ args.outputs.reserved << [right.shift_left(110), @bottom.shift_up(630), 100, 100, @logo, 0, (80.0 * slide_progress).to_i].sprite~ - Inside source: true *** True Line Result - result[:down] = @click.to_hash -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end + args.outputs.reserved << [right.shift_left(110), @bottom.shift_up(630), 100, 100, @logo, 0, (80.0 * slide_progress).to_i].sprite ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ result[:up] = @up.to_hash if @up~ -- Inside source: true -*** True Line Result - result[:up] = @up.to_hash if @up -** Processing line: ~ result[:x] = @x~ +** Processing line: ~ y = @bottom + 2 # just give us a little padding at the bottom.~ - Inside source: true *** True Line Result - result[:x] = @x -** Processing line: ~ result[:y] = @y~ + y = @bottom + 2 # just give us a little padding at the bottom. +** Processing line: ~ prompt.render args, x: left.shift_right(10), y: y~ - Inside source: true *** True Line Result - result[:y] = @y -** Processing line: ~ result[:moved] = @moved~ + prompt.render args, x: left.shift_right(10), y: y +** Processing line: ~ y += line_height_px * 1.5~ - Inside source: true *** True Line Result - result[:moved] = @moved -** Processing line: ~ result[:moved_at] = @moved_at~ + y += line_height_px * 1.5 +** Processing line: ~ args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(slide_progress))~ - Inside source: true *** True Line Result - result[:moved_at] = @moved_at -** Processing line: ~ result[:has_focus] = @has_focus~ + args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(slide_progress)) +** Processing line: ~ y += line_height_px.to_f / 2.0~ - Inside source: true *** True Line Result - result[:has_focus] = @has_focus + y += line_height_px.to_f / 2.0 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ result~ -- Inside source: true -*** True Line Result - result -** Processing line: ~ end~ +** Processing line: ~ ((@log.size - @log_offset) - 1).downto(0) do |idx|~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + ((@log.size - @log_offset) - 1).downto(0) do |idx| +** Processing line: ~ offset_after_write = write_primitive_and_return_offset args, left, y, @log[idx]~ - Inside source: true *** True Line Result - -** Processing line: ~ def to_s~ + offset_after_write = write_primitive_and_return_offset args, left, y, @log[idx] +** Processing line: ~ y += offset_after_write~ - Inside source: true *** True Line Result - def to_s -** Processing line: ~ serialize.to_s~ + y += offset_after_write +** Processing line: ~ break if y > top~ - Inside source: true *** True Line Result - serialize.to_s -** Processing line: ~ end~ + break if y > top +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ alias_method :inspect, :to_s~ -- Inside source: true -*** True Line Result - alias_method :inspect, :to_s -** Processing line: ~ end~ +** Processing line: ~ # past log separator~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + # past log separator +** Processing line: ~ args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * slide_progress))~ - Inside source: true *** True Line Result - end + args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * slide_progress)) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ -- Inside source: true -*** True Line Result - module GTK -** Processing line: ~ # @gtk~ -- Inside source: true -*** True Line Result - # @gtk -** Processing line: ~ class Inputs~ +** Processing line: ~ y += line_height_px~ - Inside source: true *** True Line Result - class Inputs + y += line_height_px ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # A list of all controllers.~ +** Processing line: ~ ((@archived_log.size - @log_offset) - 1).downto(0) do |idx|~ - Inside source: true *** True Line Result - # A list of all controllers. -** Processing line: ~ #~ + ((@archived_log.size - @log_offset) - 1).downto(0) do |idx| +** Processing line: ~ offset_after_write = write_primitive_and_return_offset args, left, y, @archived_log[idx], archived: true~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Controller[]]~ + offset_after_write = write_primitive_and_return_offset args, left, y, @archived_log[idx], archived: true +** Processing line: ~ y += offset_after_write~ - Inside source: true *** True Line Result - # @return [Controller[]] -** Processing line: ~ # @gtk~ + y += offset_after_write +** Processing line: ~ break if y > top~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :controllers~ + break if y > top +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_reader :controllers + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [Keyboard]~ -- Inside source: true -*** True Line Result - # @return [Keyboard] -** Processing line: ~ # @gtk~ +** Processing line: ~ render_log_offset args~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :keyboard~ + render_log_offset args +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_reader :keyboard + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @return [Mouse]~ +** Processing line: ~ def render_log_offset args~ - Inside source: true *** True Line Result - # @return [Mouse] -** Processing line: ~ # @gtk~ + def render_log_offset args +** Processing line: ~ return if @log_offset <= 0~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_reader :mouse~ + return if @log_offset <= 0 +** Processing line: ~ args.outputs.reserved << font_style.label(~ - Inside source: true *** True Line Result - attr_reader :mouse -** Processing line: ~~ + args.outputs.reserved << font_style.label( +** Processing line: ~ x: right.shift_left(5),~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + x: right.shift_left(5), +** Processing line: ~ y: top.shift_down(5 + line_height_px),~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ attr_accessor :text, :history~ + y: top.shift_down(5 + line_height_px), +** Processing line: ~ text: "[#{@log_offset}/#{@log.size}]",~ - Inside source: true *** True Line Result - attr_accessor :text, :history -** Processing line: ~~ + text: "[#{@log_offset}/#{@log.size}]", +** Processing line: ~ color: @text_color,~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize~ + color: @text_color, +** Processing line: ~ alignment_enum: 2~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @controllers = [Controller.new, Controller.new]~ + alignment_enum: 2 +** Processing line: ~ )~ - Inside source: true *** True Line Result - @controllers = [Controller.new, Controller.new] -** Processing line: ~ @keyboard = Keyboard.new~ + ) +** Processing line: ~ end~ - Inside source: true *** True Line Result - @keyboard = Keyboard.new -** Processing line: ~ @mouse = Mouse.new~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @mouse = Mouse.new -** Processing line: ~ @text = []~ + +** Processing line: ~ def include_error_marker? text~ - Inside source: true *** True Line Result - @text = [] + def include_error_marker? text +** Processing line: ~ include_any_words?(text.gsub('OutputsDeprecated', ''), error_markers)~ +- Inside source: true +*** True Line Result + include_any_words?(text.gsub('OutputsDeprecated', ''), error_markers) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90445,18 +91004,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def up~ -- Inside source: true -*** True Line Result - def up -** Processing line: ~ keyboard.up ||~ +** Processing line: ~ def error_markers~ - Inside source: true *** True Line Result - keyboard.up || -** Processing line: ~ (controller_one && controller_one.up)~ + def error_markers +** Processing line: ~ ["exception", "error", "undefined method", "failed", "syntax", "deprecated"]~ - Inside source: true *** True Line Result - (controller_one && controller_one.up) + ["exception", "error", "undefined method", "failed", "syntax", "deprecated"] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90465,18 +91020,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def down~ -- Inside source: true -*** True Line Result - def down -** Processing line: ~ keyboard.down ||~ +** Processing line: ~ def include_subdued_markers? text~ - Inside source: true *** True Line Result - keyboard.down || -** Processing line: ~ (controller_one && controller_one.down)~ + def include_subdued_markers? text +** Processing line: ~ include_any_words? text, subdued_markers~ - Inside source: true *** True Line Result - (controller_one && controller_one.down) + include_any_words? text, subdued_markers ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90485,18 +91036,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def left~ -- Inside source: true -*** True Line Result - def left -** Processing line: ~ keyboard.left ||~ +** Processing line: ~ def include_any_words? text, words~ - Inside source: true *** True Line Result - keyboard.left || -** Processing line: ~ (controller_one && controller_one.left)~ + def include_any_words? text, words +** Processing line: ~ words.any? { |w| text.downcase.include?(w) && !text.downcase.include?(":#{w}") }~ - Inside source: true *** True Line Result - (controller_one && controller_one.left) + words.any? { |w| text.downcase.include?(w) && !text.downcase.include?(":#{w}") } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90505,18 +91052,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def right~ -- Inside source: true -*** True Line Result - def right -** Processing line: ~ keyboard.right ||~ +** Processing line: ~ def subdued_markers~ - Inside source: true *** True Line Result - keyboard.right || -** Processing line: ~ (controller_one && controller_one.right)~ + def subdued_markers +** Processing line: ~ ["reloaded", "exported the"]~ - Inside source: true *** True Line Result - (controller_one && controller_one.right) + ["reloaded", "exported the"] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90525,54 +91068,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def directional_vector~ +** Processing line: ~ def calc args~ - Inside source: true *** True Line Result - def directional_vector -** Processing line: ~ keyboard.directional_vector ||~ + def calc args +** Processing line: ~ if visible? &&~ - Inside source: true *** True Line Result - keyboard.directional_vector || -** Processing line: ~ (controller_one && controller_one.directional_vector)~ + if visible? && +** Processing line: ~ @show_reason == :toast &&~ - Inside source: true *** True Line Result - (controller_one && controller_one.directional_vector) -** Processing line: ~ end~ + @show_reason == :toast && +** Processing line: ~ @toasted_at &&~ - Inside source: true *** True Line Result - end + @toasted_at && +** Processing line: ~ @toasted_at.elapsed?(@toast_duration, Kernel.global_tick_count)~ +- Inside source: true +*** True Line Result + @toasted_at.elapsed?(@toast_duration, Kernel.global_tick_count) +** Processing line: ~ hide~ +- Inside source: true +*** True Line Result + hide +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns a signal indicating right (`1`), left (`-1`), or neither ('0').~ +** Processing line: ~ if !$gtk.paused? && visible? && (show_reason == :exception || show_reason == :exception_on_load)~ - Inside source: true *** True Line Result - # Returns a signal indicating right (`1`), left (`-1`), or neither ('0'). -** Processing line: ~ #~ + if !$gtk.paused? && visible? && (show_reason == :exception || show_reason == :exception_on_load) +** Processing line: ~ hide~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Integer]~ + hide +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Integer] -** Processing line: ~ def left_right~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def left_right -** Processing line: ~ return -1 if self.left~ + +** Processing line: ~ if $gtk.files_reloaded.length > 0~ - Inside source: true *** True Line Result - return -1 if self.left -** Processing line: ~ return 1 if self.right~ + if $gtk.files_reloaded.length > 0 +** Processing line: ~ clear_toast~ - Inside source: true *** True Line Result - return 1 if self.right -** Processing line: ~ return 0~ + clear_toast +** Processing line: ~ @toast_ids.clear~ - Inside source: true *** True Line Result - return 0 + @toast_ids.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90581,94 +91140,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Returns a signal indicating up (`1`), down (`-1`), or neither ('0').~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - # Returns a signal indicating up (`1`), down (`-1`), or neither ('0'). -** Processing line: ~ #~ + def tick args +** Processing line: ~ begin~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Integer]~ + begin +** Processing line: ~ return if @disabled~ - Inside source: true *** True Line Result - # @return [Integer] -** Processing line: ~ def up_down~ + return if @disabled +** Processing line: ~ render args~ - Inside source: true *** True Line Result - def up_down -** Processing line: ~ return 1 if self.up~ + render args +** Processing line: ~ process_inputs args~ - Inside source: true *** True Line Result - return 1 if self.up -** Processing line: ~ return -1 if self.down~ + process_inputs args +** Processing line: ~ return unless should_tick?~ - Inside source: true *** True Line Result - return -1 if self.down -** Processing line: ~ return 0~ + return unless should_tick? +** Processing line: ~ calc args~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + calc args +** Processing line: ~ prompt.tick~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + prompt.tick +** Processing line: ~ menu.tick args~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns the coordinates of the last click.~ + menu.tick args +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - # Returns the coordinates of the last click. -** Processing line: ~ #~ + rescue Exception => e +** Processing line: ~ begin~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Float, Float]~ + begin +** Processing line: ~ puts "#{e}"~ - Inside source: true *** True Line Result - # @return [Float, Float] -** Processing line: ~ def click~ + puts "#{e}" +** Processing line: ~ puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby."~ - Inside source: true *** True Line Result - def click -** Processing line: ~ return nil unless @mouse.click~ + puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." +** Processing line: ~ rescue~ - Inside source: true *** True Line Result - return nil unless @mouse.click -** Processing line: ~ return @mouse.click.point~ + rescue +** Processing line: ~ end~ - Inside source: true *** True Line Result - return @mouse.click.point -** Processing line: ~ end~ + end +** Processing line: ~ @disabled = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @disabled = true +** Processing line: ~ $stdout.puts e~ - Inside source: true *** True Line Result - -** Processing line: ~ # The first controller.~ + $stdout.puts e +** Processing line: ~ $stdout.puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby."~ - Inside source: true *** True Line Result - # The first controller. -** Processing line: ~ #~ + $stdout.puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Controller]~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @return [Controller] -** Processing line: ~ def controller_one~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def controller_one -** Processing line: ~ @controllers[0]~ + +** Processing line: ~ def set_command_with_history_silent command, histories, show_reason = nil~ - Inside source: true *** True Line Result - @controllers[0] + def set_command_with_history_silent command, histories, show_reason = nil +** Processing line: ~ set_command_extended command: command, histories: histories, show_reason: show_reason~ +- Inside source: true +*** True Line Result + set_command_extended command: command, histories: histories, show_reason: show_reason ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90677,26 +91240,34 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # The second controller.~ +** Processing line: ~ def defaults_set_command_extended~ - Inside source: true *** True Line Result - # The second controller. -** Processing line: ~ #~ + def defaults_set_command_extended +** Processing line: ~ {~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [Controller]~ + { +** Processing line: ~ command: "puts 'Hello World'",~ - Inside source: true *** True Line Result - # @return [Controller] -** Processing line: ~ def controller_two~ + command: "puts 'Hello World'", +** Processing line: ~ histories: [],~ - Inside source: true *** True Line Result - def controller_two -** Processing line: ~ @controllers[1]~ + histories: [], +** Processing line: ~ show_reason: nil,~ - Inside source: true *** True Line Result - @controllers[1] + show_reason: nil, +** Processing line: ~ force: false~ +- Inside source: true +*** True Line Result + force: false +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90705,34 +91276,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # Clears all inputs.~ +** Processing line: ~ def set_command_extended opts~ - Inside source: true *** True Line Result - # Clears all inputs. -** Processing line: ~ #~ + def set_command_extended opts +** Processing line: ~ opts = defaults_set_command_extended.merge opts~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @return [void]~ + opts = defaults_set_command_extended.merge opts +** Processing line: ~ @command_history.concat opts[:histories]~ - Inside source: true *** True Line Result - # @return [void] -** Processing line: ~ def clear~ + @command_history.concat opts[:histories] +** Processing line: ~ @command_history << opts[:command] if @command_history[-1] != opts[:command]~ - Inside source: true *** True Line Result - def clear -** Processing line: ~ @mouse.clear~ + @command_history << opts[:command] if @command_history[-1] != opts[:command] +** Processing line: ~ self.current_input_str = opts[:command] if @command_set_at != Kernel.global_tick_count || opts[:force]~ - Inside source: true *** True Line Result - @mouse.clear -** Processing line: ~ @keyboard.clear~ + self.current_input_str = opts[:command] if @command_set_at != Kernel.global_tick_count || opts[:force] +** Processing line: ~ @command_set_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - @keyboard.clear -** Processing line: ~ @controllers.each(&:clear)~ + @command_set_at = Kernel.global_tick_count +** Processing line: ~ @command_history_index = -1~ - Inside source: true *** True Line Result - @controllers.each(&:clear) + @command_history_index = -1 +** Processing line: ~ save_history~ +- Inside source: true +*** True Line Result + save_history ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90741,202 +91316,194 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @return [Hash]~ +** Processing line: ~ def set_command_with_history command, histories, show_reason = nil~ - Inside source: true *** True Line Result - # @return [Hash] -** Processing line: ~ def serialize~ + def set_command_with_history command, histories, show_reason = nil +** Processing line: ~ set_command_with_history_silent command, histories, show_reason~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ {~ + set_command_with_history_silent command, histories, show_reason +** Processing line: ~ show show_reason~ - Inside source: true *** True Line Result - { -** Processing line: ~ controller_one: controller_one.serialize,~ + show show_reason +** Processing line: ~ end~ - Inside source: true *** True Line Result - controller_one: controller_one.serialize, -** Processing line: ~ controller_two: controller_two.serialize,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - controller_two: controller_two.serialize, -** Processing line: ~ keyboard: keyboard.serialize,~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - keyboard: keyboard.serialize, -** Processing line: ~ mouse: mouse.serialize,~ + # @gtk +** Processing line: ~ def set_command command, show_reason = nil~ - Inside source: true *** True Line Result - mouse: mouse.serialize, -** Processing line: ~ text: text.serialize~ + def set_command command, show_reason = nil +** Processing line: ~ set_command_silent command, show_reason~ - Inside source: true *** True Line Result - text: text.serialize -** Processing line: ~ }~ + set_command_silent command, show_reason +** Processing line: ~ show show_reason~ - Inside source: true *** True Line Result - } + show show_reason ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ def set_command_silent command, show_reason = nil~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def set_command_silent command, show_reason = nil +** Processing line: ~ set_command_with_history_silent command, [], show_reason~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. + set_command_with_history_silent command, [], show_reason +** Processing line: ~ end~ +- Inside source: true *** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/log.rb~ -- Header detected. +- Inside source: true *** True Line Result +** Processing line: ~ def set_system_command command, show_reason = nil~ +- Inside source: true *** True Line Result -* ./dragon/log.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + def set_system_command command, show_reason = nil +** Processing line: ~ if $gtk.platform == "Mac OS X"~ +- Inside source: true *** True Line Result - + if $gtk.platform == "Mac OS X" +** Processing line: ~ set_command_silent "$gtk.system \"open #{command}\""~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + set_command_silent "$gtk.system \"open #{command}\"" +** Processing line: ~ else~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + else +** Processing line: ~ set_command_silent "$gtk.system \"start #{command}\""~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + set_command_silent "$gtk.system \"start #{command}\"" +** Processing line: ~ end~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # log.rb has been released under MIT (*only this file*).~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # log.rb has been released under MIT (*only this file*). + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ XTERM_COLOR = {~ +** Processing line: ~ def system_command~ - Inside source: true *** True Line Result - XTERM_COLOR = { -** Processing line: ~ black: "\u001b[30m",~ -- Inside source: true -*** True Line Result - black: "\u001b[30m", -** Processing line: ~ red: "\u001b[31m",~ -- Inside source: true -*** True Line Result - red: "\u001b[31m", -** Processing line: ~ green: "\u001b[32m",~ + def system_command +** Processing line: ~ if $gtk.platform == "Mac OS X"~ - Inside source: true *** True Line Result - green: "\u001b[32m", -** Processing line: ~ yellow: "\u001b[33m",~ + if $gtk.platform == "Mac OS X" +** Processing line: ~ "open"~ - Inside source: true *** True Line Result - yellow: "\u001b[33m", -** Processing line: ~ blue: "\u001b[34m",~ + "open" +** Processing line: ~ else~ - Inside source: true *** True Line Result - blue: "\u001b[34m", -** Processing line: ~ magenta: "\u001b[35m",~ + else +** Processing line: ~ "start"~ - Inside source: true *** True Line Result - magenta: "\u001b[35m", -** Processing line: ~ cyan: "\u001b[36m",~ + "start" +** Processing line: ~ end~ - Inside source: true *** True Line Result - cyan: "\u001b[36m", -** Processing line: ~ white: "\u001b[37m",~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - white: "\u001b[37m", -** Processing line: ~ bright_black: "\u001b[30;1m",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - bright_black: "\u001b[30;1m", -** Processing line: ~ bright_red: "\u001b[31;1m",~ + +** Processing line: ~ private~ - Inside source: true *** True Line Result - bright_red: "\u001b[31;1m", -** Processing line: ~ bright_green: "\u001b[32;1m",~ + private +** Processing line: ~~ - Inside source: true *** True Line Result - bright_green: "\u001b[32;1m", -** Processing line: ~ bright_yellow: "\u001b[33;1m",~ + +** Processing line: ~ def w~ - Inside source: true *** True Line Result - bright_yellow: "\u001b[33;1m", -** Processing line: ~ bright_blue: "\u001b[34;1m",~ + def w +** Processing line: ~ $gtk.logical_width~ - Inside source: true *** True Line Result - bright_blue: "\u001b[34;1m", -** Processing line: ~ bright_magenta: "\u001b[35;1m",~ + $gtk.logical_width +** Processing line: ~ end~ - Inside source: true *** True Line Result - bright_magenta: "\u001b[35;1m", -** Processing line: ~ bright_cyan: "\u001b[36;1m",~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - bright_cyan: "\u001b[36;1m", -** Processing line: ~ bright_white: "\u001b[37;1m",~ + +** Processing line: ~ def h~ - Inside source: true *** True Line Result - bright_white: "\u001b[37;1m", -** Processing line: ~ reset: "\u001b[0m",~ + def h +** Processing line: ~ $gtk.logical_height~ - Inside source: true *** True Line Result - reset: "\u001b[0m", -** Processing line: ~ }~ + $gtk.logical_height +** Processing line: ~ end~ - Inside source: true *** True Line Result - } + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ module GTK~ +** Processing line: ~ # methods top; left; right~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Log~ + # methods top; left; right +** Processing line: ~ # Forward to grid~ - Inside source: true *** True Line Result - class Log -** Processing line: ~ def self.write_to_log_and_puts *args~ + # Forward to grid +** Processing line: ~ %i[top left right].each do |method|~ - Inside source: true *** True Line Result - def self.write_to_log_and_puts *args -** Processing line: ~ return if $gtk.production~ + %i[top left right].each do |method| +** Processing line: ~ define_method method do~ - Inside source: true *** True Line Result - return if $gtk.production -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n") + "\n"~ + define_method method do +** Processing line: ~ $gtk.args.grid.send(method)~ - Inside source: true *** True Line Result - $gtk.append_file 'logs/log.txt', args.join("\n") + "\n" -** Processing line: ~ args.each { |obj| $gtk.log obj, self }~ + $gtk.args.grid.send(method) +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.each { |obj| $gtk.log obj, self } + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90945,22 +91512,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.write_to_log_and_print *args~ -- Inside source: true -*** True Line Result - def self.write_to_log_and_print *args -** Processing line: ~ return if $gtk.production~ -- Inside source: true -*** True Line Result - return if $gtk.production -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n")~ +** Processing line: ~ def line_height_px~ - Inside source: true *** True Line Result - $gtk.append_file 'logs/log.txt', args.join("\n") -** Processing line: ~ Object.print(*args)~ + def line_height_px +** Processing line: ~ font_style.line_height_px~ - Inside source: true *** True Line Result - Object.print(*args) + font_style.line_height_px ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90969,26 +91528,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.puts_important *args~ -- Inside source: true -*** True Line Result - def self.puts_important *args -** Processing line: ~ return if $gtk.production~ -- Inside source: true -*** True Line Result - return if $gtk.production -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n")~ -- Inside source: true -*** True Line Result - $gtk.append_file 'logs/log.txt', args.join("\n") -** Processing line: ~ $gtk.notify! "Important notification occurred."~ +** Processing line: ~ def lines_on_one_page~ - Inside source: true *** True Line Result - $gtk.notify! "Important notification occurred." -** Processing line: ~ args.each { |obj| $gtk.log obj }~ + def lines_on_one_page +** Processing line: ~ (h - 4).idiv(line_height_px)~ - Inside source: true *** True Line Result - args.each { |obj| $gtk.log obj } + (h - 4).idiv(line_height_px) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -90997,22 +91544,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.puts *args~ -- Inside source: true -*** True Line Result - def self.puts *args -** Processing line: ~ message_id, message = args~ -- Inside source: true -*** True Line Result - message_id, message = args -** Processing line: ~ message ||= message_id~ +** Processing line: ~ def line(y:, color:)~ - Inside source: true *** True Line Result - message ||= message_id -** Processing line: ~ write_to_log_and_puts message~ + def line(y:, color:) +** Processing line: ~ [left, y, right, y, *color].line~ - Inside source: true *** True Line Result - write_to_log_and_puts message + [left, y, right, y, *color].line ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91021,18 +91560,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.multiline? *args~ -- Inside source: true -*** True Line Result - def self.multiline? *args -** Processing line: ~ return true if args.length > 1~ +** Processing line: ~ def include_row_marker? log_entry~ - Inside source: true *** True Line Result - return true if args.length > 1 -** Processing line: ~ return !args[0].to_s.multiline?~ + def include_row_marker? log_entry +** Processing line: ~ log_entry[0] == "|"~ - Inside source: true *** True Line Result - return !args[0].to_s.multiline? + log_entry[0] == "|" ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91041,26 +91576,30 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.join_lines args~ +** Processing line: ~ def include_header_marker? log_entry~ - Inside source: true *** True Line Result - def self.join_lines args -** Processing line: ~ return "" if args.length == 0~ + def include_header_marker? log_entry +** Processing line: ~ return false if (log_entry.strip.include? ".rb")~ - Inside source: true *** True Line Result - return "" if args.length == 0 -** Processing line: ~ return args if args.is_a? String~ + return false if (log_entry.strip.include? ".rb") +** Processing line: ~ (log_entry.start_with? "* ") ||~ - Inside source: true *** True Line Result - return args if args.is_a? String -** Processing line: ~ return args[0] if args.length == 1~ + (log_entry.start_with? "* ") || +** Processing line: ~ (log_entry.start_with? "** ") ||~ - Inside source: true *** True Line Result - return args[0] if args.length == 1 -** Processing line: ~ return args.to_s.join("\n")~ + (log_entry.start_with? "** ") || +** Processing line: ~ (log_entry.start_with? "*** ") ||~ - Inside source: true *** True Line Result - return args.to_s.join("\n") + (log_entry.start_with? "*** ") || +** Processing line: ~ (log_entry.start_with? "**** ")~ +- Inside source: true +*** True Line Result + (log_entry.start_with? "**** ") ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91069,74 +91608,78 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.headline name~ +** Processing line: ~ def color_for_log_entry(log_entry)~ - Inside source: true *** True Line Result - def self.headline name -** Processing line: ~ @asterisk_count ||= 1~ + def color_for_log_entry(log_entry) +** Processing line: ~ if include_row_marker? log_entry~ - Inside source: true *** True Line Result - @asterisk_count ||= 1 -** Processing line: ~ @asterisk_count = @asterisk_count.greater(1)~ + if include_row_marker? log_entry +** Processing line: ~ @text_color~ - Inside source: true *** True Line Result - @asterisk_count = @asterisk_count.greater(1) -** Processing line: ~ result_from_yield = join_lines yield~ + @text_color +** Processing line: ~ elsif include_error_marker? log_entry~ - Inside source: true *** True Line Result - result_from_yield = join_lines yield -** Processing line: ~ result_from_yield = result_from_yield.each_line.map { |l| " #{l}" }.join~ + elsif include_error_marker? log_entry +** Processing line: ~ @error_color~ - Inside source: true *** True Line Result - result_from_yield = result_from_yield.each_line.map { |l| " #{l}" }.join -** Processing line: ~ r ="#{"*" * @asterisk_count} #{name}\n#{result_from_yield}"~ + @error_color +** Processing line: ~ elsif include_subdued_markers? log_entry~ - Inside source: true *** True Line Result - r ="#{"*" * @asterisk_count} #{name}\n#{result_from_yield}" -** Processing line: ~ @asterisk_count -= 1~ + elsif include_subdued_markers? log_entry +** Processing line: ~ @text_color.mult_alpha(0.5)~ - Inside source: true *** True Line Result - @asterisk_count -= 1 -** Processing line: ~ @asterisk_count = @asterisk_count.greater(1)~ + @text_color.mult_alpha(0.5) +** Processing line: ~ elsif include_header_marker? log_entry~ - Inside source: true *** True Line Result - @asterisk_count = @asterisk_count.greater(1) -** Processing line: ~ r~ + elsif include_header_marker? log_entry +** Processing line: ~ @header_color~ - Inside source: true *** True Line Result - r -** Processing line: ~ end~ + @header_color +** Processing line: ~ elsif log_entry.start_with?("====")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + elsif log_entry.start_with?("====") +** Processing line: ~ @header_color~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.dynamic_block~ + @header_color +** Processing line: ~ else~ - Inside source: true *** True Line Result - def self.dynamic_block -** Processing line: ~ "#+BEGIN:~ + else +** Processing line: ~ @text_color~ - Inside source: true *** True Line Result - "#+BEGIN: -** Processing line: ~ #{join_lines yield}~ + @text_color +** Processing line: ~ end~ - Inside source: true *** True Line Result - #{join_lines yield} -** Processing line: ~ #+END:~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - #+END: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ "~ +** Processing line: ~ def prompt~ - Inside source: true *** True Line Result - " + def prompt +** Processing line: ~ @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width)~ +- Inside source: true +*** True Line Result + @prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91145,178 +91688,190 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.puts_error *args~ +** Processing line: ~ def current_input_str~ - Inside source: true *** True Line Result - def self.puts_error *args -** Processing line: ~ args ||= []~ + def current_input_str +** Processing line: ~ prompt.current_input_str~ - Inside source: true *** True Line Result - args ||= [] -** Processing line: ~ title = args[0]~ + prompt.current_input_str +** Processing line: ~ end~ - Inside source: true *** True Line Result - title = args[0] -** Processing line: ~ additional = args[1..-1] || []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - additional = args[1..-1] || [] -** Processing line: ~ additional = "" if additional.length == 0~ + +** Processing line: ~ def current_input_str=(str)~ - Inside source: true *** True Line Result - additional = "" if additional.length == 0 -** Processing line: ~ if !title.multiline? && join_lines(additional).multiline?~ + def current_input_str=(str) +** Processing line: ~ prompt.current_input_str = str~ - Inside source: true *** True Line Result - if !title.multiline? && join_lines(additional).multiline? -** Processing line: ~ message = headline "ERROR: #{title}" do~ + prompt.current_input_str = str +** Processing line: ~ end~ - Inside source: true *** True Line Result - message = headline "ERROR: #{title}" do -** Processing line: ~ dynamic_block do~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - dynamic_block do -** Processing line: ~ additional~ + +** Processing line: ~ def clear~ - Inside source: true *** True Line Result - additional -** Processing line: ~ end~ + def clear +** Processing line: ~ @archived_log.clear~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + @archived_log.clear +** Processing line: ~ @log.clear~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif title.multiline?~ + @log.clear +** Processing line: ~ @prompt.clear~ - Inside source: true *** True Line Result - elsif title.multiline? -** Processing line: ~ message = headline "ERROR: " do~ + @prompt.clear +** Processing line: ~ :console_silent_eval~ - Inside source: true *** True Line Result - message = headline "ERROR: " do -** Processing line: ~ dynamic_block do~ + :console_silent_eval +** Processing line: ~ end~ - Inside source: true *** True Line Result - dynamic_block do -** Processing line: ~ args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args -** Processing line: ~ end~ + +** Processing line: ~ def slide_progress~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def slide_progress +** Processing line: ~ return 0 if !@toggled_at~ - Inside source: true *** True Line Result - end + return 0 if !@toggled_at +** Processing line: ~ if visible?~ +- Inside source: true +*** True Line Result + if visible? +** Processing line: ~ @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip)~ +- Inside source: true +*** True Line Result + @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ message = "* ERROR: #{title} #{additional}".strip~ +** Processing line: ~ @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint)~ - Inside source: true *** True Line Result - message = "* ERROR: #{title} #{additional}".strip + @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint) ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ self.puts message~ +** Processing line: ~ @slide_progress~ - Inside source: true *** True Line Result - self.puts message + @slide_progress ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.puts_info *args~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def self.puts_info *args -** Processing line: ~ args ||= []~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - args ||= [] -** Processing line: ~ title = args[0]~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - title = args[0] -** Processing line: ~ additional = args[1..-1] || []~ -- Inside source: true +#+end_src +** Processing line: ~~ +- End of paragraph detected. *** True Line Result - additional = args[1..-1] || [] -** Processing line: ~ additional = "" if additional.length == 0~ -- Inside source: true + +** Processing line: ~* console_color.rb~ +- Header detected. *** True Line Result - additional = "" if additional.length == 0 -** Processing line: ~ if !title.multiline? && join_lines(additional).multiline?~ + +*** True Line Result +* console_color.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/console_color.rb~ - Inside source: true *** True Line Result - if !title.multiline? && join_lines(additional).multiline? -** Processing line: ~ message = headline "INFO: #{title}" do~ + # ./dragon/console_color.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - message = headline "INFO: #{title}" do -** Processing line: ~ dynamic_block do~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - dynamic_block do -** Processing line: ~ additional~ + # MIT License +** Processing line: ~ # console_color.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - additional -** Processing line: ~ end~ + # console_color.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ - Inside source: true *** True Line Result - end -** Processing line: ~ elsif title.multiline?~ + # Contributors outside of DragonRuby who also hold Copyright: +** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ - Inside source: true *** True Line Result - elsif title.multiline? -** Processing line: ~ message = headline "INFO: " do~ + # - Kevin Fischer: https://github.com/kfischer-okarin +** Processing line: ~~ - Inside source: true *** True Line Result - message = headline "INFO: " do -** Processing line: ~ dynamic_block do~ + +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - dynamic_block do -** Processing line: ~ args~ + module GTK +** Processing line: ~ class Console~ - Inside source: true *** True Line Result - args -** Processing line: ~ end~ + class Console +** Processing line: ~ class Color~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + class Color +** Processing line: ~ def initialize(color)~ - Inside source: true *** True Line Result - end -** Processing line: ~ else~ + def initialize(color) +** Processing line: ~ @color = color~ - Inside source: true *** True Line Result - else -** Processing line: ~ message = "* INFO: #{title} #{additional}".strip~ + @color = color +** Processing line: ~ @color << 255 if @color.size == 3~ - Inside source: true *** True Line Result - message = "* INFO: #{title} #{additional}".strip + @color << 255 if @color.size == 3 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -91325,3806 +91880,3962 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ self.puts message~ +** Processing line: ~ def mult_alpha(alpha_modifier)~ - Inside source: true *** True Line Result - self.puts message -** Processing line: ~ end~ + def mult_alpha(alpha_modifier) +** Processing line: ~ Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i]~ - Inside source: true *** True Line Result - end + Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.puts_once *ids, message~ +** Processing line: ~ # Support splat operator~ - Inside source: true *** True Line Result - def self.puts_once *ids, message -** Processing line: ~ id = "#{ids}"~ + # Support splat operator +** Processing line: ~ def to_a~ - Inside source: true *** True Line Result - id = "#{ids}" -** Processing line: ~ @once ||= {}~ + def to_a +** Processing line: ~ @color~ - Inside source: true *** True Line Result - @once ||= {} -** Processing line: ~ return if @once[id]~ + @color +** Processing line: ~ end~ - Inside source: true *** True Line Result - return if @once[id] -** Processing line: ~ @once[id] = id~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - @once[id] = id -** Processing line: ~ if !$gtk.cli_arguments[:replay] && !$gtk.cli_arguments[:record]~ + +** Processing line: ~ def to_h~ - Inside source: true *** True Line Result - if !$gtk.cli_arguments[:replay] && !$gtk.cli_arguments[:record] -** Processing line: ~ $gtk.notify!("Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§]. [Message ID: #{id}].")~ + def to_h +** Processing line: ~ { r: @color[0], g: @color[1], b: @color[2], a: @color[3] }~ - Inside source: true *** True Line Result - $gtk.notify!("Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§]. [Message ID: #{id}].") + { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ write_to_log_and_puts ""~ -- Inside source: true -*** True Line Result - write_to_log_and_puts "" -** Processing line: ~ write_to_log_and_puts "#{message.strip}"~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - write_to_log_and_puts "#{message.strip}" -** Processing line: ~ write_to_log_and_puts ""~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - write_to_log_and_puts "" -** Processing line: ~ write_to_log_and_puts "[Message ID: #{id}]"~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - write_to_log_and_puts "[Message ID: #{id}]" -** Processing line: ~ write_to_log_and_puts ""~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - write_to_log_and_puts "" -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def self.puts_once_info *ids, message~ -- Inside source: true +** Processing line: ~* console_font_style.rb~ +- Header detected. *** True Line Result - def self.puts_once_info *ids, message -** Processing line: ~ id = "#{ids}"~ -- Inside source: true + *** True Line Result - id = "#{ids}" -** Processing line: ~ @once ||= {}~ -- Inside source: true +* console_font_style.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - @once ||= {} -** Processing line: ~ return if @once[id]~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/console_font_style.rb~ - Inside source: true *** True Line Result - return if @once[id] -** Processing line: ~ @once[id] = id~ + # ./dragon/console_font_style.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - @once[id] = id -** Processing line: ~ log_info message~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - log_info message -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # console_font_style.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # console_font_style.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def self.print *args~ +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ - Inside source: true *** True Line Result - def self.print *args -** Processing line: ~ write_to_log_and_print(*args)~ + # Contributors outside of DragonRuby who also hold Copyright: +** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ - Inside source: true *** True Line Result - write_to_log_and_print(*args) -** Processing line: ~ end~ + # - Kevin Fischer: https://github.com/kfischer-okarin +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + module GTK +** Processing line: ~ class Console~ - Inside source: true *** True Line Result - end + class Console +** Processing line: ~ class FontStyle~ +- Inside source: true +*** True Line Result + class FontStyle +** Processing line: ~ attr_reader :font, :size_enum, :line_height~ +- Inside source: true +*** True Line Result + attr_reader :font, :size_enum, :line_height ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class Object~ +** Processing line: ~ def initialize(font:, size_enum:, line_height:)~ - Inside source: true *** True Line Result - class Object -** Processing line: ~ def log_print *args~ + def initialize(font:, size_enum:, line_height:) +** Processing line: ~ @font = font~ - Inside source: true *** True Line Result - def log_print *args -** Processing line: ~ GTK::Log.print(*args)~ + @font = font +** Processing line: ~ @size_enum = size_enum~ - Inside source: true *** True Line Result - GTK::Log.print(*args) -** Processing line: ~ end~ + @size_enum = size_enum +** Processing line: ~ @line_height = line_height~ - Inside source: true *** True Line Result - end + @line_height = line_height +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_important *args~ +** Processing line: ~ def letter_size~ - Inside source: true *** True Line Result - def log_important *args -** Processing line: ~ GTK::Log.puts_important(*args)~ + def letter_size +** Processing line: ~ @letter_size ||= $gtk.calcstringbox 'W', size_enum, font~ - Inside source: true *** True Line Result - GTK::Log.puts_important(*args) -** Processing line: ~ end~ + @letter_size ||= $gtk.calcstringbox 'W', size_enum, font +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log *args~ +** Processing line: ~ def line_height_px~ - Inside source: true *** True Line Result - def log *args -** Processing line: ~ GTK::Log.puts(*args)~ + def line_height_px +** Processing line: ~ @line_height_px ||= letter_size.y * line_height~ - Inside source: true *** True Line Result - GTK::Log.puts(*args) -** Processing line: ~ end~ + @line_height_px ||= letter_size.y * line_height +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_with_color xterm_escape_code, *args~ -- Inside source: true -*** True Line Result - def log_with_color xterm_escape_code, *args -** Processing line: ~ log_print xterm_escape_code~ +** Processing line: ~ def label(x:, y:, text:, color:, alignment_enum: 0)~ - Inside source: true *** True Line Result - log_print xterm_escape_code -** Processing line: ~ log(*args)~ + def label(x:, y:, text:, color:, alignment_enum: 0) +** Processing line: ~ {~ - Inside source: true *** True Line Result - log(*args) -** Processing line: ~ ensure~ + { +** Processing line: ~ x: x,~ - Inside source: true *** True Line Result - ensure -** Processing line: ~ log_reset_color~ + x: x, +** Processing line: ~ y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels.~ - Inside source: true *** True Line Result - log_reset_color -** Processing line: ~ end~ + y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels. +** Processing line: ~ text: text,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + text: text, +** Processing line: ~ font: font,~ - Inside source: true *** True Line Result - -** Processing line: ~ def log_reset_color~ + font: font, +** Processing line: ~ size_enum: size_enum,~ - Inside source: true *** True Line Result - def log_reset_color -** Processing line: ~ log_print XTERM_COLOR[:reset]~ + size_enum: size_enum, +** Processing line: ~ alignment_enum: alignment_enum,~ - Inside source: true *** True Line Result - log_print XTERM_COLOR[:reset] -** Processing line: ~ end~ + alignment_enum: alignment_enum, +** Processing line: ~ **color.to_h,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + **color.to_h, +** Processing line: ~ }.label~ - Inside source: true *** True Line Result - -** Processing line: ~ def log_black *args~ + }.label +** Processing line: ~ end~ - Inside source: true *** True Line Result - def log_black *args -** Processing line: ~ log_with_color XTERM_COLOR[:black], *args~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:black], *args + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def log_red *args~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - def log_red *args -** Processing line: ~ log_with_color XTERM_COLOR[:red], *args~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:red], *args -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def log_green *args~ -- Inside source: true +** Processing line: ~* console_menu.rb~ +- Header detected. *** True Line Result - def log_green *args -** Processing line: ~ log_with_color XTERM_COLOR[:green], *args~ -- Inside source: true + *** True Line Result - log_with_color XTERM_COLOR[:green], *args -** Processing line: ~ end~ -- Inside source: true +* console_menu.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. *** True Line Result - end -** Processing line: ~~ + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/console_menu.rb~ - Inside source: true *** True Line Result - -** Processing line: ~ def log_yellow *args~ + # ./dragon/console_menu.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - def log_yellow *args -** Processing line: ~ log_with_color XTERM_COLOR[:yellow], *args~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:yellow], *args -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # console_menu.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # console_menu.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_blue *args~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - def log_blue *args -** Processing line: ~ log_with_color XTERM_COLOR[:blue], *args~ + module GTK +** Processing line: ~ class Console~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:blue], *args -** Processing line: ~ end~ + class Console +** Processing line: ~ class Menu~ - Inside source: true *** True Line Result - end + class Menu +** Processing line: ~ attr_accessor :buttons~ +- Inside source: true +*** True Line Result + attr_accessor :buttons ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_magenta *args~ +** Processing line: ~ def initialize console~ - Inside source: true *** True Line Result - def log_magenta *args -** Processing line: ~ log_with_color XTERM_COLOR[:magenta], *args~ + def initialize console +** Processing line: ~ @console = console~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:magenta], *args -** Processing line: ~ end~ + @console = console +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_cyan *args~ +** Processing line: ~ def record_clicked~ - Inside source: true *** True Line Result - def log_cyan *args -** Processing line: ~ log_with_color XTERM_COLOR[:cyan], *args~ + def record_clicked +** Processing line: ~ $recording.start 100~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:cyan], *args -** Processing line: ~ end~ + $recording.start 100 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_white *args~ +** Processing line: ~ def replay_clicked~ - Inside source: true *** True Line Result - def log_white *args -** Processing line: ~ log_with_color XTERM_COLOR[:white], *args~ + def replay_clicked +** Processing line: ~ $replay.start 'replay.txt'~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:white], *args -** Processing line: ~ end~ + $replay.start 'replay.txt' +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_black *args~ +** Processing line: ~ def reset_clicked~ - Inside source: true *** True Line Result - def log_bright_black *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_black], *args~ + def reset_clicked +** Processing line: ~ $gtk.reset~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_black], *args -** Processing line: ~ end~ + $gtk.reset +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_red *args~ +** Processing line: ~ def scroll_up_clicked~ - Inside source: true *** True Line Result - def log_bright_red *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_red], *args~ + def scroll_up_clicked +** Processing line: ~ @console.scroll_up_half~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_red], *args -** Processing line: ~ end~ + @console.scroll_up_half +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_green *args~ +** Processing line: ~ def scroll_down_clicked~ - Inside source: true *** True Line Result - def log_bright_green *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_green], *args~ + def scroll_down_clicked +** Processing line: ~ @console.scroll_down_half~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_green], *args -** Processing line: ~ end~ + @console.scroll_down_half +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_yellow *args~ +** Processing line: ~ def show_menu_clicked~ - Inside source: true *** True Line Result - def log_bright_yellow *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_yellow], *args~ + def show_menu_clicked +** Processing line: ~ @menu_shown = :visible~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_yellow], *args -** Processing line: ~ end~ + @menu_shown = :visible +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_blue *args~ +** Processing line: ~ def close_clicked~ - Inside source: true *** True Line Result - def log_bright_blue *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_blue], *args~ + def close_clicked +** Processing line: ~ @menu_shown = :hidden~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_blue], *args -** Processing line: ~ end~ + @menu_shown = :hidden +** Processing line: ~ @console.hide~ - Inside source: true *** True Line Result - end + @console.hide +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_magenta *args~ +** Processing line: ~ def hide_menu_clicked~ - Inside source: true *** True Line Result - def log_bright_magenta *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_magenta], *args~ + def hide_menu_clicked +** Processing line: ~ @menu_shown = :hidden~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_magenta], *args -** Processing line: ~ end~ + @menu_shown = :hidden +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_cyan *args~ +** Processing line: ~ def framerate_diagnostics_clicked~ - Inside source: true *** True Line Result - def log_bright_cyan *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_cyan], *args~ + def framerate_diagnostics_clicked +** Processing line: ~ @console.scroll_to_bottom~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_cyan], *args -** Processing line: ~ end~ + @console.scroll_to_bottom +** Processing line: ~ $gtk.framerate_diagnostics~ - Inside source: true *** True Line Result - end + $gtk.framerate_diagnostics +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_bright_white *args~ +** Processing line: ~ def itch_wizard_clicked~ - Inside source: true *** True Line Result - def log_bright_white *args -** Processing line: ~ log_with_color XTERM_COLOR[:bright_white], *args~ + def itch_wizard_clicked +** Processing line: ~ @console.scroll_to_bottom~ - Inside source: true *** True Line Result - log_with_color XTERM_COLOR[:bright_white], *args -** Processing line: ~ end~ + @console.scroll_to_bottom +** Processing line: ~ $wizards.itch.start~ - Inside source: true *** True Line Result - end + $wizards.itch.start +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_error *args~ +** Processing line: ~ def docs_clicked~ - Inside source: true *** True Line Result - def log_error *args -** Processing line: ~ GTK::Log.puts_error(*args)~ + def docs_clicked +** Processing line: ~ @console.scroll_to_bottom~ - Inside source: true *** True Line Result - GTK::Log.puts_error(*args) -** Processing line: ~ end~ + @console.scroll_to_bottom +** Processing line: ~ log Kernel.docs_classes~ - Inside source: true *** True Line Result - end + log Kernel.docs_classes +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_info *args~ +** Processing line: ~ def scroll_end_clicked~ - Inside source: true *** True Line Result - def log_info *args -** Processing line: ~ GTK::Log.puts_info(*args)~ + def scroll_end_clicked +** Processing line: ~ @console.scroll_to_bottom~ - Inside source: true *** True Line Result - GTK::Log.puts_info(*args) -** Processing line: ~ end~ + @console.scroll_to_bottom +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_once *ids, message~ +** Processing line: ~ def custom_buttons~ - Inside source: true *** True Line Result - def log_once *ids, message -** Processing line: ~ GTK::Log.puts_once(*ids, message)~ + def custom_buttons +** Processing line: ~ []~ - Inside source: true *** True Line Result - GTK::Log.puts_once(*ids, message) -** Processing line: ~ end~ + [] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_once_info *ids, message~ -- Inside source: true -*** True Line Result - def log_once_info *ids, message -** Processing line: ~ GTK::Log.puts_once_info(*ids, message)~ -- Inside source: true -*** True Line Result - GTK::Log.puts_once_info(*ids, message) -** Processing line: ~ end~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def tick args +** Processing line: ~ return unless @console.visible?~ - Inside source: true *** True Line Result - end + return unless @console.visible? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ @menu_shown ||= :hidden~ +- Inside source: true *** True Line Result -#+end_src + @menu_shown ||= :hidden ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/numeric.rb~ -- Header detected. +- Inside source: true *** True Line Result +** Processing line: ~ if $gtk.production~ +- Inside source: true *** True Line Result -* ./dragon/numeric.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + if $gtk.production +** Processing line: ~ @buttons = [~ +- Inside source: true *** True Line Result - + @buttons = [ +** Processing line: ~ (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked),~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked), +** Processing line: ~ (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked),~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + ] +** Processing line: ~ elsif @menu_shown == :hidden~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # numeric.rb has been released under MIT (*only this file*).~ + elsif @menu_shown == :hidden +** Processing line: ~ @buttons = [~ - Inside source: true *** True Line Result - # numeric.rb has been released under MIT (*only this file*). -** Processing line: ~~ + @buttons = [ +** Processing line: ~ (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked),~ - Inside source: true *** True Line Result - -** Processing line: ~ class Numeric~ + (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked), +** Processing line: ~ ]~ - Inside source: true *** True Line Result - class Numeric -** Processing line: ~ include ValueType~ + ] +** Processing line: ~ else~ - Inside source: true *** True Line Result - include ValueType -** Processing line: ~ include NumericDeprecated~ + else +** Processing line: ~ @buttons = [~ - Inside source: true *** True Line Result - include NumericDeprecated -** Processing line: ~~ + @buttons = [ +** Processing line: ~ (button id: :scroll_up, row: 0, col: 6, text: "scroll up", method: :scroll_up_clicked),~ - Inside source: true *** True Line Result - -** Processing line: ~ alias_method :gte, :>=~ + (button id: :scroll_up, row: 0, col: 6, text: "scroll up", method: :scroll_up_clicked), +** Processing line: ~ (button id: :scroll_down, row: 0, col: 7, text: "scroll down", method: :scroll_down_clicked),~ - Inside source: true *** True Line Result - alias_method :gte, :>= -** Processing line: ~ alias_method :lte, :<=~ + (button id: :scroll_down, row: 0, col: 7, text: "scroll down", method: :scroll_down_clicked), +** Processing line: ~ (button id: :scroll_down, row: 0, col: 8, text: "scroll end", method: :scroll_end_clicked),~ - Inside source: true *** True Line Result - alias_method :lte, :<= -** Processing line: ~~ + (button id: :scroll_down, row: 0, col: 8, text: "scroll end", method: :scroll_end_clicked), +** Processing line: ~ (button id: :close, row: 0, col: 9, text: "close console", method: :close_clicked),~ - Inside source: true *** True Line Result - -** Processing line: ~ # Converts a numeric value representing seconds into frames.~ + (button id: :close, row: 0, col: 9, text: "close console", method: :close_clicked), +** Processing line: ~ (button id: :hide, row: 0, col: 10, text: "hide menu", method: :hide_menu_clicked),~ - Inside source: true *** True Line Result - # Converts a numeric value representing seconds into frames. -** Processing line: ~ #~ + (button id: :hide, row: 0, col: 10, text: "hide menu", method: :hide_menu_clicked), +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + +** Processing line: ~ (button id: :record, row: 1, col: 7, text: "record gameplay", method: :record_clicked),~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def seconds~ + (button id: :record, row: 1, col: 7, text: "record gameplay", method: :record_clicked), +** Processing line: ~ (button id: :replay, row: 1, col: 8, text: "start replay", method: :replay_clicked),~ - Inside source: true *** True Line Result - def seconds -** Processing line: ~ self * 60~ + (button id: :replay, row: 1, col: 8, text: "start replay", method: :replay_clicked), +** Processing line: ~ (button id: :record, row: 1, col: 9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked),~ - Inside source: true *** True Line Result - self * 60 -** Processing line: ~ end~ + (button id: :record, row: 1, col: 9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), +** Processing line: ~ (button id: :reset, row: 1, col: 10, text: "reset game", method: :reset_clicked),~ - Inside source: true *** True Line Result - end + (button id: :reset, row: 1, col: 10, text: "reset game", method: :reset_clicked), ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Divides the number by `2.0` and returns a `float`.~ -- Inside source: true -*** True Line Result - # Divides the number by `2.0` and returns a `float`. -** Processing line: ~ #~ +** Processing line: ~ (button id: :reset, row: 2, col: 10, text: "docs", method: :docs_clicked),~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + (button id: :reset, row: 2, col: 10, text: "docs", method: :docs_clicked), +** Processing line: ~ (button id: :reset, row: 2, col: 9, text: "itch wizard", method: :itch_wizard_clicked),~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def half~ + (button id: :reset, row: 2, col: 9, text: "itch wizard", method: :itch_wizard_clicked), +** Processing line: ~ *custom_buttons~ - Inside source: true *** True Line Result - def half -** Processing line: ~ self / 2.0~ + *custom_buttons +** Processing line: ~ ]~ - Inside source: true *** True Line Result - self / 2.0 -** Processing line: ~ end~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def to_byte~ -- Inside source: true -*** True Line Result - def to_byte -** Processing line: ~ clamp(0, 255).to_i~ +** Processing line: ~ # render~ - Inside source: true *** True Line Result - clamp(0, 255).to_i -** Processing line: ~ end~ + # render +** Processing line: ~ args.outputs.reserved << @buttons.map { |b| b[:primitives] }~ - Inside source: true *** True Line Result - end + args.outputs.reserved << @buttons.map { |b| b[:primitives] } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def elapsed_time tick_count_override = nil~ +** Processing line: ~ # inputs~ - Inside source: true *** True Line Result - def elapsed_time tick_count_override = nil -** Processing line: ~ (tick_count_override || Kernel.tick_count) - self~ + # inputs +** Processing line: ~ if args.inputs.mouse.click~ - Inside source: true *** True Line Result - (tick_count_override || Kernel.tick_count) - self -** Processing line: ~ end~ + if args.inputs.mouse.click +** Processing line: ~ clicked = @buttons.find { |b| args.inputs.mouse.inside_rect? b[:rect] }~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + clicked = @buttons.find { |b| args.inputs.mouse.inside_rect? b[:rect] } +** Processing line: ~ if clicked~ - Inside source: true *** True Line Result - -** Processing line: ~ def elapsed_time_percent duration~ + if clicked +** Processing line: ~ send clicked[:method]~ - Inside source: true *** True Line Result - def elapsed_time_percent duration -** Processing line: ~ elapsed_time.percentage_of duration~ + send clicked[:method] +** Processing line: ~ end~ - Inside source: true *** True Line Result - elapsed_time.percentage_of duration -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def new?~ +** Processing line: ~ def rect_for_layout row, col~ - Inside source: true *** True Line Result - def new? -** Processing line: ~ elapsed_time == 0~ + def rect_for_layout row, col +** Processing line: ~ col_width = 100~ - Inside source: true *** True Line Result - elapsed_time == 0 -** Processing line: ~ end~ + col_width = 100 +** Processing line: ~ row_height = 50~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + row_height = 50 +** Processing line: ~ col_margin = 5~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns `true` if the numeric value has passed a duration/offset number.~ + col_margin = 5 +** Processing line: ~ row_margin = 5~ - Inside source: true *** True Line Result - # Returns `true` if the numeric value has passed a duration/offset number. -** Processing line: ~ # `Kernel.tick_count` is used to determine if a number represents an elapsed~ + row_margin = 5 +** Processing line: ~ x = (col_margin + (col * col_width) + (col * col_margin))~ - Inside source: true *** True Line Result - # `Kernel.tick_count` is used to determine if a number represents an elapsed -** Processing line: ~ # moment in time.~ + x = (col_margin + (col * col_width) + (col * col_margin)) +** Processing line: ~ y = (row_margin + (row * row_height) + (row * row_margin) + row_height).from_top~ - Inside source: true *** True Line Result - # moment in time. -** Processing line: ~ #~ + y = (row_margin + (row * row_height) + (row * row_margin) + row_height).from_top +** Processing line: ~ { x: x, y: y, w: col_width, h: row_height }~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + { x: x, y: y, w: col_width, h: row_height } +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def elapsed? offset = 0, tick_count_override = Kernel.tick_count~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def elapsed? offset = 0, tick_count_override = Kernel.tick_count -** Processing line: ~ (self + offset) < tick_count_override~ + +** Processing line: ~ def button args~ - Inside source: true *** True Line Result - (self + offset) < tick_count_override -** Processing line: ~ end~ + def button args +** Processing line: ~ id, row, col, text, method = args[:id], args[:row], args[:col], args[:text], args[:method]~ - Inside source: true *** True Line Result - end + id, row, col, text, method = args[:id], args[:row], args[:col], args[:text], args[:method] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def frame_index *opts~ +** Processing line: ~ font_height = @console.font_style.line_height_px.half~ - Inside source: true *** True Line Result - def frame_index *opts -** Processing line: ~ frame_count_or_hash, hold_for, repeat, tick_count_override = opts~ + font_height = @console.font_style.line_height_px.half +** Processing line: ~ {~ - Inside source: true *** True Line Result - frame_count_or_hash, hold_for, repeat, tick_count_override = opts -** Processing line: ~ if frame_count_or_hash.is_a? Hash~ + { +** Processing line: ~ id: id,~ - Inside source: true *** True Line Result - if frame_count_or_hash.is_a? Hash -** Processing line: ~ frame_count = frame_count_or_hash[:count]~ + id: id, +** Processing line: ~ rect: (rect_for_layout row, col),~ - Inside source: true *** True Line Result - frame_count = frame_count_or_hash[:count] -** Processing line: ~ hold_for = frame_count_or_hash[:hold_for]~ + rect: (rect_for_layout row, col), +** Processing line: ~ text: text,~ - Inside source: true *** True Line Result - hold_for = frame_count_or_hash[:hold_for] -** Processing line: ~ repeat = frame_count_or_hash[:repeat]~ + text: text, +** Processing line: ~ method: method~ - Inside source: true *** True Line Result - repeat = frame_count_or_hash[:repeat] -** Processing line: ~ tick_count_override = frame_count_or_hash[:tick_count_override]~ + method: method +** Processing line: ~ }.let do |entity|~ - Inside source: true *** True Line Result - tick_count_override = frame_count_or_hash[:tick_count_override] -** Processing line: ~ else~ + }.let do |entity| +** Processing line: ~ primitives = []~ - Inside source: true *** True Line Result - else -** Processing line: ~ frame_count = frame_count_or_hash~ + primitives = [] +** Processing line: ~ primitives << entity[:rect].merge(a: 164).solid~ - Inside source: true *** True Line Result - frame_count = frame_count_or_hash -** Processing line: ~ end~ + primitives << entity[:rect].merge(a: 164).solid +** Processing line: ~ primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border +** Processing line: ~ primitives << text.wrapped_lines(5)~ - Inside source: true *** True Line Result - -** Processing line: ~ tick_count_override ||= Kernel.tick_count~ + primitives << text.wrapped_lines(5) +** Processing line: ~ .map_with_index do |l, i|~ - Inside source: true *** True Line Result - tick_count_override ||= Kernel.tick_count -** Processing line: ~ animation_frame_count = frame_count~ + .map_with_index do |l, i| +** Processing line: ~ [~ - Inside source: true *** True Line Result - animation_frame_count = frame_count -** Processing line: ~ animation_frame_hold_time = hold_for~ + [ +** Processing line: ~ entity[:rect][:x] + entity[:rect][:w].half,~ - Inside source: true *** True Line Result - animation_frame_hold_time = hold_for -** Processing line: ~ animation_length = animation_frame_hold_time * animation_frame_count~ + entity[:rect][:x] + entity[:rect][:w].half, +** Processing line: ~ entity[:rect][:y] + entity[:rect][:h].half + font_height - (i * (font_height + 2)),~ - Inside source: true *** True Line Result - animation_length = animation_frame_hold_time * animation_frame_count -** Processing line: ~ return nil if Kernel.tick_count < self~ + entity[:rect][:y] + entity[:rect][:h].half + font_height - (i * (font_height + 2)), +** Processing line: ~ l, -3, 1, 255, 255, 255~ - Inside source: true *** True Line Result - return nil if Kernel.tick_count < self -** Processing line: ~~ + l, -3, 1, 255, 255, 255 +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ if !repeat && (self + animation_length) < (tick_count_override - 1)~ + ] +** Processing line: ~ end.labels~ - Inside source: true *** True Line Result - if !repeat && (self + animation_length) < (tick_count_override - 1) -** Processing line: ~ return nil~ + end.labels +** Processing line: ~~ - Inside source: true *** True Line Result - return nil -** Processing line: ~ else~ + +** Processing line: ~ entity.merge(primitives: primitives)~ - Inside source: true *** True Line Result - else -** Processing line: ~ return self.elapsed_time.-(1).idiv(animation_frame_hold_time) % animation_frame_count~ + entity.merge(primitives: primitives) +** Processing line: ~ end~ - Inside source: true *** True Line Result - return self.elapsed_time.-(1).idiv(animation_frame_hold_time) % animation_frame_count -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ rescue Exception => e~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise <<-S~ + +** Processing line: ~ def serialize~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + def serialize +** Processing line: ~ {~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ #{opts}~ + { +** Processing line: ~ not_supported: "#{self}"~ - Inside source: true *** True Line Result - #{opts} -** Processing line: ~ #{e}~ + not_supported: "#{self}" +** Processing line: ~ }~ - Inside source: true *** True Line Result - #{e} -** Processing line: ~ S~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - S + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def zero?~ +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* console_prompt.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* console_prompt.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/console_prompt.rb~ - Inside source: true *** True Line Result - def zero? -** Processing line: ~ self == 0~ + # ./dragon/console_prompt.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - self == 0 -** Processing line: ~ end~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # MIT License +** Processing line: ~ # console_prompt.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - -** Processing line: ~ def zero~ + # console_prompt.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - def zero -** Processing line: ~ 0~ + +** Processing line: ~ # Contributors outside of DragonRuby who also hold Copyright:~ - Inside source: true *** True Line Result - 0 -** Processing line: ~ end~ + # Contributors outside of DragonRuby who also hold Copyright: +** Processing line: ~ # - Kevin Fischer: https://github.com/kfischer-okarin~ - Inside source: true *** True Line Result - end + # - Kevin Fischer: https://github.com/kfischer-okarin ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def one~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - def one -** Processing line: ~ 1~ + module GTK +** Processing line: ~ class Console~ - Inside source: true *** True Line Result - 1 -** Processing line: ~ end~ + class Console +** Processing line: ~ class Prompt~ - Inside source: true *** True Line Result - end + class Prompt +** Processing line: ~ attr_accessor :current_input_str, :font_style, :console_text_width, :last_input_str, :last_input_str_changed~ +- Inside source: true +*** True Line Result + attr_accessor :current_input_str, :font_style, :console_text_width, :last_input_str, :last_input_str_changed ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def two~ +** Processing line: ~ def initialize(font_style:, text_color:, console_text_width:)~ - Inside source: true *** True Line Result - def two -** Processing line: ~ 2~ + def initialize(font_style:, text_color:, console_text_width:) +** Processing line: ~ @prompt = '-> '~ - Inside source: true *** True Line Result - 2 -** Processing line: ~ end~ + @prompt = '-> ' +** Processing line: ~ @current_input_str = ''~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @current_input_str = '' +** Processing line: ~ @font_style = font_style~ - Inside source: true *** True Line Result - -** Processing line: ~ def five~ + @font_style = font_style +** Processing line: ~ @text_color = text_color~ - Inside source: true *** True Line Result - def five -** Processing line: ~ 5~ + @text_color = text_color +** Processing line: ~ @cursor_color = Color.new [187, 21, 6]~ - Inside source: true *** True Line Result - 5 -** Processing line: ~ end~ + @cursor_color = Color.new [187, 21, 6] +** Processing line: ~ @console_text_width = console_text_width~ - Inside source: true *** True Line Result - end + @console_text_width = console_text_width ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def ten~ +** Processing line: ~ @last_autocomplete_prefix = nil~ - Inside source: true *** True Line Result - def ten -** Processing line: ~ 10~ + @last_autocomplete_prefix = nil +** Processing line: ~ @next_candidate_index = 0~ - Inside source: true *** True Line Result - 10 -** Processing line: ~ end~ + @next_candidate_index = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ alias_method :gt, :>~ +** Processing line: ~ def <<(str)~ - Inside source: true *** True Line Result - alias_method :gt, :> -** Processing line: ~ alias_method :above?, :>~ + def <<(str) +** Processing line: ~ @current_input_str << str~ - Inside source: true *** True Line Result - alias_method :above?, :> -** Processing line: ~ alias_method :right_of?, :>~ + @current_input_str << str +** Processing line: ~ @current_input_changed_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - alias_method :right_of?, :> + @current_input_changed_at = Kernel.global_tick_count +** Processing line: ~ reset_autocomplete~ +- Inside source: true +*** True Line Result + reset_autocomplete +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ alias_method :lt, :<~ +** Processing line: ~ def backspace~ - Inside source: true *** True Line Result - alias_method :lt, :< -** Processing line: ~ alias_method :below?, :<~ + def backspace +** Processing line: ~ @current_input_str.chop!~ - Inside source: true *** True Line Result - alias_method :below?, :< -** Processing line: ~ alias_method :left_of?, :<~ + @current_input_str.chop! +** Processing line: ~ reset_autocomplete~ - Inside source: true *** True Line Result - alias_method :left_of?, :< -** Processing line: ~~ + reset_autocomplete +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def shift_right i~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def shift_right i -** Processing line: ~ self + i~ + +** Processing line: ~ def clear~ - Inside source: true *** True Line Result - self + i -** Processing line: ~ end~ + def clear +** Processing line: ~ @current_input_str = ''~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @current_input_str = '' +** Processing line: ~ reset_autocomplete~ - Inside source: true *** True Line Result - -** Processing line: ~ def shift_left i~ + reset_autocomplete +** Processing line: ~ end~ - Inside source: true *** True Line Result - def shift_left i -** Processing line: ~ shift_right(i * -1)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - shift_right(i * -1) -** Processing line: ~ rescue Exception => e~ + +** Processing line: ~ def autocomplete~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise_immediately e, :shift_left, i~ + def autocomplete +** Processing line: ~ if !@last_autocomplete_prefix~ - Inside source: true *** True Line Result - raise_immediately e, :shift_left, i -** Processing line: ~ end~ + if !@last_autocomplete_prefix +** Processing line: ~ @last_autocomplete_prefix = calc_autocomplete_prefix~ - Inside source: true *** True Line Result - end + @last_autocomplete_prefix = calc_autocomplete_prefix ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def shift_up i~ +** Processing line: ~ puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.."~ - Inside source: true *** True Line Result - def shift_up i -** Processing line: ~ self + i~ + puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.." +** Processing line: ~ pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix)~ - Inside source: true *** True Line Result - self + i -** Processing line: ~ rescue Exception => e~ + pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix) +** Processing line: ~ else~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise_immediately e, :shift_up, i~ + else +** Processing line: ~ candidates = method_candidates(@last_autocomplete_prefix)~ - Inside source: true *** True Line Result - raise_immediately e, :shift_up, i -** Processing line: ~ end~ + candidates = method_candidates(@last_autocomplete_prefix) +** Processing line: ~ return if candidates.empty?~ - Inside source: true *** True Line Result - end + return if candidates.empty? ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def shift_down i~ +** Processing line: ~ candidate = candidates[@next_candidate_index]~ - Inside source: true *** True Line Result - def shift_down i -** Processing line: ~ shift_up(i * -1)~ + candidate = candidates[@next_candidate_index] +** Processing line: ~ candidate = candidate[0..-2] + " = " if candidate.end_with? '='~ - Inside source: true *** True Line Result - shift_up(i * -1) -** Processing line: ~ rescue Exception => e~ + candidate = candidate[0..-2] + " = " if candidate.end_with? '=' +** Processing line: ~ @next_candidate_index += 1~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise_immediately e, :shift_down, i~ + @next_candidate_index += 1 +** Processing line: ~ @next_candidate_index = 0 if @next_candidate_index >= candidates.length~ - Inside source: true *** True Line Result - raise_immediately e, :shift_down, i -** Processing line: ~ end~ + @next_candidate_index = 0 if @next_candidate_index >= candidates.length +** Processing line: ~ self.current_input_str = display_autocomplete_candidate(candidate)~ - Inside source: true *** True Line Result - end + self.current_input_str = display_autocomplete_candidate(candidate) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # This provides a way for a numeric value to be randomized based on a combination~ +** Processing line: ~ def pretty_print_strings_as_table items~ - Inside source: true *** True Line Result - # This provides a way for a numeric value to be randomized based on a combination -** Processing line: ~ # of two options: `:sign` and `:ratio`.~ + def pretty_print_strings_as_table items +** Processing line: ~ if items.length == 0~ - Inside source: true *** True Line Result - # of two options: `:sign` and `:ratio`. -** Processing line: ~ #~ + if items.length == 0 +** Processing line: ~ puts <<-S.strip~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + puts <<-S.strip +** Processing line: ~ +--------+~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def randomize *definitions~ + +--------+ +** Processing line: ~ | (none) |~ - Inside source: true *** True Line Result - def randomize *definitions -** Processing line: ~ result = self~ + | (none) | +** Processing line: ~ +--------+~ - Inside source: true *** True Line Result - result = self -** Processing line: ~~ + +--------+ +** Processing line: ~ S~ - Inside source: true *** True Line Result - -** Processing line: ~ if definitions.include?(:sign)~ + S +** Processing line: ~ else~ - Inside source: true *** True Line Result - if definitions.include?(:sign) -** Processing line: ~ result = rand_sign~ + else +** Processing line: ~ # figure out the largest string~ - Inside source: true *** True Line Result - result = rand_sign -** Processing line: ~ end~ + # figure out the largest string +** Processing line: ~ string_width = items.sort_by { |c| -c.to_s.length }.first~ - Inside source: true *** True Line Result - end + string_width = items.sort_by { |c| -c.to_s.length }.first ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ if definitions.include?(:ratio)~ -- Inside source: true -*** True Line Result - if definitions.include?(:ratio) -** Processing line: ~ result = rand * result~ +** Processing line: ~ # add spacing to each side of the string which represents the cell width~ - Inside source: true *** True Line Result - result = rand * result -** Processing line: ~ end~ + # add spacing to each side of the string which represents the cell width +** Processing line: ~ cell_width = string_width.length + 2~ - Inside source: true *** True Line Result - end + cell_width = string_width.length + 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ result~ +** Processing line: ~ # add spacing to each side of the cell to represent the column width~ - Inside source: true *** True Line Result - result -** Processing line: ~ end~ + # add spacing to each side of the cell to represent the column width +** Processing line: ~ column_width = cell_width + 2~ - Inside source: true *** True Line Result - end + column_width = cell_width + 2 ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rand_sign~ -- Inside source: true -*** True Line Result - def rand_sign -** Processing line: ~ return self * -1 if rand > 0.5~ +** Processing line: ~ # determine the max number of columns that can fit on the screen~ - Inside source: true *** True Line Result - return self * -1 if rand > 0.5 -** Processing line: ~ self~ + # determine the max number of columns that can fit on the screen +** Processing line: ~ columns = @console_text_width.idiv column_width~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + columns = @console_text_width.idiv column_width +** Processing line: ~ columns = items.length if items.length < columns~ - Inside source: true *** True Line Result - end + columns = items.length if items.length < columns ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rand_ratio~ +** Processing line: ~ # partition the original list of items into a string to be printed~ - Inside source: true *** True Line Result - def rand_ratio -** Processing line: ~ self * rand~ + # partition the original list of items into a string to be printed +** Processing line: ~ items.each_slice(columns).each_with_index do |cells, i|~ - Inside source: true *** True Line Result - self * rand -** Processing line: ~ end~ + items.each_slice(columns).each_with_index do |cells, i| +** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - end + pretty_print_row_seperator string_width, cell_width, column_width, columns +** Processing line: ~ pretty_print_row cells, string_width, cell_width, column_width, columns~ +- Inside source: true +*** True Line Result + pretty_print_row cells, string_width, cell_width, column_width, columns +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def remainder_of_divide n~ +** Processing line: ~ pretty_print_row_seperator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - def remainder_of_divide n -** Processing line: ~ mod n~ + pretty_print_row_seperator string_width, cell_width, column_width, columns +** Processing line: ~ end~ - Inside source: true *** True Line Result - mod n -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +** Processing line: ~ def pretty_print_row cells, string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ + def pretty_print_row cells, string_width, cell_width, column_width, columns +** Processing line: ~ # if the number of cells doesn't match the number of columns, then pad the array with empty values~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + # if the number of cells doesn't match the number of columns, then pad the array with empty values +** Processing line: ~ cells += (columns - cells.length).map { "" }~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def ease_extended tick_count_override, duration, default_before, default_after, *definitions~ + cells += (columns - cells.length).map { "" } +** Processing line: ~~ - Inside source: true *** True Line Result - def ease_extended tick_count_override, duration, default_before, default_after, *definitions -** Processing line: ~ GTK::Easing.ease_extended self,~ + +** Processing line: ~ # right align each cell value~ - Inside source: true *** True Line Result - GTK::Easing.ease_extended self, -** Processing line: ~ tick_count_override,~ + # right align each cell value +** Processing line: ~ formated_row = "|" + cells.map do |c|~ - Inside source: true *** True Line Result - tick_count_override, -** Processing line: ~ self + duration,~ + formated_row = "|" + cells.map do |c| +** Processing line: ~ "#{" " * (string_width.length - c.length) } #{c} |"~ - Inside source: true *** True Line Result - self + duration, -** Processing line: ~ default_before,~ + "#{" " * (string_width.length - c.length) } #{c} |" +** Processing line: ~ end.join~ - Inside source: true *** True Line Result - default_before, -** Processing line: ~ default_after,~ + end.join +** Processing line: ~~ - Inside source: true *** True Line Result - default_after, -** Processing line: ~ *definitions~ + +** Processing line: ~ # remove seperators between empty values~ - Inside source: true *** True Line Result - *definitions -** Processing line: ~ end~ + # remove seperators between empty values +** Processing line: ~ formated_row = formated_row.gsub(" | ", " ")~ - Inside source: true *** True Line Result - end + formated_row = formated_row.gsub(" | ", " ") ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +** Processing line: ~ puts formated_row~ - Inside source: true *** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ + puts formated_row +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def global_ease duration, *definitions~ + +** Processing line: ~ def pretty_print_row_seperator string_width, cell_width, column_width, columns~ - Inside source: true *** True Line Result - def global_ease duration, *definitions -** Processing line: ~ ease_extended Kernel.global_tick_count,~ + def pretty_print_row_seperator string_width, cell_width, column_width, columns +** Processing line: ~ # this is a joint: +--------~ - Inside source: true *** True Line Result - ease_extended Kernel.global_tick_count, -** Processing line: ~ duration,~ + # this is a joint: +-------- +** Processing line: ~ column_joint = "+#{"-" * cell_width}"~ - Inside source: true *** True Line Result - duration, -** Processing line: ~ GTK::Easing.initial_value(*definitions),~ + column_joint = "+#{"-" * cell_width}" +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Easing.initial_value(*definitions), -** Processing line: ~ GTK::Easing.final_value(*definitions),~ + +** Processing line: ~ # multiple joints create a row seperator: +----+----+~ - Inside source: true *** True Line Result - GTK::Easing.final_value(*definitions), -** Processing line: ~ *definitions~ + # multiple joints create a row seperator: +----+----+ +** Processing line: ~ puts (column_joint * columns) + "+"~ - Inside source: true *** True Line Result - *definitions -** Processing line: ~ end~ + puts (column_joint * columns) + "+" +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ -- Inside source: true -*** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ -- Inside source: true -*** True Line Result - # -** Processing line: ~ # @gtk~ +** Processing line: ~ def render(args, x:, y:)~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def ease duration, *definitions~ + def render(args, x:, y:) +** Processing line: ~ args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color)~ - Inside source: true *** True Line Result - def ease duration, *definitions -** Processing line: ~ ease_extended Kernel.tick_count,~ + args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color) +** Processing line: ~ args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color)~ - Inside source: true *** True Line Result - ease_extended Kernel.tick_count, -** Processing line: ~ duration,~ + args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color) +** Processing line: ~ end~ - Inside source: true *** True Line Result - duration, -** Processing line: ~ GTK::Easing.initial_value(*definitions),~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Easing.initial_value(*definitions), -** Processing line: ~ GTK::Easing.final_value(*definitions),~ + +** Processing line: ~ def tick~ - Inside source: true *** True Line Result - GTK::Easing.final_value(*definitions), -** Processing line: ~ *definitions~ + def tick +** Processing line: ~ if (@current_input_changed_at) &&~ - Inside source: true *** True Line Result - *definitions -** Processing line: ~ end~ + if (@current_input_changed_at) && +** Processing line: ~ (@current_input_changed_at < Kernel.global_tick_count) &&~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + (@current_input_changed_at < Kernel.global_tick_count) && +** Processing line: ~ (@last_input_str != @current_input_str)~ - Inside source: true *** True Line Result - -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ + (@last_input_str != @current_input_str) +** Processing line: ~ @last_input_str_changed = true~ - Inside source: true *** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ + @last_input_str_changed = true +** Processing line: ~ @last_input_str = "#{@current_input_str}"~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + @last_input_str = "#{@current_input_str}" +** Processing line: ~ @current_input_changed_at = nil~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def ease_spline_extended tick_count_override, duration, spline~ + @current_input_changed_at = nil +** Processing line: ~ else~ - Inside source: true *** True Line Result - def ease_spline_extended tick_count_override, duration, spline -** Processing line: ~ GTK::Easing.ease_spline_extended self,~ + else +** Processing line: ~ @last_input_str_changed = false~ - Inside source: true *** True Line Result - GTK::Easing.ease_spline_extended self, -** Processing line: ~ tick_count_override,~ + @last_input_str_changed = false +** Processing line: ~ end~ - Inside source: true *** True Line Result - tick_count_override, -** Processing line: ~ self + duration,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - self + duration, -** Processing line: ~ spline~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - spline -** Processing line: ~ end~ + +** Processing line: ~ private~ - Inside source: true *** True Line Result - end + private ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ -- Inside source: true -*** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ +** Processing line: ~ def last_period_index~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + def last_period_index +** Processing line: ~ current_input_str.rindex('.')~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def global_ease_spline duration, spline~ + current_input_str.rindex('.') +** Processing line: ~ end~ - Inside source: true *** True Line Result - def global_ease_spline duration, spline -** Processing line: ~ ease_spline_extended Kernel.global_tick_count,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ease_spline_extended Kernel.global_tick_count, -** Processing line: ~ duration,~ + +** Processing line: ~ def calc_autocomplete_prefix~ - Inside source: true *** True Line Result - duration, -** Processing line: ~ spline~ + def calc_autocomplete_prefix +** Processing line: ~ if last_period_index~ - Inside source: true *** True Line Result - spline -** Processing line: ~ end~ + if last_period_index +** Processing line: ~ current_input_str[(last_period_index + 1)..-1]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + current_input_str[(last_period_index + 1)..-1] +** Processing line: ~ else~ - Inside source: true *** True Line Result - -** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ + else +** Processing line: ~ current_input_str~ - Inside source: true *** True Line Result - # Easing function progress/percentage for a specific point in time. -** Processing line: ~ #~ + current_input_str +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def ease_spline duration, spline~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def ease_spline duration, spline -** Processing line: ~ ease_spline_extended Kernel.tick_count,~ + +** Processing line: ~ def current_object~ - Inside source: true *** True Line Result - ease_spline_extended Kernel.tick_count, -** Processing line: ~ duration,~ + def current_object +** Processing line: ~ return Kernel unless last_period_index~ - Inside source: true *** True Line Result - duration, -** Processing line: ~ spline~ + return Kernel unless last_period_index +** Processing line: ~~ - Inside source: true *** True Line Result - spline -** Processing line: ~ end~ + +** Processing line: ~ Kernel.eval(current_input_str[0...last_period_index])~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + Kernel.eval(current_input_str[0...last_period_index]) +** Processing line: ~ rescue NameError~ - Inside source: true *** True Line Result - -** Processing line: ~ # Converts a number representing an angle in degrees to radians.~ + rescue NameError +** Processing line: ~ nil~ - Inside source: true *** True Line Result - # Converts a number representing an angle in degrees to radians. -** Processing line: ~ #~ + nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def to_radians~ + +** Processing line: ~ def method_candidates(prefix)~ - Inside source: true *** True Line Result - def to_radians -** Processing line: ~ self * Math::PI.fdiv(180)~ + def method_candidates(prefix) +** Processing line: ~ current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix }~ - Inside source: true *** True Line Result - self * Math::PI.fdiv(180) -** Processing line: ~ end~ + current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix } +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Converts a number representing an angle in radians to degress.~ +** Processing line: ~ def display_autocomplete_candidate(candidate)~ - Inside source: true *** True Line Result - # Converts a number representing an angle in radians to degress. -** Processing line: ~ #~ + def display_autocomplete_candidate(candidate) +** Processing line: ~ if last_period_index~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + if last_period_index +** Processing line: ~ @current_input_str[0..last_period_index] + candidate.to_s~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def to_degrees~ + @current_input_str[0..last_period_index] + candidate.to_s +** Processing line: ~ else~ - Inside source: true *** True Line Result - def to_degrees -** Processing line: ~ self / Math::PI.fdiv(180)~ + else +** Processing line: ~ candidate.to_s~ - Inside source: true *** True Line Result - self / Math::PI.fdiv(180) -** Processing line: ~ end~ + candidate.to_s +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Given `self`, a rectangle primitive is returned.~ +** Processing line: ~ def reset_autocomplete~ - Inside source: true *** True Line Result - # Given `self`, a rectangle primitive is returned. -** Processing line: ~ #~ + def reset_autocomplete +** Processing line: ~ @last_autocomplete_prefix = nil~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @example~ + @last_autocomplete_prefix = nil +** Processing line: ~ @next_candidate_index = 0~ - Inside source: true *** True Line Result - # @example -** Processing line: ~ # 5.to_square 100, 300 # returns [100, 300, 5, 5]~ + @next_candidate_index = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - # 5.to_square 100, 300 # returns [100, 300, 5, 5] -** Processing line: ~ #~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def to_square x, y, anchor_x = 0.5, anchor_y = nil~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def to_square x, y, anchor_x = 0.5, anchor_y = nil -** Processing line: ~ GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y)~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y) -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ # Returns a normal vector for a number that represents an angle in degress.~ -- Inside source: true +** Processing line: ~* controller.rb~ +- Header detected. *** True Line Result - # Returns a normal vector for a number that represents an angle in degress. -** Processing line: ~ #~ + +*** True Line Result +* controller.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/controller.rb~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + # ./dragon/controller.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def vector max_value = 1~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - def vector max_value = 1 -** Processing line: ~ [vector_x(max_value), vector_y(max_value)]~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - [vector_x(max_value), vector_y(max_value)] -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # controller.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # controller.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degress.~ -- Inside source: true -*** True Line Result - # Returns the y component of a normal vector for a number that represents an angle in degress. -** Processing line: ~ #~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - # + module GTK ** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result # @gtk -** Processing line: ~ def vector_y max_value = 1~ +** Processing line: ~ class Controller~ - Inside source: true *** True Line Result - def vector_y max_value = 1 -** Processing line: ~ max_value * Math.sin(self.to_radians)~ + class Controller +** Processing line: ~ # Access to keys that have been pressed down.~ - Inside source: true *** True Line Result - max_value * Math.sin(self.to_radians) -** Processing line: ~ end~ + # Access to keys that have been pressed down. +** Processing line: ~ #~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # +** Processing line: ~ # @return [Controller::Keys]~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degress.~ + # @return [Controller::Keys] +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - # Returns the x component of a normal vector for a number that represents an angle in degress. -** Processing line: ~ #~ + # @gtk +** Processing line: ~ attr_reader :key_down~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + attr_reader :key_down +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def vector_x max_value = 1~ + +** Processing line: ~ # Access to keys that have been released up.~ - Inside source: true *** True Line Result - def vector_x max_value = 1 -** Processing line: ~ max_value * Math.cos(self.to_radians)~ + # Access to keys that have been released up. +** Processing line: ~ #~ - Inside source: true *** True Line Result - max_value * Math.cos(self.to_radians) -** Processing line: ~ end~ + # +** Processing line: ~ # @return [Controller::Keys]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # @return [Controller::Keys] +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - -** Processing line: ~ def x_vector max_value = 1~ + # @gtk +** Processing line: ~ attr_reader :key_up~ - Inside source: true *** True Line Result - def x_vector max_value = 1 -** Processing line: ~ vector_x max_value~ + attr_reader :key_up +** Processing line: ~~ - Inside source: true *** True Line Result - vector_x max_value -** Processing line: ~ end~ + +** Processing line: ~ # Access to keys that have been held down.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Access to keys that have been held down. +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ def y_vector max_value = 1~ + # +** Processing line: ~ # @return [Controller::Keys]~ - Inside source: true *** True Line Result - def y_vector max_value = 1 -** Processing line: ~ vector_y max_value~ + # @return [Controller::Keys] +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - vector_y max_value -** Processing line: ~ end~ + # @gtk +** Processing line: ~ attr_reader :key_held~ - Inside source: true *** True Line Result - end + attr_reader :key_held ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def mod n~ + # @gtk +** Processing line: ~ attr_accessor :left_analog_x_raw,~ - Inside source: true *** True Line Result - def mod n -** Processing line: ~ self % n~ + attr_accessor :left_analog_x_raw, +** Processing line: ~ :left_analog_y_raw,~ - Inside source: true *** True Line Result - self % n -** Processing line: ~ end~ + :left_analog_y_raw, +** Processing line: ~ :left_analog_x_perc,~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + :left_analog_x_perc, +** Processing line: ~ :left_analog_y_perc,~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + :left_analog_y_perc, +** Processing line: ~ :right_analog_x_raw,~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def mod_zero? *ns~ + :right_analog_x_raw, +** Processing line: ~ :right_analog_y_raw,~ - Inside source: true *** True Line Result - def mod_zero? *ns -** Processing line: ~ ns.any? { |n| mod(n) == 0 }~ + :right_analog_y_raw, +** Processing line: ~ :right_analog_x_perc,~ - Inside source: true *** True Line Result - ns.any? { |n| mod(n) == 0 } -** Processing line: ~ end~ + :right_analog_x_perc, +** Processing line: ~ :right_analog_y_perc~ - Inside source: true *** True Line Result - end + :right_analog_y_perc ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def mult n~ -- Inside source: true -*** True Line Result - def mult n -** Processing line: ~ self * n~ +** Processing line: ~~ - Inside source: true *** True Line Result - self * n -** Processing line: ~ end~ + +** Processing line: ~ def initialize~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def initialize +** Processing line: ~ @key_down = Controller::Keys.new~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + @key_down = Controller::Keys.new +** Processing line: ~ @key_up = Controller::Keys.new~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def fdiv n~ + @key_up = Controller::Keys.new +** Processing line: ~ @key_held = Controller::Keys.new~ - Inside source: true *** True Line Result - def fdiv n -** Processing line: ~ self / n.to_f~ + @key_held = Controller::Keys.new +** Processing line: ~ @left_analog_x_raw = 0~ - Inside source: true *** True Line Result - self / n.to_f -** Processing line: ~ end~ + @left_analog_x_raw = 0 +** Processing line: ~ @left_analog_y_raw = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @left_analog_y_raw = 0 +** Processing line: ~ @left_analog_x_perc = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ # Divides `self` by a number `n` as a float, and converts it `to_i`.~ + @left_analog_x_perc = 0 +** Processing line: ~ @left_analog_y_perc = 0~ - Inside source: true *** True Line Result - # Divides `self` by a number `n` as a float, and converts it `to_i`. -** Processing line: ~ #~ + @left_analog_y_perc = 0 +** Processing line: ~ @right_analog_x_raw = 0~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + @right_analog_x_raw = 0 +** Processing line: ~ @right_analog_y_raw = 0~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def idiv n~ + @right_analog_y_raw = 0 +** Processing line: ~ @right_analog_x_perc = 0~ - Inside source: true *** True Line Result - def idiv n -** Processing line: ~ (self / n.to_f).to_i~ + @right_analog_x_perc = 0 +** Processing line: ~ @right_analog_y_perc = 0~ - Inside source: true *** True Line Result - (self / n.to_f).to_i -** Processing line: ~ end~ + @right_analog_y_perc = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns a numeric value that is a quantity `magnitude` closer to~ +** Processing line: ~ def serialize~ - Inside source: true *** True Line Result - # Returns a numeric value that is a quantity `magnitude` closer to -** Processing line: ~ #`self`. If the distance between `self` and `target` is less than~ + def serialize +** Processing line: ~ {~ - Inside source: true *** True Line Result - #`self`. If the distance between `self` and `target` is less than -** Processing line: ~ #the `magnitude` then `target` is returned.~ + { +** Processing line: ~ key_down: @key_down.serialize,~ - Inside source: true *** True Line Result - #the `magnitude` then `target` is returned. -** Processing line: ~ #~ + key_down: @key_down.serialize, +** Processing line: ~ key_held: @key_held.serialize,~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + key_held: @key_held.serialize, +** Processing line: ~ key_up: @key_up.serialize~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def towards target, magnitude~ + key_up: @key_up.serialize +** Processing line: ~ }~ - Inside source: true *** True Line Result - def towards target, magnitude -** Processing line: ~ return self if self == target~ + } +** Processing line: ~ end~ - Inside source: true *** True Line Result - return self if self == target -** Processing line: ~ delta = (self - target).abs~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - delta = (self - target).abs -** Processing line: ~ return target if delta < magnitude~ + +** Processing line: ~ # Clear all current key presses.~ - Inside source: true *** True Line Result - return target if delta < magnitude -** Processing line: ~ return self - magnitude if self > target~ + # Clear all current key presses. +** Processing line: ~ #~ - Inside source: true *** True Line Result - return self - magnitude if self > target -** Processing line: ~ return self + magnitude~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - return self + magnitude -** Processing line: ~ end~ + # @return [void] +** Processing line: ~ def clear~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def clear +** Processing line: ~ @key_down.clear~ - Inside source: true *** True Line Result - -** Processing line: ~ # Given `self` and a number representing `y` of a grid. This~ + @key_down.clear +** Processing line: ~ @key_up.clear~ - Inside source: true *** True Line Result - # Given `self` and a number representing `y` of a grid. This -** Processing line: ~ # function will return a one dimensional array containing the value~ + @key_up.clear +** Processing line: ~ @key_held.clear~ - Inside source: true *** True Line Result - # function will return a one dimensional array containing the value -** Processing line: ~ # yielded by an implicit block.~ + @key_held.clear +** Processing line: ~ end~ - Inside source: true *** True Line Result - # yielded by an implicit block. -** Processing line: ~ #~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @example~ + +** Processing line: ~ def up~ - Inside source: true *** True Line Result - # @example -** Processing line: ~ # 3.map_with_ys 2 do |x, y|~ + def up +** Processing line: ~ @key_up.up || @key_held.up~ - Inside source: true *** True Line Result - # 3.map_with_ys 2 do |x, y| -** Processing line: ~ # x * y~ + @key_up.up || @key_held.up +** Processing line: ~ end~ - Inside source: true *** True Line Result - # x * y -** Processing line: ~ # end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # end -** Processing line: ~ # # x y x y x y x y x y x y~ + +** Processing line: ~ def down~ - Inside source: true *** True Line Result - # # x y x y x y x y x y x y -** Processing line: ~ # # 0*0, 0*1 1*0 1*1 2*0 2*1~ + def down +** Processing line: ~ @key_up.down || @key_held.down~ - Inside source: true *** True Line Result - # # 0*0, 0*1 1*0 1*1 2*0 2*1 -** Processing line: ~ # # => [ 0, 0, 0, 1, 0, 2]~ + @key_up.down || @key_held.down +** Processing line: ~ end~ - Inside source: true *** True Line Result - # # => [ 0, 0, 0, 1, 0, 2] -** Processing line: ~ #~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + +** Processing line: ~ def left~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def map_with_ys ys, &block~ + def left +** Processing line: ~ @key_up.left || @key_held.left~ - Inside source: true *** True Line Result - def map_with_ys ys, &block -** Processing line: ~ self.times.flat_map do |x|~ + @key_up.left || @key_held.left +** Processing line: ~ end~ - Inside source: true *** True Line Result - self.times.flat_map do |x| -** Processing line: ~ ys.map_with_index do |y|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - ys.map_with_index do |y| -** Processing line: ~ yield x, y~ + +** Processing line: ~ def right~ - Inside source: true *** True Line Result - yield x, y -** Processing line: ~ end~ + def right +** Processing line: ~ @key_up.right || @key_held.right~ - Inside source: true *** True Line Result - end + @key_up.right || @key_held.right ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ rescue Exception => e~ +** Processing line: ~~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ raise_immediately e, :map_with_ys, [self, ys]~ + +** Processing line: ~ # Activates a key into the down position.~ - Inside source: true *** True Line Result - raise_immediately e, :map_with_ys, [self, ys] -** Processing line: ~ end~ + # Activates a key into the down position. +** Processing line: ~ #~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # +** Processing line: ~ # @param key [Symbol] The key to press down.~ - Inside source: true *** True Line Result - -** Processing line: ~ def combinations other_int~ + # @param key [Symbol] The key to press down. +** Processing line: ~ #~ - Inside source: true *** True Line Result - def combinations other_int -** Processing line: ~ self.numbers.product(other_int.numbers)~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - self.numbers.product(other_int.numbers) -** Processing line: ~ end~ + # @return [void] +** Processing line: ~ def activate_down(key)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def activate_down(key) +** Processing line: ~ key_down.activate(key)~ - Inside source: true *** True Line Result - -** Processing line: ~ def percentage_of n~ + key_down.activate(key) +** Processing line: ~ key_held.deactivate(key)~ - Inside source: true *** True Line Result - def percentage_of n -** Processing line: ~ (self / n.to_f).cap_min_max(0, 1)~ + key_held.deactivate(key) +** Processing line: ~ key_up.deactivate(key)~ - Inside source: true *** True Line Result - (self / n.to_f).cap_min_max(0, 1) -** Processing line: ~ end~ + key_up.deactivate(key) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def cap i~ +** Processing line: ~ # Activates a key into the held down position.~ - Inside source: true *** True Line Result - def cap i -** Processing line: ~ return i if self > i~ + # Activates a key into the held down position. +** Processing line: ~ #~ - Inside source: true *** True Line Result - return i if self > i -** Processing line: ~ self~ + # +** Processing line: ~ # @param key [Symbol] The key to hold down.~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + # @param key [Symbol] The key to hold down. +** Processing line: ~ #~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - -** Processing line: ~ def cap_min_max min, max~ + # @return [void] +** Processing line: ~ def activate_held(key)~ - Inside source: true *** True Line Result - def cap_min_max min, max -** Processing line: ~ return min if self < min~ + def activate_held(key) +** Processing line: ~ key_down.deactivate(key)~ - Inside source: true *** True Line Result - return min if self < min -** Processing line: ~ return max if self > max~ + key_down.deactivate(key) +** Processing line: ~ key_held.activate(key) unless key_held.send(key)~ - Inside source: true *** True Line Result - return max if self > max -** Processing line: ~ self~ + key_held.activate(key) unless key_held.send(key) +** Processing line: ~ key_up.deactivate(key)~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + key_up.deactivate(key) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def lesser other~ +** Processing line: ~~ - Inside source: true *** True Line Result - def lesser other -** Processing line: ~ return other if other < self~ + +** Processing line: ~ # Activates a key release into the up position.~ - Inside source: true *** True Line Result - return other if other < self -** Processing line: ~ self~ + # Activates a key release into the up position. +** Processing line: ~ #~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + # +** Processing line: ~ # @param key [Symbol] The key release up.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # @param key [Symbol] The key release up. +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ def greater other~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - def greater other -** Processing line: ~ return other if other > self~ + # @return [void] +** Processing line: ~ def activate_up(key)~ - Inside source: true *** True Line Result - return other if other > self -** Processing line: ~ self~ + def activate_up(key) +** Processing line: ~ key_down.deactivate(key)~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + key_down.deactivate(key) +** Processing line: ~ key_held.deactivate(key)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + key_held.deactivate(key) +** Processing line: ~ key_up.activate(key)~ - Inside source: true *** True Line Result - -** Processing line: ~ def subtract i~ + key_up.activate(key) +** Processing line: ~ end~ - Inside source: true *** True Line Result - def subtract i -** Processing line: ~ self - i~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - self - i + +** Processing line: ~ include DirectionalInputHelperMethods~ +- Inside source: true +*** True Line Result + include DirectionalInputHelperMethods ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ def minus i~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def minus i -** Processing line: ~ self - i~ + +** Processing line: ~~ - Inside source: true *** True Line Result - self - i -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def add i~ -- Inside source: true +** Processing line: ~* controller/config.rb~ +- Header detected. *** True Line Result - def add i -** Processing line: ~ self + i~ -- Inside source: true + *** True Line Result - self + i -** Processing line: ~ end~ +* controller/config.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/controller/config.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./dragon/controller/config.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - -** Processing line: ~ def plus i~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - def plus i -** Processing line: ~ self + i~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - self + i -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # controller/config.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # controller/config.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def numbers~ +** Processing line: ~ # !!! FIXME: add console command to forget custom binding(s)~ - Inside source: true *** True Line Result - def numbers -** Processing line: ~ (0..self).to_a~ + # !!! FIXME: add console command to forget custom binding(s) +** Processing line: ~ # !!! FIXME: add console command to forget replace existing binding(s)~ - Inside source: true *** True Line Result - (0..self).to_a -** Processing line: ~ end~ + # !!! FIXME: add console command to forget replace existing binding(s) +** Processing line: ~ # !!! FIXME: add console command go into play_around mode to make sure controller isn't wonky.~ - Inside source: true *** True Line Result - end + # !!! FIXME: add console command go into play_around mode to make sure controller isn't wonky. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def >= other~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - def >= other -** Processing line: ~ return false if !other~ + module GTK +** Processing line: ~ class Controller~ - Inside source: true *** True Line Result - return false if !other -** Processing line: ~ return gte other~ + class Controller +** Processing line: ~ class Config~ - Inside source: true *** True Line Result - return gte other -** Processing line: ~ end~ + class Config +** Processing line: ~ def initialize runtime~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def initialize runtime +** Processing line: ~ @runtime = runtime~ - Inside source: true *** True Line Result - -** Processing line: ~ def > other~ + @runtime = runtime +** Processing line: ~ @raw_joysticks = {} # things that aren't game controllers to try to configure.~ - Inside source: true *** True Line Result - def > other -** Processing line: ~ return false if !other~ + @raw_joysticks = {} # things that aren't game controllers to try to configure. +** Processing line: ~ @target = nil~ - Inside source: true *** True Line Result - return false if !other -** Processing line: ~ return gt other~ + @target = nil +** Processing line: ~ @animation_duration = (1.5).seconds~ - Inside source: true *** True Line Result - return gt other -** Processing line: ~ end~ + @animation_duration = (1.5).seconds +** Processing line: ~ @toggled_at = 0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @toggled_at = 0 +** Processing line: ~ @fading = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ def <= other~ + @fading = 0 +** Processing line: ~ @current_part = 0~ - Inside source: true *** True Line Result - def <= other -** Processing line: ~ return false if !other~ + @current_part = 0 +** Processing line: ~ @part_alpha = 0~ - Inside source: true *** True Line Result - return false if !other -** Processing line: ~ return lte other~ + @part_alpha = 0 +** Processing line: ~ @part_alpha_increment = 10~ - Inside source: true *** True Line Result - return lte other -** Processing line: ~ end~ + @part_alpha_increment = 10 +** Processing line: ~ @joystick_state = {}~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @joystick_state = {} +** Processing line: ~ @playing_around = false~ - Inside source: true *** True Line Result - -** Processing line: ~ def < other~ + @playing_around = false +** Processing line: ~ @used_bindings = {}~ - Inside source: true *** True Line Result - def < other -** Processing line: ~ return false if !other~ + @used_bindings = {} +** Processing line: ~ @bindings = []~ - Inside source: true *** True Line Result - return false if !other -** Processing line: ~ return gt other~ + @bindings = [] +** Processing line: ~ @parts = [~ - Inside source: true *** True Line Result - return gt other -** Processing line: ~ end~ + @parts = [ +** Processing line: ~ [ 919, 282, 'A button', 'a' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ 919, 282, 'A button', 'a' ], +** Processing line: ~ [ 960, 323, 'B button', 'b' ],~ - Inside source: true *** True Line Result - -** Processing line: ~ alias_method(:original_eq_eq, :==) unless Numeric.instance_methods.include?(:original_eq_eq)~ + [ 960, 323, 'B button', 'b' ], +** Processing line: ~ [ 878, 323, 'X button', 'x' ],~ - Inside source: true *** True Line Result - alias_method(:original_eq_eq, :==) unless Numeric.instance_methods.include?(:original_eq_eq) -** Processing line: ~ def == other~ + [ 878, 323, 'X button', 'x' ], +** Processing line: ~ [ 919, 365, 'Y button', 'y' ],~ - Inside source: true *** True Line Result - def == other -** Processing line: ~ return true if self.original_eq_eq(other)~ + [ 919, 365, 'Y button', 'y' ], +** Processing line: ~ [ 433, 246, 'left stick left', '-leftx' ],~ - Inside source: true *** True Line Result - return true if self.original_eq_eq(other) -** Processing line: ~ if other.is_a?(OpenEntity)~ + [ 433, 246, 'left stick left', '-leftx' ], +** Processing line: ~ [ 497, 246, 'left stick right', '+leftx' ],~ - Inside source: true *** True Line Result - if other.is_a?(OpenEntity) -** Processing line: ~ return self.original_eq_eq(other.entity_id)~ + [ 497, 246, 'left stick right', '+leftx' ], +** Processing line: ~ [ 466, 283, 'left stick up', '-lefty' ],~ - Inside source: true *** True Line Result - return self.original_eq_eq(other.entity_id) -** Processing line: ~ end~ + [ 466, 283, 'left stick up', '-lefty' ], +** Processing line: ~ [ 466, 218, 'left stick down', '+lefty' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~ return self.original_eq_eq(other)~ + [ 466, 218, 'left stick down', '+lefty' ], +** Processing line: ~ [ 466, 246, 'left stick button', 'leftstick' ],~ - Inside source: true *** True Line Result - return self.original_eq_eq(other) -** Processing line: ~ end~ + [ 466, 246, 'left stick button', 'leftstick' ], +** Processing line: ~ [ 741, 246, 'right stick left', '-rightx' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ 741, 246, 'right stick left', '-rightx' ], +** Processing line: ~ [ 802, 246, 'right stick right', '+rightx' ],~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + [ 802, 246, 'right stick right', '+rightx' ], +** Processing line: ~ [ 773, 283, 'right stick up', '-righty' ],~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def map~ + [ 773, 283, 'right stick up', '-righty' ], +** Processing line: ~ [ 773, 218, 'right stick down', '+righty' ],~ - Inside source: true *** True Line Result - def map -** Processing line: ~ unless block_given?~ + [ 773, 218, 'right stick down', '+righty' ], +** Processing line: ~ [ 772, 246, 'right stick button', 'rightstick' ],~ - Inside source: true *** True Line Result - unless block_given? -** Processing line: ~ raise <<-S~ + [ 772, 246, 'right stick button', 'rightstick' ], +** Processing line: ~ [ 263, 465, 'left shoulder button', 'leftshoulder' ],~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + [ 263, 465, 'left shoulder button', 'leftshoulder' ], +** Processing line: ~ [ 263, 503, 'left trigger', 'lefttrigger' ],~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ A block is required for Numeric#map.~ + [ 263, 503, 'left trigger', 'lefttrigger' ], +** Processing line: ~ [ 977, 465, 'right shoulder button', 'rightshoulder' ],~ - Inside source: true *** True Line Result - A block is required for Numeric#map. -** Processing line: ~~ + [ 977, 465, 'right shoulder button', 'rightshoulder' ], +** Processing line: ~ [ 977, 503, 'right trigger', 'righttrigger' ],~ - Inside source: true *** True Line Result - -** Processing line: ~ S~ + [ 977, 503, 'right trigger', 'righttrigger' ], +** Processing line: ~ [ 318, 365, 'D-pad up', 'dpup' ],~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + [ 318, 365, 'D-pad up', 'dpup' ], +** Processing line: ~ [ 360, 322, 'D-pad right', 'dpright' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ 360, 322, 'D-pad right', 'dpright' ], +** Processing line: ~ [ 318, 280, 'D-pad down', 'dpdown' ],~ - Inside source: true *** True Line Result - -** Processing line: ~ self.to_i.times.map do~ + [ 318, 280, 'D-pad down', 'dpdown' ], +** Processing line: ~ [ 275, 322, 'D-pad left', 'dpleft' ],~ - Inside source: true *** True Line Result - self.to_i.times.map do -** Processing line: ~ yield~ + [ 275, 322, 'D-pad left', 'dpleft' ], +** Processing line: ~ [ 570, 402, 'select/back button', 'back'],~ - Inside source: true *** True Line Result - yield -** Processing line: ~ end~ + [ 570, 402, 'select/back button', 'back'], +** Processing line: ~ [ 619, 448, 'guide/home button', 'guide' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + [ 619, 448, 'guide/home button', 'guide' ], +** Processing line: ~ [ 669, 402, 'start button', 'start' ],~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + [ 669, 402, 'start button', 'start' ], +** Processing line: ~ ]~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + ] +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def map_with_index~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def map_with_index -** Processing line: ~ unless block_given?~ + +** Processing line: ~ def rawjoystick_connected jid, joystickname, guid~ - Inside source: true *** True Line Result - unless block_given? -** Processing line: ~ raise <<-S~ + def rawjoystick_connected jid, joystickname, guid +** Processing line: ~ return if jid < 0~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + return if jid < 0 +** Processing line: ~ @raw_joysticks[jid] = { name: joystickname, guid: guid }~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ A block is required for Numeric#map.~ + @raw_joysticks[jid] = { name: joystickname, guid: guid } +** Processing line: ~ end~ - Inside source: true *** True Line Result - A block is required for Numeric#map. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ S~ -- Inside source: true -*** True Line Result - S -** Processing line: ~ end~ +** Processing line: ~ def rawjoystick_disconnected jid~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def rawjoystick_disconnected jid +** Processing line: ~ return if jid < 0~ - Inside source: true *** True Line Result - -** Processing line: ~ self.to_i.times.map do |i|~ + return if jid < 0 +** Processing line: ~ if @raw_joysticks[jid] != nil~ - Inside source: true *** True Line Result - self.to_i.times.map do |i| -** Processing line: ~ yield i~ + if @raw_joysticks[jid] != nil +** Processing line: ~ @raw_joysticks.delete(jid)~ - Inside source: true *** True Line Result - yield i -** Processing line: ~ end~ + @raw_joysticks.delete(jid) +** Processing line: ~ @runtime.ffi_misc.close_raw_joystick(jid)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + @runtime.ffi_misc.close_raw_joystick(jid) +** Processing line: ~ # Fade out the config screen if we were literally configuring this controller right now.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # Fade out the config screen if we were literally configuring this controller right now. +** Processing line: ~ if !@target.nil? && @target[0] == jid~ - Inside source: true *** True Line Result - -** Processing line: ~ def check_numeric! sender, other~ + if !@target.nil? && @target[0] == jid +** Processing line: ~ @target[0] = nil~ - Inside source: true *** True Line Result - def check_numeric! sender, other -** Processing line: ~ return if other.is_a? Numeric~ + @target[0] = nil +** Processing line: ~ @toggled_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - return if other.is_a? Numeric -** Processing line: ~~ + @toggled_at = Kernel.global_tick_count +** Processing line: ~ @fading = -1~ - Inside source: true *** True Line Result - -** Processing line: ~ raise <<-S~ + @fading = -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - raise <<-S -** Processing line: ~ * ERROR:~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - * ERROR: -** Processing line: ~ Attempted to invoke :+ on #{self} with the right hand argument of:~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - Attempted to invoke :+ on #{self} with the right hand argument of: + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #{other}~ +** Processing line: ~ def build_binding_string~ - Inside source: true *** True Line Result - #{other} -** Processing line: ~~ + def build_binding_string +** Processing line: ~ bindingstr = ''~ - Inside source: true *** True Line Result - -** Processing line: ~ The object above is not a Numeric.~ + bindingstr = '' +** Processing line: ~ skip = false~ - Inside source: true *** True Line Result - The object above is not a Numeric. + skip = false ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ S~ +** Processing line: ~ for i in 0..@parts.length-1~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + for i in 0..@parts.length-1 +** Processing line: ~ if skip ; skip = false ; next ; end~ - Inside source: true *** True Line Result - end + if skip ; skip = false ; next ; end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def - other~ -- Inside source: true -*** True Line Result - def - other -** Processing line: ~ return nil unless other~ +** Processing line: ~ binding = @bindings[i]~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :-, other~ + binding = @bindings[i] +** Processing line: ~ next if binding.nil?~ - Inside source: true *** True Line Result - check_numeric! :-, other -** Processing line: ~ super~ + next if binding.nil? +** Processing line: ~~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + +** Processing line: ~ part = @parts[i][3]~ - Inside source: true *** True Line Result - end + part = @parts[i][3] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def + other~ +** Processing line: ~ # clean up string:~ - Inside source: true *** True Line Result - def + other -** Processing line: ~ return nil unless other~ + # clean up string: +** Processing line: ~ # if axis uses -a0 for negative and +a0 for positive, just make it "leftx:a0" instead of "-leftx:-a0,+leftx:+a0"~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :+, other~ + # if axis uses -a0 for negative and +a0 for positive, just make it "leftx:a0" instead of "-leftx:-a0,+leftx:+a0" +** Processing line: ~ # if axis uses +a0 for negative and -a0 for positive, just make it "leftx:a0~" instead of "-leftx:+a0,+leftx:-a0"~ - Inside source: true *** True Line Result - check_numeric! :+, other -** Processing line: ~ super~ + # if axis uses +a0 for negative and -a0 for positive, just make it "leftx:a0~" instead of "-leftx:+a0,+leftx:-a0" +** Processing line: ~ if part == '-leftx' || part == '-lefty' || part == '-rightx' || part == '-righty'~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + if part == '-leftx' || part == '-lefty' || part == '-rightx' || part == '-righty' +** Processing line: ~ nextbinding = @bindings[i+1]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + nextbinding = @bindings[i+1] +** Processing line: ~ if binding.start_with?('-a') && nextbinding.start_with?('+a') && binding[2..-1] == nextbinding[2..-1]~ - Inside source: true *** True Line Result - -** Processing line: ~ def * other~ + if binding.start_with?('-a') && nextbinding.start_with?('+a') && binding[2..-1] == nextbinding[2..-1] +** Processing line: ~ skip = true~ - Inside source: true *** True Line Result - def * other -** Processing line: ~ return nil unless other~ + skip = true +** Processing line: ~ part = part[1..-1]~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :*, other~ + part = part[1..-1] +** Processing line: ~ binding = binding[1..-1]~ - Inside source: true *** True Line Result - check_numeric! :*, other -** Processing line: ~ super~ + binding = binding[1..-1] +** Processing line: ~ elsif binding.start_with?('+a') && nextbinding.start_with?('-a') && binding[2..-1] == nextbinding[2..-1]~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + elsif binding.start_with?('+a') && nextbinding.start_with?('-a') && binding[2..-1] == nextbinding[2..-1] +** Processing line: ~ skip = true~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + skip = true +** Processing line: ~ part = part[1..-1]~ - Inside source: true *** True Line Result - -** Processing line: ~ def / other~ + part = part[1..-1] +** Processing line: ~ binding = "#{binding[1..-1]}~"~ - Inside source: true *** True Line Result - def / other -** Processing line: ~ return nil unless other~ + binding = "#{binding[1..-1]}~" +** Processing line: ~ end~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :/, other~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - check_numeric! :/, other -** Processing line: ~ super~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + +** Processing line: ~ bindingstr += "#{!bindingstr.empty? ? ',' : ''}#{part}:#{binding}"~ - Inside source: true *** True Line Result - end + bindingstr += "#{!bindingstr.empty? ? ',' : ''}#{part}:#{binding}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ details = @target[1]~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ self~ + details = @target[1] +** Processing line: ~~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + +** Processing line: ~ # !!! FIXME: no String.delete in mRuby?!?! Maybe so when upgrading.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # !!! FIXME: no String.delete in mRuby?!?! Maybe so when upgrading. +** Processing line: ~ #name = details[:name].delete(',')~ - Inside source: true *** True Line Result - -** Processing line: ~ def from_top~ + #name = details[:name].delete(',') +** Processing line: ~ # !!! FIXME: ...no regexp either... :/~ - Inside source: true *** True Line Result - def from_top -** Processing line: ~ return 720 - self unless $gtk~ + # !!! FIXME: ...no regexp either... :/ +** Processing line: ~ #name = details[:name].gsub(/,/, ' ') # !!! FIXME: will SDL let you escape these instead?~ - Inside source: true *** True Line Result - return 720 - self unless $gtk -** Processing line: ~ $gtk.args.grid.h - self~ + #name = details[:name].gsub(/,/, ' ') # !!! FIXME: will SDL let you escape these instead? +** Processing line: ~ unescaped = details[:name]~ - Inside source: true *** True Line Result - $gtk.args.grid.h - self -** Processing line: ~ end~ + unescaped = details[:name] +** Processing line: ~ name = ''~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + name = '' +** Processing line: ~ for i in 0..unescaped.length-1~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + for i in 0..unescaped.length-1 +** Processing line: ~ ch = unescaped[i]~ - Inside source: true *** True Line Result - -** Processing line: ~ class Fixnum~ + ch = unescaped[i] +** Processing line: ~ name += (ch == ',') ? ' ' : ch~ - Inside source: true *** True Line Result - class Fixnum -** Processing line: ~ include ValueType~ + name += (ch == ',') ? ' ' : ch +** Processing line: ~ end~ - Inside source: true *** True Line Result - include ValueType -** Processing line: ~~ + end +** Processing line: ~ return "#{details[:guid]},#{name},platform:#{@runtime.platform},#{bindingstr}"~ - Inside source: true *** True Line Result - -** Processing line: ~ alias_method(:original_eq_eq, :==) unless Fixnum.instance_methods.include?(:original_eq_eq)~ + return "#{details[:guid]},#{name},platform:#{@runtime.platform},#{bindingstr}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - alias_method(:original_eq_eq, :==) unless Fixnum.instance_methods.include?(:original_eq_eq) + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def - other~ +** Processing line: ~ def move_to_different_part part~ - Inside source: true *** True Line Result - def - other -** Processing line: ~ return nil unless other~ + def move_to_different_part part +** Processing line: ~ if !@joystick_state[:axes].nil?~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :-, other~ + if !@joystick_state[:axes].nil? +** Processing line: ~ @joystick_state[:axes].each { |i| i[:farthestval] = i[:startingval] if !i.nil? }~ - Inside source: true *** True Line Result - check_numeric! :-, other -** Processing line: ~ super~ + @joystick_state[:axes].each { |i| i[:farthestval] = i[:startingval] if !i.nil? } +** Processing line: ~ end~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + end +** Processing line: ~ @current_part = part~ - Inside source: true *** True Line Result - end + @current_part = part +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns `true` if the numeric value is evenly divisible by 2.~ +** Processing line: ~ def previous_part~ - Inside source: true *** True Line Result - # Returns `true` if the numeric value is evenly divisible by 2. -** Processing line: ~ #~ + def previous_part +** Processing line: ~ if @current_part > 0~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + if @current_part > 0 +** Processing line: ~ # remove the binding that we previous had here so it can be reused.~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def even?~ + # remove the binding that we previous had here so it can be reused. +** Processing line: ~ bindstr = @bindings[@current_part - 1]~ - Inside source: true *** True Line Result - def even? -** Processing line: ~ return (self % 2) == 0~ + bindstr = @bindings[@current_part - 1] +** Processing line: ~ @bindings[@current_part - 1] = nil~ - Inside source: true *** True Line Result - return (self % 2) == 0 -** Processing line: ~ end~ + @bindings[@current_part - 1] = nil +** Processing line: ~ @used_bindings[bindstr] = nil~ - Inside source: true *** True Line Result - end + @used_bindings[bindstr] = nil +** Processing line: ~ move_to_different_part @current_part - 1~ +- Inside source: true +*** True Line Result + move_to_different_part @current_part - 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns `true` if the numeric value is *NOT* evenly divisible by 2.~ +** Processing line: ~ def next_part~ - Inside source: true *** True Line Result - # Returns `true` if the numeric value is *NOT* evenly divisible by 2. -** Processing line: ~ #~ + def next_part +** Processing line: ~ if @current_part < (@parts.length - 1)~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + if @current_part < (@parts.length - 1) +** Processing line: ~ move_to_different_part @current_part + 1~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def odd?~ + move_to_different_part @current_part + 1 +** Processing line: ~ else~ - Inside source: true *** True Line Result - def odd? -** Processing line: ~ return !even?~ + else +** Processing line: ~ @playing_around = true~ - Inside source: true *** True Line Result - return !even? -** Processing line: ~ end~ + @playing_around = true +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def + other~ +** Processing line: ~ def set_binding bindstr~ - Inside source: true *** True Line Result - def + other -** Processing line: ~ return nil unless other~ + def set_binding bindstr +** Processing line: ~ return false if !@used_bindings[bindstr].nil?~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :+, other~ + return false if !@used_bindings[bindstr].nil? +** Processing line: ~ @used_bindings[bindstr] = @current_part~ - Inside source: true *** True Line Result - check_numeric! :+, other -** Processing line: ~ super~ + @used_bindings[bindstr] = @current_part +** Processing line: ~ @bindings[@current_part] = bindstr~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + @bindings[@current_part] = bindstr +** Processing line: ~ return true~ - Inside source: true *** True Line Result - end + return true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def * other~ +** Processing line: ~ # Called when a lowlevel joystick moves an axis.~ - Inside source: true *** True Line Result - def * other -** Processing line: ~ return nil unless other~ + # Called when a lowlevel joystick moves an axis. +** Processing line: ~ def rawjoystick_axis jid, axis, value~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :*, other~ + def rawjoystick_axis jid, axis, value +** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ - Inside source: true *** True Line Result - check_numeric! :*, other -** Processing line: ~ super~ + return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. +** Processing line: ~~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + +** Processing line: ~ @joystick_state[:axes] ||= []~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @joystick_state[:axes] ||= [] +** Processing line: ~ @joystick_state[:axes][axis] ||= {~ - Inside source: true *** True Line Result - -** Processing line: ~ def / other~ + @joystick_state[:axes][axis] ||= { +** Processing line: ~ moving: false,~ - Inside source: true *** True Line Result - def / other -** Processing line: ~ return nil unless other~ + moving: false, +** Processing line: ~ startingval: 0,~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :/, other~ + startingval: 0, +** Processing line: ~ currentval: 0,~ - Inside source: true *** True Line Result - check_numeric! :/, other -** Processing line: ~ super~ + currentval: 0, +** Processing line: ~ farthestval: 0~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + farthestval: 0 +** Processing line: ~ }~ - Inside source: true *** True Line Result - end + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def == other~ +** Processing line: ~ # this is the logic from SDL's controllermap.c, more or less, since this is hard to get right from scratch.~ - Inside source: true *** True Line Result - def == other -** Processing line: ~ return true if self.original_eq_eq(other)~ + # this is the logic from SDL's controllermap.c, more or less, since this is hard to get right from scratch. +** Processing line: ~ state = @joystick_state[:axes][axis]~ - Inside source: true *** True Line Result - return true if self.original_eq_eq(other) -** Processing line: ~ if other.is_a?(GTK::OpenEntity)~ + state = @joystick_state[:axes][axis] +** Processing line: ~ state[:currentval] = value~ - Inside source: true *** True Line Result - if other.is_a?(GTK::OpenEntity) -** Processing line: ~ return self.original_eq_eq(other.entity_id)~ + state[:currentval] = value +** Processing line: ~ if !state[:moving]~ - Inside source: true *** True Line Result - return self.original_eq_eq(other.entity_id) -** Processing line: ~ end~ + if !state[:moving] +** Processing line: ~ state[:moving] = true~ - Inside source: true *** True Line Result - end -** Processing line: ~ return self.original_eq_eq(other)~ + state[:moving] = true +** Processing line: ~ state[:startingval] = value~ - Inside source: true *** True Line Result - return self.original_eq_eq(other) -** Processing line: ~ end~ + state[:startingval] = value +** Processing line: ~ state[:farthestval] = value~ - Inside source: true *** True Line Result - end + state[:farthestval] = value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns `-1` if the number is less than `0`. `+1` if the number~ +** Processing line: ~ current_distance = (value - state[:startingval]).abs~ - Inside source: true *** True Line Result - # Returns `-1` if the number is less than `0`. `+1` if the number -** Processing line: ~ # is greater than `0`. Returns `0` if the number is equal to `0`.~ + current_distance = (value - state[:startingval]).abs +** Processing line: ~ farthest_distance = (state[:farthestval] - state[:startingval]).abs~ - Inside source: true *** True Line Result - # is greater than `0`. Returns `0` if the number is equal to `0`. -** Processing line: ~ #~ + farthest_distance = (state[:farthestval] - state[:startingval]).abs +** Processing line: ~ if current_distance > farthest_distance~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + if current_distance > farthest_distance +** Processing line: ~ state[:farthestval] = value~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def sign~ + state[:farthestval] = value +** Processing line: ~ farthest_distance = (state[:farthestval] - state[:startingval]).abs~ - Inside source: true *** True Line Result - def sign -** Processing line: ~ return -1 if self < 0~ + farthest_distance = (state[:farthestval] - state[:startingval]).abs +** Processing line: ~ end~ - Inside source: true *** True Line Result - return -1 if self < 0 -** Processing line: ~ return 1 if self > 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - return 1 if self > 0 -** Processing line: ~ return 0~ + +** Processing line: ~ # If we've gone out far enough and started to come back, let's bind this axis~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + # If we've gone out far enough and started to come back, let's bind this axis +** Processing line: ~ if (farthest_distance >= 16000) && (current_distance <= 10000)~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if (farthest_distance >= 16000) && (current_distance <= 10000) +** Processing line: ~ next_part if set_binding("#{(state[:farthestval] < 0) ? '-' : '+'}a#{axis}")~ - Inside source: true *** True Line Result - -** Processing line: ~ # Returns `true` if number is greater than `0`.~ + next_part if set_binding("#{(state[:farthestval] < 0) ? '-' : '+'}a#{axis}") +** Processing line: ~ end~ - Inside source: true *** True Line Result - # Returns `true` if number is greater than `0`. -** Processing line: ~ #~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def pos?~ + +** Processing line: ~ # Called when a lowlevel joystick moves a hat.~ - Inside source: true *** True Line Result - def pos? -** Processing line: ~ sign > 0~ + # Called when a lowlevel joystick moves a hat. +** Processing line: ~ def rawjoystick_hat jid, hat, value~ - Inside source: true *** True Line Result - sign > 0 -** Processing line: ~ end~ + def rawjoystick_hat jid, hat, value +** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ - Inside source: true *** True Line Result - end + return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns `true` if number is less than `0`.~ +** Processing line: ~ @joystick_state[:hats] ||= []~ - Inside source: true *** True Line Result - # Returns `true` if number is less than `0`. -** Processing line: ~ #~ + @joystick_state[:hats] ||= [] +** Processing line: ~ @joystick_state[:hats][hat] = value~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + @joystick_state[:hats][hat] = value +** Processing line: ~~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def neg?~ + +** Processing line: ~ return if value == 0 # 0 == centered, skip it~ - Inside source: true *** True Line Result - def neg? -** Processing line: ~ sign < 0~ + return if value == 0 # 0 == centered, skip it +** Processing line: ~ next_part if set_binding("h#{hat}.#{value}")~ - Inside source: true *** True Line Result - sign < 0 -** Processing line: ~ end~ + next_part if set_binding("h#{hat}.#{value}") +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +** Processing line: ~ # Called when a lowlevel joystick moves a button.~ - Inside source: true *** True Line Result - # Returns the cosine of a represented in degrees (NOT radians). -** Processing line: ~ #~ + # Called when a lowlevel joystick moves a button. +** Processing line: ~ def rawjoystick_button jid, button, pressed~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + def rawjoystick_button jid, button, pressed +** Processing line: ~ return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick.~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def cos~ + return if @target.nil? || jid != @target[0] || @fading != 0 # skip if not currently considering this joystick. +** Processing line: ~~ - Inside source: true *** True Line Result - def cos -** Processing line: ~ Math.cos(self.to_radians)~ + +** Processing line: ~ @joystick_state[:buttons] ||= []~ - Inside source: true *** True Line Result - Math.cos(self.to_radians) -** Processing line: ~ end~ + @joystick_state[:buttons] ||= [] +** Processing line: ~ @joystick_state[:buttons][button] = pressed~ - Inside source: true *** True Line Result - end + @joystick_state[:buttons][button] = pressed ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +** Processing line: ~ return if !pressed~ - Inside source: true *** True Line Result - # Returns the cosine of a represented in degrees (NOT radians). -** Processing line: ~ #~ + return if !pressed +** Processing line: ~ next_part if set_binding("b#{button}")~ - Inside source: true *** True Line Result - # -** Processing line: ~ # @gtk~ + next_part if set_binding("b#{button}") +** Processing line: ~ end~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def sin~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - def sin -** Processing line: ~ Math.sin(self.to_radians)~ + +** Processing line: ~ def calc_fading~ - Inside source: true *** True Line Result - Math.sin(self.to_radians) -** Processing line: ~ end~ + def calc_fading +** Processing line: ~ if @fading == 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + if @fading == 0 +** Processing line: ~ return 255~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return 255 +** Processing line: ~ elsif @fading > 0 # fading in~ - Inside source: true *** True Line Result - -** Processing line: ~ class Float~ + elsif @fading > 0 # fading in +** Processing line: ~ percent = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip)~ - Inside source: true *** True Line Result - class Float -** Processing line: ~ include ValueType~ + percent = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) +** Processing line: ~ if percent >= 1.0~ - Inside source: true *** True Line Result - include ValueType -** Processing line: ~~ + if percent >= 1.0 +** Processing line: ~ percent = 1.0~ - Inside source: true *** True Line Result - -** Processing line: ~ def - other~ + percent = 1.0 +** Processing line: ~ @fading = 0~ - Inside source: true *** True Line Result - def - other -** Processing line: ~ return nil unless other~ + @fading = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :-, other~ + end +** Processing line: ~ else # fading out~ - Inside source: true *** True Line Result - check_numeric! :-, other -** Processing line: ~ super~ + else # fading out +** Processing line: ~ percent = @toggled_at.global_ease(@animation_duration, :flip, :quint)~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + percent = @toggled_at.global_ease(@animation_duration, :flip, :quint) +** Processing line: ~ if percent <= 0.0~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if percent <= 0.0 +** Processing line: ~ percent = 0.0~ - Inside source: true *** True Line Result - -** Processing line: ~ def + other~ + percent = 0.0 +** Processing line: ~ @fading = 0~ - Inside source: true *** True Line Result - def + other -** Processing line: ~ return nil unless other~ + @fading = 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :+, other~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - check_numeric! :+, other -** Processing line: ~ super~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + +** Processing line: ~ return (percent * 255.0).to_i~ - Inside source: true *** True Line Result - end + return (percent * 255.0).to_i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def * other~ +** Processing line: ~ def render_basics args, msg, fade=255~ - Inside source: true *** True Line Result - def * other -** Processing line: ~ return nil unless other~ + def render_basics args, msg, fade=255 +** Processing line: ~ joystickname = @target[1][:name]~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :*, other~ + joystickname = @target[1][:name] +** Processing line: ~ args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 255, 255, 255, fade].solid~ - Inside source: true *** True Line Result - check_numeric! :*, other -** Processing line: ~ super~ + args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 255, 255, 255, fade].solid +** Processing line: ~ args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 'dragonruby-controller.png', 0, fade, 255, 255, 255].sprite~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + args.outputs.primitives << [0, 0, $gtk.logical_width, $gtk.logical_height, 'dragonruby-controller.png', 0, fade, 255, 255, 255].sprite +** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 700, joystickname, 2, 1, 0, 0, 0, fade].label~ - Inside source: true *** True Line Result - end + args.outputs.primitives << [$gtk.logical_width / 2, 700, joystickname, 2, 1, 0, 0, 0, fade].label +** Processing line: ~ args.outputs.primitives << [$gtk.logical_height / 2, 650, msg, 0, 1, 0, 0, 0, 255].label if !msg.empty?~ +- Inside source: true +*** True Line Result + args.outputs.primitives << [$gtk.logical_height / 2, 650, msg, 0, 1, 0, 0, 0, 255].label if !msg.empty? +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def / other~ +** Processing line: ~ def render_part_highlight args, part, alpha=255~ - Inside source: true *** True Line Result - def / other -** Processing line: ~ return nil unless other~ + def render_part_highlight args, part, alpha=255 +** Processing line: ~ partsize = 41~ - Inside source: true *** True Line Result - return nil unless other -** Processing line: ~ check_numeric! :/, other~ + partsize = 41 +** Processing line: ~ args.outputs.primitives << [part[0], part[1], partsize, partsize, 255, 0, 0, alpha].border~ - Inside source: true *** True Line Result - check_numeric! :/, other -** Processing line: ~ super~ + args.outputs.primitives << [part[0], part[1], partsize, partsize, 255, 0, 0, alpha].border +** Processing line: ~ args.outputs.primitives << [part[0]-1, part[1]-1, partsize+2, partsize+2, 255, 0, 0, alpha].border~ - Inside source: true *** True Line Result - super -** Processing line: ~ end~ + args.outputs.primitives << [part[0]-1, part[1]-1, partsize+2, partsize+2, 255, 0, 0, alpha].border +** Processing line: ~ args.outputs.primitives << [part[0]-2, part[1]-2, partsize+4, partsize+4, 255, 0, 0, alpha].border~ - Inside source: true *** True Line Result - end + args.outputs.primitives << [part[0]-2, part[1]-2, partsize+4, partsize+4, 255, 0, 0, alpha].border +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def serialize~ +** Processing line: ~ def choose_target~ - Inside source: true *** True Line Result - def serialize -** Processing line: ~ self~ + def choose_target +** Processing line: ~ if @target.nil?~ - Inside source: true *** True Line Result - self -** Processing line: ~ end~ + if @target.nil? +** Processing line: ~ while !@raw_joysticks.empty?~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + while !@raw_joysticks.empty? +** Processing line: ~ t = @raw_joysticks.shift # see if there's a joystick waiting on us.~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + t = @raw_joysticks.shift # see if there's a joystick waiting on us. +** Processing line: ~ next if t[0] < 0 # just in case.~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def sign~ + next if t[0] < 0 # just in case. +** Processing line: ~ next if t[1][:guid].nil? # did we already handle this guid? Dump it.~ - Inside source: true *** True Line Result - def sign -** Processing line: ~ return -1 if self < 0~ + next if t[1][:guid].nil? # did we already handle this guid? Dump it. +** Processing line: ~ @target = t~ - Inside source: true *** True Line Result - return -1 if self < 0 -** Processing line: ~ return 1 if self > 0~ + @target = t +** Processing line: ~ break~ - Inside source: true *** True Line Result - return 1 if self > 0 -** Processing line: ~ return 0~ + break +** Processing line: ~ end~ - Inside source: true *** True Line Result - return 0 -** Processing line: ~ end~ + end +** Processing line: ~ return false if @target.nil? # nothing to configure at the moment.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + return false if @target.nil? # nothing to configure at the moment. +** Processing line: ~ @toggled_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - -** Processing line: ~ def replace_infinity scalar~ + @toggled_at = Kernel.global_tick_count +** Processing line: ~ @fading = 1~ - Inside source: true *** True Line Result - def replace_infinity scalar -** Processing line: ~ return self if !scalar~ + @fading = 1 +** Processing line: ~ @current_part = 0~ - Inside source: true *** True Line Result - return self if !scalar -** Processing line: ~ return self unless self.infinite?~ + @current_part = 0 +** Processing line: ~ @part_alpha = 0~ - Inside source: true *** True Line Result - return self unless self.infinite? -** Processing line: ~ return -scalar if self < 0~ + @part_alpha = 0 +** Processing line: ~ @part_alpha_increment = 10~ - Inside source: true *** True Line Result - return -scalar if self < 0 -** Processing line: ~ return scalar if self > 0~ + @part_alpha_increment = 10 +** Processing line: ~ @joystick_state = {}~ - Inside source: true *** True Line Result - return scalar if self > 0 -** Processing line: ~ end~ + @joystick_state = {} +** Processing line: ~ @used_bindings = {}~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + @used_bindings = {} +** Processing line: ~ @playing_around = false~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @playing_around = false +** Processing line: ~ @bindings = []~ - Inside source: true *** True Line Result - -** Processing line: ~ class Integer~ + @bindings = [] +** Processing line: ~ end~ - Inside source: true *** True Line Result - class Integer -** Processing line: ~ alias_method(:original_round, :round) unless Fixnum.instance_methods.include?(:original_round)~ + end +** Processing line: ~ return true~ - Inside source: true *** True Line Result - alias_method(:original_round, :round) unless Fixnum.instance_methods.include?(:original_round) + return true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def round *args~ +** Processing line: ~ def render_part_highlight_from_bindstr args, bindstr, alpha=255~ - Inside source: true *** True Line Result - def round *args -** Processing line: ~ original_round~ + def render_part_highlight_from_bindstr args, bindstr, alpha=255 +** Processing line: ~ partidx = @used_bindings[bindstr]~ - Inside source: true *** True Line Result - original_round -** Processing line: ~ end~ + partidx = @used_bindings[bindstr] +** Processing line: ~ return if partidx.nil?~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + return if partidx.nil? +** Processing line: ~ render_part_highlight args, @parts[partidx], alpha~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + render_part_highlight args, @parts[partidx], alpha +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src + end ** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/runtime/framerate_diagnostics.rb~ -- Header detected. -*** True Line Result - -*** True Line Result -* ./dragon/runtime/framerate_diagnostics.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. +- Inside source: true *** True Line Result +** Processing line: ~ def play_around args~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + def play_around args +** Processing line: ~ return false if !@playing_around~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + return false if !@playing_around +** Processing line: ~~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # framerate_diagnostics.rb has been released under MIT (*only this file*).~ + +** Processing line: ~ if args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - # framerate_diagnostics.rb has been released under MIT (*only this file*). -** Processing line: ~~ + if args.inputs.keyboard.key_down.escape +** Processing line: ~ @current_part = 0~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + @current_part = 0 +** Processing line: ~ @part_alpha = 0~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ class Runtime~ + @part_alpha = 0 +** Processing line: ~ @part_alpha_increment = 10~ - Inside source: true *** True Line Result - class Runtime -** Processing line: ~ # @visibility private~ + @part_alpha_increment = 10 +** Processing line: ~ @used_bindings = {}~ - Inside source: true *** True Line Result - # @visibility private -** Processing line: ~ module FramerateDiagnostics~ + @used_bindings = {} +** Processing line: ~ @playing_around = false~ - Inside source: true *** True Line Result - module FramerateDiagnostics -** Processing line: ~ def framerate_get_diagnostics~ + @playing_around = false +** Processing line: ~ @bindings = []~ - Inside source: true *** True Line Result - def framerate_get_diagnostics -** Processing line: ~ <<-S~ + @bindings = [] +** Processing line: ~ elsif args.inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - <<-S -** Processing line: ~ * INFO: Framerate Diagnostics~ + elsif args.inputs.keyboard.key_down.space +** Processing line: ~ jid = @target[0]~ - Inside source: true *** True Line Result - * INFO: Framerate Diagnostics -** Processing line: ~ You can display these diagnostics using:~ + jid = @target[0] +** Processing line: ~ bindingstr = build_binding_string~ - Inside source: true *** True Line Result - You can display these diagnostics using: -** Processing line: ~~ + bindingstr = build_binding_string +** Processing line: ~ #puts("new controller binding: '#{bindingstr}'")~ - Inside source: true *** True Line Result - -** Processing line: ~ #+begin_src~ + #puts("new controller binding: '#{bindingstr}'") +** Processing line: ~ @runtime.ffi_misc.add_controller_config bindingstr~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.outputs.debug << args.gtk.framerate_diagnostics_primitives~ + @runtime.ffi_misc.add_controller_config bindingstr +** Processing line: ~ @runtime.ffi_misc.convert_rawjoystick_to_controller jid~ - Inside source: true *** True Line Result - args.outputs.debug << args.gtk.framerate_diagnostics_primitives -** Processing line: ~ #+end_src~ + @runtime.ffi_misc.convert_rawjoystick_to_controller jid +** Processing line: ~ @target[0] = -1 # Conversion closes the raw joystick.~ - Inside source: true *** True Line Result - #+end_src + @target[0] = -1 # Conversion closes the raw joystick. ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ** Draw Calls: ~<<~ Invocation Perf Counter~ +** Processing line: ~ # Handle any other pending joysticks that have the same GUID (so if you plug in four of the same model, we're already done!)~ - Inside source: true *** True Line Result - ** Draw Calls: ~<<~ Invocation Perf Counter -** Processing line: ~ Here is how many times ~args.outputs.PRIMITIVE_ARRAY <<~ was called:~ + # Handle any other pending joysticks that have the same GUID (so if you plug in four of the same model, we're already done!) +** Processing line: ~ guid = @target[1][:guid]~ - Inside source: true *** True Line Result - Here is how many times ~args.outputs.PRIMITIVE_ARRAY <<~ was called: -** Processing line: ~~ + guid = @target[1][:guid] +** Processing line: ~ @raw_joysticks.each { |jid, details|~ - Inside source: true *** True Line Result - -** Processing line: ~ #{$perf_counter_outputs_push_count} times invoked.~ + @raw_joysticks.each { |jid, details| +** Processing line: ~ if details[:guid] == guid~ - Inside source: true *** True Line Result - #{$perf_counter_outputs_push_count} times invoked. -** Processing line: ~~ + if details[:guid] == guid +** Processing line: ~ @runtime.ffi_misc.convert_rawjoystick_to_controller jid~ - Inside source: true *** True Line Result - -** Processing line: ~ If the number above is high, consider batching primitives so you can lower the invocation of ~<<~. For example.~ + @runtime.ffi_misc.convert_rawjoystick_to_controller jid +** Processing line: ~ details[:guid] = nil~ - Inside source: true *** True Line Result - If the number above is high, consider batching primitives so you can lower the invocation of ~<<~. For example. -** Processing line: ~~ + details[:guid] = nil +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ Instead of:~ + end +** Processing line: ~ }~ - Inside source: true *** True Line Result - Instead of: + } ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #+begin_src~ +** Processing line: ~ # Done with this guy.~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.state.enemies.map do |e|~ + # Done with this guy. +** Processing line: ~ @playing_around = false~ - Inside source: true *** True Line Result - args.state.enemies.map do |e| -** Processing line: ~ e.alpha = 128~ + @playing_around = false +** Processing line: ~ @toggled_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - e.alpha = 128 -** Processing line: ~ args.outputs.sprites << e # <-- ~args.outputs.sprites <<~ is invoked a lot~ + @toggled_at = Kernel.global_tick_count +** Processing line: ~ @fading = -1~ - Inside source: true *** True Line Result - args.outputs.sprites << e # <-- ~args.outputs.sprites <<~ is invoked a lot -** Processing line: ~ end~ + @fading = -1 +** Processing line: ~ return false~ - Inside source: true *** True Line Result - end -** Processing line: ~ #+end_src~ + return false +** Processing line: ~ end~ - Inside source: true *** True Line Result - #+end_src + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Do this:~ +** Processing line: ~ render_basics args, 'Now play around with the controller, and make sure it feels right!'~ - Inside source: true *** True Line Result - Do this: + render_basics args, 'Now play around with the controller, and make sure it feels right!' +** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Reconfigure, [SPACE]: Save this configuration', 0, 1, 0, 0, 0, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Reconfigure, [SPACE]: Save this configuration', 0, 1, 0, 0, 0, 255].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #+begin_src~ +** Processing line: ~ axes = @joystick_state[:axes]~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.outputs.sprites << args.state~ + axes = @joystick_state[:axes] +** Processing line: ~ if !axes.nil?~ - Inside source: true *** True Line Result - args.outputs.sprites << args.state -** Processing line: ~ .enemies~ + if !axes.nil? +** Processing line: ~ for i in 0..axes.length-1~ - Inside source: true *** True Line Result - .enemies -** Processing line: ~ .map do |e| # <-- ~args.outputs.sprites <<~ is only invoked once.~ + for i in 0..axes.length-1 +** Processing line: ~ next if axes[i].nil?~ - Inside source: true *** True Line Result - .map do |e| # <-- ~args.outputs.sprites <<~ is only invoked once. -** Processing line: ~ e.alpha = 128~ + next if axes[i].nil? +** Processing line: ~ value = axes[i][:currentval]~ - Inside source: true *** True Line Result - e.alpha = 128 -** Processing line: ~ e~ + value = axes[i][:currentval] +** Processing line: ~ next if value.nil? || (value.abs < 16000)~ - Inside source: true *** True Line Result - e -** Processing line: ~ end~ + next if value.nil? || (value.abs < 16000) +** Processing line: ~ render_part_highlight_from_bindstr args, "#{value < 0 ? '-' : '+'}a#{i}"~ - Inside source: true *** True Line Result - end -** Processing line: ~ #+end_src~ + render_part_highlight_from_bindstr args, "#{value < 0 ? '-' : '+'}a#{i}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - #+end_src + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ** Array Primitives~ +** Processing line: ~ hats = @joystick_state[:hats]~ - Inside source: true *** True Line Result - ** Array Primitives -** Processing line: ~ ~Primitives~ represented as an ~Array~ (~Tuple~) are great for prototyping, but are not as performant as using a ~Hash~.~ + hats = @joystick_state[:hats] +** Processing line: ~ if !hats.nil?~ - Inside source: true *** True Line Result - ~Primitives~ represented as an ~Array~ (~Tuple~) are great for prototyping, but are not as performant as using a ~Hash~. -** Processing line: ~~ + if !hats.nil? +** Processing line: ~ for i in 0..hats.length-1~ - Inside source: true *** True Line Result - -** Processing line: ~ Here is the number of ~Array~ primitives that were encountered:~ + for i in 0..hats.length-1 +** Processing line: ~ value = hats[i]~ - Inside source: true *** True Line Result - Here is the number of ~Array~ primitives that were encountered: -** Processing line: ~~ + value = hats[i] +** Processing line: ~ next if value.nil? || (value == 0)~ - Inside source: true *** True Line Result - -** Processing line: ~ #{$perf_counter_primitive_is_array} Array Primitives.~ + next if value.nil? || (value == 0) +** Processing line: ~ render_part_highlight_from_bindstr args, "h#{i}.#{value}"~ - Inside source: true *** True Line Result - #{$perf_counter_primitive_is_array} Array Primitives. -** Processing line: ~~ + render_part_highlight_from_bindstr args, "h#{i}.#{value}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - -** Processing line: ~ If the number above is high, consider converting them to hashes. For example.~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - If the number above is high, consider converting them to hashes. For example. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ Instead of:~ +** Processing line: ~ buttons = @joystick_state[:buttons]~ - Inside source: true *** True Line Result - Instead of: -** Processing line: ~~ + buttons = @joystick_state[:buttons] +** Processing line: ~ if !buttons.nil?~ - Inside source: true *** True Line Result - -** Processing line: ~ #+begin_src~ + if !buttons.nil? +** Processing line: ~ for i in 0..buttons.length-1~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.outputs.sprites << [0, 0, 100, 100, 'sprites/enemy.png']~ + for i in 0..buttons.length-1 +** Processing line: ~ value = buttons[i]~ - Inside source: true *** True Line Result - args.outputs.sprites << [0, 0, 100, 100, 'sprites/enemy.png'] -** Processing line: ~ #+begin_end~ + value = buttons[i] +** Processing line: ~ next if value.nil? || !value~ - Inside source: true *** True Line Result - #+begin_end -** Processing line: ~~ + next if value.nil? || !value +** Processing line: ~ render_part_highlight_from_bindstr args, "b#{i}"~ - Inside source: true *** True Line Result - -** Processing line: ~ Do this:~ + render_part_highlight_from_bindstr args, "b#{i}" +** Processing line: ~ end~ - Inside source: true *** True Line Result - Do this: + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #+begin_src~ +** Processing line: ~ return true~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.outputs.sprites << { x: 0,~ + return true +** Processing line: ~ end~ - Inside source: true *** True Line Result - args.outputs.sprites << { x: 0, -** Processing line: ~ y: 0,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y: 0, -** Processing line: ~ w: 100,~ + +** Processing line: ~ def should_tick?~ - Inside source: true *** True Line Result - w: 100, -** Processing line: ~ h: 100,~ + def should_tick? +** Processing line: ~ return true if @play_around~ - Inside source: true *** True Line Result - h: 100, -** Processing line: ~ path: 'sprites/enemy.png' }~ + return true if @play_around +** Processing line: ~ return true if @target~ - Inside source: true *** True Line Result - path: 'sprites/enemy.png' } -** Processing line: ~ #+begin_end~ + return true if @target +** Processing line: ~ return false~ - Inside source: true *** True Line Result - #+begin_end + return false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ** Primitive Counts~ +** Processing line: ~ def tick args~ - Inside source: true *** True Line Result - ** Primitive Counts -** Processing line: ~ Here are the draw counts ordered by lowest to highest z order:~ + def tick args +** Processing line: ~ return true if play_around args~ - Inside source: true *** True Line Result - Here are the draw counts ordered by lowest to highest z order: + return true if play_around args +** Processing line: ~ return false if !choose_target~ +- Inside source: true +*** True Line Result + return false if !choose_target ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ PRIMITIVE COUNT, STATIC COUNT~ +** Processing line: ~ jid = @target[0]~ - Inside source: true *** True Line Result - PRIMITIVE COUNT, STATIC COUNT -** Processing line: ~ solids: #{@args.outputs.solids.length}, #{@args.outputs.static_solids.length}~ + jid = @target[0] +** Processing line: ~~ - Inside source: true *** True Line Result - solids: #{@args.outputs.solids.length}, #{@args.outputs.static_solids.length} -** Processing line: ~ sprites: #{@args.outputs.sprites.length}, #{@args.outputs.static_sprites.length}~ + +** Processing line: ~ if @fading == 0~ - Inside source: true *** True Line Result - sprites: #{@args.outputs.sprites.length}, #{@args.outputs.static_sprites.length} -** Processing line: ~ primitives: #{@args.outputs.primitives.length}, #{@args.outputs.static_primitives.length}~ + if @fading == 0 +** Processing line: ~ # Cancel config?~ - Inside source: true *** True Line Result - primitives: #{@args.outputs.primitives.length}, #{@args.outputs.static_primitives.length} -** Processing line: ~ labels: #{@args.outputs.labels.length}, #{@args.outputs.static_labels.length}~ + # Cancel config? +** Processing line: ~ if args.inputs.keyboard.key_down.escape~ - Inside source: true *** True Line Result - labels: #{@args.outputs.labels.length}, #{@args.outputs.static_labels.length} -** Processing line: ~ lines: #{@args.outputs.lines.length}, #{@args.outputs.static_lines.length}~ + if args.inputs.keyboard.key_down.escape +** Processing line: ~ # !!! FIXME: prompt to ignore this joystick forever or just this run~ - Inside source: true *** True Line Result - lines: #{@args.outputs.lines.length}, #{@args.outputs.static_lines.length} -** Processing line: ~ borders: #{@args.outputs.borders.length}, #{@args.outputs.static_borders.length}~ + # !!! FIXME: prompt to ignore this joystick forever or just this run +** Processing line: ~ @toggled_at = Kernel.global_tick_count~ - Inside source: true *** True Line Result - borders: #{@args.outputs.borders.length}, #{@args.outputs.static_borders.length} -** Processing line: ~ debug: #{@args.outputs.debug.length}, #{@args.outputs.static_debug.length}~ + @toggled_at = Kernel.global_tick_count +** Processing line: ~ @fading = -1~ - Inside source: true *** True Line Result - debug: #{@args.outputs.debug.length}, #{@args.outputs.static_debug.length} -** Processing line: ~ reserved: #{@args.outputs.reserved.length}, #{@args.outputs.static_reserved.length}~ + @fading = -1 +** Processing line: ~ end~ - Inside source: true *** True Line Result - reserved: #{@args.outputs.reserved.length}, #{@args.outputs.static_reserved.length} + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ** Additional Help~ +** Processing line: ~ if @fading == 0~ - Inside source: true *** True Line Result - ** Additional Help -** Processing line: ~ Come to the DragonRuby Discord channel if you need help troubleshooting performance issues. http://discord.dragonruby.org.~ + if @fading == 0 +** Processing line: ~ if args.inputs.keyboard.key_down.backspace~ - Inside source: true *** True Line Result - Come to the DragonRuby Discord channel if you need help troubleshooting performance issues. http://discord.dragonruby.org. -** Processing line: ~~ + if args.inputs.keyboard.key_down.backspace +** Processing line: ~ previous_part~ - Inside source: true *** True Line Result - -** Processing line: ~ Source code for these diagnostics can be found at: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]]~ + previous_part +** Processing line: ~ elsif args.inputs.keyboard.key_down.space~ - Inside source: true *** True Line Result - Source code for these diagnostics can be found at: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]] -** Processing line: ~ S~ + elsif args.inputs.keyboard.key_down.space +** Processing line: ~ next_part~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + next_part +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def framerate_warning_message~ +** Processing line: ~ fade = calc_fading~ - Inside source: true *** True Line Result - def framerate_warning_message -** Processing line: ~ <<-S~ + fade = calc_fading +** Processing line: ~ if (@fading < 0) && (fade == 0)~ - Inside source: true *** True Line Result - <<-S -** Processing line: ~ * WARNING:~ + if (@fading < 0) && (fade == 0) +** Processing line: ~ @runtime.ffi_misc.close_raw_joystick(jid) if jid >= 0~ - Inside source: true *** True Line Result - * WARNING: -** Processing line: ~ Your average framerate dropped below 60 fps for two seconds.~ + @runtime.ffi_misc.close_raw_joystick(jid) if jid >= 0 +** Processing line: ~ @target = nil # done with this controller~ - Inside source: true *** True Line Result - Your average framerate dropped below 60 fps for two seconds. -** Processing line: ~~ + @target = nil # done with this controller +** Processing line: ~ return false~ - Inside source: true *** True Line Result - -** Processing line: ~ The average FPS was #{current_framerate}.~ + return false +** Processing line: ~ end~ - Inside source: true *** True Line Result - The average FPS was #{current_framerate}. + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ ** How To Disable Warning~ +** Processing line: ~ render_basics args, (@fading >= 0) ? "We don't recognize this controller, so tell us about it!" : '', fade~ - Inside source: true *** True Line Result - ** How To Disable Warning -** Processing line: ~ If this warning is getting annoying put the following in your tick method:~ + render_basics args, (@fading >= 0) ? "We don't recognize this controller, so tell us about it!" : '', fade +** Processing line: ~~ - Inside source: true *** True Line Result - If this warning is getting annoying put the following in your tick method: + +** Processing line: ~ return true if fade < 255 # all done for now~ +- Inside source: true +*** True Line Result + return true if fade < 255 # all done for now ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #+begin_src~ +** Processing line: ~ part = @parts[@current_part]~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ args.gtk.log_level = :off~ + part = @parts[@current_part] +** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 575, "Please press the #{part[2]}.", 0, 1, 0, 0, 0, 255].label~ - Inside source: true *** True Line Result - args.gtk.log_level = :off -** Processing line: ~ #+end_src~ + args.outputs.primitives << [$gtk.logical_width / 2, 575, "Please press the #{part[2]}.", 0, 1, 0, 0, 0, 255].label +** Processing line: ~ render_part_highlight args, part, @part_alpha~ - Inside source: true *** True Line Result - #+end_src + render_part_highlight args, part, @part_alpha +** Processing line: ~ args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Ignore controller, [BACKSPACE]: Go back one button, [SPACE]: Skip this button', 0, 1, 0, 0, 0, 255].label~ +- Inside source: true +*** True Line Result + args.outputs.primitives << [$gtk.logical_width / 2, 90, '[ESCAPE]: Ignore controller, [BACKSPACE]: Go back one button, [SPACE]: Skip this button', 0, 1, 0, 0, 0, 255].label ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ #{framerate_get_diagnostics}~ +** Processing line: ~ @part_alpha += @part_alpha_increment~ - Inside source: true *** True Line Result - #{framerate_get_diagnostics} -** Processing line: ~ S~ + @part_alpha += @part_alpha_increment +** Processing line: ~ if (@part_alpha_increment > 0) && (@part_alpha >= 255)~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + if (@part_alpha_increment > 0) && (@part_alpha >= 255) +** Processing line: ~ @part_alpha = 255~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + @part_alpha = 255 +** Processing line: ~ @part_alpha_increment = -10~ - Inside source: true *** True Line Result - -** Processing line: ~ def current_framerate_primitives~ + @part_alpha_increment = -10 +** Processing line: ~ elsif (@part_alpha_increment < 0) && (@part_alpha <= 0)~ - Inside source: true *** True Line Result - def current_framerate_primitives -** Processing line: ~ framerate_diagnostics_primitives~ + elsif (@part_alpha_increment < 0) && (@part_alpha <= 0) +** Processing line: ~ @part_alpha = 0~ - Inside source: true *** True Line Result - framerate_diagnostics_primitives -** Processing line: ~ end~ + @part_alpha = 0 +** Processing line: ~ @part_alpha_increment = 10~ - Inside source: true *** True Line Result - end + @part_alpha_increment = 10 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def framerate_diagnostics_primitives~ +** Processing line: ~ return true~ - Inside source: true *** True Line Result - def framerate_diagnostics_primitives -** Processing line: ~ [~ + return true +** Processing line: ~ end~ - Inside source: true *** True Line Result - [ -** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid, -** Processing line: ~ {~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 5,~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 5.from_top,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - y: 5.from_top, -** Processing line: ~ text: "More Info via DragonRuby Console: $gtk.framerate_diagnostics",~ + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* controller/keys.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* controller/keys.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/controller/keys.rb~ - Inside source: true *** True Line Result - text: "More Info via DragonRuby Console: $gtk.framerate_diagnostics", -** Processing line: ~ r: 255,~ + # ./dragon/controller/keys.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ size_enum: -2~ + # MIT License +** Processing line: ~ # controller/keys.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - size_enum: -2 -** Processing line: ~ }.label,~ + # controller/keys.rb has been released under MIT (*only this file*). +** Processing line: ~~ - Inside source: true *** True Line Result - }.label, -** Processing line: ~ {~ + +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 5,~ + module GTK +** Processing line: ~ class Controller~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 20.from_top,~ + class Controller +** Processing line: ~ class Keys~ - Inside source: true *** True Line Result - y: 20.from_top, -** Processing line: ~ text: "FPS: %.2f" % args.gtk.current_framerate,~ + class Keys +** Processing line: ~ include Serialize~ - Inside source: true *** True Line Result - text: "FPS: %.2f" % args.gtk.current_framerate, -** Processing line: ~ r: 255,~ + include Serialize +** Processing line: ~~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + +** Processing line: ~ LABELS = [~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + LABELS = [ +** Processing line: ~ :up, :down, :left, :right,~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ size_enum: -2~ + :up, :down, :left, :right, +** Processing line: ~ :a, :b, :x, :y,~ - Inside source: true *** True Line Result - size_enum: -2 -** Processing line: ~ }.label,~ + :a, :b, :x, :y, +** Processing line: ~ :l1, :r1,~ - Inside source: true *** True Line Result - }.label, -** Processing line: ~ {~ + :l1, :r1, +** Processing line: ~ :l2, :r2,~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 5,~ + :l2, :r2, +** Processing line: ~ :l3, :r3,~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 35.from_top,~ + :l3, :r3, +** Processing line: ~ :start, :select,~ - Inside source: true *** True Line Result - y: 35.from_top, -** Processing line: ~ text: "Draw Calls: #{$perf_counter_outputs_push_count}",~ + :start, :select, +** Processing line: ~ :directional_up, :directional_down, :directional_left, :directional_right~ - Inside source: true *** True Line Result - text: "Draw Calls: #{$perf_counter_outputs_push_count}", -** Processing line: ~ r: 255,~ + :directional_up, :directional_down, :directional_left, :directional_right +** Processing line: ~ ].freeze~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + ].freeze +** Processing line: ~~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + +** Processing line: ~ LABELS.each do |label|~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ size_enum: -2~ + LABELS.each do |label| +** Processing line: ~ attr_reader label~ - Inside source: true *** True Line Result - size_enum: -2 -** Processing line: ~ }.label,~ + attr_reader label +** Processing line: ~ end~ - Inside source: true *** True Line Result - }.label, -** Processing line: ~ {~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 5,~ + +** Processing line: ~ # Activate a key.~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 50.from_top,~ + # Activate a key. +** Processing line: ~ #~ - Inside source: true *** True Line Result - y: 50.from_top, -** Processing line: ~ text: "Array Primitives: #{$perf_counter_primitive_is_array}",~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - text: "Array Primitives: #{$perf_counter_primitive_is_array}", -** Processing line: ~ r: 255,~ + # @return [void] +** Processing line: ~ def activate key~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + def activate key +** Processing line: ~ instance_variable_set("@#{key}", Kernel.tick_count + 1)~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + instance_variable_set("@#{key}", Kernel.tick_count + 1) +** Processing line: ~ end~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ size_enum: -2~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - size_enum: -2 -** Processing line: ~ }.label,~ + +** Processing line: ~ # Deactivate a key.~ - Inside source: true *** True Line Result - }.label, -** Processing line: ~ {~ + # Deactivate a key. +** Processing line: ~ #~ - Inside source: true *** True Line Result - { -** Processing line: ~ x: 5,~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - x: 5, -** Processing line: ~ y: 65.from_top,~ + # @return [void] +** Processing line: ~ def deactivate key~ - Inside source: true *** True Line Result - y: 65.from_top, -** Processing line: ~ text: "Mouse: #{@args.inputs.mouse.point}",~ + def deactivate key +** Processing line: ~ instance_variable_set("@#{key}", nil)~ - Inside source: true *** True Line Result - text: "Mouse: #{@args.inputs.mouse.point}", -** Processing line: ~ r: 255,~ + instance_variable_set("@#{key}", nil) +** Processing line: ~ end~ - Inside source: true *** True Line Result - r: 255, -** Processing line: ~ g: 255,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - g: 255, -** Processing line: ~ b: 255,~ + +** Processing line: ~ # Clear all key inputs.~ - Inside source: true *** True Line Result - b: 255, -** Processing line: ~ size_enum: -2~ + # Clear all key inputs. +** Processing line: ~ #~ - Inside source: true *** True Line Result - size_enum: -2 -** Processing line: ~ }.label,~ + # +** Processing line: ~ # @return [void]~ - Inside source: true *** True Line Result - }.label, -** Processing line: ~ ]~ + # @return [void] +** Processing line: ~ def clear~ - Inside source: true *** True Line Result - ] + def clear +** Processing line: ~ LABELS.each { |label| deactivate(label) }~ +- Inside source: true +*** True Line Result + LABELS.each { |label| deactivate(label) } ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95133,6 +95844,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result +** Processing line: ~ def truthy_keys~ +- Inside source: true +*** True Line Result + def truthy_keys +** Processing line: ~ LABELS.select { |label| send(label) }~ +- Inside source: true +*** True Line Result + LABELS.select { |label| send(label) } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95157,18 +95880,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/string.rb~ +** Processing line: ~* directional_input_helper_methods.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/string.rb +* directional_input_helper_methods.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./dragon/directional_input_helper_methods.rb~ +- Inside source: true +*** True Line Result + # ./dragon/directional_input_helper_methods.rb ** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result @@ -95181,390 +95908,354 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # string.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # directional_input_helper_methods.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # string.rb has been released under MIT (*only this file*). + # directional_input_helper_methods.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ class String~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - class String -** Processing line: ~ include ValueType~ + module GTK +** Processing line: ~ # This is a module that contains normalization of behavior related to `up`|`down`|`left`|`right` on keyboards and controllers.~ - Inside source: true *** True Line Result - include ValueType -** Processing line: ~~ + # This is a module that contains normalization of behavior related to `up`|`down`|`left`|`right` on keyboards and controllers. +** Processing line: ~ module DirectionalInputHelperMethods~ - Inside source: true *** True Line Result - -** Processing line: ~ def wrapped_lines_recur word, rest, length, aggregate~ + module DirectionalInputHelperMethods +** Processing line: ~ def self.included klass~ - Inside source: true *** True Line Result - def wrapped_lines_recur word, rest, length, aggregate -** Processing line: ~ if word.nil?~ + def self.included klass +** Processing line: ~ key_state_methods = [:key_held, :key_down]~ - Inside source: true *** True Line Result - if word.nil? -** Processing line: ~ return aggregate~ + key_state_methods = [:key_held, :key_down] +** Processing line: ~ directional_methods = [:up, :down, :left, :right]~ - Inside source: true *** True Line Result - return aggregate -** Processing line: ~ elsif rest[0].nil?~ + directional_methods = [:up, :down, :left, :right] +** Processing line: ~ method_results = (directional_methods + key_state_methods).map {|m| [m, klass.instance_methods.include?(m)] }~ - Inside source: true *** True Line Result - elsif rest[0].nil? -** Processing line: ~ aggregate << word + "\n"~ + method_results = (directional_methods + key_state_methods).map {|m| [m, klass.instance_methods.include?(m)] } +** Processing line: ~~ - Inside source: true *** True Line Result - aggregate << word + "\n" -** Processing line: ~ return aggregate~ + +** Processing line: ~ error_message = <<-S~ - Inside source: true *** True Line Result - return aggregate -** Processing line: ~ elsif (word + " " + rest[0]).length > length~ + error_message = <<-S +** Processing line: ~ * ERROR~ - Inside source: true *** True Line Result - elsif (word + " " + rest[0]).length > length -** Processing line: ~ aggregate << word + "\n"~ + * ERROR +** Processing line: ~ The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy:~ - Inside source: true *** True Line Result - aggregate << word + "\n" -** Processing line: ~ return wrapped_lines_recur rest[0], rest[1..-1], length, aggregate~ + The GTK::DirectionalKeys module should only be included in objects that respond to the following api heirarchy: +** Processing line: ~~ - Inside source: true *** True Line Result - return wrapped_lines_recur rest[0], rest[1..-1], length, aggregate -** Processing line: ~ elsif (word + " " + rest[0]).length <= length~ + +** Processing line: ~ - (#{ directional_methods.join("|") })~ - Inside source: true *** True Line Result - elsif (word + " " + rest[0]).length <= length -** Processing line: ~ next_word = (word + " " + rest[0])~ + - (#{ directional_methods.join("|") }) +** Processing line: ~ - key_held.(#{ directional_methods.join("|") })~ - Inside source: true *** True Line Result - next_word = (word + " " + rest[0]) -** Processing line: ~ return wrapped_lines_recur next_word, rest[1..-1], length, aggregate~ + - key_held.(#{ directional_methods.join("|") }) +** Processing line: ~ - key_down.(#{ directional_methods.join("|") })~ - Inside source: true *** True Line Result - return wrapped_lines_recur next_word, rest[1..-1], length, aggregate -** Processing line: ~ else~ + - key_down.(#{ directional_methods.join("|") }) +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ log <<-S~ + +** Processing line: ~ #{klass} does not respond to all of these methods (here is the diagnostics):~ - Inside source: true *** True Line Result - log <<-S -** Processing line: ~ WARNING:~ + #{klass} does not respond to all of these methods (here is the diagnostics): +** Processing line: ~ #{method_results.map {|m, r| "- #{m}: #{r}"}.join("\n")}~ - Inside source: true *** True Line Result - WARNING: -** Processing line: ~ #{word} is too long to fit in length of #{length}.~ + #{method_results.map {|m, r| "- #{m}: #{r}"}.join("\n")} +** Processing line: ~~ - Inside source: true *** True Line Result - #{word} is too long to fit in length of #{length}. -** Processing line: ~~ + +** Processing line: ~ Please implement the methods that returned false inthe list above.~ - Inside source: true *** True Line Result - + Please implement the methods that returned false inthe list above. ** Processing line: ~ S~ - Inside source: true *** True Line Result S -** Processing line: ~ next_word = (word + " " + rest[0])~ +** Processing line: ~ unless method_results.map {|m, result| result}.all?~ - Inside source: true *** True Line Result - next_word = (word + " " + rest[0]) -** Processing line: ~ return wrapped_lines_recur next_word, rest[1..-1], length, aggregate~ + unless method_results.map {|m, result| result}.all? +** Processing line: ~ raise error_message~ - Inside source: true *** True Line Result - return wrapped_lines_recur next_word, rest[1..-1], length, aggregate -** Processing line: ~ end~ + raise error_message +** Processing line: ~ end~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def end_with_bang?~ +** Processing line: ~ # Returns a signal indicating left (`-1`), right (`1`), or neither ('0').~ - Inside source: true *** True Line Result - def end_with_bang? -** Processing line: ~ self[-1] == "!"~ + # Returns a signal indicating left (`-1`), right (`1`), or neither ('0'). +** Processing line: ~ #~ - Inside source: true *** True Line Result - self[-1] == "!" -** Processing line: ~ end~ + # +** Processing line: ~ # @return [Integer]~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # @return [Integer] +** Processing line: ~ def left_right~ - Inside source: true *** True Line Result - -** Processing line: ~ def without_ending_bang~ + def left_right +** Processing line: ~ return -1 if self.left~ - Inside source: true *** True Line Result - def without_ending_bang -** Processing line: ~ return self unless end_with_bang?~ + return -1 if self.left +** Processing line: ~ return 1 if self.right~ - Inside source: true *** True Line Result - return self unless end_with_bang? -** Processing line: ~ self[0..-2]~ + return 1 if self.right +** Processing line: ~ return 0~ - Inside source: true *** True Line Result - self[0..-2] -** Processing line: ~ end~ + return 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ # Returns a signal indicating up (`1`), down (`-1`), or neither ('0').~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def wrapped_lines length~ + # Returns a signal indicating up (`1`), down (`-1`), or neither ('0'). +** Processing line: ~ #~ - Inside source: true *** True Line Result - def wrapped_lines length -** Processing line: ~ self.each_line.map do |l|~ + # +** Processing line: ~ # @return [Integer]~ - Inside source: true *** True Line Result - self.each_line.map do |l| -** Processing line: ~ l = l.rstrip~ + # @return [Integer] +** Processing line: ~ def up_down~ - Inside source: true *** True Line Result - l = l.rstrip -** Processing line: ~ if l.length < length~ + def up_down +** Processing line: ~ return 1 if self.up~ - Inside source: true *** True Line Result - if l.length < length -** Processing line: ~ l + "\n"~ + return 1 if self.up +** Processing line: ~ return -1 if self.down~ - Inside source: true *** True Line Result - l + "\n" -** Processing line: ~ else~ + return -1 if self.down +** Processing line: ~ return 0~ - Inside source: true *** True Line Result - else -** Processing line: ~ words = l.split ' '~ + return 0 +** Processing line: ~ end~ - Inside source: true *** True Line Result - words = l.split ' ' -** Processing line: ~ wrapped_lines_recur(words[0], words[1..-1], length, []).flatten~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - wrapped_lines_recur(words[0], words[1..-1], length, []).flatten -** Processing line: ~ end~ + +** Processing line: ~ # Returns a normal vector (in the form of an Array with two values). If no directionals are held/down, the function returns nil.~ - Inside source: true *** True Line Result - end -** Processing line: ~ end.flatten~ + # Returns a normal vector (in the form of an Array with two values). If no directionals are held/down, the function returns nil. +** Processing line: ~ #~ - Inside source: true *** True Line Result - end.flatten -** Processing line: ~ end~ + # +** Processing line: ~ # The possible results are:~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # The possible results are: +** Processing line: ~ #~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + # +** Processing line: ~ # - ~nil~ which denotes that no directional input exists.~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def wrap length~ + # - ~nil~ which denotes that no directional input exists. +** Processing line: ~ # - ~[ 0, 1]~ which denotes that only up is being held/pressed.~ - Inside source: true *** True Line Result - def wrap length -** Processing line: ~ wrapped_lines(length).join.rstrip~ + # - ~[ 0, 1]~ which denotes that only up is being held/pressed. +** Processing line: ~ # - ~[ 0, -1]~ which denotes that only down is being held/pressed.~ - Inside source: true *** True Line Result - wrapped_lines(length).join.rstrip -** Processing line: ~ end~ + # - ~[ 0, -1]~ which denotes that only down is being held/pressed. +** Processing line: ~ # - ~[ 0.5, 0.5]~ which denotes that right and up are being pressed/held.~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # - ~[ 0.5, 0.5]~ which denotes that right and up are being pressed/held. +** Processing line: ~ # - ~[-0.5, -0.5]~ which denotes that left and down are being pressed/held.~ - Inside source: true *** True Line Result - -** Processing line: ~ # @gtk~ + # - ~[-0.5, -0.5]~ which denotes that left and down are being pressed/held. +** Processing line: ~ #~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def multiline?~ + # +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - def multiline? -** Processing line: ~ include? "\n"~ + # @gtk +** Processing line: ~ def directional_vector~ - Inside source: true *** True Line Result - include? "\n" -** Processing line: ~ end~ + def directional_vector +** Processing line: ~ lr, ud = [self.left_right, self.up_down]~ - Inside source: true *** True Line Result - end + lr, ud = [self.left_right, self.up_down] ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def indent_lines amount, char = " "~ +** Processing line: ~ if lr == 0 && ud == 0~ - Inside source: true *** True Line Result - def indent_lines amount, char = " " -** Processing line: ~ self.each_line.each_with_index.map do |l, i|~ + if lr == 0 && ud == 0 +** Processing line: ~ return nil~ - Inside source: true *** True Line Result - self.each_line.each_with_index.map do |l, i| -** Processing line: ~ if i == 0~ + return nil +** Processing line: ~ elsif lr.abs == ud.abs~ - Inside source: true *** True Line Result - if i == 0 -** Processing line: ~ l~ + elsif lr.abs == ud.abs +** Processing line: ~ return [lr.half, ud.half]~ - Inside source: true *** True Line Result - l + return [lr.half, ud.half] ** Processing line: ~ else~ - Inside source: true *** True Line Result else -** Processing line: ~ char * amount + l~ +** Processing line: ~ return [lr, ud]~ - Inside source: true *** True Line Result - char * amount + l + return [lr, ud] ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end.join~ -- Inside source: true -*** True Line Result - end.join -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ -- Inside source: true -*** True Line Result - -** Processing line: ~ def quote~ -- Inside source: true -*** True Line Result - def quote -** Processing line: ~ "\"#{self}\""~ -- Inside source: true -*** True Line Result - "\"#{self}\"" -** Processing line: ~ end~ +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def trim~ +** Processing line: ~ def method_missing m, *args~ - Inside source: true *** True Line Result - def trim -** Processing line: ~ strip~ + def method_missing m, *args +** Processing line: ~ # combine the key with ctrl_~ - Inside source: true *** True Line Result - strip -** Processing line: ~ end~ + # combine the key with ctrl_ +** Processing line: ~ if m.to_s.start_with?("ctrl_")~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + if m.to_s.start_with?("ctrl_") +** Processing line: ~ other_key = m.to_s.split("_").last~ - Inside source: true *** True Line Result - -** Processing line: ~ def trim!~ + other_key = m.to_s.split("_").last +** Processing line: ~ define_singleton_method(m) do~ - Inside source: true *** True Line Result - def trim! -** Processing line: ~ strip!~ + define_singleton_method(m) do +** Processing line: ~ return self.key_up.send(other_key.to_sym) && self.key_up.control~ - Inside source: true *** True Line Result - strip! -** Processing line: ~ end~ + return self.key_up.send(other_key.to_sym) && self.key_up.control +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def ltrim~ -- Inside source: true -*** True Line Result - def ltrim -** Processing line: ~ lstrip~ +** Processing line: ~ return send(m)~ - Inside source: true *** True Line Result - lstrip -** Processing line: ~ end~ + return send(m) +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + else +** Processing line: ~ # see if the key is either held or down~ - Inside source: true *** True Line Result - -** Processing line: ~ def ltrim!~ + # see if the key is either held or down +** Processing line: ~ define_singleton_method(m) do~ - Inside source: true *** True Line Result - def ltrim! -** Processing line: ~ lstrip!~ + define_singleton_method(m) do +** Processing line: ~ self.key_down.send(m) || self.key_held.send(m)~ - Inside source: true *** True Line Result - lstrip! -** Processing line: ~ end~ + self.key_down.send(m) || self.key_held.send(m) +** Processing line: ~ end~ - Inside source: true *** True Line Result - end + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def rtrim~ -- Inside source: true -*** True Line Result - def rtrim -** Processing line: ~ rstrip~ -- Inside source: true -*** True Line Result - rstrip -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~~ +** Processing line: ~ return send(m)~ - Inside source: true *** True Line Result - -** Processing line: ~ def rtrim!~ + return send(m) +** Processing line: ~ end~ - Inside source: true *** True Line Result - def rtrim! -** Processing line: ~ rstrip!~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - rstrip! + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95585,18 +96276,22 @@ Follows is a source code listing for all files that have been open sourced. This - End of paragraph detected. *** True Line Result -** Processing line: ~* ./dragon/tests.rb~ +** Processing line: ~* easing.rb~ - Header detected. *** True Line Result *** True Line Result -* ./dragon/tests.rb +* easing.rb ** Processing line: ~#+begin_src ruby~ - Line was identified as the beginning of a code block. *** True Line Result *** True Line Result #+begin_src ruby +** Processing line: ~ # ./dragon/easing.rb~ +- Inside source: true +*** True Line Result + # ./dragon/easing.rb ** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result @@ -95609,10 +96304,10 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result # MIT License -** Processing line: ~ # tests.rb has been released under MIT (*only this file*).~ +** Processing line: ~ # easing.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - # tests.rb has been released under MIT (*only this file*). + # easing.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result @@ -95621,114 +96316,98 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result module GTK -** Processing line: ~ class Tests~ -- Inside source: true -*** True Line Result - class Tests -** Processing line: ~ attr_accessor :failed, :passed, :inconclusive~ +** Processing line: ~ module Easing~ - Inside source: true *** True Line Result - attr_accessor :failed, :passed, :inconclusive -** Processing line: ~~ + module Easing +** Processing line: ~ def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions~ - Inside source: true *** True Line Result - -** Processing line: ~ def initialize~ + def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions +** Processing line: ~ definitions.flatten!~ - Inside source: true *** True Line Result - def initialize -** Processing line: ~ @failed = []~ + definitions.flatten! +** Processing line: ~ definitions = [:identity] if definitions.length == 0~ - Inside source: true *** True Line Result - @failed = [] -** Processing line: ~ @passed = []~ + definitions = [:identity] if definitions.length == 0 +** Processing line: ~ duration = end_tick - start_tick~ - Inside source: true *** True Line Result - @passed = [] -** Processing line: ~ @inconclusive = []~ + duration = end_tick - start_tick +** Processing line: ~ elapsed = current_tick - start_tick~ - Inside source: true *** True Line Result - @inconclusive = [] -** Processing line: ~ end~ + elapsed = current_tick - start_tick +** Processing line: ~ y = elapsed.percentage_of(duration).cap_min_max(0, 1)~ - Inside source: true *** True Line Result - end + y = elapsed.percentage_of(duration).cap_min_max(0, 1) ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def run_test m~ -- Inside source: true -*** True Line Result - def run_test m -** Processing line: ~ args = Args.new $gtk, nil~ -- Inside source: true -*** True Line Result - args = Args.new $gtk, nil -** Processing line: ~ assert = Assert.new~ -- Inside source: true -*** True Line Result - assert = Assert.new -** Processing line: ~ begin~ -- Inside source: true -*** True Line Result - begin -** Processing line: ~ log_test_running m~ +** Processing line: ~ definitions.map do |definition|~ - Inside source: true *** True Line Result - log_test_running m -** Processing line: ~ send(m, args, assert)~ + definitions.map do |definition| +** Processing line: ~ y = Easing.exec_definition(definition, start_tick, duration, y)~ - Inside source: true *** True Line Result - send(m, args, assert) -** Processing line: ~ if !assert.assertion_performed~ + y = Easing.exec_definition(definition, start_tick, duration, y) +** Processing line: ~ end~ - Inside source: true *** True Line Result - if !assert.assertion_performed -** Processing line: ~ log_inconclusive m~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - log_inconclusive m -** Processing line: ~ else~ + +** Processing line: ~ y~ - Inside source: true *** True Line Result - else -** Processing line: ~ log_passed m~ + y +** Processing line: ~ end~ - Inside source: true *** True Line Result - log_passed m -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ rescue Exception => e~ + +** Processing line: ~ def self.ease_spline_extended start_tick, current_tick, end_tick, spline~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ if test_signature_invalid_exception? e, m~ + def self.ease_spline_extended start_tick, current_tick, end_tick, spline +** Processing line: ~ duration = end_tick - start_tick~ - Inside source: true *** True Line Result - if test_signature_invalid_exception? e, m -** Processing line: ~ log_test_signature_incorrect m~ + duration = end_tick - start_tick +** Processing line: ~ t = (current_tick - start_tick).fdiv duration~ - Inside source: true *** True Line Result - log_test_signature_incorrect m -** Processing line: ~ else~ + t = (current_tick - start_tick).fdiv duration +** Processing line: ~ time_allocation_per_curve = 1.fdiv(spline.length)~ - Inside source: true *** True Line Result - else -** Processing line: ~ mark_test_failed m, e~ + time_allocation_per_curve = 1.fdiv(spline.length) +** Processing line: ~ curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t|~ - Inside source: true *** True Line Result - mark_test_failed m, e -** Processing line: ~ end~ + curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t| +** Processing line: ~ [spline_t.to_i, spline_t - spline_t.to_i]~ - Inside source: true *** True Line Result - end + [spline_t.to_i, spline_t - spline_t.to_i] ** Processing line: ~ end~ - Inside source: true *** True Line Result end +** Processing line: ~ Geometry.cubic_bezier curve_t, *spline[curve_index]~ +- Inside source: true +*** True Line Result + Geometry.cubic_bezier curve_t, *spline[curve_index] ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95737,14 +96416,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_methods_focused~ +** Processing line: ~ def self.initial_value *definitions~ - Inside source: true *** True Line Result - def test_methods_focused -** Processing line: ~ Object.methods.find_all { |m| m.start_with?( "focus_test_") }~ + def self.initial_value *definitions +** Processing line: ~ definitions.flatten!~ - Inside source: true *** True Line Result - Object.methods.find_all { |m| m.start_with?( "focus_test_") } + definitions.flatten! +** Processing line: ~ return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0~ +- Inside source: true +*** True Line Result + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95753,14 +96436,18 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def test_methods~ +** Processing line: ~ def self.final_value *definitions~ - Inside source: true *** True Line Result - def test_methods -** Processing line: ~ Object.methods.find_all { |m| m.start_with? "test_" }~ + def self.final_value *definitions +** Processing line: ~ definitions.flatten!~ - Inside source: true *** True Line Result - Object.methods.find_all { |m| m.start_with? "test_" } + definitions.flatten! +** Processing line: ~ return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0~ +- Inside source: true +*** True Line Result + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0 ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95769,70 +96456,70 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def self.exec_definition definition, start_tick, duration, x~ - Inside source: true *** True Line Result - # @gtk -** Processing line: ~ def start~ + def self.exec_definition definition, start_tick, duration, x +** Processing line: ~ if definition.is_a? Symbol~ - Inside source: true *** True Line Result - def start -** Processing line: ~ log "* TEST: gtk.test.start has been invoked."~ + if definition.is_a? Symbol +** Processing line: ~ return Easing.send(definition, x).cap_min_max(0, 1)~ - Inside source: true *** True Line Result - log "* TEST: gtk.test.start has been invoked." -** Processing line: ~ if test_methods_focused.length != 0~ + return Easing.send(definition, x).cap_min_max(0, 1) +** Processing line: ~ elsif definition.is_a? Proc~ - Inside source: true *** True Line Result - if test_methods_focused.length != 0 -** Processing line: ~ @is_running = true~ + elsif definition.is_a? Proc +** Processing line: ~ return definition.call(x, start_tick, duration).cap_min_max(0, 1)~ - Inside source: true *** True Line Result - @is_running = true -** Processing line: ~ test_methods_focused.each { |m| run_test m }~ + return definition.call(x, start_tick, duration).cap_min_max(0, 1) +** Processing line: ~ end~ - Inside source: true *** True Line Result - test_methods_focused.each { |m| run_test m } -** Processing line: ~ print_summary~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - print_summary -** Processing line: ~ @is_running = false~ + +** Processing line: ~ raise <<-S~ - Inside source: true *** True Line Result - @is_running = false -** Processing line: ~ elsif test_methods.length == 0~ + raise <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - elsif test_methods.length == 0 -** Processing line: ~ log_no_tests_found~ + * ERROR: +** Processing line: ~ I don't know how to execute easing function with definition #{definition}.~ - Inside source: true *** True Line Result - log_no_tests_found -** Processing line: ~ else~ + I don't know how to execute easing function with definition #{definition}. +** Processing line: ~~ - Inside source: true *** True Line Result - else -** Processing line: ~ @is_running = true~ + +** Processing line: ~ S~ - Inside source: true *** True Line Result - @is_running = true -** Processing line: ~ test_methods.each { |m| run_test m }~ + S +** Processing line: ~ end~ - Inside source: true *** True Line Result - test_methods.each { |m| run_test m } -** Processing line: ~ print_summary~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - print_summary -** Processing line: ~ @is_running = false~ + +** Processing line: ~ def self.identity x~ - Inside source: true *** True Line Result - @is_running = false -** Processing line: ~ end~ + def self.identity x +** Processing line: ~ x~ - Inside source: true *** True Line Result - end + x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95841,22 +96528,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def mark_test_failed m, e~ -- Inside source: true -*** True Line Result - def mark_test_failed m, e -** Processing line: ~ message = "Failed."~ -- Inside source: true -*** True Line Result - message = "Failed." -** Processing line: ~ self.failed << { m: m, e: e }~ +** Processing line: ~ def self.flip x~ - Inside source: true *** True Line Result - self.failed << { m: m, e: e } -** Processing line: ~ log message~ + def self.flip x +** Processing line: ~ 1 - x~ - Inside source: true *** True Line Result - log message + 1 - x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95865,14 +96544,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def running?~ +** Processing line: ~ def self.quad x~ - Inside source: true *** True Line Result - def running? -** Processing line: ~ @is_running~ + def self.quad x +** Processing line: ~ x * x~ - Inside source: true *** True Line Result - @is_running + x * x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95881,18 +96560,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def log_inconclusive m~ -- Inside source: true -*** True Line Result - def log_inconclusive m -** Processing line: ~ self.inconclusive << {m: m}~ +** Processing line: ~ def self.cube x~ - Inside source: true *** True Line Result - self.inconclusive << {m: m} -** Processing line: ~ log "Inconclusive."~ + def self.cube x +** Processing line: ~ x * x * x~ - Inside source: true *** True Line Result - log "Inconclusive." + x * x * x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95901,18 +96576,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def log_passed m~ -- Inside source: true -*** True Line Result - def log_passed m -** Processing line: ~ self.passed << {m: m}~ +** Processing line: ~ def self.quart x~ - Inside source: true *** True Line Result - self.passed << {m: m} -** Processing line: ~ log "Passed."~ + def self.quart x +** Processing line: ~ x * x * x * x * x~ - Inside source: true *** True Line Result - log "Passed." + x * x * x * x * x ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -95921,438 +96592,422 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def log_no_tests_found~ -- Inside source: true -*** True Line Result - def log_no_tests_found -** Processing line: ~ log <<-S~ +** Processing line: ~ def self.quint x~ - Inside source: true *** True Line Result - log <<-S -** Processing line: ~ No tests were found. To create a test. Define a method~ + def self.quint x +** Processing line: ~ x * x * x * x * x * x~ - Inside source: true *** True Line Result - No tests were found. To create a test. Define a method -** Processing line: ~ that begins with test_. For example:~ + x * x * x * x * x * x +** Processing line: ~ end~ - Inside source: true *** True Line Result - that begins with test_. For example: -** Processing line: ~ #+begin_src~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ def test_game_over args, assert~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - def test_game_over args, assert + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ #+end_src~ +** Processing line: ~ Easing = GTK::Easing~ - Inside source: true *** True Line Result - #+end_src -** Processing line: ~ S~ + Easing = GTK::Easing +** Processing line: ~~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ -- Inside source: true + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. *** True Line Result - end +#+end_src ** Processing line: ~~ -- Inside source: true +- End of paragraph detected. *** True Line Result -** Processing line: ~ def log_test_running m~ -- Inside source: true +** Processing line: ~* geometry.rb~ +- Header detected. *** True Line Result - def log_test_running m -** Processing line: ~ log "** Running: #{m}"~ -- Inside source: true + *** True Line Result - log "** Running: #{m}" -** Processing line: ~ end~ +* geometry.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/geometry.rb~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + # ./dragon/geometry.rb +** Processing line: ~ # coding: utf-8~ - Inside source: true *** True Line Result - -** Processing line: ~ def test_signature_invalid_exception? e, m~ + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ - Inside source: true *** True Line Result - def test_signature_invalid_exception? e, m -** Processing line: ~ e.to_s.include?(m.to_s) && e.to_s.include?("wrong number of arguments")~ + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ - Inside source: true *** True Line Result - e.to_s.include?(m.to_s) && e.to_s.include?("wrong number of arguments") -** Processing line: ~ end~ + # MIT License +** Processing line: ~ # geometry.rb has been released under MIT (*only this file*).~ - Inside source: true *** True Line Result - end + # geometry.rb has been released under MIT (*only this file*). ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def log_test_signature_incorrect m~ +** Processing line: ~ module GTK~ - Inside source: true *** True Line Result - def log_test_signature_incorrect m -** Processing line: ~ log "TEST METHOD INVALID:", <<-S~ + module GTK +** Processing line: ~ module Geometry~ - Inside source: true *** True Line Result - log "TEST METHOD INVALID:", <<-S -** Processing line: ~ I found a test method called :#{m}. But it needs to have~ + module Geometry +** Processing line: ~ # Returns f(t) for a cubic Bezier curve.~ - Inside source: true *** True Line Result - I found a test method called :#{m}. But it needs to have -** Processing line: ~ the following method signature:~ + # Returns f(t) for a cubic Bezier curve. +** Processing line: ~ def self.cubic_bezier t, a, b, c, d~ - Inside source: true *** True Line Result - the following method signature: -** Processing line: ~ #+begin_src~ + def self.cubic_bezier t, a, b, c, d +** Processing line: ~ s = 1 - t~ - Inside source: true *** True Line Result - #+begin_src -** Processing line: ~ def #{m} args, assert~ + s = 1 - t +** Processing line: ~ s0 = 1~ - Inside source: true *** True Line Result - def #{m} args, assert -** Processing line: ~~ + s0 = 1 +** Processing line: ~ s1 = s~ - Inside source: true *** True Line Result - -** Processing line: ~ end~ + s1 = s +** Processing line: ~ s2 = s * s~ - Inside source: true *** True Line Result - end -** Processing line: ~ #+end_src~ + s2 = s * s +** Processing line: ~ s3 = s * s * s~ - Inside source: true *** True Line Result - #+end_src -** Processing line: ~ Please update the method signature to match the code above. If you~ + s3 = s * s * s +** Processing line: ~~ - Inside source: true *** True Line Result - Please update the method signature to match the code above. If you -** Processing line: ~ did not intend this to be a test method. Rename the method so it does~ + +** Processing line: ~ t0 = 1~ - Inside source: true *** True Line Result - did not intend this to be a test method. Rename the method so it does -** Processing line: ~ not start with "test_".~ + t0 = 1 +** Processing line: ~ t1 = t~ - Inside source: true *** True Line Result - not start with "test_". -** Processing line: ~ S~ + t1 = t +** Processing line: ~ t2 = t * t~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + t2 = t * t +** Processing line: ~ t3 = t * t * t~ - Inside source: true *** True Line Result - end + t3 = t * t * t ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~ def print_summary~ +** Processing line: ~ 1 * s3 * t0 * a +~ - Inside source: true *** True Line Result - def print_summary -** Processing line: ~ log "** Summary"~ + 1 * s3 * t0 * a + +** Processing line: ~ 3 * s2 * t1 * b +~ - Inside source: true *** True Line Result - log "** Summary" -** Processing line: ~ log "*** Passed"~ + 3 * s2 * t1 * b + +** Processing line: ~ 3 * s1 * t2 * c +~ - Inside source: true *** True Line Result - log "*** Passed" -** Processing line: ~ log "#{self.passed.length} test(s) passed."~ + 3 * s1 * t2 * c + +** Processing line: ~ 1 * s0 * t3 * d~ - Inside source: true *** True Line Result - log "#{self.passed.length} test(s) passed." -** Processing line: ~ self.passed.each { |h| log "**** :#{h[:m]}" }~ + 1 * s0 * t3 * d +** Processing line: ~ end~ - Inside source: true *** True Line Result - self.passed.each { |h| log "**** :#{h[:m]}" } -** Processing line: ~ log "*** Inconclusive"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - log "*** Inconclusive" -** Processing line: ~ if self.inconclusive.length > 0~ + +** Processing line: ~ # Returns true if a primitive's rectangle is entirely inside another primitive's rectangle.~ - Inside source: true *** True Line Result - if self.inconclusive.length > 0 -** Processing line: ~ log_once :assertion_ok_note, <<-S~ + # Returns true if a primitive's rectangle is entirely inside another primitive's rectangle. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - log_once :assertion_ok_note, <<-S -** Processing line: ~ NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test.~ + # @gtk +** Processing line: ~ def inside_rect? outer~ - Inside source: true *** True Line Result - NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test. -** Processing line: ~ Add assert.ok! at the end of the test if you are using your own assertions.~ + def inside_rect? outer +** Processing line: ~ Geometry.inside_rect? self, outer~ - Inside source: true *** True Line Result - Add assert.ok! at the end of the test if you are using your own assertions. -** Processing line: ~ S~ + Geometry.inside_rect? self, outer +** Processing line: ~ end~ - Inside source: true *** True Line Result - S -** Processing line: ~ end~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ log "#{self.inconclusive.length} test(s) inconclusive."~ + +** Processing line: ~ # Returns true if a primitive's rectangle overlaps another primitive's rectangle.~ - Inside source: true *** True Line Result - log "#{self.inconclusive.length} test(s) inconclusive." -** Processing line: ~ self.inconclusive.each { |h| log "**** :#{h[:m]}" }~ + # Returns true if a primitive's rectangle overlaps another primitive's rectangle. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - self.inconclusive.each { |h| log "**** :#{h[:m]}" } -** Processing line: ~ log "*** Failed"~ + # @gtk +** Processing line: ~ def intersect_rect? other, tolerance = 0.1~ - Inside source: true *** True Line Result - log "*** Failed" -** Processing line: ~ log "#{self.failed.length} test(s) failed."~ + def intersect_rect? other, tolerance = 0.1 +** Processing line: ~ Geometry.intersect_rect? self, other, tolerance~ - Inside source: true *** True Line Result - log "#{self.failed.length} test(s) failed." -** Processing line: ~ self.failed.each do |h|~ + Geometry.intersect_rect? self, other, tolerance +** Processing line: ~ end~ - Inside source: true *** True Line Result - self.failed.each do |h| -** Processing line: ~ log "**** Test name: :#{h[:m]}"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - log "**** Test name: :#{h[:m]}" -** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}"~ + +** Processing line: ~ def intersects_rect? *args~ - Inside source: true *** True Line Result - log "#{h[:e].to_s.gsub("* ERROR:", "").strip}" -** Processing line: ~ end~ + def intersects_rect? *args +** Processing line: ~ Geometry.intersects_rect?(*args)~ - Inside source: true *** True Line Result - end + Geometry.intersects_rect?(*args) ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end -** Processing line: ~ end~ -- Inside source: true -*** True Line Result - end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. -*** True Line Result -#+end_src -** Processing line: ~~ -- End of paragraph detected. -*** True Line Result - -** Processing line: ~* ./dragon/trace.rb~ -- Header detected. +** Processing line: ~ def scale_rect_extended percentage_x: percentage_x,~ +- Inside source: true *** True Line Result - + def scale_rect_extended percentage_x: percentage_x, +** Processing line: ~ percentage_y: percentage_y,~ +- Inside source: true *** True Line Result -* ./dragon/trace.rb -** Processing line: ~#+begin_src ruby~ -- Line was identified as the beginning of a code block. + percentage_y: percentage_y, +** Processing line: ~ anchor_x: anchor_x,~ +- Inside source: true *** True Line Result - + anchor_x: anchor_x, +** Processing line: ~ anchor_y: anchor_y~ +- Inside source: true *** True Line Result -#+begin_src ruby -** Processing line: ~ # coding: utf-8~ + anchor_y: anchor_y +** Processing line: ~~ - Inside source: true *** True Line Result - # coding: utf-8 -** Processing line: ~ # Copyright 2019 DragonRuby LLC~ + +** Processing line: ~ Geometry.scale_rect_extended self,~ - Inside source: true *** True Line Result - # Copyright 2019 DragonRuby LLC -** Processing line: ~ # MIT License~ + Geometry.scale_rect_extended self, +** Processing line: ~ percentage_x: percentage_x,~ - Inside source: true *** True Line Result - # MIT License -** Processing line: ~ # trace.rb has been released under MIT (*only this file*).~ + percentage_x: percentage_x, +** Processing line: ~ percentage_y: percentage_y,~ - Inside source: true *** True Line Result - # trace.rb has been released under MIT (*only this file*). -** Processing line: ~~ + percentage_y: percentage_y, +** Processing line: ~ anchor_x: anchor_x,~ - Inside source: true *** True Line Result - -** Processing line: ~ module GTK~ + anchor_x: anchor_x, +** Processing line: ~ anchor_y: anchor_y~ - Inside source: true *** True Line Result - module GTK -** Processing line: ~ module Trace~ + anchor_y: anchor_y +** Processing line: ~ end~ - Inside source: true *** True Line Result - module Trace -** Processing line: ~ IGNORED_METHODS = [~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - IGNORED_METHODS = [ -** Processing line: ~ :define_singleton_method, :raise_immediately, :instance_of?,~ + +** Processing line: ~ # Scales a primitive rect by a percentage.~ - Inside source: true *** True Line Result - :define_singleton_method, :raise_immediately, :instance_of?, -** Processing line: ~ :raise_with_caller, :initialize_copy, :class_defined?,~ + # Scales a primitive rect by a percentage. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - :raise_with_caller, :initialize_copy, :class_defined?, -** Processing line: ~ :instance_variable_get, :format, :purge_class, :instance_variable_defined?,~ + # @gtk +** Processing line: ~ def scale_rect percentage, *anchors~ - Inside source: true *** True Line Result - :instance_variable_get, :format, :purge_class, :instance_variable_defined?, -** Processing line: ~ :metadata_object_id, :instance_variable_set, :__printstr__,~ + def scale_rect percentage, *anchors +** Processing line: ~ Geometry.scale_rect self, percentage, *anchors~ - Inside source: true *** True Line Result - :metadata_object_id, :instance_variable_set, :__printstr__, -** Processing line: ~ :instance_variables, :is_a?, :p, :kind_of?, :==, :log_once,~ + Geometry.scale_rect self, percentage, *anchors +** Processing line: ~ end~ - Inside source: true *** True Line Result - :instance_variables, :is_a?, :p, :kind_of?, :==, :log_once, -** Processing line: ~ :protected_methods, :log_once_info, :private_methods, :open,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :protected_methods, :log_once_info, :private_methods, :open, -** Processing line: ~ :!=, :initialize, :object_id, :Hash, :methods, :tick, :!,~ + +** Processing line: ~ # Returns the angle from one primitive to another primitive.~ - Inside source: true *** True Line Result - :!=, :initialize, :object_id, :Hash, :methods, :tick, :!, -** Processing line: ~ :respond_to?, :yield_self, :send, :instance_eval, :then,~ + # Returns the angle from one primitive to another primitive. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - :respond_to?, :yield_self, :send, :instance_eval, :then, -** Processing line: ~ :__method__, :__send__, :log_print, :dig, :itself, :log_info,~ + # @gtk +** Processing line: ~ def angle_to other_point~ - Inside source: true *** True Line Result - :__method__, :__send__, :log_print, :dig, :itself, :log_info, -** Processing line: ~ :remove_instance_variable, :raise, :public_methods, :instance_exec,~ + def angle_to other_point +** Processing line: ~ Geometry.angle_to self, other_point~ - Inside source: true *** True Line Result - :remove_instance_variable, :raise, :public_methods, :instance_exec, -** Processing line: ~ :gets, :local_variables, :tap, :__id__, :class, :singleton_class,~ + Geometry.angle_to self, other_point +** Processing line: ~ end~ - Inside source: true *** True Line Result - :gets, :local_variables, :tap, :__id__, :class, :singleton_class, -** Processing line: ~ :block_given?, :_inspect, :puts, :global_variables, :getc, :iterator?,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :block_given?, :_inspect, :puts, :global_variables, :getc, :iterator?, -** Processing line: ~ :hash, :to_enum, :printf, :frozen?, :print, :original_puts,~ + +** Processing line: ~ # Returns the angle to one primitive from another primitive.~ - Inside source: true *** True Line Result - :hash, :to_enum, :printf, :frozen?, :print, :original_puts, -** Processing line: ~ :srand, :freeze, :rand, :extend, :eql?, :equal?, :sprintf, :clone,~ + # Returns the angle to one primitive from another primitive. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - :srand, :freeze, :rand, :extend, :eql?, :equal?, :sprintf, :clone, -** Processing line: ~ :dup, :to_s, :primitive_determined?, :inspect, :primitive?, :help,~ + # @gtk +** Processing line: ~ def angle_from other_point~ - Inside source: true *** True Line Result - :dup, :to_s, :primitive_determined?, :inspect, :primitive?, :help, -** Processing line: ~ :__object_methods__, :proc, :__custom_object_methods__, :Float, :enum_for,~ + def angle_from other_point +** Processing line: ~ Geometry.angle_from self, other_point~ - Inside source: true *** True Line Result - :__object_methods__, :proc, :__custom_object_methods__, :Float, :enum_for, -** Processing line: ~ :__supports_ivars__?, :nil?, :fast_rand, :or, :and,~ + Geometry.angle_from self, other_point +** Processing line: ~ end~ - Inside source: true *** True Line Result - :__supports_ivars__?, :nil?, :fast_rand, :or, :and, -** Processing line: ~ :__caller_without_noise__, :__gtk_ruby_string_contains_source_file_path__?,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :__caller_without_noise__, :__gtk_ruby_string_contains_source_file_path__?, -** Processing line: ~ :__pretty_print_exception__, :__gtk_ruby_source_files__,~ + +** Processing line: ~ # Returns true if a primitive is within a circle specified by the circle's center and radius.~ - Inside source: true *** True Line Result - :__pretty_print_exception__, :__gtk_ruby_source_files__, -** Processing line: ~ :String, :log, :Array, :putsc, :Integer, :===, :here,~ + # Returns true if a primitive is within a circle specified by the circle's center and radius. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - :String, :log, :Array, :putsc, :Integer, :===, :here, -** Processing line: ~ :raise_error_with_kind_of_okay_message, :better_instance_information,~ + # @gtk +** Processing line: ~ def point_inside_circle? circle_center_point, radius~ - Inside source: true *** True Line Result - :raise_error_with_kind_of_okay_message, :better_instance_information, -** Processing line: ~ :lambda, :fail, :method_missing, :__case_eqq, :caller,~ + def point_inside_circle? circle_center_point, radius +** Processing line: ~ Geometry.point_inside_circle? self, circle_center_point, radius~ - Inside source: true *** True Line Result - :lambda, :fail, :method_missing, :__case_eqq, :caller, -** Processing line: ~ :raise_method_missing_better_error, :require, :singleton_methods,~ + Geometry.point_inside_circle? self, circle_center_point, radius +** Processing line: ~ end~ - Inside source: true *** True Line Result - :raise_method_missing_better_error, :require, :singleton_methods, -** Processing line: ~ :!~, :loop, :numeric_or_default, :`, :state, :inputs, :outputs, "args=".to_sym,~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - :!~, :loop, :numeric_or_default, :`, :state, :inputs, :outputs, "args=".to_sym, -** Processing line: ~ :grid, :gtk, :dragon, :args, :passes, :tick, :grep_source, :grep_source_file,~ + +** Processing line: ~ def center_inside_rect other_rect~ - Inside source: true *** True Line Result - :grid, :gtk, :dragon, :args, :passes, :tick, :grep_source, :grep_source_file, -** Processing line: ~ :numeric_or_default, :f_or_default, :s_or_default, :i_or_default,~ + def center_inside_rect other_rect +** Processing line: ~ offset_x = (other_rect.w - w).half~ - Inside source: true *** True Line Result - :numeric_or_default, :f_or_default, :s_or_default, :i_or_default, -** Processing line: ~ :comment, :primitive_marker, :xrepl, :repl~ + offset_x = (other_rect.w - w).half +** Processing line: ~ offset_y = (other_rect.h - h).half~ - Inside source: true *** True Line Result - :comment, :primitive_marker, :xrepl, :repl -** Processing line: ~ ]~ + offset_y = (other_rect.h - h).half +** Processing line: ~ new_rect = self.shift_rect(0, 0)~ - Inside source: true *** True Line Result - ] -** Processing line: ~~ + new_rect = self.shift_rect(0, 0) +** Processing line: ~ new_rect.x = other_rect.x + offset_x~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.traced_classes~ + new_rect.x = other_rect.x + offset_x +** Processing line: ~ new_rect.y = other_rect.y + offset_y~ - Inside source: true *** True Line Result - def self.traced_classes -** Processing line: ~ @traced_classes ||= []~ + new_rect.y = other_rect.y + offset_y +** Processing line: ~ new_rect~ - Inside source: true *** True Line Result - @traced_classes ||= [] -** Processing line: ~ @traced_classes~ + new_rect +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - @traced_classes -** Processing line: ~ end~ + rescue Exception => e +** Processing line: ~ raise e, <<-S~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + raise e, <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.mark_class_as_traced! klass~ + * ERROR: +** Processing line: ~ center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ - Inside source: true *** True Line Result - def self.mark_class_as_traced! klass -** Processing line: ~ @traced_classes << klass~ + center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +** Processing line: ~ S~ - Inside source: true *** True Line Result - @traced_classes << klass + S ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96361,98 +97016,94 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.untrace_classes!~ -- Inside source: true -*** True Line Result - def self.untrace_classes! -** Processing line: ~ traced_classes.each do |klass|~ +** Processing line: ~ def center_inside_rect_y other_rect~ - Inside source: true *** True Line Result - traced_classes.each do |klass| -** Processing line: ~ klass.class_eval do~ + def center_inside_rect_y other_rect +** Processing line: ~ offset_y = (other_rect.h - h).half~ - Inside source: true *** True Line Result - klass.class_eval do -** Processing line: ~ all_methods = klass.instance_methods false~ + offset_y = (other_rect.h - h).half +** Processing line: ~ new_rect = self.shift_rect(0, 0)~ - Inside source: true *** True Line Result - all_methods = klass.instance_methods false -** Processing line: ~ if klass.instance_methods.respond_to?(:__trace_call_depth__)~ + new_rect = self.shift_rect(0, 0) +** Processing line: ~ new_rect.y = other_rect.y + offset_y~ - Inside source: true *** True Line Result - if klass.instance_methods.respond_to?(:__trace_call_depth__) -** Processing line: ~ undef_method :__trace_call_depth__~ + new_rect.y = other_rect.y + offset_y +** Processing line: ~ new_rect~ - Inside source: true *** True Line Result - undef_method :__trace_call_depth__ -** Processing line: ~ end~ + new_rect +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + rescue Exception => e +** Processing line: ~ raise e, <<-S~ - Inside source: true *** True Line Result - -** Processing line: ~ GTK::Trace.filter_methods_to_trace(all_methods).each do |m|~ + raise e, <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - GTK::Trace.filter_methods_to_trace(all_methods).each do |m| -** Processing line: ~ original_method_name = m~ + * ERROR: +** Processing line: ~ center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ - Inside source: true *** True Line Result - original_method_name = m -** Processing line: ~ trace_method_name = GTK::Trace.trace_method_name_for m~ + center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +** Processing line: ~ S~ - Inside source: true *** True Line Result - trace_method_name = GTK::Trace.trace_method_name_for m -** Processing line: ~ if klass.instance_methods.include? trace_method_name~ + S +** Processing line: ~ end~ - Inside source: true *** True Line Result - if klass.instance_methods.include? trace_method_name -** Processing line: ~ alias_method m, trace_method_name~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - alias_method m, trace_method_name -** Processing line: ~ end~ + +** Processing line: ~ def center_inside_rect_x other_rect~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + def center_inside_rect_x other_rect +** Processing line: ~ offset_x = (other_rect.w - w).half~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + offset_x = (other_rect.w - w).half +** Processing line: ~ new_rect = self.shift_rect(0, 0)~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + new_rect = self.shift_rect(0, 0) +** Processing line: ~ new_rect.x = other_rect.x + offset_x~ - Inside source: true *** True Line Result - end -** Processing line: ~ $last_method_traced = nil~ + new_rect.x = other_rect.x + offset_x +** Processing line: ~ new_rect~ - Inside source: true *** True Line Result - $last_method_traced = nil -** Processing line: ~ @traced_classes.clear~ + new_rect +** Processing line: ~ rescue Exception => e~ - Inside source: true *** True Line Result - @traced_classes.clear -** Processing line: ~ $trace_enabled = false~ + rescue Exception => e +** Processing line: ~ raise e, <<-S~ - Inside source: true *** True Line Result - $trace_enabled = false -** Processing line: ~ if !$gtk.production~ + raise e, <<-S +** Processing line: ~ * ERROR:~ - Inside source: true *** True Line Result - if !$gtk.production -** Processing line: ~ $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"~ + * ERROR: +** Processing line: ~ center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}.~ - Inside source: true *** True Line Result - $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" -** Processing line: ~ end~ + center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +** Processing line: ~ S~ - Inside source: true *** True Line Result - end + S ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96461,34 +97112,38 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.trace_method_name_for m~ +** Processing line: ~ # Returns a primitive that is anchored/repositioned based off its retangle.~ - Inside source: true *** True Line Result - def self.trace_method_name_for m -** Processing line: ~ "__trace_original_#{m}__".to_sym~ + # Returns a primitive that is anchored/repositioned based off its retangle. +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - "__trace_original_#{m}__".to_sym -** Processing line: ~ end~ + # @gtk +** Processing line: ~ def anchor_rect anchor_x, anchor_y~ - Inside source: true *** True Line Result - end -** Processing line: ~~ + def anchor_rect anchor_x, anchor_y +** Processing line: ~ current_w = self.w~ - Inside source: true *** True Line Result - -** Processing line: ~ def self.original_method_name_for m~ + current_w = self.w +** Processing line: ~ current_h = self.h~ - Inside source: true *** True Line Result - def self.original_method_name_for m -** Processing line: ~ return m unless m.to_s.start_with?("__trace_original_") && m.to_s.end_with?("__")~ + current_h = self.h +** Processing line: ~ delta_x = -1 * (anchor_x * current_w)~ - Inside source: true *** True Line Result - return m unless m.to_s.start_with?("__trace_original_") && m.to_s.end_with?("__") -** Processing line: ~ m[16..-3]~ + delta_x = -1 * (anchor_x * current_w) +** Processing line: ~ delta_y = -1 * (anchor_y * current_h)~ - Inside source: true *** True Line Result - m[16..-3] + delta_y = -1 * (anchor_y * current_h) +** Processing line: ~ self.shift_rect(delta_x, delta_y)~ +- Inside source: true +*** True Line Result + self.shift_rect(delta_x, delta_y) ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96497,14 +97152,14 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.filter_methods_to_trace methods~ +** Processing line: ~ def angle_given_point other_point~ - Inside source: true *** True Line Result - def self.filter_methods_to_trace methods -** Processing line: ~ methods.reject { |m| m.start_with? "__trace_" }.reject { |m| IGNORED_METHODS.include? m }~ + def angle_given_point other_point +** Processing line: ~ raise ":angle_given_point has been deprecated use :angle_from instead."~ - Inside source: true *** True Line Result - methods.reject { |m| m.start_with? "__trace_" }.reject { |m| IGNORED_METHODS.include? m } + raise ":angle_given_point has been deprecated use :angle_from instead." ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96513,50 +97168,54 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ def self.flush_trace pad_with_newline = false~ +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - def self.flush_trace pad_with_newline = false -** Processing line: ~ $trace_puts ||= []~ + # @gtk +** Processing line: ~ def self.shift_line line, x, y~ - Inside source: true *** True Line Result - $trace_puts ||= [] -** Processing line: ~ if $trace_puts.length > 0~ + def self.shift_line line, x, y +** Processing line: ~ if line.is_a?(Array) || line.is_a?(Hash)~ - Inside source: true *** True Line Result - if $trace_puts.length > 0 -** Processing line: ~ text = $trace_puts.join("")~ + if line.is_a?(Array) || line.is_a?(Hash) +** Processing line: ~ new_line = line.dup~ - Inside source: true *** True Line Result - text = $trace_puts.join("") -** Processing line: ~ if pad_with_newline~ + new_line = line.dup +** Processing line: ~ new_line.x += x~ - Inside source: true *** True Line Result - if pad_with_newline -** Processing line: ~ $gtk.append_file 'logs/trace.txt', "\n" + text.strip~ + new_line.x += x +** Processing line: ~ new_line.x2 += x~ - Inside source: true *** True Line Result - $gtk.append_file 'logs/trace.txt', "\n" + text.strip -** Processing line: ~ else~ + new_line.x2 += x +** Processing line: ~ new_line.y += y~ - Inside source: true *** True Line Result - else -** Processing line: ~ $gtk.append_file 'logs/trace.txt', text.strip~ + new_line.y += y +** Processing line: ~ new_line.y2 += y~ - Inside source: true *** True Line Result - $gtk.append_file 'logs/trace.txt', text.strip -** Processing line: ~ end~ + new_line.y2 += y +** Processing line: ~ new_line~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + new_line +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~ $trace_puts.clear~ + else +** Processing line: ~ raise "shift_line for #{line} is not supported."~ - Inside source: true *** True Line Result - $trace_puts.clear + raise "shift_line for #{line} is not supported." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ - Inside source: true *** True Line Result @@ -96565,7970 +97224,16088 @@ Follows is a source code listing for all files that have been open sourced. This - Inside source: true *** True Line Result -** Processing line: ~ # @gtk~ +** Processing line: ~ def self.intersects_rect? *args~ +- Inside source: true +*** True Line Result + def self.intersects_rect? *args +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ intersects_rect? (with an \"s\") has been deprecated.~ +- Inside source: true +*** True Line Result + intersects_rect? (with an \"s\") has been deprecated. +** Processing line: ~ Use intersect_rect? instead (remove the \"s\").~ +- Inside source: true +*** True Line Result + Use intersect_rect? instead (remove the \"s\"). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ * NOTE:~ +- Inside source: true +*** True Line Result + * NOTE: +** Processing line: ~ Ruby's naming convention is to *never* include the \"s\" for~ +- Inside source: true +*** True Line Result + Ruby's naming convention is to *never* include the \"s\" for +** Processing line: ~ interrogative method names (methods that end with a ?). It~ +- Inside source: true +*** True Line Result + interrogative method names (methods that end with a ?). It +** Processing line: ~ doesn't sound grammatically correct, but that has been the~ +- Inside source: true +*** True Line Result + doesn't sound grammatically correct, but that has been the +** Processing line: ~ rule for a long time (and why intersects_rect? has been deprecated).~ +- Inside source: true +*** True Line Result + rule for a long time (and why intersects_rect? has been deprecated). +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result # @gtk -** Processing line: ~ def self.trace! instance = nil~ +** Processing line: ~ def self.line_y_intercept line~ - Inside source: true *** True Line Result - def self.trace! instance = nil -** Processing line: ~ $trace_history ||= []~ + def self.line_y_intercept line +** Processing line: ~ line.y - line_slope(line) * line.x~ - Inside source: true *** True Line Result - $trace_history ||= [] -** Processing line: ~ $trace_enabled = true~ + line.y - line_slope(line) * line.x +** Processing line: ~ end~ - Inside source: true *** True Line Result - $trace_enabled = true -** Processing line: ~ $trace_call_depth ||=0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $trace_call_depth ||=0 -** Processing line: ~ flush_trace~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - flush_trace -** Processing line: ~ instance = $top_level unless instance~ + # @gtk +** Processing line: ~ def self.angle_between_lines line_one, line_two, replace_infinity: nil~ - Inside source: true *** True Line Result - instance = $top_level unless instance -** Processing line: ~ return if Trace.traced_classes.include? instance.class~ + def self.angle_between_lines line_one, line_two, replace_infinity: nil +** Processing line: ~ m_line_one = line_slope line_one, replace_infinity: replace_infinity~ - Inside source: true *** True Line Result - return if Trace.traced_classes.include? instance.class -** Processing line: ~ all_methods = instance.class.instance_methods false~ + m_line_one = line_slope line_one, replace_infinity: replace_infinity +** Processing line: ~ m_line_two = line_slope line_two, replace_infinity: replace_infinity~ - Inside source: true *** True Line Result - all_methods = instance.class.instance_methods false -** Processing line: ~ instance.class.class_eval do~ + m_line_two = line_slope line_two, replace_infinity: replace_infinity +** Processing line: ~ Math.atan((m_line_one - m_line_two) / (1 + m_line_two * m_line_one)).to_degrees~ - Inside source: true *** True Line Result - instance.class.class_eval do -** Processing line: ~ attr_accessor :__trace_call_depth__ unless instance.class.instance_methods.include?(:__trace_call_depth__)~ + Math.atan((m_line_one - m_line_two) / (1 + m_line_two * m_line_one)).to_degrees +** Processing line: ~ end~ - Inside source: true *** True Line Result - attr_accessor :__trace_call_depth__ unless instance.class.instance_methods.include?(:__trace_call_depth__) -** Processing line: ~ GTK::Trace.filter_methods_to_trace(all_methods).each do |m|~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - GTK::Trace.filter_methods_to_trace(all_methods).each do |m| -** Processing line: ~ original_method_name = m~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - original_method_name = m -** Processing line: ~ trace_method_name = GTK::Trace.trace_method_name_for m~ + # @gtk +** Processing line: ~ def self.line_slope line, replace_infinity: nil~ - Inside source: true *** True Line Result - trace_method_name = GTK::Trace.trace_method_name_for m -** Processing line: ~ alias_method trace_method_name, m~ + def self.line_slope line, replace_infinity: nil +** Processing line: ~ (line.y2 - line.y).fdiv(line.x2 - line.x)~ - Inside source: true *** True Line Result - alias_method trace_method_name, m -** Processing line: ~ $trace_puts << "Tracing #{m} on #{instance.class}.\n"~ + (line.y2 - line.y).fdiv(line.x2 - line.x) +** Processing line: ~ .replace_infinity(replace_infinity)~ - Inside source: true *** True Line Result - $trace_puts << "Tracing #{m} on #{instance.class}.\n" -** Processing line: ~ define_method(m) do |*args|~ + .replace_infinity(replace_infinity) +** Processing line: ~ end~ - Inside source: true *** True Line Result - define_method(m) do |*args| -** Processing line: ~ instance.__trace_call_depth__ ||= 0~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ ||= 0 -** Processing line: ~ tab_width = " " * (instance.__trace_call_depth__ * 8)~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - tab_width = " " * (instance.__trace_call_depth__ * 8) -** Processing line: ~ instance.__trace_call_depth__ += 1~ + # @gtk +** Processing line: ~ def self.ray_test point, line~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ += 1 -** Processing line: ~ $trace_call_depth = instance.__trace_call_depth__~ + def self.ray_test point, line +** Processing line: ~ slope = (line.y2 - line.y).fdiv(line.x2 - line.x)~ - Inside source: true *** True Line Result - $trace_call_depth = instance.__trace_call_depth__ -** Processing line: ~ parameters = "#{args}"[1..-2]~ + slope = (line.y2 - line.y).fdiv(line.x2 - line.x) +** Processing line: ~~ - Inside source: true *** True Line Result - parameters = "#{args}"[1..-2] -** Processing line: ~ $trace_puts << "\n #{tab_width}#{m}(#{parameters})"~ + +** Processing line: ~ if line.x > line.x2~ - Inside source: true *** True Line Result - $trace_puts << "\n #{tab_width}#{m}(#{parameters})" -** Processing line: ~ execution_time = Time.new.to_i~ + if line.x > line.x2 +** Processing line: ~ point_two, point_one = [point_one, point_two]~ - Inside source: true *** True Line Result - execution_time = Time.new.to_i -** Processing line: ~ $last_method_traced = trace_method_name~ + point_two, point_one = [point_one, point_two] +** Processing line: ~ end~ - Inside source: true *** True Line Result - $last_method_traced = trace_method_name -** Processing line: ~ $trace_history << [m, parameters]~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $trace_history << [m, parameters] -** Processing line: ~ result = send(trace_method_name, *args)~ + +** Processing line: ~ r = ((line.x2 - line.x) * (point.y - line.y) -~ - Inside source: true *** True Line Result - result = send(trace_method_name, *args) -** Processing line: ~ completion_time = Time.new.to_i~ + r = ((line.x2 - line.x) * (point.y - line.y) - +** Processing line: ~ (point.x - line.x) * (line.y2 - line.y))~ - Inside source: true *** True Line Result - completion_time = Time.new.to_i -** Processing line: ~ instance.__trace_call_depth__ -= 1~ + (point.x - line.x) * (line.y2 - line.y)) +** Processing line: ~~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ -= 1 -** Processing line: ~ instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0~ + +** Processing line: ~ if r == 0~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0 -** Processing line: ~ $trace_puts << "\n #{tab_width} success: #{m}"~ + if r == 0 +** Processing line: ~ return :on~ - Inside source: true *** True Line Result - $trace_puts << "\n #{tab_width} success: #{m}" -** Processing line: ~ if instance.__trace_call_depth__ == 0~ + return :on +** Processing line: ~ elsif r < 0~ - Inside source: true *** True Line Result - if instance.__trace_call_depth__ == 0 -** Processing line: ~ $trace_puts << "\n"~ + elsif r < 0 +** Processing line: ~ return :right if slope >= 0~ - Inside source: true *** True Line Result - $trace_puts << "\n" -** Processing line: ~ $trace_history.clear~ + return :right if slope >= 0 +** Processing line: ~ return :left~ - Inside source: true *** True Line Result - $trace_history.clear -** Processing line: ~ end~ + return :left +** Processing line: ~ elsif r > 0~ - Inside source: true *** True Line Result - end -** Processing line: ~ result~ + elsif r > 0 +** Processing line: ~ return :left if slope >= 0~ - Inside source: true *** True Line Result - result -** Processing line: ~ rescue Exception => e~ + return :left if slope >= 0 +** Processing line: ~ return :right~ - Inside source: true *** True Line Result - rescue Exception => e -** Processing line: ~ instance.__trace_call_depth__ -= 1~ + return :right +** Processing line: ~ end~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ -= 1 -** Processing line: ~ instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0~ + end +** Processing line: ~ end~ - Inside source: true *** True Line Result - instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0 -** Processing line: ~ $trace_puts << "\n #{tab_width} failed: #{m}"~ + end +** Processing line: ~~ - Inside source: true *** True Line Result - $trace_puts << "\n #{tab_width} failed: #{m}" -** Processing line: ~ if instance.__trace_call_depth__ == 0~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - if instance.__trace_call_depth__ == 0 -** Processing line: ~ $trace_puts << "\n #{tab_width} #{e}"~ + # @gtk +** Processing line: ~ def self.line_rect line~ - Inside source: true *** True Line Result - $trace_puts << "\n #{tab_width} #{e}" -** Processing line: ~ $trace_puts << "\n"~ + def self.line_rect line +** Processing line: ~ if line.x > line.x2~ - Inside source: true *** True Line Result - $trace_puts << "\n" -** Processing line: ~ end~ + if line.x > line.x2 +** Processing line: ~ x = line.x2~ - Inside source: true *** True Line Result - end -** Processing line: ~ $trace_call_depth = 0~ + x = line.x2 +** Processing line: ~ y = line.y2~ - Inside source: true *** True Line Result - $trace_call_depth = 0 -** Processing line: ~ GTK::Trace.flush_trace true~ + y = line.y2 +** Processing line: ~ x2 = line.x~ - Inside source: true *** True Line Result - GTK::Trace.flush_trace true -** Processing line: ~ raise e~ + x2 = line.x +** Processing line: ~ y2 = line.y~ - Inside source: true *** True Line Result - raise e -** Processing line: ~ end~ + y2 = line.y +** Processing line: ~ else~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + else +** Processing line: ~ x = line.x~ - Inside source: true *** True Line Result - end + x = line.x +** Processing line: ~ y = line.y~ +- Inside source: true +*** True Line Result + y = line.y +** Processing line: ~ x2 = line.x2~ +- Inside source: true +*** True Line Result + x2 = line.x2 +** Processing line: ~ y2 = line.y2~ +- Inside source: true +*** True Line Result + y2 = line.y2 ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ mark_class_as_traced! instance.class~ +** Processing line: ~~ - Inside source: true *** True Line Result - mark_class_as_traced! instance.class + +** Processing line: ~ w = x2 - x~ +- Inside source: true +*** True Line Result + w = x2 - x +** Processing line: ~ h = y2 - y~ +- Inside source: true +*** True Line Result + h = y2 - y +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ { x: x, y: y, w: w, h: h }~ +- Inside source: true +*** True Line Result + { x: x, y: y, w: w, h: h } ** Processing line: ~ end~ - Inside source: true *** True Line Result end -** Processing line: ~ end~ +** Processing line: ~~ - Inside source: true *** True Line Result - end -** Processing line: ~ end~ + +** Processing line: ~ # @gtk~ - Inside source: true *** True Line Result - end + # @gtk +** Processing line: ~ def self.line_intersect line_one, line_two~ +- Inside source: true +*** True Line Result + def self.line_intersect line_one, line_two +** Processing line: ~ m1 = line_slope(line_one)~ +- Inside source: true +*** True Line Result + m1 = line_slope(line_one) +** Processing line: ~ m2 = line_slope(line_two)~ +- Inside source: true +*** True Line Result + m2 = line_slope(line_two) +** Processing line: ~ b1 = line_y_intercept(line_one)~ +- Inside source: true +*** True Line Result + b1 = line_y_intercept(line_one) +** Processing line: ~ b2 = line_y_intercept(line_two)~ +- Inside source: true +*** True Line Result + b2 = line_y_intercept(line_two) +** Processing line: ~ x = (b1 - b2) / (m2 - m1)~ +- Inside source: true +*** True Line Result + x = (b1 - b2) / (m2 - m1) +** Processing line: ~ y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2))~ +- Inside source: true +*** True Line Result + y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2)) +** Processing line: ~ [x, y]~ +- Inside source: true +*** True Line Result + [x, y] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ - Inside source: true *** True Line Result -** Processing line: ~#+end_src~ -- Line was identified as the end of a code block. +** Processing line: ~ def self.contract_intersect_rect?~ +- Inside source: true *** True Line Result -#+end_src -* Processing Html Given True Lines -** Processing line: ~* DragonRuby Game Toolkit Live Docs~ -- H1 detected. -- Formatting line: ~DragonRuby Game Toolkit Live Docs~ -- Line's tilde count is: 0 -- Line contains link marker: false + def self.contract_intersect_rect? +** Processing line: ~ [:left, :right, :top, :bottom]~ +- Inside source: true +*** True Line Result + [:left, :right, :top, :bottom] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ -- P detected. -- Formatting line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ -- Line's tilde count is: 1 -- Line contains link marker: false -** Processing line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ -- P detected. -- Formatting line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.intersect_rect? rect_one, rect_two, tolerance = 0.1~ +- Inside source: true +*** True Line Result + def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 +** Processing line: ~ return false if rect_one.right - tolerance < rect_two.left + tolerance~ +- Inside source: true +*** True Line Result + return false if rect_one.right - tolerance < rect_two.left + tolerance +** Processing line: ~ return false if rect_one.left + tolerance > rect_two.right - tolerance~ +- Inside source: true +*** True Line Result + return false if rect_one.left + tolerance > rect_two.right - tolerance +** Processing line: ~ return false if rect_one.top - tolerance < rect_two.bottom + tolerance~ +- Inside source: true +*** True Line Result + return false if rect_one.top - tolerance < rect_two.bottom + tolerance +** Processing line: ~ return false if rect_one.bottom + tolerance > rect_two.top - tolerance~ +- Inside source: true +*** True Line Result + return false if rect_one.bottom + tolerance > rect_two.top - tolerance +** Processing line: ~ return true~ +- Inside source: true +*** True Line Result + return true +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ context_help_rect_one = (rect_one.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods]~ +- Inside source: true +*** True Line Result + context_help_rect_one = (rect_one.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] +** Processing line: ~ context_help_rect_two = (rect_two.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods]~ +- Inside source: true +*** True Line Result + context_help_rect_two = (rect_two.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] +** Processing line: ~ context_help = ""~ +- Inside source: true +*** True Line Result + context_help = "" +** Processing line: ~ if context_help_rect_one && context_help_rect_one.length > 0~ +- Inside source: true +*** True Line Result + if context_help_rect_one && context_help_rect_one.length > 0 +** Processing line: ~ context_help += <<-S~ +- Inside source: true +*** True Line Result + context_help += <<-S +** Processing line: ~ rect_one needs to implement the following methods: #{context_help_rect_one}~ +- Inside source: true +*** True Line Result + rect_one needs to implement the following methods: #{context_help_rect_one} ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") }~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ You may want to try include the ~AttrRect~ module which will give you these methods.~ +- Inside source: true +*** True Line Result + You may want to try include the ~AttrRect~ module which will give you these methods. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~[[docs_search.gif]]~ -- P detected. -- Formatting line: ~[[docs_search.gif]]~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ if context_help_rect_two && context_help_rect_two.length > 0~ +- Inside source: true +*** True Line Result + if context_help_rect_two && context_help_rect_two.length > 0 +** Processing line: ~ context_help += <<-S~ +- Inside source: true +*** True Line Result + context_help += <<-S +** Processing line: ~ * FAILURE REASON:~ +- Inside source: true +*** True Line Result + * FAILURE REASON: +** Processing line: ~ rect_two needs to implement the following methods: #{context_help_rect_two}~ +- Inside source: true +*** True Line Result + rect_two needs to implement the following methods: #{context_help_rect_two} +** Processing line: ~ NOTE: You may want to try include the ~GTK::Geometry~ module which will give you these methods.~ +- Inside source: true +*** True Line Result + NOTE: You may want to try include the ~GTK::Geometry~ module which will give you these methods. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Hello World~ -- H1 detected. -- Formatting line: ~Hello World~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ raise e, <<-S~ +- Inside source: true +*** True Line Result + raise e, <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ :intersect_rect? failed for~ +- Inside source: true +*** True Line Result + :intersect_rect? failed for +** Processing line: ~ - rect_one: #{rect_one}~ +- Inside source: true +*** True Line Result + - rect_one: #{rect_one} +** Processing line: ~ - rect_two: #{rect_two}~ +- Inside source: true +*** True Line Result + - rect_two: #{rect_two} +** Processing line: ~ #{context_help}~ +- Inside source: true +*** True Line Result + #{context_help} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ -- P detected. -- Formatting line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~* Join the Discord and Subscribe to the News Letter~ -- H1 detected. -- Formatting line: ~Join the Discord and Subscribe to the News Letter~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ -- P detected. -- Formatting line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ -- P detected. -- Formatting line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ -- P detected. -- Formatting line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_quote~ -- BLOCKQUOTE start detected. -** Processing line: ~What game engine do you use?~ -- P detected. -- Formatting line: ~What game engine do you use?~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~#+end_quote~ -- BLOCKQUOTE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.to_square size, x, y, anchor_x = 0.5, anchor_y = nil~ +- Inside source: true +*** True Line Result + def self.to_square size, x, y, anchor_x = 0.5, anchor_y = nil +** Processing line: ~ anchor_y ||= anchor_x~ +- Inside source: true +*** True Line Result + anchor_y ||= anchor_x +** Processing line: ~ x = x.shift_left(size * anchor_x)~ +- Inside source: true +*** True Line Result + x = x.shift_left(size * anchor_x) +** Processing line: ~ y = y.shift_down(size * anchor_y)~ +- Inside source: true +*** True Line Result + y = y.shift_down(size * anchor_y) +** Processing line: ~ [x, y, size, size]~ +- Inside source: true +*** True Line Result + [x, y, size, size] +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}."~ +- Inside source: true +*** True Line Result + raise e, ":to_square failed for size: #{size} x: #{x} y: #{y} anchor_x: #{anchor_x} anchor_y: #{anchor_y}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Reply with:~ -- P detected. -- Formatting line: ~Reply with:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.distance point_one, point_two~ +- Inside source: true +*** True Line Result + def self.distance point_one, point_two +** Processing line: ~ Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2)~ +- Inside source: true +*** True Line Result + Math.sqrt((point_two.x - point_one.x)**2 + (point_two.y - point_one.y)**2) +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}."~ +- Inside source: true +*** True Line Result + raise e, ":distance failed for point_one: #{point_one} point_two #{point_two}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_quote~ -- BLOCKQUOTE start detected. -** Processing line: ~I am a Dragon Rider.~ -- P detected. -- Formatting line: ~I am a Dragon Rider.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~#+end_quote~ -- BLOCKQUOTE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.angle_from start_point, end_point~ +- Inside source: true +*** True Line Result + def self.angle_from start_point, end_point +** Processing line: ~ d_y = end_point.y - start_point.y~ +- Inside source: true +*** True Line Result + d_y = end_point.y - start_point.y +** Processing line: ~ d_x = end_point.x - start_point.x~ +- Inside source: true +*** True Line Result + d_x = end_point.x - start_point.x +** Processing line: ~ Math::PI.+(Math.atan2(d_y, d_x)).to_degrees~ +- Inside source: true +*** True Line Result + Math::PI.+(Math.atan2(d_y, d_x)).to_degrees +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}."~ +- Inside source: true +*** True Line Result + raise e, ":angle_from failed for start_point: #{start_point} end_point: #{end_point}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.angle_to start_point, end_point~ +- Inside source: true +*** True Line Result + def self.angle_to start_point, end_point +** Processing line: ~ angle_from end_point, start_point~ +- Inside source: true +*** True Line Result + angle_from end_point, start_point +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}."~ +- Inside source: true +*** True Line Result + raise e, ":angle_to failed for start_point: #{start_point} end_point: #{end_point}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Watch Some Intro Videos~ -- H1 detected. -- Formatting line: ~Watch Some Intro Videos~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.point_inside_circle? point, circle_center_point, radius~ +- Inside source: true +*** True Line Result + def self.point_inside_circle? point, circle_center_point, radius +** Processing line: ~ (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2~ +- Inside source: true +*** True Line Result + (point.x - circle_center_point.x) ** 2 + (point.y - circle_center_point.y) ** 2 < radius ** 2 +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}"~ +- Inside source: true +*** True Line Result + raise e, ":point_inside_circle? failed for point: #{point} circle_center_point: #{circle_center_point} radius: #{radius}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ -- P detected. -- Formatting line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.inside_rect? inner_rect, outer_rect~ +- Inside source: true +*** True Line Result + def self.inside_rect? inner_rect, outer_rect +** Processing line: ~ inner_rect.x >= outer_rect.x &&~ +- Inside source: true +*** True Line Result + inner_rect.x >= outer_rect.x && +** Processing line: ~ inner_rect.right <= outer_rect.right &&~ +- Inside source: true +*** True Line Result + inner_rect.right <= outer_rect.right && +** Processing line: ~ inner_rect.y >= outer_rect.y &&~ +- Inside source: true +*** True Line Result + inner_rect.y >= outer_rect.y && +** Processing line: ~ inner_rect.top <= outer_rect.top~ +- Inside source: true +*** True Line Result + inner_rect.top <= outer_rect.top +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}."~ +- Inside source: true +*** True Line Result + raise e, ":inside_rect? failed for inner_rect: #{inner_rect} outer_rect: #{outer_rect}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ -- OL start detected. -- LI detected. -- Formatting line: ~ Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ -- LI detected. -- Formatting line: ~ Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ -- LI detected. -- Formatting line: ~ Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ -- OL end detected. -- P detected. -- Formatting line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ -- P detected. -- Formatting line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.scale_rect_extended rect,~ +- Inside source: true +*** True Line Result + def self.scale_rect_extended rect, +** Processing line: ~ percentage_x: percentage_x,~ +- Inside source: true +*** True Line Result + percentage_x: percentage_x, +** Processing line: ~ percentage_y: percentage_y,~ +- Inside source: true +*** True Line Result + percentage_y: percentage_y, +** Processing line: ~ anchor_x: anchor_x,~ +- Inside source: true +*** True Line Result + anchor_x: anchor_x, +** Processing line: ~ anchor_y: anchor_y~ +- Inside source: true +*** True Line Result + anchor_y: anchor_y +** Processing line: ~ anchor_x ||= 0.0~ +- Inside source: true +*** True Line Result + anchor_x ||= 0.0 +** Processing line: ~ anchor_y ||= 0.0~ +- Inside source: true +*** True Line Result + anchor_y ||= 0.0 +** Processing line: ~ percentage_x ||= 1.0~ +- Inside source: true +*** True Line Result + percentage_x ||= 1.0 +** Processing line: ~ percentage_y ||= 1.0~ +- Inside source: true +*** True Line Result + percentage_y ||= 1.0 +** Processing line: ~ new_w = rect.w * percentage_x~ +- Inside source: true +*** True Line Result + new_w = rect.w * percentage_x +** Processing line: ~ new_h = rect.h * percentage_y~ +- Inside source: true +*** True Line Result + new_h = rect.h * percentage_y +** Processing line: ~ new_x = rect.x + (rect.w - new_w) * anchor_x~ +- Inside source: true +*** True Line Result + new_x = rect.x + (rect.w - new_w) * anchor_x +** Processing line: ~ new_y = rect.y + (rect.h - new_h) * anchor_y~ +- Inside source: true +*** True Line Result + new_y = rect.y + (rect.h - new_h) * anchor_y +** Processing line: ~ if rect.is_a? Array~ +- Inside source: true +*** True Line Result + if rect.is_a? Array +** Processing line: ~ return [~ +- Inside source: true +*** True Line Result + return [ +** Processing line: ~ new_x,~ +- Inside source: true +*** True Line Result + new_x, +** Processing line: ~ new_y,~ +- Inside source: true +*** True Line Result + new_y, +** Processing line: ~ new_w,~ +- Inside source: true +*** True Line Result + new_w, +** Processing line: ~ new_h,~ +- Inside source: true +*** True Line Result + new_h, +** Processing line: ~ *rect[4..-1]~ +- Inside source: true +*** True Line Result + *rect[4..-1] +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ elsif rect.is_a? Hash~ +- Inside source: true +*** True Line Result + elsif rect.is_a? Hash +** Processing line: ~ return rect.merge(x: new_x, y: new_y, w: new_w, h: new_h)~ +- Inside source: true +*** True Line Result + return rect.merge(x: new_x, y: new_y, w: new_w, h: new_h) +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ rect.x = new_x~ +- Inside source: true +*** True Line Result + rect.x = new_x +** Processing line: ~ rect.y = new_y~ +- Inside source: true +*** True Line Result + rect.y = new_y +** Processing line: ~ rect.w = new_w~ +- Inside source: true +*** True Line Result + rect.w = new_w +** Processing line: ~ rect.h = new_h~ +- Inside source: true +*** True Line Result + rect.h = new_h +** Processing line: ~ return rect~ +- Inside source: true +*** True Line Result + return rect +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}."~ +- Inside source: true +*** True Line Result + raise e, ":scale_rect_extended failed for rect: #{rect} percentage_x: #{percentage_x} percentage_y: #{percentage_y} anchors_x: #{anchor_x} anchor_y: #{anchor_y}." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Getting Started Tutorial~ -- H1 detected. -- Formatting line: ~Getting Started Tutorial~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.scale_rect rect, percentage, *anchors~ +- Inside source: true +*** True Line Result + def self.scale_rect rect, percentage, *anchors +** Processing line: ~ anchor_x, anchor_y = *anchors.flatten~ +- Inside source: true +*** True Line Result + anchor_x, anchor_y = *anchors.flatten +** Processing line: ~ anchor_x ||= 0~ +- Inside source: true +*** True Line Result + anchor_x ||= 0 +** Processing line: ~ anchor_y ||= anchor_x~ +- Inside source: true +*** True Line Result + anchor_y ||= anchor_x +** Processing line: ~ Geometry.scale_rect_extended rect,~ +- Inside source: true +*** True Line Result + Geometry.scale_rect_extended rect, +** Processing line: ~ percentage_x: percentage,~ +- Inside source: true +*** True Line Result + percentage_x: percentage, +** Processing line: ~ percentage_y: percentage,~ +- Inside source: true +*** True Line Result + percentage_y: percentage, +** Processing line: ~ anchor_x: anchor_x,~ +- Inside source: true +*** True Line Result + anchor_x: anchor_x, +** Processing line: ~ anchor_y: anchor_y~ +- Inside source: true +*** True Line Result + anchor_y: anchor_y +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]."~ +- Inside source: true +*** True Line Result + raise e, ":scale_rect failed for rect: #{rect} percentage: #{percentage} anchors [#{anchor_x} (x), #{anchor_y} (y)]." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end # module Geometry~ +- Inside source: true +*** True Line Result + end # module Geometry +** Processing line: ~ end # module GTK~ +- Inside source: true +*** True Line Result + end # module GTK ** Processing line: ~~ -** Processing line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ -- P detected. -- Formatting line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -** Processing line: ~** Introduction~ -- H2 detected. -- Formatting line: ~Introduction~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Introduction~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Welcome!~ -- P detected. -- Formatting line: ~Welcome!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Here's just a little push to get you started if you're new to programming or game development.~ -- P detected. -- Formatting line: ~Here's just a little push to get you started if you're new to programming or game development.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ -- P detected. -- Formatting line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ -- P detected. -- Formatting line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ -- P detected. -- Formatting line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~** Prerequisites~ -- H2 detected. -- Formatting line: ~Prerequisites~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Prerequisites~ -- Line's tilde count is: 0 -- Line contains link marker: false +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* grid.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* grid.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/grid.rb~ +- Inside source: true +*** True Line Result + # ./dragon/grid.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # grid.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # grid.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ -- P detected. -- Formatting line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ -- P detected. -- Formatting line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ class Grid~ +- Inside source: true +*** True Line Result + class Grid +** Processing line: ~ include Serialize~ +- Inside source: true +*** True Line Result + include Serialize +** Processing line: ~ SCREEN_Y_DIRECTION = -1.0~ +- Inside source: true +*** True Line Result + SCREEN_Y_DIRECTION = -1.0 ** Processing line: ~~ -** Processing line: ~** The Game Loop~ -- H2 detected. -- Formatting line: ~The Game Loop~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~The Game Loop~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # The coordinate system currently in use.~ +- Inside source: true +*** True Line Result + # The coordinate system currently in use. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Symbol] `:bottom_left` or `:center`~ +- Inside source: true +*** True Line Result + # @return [Symbol] `:bottom_left` or `:center` +** Processing line: ~ attr_accessor :name~ +- Inside source: true +*** True Line Result + attr_accessor :name ** Processing line: ~~ -** Processing line: ~Ok, here are few rules with regards to game development with GTK:~ -- P detected. -- Formatting line: ~Ok, here are few rules with regards to game development with GTK:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "x" coordinate indicating the bottom of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "x" coordinate indicating the bottom of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :bottom~ +- Inside source: true +*** True Line Result + attr_accessor :bottom ** Processing line: ~~ -** Processing line: ~- Your game is all going to happen under one function ...~ -- UL start detected. -- LI detected. -- Formatting line: ~Your game is all going to happen under one function ...~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- that runs 60 times a second ...~ -- LI detected. -- Formatting line: ~that runs 60 times a second ...~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- and has to tell the computer what to draw each time.~ -- LI detected. -- Formatting line: ~and has to tell the computer what to draw each time.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~That's an entire video game in one run-on sentence.~ -- UL end detected. -- P detected. -- Formatting line: ~That's an entire video game in one run-on sentence.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ -- P detected. -- Formatting line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "x" coordinate indicating the top of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "x" coordinate indicating the top of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :top~ +- Inside source: true +*** True Line Result + attr_accessor :top ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "y" coordinate indicating the left of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "y" coordinate indicating the left of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :left~ +- Inside source: true +*** True Line Result + attr_accessor :left ** Processing line: ~~ -** Processing line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ -- P detected. -- Formatting line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "y" coordinate indicating the right of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "y" coordinate indicating the right of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :right~ +- Inside source: true +*** True Line Result + attr_accessor :right ** Processing line: ~~ -** Processing line: ~** Breakdown Of The ~tick~ Method~ -- H2 detected. -- Formatting line: ~Breakdown Of The ~tick~ Method~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -- Formatting line: ~Breakdown Of The ~tick~ Method~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "x" coordinate indicating the center of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "x" coordinate indicating the center of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :center_x~ +- Inside source: true +*** True Line Result + attr_accessor :center_x ** Processing line: ~~ -** Processing line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ -- P detected. -- Formatting line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "y" coordinate indicating the center of the screen.~ +- Inside source: true +*** True Line Result + # Returns the "y" coordinate indicating the center of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :center_y~ +- Inside source: true +*** True Line Result + attr_accessor :center_y ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # This "def"ines a function, named "tick," which takes a single argument~ -** Processing line: ~ # named "args". DragonRuby looks for this function and calls it every~ -** Processing line: ~ # frame, 60 times a second. "args" is a magic structure with lots of~ -** Processing line: ~ # information in it. You can set variables in there for your own game state,~ -** Processing line: ~ # and every frame it will updated if keys are pressed, joysticks moved,~ -** Processing line: ~ # mice clicked, etc.~ -** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the bottom left and top right coordinates in a single list.~ +- Inside source: true +*** True Line Result + # Returns the bottom left and top right coordinates in a single list. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [[Float, Float, Float, Float]]~ +- Inside source: true +*** True Line Result + # @return [[Float, Float, Float, Float]] +** Processing line: ~ attr_accessor :rect~ +- Inside source: true +*** True Line Result + attr_accessor :rect ** Processing line: ~~ -** Processing line: ~ # One of the things in "args" is the "outputs" object that your game uses~ -** Processing line: ~ # to draw things. Afraid of rendering APIs? No problem. In DragonRuby,~ -** Processing line: ~ # you use arrays to draw things and we figure out the details.~ -** Processing line: ~ # If you want to draw text on the screen, you give it an array (the thing~ -** Processing line: ~ # in the [ brackets ]), with an X and Y coordinate and the text to draw.~ -** Processing line: ~ # The "<<" thing says "append this array onto the list of them at~ -** Processing line: ~ # args.outputs.labels)~ -** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "x" coordinate of the origin.~ +- Inside source: true +*** True Line Result + # Returns the "x" coordinate of the origin. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :origin_x~ +- Inside source: true +*** True Line Result + attr_accessor :origin_x ** Processing line: ~~ -** Processing line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ -- P detected. -- Formatting line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the "y" coordinate of the origin.~ +- Inside source: true +*** True Line Result + # Returns the "y" coordinate of the origin. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ attr_accessor :origin_y~ +- Inside source: true +*** True Line Result + attr_accessor :origin_y ** Processing line: ~~ -** Processing line: ~** Rendering A Sprite~ -- H2 detected. -- Formatting line: ~Rendering A Sprite~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Rendering A Sprite~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ attr_accessor :left_margin, :bottom_margin~ +- Inside source: true +*** True Line Result + attr_accessor :left_margin, :bottom_margin ** Processing line: ~~ -** Processing line: ~Now let's spice this up a little.~ -- P detected. -- Formatting line: ~Now let's spice this up a little.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ -- P detected. -- Formatting line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ -- P detected. -- Formatting line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize runtime~ +- Inside source: true +*** True Line Result + def initialize runtime +** Processing line: ~ @runtime = runtime~ +- Inside source: true +*** True Line Result + @runtime = runtime +** Processing line: ~ @ffi_draw = runtime.ffi_draw~ +- Inside source: true +*** True Line Result + @ffi_draw = runtime.ffi_draw +** Processing line: ~ origin_bottom_left!~ +- Inside source: true +*** True Line Result + origin_bottom_left! +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ -** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png']~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `x` plus the origin "x".~ +- Inside source: true +*** True Line Result + # Returns `x` plus the origin "x". +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def transform_x x~ +- Inside source: true +*** True Line Result + def transform_x x +** Processing line: ~ @origin_x + x~ +- Inside source: true +*** True Line Result + @origin_x + x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ -- P detected. -- Formatting line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ -- P detected. -- Formatting line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `x` minus the origin "x".~ +- Inside source: true +*** True Line Result + # Returns `x` minus the origin "x". +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def untransform_x x~ +- Inside source: true +*** True Line Result + def untransform_x x +** Processing line: ~ x - @origin_x~ +- Inside source: true +*** True Line Result + x - @origin_x +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Coordinate System and Virtual Canvas~ -- H2 detected. -- Formatting line: ~Coordinate System and Virtual Canvas~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Coordinate System and Virtual Canvas~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ -- P detected. -- Formatting line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ -- P detected. -- Formatting line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Ok, now we have an image on the screen, let's animate it:~ -- P detected. -- Formatting line: ~Ok, now we have an image on the screen, let's animate it:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.rotation ||= 0~ -** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!' ]~ -** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation]~ -** Processing line: ~ args.state.rotation -= 1~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~Now you can see that this function is getting called a lot!~ -- P detected. -- Formatting line: ~Now you can see that this function is getting called a lot!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~** Game State~ -- H2 detected. -- Formatting line: ~Game State~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Game State~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ -- P detected. -- Formatting line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `y` plus the origin "y".~ +- Inside source: true +*** True Line Result + # Returns `y` plus the origin "y". +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def transform_y y~ +- Inside source: true +*** True Line Result + def transform_y y +** Processing line: ~ @origin_y + y * SCREEN_Y_DIRECTION~ +- Inside source: true +*** True Line Result + @origin_y + y * SCREEN_Y_DIRECTION +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~~args.state~ is a place you can hang your own data. It's an open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of class.~ -- P detected. -- Formatting line: ~~args.state~ is a place you can hang your own data. It's an open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of class.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ -- P detected. -- Formatting line: ~In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `y` minus the origin "y".~ +- Inside source: true +*** True Line Result + # Returns `y` minus the origin "y". +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def untransform_y y~ +- Inside source: true +*** True Line Result + def untransform_y y +** Processing line: ~ @origin_y + y * SCREEN_Y_DIRECTION~ +- Inside source: true +*** True Line Result + @origin_y + y * SCREEN_Y_DIRECTION +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** There Is No Delta Time~ -- H2 detected. -- Formatting line: ~There Is No Delta Time~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~There Is No Delta Time~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def ffi_draw~ +- Inside source: true +*** True Line Result + def ffi_draw +** Processing line: ~ @ffi_draw~ +- Inside source: true +*** True Line Result + @ffi_draw +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ -- P detected. -- Formatting line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ -- P detected. -- Formatting line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def ffi_draw= value~ +- Inside source: true +*** True Line Result + def ffi_draw= value +** Processing line: ~ @ffi_draw = value~ +- Inside source: true +*** True Line Result + @ffi_draw = value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Handling User Input~ -- H2 detected. -- Formatting line: ~Handling User Input~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Handling User Input~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Sets the rendering coordinate system to have its origin in the bottom left.~ +- Inside source: true +*** True Line Result + # Sets the rendering coordinate system to have its origin in the bottom left. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [void]~ +- Inside source: true +*** True Line Result + # @return [void] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def origin_bottom_left!~ +- Inside source: true +*** True Line Result + def origin_bottom_left! +** Processing line: ~ return if @name == :bottom_left~ +- Inside source: true +*** True Line Result + return if @name == :bottom_left +** Processing line: ~ @name = :bottom_left~ +- Inside source: true +*** True Line Result + @name = :bottom_left +** Processing line: ~ @origin_x = 0.0~ +- Inside source: true +*** True Line Result + @origin_x = 0.0 +** Processing line: ~ @origin_y = @runtime.logical_height~ +- Inside source: true +*** True Line Result + @origin_y = @runtime.logical_height +** Processing line: ~ @left = 0.0~ +- Inside source: true +*** True Line Result + @left = 0.0 +** Processing line: ~ @right = @runtime.logical_width~ +- Inside source: true +*** True Line Result + @right = @runtime.logical_width +** Processing line: ~ @top = @runtime.logical_height~ +- Inside source: true +*** True Line Result + @top = @runtime.logical_height +** Processing line: ~ @bottom = 0.0~ +- Inside source: true +*** True Line Result + @bottom = 0.0 +** Processing line: ~ @left_margin = 0.0~ +- Inside source: true +*** True Line Result + @left_margin = 0.0 +** Processing line: ~ @bottom_margin = 0.0~ +- Inside source: true +*** True Line Result + @bottom_margin = 0.0 +** Processing line: ~ @center_x = @runtime.logical_width.half~ +- Inside source: true +*** True Line Result + @center_x = @runtime.logical_width.half +** Processing line: ~ @center_y = @runtime.logical_height.half~ +- Inside source: true +*** True Line Result + @center_y = @runtime.logical_height.half +** Processing line: ~ @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect~ +- Inside source: true +*** True Line Result + @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect +** Processing line: ~ @center = [@center_x, @center_y].point~ +- Inside source: true +*** True Line Result + @center = [@center_x, @center_y].point +** Processing line: ~ @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION~ +- Inside source: true +*** True Line Result + @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Now, let's move that image around.~ -- P detected. -- Formatting line: ~Now, let's move that image around.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Sets the rendering coordinate system to have its origin in the center.~ +- Inside source: true +*** True Line Result + # Sets the rendering coordinate system to have its origin in the center. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [void]~ +- Inside source: true +*** True Line Result + # @return [void] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def origin_center!~ +- Inside source: true +*** True Line Result + def origin_center! +** Processing line: ~ return if @name == :center~ +- Inside source: true +*** True Line Result + return if @name == :center +** Processing line: ~ @name = :center~ +- Inside source: true +*** True Line Result + @name = :center +** Processing line: ~ @origin_x = @runtime.logical_width.half~ +- Inside source: true +*** True Line Result + @origin_x = @runtime.logical_width.half +** Processing line: ~ @origin_y = @runtime.logical_height.half~ +- Inside source: true +*** True Line Result + @origin_y = @runtime.logical_height.half +** Processing line: ~ @left = -@runtime.logical_width.half~ +- Inside source: true +*** True Line Result + @left = -@runtime.logical_width.half +** Processing line: ~ @right = @runtime.logical_width.half~ +- Inside source: true +*** True Line Result + @right = @runtime.logical_width.half +** Processing line: ~ @top = @runtime.logical_height.half~ +- Inside source: true +*** True Line Result + @top = @runtime.logical_height.half +** Processing line: ~ @bottom = -@runtime.logical_height.half~ +- Inside source: true +*** True Line Result + @bottom = -@runtime.logical_height.half +** Processing line: ~ @center_x = 0.0~ +- Inside source: true +*** True Line Result + @center_x = 0.0 +** Processing line: ~ @center_y = 0.0~ +- Inside source: true +*** True Line Result + @center_y = 0.0 +** Processing line: ~ @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect~ +- Inside source: true +*** True Line Result + @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect +** Processing line: ~ @center = [@center_x, @center_y].point~ +- Inside source: true +*** True Line Result + @center = [@center_x, @center_y].point +** Processing line: ~ @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION~ +- Inside source: true +*** True Line Result + @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.rotation ||= 0~ -** Processing line: ~ args.state.x ||= 576~ -** Processing line: ~ args.state.y ||= 100~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # The logical width used for rendering.~ +- Inside source: true +*** True Line Result + # The logical width used for rendering. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def w~ +- Inside source: true +*** True Line Result + def w +** Processing line: ~ @runtime.logical_width~ +- Inside source: true +*** True Line Result + @runtime.logical_width +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ args.state.x = args.inputs.mouse.click.point.x - 64~ -** Processing line: ~ args.state.y = args.inputs.mouse.click.point.y - 50~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Half the logical width used for rendering.~ +- Inside source: true +*** True Line Result + # Half the logical width used for rendering. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def w_half~ +- Inside source: true +*** True Line Result + def w_half +** Processing line: ~ w.half~ +- Inside source: true +*** True Line Result + w.half +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ -** Processing line: ~ args.outputs.sprites << [args.state.x,~ -** Processing line: ~ args.state.y,~ -** Processing line: ~ 128,~ -** Processing line: ~ 101,~ -** Processing line: ~ 'dragonruby.png',~ -** Processing line: ~ args.state.rotation]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # The logical height used for rendering.~ +- Inside source: true +*** True Line Result + # The logical height used for rendering. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def h~ +- Inside source: true +*** True Line Result + def h +** Processing line: ~ @runtime.logical_height~ +- Inside source: true +*** True Line Result + @runtime.logical_height +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.state.rotation -= 1~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Half the logical height used for rendering.~ +- Inside source: true +*** True Line Result + # Half the logical height used for rendering. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float]~ +- Inside source: true +*** True Line Result + # @return [Float] +** Processing line: ~ def h_half~ +- Inside source: true +*** True Line Result + def h_half +** Processing line: ~ h.half~ +- Inside source: true +*** True Line Result + h.half +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ -- P detected. -- Formatting line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the coordinates indicating the center of the screen.~ +- Inside source: true +*** True Line Result + # Returns the coordinates indicating the center of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [[Float, Float]]~ +- Inside source: true +*** True Line Result + # @return [[Float, Float]] +** Processing line: ~ def center~ +- Inside source: true +*** True Line Result + def center +** Processing line: ~ @center~ +- Inside source: true +*** True Line Result + @center +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Coding On A Raspberry Pi~ -- H2 detected. -- Formatting line: ~Coding On A Raspberry Pi~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Coding On A Raspberry Pi~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ -- P detected. -- Formatting line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ -- P detected. -- Formatting line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ -- P detected. -- Formatting line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the coordinates indicating the bottom right of the screen.~ +- Inside source: true +*** True Line Result + # Returns the coordinates indicating the bottom right of the screen. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [[Float, Float]]~ +- Inside source: true +*** True Line Result + # @return [[Float, Float]] +** Processing line: ~ def bottom_right~ +- Inside source: true +*** True Line Result + def bottom_right +** Processing line: ~ [@right, @bottom].point~ +- Inside source: true +*** True Line Result + [@right, @bottom].point +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~sudo raspi-config~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ -- PRE end detected. +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -** Processing line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ -- P detected. -- Formatting line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ -- P detected. -- Formatting line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ -- P detected. -- Formatting line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* inputs.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* inputs.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/inputs.rb~ +- Inside source: true +*** True Line Result + # ./dragon/inputs.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # inputs.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # inputs.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~** Conclusion~ -- H2 detected. -- Formatting line: ~Conclusion~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Conclusion~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ # Represents all the keys available on the keyboard.~ +- Inside source: true +*** True Line Result + # Represents all the keys available on the keyboard. +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class KeyboardKeys~ +- Inside source: true +*** True Line Result + class KeyboardKeys +** Processing line: ~ include Serialize~ +- Inside source: true +*** True Line Result + include Serialize ** Processing line: ~~ -** Processing line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ -- P detected. -- Formatting line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :exclamation_point,~ +- Inside source: true +*** True Line Result + attr_accessor :exclamation_point, +** Processing line: ~ :zero, :one, :two, :three, :four,~ +- Inside source: true +*** True Line Result + :zero, :one, :two, :three, :four, +** Processing line: ~ :five, :six, :seven, :eight, :nine,~ +- Inside source: true +*** True Line Result + :five, :six, :seven, :eight, :nine, +** Processing line: ~ :backspace, :delete, :escape, :enter, :tab,~ +- Inside source: true +*** True Line Result + :backspace, :delete, :escape, :enter, :tab, +** Processing line: ~ :open_round_brace, :close_round_brace,~ +- Inside source: true +*** True Line Result + :open_round_brace, :close_round_brace, +** Processing line: ~ :open_curly_brace, :close_curly_brace,~ +- Inside source: true +*** True Line Result + :open_curly_brace, :close_curly_brace, +** Processing line: ~ :open_square_brace, :close_square_brace,~ +- Inside source: true +*** True Line Result + :open_square_brace, :close_square_brace, +** Processing line: ~ :colon, :semicolon, :equal_sign,~ +- Inside source: true +*** True Line Result + :colon, :semicolon, :equal_sign, +** Processing line: ~ :hyphen, :space, :dollar_sign,~ +- Inside source: true +*** True Line Result + :hyphen, :space, :dollar_sign, +** Processing line: ~ :double_quotation_mark,~ +- Inside source: true +*** True Line Result + :double_quotation_mark, +** Processing line: ~ :single_quotation_mark,~ +- Inside source: true +*** True Line Result + :single_quotation_mark, +** Processing line: ~ :backtick,~ +- Inside source: true +*** True Line Result + :backtick, +** Processing line: ~ :tilde, :period, :comma, :pipe,~ +- Inside source: true +*** True Line Result + :tilde, :period, :comma, :pipe, +** Processing line: ~ :underscore,~ +- Inside source: true +*** True Line Result + :underscore, +** Processing line: ~ :a, :b, :c, :d, :e, :f, :g, :h,~ +- Inside source: true +*** True Line Result + :a, :b, :c, :d, :e, :f, :g, :h, +** Processing line: ~ :i, :j, :k, :l, :m, :n, :o, :p,~ +- Inside source: true +*** True Line Result + :i, :j, :k, :l, :m, :n, :o, :p, +** Processing line: ~ :q, :r, :s, :t, :u, :v, :w, :x,~ +- Inside source: true +*** True Line Result + :q, :r, :s, :t, :u, :v, :w, :x, +** Processing line: ~ :y, :z,~ +- Inside source: true +*** True Line Result + :y, :z, +** Processing line: ~ :shift, :control, :alt, :meta,~ +- Inside source: true +*** True Line Result + :shift, :control, :alt, :meta, +** Processing line: ~ :left, :right, :up, :down, :pageup, :pagedown,~ +- Inside source: true +*** True Line Result + :left, :right, :up, :down, :pageup, :pagedown, +** Processing line: ~ :char, :plus, :at, :forward_slash, :back_slash, :asterisk,~ +- Inside source: true +*** True Line Result + :char, :plus, :at, :forward_slash, :back_slash, :asterisk, +** Processing line: ~ :less_than, :greater_than, :carat, :ampersand, :superscript_two,~ +- Inside source: true +*** True Line Result + :less_than, :greater_than, :carat, :ampersand, :superscript_two, +** Processing line: ~ :circumflex,~ +- Inside source: true +*** True Line Result + :circumflex, +** Processing line: ~ :question_mark, :section_sign, :ordinal_indicator,~ +- Inside source: true +*** True Line Result + :question_mark, :section_sign, :ordinal_indicator, +** Processing line: ~ :raw_key~ +- Inside source: true +*** True Line Result + :raw_key ** Processing line: ~~ -** Processing line: ~** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ -- H2 detected. -- Formatting line: ~IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.sdl_to_key raw_key, modifier~ +- Inside source: true +*** True Line Result + def self.sdl_to_key raw_key, modifier +** Processing line: ~ return nil unless (raw_key >= 0 && raw_key <= 255) ||~ +- Inside source: true +*** True Line Result + return nil unless (raw_key >= 0 && raw_key <= 255) || +** Processing line: ~ raw_key == 1073741903 ||~ +- Inside source: true +*** True Line Result + raw_key == 1073741903 || +** Processing line: ~ raw_key == 1073741904 ||~ +- Inside source: true +*** True Line Result + raw_key == 1073741904 || +** Processing line: ~ raw_key == 1073741905 ||~ +- Inside source: true +*** True Line Result + raw_key == 1073741905 || +** Processing line: ~ raw_key == 1073741906 ||~ +- Inside source: true +*** True Line Result + raw_key == 1073741906 || +** Processing line: ~ raw_key == 1073741899 ||~ +- Inside source: true +*** True Line Result + raw_key == 1073741899 || +** Processing line: ~ raw_key == 1073741902~ +- Inside source: true +*** True Line Result + raw_key == 1073741902 ** Processing line: ~~ -** Processing line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ -- P detected. -- Formatting line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ char = KeyboardKeys.char_with_shift raw_key, modifier~ +- Inside source: true +*** True Line Result + char = KeyboardKeys.char_with_shift raw_key, modifier +** Processing line: ~ names = KeyboardKeys.char_to_method char, raw_key~ +- Inside source: true +*** True Line Result + names = KeyboardKeys.char_to_method char, raw_key +** Processing line: ~ names << :alt if (modifier & (256|512)) != 0 # alt key~ +- Inside source: true +*** True Line Result + names << :alt if (modifier & (256|512)) != 0 # alt key +** Processing line: ~ names << :meta if (modifier & (1024|2048)) != 0 # meta key (command/apple/windows key)~ +- Inside source: true +*** True Line Result + names << :meta if (modifier & (1024|2048)) != 0 # meta key (command/apple/windows key) +** Processing line: ~ names << :control if (modifier & (64|128)) != 0 # ctrl key~ +- Inside source: true +*** True Line Result + names << :control if (modifier & (64|128)) != 0 # ctrl key +** Processing line: ~ names << :shift if (modifier & (1|2)) != 0 # shift key~ +- Inside source: true +*** True Line Result + names << :shift if (modifier & (1|2)) != 0 # shift key +** Processing line: ~ names~ +- Inside source: true +*** True Line Result + names +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ -- OL start detected. -- LI detected. -- Formatting line: ~ 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ -- LI detected. -- Formatting line: ~ 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~3. 01_api_01_labels: Various ways to render ~label~s.~ -- LI detected. -- Formatting line: ~ 01_api_01_labels: Various ways to render ~label~s.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~4. 01_api_02_lines: Various ways to render ~line~s.~ -- LI detected. -- Formatting line: ~ 01_api_02_lines: Various ways to render ~line~s.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ -- LI detected. -- Formatting line: ~ 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ -- LI detected. -- Formatting line: ~ 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~7. 01_api_05_keyboard: Hows how to get keyboard input from the user.~ -- LI detected. -- Formatting line: ~ 01_api_05_keyboard: Hows how to get keyboard input from the user.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~8. 01_api_06_mouse: Hows how to get mouse mouse position.~ -- LI detected. -- Formatting line: ~ 01_api_06_mouse: Hows how to get mouse mouse position.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ -- LI detected. -- Formatting line: ~ 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ -- LI detected. -- Formatting line: ~ 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~11. 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ -- LI detected. -- Formatting line: ~ 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ -- LI detected. -- Formatting line: ~ 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~13. 02_collision_01_simple: Collision detection with dynamically moving bodies.~ -- LI detected. -- Formatting line: ~ 02_collision_01_simple: Collision detection with dynamically moving bodies.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ -- LI detected. -- Formatting line: ~ 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ -- LI detected. -- Formatting line: ~ 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ -- LI detected. -- Formatting line: ~ 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ -- LI detected. -- Formatting line: ~ 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ -- LI detected. -- Formatting line: ~ 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ -- LI detected. -- Formatting line: ~ 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~20. 04_sounds: How to play sounds and work with buttons.~ -- LI detected. -- Formatting line: ~ 04_sounds: How to play sounds and work with buttons.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ -- LI detected. -- Formatting line: ~ 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~22. 05_mouse_move_paint_app: Represents a simple paint app.~ -- LI detected. -- Formatting line: ~ 05_mouse_move_paint_app: Represents a simple paint app.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~23. 05_mouse_move_tile_editor: A starting point for a tile editor.~ -- LI detected. -- Formatting line: ~ 05_mouse_move_tile_editor: A starting point for a tile editor.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ -- LI detected. -- Formatting line: ~ 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ -- LI detected. -- Formatting line: ~ 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~26. 07_render_targets_advanced: Advanced usage of ~render_target~s.~ -- LI detected. -- Formatting line: ~ 07_render_targets_advanced: Advanced usage of ~render_target~s.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~27. 08_platformer_collisions: Axis aligned collision along with platformer physics.~ -- LI detected. -- Formatting line: ~ 08_platformer_collisions: Axis aligned collision along with platformer physics.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ -- LI detected. -- Formatting line: ~ 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ -- LI detected. -- Formatting line: ~ 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ -- LI detected. -- Formatting line: ~ 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ -- LI detected. -- Formatting line: ~ 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~32. 10_save_load_game: Save and load game data.~ -- LI detected. -- Formatting line: ~ 10_save_load_game: Save and load game data.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ -- LI detected. -- Formatting line: ~ 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~34. 11_hash_primitives: How primitives can be represented using a ~Hash~.~ -- LI detected. -- Formatting line: ~ 11_hash_primitives: How primitives can be represented using a ~Hash~.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ -- LI detected. -- Formatting line: ~ 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~36. 12_top_down_area: How to render a top down map and how to manage collision of a player.~ -- LI detected. -- Formatting line: ~ 12_top_down_area: How to render a top down map and how to manage collision of a player.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~37. 13_01_easing_functions: How to use lerping functions to define animations/movement.~ -- LI detected. -- Formatting line: ~ 13_01_easing_functions: How to use lerping functions to define animations/movement.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~38. 13_02_cubic_bezier: How to create a bezier curve using lines.~ -- LI detected. -- Formatting line: ~ 13_02_cubic_bezier: How to create a bezier curve using lines.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ -- LI detected. -- Formatting line: ~ 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ -- LI detected. -- Formatting line: ~ 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ -- LI detected. -- Formatting line: ~ 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ -- LI detected. -- Formatting line: ~ 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~43. 15_collision_limits: How many collisions can be processed across many primitives.~ -- LI detected. -- Formatting line: ~ 15_collision_limits: How many collisions can be processed across many primitives.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~44. 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ -- LI detected. -- Formatting line: ~ 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ -- LI detected. -- Formatting line: ~ 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ -- LI detected. -- Formatting line: ~ 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ -- LI detected. -- Formatting line: ~ 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~48. 21_mailbox_usage: How to do interprocess communication.~ -- LI detected. -- Formatting line: ~ 21_mailbox_usage: How to do interprocess communication.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~49. 22_trace_debugging: Debugging techniques and tracing execution through your game.~ -- LI detected. -- Formatting line: ~ 22_trace_debugging: Debugging techniques and tracing execution through your game.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ -- LI detected. -- Formatting line: ~ 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ -- LI detected. -- Formatting line: ~ 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ -- LI detected. -- Formatting line: ~ 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~53. 24_http_example: How to make http requests.~ -- LI detected. -- Formatting line: ~ 24_http_example: How to make http requests.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~54. 25_3d_experiment_01_square: How to create 3D objects.~ -- LI detected. -- Formatting line: ~ 25_3d_experiment_01_square: How to create 3D objects.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ -- LI detected. -- Formatting line: ~ 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ -- LI detected. -- Formatting line: ~ 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ -- LI detected. -- Formatting line: ~ 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ -- LI detected. -- Formatting line: ~ 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ -- LI detected. -- Formatting line: ~ 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~60. 99_sample_game_pong: Reference implementation of pong.~ -- LI detected. -- Formatting line: ~ 99_sample_game_pong: Reference implementation of pong.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ -- LI detected. -- Formatting line: ~ 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ -- LI detected. -- Formatting line: ~ 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ -- LI detected. -- Formatting line: ~ 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ -- LI detected. -- Formatting line: ~ 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ -- LI detected. -- Formatting line: ~ 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.utf_8_char raw_key~ +- Inside source: true +*** True Line Result + def self.utf_8_char raw_key +** Processing line: ~ return "²" if raw_key == 178~ +- Inside source: true +*** True Line Result + return "²" if raw_key == 178 +** Processing line: ~ return "§" if raw_key == 167~ +- Inside source: true +*** True Line Result + return "§" if raw_key == 167 +** Processing line: ~ return "º" if raw_key == 186~ +- Inside source: true +*** True Line Result + return "º" if raw_key == 186 +** Processing line: ~ return raw_key.chr~ +- Inside source: true +*** True Line Result + return raw_key.chr +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.char_with_shift raw_key, modifier~ +- Inside source: true +*** True Line Result + def self.char_with_shift raw_key, modifier +** Processing line: ~ return nil unless raw_key >= 0 && raw_key <= 255~ +- Inside source: true +*** True Line Result + return nil unless raw_key >= 0 && raw_key <= 255 +** Processing line: ~ if modifier != 1 && modifier != 2 && modifier != 3~ +- Inside source: true +*** True Line Result + if modifier != 1 && modifier != 2 && modifier != 3 +** Processing line: ~ return utf_8_char raw_key~ +- Inside source: true +*** True Line Result + return utf_8_char raw_key +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ @shift_keys ||= {~ +- Inside source: true +*** True Line Result + @shift_keys ||= { +** Processing line: ~ '`' => '~', '-' => '_', "'" => '"', "1" => '!',~ +- Inside source: true +*** True Line Result + '`' => '~', '-' => '_', "'" => '"', "1" => '!', +** Processing line: ~ "2" => '@', "3" => '#', "4" => '$', "5" => '%',~ +- Inside source: true +*** True Line Result + "2" => '@', "3" => '#', "4" => '$', "5" => '%', +** Processing line: ~ "6" => '^', "7" => '&', "8" => '*', "9" => '(',~ +- Inside source: true +*** True Line Result + "6" => '^', "7" => '&', "8" => '*', "9" => '(', +** Processing line: ~ "0" => ')', ";" => ":", "=" => "+", "[" => "{",~ +- Inside source: true +*** True Line Result + "0" => ')', ";" => ":", "=" => "+", "[" => "{", +** Processing line: ~ "]" => "}", '\\'=> "|", '/' => "?", '.' => ">",~ +- Inside source: true +*** True Line Result + "]" => "}", '\\'=> "|", '/' => "?", '.' => ">", +** Processing line: ~ ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C',~ +- Inside source: true +*** True Line Result + ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C', +** Processing line: ~ 'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G',~ +- Inside source: true +*** True Line Result + 'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G', +** Processing line: ~ 'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K',~ +- Inside source: true +*** True Line Result + 'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K', +** Processing line: ~ 'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O',~ +- Inside source: true +*** True Line Result + 'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O', +** Processing line: ~ 'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S',~ +- Inside source: true +*** True Line Result + 'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S', +** Processing line: ~ 't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W',~ +- Inside source: true +*** True Line Result + 't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W', +** Processing line: ~ 'x' => 'X', 'y' => 'Y', 'z' => 'Z'~ +- Inside source: true +*** True Line Result + 'x' => 'X', 'y' => 'Y', 'z' => 'Z' +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ @shift_keys[raw_key.chr.to_s] || raw_key.chr.to_s~ +- Inside source: true +*** True Line Result + @shift_keys[raw_key.chr.to_s] || raw_key.chr.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Deploying To Itch.io~ -- H1 detected. -- Formatting line: ~Deploying To Itch.io~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.char_to_method_hash~ +- Inside source: true +*** True Line Result + def self.char_to_method_hash +** Processing line: ~ @char_to_method ||= {~ +- Inside source: true +*** True Line Result + @char_to_method ||= { +** Processing line: ~ 'A' => [:a, :shift],~ +- Inside source: true +*** True Line Result + 'A' => [:a, :shift], +** Processing line: ~ 'B' => [:b, :shift],~ +- Inside source: true +*** True Line Result + 'B' => [:b, :shift], +** Processing line: ~ 'C' => [:c, :shift],~ +- Inside source: true +*** True Line Result + 'C' => [:c, :shift], +** Processing line: ~ 'D' => [:d, :shift],~ +- Inside source: true +*** True Line Result + 'D' => [:d, :shift], +** Processing line: ~ 'E' => [:e, :shift],~ +- Inside source: true +*** True Line Result + 'E' => [:e, :shift], +** Processing line: ~ 'F' => [:f, :shift],~ +- Inside source: true +*** True Line Result + 'F' => [:f, :shift], +** Processing line: ~ 'G' => [:g, :shift],~ +- Inside source: true +*** True Line Result + 'G' => [:g, :shift], +** Processing line: ~ 'H' => [:h, :shift],~ +- Inside source: true +*** True Line Result + 'H' => [:h, :shift], +** Processing line: ~ 'I' => [:i, :shift],~ +- Inside source: true +*** True Line Result + 'I' => [:i, :shift], +** Processing line: ~ 'J' => [:j, :shift],~ +- Inside source: true +*** True Line Result + 'J' => [:j, :shift], +** Processing line: ~ 'K' => [:k, :shift],~ +- Inside source: true +*** True Line Result + 'K' => [:k, :shift], +** Processing line: ~ 'L' => [:l, :shift],~ +- Inside source: true +*** True Line Result + 'L' => [:l, :shift], +** Processing line: ~ 'M' => [:m, :shift],~ +- Inside source: true +*** True Line Result + 'M' => [:m, :shift], +** Processing line: ~ 'N' => [:n, :shift],~ +- Inside source: true +*** True Line Result + 'N' => [:n, :shift], +** Processing line: ~ 'O' => [:o, :shift],~ +- Inside source: true +*** True Line Result + 'O' => [:o, :shift], +** Processing line: ~ 'P' => [:p, :shift],~ +- Inside source: true +*** True Line Result + 'P' => [:p, :shift], +** Processing line: ~ 'Q' => [:q, :shift],~ +- Inside source: true +*** True Line Result + 'Q' => [:q, :shift], +** Processing line: ~ 'R' => [:r, :shift],~ +- Inside source: true +*** True Line Result + 'R' => [:r, :shift], +** Processing line: ~ 'S' => [:s, :shift],~ +- Inside source: true +*** True Line Result + 'S' => [:s, :shift], +** Processing line: ~ 'T' => [:t, :shift],~ +- Inside source: true +*** True Line Result + 'T' => [:t, :shift], +** Processing line: ~ 'U' => [:u, :shift],~ +- Inside source: true +*** True Line Result + 'U' => [:u, :shift], +** Processing line: ~ 'V' => [:v, :shift],~ +- Inside source: true +*** True Line Result + 'V' => [:v, :shift], +** Processing line: ~ 'W' => [:w, :shift],~ +- Inside source: true +*** True Line Result + 'W' => [:w, :shift], +** Processing line: ~ 'X' => [:x, :shift],~ +- Inside source: true +*** True Line Result + 'X' => [:x, :shift], +** Processing line: ~ 'Y' => [:y, :shift],~ +- Inside source: true +*** True Line Result + 'Y' => [:y, :shift], +** Processing line: ~ 'Z' => [:z, :shift],~ +- Inside source: true +*** True Line Result + 'Z' => [:z, :shift], +** Processing line: ~ "!" => [:exclamation_point],~ +- Inside source: true +*** True Line Result + "!" => [:exclamation_point], +** Processing line: ~ "0" => [:zero],~ +- Inside source: true +*** True Line Result + "0" => [:zero], +** Processing line: ~ "1" => [:one],~ +- Inside source: true +*** True Line Result + "1" => [:one], +** Processing line: ~ "2" => [:two],~ +- Inside source: true +*** True Line Result + "2" => [:two], +** Processing line: ~ "3" => [:three],~ +- Inside source: true +*** True Line Result + "3" => [:three], +** Processing line: ~ "4" => [:four],~ +- Inside source: true +*** True Line Result + "4" => [:four], +** Processing line: ~ "5" => [:five],~ +- Inside source: true +*** True Line Result + "5" => [:five], +** Processing line: ~ "6" => [:six],~ +- Inside source: true +*** True Line Result + "6" => [:six], +** Processing line: ~ "7" => [:seven],~ +- Inside source: true +*** True Line Result + "7" => [:seven], +** Processing line: ~ "8" => [:eight],~ +- Inside source: true +*** True Line Result + "8" => [:eight], +** Processing line: ~ "9" => [:nine],~ +- Inside source: true +*** True Line Result + "9" => [:nine], +** Processing line: ~ "\b" => [:backspace],~ +- Inside source: true +*** True Line Result + "\b" => [:backspace], +** Processing line: ~ "\e" => [:escape],~ +- Inside source: true +*** True Line Result + "\e" => [:escape], +** Processing line: ~ "\r" => [:enter],~ +- Inside source: true +*** True Line Result + "\r" => [:enter], +** Processing line: ~ "\t" => [:tab],~ +- Inside source: true +*** True Line Result + "\t" => [:tab], +** Processing line: ~ "(" => [:open_round_brace],~ +- Inside source: true +*** True Line Result + "(" => [:open_round_brace], +** Processing line: ~ ")" => [:close_round_brace],~ +- Inside source: true +*** True Line Result + ")" => [:close_round_brace], +** Processing line: ~ "{" => [:open_curly_brace],~ +- Inside source: true +*** True Line Result + "{" => [:open_curly_brace], +** Processing line: ~ "}" => [:close_curly_brace],~ +- Inside source: true +*** True Line Result + "}" => [:close_curly_brace], +** Processing line: ~ "[" => [:open_square_brace],~ +- Inside source: true +*** True Line Result + "[" => [:open_square_brace], +** Processing line: ~ "]" => [:close_square_brace],~ +- Inside source: true +*** True Line Result + "]" => [:close_square_brace], +** Processing line: ~ ":" => [:colon],~ +- Inside source: true +*** True Line Result + ":" => [:colon], +** Processing line: ~ ";" => [:semicolon],~ +- Inside source: true +*** True Line Result + ";" => [:semicolon], +** Processing line: ~ "=" => [:equal_sign],~ +- Inside source: true +*** True Line Result + "=" => [:equal_sign], +** Processing line: ~ "-" => [:hyphen],~ +- Inside source: true +*** True Line Result + "-" => [:hyphen], +** Processing line: ~ " " => [:space],~ +- Inside source: true +*** True Line Result + " " => [:space], +** Processing line: ~ "$" => [:dollar_sign],~ +- Inside source: true +*** True Line Result + "$" => [:dollar_sign], +** Processing line: ~ "\"" => [:double_quotation_mark],~ +- Inside source: true +*** True Line Result + "\"" => [:double_quotation_mark], +** Processing line: ~ "'" => [:single_quotation_mark],~ +- Inside source: true +*** True Line Result + "'" => [:single_quotation_mark], +** Processing line: ~ "`" => [:backtick],~ +- Inside source: true +*** True Line Result + "`" => [:backtick], +** Processing line: ~ "~" => [:tilde],~ +- Inside source: true +*** True Line Result + "~" => [:tilde], +** Processing line: ~ "." => [:period],~ +- Inside source: true +*** True Line Result + "." => [:period], +** Processing line: ~ "," => [:comma],~ +- Inside source: true +*** True Line Result + "," => [:comma], +** Processing line: ~ "|" => [:pipe],~ +- Inside source: true +*** True Line Result + "|" => [:pipe], +** Processing line: ~ "_" => [:underscore],~ +- Inside source: true +*** True Line Result + "_" => [:underscore], +** Processing line: ~ "#" => [:hash],~ +- Inside source: true +*** True Line Result + "#" => [:hash], +** Processing line: ~ "+" => [:plus],~ +- Inside source: true +*** True Line Result + "+" => [:plus], +** Processing line: ~ "@" => [:at],~ +- Inside source: true +*** True Line Result + "@" => [:at], +** Processing line: ~ "/" => [:forward_slash],~ +- Inside source: true +*** True Line Result + "/" => [:forward_slash], +** Processing line: ~ "\\" => [:back_slash],~ +- Inside source: true +*** True Line Result + "\\" => [:back_slash], +** Processing line: ~ "*" => [:asterisk],~ +- Inside source: true +*** True Line Result + "*" => [:asterisk], +** Processing line: ~ "<" => [:less_than],~ +- Inside source: true +*** True Line Result + "<" => [:less_than], +** Processing line: ~ ">" => [:greater_than],~ +- Inside source: true +*** True Line Result + ">" => [:greater_than], +** Processing line: ~ "^" => [:circumflex],~ +- Inside source: true +*** True Line Result + "^" => [:circumflex], +** Processing line: ~ "&" => [:ampersand],~ +- Inside source: true +*** True Line Result + "&" => [:ampersand], +** Processing line: ~ "²" => [:superscript_two],~ +- Inside source: true +*** True Line Result + "²" => [:superscript_two], +** Processing line: ~ "§" => [:section_sign],~ +- Inside source: true +*** True Line Result + "§" => [:section_sign], +** Processing line: ~ "?" => [:question_mark],~ +- Inside source: true +*** True Line Result + "?" => [:question_mark], +** Processing line: ~ '%' => [:percent_sign],~ +- Inside source: true +*** True Line Result + '%' => [:percent_sign], +** Processing line: ~ "º" => [:ordinal_indicator],~ +- Inside source: true +*** True Line Result + "º" => [:ordinal_indicator], +** Processing line: ~ 1073741903 => [:right],~ +- Inside source: true +*** True Line Result + 1073741903 => [:right], +** Processing line: ~ 1073741904 => [:left],~ +- Inside source: true +*** True Line Result + 1073741904 => [:left], +** Processing line: ~ 1073741905 => [:down],~ +- Inside source: true +*** True Line Result + 1073741905 => [:down], +** Processing line: ~ 1073741906 => [:up],~ +- Inside source: true +*** True Line Result + 1073741906 => [:up], +** Processing line: ~ 1073741899 => [:pageup],~ +- Inside source: true +*** True Line Result + 1073741899 => [:pageup], +** Processing line: ~ 1073741902 => [:pagedown],~ +- Inside source: true +*** True Line Result + 1073741902 => [:pagedown], +** Processing line: ~ 127 => [:delete]~ +- Inside source: true +*** True Line Result + 127 => [:delete] +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ -- P detected. -- Formatting line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~** Creating Your Game Landing Page~ -- H2 detected. -- Formatting line: ~Creating Your Game Landing Page~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Creating Your Game Landing Page~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ -- P detected. -- Formatting line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~~ -** Processing line: ~- Title: Give your game a Title. This value represents your `gametitle`.~ -- UL start detected. -- LI detected. -- Formatting line: ~Title: Give your game a Title. This value represents your `gametitle`.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Project URL: Set your project url. This value represents your `gameid`.~ -- LI detected. -- Formatting line: ~Project URL: Set your project url. This value represents your `gameid`.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Classification: Keep this as Game.~ -- LI detected. -- Formatting line: ~Classification: Keep this as Game.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Kind of Project: Select HTML from the drop down list. Don't worry, - the HTML project type _also supports binary downloads_.~ -- LI detected. -- Formatting line: ~Kind of Project: Select HTML from the drop down list. Don't worry, - the HTML project type _also supports binary downloads_.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Uploads: Skip this section for now.~ -- LI detected. -- Formatting line: ~Uploads: Skip this section for now.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~You can fill out all the other options later.~ -- UL end detected. -- P detected. -- Formatting line: ~You can fill out all the other options later.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.char_to_method char, int = nil~ +- Inside source: true +*** True Line Result + def self.char_to_method char, int = nil +** Processing line: ~ char_to_method_hash[char] || char_to_method_hash[int] || [char.to_sym || int]~ +- Inside source: true +*** True Line Result + char_to_method_hash[char] || char_to_method_hash[int] || [char.to_sym || int] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Update Your Game's Metadata~ -- H2 detected. -- Formatting line: ~Update Your Game's Metadata~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Update Your Game's Metadata~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def clear~ +- Inside source: true +*** True Line Result + def clear +** Processing line: ~ set truthy_keys, false~ +- Inside source: true +*** True Line Result + set truthy_keys, false +** Processing line: ~ @scrubbed_ivars = nil~ +- Inside source: true +*** True Line Result + @scrubbed_ivars = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ -- P detected. -- Formatting line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~NOTE: Remove the ~#~ at the beginning of each line.~ -- P detected. -- Formatting line: ~NOTE: Remove the ~#~ at the beginning of each line.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def left_right~ +- Inside source: true +*** True Line Result + def left_right +** Processing line: ~ return -1 if self.left~ +- Inside source: true +*** True Line Result + return -1 if self.left +** Processing line: ~ return 1 if self.right~ +- Inside source: true +*** True Line Result + return 1 if self.right +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~devid=bob~ -** Processing line: ~devtitle=Bob The Game Developer~ -** Processing line: ~gameid=mygame~ -** Processing line: ~gametitle=My Game~ -** Processing line: ~version=0.1~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def up_down~ +- Inside source: true +*** True Line Result + def up_down +** Processing line: ~ return 1 if self.up~ +- Inside source: true +*** True Line Result + return 1 if self.up +** Processing line: ~ return -1 if self.down~ +- Inside source: true +*** True Line Result + return -1 if self.down +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ -- P detected. -- Formatting line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ -- Line's tilde count is: 12 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def truthy_keys~ +- Inside source: true +*** True Line Result + def truthy_keys +** Processing line: ~ get(all).find_all { |_, v| v }~ +- Inside source: true +*** True Line Result + get(all).find_all { |_, v| v } +** Processing line: ~ .map { |k, _| k.to_sym }~ +- Inside source: true +*** True Line Result + .map { |k, _| k.to_sym } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Building Your Game For Distribution~ -- H2 detected. -- Formatting line: ~Building Your Game For Distribution~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Building Your Game For Distribution~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def all? keys~ +- Inside source: true +*** True Line Result + def all? keys +** Processing line: ~ values = get(keys.map { |k| k.without_ending_bang })~ +- Inside source: true +*** True Line Result + values = get(keys.map { |k| k.without_ending_bang }) +** Processing line: ~ all_true = values.all? do |k, v|~ +- Inside source: true +*** True Line Result + all_true = values.all? do |k, v| +** Processing line: ~ v~ +- Inside source: true +*** True Line Result + v +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Open up the terminal and run this from the command line:~ -- P detected. -- Formatting line: ~Open up the terminal and run this from the command line:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ if all_true~ +- Inside source: true +*** True Line Result + if all_true +** Processing line: ~ keys.each do |k|~ +- Inside source: true +*** True Line Result + keys.each do |k| +** Processing line: ~ clear_key k if k.end_with_bang?~ +- Inside source: true +*** True Line Result + clear_key k if k.end_with_bang? +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~./dragonruby-publish --only-package mygame~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ all_true~ +- Inside source: true +*** True Line Result + all_true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ -- P detected. -- Formatting line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ -- P detected. -- Formatting line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ -- P detected. -- Formatting line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~For subsequent updates you can use an automated deployment to Itch.io:~ -- P detected. -- Formatting line: ~For subsequent updates you can use an automated deployment to Itch.io:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def any? keys~ +- Inside source: true +*** True Line Result + def any? keys +** Processing line: ~ values = get(keys.map { |k| k.without_ending_bang })~ +- Inside source: true +*** True Line Result + values = get(keys.map { |k| k.without_ending_bang }) +** Processing line: ~ any_true = values.any? do |k, v|~ +- Inside source: true +*** True Line Result + any_true = values.any? do |k, v| +** Processing line: ~ v~ +- Inside source: true +*** True Line Result + v +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~./dragonruby-publish mygame~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ if any_true~ +- Inside source: true +*** True Line Result + if any_true +** Processing line: ~ keys.each do |k|~ +- Inside source: true +*** True Line Result + keys.each do |k| +** Processing line: ~ clear_key k if k.end_with_bang?~ +- Inside source: true +*** True Line Result + clear_key k if k.end_with_bang? +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ -- P detected. -- Formatting line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ -- P detected. -- Formatting line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ any_true~ +- Inside source: true +*** True Line Result + any_true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** DragonRuby's Philosophy~ -- H2 detected. -- Formatting line: ~DragonRuby's Philosophy~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~DragonRuby's Philosophy~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def clear_key key~ +- Inside source: true +*** True Line Result + def clear_key key +** Processing line: ~ @scrubbed_ivars = nil~ +- Inside source: true +*** True Line Result + @scrubbed_ivars = nil +** Processing line: ~ self.instance_variable_set("@#{key.without_ending_bang}", false)~ +- Inside source: true +*** True Line Result + self.instance_variable_set("@#{key.without_ending_bang}", false) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ -- P detected. -- Formatting line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def all~ +- Inside source: true +*** True Line Result + def all +** Processing line: ~ @scrubbed_ivars ||= self.instance_variables~ +- Inside source: true +*** True Line Result + @scrubbed_ivars ||= self.instance_variables +** Processing line: ~ .reject { |i| i == :@all || i == :@scrubbed_ivars }~ +- Inside source: true +*** True Line Result + .reject { |i| i == :@all || i == :@scrubbed_ivars } +** Processing line: ~ .map { |i| i.to_s.gsub("@", "") }~ +- Inside source: true +*** True Line Result + .map { |i| i.to_s.gsub("@", "") } ** Processing line: ~~ -** Processing line: ~*** Challenge The Status Quo~ -- H3 detected. -- Formatting line: ~Challenge The Status Quo~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Challenge The Status Quo~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ get(@scrubbed_ivars).map { |k, _| k }~ +- Inside source: true +*** True Line Result + get(@scrubbed_ivars).map { |k, _| k } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ -- P detected. -- Formatting line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def get collection~ +- Inside source: true +*** True Line Result + def get collection +** Processing line: ~ return [] if collection.length == 0~ +- Inside source: true +*** True Line Result + return [] if collection.length == 0 +** Processing line: ~ collection.map do |m|~ +- Inside source: true +*** True Line Result + collection.map do |m| +** Processing line: ~ if m.end_with_bang?~ +- Inside source: true +*** True Line Result + if m.end_with_bang? +** Processing line: ~ clear_after_return = true~ +- Inside source: true +*** True Line Result + clear_after_return = true +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_quote~ -- BLOCKQUOTE start detected. -** Processing line: ~But that's how we've always done it.~ -- P detected. -- Formatting line: ~But that's how we've always done it.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~#+end_quote~ -- BLOCKQUOTE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ +- Inside source: true +*** True Line Result + value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) +** Processing line: ~ clear_key m if clear_after_return~ +- Inside source: true +*** True Line Result + clear_key m if clear_after_return +** Processing line: ~ [m.without_ending_bang, value]~ +- Inside source: true +*** True Line Result + [m.without_ending_bang, value] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ -- P detected. -- Formatting line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def set collection, value = true~ +- Inside source: true +*** True Line Result + def set collection, value = true +** Processing line: ~ return if collection.length == 0~ +- Inside source: true +*** True Line Result + return if collection.length == 0 +** Processing line: ~ @scrubbed_ivars = nil~ +- Inside source: true +*** True Line Result + @scrubbed_ivars = nil +** Processing line: ~ value = Kernel.tick_count if value~ +- Inside source: true +*** True Line Result + value = Kernel.tick_count if value ** Processing line: ~~ -** Processing line: ~*** Continuity of Design~ -- H3 detected. -- Formatting line: ~Continuity of Design~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Continuity of Design~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ collection.each do |m|~ +- Inside source: true +*** True Line Result + collection.each do |m| +** Processing line: ~ self.instance_variable_set("@#{m.to_s}".to_sym, value)~ +- Inside source: true +*** True Line Result + self.instance_variable_set("@#{m.to_s}".to_sym, value) +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise e, <<-S~ +- Inside source: true +*** True Line Result + raise e, <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ Attempted to set the a key on the DragonRuby GTK's Keyboard data~ +- Inside source: true +*** True Line Result + Attempted to set the a key on the DragonRuby GTK's Keyboard data +** Processing line: ~ structure, but the property isn't available for raw_key #{raw_key} #{m}.~ +- Inside source: true +*** True Line Result + structure, but the property isn't available for raw_key #{raw_key} #{m}. ** Processing line: ~~ -** Processing line: ~There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the (hopes that the investment will yield dividends "when you become successful"). This results in more "Enterprise TM" code upfront, and makes it more difficult to get started when you are new to programming.~ -- P detected. -- Formatting line: ~There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the (hopes that the investment will yield dividends "when you become successful"). This results in more "Enterprise TM" code upfront, and makes it more difficult to get started when you are new to programming.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront).~ -- P detected. -- Formatting line: ~DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront).~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ You should contact DragonRuby and tell them to associate the raw_key #{raw_key}~ +- Inside source: true +*** True Line Result + You should contact DragonRuby and tell them to associate the raw_key #{raw_key} +** Processing line: ~ with a friendly property name (we are open to suggestions if you have any).~ +- Inside source: true +*** True Line Result + with a friendly property name (we are open to suggestions if you have any). +** Processing line: ~ [GTK::KeyboardKeys#set, GTK::KeyboardKeys#char_to_method]~ +- Inside source: true +*** True Line Result + [GTK::KeyboardKeys#set, GTK::KeyboardKeys#char_to_method] ** Processing line: ~~ -** Processing line: ~*** Release Often And Soon~ -- H3 detected. -- Formatting line: ~Release Often And Soon~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Release Often And Soon~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ -- P detected. -- Formatting line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ -- P detected. -- Formatting line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Remember:~ -- P detected. -- Formatting line: ~Remember:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def method_missing m, *args~ +- Inside source: true +*** True Line Result + def method_missing m, *args +** Processing line: ~ begin~ +- Inside source: true +*** True Line Result + begin +** Processing line: ~ define_singleton_method(m) do~ +- Inside source: true +*** True Line Result + define_singleton_method(m) do +** Processing line: ~ r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)~ +- Inside source: true +*** True Line Result + r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym) +** Processing line: ~ clear_key m~ +- Inside source: true +*** True Line Result + clear_key m +** Processing line: ~ return r~ +- Inside source: true +*** True Line Result + return r +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_quote~ -- BLOCKQUOTE start detected. -** Processing line: ~Real artists ship.~ -- P detected. -- Formatting line: ~Real artists ship.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~#+end_quote~ -- BLOCKQUOTE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ return self.send m~ +- Inside source: true +*** True Line Result + return self.send m +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ log_important "#{e}"~ +- Inside source: true +*** True Line Result + log_important "#{e}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ There is no member on the keyboard called #{m}. Here is a to_s representation of what's available:~ +- Inside source: true +*** True Line Result + There is no member on the keyboard called #{m}. Here is a to_s representation of what's available: ** Processing line: ~~ -** Processing line: ~*** Sustainable And Ethical Monetization~ -- H3 detected. -- Formatting line: ~Sustainable And Ethical Monetization~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Sustainable And Ethical Monetization~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")}~ +- Inside source: true +*** True Line Result + #{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join(" ")} ** Processing line: ~~ -** Processing line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ -- P detected. -- Formatting line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ -- P detected. -- Formatting line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** Sustainable And Ethical Open Source~ -- H3 detected. -- Formatting line: ~Sustainable And Ethical Open Source~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Sustainable And Ethical Open Source~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ hash = super~ +- Inside source: true +*** True Line Result + hash = super +** Processing line: ~ hash.delete(:scrubbed_ivars)~ +- Inside source: true +*** True Line Result + hash.delete(:scrubbed_ivars) +** Processing line: ~ hash[:truthy_keys] = self.truthy_keys~ +- Inside source: true +*** True Line Result + hash[:truthy_keys] = self.truthy_keys +** Processing line: ~ hash~ +- Inside source: true +*** True Line Result + hash +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ -- P detected. -- Formatting line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ -- P detected. -- Formatting line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class Keyboard~ +- Inside source: true +*** True Line Result + class Keyboard ** Processing line: ~~ -** Processing line: ~*** People Over Entities~ -- H3 detected. -- Formatting line: ~People Over Entities~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~People Over Entities~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [KeyboardKeys]~ +- Inside source: true +*** True Line Result + # @return [KeyboardKeys] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :key_up~ +- Inside source: true +*** True Line Result + attr_accessor :key_up ** Processing line: ~~ -** Processing line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ -- P detected. -- Formatting line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [KeyboardKeys]~ +- Inside source: true +*** True Line Result + # @return [KeyboardKeys] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :key_held~ +- Inside source: true +*** True Line Result + attr_accessor :key_held ** Processing line: ~~ -** Processing line: ~*** Building A Game Should Be Fun And Bring Happiness~ -- H3 detected. -- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [KeyboardKeys]~ +- Inside source: true +*** True Line Result + # @return [KeyboardKeys] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :key_down~ +- Inside source: true +*** True Line Result + attr_accessor :key_down ** Processing line: ~~ -** Processing line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ -- P detected. -- Formatting line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [Boolean]~ +- Inside source: true +*** True Line Result + # @return [Boolean] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :has_focus~ +- Inside source: true +*** True Line Result + attr_accessor :has_focus ** Processing line: ~~ -** Processing line: ~*** Real World Application Drives Features~ -- H3 detected. -- Formatting line: ~Real World Application Drives Features~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Real World Application Drives Features~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize~ +- Inside source: true +*** True Line Result + def initialize +** Processing line: ~ @key_up = KeyboardKeys.new~ +- Inside source: true +*** True Line Result + @key_up = KeyboardKeys.new +** Processing line: ~ @key_held = KeyboardKeys.new~ +- Inside source: true +*** True Line Result + @key_held = KeyboardKeys.new +** Processing line: ~ @key_down = KeyboardKeys.new~ +- Inside source: true +*** True Line Result + @key_down = KeyboardKeys.new +** Processing line: ~ @has_focus = false~ +- Inside source: true +*** True Line Result + @has_focus = false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ -- P detected. -- Formatting line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ -- P detected. -- Formatting line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def p~ +- Inside source: true +*** True Line Result + def p +** Processing line: ~ @key_down.p || @key_held.p~ +- Inside source: true +*** True Line Result + @key_down.p || @key_held.p +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* How To Determine What Frame You Are On~ -- H1 detected. -- Formatting line: ~How To Determine What Frame You Are On~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # The left arrow or "a" was pressed.~ +- Inside source: true +*** True Line Result + # The left arrow or "a" was pressed. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Boolean]~ +- Inside source: true +*** True Line Result + # @return [Boolean] +** Processing line: ~ def left~ +- Inside source: true +*** True Line Result + def left +** Processing line: ~ @key_up.left || @key_held.left || a~ +- Inside source: true +*** True Line Result + @key_up.left || @key_held.left || a +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ -- P detected. -- Formatting line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ -- Line's tilde count is: 8 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # The right arrow or "d" was pressed.~ +- Inside source: true +*** True Line Result + # The right arrow or "d" was pressed. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Boolean]~ +- Inside source: true +*** True Line Result + # @return [Boolean] +** Processing line: ~ def right~ +- Inside source: true +*** True Line Result + def right +** Processing line: ~ @key_up.right || @key_held.right || d~ +- Inside source: true +*** True Line Result + @key_up.right || @key_held.right || d +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << [10, 670, "#{args.state.tick_count}"]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* How To Get Current Framerate~ -- H1 detected. -- Formatting line: ~How To Get Current Framerate~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # The up arrow or "w" was pressed.~ +- Inside source: true +*** True Line Result + # The up arrow or "w" was pressed. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Boolean]~ +- Inside source: true +*** True Line Result + # @return [Boolean] +** Processing line: ~ def up~ +- Inside source: true +*** True Line Result + def up +** Processing line: ~ @key_up.up || @key_held.up || w~ +- Inside source: true +*** True Line Result + @key_up.up || @key_held.up || w +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ -- P detected. -- Formatting line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # The down arrow or "s" was pressed.~ +- Inside source: true +*** True Line Result + # The down arrow or "s" was pressed. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Boolean]~ +- Inside source: true +*** True Line Result + # @return [Boolean] +** Processing line: ~ def down~ +- Inside source: true +*** True Line Result + def down +** Processing line: ~ @key_up.down || @key_held.down || s~ +- Inside source: true +*** True Line Result + @key_up.down || @key_held.down || s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Clear all current key presses.~ +- Inside source: true +*** True Line Result + # Clear all current key presses. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [void]~ +- Inside source: true +*** True Line Result + # @return [void] +** Processing line: ~ def clear~ +- Inside source: true +*** True Line Result + def clear +** Processing line: ~ @key_up.clear~ +- Inside source: true +*** True Line Result + @key_up.clear +** Processing line: ~ @key_held.clear~ +- Inside source: true +*** True Line Result + @key_held.clear +** Processing line: ~ @key_down.clear~ +- Inside source: true +*** True Line Result + @key_down.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ key_up: @key_up.serialize,~ +- Inside source: true +*** True Line Result + key_up: @key_up.serialize, +** Processing line: ~ key_held: @key_held.serialize,~ +- Inside source: true +*** True Line Result + key_held: @key_held.serialize, +** Processing line: ~ key_down: @key_down.serialize,~ +- Inside source: true +*** True Line Result + key_down: @key_down.serialize, +** Processing line: ~ has_focus: @has_focus~ +- Inside source: true +*** True Line Result + has_focus: @has_focus +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ alias_method :inspect, :serialize~ +- Inside source: true +*** True Line Result + alias_method :inspect, :serialize ** Processing line: ~~ -** Processing line: ~* How To Render A Sprite Using An Array~ -- H1 detected. -- Formatting line: ~How To Render A Sprite Using An Array~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [String]~ +- Inside source: true +*** True Line Result + # @return [String] +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ serialize.to_s~ +- Inside source: true +*** True Line Result + serialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ -- P detected. -- Formatting line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ -- Line's tilde count is: 8 -- Line contains link marker: false -- CODE detected. -** Processing line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ -- P detected. -- Formatting line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~args.outputs.sprites~ is used to render a sprite.~ -- P detected. -- Formatting line: ~~args.outputs.sprites~ is used to render a sprite.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def key~ +- Inside source: true +*** True Line Result + def key +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ down: @key_down.truthy_keys,~ +- Inside source: true +*** True Line Result + down: @key_down.truthy_keys, +** Processing line: ~ held: @key_held.truthy_keys,~ +- Inside source: true +*** True Line Result + held: @key_held.truthy_keys, +** Processing line: ~ down_or_held: (@key_down.truthy_keys + @key_held.truthy_keys).uniq,~ +- Inside source: true +*** True Line Result + down_or_held: (@key_down.truthy_keys + @key_held.truthy_keys).uniq, +** Processing line: ~ up: @key_up.truthy_keys,~ +- Inside source: true +*** True Line Result + up: @key_up.truthy_keys, +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ alias_method :keys, :key~ +- Inside source: true +*** True Line Result + alias_method :keys, :key ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ 640 - 50, # X~ -** Processing line: ~ 360 - 50, # Y~ -** Processing line: ~ 100, # W~ -** Processing line: ~ 100, # H~ -** Processing line: ~ 'sprites/square-blue.png' # PATH~ -** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ include DirectionalInputHelperMethods~ +- Inside source: true +*** True Line Result + include DirectionalInputHelperMethods +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* More Sprite Properties As An Array~ -- H1 detected. -- Formatting line: ~More Sprite Properties As An Array~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Here are all the properties you can set on a sprite.~ -- P detected. -- Formatting line: ~Here are all the properties you can set on a sprite.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ class MousePoint~ +- Inside source: true +*** True Line Result + class MousePoint +** Processing line: ~ include GTK::Geometry~ +- Inside source: true +*** True Line Result + include GTK::Geometry ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ 100, # X~ -** Processing line: ~ 100, # Y~ -** Processing line: ~ 32, # W~ -** Processing line: ~ 64, # H~ -** Processing line: ~ 'sprites/square-blue.png', # PATH~ -** Processing line: ~ 0, # ANGLE~ -** Processing line: ~ 255, # ALPHA~ -** Processing line: ~ 0, # RED_SATURATION~ -** Processing line: ~ 255, # GREEN_SATURATION~ -** Processing line: ~ 0 # BLUE_SATURATION~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :x, :y, :point, :created_at, :global_created_at~ +- Inside source: true +*** True Line Result + attr_accessor :x, :y, :point, :created_at, :global_created_at ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize x, y~ +- Inside source: true +*** True Line Result + def initialize x, y +** Processing line: ~ @x = x~ +- Inside source: true +*** True Line Result + @x = x +** Processing line: ~ @y = y~ +- Inside source: true +*** True Line Result + @y = y +** Processing line: ~ @point = [x, y]~ +- Inside source: true +*** True Line Result + @point = [x, y] +** Processing line: ~ @created_at = Kernel.tick_count~ +- Inside source: true +*** True Line Result + @created_at = Kernel.tick_count +** Processing line: ~ @global_created_at = Kernel.global_tick_count~ +- Inside source: true +*** True Line Result + @global_created_at = Kernel.global_tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Different Sprite Representations~ -- H1 detected. -- Formatting line: ~Different Sprite Representations~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def w; 0; end~ +- Inside source: true +*** True Line Result + def w; 0; end +** Processing line: ~ def h; 0; end~ +- Inside source: true +*** True Line Result + def h; 0; end +** Processing line: ~ def left; x; end~ +- Inside source: true +*** True Line Result + def left; x; end +** Processing line: ~ def right; x; end~ +- Inside source: true +*** True Line Result + def right; x; end +** Processing line: ~ def top; y; end~ +- Inside source: true +*** True Line Result + def top; y; end +** Processing line: ~ def bottom; y; end~ +- Inside source: true +*** True Line Result + def bottom; y; end ** Processing line: ~~ -** Processing line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ -- P detected. -- Formatting line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~You can represent a sprite as a ~Hash~:~ -- P detected. -- Formatting line: ~You can represent a sprite as a ~Hash~:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def created_at_elapsed~ +- Inside source: true +*** True Line Result + def created_at_elapsed +** Processing line: ~ @created_at.elapsed_time~ +- Inside source: true +*** True Line Result + @created_at.elapsed_time +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.sprites << {~ -** Processing line: ~ x: 640 - 50,~ -** Processing line: ~ y: 360 - 50,~ -** Processing line: ~ w: 100,~ -** Processing line: ~ h: 100,~ -** Processing line: ~ path: 'sprites/square-blue.png',~ -** Processing line: ~ angle: 0,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ r: 255,~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 255,~ -** Processing line: ~ source_x: 0,~ -** Processing line: ~ source_y: 0,~ -** Processing line: ~ source_w: -1,~ -** Processing line: ~ source_h: -1,~ -** Processing line: ~ flip_vertically: false,~ -** Processing line: ~ flip_horizontally: false,~ -** Processing line: ~ angle_anchor_x: 0.5,~ -** Processing line: ~ angle_anchor_y: 1.0~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_hash~ +- Inside source: true +*** True Line Result + def to_hash +** Processing line: ~ serialize~ +- Inside source: true +*** True Line Result + serialize +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~You can represent a sprite as an ~object~:~ -- P detected. -- Formatting line: ~You can represent a sprite as an ~object~:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: @x,~ +- Inside source: true +*** True Line Result + x: @x, +** Processing line: ~ y: @y,~ +- Inside source: true +*** True Line Result + y: @y, +** Processing line: ~ created_at: @created_at,~ +- Inside source: true +*** True Line Result + created_at: @created_at, +** Processing line: ~ global_created_at: @global_created_at~ +- Inside source: true +*** True Line Result + global_created_at: @global_created_at +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ -** Processing line: ~ class Sprite~ -** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,~ -** Processing line: ~ :source_x, :source_y, :source_w, :source_h,~ -** Processing line: ~ :tile_x, :tile_y, :tile_w, :tile_h,~ -** Processing line: ~ :flip_horizontally, :flip_vertically,~ -** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def inspect~ +- Inside source: true +*** True Line Result + def inspect +** Processing line: ~ serialize.to_s~ +- Inside source: true +*** True Line Result + serialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def primitive_marker~ -** Processing line: ~ :sprite~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ class BlueSquare < Sprite~ -** Processing line: ~ def initialize opts~ -** Processing line: ~ @x = opts[:x]~ -** Processing line: ~ @y = opts[:y]~ -** Processing line: ~ @w = opts[:w]~ -** Processing line: ~ @h = opts[:h]~ -** Processing line: ~ @path = 'sprites/square-blue.png'~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ serialize.to_s~ +- Inside source: true +*** True Line Result + serialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.sprites << (BlueSquare.new x: 640 - 50,~ -** Processing line: ~ y: 360 - 50,~ -** Processing line: ~ w: 50,~ -** Processing line: ~ h: 50)~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Provides access to the mouse.~ +- Inside source: true +*** True Line Result + # Provides access to the mouse. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class Mouse~ +- Inside source: true +*** True Line Result + class Mouse ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :moved,~ +- Inside source: true +*** True Line Result + attr_accessor :moved, +** Processing line: ~ :moved_at,~ +- Inside source: true +*** True Line Result + :moved_at, +** Processing line: ~ :global_moved_at,~ +- Inside source: true +*** True Line Result + :global_moved_at, +** Processing line: ~ :up, :has_focus,~ +- Inside source: true +*** True Line Result + :up, :has_focus, +** Processing line: ~ :button_bits, :button_left,~ +- Inside source: true +*** True Line Result + :button_bits, :button_left, +** Processing line: ~ :button_middle, :button_right,~ +- Inside source: true +*** True Line Result + :button_middle, :button_right, +** Processing line: ~ :button_x1, :button_x2,~ +- Inside source: true +*** True Line Result + :button_x1, :button_x2, +** Processing line: ~ :wheel~ +- Inside source: true +*** True Line Result + :wheel ** Processing line: ~~ -** Processing line: ~* How To Render A Label~ -- H1 detected. -- Formatting line: ~How To Render A Label~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ attr_accessor :click~ +- Inside source: true +*** True Line Result + attr_accessor :click +** Processing line: ~ attr_accessor :previous_click~ +- Inside source: true +*** True Line Result + attr_accessor :previous_click +** Processing line: ~ attr_accessor :x~ +- Inside source: true +*** True Line Result + attr_accessor :x +** Processing line: ~ attr_accessor :y~ +- Inside source: true +*** True Line Result + attr_accessor :y ** Processing line: ~~ -** Processing line: ~~args.outputs.labels~ is used to render labels.~ -- P detected. -- Formatting line: ~~args.outputs.labels~ is used to render labels.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ -- P detected. -- Formatting line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Here is the minimum code:~ -- P detected. -- Formatting line: ~Here is the minimum code:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize~ +- Inside source: true +*** True Line Result + def initialize +** Processing line: ~ @x = 0~ +- Inside source: true +*** True Line Result + @x = 0 +** Processing line: ~ @y = 0~ +- Inside source: true +*** True Line Result + @y = 0 +** Processing line: ~ @has_focus = false~ +- Inside source: true +*** True Line Result + @has_focus = false +** Processing line: ~ @button_bits = 0~ +- Inside source: true +*** True Line Result + @button_bits = 0 +** Processing line: ~ @button_left = false~ +- Inside source: true +*** True Line Result + @button_left = false +** Processing line: ~ @button_middle = false~ +- Inside source: true +*** True Line Result + @button_middle = false +** Processing line: ~ @button_right = false~ +- Inside source: true +*** True Line Result + @button_right = false +** Processing line: ~ @button_x1 = false~ +- Inside source: true +*** True Line Result + @button_x1 = false +** Processing line: ~ @button_x2 = false~ +- Inside source: true +*** True Line Result + @button_x2 = false +** Processing line: ~ clear~ +- Inside source: true +*** True Line Result + clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # X Y TEXT~ -** Processing line: ~ args.outputs.labels << [640, 360, "I am a black label."]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def point~ +- Inside source: true +*** True Line Result + def point +** Processing line: ~ [@x, @y].point~ +- Inside source: true +*** True Line Result + [@x, @y].point +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def inside_rect? rect~ +- Inside source: true +*** True Line Result + def inside_rect? rect +** Processing line: ~ point.inside_rect? rect~ +- Inside source: true +*** True Line Result + point.inside_rect? rect +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* A Colored Label~ -- H1 detected. -- Formatting line: ~A Colored Label~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :position, :point~ +- Inside source: true +*** True Line Result + alias_method :position, :point ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def clear~ +- Inside source: true +*** True Line Result + def clear +** Processing line: ~ if @click~ +- Inside source: true +*** True Line Result + if @click +** Processing line: ~ @previous_click = MousePoint.new @click.point.x, @click.point.y~ +- Inside source: true +*** True Line Result + @previous_click = MousePoint.new @click.point.x, @click.point.y +** Processing line: ~ @previous_click.created_at = @click.created_at~ +- Inside source: true +*** True Line Result + @previous_click.created_at = @click.created_at +** Processing line: ~ @previous_click.global_created_at = @click.global_created_at~ +- Inside source: true +*** True Line Result + @previous_click.global_created_at = @click.global_created_at +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # A colored label~ -** Processing line: ~ # X Y TEXT, RED GREEN BLUE ALPHA~ -** Processing line: ~ args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ @click = nil~ +- Inside source: true +*** True Line Result + @click = nil +** Processing line: ~ @up = nil~ +- Inside source: true +*** True Line Result + @up = nil +** Processing line: ~ @moved = nil~ +- Inside source: true +*** True Line Result + @moved = nil +** Processing line: ~ @wheel = nil~ +- Inside source: true +*** True Line Result + @wheel = nil +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def up~ +- Inside source: true +*** True Line Result + def up +** Processing line: ~ @up~ +- Inside source: true +*** True Line Result + @up +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Extended Label Properties~ -- H1 detected. -- Formatting line: ~Extended Label Properties~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def down~ +- Inside source: true +*** True Line Result + def down +** Processing line: ~ @click~ +- Inside source: true +*** True Line Result + @click +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ result = {}~ +- Inside source: true +*** True Line Result + result = {} ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # A colored label~ -** Processing line: ~ # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ 640, # X~ -** Processing line: ~ 360, # Y~ -** Processing line: ~ "Hello world", # TEXT~ -** Processing line: ~ 0, # SIZE_ENUM~ -** Processing line: ~ 1, # ALIGNMENT_ENUM~ -** Processing line: ~ 0, # RED~ -** Processing line: ~ 0, # GREEN~ -** Processing line: ~ 0, # BLUE~ -** Processing line: ~ 255, # ALPHA~ -** Processing line: ~ "fonts/coolfont.ttf" # FONT~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ if @click~ +- Inside source: true +*** True Line Result + if @click +** Processing line: ~ result[:click] = @click.to_hash~ +- Inside source: true +*** True Line Result + result[:click] = @click.to_hash +** Processing line: ~ result[:down] = @click.to_hash~ +- Inside source: true +*** True Line Result + result[:down] = @click.to_hash +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ -- P detected. -- Formatting line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ -- Line's tilde count is: 8 -- Line contains link marker: false -- CODE detected. -** Processing line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ -- P detected. -- Formatting line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ -- Line's tilde count is: 8 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ result[:up] = @up.to_hash if @up~ +- Inside source: true +*** True Line Result + result[:up] = @up.to_hash if @up +** Processing line: ~ result[:x] = @x~ +- Inside source: true +*** True Line Result + result[:x] = @x +** Processing line: ~ result[:y] = @y~ +- Inside source: true +*** True Line Result + result[:y] = @y +** Processing line: ~ result[:moved] = @moved~ +- Inside source: true +*** True Line Result + result[:moved] = @moved +** Processing line: ~ result[:moved_at] = @moved_at~ +- Inside source: true +*** True Line Result + result[:moved_at] = @moved_at +** Processing line: ~ result[:has_focus] = @has_focus~ +- Inside source: true +*** True Line Result + result[:has_focus] = @has_focus ** Processing line: ~~ -** Processing line: ~* Rendering A Label As A ~Hash~~ -- H1 detected. -- Formatting line: ~Rendering A Label As A ~Hash~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ result~ +- Inside source: true +*** True Line Result + result +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ -- P detected. -- Formatting line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ serialize.to_s~ +- Inside source: true +*** True Line Result + serialize.to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << {~ -** Processing line: ~ x: 200,~ -** Processing line: ~ y: 550,~ -** Processing line: ~ text: "dragonruby",~ -** Processing line: ~ size_enum: 2,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 155,~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: "fonts/manaspc.ttf",~ -** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ -** Processing line: ~ game_data_one: "Something",~ -** Processing line: ~ game_data_two: {~ -** Processing line: ~ value_1: "value",~ -** Processing line: ~ value_2: "value two",~ -** Processing line: ~ a_number: 15~ -** Processing line: ~ }~ -** Processing line: ~ }~ +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :inspect, :to_s~ +- Inside source: true +*** True Line Result + alias_method :inspect, :to_s +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ class Inputs~ +- Inside source: true +*** True Line Result + class Inputs ** Processing line: ~~ -** Processing line: ~* Getting The Size Of A Piece Of Text~ -- H1 detected. -- Formatting line: ~Getting The Size Of A Piece Of Text~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ -- P detected. -- Formatting line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # TEXT SIZE_ENUM FONT~ -** Processing line: ~ w, h = args.gtk.calcstringbox("some string", 0, "font.ttf")~ -** Processing line: ~~ -** Processing line: ~ # NOTE: The SIZE_ENUM and FONT are optional arguments.~ -** Processing line: ~~ -** Processing line: ~ # Render a label showing the w and h of the text:~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ 10,~ -** Processing line: ~ 710,~ -** Processing line: ~ # This string uses Ruby's string interpolation literal: #{}~ -** Processing line: ~ "'some string' has width: #{w}, and height: #{h}."~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # A list of all controllers.~ +- Inside source: true +*** True Line Result + # A list of all controllers. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Controller[]]~ +- Inside source: true +*** True Line Result + # @return [Controller[]] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_reader :controllers~ +- Inside source: true +*** True Line Result + attr_reader :controllers ** Processing line: ~~ -** Processing line: ~* How To Play A Sound~ -- H1 detected. -- Formatting line: ~How To Play A Sound~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [Keyboard]~ +- Inside source: true +*** True Line Result + # @return [Keyboard] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_reader :keyboard~ +- Inside source: true +*** True Line Result + attr_reader :keyboard ** Processing line: ~~ -** Processing line: ~Sounds that end ~.wav~ will play once:~ -- P detected. -- Formatting line: ~Sounds that end ~.wav~ will play once:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [Mouse]~ +- Inside source: true +*** True Line Result + # @return [Mouse] +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_reader :mouse~ +- Inside source: true +*** True Line Result + attr_reader :mouse ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # Play a sound every second~ -** Processing line: ~ if (args.state.tick_count % 60) == 0~ -** Processing line: ~ args.outputs.sounds << 'something.wav'~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ attr_accessor :text, :history~ +- Inside source: true +*** True Line Result + attr_accessor :text, :history ** Processing line: ~~ -** Processing line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ -- P detected. -- Formatting line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize~ +- Inside source: true +*** True Line Result + def initialize +** Processing line: ~ @controllers = [Controller.new, Controller.new]~ +- Inside source: true +*** True Line Result + @controllers = [Controller.new, Controller.new] +** Processing line: ~ @keyboard = Keyboard.new~ +- Inside source: true +*** True Line Result + @keyboard = Keyboard.new +** Processing line: ~ @mouse = Mouse.new~ +- Inside source: true +*** True Line Result + @mouse = Mouse.new +** Processing line: ~ @text = []~ +- Inside source: true +*** True Line Result + @text = [] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # Start a sound loop at the beginning of the game~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.outputs.sounds << 'background_music.ogg'~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def up~ +- Inside source: true +*** True Line Result + def up +** Processing line: ~ keyboard.up ||~ +- Inside source: true +*** True Line Result + keyboard.up || +** Processing line: ~ (controller_one && controller_one.up)~ +- Inside source: true +*** True Line Result + (controller_one && controller_one.up) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ -- P detected. -- Formatting line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def down~ +- Inside source: true +*** True Line Result + def down +** Processing line: ~ keyboard.down ||~ +- Inside source: true +*** True Line Result + keyboard.down || +** Processing line: ~ (controller_one && controller_one.down)~ +- Inside source: true +*** True Line Result + (controller_one && controller_one.down) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # Play a sound every second~ -** Processing line: ~ if (args.state.tick_count % 60) == 0~ -** Processing line: ~ args.gtk.queue_sound 'some-ogg.ogg'~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def left~ +- Inside source: true +*** True Line Result + def left +** Processing line: ~ keyboard.left ||~ +- Inside source: true +*** True Line Result + keyboard.left || +** Processing line: ~ (controller_one && controller_one.left)~ +- Inside source: true +*** True Line Result + (controller_one && controller_one.left) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def right~ +- Inside source: true +*** True Line Result + def right +** Processing line: ~ keyboard.right ||~ +- Inside source: true +*** True Line Result + keyboard.right || +** Processing line: ~ (controller_one && controller_one.right)~ +- Inside source: true +*** True Line Result + (controller_one && controller_one.right) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Using ~args.state~ To Store Your Game State~ -- H1 detected. -- Formatting line: ~Using ~args.state~ To Store Your Game State~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def directional_vector~ +- Inside source: true +*** True Line Result + def directional_vector +** Processing line: ~ keyboard.directional_vector ||~ +- Inside source: true +*** True Line Result + keyboard.directional_vector || +** Processing line: ~ (controller_one && controller_one.directional_vector)~ +- Inside source: true +*** True Line Result + (controller_one && controller_one.directional_vector) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ -- P detected. -- Formatting line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ -- P detected. -- Formatting line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ -- P detected. -- Formatting line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns a signal indicating right (`1`), left (`-1`), or neither ('0').~ +- Inside source: true +*** True Line Result + # Returns a signal indicating right (`1`), left (`-1`), or neither ('0'). +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Integer]~ +- Inside source: true +*** True Line Result + # @return [Integer] +** Processing line: ~ def left_right~ +- Inside source: true +*** True Line Result + def left_right +** Processing line: ~ return -1 if self.left~ +- Inside source: true +*** True Line Result + return -1 if self.left +** Processing line: ~ return 1 if self.right~ +- Inside source: true +*** True Line Result + return 1 if self.right +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # initialize your game state ONCE~ -** Processing line: ~ args.state.player.x ||= 0~ -** Processing line: ~ args.state.player.y ||= 0~ -** Processing line: ~ args.state.player.hp ||= 100~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns a signal indicating up (`1`), down (`-1`), or neither ('0').~ +- Inside source: true +*** True Line Result + # Returns a signal indicating up (`1`), down (`-1`), or neither ('0'). +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Integer]~ +- Inside source: true +*** True Line Result + # @return [Integer] +** Processing line: ~ def up_down~ +- Inside source: true +*** True Line Result + def up_down +** Processing line: ~ return 1 if self.up~ +- Inside source: true +*** True Line Result + return 1 if self.up +** Processing line: ~ return -1 if self.down~ +- Inside source: true +*** True Line Result + return -1 if self.down +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # increment the x position of the character by one every frame~ -** Processing line: ~ args.state.player.x += 1~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the coordinates of the last click.~ +- Inside source: true +*** True Line Result + # Returns the coordinates of the last click. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Float, Float]~ +- Inside source: true +*** True Line Result + # @return [Float, Float] +** Processing line: ~ def click~ +- Inside source: true +*** True Line Result + def click +** Processing line: ~ return nil unless @mouse.click~ +- Inside source: true +*** True Line Result + return nil unless @mouse.click +** Processing line: ~ return @mouse.click.point~ +- Inside source: true +*** True Line Result + return @mouse.click.point +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Render a sprite with a label above the sprite~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ args.state.player.x,~ -** Processing line: ~ args.state.player.y,~ -** Processing line: ~ 32, 32,~ -** Processing line: ~ "player.png"~ -** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # The first controller.~ +- Inside source: true +*** True Line Result + # The first controller. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Controller]~ +- Inside source: true +*** True Line Result + # @return [Controller] +** Processing line: ~ def controller_one~ +- Inside source: true +*** True Line Result + def controller_one +** Processing line: ~ @controllers[0]~ +- Inside source: true +*** True Line Result + @controllers[0] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ args.state.player.x,~ -** Processing line: ~ args.state.player.y - 50,~ -** Processing line: ~ args.state.player.hp~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # The second controller.~ +- Inside source: true +*** True Line Result + # The second controller. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [Controller]~ +- Inside source: true +*** True Line Result + # @return [Controller] +** Processing line: ~ def controller_two~ +- Inside source: true +*** True Line Result + def controller_two +** Processing line: ~ @controllers[1]~ +- Inside source: true +*** True Line Result + @controllers[1] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Clears all inputs.~ +- Inside source: true +*** True Line Result + # Clears all inputs. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @return [void]~ +- Inside source: true +*** True Line Result + # @return [void] +** Processing line: ~ def clear~ +- Inside source: true +*** True Line Result + def clear +** Processing line: ~ @mouse.clear~ +- Inside source: true +*** True Line Result + @mouse.clear +** Processing line: ~ @keyboard.clear~ +- Inside source: true +*** True Line Result + @keyboard.clear +** Processing line: ~ @controllers.each(&:clear)~ +- Inside source: true +*** True Line Result + @controllers.each(&:clear) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Frequently Asked Questions, Comments, and Concerns~ -- H1 detected. -- Formatting line: ~Frequently Asked Questions, Comments, and Concerns~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~Here are questions, comments, and concerns that frequently come up.~ -- P detected. -- Formatting line: ~Here are questions, comments, and concerns that frequently come up.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @return [Hash]~ +- Inside source: true +*** True Line Result + # @return [Hash] +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ controller_one: controller_one.serialize,~ +- Inside source: true +*** True Line Result + controller_one: controller_one.serialize, +** Processing line: ~ controller_two: controller_two.serialize,~ +- Inside source: true +*** True Line Result + controller_two: controller_two.serialize, +** Processing line: ~ keyboard: keyboard.serialize,~ +- Inside source: true +*** True Line Result + keyboard: keyboard.serialize, +** Processing line: ~ mouse: mouse.serialize,~ +- Inside source: true +*** True Line Result + mouse: mouse.serialize, +** Processing line: ~ text: text.serialize~ +- Inside source: true +*** True Line Result + text: text.serialize +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Frequently Asked Questions~ -- H2 detected. -- Formatting line: ~Frequently Asked Questions~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Frequently Asked Questions~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* log.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* log.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/log.rb~ +- Inside source: true +*** True Line Result + # ./dragon/log.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # log.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # log.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~*** What is DragonRuby LLP?~ -- H3 detected. -- Formatting line: ~What is DragonRuby LLP?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~What is DragonRuby LLP?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ XTERM_COLOR = {~ +- Inside source: true +*** True Line Result + XTERM_COLOR = { +** Processing line: ~ black: "\u001b[30m",~ +- Inside source: true +*** True Line Result + black: "\u001b[30m", +** Processing line: ~ red: "\u001b[31m",~ +- Inside source: true +*** True Line Result + red: "\u001b[31m", +** Processing line: ~ green: "\u001b[32m",~ +- Inside source: true +*** True Line Result + green: "\u001b[32m", +** Processing line: ~ yellow: "\u001b[33m",~ +- Inside source: true +*** True Line Result + yellow: "\u001b[33m", +** Processing line: ~ blue: "\u001b[34m",~ +- Inside source: true +*** True Line Result + blue: "\u001b[34m", +** Processing line: ~ magenta: "\u001b[35m",~ +- Inside source: true +*** True Line Result + magenta: "\u001b[35m", +** Processing line: ~ cyan: "\u001b[36m",~ +- Inside source: true +*** True Line Result + cyan: "\u001b[36m", +** Processing line: ~ white: "\u001b[37m",~ +- Inside source: true +*** True Line Result + white: "\u001b[37m", +** Processing line: ~ bright_black: "\u001b[30;1m",~ +- Inside source: true +*** True Line Result + bright_black: "\u001b[30;1m", +** Processing line: ~ bright_red: "\u001b[31;1m",~ +- Inside source: true +*** True Line Result + bright_red: "\u001b[31;1m", +** Processing line: ~ bright_green: "\u001b[32;1m",~ +- Inside source: true +*** True Line Result + bright_green: "\u001b[32;1m", +** Processing line: ~ bright_yellow: "\u001b[33;1m",~ +- Inside source: true +*** True Line Result + bright_yellow: "\u001b[33;1m", +** Processing line: ~ bright_blue: "\u001b[34;1m",~ +- Inside source: true +*** True Line Result + bright_blue: "\u001b[34;1m", +** Processing line: ~ bright_magenta: "\u001b[35;1m",~ +- Inside source: true +*** True Line Result + bright_magenta: "\u001b[35;1m", +** Processing line: ~ bright_cyan: "\u001b[36;1m",~ +- Inside source: true +*** True Line Result + bright_cyan: "\u001b[36;1m", +** Processing line: ~ bright_white: "\u001b[37;1m",~ +- Inside source: true +*** True Line Result + bright_white: "\u001b[37;1m", +** Processing line: ~ reset: "\u001b[0m",~ +- Inside source: true +*** True Line Result + reset: "\u001b[0m", +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } ** Processing line: ~~ -** Processing line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ -- P detected. -- Formatting line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ -- P detected. -- Formatting line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ class Log~ +- Inside source: true +*** True Line Result + class Log +** Processing line: ~ def self.write_to_log_and_puts *args~ +- Inside source: true +*** True Line Result + def self.write_to_log_and_puts *args +** Processing line: ~ return if $gtk.production~ +- Inside source: true +*** True Line Result + return if $gtk.production +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n"~ +- Inside source: true +*** True Line Result + $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n" +** Processing line: ~ args.each { |obj| $gtk.log obj, self }~ +- Inside source: true +*** True Line Result + args.each { |obj| $gtk.log obj, self } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]()~ -- UL start detected. -- LI detected. -- Formatting line: ~Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]()~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]()~ -- LI detected. -- Formatting line: ~RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]()~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ -- LI detected. -- Formatting line: ~Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~All of the products above leverage a shared core called DragonRuby.~ -- UL end detected. -- P detected. -- Formatting line: ~All of the products above leverage a shared core called DragonRuby.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ -- P detected. -- Formatting line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ -- P detected. -- Formatting line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ -- P detected. -- Formatting line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.write_to_log_and_print *args~ +- Inside source: true +*** True Line Result + def self.write_to_log_and_print *args +** Processing line: ~ return if $gtk.production~ +- Inside source: true +*** True Line Result + return if $gtk.production +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n")~ +- Inside source: true +*** True Line Result + $gtk.append_file_root 'logs/log.txt', args.join("\n") +** Processing line: ~ Object.print(*args)~ +- Inside source: true +*** True Line Result + Object.print(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** What is DragonRuby?~ -- H3 detected. -- Formatting line: ~What is DragonRuby?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~What is DragonRuby?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts_important *args~ +- Inside source: true +*** True Line Result + def self.puts_important *args +** Processing line: ~ return if $gtk.production~ +- Inside source: true +*** True Line Result + return if $gtk.production +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n")~ +- Inside source: true +*** True Line Result + $gtk.append_file_root 'logs/log.txt', args.join("\n") +** Processing line: ~ $gtk.notify! "Important notification occurred."~ +- Inside source: true +*** True Line Result + $gtk.notify! "Important notification occurred." +** Processing line: ~ args.each { |obj| $gtk.log obj }~ +- Inside source: true +*** True Line Result + args.each { |obj| $gtk.log obj } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ -- P detected. -- Formatting line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts *args~ +- Inside source: true +*** True Line Result + def self.puts *args +** Processing line: ~ message_id, message = args~ +- Inside source: true +*** True Line Result + message_id, message = args +** Processing line: ~ message ||= message_id~ +- Inside source: true +*** True Line Result + message ||= message_id +** Processing line: ~ write_to_log_and_puts message~ +- Inside source: true +*** True Line Result + write_to_log_and_puts message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** Okay... so what is the difference between a language specification and a runtime?~ -- H3 detected. -- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.multiline? *args~ +- Inside source: true +*** True Line Result + def self.multiline? *args +** Processing line: ~ return true if args.length > 1~ +- Inside source: true +*** True Line Result + return true if args.length > 1 +** Processing line: ~ return !args[0].to_s.multiline?~ +- Inside source: true +*** True Line Result + return !args[0].to_s.multiline? +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ -- P detected. -- Formatting line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ -- P detected. -- Formatting line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.join_lines args~ +- Inside source: true +*** True Line Result + def self.join_lines args +** Processing line: ~ return "" if args.length == 0~ +- Inside source: true +*** True Line Result + return "" if args.length == 0 +** Processing line: ~ return args if args.is_a? String~ +- Inside source: true +*** True Line Result + return args if args.is_a? String +** Processing line: ~ return args[0] if args.length == 1~ +- Inside source: true +*** True Line Result + return args[0] if args.length == 1 +** Processing line: ~ return args.to_s.join("\n")~ +- Inside source: true +*** True Line Result + return args.to_s.join("\n") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** Okay... what language specification does DragonRuby use then?~ -- H3 detected. -- Formatting line: ~Okay... what language specification does DragonRuby use then?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Okay... what language specification does DragonRuby use then?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.headline name~ +- Inside source: true +*** True Line Result + def self.headline name +** Processing line: ~ @asterisk_count ||= 1~ +- Inside source: true +*** True Line Result + @asterisk_count ||= 1 +** Processing line: ~ @asterisk_count = @asterisk_count.greater(1)~ +- Inside source: true +*** True Line Result + @asterisk_count = @asterisk_count.greater(1) +** Processing line: ~ result_from_yield = join_lines yield~ +- Inside source: true +*** True Line Result + result_from_yield = join_lines yield +** Processing line: ~ result_from_yield = result_from_yield.each_line.map { |l| " #{l}" }.join~ +- Inside source: true +*** True Line Result + result_from_yield = result_from_yield.each_line.map { |l| " #{l}" }.join +** Processing line: ~ r ="#{"*" * @asterisk_count} #{name}\n#{result_from_yield}"~ +- Inside source: true +*** True Line Result + r ="#{"*" * @asterisk_count} #{name}\n#{result_from_yield}" +** Processing line: ~ @asterisk_count -= 1~ +- Inside source: true +*** True Line Result + @asterisk_count -= 1 +** Processing line: ~ @asterisk_count = @asterisk_count.greater(1)~ +- Inside source: true +*** True Line Result + @asterisk_count = @asterisk_count.greater(1) +** Processing line: ~ r~ +- Inside source: true +*** True Line Result + r +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ -- P detected. -- Formatting line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.dynamic_block~ +- Inside source: true +*** True Line Result + def self.dynamic_block +** Processing line: ~ "#+BEGIN:~ +- Inside source: true +*** True Line Result + "#+BEGIN: +** Processing line: ~ #{join_lines yield}~ +- Inside source: true +*** True Line Result + #{join_lines yield} +** Processing line: ~ #+END:~ +- Inside source: true +*** True Line Result + #+END: ** Processing line: ~~ -** Processing line: ~*** So... why another runtime?~ -- H3 detected. -- Formatting line: ~So... why another runtime?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~So... why another runtime?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ "~ +- Inside source: true +*** True Line Result + " +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The elevator pitch is:~ -- P detected. -- Formatting line: ~The elevator pitch is:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ -- P detected. -- Formatting line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~*** What does Multilevel Cross-platform mean?~ -- H3 detected. -- Formatting line: ~What does Multilevel Cross-platform mean?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~What does Multilevel Cross-platform mean?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts_error *args~ +- Inside source: true +*** True Line Result + def self.puts_error *args +** Processing line: ~ args ||= []~ +- Inside source: true +*** True Line Result + args ||= [] +** Processing line: ~ title = args[0]~ +- Inside source: true +*** True Line Result + title = args[0] +** Processing line: ~ additional = args[1..-1] || []~ +- Inside source: true +*** True Line Result + additional = args[1..-1] || [] +** Processing line: ~ additional = "" if additional.length == 0~ +- Inside source: true +*** True Line Result + additional = "" if additional.length == 0 +** Processing line: ~ if !title.multiline? && join_lines(additional).multiline?~ +- Inside source: true +*** True Line Result + if !title.multiline? && join_lines(additional).multiline? +** Processing line: ~ message = headline "ERROR: #{title}" do~ +- Inside source: true +*** True Line Result + message = headline "ERROR: #{title}" do +** Processing line: ~ dynamic_block do~ +- Inside source: true +*** True Line Result + dynamic_block do +** Processing line: ~ additional~ +- Inside source: true +*** True Line Result + additional +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ elsif title.multiline?~ +- Inside source: true +*** True Line Result + elsif title.multiline? +** Processing line: ~ message = headline "ERROR: " do~ +- Inside source: true +*** True Line Result + message = headline "ERROR: " do +** Processing line: ~ dynamic_block do~ +- Inside source: true +*** True Line Result + dynamic_block do +** Processing line: ~ args~ +- Inside source: true +*** True Line Result + args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ message = "* ERROR: #{title} #{additional}".strip~ +- Inside source: true +*** True Line Result + message = "* ERROR: #{title} #{additional}".strip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ -- P detected. -- Formatting line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ self.puts message~ +- Inside source: true +*** True Line Result + self.puts message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Level 1 we leverage a good portion of mRuby.~ -- UL start detected. -- LI detected. -- Formatting line: ~Level 1 we leverage a good portion of mRuby.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Level 2 consists of optimizations to mRuby we've made given that our - target platforms are well known.~ -- LI detected. -- Formatting line: ~Level 2 consists of optimizations to mRuby we've made given that our - target platforms are well known.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Level 3 consists of portable C libraries and their Ruby - C-Extensions.~ -- LI detected. -- Formatting line: ~Level 3 consists of portable C libraries and their Ruby - C-Extensions.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ -- UL end detected. -- P detected. -- Formatting line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts_info *args~ +- Inside source: true +*** True Line Result + def self.puts_info *args +** Processing line: ~ args ||= []~ +- Inside source: true +*** True Line Result + args ||= [] +** Processing line: ~ title = args[0]~ +- Inside source: true +*** True Line Result + title = args[0] +** Processing line: ~ additional = args[1..-1] || []~ +- Inside source: true +*** True Line Result + additional = args[1..-1] || [] +** Processing line: ~ additional = "" if additional.length == 0~ +- Inside source: true +*** True Line Result + additional = "" if additional.length == 0 +** Processing line: ~ if !title.multiline? && join_lines(additional).multiline?~ +- Inside source: true +*** True Line Result + if !title.multiline? && join_lines(additional).multiline? +** Processing line: ~ message = headline "INFO: #{title}" do~ +- Inside source: true +*** True Line Result + message = headline "INFO: #{title}" do +** Processing line: ~ dynamic_block do~ +- Inside source: true +*** True Line Result + dynamic_block do +** Processing line: ~ additional~ +- Inside source: true +*** True Line Result + additional +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ elsif title.multiline?~ +- Inside source: true +*** True Line Result + elsif title.multiline? +** Processing line: ~ message = headline "INFO: " do~ +- Inside source: true +*** True Line Result + message = headline "INFO: " do +** Processing line: ~ dynamic_block do~ +- Inside source: true +*** True Line Result + dynamic_block do +** Processing line: ~ args~ +- Inside source: true +*** True Line Result + args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ message = "* INFO: #{title} #{additional}".strip~ +- Inside source: true +*** True Line Result + message = "* INFO: #{title} #{additional}".strip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Level 4 consists of shared abstractions around hardware I/O and operating - system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ -- UL start detected. -- LI detected. -- Formatting line: ~Level 4 consists of shared abstractions around hardware I/O and operating - system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ self.puts message~ +- Inside source: true +*** True Line Result + self.puts message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Level 5 is a code generation layer which creates metadata that allows - for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ -- LI detected. -- Formatting line: ~Level 5 is a code generation layer which creates metadata that allows - for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts_once *ids, message~ +- Inside source: true +*** True Line Result + def self.puts_once *ids, message +** Processing line: ~ id = "#{ids}"~ +- Inside source: true +*** True Line Result + id = "#{ids}" +** Processing line: ~ @once ||= {}~ +- Inside source: true +*** True Line Result + @once ||= {} +** Processing line: ~ return if @once[id]~ +- Inside source: true +*** True Line Result + return if @once[id] +** Processing line: ~ @once[id] = id~ +- Inside source: true +*** True Line Result + @once[id] = id +** Processing line: ~ if !$gtk.cli_arguments[:replay] && !$gtk.cli_arguments[:record]~ +- Inside source: true +*** True Line Result + if !$gtk.cli_arguments[:replay] && !$gtk.cli_arguments[:record] +** Processing line: ~ $gtk.notify!("Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§]. [Message ID: #{id}].")~ +- Inside source: true +*** True Line Result + $gtk.notify!("Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§]. [Message ID: #{id}].") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ write_to_log_and_puts ""~ +- Inside source: true +*** True Line Result + write_to_log_and_puts "" +** Processing line: ~ write_to_log_and_puts "#{message.strip}"~ +- Inside source: true +*** True Line Result + write_to_log_and_puts "#{message.strip}" +** Processing line: ~ write_to_log_and_puts ""~ +- Inside source: true +*** True Line Result + write_to_log_and_puts "" +** Processing line: ~ write_to_log_and_puts "[Message ID: #{id}]"~ +- Inside source: true +*** True Line Result + write_to_log_and_puts "[Message ID: #{id}]" +** Processing line: ~ write_to_log_and_puts ""~ +- Inside source: true +*** True Line Result + write_to_log_and_puts "" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This - compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ -- LI detected. -- Formatting line: ~Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This - compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ -- UL end detected. -- P detected. -- Formatting line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.puts_once_info *ids, message~ +- Inside source: true +*** True Line Result + def self.puts_once_info *ids, message +** Processing line: ~ id = "#{ids}"~ +- Inside source: true +*** True Line Result + id = "#{ids}" +** Processing line: ~ @once ||= {}~ +- Inside source: true +*** True Line Result + @once ||= {} +** Processing line: ~ return if @once[id]~ +- Inside source: true +*** True Line Result + return if @once[id] +** Processing line: ~ @once[id] = id~ +- Inside source: true +*** True Line Result + @once[id] = id +** Processing line: ~ log_info message~ +- Inside source: true +*** True Line Result + log_info message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ -- H3 detected. -- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.print *args~ +- Inside source: true +*** True Line Result + def self.print *args +** Processing line: ~ write_to_log_and_print(*args)~ +- Inside source: true +*** True Line Result + write_to_log_and_print(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ -- P detected. -- Formatting line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ class Object~ +- Inside source: true +*** True Line Result + class Object +** Processing line: ~ def log_print *args~ +- Inside source: true +*** True Line Result + def log_print *args +** Processing line: ~ GTK::Log.print(*args)~ +- Inside source: true +*** True Line Result + GTK::Log.print(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Frequent Comments~ -- H2 detected. -- Formatting line: ~Frequent Comments~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Frequent Comments~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_important *args~ +- Inside source: true +*** True Line Result + def log_important *args +** Processing line: ~ GTK::Log.puts_important(*args)~ +- Inside source: true +*** True Line Result + GTK::Log.puts_important(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log *args~ +- Inside source: true +*** True Line Result + def log *args +** Processing line: ~ GTK::Log.puts(*args)~ +- Inside source: true +*** True Line Result + GTK::Log.puts(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** But Ruby is dead.~ -- H3 detected. -- Formatting line: ~But Ruby is dead.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~But Ruby is dead.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_with_color xterm_escape_code, *args~ +- Inside source: true +*** True Line Result + def log_with_color xterm_escape_code, *args +** Processing line: ~ log_print xterm_escape_code~ +- Inside source: true +*** True Line Result + log_print xterm_escape_code +** Processing line: ~ log(*args)~ +- Inside source: true +*** True Line Result + log(*args) +** Processing line: ~ ensure~ +- Inside source: true +*** True Line Result + ensure +** Processing line: ~ log_reset_color~ +- Inside source: true +*** True Line Result + log_reset_color +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ -- P detected. -- Formatting line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ -- Line's tilde count is: 0 -- Line contains link marker: true -- LINK detected. -** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ -- P detected. -- Formatting line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ -- P detected. -- Formatting line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Let's stop making this comment shall we?~ -- P detected. -- Formatting line: ~Let's stop making this comment shall we?~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_reset_color~ +- Inside source: true +*** True Line Result + def log_reset_color +** Processing line: ~ log_print XTERM_COLOR[:reset]~ +- Inside source: true +*** True Line Result + log_print XTERM_COLOR[:reset] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** But Ruby is slow.~ -- H3 detected. -- Formatting line: ~But Ruby is slow.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~But Ruby is slow.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_black *args~ +- Inside source: true +*** True Line Result + def log_black *args +** Processing line: ~ log_with_color XTERM_COLOR[:black], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:black], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ -- P detected. -- Formatting line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_red *args~ +- Inside source: true +*** True Line Result + def log_red *args +** Processing line: ~ log_with_color XTERM_COLOR[:red], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:red], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** Dynamic languages are slow.~ -- H3 detected. -- Formatting line: ~Dynamic languages are slow.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Dynamic languages are slow.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_green *args~ +- Inside source: true +*** True Line Result + def log_green *args +** Processing line: ~ log_with_color XTERM_COLOR[:green], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:green], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ -- P detected. -- Formatting line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ -- P detected. -- Formatting line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ -- P detected. -- Formatting line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_yellow *args~ +- Inside source: true +*** True Line Result + def log_yellow *args +** Processing line: ~ log_with_color XTERM_COLOR[:yellow], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:yellow], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Frequent Concerns~ -- H2 detected. -- Formatting line: ~Frequent Concerns~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Frequent Concerns~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_blue *args~ +- Inside source: true +*** True Line Result + def log_blue *args +** Processing line: ~ log_with_color XTERM_COLOR[:blue], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:blue], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_magenta *args~ +- Inside source: true +*** True Line Result + def log_magenta *args +** Processing line: ~ log_with_color XTERM_COLOR[:magenta], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:magenta], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** DragonRuby is not open source. That's not right.~ -- H3 detected. -- Formatting line: ~DragonRuby is not open source. That's not right.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~DragonRuby is not open source. That's not right.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_cyan *args~ +- Inside source: true +*** True Line Result + def log_cyan *args +** Processing line: ~ log_with_color XTERM_COLOR[:cyan], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:cyan], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ -- P detected. -- Formatting line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ -- P detected. -- Formatting line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If you have ideas on how we can do this, email us!~ -- P detected. -- Formatting line: ~If you have ideas on how we can do this, email us!~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~If the reason above isn't sufficient, then definitely use something else.~ -- P detected. -- Formatting line: ~If the reason above isn't sufficient, then definitely use something else.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_white *args~ +- Inside source: true +*** True Line Result + def log_white *args +** Processing line: ~ log_with_color XTERM_COLOR[:white], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:white], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** DragonRuby is for pay. You should offer a free version.~ -- H3 detected. -- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_black *args~ +- Inside source: true +*** True Line Result + def log_bright_black *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_black], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_black], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ -- P detected. -- Formatting line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ -- P detected. -- Formatting line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ -- P detected. -- Formatting line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_red *args~ +- Inside source: true +*** True Line Result + def log_bright_red *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_red], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_red], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- Your income is below $2,000.00 (USD) per month.~ -- UL start detected. -- LI detected. -- Formatting line: ~Your income is below $2,000.00 (USD) per month.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- You are under 18 years of age.~ -- LI detected. -- Formatting line: ~You are under 18 years of age.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- You are a student of any type: traditional public school, home - schooling, college, bootcamp, or online.~ -- LI detected. -- Formatting line: ~You are a student of any type: traditional public school, home - schooling, college, bootcamp, or online.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- You are a teacher, mentor, or parent who wants to teach a kid how to code.~ -- LI detected. -- Formatting line: ~You are a teacher, mentor, or parent who wants to teach a kid how to code.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- You work/worked in public service or at a charitable organization: - for example public office, army, or any 501(c)(3) organization.~ -- LI detected. -- Formatting line: ~You work/worked in public service or at a charitable organization: - for example public office, army, or any 501(c)(3) organization.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Just contact Amir at amir.rajan@dragonruby.org with a short explanation of your current situation and he'll set you up. No questions asked.~ -- UL end detected. -- P detected. -- Formatting line: ~Just contact Amir at amir.rajan@dragonruby.org with a short explanation of your current situation and he'll set you up. No questions asked.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_green *args~ +- Inside source: true +*** True Line Result + def log_bright_green *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_green], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_green], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** But still, you should offer a free version. So I can try it out and see if I like it.~ -- H3 detected. -- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_yellow *args~ +- Inside source: true +*** True Line Result + def log_bright_yellow *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_yellow], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_yellow], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ -- P detected. -- Formatting line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ -- P detected. -- Formatting line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_blue *args~ +- Inside source: true +*** True Line Result + def log_bright_blue *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_blue], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_blue], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** I still think you should do a free version. Think of all people who would give it a shot.~ -- H3 detected. -- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_magenta *args~ +- Inside source: true +*** True Line Result + def log_bright_magenta *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_magenta], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_magenta], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ -- P detected. -- Formatting line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ -- P detected. -- Formatting line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_cyan *args~ +- Inside source: true +*** True Line Result + def log_bright_cyan *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_cyan], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_cyan], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ -- H3 detected. -- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_bright_white *args~ +- Inside source: true +*** True Line Result + def log_bright_white *args +** Processing line: ~ log_with_color XTERM_COLOR[:bright_white], *args~ +- Inside source: true +*** True Line Result + log_with_color XTERM_COLOR[:bright_white], *args +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ -- P detected. -- Formatting line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ -- P detected. -- Formatting line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_error *args~ +- Inside source: true +*** True Line Result + def log_error *args +** Processing line: ~ GTK::Log.puts_error(*args)~ +- Inside source: true +*** True Line Result + GTK::Log.puts_error(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Runtime~~ -- H1 detected. -- Formatting line: ~~GTK::Runtime~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ -- P detected. -- Formatting line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_info *args~ +- Inside source: true +*** True Line Result + def log_info *args +** Processing line: ~ GTK::Log.puts_info(*args)~ +- Inside source: true +*** True Line Result + GTK::Log.puts_info(*args) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Runtime#calcstringbox~~ -- H1 detected. -- Formatting line: ~~GTK::Runtime#calcstringbox~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~This function returns the width and height of a string.~ -- P detected. -- Formatting line: ~This function returns the width and height of a string.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_once *ids, message~ +- Inside source: true +*** True Line Result + def log_once *ids, message +** Processing line: ~ GTK::Log.puts_once(*ids, message)~ +- Inside source: true +*** True Line Result + GTK::Log.puts_once(*ids, message) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.string_size ||= args.gtk.calcstringbox "Hello World"~ -** Processing line: ~ args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World"~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_once_info *ids, message~ +- Inside source: true +*** True Line Result + def log_once_info *ids, message +** Processing line: ~ GTK::Log.puts_once_info(*ids, message)~ +- Inside source: true +*** True Line Result + GTK::Log.puts_once_info(*ids, message) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ -- H1 detected. -- Formatting line: ~~GTK::Runtime#reset~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ -- P detected. -- Formatting line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~* DOCS: ~Array~~ -- H1 detected. -- Formatting line: ~~Array~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -** Processing line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ -- P detected. -- Formatting line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* numeric.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* numeric.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/numeric.rb~ +- Inside source: true +*** True Line Result + # ./dragon/numeric.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # numeric.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # numeric.rb has been released under MIT (*only this file*). ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class Numeric~ +- Inside source: true +*** True Line Result + class Numeric +** Processing line: ~ include ValueType~ +- Inside source: true +*** True Line Result + include ValueType +** Processing line: ~ include NumericDeprecated~ +- Inside source: true +*** True Line Result + include NumericDeprecated ** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#map~~ -- H1 detected. -- Formatting line: ~~Array#map~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :gte, :>=~ +- Inside source: true +*** True Line Result + alias_method :gte, :>= +** Processing line: ~ alias_method :lte, :<=~ +- Inside source: true +*** True Line Result + alias_method :lte, :<= ** Processing line: ~~ -** Processing line: ~The function given a block returns a new ~Enumerable~ of values.~ -- P detected. -- Formatting line: ~The function given a block returns a new ~Enumerable~ of values.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ -- P detected. -- Formatting line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Converts a numeric value representing seconds into frames.~ +- Inside source: true +*** True Line Result + # Converts a numeric value representing seconds into frames. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def seconds~ +- Inside source: true +*** True Line Result + def seconds +** Processing line: ~ self * 60~ +- Inside source: true +*** True Line Result + self * 60 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # define the colors of the rainbow in ~args.state~~ -** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ -** Processing line: ~ # :order will be used to determine render location~ -** Processing line: ~ # and :name will be used to determine sprite path.~ -** Processing line: ~ args.state.rainbow_colors ||= [~ -** Processing line: ~ { order: 0, name: :red },~ -** Processing line: ~ { order: 1, name: :orange },~ -** Processing line: ~ { order: 2, name: :yellow },~ -** Processing line: ~ { order: 3, name: :green },~ -** Processing line: ~ { order: 4, name: :blue },~ -** Processing line: ~ { order: 5, name: :indigo },~ -** Processing line: ~ { order: 6, name: :violet },~ -** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Divides the number by `2.0` and returns a `float`.~ +- Inside source: true +*** True Line Result + # Divides the number by `2.0` and returns a `float`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def half~ +- Inside source: true +*** True Line Result + def half +** Processing line: ~ self / 2.0~ +- Inside source: true +*** True Line Result + self / 2.0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # render sprites diagonally to the screen~ -** Processing line: ~ # with a width and height of 50.~ -** Processing line: ~ args.outputs~ -** Processing line: ~ .sprites << args.state~ -** Processing line: ~ .rainbow_colors~ -** Processing line: ~ .map do |color| # <-- ~Array#map~ usage~ -** Processing line: ~ [~ -** Processing line: ~ color[:order] * 50,~ -** Processing line: ~ color[:order] * 50,~ -** Processing line: ~ 50,~ -** Processing line: ~ 50,~ -** Processing line: ~ "sprites/square-#{color[:name]}.png"~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_byte~ +- Inside source: true +*** True Line Result + def to_byte +** Processing line: ~ clamp(0, 255).to_i~ +- Inside source: true +*** True Line Result + clamp(0, 255).to_i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def elapsed_time tick_count_override = nil~ +- Inside source: true +*** True Line Result + def elapsed_time tick_count_override = nil +** Processing line: ~ (tick_count_override || Kernel.tick_count) - self~ +- Inside source: true +*** True Line Result + (tick_count_override || Kernel.tick_count) - self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def elapsed_time_percent duration~ +- Inside source: true +*** True Line Result + def elapsed_time_percent duration +** Processing line: ~ elapsed_time.percentage_of duration~ +- Inside source: true +*** True Line Result + elapsed_time.percentage_of duration +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#each~~ -- H1 detected. -- Formatting line: ~~Array#each~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def new?~ +- Inside source: true +*** True Line Result + def new? +** Processing line: ~ elapsed_time == 0~ +- Inside source: true +*** True Line Result + elapsed_time == 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ -- P detected. -- Formatting line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ -- P detected. -- Formatting line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `true` if the numeric value has passed a duration/offset number.~ +- Inside source: true +*** True Line Result + # Returns `true` if the numeric value has passed a duration/offset number. +** Processing line: ~ # `Kernel.tick_count` is used to determine if a number represents an elapsed~ +- Inside source: true +*** True Line Result + # `Kernel.tick_count` is used to determine if a number represents an elapsed +** Processing line: ~ # moment in time.~ +- Inside source: true +*** True Line Result + # moment in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def elapsed? offset = 0, tick_count_override = Kernel.tick_count~ +- Inside source: true +*** True Line Result + def elapsed? offset = 0, tick_count_override = Kernel.tick_count +** Processing line: ~ (self + offset) < tick_count_override~ +- Inside source: true +*** True Line Result + (self + offset) < tick_count_override +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # define the colors of the rainbow in ~args.state~~ -** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ -** Processing line: ~ # :order will be used to determine render location~ -** Processing line: ~ # and :name will be used to determine sprite path.~ -** Processing line: ~ args.state.rainbow_colors ||= [~ -** Processing line: ~ { order: 0, name: :red },~ -** Processing line: ~ { order: 1, name: :orange },~ -** Processing line: ~ { order: 2, name: :yellow },~ -** Processing line: ~ { order: 3, name: :green },~ -** Processing line: ~ { order: 4, name: :blue },~ -** Processing line: ~ { order: 5, name: :indigo },~ -** Processing line: ~ { order: 6, name: :violet },~ -** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def frame_index *opts~ +- Inside source: true +*** True Line Result + def frame_index *opts +** Processing line: ~ frame_count_or_hash, hold_for, repeat, tick_count_override = opts~ +- Inside source: true +*** True Line Result + frame_count_or_hash, hold_for, repeat, tick_count_override = opts +** Processing line: ~ if frame_count_or_hash.is_a? Hash~ +- Inside source: true +*** True Line Result + if frame_count_or_hash.is_a? Hash +** Processing line: ~ frame_count = frame_count_or_hash[:count]~ +- Inside source: true +*** True Line Result + frame_count = frame_count_or_hash[:count] +** Processing line: ~ hold_for = frame_count_or_hash[:hold_for]~ +- Inside source: true +*** True Line Result + hold_for = frame_count_or_hash[:hold_for] +** Processing line: ~ repeat = frame_count_or_hash[:repeat]~ +- Inside source: true +*** True Line Result + repeat = frame_count_or_hash[:repeat] +** Processing line: ~ tick_count_override = frame_count_or_hash[:tick_count_override]~ +- Inside source: true +*** True Line Result + tick_count_override = frame_count_or_hash[:tick_count_override] +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ frame_count = frame_count_or_hash~ +- Inside source: true +*** True Line Result + frame_count = frame_count_or_hash +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # render sprites diagonally to the screen~ -** Processing line: ~ # with a width and height of 50.~ -** Processing line: ~ args.state~ -** Processing line: ~ .rainbow_colors~ -** Processing line: ~ .map do |color| # <-- ~Array#each~ usage~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ color[:order] * 50,~ -** Processing line: ~ color[:order] * 50,~ -** Processing line: ~ 50,~ -** Processing line: ~ 50,~ -** Processing line: ~ "sprites/square-#{color[:name]}.png"~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ tick_count_override ||= Kernel.tick_count~ +- Inside source: true +*** True Line Result + tick_count_override ||= Kernel.tick_count +** Processing line: ~ animation_frame_count = frame_count~ +- Inside source: true +*** True Line Result + animation_frame_count = frame_count +** Processing line: ~ animation_frame_hold_time = hold_for~ +- Inside source: true +*** True Line Result + animation_frame_hold_time = hold_for +** Processing line: ~ animation_length = animation_frame_hold_time * animation_frame_count~ +- Inside source: true +*** True Line Result + animation_length = animation_frame_hold_time * animation_frame_count +** Processing line: ~ return nil if Kernel.tick_count < self~ +- Inside source: true +*** True Line Result + return nil if Kernel.tick_count < self ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !repeat && (self + animation_length) < (tick_count_override - 1)~ +- Inside source: true +*** True Line Result + if !repeat && (self + animation_length) < (tick_count_override - 1) +** Processing line: ~ return nil~ +- Inside source: true +*** True Line Result + return nil +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ return self.elapsed_time.-(1).idiv(animation_frame_hold_time) % animation_frame_count~ +- Inside source: true +*** True Line Result + return self.elapsed_time.-(1).idiv(animation_frame_hold_time) % animation_frame_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ #{opts}~ +- Inside source: true +*** True Line Result + #{opts} +** Processing line: ~ #{e}~ +- Inside source: true +*** True Line Result + #{e} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def zero?~ +- Inside source: true +*** True Line Result + def zero? +** Processing line: ~ self == 0~ +- Inside source: true +*** True Line Result + self == 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#reject_nil~~ -- H1 detected. -- Formatting line: ~~Array#reject_nil~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def zero~ +- Inside source: true +*** True Line Result + def zero +** Processing line: ~ 0~ +- Inside source: true +*** True Line Result + 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ -- P detected. -- Formatting line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def one~ +- Inside source: true +*** True Line Result + def one +** Processing line: ~ 1~ +- Inside source: true +*** True Line Result + 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ a = [1, nil, 4, false, :a]~ -** Processing line: ~ puts a.reject_nil~ -** Processing line: ~ # => [1, 4, false, :a]~ -** Processing line: ~ puts a.compact~ -** Processing line: ~ # => [1, 4, false, :a]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#reject_false~~ -- H1 detected. -- Formatting line: ~~Array#reject_false~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ -- P detected. -- Formatting line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ a = [1, nil, 4, false, :a]~ -** Processing line: ~ puts a.reject_false~ -** Processing line: ~ # => [1, 4, :a]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#product~~ -- H1 detected. -- Formatting line: ~~Array#product~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Returns all combinations of values between two arrays.~ -- P detected. -- Formatting line: ~Returns all combinations of values between two arrays.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ -- P detected. -- Formatting line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ a = [0, 1]~ -** Processing line: ~ puts a.product~ -** Processing line: ~ # => [[0, 0], [0, 1], [1, 0], [1, 1]]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ a = [ 0, 1]~ -** Processing line: ~ b = [:a, :b]~ -** Processing line: ~ puts a.product b~ -** Processing line: ~ # => [[0, :a], [0, :b], [1, :a], [1, :b]]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#map_2d~~ -- H1 detected. -- Formatting line: ~~Array#map_2d~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ -- P detected. -- Formatting line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ stage = [~ -** Processing line: ~ [:enemy, :empty, :player],~ -** Processing line: ~ [:empty, :empty, :empty],~ -** Processing line: ~ [:enemy, :empty, :enemy],~ -** Processing line: ~ ]~ -** Processing line: ~~ -** Processing line: ~ occupied_tiles = stage.map_2d do |row, col, tile|~ -** Processing line: ~ if tile == :empty~ -** Processing line: ~ nil~ -** Processing line: ~ else~ -** Processing line: ~ [row, col, tile]~ -** Processing line: ~ end~ -** Processing line: ~ end.reject_nil~ -** Processing line: ~~ -** Processing line: ~ puts "Stage:"~ -** Processing line: ~ puts stage~ -** Processing line: ~~ -** Processing line: ~ puts "Occupied Tiles"~ -** Processing line: ~ puts occupied_tiles~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def two~ +- Inside source: true +*** True Line Result + def two +** Processing line: ~ 2~ +- Inside source: true +*** True Line Result + 2 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def five~ +- Inside source: true +*** True Line Result + def five +** Processing line: ~ 5~ +- Inside source: true +*** True Line Result + 5 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def ten~ +- Inside source: true +*** True Line Result + def ten +** Processing line: ~ 10~ +- Inside source: true +*** True Line Result + 10 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#include_any?~~ -- H1 detected. -- Formatting line: ~~Array#include_any?~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :gt, :>~ +- Inside source: true +*** True Line Result + alias_method :gt, :> +** Processing line: ~ alias_method :above?, :>~ +- Inside source: true +*** True Line Result + alias_method :above?, :> +** Processing line: ~ alias_method :right_of?, :>~ +- Inside source: true +*** True Line Result + alias_method :right_of?, :> ** Processing line: ~~ -** Processing line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ -- P detected. -- Formatting line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method :lt, :<~ +- Inside source: true +*** True Line Result + alias_method :lt, :< +** Processing line: ~ alias_method :below?, :<~ +- Inside source: true +*** True Line Result + alias_method :below?, :< +** Processing line: ~ alias_method :left_of?, :<~ +- Inside source: true +*** True Line Result + alias_method :left_of?, :< ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def shift_right i~ +- Inside source: true +*** True Line Result + def shift_right i +** Processing line: ~ self + i~ +- Inside source: true +*** True Line Result + self + i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~Array#any_intersect_rect?~~ -- H1 detected. -- Formatting line: ~~Array#any_intersect_rect?~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def shift_left i~ +- Inside source: true +*** True Line Result + def shift_left i +** Processing line: ~ shift_right(i * -1)~ +- Inside source: true +*** True Line Result + shift_right(i * -1) +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise_immediately e, :shift_left, i~ +- Inside source: true +*** True Line Result + raise_immediately e, :shift_left, i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ -- P detected. -- Formatting line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ -- Line's tilde count is: 12 -- Line contains link marker: false -- CODE detected. -** Processing line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ -- P detected. -- Formatting line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def shift_up i~ +- Inside source: true +*** True Line Result + def shift_up i +** Processing line: ~ self + i~ +- Inside source: true +*** True Line Result + self + i +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise_immediately e, :shift_up, i~ +- Inside source: true +*** True Line Result + raise_immediately e, :shift_up, i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ repl do~ -** Processing line: ~ # Here is a player class that has position and implement~ -** Processing line: ~ # the ~attr_rect~ contract.~ -** Processing line: ~ class Player~ -** Processing line: ~ attr_rect~ -** Processing line: ~ attr_accessor :x, :y, :w, :h~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def shift_down i~ +- Inside source: true +*** True Line Result + def shift_down i +** Processing line: ~ shift_up(i * -1)~ +- Inside source: true +*** True Line Result + shift_up(i * -1) +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise_immediately e, :shift_down, i~ +- Inside source: true +*** True Line Result + raise_immediately e, :shift_down, i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def initialize x, y, w, h~ -** Processing line: ~ @x = x~ -** Processing line: ~ @y = y~ -** Processing line: ~ @w = w~ -** Processing line: ~ @h = h~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # This provides a way for a numeric value to be randomized based on a combination~ +- Inside source: true +*** True Line Result + # This provides a way for a numeric value to be randomized based on a combination +** Processing line: ~ # of two options: `:sign` and `:ratio`.~ +- Inside source: true +*** True Line Result + # of two options: `:sign` and `:ratio`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def randomize *definitions~ +- Inside source: true +*** True Line Result + def randomize *definitions +** Processing line: ~ result = self~ +- Inside source: true +*** True Line Result + result = self ** Processing line: ~~ -** Processing line: ~ def serialize~ -** Processing line: ~ { x: @x, y: @y, w: @w, h: @h }~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if definitions.include?(:sign)~ +- Inside source: true +*** True Line Result + if definitions.include?(:sign) +** Processing line: ~ result = rand_sign~ +- Inside source: true +*** True Line Result + result = rand_sign ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def inspect~ -** Processing line: ~ "#{serialize}"~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if definitions.include?(:ratio)~ +- Inside source: true +*** True Line Result + if definitions.include?(:ratio) +** Processing line: ~ result = rand * result~ +- Inside source: true +*** True Line Result + result = rand * result ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def to_s~ -** Processing line: ~ "#{serialize}"~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ result~ +- Inside source: true +*** True Line Result + result ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Here is a definition of two walls.~ -** Processing line: ~ walls = [~ -** Processing line: ~ [10, 10, 10, 10],~ -** Processing line: ~ { x: 20, y: 20, w: 10, h: 10 },~ -** Processing line: ~ ]~ -** Processing line: ~~ -** Processing line: ~ # Display the walls.~ -** Processing line: ~ puts "Walls."~ -** Processing line: ~ puts walls~ -** Processing line: ~ puts ""~ -** Processing line: ~~ -** Processing line: ~ # Check any_intersect_rect? on player~ -** Processing line: ~ player = Player.new 30, 20, 10, 10~ -** Processing line: ~ puts "Is Player #{player} touching wall?"~ -** Processing line: ~ puts (walls.any_intersect_rect? player)~ -** Processing line: ~ # => false~ -** Processing line: ~ # The value is false because of the default tolerance is 0.1.~ -** Processing line: ~ # The overlap of the player rect and any of the wall rects is~ -** Processing line: ~ # less than 0.1 (for those that intersect).~ -** Processing line: ~ puts ""~ -** Processing line: ~~ -** Processing line: ~ player = Player.new 9, 10, 10, 10~ -** Processing line: ~ puts "Is Player #{player} touching wall?"~ -** Processing line: ~ puts (walls.any_intersect_rect? player)~ -** Processing line: ~ # => true~ -** Processing line: ~ puts ""~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def rand_sign~ +- Inside source: true +*** True Line Result + def rand_sign +** Processing line: ~ return self * -1 if rand > 0.5~ +- Inside source: true +*** True Line Result + return self * -1 if rand > 0.5 +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def rand_ratio~ +- Inside source: true +*** True Line Result + def rand_ratio +** Processing line: ~ self * rand~ +- Inside source: true +*** True Line Result + self * rand +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def remainder_of_divide n~ +- Inside source: true +*** True Line Result + def remainder_of_divide n +** Processing line: ~ mod n~ +- Inside source: true +*** True Line Result + mod n +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Outputs~~ -- H1 detected. -- Formatting line: ~~GTK::Outputs~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ -- P detected. -- Formatting line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # code goes here~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def ease_extended tick_count_override, duration, default_before, default_after, *definitions~ +- Inside source: true +*** True Line Result + def ease_extended tick_count_override, duration, default_before, default_after, *definitions +** Processing line: ~ GTK::Easing.ease_extended self,~ +- Inside source: true +*** True Line Result + GTK::Easing.ease_extended self, +** Processing line: ~ tick_count_override,~ +- Inside source: true +*** True Line Result + tick_count_override, +** Processing line: ~ self + duration,~ +- Inside source: true +*** True Line Result + self + duration, +** Processing line: ~ default_before,~ +- Inside source: true +*** True Line Result + default_before, +** Processing line: ~ default_after,~ +- Inside source: true +*** True Line Result + default_after, +** Processing line: ~ *definitions~ +- Inside source: true +*** True Line Result + *definitions +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def global_ease duration, *definitions~ +- Inside source: true +*** True Line Result + def global_ease duration, *definitions +** Processing line: ~ ease_extended Kernel.global_tick_count,~ +- Inside source: true +*** True Line Result + ease_extended Kernel.global_tick_count, +** Processing line: ~ duration,~ +- Inside source: true +*** True Line Result + duration, +** Processing line: ~ GTK::Easing.initial_value(*definitions),~ +- Inside source: true +*** True Line Result + GTK::Easing.initial_value(*definitions), +** Processing line: ~ GTK::Easing.final_value(*definitions),~ +- Inside source: true +*** True Line Result + GTK::Easing.final_value(*definitions), +** Processing line: ~ *definitions~ +- Inside source: true +*** True Line Result + *definitions +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def ease duration, *definitions~ +- Inside source: true +*** True Line Result + def ease duration, *definitions +** Processing line: ~ ease_extended Kernel.tick_count,~ +- Inside source: true +*** True Line Result + ease_extended Kernel.tick_count, +** Processing line: ~ duration,~ +- Inside source: true +*** True Line Result + duration, +** Processing line: ~ GTK::Easing.initial_value(*definitions),~ +- Inside source: true +*** True Line Result + GTK::Easing.initial_value(*definitions), +** Processing line: ~ GTK::Easing.final_value(*definitions),~ +- Inside source: true +*** True Line Result + GTK::Easing.final_value(*definitions), +** Processing line: ~ *definitions~ +- Inside source: true +*** True Line Result + *definitions +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Outputs#solids~~ -- H1 detected. -- Formatting line: ~~GTK::Outputs#solids~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def ease_spline_extended tick_count_override, duration, spline~ +- Inside source: true +*** True Line Result + def ease_spline_extended tick_count_override, duration, spline +** Processing line: ~ GTK::Easing.ease_spline_extended self,~ +- Inside source: true +*** True Line Result + GTK::Easing.ease_spline_extended self, +** Processing line: ~ tick_count_override,~ +- Inside source: true +*** True Line Result + tick_count_override, +** Processing line: ~ self + duration,~ +- Inside source: true +*** True Line Result + self + duration, +** Processing line: ~ spline~ +- Inside source: true +*** True Line Result + spline +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Add primitives to this collection to render a solid to the screen.~ -- P detected. -- Formatting line: ~Add primitives to this collection to render a solid to the screen.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def global_ease_spline duration, spline~ +- Inside source: true +*** True Line Result + def global_ease_spline duration, spline +** Processing line: ~ ease_spline_extended Kernel.global_tick_count,~ +- Inside source: true +*** True Line Result + ease_spline_extended Kernel.global_tick_count, +** Processing line: ~ duration,~ +- Inside source: true +*** True Line Result + duration, +** Processing line: ~ spline~ +- Inside source: true +*** True Line Result + spline +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Rendering a solid using an Array~ -- H2 detected. -- Formatting line: ~Rendering a solid using an Array~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Rendering a solid using an Array~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Easing function progress/percentage for a specific point in time.~ +- Inside source: true +*** True Line Result + # Easing function progress/percentage for a specific point in time. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def ease_spline duration, spline~ +- Inside source: true +*** True Line Result + def ease_spline duration, spline +** Processing line: ~ ease_spline_extended Kernel.tick_count,~ +- Inside source: true +*** True Line Result + ease_spline_extended Kernel.tick_count, +** Processing line: ~ duration,~ +- Inside source: true +*** True Line Result + duration, +** Processing line: ~ spline~ +- Inside source: true +*** True Line Result + spline +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ -- P detected. -- Formatting line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Converts a number representing an angle in degrees to radians.~ +- Inside source: true +*** True Line Result + # Converts a number representing an angle in degrees to radians. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def to_radians~ +- Inside source: true +*** True Line Result + def to_radians +** Processing line: ~ self * Math::PI.fdiv(180)~ +- Inside source: true +*** True Line Result + self * Math::PI.fdiv(180) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # X Y WIDTH HEIGHT~ -** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Converts a number representing an angle in radians to degress.~ +- Inside source: true +*** True Line Result + # Converts a number representing an angle in radians to degress. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def to_degrees~ +- Inside source: true +*** True Line Result + def to_degrees +** Processing line: ~ self / Math::PI.fdiv(180)~ +- Inside source: true +*** True Line Result + self / Math::PI.fdiv(180) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Given `self`, a rectangle primitive is returned.~ +- Inside source: true +*** True Line Result + # Given `self`, a rectangle primitive is returned. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @example~ +- Inside source: true +*** True Line Result + # @example +** Processing line: ~ # 5.to_square 100, 300 # returns [100, 300, 5, 5]~ +- Inside source: true +*** True Line Result + # 5.to_square 100, 300 # returns [100, 300, 5, 5] +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def to_square x, y, anchor_x = 0.5, anchor_y = nil~ +- Inside source: true +*** True Line Result + def to_square x, y, anchor_x = 0.5, anchor_y = nil +** Processing line: ~ GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y)~ +- Inside source: true +*** True Line Result + GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Rendering a solid using an Array with colors and alpha~ -- H2 detected. -- Formatting line: ~Rendering a solid using an Array with colors and alpha~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Rendering a solid using an Array with colors and alpha~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns a normal vector for a number that represents an angle in degress.~ +- Inside source: true +*** True Line Result + # Returns a normal vector for a number that represents an angle in degress. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def vector max_value = 1~ +- Inside source: true +*** True Line Result + def vector max_value = 1 +** Processing line: ~ [vector_x(max_value), vector_y(max_value)]~ +- Inside source: true +*** True Line Result + [vector_x(max_value), vector_y(max_value)] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ -- P detected. -- Formatting line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Creates a green solid rectangle with an opacity of 50%.~ -- P detected. -- Formatting line: ~Creates a green solid rectangle with an opacity of 50%.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the y component of a normal vector for a number that represents an angle in degress.~ +- Inside source: true +*** True Line Result + # Returns the y component of a normal vector for a number that represents an angle in degress. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def vector_y max_value = 1~ +- Inside source: true +*** True Line Result + def vector_y max_value = 1 +** Processing line: ~ max_value * Math.sin(self.to_radians)~ +- Inside source: true +*** True Line Result + max_value * Math.sin(self.to_radians) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA~ -** Processing line: ~ args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the x component of a normal vector for a number that represents an angle in degress.~ +- Inside source: true +*** True Line Result + # Returns the x component of a normal vector for a number that represents an angle in degress. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def vector_x max_value = 1~ +- Inside source: true +*** True Line Result + def vector_x max_value = 1 +** Processing line: ~ max_value * Math.cos(self.to_radians)~ +- Inside source: true +*** True Line Result + max_value * Math.cos(self.to_radians) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def x_vector max_value = 1~ +- Inside source: true +*** True Line Result + def x_vector max_value = 1 +** Processing line: ~ vector_x max_value~ +- Inside source: true +*** True Line Result + vector_x max_value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~** Rendering a solid using a Hash~ -- H2 detected. -- Formatting line: ~Rendering a solid using a Hash~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Rendering a solid using a Hash~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def y_vector max_value = 1~ +- Inside source: true +*** True Line Result + def y_vector max_value = 1 +** Processing line: ~ vector_y max_value~ +- Inside source: true +*** True Line Result + vector_y max_value +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ -- P detected. -- Formatting line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def mod n~ +- Inside source: true +*** True Line Result + def mod n +** Processing line: ~ self % n~ +- Inside source: true +*** True Line Result + self % n +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.solids << {~ -** Processing line: ~ x: 0,~ -** Processing line: ~ y: 0,~ -** Processing line: ~ w: 100,~ -** Processing line: ~ h: 100,~ -** Processing line: ~ r: 0,~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 0,~ -** Processing line: ~ a: 255~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~** Rendering a solid using a Class~ -- H2 detected. -- Formatting line: ~Rendering a solid using a Class~ -- Line's tilde count is: 0 -- Line contains link marker: false -- Formatting line: ~Rendering a solid using a Class~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def mod_zero? *ns~ +- Inside source: true +*** True Line Result + def mod_zero? *ns +** Processing line: ~ ns.any? { |n| mod(n) == 0 }~ +- Inside source: true +*** True Line Result + ns.any? { |n| mod(n) == 0 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ -- P detected. -- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Here is an example:~ -- P detected. -- Formatting line: ~Here is an example:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def mult n~ +- Inside source: true +*** True Line Result + def mult n +** Processing line: ~ self * n~ +- Inside source: true +*** True Line Result + self * n +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ # Create type with ALL solid properties AND primitive_marker~ -** Processing line: ~ class Solid~ -** Processing line: ~ attr_accessor :x, :y, :w, :h, :r, :g, :b, :a~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def fdiv n~ +- Inside source: true +*** True Line Result + def fdiv n +** Processing line: ~ self / n.to_f~ +- Inside source: true +*** True Line Result + self / n.to_f +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def primitive_marker~ -** Processing line: ~ :solid~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Divides `self` by a number `n` as a float, and converts it `to_i`.~ +- Inside source: true +*** True Line Result + # Divides `self` by a number `n` as a float, and converts it `to_i`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def idiv n~ +- Inside source: true +*** True Line Result + def idiv n +** Processing line: ~ (self / n.to_f).to_i~ +- Inside source: true +*** True Line Result + (self / n.to_f).to_i ** Processing line: ~ end~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Inherit from type~ -** Processing line: ~ class Square < Solid~ -** Processing line: ~ # constructor~ -** Processing line: ~ def initialize x, y, size~ -** Processing line: ~ self.x = x~ -** Processing line: ~ self.y = y~ -** Processing line: ~ self.w = size~ -** Processing line: ~ self.h = size~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns a numeric value that is a quantity `magnitude` closer to~ +- Inside source: true +*** True Line Result + # Returns a numeric value that is a quantity `magnitude` closer to +** Processing line: ~ #`self`. If the distance between `self` and `target` is less than~ +- Inside source: true +*** True Line Result + #`self`. If the distance between `self` and `target` is less than +** Processing line: ~ #the `magnitude` then `target` is returned.~ +- Inside source: true +*** True Line Result + #the `magnitude` then `target` is returned. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def towards target, magnitude~ +- Inside source: true +*** True Line Result + def towards target, magnitude +** Processing line: ~ return self if self == target~ +- Inside source: true +*** True Line Result + return self if self == target +** Processing line: ~ delta = (self - target).abs~ +- Inside source: true +*** True Line Result + delta = (self - target).abs +** Processing line: ~ return target if delta < magnitude~ +- Inside source: true +*** True Line Result + return target if delta < magnitude +** Processing line: ~ return self - magnitude if self > target~ +- Inside source: true +*** True Line Result + return self - magnitude if self > target +** Processing line: ~ return self + magnitude~ +- Inside source: true +*** True Line Result + return self + magnitude ** Processing line: ~ end~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ # render solid/border~ -** Processing line: ~ args.outputs.solids << Square.new(10, 10, 32)~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # Given `self` and a number representing `y` of a grid. This~ +- Inside source: true +*** True Line Result + # Given `self` and a number representing `y` of a grid. This +** Processing line: ~ # function will return a one dimensional array containing the value~ +- Inside source: true +*** True Line Result + # function will return a one dimensional array containing the value +** Processing line: ~ # yielded by an implicit block.~ +- Inside source: true +*** True Line Result + # yielded by an implicit block. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @example~ +- Inside source: true +*** True Line Result + # @example +** Processing line: ~ # 3.map_with_ys 2 do |x, y|~ +- Inside source: true +*** True Line Result + # 3.map_with_ys 2 do |x, y| +** Processing line: ~ # x * y~ +- Inside source: true +*** True Line Result + # x * y +** Processing line: ~ # end~ +- Inside source: true +*** True Line Result + # end +** Processing line: ~ # # x y x y x y x y x y x y~ +- Inside source: true +*** True Line Result + # # x y x y x y x y x y x y +** Processing line: ~ # # 0*0, 0*1 1*0 1*1 2*0 2*1~ +- Inside source: true +*** True Line Result + # # 0*0, 0*1 1*0 1*1 2*0 2*1 +** Processing line: ~ # # => [ 0, 0, 0, 1, 0, 2]~ +- Inside source: true +*** True Line Result + # # => [ 0, 0, 0, 1, 0, 2] +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def map_with_ys ys, &block~ +- Inside source: true +*** True Line Result + def map_with_ys ys, &block +** Processing line: ~ self.times.flat_map do |x|~ +- Inside source: true +*** True Line Result + self.times.flat_map do |x| +** Processing line: ~ ys.map_with_index do |y|~ +- Inside source: true +*** True Line Result + ys.map_with_index do |y| +** Processing line: ~ yield x, y~ +- Inside source: true +*** True Line Result + yield x, y +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ raise_immediately e, :map_with_ys, [self, ys]~ +- Inside source: true +*** True Line Result + raise_immediately e, :map_with_ys, [self, ys] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def combinations other_int~ +- Inside source: true +*** True Line Result + def combinations other_int +** Processing line: ~ self.numbers.product(other_int.numbers)~ +- Inside source: true +*** True Line Result + self.numbers.product(other_int.numbers) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def percentage_of n~ +- Inside source: true +*** True Line Result + def percentage_of n +** Processing line: ~ (self / n.to_f).cap_min_max(0, 1)~ +- Inside source: true +*** True Line Result + (self / n.to_f).cap_min_max(0, 1) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Outputs#borders~~ -- H1 detected. -- Formatting line: ~~GTK::Outputs#borders~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def cap i~ +- Inside source: true +*** True Line Result + def cap i +** Processing line: ~ return i if self > i~ +- Inside source: true +*** True Line Result + return i if self > i +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ -- P detected. -- Formatting line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~The only difference between the two primitives is where they are added.~ -- P detected. -- Formatting line: ~The only difference between the two primitives is where they are added.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Instead of using ~args.outputs.solids~:~ -- P detected. -- Formatting line: ~Instead of using ~args.outputs.solids~:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def cap_min_max min, max~ +- Inside source: true +*** True Line Result + def cap_min_max min, max +** Processing line: ~ return min if self < min~ +- Inside source: true +*** True Line Result + return min if self < min +** Processing line: ~ return max if self > max~ +- Inside source: true +*** True Line Result + return max if self > max +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # X Y WIDTH HEIGHT~ -** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def lesser other~ +- Inside source: true +*** True Line Result + def lesser other +** Processing line: ~ return other if other < self~ +- Inside source: true +*** True Line Result + return other if other < self +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~You have to use ~args.outputs.borders~:~ -- P detected. -- Formatting line: ~You have to use ~args.outputs.borders~:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def greater other~ +- Inside source: true +*** True Line Result + def greater other +** Processing line: ~ return other if other > self~ +- Inside source: true +*** True Line Result + return other if other > self +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # X Y WIDTH HEIGHT~ -** Processing line: ~ args.outputs.borders << [100, 100, 160, 90]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def subtract i~ +- Inside source: true +*** True Line Result + def subtract i +** Processing line: ~ self - i~ +- Inside source: true +*** True Line Result + self - i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def minus i~ +- Inside source: true +*** True Line Result + def minus i +** Processing line: ~ self - i~ +- Inside source: true +*** True Line Result + self - i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def add i~ +- Inside source: true +*** True Line Result + def add i +** Processing line: ~ self + i~ +- Inside source: true +*** True Line Result + self + i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::Mouse~~ -- H1 detected. -- Formatting line: ~~GTK::Mouse~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def plus i~ +- Inside source: true +*** True Line Result + def plus i +** Processing line: ~ self + i~ +- Inside source: true +*** True Line Result + self + i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The mouse is accessible via ~args.inputs.mouse~:~ -- P detected. -- Formatting line: ~The mouse is accessible via ~args.inputs.mouse~:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def numbers~ +- Inside source: true +*** True Line Result + def numbers +** Processing line: ~ (0..self).to_a~ +- Inside source: true +*** True Line Result + (0..self).to_a +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse).~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ 10,~ -** Processing line: ~ 710,~ -** Processing line: ~ "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}."~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~The mouse has the following properties.~ -- P detected. -- Formatting line: ~The mouse has the following properties.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def >= other~ +- Inside source: true +*** True Line Result + def >= other +** Processing line: ~ return false if !other~ +- Inside source: true +*** True Line Result + return false if !other +** Processing line: ~ return gte other~ +- Inside source: true +*** True Line Result + return gte other +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- ~args.inputs.mouse.x~: Returns the x position of the mouse.~ -- UL start detected. -- LI detected. -- Formatting line: ~~args.inputs.mouse.x~: Returns the x position of the mouse.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.y~: Returns the y position of the mouse.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.y~: Returns the y position of the mouse.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ -- Line's tilde count is: 10 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ -- Line's tilde count is: 10 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ -- LI detected. -- Formatting line: ~~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def > other~ +- Inside source: true +*** True Line Result + def > other +** Processing line: ~ return false if !other~ +- Inside source: true +*** True Line Result + return false if !other +** Processing line: ~ return gt other~ +- Inside source: true +*** True Line Result + return gt other +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::MousePoint~~ -- H1 detected. -- Formatting line: ~~GTK::MousePoint~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def <= other~ +- Inside source: true +*** True Line Result + def <= other +** Processing line: ~ return false if !other~ +- Inside source: true +*** True Line Result + return false if !other +** Processing line: ~ return lte other~ +- Inside source: true +*** True Line Result + return lte other +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~The ~GTK::MousePoint~ has the following properties.~ -- P detected. -- Formatting line: ~The ~GTK::MousePoint~ has the following properties.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def < other~ +- Inside source: true +*** True Line Result + def < other +** Processing line: ~ return false if !other~ +- Inside source: true +*** True Line Result + return false if !other +** Processing line: ~ return gt other~ +- Inside source: true +*** True Line Result + return gt other +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~- ~x~: Integer representing the mouse's x.~ -- UL start detected. -- LI detected. -- Formatting line: ~~x~: Integer representing the mouse's x.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~y~: Integer representing the mouse's y.~ -- LI detected. -- Formatting line: ~~y~: Integer representing the mouse's y.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~point~: Array with the ~x~ and ~y~ values.~ -- LI detected. -- Formatting line: ~~point~: Array with the ~x~ and ~y~ values.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- LI detected. -- Formatting line: ~~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ -- LI detected. -- Formatting line: ~~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ -- LI detected. -- Formatting line: ~~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method(:original_eq_eq, :==) unless Numeric.instance_methods.include?(:original_eq_eq)~ +- Inside source: true +*** True Line Result + alias_method(:original_eq_eq, :==) unless Numeric.instance_methods.include?(:original_eq_eq) +** Processing line: ~ def == other~ +- Inside source: true +*** True Line Result + def == other +** Processing line: ~ return true if self.original_eq_eq(other)~ +- Inside source: true +*** True Line Result + return true if self.original_eq_eq(other) +** Processing line: ~ if other.is_a?(OpenEntity)~ +- Inside source: true +*** True Line Result + if other.is_a?(OpenEntity) +** Processing line: ~ return self.original_eq_eq(other.entity_id)~ +- Inside source: true +*** True Line Result + return self.original_eq_eq(other.entity_id) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ return self.original_eq_eq(other)~ +- Inside source: true +*** True Line Result + return self.original_eq_eq(other) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def map~ +- Inside source: true +*** True Line Result + def map +** Processing line: ~ unless block_given?~ +- Inside source: true +*** True Line Result + unless block_given? +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ A block is required for Numeric#map.~ +- Inside source: true +*** True Line Result + A block is required for Numeric#map. ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::OpenEntity~~ -- H1 detected. -- Formatting line: ~~GTK::OpenEntity~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ -- P detected. -- Formatting line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ self.to_i.times.map do~ +- Inside source: true +*** True Line Result + self.to_i.times.map do +** Processing line: ~ yield~ +- Inside source: true +*** True Line Result + yield +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.x ||= 100~ -** Processing line: ~ args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def map_with_index~ +- Inside source: true +*** True Line Result + def map_with_index +** Processing line: ~ unless block_given?~ +- Inside source: true +*** True Line Result + unless block_given? +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ A block is required for Numeric#map.~ +- Inside source: true +*** True Line Result + A block is required for Numeric#map. ** Processing line: ~~ -** Processing line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ -- P detected. -- Formatting line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~For example:~ -- P detected. -- Formatting line: ~For example:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # intermediate player object does not need to be created~ -** Processing line: ~ args.state.player.x ||= 100~ -** Processing line: ~ args.state.player.y ||= 100~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ 10,~ -** Processing line: ~ 710,~ -** Processing line: ~ "player x, y is:#{args.state.player.x}, #{args.state.player.y}."~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ self.to_i.times.map do |i|~ +- Inside source: true +*** True Line Result + self.to_i.times.map do |i| +** Processing line: ~ yield i~ +- Inside source: true +*** True Line Result + yield i +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def check_numeric! sender, other~ +- Inside source: true +*** True Line Result + def check_numeric! sender, other +** Processing line: ~ return if other.is_a? Numeric~ +- Inside source: true +*** True Line Result + return if other.is_a? Numeric ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ raise <<-S~ +- Inside source: true +*** True Line Result + raise <<-S +** Processing line: ~ * ERROR:~ +- Inside source: true +*** True Line Result + * ERROR: +** Processing line: ~ Attempted to invoke :+ on #{self} with the right hand argument of:~ +- Inside source: true +*** True Line Result + Attempted to invoke :+ on #{self} with the right hand argument of: ** Processing line: ~~ -** Processing line: ~* DOCS: ~GTK::OpenEntity#as_hash~~ -- H1 detected. -- Formatting line: ~~GTK::OpenEntity#as_hash~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ #{other}~ +- Inside source: true +*** True Line Result + #{other} ** Processing line: ~~ -** Processing line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ -- P detected. -- Formatting line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ -- Line's tilde count is: 10 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example:~ -- P detected. -- Formatting line: ~Example:~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ The object above is not a Numeric.~ +- Inside source: true +*** True Line Result + The object above is not a Numeric. ** Processing line: ~~ -** Processing line: ~#+begin_src~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.x ||= 100~ -** Processing line: ~ args.state.y ||= 100~ -** Processing line: ~ values = args.state~ -** Processing line: ~ .as_hash~ -** Processing line: ~ .map { |k, v| "#{k} #{v}" }~ -** Processing line: ~~ -** Processing line: ~ args.outputs.labels << values.map.with_index do |v, i|~ -** Processing line: ~ [~ -** Processing line: ~ 10,~ -** Processing line: ~ 710 - (30 * i),~ -** Processing line: ~ v~ -** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Numeric#frame_index~~ -- H1 detected. -- Formatting line: ~~Numeric#frame_index~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ -- P detected. -- Formatting line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~frame_index~ takes three additional parameters:~ -- P detected. -- Formatting line: ~~frame_index~ takes three additional parameters:~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~- How many frames exist in the sprite animation.~ -- UL start detected. -- LI detected. -- Formatting line: ~How many frames exist in the sprite animation.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- How long to hold each animation for.~ -- LI detected. -- Formatting line: ~How long to hold each animation for.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~- Whether the animation should repeat.~ -- LI detected. -- Formatting line: ~Whether the animation should repeat.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ -- UL end detected. -- P detected. -- Formatting line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ -- Line's tilde count is: 4 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example using variables:~ -- P detected. -- Formatting line: ~Example using variables:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ start_looping_at = 0~ -** Processing line: ~ number_of_sprites = 6~ -** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ -** Processing line: ~ does_sprite_loop = true~ -** Processing line: ~~ -** Processing line: ~ sprite_index =~ -** Processing line: ~ start_looping_at.frame_index number_of_sprites,~ -** Processing line: ~ number_of_frames_to_show_each_sprite,~ -** Processing line: ~ does_sprite_loop~ -** Processing line: ~~ -** Processing line: ~ sprite_index ||= 0~ -** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ 640 - 50,~ -** Processing line: ~ 360 - 50,~ -** Processing line: ~ 100,~ -** Processing line: ~ 100,~ -** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~Example using named parameters:~ -- P detected. -- Formatting line: ~Example using named parameters:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ start_looping_at = 0~ -** Processing line: ~~ -** Processing line: ~ sprite_index =~ -** Processing line: ~ start_looping_at.frame_index count: 6,~ -** Processing line: ~ hold_for: 4,~ -** Processing line: ~ repeat: true,~ -** Processing line: ~ tick_count_override: args.state.tick_count~ -** Processing line: ~~ -** Processing line: ~ sprite_index ||= 0~ -** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << [~ -** Processing line: ~ 640 - 50,~ -** Processing line: ~ 360 - 50,~ -** Processing line: ~ 100,~ -** Processing line: ~ 100,~ -** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Numeric#elapsed_time~~ -- H1 detected. -- Formatting line: ~~Numeric#elapsed_time~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ -- P detected. -- Formatting line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Here is an example of how elapsed_time can be used.~ -- P detected. -- Formatting line: ~Here is an example of how elapsed_time can be used.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.last_click_at ||= 0~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # record when a mouse click occurs~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ args.state.last_click_at = args.state.tick_count~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def - other~ +- Inside source: true +*** True Line Result + def - other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :-, other~ +- Inside source: true +*** True Line Result + check_numeric! :-, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ -** Processing line: ~ if args.state.last_click_at.elapsed_time > 120~ -** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def + other~ +- Inside source: true +*** True Line Result + def + other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :+, other~ +- Inside source: true +*** True Line Result + check_numeric! :+, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~And here is an example where the override parameter is passed in:~ -- P detected. -- Formatting line: ~And here is an example where the override parameter is passed in:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.last_click_at ||= 0~ -** Processing line: ~~ -** Processing line: ~ # create a state variable that tracks time at half the speed of args.state.tick_count~ -** Processing line: ~ args.state.simulation_tick = args.state.tick_count.idiv 2~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # record when a mouse click occurs~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ args.state.last_click_at = args.state.simulation_tick~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def * other~ +- Inside source: true +*** True Line Result + def * other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :*, other~ +- Inside source: true +*** True Line Result + check_numeric! :*, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ -** Processing line: ~ if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120~ -** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def / other~ +- Inside source: true +*** True Line Result + def / other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :/, other~ +- Inside source: true +*** True Line Result + check_numeric! :/, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Numeric#elapsed?~~ -- H1 detected. -- Formatting line: ~~Numeric#elapsed?~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ -- P detected. -- Formatting line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ -- Line's tilde count is: 6 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example usage (no optional parameter):~ -- P detected. -- Formatting line: ~Example usage (no optional parameter):~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.box_queue ||= []~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ if args.state.box_queue.empty?~ -** Processing line: ~ args.state.box_queue << { name: :red,~ -** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ -** Processing line: ~ args.state.box_queue << { name: :green,~ -** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ -** Processing line: ~ args.state.box_queue << { name: :blue,~ -** Processing line: ~ destroy_at: args.state.tick_count + 120 }~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ boxes_to_destroy = args.state~ -** Processing line: ~ .box_queue~ -** Processing line: ~ .find_all { |b| b[:destroy_at].elapsed? }~ -** Processing line: ~~ -** Processing line: ~ if !boxes_to_destroy.empty?~ -** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def from_top~ +- Inside source: true +*** True Line Result + def from_top +** Processing line: ~ return 720 - self unless $gtk~ +- Inside source: true +*** True Line Result + return 720 - self unless $gtk +** Processing line: ~ $gtk.args.grid.h - self~ +- Inside source: true +*** True Line Result + $gtk.args.grid.h - self ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ -** Processing line: ~~ -** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Example usage (with optional parameter):~ -- P detected. -- Formatting line: ~Example usage (with optional parameter):~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ class Fixnum~ +- Inside source: true +*** True Line Result + class Fixnum +** Processing line: ~ include ValueType~ +- Inside source: true +*** True Line Result + include ValueType ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.box_queue ||= []~ +- Inside source: true +*** True Line Result + +** Processing line: ~ alias_method(:original_eq_eq, :==) unless Fixnum.instance_methods.include?(:original_eq_eq)~ +- Inside source: true +*** True Line Result + alias_method(:original_eq_eq, :==) unless Fixnum.instance_methods.include?(:original_eq_eq) ** Processing line: ~~ -** Processing line: ~ if args.state.box_queue.empty?~ -** Processing line: ~ args.state.box_queue << { name: :red,~ -** Processing line: ~ create_at: args.state.tick_count + 120,~ -** Processing line: ~ lifespan: 60 }~ -** Processing line: ~ args.state.box_queue << { name: :green,~ -** Processing line: ~ create_at: args.state.tick_count + 120,~ -** Processing line: ~ lifespan: 60 }~ -** Processing line: ~ args.state.box_queue << { name: :blue,~ -** Processing line: ~ create_at: args.state.tick_count + 120,~ -** Processing line: ~ lifespan: 120 }~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def - other~ +- Inside source: true +*** True Line Result + def - other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :-, other~ +- Inside source: true +*** True Line Result + check_numeric! :-, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # lifespan is passed in as a parameter to ~elapsed?~~ -** Processing line: ~ boxes_to_destroy = args.state~ -** Processing line: ~ .box_queue~ -** Processing line: ~ .find_all { |b| b[:create_at].elapsed? b[:lifespan] }~ -** Processing line: ~~ -** Processing line: ~ if !boxes_to_destroy.empty?~ -** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `true` if the numeric value is evenly divisible by 2.~ +- Inside source: true +*** True Line Result + # Returns `true` if the numeric value is evenly divisible by 2. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def even?~ +- Inside source: true +*** True Line Result + def even? +** Processing line: ~ return (self % 2) == 0~ +- Inside source: true +*** True Line Result + return (self % 2) == 0 ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ -** Processing line: ~~ -** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Numeric#created?~~ -- H1 detected. -- Formatting line: ~~Numeric#created?~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ -- P detected. -- Formatting line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~Example usage:~ -- P detected. -- Formatting line: ~Example usage:~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.box_queue ||= []~ -** Processing line: ~~ -** Processing line: ~ if args.state.box_queue.empty?~ -** Processing line: ~ args.state.box_queue << { name: :red,~ -** Processing line: ~ create_at: args.state.tick_count + 60 }~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `true` if the numeric value is *NOT* evenly divisible by 2.~ +- Inside source: true +*** True Line Result + # Returns `true` if the numeric value is *NOT* evenly divisible by 2. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def odd?~ +- Inside source: true +*** True Line Result + def odd? +** Processing line: ~ return !even?~ +- Inside source: true +*** True Line Result + return !even? ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ boxes_to_spawn_this_frame = args.state~ -** Processing line: ~ .box_queue~ -** Processing line: ~ .find_all { |b| b[:create_at].new? }~ -** Processing line: ~~ -** Processing line: ~ boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." }~ -** Processing line: ~~ -** Processing line: ~ args.state.box_queue -= boxes_to_spawn_this_frame~ -** Processing line: ~ end~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Kernel~~ -- H1 detected. -- Formatting line: ~~Kernel~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ -- P detected. -- Formatting line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* DOCS: ~Kernel::tick_count~~ -- H1 detected. -- Formatting line: ~~Kernel::tick_count~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. -** Processing line: ~~ -** Processing line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ -- P detected. -- Formatting line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def + other~ +- Inside source: true +*** True Line Result + def + other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :+, other~ +- Inside source: true +*** True Line Result + check_numeric! :+, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* DOCS: ~Kernel::global_tick_count~~ -- H1 detected. -- Formatting line: ~~Kernel::global_tick_count~~ -- Line's tilde count is: 2 -- Line contains link marker: false -- CODE detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def * other~ +- Inside source: true +*** True Line Result + def * other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :*, other~ +- Inside source: true +*** True Line Result + check_numeric! :*, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ -- P detected. -- Formatting line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def / other~ +- Inside source: true +*** True Line Result + def / other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :/, other~ +- Inside source: true +*** True Line Result + check_numeric! :/, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def == other~ +- Inside source: true +*** True Line Result + def == other +** Processing line: ~ return true if self.original_eq_eq(other)~ +- Inside source: true +*** True Line Result + return true if self.original_eq_eq(other) +** Processing line: ~ if other.is_a?(GTK::OpenEntity)~ +- Inside source: true +*** True Line Result + if other.is_a?(GTK::OpenEntity) +** Processing line: ~ return self.original_eq_eq(other.entity_id)~ +- Inside source: true +*** True Line Result + return self.original_eq_eq(other.entity_id) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ return self.original_eq_eq(other)~ +- Inside source: true +*** True Line Result + return self.original_eq_eq(other) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `-1` if the number is less than `0`. `+1` if the number~ +- Inside source: true +*** True Line Result + # Returns `-1` if the number is less than `0`. `+1` if the number +** Processing line: ~ # is greater than `0`. Returns `0` if the number is equal to `0`.~ +- Inside source: true +*** True Line Result + # is greater than `0`. Returns `0` if the number is equal to `0`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def sign~ +- Inside source: true +*** True Line Result + def sign +** Processing line: ~ return -1 if self < 0~ +- Inside source: true +*** True Line Result + return -1 if self < 0 +** Processing line: ~ return 1 if self > 0~ +- Inside source: true +*** True Line Result + return 1 if self > 0 +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* Open Source~ -- H1 detected. -- Formatting line: ~Open Source~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ -- P detected. -- Formatting line: ~Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ -- Line's tilde count is: 2 -- Line contains link marker: true -- CODE detected. -- LINK detected. -** Processing line: ~* 00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb~ -- H1 detected. -- Formatting line: ~00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `true` if number is greater than `0`.~ +- Inside source: true +*** True Line Result + # Returns `true` if number is greater than `0`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def pos?~ +- Inside source: true +*** True Line Result + def pos? +** Processing line: ~ sign > 0~ +- Inside source: true +*** True Line Result + sign > 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # ==========================================================================~ -** Processing line: ~ # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _~ -** Processing line: ~ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | |~ -** Processing line: ~ # | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | |~ -** Processing line: ~ # | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | |~ -** Processing line: ~ # | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_|~ -** Processing line: ~ # |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_)~ -** Processing line: ~ #~ -** Processing line: ~ #~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # \ | /~ -** Processing line: ~ # \ | /~ -** Processing line: ~ # +~ -** Processing line: ~ #~ -** Processing line: ~ # If you are new to the programming language Ruby, then you may find the~ -** Processing line: ~ # following code a bit overwhelming. Come back to this file when you have~ -** Processing line: ~ # a better grasp of Ruby and Game Toolkit.~ -** Processing line: ~ #~ -** Processing line: ~ # What follows is an automations script # that can be run via terminal:~ -** Processing line: ~ # ./samples/00_beginner_ruby_primer $ ../../dragonruby . --eval app/automation.rb~ -** Processing line: ~ # ==========================================================================~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns `true` if number is less than `0`.~ +- Inside source: true +*** True Line Result + # Returns `true` if number is less than `0`. +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def neg?~ +- Inside source: true +*** True Line Result + def neg? +** Processing line: ~ sign < 0~ +- Inside source: true +*** True Line Result + sign < 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.scheduled_callbacks.clear~ -** Processing line: ~ $gtk.schedule_callback 10 do~ -** Processing line: ~ $gtk.console.set_command 'puts "Hello DragonRuby!"'~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +- Inside source: true +*** True Line Result + # Returns the cosine of a represented in degrees (NOT radians). +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def cos~ +- Inside source: true +*** True Line Result + def cos +** Processing line: ~ Math.cos(self.to_radians)~ +- Inside source: true +*** True Line Result + Math.cos(self.to_radians) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 20 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Returns the cosine of a represented in degrees (NOT radians).~ +- Inside source: true +*** True Line Result + # Returns the cosine of a represented in degrees (NOT radians). +** Processing line: ~ #~ +- Inside source: true +*** True Line Result + # +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def sin~ +- Inside source: true +*** True Line Result + def sin +** Processing line: ~ Math.sin(self.to_radians)~ +- Inside source: true +*** True Line Result + Math.sin(self.to_radians) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 30 do~ -** Processing line: ~ $gtk.console.set_command 'outputs.solids << [910, 200, 100, 100, 255, 0, 0]'~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class Float~ +- Inside source: true +*** True Line Result + class Float +** Processing line: ~ include ValueType~ +- Inside source: true +*** True Line Result + include ValueType ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 40 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def - other~ +- Inside source: true +*** True Line Result + def - other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :-, other~ +- Inside source: true +*** True Line Result + check_numeric! :-, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 50 do~ -** Processing line: ~ $gtk.console.set_command 'outputs.solids << [1010, 200, 100, 100, 0, 0, 255]'~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def + other~ +- Inside source: true +*** True Line Result + def + other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :+, other~ +- Inside source: true +*** True Line Result + check_numeric! :+, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 60 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def * other~ +- Inside source: true +*** True Line Result + def * other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :*, other~ +- Inside source: true +*** True Line Result + check_numeric! :*, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 70 do~ -** Processing line: ~ $gtk.console.set_command 'outputs.sprites << [1110, 200, 100, 100, "sprites/dragon_fly_0.png"]'~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def / other~ +- Inside source: true +*** True Line Result + def / other +** Processing line: ~ return nil unless other~ +- Inside source: true +*** True Line Result + return nil unless other +** Processing line: ~ check_numeric! :/, other~ +- Inside source: true +*** True Line Result + check_numeric! :/, other +** Processing line: ~ super~ +- Inside source: true +*** True Line Result + super +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 80 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ self~ +- Inside source: true +*** True Line Result + self +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 90 do~ -** Processing line: ~ $gtk.console.set_command "outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]"~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def sign~ +- Inside source: true +*** True Line Result + def sign +** Processing line: ~ return -1 if self < 0~ +- Inside source: true +*** True Line Result + return -1 if self < 0 +** Processing line: ~ return 1 if self > 0~ +- Inside source: true +*** True Line Result + return 1 if self > 0 +** Processing line: ~ return 0~ +- Inside source: true +*** True Line Result + return 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 100 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 110 do~ -** Processing line: ~ $gtk.console.set_command "state.sprite_frame = state.tick_count.idiv(4).mod(6)"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 120 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 130 do~ -** Processing line: ~ $gtk.console.set_command "outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0]"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 140 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 150 do~ -** Processing line: ~ $gtk.console.set_command "state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\""~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 160 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 170 do~ -** Processing line: ~ $gtk.console.set_command "outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0]"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 180 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 190 do~ -** Processing line: ~ $gtk.console.set_command "outputs.sprites << [910, 330, 370, 370, state.sprite_path]"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 200 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def replace_infinity scalar~ +- Inside source: true +*** True Line Result + def replace_infinity scalar +** Processing line: ~ return self if !scalar~ +- Inside source: true +*** True Line Result + return self if !scalar +** Processing line: ~ return self unless self.infinite?~ +- Inside source: true +*** True Line Result + return self unless self.infinite? +** Processing line: ~ return -scalar if self < 0~ +- Inside source: true +*** True Line Result + return -scalar if self < 0 +** Processing line: ~ return scalar if self > 0~ +- Inside source: true +*** True Line Result + return scalar if self > 0 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 300 do~ -** Processing line: ~ $gtk.console.set_command ":wq"~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class Integer~ +- Inside source: true +*** True Line Result + class Integer +** Processing line: ~ alias_method(:original_round, :round) unless Fixnum.instance_methods.include?(:original_round)~ +- Inside source: true +*** True Line Result + alias_method(:original_round, :round) unless Fixnum.instance_methods.include?(:original_round) ** Processing line: ~~ -** Processing line: ~ $gtk.schedule_callback 400 do~ -** Processing line: ~ $gtk.console.eval_the_set_command~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def round *args~ +- Inside source: true +*** True Line Result + def round *args +** Processing line: ~ original_round~ +- Inside source: true +*** True Line Result + original_round +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb~ -- H1 detected. -- Formatting line: ~00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* runtime/framerate_diagnostics.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* runtime/framerate_diagnostics.rb ** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # ==========================================================================~ -** Processing line: ~ # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _~ -** Processing line: ~ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | |~ -** Processing line: ~ # | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | |~ -** Processing line: ~ # | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | |~ -** Processing line: ~ # | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_|~ -** Processing line: ~ # |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_)~ -** Processing line: ~ #~ -** Processing line: ~ #~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # |~ -** Processing line: ~ # \ | /~ -** Processing line: ~ # \ | /~ -** Processing line: ~ # +~ -** Processing line: ~ #~ -** Processing line: ~ # If you are new to the programming language Ruby, then you may find the~ -** Processing line: ~ # following code a bit overwhelming. This sample is only designed to be~ -** Processing line: ~ # run interactively (as opposed to being manipulated via source code).~ -** Processing line: ~ #~ -** Processing line: ~ # Start up this sample and follow along by visiting:~ -** Processing line: ~ # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-primer.mp4~ -** Processing line: ~ #~ -** Processing line: ~ # It is STRONGLY recommended that you work through all the samples before~ -** Processing line: ~ # looking at the code in this file.~ -** Processing line: ~ # ==========================================================================~ -** Processing line: ~~ -** Processing line: ~ class TutorialOutputs~ -** Processing line: ~ attr_accessor :solids, :sprites, :labels, :lines, :borders~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/runtime/framerate_diagnostics.rb~ +- Inside source: true +*** True Line Result + # ./dragon/runtime/framerate_diagnostics.rb +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # framerate_diagnostics.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # framerate_diagnostics.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~ def initialize~ -** Processing line: ~ @solids = []~ -** Processing line: ~ @sprites = []~ -** Processing line: ~ @labels = []~ -** Processing line: ~ @lines = []~ -** Processing line: ~ @borders = []~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ class Runtime~ +- Inside source: true +*** True Line Result + class Runtime +** Processing line: ~ # @visibility private~ +- Inside source: true +*** True Line Result + # @visibility private +** Processing line: ~ module FramerateDiagnostics~ +- Inside source: true +*** True Line Result + module FramerateDiagnostics +** Processing line: ~ def framerate_get_diagnostics~ +- Inside source: true +*** True Line Result + def framerate_get_diagnostics +** Processing line: ~ <<-S~ +- Inside source: true +*** True Line Result + <<-S +** Processing line: ~ * INFO: Framerate Diagnostics~ +- Inside source: true +*** True Line Result + * INFO: Framerate Diagnostics +** Processing line: ~ You can display these diagnostics using:~ +- Inside source: true +*** True Line Result + You can display these diagnostics using: ** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ @solids ||= []~ -** Processing line: ~ @sprites ||= []~ -** Processing line: ~ @labels ||= []~ -** Processing line: ~ @lines ||= []~ -** Processing line: ~ @borders ||= []~ -** Processing line: ~ @solids.each { |p| $gtk.args.outputs.reserved << p.solid }~ -** Processing line: ~ @sprites.each { |p| $gtk.args.outputs.reserved << p.sprite }~ -** Processing line: ~ @labels.each { |p| $gtk.args.outputs.reserved << p.label }~ -** Processing line: ~ @lines.each { |p| $gtk.args.outputs.reserved << p.line }~ -** Processing line: ~ @borders.each { |p| $gtk.args.outputs.reserved << p.border }~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.outputs.debug << args.gtk.framerate_diagnostics_primitives~ +- Inside source: true +*** True Line Result + args.outputs.debug << args.gtk.framerate_diagnostics_primitives +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src ** Processing line: ~~ -** Processing line: ~ def clear~ -** Processing line: ~ @solids.clear~ -** Processing line: ~ @sprites.clear~ -** Processing line: ~ @labels.clear~ -** Processing line: ~ @borders.clear~ -** Processing line: ~ end~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ** Draw Calls: ~<<~ Invocation Perf Counter~ +- Inside source: true +*** True Line Result + ** Draw Calls: ~<<~ Invocation Perf Counter +** Processing line: ~ Here is how many times ~args.outputs.PRIMITIVE_ARRAY <<~ was called:~ +- Inside source: true +*** True Line Result + Here is how many times ~args.outputs.PRIMITIVE_ARRAY <<~ was called: ** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.reset_button ||=~ -** Processing line: ~ state.new_entity(~ -** Processing line: ~ :button,~ -** Processing line: ~ label: [1190, 68, "RESTART", -2, 0, 0, 0, 0].label,~ -** Processing line: ~ background: [1160, 38, 120, 50, 255, 255, 255].solid~ -** Processing line: ~ )~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #{$perf_counter_outputs_push_count} times invoked.~ +- Inside source: true +*** True Line Result + #{$perf_counter_outputs_push_count} times invoked. ** Processing line: ~~ -** Processing line: ~ def tick_reset_button~ -** Processing line: ~ return unless state.hello_dragonruby_confirmed~ -** Processing line: ~ $gtk.args.outputs.reserved << state.reset_button.background~ -** Processing line: ~ $gtk.args.outputs.reserved << state.reset_button.label~ -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.reset_button.background)~ -** Processing line: ~ restart_tutorial~ -** Processing line: ~ end~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ If the number above is high, consider batching primitives so you can lower the invocation of ~<<~. For example.~ +- Inside source: true +*** True Line Result + If the number above is high, consider batching primitives so you can lower the invocation of ~<<~. For example. ** Processing line: ~~ -** Processing line: ~ def seperator~ -** Processing line: ~ @seperator = "=" * 80~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Instead of:~ +- Inside source: true +*** True Line Result + Instead of: ** Processing line: ~~ -** Processing line: ~ def tick_intro~ -** Processing line: ~ queue_message "Welcome to the DragonRuby GTK primer! Try typing the~ -** Processing line: ~ code below and press ENTER:~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.state.enemies.map do |e|~ +- Inside source: true +*** True Line Result + args.state.enemies.map do |e| +** Processing line: ~ e.alpha = 128~ +- Inside source: true +*** True Line Result + e.alpha = 128 +** Processing line: ~ args.outputs.sprites << e # <-- ~args.outputs.sprites <<~ is invoked a lot~ +- Inside source: true +*** True Line Result + args.outputs.sprites << e # <-- ~args.outputs.sprites <<~ is invoked a lot +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src ** Processing line: ~~ -** Processing line: ~ puts \"Hello DragonRuby!\"~ -** Processing line: ~ "~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Do this:~ +- Inside source: true +*** True Line Result + Do this: ** Processing line: ~~ -** Processing line: ~ def tick_hello_dragonruby~ -** Processing line: ~ return unless console_has? "Hello DragonRuby!"~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.outputs.sprites << args.state~ +- Inside source: true +*** True Line Result + args.outputs.sprites << args.state +** Processing line: ~ .enemies~ +- Inside source: true +*** True Line Result + .enemies +** Processing line: ~ .map do |e| # <-- ~args.outputs.sprites <<~ is only invoked once.~ +- Inside source: true +*** True Line Result + .map do |e| # <-- ~args.outputs.sprites <<~ is only invoked once. +** Processing line: ~ e.alpha = 128~ +- Inside source: true +*** True Line Result + e.alpha = 128 +** Processing line: ~ e~ +- Inside source: true +*** True Line Result + e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src ** Processing line: ~~ -** Processing line: ~ $gtk.args.state.hello_dragonruby_confirmed = true~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ** Array Primitives~ +- Inside source: true +*** True Line Result + ** Array Primitives +** Processing line: ~ ~Primitives~ represented as an ~Array~ (~Tuple~) are great for prototyping, but are not as performant as using a ~Hash~.~ +- Inside source: true +*** True Line Result + ~Primitives~ represented as an ~Array~ (~Tuple~) are great for prototyping, but are not as performant as using a ~Hash~. ** Processing line: ~~ -** Processing line: ~ queue_message "Well HELLO to you too!~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Here is the number of ~Array~ primitives that were encountered:~ +- Inside source: true +*** True Line Result + Here is the number of ~Array~ primitives that were encountered: ** Processing line: ~~ -** Processing line: ~ If you ever want to RESTART the tutorial, just click the \"RESTART\"~ -** Processing line: ~ button in the bottom right-hand corner.~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #{$perf_counter_primitive_is_array} Array Primitives.~ +- Inside source: true +*** True Line Result + #{$perf_counter_primitive_is_array} Array Primitives. ** Processing line: ~~ -** Processing line: ~ Let's continue shall we? Type the code below and press ENTER:~ +- Inside source: true +*** True Line Result + +** Processing line: ~ If the number above is high, consider converting them to hashes. For example.~ +- Inside source: true +*** True Line Result + If the number above is high, consider converting them to hashes. For example. ** Processing line: ~~ -** Processing line: ~ outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ -** Processing line: ~ "~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Instead of:~ +- Inside source: true +*** True Line Result + Instead of: ** Processing line: ~~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.outputs.sprites << [0, 0, 100, 100, 'sprites/enemy.png']~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [0, 0, 100, 100, 'sprites/enemy.png'] +** Processing line: ~ #+begin_end~ +- Inside source: true +*** True Line Result + #+begin_end ** Processing line: ~~ -** Processing line: ~ def tick_explain_solid~ -** Processing line: ~ return unless $tutorial_outputs.solids.any? {|s| s == [910, 200, 100, 100, 255, 0, 0]}~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Do this:~ +- Inside source: true +*** True Line Result + Do this: ** Processing line: ~~ -** Processing line: ~ queue_message "Sweet!~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.outputs.sprites << { x: 0,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { x: 0, +** Processing line: ~ y: 0,~ +- Inside source: true +*** True Line Result + y: 0, +** Processing line: ~ w: 100,~ +- Inside source: true +*** True Line Result + w: 100, +** Processing line: ~ h: 100,~ +- Inside source: true +*** True Line Result + h: 100, +** Processing line: ~ path: 'sprites/enemy.png' }~ +- Inside source: true +*** True Line Result + path: 'sprites/enemy.png' } +** Processing line: ~ #+begin_end~ +- Inside source: true +*** True Line Result + #+begin_end ** Processing line: ~~ -** Processing line: ~ The code: outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ -** Processing line: ~ Does the following:~ -** Processing line: ~ 1. GET the place where SOLIDS go: outputs.solids~ -** Processing line: ~ 2. Request that a new SOLID be ADDED: <<~ -** Processing line: ~ 3. The DEFINITION of a SOLID is the ARRAY:~ -** Processing line: ~ [910, 200, 100, 100, 255, 0, 0]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ** Primitive Counts~ +- Inside source: true +*** True Line Result + ** Primitive Counts +** Processing line: ~ Here are the draw counts ordered by lowest to highest z order:~ +- Inside source: true +*** True Line Result + Here are the draw counts ordered by lowest to highest z order: ** Processing line: ~~ -** Processing line: ~ GET ADD X Y WIDTH HEIGHT RED GREEN BLUE~ -** Processing line: ~ | | | | | | | | |~ -** Processing line: ~ | | | | | | | | |~ -** Processing line: ~ outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ -** Processing line: ~ |_________________________________________|~ -** Processing line: ~ |~ -** Processing line: ~ |~ -** Processing line: ~ ARRAY~ -** Processing line: ~~ -** Processing line: ~ Now let's create a blue SOLID. Type:~ -** Processing line: ~~ -** Processing line: ~ outputs.solids << [1010, 200, 100, 100, 0, 0, 255]~ -** Processing line: ~ "~ -** Processing line: ~~ -** Processing line: ~ state.explain_solid_confirmed = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick_explain_solid_blue~ -** Processing line: ~ return unless state.explain_solid_confirmed~ -** Processing line: ~ return unless $tutorial_outputs.solids.any? {|s| s == [1010, 200, 100, 100, 0, 0, 255]}~ -** Processing line: ~ state.explain_solid_blue_confirmed = true~ -** Processing line: ~~ -** Processing line: ~ queue_message "And there is our blue SOLID!~ -** Processing line: ~~ -** Processing line: ~ The ARRAY is the MOST important thing in DragonRuby GTK.~ -** Processing line: ~~ -** Processing line: ~ Let's create a SPRITE using an ARRAY:~ +- Inside source: true +*** True Line Result + +** Processing line: ~ PRIMITIVE COUNT, STATIC COUNT~ +- Inside source: true +*** True Line Result + PRIMITIVE COUNT, STATIC COUNT +** Processing line: ~ solids: #{@args.outputs.solids.length}, #{@args.outputs.static_solids.length}~ +- Inside source: true +*** True Line Result + solids: #{@args.outputs.solids.length}, #{@args.outputs.static_solids.length} +** Processing line: ~ sprites: #{@args.outputs.sprites.length}, #{@args.outputs.static_sprites.length}~ +- Inside source: true +*** True Line Result + sprites: #{@args.outputs.sprites.length}, #{@args.outputs.static_sprites.length} +** Processing line: ~ primitives: #{@args.outputs.primitives.length}, #{@args.outputs.static_primitives.length}~ +- Inside source: true +*** True Line Result + primitives: #{@args.outputs.primitives.length}, #{@args.outputs.static_primitives.length} +** Processing line: ~ labels: #{@args.outputs.labels.length}, #{@args.outputs.static_labels.length}~ +- Inside source: true +*** True Line Result + labels: #{@args.outputs.labels.length}, #{@args.outputs.static_labels.length} +** Processing line: ~ lines: #{@args.outputs.lines.length}, #{@args.outputs.static_lines.length}~ +- Inside source: true +*** True Line Result + lines: #{@args.outputs.lines.length}, #{@args.outputs.static_lines.length} +** Processing line: ~ borders: #{@args.outputs.borders.length}, #{@args.outputs.static_borders.length}~ +- Inside source: true +*** True Line Result + borders: #{@args.outputs.borders.length}, #{@args.outputs.static_borders.length} +** Processing line: ~ debug: #{@args.outputs.debug.length}, #{@args.outputs.static_debug.length}~ +- Inside source: true +*** True Line Result + debug: #{@args.outputs.debug.length}, #{@args.outputs.static_debug.length} +** Processing line: ~ reserved: #{@args.outputs.reserved.length}, #{@args.outputs.static_reserved.length}~ +- Inside source: true +*** True Line Result + reserved: #{@args.outputs.reserved.length}, #{@args.outputs.static_reserved.length} ** Processing line: ~~ -** Processing line: ~ outputs.sprites << [1110, 200, 100, 100, 'sprites/dragon_fly_0.png']~ -** Processing line: ~ "~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ** Additional Help~ +- Inside source: true +*** True Line Result + ** Additional Help +** Processing line: ~ Come to the DragonRuby Discord channel if you need help troubleshooting performance issues. http://discord.dragonruby.org.~ +- Inside source: true +*** True Line Result + Come to the DragonRuby Discord channel if you need help troubleshooting performance issues. http://discord.dragonruby.org. ** Processing line: ~~ -** Processing line: ~ def tick_explain_tick_count~ -** Processing line: ~ return unless $tutorial_outputs.sprites.any? {|s| s == [1110, 200, 100, 100, 'sprites/dragon_fly_0.png']}~ -** Processing line: ~ return if $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 255, 255, 255]}~ -** Processing line: ~ state.explain_tick_count_confirmed = true~ +- Inside source: true +*** True Line Result + +** Processing line: ~ Source code for these diagnostics can be found at: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]]~ +- Inside source: true +*** True Line Result + Source code for these diagnostics can be found at: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]] +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ queue_message "Look at the cute little dragon!~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def framerate_warning_message~ +- Inside source: true +*** True Line Result + def framerate_warning_message +** Processing line: ~ <<-S~ +- Inside source: true +*** True Line Result + <<-S +** Processing line: ~ * WARNING:~ +- Inside source: true +*** True Line Result + * WARNING: +** Processing line: ~ Your average framerate dropped below 60 fps for two seconds.~ +- Inside source: true +*** True Line Result + Your average framerate dropped below 60 fps for two seconds. ** Processing line: ~~ -** Processing line: ~ We can create a LABEL with ARRAYS too. Let's create a LABEL showing~ -** Processing line: ~ THE PASSAGE OF TIME, which is called TICK_COUNT.~ +- Inside source: true +*** True Line Result + +** Processing line: ~ The average FPS was #{current_framerate}.~ +- Inside source: true +*** True Line Result + The average FPS was #{current_framerate}. ** Processing line: ~~ -** Processing line: ~ outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ -** Processing line: ~ "~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ ** How To Disable Warning~ +- Inside source: true +*** True Line Result + ** How To Disable Warning +** Processing line: ~ If this warning is getting annoying put the following in your tick method:~ +- Inside source: true +*** True Line Result + If this warning is getting annoying put the following in your tick method: ** Processing line: ~~ -** Processing line: ~ def tick_explain_mod~ -** Processing line: ~ return unless $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 0, 255, 0]}~ -** Processing line: ~ state.explain_mod_confirmed = true~ -** Processing line: ~ queue_message "~ -** Processing line: ~ The code: outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ -** Processing line: ~ Does the following:~ -** Processing line: ~ 1. GET the place where labels go: outputs.labels~ -** Processing line: ~ 2. Request that a new label be ADDED: <<~ -** Processing line: ~ 3. The DEFINITION of a LABEL is the ARRAY:~ -** Processing line: ~ [1210, 200, state.tick_count, 0, 255, 0]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ args.gtk.log_level = :off~ +- Inside source: true +*** True Line Result + args.gtk.log_level = :off +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src ** Processing line: ~~ -** Processing line: ~ GET ADD X Y TEXT RED GREEN BLUE~ -** Processing line: ~ | | | | | | | |~ -** Processing line: ~ | | | | | | | |~ -** Processing line: ~ outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ -** Processing line: ~ |______________________________________________|~ -** Processing line: ~ |~ -** Processing line: ~ |~ -** Processing line: ~ ARRAY~ +- Inside source: true +*** True Line Result + +** Processing line: ~ #{framerate_get_diagnostics}~ +- Inside source: true +*** True Line Result + #{framerate_get_diagnostics} +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ Now let's do some MATH, save the result to STATE, and create a LABEL:~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def current_framerate_primitives~ +- Inside source: true +*** True Line Result + def current_framerate_primitives +** Processing line: ~ framerate_diagnostics_primitives~ +- Inside source: true +*** True Line Result + framerate_diagnostics_primitives +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ state.sprite_frame = state.tick_count.idiv(4).mod(6)~ -** Processing line: ~ outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def framerate_diagnostics_primitives~ +- Inside source: true +*** True Line Result + def framerate_diagnostics_primitives +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid,~ +- Inside source: true +*** True Line Result + { x: 0, y: 93.from_top, w: 500, h: 93, a: 128 }.solid, +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 5,~ +- Inside source: true +*** True Line Result + x: 5, +** Processing line: ~ y: 5.from_top,~ +- Inside source: true +*** True Line Result + y: 5.from_top, +** Processing line: ~ text: "More Info via DragonRuby Console: $gtk.framerate_diagnostics",~ +- Inside source: true +*** True Line Result + text: "More Info via DragonRuby Console: $gtk.framerate_diagnostics", +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ size_enum: -2~ +- Inside source: true +*** True Line Result + size_enum: -2 +** Processing line: ~ }.label,~ +- Inside source: true +*** True Line Result + }.label, +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 5,~ +- Inside source: true +*** True Line Result + x: 5, +** Processing line: ~ y: 20.from_top,~ +- Inside source: true +*** True Line Result + y: 20.from_top, +** Processing line: ~ text: "FPS: %.2f" % args.gtk.current_framerate,~ +- Inside source: true +*** True Line Result + text: "FPS: %.2f" % args.gtk.current_framerate, +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ size_enum: -2~ +- Inside source: true +*** True Line Result + size_enum: -2 +** Processing line: ~ }.label,~ +- Inside source: true +*** True Line Result + }.label, +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 5,~ +- Inside source: true +*** True Line Result + x: 5, +** Processing line: ~ y: 35.from_top,~ +- Inside source: true +*** True Line Result + y: 35.from_top, +** Processing line: ~ text: "Draw Calls: #{$perf_counter_outputs_push_count}",~ +- Inside source: true +*** True Line Result + text: "Draw Calls: #{$perf_counter_outputs_push_count}", +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ size_enum: -2~ +- Inside source: true +*** True Line Result + size_enum: -2 +** Processing line: ~ }.label,~ +- Inside source: true +*** True Line Result + }.label, +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 5,~ +- Inside source: true +*** True Line Result + x: 5, +** Processing line: ~ y: 50.from_top,~ +- Inside source: true +*** True Line Result + y: 50.from_top, +** Processing line: ~ text: "Array Primitives: #{$perf_counter_primitive_is_array}",~ +- Inside source: true +*** True Line Result + text: "Array Primitives: #{$perf_counter_primitive_is_array}", +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ size_enum: -2~ +- Inside source: true +*** True Line Result + size_enum: -2 +** Processing line: ~ }.label,~ +- Inside source: true +*** True Line Result + }.label, +** Processing line: ~ {~ +- Inside source: true +*** True Line Result + { +** Processing line: ~ x: 5,~ +- Inside source: true +*** True Line Result + x: 5, +** Processing line: ~ y: 65.from_top,~ +- Inside source: true +*** True Line Result + y: 65.from_top, +** Processing line: ~ text: "Mouse: #{@args.inputs.mouse.point}",~ +- Inside source: true +*** True Line Result + text: "Mouse: #{@args.inputs.mouse.point}", +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ size_enum: -2~ +- Inside source: true +*** True Line Result + size_enum: -2 +** Processing line: ~ }.label,~ +- Inside source: true +*** True Line Result + }.label, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ Type the lines above (pressing ENTER after each line).~ -** Processing line: ~ "~ +- Inside source: true +*** True Line Result + +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick_explain_string_interpolation~ -** Processing line: ~ return unless state.explain_mod_confirmed~ -** Processing line: ~ return unless state.sprite_frame == state.tick_count.idiv(4).mod(6)~ -** Processing line: ~ return unless $tutorial_outputs.labels.any? {|l| l == [1210, 170, state.sprite_frame, 0, 255, 0]}~ -** Processing line: ~~ -** Processing line: ~ queue_message "Here is what the mathematical computation you just typed does:~ -** Processing line: ~~ -** Processing line: ~ 1. Create an item of STATE named SPRITE_FRAME: state.sprite_frame =~ -** Processing line: ~ 2. Set this SPRITE_FRAME to the PASSAGE OF TIME (tick_count),~ -** Processing line: ~ DIVIDED EVENLY (idiv) into 4,~ -** Processing line: ~ and then compute the REMAINDER (mod) of 6.~ -** Processing line: ~~ -** Processing line: ~ STATE SPRITE_FRAME PASSAGE OF HOW LONG HOW MANY~ -** Processing line: ~ | | TIME TO SHOW IMAGES~ -** Processing line: ~ | | | AN IMAGE TO FLIP THROUGH~ -** Processing line: ~ | | | | |~ -** Processing line: ~ state.sprite_frame = state.tick_count.idiv(4).mod(6)~ -** Processing line: ~ | |~ -** Processing line: ~ | +- REMAINDER OF DIVIDE~ -** Processing line: ~ DIVIDE EVENLY~ -** Processing line: ~ (NO DECIMALS)~ -** Processing line: ~~ -** Processing line: ~ With the information above, we can animate a SPRITE~ -** Processing line: ~ using STRING INTERPOLATION: \#{}~ -** Processing line: ~ which creates a unique SPRITE_PATH:~ -** Processing line: ~~ -** Processing line: ~ state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\"~ -** Processing line: ~ outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0]~ -** Processing line: ~ outputs.sprites << [910, 330, 370, 370, state.sprite_path]~ +- Inside source: true +*** True Line Result + +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ -** Processing line: ~ Type the lines above (pressing ENTER after each line).~ -** Processing line: ~ "~ -** Processing line: ~ end~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* string.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* string.rb +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/string.rb~ +- Inside source: true +*** True Line Result + # ./dragon/string.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # string.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # string.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~ def tick_reprint_on_error~ -** Processing line: ~ return unless console.last_command_errored~ -** Processing line: ~ puts $gtk.state.messages.last~ -** Processing line: ~ puts "\nWhoops! Try again."~ -** Processing line: ~ console.last_command_errored = false~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class String~ +- Inside source: true +*** True Line Result + class String +** Processing line: ~ include ValueType~ +- Inside source: true +*** True Line Result + include ValueType ** Processing line: ~~ -** Processing line: ~ def tick_evals~ -** Processing line: ~ state.evals ||= []~ -** Processing line: ~ if console.last_command && (console.last_command.start_with?("outputs.") || console.last_command.start_with?("state."))~ -** Processing line: ~ state.evals << console.last_command~ -** Processing line: ~ console.last_command = nil~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def wrapped_lines_recur word, rest, length, aggregate~ +- Inside source: true +*** True Line Result + def wrapped_lines_recur word, rest, length, aggregate +** Processing line: ~ if word.nil?~ +- Inside source: true +*** True Line Result + if word.nil? +** Processing line: ~ return aggregate~ +- Inside source: true +*** True Line Result + return aggregate +** Processing line: ~ elsif rest[0].nil?~ +- Inside source: true +*** True Line Result + elsif rest[0].nil? +** Processing line: ~ aggregate << word + "\n"~ +- Inside source: true +*** True Line Result + aggregate << word + "\n" +** Processing line: ~ return aggregate~ +- Inside source: true +*** True Line Result + return aggregate +** Processing line: ~ elsif (word + " " + rest[0]).length > length~ +- Inside source: true +*** True Line Result + elsif (word + " " + rest[0]).length > length +** Processing line: ~ aggregate << word + "\n"~ +- Inside source: true +*** True Line Result + aggregate << word + "\n" +** Processing line: ~ return wrapped_lines_recur rest[0], rest[1..-1], length, aggregate~ +- Inside source: true +*** True Line Result + return wrapped_lines_recur rest[0], rest[1..-1], length, aggregate +** Processing line: ~ elsif (word + " " + rest[0]).length <= length~ +- Inside source: true +*** True Line Result + elsif (word + " " + rest[0]).length <= length +** Processing line: ~ next_word = (word + " " + rest[0])~ +- Inside source: true +*** True Line Result + next_word = (word + " " + rest[0]) +** Processing line: ~ return wrapped_lines_recur next_word, rest[1..-1], length, aggregate~ +- Inside source: true +*** True Line Result + return wrapped_lines_recur next_word, rest[1..-1], length, aggregate +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ log <<-S~ +- Inside source: true +*** True Line Result + log <<-S +** Processing line: ~ WARNING:~ +- Inside source: true +*** True Line Result + WARNING: +** Processing line: ~ #{word} is too long to fit in length of #{length}.~ +- Inside source: true +*** True Line Result + #{word} is too long to fit in length of #{length}. ** Processing line: ~~ -** Processing line: ~ state.evals.each do |l|~ -** Processing line: ~ Kernel.eval l~ +- Inside source: true +*** True Line Result + +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ next_word = (word + " " + rest[0])~ +- Inside source: true +*** True Line Result + next_word = (word + " " + rest[0]) +** Processing line: ~ return wrapped_lines_recur next_word, rest[1..-1], length, aggregate~ +- Inside source: true +*** True Line Result + return wrapped_lines_recur next_word, rest[1..-1], length, aggregate +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ state.evals = state.evals[0..-2]~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ $tutorial_outputs ||= TutorialOutputs.new~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def end_with_bang?~ +- Inside source: true +*** True Line Result + def end_with_bang? +** Processing line: ~ self[-1] == "!"~ +- Inside source: true +*** True Line Result + self[-1] == "!" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ defaults~ -** Processing line: ~ console.show~ -** Processing line: ~ $tutorial_outputs.clear~ -** Processing line: ~ $tutorial_outputs.solids << [900, 37, 480, 700, 0, 0, 0, 255]~ -** Processing line: ~ $tutorial_outputs.borders << [900, 37, 380, 683, 255, 255, 255]~ -** Processing line: ~ tick_evals~ -** Processing line: ~ $tutorial_outputs.tick~ -** Processing line: ~ tick_intro~ -** Processing line: ~ tick_hello_dragonruby~ -** Processing line: ~ tick_reset_button~ -** Processing line: ~ tick_explain_solid~ -** Processing line: ~ tick_explain_solid_blue~ -** Processing line: ~ tick_reprint_on_error~ -** Processing line: ~ tick_explain_tick_count~ -** Processing line: ~ tick_explain_mod~ -** Processing line: ~ tick_explain_string_interpolation~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def without_ending_bang~ +- Inside source: true +*** True Line Result + def without_ending_bang +** Processing line: ~ return self unless end_with_bang?~ +- Inside source: true +*** True Line Result + return self unless end_with_bang? +** Processing line: ~ self[0..-2]~ +- Inside source: true +*** True Line Result + self[0..-2] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def console~ -** Processing line: ~ $gtk.console~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def wrapped_lines length~ +- Inside source: true +*** True Line Result + def wrapped_lines length +** Processing line: ~ self.each_line.map do |l|~ +- Inside source: true +*** True Line Result + self.each_line.map do |l| +** Processing line: ~ l = l.rstrip~ +- Inside source: true +*** True Line Result + l = l.rstrip +** Processing line: ~ if l.length < length~ +- Inside source: true +*** True Line Result + if l.length < length +** Processing line: ~ l + "\n"~ +- Inside source: true +*** True Line Result + l + "\n" +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ words = l.split ' '~ +- Inside source: true +*** True Line Result + words = l.split ' ' +** Processing line: ~ wrapped_lines_recur(words[0], words[1..-1], length, []).flatten~ +- Inside source: true +*** True Line Result + wrapped_lines_recur(words[0], words[1..-1], length, []).flatten +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end.flatten~ +- Inside source: true +*** True Line Result + end.flatten +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def queue_message message~ -** Processing line: ~ $gtk.args.state.messages ||= []~ -** Processing line: ~ return if $gtk.args.state.messages.include? message~ -** Processing line: ~ $gtk.args.state.messages << message~ -** Processing line: ~ last_three = [$gtk.console.log[-3], $gtk.console.log[-2], $gtk.console.log[-1]].reject_nil~ -** Processing line: ~ $gtk.console.log.clear~ -** Processing line: ~ puts seperator~ -** Processing line: ~ $gtk.console.log += last_three~ -** Processing line: ~ puts seperator~ -** Processing line: ~ puts message~ -** Processing line: ~ puts seperator~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def wrap length~ +- Inside source: true +*** True Line Result + def wrap length +** Processing line: ~ wrapped_lines(length).join.rstrip~ +- Inside source: true +*** True Line Result + wrapped_lines(length).join.rstrip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def console_has? message~ -** Processing line: ~ console.log.map(&:upcase).include? "#{message.upcase}\n"~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def multiline?~ +- Inside source: true +*** True Line Result + def multiline? +** Processing line: ~ include? "\n"~ +- Inside source: true +*** True Line Result + include? "\n" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def restart_tutorial~ -** Processing line: ~ $tutorial_outputs.clear~ -** Processing line: ~ $gtk.console.log.clear~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ puts "Starting the tutorial over!"~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def indent_lines amount, char = " "~ +- Inside source: true +*** True Line Result + def indent_lines amount, char = " " +** Processing line: ~ self.each_line.each_with_index.map do |l, i|~ +- Inside source: true +*** True Line Result + self.each_line.each_with_index.map do |l, i| +** Processing line: ~ if i == 0~ +- Inside source: true +*** True Line Result + if i == 0 +** Processing line: ~ l~ +- Inside source: true +*** True Line Result + l +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ char * amount + l~ +- Inside source: true +*** True Line Result + char * amount + l +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end.join~ +- Inside source: true +*** True Line Result + end.join +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def state~ -** Processing line: ~ $gtk.args.state~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def quote~ +- Inside source: true +*** True Line Result + def quote +** Processing line: ~ "\"#{self}\""~ +- Inside source: true +*** True Line Result + "\"#{self}\"" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def inputs~ -** Processing line: ~ $gtk.args.inputs~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def trim~ +- Inside source: true +*** True Line Result + def trim +** Processing line: ~ strip~ +- Inside source: true +*** True Line Result + strip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def outputs~ -** Processing line: ~ $tutorial_outputs~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def trim!~ +- Inside source: true +*** True Line Result + def trim! +** Processing line: ~ strip!~ +- Inside source: true +*** True Line Result + strip! +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ def ltrim~ +- Inside source: true +*** True Line Result + def ltrim +** Processing line: ~ lstrip~ +- Inside source: true +*** True Line Result + lstrip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def ltrim!~ +- Inside source: true +*** True Line Result + def ltrim! +** Processing line: ~ lstrip!~ +- Inside source: true +*** True Line Result + lstrip! +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb~ -- H1 detected. -- Formatting line: ~00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Inside source: true +*** True Line Result + +** Processing line: ~ def rtrim~ +- Inside source: true +*** True Line Result + def rtrim +** Processing line: ~ rstrip~ +- Inside source: true +*** True Line Result + rstrip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def rtrim!~ +- Inside source: true +*** True Line Result + def rtrim! +** Processing line: ~ rstrip!~ +- Inside source: true +*** True Line Result + rstrip! +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb~ -- H1 detected. -- Formatting line: ~00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* tests.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* tests.rb ** Processing line: ~#+begin_src ruby~ -- PRE start detected. +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/tests.rb~ +- Inside source: true +*** True Line Result + # ./dragon/tests.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # tests.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # tests.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ class Tests~ +- Inside source: true +*** True Line Result + class Tests +** Processing line: ~ attr_accessor :failed, :passed, :inconclusive~ +- Inside source: true +*** True Line Result + attr_accessor :failed, :passed, :inconclusive ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize~ +- Inside source: true +*** True Line Result + def initialize +** Processing line: ~ @failed = []~ +- Inside source: true +*** True Line Result + @failed = [] +** Processing line: ~ @passed = []~ +- Inside source: true +*** True Line Result + @passed = [] +** Processing line: ~ @inconclusive = []~ +- Inside source: true +*** True Line Result + @inconclusive = [] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~* 01_rendering_basics/01_labels/app/main.rb~ -- H1 detected. -- Formatting line: ~01_rendering_basics/01_labels/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. Values in this array generate labels~ -** Processing line: ~ the screen.~ -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ -** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ -** Processing line: ~ by adding or subracting.~ -** Processing line: ~~ -** Processing line: ~ =end~ -** Processing line: ~~ -** Processing line: ~ # Labels are used to represent text elements in DragonRuby~ -** Processing line: ~~ -** Processing line: ~ # An example of creating a label is:~ -** Processing line: ~ # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ -** Processing line: ~~ -** Processing line: ~ # The code above does the following:~ -** Processing line: ~ # 1. GET the place where labels go: args.outputs.labels~ -** Processing line: ~ # 2. Request a new LABEL be ADDED: <<~ -** Processing line: ~ # 3. The DEFINITION of a SOLID is the ARRAY:~ -** Processing line: ~ # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ -** Processing line: ~ # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~ # The tick method is called by DragonRuby every frame~ -** Processing line: ~ # args contains all the information regarding the game.~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays."~ -** Processing line: ~ # Here are some examples of simple labels, with the minimum number of parameters~ -** Processing line: ~ # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font~ -** Processing line: ~ args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def run_test m~ +- Inside source: true +*** True Line Result + def run_test m +** Processing line: ~ args = Args.new $gtk, nil~ +- Inside source: true +*** True Line Result + args = Args.new $gtk, nil +** Processing line: ~ assert = Assert.new~ +- Inside source: true +*** True Line Result + assert = Assert.new +** Processing line: ~ begin~ +- Inside source: true +*** True Line Result + begin +** Processing line: ~ log_test_running m~ +- Inside source: true +*** True Line Result + log_test_running m +** Processing line: ~ send(m, args, assert)~ +- Inside source: true +*** True Line Result + send(m, args, assert) +** Processing line: ~ if !assert.assertion_performed~ +- Inside source: true +*** True Line Result + if !assert.assertion_performed +** Processing line: ~ log_inconclusive m~ +- Inside source: true +*** True Line Result + log_inconclusive m +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ log_passed m~ +- Inside source: true +*** True Line Result + log_passed m +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ if test_signature_invalid_exception? e, m~ +- Inside source: true +*** True Line Result + if test_signature_invalid_exception? e, m +** Processing line: ~ log_test_signature_incorrect m~ +- Inside source: true +*** True Line Result + log_test_signature_incorrect m +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ mark_test_failed m, e~ +- Inside source: true +*** True Line Result + mark_test_failed m, e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."]~ -** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ -** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."]~ -** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_methods_focused~ +- Inside source: true +*** True Line Result + def test_methods_focused +** Processing line: ~ Object.methods.find_all { |m| m.start_with?( "focus_test_") }~ +- Inside source: true +*** True Line Result + Object.methods.find_all { |m| m.start_with?( "focus_test_") } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Demonstration of the Size Parameter~ -** Processing line: ~ args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2]~ -** Processing line: ~ args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1]~ -** Processing line: ~ args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0]~ -** Processing line: ~ args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1]~ -** Processing line: ~ args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_methods~ +- Inside source: true +*** True Line Result + def test_methods +** Processing line: ~ Object.methods.find_all { |m| m.start_with? "test_" }~ +- Inside source: true +*** True Line Result + Object.methods.find_all { |m| m.start_with? "test_" } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Demonstration of the Align Parameter~ -** Processing line: ~ args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2]~ -** Processing line: ~ args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1]~ -** Processing line: ~ args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def start~ +- Inside source: true +*** True Line Result + def start +** Processing line: ~ log "* TEST: gtk.test.start has been invoked."~ +- Inside source: true +*** True Line Result + log "* TEST: gtk.test.start has been invoked." +** Processing line: ~ if test_methods_focused.length != 0~ +- Inside source: true +*** True Line Result + if test_methods_focused.length != 0 +** Processing line: ~ @is_running = true~ +- Inside source: true +*** True Line Result + @is_running = true +** Processing line: ~ test_methods_focused.each { |m| run_test m }~ +- Inside source: true +*** True Line Result + test_methods_focused.each { |m| run_test m } +** Processing line: ~ print_summary~ +- Inside source: true +*** True Line Result + print_summary +** Processing line: ~ @is_running = false~ +- Inside source: true +*** True Line Result + @is_running = false +** Processing line: ~ elsif test_methods.length == 0~ +- Inside source: true +*** True Line Result + elsif test_methods.length == 0 +** Processing line: ~ log_no_tests_found~ +- Inside source: true +*** True Line Result + log_no_tests_found +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ @is_running = true~ +- Inside source: true +*** True Line Result + @is_running = true +** Processing line: ~ test_methods.each { |m| run_test m }~ +- Inside source: true +*** True Line Result + test_methods.each { |m| run_test m } +** Processing line: ~ print_summary~ +- Inside source: true +*** True Line Result + print_summary +** Processing line: ~ @is_running = false~ +- Inside source: true +*** True Line Result + @is_running = false +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Demonstration of the RGBA parameters~ -** Processing line: ~ args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0]~ -** Processing line: ~ args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0]~ -** Processing line: ~ args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255]~ -** Processing line: ~ args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def mark_test_failed m, e~ +- Inside source: true +*** True Line Result + def mark_test_failed m, e +** Processing line: ~ message = "Failed."~ +- Inside source: true +*** True Line Result + message = "Failed." +** Processing line: ~ self.failed << { m: m, e: e }~ +- Inside source: true +*** True Line Result + self.failed << { m: m, e: e } +** Processing line: ~ log message~ +- Inside source: true +*** True Line Result + log message +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Demonstration of the Font parameter~ -** Processing line: ~ # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is~ -** Processing line: ~ args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ]~ -** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ -** Processing line: ~ y: 330 - 50,~ -** Processing line: ~ text: "Custom font (Hash)",~ -** Processing line: ~ size_enum: 0,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 125,~ -** Processing line: ~ g: 0,~ -** Processing line: ~ b: 200,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: "manaspc.ttf" }.label~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def running?~ +- Inside source: true +*** True Line Result + def running? +** Processing line: ~ @is_running~ +- Inside source: true +*** True Line Result + @is_running +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Primitives can hold anything, and can be given a label in the following forms~ -** Processing line: ~ args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_inconclusive m~ +- Inside source: true +*** True Line Result + def log_inconclusive m +** Processing line: ~ self.inconclusive << {m: m}~ +- Inside source: true +*** True Line Result + self.inconclusive << {m: m} +** Processing line: ~ log "Inconclusive."~ +- Inside source: true +*** True Line Result + log "Inconclusive." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ -** Processing line: ~ y: 330 - 110,~ -** Processing line: ~ text: "Custom font (.primitives Hash)",~ -** Processing line: ~ size_enum: 0,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 125,~ -** Processing line: ~ g: 0,~ -** Processing line: ~ b: 200,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: "manaspc.ttf" }.label~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_passed m~ +- Inside source: true +*** True Line Result + def log_passed m +** Processing line: ~ self.passed << {m: m}~ +- Inside source: true +*** True Line Result + self.passed << {m: m} +** Processing line: ~ log "Passed."~ +- Inside source: true +*** True Line Result + log "Passed." +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_no_tests_found~ +- Inside source: true +*** True Line Result + def log_no_tests_found +** Processing line: ~ log <<-S~ +- Inside source: true +*** True Line Result + log <<-S +** Processing line: ~ No tests were found. To create a test. Define a method~ +- Inside source: true +*** True Line Result + No tests were found. To create a test. Define a method +** Processing line: ~ that begins with test_. For example:~ +- Inside source: true +*** True Line Result + that begins with test_. For example: +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ def test_game_over args, assert~ +- Inside source: true +*** True Line Result + def test_game_over args, assert ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 01_rendering_basics/02_lines/app/main.rb~ -- H1 detected. -- Formatting line: ~01_rendering_basics/02_lines/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.lines: An array. Values in this array generate lines on~ -** Processing line: ~ the screen.~ -** Processing line: ~ - args.state.tick_count: This property contains an integer value that~ -** Processing line: ~ represents the current frame. GTK renders at 60 FPS. A value of 0~ -** Processing line: ~ for args.state.tick_count represents the initial load of the game.~ -** Processing line: ~~ -** Processing line: ~ =end~ -** Processing line: ~~ -** Processing line: ~ # The parameters required for lines are:~ -** Processing line: ~ # 1. The initial point (x, y)~ -** Processing line: ~ # 2. The end point (x2, y2)~ -** Processing line: ~ # 3. The rgba values for the color and transparency (r, g, b, a)~ -** Processing line: ~~ -** Processing line: ~ # An example of creating a line would be:~ -** Processing line: ~ # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255]~ -** Processing line: ~~ -** Processing line: ~ # This would create a line from (100, 100) to (300, 300)~ -** Processing line: ~ # The RGB code (255, 0, 255) would determine its color, a purple~ -** Processing line: ~ # It would have an Alpha value of 255, making it completely opaque~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to create lines."~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_test_running m~ +- Inside source: true +*** True Line Result + def log_test_running m +** Processing line: ~ log "** Running: #{m}"~ +- Inside source: true +*** True Line Result + log "** Running: #{m}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def test_signature_invalid_exception? e, m~ +- Inside source: true +*** True Line Result + def test_signature_invalid_exception? e, m +** Processing line: ~ e.to_s.include?(m.to_s) && e.to_s.include?("wrong number of arguments")~ +- Inside source: true +*** True Line Result + e.to_s.include?(m.to_s) && e.to_s.include?("wrong number of arguments") +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Some simple lines~ -** Processing line: ~ args.outputs.lines << [380, 450, 675, 450]~ -** Processing line: ~ args.outputs.lines << [380, 410, 875, 410]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def log_test_signature_incorrect m~ +- Inside source: true +*** True Line Result + def log_test_signature_incorrect m +** Processing line: ~ log "TEST METHOD INVALID:", <<-S~ +- Inside source: true +*** True Line Result + log "TEST METHOD INVALID:", <<-S +** Processing line: ~ I found a test method called :#{m}. But it needs to have~ +- Inside source: true +*** True Line Result + I found a test method called :#{m}. But it needs to have +** Processing line: ~ the following method signature:~ +- Inside source: true +*** True Line Result + the following method signature: +** Processing line: ~ #+begin_src~ +- Inside source: true +*** True Line Result + #+begin_src +** Processing line: ~ def #{m} args, assert~ +- Inside source: true +*** True Line Result + def #{m} args, assert ** Processing line: ~~ -** Processing line: ~ # These examples utilize args.state.tick_count to change the length of the lines over time~ -** Processing line: ~ # args.state.tick_count is the ticks that have occurred in the game~ -** Processing line: ~ # This is accomplished by making either the starting or ending point based on the args.state.tick_count~ -** Processing line: ~ args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255]~ -** Processing line: ~ args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255]~ -** Processing line: ~ args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255]~ +- Inside source: true +*** True Line Result + ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ #+end_src~ +- Inside source: true +*** True Line Result + #+end_src +** Processing line: ~ Please update the method signature to match the code above. If you~ +- Inside source: true +*** True Line Result + Please update the method signature to match the code above. If you +** Processing line: ~ did not intend this to be a test method. Rename the method so it does~ +- Inside source: true +*** True Line Result + did not intend this to be a test method. Rename the method so it does +** Processing line: ~ not start with "test_".~ +- Inside source: true +*** True Line Result + not start with "test_". +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def print_summary~ +- Inside source: true +*** True Line Result + def print_summary +** Processing line: ~ log "** Summary"~ +- Inside source: true +*** True Line Result + log "** Summary" +** Processing line: ~ log "*** Passed"~ +- Inside source: true +*** True Line Result + log "*** Passed" +** Processing line: ~ log "#{self.passed.length} test(s) passed."~ +- Inside source: true +*** True Line Result + log "#{self.passed.length} test(s) passed." +** Processing line: ~ self.passed.each { |h| log "**** :#{h[:m]}" }~ +- Inside source: true +*** True Line Result + self.passed.each { |h| log "**** :#{h[:m]}" } +** Processing line: ~ log "*** Inconclusive"~ +- Inside source: true +*** True Line Result + log "*** Inconclusive" +** Processing line: ~ if self.inconclusive.length > 0~ +- Inside source: true +*** True Line Result + if self.inconclusive.length > 0 +** Processing line: ~ log_once :assertion_ok_note, <<-S~ +- Inside source: true +*** True Line Result + log_once :assertion_ok_note, <<-S +** Processing line: ~ NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test.~ +- Inside source: true +*** True Line Result + NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test. +** Processing line: ~ Add assert.ok! at the end of the test if you are using your own assertions.~ +- Inside source: true +*** True Line Result + Add assert.ok! at the end of the test if you are using your own assertions. +** Processing line: ~ S~ +- Inside source: true +*** True Line Result + S +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ log "#{self.inconclusive.length} test(s) inconclusive."~ +- Inside source: true +*** True Line Result + log "#{self.inconclusive.length} test(s) inconclusive." +** Processing line: ~ self.inconclusive.each { |h| log "**** :#{h[:m]}" }~ +- Inside source: true +*** True Line Result + self.inconclusive.each { |h| log "**** :#{h[:m]}" } +** Processing line: ~ log "*** Failed"~ +- Inside source: true +*** True Line Result + log "*** Failed" +** Processing line: ~ log "#{self.failed.length} test(s) failed."~ +- Inside source: true +*** True Line Result + log "#{self.failed.length} test(s) failed." +** Processing line: ~ self.failed.each do |h|~ +- Inside source: true +*** True Line Result + self.failed.each do |h| +** Processing line: ~ log "**** Test name: :#{h[:m]}"~ +- Inside source: true +*** True Line Result + log "**** Test name: :#{h[:m]}" +** Processing line: ~ log "#{h[:e].to_s.gsub("* ERROR:", "").strip}"~ +- Inside source: true +*** True Line Result + log "#{h[:e].to_s.gsub("* ERROR:", "").strip}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 01_rendering_basics/03_solids_borders/app/main.rb~ -- H1 detected. -- Formatting line: ~01_rendering_basics/03_solids_borders/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +- Line was identified as the end of a code block. +*** True Line Result +#+end_src ** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* trace.rb~ +- Header detected. +*** True Line Result + +*** True Line Result +* trace.rb ** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. Values in this array generate~ -** Processing line: ~ solid/filled rectangles on the screen.~ -** Processing line: ~~ -** Processing line: ~ =end~ -** Processing line: ~~ -** Processing line: ~ # Rects are outputted in DragonRuby as rectangles~ -** Processing line: ~ # If filled in, they are solids~ -** Processing line: ~ # If hollow, they are borders~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # ./dragon/trace.rb~ +- Inside source: true +*** True Line Result + # ./dragon/trace.rb +** Processing line: ~ # coding: utf-8~ +- Inside source: true +*** True Line Result + # coding: utf-8 +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +- Inside source: true +*** True Line Result + # Copyright 2019 DragonRuby LLC +** Processing line: ~ # MIT License~ +- Inside source: true +*** True Line Result + # MIT License +** Processing line: ~ # trace.rb has been released under MIT (*only this file*).~ +- Inside source: true +*** True Line Result + # trace.rb has been released under MIT (*only this file*). ** Processing line: ~~ -** Processing line: ~ # Solids are added to args.outputs.solids~ -** Processing line: ~ # Borders are added to args.outputs.borders~ +- Inside source: true +*** True Line Result + +** Processing line: ~ module GTK~ +- Inside source: true +*** True Line Result + module GTK +** Processing line: ~ module Trace~ +- Inside source: true +*** True Line Result + module Trace +** Processing line: ~ IGNORED_METHODS = [~ +- Inside source: true +*** True Line Result + IGNORED_METHODS = [ +** Processing line: ~ :define_singleton_method, :raise_immediately, :instance_of?,~ +- Inside source: true +*** True Line Result + :define_singleton_method, :raise_immediately, :instance_of?, +** Processing line: ~ :raise_with_caller, :initialize_copy, :class_defined?,~ +- Inside source: true +*** True Line Result + :raise_with_caller, :initialize_copy, :class_defined?, +** Processing line: ~ :instance_variable_get, :format, :purge_class, :instance_variable_defined?,~ +- Inside source: true +*** True Line Result + :instance_variable_get, :format, :purge_class, :instance_variable_defined?, +** Processing line: ~ :metadata_object_id, :instance_variable_set, :__printstr__,~ +- Inside source: true +*** True Line Result + :metadata_object_id, :instance_variable_set, :__printstr__, +** Processing line: ~ :instance_variables, :is_a?, :p, :kind_of?, :==, :log_once,~ +- Inside source: true +*** True Line Result + :instance_variables, :is_a?, :p, :kind_of?, :==, :log_once, +** Processing line: ~ :protected_methods, :log_once_info, :private_methods, :open,~ +- Inside source: true +*** True Line Result + :protected_methods, :log_once_info, :private_methods, :open, +** Processing line: ~ :!=, :initialize, :object_id, :Hash, :methods, :tick, :!,~ +- Inside source: true +*** True Line Result + :!=, :initialize, :object_id, :Hash, :methods, :tick, :!, +** Processing line: ~ :respond_to?, :yield_self, :send, :instance_eval, :then,~ +- Inside source: true +*** True Line Result + :respond_to?, :yield_self, :send, :instance_eval, :then, +** Processing line: ~ :__method__, :__send__, :log_print, :dig, :itself, :log_info,~ +- Inside source: true +*** True Line Result + :__method__, :__send__, :log_print, :dig, :itself, :log_info, +** Processing line: ~ :remove_instance_variable, :raise, :public_methods, :instance_exec,~ +- Inside source: true +*** True Line Result + :remove_instance_variable, :raise, :public_methods, :instance_exec, +** Processing line: ~ :gets, :local_variables, :tap, :__id__, :class, :singleton_class,~ +- Inside source: true +*** True Line Result + :gets, :local_variables, :tap, :__id__, :class, :singleton_class, +** Processing line: ~ :block_given?, :_inspect, :puts, :global_variables, :getc, :iterator?,~ +- Inside source: true +*** True Line Result + :block_given?, :_inspect, :puts, :global_variables, :getc, :iterator?, +** Processing line: ~ :hash, :to_enum, :printf, :frozen?, :print, :original_puts,~ +- Inside source: true +*** True Line Result + :hash, :to_enum, :printf, :frozen?, :print, :original_puts, +** Processing line: ~ :srand, :freeze, :rand, :extend, :eql?, :equal?, :sprintf, :clone,~ +- Inside source: true +*** True Line Result + :srand, :freeze, :rand, :extend, :eql?, :equal?, :sprintf, :clone, +** Processing line: ~ :dup, :to_s, :primitive_determined?, :inspect, :primitive?, :help,~ +- Inside source: true +*** True Line Result + :dup, :to_s, :primitive_determined?, :inspect, :primitive?, :help, +** Processing line: ~ :__object_methods__, :proc, :__custom_object_methods__, :Float, :enum_for,~ +- Inside source: true +*** True Line Result + :__object_methods__, :proc, :__custom_object_methods__, :Float, :enum_for, +** Processing line: ~ :__supports_ivars__?, :nil?, :fast_rand, :or, :and,~ +- Inside source: true +*** True Line Result + :__supports_ivars__?, :nil?, :fast_rand, :or, :and, +** Processing line: ~ :__caller_without_noise__, :__gtk_ruby_string_contains_source_file_path__?,~ +- Inside source: true +*** True Line Result + :__caller_without_noise__, :__gtk_ruby_string_contains_source_file_path__?, +** Processing line: ~ :__pretty_print_exception__, :__gtk_ruby_source_files__,~ +- Inside source: true +*** True Line Result + :__pretty_print_exception__, :__gtk_ruby_source_files__, +** Processing line: ~ :String, :log, :Array, :putsc, :Integer, :===, :here,~ +- Inside source: true +*** True Line Result + :String, :log, :Array, :putsc, :Integer, :===, :here, +** Processing line: ~ :raise_error_with_kind_of_okay_message, :better_instance_information,~ +- Inside source: true +*** True Line Result + :raise_error_with_kind_of_okay_message, :better_instance_information, +** Processing line: ~ :lambda, :fail, :method_missing, :__case_eqq, :caller,~ +- Inside source: true +*** True Line Result + :lambda, :fail, :method_missing, :__case_eqq, :caller, +** Processing line: ~ :raise_method_missing_better_error, :require, :singleton_methods,~ +- Inside source: true +*** True Line Result + :raise_method_missing_better_error, :require, :singleton_methods, +** Processing line: ~ :!~, :loop, :numeric_or_default, :`, :state, :inputs, :outputs, "args=".to_sym,~ +- Inside source: true +*** True Line Result + :!~, :loop, :numeric_or_default, :`, :state, :inputs, :outputs, "args=".to_sym, +** Processing line: ~ :grid, :gtk, :dragon, :args, :passes, :tick, :grep_source, :grep_source_file,~ +- Inside source: true +*** True Line Result + :grid, :gtk, :dragon, :args, :passes, :tick, :grep_source, :grep_source_file, +** Processing line: ~ :numeric_or_default, :f_or_default, :s_or_default, :i_or_default,~ +- Inside source: true +*** True Line Result + :numeric_or_default, :f_or_default, :s_or_default, :i_or_default, +** Processing line: ~ :comment, :primitive_marker, :xrepl, :repl~ +- Inside source: true +*** True Line Result + :comment, :primitive_marker, :xrepl, :repl +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] ** Processing line: ~~ -** Processing line: ~ # The parameters required for rects are:~ -** Processing line: ~ # 1. The upper right corner (x, y)~ -** Processing line: ~ # 2. The width (w)~ -** Processing line: ~ # 3. The height (h)~ -** Processing line: ~ # 4. The rgba values for the color and transparency (r, g, b, a)~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.traced_classes~ +- Inside source: true +*** True Line Result + def self.traced_classes +** Processing line: ~ @traced_classes ||= []~ +- Inside source: true +*** True Line Result + @traced_classes ||= [] +** Processing line: ~ @traced_classes~ +- Inside source: true +*** True Line Result + @traced_classes +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Here is an example of a rect definition:~ -** Processing line: ~ # [100, 100, 400, 500, 0, 255, 0, 180]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.mark_class_as_traced! klass~ +- Inside source: true +*** True Line Result + def self.mark_class_as_traced! klass +** Processing line: ~ @traced_classes << klass~ +- Inside source: true +*** True Line Result + @traced_classes << klass +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # The example would create a rect from (100, 100)~ -** Processing line: ~ # Extending 400 pixels across the x axis~ -** Processing line: ~ # and 500 pixels across the y axis~ -** Processing line: ~ # The rect would be green (0, 255, 0)~ -** Processing line: ~ # and mostly opaque with some transparency (180)~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.untrace_classes!~ +- Inside source: true +*** True Line Result + def self.untrace_classes! +** Processing line: ~ traced_classes.each do |klass|~ +- Inside source: true +*** True Line Result + traced_classes.each do |klass| +** Processing line: ~ klass.class_eval do~ +- Inside source: true +*** True Line Result + klass.class_eval do +** Processing line: ~ all_methods = klass.instance_methods false~ +- Inside source: true +*** True Line Result + all_methods = klass.instance_methods false +** Processing line: ~ if klass.instance_methods.respond_to?(:__trace_call_depth__)~ +- Inside source: true +*** True Line Result + if klass.instance_methods.respond_to?(:__trace_call_depth__) +** Processing line: ~ undef_method :__trace_call_depth__~ +- Inside source: true +*** True Line Result + undef_method :__trace_call_depth__ +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ # Whether the rect would be filled or not depends on if~ -** Processing line: ~ # it is added to args.outputs.solids or args.outputs.borders~ +- Inside source: true +*** True Line Result + +** Processing line: ~ GTK::Trace.filter_methods_to_trace(all_methods).each do |m|~ +- Inside source: true +*** True Line Result + GTK::Trace.filter_methods_to_trace(all_methods).each do |m| +** Processing line: ~ original_method_name = m~ +- Inside source: true +*** True Line Result + original_method_name = m +** Processing line: ~ trace_method_name = GTK::Trace.trace_method_name_for m~ +- Inside source: true +*** True Line Result + trace_method_name = GTK::Trace.trace_method_name_for m +** Processing line: ~ if klass.instance_methods.include? trace_method_name~ +- Inside source: true +*** True Line Result + if klass.instance_methods.include? trace_method_name +** Processing line: ~ alias_method m, trace_method_name~ +- Inside source: true +*** True Line Result + alias_method m, trace_method_name +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ $last_method_traced = nil~ +- Inside source: true +*** True Line Result + $last_method_traced = nil +** Processing line: ~ @traced_classes.clear~ +- Inside source: true +*** True Line Result + @traced_classes.clear +** Processing line: ~ $trace_enabled = false~ +- Inside source: true +*** True Line Result + $trace_enabled = false +** Processing line: ~ if !$gtk.production~ +- Inside source: true +*** True Line Result + if !$gtk.production +** Processing line: ~ $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"~ +- Inside source: true +*** True Line Result + $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.trace_method_name_for m~ +- Inside source: true +*** True Line Result + def self.trace_method_name_for m +** Processing line: ~ "__trace_original_#{m}__".to_sym~ +- Inside source: true +*** True Line Result + "__trace_original_#{m}__".to_sym +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to create solid squares."~ -** Processing line: ~ args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"]~ -** Processing line: ~ args.outputs.solids << [470, 520, 50, 50]~ -** Processing line: ~ args.outputs.solids << [530, 520, 50, 50, 0, 0, 0]~ -** Processing line: ~ args.outputs.solids << [590, 520, 50, 50, 255, 0, 0]~ -** Processing line: ~ args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128]~ -** Processing line: ~ args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.original_method_name_for m~ +- Inside source: true +*** True Line Result + def self.original_method_name_for m +** Processing line: ~ return m unless m.to_s.start_with?("__trace_original_") && m.to_s.end_with?("__")~ +- Inside source: true +*** True Line Result + return m unless m.to_s.start_with?("__trace_original_") && m.to_s.end_with?("__") +** Processing line: ~ m[16..-3]~ +- Inside source: true +*** True Line Result + m[16..-3] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.filter_methods_to_trace methods~ +- Inside source: true +*** True Line Result + def self.filter_methods_to_trace methods +** Processing line: ~ methods.reject { |m| m.start_with? "__trace_" }.reject { |m| IGNORED_METHODS.include? m }~ +- Inside source: true +*** True Line Result + methods.reject { |m| m.start_with? "__trace_" }.reject { |m| IGNORED_METHODS.include? m } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"]~ -** Processing line: ~ args.outputs.borders << [470, 320, 50, 50]~ -** Processing line: ~ args.outputs.borders << [530, 320, 50, 50, 0, 0, 0]~ -** Processing line: ~ args.outputs.borders << [590, 320, 50, 50, 255, 0, 0]~ -** Processing line: ~ args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128]~ -** Processing line: ~ args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ -** Processing line: ~ end~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def self.flush_trace pad_with_newline = false~ +- Inside source: true +*** True Line Result + def self.flush_trace pad_with_newline = false +** Processing line: ~ $trace_puts ||= []~ +- Inside source: true +*** True Line Result + $trace_puts ||= [] +** Processing line: ~ if $trace_puts.length > 0~ +- Inside source: true +*** True Line Result + if $trace_puts.length > 0 +** Processing line: ~ text = $trace_puts.join("")~ +- Inside source: true +*** True Line Result + text = $trace_puts.join("") +** Processing line: ~ if pad_with_newline~ +- Inside source: true +*** True Line Result + if pad_with_newline +** Processing line: ~ $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip~ +- Inside source: true +*** True Line Result + $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ $gtk.append_file_root 'logs/trace.txt', text.strip~ +- Inside source: true +*** True Line Result + $gtk.append_file_root 'logs/trace.txt', text.strip +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ $trace_puts.clear~ +- Inside source: true +*** True Line Result + $trace_puts.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # @gtk~ +- Inside source: true +*** True Line Result + # @gtk +** Processing line: ~ def self.trace! instance = nil~ +- Inside source: true +*** True Line Result + def self.trace! instance = nil +** Processing line: ~ $trace_history ||= []~ +- Inside source: true +*** True Line Result + $trace_history ||= [] +** Processing line: ~ $trace_enabled = true~ +- Inside source: true +*** True Line Result + $trace_enabled = true +** Processing line: ~ $trace_call_depth ||=0~ +- Inside source: true +*** True Line Result + $trace_call_depth ||=0 +** Processing line: ~ flush_trace~ +- Inside source: true +*** True Line Result + flush_trace +** Processing line: ~ instance = $top_level unless instance~ +- Inside source: true +*** True Line Result + instance = $top_level unless instance +** Processing line: ~ return if Trace.traced_classes.include? instance.class~ +- Inside source: true +*** True Line Result + return if Trace.traced_classes.include? instance.class +** Processing line: ~ all_methods = instance.class.instance_methods false~ +- Inside source: true +*** True Line Result + all_methods = instance.class.instance_methods false +** Processing line: ~ instance.class.class_eval do~ +- Inside source: true +*** True Line Result + instance.class.class_eval do +** Processing line: ~ attr_accessor :__trace_call_depth__ unless instance.class.instance_methods.include?(:__trace_call_depth__)~ +- Inside source: true +*** True Line Result + attr_accessor :__trace_call_depth__ unless instance.class.instance_methods.include?(:__trace_call_depth__) +** Processing line: ~ GTK::Trace.filter_methods_to_trace(all_methods).each do |m|~ +- Inside source: true +*** True Line Result + GTK::Trace.filter_methods_to_trace(all_methods).each do |m| +** Processing line: ~ original_method_name = m~ +- Inside source: true +*** True Line Result + original_method_name = m +** Processing line: ~ trace_method_name = GTK::Trace.trace_method_name_for m~ +- Inside source: true +*** True Line Result + trace_method_name = GTK::Trace.trace_method_name_for m +** Processing line: ~ alias_method trace_method_name, m~ +- Inside source: true +*** True Line Result + alias_method trace_method_name, m +** Processing line: ~ $trace_puts << "Tracing #{m} on #{instance.class}.\n"~ +- Inside source: true +*** True Line Result + $trace_puts << "Tracing #{m} on #{instance.class}.\n" +** Processing line: ~ define_method(m) do |*args|~ +- Inside source: true +*** True Line Result + define_method(m) do |*args| +** Processing line: ~ instance.__trace_call_depth__ ||= 0~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ ||= 0 +** Processing line: ~ tab_width = " " * (instance.__trace_call_depth__ * 8)~ +- Inside source: true +*** True Line Result + tab_width = " " * (instance.__trace_call_depth__ * 8) +** Processing line: ~ instance.__trace_call_depth__ += 1~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ += 1 +** Processing line: ~ $trace_call_depth = instance.__trace_call_depth__~ +- Inside source: true +*** True Line Result + $trace_call_depth = instance.__trace_call_depth__ +** Processing line: ~ parameters = "#{args}"[1..-2]~ +- Inside source: true +*** True Line Result + parameters = "#{args}"[1..-2] +** Processing line: ~ $trace_puts << "\n #{tab_width}#{m}(#{parameters})"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n #{tab_width}#{m}(#{parameters})" +** Processing line: ~ execution_time = Time.new.to_i~ +- Inside source: true +*** True Line Result + execution_time = Time.new.to_i +** Processing line: ~ $last_method_traced = trace_method_name~ +- Inside source: true +*** True Line Result + $last_method_traced = trace_method_name +** Processing line: ~ $trace_history << [m, parameters]~ +- Inside source: true +*** True Line Result + $trace_history << [m, parameters] +** Processing line: ~ result = send(trace_method_name, *args)~ +- Inside source: true +*** True Line Result + result = send(trace_method_name, *args) +** Processing line: ~ completion_time = Time.new.to_i~ +- Inside source: true +*** True Line Result + completion_time = Time.new.to_i +** Processing line: ~ instance.__trace_call_depth__ -= 1~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ -= 1 +** Processing line: ~ instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0 +** Processing line: ~ $trace_puts << "\n #{tab_width} success: #{m}"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n #{tab_width} success: #{m}" +** Processing line: ~ if instance.__trace_call_depth__ == 0~ +- Inside source: true +*** True Line Result + if instance.__trace_call_depth__ == 0 +** Processing line: ~ $trace_puts << "\n"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n" +** Processing line: ~ $trace_history.clear~ +- Inside source: true +*** True Line Result + $trace_history.clear +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ result~ +- Inside source: true +*** True Line Result + result +** Processing line: ~ rescue Exception => e~ +- Inside source: true +*** True Line Result + rescue Exception => e +** Processing line: ~ instance.__trace_call_depth__ -= 1~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ -= 1 +** Processing line: ~ instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0~ +- Inside source: true +*** True Line Result + instance.__trace_call_depth__ = instance.__trace_call_depth__.greater 0 +** Processing line: ~ $trace_puts << "\n #{tab_width} failed: #{m}"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n #{tab_width} failed: #{m}" +** Processing line: ~ if instance.__trace_call_depth__ == 0~ +- Inside source: true +*** True Line Result + if instance.__trace_call_depth__ == 0 +** Processing line: ~ $trace_puts << "\n #{tab_width} #{e}"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n #{tab_width} #{e}" +** Processing line: ~ $trace_puts << "\n"~ +- Inside source: true +*** True Line Result + $trace_puts << "\n" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ $trace_call_depth = 0~ +- Inside source: true +*** True Line Result + $trace_call_depth = 0 +** Processing line: ~ GTK::Trace.flush_trace true~ +- Inside source: true +*** True Line Result + GTK::Trace.flush_trace true +** Processing line: ~ raise e~ +- Inside source: true +*** True Line Result + raise e +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ mark_class_as_traced! instance.class~ +- Inside source: true +*** True Line Result + mark_class_as_traced! instance.class +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +- Inside source: true +*** True Line Result + end ** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end ** Processing line: ~~ +- Inside source: true +*** True Line Result + ** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 01_rendering_basics/04_sprites/app/main.rb~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +* Processing Html Given True Lines +** Processing line: ~* DragonRuby Game Toolkit Live Docs~ - H1 detected. -- Formatting line: ~01_rendering_basics/04_sprites/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DragonRuby Game Toolkit Live Docs~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate~ -** Processing line: ~ sprites on the screen. The location of the sprite is assumed to~ -** Processing line: ~ be under the mygame/ directory (the exception being dragonruby.png).~ -** Processing line: ~~ -** Processing line: ~ =end~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~ # For all other display outputs, Sprites are your solution~ -** Processing line: ~ # Sprites import images and display them with a certain rectangular area~ -** Processing line: ~ # The image can be of any usual format and should be located within the folder,~ -** Processing line: ~ # similar to additional fonts.~ -** Processing line: ~~ -** Processing line: ~ # Sprites have the following parameters~ -** Processing line: ~ # Rectangular area (x, y, width, height)~ -** Processing line: ~ # The image (path)~ -** Processing line: ~ # Rotation (angle)~ -** Processing line: ~ # Alpha (a)~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it."~ -** Processing line: ~ args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"]~ -** Processing line: ~ args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png']~ -** Processing line: ~ args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360]~ -** Processing line: ~ args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ +- Line's tilde count is: 1 +- Line contains link marker: false +** Processing line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") }~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ +** Processing line: ~[[docs_search.gif]]~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~[[docs_search.gif]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~* 01_rendering_basics/05_sounds/app/main.rb~ +** Processing line: ~* Hello World~ - H1 detected. -- Formatting line: ~01_rendering_basics/05_sounds/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Hello World~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs Listing that haven't been encountered in previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - sample: Chooses random element from array.~ -** Processing line: ~ In this sample app, the target note is set by taking a sample from the collection~ -** Processing line: ~ of available notes.~ +** Processing line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ Reminders:~ -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ +** Processing line: ~* Join the Discord and Subscribe to the News Letter~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Join the Discord and Subscribe to the News Letter~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ -** Processing line: ~ then define its properties.~ +** Processing line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~What game engine do you use?~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~What game engine do you use?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~Reply with:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Reply with:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~I am a Dragon Rider.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~I am a Dragon Rider.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. ** Processing line: ~~ -** Processing line: ~ - first: Returns the first element of an array.~ ** Processing line: ~~ -** Processing line: ~ - inside_rect: Returns true or false depending on if the point is inside the rect.~ +** Processing line: ~* Watch Some Intro Videos~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Watch Some Intro Videos~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - to_sym: Returns symbol corresponding to string. Will create a symbol if it does~ -** Processing line: ~ not already exist.~ +** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ +- OL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~ # This sample app allows users to test their musical skills by matching the piano sound that plays in each~ -** Processing line: ~ # level to the correct note.~ +** Processing line: ~* Getting Started Tutorial~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Getting Started Tutorial~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ input_mouse args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\""~ -** Processing line: ~ end~ +** Processing line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~ # Sets default values and creates empty collections~ -** Processing line: ~ # Initialization happens in the first frame only~ -** Processing line: ~ def defaults _~ -** Processing line: ~ _.state.notes ||= []~ -** Processing line: ~ _.state.click_feedbacks ||= []~ -** Processing line: ~ _.state.current_level ||= 1~ -** Processing line: ~ _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet~ -** Processing line: ~ end~ +** Processing line: ~** Introduction~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Introduction~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Introduction~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Uses a label to display current level, and shows the score~ -** Processing line: ~ # Creates a button to play the sample note, and displays the available notes that could be a potential match~ -** Processing line: ~ def render _~ -** Processing line: ~~ -** Processing line: ~ # grid.w_half positions the label in the horizontal center of the screen.~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0]~ -** Processing line: ~~ -** Processing line: ~ render_score _ # shows score on screen~ -** Processing line: ~~ -** Processing line: ~ if _.state.game_over # if game is over, a "play again" button is shown~ -** Processing line: ~ # Calculations ensure that Play Again label is displayed in center of border~ -** Processing line: ~ # Remove calculations from y parameters and see what happens to border and label placement~ -** Processing line: ~ _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label~ -** Processing line: ~ _.outputs.borders << _.state.play_again_border # outputs border~ -** Processing line: ~ else # otherwise, if game is not over~ -** Processing line: ~ # Calculations ensure that label appears in center of border~ -** Processing line: ~ _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label~ -** Processing line: ~ _.outputs.borders << _.state.play_note_border # outputs border~ -** Processing line: ~ end~ +** Processing line: ~Welcome!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Welcome!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here's just a little push to get you started if you're new to programming or game development.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here's just a little push to get you started if you're new to programming or game development.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ return if _.state.game_over # return if game is over~ +** Processing line: ~** Prerequisites~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Prerequisites~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Prerequisites~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label~ +** Processing line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Shows all of the available notes that can be potential matches.~ -** Processing line: ~ available_notes.each_with_index do |note, i|~ -** Processing line: ~ _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border)~ -** Processing line: ~ _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border~ -** Processing line: ~ _.outputs.borders << _.state.notes[i].border~ -** Processing line: ~ end~ +** Processing line: ~** The Game Loop~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~The Game Loop~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~The Game Loop~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Shows whether or not the user is correct by filling the screen with either red or green~ -** Processing line: ~ _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid }~ -** Processing line: ~ end~ +** Processing line: ~Ok, here are few rules with regards to game development with GTK:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Ok, here are few rules with regards to game development with GTK:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Shows the score (number of times the user guesses wrong) onto the screen using labels.~ -** Processing line: ~ def render_score _~ -** Processing line: ~ if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0]~ -** Processing line: ~ else # otherwise, number of times the user has guessed wrong is shown~ -** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~- Your game is all going to happen under one function ...~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Your game is all going to happen under one function ...~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- that runs 60 times a second ...~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~that runs 60 times a second ...~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- and has to tell the computer what to draw each time.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~and has to tell the computer what to draw each time.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That's an entire video game in one run-on sentence.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~That's an entire video game in one run-on sentence.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Sets the target note for the level and performs calculations on click_feedbacks.~ -** Processing line: ~ def calc _~ -** Processing line: ~ _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note~ -** Processing line: ~ _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely~ -** Processing line: ~ # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection~ -** Processing line: ~ _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 }~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Uses input from the user to play the target note, as well as the other notes that could be a potential match.~ -** Processing line: ~ def input_mouse _~ -** Processing line: ~ return unless _.inputs.mouse.click # return unless the mouse is clicked~ -** Processing line: ~~ -** Processing line: ~ # finds button that was clicked by user~ -** Processing line: ~ button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements~ -** Processing line: ~ _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of~ -** Processing line: ~ end.reject {|b| !_.state.meta(b)}.first # reject, return first element~ -** Processing line: ~~ -** Processing line: ~ return unless button_clicked # return unless button_clicked as a value (a button was clicked)~ -** Processing line: ~~ -** Processing line: ~ queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked~ -** Processing line: ~ button_clicked.x,~ -** Processing line: ~ button_clicked.y,~ -** Processing line: ~ button_clicked.w,~ -** Processing line: ~ button_clicked.h,~ -** Processing line: ~ 150, 100, 200 # sets color of button to shade of purple~ +** Processing line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed~ -** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output~ -** Processing line: ~ elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed~ -** Processing line: ~ _.state.target_note = nil # no target note~ -** Processing line: ~ _.state.current_level = 1 # starts at level 1 again~ -** Processing line: ~ _.state.times_wrong = 0 # starts off with 0 wrong guesses~ -** Processing line: ~ _.state.game_over = false # the game is not over (because it has just been restarted)~ -** Processing line: ~ else # otherwise if neither of those buttons were pressed~ -** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played~ -** Processing line: ~ if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note~ -** Processing line: ~ _.state.target_note = nil # target note is emptied~ +** Processing line: ~** Breakdown Of The ~tick~ Method~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Breakdown Of The ~tick~ Method~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Breakdown Of The ~tick~ Method~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if _.state.current_level < 9 # if game hasn't reached level 9~ -** Processing line: ~ _.state.current_level += 1 # game goes to next level~ -** Processing line: ~ else # otherwise, if game has reached level 9~ -** Processing line: ~ _.state.game_over = true # the game is over~ -** Processing line: ~ end~ +** Processing line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly~ -** Processing line: ~ else # otherwise, if clicked note is not target note~ -** Processing line: ~ _.state.times_wrong += 1 # increments times user guessed wrong~ -** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # This "def"ines a function, named "tick," which takes a single argument~ +** Processing line: ~ # named "args". DragonRuby looks for this function and calls it every~ +** Processing line: ~ # frame, 60 times a second. "args" is a magic structure with lots of~ +** Processing line: ~ # information in it. You can set variables in there for your own game state,~ +** Processing line: ~ # and every frame it will updated if keys are pressed, joysticks moved,~ +** Processing line: ~ # mice clicked, etc.~ +** Processing line: ~ def tick args~ ** Processing line: ~~ -** Processing line: ~ # Creates a collection of all of the available notes as symbols~ -** Processing line: ~ def available_notes~ -** Processing line: ~ [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]~ +** Processing line: ~ # One of the things in "args" is the "outputs" object that your game uses~ +** Processing line: ~ # to draw things. Afraid of rendering APIs? No problem. In DragonRuby,~ +** Processing line: ~ # you use arrays to draw things and we figure out the details.~ +** Processing line: ~ # If you want to draw text on the screen, you give it an array (the thing~ +** Processing line: ~ # in the [ brackets ]), with an X and Y coordinate and the text to draw.~ +** Processing line: ~ # The "<<" thing says "append this array onto the list of them at~ +** Processing line: ~ # args.outputs.labels)~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Creates buttons for each note, and sets a label (the note's name) and border for each note's button.~ -** Processing line: ~ def piano_button _, note, position~ -** Processing line: ~ _.state.new_entity(:button) do |b| # declares button as new entity~ -** Processing line: ~ b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition~ -** Processing line: ~ b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong~ -** Processing line: ~ # If a button is clicked, the inside of button is purple (see input_mouse method)~ -** Processing line: ~ # If correct note is clicked, screen turns green~ -** Processing line: ~ # If incorrect note is clicked, screen turns red (again, see input_mouse method)~ -** Processing line: ~ def queue_click_feedback _, x, y, w, h, *color~ -** Processing line: ~ _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity~ -** Processing line: ~ c.solid = [x, y, w, h, *color, 255] # sets color~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~** Rendering A Sprite~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering A Sprite~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering A Sprite~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~Now let's spice this up a little.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Now let's spice this up a little.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png']~ ** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ +** Processing line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Coordinate System and Virtual Canvas~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Coordinate System and Virtual Canvas~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Coordinate System and Virtual Canvas~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~* 02_input_basics/01_keyboard/app/main.rb~ -- H1 detected. -- Formatting line: ~02_input_basics/01_keyboard/app/main.rb~ +** Processing line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Ok, now we have an image on the screen, let's animate it:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Ok, now we have an image on the screen, let's animate it:~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.rotation ||= 0~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!' ]~ +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation]~ +** Processing line: ~ args.state.rotation -= 1~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ +** Processing line: ~Now you can see that this function is getting called a lot!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Now you can see that this function is getting called a lot!~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ -** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ -** Processing line: ~ to args.state.tick_count). Otherwise the value will be nil. For a~ -** Processing line: ~ full listing of keys, take a look at mygame/documentation/06-keyboard.md.~ -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ -** Processing line: ~ structure. You can define ANY property here with ANY type of~ -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ -** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ +** Processing line: ~** Game State~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Game State~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Game State~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Along with outputs, inputs are also an essential part of video game development~ -** Processing line: ~ # DragonRuby can take input from keyboards, mouse, and controllers.~ -** Processing line: ~ # This sample app will cover keyboard input.~ +** Processing line: ~~args.state~ is a place you can hang your own data. It's an open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of class.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.state~ is a place you can hang your own data. It's an open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of class.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed~ -** Processing line: ~ # This will work with the other keys as well~ +** Processing line: ~** There Is No Delta Time~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~There Is No Delta Time~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~There Is No Delta Time~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360~ -** Processing line: ~ # Notice how small_font accounts for all the remaining parameters~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ +** Processing line: ~** Handling User Input~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Handling User Input~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Handling User Input~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key~ -** Processing line: ~ if args.inputs.keyboard.key_up.h~ -** Processing line: ~ args.state.h_pressed_at = args.state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~Now, let's move that image around.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Now, let's move that image around.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false~ -** Processing line: ~ args.state.h_pressed_at ||= false~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.rotation ||= 0~ +** Processing line: ~ args.state.x ||= 576~ +** Processing line: ~ args.state.y ||= 100~ ** Processing line: ~~ -** Processing line: ~ if args.state.h_pressed_at~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.x = args.inputs.mouse.click.point.x - 64~ +** Processing line: ~ args.state.y = args.inputs.mouse.click.point.y - 50~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ tick_help_text args~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ # This method provides some values for the construction of labels~ -** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ -** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ -** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ args.outputs.sprites << [args.state.x,~ +** Processing line: ~ args.state.y,~ +** Processing line: ~ 128,~ +** Processing line: ~ 101,~ +** Processing line: ~ 'dragonruby.png',~ +** Processing line: ~ args.state.rotation]~ ** Processing line: ~~ -** Processing line: ~ def row_to_px args, row_number~ -** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ -** Processing line: ~ # Row 0 starts 5 units below the top of the grid~ -** Processing line: ~ # Each row afterward is 20 units lower~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ args.state.rotation -= 1~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Don't worry about understanding the code within this method just yet.~ -** Processing line: ~ # This method shows you the help text within the game.~ -** Processing line: ~ def tick_help_text args~ -** Processing line: ~ return unless args.state.h_pressed_at~ +** Processing line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ args.state.key_value_history ||= {}~ -** Processing line: ~ args.state.key_down_value_history ||= {}~ -** Processing line: ~ args.state.key_held_value_history ||= {}~ -** Processing line: ~ args.state.key_up_value_history ||= {}~ +** Processing line: ~** Coding On A Raspberry Pi~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Coding On A Raspberry Pi~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Coding On A Raspberry Pi~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if (args.inputs.keyboard.key_down.truthy_keys.length > 0 ||~ -** Processing line: ~ args.inputs.keyboard.key_held.truthy_keys.length > 0 ||~ -** Processing line: ~ args.inputs.keyboard.key_up.truthy_keys.length > 0)~ -** Processing line: ~ args.state.help_available = true~ -** Processing line: ~ args.state.no_activity_debounce = nil~ -** Processing line: ~ else~ -** Processing line: ~ args.state.no_activity_debounce ||= 5.seconds~ -** Processing line: ~ args.state.no_activity_debounce -= 1~ -** Processing line: ~ if args.state.no_activity_debounce <= 0~ -** Processing line: ~ args.state.help_available = false~ -** Processing line: ~ args.state.key_value_history = {}~ -** Processing line: ~ args.state.key_down_value_history = {}~ -** Processing line: ~ args.state.key_held_value_history = {}~ -** Processing line: ~ args.state.key_up_value_history = {}~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~sudo raspi-config~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ if !args.state.help_available~ -** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font]~ -** Processing line: ~ return~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ -** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ -** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ -** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ -** Processing line: ~~ -** Processing line: ~ fill_history args, :key_value_history, :down_or_held, nil~ -** Processing line: ~ fill_history args, :key_down_value_history, :down, :key_down~ -** Processing line: ~ fill_history args, :key_held_value_history, :held, :key_held~ -** Processing line: ~ fill_history args, :key_up_value_history, :up, :key_up~ -** Processing line: ~~ -** Processing line: ~ render_help_labels args, :key_value_history, :down_or_held, nil, 10~ -** Processing line: ~ render_help_labels args, :key_down_value_history, :down, :key_down, 330~ -** Processing line: ~ render_help_labels args, :key_held_value_history, :held, :key_held, 650~ -** Processing line: ~ render_help_labels args, :key_up_value_history, :up, :key_up, 990~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def fill_history args, history_key, state_key, keyboard_method~ -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :raw_key~ -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :char~ -** Processing line: ~ args.inputs.keyboard.keys[state_key].each do |key_name|~ -** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, key_name~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def fill_single_history args, history_key, state_key, keyboard_method, key_name~ -** Processing line: ~ current_value = args.inputs.keyboard.send(key_name)~ -** Processing line: ~ if keyboard_method~ -** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(key_name)~ -** Processing line: ~ end~ -** Processing line: ~ args.state.as_hash[history_key][key_name] ||= []~ -** Processing line: ~ args.state.as_hash[history_key][key_name] << current_value~ -** Processing line: ~ args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_help_labels args, history_key, state_key, keyboard_method, x~ -** Processing line: ~ idx = 8~ -** Processing line: ~ args.outputs.labels << args.state~ -** Processing line: ~ .as_hash[history_key]~ -** Processing line: ~ .keys~ -** Processing line: ~ .reverse~ -** Processing line: ~ .map~ -** Processing line: ~ .with_index do |k, i|~ -** Processing line: ~ v = args.state.as_hash[history_key][k]~ -** Processing line: ~ current_value = args.inputs.keyboard.send(k)~ -** Processing line: ~ if keyboard_method~ -** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(k)~ -** Processing line: ~ end~ -** Processing line: ~ idx += 2~ -** Processing line: ~ [~ -** Processing line: ~ [x, row_to_px(args, idx - 2),~ -** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ -** Processing line: ~ small_font],~ -** Processing line: ~ [x, row_to_px(args, idx - 1),~ -** Processing line: ~ " was #{v}",~ -** Processing line: ~ small_font]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~** Conclusion~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Conclusion~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Conclusion~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~* 02_input_basics/02_mouse/app/main.rb~ +** Processing line: ~* IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this!~ - H1 detected. -- Formatting line: ~02_input_basics/02_mouse/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this!~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ +** Processing line: ~** Guided Samples~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Guided Samples~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Guided Samples~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ -** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ -** Processing line: ~ since the click event.~ ** Processing line: ~~ -** Processing line: ~ Reminder:~ +** Processing line: ~1. ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language.~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~2. ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~.~ +- Line's tilde count is: 14 +- Line contains link marker: false +- CODE detected. +** Processing line: ~3. ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~.~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet).~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~5. ~samples/05_mouse~: This set of samples show more advanced usages of the mouse.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/05_mouse~: This set of samples show more advanced usages of the mouse.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~6. ~samples/06_save_load~: This set of samples show how to save and load game data.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/06_save_load~: This set of samples show how to save and load game data.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~7. ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~8. ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~9. ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~10. ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~11. ~samples/11_http~: This set of samples show how use http.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ ~samples/11_http~: This set of samples show how use http.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ -** Processing line: ~ structure. You can define ANY property here with ANY type of~ -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ -** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ +** Processing line: ~** Sample Games~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sample Games~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sample Games~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # This code demonstrates DragonRuby mouse input~ +** Processing line: ~1. 3D Cube: Shows how to do faux 3D in DragonRuby.~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ 3D Cube: Shows how to do faux 3D in DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~2. Dueling Starships: A two player top-down versus game where each player controls a ship.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Dueling Starships: A two player top-down versus game where each player controls a ship.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~3. Flappy Dragon: DragonRuby's clone of Flappy Bird.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Flappy Dragon: DragonRuby's clone of Flappy Bird.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~4. Pong: A simple implementation of the game Pong.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Pong: A simple implementation of the game Pong.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~5. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~6. Solar System: A simulation of our solar system.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Solar System: A simulation of our solar system.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~7. Crafting Starting Point: A starting point for those that want to build a crafting game.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Crafting Starting Point: A starting point for those that want to build a crafting game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~8. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~9. LOWREZ: Sample apps that show how to render at different resolutions.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ LOWREZ: Sample apps that show how to render at different resolutions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~10. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~11. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # To see if the a mouse click occurred~ -** Processing line: ~ # Use args.inputs.mouse.click~ -** Processing line: ~ # Which returns a boolean~ ** Processing line: ~~ -** Processing line: ~ # To see where a mouse click occurred~ -** Processing line: ~ # Use args.inputs.mouse.click.point.x AND~ -** Processing line: ~ # args.inputs.mouse.click.point.y~ +** Processing line: ~* Deploying To Itch.io~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Deploying To Itch.io~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # To see which frame the click occurred~ -** Processing line: ~ # Use args.inputs.mouse.click.created_at~ +** Processing line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # To see how many frames its been since the click occurred~ -** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ +** Processing line: ~** Creating Your Game Landing Page~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Creating Your Game Landing Page~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Creating Your Game Landing Page~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Saving the click in args.state can be quite useful~ +** Processing line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time."~ -** Processing line: ~ x = 460~ +** Processing line: ~- Title: Give your game a Title. This value represents your `gametitle`.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Title: Give your game a Title. This value represents your `gametitle`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Project URL: Set your project url. This value represents your `gameid`.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Project URL: Set your project url. This value represents your `gameid`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Classification: Keep this as Game.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Classification: Keep this as Game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Uploads: Skip this section for now.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Uploads: Skip this section for now.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You can fill out all the other options later.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can fill out all the other options later.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse")~ +** Processing line: ~** Update Your Game's Metadata~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Update Your Game's Metadata~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Update Your Game's Metadata~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ -** Processing line: ~ end~ +** Processing line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: Remove the ~#~ at the beginning of each line.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~NOTE: Remove the ~#~ at the beginning of each line.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if args.state.last_mouse_click~ -** Processing line: ~ click = args.state.last_mouse_click~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}")~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago")~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}")~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.")~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Please click mouse.")~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ devid=bob~ +** Processing line: ~ devtitle=Bob The Game Developer~ +** Processing line: ~ gameid=mygame~ +** Processing line: ~ gametitle=My Game~ +** Processing line: ~ version=0.1~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def small_label args, x, row, message~ -** Processing line: ~ # This method effectively combines the row_to_px and small_font methods~ -** Processing line: ~ # It changes the given row value to a DragonRuby pixel value~ -** Processing line: ~ # and adds the customization parameters~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ +** Processing line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ +- Line's tilde count is: 12 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -** Processing line: ~ end~ +** Processing line: ~** Building Your Game For Distribution~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Building Your Game For Distribution~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Building Your Game For Distribution~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def row_to_px args, row_number~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ -** Processing line: ~ end~ +** Processing line: ~Open up the terminal and run this from the command line:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Open up the terminal and run this from the command line:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ ./dragonruby-publish --only-package mygame~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~For subsequent updates you can use an automated deployment to Itch.io:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~For subsequent updates you can use an automated deployment to Itch.io:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ ./dragonruby-publish mygame~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ +** Processing line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~* 02_input_basics/03_mouse_point_to_rect/app/main.rb~ +** Processing line: ~* DragonRuby's Philosophy~ - H1 detected. -- Formatting line: ~02_input_basics/03_mouse_point_to_rect/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DragonRuby's Philosophy~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ +** Processing line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.outputus.borders: An array. Values in this array will be rendered as~ -** Processing line: ~ unfilled rectangles on the screen.~ -** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ -** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ -** Processing line: ~ or false depending on if the point is inside the rect.~ +** Processing line: ~** Challenge The Status Quo~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Challenge The Status Quo~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Challenge The Status Quo~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ ```~ -** Processing line: ~ # Point: x: 100, y: 100~ -** Processing line: ~ # Rect: x: 0, y: 0, w: 500, h: 500~ -** Processing line: ~ # Result: true~ +** Processing line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ [100, 100].inside_rect? [0, 0, 500, 500]~ -** Processing line: ~ ```~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~But that's how we've always done it.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~But that's how we've always done it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. ** Processing line: ~~ -** Processing line: ~ ```~ -** Processing line: ~ # Point: x: 100, y: 100~ -** Processing line: ~ # Rect: x: 300, y: 300, w: 100, h: 100~ -** Processing line: ~ # Result: false~ +** Processing line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ [100, 100].inside_rect? [300, 300, 100, 100]~ -** Processing line: ~ ```~ +** Processing line: ~** Continuity of Design~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Continuity of Design~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Continuity of Design~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ -** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ -** Processing line: ~ since the click event.~ +** Processing line: ~There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the (hopes that the investment will yield dividends "when you become successful"). This results in more "Enterprise TM" code upfront, and makes it more difficult to get started when you are new to programming.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the (hopes that the investment will yield dividends "when you become successful"). This results in more "Enterprise TM" code upfront, and makes it more difficult to get started when you are new to programming.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby's philosophy is to provide a spectrum across the "make it fast" vs "make it right" spectrum and provide incremental, intuitive transitions between points on that spectrum. This is captured in how render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront).~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~** Release Often And Soon~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Release Often And Soon~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Release Often And Soon~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # To determine whether a point is in a rect~ -** Processing line: ~ # Use point.inside_rect? rect~ +** Processing line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Remember:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Remember:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This is useful to determine if a click occurred in a rect~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~Real artists ship.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Real artists ship.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle."~ ** Processing line: ~~ -** Processing line: ~ x = 460~ +** Processing line: ~** Sustainable And Ethical Monetization~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sustainable And Ethical Monetization~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sustainable And Ethical Monetization~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->")~ +** Processing line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ -** Processing line: ~ args.outputs.borders << box~ +** Processing line: ~** Sustainable And Ethical Open Source~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sustainable And Ethical Open Source~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Sustainable And Ethical Open Source~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Saves the most recent click into args.state~ -** Processing line: ~ # Unlike the other components of args,~ -** Processing line: ~ # args.state does not reset every tick.~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ -** Processing line: ~ end~ +** Processing line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if args.state.last_mouse_click~ -** Processing line: ~ if args.state.last_mouse_click.point.inside_rect? box~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.")~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.")~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.")~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~** People Over Entities~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~People Over Entities~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~People Over Entities~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def small_label args, x, row, message~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ +** Processing line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -** Processing line: ~ end~ +** Processing line: ~** Building A Game Should Be Fun And Bring Happiness~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def row_to_px args, row_number~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ -** Processing line: ~ end~ +** Processing line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~** Real World Application Drives Features~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Real World Application Drives Features~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Real World Application Drives Features~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~* How To Determine What Frame You Are On~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~How To Determine What Frame You Are On~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [10, 670, "#{args.state.tick_count}"]~ +** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 02_input_basics/04_mouse_rect_to_rect/app/main.rb~ +** Processing line: ~* How To Get Current Framerate~ - H1 detected. -- Formatting line: ~02_input_basics/04_mouse_rect_to_rect/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~How To Get Current Framerate~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ +** Processing line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - args.outputs.borders: An array. Values in this array will be rendered as~ -** Processing line: ~ unfilled rectangles on the screen.~ -** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ -** Processing line: ~ considered a rect. The intersect_rect? function returns true~ -** Processing line: ~ or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ ```~ -** Processing line: ~ # Rect One: x: 100, y: 100, w: 100, h: 100~ -** Processing line: ~ # Rect Two: x: 0, y: 0, w: 500, h: 500~ -** Processing line: ~ # Result: true~ +** Processing line: ~* How To Render A Sprite Using An Array~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~How To Render A Sprite Using An Array~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500]~ -** Processing line: ~ ```~ +** Processing line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~args.outputs.sprites~ is used to render a sprite.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.outputs.sprites~ is used to render a sprite.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ ```~ -** Processing line: ~ # Rect One: x: 100, y: 100, w: 10, h: 10~ -** Processing line: ~ # Rect Two: x: 500, y: 500, w: 10, h: 10~ -** Processing line: ~ # Result: false~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50, # X~ +** Processing line: ~ 360 - 50, # Y~ +** Processing line: ~ 100, # W~ +** Processing line: ~ 100, # H~ +** Processing line: ~ 'sprites/square-blue.png' # PATH~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10]~ -** Processing line: ~ ```~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~* More Sprite Properties As An Array~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~More Sprite Properties As An Array~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Similarly, whether rects intersect can be found through~ -** Processing line: ~ # rect1.intersect_rect? rect2~ +** Processing line: ~Here are all the properties you can set on a sprite.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here are all the properties you can set on a sprite.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. ** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to determine if two rectangles intersect."~ -** Processing line: ~ x = 460~ -** Processing line: ~~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen")~ -** Processing line: ~ # red_box = [460, 250, 355, 90, 170, 0, 0]~ -** Processing line: ~ # args.outputs.borders << red_box~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 100, # X~ +** Processing line: ~ 100, # Y~ +** Processing line: ~ 32, # W~ +** Processing line: ~ 64, # H~ +** Processing line: ~ 'sprites/square-blue.png', # PATH~ +** Processing line: ~ 0, # ANGLE~ +** Processing line: ~ 255, # ALPHA~ +** Processing line: ~ 0, # RED_SATURATION~ +** Processing line: ~ 255, # GREEN_SATURATION~ +** Processing line: ~ 0 # BLUE_SATURATION~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # args.state.box_collision_one and args.state.box_collision_two~ -** Processing line: ~ # Are given values of a solid when they should be rendered~ -** Processing line: ~ # They are stored in game so that they do not get reset every tick~ -** Processing line: ~ if args.inputs.mouse.click~ -** Processing line: ~ if !args.state.box_collision_one~ -** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ -** Processing line: ~ elsif !args.state.box_collision_two~ -** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ -** Processing line: ~ else~ -** Processing line: ~ args.state.box_collision_one = nil~ -** Processing line: ~ args.state.box_collision_two = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.state.box_collision_one~ -** Processing line: ~ args.outputs.solids << args.state.box_collision_one~ -** Processing line: ~ end~ +** Processing line: ~* Different Sprite Representations~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Different Sprite Representations~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if args.state.box_collision_two~ -** Processing line: ~ args.outputs.solids << args.state.box_collision_two~ -** Processing line: ~ end~ +** Processing line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You can represent a sprite as a ~Hash~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can represent a sprite as a ~Hash~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if args.state.box_collision_one && args.state.box_collision_two~ -** Processing line: ~ if args.state.box_collision_one.intersect_rect? args.state.box_collision_two~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.')~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.')~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.labels << small_label(args, x, 4, '--')~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << {~ +** Processing line: ~ x: 640 - 50,~ +** Processing line: ~ y: 360 - 50,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ path: 'sprites/square-blue.png',~ +** Processing line: ~ angle: 0,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ r: 255,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ source_x: 0,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: -1,~ +** Processing line: ~ source_h: -1,~ +** Processing line: ~ flip_vertically: false,~ +** Processing line: ~ flip_horizontally: false,~ +** Processing line: ~ angle_anchor_x: 0.5,~ +** Processing line: ~ angle_anchor_y: 1.0~ +** Processing line: ~ }~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def small_label args, x, row, message~ -** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ -** Processing line: ~ end~ +** Processing line: ~You can represent a sprite as an ~object~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can represent a sprite as an ~object~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ +** Processing line: ~ class Sprite~ +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,~ +** Processing line: ~ :source_x, :source_y, :source_w, :source_h,~ +** Processing line: ~ :tile_x, :tile_y, :tile_w, :tile_h,~ +** Processing line: ~ :flip_horizontally, :flip_vertically,~ +** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ ** Processing line: ~~ -** Processing line: ~ def row_to_px args, row_number~ -** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ def primitive_marker~ +** Processing line: ~ :sprite~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ class BlueSquare < Sprite~ +** Processing line: ~ def initialize opts~ +** Processing line: ~ @x = opts[:x]~ +** Processing line: ~ @y = opts[:y]~ +** Processing line: ~ @w = opts[:w]~ +** Processing line: ~ @h = opts[:h]~ +** Processing line: ~ @path = 'sprites/square-blue.png'~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << (BlueSquare.new x: 640 - 50,~ +** Processing line: ~ y: 360 - 50,~ +** Processing line: ~ w: 50,~ +** Processing line: ~ h: 50)~ +** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 02_input_basics/05_controller/app/main.rb~ +** Processing line: ~* How To Render A Label~ - H1 detected. -- Formatting line: ~02_input_basics/05_controller/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~How To Render A Label~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key~ -** Processing line: ~ is being held down on the controller.~ -** Processing line: ~ If there is more than one controller being used, they can be differentiated by~ -** Processing line: ~ using names like controller_one and controller_two.~ -** Processing line: ~~ -** Processing line: ~ For a full listing of buttons, take a look at mygame/documentation/08-controllers.md.~ -** Processing line: ~~ -** Processing line: ~ Reminder:~ +** Processing line: ~~args.outputs.labels~ is used to render labels.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.outputs.labels~ is used to render labels.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Here is the minimum code:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here is the minimum code:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ -** Processing line: ~ structure. You can define ANY property here with ANY type of~ -** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ -** Processing line: ~ across frames. If you attempt to access a property that doesn't exist~ -** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y TEXT~ +** Processing line: ~ args.outputs.labels << [640, 360, "I am a black label."]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller.~ -** Processing line: ~ The parameters of a button are:~ -** Processing line: ~ 1. the position (x, y)~ -** Processing line: ~ 2. the input key held on the controller~ -** Processing line: ~ 3. the text or name of the button~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~* A Colored Label~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~A Colored Label~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This sample app provides a visual demonstration of a standard controller, including~ -** Processing line: ~ # the placement and function of all buttons.~ ** Processing line: ~~ -** Processing line: ~ class ControllerDemo~ -** Processing line: ~ attr_accessor :inputs, :state, :outputs~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # A colored label~ +** Processing line: ~ # X Y TEXT, RED GREEN BLUE ALPHA~ +** Processing line: ~ args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Calls the methods necessary for the app to run successfully.~ -** Processing line: ~ def tick~ -** Processing line: ~ process_inputs~ -** Processing line: ~ render~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Starts with an empty collection of buttons.~ -** Processing line: ~ # Adds buttons that are on the controller to the collection.~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ state.buttons = []~ +** Processing line: ~* Extended Label Properties~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Extended Label Properties~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ -** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ ** Processing line: ~~ -** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ -** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # A colored label~ +** Processing line: ~ # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 640, # X~ +** Processing line: ~ 360, # Y~ +** Processing line: ~ "Hello world", # TEXT~ +** Processing line: ~ 0, # SIZE_ENUM~ +** Processing line: ~ 1, # ALIGNMENT_ENUM~ +** Processing line: ~ 0, # RED~ +** Processing line: ~ 0, # GREEN~ +** Processing line: ~ 0, # BLUE~ +** Processing line: ~ 255, # ALPHA~ +** Processing line: ~ "fonts/coolfont.ttf" # FONT~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ -** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ +** Processing line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ -** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ -** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ -** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ +** Processing line: ~* Rendering A Label As A ~Hash~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering A Label As A ~Hash~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ -** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ -** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ -** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ +** Processing line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ -** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ -** Processing line: ~ inputs.controller_one.key_held.l3,~ -** Processing line: ~ "L3"]~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << {~ +** Processing line: ~ x: 200,~ +** Processing line: ~ y: 550,~ +** Processing line: ~ text: "dragonruby",~ +** Processing line: ~ size_enum: 2,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 155,~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: "fonts/manaspc.ttf",~ +** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ +** Processing line: ~ game_data_one: "Something",~ +** Processing line: ~ game_data_two: {~ +** Processing line: ~ value_1: "value",~ +** Processing line: ~ value_2: "value two",~ +** Processing line: ~ a_number: 15~ +** Processing line: ~ }~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ -** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ -** Processing line: ~ inputs.controller_one.key_held.r3,~ -** Processing line: ~ "R3"]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Gives each button a square shape.~ -** Processing line: ~ # If the button is being pressed or held (which means it is considered active),~ -** Processing line: ~ # the square is filled in. Otherwise, the button simply has a border.~ -** Processing line: ~ def render~ -** Processing line: ~ state.buttons.each do |x, y, active, text|~ -** Processing line: ~ rect = [x, y, 75, 75]~ +** Processing line: ~* Getting The Size Of A Piece Of Text~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Getting The Size Of A Piece Of Text~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if active # if button is pressed~ -** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ -** Processing line: ~ else~ -** Processing line: ~ outputs.borders << rect # otherwise, output as border~ -** Processing line: ~ end~ +** Processing line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Outputs the text of each button using labels.~ -** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # TEXT SIZE_ENUM FONT~ +** Processing line: ~ w, h = args.gtk.calcstringbox("some string", 0, "font.ttf")~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ -** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ -** Processing line: ~ end~ +** Processing line: ~ # NOTE: The SIZE_ENUM and FONT are optional arguments.~ +** Processing line: ~~ +** Processing line: ~ # Render a label showing the w and h of the text:~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ # This string uses Ruby's string interpolation literal: #{}~ +** Processing line: ~ "'some string' has width: #{w}, and height: #{h}."~ +** Processing line: ~ ]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ $controller_demo = ControllerDemo.new~ ** Processing line: ~~ +** Processing line: ~* How To Play A Sound~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~How To Play A Sound~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Sounds that end ~.wav~ will play once:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Sounds that end ~.wav~ will play once:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. ** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller."~ -** Processing line: ~ $controller_demo.inputs = args.inputs~ -** Processing line: ~ $controller_demo.state = args.state~ -** Processing line: ~ $controller_demo.outputs = args.outputs~ -** Processing line: ~ $controller_demo.tick~ +** Processing line: ~ # Play a sound every second~ +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +** Processing line: ~ args.outputs.sounds << 'something.wav'~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Resets the app.~ -** Processing line: ~ def r~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ end~ +** Processing line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Start a sound loop at the beginning of the game~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.outputs.sounds << 'background_music.ogg'~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb~ -- H1 detected. -- Formatting line: ~03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb~ -- Line's tilde count is: 0 +** Processing line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ def tick args~ +** Processing line: ~ # Play a sound every second~ +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +** Processing line: ~ args.gtk.queue_sound 'some-ogg.ogg'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~* Using ~args.state~ To Store Your Game State~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Using ~args.state~ To Store Your Game State~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ In this sample app, we're using string interpolation to iterate through images in the~ -** Processing line: ~ sprites folder using their image path names.~ +** Processing line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate sprites on the screen.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # initialize your game state ONCE~ +** Processing line: ~ args.state.player.x ||= 0~ +** Processing line: ~ args.state.player.y ||= 0~ +** Processing line: ~ args.state.player.hp ||= 100~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ # increment the x position of the character by one every frame~ +** Processing line: ~ args.state.player.x += 1~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed.~ -** Processing line: ~ Stores the frame that key was pressed on.~ -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~ # Render a sprite with a label above the sprite~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ args.state.player.x,~ +** Processing line: ~ args.state.player.y,~ +** Processing line: ~ 32, 32,~ +** Processing line: ~ "player.png"~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ args.state.player.x,~ +** Processing line: ~ args.state.player.y - 50,~ +** Processing line: ~ args.state.player.hp~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # This sample app demonstrates how sprite animations work.~ -** Processing line: ~ # There are two sprites that animate forever and one sprite~ -** Processing line: ~ # that *only* animates when you press the "f" key on the keyboard.~ ** Processing line: ~~ -** Processing line: ~ # This is the entry point to your game. The `tick` method~ -** Processing line: ~ # executes at 60 frames per second. There are two methods~ -** Processing line: ~ # in this tick "entry point": `looping_animation`, and the~ -** Processing line: ~ # second method is `one_time_animation`.~ -** Processing line: ~ def tick args~ -** Processing line: ~ looping_animation args~ -** Processing line: ~ one_time_animation args~ -** Processing line: ~ end~ +** Processing line: ~* Frequently Asked Questions, Comments, and Concerns~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Frequently Asked Questions, Comments, and Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This function shows how to animate a sprite that loops forever.~ -** Processing line: ~ def looping_animation args~ -** Processing line: ~ # Here we define a few local variables that will be sent~ -** Processing line: ~ # into the magic function that gives us the correct sprite image~ -** Processing line: ~ # over time. There are four things we need in order to figure~ -** Processing line: ~ # out which sprite to show.~ +** Processing line: ~Here are questions, comments, and concerns that frequently come up.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here are questions, comments, and concerns that frequently come up.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # 1. When to start the animation.~ -** Processing line: ~ start_looping_at = 0~ +** Processing line: ~** Frequently Asked Questions~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequently Asked Questions~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequently Asked Questions~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # 2. The number of pngs that represent the full animation.~ -** Processing line: ~ number_of_sprites = 6~ ** Processing line: ~~ -** Processing line: ~ # 3. How long to show each png.~ -** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ +** Processing line: ~*** What is DragonRuby LLP?~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What is DragonRuby LLP?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What is DragonRuby LLP?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # 4. Whether the animation should loop once, or forever.~ -** Processing line: ~ does_sprite_loop = true~ +** Processing line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # With the variables defined above, we can get a number~ -** Processing line: ~ # which represents the sprite to show by calling the `frame_index` function.~ -** Processing line: ~ # In this case the number will be between 0, and 5 (you can see the sprites~ -** Processing line: ~ # in the ./sprites directory).~ -** Processing line: ~ sprite_index = start_looping_at.frame_index number_of_sprites,~ -** Processing line: ~ number_of_frames_to_show_each_sprite,~ -** Processing line: ~ does_sprite_loop~ +** Processing line: ~- Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [[http://rubymotion.com]]~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [[http://rubymotion.com]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~All of the products above leverage a shared core called DragonRuby.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~All of the products above leverage a shared core called DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Now that we have `sprite_index, we can present the correct file.~ -** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~*** What is DragonRuby?~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Try changing the numbers below to see how the animation changes:~ -** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ -** Processing line: ~ end~ +** Processing line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This function shows how to animate a sprite that executes~ -** Processing line: ~ # only once when the "f" key is pressed.~ -** Processing line: ~ def one_time_animation args~ -** Processing line: ~ # This is just a label the shows instructions within the game.~ -** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ +** Processing line: ~**** Okay... so what is the difference between a language specification and a runtime?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # If "f" is pressed on the keyboard...~ -** Processing line: ~ if args.inputs.keyboard.key_down.f~ -** Processing line: ~ # Print the frame that "f" was pressed on.~ -** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ +** Processing line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # And MOST IMPORTANTLY set the point it time to start the animation,~ -** Processing line: ~ # equal to "now" which is represented as args.state.tick_count.~ +** Processing line: ~**** Okay... what language specification does DragonRuby use then?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Okay... what language specification does DragonRuby use then?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Okay... what language specification does DragonRuby use then?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Also IMPORTANT, you'll notice that the value of when to start looping~ -** Processing line: ~ # is stored in `args.state`. This construct's values are retained across~ -** Processing line: ~ # executions of the `tick` method.~ -** Processing line: ~ args.state.start_looping_at = args.state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # These are the same local variables that were defined~ -** Processing line: ~ # for the `looping_animation` function.~ -** Processing line: ~ number_of_sprites = 6~ -** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ +** Processing line: ~**** So... why another runtime?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~So... why another runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~So... why another runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Except this sprite does not loop again. If the animation time has passed,~ -** Processing line: ~ # then the frame_index function returns nil.~ -** Processing line: ~ does_sprite_loop = false~ +** Processing line: ~The elevator pitch is:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The elevator pitch is:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ sprite_index = args.state~ -** Processing line: ~ .start_looping_at~ -** Processing line: ~ .frame_index number_of_sprites,~ -** Processing line: ~ number_of_frames_to_show_each_sprite,~ -** Processing line: ~ does_sprite_loop~ +** Processing line: ~**** What does Multilevel Cross-platform mean?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~What does Multilevel Cross-platform mean?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~What does Multilevel Cross-platform mean?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # This line sets the frame index to zero, if~ -** Processing line: ~ # the animation duration has passed (frame_index returned nil).~ +** Processing line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Remeber: we are not looping forever here.~ -** Processing line: ~ sprite_index ||= 0~ +** Processing line: ~- Level 1 we leverage a good portion of mRuby.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 1 we leverage a good portion of mRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Level 3 consists of portable C libraries and their Ruby + C-Extensions.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 3 consists of portable C libraries and their Ruby + C-Extensions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Present the sprite.~ -** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~- Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time."~ -** Processing line: ~ end~ +** Processing line: ~- Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~**** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~*** How is DragonRuby different than MRI?~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~How is DragonRuby different than MRI?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~How is DragonRuby different than MRI?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~* 03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb~ -- H1 detected. -- Formatting line: ~03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb~ +** Processing line: ~DragonRuby supports a subset of MRI apis. Our target is to support all of mRuby's standard lib. There are challenges to this given the number of platforms we are trying to support (specifically console).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby supports a subset of MRI apis. Our target is to support all of mRuby's standard lib. There are challenges to this given the number of platforms we are trying to support (specifically console).~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.player.x ||= 100~ -** Processing line: ~ args.state.player.y ||= 100~ -** Processing line: ~ args.state.player.w ||= 64~ -** Processing line: ~ args.state.player.h ||= 64~ -** Processing line: ~ args.state.player.direction ||= 1~ -** Processing line: ~~ -** Processing line: ~ args.state.player.is_moving = false~ -** Processing line: ~~ -** Processing line: ~ # get the keyboard input and set player properties~ -** Processing line: ~ if args.inputs.keyboard.right~ -** Processing line: ~ args.state.player.x += 3~ -** Processing line: ~ args.state.player.direction = 1~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ elsif args.inputs.keyboard.left~ -** Processing line: ~ args.state.player.x -= 3~ -** Processing line: ~ args.state.player.direction = -1~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.up~ -** Processing line: ~ args.state.player.y += 1~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ elsif args.inputs.keyboard.down~ -** Processing line: ~ args.state.player.y -= 1~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # if no arrow keys are being pressed, set the player as not moving~ -** Processing line: ~ if !args.inputs.keyboard.directional_vector~ -** Processing line: ~ args.state.player.started_running_at = nil~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # wrap player around the stage~ -** Processing line: ~ if args.state.player.x > 1280~ -** Processing line: ~ args.state.player.x = -64~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ elsif args.state.player.x < -64~ -** Processing line: ~ args.state.player.x = 1280~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~**** Does DragonRuby support Gems?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby support Gems?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby support Gems?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if args.state.player.y > 720~ -** Processing line: ~ args.state.player.y = -64~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ elsif args.state.player.y < -64~ -** Processing line: ~ args.state.player.y = 720~ -** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~DragonRuby does not support gems because that requires the installation of MRI Ruby on the developer's machine (which is a non-starter given that we want DragonRuby to be a zero dependency runtime). While this seems easy for Mac and Linux, it is much harder on Windows and Raspberry Pi. mRuby has taken the approach of having a git repository for compatible gems and we will most likely follow suite: [[https://github.com/mruby/mgem-list]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~DragonRuby does not support gems because that requires the installation of MRI Ruby on the developer's machine (which is a non-starter given that we want DragonRuby to be a zero dependency runtime). While this seems easy for Mac and Linux, it is much harder on Windows and Raspberry Pi. mRuby has taken the approach of having a git repository for compatible gems and we will most likely follow suite: [[https://github.com/mruby/mgem-list]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~ # render player as standing or running~ -** Processing line: ~ if args.state.player.started_running_at~ -** Processing line: ~ args.outputs.sprites << running_sprite(args)~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.sprites << standing_sprite(args)~ -** Processing line: ~ end~ -** Processing line: ~ args.outputs.labels << [30, 700, "Use arrow keys to move around."]~ -** Processing line: ~ end~ +** Processing line: ~**** Does DragonRuby have a REPL/IRB?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby have a REPL/IRB?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby have a REPL/IRB?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def standing_sprite args~ -** Processing line: ~ {~ -** Processing line: ~ x: args.state.player.x,~ -** Processing line: ~ y: args.state.player.y,~ -** Processing line: ~ w: args.state.player.w,~ -** Processing line: ~ h: args.state.player.h,~ -** Processing line: ~ path: "sprites/horizontal-stand.png",~ -** Processing line: ~ flip_horizontally: args.state.player.direction > 0~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~You can use DragonRuby's Console within the game to inspect object and execute small pieces of code. For more complex pieces of code create a file called ~repl.rb~ and put it in ~mygame/app/repl.rb~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can use DragonRuby's Console within the game to inspect object and execute small pieces of code. For more complex pieces of code create a file called ~repl.rb~ and put it in ~mygame/app/repl.rb~:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def running_sprite args~ -** Processing line: ~ if !args.state.player.started_running_at~ -** Processing line: ~ tile_index = 0~ -** Processing line: ~ else~ -** Processing line: ~ how_many_frames_in_sprite_sheet = 6~ -** Processing line: ~ how_many_ticks_to_hold_each_frame = 3~ -** Processing line: ~ should_the_index_repeat = true~ -** Processing line: ~ tile_index = args.state~ -** Processing line: ~ .player~ -** Processing line: ~ .started_running_at~ -** Processing line: ~ .frame_index(how_many_frames_in_sprite_sheet,~ -** Processing line: ~ how_many_ticks_to_hold_each_frame,~ -** Processing line: ~ should_the_index_repeat)~ -** Processing line: ~ end~ +** Processing line: ~- Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method:~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ x: args.state.player.x,~ -** Processing line: ~ y: args.state.player.y,~ -** Processing line: ~ w: args.state.player.w,~ -** Processing line: ~ h: args.state.player.h,~ -** Processing line: ~ path: 'sprites/horizontal-run.png',~ -** Processing line: ~ tile_x: 0 + (tile_index * args.state.player.w),~ -** Processing line: ~ tile_y: 0,~ -** Processing line: ~ tile_w: args.state.player.w,~ -** Processing line: ~ tile_h: args.state.player.h,~ -** Processing line: ~ flip_horizontally: args.state.player.direction > 0,~ -** Processing line: ~ }~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ puts "hello world"~ +** Processing line: ~ puts 1 + 1~ ** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 03_rendering_sprites/03_animation_states/app/main.rb~ -- H1 detected. -- Formatting line: ~03_rendering_sprites/03_animation_states/app/main.rb~ +** Processing line: ~- If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal).~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal).~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ +** Processing line: ~- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class Game~ -** Processing line: ~ attr_gtk~ -** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.show_debug_layer = true if state.tick_count == 0~ -** Processing line: ~ player.tile_size = 64~ -** Processing line: ~ player.speed = 3~ -** Processing line: ~ player.slash_frames = 15~ -** Processing line: ~ player.x ||= 50~ -** Processing line: ~ player.y ||= 400~ -** Processing line: ~ player.dir_x ||= 1~ -** Processing line: ~ player.dir_y ||= -1~ -** Processing line: ~ player.is_moving ||= false~ -** Processing line: ~ state.watch_list ||= {}~ -** Processing line: ~ state.enemies ||= []~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def add_enemy~ -** Processing line: ~ state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sprite_horizontal_run~ -** Processing line: ~ tile_index = 0.frame_index(6, 3, true)~ -** Processing line: ~ tile_index = 0 if !player.is_moving~ -** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ x: player.x,~ -** Processing line: ~ y: player.y,~ -** Processing line: ~ w: player.tile_size,~ -** Processing line: ~ h: player.tile_size,~ -** Processing line: ~ path: 'sprites/horizontal-run.png',~ -** Processing line: ~ tile_x: 0 + (tile_index * player.tile_size),~ -** Processing line: ~ tile_y: 0,~ -** Processing line: ~ tile_w: player.tile_size,~ -** Processing line: ~ tile_h: player.tile_size,~ -** Processing line: ~ flip_horizontally: player.dir_x > 0,~ -** Processing line: ~ # a: 40~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sprite_horizontal_stand~ -** Processing line: ~ {~ -** Processing line: ~ x: player.x,~ -** Processing line: ~ y: player.y,~ -** Processing line: ~ w: player.tile_size,~ -** Processing line: ~ h: player.tile_size,~ -** Processing line: ~ path: 'sprites/horizontal-stand.png',~ -** Processing line: ~ flip_horizontally: player.dir_x > 0,~ -** Processing line: ~ # a: 40~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sprite_horizontal_slash~ -** Processing line: ~ tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0~ +** Processing line: ~ xrepl do # <------- line is prefixed with an "x"~ +** Processing line: ~ puts "hello world"~ +** Processing line: ~ puts 1 + 1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ x: player.x - 41.25,~ -** Processing line: ~ y: player.y - 41.25,~ -** Processing line: ~ w: 165,~ -** Processing line: ~ h: 165,~ -** Processing line: ~ path: 'sprites/horizontal-slash.png',~ -** Processing line: ~ tile_x: 0 + (tile_index * 128),~ -** Processing line: ~ tile_y: 0,~ -** Processing line: ~ tile_w: 128,~ -** Processing line: ~ tile_h: 128,~ -** Processing line: ~ flip_horizontally: player.dir_x > 0~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # This code will be executed when you save the file.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "Hello"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_player~ -** Processing line: ~ if player.slash_at~ -** Processing line: ~ outputs.sprites << sprite_horizontal_slash~ -** Processing line: ~ elsif player.is_moving~ -** Processing line: ~ outputs.sprites << sprite_horizontal_run~ -** Processing line: ~ else~ -** Processing line: ~ outputs.sprites << sprite_horizontal_stand~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "This code will also be executed."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_enemies~ -** Processing line: ~ outputs.borders << state.enemies~ -** Processing line: ~ end~ +** Processing line: ~ # use xrepl to "comment out" code~ +** Processing line: ~ xrepl do~ +** Processing line: ~ puts "This code will not be executed because of the x infront of repl".~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def render_debug_layer~ -** Processing line: ~ return if !state.show_debug_layer~ -** Processing line: ~ outputs.labels << state.watch_list.map.with_index do |(k, v), i|~ -** Processing line: ~ [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.borders << player.slash_collision_rect~ -** Processing line: ~ end~ +** Processing line: ~**** Does DragonRuby support ~pry~ or have any other debugging facilities?~ +- H4 detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby support ~pry~ or have any other debugging facilities?~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +- Determining if line is a header. +- Line contains ~**** ~... gsub-ing empty string +- Formatting line: ~Does DragonRuby support ~pry~ or have any other debugging facilities?~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def slash_initiate?~ -** Processing line: ~ # buffalo usb controller has a button and b button swapped lol~ -** Processing line: ~ inputs.controller_one.key_down.a || inputs.keyboard.key_down.j~ -** Processing line: ~ end~ +** Processing line: ~~pry~ is a gem that assumes you are using the MRI Runtime (which is incompatible with DragonRuby). Eventually DragonRuby will have a pry based experience that is compatible with a debugging infrastructure called LLDB. Take the time to read about LLDB as it shows the challenges in creating something that is compatible.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~pry~ is a gem that assumes you are using the MRI Runtime (which is incompatible with DragonRuby). Eventually DragonRuby will have a pry based experience that is compatible with a debugging infrastructure called LLDB. Take the time to read about LLDB as it shows the challenges in creating something that is compatible.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~You can use DragonRuby's replay capabilities to troubleshoot:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can use DragonRuby's replay capabilities to troubleshoot:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def input~ -** Processing line: ~ # player movement~ -** Processing line: ~ if slash_complete? && (vector = inputs.directional_vector)~ -** Processing line: ~ player.x += vector.x * player.speed~ -** Processing line: ~ player.y += vector.y * player.speed~ -** Processing line: ~ end~ -** Processing line: ~ player.slash_at = slash_initiate? if slash_initiate?~ -** Processing line: ~ end~ +** Processing line: ~1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).~ +- OL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~ Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def calc_movement~ -** Processing line: ~ # movement~ -** Processing line: ~ if vector = inputs.directional_vector~ -** Processing line: ~ state.debug_label = vector~ -** Processing line: ~ player.dir_x = vector.x~ -** Processing line: ~ player.dir_y = vector.y~ -** Processing line: ~ player.is_moving = true~ -** Processing line: ~ else~ -** Processing line: ~ state.debug_label = vector~ -** Processing line: ~ player.is_moving = false~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~** Frequent Comments About Ruby as a Language Choice~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequent Comments About Ruby as a Language Choice~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequent Comments About Ruby as a Language Choice~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def calc_slash~ -** Processing line: ~ # re-calc the location of the swords collision box~ -** Processing line: ~ if player.dir_x.positive?~ -** Processing line: ~ player.slash_collision_rect = [player.x + player.tile_size,~ -** Processing line: ~ player.y + player.tile_size.half - 10,~ -** Processing line: ~ 40, 20]~ -** Processing line: ~ else~ -** Processing line: ~ player.slash_collision_rect = [player.x - 32 - 8,~ -** Processing line: ~ player.y + player.tile_size.half - 10,~ -** Processing line: ~ 40, 20]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # recalc sword's slash state~ -** Processing line: ~ player.slash_at = nil if slash_complete?~ +** Processing line: ~*** But Ruby is dead.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But Ruby is dead.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But Ruby is dead.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # determine collision if the sword is at it's point of damaging~ -** Processing line: ~ return unless slash_can_damage?~ +** Processing line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Let's stop making this comment shall we?~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Let's stop making this comment shall we?~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect }~ -** Processing line: ~ end~ +** Processing line: ~*** But Ruby is slow.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But Ruby is slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But Ruby is slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def slash_complete?~ -** Processing line: ~ !player.slash_at || player.slash_at.elapsed?(player.slash_frames)~ -** Processing line: ~ end~ +** Processing line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def slash_can_damage?~ -** Processing line: ~ # damage occurs half way into the slash animation~ -** Processing line: ~ return false if slash_complete?~ -** Processing line: ~ return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count~ -** Processing line: ~ return true~ -** Processing line: ~ end~ +** Processing line: ~*** Dynamic languages are slow.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Dynamic languages are slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~Dynamic languages are slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ # generate an enemy if there aren't any on the screen~ -** Processing line: ~ add_enemy if state.enemies.length == 0~ -** Processing line: ~ calc_movement~ -** Processing line: ~ calc_slash~ -** Processing line: ~ end~ +** Processing line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # source is at http://github.com/amirrajan/dragonruby-link-to-the-past~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render_enemies~ -** Processing line: ~ render_player~ -** Processing line: ~ outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."]~ -** Processing line: ~ outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."]~ -** Processing line: ~ render_debug_layer~ -** Processing line: ~ input~ -** Processing line: ~ calc~ -** Processing line: ~ end~ +** Processing line: ~** Frequent Concerns~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequent Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Frequent Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def player~ -** Processing line: ~ state.player~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $game = Game.new~ +** Processing line: ~*** DragonRuby is not open source. That's not right.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~DragonRuby is not open source. That's not right.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~DragonRuby is not open source. That's not right.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ -** Processing line: ~ end~ +** Processing line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you have ideas on how we can do this, email us!~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you have ideas on how we can do this, email us!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If the reason above isn't sufficient, then definitely use something else.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If the reason above isn't sufficient, then definitely use something else.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]]~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. ** Processing line: ~~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~*** DragonRuby is for pay. You should offer a free version.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~- Your income is below $2,000.00 (USD) per month.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Your income is below $2,000.00 (USD) per month.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are under 18 years of age.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You are under 18 years of age.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are a teacher, mentor, or parent who wants to teach a kid how to code.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You are a teacher, mentor, or parent who wants to teach a kid how to code.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Just contact Amir at amir.rajan@dragonruby.org with a short explanation of your current situation and he'll set you up. No questions asked.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Just contact Amir at amir.rajan@dragonruby.org with a short explanation of your current situation and he'll set you up. No questions asked.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~* 03_rendering_sprites/04_color_and_rotation/app/main.rb~ -- H1 detected. -- Formatting line: ~03_rendering_sprites/04_color_and_rotation/app/main.rb~ +** Processing line: ~*** But still, you should offer a free version. So I can try it out and see if I like it.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - merge: Returns a hash containing the contents of two original hashes.~ -** Processing line: ~ Merge does not allow duplicate keys, so the value of a repeated key~ -** Processing line: ~ will be overwritten.~ +** Processing line: ~*** I still think you should do a free version. Think of all people who would give it a shot.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ For example, if we had two hashes~ -** Processing line: ~ h1 = { "a" => 1, "b" => 2}~ -** Processing line: ~ h2 = { "b" => 3, "c" => 3}~ -** Processing line: ~ and we called the command~ -** Processing line: ~ h1.merge(h2)~ -** Processing line: ~ the result would the following hash~ -** Processing line: ~ { "a" => 1, "b" => 3, "c" => 3}.~ +** Processing line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- H3 detected. +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~*** ~... gsub-ing empty string +- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ -** Processing line: ~ using their keys.~ -** Processing line: ~ In this sample app, we're using a hash to create a sprite.~ +** Processing line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ -** Processing line: ~ Before continuing with this sample app, it is HIGHLY recommended that you look~ -** Processing line: ~ at mygame/documentation/05-sprites.md.~ +** Processing line: ~* DOCS: ~GTK::Runtime~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Runtime~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed.~ -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Runtime#reset~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.inputs.controller_one: Takes input from the controller based on what key is pressed.~ -** Processing line: ~ For more information about the controller, go to mygame/documentation/08-controllers.md.~ +** Processing line: ~* DOCS: ~GTK::Runtime#calcstringbox~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Runtime#calcstringbox~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~This function returns the width and height of a string.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This function returns the width and height of a string.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.string_size ||= args.gtk.calcstringbox "Hello World"~ +** Processing line: ~ args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World"~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen,~ -** Processing line: ~ # and also can be moved in different directions through keyboard input from the user.~ +** Processing line: ~* DOCS: ~GTK::Runtime#write_file~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Runtime#write_file~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~This function takes in two parameters. The first paramter is the file path and assumes the the game directory is the root. The second parameter is the string that will be written. The method overwrites whatever is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This function takes in two parameters. The first paramter is the file path and assumes the the game directory is the root. The second parameter is the string that will be written. The method overwrites whatever is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Calls the methods necessary for the game to run successfully.~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. ** Processing line: ~ def tick args~ -** Processing line: ~ default args~ -** Processing line: ~ render args.grid, args.outputs, args.state~ -** Processing line: ~ calc args.state~ -** Processing line: ~ process_inputs args~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at #{args.state.tick_count}."~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Sets default values for the car sprite~ -** Processing line: ~ # Initialization ||= only happens in the first frame~ -** Processing line: ~ def default args~ -** Processing line: ~ args.state.sprite.width = 19~ -** Processing line: ~ args.state.sprite.height = 10~ -** Processing line: ~ args.state.sprite.scale = 4~ -** Processing line: ~ args.state.max_speed = 5~ -** Processing line: ~ args.state.x ||= 100~ -** Processing line: ~ args.state.y ||= 100~ -** Processing line: ~ args.state.speed ||= 1~ -** Processing line: ~ args.state.angle ||= 0~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs sprite onto screen~ -** Processing line: ~ def render grid, outputs, state~ -** Processing line: ~ outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background~ -** Processing line: ~ outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite~ -** Processing line: ~ 'sprites/86.png', # image path of car~ -** Processing line: ~ state.angle,~ -** Processing line: ~ opacity, # transparency~ -** Processing line: ~ saturation,~ -** Processing line: ~ source_rect(state), # sprite sub division/tile (tile x, y, w, h)~ -** Processing line: ~ false, false, # don't flip sprites~ -** Processing line: ~ rotation_anchor]~ +** Processing line: ~* DOCS: ~Array~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # also look at the create_sprite helper method~ -** Processing line: ~ #~ -** Processing line: ~ # For example:~ -** Processing line: ~ #~ -** Processing line: ~ # dest = destination_rect(state)~ -** Processing line: ~ # source = source_rect(state),~ -** Processing line: ~ # outputs.sprites << create_sprite(~ -** Processing line: ~ # 'sprites/86.png',~ -** Processing line: ~ # x: dest.x,~ -** Processing line: ~ # y: dest.y,~ -** Processing line: ~ # w: dest.w,~ -** Processing line: ~ # h: dest.h,~ -** Processing line: ~ # angle: state.angle,~ -** Processing line: ~ # source_x: source.x,~ -** Processing line: ~ # source_y: source.y,~ -** Processing line: ~ # source_w: source.w,~ -** Processing line: ~ # source_h: source.h,~ -** Processing line: ~ # flip_h: false,~ -** Processing line: ~ # flip_v: false,~ -** Processing line: ~ # rotation_anchor_x: 0.7,~ -** Processing line: ~ # rotation_anchor_y: 0.5~ -** Processing line: ~ # )~ -** Processing line: ~ end~ +** Processing line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Creates sprite by setting values inside of a hash~ -** Processing line: ~ def create_sprite path, options = {}~ -** Processing line: ~ options = {~ ** Processing line: ~~ -** Processing line: ~ # dest x, y, w, h~ -** Processing line: ~ x: 0,~ -** Processing line: ~ y: 0,~ -** Processing line: ~ w: 100,~ -** Processing line: ~ h: 100,~ +** Processing line: ~* DOCS: ~Array#map~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#map~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # angle, rotation~ -** Processing line: ~ angle: 0,~ -** Processing line: ~ rotation_anchor_x: 0.5,~ -** Processing line: ~ rotation_anchor_y: 0.5,~ +** Processing line: ~The function given a block returns a new ~Enumerable~ of values.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The function given a block returns a new ~Enumerable~ of values.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # color saturation (red, green, blue), transparency~ -** Processing line: ~ r: 255,~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 255,~ -** Processing line: ~ a: 255,~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +** Processing line: ~ # :order will be used to determine render location~ +** Processing line: ~ # and :name will be used to determine sprite path.~ +** Processing line: ~ args.state.rainbow_colors ||= [~ +** Processing line: ~ { order: 0, name: :red },~ +** Processing line: ~ { order: 1, name: :orange },~ +** Processing line: ~ { order: 2, name: :yellow },~ +** Processing line: ~ { order: 3, name: :green },~ +** Processing line: ~ { order: 4, name: :blue },~ +** Processing line: ~ { order: 5, name: :indigo },~ +** Processing line: ~ { order: 6, name: :violet },~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # source x, y, width, height~ -** Processing line: ~ source_x: 0,~ -** Processing line: ~ source_y: 0,~ -** Processing line: ~ source_w: -1,~ -** Processing line: ~ source_h: -1,~ +** Processing line: ~ # render sprites diagonally to the screen~ +** Processing line: ~ # with a width and height of 50.~ +** Processing line: ~ args.outputs~ +** Processing line: ~ .sprites << args.state~ +** Processing line: ~ .rainbow_colors~ +** Processing line: ~ .map do |color| # <-- ~Array#map~ usage~ +** Processing line: ~ [~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # flip horiztonally, flip vertically~ -** Processing line: ~ flip_h: false,~ -** Processing line: ~ flip_v: false,~ ** Processing line: ~~ -** Processing line: ~ }.merge options~ ** Processing line: ~~ -** Processing line: ~ [~ -** Processing line: ~ options[:x], options[:y], options[:w], options[:h], # dest rect keys~ -** Processing line: ~ path,~ -** Processing line: ~ options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha~ -** Processing line: ~ options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys~ -** Processing line: ~ options[:flip_h], options[:flip_v], # flip~ -** Processing line: ~ options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor~ -** Processing line: ~ ] # hash keys contain corresponding values~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~Array#each~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#each~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Calls the calc_pos and calc_wrap methods.~ -** Processing line: ~ def calc state~ -** Processing line: ~ calc_pos state~ -** Processing line: ~ calc_wrap state~ -** Processing line: ~ end~ +** Processing line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Changes sprite's position on screen~ -** Processing line: ~ # Vectors have magnitude and direction, so the incremented x and y values give the car direction~ -** Processing line: ~ def calc_pos state~ -** Processing line: ~ state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed~ -** Processing line: ~ state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed~ -** Processing line: ~ state.speed *= 1.1 # scales speed up~ -** Processing line: ~ state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed)~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +** Processing line: ~ # :order will be used to determine render location~ +** Processing line: ~ # and :name will be used to determine sprite path.~ +** Processing line: ~ args.state.rainbow_colors ||= [~ +** Processing line: ~ { order: 0, name: :red },~ +** Processing line: ~ { order: 1, name: :orange },~ +** Processing line: ~ { order: 2, name: :yellow },~ +** Processing line: ~ { order: 3, name: :green },~ +** Processing line: ~ { order: 4, name: :blue },~ +** Processing line: ~ { order: 5, name: :indigo },~ +** Processing line: ~ { order: 6, name: :violet },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # render sprites diagonally to the screen~ +** Processing line: ~ # with a width and height of 50.~ +** Processing line: ~ args.state~ +** Processing line: ~ .rainbow_colors~ +** Processing line: ~ .map do |color| # <-- ~Array#each~ usage~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # The screen's dimensions are 1280x720. If the car goes out of scope,~ -** Processing line: ~ # it loops back around on the screen.~ -** Processing line: ~ def calc_wrap state~ ** Processing line: ~~ -** Processing line: ~ # car returns to left side of screen if it disappears on right side of screen~ -** Processing line: ~ # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger~ -** Processing line: ~ state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280~ ** Processing line: ~~ -** Processing line: ~ # car wraps around to right side of screen if it disappears on the left side~ -** Processing line: ~ state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0~ +** Processing line: ~* DOCS: ~Array#reject_nil~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#reject_nil~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # car wraps around to bottom of screen if it disappears at the top of the screen~ -** Processing line: ~ # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!)~ -** Processing line: ~ state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope~ +** Processing line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # car wraps around to top of screen if it disappears at the bottom of the screen~ -** Processing line: ~ state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [1, nil, 4, false, :a]~ +** Processing line: ~ puts a.reject_nil~ +** Processing line: ~ # => [1, 4, false, :a]~ +** Processing line: ~ puts a.compact~ +** Processing line: ~ # => [1, 4, false, :a]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Changes angle of sprite based on user input from keyboard or controller~ -** Processing line: ~ def process_inputs args~ ** Processing line: ~~ -** Processing line: ~ # NOTE: increasing the angle doesn't mean that the car will continue to go~ -** Processing line: ~ # in a specific direction. The angle is increasing, which means that if the~ -** Processing line: ~ # left key was kept in the "down" state, the change in the angle would cause~ -** Processing line: ~ # the car to go in a counter-clockwise direction and form a circle (360 degrees)~ -** Processing line: ~ if args.inputs.keyboard.key_held.left # if left key is pressed~ -** Processing line: ~ args.state.angle += 2 # car's angle is incremented by 2~ ** Processing line: ~~ -** Processing line: ~ # The same applies to decreasing the angle. If the right key was kept in the~ -** Processing line: ~ # "down" state, the decreasing angle would cause the car to go in a clockwise~ -** Processing line: ~ # direction and form a circle (360 degrees)~ -** Processing line: ~ elsif args.inputs.keyboard.key_held.right # if right key is pressed~ -** Processing line: ~ args.state.angle -= 2 # car's angle is decremented by 2~ +** Processing line: ~* DOCS: ~Array#reject_false~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#reject_false~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Input from a controller can also change the angle of the car~ -** Processing line: ~ elsif args.inputs.controller_one.left_analog_x_perc != 0~ -** Processing line: ~ args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # A sprite's center of rotation can be altered~ -** Processing line: ~ # Increasing either of these numbers would dramatically increase the~ -** Processing line: ~ # car's drift when it turns!~ -** Processing line: ~ def rotation_anchor~ -** Processing line: ~ [0.7, 0.5]~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [1, nil, 4, false, :a]~ +** Processing line: ~ puts a.reject_false~ +** Processing line: ~ # => [1, 4, :a]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Sets opacity value of sprite to 255 so that it is not transparent at all~ -** Processing line: ~ # Change it to 0 and you won't be able to see the car sprite on the screen~ -** Processing line: ~ def opacity~ -** Processing line: ~ 255~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets the color of the sprite to white.~ -** Processing line: ~ def saturation~ -** Processing line: ~ [255, 255, 255]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets definition of destination_rect (used to define the car sprite)~ -** Processing line: ~ def destination_rect state~ -** Processing line: ~ [state.x, state.y,~ -** Processing line: ~ state.sprite.width * state.sprite.scale, # multiplies by 4 to set size~ -** Processing line: ~ state.sprite.height * state.sprite.scale]~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~Array#product~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#product~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Portion of a sprite (a tile)~ -** Processing line: ~ # Sub division of sprite is denoted as a rectangle directly related to original size of .png~ -** Processing line: ~ # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height)~ -** Processing line: ~ def source_rect state~ -** Processing line: ~ [0, 0, state.sprite.width, state.sprite.height]~ +** Processing line: ~Returns all combinations of values between two arrays.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns all combinations of values between two arrays.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [0, 1]~ +** Processing line: ~ puts a.product~ +** Processing line: ~ # => [[0, 0], [0, 1], [1, 0], [1, 1]]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ ** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [ 0, 1]~ +** Processing line: ~ b = [:a, :b]~ +** Processing line: ~ puts a.product b~ +** Processing line: ~ # => [[0, :a], [0, :b], [1, :a], [1, :b]]~ +** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/01_simple/app/main.rb~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#map_2d~~ - H1 detected. -- Formatting line: ~04_physics_and_collisions/01_simple/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#map_2d~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ +** Processing line: ~#+begin_src~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ repl do~ +** Processing line: ~ stage = [~ +** Processing line: ~ [:enemy, :empty, :player],~ +** Processing line: ~ [:empty, :empty, :empty],~ +** Processing line: ~ [:enemy, :empty, :enemy],~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +** Processing line: ~ occupied_tiles = stage.map_2d do |row, col, tile|~ +** Processing line: ~ if tile == :empty~ +** Processing line: ~ nil~ +** Processing line: ~ else~ +** Processing line: ~ [row, col, tile]~ +** Processing line: ~ end~ +** Processing line: ~ end.reject_nil~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ puts "Stage:"~ +** Processing line: ~ puts stage~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ puts "Occupied Tiles"~ +** Processing line: ~ puts occupied_tiles~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # This sample app shows collisions between two boxes.~ ** Processing line: ~~ -** Processing line: ~ # Runs methods needed for game to run properly.~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to move a square over time and determine collision."~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values.~ -** Processing line: ~ def defaults args~ -** Processing line: ~ # These values represent the moving box.~ -** Processing line: ~ args.state.moving_box_speed = 10~ -** Processing line: ~ args.state.moving_box_size = 100~ -** Processing line: ~ args.state.moving_box_dx ||= 1~ -** Processing line: ~ args.state.moving_box_dy ||= 1~ -** Processing line: ~ args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height~ +** Processing line: ~* DOCS: ~Array#include_any?~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#include_any?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # These values represent the center box.~ -** Processing line: ~ args.state.center_box ||= [540, 260, 200, 200, 180]~ -** Processing line: ~ args.state.center_box_collision ||= false # initially no collision~ -** Processing line: ~ end~ +** Processing line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ # If the game state denotes that a collision has occured,~ -** Processing line: ~ # render a solid square, otherwise render a border instead.~ -** Processing line: ~ if args.state.center_box_collision~ -** Processing line: ~ args.outputs.solids << args.state.center_box~ -** Processing line: ~ else~ -** Processing line: ~ args.outputs.borders << args.state.center_box~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Then render the moving box.~ -** Processing line: ~ args.outputs.solids << args.state.moving_box~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~Array#any_intersect_rect?~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Array#any_intersect_rect?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Generally in a pipeline for a game engine, you have rendering,~ -** Processing line: ~ # game simulation (calculation), and input processing.~ -** Processing line: ~ # This fuction represents the game simulation.~ -** Processing line: ~ def calc args~ -** Processing line: ~ position_moving_box args~ -** Processing line: ~ determine_collision_center_box args~ -** Processing line: ~ end~ +** Processing line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ +- Line's tilde count is: 12 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed,~ -** Processing line: ~ # and adding it to the current position.~ -** Processing line: ~ # dx and dy are positive if the box is moving right and up, respectively~ -** Processing line: ~ # dx and dy are negative if the box is moving left and down, respectively~ -** Processing line: ~ def position_moving_box args~ -** Processing line: ~ args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed~ -** Processing line: ~ args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ # Here is a player class that has position and implement~ +** Processing line: ~ # the ~attr_rect~ contract.~ +** Processing line: ~ class Player~ +** Processing line: ~ attr_rect~ +** Processing line: ~ attr_accessor :x, :y, :w, :h~ ** Processing line: ~~ -** Processing line: ~ # 1280x720 are the virtual pixels you work with (essentially 720p).~ -** Processing line: ~ screen_width = 1280~ -** Processing line: ~ screen_height = 720~ +** Processing line: ~ def initialize x, y, w, h~ +** Processing line: ~ @x = x~ +** Processing line: ~ @y = y~ +** Processing line: ~ @w = w~ +** Processing line: ~ @h = h~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Position of the box is denoted by the bottom left hand corner, in~ -** Processing line: ~ # that case, we have to subtract the width of the box so that it stays~ -** Processing line: ~ # in the scene (you can try deleting the subtraction to see how it~ -** Processing line: ~ # impacts the box's movement).~ -** Processing line: ~ if args.state.moving_box.x > screen_width - args.state.moving_box_size~ -** Processing line: ~ args.state.moving_box_dx = -1 # moves left~ -** Processing line: ~ elsif args.state.moving_box.x < 0~ -** Processing line: ~ args.state.moving_box_dx = 1 # moves right~ -** Processing line: ~ end~ +** Processing line: ~ def serialize~ +** Processing line: ~ { x: @x, y: @y, w: @w, h: @h }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Here, we're making sure the moving box remains within the vertical scope of the screen~ -** Processing line: ~ if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high~ -** Processing line: ~ args.state.moving_box_dy = -1 # moves down~ -** Processing line: ~ elsif args.state.moving_box.y < 0 # if the box moves too low~ -** Processing line: ~ args.state.moving_box_dy = 1 # moves up~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def inspect~ +** Processing line: ~ "#{serialize}"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def determine_collision_center_box args~ -** Processing line: ~ # Collision is handled by the engine. You simply have to call the~ -** Processing line: ~ # `intersect_rect?` function.~ -** Processing line: ~ if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect~ -** Processing line: ~ args.state.center_box_collision = true # then a collision happened~ -** Processing line: ~ else~ -** Processing line: ~ args.state.center_box_collision = false # otherwise, no collision happened~ +** Processing line: ~ def to_s~ +** Processing line: ~ "#{serialize}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~ # Here is a definition of two walls.~ +** Processing line: ~ walls = [~ +** Processing line: ~ [10, 10, 10, 10],~ +** Processing line: ~ { x: 20, y: 20, w: 10, h: 10 },~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~ # Display the walls.~ +** Processing line: ~ puts "Walls."~ +** Processing line: ~ puts walls~ +** Processing line: ~ puts ""~ +** Processing line: ~~ +** Processing line: ~ # Check any_intersect_rect? on player~ +** Processing line: ~ player = Player.new 30, 20, 10, 10~ +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +** Processing line: ~ # => false~ +** Processing line: ~ # The value is false because of the default tolerance is 0.1.~ +** Processing line: ~ # The overlap of the player rect and any of the wall rects is~ +** Processing line: ~ # less than 0.1 (for those that intersect).~ +** Processing line: ~ puts ""~ ** Processing line: ~~ +** Processing line: ~ player = Player.new 9, 10, 10, 10~ +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +** Processing line: ~ # => true~ +** Processing line: ~ puts ""~ +** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/02_moving_objects/app/main.rb~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Outputs~~ - H1 detected. -- Formatting line: ~04_physics_and_collisions/02_moving_objects/app/main.rb~ -- Line's tilde count is: 0 +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Outputs~~ +- Line's tilde count is: 2 - Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # code goes here~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ -** Processing line: ~ using their keys.~ ** Processing line: ~~ -** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ -** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ -** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ -** Processing line: ~ and on it goes.~ ** Processing line: ~~ -** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ -** Processing line: ~ puts numbers["one"]~ -** Processing line: ~ which would print "uno" to the console.~ +** Processing line: ~* DOCS: ~GTK::Outputs#solids~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Outputs#solids~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ -** Processing line: ~ For example, if we have the command~ -** Processing line: ~ puts 4.greater(3)~ -** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ -** Processing line: ~ Similar to lesser, which returns the lesser value.~ +** Processing line: ~Add primitives to this collection to render a solid to the screen.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Add primitives to this collection to render a solid to the screen.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ -** Processing line: ~ For example, in the statement~ -** Processing line: ~ a = 4.lesser(3)~ -** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ -** Processing line: ~ but if the statement had been~ -** Processing line: ~ a = 4.lesser(5)~ -** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ +** Processing line: ~** Rendering a solid using an Array~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ -** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ -** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ +** Processing line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ -** Processing line: ~ For example, you can find all elements of a collection that are divisible by 2~ -** Processing line: ~ or find all objects that have intersected with another object.~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - abs: Returns the absolute value.~ -** Processing line: ~ For example, the command~ -** Processing line: ~ (-30).abs~ -** Processing line: ~ would return 30 as a result.~ ** Processing line: ~~ -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ +** Processing line: ~** Rendering a solid using an Array with colors and alpha~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Creates a green solid rectangle with an opacity of 50%.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Creates a green solid rectangle with an opacity of 50%.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.KEY: Determines if a key has been pressed.~ -** Processing line: ~ For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md.~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~** Rendering a solid using a Hash~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Calls methods needed for game to run properly~ +** Processing line: ~#+begin_src~ +- PRE start detected. ** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ input args~ +** Processing line: ~ args.outputs.solids << {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ r: 0,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 0,~ +** Processing line: ~ a: 255~ +** Processing line: ~ }~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # sets default values and creates empty collections~ -** Processing line: ~ # initialization only happens in the first frame~ -** Processing line: ~ def defaults args~ -** Processing line: ~ fiddle args~ -** Processing line: ~ args.state.enemy.hammers ||= []~ -** Processing line: ~ args.state.enemy.hammer_queue ||= []~ -** Processing line: ~ args.state.tick_count = args.state.tick_count~ -** Processing line: ~ args.state.bridge_top = 128~ -** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ -** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ -** Processing line: ~ args.state.player.w ||= 64~ -** Processing line: ~ args.state.player.h ||= 64~ -** Processing line: ~ args.state.player.dy ||= 0~ -** Processing line: ~ args.state.player.dx ||= 0~ -** Processing line: ~ args.state.enemy.x ||= 800 # initializes enemy's properties~ -** Processing line: ~ args.state.enemy.y ||= 0~ -** Processing line: ~ args.state.enemy.w ||= 128~ -** Processing line: ~ args.state.enemy.h ||= 128~ -** Processing line: ~ args.state.enemy.dy ||= 0~ -** Processing line: ~ args.state.enemy.dx ||= 0~ -** Processing line: ~ args.state.game_over_at ||= 0~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # sets enemy, player, hammer values~ -** Processing line: ~ def fiddle args~ -** Processing line: ~ args.state.gravity = -0.3~ -** Processing line: ~ args.state.enemy_jump_power = 10 # sets enemy values~ -** Processing line: ~ args.state.enemy_jump_interval = 60~ -** Processing line: ~ args.state.hammer_throw_interval = 40 # sets hammer values~ -** Processing line: ~ args.state.hammer_launch_power_default = 5~ -** Processing line: ~ args.state.hammer_launch_power_near = 2~ -** Processing line: ~ args.state.hammer_launch_power_far = 7~ -** Processing line: ~ args.state.hammer_upward_launch_power = 15~ -** Processing line: ~ args.state.max_hammers_per_volley = 10~ -** Processing line: ~ args.state.gap_between_hammers = 10~ -** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ -** Processing line: ~ args.state.player_jump_power_duration = 10~ -** Processing line: ~ args.state.player_max_run_speed = 10~ -** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ -** Processing line: ~ args.state.player_acceleration = 1~ -** Processing line: ~ args.state.hammer_size = 32~ -** Processing line: ~ end~ +** Processing line: ~** Rendering a solid using a Class~ +- H2 detected. +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Determining if line is a header. +- Line contains ~** ~... gsub-ing empty string +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # outputs objects onto the screen~ -** Processing line: ~ def render args~ -** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ -** Processing line: ~ # sets x by multiplying 64 to index to find pixel value (places all squares side by side)~ -** Processing line: ~ # subtracts 64 from bridge_top because position is denoted by bottom left corner~ -** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ -** Processing line: ~ end~ +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Here is an example:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here is an example:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0]~ -** Processing line: ~ args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box)~ -** Processing line: ~ args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box)~ -** Processing line: ~ args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ # Create type with ALL solid properties AND primitive_marker~ +** Processing line: ~ class Solid~ +** Processing line: ~ attr_accessor :x, :y, :w, :h, :r, :g, :b, :a~ +** Processing line: ~~ +** Processing line: ~ def primitive_marker~ +** Processing line: ~ :solid~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Performs calculations to move objects on the screen~ -** Processing line: ~ def calc args~ +** Processing line: ~ # Inherit from type~ +** Processing line: ~ class Square < Solid~ +** Processing line: ~ # constructor~ +** Processing line: ~ def initialize x, y, size~ +** Processing line: ~ self.x = x~ +** Processing line: ~ self.y = y~ +** Processing line: ~ self.w = size~ +** Processing line: ~ self.h = size~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ -** Processing line: ~ args.state.player.x += args.state.player.dx~ -** Processing line: ~ args.state.player.y += args.state.player.dy~ +** Processing line: ~ def tick args~ +** Processing line: ~ # render solid/border~ +** Processing line: ~ args.outputs.solids << Square.new(10, 10, 32)~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ -** Processing line: ~ args.state.player.dy += args.state.gravity~ ** Processing line: ~~ -** Processing line: ~ # player's y position is either current y position or y position of top of~ -** Processing line: ~ # bridge, whichever has a greater value~ -** Processing line: ~ # ensures that the player never goes below the bridge~ -** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ ** Processing line: ~~ -** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ -** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ -** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ +** Processing line: ~* DOCS: ~GTK::Outputs#borders~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Outputs#borders~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # player is not falling if it is located on the top of the bridge~ -** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ -** Processing line: ~ args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ +** Processing line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~The only difference between the two primitives is where they are added.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The only difference between the two primitives is where they are added.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Instead of using ~args.outputs.solids~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Instead of using ~args.outputs.solids~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx~ -** Processing line: ~ args.state.enemy.y += args.state.enemy.dy # same with y and dy~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # ensures that the enemy never goes below the bridge~ -** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ +** Processing line: ~You have to use ~args.outputs.borders~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~You have to use ~args.outputs.borders~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # ensures that the enemy never goes too far left (outside the screen's scope)~ -** Processing line: ~ args.state.enemy.x = args.state.enemy.x.greater(0)~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.borders << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # objects that go up must come down because of gravity~ -** Processing line: ~ args.state.enemy.dy += args.state.gravity~ ** Processing line: ~~ -** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ ** Processing line: ~~ -** Processing line: ~ #sets definition of enemy~ -** Processing line: ~ args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w]~ +** Processing line: ~* DOCS: ~GTK::Mouse~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::Mouse~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge~ -** Processing line: ~ args.state.enemy.dy = 0 # there is no change in y~ -** Processing line: ~ end~ +** Processing line: ~The mouse is accessible via ~args.inputs.mouse~:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The mouse is accessible via ~args.inputs.mouse~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # if 60 frames have passed and the enemy is not moving vertically~ -** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0~ -** Processing line: ~ args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse).~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}."~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # if 40 frames have passed or 5 frames have passed since the game ended~ -** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5~ -** Processing line: ~ # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded)~ -** Processing line: ~ # that is why we're adding 1, to include the max possibility~ -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations)~ +** Processing line: ~The mouse has the following properties.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The mouse has the following properties.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # if the horizontal distance between the player and enemy is less than 128 pixels~ -** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs < 128~ -** Processing line: ~ # the change in x won't be that great since the enemy and player are closer to each other~ -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # if the horizontal distance between the player and enemy is greater than 300 pixels~ -** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs > 300~ -** Processing line: ~ # change in x will be more drastic since player and enemy are so far apart~ -** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change~ -** Processing line: ~ end~ +** Processing line: ~- ~args.inputs.mouse.x~: Returns the x position of the mouse.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.x~: Returns the x position of the mouse.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.y~: Returns the y position of the mouse.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.y~: Returns the y position of the mouse.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i|~ -** Processing line: ~ args.state.enemy.hammer_queue << { # stores hammer values in a hash~ -** Processing line: ~ x: args.state.enemy.x,~ -** Processing line: ~ w: args.state.hammer_size,~ -** Processing line: ~ h: args.state.hammer_size,~ -** Processing line: ~ dx: volley_dx, # change in horizontal position~ -** Processing line: ~ # multiplication operator takes precedence over addition operator~ -** Processing line: ~ throw_at: args.state.tick_count + i * args.state.gap_between_hammers~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~GTK::MousePoint~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::MousePoint~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # add elements from hammer_queue collection to the hammers collection by~ -** Processing line: ~ # finding all hammers that were thrown before the current frame (have already been thrown)~ -** Processing line: ~ args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h|~ -** Processing line: ~ h[:throw_at] < args.state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~The ~GTK::MousePoint~ has the following properties.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The ~GTK::MousePoint~ has the following properties.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ args.state.enemy.hammers.each do |h| # sets values for all hammers in collection~ -** Processing line: ~ h[:y] ||= args.state.enemy.y + 130~ -** Processing line: ~ h[:dy] ||= args.state.hammer_upward_launch_power~ -** Processing line: ~ h[:dy] += args.state.gravity # acceleration is change in gravity~ -** Processing line: ~ h[:x] += h[:dx] # incremented by change in position~ -** Processing line: ~ h[:y] += h[:dy]~ -** Processing line: ~ h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect~ -** Processing line: ~ end~ +** Processing line: ~- ~x~: Integer representing the mouse's x.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~x~: Integer representing the mouse's x.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~y~: Integer representing the mouse's y.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~y~: Integer representing the mouse's y.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~point~: Array with the ~x~ and ~y~ values.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~point~: Array with the ~x~ and ~y~ values.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # reject hammers that have been thrown before current frame (have already been thrown)~ -** Processing line: ~ args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h|~ -** Processing line: ~ h[:throw_at] < args.state.tick_count~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # any hammers with a y position less than 0 are rejected from the hammers collection~ -** Processing line: ~ # since they have gone too far down (outside the scope's screen)~ -** Processing line: ~ args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 }~ +** Processing line: ~* DOCS: ~GTK::OpenEntity~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::OpenEntity~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # if there are any hammers that intersect with (or hit) the player,~ -** Processing line: ~ # the reset_player method is called (so the game can start over)~ -** Processing line: ~ if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) }~ -** Processing line: ~ reset_player args~ -** Processing line: ~ end~ +** Processing line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # if the enemy's rect intersects with (or hits) the player,~ -** Processing line: ~ # the reset_player method is called (so the game can start over)~ -** Processing line: ~ if args.state.enemy.rect.intersect_rect? args.state.player.rect~ -** Processing line: ~ reset_player args~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.x ||= 100~ +** Processing line: ~ args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ -** Processing line: ~ def reset_player args~ -** Processing line: ~ args.state.player.x = 0~ -** Processing line: ~ args.state.player.y = args.state.bridge_top~ -** Processing line: ~ args.state.player.dy = 0~ -** Processing line: ~ args.state.player.dx = 0~ -** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ -** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ -** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ +** Processing line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For example:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~For example:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # intermediate player object does not need to be created~ +** Processing line: ~ args.state.player.x ||= 100~ +** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ "player x, y is:#{args.state.player.x}, #{args.state.player.y}."~ +** Processing line: ~ ]~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Processes input from the user to move the player~ -** Processing line: ~ def input args~ -** Processing line: ~ if args.inputs.keyboard.space # if the user presses the space bar~ -** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ ** Processing line: ~~ -** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ -** Processing line: ~ # the player is not falling~ -** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ -** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ -** Processing line: ~ if args.inputs.keyboard.key_up.space~ -** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ -** Processing line: ~ args.state.player.falling = true # the player is falling~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~GTK::OpenEntity#as_hash~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~GTK::OpenEntity#as_hash~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.left # if left key is pressed~ -** Processing line: ~ args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)~ -** Processing line: ~ # dx is either set to current dx or the negative max run speed (which would be -10),~ -** Processing line: ~ # whichever has a greater value~ -** Processing line: ~ args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)~ -** Processing line: ~ elsif args.inputs.keyboard.right # if right key is pressed~ -** Processing line: ~ args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)~ -** Processing line: ~ # dx is either set to current dx or max run speed (which would be 10),~ -** Processing line: ~ # whichever has a lesser value~ -** Processing line: ~ args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)~ -** Processing line: ~ else~ -** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.space ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.x ||= 100~ +** Processing line: ~ args.state.y ||= 100~ +** Processing line: ~ values = args.state~ +** Processing line: ~ .as_hash~ +** Processing line: ~ .map { |k, v| "#{k} #{v}" }~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.labels << values.map.with_index do |v, i|~ +** Processing line: ~ [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710 - (30 * i),~ +** Processing line: ~ v~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/03_entities/app/main.rb~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#frame_index~~ - H1 detected. -- Formatting line: ~04_physics_and_collisions/03_entities/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Numeric#frame_index~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~frame_index~ takes three additional parameters:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~frame_index~ takes three additional parameters:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~- How many frames exist in the sprite animation.~ +- UL start detected. +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~How many frames exist in the sprite animation.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- How long to hold each animation for.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~How long to hold each animation for.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Whether the animation should repeat.~ +- LI detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Whether the animation should repeat.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ +- UL end detected. +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example using variables:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example using variables:~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ def tick args~ +** Processing line: ~ start_looping_at = 0~ +** Processing line: ~ number_of_sprites = 6~ +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ +** Processing line: ~ does_sprite_loop = true~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ sprite_index =~ +** Processing line: ~ start_looping_at.frame_index number_of_sprites,~ +** Processing line: ~ number_of_frames_to_show_each_sprite,~ +** Processing line: ~ does_sprite_loop~ ** Processing line: ~~ -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ +** Processing line: ~ sprite_index ||= 0~ ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ -** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ -** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50,~ +** Processing line: ~ 360 - 50,~ +** Processing line: ~ 100,~ +** Processing line: ~ 100,~ +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ In this sample app, new_entity is used to define the properties of enemies and bullets.~ -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ +** Processing line: ~Example using named parameters:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example using named parameters:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label on the screen.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ start_looping_at = 0~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +** Processing line: ~ sprite_index =~ +** Processing line: ~ start_looping_at.frame_index count: 6,~ +** Processing line: ~ hold_for: 4,~ +** Processing line: ~ repeat: true,~ +** Processing line: ~ tick_count_override: args.state.tick_count~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ +** Processing line: ~ sprite_index ||= 0~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50,~ +** Processing line: ~ 360 - 50,~ +** Processing line: ~ 100,~ +** Processing line: ~ 100,~ +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # This sample app shows enemies that contain an id value and the time they were created.~ -** Processing line: ~ # These enemies can be removed by shooting at them with bullets.~ ** Processing line: ~~ -** Processing line: ~ # Calls all methods necessary for the game to function properly.~ -** Processing line: ~ def tick args~ -** Processing line: ~ tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet."~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ process_inputs args~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values~ -** Processing line: ~ # Enemies and bullets start off as empty collections~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.state.enemies ||= []~ -** Processing line: ~ args.state.bullets ||= []~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~Numeric#elapsed_time~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Numeric#elapsed_time~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here is an example of how elapsed_time can be used.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Here is an example of how elapsed_time can be used.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Provides each enemy in enemies collection with rectangular border,~ -** Processing line: ~ # as well as a label showing id and when they were created~ -** Processing line: ~ def render args~ -** Processing line: ~ # When you're calling a method that takes no arguments, you can use this & syntax on map.~ -** Processing line: ~ # Numbers are being added to x and y in order to keep the text within the enemy's borders.~ -** Processing line: ~ args.outputs.borders << args.state.enemies.map(&:rect)~ -** Processing line: ~ args.outputs.labels << args.state.enemies.flat_map do |enemy|~ -** Processing line: ~ [~ -** Processing line: ~ [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0],~ -** Processing line: ~ [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created~ -** Processing line: ~ ]~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.last_click_at ||= 0~ +** Processing line: ~~ +** Processing line: ~ # record when a mouse click occurs~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_click_at = args.state.tick_count~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs bullets in bullets collection as rectangular solids~ -** Processing line: ~ args.outputs.solids << args.state.bullets.map(&:rect)~ +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +** Processing line: ~ if args.state.last_click_at.elapsed_time > 120~ +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."]~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Calls all methods necessary for performing calculations~ -** Processing line: ~ def calc args~ -** Processing line: ~ add_new_enemies_if_needed args~ -** Processing line: ~ move_bullets args~ -** Processing line: ~ calculate_collisions args~ -** Processing line: ~ remove_bullets_of_screen args~ -** Processing line: ~ end~ +** Processing line: ~And here is an example where the override parameter is passed in:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~And here is an example where the override parameter is passed in:~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Adds enemies to the enemies collection and sets their values~ -** Processing line: ~ def add_new_enemies_if_needed args~ -** Processing line: ~ return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added~ -** Processing line: ~ return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.last_click_at ||= 0~ ** Processing line: ~~ -** Processing line: ~ args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total~ -** Processing line: ~ args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity~ -** Processing line: ~ e.x = 640 + 500 * rand # each enemy is given random position on screen~ -** Processing line: ~ e.y = 600 * rand + 50~ -** Processing line: ~ e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect~ -** Processing line: ~ end~ +** Processing line: ~ # create a state variable that tracks time at half the speed of args.state.tick_count~ +** Processing line: ~ args.state.simulation_tick = args.state.tick_count.idiv 2~ +** Processing line: ~~ +** Processing line: ~ # record when a mouse click occurs~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_click_at = args.state.simulation_tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +** Processing line: ~ if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120~ +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."]~ ** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Moves bullets across screen~ -** Processing line: ~ # Sets definition of the bullets~ -** Processing line: ~ def move_bullets args~ -** Processing line: ~ args.state.bullets.each do |bullet| # perform action on each bullet in collection~ -** Processing line: ~ bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)~ ** Processing line: ~~ -** Processing line: ~ # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out~ -** Processing line: ~ # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to~ -** Processing line: ~ # see what happens to the bullet's movement.~ -** Processing line: ~ bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)~ -** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#elapsed?~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Numeric#elapsed?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example usage (no optional parameter):~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example usage (no optional parameter):~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ +** Processing line: ~~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +** Processing line: ~ args.state.box_queue << { name: :green,~ +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +** Processing line: ~ args.state.box_queue << { name: :blue,~ +** Processing line: ~ destroy_at: args.state.tick_count + 120 }~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Determines if a bullet hits an enemy~ -** Processing line: ~ def calculate_collisions args~ -** Processing line: ~ args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections~ -** Processing line: ~ args.state.enemies.each do |enemy|~ -** Processing line: ~ # if bullet has not exploded yet and the bullet hits an enemy~ -** Processing line: ~ if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)~ -** Processing line: ~ bullet.exploded = true # bullet explodes~ -** Processing line: ~ enemy.dead = true # enemy is killed~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ boxes_to_destroy = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:destroy_at].elapsed? }~ +** Processing line: ~~ +** Processing line: ~ if !boxes_to_destroy.empty?~ +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # All exploded bullets are rejected or removed from the bullets collection~ -** Processing line: ~ # and any dead enemy is rejected from the enemies collection.~ -** Processing line: ~ args.state.bullets = args.state.bullets.reject(&:exploded)~ -** Processing line: ~ args.state.enemies = args.state.enemies.reject(&:dead)~ -** Processing line: ~ end~ +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ ** Processing line: ~~ -** Processing line: ~ # Bullets are rejected from bullets collection once their position exceeds the width of screen~ -** Processing line: ~ def remove_bullets_of_screen args~ -** Processing line: ~ args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280~ +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ ** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Calls fire_bullet method~ -** Processing line: ~ def process_inputs args~ -** Processing line: ~ fire_bullet args~ -** Processing line: ~ end~ +** Processing line: ~Example usage (with optional parameter):~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example usage (with optional parameter):~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection~ -** Processing line: ~ def fire_bullet args~ -** Processing line: ~ return unless args.inputs.mouse.click # return unless mouse is clicked~ -** Processing line: ~ args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity~ -** Processing line: ~ bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked~ -** Processing line: ~ bullet.x = 0 # starts on the left side of the screen~ -** Processing line: ~ bullet.size = 10~ -** Processing line: ~ bullet.speed = 10 * rand + 2 # speed of a bullet is randomized~ -** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ +** Processing line: ~~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 60 }~ +** Processing line: ~ args.state.box_queue << { name: :green,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 60 }~ +** Processing line: ~ args.state.box_queue << { name: :blue,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 120 }~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.space ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ # lifespan is passed in as a parameter to ~elapsed?~~ +** Processing line: ~ boxes_to_destroy = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:create_at].elapsed? b[:lifespan] }~ +** Processing line: ~~ +** Processing line: ~ if !boxes_to_destroy.empty?~ +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ ** Processing line: ~~ +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +** Processing line: ~ end~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/04_box_collision/app/main.rb~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#created?~~ - H1 detected. -- Formatting line: ~04_physics_and_collisions/04_box_collision/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Numeric#created?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example usage:~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Example usage:~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ create_at: args.state.tick_count + 60 }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - first: Returns the first element of the array.~ -** Processing line: ~ For example, if we have an array~ -** Processing line: ~ numbers = [1, 2, 3, 4, 5]~ -** Processing line: ~ and we call first by saying~ -** Processing line: ~ numbers.first~ -** Processing line: ~ the number 1 will be returned because it is the first element of the numbers array.~ +** Processing line: ~ boxes_to_spawn_this_frame = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:create_at].new? }~ ** Processing line: ~~ -** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ -** Processing line: ~ For example,~ -** Processing line: ~ 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer.~ -** Processing line: ~ 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal.~ +** Processing line: ~ boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." }~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ args.state.box_queue -= boxes_to_spawn_this_frame~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ -** Processing line: ~ considered a rect. The intersect_rect? function returns true~ -** Processing line: ~ or false depending on if the two rectangles intersect.~ +** Processing line: ~* DOCS: ~Kernel~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Kernel~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # This sample app allows users to create tiles and place them anywhere on the screen as obstacles.~ -** Processing line: ~ # The player can then move and maneuver around them.~ +** Processing line: ~* DOCS: ~Kernel::tick_count~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Kernel::tick_count~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ class PoorManPlatformerPhysics~ -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ +** Processing line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Calls all methods necessary for the app to run successfully.~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ process_inputs~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values for variables.~ -** Processing line: ~ # The ||= sign means that the variable will only be set to the value following the = sign if the value has~ -** Processing line: ~ # not already been set before. Intialization happens only in the first frame.~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.tile_size = 64~ -** Processing line: ~ state.gravity = -0.2~ -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ -** Processing line: ~ state.x ||= 0~ -** Processing line: ~ state.y ||= 800~ -** Processing line: ~ state.dy ||= 0~ -** Processing line: ~ state.dx ||= 0~ -** Processing line: ~ state.world ||= []~ -** Processing line: ~ state.world_lookup ||= {}~ -** Processing line: ~ state.world_collision_rects ||= []~ -** Processing line: ~ end~ +** Processing line: ~* DOCS: ~Kernel::global_tick_count~~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~DOCS: ~Kernel::global_tick_count~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. ** Processing line: ~~ -** Processing line: ~ # Outputs solids and borders of different colors for the world and collision_rects collections.~ -** Processing line: ~ def render~ +** Processing line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Sets a black background on the screen (Comment this line out and the background will become white.)~ -** Processing line: ~ # Also note that black is the default color for when no color is assigned.~ -** Processing line: ~ outputs.solids << grid.rect~ ** Processing line: ~~ -** Processing line: ~ # The position, size, and color (white) are set for borders given to the world collection.~ -** Processing line: ~ # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.~ -** Processing line: ~ outputs.borders << state.world.map do |x, y|~ -** Processing line: ~ [x * state.tile_size,~ -** Processing line: ~ y * state.tile_size,~ -** Processing line: ~ state.tile_size,~ -** Processing line: ~ state.tile_size, 255, 255, 255]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The top, bottom, and sides of the borders for collision_rects are different colors.~ -** Processing line: ~ outputs.borders << state.world_collision_rects.map do |e|~ -** Processing line: ~ [~ -** Processing line: ~ [e[:top], 0, 170, 0], # top is a shade of green~ -** Processing line: ~ [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue~ -** Processing line: ~ [e[:left_right], 170, 0, 0], # left and right are a shade of red~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~* Open Source~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Open Source~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ +- P detected. +- Determining if line is a header. +- Line does not appear to be a header. +- Formatting line: ~Follows is a source code listing for all files that have been open sourced. This code can be found in the ~./samples~ directory and online at [[https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/]].~ +- Line's tilde count is: 2 +- Line contains link marker: true +- CODE detected. +- LINK detected. +** Processing line: ~* Learn Ruby Optional - Beginner Ruby Primer - automation.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Beginner Ruby Primer - automation.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Sets the position, size, and color (a shade of green) of the borders of only the player's~ -** Processing line: ~ # box and outputs it. If you change the 180 to 0, the player's box will be black and you~ -** Processing line: ~ # won't be able to see it (because it will match the black background).~ -** Processing line: ~ outputs.borders << [state.x,~ -** Processing line: ~ state.y,~ -** Processing line: ~ state.tile_size,~ -** Processing line: ~ state.tile_size, 0, 180, 0]~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/automation.rb~ +** Processing line: ~ # ==========================================================================~ +** Processing line: ~ # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _~ +** Processing line: ~ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | |~ +** Processing line: ~ # | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | |~ +** Processing line: ~ # | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | |~ +** Processing line: ~ # | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_|~ +** Processing line: ~ # |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_)~ +** Processing line: ~ #~ +** Processing line: ~ #~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # \ | /~ +** Processing line: ~ # \ | /~ +** Processing line: ~ # +~ +** Processing line: ~ #~ +** Processing line: ~ # If you are new to the programming language Ruby, then you may find the~ +** Processing line: ~ # following code a bit overwhelming. Come back to this file when you have~ +** Processing line: ~ # a better grasp of Ruby and Game Toolkit.~ +** Processing line: ~ #~ +** Processing line: ~ # What follows is an automations script # that can be run via terminal:~ +** Processing line: ~ # ./samples/00_beginner_ruby_primer $ ../../dragonruby . --eval app/automation.rb~ +** Processing line: ~ # ==========================================================================~ ** Processing line: ~~ -** Processing line: ~ # Calls methods needed to perform calculations.~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_world_lookup~ -** Processing line: ~ calc_player~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.scheduled_callbacks.clear~ +** Processing line: ~ $gtk.schedule_callback 10 do~ +** Processing line: ~ $gtk.console.set_command 'puts "Hello DragonRuby!"'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Performs calculations on world_lookup and sets values.~ -** Processing line: ~ def calc_world_lookup~ +** Processing line: ~ $gtk.schedule_callback 20 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ -** Processing line: ~ # the previous tile size is set to the tile size,~ -** Processing line: ~ # and world_lookup hash is set to empty.~ -** Processing line: ~ if state.tile_size != state.previous_tile_size~ -** Processing line: ~ state.previous_tile_size = state.tile_size~ -** Processing line: ~ state.world_lookup = {} # empty hash~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 30 do~ +** Processing line: ~ $gtk.console.set_command 'outputs.solids << [910, 200, 100, 100, 255, 0, 0]'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # return if the world_lookup hash has keys (or, in other words, is not empty)~ -** Processing line: ~ # return unless the world collection has values inside of it (or is not empty)~ -** Processing line: ~ return if state.world_lookup.keys.length > 0~ -** Processing line: ~ return unless state.world.length > 0~ +** Processing line: ~ $gtk.schedule_callback 40 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Starts with an empty hash for world_lookup.~ -** Processing line: ~ # Searches through the world and finds the coordinates that exist.~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ +** Processing line: ~ $gtk.schedule_callback 50 do~ +** Processing line: ~ $gtk.console.set_command 'outputs.solids << [1010, 200, 100, 100, 0, 0, 255]'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Assigns world_collision_rects for every sprite drawn.~ -** Processing line: ~ state.world_collision_rects =~ -** Processing line: ~ state.world_lookup~ -** Processing line: ~ .keys~ -** Processing line: ~ .map do |coord_x, coord_y|~ -** Processing line: ~ s = state.tile_size~ -** Processing line: ~ # multiply by tile size so the grid coordinates; sets pixel value~ -** Processing line: ~ # don't forget that position is denoted by bottom left corner~ -** Processing line: ~ # set x = coord_x or y = coord_y and see what happens!~ -** Processing line: ~ x = s * coord_x~ -** Processing line: ~ y = s * coord_y~ -** Processing line: ~ {~ -** Processing line: ~ # The values added to x, y, and s position the world_collision_rects so they all appear~ -** Processing line: ~ # stacked (on top of world rects) but don't directly overlap.~ -** Processing line: ~ # Remove these added values and mess around with the rect placement!~ -** Processing line: ~ args: [coord_x, coord_y],~ -** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ -** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ -** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 60 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Performs calculations to change the x and y values of the player's box.~ -** Processing line: ~ def calc_player~ +** Processing line: ~ $gtk.schedule_callback 70 do~ +** Processing line: ~ $gtk.console.set_command 'outputs.sprites << [1110, 200, 100, 100, "sprites/dragon_fly_0.png"]'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame.~ -** Processing line: ~ # What goes up must come down because of gravity.~ -** Processing line: ~ state.dy += state.gravity~ +** Processing line: ~ $gtk.schedule_callback 80 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls the calc_box_collision and calc_edge_collision methods.~ -** Processing line: ~ calc_box_collision~ -** Processing line: ~ calc_edge_collision~ +** Processing line: ~ $gtk.schedule_callback 90 do~ +** Processing line: ~ $gtk.console.set_command "outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.~ -** Processing line: ~ state.y += state.dy~ -** Processing line: ~ state.x += state.dx~ +** Processing line: ~ $gtk.schedule_callback 100 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Scales dx down.~ -** Processing line: ~ state.dx *= 0.8~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 110 do~ +** Processing line: ~ $gtk.console.set_command "state.sprite_frame = state.tick_count.idiv(4).mod(6)"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls methods needed to determine collisions between player and world_collision rects.~ -** Processing line: ~ def calc_box_collision~ -** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ -** Processing line: ~ collision_floor!~ -** Processing line: ~ collision_left!~ -** Processing line: ~ collision_right!~ -** Processing line: ~ collision_ceiling!~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 120 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ -** Processing line: ~ def collision_floor!~ -** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ -** Processing line: ~ player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player~ +** Processing line: ~ $gtk.schedule_callback 130 do~ +** Processing line: ~ $gtk.console.set_command "outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0]"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Goes through world_collision_rects to find all intersections between the bottom of player's rect and~ -** Processing line: ~ # the top of a world_collision_rect (hence the "-0.1" above)~ -** Processing line: ~ floor_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ $gtk.schedule_callback 140 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless floor_collisions # return unless collision occurred~ -** Processing line: ~ state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect~ -** Processing line: ~ state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 150 do~ +** Processing line: ~ $gtk.console.set_command "state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\""~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ -** Processing line: ~ def collision_left!~ -** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ -** Processing line: ~ player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]~ +** Processing line: ~ $gtk.schedule_callback 160 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Goes through world_collision_rects to find all intersections beween the player's left side and the~ -** Processing line: ~ # right side of a world_collision_rect.~ -** Processing line: ~ left_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ $gtk.schedule_callback 170 do~ +** Processing line: ~ $gtk.console.set_command "outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0]"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ +** Processing line: ~ $gtk.schedule_callback 180 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # player's x is set to the value of the x of the collided rect's right side~ -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ -** Processing line: ~ state.dx = 0 # player isn't moving left because its path is blocked~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.schedule_callback 190 do~ +** Processing line: ~ $gtk.console.set_command "outputs.sprites << [910, 330, 370, 370, state.sprite_path]"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ -** Processing line: ~ def collision_right!~ -** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ -** Processing line: ~ player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size]~ +** Processing line: ~ $gtk.schedule_callback 200 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Goes through world_collision_rects to find all intersections between the player's right side~ -** Processing line: ~ # and the left side of a world_collision_rect (hence the "+0.1" above)~ -** Processing line: ~ right_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ $gtk.schedule_callback 300 do~ +** Processing line: ~ $gtk.console.set_command ":wq"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ +** Processing line: ~ $gtk.schedule_callback 400 do~ +** Processing line: ~ $gtk.console.eval_the_set_command~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # player's x is set to the value of the collided rect's left, minus the size of a rect~ -** Processing line: ~ # tile size is subtracted because player's position is denoted by bottom left corner~ -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ -** Processing line: ~ state.dx = 0 # player isn't moving right because its path is blocked~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ -** Processing line: ~ def collision_ceiling!~ -** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ -** Processing line: ~ player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size]~ -** Processing line: ~~ -** Processing line: ~ # Goes through world_collision_rects to find intersections between the bottom of a~ -** Processing line: ~ # world_collision_rect and the top of the player's rect (hence the "+0.1" above)~ -** Processing line: ~ ceil_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) }~ -** Processing line: ~ .first~ -** Processing line: ~~ -** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # player's y is set to the bottom y of the rect it collided with, minus the size of a rect~ -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ -** Processing line: ~ state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ -** Processing line: ~ def calc_edge_collision~ +** Processing line: ~* Learn Ruby Optional - Beginner Ruby Primer - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Beginner Ruby Primer - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ #Ensures that the player doesn't fall below the map.~ -** Processing line: ~ if state.y < 0~ -** Processing line: ~ state.y = 0~ -** Processing line: ~ state.dy = 0~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_beginner_ruby_primer/app/main.rb~ +** Processing line: ~ # ==========================================================================~ +** Processing line: ~ # _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _~ +** Processing line: ~ # | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | |~ +** Processing line: ~ # | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | |~ +** Processing line: ~ # | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | |~ +** Processing line: ~ # | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_|~ +** Processing line: ~ # |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_)~ +** Processing line: ~ #~ +** Processing line: ~ #~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # |~ +** Processing line: ~ # \ | /~ +** Processing line: ~ # \ | /~ +** Processing line: ~ # +~ +** Processing line: ~ #~ +** Processing line: ~ # If you are new to the programming language Ruby, then you may find the~ +** Processing line: ~ # following code a bit overwhelming. This sample is only designed to be~ +** Processing line: ~ # run interactively (as opposed to being manipulated via source code).~ +** Processing line: ~ #~ +** Processing line: ~ # Start up this sample and follow along by visiting:~ +** Processing line: ~ # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-primer.mp4~ +** Processing line: ~ #~ +** Processing line: ~ # It is STRONGLY recommended that you work through all the samples before~ +** Processing line: ~ # looking at the code in this file.~ +** Processing line: ~ # ==========================================================================~ ** Processing line: ~~ -** Processing line: ~ #Ensures that the player doesn't go too high.~ -** Processing line: ~ # Position of player is denoted by bottom left hand corner, which is why we have to subtract the~ -** Processing line: ~ # size of the player's box (so it remains visible on the screen)~ -** Processing line: ~ elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen~ -** Processing line: ~ state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ end~ +** Processing line: ~ class TutorialOutputs~ +** Processing line: ~ attr_accessor :solids, :sprites, :labels, :lines, :borders~ ** Processing line: ~~ -** Processing line: ~ # Ensures that the player remains in the horizontal range that it is supposed to.~ -** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right~ -** Processing line: ~ state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if player moves too far left~ -** Processing line: ~ state.x = 0 # player will remain as left as possible while remaining on screen~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ end~ +** Processing line: ~ def initialize~ +** Processing line: ~ @solids = []~ +** Processing line: ~ @sprites = []~ +** Processing line: ~ @labels = []~ +** Processing line: ~ @lines = []~ +** Processing line: ~ @borders = []~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Processes input from the user on the keyboard.~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ if inputs.mouse.down~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ -** Processing line: ~~ -** Processing line: ~ if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate~ -** Processing line: ~ state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space~ -** Processing line: ~ else~ -** Processing line: ~ state.world << [x, y] # If no duplicates, adds to world collection~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys.~ -** Processing line: ~ if inputs.keyboard.key_up.right~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ elsif inputs.keyboard.key_up.left~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses.~ -** Processing line: ~ if inputs.keyboard.key_held.right # if right key is pressed~ -** Processing line: ~ state.dx = 3~ -** Processing line: ~ elsif inputs.keyboard.key_held.left # if left key is pressed~ -** Processing line: ~ state.dx = -3~ -** Processing line: ~ end~ +** Processing line: ~ def tick~ +** Processing line: ~ @solids ||= []~ +** Processing line: ~ @sprites ||= []~ +** Processing line: ~ @labels ||= []~ +** Processing line: ~ @lines ||= []~ +** Processing line: ~ @borders ||= []~ +** Processing line: ~ @solids.each { |p| $gtk.args.outputs.reserved << p.solid }~ +** Processing line: ~ @sprites.each { |p| $gtk.args.outputs.reserved << p.sprite }~ +** Processing line: ~ @labels.each { |p| $gtk.args.outputs.reserved << p.label }~ +** Processing line: ~ @lines.each { |p| $gtk.args.outputs.reserved << p.line }~ +** Processing line: ~ @borders.each { |p| $gtk.args.outputs.reserved << p.border }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ #Sets dy to 5 to make the player ~fly~ when they press the space bar~ -** Processing line: ~ if inputs.keyboard.key_held.space~ -** Processing line: ~ state.dy = 5~ -** Processing line: ~ end~ +** Processing line: ~ def clear~ +** Processing line: ~ @solids.clear~ +** Processing line: ~ @sprites.clear~ +** Processing line: ~ @labels.clear~ +** Processing line: ~ @borders.clear~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def to_coord point~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.reset_button ||=~ +** Processing line: ~ state.new_entity(~ +** Processing line: ~ :button,~ +** Processing line: ~ label: [1190, 68, "RESTART", -2, 0, 0, 0, 0].label,~ +** Processing line: ~ background: [1160, 38, 120, 50, 255, 255, 255].solid~ +** Processing line: ~ )~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size later so the grid coordinates.~ -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ def tick_reset_button~ +** Processing line: ~ return unless state.hello_dragonruby_confirmed~ +** Processing line: ~ $gtk.args.outputs.reserved << state.reset_button.background~ +** Processing line: ~ $gtk.args.outputs.reserved << state.reset_button.label~ +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.reset_button.background)~ +** Processing line: ~ restart_tutorial~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Represents the tolerance for a collision between the player's rect and another rect.~ -** Processing line: ~ def collision_tollerance~ -** Processing line: ~ 0.0~ -** Processing line: ~ end~ +** Processing line: ~ def seperator~ +** Processing line: ~ @seperator = "=" * 80~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $platformer_physics = PoorManPlatformerPhysics.new~ +** Processing line: ~ def tick_intro~ +** Processing line: ~ queue_message "Welcome to the DragonRuby GTK primer! Try typing the~ +** Processing line: ~ code below and press ENTER:~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $platformer_physics.grid = args.grid~ -** Processing line: ~ $platformer_physics.inputs = args.inputs~ -** Processing line: ~ $platformer_physics.state = args.state~ -** Processing line: ~ $platformer_physics.outputs = args.outputs~ -** Processing line: ~ $platformer_physics.tick~ -** Processing line: ~ tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump."~ +** Processing line: ~ puts \"Hello DragonRuby!\"~ +** Processing line: ~ "~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~ def tick_hello_dragonruby~ +** Processing line: ~ return unless console_has? "Hello DragonRuby!"~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.args.state.hello_dragonruby_confirmed = true~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ queue_message "Well HELLO to you too!~ ** Processing line: ~~ +** Processing line: ~ If you ever want to RESTART the tutorial, just click the \"RESTART\"~ +** Processing line: ~ button in the bottom right-hand corner.~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/04_box_collision_2/app/main.rb~ -- H1 detected. -- Formatting line: ~04_physics_and_collisions/04_box_collision_2/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ Let's continue shall we? Type the code below and press ENTER:~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ +** Processing line: ~ "~ ** Processing line: ~~ -** Processing line: ~ - times: Performs an action a specific number of times.~ -** Processing line: ~ For example, if we said~ -** Processing line: ~ 5.times puts "Hello DragonRuby",~ -** Processing line: ~ then we'd see the words "Hello DragonRuby" printed on the console 5 times.~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - split: Divides a string into substrings based on a delimiter.~ -** Processing line: ~ For example, if we had a command~ -** Processing line: ~ "DragonRuby is awesome".split(" ")~ -** Processing line: ~ then the result would be~ -** Processing line: ~ ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter.~ +** Processing line: ~ def tick_explain_solid~ +** Processing line: ~ return unless $tutorial_outputs.solids.any? {|s| s == [910, 200, 100, 100, 255, 0, 0]}~ ** Processing line: ~~ -** Processing line: ~ - join: Opposite of split; converts each element of array to a string separated by delimiter.~ -** Processing line: ~ For example, if we had a command~ -** Processing line: ~ ["DragonRuby","is","awesome"].join(" ")~ -** Processing line: ~ then the result would be~ -** Processing line: ~ "DragonRuby is awesome".~ +** Processing line: ~ queue_message "Sweet!~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ The code: outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ +** Processing line: ~ Does the following:~ +** Processing line: ~ 1. GET the place where SOLIDS go: outputs.solids~ +** Processing line: ~ 2. Request that a new SOLID be ADDED: <<~ +** Processing line: ~ 3. The DEFINITION of a SOLID is the ARRAY:~ +** Processing line: ~ [910, 200, 100, 100, 255, 0, 0]~ ** Processing line: ~~ -** Processing line: ~ - to_s: Returns a string representation of an object.~ -** Processing line: ~ For example, if we had~ -** Processing line: ~ 500.to_s~ -** Processing line: ~ the string "500" would be returned.~ -** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ +** Processing line: ~ GET ADD X Y WIDTH HEIGHT RED GREEN BLUE~ +** Processing line: ~ | | | | | | | | |~ +** Processing line: ~ | | | | | | | | |~ +** Processing line: ~ outputs.solids << [910, 200, 100, 100, 255, 0, 0]~ +** Processing line: ~ |_________________________________________|~ +** Processing line: ~ |~ +** Processing line: ~ |~ +** Processing line: ~ ARRAY~ ** Processing line: ~~ -** Processing line: ~ - elapsed_time: How many frames have passed since the click event.~ +** Processing line: ~ Now let's create a blue SOLID. Type:~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ -** Processing line: ~ The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ outputs.solids << [1010, 200, 100, 100, 0, 0, 255]~ +** Processing line: ~ "~ ** Processing line: ~~ -** Processing line: ~ - inputs.mouse.down: Determines whether or not the mouse is being pressed down.~ -** Processing line: ~ The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y).~ +** Processing line: ~ state.explain_solid_confirmed = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - first: Returns the first element of the array.~ +** Processing line: ~ def tick_explain_solid_blue~ +** Processing line: ~ return unless state.explain_solid_confirmed~ +** Processing line: ~ return unless $tutorial_outputs.solids.any? {|s| s == [1010, 200, 100, 100, 0, 0, 255]}~ +** Processing line: ~ state.explain_solid_blue_confirmed = true~ ** Processing line: ~~ -** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ +** Processing line: ~ queue_message "And there is our blue SOLID!~ ** Processing line: ~~ -** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ +** Processing line: ~ The ARRAY is the MOST important thing in DragonRuby GTK.~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ +** Processing line: ~ Let's create a SPRITE using an ARRAY:~ ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~ outputs.sprites << [1110, 200, 100, 100, 'sprites/dragon_fly_0.png']~ +** Processing line: ~ "~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~ def tick_explain_tick_count~ +** Processing line: ~ return unless $tutorial_outputs.sprites.any? {|s| s == [1110, 200, 100, 100, 'sprites/dragon_fly_0.png']}~ +** Processing line: ~ return if $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 255, 255, 255]}~ +** Processing line: ~ state.explain_tick_count_confirmed = true~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ queue_message "Look at the cute little dragon!~ ** Processing line: ~~ -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map~ +** Processing line: ~ We can create a LABEL with ARRAYS too. Let's create a LABEL showing~ +** Processing line: ~ THE PASSAGE OF TIME, which is called TICK_COUNT.~ ** Processing line: ~~ -** Processing line: ~ class MetroidvaniaStarter~ -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs, :gtk~ +** Processing line: ~ outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ +** Processing line: ~ "~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls methods needed to run the game properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ process_inputs~ -** Processing line: ~ end~ +** Processing line: ~ def tick_explain_mod~ +** Processing line: ~ return unless $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 0, 255, 0]}~ +** Processing line: ~ state.explain_mod_confirmed = true~ +** Processing line: ~ queue_message "~ +** Processing line: ~ The code: outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ +** Processing line: ~ Does the following:~ +** Processing line: ~ 1. GET the place where labels go: outputs.labels~ +** Processing line: ~ 2. Request that a new label be ADDED: <<~ +** Processing line: ~ 3. The DEFINITION of a LABEL is the ARRAY:~ +** Processing line: ~ [1210, 200, state.tick_count, 0, 255, 0]~ ** Processing line: ~~ -** Processing line: ~ # Sets all the default variables.~ -** Processing line: ~ # '||' states that initialization occurs only in the first frame.~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.tile_size = 64~ -** Processing line: ~ state.gravity = -0.2~ -** Processing line: ~ state.player_width = 60~ -** Processing line: ~ state.player_height = 64~ -** Processing line: ~ state.collision_tolerance = 0.0~ -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ -** Processing line: ~ state.x ||= 0~ -** Processing line: ~ state.y ||= 800~ -** Processing line: ~ state.dy ||= 0~ -** Processing line: ~ state.dx ||= 0~ -** Processing line: ~ attempt_load_world_from_file~ -** Processing line: ~ state.world_lookup ||= { }~ -** Processing line: ~ state.world_collision_rects ||= []~ -** Processing line: ~ state.mode ||= :creating # alternates between :creating and :selecting for sprite selection~ -** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ -** Processing line: ~ #=======================================IMPORTANT=======================================#~ -** Processing line: ~ # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc.~ -** Processing line: ~ # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have.~ -** Processing line: ~ #=======================================================================================#~ -** Processing line: ~ state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES~ -** Processing line: ~ state.sprite_coords ||= []~ -** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ -** Processing line: ~ state.sprite_selected ||= 1~ -** Processing line: ~ state.map_saved_at ||= 0~ +** Processing line: ~ GET ADD X Y TEXT RED GREEN BLUE~ +** Processing line: ~ | | | | | | | |~ +** Processing line: ~ | | | | | | | |~ +** Processing line: ~ outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]~ +** Processing line: ~ |______________________________________________|~ +** Processing line: ~ |~ +** Processing line: ~ |~ +** Processing line: ~ ARRAY~ ** Processing line: ~~ -** Processing line: ~ # Sets all the cordinate values for the sprite selection screen into a grid~ -** Processing line: ~ # Displayed when 's' is pressed by player to access sprites~ -** Processing line: ~ if state.sprite_coords == [] # if sprite_coords is an empty array~ -** Processing line: ~ count = 1~ -** Processing line: ~ temp_x = 165 # sets a starting x and y position for display~ -** Processing line: ~ temp_y = 500 + 720~ -** Processing line: ~ state.sprite_quantity.times do # for the number of sprites you have~ -** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array~ -** Processing line: ~ temp_x += 100 # increment temp_x~ -** Processing line: ~ count += 1 # increment count~ -** Processing line: ~ if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen~ -** Processing line: ~ temp_x = 165 # a new row of sprites starts~ -** Processing line: ~ temp_y -= 75 # new row of sprites starts 75 units lower than the previous row~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ Now let's do some MATH, save the result to STATE, and create a LABEL:~ ** Processing line: ~~ -** Processing line: ~ # Places sprites~ -** Processing line: ~ def render~ +** Processing line: ~ state.sprite_frame = state.tick_count.idiv(4).mod(6)~ +** Processing line: ~ outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0]~ ** Processing line: ~~ -** Processing line: ~ # Sets the x, y, width, height, and image path for each sprite in the world collection.~ -** Processing line: ~ outputs.sprites << state.world.map do |x, y, sprite|~ -** Processing line: ~ [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location~ -** Processing line: ~ y * state.tile_size,~ -** Processing line: ~ state.tile_size,~ -** Processing line: ~ state.tile_size,~ -** Processing line: ~ 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path~ -** Processing line: ~ end~ +** Processing line: ~ Type the lines above (pressing ENTER after each line).~ +** Processing line: ~ "~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs sprite for the player by setting x, y, width, height, and image path~ -** Processing line: ~ outputs.sprites << [state.x,~ -** Processing line: ~ state.y,~ -** Processing line: ~ state.player_width,~ -** Processing line: ~ state.player_height,'sprites/player.png']~ +** Processing line: ~ def tick_explain_string_interpolation~ +** Processing line: ~ return unless state.explain_mod_confirmed~ +** Processing line: ~ return unless state.sprite_frame == state.tick_count.idiv(4).mod(6)~ +** Processing line: ~ return unless $tutorial_outputs.labels.any? {|l| l == [1210, 170, state.sprite_frame, 0, 255, 0]}~ ** Processing line: ~~ -** Processing line: ~ # Outputs labels as primitives in top right of the screen~ -** Processing line: ~ outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label~ -** Processing line: ~ outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label~ +** Processing line: ~ queue_message "Here is what the mathematical computation you just typed does:~ ** Processing line: ~~ -** Processing line: ~ outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label~ -** Processing line: ~ outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label~ +** Processing line: ~ 1. Create an item of STATE named SPRITE_FRAME: state.sprite_frame =~ +** Processing line: ~ 2. Set this SPRITE_FRAME to the PASSAGE OF TIME (tick_count),~ +** Processing line: ~ DIVIDED EVENLY (idiv) into 4,~ +** Processing line: ~ and then compute the REMAINDER (mod) of 6.~ ** Processing line: ~~ -** Processing line: ~ outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label~ +** Processing line: ~ STATE SPRITE_FRAME PASSAGE OF HOW LONG HOW MANY~ +** Processing line: ~ | | TIME TO SHOW IMAGES~ +** Processing line: ~ | | | AN IMAGE TO FLIP THROUGH~ +** Processing line: ~ | | | | |~ +** Processing line: ~ state.sprite_frame = state.tick_count.idiv(4).mod(6)~ +** Processing line: ~ | |~ +** Processing line: ~ | +- REMAINDER OF DIVIDE~ +** Processing line: ~ DIVIDE EVENLY~ +** Processing line: ~ (NO DECIMALS)~ ** Processing line: ~~ -** Processing line: ~ # if the map is saved and less than 120 frames have passed, the label is displayed~ -** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ -** Processing line: ~ outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label~ -** Processing line: ~ end~ +** Processing line: ~ With the information above, we can animate a SPRITE~ +** Processing line: ~ using STRING INTERPOLATION: \#{}~ +** Processing line: ~ which creates a unique SPRITE_PATH:~ ** Processing line: ~~ -** Processing line: ~ # If player hits 's', following appears~ -** Processing line: ~ if state.mode == :selecting~ -** Processing line: ~ # White background for sprite selection~ -** Processing line: ~ outputs.primitives << [state.select_menu, 255, 255, 255].solid~ +** Processing line: ~ state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\"~ +** Processing line: ~ outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0]~ +** Processing line: ~ outputs.sprites << [910, 330, 370, 370, state.sprite_path]~ ** Processing line: ~~ -** Processing line: ~ # Select tile label at the top of the screen~ -** Processing line: ~ outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label~ +** Processing line: ~ Type the lines above (pressing ENTER after each line).~ +** Processing line: ~ "~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Places sprites in locations calculated in the defaults function~ -** Processing line: ~ outputs.primitives << state.sprite_coords.map do |x, y, order|~ -** Processing line: ~ [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def tick_reprint_on_error~ +** Processing line: ~ return unless console.last_command_errored~ +** Processing line: ~ puts $gtk.state.messages.last~ +** Processing line: ~ puts "\nWhoops! Try again."~ +** Processing line: ~ console.last_command_errored = false~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ -** Processing line: ~ # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon~ -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y,~ -** Processing line: ~ 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite~ +** Processing line: ~ def tick_evals~ +** Processing line: ~ state.evals ||= []~ +** Processing line: ~ if console.last_command && (console.last_command.start_with?("outputs.") || console.last_command.start_with?("state."))~ +** Processing line: ~ state.evals << console.last_command~ +** Processing line: ~ console.last_command = nil~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls methods that perform calculations~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_in_game~ -** Processing line: ~ calc_sprite_selection~ +** Processing line: ~ state.evals.each do |l|~ +** Processing line: ~ Kernel.eval l~ ** Processing line: ~ end~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ state.evals = state.evals[0..-2]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls methods that perform calculations (if in creating mode)~ -** Processing line: ~ def calc_in_game~ -** Processing line: ~ return unless state.mode == :creating~ -** Processing line: ~ calc_world_lookup~ -** Processing line: ~ calc_player~ -** Processing line: ~ end~ +** Processing line: ~ $tutorial_outputs ||= TutorialOutputs.new~ ** Processing line: ~~ -** Processing line: ~ def calc_world_lookup~ -** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ -** Processing line: ~ # the previous tile size is set to the tile size,~ -** Processing line: ~ # and world_lookup hash is set to empty.~ -** Processing line: ~ if state.tile_size != state.previous_tile_size~ -** Processing line: ~ state.previous_tile_size = state.tile_size~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ defaults~ +** Processing line: ~ console.show~ +** Processing line: ~ $tutorial_outputs.clear~ +** Processing line: ~ $tutorial_outputs.solids << [900, 37, 480, 700, 0, 0, 0, 255]~ +** Processing line: ~ $tutorial_outputs.borders << [900, 37, 380, 683, 255, 255, 255]~ +** Processing line: ~ tick_evals~ +** Processing line: ~ $tutorial_outputs.tick~ +** Processing line: ~ tick_intro~ +** Processing line: ~ tick_hello_dragonruby~ +** Processing line: ~ tick_reset_button~ +** Processing line: ~ tick_explain_solid~ +** Processing line: ~ tick_explain_solid_blue~ +** Processing line: ~ tick_reprint_on_error~ +** Processing line: ~ tick_explain_tick_count~ +** Processing line: ~ tick_explain_mod~ +** Processing line: ~ tick_explain_string_interpolation~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # return if world_lookup is not empty or if world is empty~ -** Processing line: ~ return if state.world_lookup.keys.length > 0~ -** Processing line: ~ return unless state.world.length > 0~ +** Processing line: ~ def console~ +** Processing line: ~ $gtk.console~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Searches through the world and finds the coordinates that exist~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ +** Processing line: ~ def queue_message message~ +** Processing line: ~ $gtk.args.state.messages ||= []~ +** Processing line: ~ return if $gtk.args.state.messages.include? message~ +** Processing line: ~ $gtk.args.state.messages << message~ +** Processing line: ~ last_three = [$gtk.console.log[-3], $gtk.console.log[-2], $gtk.console.log[-1]].reject_nil~ +** Processing line: ~ $gtk.console.log.clear~ +** Processing line: ~ puts seperator~ +** Processing line: ~ $gtk.console.log += last_three~ +** Processing line: ~ puts seperator~ +** Processing line: ~ puts message~ +** Processing line: ~ puts seperator~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Assigns collision rects for every sprite drawn~ -** Processing line: ~ state.world_collision_rects =~ -** Processing line: ~ state.world_lookup~ -** Processing line: ~ .keys~ -** Processing line: ~ .map do |coord_x, coord_y|~ -** Processing line: ~ s = state.tile_size~ -** Processing line: ~ # Multiplying by s (the size of a tile) ensures that the rect is~ -** Processing line: ~ # placed exactly where you want it to be placed (causes grid to coordinate)~ -** Processing line: ~ # How many pixels horizontally across and vertically up and down~ -** Processing line: ~ x = s * coord_x~ -** Processing line: ~ y = s * coord_y~ -** Processing line: ~ {~ -** Processing line: ~ args: [coord_x, coord_y],~ -** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ -** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ -** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def console_has? message~ +** Processing line: ~ console.log.map(&:upcase).include? "#{message.upcase}\n"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calculates movement of player and calls methods that perform collision calculations~ -** Processing line: ~ def calc_player~ -** Processing line: ~ state.dy += state.gravity # what goes up must come down because of gravity~ -** Processing line: ~ calc_box_collision~ -** Processing line: ~ calc_edge_collision~ -** Processing line: ~ state.y += state.dy # Since velocity is the change in position, the change in y increases by dy~ -** Processing line: ~ state.x += state.dx # Ditto line above but dx and x~ -** Processing line: ~ state.dx *= 0.8 # Scales dx down~ -** Processing line: ~ end~ +** Processing line: ~ def restart_tutorial~ +** Processing line: ~ $tutorial_outputs.clear~ +** Processing line: ~ $gtk.console.log.clear~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ puts "Starting the tutorial over!"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls methods that determine whether the player collides with any world_collision_rects.~ -** Processing line: ~ def calc_box_collision~ -** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ -** Processing line: ~ collision_floor~ -** Processing line: ~ collision_left~ -** Processing line: ~ collision_right~ -** Processing line: ~ collision_ceiling~ -** Processing line: ~ end~ +** Processing line: ~ def state~ +** Processing line: ~ $gtk.args.state~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ -** Processing line: ~ def collision_floor~ -** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ -** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player~ +** Processing line: ~ def inputs~ +** Processing line: ~ $gtk.args.inputs~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between player's~ -** Processing line: ~ # bottom and the top of a rect.~ -** Processing line: ~ floor_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ def outputs~ +** Processing line: ~ $tutorial_outputs~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless floor_collisions # performs following changes if a collision has occurred~ -** Processing line: ~ state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top~ -** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ -** Processing line: ~ def collision_left~ -** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's left side~ -** Processing line: ~ # and the right side of a rect.~ -** Processing line: ~ left_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - printing.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - printing.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ -** Processing line: ~ state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side~ -** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Commenting Code~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Prefixing text with a pound sign (#) is how you comment code in Ruby. Example:~ +** Processing line: ~ #~ +** Processing line: ~ # I am commented code. And so are the lines above.~ +** Processing line: ~ #~ +** Processing line: ~ # I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's~ +** Processing line: ~ # an entertaining read. Otherwise, go to the next txt file.~ +** Processing line: ~ #~ +** Processing line: ~ # Follow along by visiting:~ +** Processing line: ~ # https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4~ ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ -** Processing line: ~ def collision_right~ -** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Printing to the Console:~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text~ +** Processing line: ~ # to repl.rb and save to see Hello World printed to the console.~ ** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's~ -** Processing line: ~ # right side and the left side of a rect.~ -** Processing line: ~ right_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ repl do~ +** Processing line: ~ puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.'~ +** Processing line: ~ puts '===='~ +** Processing line: ~ puts '======'~ +** Processing line: ~ puts '================================'~ +** Processing line: ~ puts 'Hello World'~ +** Processing line: ~ puts '================================'~ +** Processing line: ~ puts '======'~ +** Processing line: ~ puts '===='~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner)~ -** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ -** Processing line: ~ def collision_ceiling~ -** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ -** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ ** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's top~ -** Processing line: ~ # and the bottom of a rect.~ -** Processing line: ~ ceil_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - strings.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - strings.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size)~ -** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Strings~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Here is how you work with strings in Ruby. Take the text~ +** Processing line: ~ # in this file and paste it into repl.rb and save:~ ** Processing line: ~~ -** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ -** Processing line: ~ def calc_edge_collision~ -** Processing line: ~ # Ensures that player doesn't fall below the map~ -** Processing line: ~ if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope~ -** Processing line: ~ state.y = 0 # 0 is the lowest the player can be while staying on the screen~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ # Ensures player doesn't go insanely high~ -** Processing line: ~ elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope~ -** Processing line: ~ state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts '* RUBY PRIMER: strings'~ +** Processing line: ~ message = "Hello World"~ +** Processing line: ~ puts "The value of message is: " + message~ +** Processing line: ~ puts "Any value can be interpolated within a string using \#{}."~ +** Processing line: ~ puts "Interpolated message: #{message}."~ +** Processing line: ~ puts 'This #{message} is not interpolated because the string uses single quotes.'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ -** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right~ -** Processing line: ~ state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left~ -** Processing line: ~ state.x = 0 # farthest left the player can be while remaining in the screen's scope~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def calc_sprite_selection~ -** Processing line: ~ # Does the transition to bring down the select sprite screen~ -** Processing line: ~ if state.mode == :selecting && state.select_menu.y != 0~ -** Processing line: ~ state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed)~ -** Processing line: ~ state.banner_coords.y = 680 # sets y position of Select Sprite banner~ -** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ -** Processing line: ~ [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen)~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Does the transition to leave the select sprite screen~ -** Processing line: ~ if state.mode == :creating && state.select_menu.y != 720~ -** Processing line: ~ state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up)~ -** Processing line: ~ state.banner_coords.y = 1000 # sets y position of Select Sprite banner~ -** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ -** Processing line: ~ [x, y + 720, w, h] # sets definition of all elements in collection~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - numbers.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ # If the state.mode is back and if the menu has retreated back up~ -** Processing line: ~ # call methods that process user inputs~ -** Processing line: ~ if state.mode == :creating~ -** Processing line: ~ process_inputs_player_movement~ -** Processing line: ~ process_inputs_place_tile~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Numerics~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Here is how you work with numbers in Ruby. Take the text~ +** Processing line: ~ # in this file and paste it into repl.rb and save:~ ** Processing line: ~~ -** Processing line: ~ # For each sprite_coordinate added, check what sprite was selected~ -** Processing line: ~ if state.mode == :selecting~ -** Processing line: ~ state.sprite_coords.map do |x, y, order| # goes through all sprites in collection~ -** Processing line: ~ # checks that a specific sprite was pressed based on x, y position~ -** Processing line: ~ if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true~ -** Processing line: ~ inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and~ -** Processing line: ~ inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right~ -** Processing line: ~ inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y~ -** Processing line: ~ inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up~ -** Processing line: ~ state.sprite_selected = order # sprite is chosen~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts '* RUBY PRIMER: Fixnum and Floats'~ +** Processing line: ~ a = 10~ +** Processing line: ~ puts "The value of a is: #{a}"~ +** Processing line: ~ puts "a + 1 is: #{a + 1}"~ +** Processing line: ~ puts "a / 3 is: #{a / 3}"~ +** Processing line: ~ puts ''~ ** Processing line: ~~ -** Processing line: ~ inputs_export_stage~ -** Processing line: ~ process_inputs_show_available_sprites~ -** Processing line: ~ end~ +** Processing line: ~ b = 10.12~ +** Processing line: ~ puts "The value of b is: #{b}"~ +** Processing line: ~ puts "b + 1 is: #{b + 1}"~ +** Processing line: ~ puts "b as an integer is: #{b.to_i}"~ +** Processing line: ~ puts ''~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Moves the player based on the keys they press on their keyboard~ -** Processing line: ~ def process_inputs_player_movement~ -** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right)~ -** Processing line: ~ if inputs.keyboard.key_up.right~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ elsif inputs.keyboard.key_up.left~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys~ -** Processing line: ~ if inputs.keyboard.key_held.right~ -** Processing line: ~ state.dx = 3~ -** Processing line: ~ elsif inputs.keyboard.key_held.left~ -** Processing line: ~ state.dx = -3~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard~ -** Processing line: ~ if inputs.keyboard.key_held.space~ -** Processing line: ~ state.dy = 5~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - booleans.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Adds tile in the place the user holds down the mouse~ -** Processing line: ~ def process_inputs_place_tile~ -** Processing line: ~ if inputs.mouse.down # if mouse is pressed~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Booleans~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Here is how you work with numbers in Ruby. Take the text~ +** Processing line: ~ # in this file and paste it into repl.rb and save:~ ** Processing line: ~~ -** Processing line: ~ # Checks if any coordinates duplicate (already exist in world)~ -** Processing line: ~ if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y }~ -** Processing line: ~ #erases existing tile space by rejecting them from world~ -** Processing line: ~ state.world = state.world.reject do |existing_x, existing_y, n|~ -** Processing line: ~ existing_x == x && existing_y == y~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)'~ +** Processing line: ~ puts "Anything that *isn't* false or nil is true."~ ** Processing line: ~~ -** Processing line: ~ # Stores/exports world collection's info (coordinates, sprite number) into a file~ -** Processing line: ~ def inputs_export_stage~ -** Processing line: ~ if inputs.keyboard.key_down.e # if "e" is pressed~ -** Processing line: ~ export_string = state.world.map do |x, y, sprite_number| # stores world info in a string~ -** Processing line: ~ "#{x},#{y},#{sprite_number}" # using string interpolation~ -** Processing line: ~ end~ -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file~ -** Processing line: ~ state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ c = 30~ +** Processing line: ~ puts "The value of c is #{c}."~ ** Processing line: ~~ -** Processing line: ~ def process_inputs_show_available_sprites~ -** Processing line: ~ # Based on keyboard input, the entity (:creating and :selecting) switch~ -** Processing line: ~ if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating~ -** Processing line: ~ state.mode = :selecting # will change to selecting~ -** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ -** Processing line: ~ elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting~ -** Processing line: ~ state.mode = :creating # will change to creating~ -** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ -** Processing line: ~ end~ +** Processing line: ~ if c~ +** Processing line: ~ puts "This if statement ran because c is truthy."~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Loads the world collection by reading from the map.txt file in the app folder~ -** Processing line: ~ def attempt_load_world_from_file~ -** Processing line: ~ return if state.world # return if the world collection is already populated~ -** Processing line: ~ state.world ||= [] # initialized as an empty collection~ -** Processing line: ~ exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code~ -** Processing line: ~ return unless exported_world # return unless the file read was successful~ -** Processing line: ~ state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world~ -** Processing line: ~ l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,~ -** Processing line: ~ # calling to_i (converts to integers) on each element~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ d = false~ +** Processing line: ~ puts "The value if d is #{d}. The type for d is #{d.class}."~ ** Processing line: ~~ -** Processing line: ~ # Adds the change in y to y to determine the next y position of the player.~ -** Processing line: ~ def next_y~ -** Processing line: ~ state.y + state.dy~ +** Processing line: ~ if !d~ +** Processing line: ~ puts "This if statement ran because d is falsey, using the not operator (!)."~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Determines next x position of player~ -** Processing line: ~ def next_x~ -** Processing line: ~ if state.dx < 0 # if the player moves left~ -** Processing line: ~ return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)~ -** Processing line: ~ else~ -** Processing line: ~ return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ e = nil~ +** Processing line: ~ puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}."~ ** Processing line: ~~ -** Processing line: ~ def to_coord point~ -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ -** Processing line: ~ # later and huzzah. Grid coordinates~ -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ if !e~ +** Processing line: ~ puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}."~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $metroidvania_starter = MetroidvaniaStarter.new~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $metroidvania_starter.grid = args.grid~ -** Processing line: ~ $metroidvania_starter.inputs = args.inputs~ -** Processing line: ~ $metroidvania_starter.state = args.state~ -** Processing line: ~ $metroidvania_starter.outputs = args.outputs~ -** Processing line: ~ $metroidvania_starter.gtk = args.gtk~ -** Processing line: ~ $metroidvania_starter.tick~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 04_physics_and_collisions/04_jump_physics/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt~ - H1 detected. -- Formatting line: ~04_physics_and_collisions/04_jump_physics/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - conditionals.txt~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Conditionals~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Here is how you create conditionals in Ruby. Take the text~ +** Processing line: ~ # in this file and paste it into repl.rb and save:~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* RUBY PRIMER: Conditionals"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ -** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ -** Processing line: ~ be retained across frames.)~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # if~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: if statement"~ +** Processing line: ~ i_am_one = 1~ +** Processing line: ~ if i_am_one~ +** Processing line: ~ puts "This was printed because i_am_one is truthy."~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # if/else~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ -** Processing line: ~ using their keys.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: if/else statement"~ +** Processing line: ~ i_am_false = false~ +** Processing line: ~ if i_am_false~ +** Processing line: ~ puts "This will NOT get printed because i_am_false is false."~ +** Processing line: ~ else~ +** Processing line: ~ puts "This was printed because i_am_false is false."~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # if/elsif/else~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # This sample app is a game that requires the user to jump from one platform to the next.~ -** Processing line: ~ # As the player successfully clears platforms, they become smaller and move faster.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: if/elsif/else statement"~ +** Processing line: ~ i_am_false = false~ +** Processing line: ~ i_am_true = true~ +** Processing line: ~ if i_am_false~ +** Processing line: ~ puts "This will NOT get printed because i_am_false is false."~ +** Processing line: ~ elsif i_am_true~ +** Processing line: ~ puts "This was printed because i_am_true is true."~ +** Processing line: ~ else~ +** Processing line: ~ puts "This will NOT get printed i_am_true was true."~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class VerticalPlatformer~ -** Processing line: ~ attr_gtk~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # case~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # declares vertical platformer as new entity~ -** Processing line: ~ def s~ -** Processing line: ~ state.vertical_platformer ||= state.new_entity(:vertical_platformer)~ -** Processing line: ~ state.vertical_platformer~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO case statement"~ +** Processing line: ~ i_am_one = 1 # change this value to see different results~ +** Processing line: ~~ +** Processing line: ~ case i_am_one~ +** Processing line: ~ when 10~ +** Processing line: ~ puts "the value of i_am_one is 10"~ +** Processing line: ~ when 9~ +** Processing line: ~ puts "the value of i_am_one is 9"~ +** Processing line: ~ when 5~ +** Processing line: ~ puts "the value of i_am_one is 5"~ +** Processing line: ~ when 1~ +** Processing line: ~ puts "the value of i_am_one is 1"~ +** Processing line: ~ else~ +** Processing line: ~ puts "Value wasn't cased."~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # creates a new platform using a hash~ -** Processing line: ~ def new_platform hash~ -** Processing line: ~ s.new_entity_strict(:platform, hash) # platform key~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # comparison operators~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Different types of comparisons"~ +** Processing line: ~ if 4 == 4~ +** Processing line: ~ puts "4 equals 4 (==)"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # calls methods needed for game to run properly~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ input~ +** Processing line: ~ if 4 != 3~ +** Processing line: ~ puts "4 does not equal 3 (!=)"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values~ -** Processing line: ~ def defaults~ -** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ -** Processing line: ~ new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil),~ -** Processing line: ~ new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher~ -** Processing line: ~ ]~ +** Processing line: ~ if 3 < 4~ +** Processing line: ~ puts "3 is less than 4 (<)"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ s.tick_count = args.state.tick_count~ -** Processing line: ~ s.gravity = -0.3 # what goes up must come down because of gravity~ -** Processing line: ~ s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared~ -** Processing line: ~ s.player.x ||= 0 # sets player values~ -** Processing line: ~ s.player.y ||= 100~ -** Processing line: ~ s.player.w ||= 64~ -** Processing line: ~ s.player.h ||= 64~ -** Processing line: ~ s.player.dy ||= 0 # change in position~ -** Processing line: ~ s.player.dx ||= 0~ -** Processing line: ~ s.player_jump_power = 15~ -** Processing line: ~ s.player_jump_power_duration = 10~ -** Processing line: ~ s.player_max_run_speed = 5~ -** Processing line: ~ s.player_speed_slowdown_rate = 0.9~ -** Processing line: ~ s.player_acceleration = 1~ -** Processing line: ~ s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too)~ +** Processing line: ~ if 4 > 3~ +** Processing line: ~ puts "4 is greater than 3 (>)"~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs objects onto the screen~ -** Processing line: ~ def render~ -** Processing line: ~ outputs.solids << s.platforms.map do |p| # outputs platforms onto screen~ -** Processing line: ~ [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center~ -** Processing line: ~ # don't forget, position of platform is denoted by bottom left hand corner~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # and/or conditionals~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # outputs player using hash~ -** Processing line: ~ outputs.solids << {~ -** Processing line: ~ x: s.player.x + 300, # player positioned on top of platform~ -** Processing line: ~ y: s.player.y - s.camera[:y],~ -** Processing line: ~ w: s.player.w,~ -** Processing line: ~ h: s.player.h,~ -** Processing line: ~ r: 100, # color saturation~ -** Processing line: ~ g: 100,~ -** Processing line: ~ b: 200~ -** Processing line: ~ }~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: AND, OR operator (&&, ||)"~ +** Processing line: ~ if (4 > 3) || (3 < 4) || false~ +** Processing line: ~ puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Performs calculations~ -** Processing line: ~ def calc~ -** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ -** Processing line: ~ p.rect = [p.x, p.y, p.w, p.h] # set the definition~ -** Processing line: ~ end~ +** Processing line: ~ if (4 > 3) && (3 < 4)~ +** Processing line: ~ puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)"~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # sets player point by adding half the player's width to the player's x~ -** Processing line: ~ s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens!~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # search the platforms collection to find if the player's point is inside the rect of a platform~ -** Processing line: ~ collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect }~ ** Processing line: ~~ -** Processing line: ~ # if collision occurred and player is moving down (or not moving vertically at all)~ -** Processing line: ~ if collision && s.player.dy <= 0~ -** Processing line: ~ s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform~ -** Processing line: ~ s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically~ -** Processing line: ~ if !s.player.platform~ -** Processing line: ~ s.player.dx = 0 # no horizontal movement~ -** Processing line: ~ end~ -** Processing line: ~ # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x~ -** Processing line: ~ s.player.x += collision.dx * collision.speed~ -** Processing line: ~ s.player.platform = collision # player is on the platform that it collided with (or landed on)~ -** Processing line: ~ if s.player.falling # if player is falling~ -** Processing line: ~ s.player.dx = 0 # no horizontal movement~ -** Processing line: ~ end~ -** Processing line: ~ s.player.falling = false~ -** Processing line: ~ s.player.jumped_at = nil~ -** Processing line: ~ else~ -** Processing line: ~ s.player.platform = nil # player is not on a platform~ -** Processing line: ~ s.player.y += s.player.dy # velocity is the change in position~ -** Processing line: ~ s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down~ -** Processing line: ~ end~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - looping.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - looping.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ -** Processing line: ~ p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally)~ -** Processing line: ~ # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels)~ -** Processing line: ~ if p.x < -300 # if platform goes too far left~ -** Processing line: ~ p.dx *= -1 # dx is scaled down~ -** Processing line: ~ p.x = -300 # as far left as possible within scope~ -** Processing line: ~ elsif p.x > (1000 - p.w) # if platform's x is greater than 300~ -** Processing line: ~ p.dx *= -1~ -** Processing line: ~ p.x = (1000 - p.w) # set to 300 (as far right as possible within scope)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Looping~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ #~ +** Processing line: ~ # Looping looks a whole lot different than other languages.~ +** Processing line: ~ # But it's pretty awesome when you get used to it.~ ** Processing line: ~~ -** Processing line: ~ delta = (s.player.y - s.camera[:y] - 100) # used to position camera view~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* RUBY PRIMER: Loops"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if delta > -200~ -** Processing line: ~ s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards~ -** Processing line: ~ s.player.x += s.player.dx # velocity is change in position; change in x increases by dx~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # times~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # searches platform collection to find platforms located more than 300 pixels above the player~ -** Processing line: ~ has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) }~ -** Processing line: ~ if !has_platforms # if there are no platforms 300 pixels above the player~ -** Processing line: ~ width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous~ -** Processing line: ~ s.player.platforms_cleared += 1 # player successfully cleared another platform~ -** Processing line: ~ last_platform = s.platforms[-1] # platform just cleared becomes last platform~ -** Processing line: ~ # another platform is created 300 pixels above the last platform, and this~ -** Processing line: ~ # new platform has a smaller width and moves faster than all previous platforms~ -** Processing line: ~ s.platforms << new_platform(x: (700 - width) * rand, # random x position~ -** Processing line: ~ y: last_platform.y + 300,~ -** Processing line: ~ w: width,~ -** Processing line: ~ h: 32,~ -** Processing line: ~ dx: 1.randomize(:sign), # random change in x~ -** Processing line: ~ speed: 2 * s.player.platforms_cleared,~ -** Processing line: ~ rect: nil)~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: ~Numeric#times~ (for loop)"~ +** Processing line: ~ 3.times do |i|~ +** Processing line: ~ puts i~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Takes input from the user to move the player~ -** Processing line: ~ def input~ -** Processing line: ~ if inputs.keyboard.space # if the space bar is pressed~ -** Processing line: ~ s.player.jumped_at ||= s.tick_count # set to current frame~ -** Processing line: ~~ -** Processing line: ~ # if the time that has passed since the jump is less than the duration of a jump (10 frames)~ -** Processing line: ~ # and the player is not falling~ -** Processing line: ~ if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling~ -** Processing line: ~ s.player.dy = s.player_jump_power # player jumps up~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # foreach~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_up.space # if space bar is in "up" state~ -** Processing line: ~ s.player.falling = true # player is falling~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: ~Array#each~ (for each loop)"~ +** Processing line: ~ array = ["a", "b", "c", "d"]~ +** Processing line: ~ array.each do |char|~ +** Processing line: ~ puts char~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.left # if left key is pressed~ -** Processing line: ~ s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration~ -** Processing line: ~ s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater~ -** Processing line: ~ elsif inputs.keyboard.right # if right key is pressed~ -** Processing line: ~ s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration~ -** Processing line: ~ s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser~ -** Processing line: ~ else~ -** Processing line: ~ s.player.dx *= s.player_speed_slowdown_rate # scales dx down~ -** Processing line: ~ end~ +** Processing line: ~ puts "** INFO: ~Array#each_with_index~ (for each loop)"~ +** Processing line: ~ array = ["a", "b", "c", "d"]~ +** Processing line: ~ array.each do |char, i|~ +** Processing line: ~ puts "index #{i}: #{char}"~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $game = VerticalPlatformer.new~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # ranges~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: range block exclusive (three dots)"~ +** Processing line: ~ (0...3).each do |i|~ +** Processing line: ~ puts i~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ puts "** INFO: range block inclusive (two dots)"~ +** Processing line: ~ (0..3).each do |i|~ +** Processing line: ~ puts i~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 05_mouse/03_mouse_click/app/main.rb~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - functions.txt~ - H1 detected. -- Formatting line: ~05_mouse/03_mouse_click/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - functions.txt~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Functions~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ # The last statement of a function is implictly returned. Parenthesis for functions~ +** Processing line: ~ # are optional as long as the statement can be envaluated disambiguously.~ ** Processing line: ~~ -** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* RUBY PRIMER: Functions"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ For example, [1,2].product([1,2]) would return the following array...~ -** Processing line: ~ [[1,1], [1,2], [2,1], [2,2]]~ -** Processing line: ~ More than two arrays can be given to product and it will still work,~ -** Processing line: ~ such as [1,2].product([1,2],[3,4]). What would product return in this case?~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Functions single parameter~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ Answer:~ -** Processing line: ~ [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]]~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* INFO: Function with one parameter"~ ** Processing line: ~~ -** Processing line: ~ - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers.~ -** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ +** Processing line: ~ # function definition~ +** Processing line: ~ def add_one_to n~ +** Processing line: ~ n + 1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - yield: Allows you to call a method with a code block and yield to that block.~ +** Processing line: ~ # Parenthesis are optional in Ruby as long as the~ +** Processing line: ~ # parsing is disambiguous. Here are a couple of variations.~ +** Processing line: ~ # Generally speaking, don't put parenthesis is you don't have to.~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ # Conventional Usage of Parenthesis.~ +** Processing line: ~ puts add_one_to(3)~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ +** Processing line: ~ # DragonRuby's recommended use of parenthesis (inner function has parenthesis).~ +** Processing line: ~ puts (add_one_to 3)~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~ # Full parens.~ +** Processing line: ~ puts(add_one_to(3))~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ # Outer function has parenthesis~ +** Processing line: ~ puts(add_one_to 3)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - Ternary operator (?): Will evaluate a statement (just like an if statement)~ -** Processing line: ~ and perform an action if the result is true or another action if it is false.~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Functions with default parameter values~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* INFO: Function with default value"~ +** Processing line: ~ def function_with_default_value v = 10~ +** Processing line: ~ v * 10~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ puts "Passing the argument three yields: #{function_with_default_value 3}"~ +** Processing line: ~ puts "Passing no argument yields: #{function_with_default_value}"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Nil default parameter value and ||= operator.~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* INFO: Using the OR EQUAL operator (||=)"~ +** Processing line: ~ def function_with_nil_default_with_local a = nil~ +** Processing line: ~ result = a~ +** Processing line: ~ result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE"~ +** Processing line: ~ "value is #{result}."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # This sample app is a classic game of Tic Tac Toe.~ +** Processing line: ~ puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}"~ +** Processing line: ~ puts "Passing nil: #{function_with_nil_default_with_local}"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class TicTacToe~ -** Processing line: ~ attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Starts the game with player x's turn and creates an array (to_a) for space combinations.~ -** Processing line: ~ # Calls methods necessary for the game to run properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ state.current_turn ||= :x~ -** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ -** Processing line: ~ render_board~ -** Processing line: ~ input_board~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ -** Processing line: ~ def render_board~ -** Processing line: ~ square_size = 80~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - arrays.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Positions the game's board in the center of the screen.~ -** Processing line: ~ # Try removing what follows grid.w_half or grid.h_half and see how the position changes!~ -** Processing line: ~ board_left = grid.w_half - square_size * 1.5~ -** Processing line: ~ board_top = grid.h_half - square_size * 1.5~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Arrays~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # At first glance, the add(1) looks pretty trivial. But if you remove it,~ -** Processing line: ~ # you'll see that the positioning of the board would be skewed without it!~ -** Processing line: ~ # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares~ -** Processing line: ~ # due to the change in board placement.~ -** Processing line: ~ outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces~ -** Processing line: ~ space.border ||= [~ -** Processing line: ~ board_left + x.add(1) * square_size, # space.border is initialized using this definition~ -** Processing line: ~ board_top + y.add(1) * square_size,~ -** Processing line: ~ square_size,~ -** Processing line: ~ square_size~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ # Arrays are incredibly powerful in Ruby. Learn to use them well.~ ** Processing line: ~~ -** Processing line: ~ # Again, the calculations ensure that the piece is placed in the center of the grid square.~ -** Processing line: ~ # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center.~ -** Processing line: ~ outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board~ -** Processing line: ~ label board_left + x.add(1) * square_size + square_size.fdiv(2),~ -** Processing line: ~ board_top + y.add(1) * square_size + square_size - 20,~ -** Processing line: ~ space.piece # text of label, either "x" or "o"~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "* RUBY PRIMER: ARRAYS"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses a label to output whether x or o won, or if a draw occurred.~ -** Processing line: ~ # If the game is ongoing, a label shows whose turn it currently is.~ -** Processing line: ~ outputs.labels << if state.x_won~ -** Processing line: ~ label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top~ -** Processing line: ~ elsif state.o_won~ -** Processing line: ~ label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally~ -** Processing line: ~ elsif state.draw~ -** Processing line: ~ label grid.w_half, grid.top - 80, "a draw"~ -** Processing line: ~ else # if no one won and the game is ongoing~ -** Processing line: ~ label grid.w_half, grid.top - 80, "turn: #{state.current_turn}"~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Enumerable ranges and .to_a~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # Calls the methods responsible for handling user input and determining the winner.~ -** Processing line: ~ # Does nothing unless the mouse is clicked.~ -** Processing line: ~ def input_board~ -** Processing line: ~ return unless inputs.mouse.click~ -** Processing line: ~ input_place_piece~ -** Processing line: ~ input_restart_game~ -** Processing line: ~ determine_winner~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Create an array with the numbers 1 to 10."~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ puts one_to_ten~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Finding elements~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Finding elements in an array using ~Array#find_all~."~ +** Processing line: ~ puts "Create a new array that only contains even numbers from the previous array."~ +** Processing line: ~~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ evens = one_to_ten.find_all do |number|~ +** Processing line: ~ number % 2 == 0~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Handles user input for placing pieces on the board.~ -** Processing line: ~ def input_place_piece~ -** Processing line: ~ return if state.game_over~ +** Processing line: ~ puts evens~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already~ -** Processing line: ~ # have a piece in it.~ -** Processing line: ~ __, __, space = all_spaces.find do |__, __, space|~ -** Processing line: ~ inputs.mouse.click.point.inside_rect?(space.border) && !space.piece~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Rejecting elements~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # The piece that goes into the space belongs to the player whose turn it currently is.~ -** Processing line: ~ return unless space~ -** Processing line: ~ space.piece = state.current_turn~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Removing elements in an array using ~Array#reject~."~ +** Processing line: ~ puts "Create a new array that rejects odd numbers."~ ** Processing line: ~~ -** Processing line: ~ # This ternary operator statement allows us to change the current player's turn.~ -** Processing line: ~ # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn.~ -** Processing line: ~ state.current_turn = state.current_turn == :x ? :o : :x~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ also_even = one_to_ten.reject do |number|~ +** Processing line: ~ number % 2 != 0~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Resets the game.~ -** Processing line: ~ def input_restart_game~ -** Processing line: ~ return unless state.game_over~ -** Processing line: ~ gtk.reset~ +** Processing line: ~ puts also_even~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Array transform using the map function.~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Creating new derived values from an array using ~Array#map~."~ +** Processing line: ~ puts "Create an array that doubles every number."~ +** Processing line: ~~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ doubled = one_to_ten.map do |number|~ +** Processing line: ~ number * 2~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Checks if x or o won the game.~ -** Processing line: ~ # If neither player wins and all nine squares are filled, a draw happens.~ -** Processing line: ~ # Once a player is chosen as the winner or a draw happens, the game is over.~ -** Processing line: ~ def determine_winner~ -** Processing line: ~ state.x_won = won? :x # evaluates to either true or false (boolean values)~ -** Processing line: ~ state.o_won = won? :o~ -** Processing line: ~ state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won~ -** Processing line: ~ state.game_over = state.x_won || state.o_won || state.draw~ +** Processing line: ~ puts doubled~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Combining array functions.~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~."~ +** Processing line: ~ puts "Create an array that selects only odd numbers and then multiply those by 10."~ +** Processing line: ~~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ odd_doubled = one_to_ten.find_all do |number|~ +** Processing line: ~ number % 2 != 0~ +** Processing line: ~ end.map do |odd_number|~ +** Processing line: ~ odd_number * 10~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Determines if a player won by checking if there is a horizontal match or vertical match.~ -** Processing line: ~ # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won.~ -** Processing line: ~ def won? piece~ -** Processing line: ~ # performs action on all space combinations~ -** Processing line: ~ won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y|~ +** Processing line: ~ puts odd_doubled~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Checks if the 3 grid spaces with the same y value (or same row) and~ -** Processing line: ~ # x values that are next to each other have pieces that belong to the same player.~ -** Processing line: ~ # Remember, the value of piece is equal to the current turn (which is the player).~ -** Processing line: ~ horizontal_match = state.spaces[xs[0]][y].piece == piece &&~ -** Processing line: ~ state.spaces[xs[1]][y].piece == piece &&~ -** Processing line: ~ state.spaces[xs[2]][y].piece == piece~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Product function.~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # Checks if the 3 grid spaces with the same x value (or same column) and~ -** Processing line: ~ # y values that are next to each other have pieces that belong to the same player.~ -** Processing line: ~ # The && represents an "and" statement: if even one part of the statement is false,~ -** Processing line: ~ # the entire statement evaluates to false.~ -** Processing line: ~ vertical_match = state.spaces[y][xs[0]].piece == piece &&~ -** Processing line: ~ state.spaces[y][xs[1]].piece == piece &&~ -** Processing line: ~ state.spaces[y][xs[2]].piece == piece~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Create all combinations of array values using ~Array#product~."~ +** Processing line: ~ puts "All two-item pairs of numbers 1 to 10."~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ all_combinations = one_to_ten.product(one_to_ten)~ +** Processing line: ~ puts all_combinations~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ horizontal_match || vertical_match # if either is true, true is returned~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Uniq and sort function.~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # Sees if there is a diagonal match, starting from the bottom left and ending at the top right.~ -** Processing line: ~ # Is added to won regardless of whether the statement is true or false.~ -** Processing line: ~ won << (state.spaces[-1][-1].piece == piece && # bottom left~ -** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ -** Processing line: ~ state.spaces[ 1][ 1].piece == piece) # top right~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~."~ +** Processing line: ~ puts "All uniq combinations of numbers regardless of order."~ +** Processing line: ~ puts "For example: [1, 2] is the same as [2, 1]."~ +** Processing line: ~ one_to_ten = (1..10).to_a~ +** Processing line: ~ uniq_combinations =~ +** Processing line: ~ one_to_ten.product(one_to_ten)~ +** Processing line: ~ .map do |unsorted_number|~ +** Processing line: ~ unsorted_number.sort~ +** Processing line: ~ end.uniq~ +** Processing line: ~ puts uniq_combinations~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Example of an advanced array transform.~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # Sees if there is a diagonal match, starting at the bottom right and ending at the top left~ -** Processing line: ~ # and is added to won.~ -** Processing line: ~ won << (state.spaces[ 1][-1].piece == piece && # bottom right~ -** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ -** Processing line: ~ state.spaces[-1][ 1].piece == piece) # top left~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~."~ +** Processing line: ~ puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle."~ +** Processing line: ~~ +** Processing line: ~ one_to_hundred = (1..100).to_a~ +** Processing line: ~~ +** Processing line: ~ triples =~ +** Processing line: ~ one_to_hundred.product(one_to_hundred).map do |width, height|~ +** Processing line: ~ [width, height, Math.sqrt(width ** 2 + height ** 2)]~ +** Processing line: ~ end.find_all do |_, _, hypotenuse|~ +** Processing line: ~ hypotenuse.to_i == hypotenuse~ +** Processing line: ~ end.map do |triangle|~ +** Processing line: ~ triangle.map(&:to_i)~ +** Processing line: ~ end.uniq do |triangle|~ +** Processing line: ~ triangle.sort~ +** Processing line: ~ end.map do |width, height, hypotenuse|~ +** Processing line: ~ [width, height, hypotenuse, (width * height) / 2]~ +** Processing line: ~ end.sort_by do |_, _, _, area|~ +** Processing line: ~ area~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Any false statements (meaning false diagonal matches) are rejected from won~ -** Processing line: ~ won.reject_false.any?~ +** Processing line: ~ triples.each do |width, height, hypotenuse, _|~ +** Processing line: ~ puts "(#{width}, #{height}, #{hypotenuse})"~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them.~ -** Processing line: ~ # The ! before a statement means "not". For example, we are rejecting any space combinations that do~ -** Processing line: ~ # NOT have pieces in them.~ -** Processing line: ~ def filled_spaces~ -** Processing line: ~ state.space_combinations~ -** Processing line: ~ .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them~ -** Processing line: ~ .map do |x, y|~ -** Processing line: ~ if block_given?~ -** Processing line: ~ yield x, y, state.spaces[x][y]~ -** Processing line: ~ else~ -** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Example of an sorting.~ +** Processing line: ~ # ====================================================================================~ ** Processing line: ~~ -** Processing line: ~ # Defines all spaces on the board.~ -** Processing line: ~ def all_spaces~ -** Processing line: ~ if !block_given?~ -** Processing line: ~ state.space_combinations.map do |x, y|~ -** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ -** Processing line: ~ end~ -** Processing line: ~ else # if a block is given (block_given? is true)~ -** Processing line: ~ state.space_combinations.map do |x, y|~ -** Processing line: ~ yield x, y, state.spaces[x][y] # yield if a block is given~ -** Processing line: ~ end~ +** Processing line: ~ repl do~ +** Processing line: ~ puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype."~ +** Processing line: ~~ +** Processing line: ~ things_to_sort = [~ +** Processing line: ~ { type: :background, order: 1 },~ +** Processing line: ~ { type: :foreground, order: 1 },~ +** Processing line: ~ { type: :foreground, order: 2 }~ +** Processing line: ~ ]~ +** Processing line: ~ puts "*** Original array."~ +** Processing line: ~ puts things_to_sort~ +** Processing line: ~~ +** Processing line: ~ puts "*** Simple sort using key."~ +** Processing line: ~ # For a simple sort, you can use sort_by~ +** Processing line: ~ results = things_to_sort.sort_by do |hash|~ +** Processing line: ~ hash[:order]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ puts results~ +** Processing line: ~~ +** Processing line: ~ puts "*** Custom sort."~ +** Processing line: ~ puts "**** Sorting process."~ +** Processing line: ~ # for a more complicated sort, you can provide a block that returns~ +** Processing line: ~ # -1, 0, 1 for a left and right operand~ +** Processing line: ~ results = things_to_sort.sort do |l, r|~ +** Processing line: ~ sort_result = 0~ +** Processing line: ~ puts "here is l: #{l}"~ +** Processing line: ~ puts "here is r: #{r || "nil"}"~ +** Processing line: ~ # if either value is nil/false return 0~ +** Processing line: ~ if !l || !r~ +** Processing line: ~ sort_result = 0~ +** Processing line: ~ # if the type of "left" is background and the~ +** Processing line: ~ # type of "right" is foreground, then return~ +** Processing line: ~ # -1 (which means "left" is less than "right"~ +** Processing line: ~ elsif l[:type] == :background && r[:type] == :foreground~ +** Processing line: ~ sort_result = -1~ +** Processing line: ~ # if the type of "left" is foreground and the~ +** Processing line: ~ # type of "right" is background, then return~ +** Processing line: ~ # 1 (which means "left" is greater than "right"~ +** Processing line: ~ elsif l[:type] == :foreground && r[:type] == :background~ +** Processing line: ~ sort_result = 1~ +** Processing line: ~ # if "left" and "right"'s type are the same, then~ +** Processing line: ~ # use the order as the tie breaker~ +** Processing line: ~ elsif l[:order] < r[:order]~ +** Processing line: ~ sort_result = -1~ +** Processing line: ~ elsif l[:order] > r[:order]~ +** Processing line: ~ sort_result = 1~ +** Processing line: ~ # returning 0 means both values are equal~ +** Processing line: ~ else~ +** Processing line: ~ sort_result = 0~ ** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ sort_result~ +** Processing line: ~ end.to_a~ ** Processing line: ~~ -** Processing line: ~ # Sets values for a label, such as the position, value, size, alignment, and color.~ -** Processing line: ~ def label x, y, value~ -** Processing line: ~ [x, y + 10, value, 20, 1, 0, 0, 0]~ -** Processing line: ~ end~ +** Processing line: ~ puts "**** Sort result."~ +** Processing line: ~ puts results~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $tic_tac_toe = TicTacToe.new~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~ # Api documention for Array that is worth commiting to memory because arrays are so~ +** Processing line: ~ # awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html~ +** Processing line: ~ # ====================================================================================~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/main.rb~ ** Processing line: ~ def tick args~ -** Processing line: ~ $tic_tac_toe._ = args~ -** Processing line: ~ $tic_tac_toe.state = args.state~ -** Processing line: ~ $tic_tac_toe.outputs = args.outputs~ -** Processing line: ~ $tic_tac_toe.inputs = args.inputs~ -** Processing line: ~ $tic_tac_toe.grid = args.grid~ -** Processing line: ~ $tic_tac_toe.gtk = args.gtk~ -** Processing line: ~ $tic_tac_toe.tick~ -** Processing line: ~ tick_instructions args, "Sample app shows how to work with mouse clicks."~ +** Processing line: ~ args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Learn Ruby Optional - Intermediate Ruby Primer - repl.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Learn Ruby Optional - Intermediate Ruby Primer - repl.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/repl.rb~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Rendering Basics - Labels - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Basics - Labels - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/01_rendering_basics/01_labels/app/main.rb~ +** Processing line: ~ =begin~ +** Processing line: ~~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.labels: An array. Values in this array generate labels~ +** Processing line: ~ the screen.~ +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ +** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ +** Processing line: ~ by adding or subracting.~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # Labels are used to represent text elements in DragonRuby~ +** Processing line: ~~ +** Processing line: ~ # An example of creating a label is:~ +** Processing line: ~ # args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ +** Processing line: ~~ +** Processing line: ~ # The code above does the following:~ +** Processing line: ~ # 1. GET the place where labels go: args.outputs.labels~ +** Processing line: ~ # 2. Request a new LABEL be ADDED: <<~ +** Processing line: ~ # 3. The DEFINITION of a SOLID is the ARRAY:~ +** Processing line: ~ # [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf]~ +** Processing line: ~ # [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # The tick method is called by DragonRuby every frame~ +** Processing line: ~ # args contains all the information regarding the game.~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays."~ +** Processing line: ~ # Here are some examples of simple labels, with the minimum number of parameters~ +** Processing line: ~ # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font~ +** Processing line: ~ args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"]~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."]~ +** Processing line: ~ args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ +** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."]~ +** Processing line: ~ args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."]~ +** Processing line: ~~ +** Processing line: ~ # Demonstration of the Size Parameter~ +** Processing line: ~ args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2]~ +** Processing line: ~ args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1]~ +** Processing line: ~ args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0]~ +** Processing line: ~ args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1]~ +** Processing line: ~ args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2]~ +** Processing line: ~~ +** Processing line: ~ # Demonstration of the Align Parameter~ +** Processing line: ~ args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2]~ +** Processing line: ~ args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1]~ +** Processing line: ~ args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0]~ +** Processing line: ~~ +** Processing line: ~ # Demonstration of the RGBA parameters~ +** Processing line: ~ args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0]~ +** Processing line: ~ args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0]~ +** Processing line: ~ args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255]~ +** Processing line: ~ args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128]~ +** Processing line: ~~ +** Processing line: ~ # Demonstration of the Font parameter~ +** Processing line: ~ # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is~ +** Processing line: ~ args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ]~ +** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ +** Processing line: ~ y: 330 - 50,~ +** Processing line: ~ text: "Custom font (Hash)",~ +** Processing line: ~ size_enum: 0,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 125,~ +** Processing line: ~ g: 0,~ +** Processing line: ~ b: 200,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: "manaspc.ttf" }.label~ +** Processing line: ~~ +** Processing line: ~ # Primitives can hold anything, and can be given a label in the following forms~ +** Processing line: ~ args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label~ +** Processing line: ~~ +** Processing line: ~ args.outputs.primitives << { x: 690 + 150,~ +** Processing line: ~ y: 330 - 110,~ +** Processing line: ~ text: "Custom font (.primitives Hash)",~ +** Processing line: ~ size_enum: 0,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 125,~ +** Processing line: ~ g: 0,~ +** Processing line: ~ b: 200,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: "manaspc.ttf" }.label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -104549,295 +113326,197 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 05_mouse/05_mouse_move/app/main.rb~ +** Processing line: ~* Rendering Basics - Lines - main.rb~ - H1 detected. -- Formatting line: ~05_mouse/05_mouse_move/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Basics - Lines - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/01_rendering_basics/02_lines/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ -** Processing line: ~~ -** Processing line: ~ - num1.greater(num2): Returns the greater value.~ -** Processing line: ~ For example, if we have the command~ -** Processing line: ~ puts 4.greater(3)~ -** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ -** Processing line: ~ Similar to lesser, which returns the lesser value.~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ -** Processing line: ~ For example, in this sample app, we're using find_all to find all zombies that have intersected~ -** Processing line: ~ or hit the player's sprite since these zombies have been killed.~ +** Processing line: ~ - args.outputs.lines: An array. Values in this array generate lines on~ +** Processing line: ~ the screen.~ +** Processing line: ~ - args.state.tick_count: This property contains an integer value that~ +** Processing line: ~ represents the current frame. GTK renders at 60 FPS. A value of 0~ +** Processing line: ~ for args.state.tick_count represents the initial load of the game.~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed.~ -** Processing line: ~ Stores the frame the "down" event occurred.~ -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~ # The parameters required for lines are:~ +** Processing line: ~ # 1. The initial point (x, y)~ +** Processing line: ~ # 2. The end point (x2, y2)~ +** Processing line: ~ # 3. The rgba values for the color and transparency (r, g, b, a)~ ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ When we want to create a new object, we can declare it as a new entity and then define~ -** Processing line: ~ its properties. (Remember, you can use state to define ANY property and it will~ -** Processing line: ~ be retained across frames.)~ +** Processing line: ~ # An example of creating a line would be:~ +** Processing line: ~ # args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255]~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~ # This would create a line from (100, 100) to (300, 300)~ +** Processing line: ~ # The RGB code (255, 0, 255) would determine its color, a purple~ +** Processing line: ~ # It would have an Alpha value of 255, making it completely opaque~ ** Processing line: ~~ -** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ -** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ -** Processing line: ~ each element by 2 or declaring every element as a new entity.~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to create lines."~ ** Processing line: ~~ -** Processing line: ~ - sample: Chooses a random element from the array.~ +** Processing line: ~ args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"]~ ** Processing line: ~~ -** Processing line: ~ - reject: Removes elements that meet certain requirements.~ -** Processing line: ~ In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also~ -** Processing line: ~ rejecting zombies that were killed more than 30 frames ago.~ +** Processing line: ~ # Some simple lines~ +** Processing line: ~ args.outputs.lines << [380, 450, 675, 450]~ +** Processing line: ~ args.outputs.lines << [380, 410, 875, 410]~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ # These examples utilize args.state.tick_count to change the length of the lines over time~ +** Processing line: ~ # args.state.tick_count is the ticks that have occurred in the game~ +** Processing line: ~ # This is accomplished by making either the starting or ending point based on the args.state.tick_count~ +** Processing line: ~ args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255]~ +** Processing line: ~ args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255]~ +** Processing line: ~ args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal~ -** Processing line: ~ # is to kill the zombies as fast as possible!~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class ProtectThePuppiesFromTheZombies~ -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calls the methods necessary for the game to run properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ input~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Sets default values for the zombies and for the player.~ -** Processing line: ~ # Initialization happens only in the first frame.~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.flash_at ||= 0~ -** Processing line: ~ state.zombie_min_spawn_rate ||= 60~ -** Processing line: ~ state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate~ -** Processing line: ~ state.zombies ||= []~ -** Processing line: ~ state.killed_zombies ||= []~ ** Processing line: ~~ -** Processing line: ~ # Declares player as a new entity and sets its properties.~ -** Processing line: ~ # The player begins the game in the center of the screen, not moving in any direction.~ -** Processing line: ~ state.player ||= state.new_entity(:player, { x: 640,~ -** Processing line: ~ y: 360,~ -** Processing line: ~ attack_angle: 0,~ -** Processing line: ~ dx: 0,~ -** Processing line: ~ dy: 0 })~ -** Processing line: ~ end~ +** Processing line: ~* Rendering Basics - Solids Borders - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Basics - Solids Borders - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Outputs a gray background.~ -** Processing line: ~ # Calls the methods needed to output the player, zombies, etc onto the screen.~ -** Processing line: ~ def render~ -** Processing line: ~ outputs.solids << [grid.rect, 100, 100, 100]~ -** Processing line: ~ render_zombies~ -** Processing line: ~ render_killed_zombies~ -** Processing line: ~ render_player~ -** Processing line: ~ render_flash~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/01_rendering_basics/03_solids_borders/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation.~ -** Processing line: ~ def render_zombies~ -** Processing line: ~ outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection~ -** Processing line: ~ z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method~ -** Processing line: ~ z.sprite~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.~ -** Processing line: ~ def render_killed_zombies~ -** Processing line: ~ outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection~ -** Processing line: ~ z.sprite = [z.x,~ -** Processing line: ~ z.y,~ -** Processing line: ~ 4 * 3,~ -** Processing line: ~ 8 * 3,~ -** Processing line: ~ animation_sprite(z, z.death_at), # calls animation_sprite method~ -** Processing line: ~ 0, # angle~ -** Processing line: ~ 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die~ -** Processing line: ~ # change the value of 30 and see what happens when a zombie is killed~ +** Processing line: ~ - args.outputs.solids: An array. Values in this array generate~ +** Processing line: ~ solid/filled rectangles on the screen.~ ** Processing line: ~~ -** Processing line: ~ # Sets values to output the slash over the zombie's sprite when a zombie is killed.~ -** Processing line: ~ # The slash is tilted 45 degrees from the angle of the player's attack.~ -** Processing line: ~ # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions~ -** Processing line: ~ # the slash over the killed zombie's sprite.~ -** Processing line: ~ [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # Outputs the player sprite using the images in the sprites folder.~ -** Processing line: ~ def render_player~ -** Processing line: ~ state.player_sprite = [state.player.x,~ -** Processing line: ~ state.player.y,~ -** Processing line: ~ 4 * 3,~ -** Processing line: ~ 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation~ -** Processing line: ~ outputs.sprites << state.player_sprite~ +** Processing line: ~ # Rects are outputted in DragonRuby as rectangles~ +** Processing line: ~ # If filled in, they are solids~ +** Processing line: ~ # If hollow, they are borders~ ** Processing line: ~~ -** Processing line: ~ # Outputs a small red square that previews the angles that the player can attack in.~ -** Processing line: ~ # It can be moved in a perfect circle around the player to show possible movements.~ -** Processing line: ~ # Change the 60 in the parenthesis and see what happens to the movement of the red square.~ -** Processing line: ~ outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),~ -** Processing line: ~ state.player.y + state.player.attack_angle.vector_y(60),~ -** Processing line: ~ 3, 3, 255, 0, 0]~ -** Processing line: ~ end~ +** Processing line: ~ # Solids are added to args.outputs.solids~ +** Processing line: ~ # Borders are added to args.outputs.borders~ ** Processing line: ~~ -** Processing line: ~ # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed.~ -** Processing line: ~ def render_flash~ -** Processing line: ~ return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash.~ -** Processing line: ~ # Transparency gradually changes (or eases) during the 10 frames of flash.~ -** Processing line: ~ outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid~ -** Processing line: ~ end~ +** Processing line: ~ # The parameters required for rects are:~ +** Processing line: ~ # 1. The upper right corner (x, y)~ +** Processing line: ~ # 2. The width (w)~ +** Processing line: ~ # 3. The height (h)~ +** Processing line: ~ # 4. The rgba values for the color and transparency (r, g, b, a)~ ** Processing line: ~~ -** Processing line: ~ # Calls all methods necessary for performing calculations.~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_spawn_zombie~ -** Processing line: ~ calc_move_zombies~ -** Processing line: ~ calc_player~ -** Processing line: ~ calc_kill_zombie~ -** Processing line: ~ end~ +** Processing line: ~ # Here is an example of a rect definition:~ +** Processing line: ~ # [100, 100, 400, 500, 0, 255, 0, 180]~ ** Processing line: ~~ -** Processing line: ~ # Decreases the zombie spawn countdown by 1 if it has a value greater than 0.~ -** Processing line: ~ def calc_spawn_zombie~ -** Processing line: ~ if state.zombie_spawn_countdown > 0~ -** Processing line: ~ state.zombie_spawn_countdown -= 1~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~ # The example would create a rect from (100, 100)~ +** Processing line: ~ # Extending 400 pixels across the x axis~ +** Processing line: ~ # and 500 pixels across the y axis~ +** Processing line: ~ # The rect would be green (0, 255, 0)~ +** Processing line: ~ # and mostly opaque with some transparency (180)~ ** Processing line: ~~ -** Processing line: ~ # New zombies are created, positioned on the screen, and added to the zombies collection.~ -** Processing line: ~ state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity~ -** Processing line: ~ if rand > 0.5~ -** Processing line: ~ z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope)~ -** Processing line: ~ z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen)~ -** Processing line: ~ # the possible values exceed the screen's scope so zombies appear to be coming from far away~ -** Processing line: ~ else~ -** Processing line: ~ z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen)~ -** Processing line: ~ z.y = grid.rect.w.randomize(:ratio) # random y position on screen~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Whether the rect would be filled or not depends on if~ +** Processing line: ~ # it is added to args.outputs.solids or args.outputs.borders~ ** Processing line: ~~ -** Processing line: ~ # Calls random_spawn_countdown method (determines how fast new zombies appear)~ -** Processing line: ~ state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate~ -** Processing line: ~ state.zombie_min_spawn_rate -= 1~ -** Processing line: ~ # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater~ -** Processing line: ~ state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0)~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Moves all zombies towards the center of the screen.~ -** Processing line: ~ # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear.~ -** Processing line: ~ def calc_move_zombies~ -** Processing line: ~ state.zombies.each do |z| # for each zombie in the collection~ -** Processing line: ~ z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1~ -** Processing line: ~ z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center~ -** Processing line: ~ end~ -** Processing line: ~ state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to create solid squares."~ +** Processing line: ~ args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"]~ +** Processing line: ~ args.outputs.solids << [470, 520, 50, 50]~ +** Processing line: ~ args.outputs.solids << [530, 520, 50, 50, 0, 0, 0]~ +** Processing line: ~ args.outputs.solids << [590, 520, 50, 50, 255, 0, 0]~ +** Processing line: ~ args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128]~ +** Processing line: ~ args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ ** Processing line: ~~ -** Processing line: ~ # Calculates the position and movement of the player on the screen.~ -** Processing line: ~ def calc_player~ -** Processing line: ~ state.player.x += state.player.dx # changes x based on dx (change in x)~ -** Processing line: ~ state.player.y += state.player.dy # changes y based on dy (change in y)~ ** Processing line: ~~ -** Processing line: ~ state.player.dx *= 0.9 # scales dx down~ -** Processing line: ~ state.player.dy *= 0.9 # scales dy down~ +** Processing line: ~ args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"]~ +** Processing line: ~ args.outputs.borders << [470, 320, 50, 50]~ +** Processing line: ~ args.outputs.borders << [530, 320, 50, 50, 0, 0, 0]~ +** Processing line: ~ args.outputs.borders << [590, 320, 50, 50, 255, 0, 0]~ +** Processing line: ~ args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128]~ +** Processing line: ~ args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value.~ -** Processing line: ~ # This ensures that the player remains within the screen's scope.~ -** Processing line: ~ state.player.x = state.player.x.lesser(1280).greater(0)~ -** Processing line: ~ state.player.y = state.player.y.lesser(720).greater(0) # same with player's y~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection~ -** Processing line: ~ # and added to the killed_zombies collection since any zombie that intersects with the player is killed.~ -** Processing line: ~ def calc_kill_zombie~ -** Processing line: ~~ -** Processing line: ~ # Find all zombies that intersect with the player. They are considered killed.~ -** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ -** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ -** Processing line: ~ state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies~ -** Processing line: ~~ -** Processing line: ~ if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame~ -** Processing line: ~ state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed~ -** Processing line: ~ # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method)~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie.~ -** Processing line: ~ # Death_at stores the frame a zombie was killed.~ -** Processing line: ~ killed_this_frame.each do |z|~ -** Processing line: ~ z.death_at = state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Zombies are rejected from the killed_zombies collection depending on when they were killed.~ -** Processing line: ~ # They are rejected if more than 30 frames have passed since their death.~ -** Processing line: ~ state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 }~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Uses input from the user to move the player around the screen.~ -** Processing line: ~ def input~ ** Processing line: ~~ -** Processing line: ~ # If the "a" key or left key is pressed, the x position of the player decreases.~ -** Processing line: ~ # Otherwise, if the "d" key or right key is pressed, the x position of the player increases.~ -** Processing line: ~ if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left~ -** Processing line: ~ state.player.x -= 5~ -** Processing line: ~ elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right~ -** Processing line: ~ state.player.x += 5~ -** Processing line: ~ end~ +** Processing line: ~* Rendering Basics - Sprites - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Basics - Sprites - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # If the "w" or up key is pressed, the y position of the player increases.~ -** Processing line: ~ # Otherwise, if the "s" or down key is pressed, the y position of the player decreases.~ -** Processing line: ~ if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up~ -** Processing line: ~ state.player.y += 5~ -** Processing line: ~ elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down~ -** Processing line: ~ state.player.y -= 5~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/01_rendering_basics/04_sprites/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # Sets the attack angle so the player can move and attack in the precise direction it wants to go.~ -** Processing line: ~ # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position).~ -** Processing line: ~ # Attack angle also contributes to the position of red square.~ -** Processing line: ~ if inputs.mouse.moved~ -** Processing line: ~ state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5~ -** Processing line: ~ state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ -** Processing line: ~ state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set~ -** Processing line: ~ state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position~ -** Processing line: ~ state.player.dy = state.player.attack_angle.vector_y(25)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate~ +** Processing line: ~ sprites on the screen. The location of the sprite is assumed to~ +** Processing line: ~ be under the mygame/ directory (the exception being dragonruby.png).~ ** Processing line: ~~ -** Processing line: ~ # Sets the zombie spawn's countdown to a random number.~ -** Processing line: ~ # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!)~ -** Processing line: ~ def random_spawn_countdown minimum~ -** Processing line: ~ 10.randomize(:ratio, :sign).to_i + 60~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # Helps to iterate through the images in the sprites folder by setting the animation index.~ -** Processing line: ~ # 3 frames is how long to show an image, and 6 is how many images to flip through.~ -** Processing line: ~ def animation_index at~ -** Processing line: ~ at.idiv(3).mod(6)~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Animates the zombies by using the animation index to go through the images in the sprites folder.~ -** Processing line: ~ def animation_sprite zombie, at = nil~ -** Processing line: ~ at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created~ -** Processing line: ~ index = animation_index at~ -** Processing line: ~ "sprites/zombie-#{index}.png" # string interpolation to iterate through images~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # For all other display outputs, Sprites are your solution~ +** Processing line: ~ # Sprites import images and display them with a certain rectangular area~ +** Processing line: ~ # The image can be of any usual format and should be located within the folder,~ +** Processing line: ~ # similar to additional fonts.~ ** Processing line: ~~ -** Processing line: ~ $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new~ +** Processing line: ~ # Sprites have the following parameters~ +** Processing line: ~ # Rectangular area (x, y, width, height)~ +** Processing line: ~ # The image (path)~ +** Processing line: ~ # Rotation (angle)~ +** Processing line: ~ # Alpha (a)~ ** Processing line: ~~ ** Processing line: ~ def tick args~ -** Processing line: ~ $protect_the_puppies_from_the_zombies.grid = args.grid~ -** Processing line: ~ $protect_the_puppies_from_the_zombies.inputs = args.inputs~ -** Processing line: ~ $protect_the_puppies_from_the_zombies.state = args.state~ -** Processing line: ~ $protect_the_puppies_from_the_zombies.outputs = args.outputs~ -** Processing line: ~ $protect_the_puppies_from_the_zombies.tick~ -** Processing line: ~ tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play."~ +** Processing line: ~ tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it."~ +** Processing line: ~ args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"]~ +** Processing line: ~ args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png']~ +** Processing line: ~ args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360]~ +** Processing line: ~ args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255]~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -104858,239 +113537,191 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 05_mouse/05_mouse_move_paint_app/app/main.rb~ +** Processing line: ~* Rendering Basics - Sounds - main.rb~ - H1 detected. -- Formatting line: ~05_mouse/05_mouse_move_paint_app/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Basics - Sounds - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/01_rendering_basics/05_sounds/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - Floor: Method that returns an integer number smaller than or equal to the original with no decimal.~ +** Processing line: ~ APIs Listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this...~ -** Processing line: ~ puts a.floor()~ -** Processing line: ~ which would print out 13.~ -** Processing line: ~ (There is also a ceil method, which returns an integer number greater than or equal to the original~ -** Processing line: ~ with no decimal. If we had called ceil on the variable a, the result would have been 14.)~ +** Processing line: ~ - sample: Chooses random element from array.~ +** Processing line: ~ In this sample app, the target note is set by taking a sample from the collection~ +** Processing line: ~ of available notes.~ ** Processing line: ~~ ** Processing line: ~ Reminders:~ -** Processing line: ~~ -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ -** Processing line: ~ using their keys.~ -** Processing line: ~~ -** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ -** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ -** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ -** Processing line: ~ and on it goes.~ -** Processing line: ~~ -** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ -** Processing line: ~ puts numbers["one"]~ -** Processing line: ~ which would print "uno" to the console.~ +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ ** Processing line: ~~ ** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ -** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ +** Processing line: ~ then define its properties.~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values in the array generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ ** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ - first: Returns the first element of an array.~ ** Processing line: ~~ -** Processing line: ~ # This sample app shows an empty grid that the user can paint on.~ -** Processing line: ~ # To paint, the user must keep their mouse presssed and drag it around the grid.~ -** Processing line: ~ # The "clear" button allows users to clear the grid so they can start over.~ +** Processing line: ~ - inside_rect: Returns true or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ class PaintApp~ -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ +** Processing line: ~ - to_sym: Returns symbol corresponding to string. Will create a symbol if it does~ +** Processing line: ~ not already exist.~ ** Processing line: ~~ -** Processing line: ~ # Runs methods necessary for the game to function properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ print_title~ -** Processing line: ~ add_grid~ -** Processing line: ~ check_click~ -** Processing line: ~ draw_buttons~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # Prints the title onto the screen by using a label.~ -** Processing line: ~ # Also separates the title from the grid with a line as a horizontal separator.~ -** Processing line: ~ def print_title~ -** Processing line: ~ args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ]~ -** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280)~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app allows users to test their musical skills by matching the piano sound that plays in each~ +** Processing line: ~ # level to the correct note.~ ** Processing line: ~~ -** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ -** Processing line: ~ # The starting and ending positions have the same y values.~ -** Processing line: ~ def horizontal_separator y, x, x2~ -** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ -** Processing line: ~ end~ +** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ +** Processing line: ~ input_mouse args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\""~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets the starting position, ending position, and color for the vertical separator.~ -** Processing line: ~ # The starting and ending positions have the same x values.~ -** Processing line: ~ def vertical_separator x, y, y2~ -** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ -** Processing line: ~ end~ +** Processing line: ~ # Sets default values and creates empty collections~ +** Processing line: ~ # Initialization happens in the first frame only~ +** Processing line: ~ def defaults _~ +** Processing line: ~ _.state.notes ||= []~ +** Processing line: ~ _.state.click_feedbacks ||= []~ +** Processing line: ~ _.state.current_level ||= 1~ +** Processing line: ~ _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs a border and a grid containing empty squares onto the screen.~ -** Processing line: ~ def add_grid~ +** Processing line: ~ # Uses a label to display current level, and shows the score~ +** Processing line: ~ # Creates a button to play the sample note, and displays the available notes that could be a potential match~ +** Processing line: ~ def render _~ ** Processing line: ~~ -** Processing line: ~ # Sets the x, y, height, and width of the grid.~ -** Processing line: ~ # There are 31 horizontal lines and 31 vertical lines in the grid.~ -** Processing line: ~ # Feel free to count them yourself before continuing!~ -** Processing line: ~ x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center~ -** Processing line: ~ lines_h = 31~ -** Processing line: ~ lines_v = 31~ +** Processing line: ~ # grid.w_half positions the label in the horizontal center of the screen.~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0]~ ** Processing line: ~~ -** Processing line: ~ # Sets values for the grid's border, grid lines, and filled squares.~ -** Processing line: ~ # The filled_squares variable is initially set to an empty array.~ -** Processing line: ~ state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border~ -** Processing line: ~ state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method~ -** Processing line: ~ state.filled_squares ||= [] # there are no filled squares until the user fills them in~ +** Processing line: ~ render_score _ # shows score on screen~ ** Processing line: ~~ -** Processing line: ~ # Outputs the grid lines, border, and filled squares onto the screen.~ -** Processing line: ~ outputs.lines.concat state.grid_lines~ -** Processing line: ~ outputs.borders << state.grid_border~ -** Processing line: ~ outputs.solids << state.filled_squares~ +** Processing line: ~ if _.state.game_over # if game is over, a "play again" button is shown~ +** Processing line: ~ # Calculations ensure that Play Again label is displayed in center of border~ +** Processing line: ~ # Remove calculations from y parameters and see what happens to border and label placement~ +** Processing line: ~ _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label~ +** Processing line: ~ _.outputs.borders << _.state.play_again_border # outputs border~ +** Processing line: ~ else # otherwise, if game is not over~ +** Processing line: ~ # Calculations ensure that label appears in center of border~ +** Processing line: ~ _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label~ +** Processing line: ~ _.outputs.borders << _.state.play_note_border # outputs border~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Draws the grid by adding in vertical and horizontal separators.~ -** Processing line: ~ def draw_grid x, y, h, w, lines_h, lines_v~ -** Processing line: ~~ -** Processing line: ~ # The grid starts off empty.~ -** Processing line: ~ grid = []~ -** Processing line: ~~ -** Processing line: ~ # Calculates the placement and adds horizontal lines or separators into the grid.~ -** Processing line: ~ curr_y = y # start at the bottom of the box~ -** Processing line: ~ dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid~ -** Processing line: ~ lines_h.times do~ -** Processing line: ~ curr_y += dist_y # increment curr_y by the distance between the horizontal lines~ -** Processing line: ~ grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Calculates the placement and adds vertical lines or separators into the grid.~ -** Processing line: ~ curr_x = x # now start at the left of the box~ -** Processing line: ~ dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid~ -** Processing line: ~ lines_v.times do~ -** Processing line: ~ curr_x += dist_x # increment curr_x by the distance between the vertical lines~ -** Processing line: ~ grid << vertical_separator(curr_x, y + 1, y + h) # add separator~ -** Processing line: ~ end~ +** Processing line: ~ return if _.state.game_over # return if game is over~ ** Processing line: ~~ -** Processing line: ~ # paint_grid uses a hash to assign values to keys.~ -** Processing line: ~ state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h,~ -** Processing line: ~ "lines_v" => lines_v, "dist_x" => dist_x,~ -** Processing line: ~ "dist_y" => dist_y }~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label~ ** Processing line: ~~ -** Processing line: ~ return grid~ +** Processing line: ~ # Shows all of the available notes that can be potential matches.~ +** Processing line: ~ available_notes.each_with_index do |note, i|~ +** Processing line: ~ _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border)~ +** Processing line: ~ _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border~ +** Processing line: ~ _.outputs.borders << _.state.notes[i].border~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values.~ -** Processing line: ~ # If the mouse is up, the user cannot drag the mouse.~ -** Processing line: ~ def check_click~ -** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ -** Processing line: ~ state.mouse_held = true # mouse is being held down~ -** Processing line: ~ elsif inputs.mouse.up # if mouse is up~ -** Processing line: ~ state.mouse_held = false # mouse is not being held down or dragged~ -** Processing line: ~ state.mouse_dragging = false~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.mouse_held && # mouse needs to be down~ -** Processing line: ~ !inputs.mouse.click && # must not be first click~ -** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag"~ -** Processing line: ~ state.mouse_dragging = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type.~ -** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ -** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ +** Processing line: ~ # Shows whether or not the user is correct by filling the screen with either red or green~ +** Processing line: ~ _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type.~ -** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ -** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ -** Processing line: ~ end~ +** Processing line: ~ # Shows the score (number of times the user guesses wrong) onto the screen using labels.~ +** Processing line: ~ def render_score _~ +** Processing line: ~ if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0]~ +** Processing line: ~ else # otherwise, number of times the user has guessed wrong is shown~ +** Processing line: ~ _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets the definition of a grid box and handles user input to fill in or clear grid boxes.~ -** Processing line: ~ def search_lines (point, input_type)~ -** Processing line: ~ point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash~ -** Processing line: ~ point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash~ +** Processing line: ~ # Sets the target note for the level and performs calculations on click_feedbacks.~ +** Processing line: ~ def calc _~ +** Processing line: ~ _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note~ +** Processing line: ~ _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely~ +** Processing line: ~ # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection~ +** Processing line: ~ _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Remove code following the .floor and see what happens when you try to fill in grid squares~ -** Processing line: ~ point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"]~ -** Processing line: ~ point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"]~ +** Processing line: ~ # Uses input from the user to play the target note, as well as the other notes that could be a potential match.~ +** Processing line: ~ def input_mouse _~ +** Processing line: ~ return unless _.inputs.mouse.click # return unless the mouse is clicked~ ** Processing line: ~~ -** Processing line: ~ point.x += state.paint_grid["x"]~ -** Processing line: ~ point.y += state.paint_grid["y"]~ +** Processing line: ~ # finds button that was clicked by user~ +** Processing line: ~ button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements~ +** Processing line: ~ _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of~ +** Processing line: ~ end.reject {|b| !_.state.meta(b)}.first # reject, return first element~ ** Processing line: ~~ -** Processing line: ~ # Sets definition of a grid box, meaning its x, y, width, and height.~ -** Processing line: ~ # Floor is called on the point.x and point.y variables.~ -** Processing line: ~ # Ceil method is called on values of the distance hash keys, setting the width and height of a box.~ -** Processing line: ~ grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ]~ +** Processing line: ~ return unless button_clicked # return unless button_clicked as a value (a button was clicked)~ ** Processing line: ~~ -** Processing line: ~ if input_type == :click # if user clicks their mouse~ -** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ -** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ -** Processing line: ~ else~ -** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ -** Processing line: ~ end~ -** Processing line: ~ elsif input_type == :drag # if user drags mouse~ -** Processing line: ~ unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in~ -** Processing line: ~ state.filled_squares << grid_box # the box is filled in and added to filled_squares~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked~ +** Processing line: ~ button_clicked.x,~ +** Processing line: ~ button_clicked.y,~ +** Processing line: ~ button_clicked.w,~ +** Processing line: ~ button_clicked.h,~ +** Processing line: ~ 150, 100, 200 # sets color of button to shade of purple~ ** Processing line: ~~ -** Processing line: ~ # Creates and outputs a "Clear" button on the screen using a label and a border.~ -** Processing line: ~ # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty.~ -** Processing line: ~ def draw_buttons~ -** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ -** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ +** Processing line: ~ if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed~ +** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output~ +** Processing line: ~ elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed~ +** Processing line: ~ _.state.target_note = nil # no target note~ +** Processing line: ~ _.state.current_level = 1 # starts at level 1 again~ +** Processing line: ~ _.state.times_wrong = 0 # starts off with 0 wrong guesses~ +** Processing line: ~ _.state.game_over = false # the game is not over (because it has just been restarted)~ +** Processing line: ~ else # otherwise if neither of those buttons were pressed~ +** Processing line: ~ _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played~ +** Processing line: ~ if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note~ +** Processing line: ~ _.state.target_note = nil # target note is emptied~ ** Processing line: ~~ -** Processing line: ~ # The x and y positions are set to display the label in the center of the button.~ -** Processing line: ~ # Try changing the first two parameters to simply x, y and see what happens to the text placement!~ -** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border~ -** Processing line: ~ state.clear_button.border ||= [x, y, w, h]~ +** Processing line: ~ if _.state.current_level < 9 # if game hasn't reached level 9~ +** Processing line: ~ _.state.current_level += 1 # game goes to next level~ +** Processing line: ~ else # otherwise, if game has reached level 9~ +** Processing line: ~ _.state.game_over = true # the game is over~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # If the mouse is clicked inside the borders of the clear button,~ -** Processing line: ~ # the filled_squares collection is emptied and the squares are cleared.~ -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ -** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred~ -** Processing line: ~ state.filled_squares.clear~ -** Processing line: ~ inputs.mouse.previous_click = nil~ +** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly~ +** Processing line: ~ else # otherwise, if clicked note is not target note~ +** Processing line: ~ _.state.times_wrong += 1 # increments times user guessed wrong~ +** Processing line: ~ queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong~ ** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << state.clear_button.label~ -** Processing line: ~ outputs.borders << state.clear_button.border~ +** Processing line: ~ # Creates a collection of all of the available notes as symbols~ +** Processing line: ~ def available_notes~ +** Processing line: ~ [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # When the clear button is clicked, the color of the button changes~ -** Processing line: ~ # and the transparency changes, as well. If you change the time from~ -** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ -** Processing line: ~ if state.clear_button.clicked_at~ -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ -** Processing line: ~ end~ +** Processing line: ~ # Creates buttons for each note, and sets a label (the note's name) and border for each note's button.~ +** Processing line: ~ def piano_button _, note, position~ +** Processing line: ~ _.state.new_entity(:button) do |b| # declares button as new entity~ +** Processing line: ~ b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition~ +** Processing line: ~ b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $paint_app = PaintApp.new~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $paint_app.inputs = args.inputs~ -** Processing line: ~ $paint_app.state = args.state~ -** Processing line: ~ $paint_app.grid = args.grid~ -** Processing line: ~ $paint_app.args = args~ -** Processing line: ~ $paint_app.outputs = args.outputs~ -** Processing line: ~ $paint_app.tick~ -** Processing line: ~ tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw."~ +** Processing line: ~ # Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong~ +** Processing line: ~ # If a button is clicked, the inside of button is purple (see input_mouse method)~ +** Processing line: ~ # If correct note is clicked, screen turns green~ +** Processing line: ~ # If incorrect note is clicked, screen turns red (again, see input_mouse method)~ +** Processing line: ~ def queue_click_feedback _, x, y, w, h, *color~ +** Processing line: ~ _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity~ +** Processing line: ~ c.solid = [x, y, w, h, *color, 255] # sets color~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -105111,81 +113742,174 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 05_mouse/06_coordinate_systems/app/main.rb~ +** Processing line: ~* Input Basics - Keyboard - main.rb~ - H1 detected. -- Formatting line: ~05_mouse/06_coordinate_systems/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Input Basics - Keyboard - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/02_input_basics/01_keyboard/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ APIs listing that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen.~ -** Processing line: ~ Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for~ -** Processing line: ~ position to know the mouse's coordinates.~ -** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ +** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ +** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ +** Processing line: ~ to args.state.tick_count). Otherwise the value will be nil. For a~ +** Processing line: ~ full listing of keys, take a look at mygame/documentation/06-keyboard.md.~ +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ +** Processing line: ~ structure. You can define ANY property here with ANY type of~ +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ +** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ # Along with outputs, inputs are also an essential part of video game development~ +** Processing line: ~ # DragonRuby can take input from keyboards, mouse, and controllers.~ +** Processing line: ~ # This sample app will cover keyboard input.~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ +** Processing line: ~ # args.inputs.keyboard.key_up.a will check to see if the a key has been pressed~ +** Processing line: ~ # This will work with the other keys as well~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ In this sample app, string interpolation is used to show the current position of the mouse~ -** Processing line: ~ in a label.~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360~ +** Processing line: ~ # Notice how small_font accounts for all the remaining parameters~ +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font]~ +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font]~ +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font]~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array that generates a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key~ +** Processing line: ~ if args.inputs.keyboard.key_up.h~ +** Processing line: ~ args.state.h_pressed_at = args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array that generates a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false~ +** Processing line: ~ args.state.h_pressed_at ||= false~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.lines: An array that generates a line.~ -** Processing line: ~ The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA]~ -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ +** Processing line: ~ if args.state.h_pressed_at~ +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font]~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ tick_help_text args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the~ -** Processing line: ~ # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or~ -** Processing line: ~ # four quadrants by pressing the button.~ +** Processing line: ~ def small_font~ +** Processing line: ~ # This method provides some values for the construction of labels~ +** Processing line: ~ # Specifically, Size, Alignment, & RGBA~ +** Processing line: ~ # This makes it so that custom parameters don't have to be repeatedly typed.~ +** Processing line: ~ # Additionally "small_font" provides programmers with more information than some numbers~ +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ +** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ # This takes a row_number and converts it to pixels DragonRuby understands.~ +** Processing line: ~ # Row 0 starts 5 units below the top of the grid~ +** Processing line: ~ # Each row afterward is 20 units lower~ +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The addition and subtraction in the first two parameters of the label and solid~ -** Processing line: ~ # ensure that the outputs don't overlap each other. Try removing them and see what happens.~ -** Processing line: ~ pos = args.inputs.mouse.position # stores coordinates of mouse's position~ -** Processing line: ~ args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates~ -** Processing line: ~ args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering~ +** Processing line: ~ # Don't worry about understanding the code within this method just yet.~ +** Processing line: ~ # This method shows you the help text within the game.~ +** Processing line: ~ def tick_help_text args~ +** Processing line: ~ return unless args.state.h_pressed_at~ ** Processing line: ~~ -** Processing line: ~ button = [0, 0, 370, 50] # sets definition of toggle button~ -** Processing line: ~ args.outputs.borders << button # outputs button as border (not filled in)~ -** Processing line: ~ args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button~ -** Processing line: ~ args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants~ -** Processing line: ~ args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants~ +** Processing line: ~ args.state.key_value_history ||= {}~ +** Processing line: ~ args.state.key_down_value_history ||= {}~ +** Processing line: ~ args.state.key_held_value_history ||= {}~ +** Processing line: ~ args.state.key_up_value_history ||= {}~ ** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.click # if the user clicks the mouse~ -** Processing line: ~ pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates)~ -** Processing line: ~ if pos.inside_rect? button # if the click occurred inside the button~ -** Processing line: ~ if args.grid.name == :bottom_left # if the grid shows bottom left as origin~ -** Processing line: ~ args.grid.origin_center! # origin will be shown in center~ -** Processing line: ~ else~ -** Processing line: ~ args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin~ -** Processing line: ~ end~ +** Processing line: ~ if (args.inputs.keyboard.key_down.truthy_keys.length > 0 ||~ +** Processing line: ~ args.inputs.keyboard.key_held.truthy_keys.length > 0 ||~ +** Processing line: ~ args.inputs.keyboard.key_up.truthy_keys.length > 0)~ +** Processing line: ~ args.state.help_available = true~ +** Processing line: ~ args.state.no_activity_debounce = nil~ +** Processing line: ~ else~ +** Processing line: ~ args.state.no_activity_debounce ||= 5.seconds~ +** Processing line: ~ args.state.no_activity_debounce -= 1~ +** Processing line: ~ if args.state.no_activity_debounce <= 0~ +** Processing line: ~ args.state.help_available = false~ +** Processing line: ~ args.state.key_value_history = {}~ +** Processing line: ~ args.state.key_down_value_history = {}~ +** Processing line: ~ args.state.key_held_value_history = {}~ +** Processing line: ~ args.state.key_up_value_history = {}~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit."~ +** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font]~ +** Processing line: ~~ +** Processing line: ~ if !args.state.help_available~ +** Processing line: ~ args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font]~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font]~ +** Processing line: ~ args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font]~ +** Processing line: ~ args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font]~ +** Processing line: ~ args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font]~ +** Processing line: ~~ +** Processing line: ~ fill_history args, :key_value_history, :down_or_held, nil~ +** Processing line: ~ fill_history args, :key_down_value_history, :down, :key_down~ +** Processing line: ~ fill_history args, :key_held_value_history, :held, :key_held~ +** Processing line: ~ fill_history args, :key_up_value_history, :up, :key_up~ +** Processing line: ~~ +** Processing line: ~ render_help_labels args, :key_value_history, :down_or_held, nil, 10~ +** Processing line: ~ render_help_labels args, :key_down_value_history, :down, :key_down, 330~ +** Processing line: ~ render_help_labels args, :key_held_value_history, :held, :key_held, 650~ +** Processing line: ~ render_help_labels args, :key_up_value_history, :up, :key_up, 990~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def fill_history args, history_key, state_key, keyboard_method~ +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :raw_key~ +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, :char~ +** Processing line: ~ args.inputs.keyboard.keys[state_key].each do |key_name|~ +** Processing line: ~ fill_single_history args, history_key, state_key, keyboard_method, key_name~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def fill_single_history args, history_key, state_key, keyboard_method, key_name~ +** Processing line: ~ current_value = args.inputs.keyboard.send(key_name)~ +** Processing line: ~ if keyboard_method~ +** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(key_name)~ +** Processing line: ~ end~ +** Processing line: ~ args.state.as_hash[history_key][key_name] ||= []~ +** Processing line: ~ args.state.as_hash[history_key][key_name] << current_value~ +** Processing line: ~ args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_help_labels args, history_key, state_key, keyboard_method, x~ +** Processing line: ~ idx = 8~ +** Processing line: ~ args.outputs.labels << args.state~ +** Processing line: ~ .as_hash[history_key]~ +** Processing line: ~ .keys~ +** Processing line: ~ .reverse~ +** Processing line: ~ .map~ +** Processing line: ~ .with_index do |k, i|~ +** Processing line: ~ v = args.state.as_hash[history_key][k]~ +** Processing line: ~ current_value = args.inputs.keyboard.send(k)~ +** Processing line: ~ if keyboard_method~ +** Processing line: ~ current_value = args.inputs.keyboard.send(keyboard_method).send(k)~ +** Processing line: ~ end~ +** Processing line: ~ idx += 2~ +** Processing line: ~ [~ +** Processing line: ~ [x, row_to_px(args, idx - 2),~ +** Processing line: ~ " .#{k} is #{current_value || "nil"}",~ +** Processing line: ~ small_font],~ +** Processing line: ~ [x, row_to_px(args, idx - 1),~ +** Processing line: ~ " was #{v}",~ +** Processing line: ~ small_font]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ ** Processing line: ~ return if args.state.key_event_occurred~ ** Processing line: ~ if args.inputs.mouse.click ||~ @@ -105204,451 +113928,450 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 06_save_load/10_save_load_game/app/main.rb~ +** Processing line: ~* Input Basics - Mouse - main.rb~ - H1 detected. -- Formatting line: ~06_save_load/10_save_load_game/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Input Basics - Mouse - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/02_input_basics/02_mouse/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful~ -** Processing line: ~ because with a given symbol name, you can refer to the same object throughout~ -** Processing line: ~ a Ruby program.~ +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ In this sample app, we're using symbols for our buttons. We have buttons that~ -** Processing line: ~ light fires, save, load, etc. Each of these buttons has a distinct symbol like~ -** Processing line: ~ :light_fire, :save_game, :load_game, etc.~ +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ +** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ +** Processing line: ~ since the click event.~ ** Processing line: ~~ -** Processing line: ~ - to_sym: Returns the symbol corresponding to the given string; creates the symbol~ -** Processing line: ~ if it does not already exist.~ -** Processing line: ~ For example,~ -** Processing line: ~ 'car'.to_sym~ -** Processing line: ~ would return the symbol :car.~ +** Processing line: ~ Reminder:~ ** Processing line: ~~ -** Processing line: ~ - last: Returns the last element of an array.~ +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ +** Processing line: ~ structure. You can define ANY property here with ANY type of~ +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ +** Processing line: ~ across frames. If you attempt access a property that doesn't exist~ +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ - num1.lesser(num2): finds the lower value of the given options.~ -** Processing line: ~ For example, in the statement~ -** Processing line: ~ a = 4.lesser(3)~ -** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ -** Processing line: ~ but if the statement had been~ -** Processing line: ~ a = 4.lesser(5)~ -** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ +** Processing line: ~ # This code demonstrates DragonRuby mouse input~ ** Processing line: ~~ -** Processing line: ~ - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers.~ -** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ +** Processing line: ~ # To see if the a mouse click occurred~ +** Processing line: ~ # Use args.inputs.mouse.click~ +** Processing line: ~ # Which returns a boolean~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~ # To see where a mouse click occurred~ +** Processing line: ~ # Use args.inputs.mouse.click.point.x AND~ +** Processing line: ~ # args.inputs.mouse.click.point.y~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. Values generate a label.~ -** Processing line: ~ Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ # To see which frame the click occurred~ +** Processing line: ~ # Use args.inputs.mouse.click.created_at~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ -** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ -** Processing line: ~ or false depending on if the point is inside the rect.~ +** Processing line: ~ # To see how many frames its been since the click occurred~ +** Processing line: ~ # Use args.inputs.mouse.click.creat_at_elapsed~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ # Saving the click in args.state can be quite useful~ ** Processing line: ~~ -** Processing line: ~ # This code allows users to perform different tasks, such as saving and loading the game.~ -** Processing line: ~ # Users also have options to reset the game and light a fire.~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time."~ +** Processing line: ~ x = 460~ ** Processing line: ~~ -** Processing line: ~ class TextedBasedGame~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse")~ ** Processing line: ~~ -** Processing line: ~ # Contains methods needed for game to run properly.~ -** Processing line: ~ # Increments tick count by 1 each time it runs (60 times in a single second)~ -** Processing line: ~ def tick~ -** Processing line: ~ default~ -** Processing line: ~ show_intro~ -** Processing line: ~ state.engine_tick_count += 1~ -** Processing line: ~ tick_fire~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values.~ -** Processing line: ~ # The ||= ensures that a variable's value is only set to the value following the = sign~ -** Processing line: ~ # if the value has not already been set before. Intialization happens only in the first frame.~ -** Processing line: ~ def default~ -** Processing line: ~ state.engine_tick_count ||= 0~ -** Processing line: ~ state.active_module ||= :room~ -** Processing line: ~ state.fire_progress ||= 0~ -** Processing line: ~ state.fire_ready_in ||= 10~ -** Processing line: ~ state.previous_fire ||= :dead~ -** Processing line: ~ state.fire ||= :dead~ +** Processing line: ~ if args.state.last_mouse_click~ +** Processing line: ~ click = args.state.last_mouse_click~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}")~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago")~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}")~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.")~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 13, "Please click mouse.")~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def show_intro~ -** Processing line: ~ return unless state.engine_tick_count == 0 # return unless the game just started~ -** Processing line: ~ set_story_line "awake." # calls set_story_line method, sets to "awake"~ -** Processing line: ~ end~ +** Processing line: ~ def small_label args, x, row, message~ +** Processing line: ~ # This method effectively combines the row_to_px and small_font methods~ +** Processing line: ~ # It changes the given row value to a DragonRuby pixel value~ +** Processing line: ~ # and adds the customization parameters~ +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets story line.~ -** Processing line: ~ def set_story_line story_line~ -** Processing line: ~ state.story_line = story_line # story line set to value of parameter~ -** Processing line: ~ state.active_module = :alert # active module set to alert~ -** Processing line: ~ end~ +** Processing line: ~ def small_font~ +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Clears story line.~ -** Processing line: ~ def clear_storyline~ -** Processing line: ~ state.active_module = :none # active module set to none~ -** Processing line: ~ state.story_line = nil # story line is cleared, set to nil (or empty)~ -** Processing line: ~ end~ +** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Determines fire progress (how close the fire is to being ready to light).~ -** Processing line: ~ def tick_fire~ -** Processing line: ~ return if state.active_module == :alert # return if active module is alert~ -** Processing line: ~ state.fire_progress += 1 # increment fire progress~ -** Processing line: ~ # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value.~ -** Processing line: ~ state.fire_progress = state.fire_progress.lesser(state.fire_ready_in)~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets the value of fire (whether it is dead or roaring), and the story line~ -** Processing line: ~ def light_fire~ -** Processing line: ~ return unless fire_ready? # returns unless the fire is ready to be lit~ -** Processing line: ~ state.fire = :roaring # fire is lit, set to roaring~ -** Processing line: ~ state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit~ -** Processing line: ~ if state.fire != state.previous_fire~ -** Processing line: ~ set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation~ -** Processing line: ~ state.previous_fire = state.fire~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Checks if the fire is ready to be lit. Returns a boolean value.~ -** Processing line: ~ def fire_ready?~ -** Processing line: ~ # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10),~ -** Processing line: ~ # the fire is ready to be lit.~ -** Processing line: ~ state.fire_progress == state.fire_ready_in~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Divides the value of the fire_progress variable by 10 to determine how close the user is to~ -** Processing line: ~ # being able to light a fire.~ -** Processing line: ~ def light_fire_progress~ -** Processing line: ~ state.fire_progress.fdiv(10) # float division~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Defines fire as the state.fire variable.~ -** Processing line: ~ def fire~ -** Processing line: ~ state.fire~ -** Processing line: ~ end~ +** Processing line: ~* Input Basics - Mouse Point To Rect - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Input Basics - Mouse Point To Rect - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Sets the title of the room.~ -** Processing line: ~ def room_title~ -** Processing line: ~ return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead~ -** Processing line: ~ return "a room that is lit" # room is lit if the fire is not dead~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/02_input_basics/03_mouse_point_to_rect/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # Sets the active_module to room.~ -** Processing line: ~ def go_to_room~ -** Processing line: ~ state.active_module = :room~ -** Processing line: ~ end~ +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ # Defines active_module as the state.active_module variable.~ -** Processing line: ~ def active_module~ -** Processing line: ~ state.active_module~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputus.borders: An array. Values in this array will be rendered as~ +** Processing line: ~ unfilled rectangles on the screen.~ +** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ +** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ +** Processing line: ~ or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ # Defines story_line as the state.story_line variable.~ -** Processing line: ~ def story_line~ -** Processing line: ~ state.story_line~ -** Processing line: ~ end~ +** Processing line: ~ ```~ +** Processing line: ~ # Point: x: 100, y: 100~ +** Processing line: ~ # Rect: x: 0, y: 0, w: 500, h: 500~ +** Processing line: ~ # Result: true~ ** Processing line: ~~ -** Processing line: ~ # Update every 60 frames (or every second)~ -** Processing line: ~ def should_tick?~ -** Processing line: ~ state.tick_count.mod_zero?(60)~ -** Processing line: ~ end~ +** Processing line: ~ [100, 100].inside_rect? [0, 0, 500, 500]~ +** Processing line: ~ ```~ ** Processing line: ~~ -** Processing line: ~ # Sets the value of the game state provider.~ -** Processing line: ~ def initialize game_state_provider~ -** Processing line: ~ @game_state_provider = game_state_provider~ -** Processing line: ~ end~ +** Processing line: ~ ```~ +** Processing line: ~ # Point: x: 100, y: 100~ +** Processing line: ~ # Rect: x: 300, y: 300, w: 100, h: 100~ +** Processing line: ~ # Result: false~ ** Processing line: ~~ -** Processing line: ~ # Defines the game state.~ -** Processing line: ~ # Any variable prefixed with an @ symbol is an instance variable.~ -** Processing line: ~ def state~ -** Processing line: ~ @game_state_provider.state~ -** Processing line: ~ end~ +** Processing line: ~ [100, 100].inside_rect? [300, 300, 100, 100]~ +** Processing line: ~ ```~ ** Processing line: ~~ -** Processing line: ~ # Saves the state of the game in a text file called game_state.txt.~ -** Processing line: ~ def save~ -** Processing line: ~ $gtk.serialize_state('game_state.txt', state)~ +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ +** Processing line: ~ - args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed~ +** Processing line: ~ since the click event.~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # To determine whether a point is in a rect~ +** Processing line: ~ # Use point.inside_rect? rect~ +** Processing line: ~~ +** Processing line: ~ # This is useful to determine if a click occurred in a rect~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle."~ +** Processing line: ~~ +** Processing line: ~ x = 460~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->")~ +** Processing line: ~~ +** Processing line: ~ box = [785, 370, 50, 50, 0, 0, 170]~ +** Processing line: ~ args.outputs.borders << box~ +** Processing line: ~~ +** Processing line: ~ # Saves the most recent click into args.state~ +** Processing line: ~ # Unlike the other components of args,~ +** Processing line: ~ # args.state does not reset every tick.~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_mouse_click = args.inputs.mouse.click~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Loads the game state from the game_state.txt text file.~ -** Processing line: ~ # If the load is unsuccessful, the user is informed since the story line indicates the failure.~ -** Processing line: ~ def load~ -** Processing line: ~ parsed_state = $gtk.deserialize_state('game_state.txt')~ -** Processing line: ~ if !parsed_state~ -** Processing line: ~ set_story_line "no game to load. press save first."~ +** Processing line: ~ if args.state.last_mouse_click~ +** Processing line: ~ if args.state.last_mouse_click.point.inside_rect? box~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.")~ ** Processing line: ~ else~ -** Processing line: ~ $gtk.args.state = parsed_state~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.")~ ** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.")~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Resets the game.~ -** Processing line: ~ def reset~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ end~ +** Processing line: ~ def small_label args, x, row, message~ +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class TextedBasedGamePresenter~ -** Processing line: ~ attr_accessor :state, :outputs, :inputs~ +** Processing line: ~ def small_font~ +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Creates empty collection called highlights.~ -** Processing line: ~ # Calls methods necessary to run the game.~ -** Processing line: ~ def tick~ -** Processing line: ~ state.layout.highlights ||= []~ -** Processing line: ~ game.tick if game.should_tick?~ -** Processing line: ~ render~ -** Processing line: ~ process_input~ -** Processing line: ~ end~ +** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs a label of the tick count (passage of time) and calls all render methods.~ -** Processing line: ~ def render~ -** Processing line: ~ outputs.labels << [10, 30, state.tick_count]~ -** Processing line: ~ render_alert~ -** Processing line: ~ render_room~ -** Processing line: ~ render_highlights~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs a label onto the screen that shows the story line, and also outputs a "close" button.~ -** Processing line: ~ def render_alert~ -** Processing line: ~ return unless game.active_module == :alert~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label~ -** Processing line: ~ outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def render_room~ -** Processing line: ~ return unless game.active_module == :room~ -** Processing line: ~ outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen~ ** Processing line: ~~ -** Processing line: ~ # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value~ -** Processing line: ~ # that positions it 60 pixels lower than the previous output.~ +** Processing line: ~* Input Basics - Mouse Rect To Rect - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Input Basics - Mouse Rect To Rect - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance)~ -** Processing line: ~ outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress)~ -** Processing line: ~ outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button~ -** Processing line: ~ outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button~ -** Processing line: ~ outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button~ -** Processing line: ~ outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/02_input_basics/04_mouse_rect_to_rect/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.~ -** Processing line: ~ def render_highlights~ -** Processing line: ~ state.layout.highlights.each do |h| # for each highlight in the collection~ -** Processing line: ~ h.lifetime -= 1 # decrease the value of its lifetime~ -** Processing line: ~ end~ +** Processing line: ~ APIs that haven't been encountered in a previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection~ -** Processing line: ~ [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight~ -** Processing line: ~ # transparency changes; divide lifetime by max_lifetime, multiply result by 255~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.borders: An array. Values in this array will be rendered as~ +** Processing line: ~ unfilled rectangles on the screen.~ +** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ +** Processing line: ~ considered a rect. The intersect_rect? function returns true~ +** Processing line: ~ or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ # reject highlights from collection that have no remaining lifetime~ -** Processing line: ~ state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 }~ -** Processing line: ~ end~ +** Processing line: ~ ```~ +** Processing line: ~ # Rect One: x: 100, y: 100, w: 100, h: 100~ +** Processing line: ~ # Rect Two: x: 0, y: 0, w: 500, h: 500~ +** Processing line: ~ # Result: true~ ** Processing line: ~~ -** Processing line: ~ # Checks whether or not a button was clicked.~ -** Processing line: ~ # Returns a boolean value.~ -** Processing line: ~ def process_input~ -** Processing line: ~ button = button_clicked? # calls button_clicked? method~ -** Processing line: ~ end~ +** Processing line: ~ [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500]~ +** Processing line: ~ ```~ ** Processing line: ~~ -** Processing line: ~ # Returns a boolean value.~ -** Processing line: ~ # Finds the button that was clicked from the button list and determines what method to call.~ -** Processing line: ~ # Adds a highlight to the highlights collection.~ -** Processing line: ~ def button_clicked?~ -** Processing line: ~ return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click~ -** Processing line: ~ button = @button_list.find do |k, v| # goes through button_list to find button clicked~ -** Processing line: ~ click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button?~ -** Processing line: ~ end~ -** Processing line: ~ return unless button # return unless a button was clicked~ -** Processing line: ~ method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game)~ -** Processing line: ~ if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists)~ -** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in button list hash~ -** Processing line: ~~ -** Processing line: ~ # declares each highlight as a new entity, sets properties~ -** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ -** Processing line: ~ h.x = border.x~ -** Processing line: ~ h.y = border.y~ -** Processing line: ~ h.w = border.w~ -** Processing line: ~ h.h = border.h~ -** Processing line: ~ h.max_lifetime = 10~ -** Processing line: ~ h.lifetime = h.max_lifetime~ -** Processing line: ~ h.color = [120, 120, 180] # sets color to shade of purple~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ self.send method_to_call # invoke method identified by symbol~ -** Processing line: ~ else # otherwise, if self doesn't respond to given method~ -** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in hash~ -** Processing line: ~~ -** Processing line: ~ # declares each highlight as a new entity, sets properties~ -** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ -** Processing line: ~ h.x = border.x~ -** Processing line: ~ h.y = border.y~ -** Processing line: ~ h.w = border.w~ -** Processing line: ~ h.h = border.h~ -** Processing line: ~ h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true~ -** Processing line: ~ h.lifetime = h.max_lifetime~ -** Processing line: ~ h.color = [120, 80, 80] # sets color to dark color~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # instructions for users on how to add the missing method_to_call to the code~ -** Processing line: ~ puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:"~ -** Processing line: ~ puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition."~ -** Processing line: ~ puts ""~ -** Processing line: ~ puts "```"~ -** Processing line: ~ puts "class TextedBasedGamePresenter <--- find this class and put the method below in it"~ -** Processing line: ~ puts ""~ -** Processing line: ~ puts " def #{method_to_call}"~ -** Processing line: ~ puts " puts 'Yay that worked!'"~ -** Processing line: ~ puts " end"~ -** Processing line: ~ puts ""~ -** Processing line: ~ puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement."~ -** Processing line: ~ puts "```"~ -** Processing line: ~ puts ""~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ ```~ +** Processing line: ~ # Rect One: x: 100, y: 100, w: 10, h: 10~ +** Processing line: ~ # Rect Two: x: 500, y: 500, w: 10, h: 10~ +** Processing line: ~ # Result: false~ ** Processing line: ~~ -** Processing line: ~ # Returns the position of the mouse when it is clicked.~ -** Processing line: ~ def click_pos~ -** Processing line: ~ return nil unless inputs.mouse.click # returns nil unless the mouse was clicked~ -** Processing line: ~ return inputs.mouse.click.point # returns location of mouse click (coordinates)~ -** Processing line: ~ end~ +** Processing line: ~ [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10]~ +** Processing line: ~ ```~ ** Processing line: ~~ -** Processing line: ~ # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)~ -** Processing line: ~ def button id, x, y, text~ -** Processing line: ~ @button_list[id] ||= { # assigns values to hash keys~ -** Processing line: ~ id: id,~ -** Processing line: ~ text: text,~ -** Processing line: ~ primitives: [~ -** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # positions label inside border~ -** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ @button_list[id][:primitives] # returns label and border for buttons~ -** Processing line: ~ end~ +** Processing line: ~ # Similarly, whether rects intersect can be found through~ +** Processing line: ~ # rect1.intersect_rect? rect2~ ** Processing line: ~~ -** Processing line: ~ # Creates a progress bar (used for lighting the fire) and sets its values.~ -** Processing line: ~ def progress_bar id, x, y, text, percentage~ -** Processing line: ~ @button_list[id] = { # assigns values to hash keys~ -** Processing line: ~ id: id,~ -** Processing line: ~ text: text,~ -** Processing line: ~ primitives: [~ -** Processing line: ~ [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray)~ -** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border~ -** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to determine if two rectangles intersect."~ +** Processing line: ~ x = 460~ ** Processing line: ~~ -** Processing line: ~ # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by~ -** Processing line: ~ # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in.~ -** Processing line: ~ @button_list[id][:primitives][0][2] = 300 * percentage~ -** Processing line: ~ @button_list[id][:primitives]~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen")~ +** Processing line: ~ # red_box = [460, 250, 355, 90, 170, 0, 0]~ +** Processing line: ~ # args.outputs.borders << red_box~ ** Processing line: ~~ -** Processing line: ~ # Defines the game.~ -** Processing line: ~ def game~ -** Processing line: ~ @game~ +** Processing line: ~ # args.state.box_collision_one and args.state.box_collision_two~ +** Processing line: ~ # Are given values of a solid when they should be rendered~ +** Processing line: ~ # They are stored in game so that they do not get reset every tick~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ if !args.state.box_collision_one~ +** Processing line: ~ args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180]~ +** Processing line: ~ elsif !args.state.box_collision_two~ +** Processing line: ~ args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180]~ +** Processing line: ~ else~ +** Processing line: ~ args.state.box_collision_one = nil~ +** Processing line: ~ args.state.box_collision_two = nil~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Initalizes the game and creates an empty list of buttons.~ -** Processing line: ~ def initialize~ -** Processing line: ~ @game = TextedBasedGame.new self~ -** Processing line: ~ @button_list ||= {}~ +** Processing line: ~ if args.state.box_collision_one~ +** Processing line: ~ args.outputs.solids << args.state.box_collision_one~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Clears the storyline and takes the user to the room.~ -** Processing line: ~ def alert_dismiss_clicked~ -** Processing line: ~ game.clear_storyline~ -** Processing line: ~ game.go_to_room~ +** Processing line: ~ if args.state.box_collision_two~ +** Processing line: ~ args.outputs.solids << args.state.box_collision_two~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Lights the fire when the user clicks the "light fire" option.~ -** Processing line: ~ def light_fire_clicked~ -** Processing line: ~ game.light_fire~ +** Processing line: ~ if args.state.box_collision_one && args.state.box_collision_two~ +** Processing line: ~ if args.state.box_collision_one.intersect_rect? args.state.box_collision_two~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.')~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.')~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.labels << small_label(args, x, 4, '--')~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Saves the game when the user clicks the "save" option.~ -** Processing line: ~ def save_game_clicked~ -** Processing line: ~ game.save~ -** Processing line: ~ end~ +** Processing line: ~ def small_label args, x, row, message~ +** Processing line: ~ [x, row_to_px(args, row), message, small_font]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Resets the game when the user clicks the "reset" option.~ -** Processing line: ~ def reset_game_clicked~ -** Processing line: ~ game.reset~ -** Processing line: ~ end~ +** Processing line: ~ def small_font~ +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Loads the game when the user clicks the "load" option.~ -** Processing line: ~ def load_game_clicked~ -** Processing line: ~ game.load~ -** Processing line: ~ end~ +** Processing line: ~ def row_to_px args, row_number~ +** Processing line: ~ args.grid.top.shift_down(5).shift_down(20 * row_number)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $text_based_rpg = TextedBasedGamePresenter.new~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $text_based_rpg.state = args.state~ -** Processing line: ~ $text_based_rpg.outputs = args.outputs~ -** Processing line: ~ $text_based_rpg.inputs = args.inputs~ -** Processing line: ~ $text_based_rpg.tick~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 07_advanced_rendering/01_simple_render_targets/app/main.rb~ +** Processing line: ~* Input Basics - Controller - main.rb~ - H1 detected. -- Formatting line: ~07_advanced_rendering/01_simple_render_targets/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Input Basics - Controller - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # args.outputs.render_targets are really really powerful.~ -** Processing line: ~ # They essentially allow you to create a sprite programmatically and cache the result.~ +** Processing line: ~ # ./samples/02_input_basics/05_controller/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # Create a render_target of a :block and a :gradient on tick zero.~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.render_target(:block).solids << [0, 0, 1280, 100]~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ # The gradient is actually just a collection of black solids with increasing~ -** Processing line: ~ # opacities.~ -** Processing line: ~ args.render_target(:gradient).solids << 90.map_with_index do |x|~ -** Processing line: ~ 50.map_with_index do |y|~ -** Processing line: ~ [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255]~ +** Processing line: ~ - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key~ +** Processing line: ~ is being held down on the controller.~ +** Processing line: ~ If there is more than one controller being used, they can be differentiated by~ +** Processing line: ~ using names like controller_one and controller_two.~ +** Processing line: ~~ +** Processing line: ~ For a full listing of buttons, take a look at mygame/documentation/08-controllers.md.~ +** Processing line: ~~ +** Processing line: ~ Reminder:~ +** Processing line: ~~ +** Processing line: ~ - args.state.PROPERTY: The state property on args is a dynamic~ +** Processing line: ~ structure. You can define ANY property here with ANY type of~ +** Processing line: ~ arbitrary nesting. Properties defined on args.state will be retained~ +** Processing line: ~ across frames. If you attempt to access a property that doesn't exist~ +** Processing line: ~ on args.state, it will simply return nil (no exception will be thrown).~ +** Processing line: ~~ +** Processing line: ~ In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller.~ +** Processing line: ~ The parameters of a button are:~ +** Processing line: ~ 1. the position (x, y)~ +** Processing line: ~ 2. the input key held on the controller~ +** Processing line: ~ 3. the text or name of the button~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This sample app provides a visual demonstration of a standard controller, including~ +** Processing line: ~ # the placement and function of all buttons.~ +** Processing line: ~~ +** Processing line: ~ class ControllerDemo~ +** Processing line: ~ attr_accessor :inputs, :state, :outputs~ +** Processing line: ~~ +** Processing line: ~ # Calls the methods necessary for the app to run successfully.~ +** Processing line: ~ def tick~ +** Processing line: ~ process_inputs~ +** Processing line: ~ render~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Starts with an empty collection of buttons.~ +** Processing line: ~ # Adds buttons that are on the controller to the collection.~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ state.buttons = []~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"]~ +** Processing line: ~ state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"]~ +** Processing line: ~ state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"]~ +** Processing line: ~ state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"]~ +** Processing line: ~ state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"]~ +** Processing line: ~ state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"]~ +** Processing line: ~ state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"]~ +** Processing line: ~ state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"]~ +** Processing line: ~ state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"]~ +** Processing line: ~ state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100,~ +** Processing line: ~ 100 + inputs.controller_one.left_analog_y_perc * 100,~ +** Processing line: ~ inputs.controller_one.key_held.l3,~ +** Processing line: ~ "L3"]~ +** Processing line: ~~ +** Processing line: ~ state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100,~ +** Processing line: ~ 100 + inputs.controller_one.right_analog_y_perc * 100,~ +** Processing line: ~ inputs.controller_one.key_held.r3,~ +** Processing line: ~ "R3"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Gives each button a square shape.~ +** Processing line: ~ # If the button is being pressed or held (which means it is considered active),~ +** Processing line: ~ # the square is filled in. Otherwise, the button simply has a border.~ +** Processing line: ~ def render~ +** Processing line: ~ state.buttons.each do |x, y, active, text|~ +** Processing line: ~ rect = [x, y, 75, 75]~ +** Processing line: ~~ +** Processing line: ~ if active # if button is pressed~ +** Processing line: ~ outputs.solids << rect # rect is output as solid (filled in)~ +** Processing line: ~ else~ +** Processing line: ~ outputs.borders << rect # otherwise, output as border~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Outputs the text of each button using labels.~ +** Processing line: ~ outputs.labels << [x, y + 95, text] # add 95 to place label above button~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"]~ +** Processing line: ~ outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"]~ +** Processing line: ~ outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"]~ +** Processing line: ~ outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"]~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Take the :block render_target and present it horizontally centered.~ -** Processing line: ~ # Use a subsection of the render_targetd specified by source_x,~ -** Processing line: ~ # source_y, source_w, source_h.~ -** Processing line: ~ args.outputs.sprites << { x: 0,~ -** Processing line: ~ y: 310,~ -** Processing line: ~ w: 1280,~ -** Processing line: ~ h: 100,~ -** Processing line: ~ path: :block,~ -** Processing line: ~ source_x: 0,~ -** Processing line: ~ source_y: 0,~ -** Processing line: ~ source_w: 1280,~ -** Processing line: ~ source_h: 100 }~ +** Processing line: ~ $controller_demo = ControllerDemo.new~ ** Processing line: ~~ -** Processing line: ~ # After rendering :block, render gradient on top of :block.~ -** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :gradient]~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller."~ +** Processing line: ~ $controller_demo.inputs = args.inputs~ +** Processing line: ~ $controller_demo.state = args.state~ +** Processing line: ~ $controller_demo.outputs = args.outputs~ +** Processing line: ~ $controller_demo.tick~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255]~ -** Processing line: ~ tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)."~ +** Processing line: ~ # Resets the app.~ +** Processing line: ~ def r~ +** Processing line: ~ $gtk.reset~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -105665,100 +114388,137 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 07_advanced_rendering/02_render_targets_with_alphas/app/main.rb~ +** Processing line: ~* Rendering Sprites - Animation Using Separate Pngs - main.rb~ - H1 detected. -- Formatting line: ~07_advanced_rendering/02_render_targets_with_alphas/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Sprites - Animation Using Separate Pngs - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # This sample is meant to show you how to do that dripping transition thing~ -** Processing line: ~ # at the start of the original Doom. Most of this file is here to animate~ -** Processing line: ~ # a scene to wipe away; the actual wipe effect is in the last 20 lines or~ -** Processing line: ~ # so.~ +** Processing line: ~ # ./samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ $gtk.reset # reset all game state if reloaded.~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance~ -** Processing line: ~ numblocks = 10~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ for i in 1..numblocks do~ -** Processing line: ~ angle = ((360 / numblocks) * i) + angleoffset~ -** Processing line: ~ radians = angle * (Math::PI / 180)~ -** Processing line: ~ x = (xoffset + (distance * Math.cos(radians))).round~ -** Processing line: ~ y = (yoffset + (distance * Math.sin(radians))).round~ -** Processing line: ~ pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ In this sample app, we're using string interpolation to iterate through images in the~ +** Processing line: ~ sprites folder using their image path names.~ ** Processing line: ~~ -** Processing line: ~ def draw_scene args, pass~ -** Processing line: ~ pass.solids << [0, 360, 1280, 360, 0, 0, 200]~ -** Processing line: ~ pass.solids << [0, 0, 1280, 360, 0, 127, 0]~ +** Processing line: ~ - args.outputs.sprites: An array. Values in this array generate sprites on the screen.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ ** Processing line: ~~ -** Processing line: ~ blocksize = 100~ -** Processing line: ~ angleoffset = args.state.tick_count * 2.5~ -** Processing line: ~ centerx = (1280 - blocksize) / 2~ -** Processing line: ~ centery = (720 - blocksize) / 2~ +** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500~ -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325~ -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200~ -** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed.~ +** Processing line: ~ Stores the frame that key was pressed on.~ +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This sample app demonstrates how sprite animations work.~ +** Processing line: ~ # There are two sprites that animate forever and one sprite~ +** Processing line: ~ # that *only* animates when you press the "f" key on the keyboard.~ ** Processing line: ~~ +** Processing line: ~ # This is the entry point to your game. The `tick` method~ +** Processing line: ~ # executes at 60 frames per second. There are two methods~ +** Processing line: ~ # in this tick "entry point": `looping_animation`, and the~ +** Processing line: ~ # second method is `one_time_animation`.~ ** Processing line: ~ def tick args~ -** Processing line: ~ segments = 160~ +** Processing line: ~ looping_animation args~ +** Processing line: ~ one_time_animation args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # On the first tick, initialize some stuff.~ -** Processing line: ~ if !args.state.yoffsets~ -** Processing line: ~ args.state.baseyoff = 0~ -** Processing line: ~ args.state.yoffsets = []~ -** Processing line: ~ for i in 0..segments do~ -** Processing line: ~ args.state.yoffsets << rand * 100~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # This function shows how to animate a sprite that loops forever.~ +** Processing line: ~ def looping_animation args~ +** Processing line: ~ # Here we define a few local variables that will be sent~ +** Processing line: ~ # into the magic function that gives us the correct sprite image~ +** Processing line: ~ # over time. There are four things we need in order to figure~ +** Processing line: ~ # out which sprite to show.~ ** Processing line: ~~ -** Processing line: ~ # Just draw some random stuff for a few seconds.~ -** Processing line: ~ args.state.static_debounce ||= 60 * 2.5~ -** Processing line: ~ if args.state.static_debounce > 0~ -** Processing line: ~ last_frame = args.state.static_debounce == 1~ -** Processing line: ~ target = last_frame ? args.render_target(:last_frame) : args.outputs~ -** Processing line: ~ draw_scene args, target~ -** Processing line: ~ args.state.static_debounce -= 1~ -** Processing line: ~ return unless last_frame~ -** Processing line: ~ end~ +** Processing line: ~ # 1. When to start the animation.~ +** Processing line: ~ start_looping_at = 0~ ** Processing line: ~~ -** Processing line: ~ # build up the wipe...~ +** Processing line: ~ # 2. The number of pngs that represent the full animation.~ +** Processing line: ~ number_of_sprites = 6~ ** Processing line: ~~ -** Processing line: ~ # this is the thing we're wiping to.~ -** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ]~ +** Processing line: ~ # 3. How long to show each png.~ +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ ** Processing line: ~~ -** Processing line: ~ return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding~ +** Processing line: ~ # 4. Whether the animation should loop once, or forever.~ +** Processing line: ~ does_sprite_loop = true~ ** Processing line: ~~ -** Processing line: ~ segmentw = 1280 / segments~ +** Processing line: ~ # With the variables defined above, we can get a number~ +** Processing line: ~ # which represents the sprite to show by calling the `frame_index` function.~ +** Processing line: ~ # In this case the number will be between 0, and 5 (you can see the sprites~ +** Processing line: ~ # in the ./sprites directory).~ +** Processing line: ~ sprite_index = start_looping_at.frame_index number_of_sprites,~ +** Processing line: ~ number_of_frames_to_show_each_sprite,~ +** Processing line: ~ does_sprite_loop~ ** Processing line: ~~ -** Processing line: ~ x = 0~ -** Processing line: ~ for i in 0..segments do~ -** Processing line: ~ yoffset = 0~ -** Processing line: ~ if args.state.yoffsets[i] < args.state.baseyoff~ -** Processing line: ~ yoffset = args.state.baseyoff - args.state.yoffsets[i]~ -** Processing line: ~ end~ +** Processing line: ~ # Now that we have `sprite_index, we can present the correct file.~ +** Processing line: ~ args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ ** Processing line: ~~ -** Processing line: ~ # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment.~ -** Processing line: ~ args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ]~ -** Processing line: ~ x += segmentw~ +** Processing line: ~ # Try changing the numbers below to see how the animation changes:~ +** Processing line: ~ args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # This function shows how to animate a sprite that executes~ +** Processing line: ~ # only once when the "f" key is pressed.~ +** Processing line: ~ def one_time_animation args~ +** Processing line: ~ # This is just a label the shows instructions within the game.~ +** Processing line: ~ args.outputs.labels << [220, 350, "(press f to animate)"]~ +** Processing line: ~~ +** Processing line: ~ # If "f" is pressed on the keyboard...~ +** Processing line: ~ if args.inputs.keyboard.key_down.f~ +** Processing line: ~ # Print the frame that "f" was pressed on.~ +** Processing line: ~ puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}"~ +** Processing line: ~~ +** Processing line: ~ # And MOST IMPORTANTLY set the point it time to start the animation,~ +** Processing line: ~ # equal to "now" which is represented as args.state.tick_count.~ +** Processing line: ~~ +** Processing line: ~ # Also IMPORTANT, you'll notice that the value of when to start looping~ +** Processing line: ~ # is stored in `args.state`. This construct's values are retained across~ +** Processing line: ~ # executions of the `tick` method.~ +** Processing line: ~ args.state.start_looping_at = args.state.tick_count~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.baseyoff += 4~ +** Processing line: ~ # These are the same local variables that were defined~ +** Processing line: ~ # for the `looping_animation` function.~ +** Processing line: ~ number_of_sprites = 6~ +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ ** Processing line: ~~ -** Processing line: ~ tick_instructions args, "Sample app shows an advanced usage of render_target."~ +** Processing line: ~ # Except this sprite does not loop again. If the animation time has passed,~ +** Processing line: ~ # then the frame_index function returns nil.~ +** Processing line: ~ does_sprite_loop = false~ +** Processing line: ~~ +** Processing line: ~ sprite_index = args.state~ +** Processing line: ~ .start_looping_at~ +** Processing line: ~ .frame_index number_of_sprites,~ +** Processing line: ~ number_of_frames_to_show_each_sprite,~ +** Processing line: ~ does_sprite_loop~ +** Processing line: ~~ +** Processing line: ~ # This line sets the frame index to zero, if~ +** Processing line: ~ # the animation duration has passed (frame_index returned nil).~ +** Processing line: ~~ +** Processing line: ~ # Remeber: we are not looping forever here.~ +** Processing line: ~ sprite_index ||= 0~ +** Processing line: ~~ +** Processing line: ~ # Present the sprite.~ +** Processing line: ~ args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"]~ +** Processing line: ~~ +** Processing line: ~ tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time."~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def tick_instructions args, text, y = 715~ @@ -105779,683 +114539,699 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 07_advanced_rendering/03_render_target_viewports/app/main.rb~ +** Processing line: ~* Rendering Sprites - Animation Using Sprite Sheet - main.rb~ - H1 detected. -- Formatting line: ~07_advanced_rendering/03_render_target_viewports/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Sprites - Animation Using Sprite Sheet - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~ # ./samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.player.x ||= 100~ +** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ args.state.player.w ||= 64~ +** Processing line: ~ args.state.player.h ||= 64~ +** Processing line: ~ args.state.player.direction ||= 1~ ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ -** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ -** Processing line: ~ be retained across frames.)~ +** Processing line: ~ args.state.player.is_moving = false~ ** Processing line: ~~ -** Processing line: ~ If you have a solar system and you're creating args.state.sun and setting its image path to an~ -** Processing line: ~ image in the sprites folder, you would do the following:~ -** Processing line: ~ (See samples/99_sample_nddnug_workshop for more details.)~ +** Processing line: ~ # get the keyboard input and set player properties~ +** Processing line: ~ if args.inputs.keyboard.right~ +** Processing line: ~ args.state.player.x += 3~ +** Processing line: ~ args.state.player.direction = 1~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ elsif args.inputs.keyboard.left~ +** Processing line: ~ args.state.player.x -= 3~ +** Processing line: ~ args.state.player.direction = -1~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ -** Processing line: ~ s.path = 'sprites/sun.png'~ -** Processing line: ~ end~ +** Processing line: ~ if args.inputs.keyboard.up~ +** Processing line: ~ args.state.player.y += 1~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ elsif args.inputs.keyboard.down~ +** Processing line: ~ args.state.player.y -= 1~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~ # if no arrow keys are being pressed, set the player as not moving~ +** Processing line: ~ if !args.inputs.keyboard.directional_vector~ +** Processing line: ~ args.state.player.started_running_at = nil~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ For example, if we have a variable~ -** Processing line: ~ name = "Ruby"~ -** Processing line: ~ then the line~ -** Processing line: ~ puts "How are you, #{name}?"~ -** Processing line: ~ would print "How are you, Ruby?" to the console.~ -** Processing line: ~ (Remember, string interpolation only works with double quotes!)~ +** Processing line: ~ # wrap player around the stage~ +** Processing line: ~ if args.state.player.x > 1280~ +** Processing line: ~ args.state.player.x = -64~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ elsif args.state.player.x < -64~ +** Processing line: ~ args.state.player.x = 1280~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - Ternary operator (?): Similar to if statement; first evalulates whether a statement is~ -** Processing line: ~ true or false, and then executes a command depending on that result.~ -** Processing line: ~ For example, if we had a variable~ -** Processing line: ~ grade = 75~ -** Processing line: ~ and used the ternary operator in the command~ -** Processing line: ~ pass_or_fail = grade > 65 ? "pass" : "fail"~ -** Processing line: ~ then the value of pass_or_fail would be "pass" since grade's value was greater than 65.~ +** Processing line: ~ if args.state.player.y > 720~ +** Processing line: ~ args.state.player.y = -64~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ elsif args.state.player.y < -64~ +** Processing line: ~ args.state.player.y = 720~ +** Processing line: ~ args.state.player.started_running_at ||= args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ # render player as standing or running~ +** Processing line: ~ if args.state.player.started_running_at~ +** Processing line: ~ args.outputs.sprites << running_sprite(args)~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.sprites << standing_sprite(args)~ +** Processing line: ~ end~ +** Processing line: ~ args.outputs.labels << [30, 700, "Use arrow keys to move around."]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ -** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ +** Processing line: ~ def standing_sprite args~ +** Processing line: ~ {~ +** Processing line: ~ x: args.state.player.x,~ +** Processing line: ~ y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.w,~ +** Processing line: ~ h: args.state.player.h,~ +** Processing line: ~ path: "sprites/horizontal-stand.png",~ +** Processing line: ~ flip_horizontally: args.state.player.direction > 0~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ -** Processing line: ~ by adding or subracting.~ +** Processing line: ~ def running_sprite args~ +** Processing line: ~ if !args.state.player.started_running_at~ +** Processing line: ~ tile_index = 0~ +** Processing line: ~ else~ +** Processing line: ~ how_many_frames_in_sprite_sheet = 6~ +** Processing line: ~ how_many_ticks_to_hold_each_frame = 3~ +** Processing line: ~ should_the_index_repeat = true~ +** Processing line: ~ tile_index = args.state~ +** Processing line: ~ .player~ +** Processing line: ~ .started_running_at~ +** Processing line: ~ .frame_index(how_many_frames_in_sprite_sheet,~ +** Processing line: ~ how_many_ticks_to_hold_each_frame,~ +** Processing line: ~ should_the_index_repeat)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ -** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ -** Processing line: ~ or false depending on if the point is inside the rect.~ +** Processing line: ~ {~ +** Processing line: ~ x: args.state.player.x,~ +** Processing line: ~ y: args.state.player.y,~ +** Processing line: ~ w: args.state.player.w,~ +** Processing line: ~ h: args.state.player.h,~ +** Processing line: ~ path: 'sprites/horizontal-run.png',~ +** Processing line: ~ tile_x: 0 + (tile_index * args.state.player.w),~ +** Processing line: ~ tile_y: 0,~ +** Processing line: ~ tile_w: args.state.player.w,~ +** Processing line: ~ tile_h: args.state.player.h,~ +** Processing line: ~ flip_horizontally: args.state.player.direction > 0,~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ -** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ ** Processing line: ~~ -** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ -** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ -** Processing line: ~ to args.state.tick_count).~ -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~* Rendering Sprites - Animation States - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Sprites - Animation States - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ - args.state.labels:~ -** Processing line: ~ The parameters for a label are~ -** Processing line: ~ 1. the position (x, y)~ -** Processing line: ~ 2. the text~ -** Processing line: ~ 3. the size~ -** Processing line: ~ 4. the alignment~ -** Processing line: ~ 5. the color (red, green, and blue saturations)~ -** Processing line: ~ 6. the alpha (or transparency)~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/03_rendering_sprites/03_animation_states/app/main.rb~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_gtk~ ** Processing line: ~~ -** Processing line: ~ - args.state.lines:~ -** Processing line: ~ The parameters for a line are~ -** Processing line: ~ 1. the starting position (x, y)~ -** Processing line: ~ 2. the ending position (x2, y2)~ -** Processing line: ~ 3. the color (red, green, and blue saturations)~ -** Processing line: ~ 4. the alpha (or transparency)~ -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.show_debug_layer = true if state.tick_count == 0~ +** Processing line: ~ player.tile_size = 64~ +** Processing line: ~ player.speed = 3~ +** Processing line: ~ player.slash_frames = 15~ +** Processing line: ~ player.x ||= 50~ +** Processing line: ~ player.y ||= 400~ +** Processing line: ~ player.dir_x ||= 1~ +** Processing line: ~ player.dir_y ||= -1~ +** Processing line: ~ player.is_moving ||= false~ +** Processing line: ~ state.watch_list ||= {}~ +** Processing line: ~ state.enemies ||= []~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.state.solids (and args.state.borders):~ -** Processing line: ~ The parameters for a solid (or border) are~ -** Processing line: ~ 1. the position (x, y)~ -** Processing line: ~ 2. the width (w)~ -** Processing line: ~ 3. the height (h)~ -** Processing line: ~ 4. the color (r, g, b)~ -** Processing line: ~ 5. the alpha (or transparency)~ -** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ def add_enemy~ +** Processing line: ~ state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ - args.state.sprites:~ -** Processing line: ~ The parameters for a sprite are~ -** Processing line: ~ 1. the position (x, y)~ -** Processing line: ~ 2. the width (w)~ -** Processing line: ~ 3. the height (h)~ -** Processing line: ~ 4. the image path~ -** Processing line: ~ 5. the angle~ -** Processing line: ~ 6. the alpha (or transparency)~ -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ -** Processing line: ~ =end~ +** Processing line: ~ def sprite_horizontal_run~ +** Processing line: ~ tile_index = 0.frame_index(6, 3, true)~ +** Processing line: ~ tile_index = 0 if !player.is_moving~ ** Processing line: ~~ -** Processing line: ~ # This sample app shows different objects that can be used when making games, such as labels,~ -** Processing line: ~ # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used.~ +** Processing line: ~ {~ +** Processing line: ~ x: player.x,~ +** Processing line: ~ y: player.y,~ +** Processing line: ~ w: player.tile_size,~ +** Processing line: ~ h: player.tile_size,~ +** Processing line: ~ path: 'sprites/horizontal-run.png',~ +** Processing line: ~ tile_x: 0 + (tile_index * player.tile_size),~ +** Processing line: ~ tile_y: 0,~ +** Processing line: ~ tile_w: player.tile_size,~ +** Processing line: ~ tile_h: player.tile_size,~ +** Processing line: ~ flip_horizontally: player.dir_x > 0,~ +** Processing line: ~ # a: 40~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Also note that state.tick_count refers to the passage of time, or current frame.~ +** Processing line: ~ def sprite_horizontal_stand~ +** Processing line: ~ {~ +** Processing line: ~ x: player.x,~ +** Processing line: ~ y: player.y,~ +** Processing line: ~ w: player.tile_size,~ +** Processing line: ~ h: player.tile_size,~ +** Processing line: ~ path: 'sprites/horizontal-stand.png',~ +** Processing line: ~ flip_horizontally: player.dir_x > 0,~ +** Processing line: ~ # a: 40~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class TechDemo~ -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ +** Processing line: ~ def sprite_horizontal_slash~ +** Processing line: ~ tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0~ ** Processing line: ~~ -** Processing line: ~ # Calls all methods necessary for the app to run properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ labels_tech_demo~ -** Processing line: ~ lines_tech_demo~ -** Processing line: ~ solids_tech_demo~ -** Processing line: ~ borders_tech_demo~ -** Processing line: ~ sprites_tech_demo~ -** Processing line: ~ keyboards_tech_demo~ -** Processing line: ~ controller_tech_demo~ -** Processing line: ~ mouse_tech_demo~ -** Processing line: ~ point_to_rect_tech_demo~ -** Processing line: ~ rect_to_rect_tech_demo~ -** Processing line: ~ button_tech_demo~ -** Processing line: ~ export_game_state_demo~ -** Processing line: ~ window_state_demo~ -** Processing line: ~ render_seperators~ +** Processing line: ~ {~ +** Processing line: ~ x: player.x - 41.25,~ +** Processing line: ~ y: player.y - 41.25,~ +** Processing line: ~ w: 165,~ +** Processing line: ~ h: 165,~ +** Processing line: ~ path: 'sprites/horizontal-slash.png',~ +** Processing line: ~ tile_x: 0 + (tile_index * 128),~ +** Processing line: ~ tile_y: 0,~ +** Processing line: ~ tile_w: 128,~ +** Processing line: ~ tile_h: 128,~ +** Processing line: ~ flip_horizontally: player.dir_x > 0~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows output of different kinds of labels on the screen~ -** Processing line: ~ def labels_tech_demo~ -** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."]~ -** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ -** Processing line: ~ outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"]~ -** Processing line: ~ outputs.labels << [ 5, 660, "Smaller label.", -2]~ -** Processing line: ~ outputs.labels << [ 5, 630, "Small label.", -1]~ -** Processing line: ~ outputs.labels << [ 5, 600, "Medium label.", 0]~ -** Processing line: ~ outputs.labels << [ 5, 570, "Large label.", 1]~ -** Processing line: ~ outputs.labels << [ 5, 540, "Larger label.", 2]~ -** Processing line: ~ outputs.labels << [300, 660, "Left aligned.", 0, 2]~ -** Processing line: ~ outputs.labels << [300, 640, "Center aligned.", 0, 1]~ -** Processing line: ~ outputs.labels << [300, 620, "Right aligned.", 0, 0]~ -** Processing line: ~ outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0]~ -** Processing line: ~ outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0]~ -** Processing line: ~ outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255]~ -** Processing line: ~ outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128]~ +** Processing line: ~ def render_player~ +** Processing line: ~ if player.slash_at~ +** Processing line: ~ outputs.sprites << sprite_horizontal_slash~ +** Processing line: ~ elsif player.is_moving~ +** Processing line: ~ outputs.sprites << sprite_horizontal_run~ +** Processing line: ~ else~ +** Processing line: ~ outputs.sprites << sprite_horizontal_stand~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows output of lines on the screen~ -** Processing line: ~ def lines_tech_demo~ -** Processing line: ~ outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"]~ -** Processing line: ~ outputs.lines << [5, 450, 100, 450]~ -** Processing line: ~ outputs.lines << [5, 430, 300, 430]~ -** Processing line: ~ outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes~ -** Processing line: ~ outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes~ -** Processing line: ~ outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes~ +** Processing line: ~ def render_enemies~ +** Processing line: ~ outputs.borders << state.enemies~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows output of different kinds of solids on the screen~ -** Processing line: ~ def solids_tech_demo~ -** Processing line: ~ outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"]~ -** Processing line: ~ outputs.solids << [ 10, 270, 50, 50]~ -** Processing line: ~ outputs.solids << [ 70, 270, 50, 50, 0, 0, 0]~ -** Processing line: ~ outputs.solids << [130, 270, 50, 50, 255, 0, 0]~ -** Processing line: ~ outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128]~ -** Processing line: ~ outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ -** Processing line: ~ end~ +** Processing line: ~ def render_debug_layer~ +** Processing line: ~ return if !state.show_debug_layer~ +** Processing line: ~ outputs.labels << state.watch_list.map.with_index do |(k, v), i|~ +** Processing line: ~ [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows output of different kinds of borders on the screen~ -** Processing line: ~ # The parameters for a border are the same as the parameters for a solid~ -** Processing line: ~ def borders_tech_demo~ -** Processing line: ~ outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"]~ -** Processing line: ~ outputs.borders << [ 10, 180, 50, 50]~ -** Processing line: ~ outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]~ -** Processing line: ~ outputs.borders << [130, 180, 50, 50, 255, 0, 0]~ -** Processing line: ~ outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]~ -** Processing line: ~ outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ +** Processing line: ~ outputs.borders << player.slash_collision_rect~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows output of different kinds of sprites on the screen~ -** Processing line: ~ def sprites_tech_demo~ -** Processing line: ~ outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"]~ -** Processing line: ~ outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']~ -** Processing line: ~ outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes~ -** Processing line: ~ outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes~ +** Processing line: ~ def slash_initiate?~ +** Processing line: ~ # buffalo usb controller has a button and b button swapped lol~ +** Processing line: ~ inputs.controller_one.key_down.a || inputs.keyboard.key_down.j~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Holds size, alignment, color (black), and alpha (transparency) parameters~ -** Processing line: ~ # Using small_font as a parameter accounts for all remaining parameters~ -** Processing line: ~ # so they don't have to be repeatedly typed~ -** Processing line: ~ def small_font~ -** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ def input~ +** Processing line: ~ # player movement~ +** Processing line: ~ if slash_complete? && (vector = inputs.directional_vector)~ +** Processing line: ~ player.x += vector.x * player.speed~ +** Processing line: ~ player.y += vector.y * player.speed~ +** Processing line: ~ end~ +** Processing line: ~ player.slash_at = slash_initiate? if slash_initiate?~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets position of each row~ -** Processing line: ~ # Converts given row value to pixels that DragonRuby understands~ -** Processing line: ~ def row_to_px row_number~ -** Processing line: ~~ -** Processing line: ~ # Row 0 starts 5 units below the top of the grid.~ -** Processing line: ~ # Each row afterward is 20 units lower.~ -** Processing line: ~ grid.top.shift_down(5).shift_down(20 * row_number)~ +** Processing line: ~ def calc_movement~ +** Processing line: ~ # movement~ +** Processing line: ~ if vector = inputs.directional_vector~ +** Processing line: ~ state.debug_label = vector~ +** Processing line: ~ player.dir_x = vector.x~ +** Processing line: ~ player.dir_y = vector.y~ +** Processing line: ~ player.is_moving = true~ +** Processing line: ~ else~ +** Processing line: ~ state.debug_label = vector~ +** Processing line: ~ player.is_moving = false~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses labels to output current game time (passage of time), and whether or not "h" was pressed~ -** Processing line: ~ # If "h" is pressed, the frame is output when the key_up event occurred~ -** Processing line: ~ def keyboards_tech_demo~ -** Processing line: ~ outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font]~ -** Processing line: ~ outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font]~ -** Processing line: ~ outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font]~ -** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_up.h # if "h" key_up event occurs~ -** Processing line: ~ state.h_pressed_at = state.tick_count # frame it occurred is stored~ +** Processing line: ~ def calc_slash~ +** Processing line: ~ # re-calc the location of the swords collision box~ +** Processing line: ~ if player.dir_x.positive?~ +** Processing line: ~ player.slash_collision_rect = [player.x + player.tile_size,~ +** Processing line: ~ player.y + player.tile_size.half - 10,~ +** Processing line: ~ 40, 20]~ +** Processing line: ~ else~ +** Processing line: ~ player.slash_collision_rect = [player.x - 32 - 8,~ +** Processing line: ~ player.y + player.tile_size.half - 10,~ +** Processing line: ~ 40, 20]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # h_pressed_at is initially set to false, and changes once the user presses the "h" key.~ -** Processing line: ~ state.h_pressed_at ||= false~ +** Processing line: ~ # recalc sword's slash state~ +** Processing line: ~ player.slash_at = nil if slash_complete?~ ** Processing line: ~~ -** Processing line: ~ if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false)~ -** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font]~ -** Processing line: ~ else # otherwise, label says "h" was never pressed~ -** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font]~ -** Processing line: ~ end~ +** Processing line: ~ # determine collision if the sword is at it's point of damaging~ +** Processing line: ~ return unless slash_can_damage?~ ** Processing line: ~~ -** Processing line: ~ # border around keyboard input demo section~ -** Processing line: ~ outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)]~ +** Processing line: ~ state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets definition for a small label~ -** Processing line: ~ # Makes it easier to position labels in respect to the position of other labels~ -** Processing line: ~ def small_label x, row, message~ -** Processing line: ~ [x, row_to_px(row), message, small_font]~ +** Processing line: ~ def slash_complete?~ +** Processing line: ~ !player.slash_at || player.slash_at.elapsed?(player.slash_frames)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses small labels to show whether the "a" button on the controller is down, held, or up.~ -** Processing line: ~ # y value of each small label is set by calling the row_to_px method~ -** Processing line: ~ def controller_tech_demo~ -** Processing line: ~ x = 460~ -** Processing line: ~ outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")~ -** Processing line: ~ outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")~ -** Processing line: ~ outputs.labels << small_label(x, 8, "Check console window for more info.")~ +** Processing line: ~ def slash_can_damage?~ +** Processing line: ~ # damage occurs half way into the slash animation~ +** Processing line: ~ return false if slash_complete?~ +** Processing line: ~ return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count~ +** Processing line: ~ return true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.controller_one.key_down.a # if "a" is in "down" state~ -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")~ -** Processing line: ~ puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred~ -** Processing line: ~ elsif inputs.controller_one.key_held.a # if "a" is held down~ -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")~ -** Processing line: ~ elsif inputs.controller_one.key_up.a # if "a" is in up state~ -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")~ -** Processing line: ~ puts "\"a\" key up at #{inputs.controller_one.key_up.a}"~ -** Processing line: ~ else # if no event has occurred~ -** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button state is nil.")~ -** Processing line: ~ end~ +** Processing line: ~ def calc~ +** Processing line: ~ # generate an enemy if there aren't any on the screen~ +** Processing line: ~ add_enemy if state.enemies.length == 0~ +** Processing line: ~ calc_movement~ +** Processing line: ~ calc_slash~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # border around controller input demo section~ -** Processing line: ~ outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]~ +** Processing line: ~ # source is at http://github.com/amirrajan/dragonruby-link-to-the-past~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render_enemies~ +** Processing line: ~ render_player~ +** Processing line: ~ outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."]~ +** Processing line: ~ outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."]~ +** Processing line: ~ render_debug_layer~ +** Processing line: ~ input~ +** Processing line: ~ calc~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs when the mouse was clicked, as well as the coordinates on the screen~ -** Processing line: ~ # of where the click occurred~ -** Processing line: ~ def mouse_tech_demo~ -** Processing line: ~ x = 460~ +** Processing line: ~ def player~ +** Processing line: ~ state.player~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse")~ +** Processing line: ~ $game = Game.new~ ** Processing line: ~~ -** Processing line: ~ if inputs.mouse.click # if click has a value and is not nil~ -** Processing line: ~ state.last_mouse_click = inputs.mouse.click # coordinates of click are stored~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.last_mouse_click # if mouse is clicked (has coordinates as value)~ -** Processing line: ~ # outputs the time (frame) the click occurred, as well as how many frames have passed since the event~ -** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}")~ -** Processing line: ~ # outputs coordinates of click~ -** Processing line: ~ outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}")~ -** Processing line: ~ else # otherwise if the mouse has not been clicked~ -** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.")~ -** Processing line: ~ outputs.labels << small_label(x, 13, "Please click mouse.")~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.reset~ ** Processing line: ~~ -** Processing line: ~ # Outputs whether a mouse click occurred inside or outside of a box~ -** Processing line: ~ def point_to_rect_tech_demo~ -** Processing line: ~ x = 460~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->")~ ** Processing line: ~~ -** Processing line: ~ box = [765, 370, 50, 50, 0, 0, 170] # blue box~ -** Processing line: ~ outputs.borders << box~ +** Processing line: ~* Rendering Sprites - Color And Rotation - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rendering Sprites - Color And Rotation - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if state.last_mouse_click # if the mouse was clicked~ -** Processing line: ~ if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box~ -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened inside the box.")~ -** Processing line: ~ else # otherwise, if mouse was clicked outside the box~ -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened outside the box.")~ -** Processing line: ~ end~ -** Processing line: ~ else # otherwise, if was not clicked at all~ -** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/03_rendering_sprites/04_color_and_rotation/app/main.rb~ +** Processing line: ~ =begin~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ # border around mouse input demo section~ -** Processing line: ~ outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]~ -** Processing line: ~ end~ +** Processing line: ~ - merge: Returns a hash containing the contents of two original hashes.~ +** Processing line: ~ Merge does not allow duplicate keys, so the value of a repeated key~ +** Processing line: ~ will be overwritten.~ ** Processing line: ~~ -** Processing line: ~ # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output~ -** Processing line: ~ # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not~ -** Processing line: ~ # they intersect.~ -** Processing line: ~ def rect_to_rect_tech_demo~ -** Processing line: ~ x = 460~ +** Processing line: ~ For example, if we had two hashes~ +** Processing line: ~ h1 = { "a" => 1, "b" => 2}~ +** Processing line: ~ h2 = { "b" => 3, "c" => 3}~ +** Processing line: ~ and we called the command~ +** Processing line: ~ h1.merge(h2)~ +** Processing line: ~ the result would the following hash~ +** Processing line: ~ { "a" => 1, "b" => 3, "c" => 3}.~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions~ -** Processing line: ~ red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box~ -** Processing line: ~ outputs.borders << red_box # output as a border (not filled in)~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ # If the mouse is clicked inside the red box, two collision boxes are created.~ -** Processing line: ~ if inputs.mouse.click~ -** Processing line: ~ if inputs.mouse.click.point.inside_rect? red_box~ -** Processing line: ~ if !state.box_collision_one # if the collision_one box does not yet have a definition~ -** Processing line: ~ # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.~ -** Processing line: ~ # You can try deleting the subtraction to see how it impacts the box placement.~ -** Processing line: ~ state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition~ -** Processing line: ~ elsif !state.box_collision_two # if collision_two does not yet have a definition~ -** Processing line: ~ state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition~ -** Processing line: ~ else~ -** Processing line: ~ state.box_collision_one = nil # both boxes are empty~ -** Processing line: ~ state.box_collision_two = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ using their keys.~ +** Processing line: ~ In this sample app, we're using a hash to create a sprite.~ ** Processing line: ~~ -** Processing line: ~ # If collision boxes exist, they are output onto screen inside the red box as solids~ -** Processing line: ~ if state.box_collision_one~ -** Processing line: ~ outputs.solids << state.box_collision_one~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ +** Processing line: ~ Before continuing with this sample app, it is HIGHLY recommended that you look~ +** Processing line: ~ at mygame/documentation/05-sprites.md.~ ** Processing line: ~~ -** Processing line: ~ if state.box_collision_two~ -** Processing line: ~ outputs.solids << state.box_collision_two~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed.~ +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ ** Processing line: ~~ -** Processing line: ~ # Outputs whether or not the two collision boxes intersect.~ -** Processing line: ~ if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)~ -** Processing line: ~ if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect~ -** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes intersect.')~ -** Processing line: ~ else # otherwise, if the two boxes do not intersect~ -** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.controller_one: Takes input from the controller based on what key is pressed.~ +** Processing line: ~ For more information about the controller, go to mygame/documentation/08-controllers.md.~ ** Processing line: ~~ -** Processing line: ~ # Creates a button and outputs it onto the screen using labels and borders.~ -** Processing line: ~ # If the button is clicked, the color changes to make it look faded.~ -** Processing line: ~ def button_tech_demo~ -** Processing line: ~ x, y, w, h = 460, 160, 300, 50~ -** Processing line: ~ state.button ||= state.new_entity(:button_with_fade)~ +** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ ** Processing line: ~~ -** Processing line: ~ # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.~ -** Processing line: ~ state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1]~ -** Processing line: ~ state.button.border ||= [x, y, w, h]~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border~ -** Processing line: ~ state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen,~ +** Processing line: ~ # and also can be moved in different directions through keyboard input from the user.~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << state.button.label~ -** Processing line: ~ outputs.borders << state.button.border~ +** Processing line: ~ # Calls the methods necessary for the game to run successfully.~ +** Processing line: ~ def tick args~ +** Processing line: ~ default args~ +** Processing line: ~ render args.grid, args.outputs, args.state~ +** Processing line: ~ calc args.state~ +** Processing line: ~ process_inputs args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.button.clicked_at # if button was clicked (variable has a value and is not nil)~ +** Processing line: ~ # Sets default values for the car sprite~ +** Processing line: ~ # Initialization ||= only happens in the first frame~ +** Processing line: ~ def default args~ +** Processing line: ~ args.state.sprite.width = 19~ +** Processing line: ~ args.state.sprite.height = 10~ +** Processing line: ~ args.state.sprite.scale = 4~ +** Processing line: ~ args.state.max_speed = 5~ +** Processing line: ~ args.state.x ||= 100~ +** Processing line: ~ args.state.y ||= 100~ +** Processing line: ~ args.state.speed ||= 1~ +** Processing line: ~ args.state.angle ||= 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.~ -** Processing line: ~ # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.~ -** Processing line: ~ # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.~ -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs sprite onto screen~ +** Processing line: ~ def render grid, outputs, state~ +** Processing line: ~ outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background~ +** Processing line: ~ outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite~ +** Processing line: ~ 'sprites/86.png', # image path of car~ +** Processing line: ~ state.angle,~ +** Processing line: ~ opacity, # transparency~ +** Processing line: ~ saturation,~ +** Processing line: ~ source_rect(state), # sprite sub division/tile (tile x, y, w, h)~ +** Processing line: ~ false, false, # don't flip sprites~ +** Processing line: ~ rotation_anchor]~ ** Processing line: ~~ -** Processing line: ~ # Creates a new button by declaring it as a new entity, and sets values.~ -** Processing line: ~ def new_button_prefab x, y, message~ -** Processing line: ~ w, h = 300, 50~ -** Processing line: ~ button = state.new_entity(:button_with_fade)~ -** Processing line: ~ button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders~ -** Processing line: ~ button.border = [x, y, w, h] # sets border definition~ -** Processing line: ~ button~ -** Processing line: ~ end~ +** Processing line: ~ # also look at the create_sprite helper method~ +** Processing line: ~ #~ +** Processing line: ~ # For example:~ +** Processing line: ~ #~ +** Processing line: ~ # dest = destination_rect(state)~ +** Processing line: ~ # source = source_rect(state),~ +** Processing line: ~ # outputs.sprites << create_sprite(~ +** Processing line: ~ # 'sprites/86.png',~ +** Processing line: ~ # x: dest.x,~ +** Processing line: ~ # y: dest.y,~ +** Processing line: ~ # w: dest.w,~ +** Processing line: ~ # h: dest.h,~ +** Processing line: ~ # angle: state.angle,~ +** Processing line: ~ # source_x: source.x,~ +** Processing line: ~ # source_y: source.y,~ +** Processing line: ~ # source_w: source.w,~ +** Processing line: ~ # source_h: source.h,~ +** Processing line: ~ # flip_h: false,~ +** Processing line: ~ # flip_v: false,~ +** Processing line: ~ # rotation_anchor_x: 0.7,~ +** Processing line: ~ # rotation_anchor_y: 0.5~ +** Processing line: ~ # )~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # If the mouse has been clicked and the click's location is inside of the button's border, that means~ -** Processing line: ~ # that the button has been clicked. This method returns a boolean value.~ -** Processing line: ~ def button_clicked? button~ -** Processing line: ~ inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)~ -** Processing line: ~ end~ +** Processing line: ~ # Creates sprite by setting values inside of a hash~ +** Processing line: ~ def create_sprite path, options = {}~ +** Processing line: ~ options = {~ ** Processing line: ~~ -** Processing line: ~ # Determines if button was clicked, and changes its appearance if it is clicked~ -** Processing line: ~ def tick_button_prefab button~ -** Processing line: ~ outputs.labels << button.label # outputs button's label and border~ -** Processing line: ~ outputs.borders << button.border~ +** Processing line: ~ # dest x, y, w, h~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ ** Processing line: ~~ -** Processing line: ~ if button_clicked? button # if button is clicked~ -** Processing line: ~ button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked~ -** Processing line: ~ end~ +** Processing line: ~ # angle, rotation~ +** Processing line: ~ angle: 0,~ +** Processing line: ~ rotation_anchor_x: 0.5,~ +** Processing line: ~ rotation_anchor_y: 0.5,~ ** Processing line: ~~ -** Processing line: ~ if button.clicked_at # if clicked_at has a frame value and is not nil~ -** Processing line: ~ # button is output; color changes and transparency changes for 0.25 seconds after click occurs~ -** Processing line: ~ outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,~ -** Processing line: ~ 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # color saturation (red, green, blue), transparency~ +** Processing line: ~ r: 255,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ a: 255,~ ** Processing line: ~~ -** Processing line: ~ # Exports the app's game state if the export button is clicked.~ -** Processing line: ~ def export_game_state_demo~ -** Processing line: ~ state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state")~ -** Processing line: ~ tick_button_prefab(state.export_game_state_button) # calls method to output button~ -** Processing line: ~ if button_clicked? state.export_game_state_button # if the export button is clicked~ -** Processing line: ~ args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # source x, y, width, height~ +** Processing line: ~ source_x: 0,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: -1,~ +** Processing line: ~ source_h: -1,~ ** Processing line: ~~ -** Processing line: ~ # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window.~ -** Processing line: ~ def window_state_demo~ -** Processing line: ~ m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement)~ -** Processing line: ~ k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N'~ -** Processing line: ~ outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font]~ -** Processing line: ~ end~ +** Processing line: ~ # flip horiztonally, flip vertically~ +** Processing line: ~ flip_h: false,~ +** Processing line: ~ flip_v: false,~ ** Processing line: ~~ -** Processing line: ~ #Sets values for the horizontal separator (divides demo sections)~ -** Processing line: ~ def horizontal_seperator y, x, x2~ -** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ -** Processing line: ~ end~ +** Processing line: ~ }.merge options~ ** Processing line: ~~ -** Processing line: ~ #Sets the values for the vertical separator (divides demo sections)~ -** Processing line: ~ def vertical_seperator x, y, y2~ -** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ -** Processing line: ~ end~ +** Processing line: ~ [~ +** Processing line: ~ options[:x], options[:y], options[:w], options[:h], # dest rect keys~ +** Processing line: ~ path,~ +** Processing line: ~ options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha~ +** Processing line: ~ options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys~ +** Processing line: ~ options[:flip_h], options[:flip_v], # flip~ +** Processing line: ~ options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor~ +** Processing line: ~ ] # hash keys contain corresponding values~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs vertical and horizontal separators onto the screen to separate each demo section.~ -** Processing line: ~ def render_seperators~ -** Processing line: ~ outputs.lines << horizontal_seperator(505, grid.left, 445)~ -** Processing line: ~ outputs.lines << horizontal_seperator(353, grid.left, 445)~ -** Processing line: ~ outputs.lines << horizontal_seperator(264, grid.left, 445)~ -** Processing line: ~ outputs.lines << horizontal_seperator(174, grid.left, 445)~ +** Processing line: ~ # Calls the calc_pos and calc_wrap methods.~ +** Processing line: ~ def calc state~ +** Processing line: ~ calc_pos state~ +** Processing line: ~ calc_wrap state~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.lines << vertical_seperator(445, grid.top, grid.bottom)~ +** Processing line: ~ # Changes sprite's position on screen~ +** Processing line: ~ # Vectors have magnitude and direction, so the incremented x and y values give the car direction~ +** Processing line: ~ def calc_pos state~ +** Processing line: ~ state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed~ +** Processing line: ~ state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed~ +** Processing line: ~ state.speed *= 1.1 # scales speed up~ +** Processing line: ~ state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.lines << horizontal_seperator(690, 445, 820)~ -** Processing line: ~ outputs.lines << horizontal_seperator(426, 445, 820)~ +** Processing line: ~ # The screen's dimensions are 1280x720. If the car goes out of scope,~ +** Processing line: ~ # it loops back around on the screen.~ +** Processing line: ~ def calc_wrap state~ ** Processing line: ~~ -** Processing line: ~ outputs.lines << vertical_seperator(820, grid.top, grid.bottom)~ +** Processing line: ~ # car returns to left side of screen if it disappears on right side of screen~ +** Processing line: ~ # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger~ +** Processing line: ~ state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280~ +** Processing line: ~~ +** Processing line: ~ # car wraps around to right side of screen if it disappears on the left side~ +** Processing line: ~ state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0~ +** Processing line: ~~ +** Processing line: ~ # car wraps around to bottom of screen if it disappears at the top of the screen~ +** Processing line: ~ # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!)~ +** Processing line: ~ state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope~ +** Processing line: ~~ +** Processing line: ~ # car wraps around to top of screen if it disappears at the bottom of the screen~ +** Processing line: ~ state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Changes angle of sprite based on user input from keyboard or controller~ +** Processing line: ~ def process_inputs args~ +** Processing line: ~~ +** Processing line: ~ # NOTE: increasing the angle doesn't mean that the car will continue to go~ +** Processing line: ~ # in a specific direction. The angle is increasing, which means that if the~ +** Processing line: ~ # left key was kept in the "down" state, the change in the angle would cause~ +** Processing line: ~ # the car to go in a counter-clockwise direction and form a circle (360 degrees)~ +** Processing line: ~ if args.inputs.keyboard.key_held.left # if left key is pressed~ +** Processing line: ~ args.state.angle += 2 # car's angle is incremented by 2~ +** Processing line: ~~ +** Processing line: ~ # The same applies to decreasing the angle. If the right key was kept in the~ +** Processing line: ~ # "down" state, the decreasing angle would cause the car to go in a clockwise~ +** Processing line: ~ # direction and form a circle (360 degrees)~ +** Processing line: ~ elsif args.inputs.keyboard.key_held.right # if right key is pressed~ +** Processing line: ~ args.state.angle -= 2 # car's angle is decremented by 2~ +** Processing line: ~~ +** Processing line: ~ # Input from a controller can also change the angle of the car~ +** Processing line: ~ elsif args.inputs.controller_one.left_analog_x_perc != 0~ +** Processing line: ~ args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $tech_demo = TechDemo.new~ +** Processing line: ~ # A sprite's center of rotation can be altered~ +** Processing line: ~ # Increasing either of these numbers would dramatically increase the~ +** Processing line: ~ # car's drift when it turns!~ +** Processing line: ~ def rotation_anchor~ +** Processing line: ~ [0.7, 0.5]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $tech_demo.inputs = args.inputs~ -** Processing line: ~ $tech_demo.state = args.state~ -** Processing line: ~ $tech_demo.grid = args.grid~ -** Processing line: ~ $tech_demo.args = args~ -** Processing line: ~ $tech_demo.outputs = args.render_target(:mini_map)~ -** Processing line: ~ $tech_demo.tick~ -** Processing line: ~ args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]]~ -** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :mini_map]~ -** Processing line: ~ args.outputs.sprites << [830, 300, 675, 379, :mini_map]~ -** Processing line: ~ tick_instructions args, "Sample app shows all the rendering apis available."~ +** Processing line: ~ # Sets opacity value of sprite to 255 so that it is not transparent at all~ +** Processing line: ~ # Change it to 0 and you won't be able to see the car sprite on the screen~ +** Processing line: ~ def opacity~ +** Processing line: ~ 255~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~ # Sets the color of the sprite to white.~ +** Processing line: ~ def saturation~ +** Processing line: ~ [255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ # Sets definition of destination_rect (used to define the car sprite)~ +** Processing line: ~ def destination_rect state~ +** Processing line: ~ [state.x, state.y,~ +** Processing line: ~ state.sprite.width * state.sprite.scale, # multiplies by 4 to set size~ +** Processing line: ~ state.sprite.height * state.sprite.scale]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Portion of a sprite (a tile)~ +** Processing line: ~ # Sub division of sprite is denoted as a rectangle directly related to original size of .png~ +** Processing line: ~ # Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height)~ +** Processing line: ~ def source_rect state~ +** Processing line: ~ [0, 0, state.sprite.width, state.sprite.height]~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb~ +** Processing line: ~* Physics And Collisions - Simple - main.rb~ - H1 detected. -- Formatting line: ~07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Simple - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/04_physics_and_collisions/01_simple/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ -** Processing line: ~~ -** Processing line: ~ - Nested array: An array whose individual elements are also arrays; useful for~ -** Processing line: ~ storing groups of similar data. Also called multidimensional arrays.~ -** Processing line: ~~ -** Processing line: ~ In this sample app, we see nested arrays being used in object definitions.~ -** Processing line: ~ Notice the parameters for solids, listed below. Parameters 1-3 set the~ -** Processing line: ~ definition for the rect, and parameter 4 sets the definition of the color.~ -** Processing line: ~~ -** Processing line: ~ Instead of having a solid definition that looks like this,~ -** Processing line: ~ [X, Y, W, H, R, G, B]~ -** Processing line: ~ we can separate it into two separate array definitions in one, like this~ -** Processing line: ~ [[X, Y, W, H], [R, G, B]]~ -** Processing line: ~ and both options work fine in defining our solid (or any object).~ -** Processing line: ~~ -** Processing line: ~ - Collections: Lists of data; useful for organizing large amounts of data.~ -** Processing line: ~ One element of a collection could be an array (which itself contains many elements).~ -** Processing line: ~ For example, a collection that stores two solid objects would look like this:~ -** Processing line: ~ [~ -** Processing line: ~ [100, 100, 50, 50, 0, 0, 0],~ -** Processing line: ~ [100, 150, 50, 50, 255, 255, 255]~ -** Processing line: ~ ]~ -** Processing line: ~ If this collection was added to args.outputs.solids, two solids would be output~ -** Processing line: ~ next to each other, one black and one white.~ -** Processing line: ~ Nested arrays can be used in collections, as you will see in this sample app.~ -** Processing line: ~~ ** Processing line: ~ Reminders:~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ ** Processing line: ~~ ** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters for a solid are~ -** Processing line: ~ 1. The position on the screen (x, y)~ -** Processing line: ~ 2. The width (w)~ -** Processing line: ~ 3. The height (h)~ -** Processing line: ~ 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black)~ -** Processing line: ~ NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS!~ -** Processing line: ~~ -** Processing line: ~ Here is an example of a (red) border or solid definition:~ -** Processing line: ~ [100, 100, 400, 500, 255, 0, 0]~ -** Processing line: ~ It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders.~ -** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ -** Processing line: ~ The parameters for sprites are~ -** Processing line: ~ 1. The position on the screen (x, y)~ -** Processing line: ~ 2. The width (w)~ -** Processing line: ~ 3. The height (h)~ -** Processing line: ~ 4. The image path (p)~ -** Processing line: ~~ -** Processing line: ~ Here is an example of a sprite definition:~ -** Processing line: ~ [100, 100, 400, 500, 'sprites/dragonruby.png']~ -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ ** Processing line: ~~ ** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # This code demonstrates the creation and output of objects like sprites, borders, and solids~ -** Processing line: ~ # If filled in, they are solids~ -** Processing line: ~ # If hollow, they are borders~ -** Processing line: ~ # If images, they are sprites~ -** Processing line: ~~ -** Processing line: ~ # Solids are added to args.outputs.solids~ -** Processing line: ~ # Borders are added to args.outputs.borders~ -** Processing line: ~ # Sprites are added to args.outputs.sprites~ +** Processing line: ~ # This sample app shows collisions between two boxes.~ ** Processing line: ~~ -** Processing line: ~ # The tick method runs 60 frames every second.~ -** Processing line: ~ # Your game is going to happen under this one function.~ +** Processing line: ~ # Runs methods needed for game to run properly.~ ** Processing line: ~ def tick args~ -** Processing line: ~ border_as_solid_and_solid_as_border args~ -** Processing line: ~ sprite_as_border_or_solids args~ -** Processing line: ~ collection_of_borders_and_solids args~ -** Processing line: ~ collection_of_sprites args~ +** Processing line: ~ tick_instructions args, "Sample app shows how to move a square over time and determine collision."~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows a border being output onto the screen as a border and a solid~ -** Processing line: ~ # Also shows how colors can be set~ -** Processing line: ~ def border_as_solid_and_solid_as_border args~ -** Processing line: ~ border = [0, 0, 50, 50]~ -** Processing line: ~ args.outputs.borders << border~ -** Processing line: ~ args.outputs.solids << border~ -** Processing line: ~~ -** Processing line: ~ # Red, green, blue saturations (last three parameters) can be any number between 0 and 255~ -** Processing line: ~ border_with_color = [0, 100, 50, 50, 255, 0, 0]~ -** Processing line: ~ args.outputs.borders << border_with_color~ -** Processing line: ~ args.outputs.solids << border_with_color~ -** Processing line: ~~ -** Processing line: ~ border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color~ -** Processing line: ~ args.outputs.borders << border_with_nested_color~ -** Processing line: ~ args.outputs.solids << border_with_nested_color~ -** Processing line: ~~ -** Processing line: ~ border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect~ -** Processing line: ~ args.outputs.borders << border_with_nested_rect~ -** Processing line: ~ args.outputs.solids << border_with_nested_rect~ +** Processing line: ~ # Sets default values.~ +** Processing line: ~ def defaults args~ +** Processing line: ~ # These values represent the moving box.~ +** Processing line: ~ args.state.moving_box_speed = 10~ +** Processing line: ~ args.state.moving_box_size = 100~ +** Processing line: ~ args.state.moving_box_dx ||= 1~ +** Processing line: ~ args.state.moving_box_dy ||= 1~ +** Processing line: ~ args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height~ ** Processing line: ~~ -** Processing line: ~ border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color~ -** Processing line: ~ args.outputs.borders << border_with_nested_color_and_rect~ -** Processing line: ~ args.outputs.solids << border_with_nested_color_and_rect~ +** Processing line: ~ # These values represent the center box.~ +** Processing line: ~ args.state.center_box ||= [540, 260, 200, 200, 180]~ +** Processing line: ~ args.state.center_box_collision ||= false # initially no collision~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Shows a sprite output onto the screen as a sprite, border, and solid~ -** Processing line: ~ # Demonstrates that all three outputs appear differently on screen~ -** Processing line: ~ def sprite_as_border_or_solids args~ -** Processing line: ~ sprite = [100, 0, 50, 50, 'sprites/ship.png']~ -** Processing line: ~ args.outputs.sprites << sprite~ +** Processing line: ~ def render args~ +** Processing line: ~ # If the game state denotes that a collision has occured,~ +** Processing line: ~ # render a solid square, otherwise render a border instead.~ +** Processing line: ~ if args.state.center_box_collision~ +** Processing line: ~ args.outputs.solids << args.state.center_box~ +** Processing line: ~ else~ +** Processing line: ~ args.outputs.borders << args.state.center_box~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sprite_as_border variable has same parameters (excluding position) as above object,~ -** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.borders~ -** Processing line: ~ sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png']~ -** Processing line: ~ args.outputs.borders << sprite_as_border~ +** Processing line: ~ # Then render the moving box.~ +** Processing line: ~ args.outputs.solids << args.state.moving_box~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sprite_as_solid variable has same parameters (excluding position) as above object,~ -** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.solids~ -** Processing line: ~ sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png']~ -** Processing line: ~ args.outputs.solids << sprite_as_solid~ +** Processing line: ~ # Generally in a pipeline for a game engine, you have rendering,~ +** Processing line: ~ # game simulation (calculation), and input processing.~ +** Processing line: ~ # This fuction represents the game simulation.~ +** Processing line: ~ def calc args~ +** Processing line: ~ position_moving_box args~ +** Processing line: ~ determine_collision_center_box args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Holds and outputs a collection of borders and a collection of solids~ -** Processing line: ~ # Collections are created by using arrays to hold parameters of each individual object~ -** Processing line: ~ def collection_of_borders_and_solids args~ -** Processing line: ~ collection_borders = [~ -** Processing line: ~ [~ -** Processing line: ~ [200, 0, 50, 50], # black border~ -** Processing line: ~ [200, 100, 50, 50, 255, 0, 0], # red border~ -** Processing line: ~ [200, 200, 50, 50, [0, 255, 0]], # nested color~ -** Processing line: ~ ],~ -** Processing line: ~ [[200, 300, 50, 50], 0, 0, 255], # nested rect~ -** Processing line: ~ [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ -** Processing line: ~ ]~ +** Processing line: ~ # Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed,~ +** Processing line: ~ # and adding it to the current position.~ +** Processing line: ~ # dx and dy are positive if the box is moving right and up, respectively~ +** Processing line: ~ # dx and dy are negative if the box is moving left and down, respectively~ +** Processing line: ~ def position_moving_box args~ +** Processing line: ~ args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed~ +** Processing line: ~ args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed~ ** Processing line: ~~ -** Processing line: ~ args.outputs.borders << collection_borders~ +** Processing line: ~ # 1280x720 are the virtual pixels you work with (essentially 720p).~ +** Processing line: ~ screen_width = 1280~ +** Processing line: ~ screen_height = 720~ ** Processing line: ~~ -** Processing line: ~ collection_solids = [~ -** Processing line: ~ [~ -** Processing line: ~ [[300, 300, 50, 50], 0, 0, 255], # nested rect~ -** Processing line: ~ [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ -** Processing line: ~ ],~ -** Processing line: ~ [300, 0, 50, 50],~ -** Processing line: ~ [300, 100, 50, 50, 255, 0, 0],~ -** Processing line: ~ [300, 200, 50, 50, [0, 255, 0]], # nested color~ -** Processing line: ~ ]~ +** Processing line: ~ # Position of the box is denoted by the bottom left hand corner, in~ +** Processing line: ~ # that case, we have to subtract the width of the box so that it stays~ +** Processing line: ~ # in the scene (you can try deleting the subtraction to see how it~ +** Processing line: ~ # impacts the box's movement).~ +** Processing line: ~ if args.state.moving_box.x > screen_width - args.state.moving_box_size~ +** Processing line: ~ args.state.moving_box_dx = -1 # moves left~ +** Processing line: ~ elsif args.state.moving_box.x < 0~ +** Processing line: ~ args.state.moving_box_dx = 1 # moves right~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.solids << collection_solids~ +** Processing line: ~ # Here, we're making sure the moving box remains within the vertical scope of the screen~ +** Processing line: ~ if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high~ +** Processing line: ~ args.state.moving_box_dy = -1 # moves down~ +** Processing line: ~ elsif args.state.moving_box.y < 0 # if the box moves too low~ +** Processing line: ~ args.state.moving_box_dy = 1 # moves up~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Holds and outputs a collection of sprites by adding it to args.outputs.sprites~ -** Processing line: ~ # Also outputs a collection with same parameters (excluding position) by adding~ -** Processing line: ~ # it to args.outputs.solids and another to args.outputs.borders~ -** Processing line: ~ def collection_of_sprites args~ -** Processing line: ~ sprites_collection = [~ -** Processing line: ~ [~ -** Processing line: ~ [400, 0, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ [400, 100, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ ],~ -** Processing line: ~ [400, 200, 50, 50, 'sprites/ship.png']~ -** Processing line: ~ ]~ -** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << sprites_collection~ +** Processing line: ~ def determine_collision_center_box args~ +** Processing line: ~ # Collision is handled by the engine. You simply have to call the~ +** Processing line: ~ # `intersect_rect?` function.~ +** Processing line: ~ if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect~ +** Processing line: ~ args.state.center_box_collision = true # then a collision happened~ +** Processing line: ~ else~ +** Processing line: ~ args.state.center_box_collision = false # otherwise, no collision happened~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.solids << [~ -** Processing line: ~ [500, 0, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ [500, 100, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ [[[500, 200, 50, 50, 'sprites/ship.png']]]~ -** Processing line: ~ ]~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.borders << [~ -** Processing line: ~ [~ -** Processing line: ~ [600, 0, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ [600, 100, 50, 50, 'sprites/ship.png'],~ -** Processing line: ~ ],~ -** Processing line: ~ [600, 200, 50, 50, 'sprites/ship.png']~ -** Processing line: ~ ]~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 07_advanced_rendering/11_render_primitives_as_hash/app/main.rb~ +** Processing line: ~* Physics And Collisions - Moving Objects - main.rb~ - H1 detected. -- Formatting line: ~07_advanced_rendering/11_render_primitives_as_hash/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Moving Objects - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/04_physics_and_collisions/02_moving_objects/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ Reminders:~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ ** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ ** Processing line: ~ using their keys.~ @@ -106469,1923 +115245,1833 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ puts numbers["one"]~ ** Processing line: ~ which would print "uno" to the console.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ +** Processing line: ~ For example, if we have the command~ +** Processing line: ~ puts 4.greater(3)~ +** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ +** Processing line: ~ Similar to lesser, which returns the lesser value.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ - num1.lesser(num2): Finds the lower value of the given options.~ +** Processing line: ~ For example, in the statement~ +** Processing line: ~ a = 4.lesser(3)~ +** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ +** Processing line: ~ but if the statement had been~ +** Processing line: ~ a = 4.lesser(5)~ +** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ -** Processing line: ~ The parameters are the same as a solid.~ -** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ -** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ +** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ +** Processing line: ~ For example, you can find all elements of a collection that are divisible by 2~ +** Processing line: ~ or find all objects that have intersected with another object.~ ** Processing line: ~~ -** Processing line: ~ # This sample app demonstrates how hashes can be used to output different kinds of objects.~ +** Processing line: ~ - abs: Returns the absolute value.~ +** Processing line: ~ For example, the command~ +** Processing line: ~ (-30).abs~ +** Processing line: ~ would return 30 as a result.~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.angle ||= 0 # initializes angle to 0~ -** Processing line: ~ args.state.angle += 1 # increments angle by 1 every frame (60 times a second)~ +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ ** Processing line: ~~ -** Processing line: ~ # Outputs sprite using a hash~ -** Processing line: ~ args.outputs.sprites << {~ -** Processing line: ~ x: 30, # sprite position~ -** Processing line: ~ y: 550,~ -** Processing line: ~ w: 128, # sprite size~ -** Processing line: ~ h: 101,~ -** Processing line: ~ path: "dragonruby.png", # image path~ -** Processing line: ~ angle: args.state.angle, # angle~ -** Processing line: ~ a: 255, # alpha (transparency)~ -** Processing line: ~ r: 255, # color saturation~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 255,~ -** Processing line: ~ tile_x: 0, # sprite sub division/tile~ -** Processing line: ~ tile_y: 0,~ -** Processing line: ~ tile_w: -1,~ -** Processing line: ~ tile_h: -1,~ -** Processing line: ~ flip_vertically: false, # don't flip sprite~ -** Processing line: ~ flip_horizontally: false,~ -** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ -** Processing line: ~ angle_anchor_y: 0.5~ -** Processing line: ~ }~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ # Outputs label using a hash~ -** Processing line: ~ args.outputs.labels << {~ -** Processing line: ~ x: 200, # label position~ -** Processing line: ~ y: 550,~ -** Processing line: ~ text: "dragonruby", # label text~ -** Processing line: ~ size_enum: 2,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 155, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255, # transparency~ -** Processing line: ~ font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly~ -** Processing line: ~ }~ +** Processing line: ~ - args.inputs.keyboard.KEY: Determines if a key has been pressed.~ +** Processing line: ~ For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md.~ ** Processing line: ~~ -** Processing line: ~ # Outputs solid using a hash~ -** Processing line: ~ # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ -** Processing line: ~ args.outputs.solids << {~ -** Processing line: ~ x: 400, # position~ -** Processing line: ~ y: 550,~ -** Processing line: ~ w: 160, # size~ -** Processing line: ~ h: 90,~ -** Processing line: ~ r: 120, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ # Outputs border using a hash~ -** Processing line: ~ # Same parameters as a solid~ -** Processing line: ~ args.outputs.borders << {~ -** Processing line: ~ x: 600,~ -** Processing line: ~ y: 550,~ -** Processing line: ~ w: 160,~ -** Processing line: ~ h: 90,~ -** Processing line: ~ r: 120,~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255~ -** Processing line: ~ }~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ # Outputs line using a hash~ -** Processing line: ~ args.outputs.lines << {~ -** Processing line: ~ x: 900, # starting position~ -** Processing line: ~ y: 550,~ -** Processing line: ~ x2: 1200, # ending position~ -** Processing line: ~ y2: 550,~ -** Processing line: ~ r: 120, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # Outputs sprite as a primitive using a hash~ -** Processing line: ~ args.outputs.primitives << {~ -** Processing line: ~ x: 30, # position~ -** Processing line: ~ y: 200,~ -** Processing line: ~ w: 128, # size~ -** Processing line: ~ h: 101,~ -** Processing line: ~ path: "dragonruby.png", # image path~ -** Processing line: ~ angle: args.state.angle, # angle~ -** Processing line: ~ a: 255, # transparency~ -** Processing line: ~ r: 255, # color saturation~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 255,~ -** Processing line: ~ tile_x: 0, # sprite sub division/tile~ -** Processing line: ~ tile_y: 0,~ -** Processing line: ~ tile_w: -1,~ -** Processing line: ~ tile_h: -1,~ -** Processing line: ~ flip_vertically: false, # don't flip~ -** Processing line: ~ flip_horizontally: false,~ -** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ -** Processing line: ~ angle_anchor_y: 0.5~ -** Processing line: ~ }.sprite~ +** Processing line: ~ # Calls methods needed for game to run properly~ +** Processing line: ~ def tick args~ +** Processing line: ~ tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump."~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ +** Processing line: ~ input args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs label as primitive using a hash~ -** Processing line: ~ args.outputs.primitives << {~ -** Processing line: ~ x: 200, # position~ -** Processing line: ~ y: 200,~ -** Processing line: ~ text: "dragonruby", # text~ -** Processing line: ~ size: 2,~ -** Processing line: ~ alignment: 1,~ -** Processing line: ~ r: 155, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255, # transparency~ -** Processing line: ~ font: "fonts/manaspc.ttf" # font style~ -** Processing line: ~ }.label~ +** Processing line: ~ # sets default values and creates empty collections~ +** Processing line: ~ # initialization only happens in the first frame~ +** Processing line: ~ def defaults args~ +** Processing line: ~ fiddle args~ +** Processing line: ~ args.state.enemy.hammers ||= []~ +** Processing line: ~ args.state.enemy.hammer_queue ||= []~ +** Processing line: ~ args.state.tick_count = args.state.tick_count~ +** Processing line: ~ args.state.bridge_top = 128~ +** Processing line: ~ args.state.player.x ||= 0 # initializes player's properties~ +** Processing line: ~ args.state.player.y ||= args.state.bridge_top~ +** Processing line: ~ args.state.player.w ||= 64~ +** Processing line: ~ args.state.player.h ||= 64~ +** Processing line: ~ args.state.player.dy ||= 0~ +** Processing line: ~ args.state.player.dx ||= 0~ +** Processing line: ~ args.state.enemy.x ||= 800 # initializes enemy's properties~ +** Processing line: ~ args.state.enemy.y ||= 0~ +** Processing line: ~ args.state.enemy.w ||= 128~ +** Processing line: ~ args.state.enemy.h ||= 128~ +** Processing line: ~ args.state.enemy.dy ||= 0~ +** Processing line: ~ args.state.enemy.dx ||= 0~ +** Processing line: ~ args.state.game_over_at ||= 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs solid as primitive using a hash~ -** Processing line: ~ args.outputs.primitives << {~ -** Processing line: ~ x: 400, # position~ -** Processing line: ~ y: 200,~ -** Processing line: ~ w: 160, # size~ -** Processing line: ~ h: 90,~ -** Processing line: ~ r: 120, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.solid~ +** Processing line: ~ # sets enemy, player, hammer values~ +** Processing line: ~ def fiddle args~ +** Processing line: ~ args.state.gravity = -0.3~ +** Processing line: ~ args.state.enemy_jump_power = 10 # sets enemy values~ +** Processing line: ~ args.state.enemy_jump_interval = 60~ +** Processing line: ~ args.state.hammer_throw_interval = 40 # sets hammer values~ +** Processing line: ~ args.state.hammer_launch_power_default = 5~ +** Processing line: ~ args.state.hammer_launch_power_near = 2~ +** Processing line: ~ args.state.hammer_launch_power_far = 7~ +** Processing line: ~ args.state.hammer_upward_launch_power = 15~ +** Processing line: ~ args.state.max_hammers_per_volley = 10~ +** Processing line: ~ args.state.gap_between_hammers = 10~ +** Processing line: ~ args.state.player_jump_power = 10 # sets player values~ +** Processing line: ~ args.state.player_jump_power_duration = 10~ +** Processing line: ~ args.state.player_max_run_speed = 10~ +** Processing line: ~ args.state.player_speed_slowdown_rate = 0.9~ +** Processing line: ~ args.state.player_acceleration = 1~ +** Processing line: ~ args.state.hammer_size = 32~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs border as primitive using a hash~ -** Processing line: ~ # Same parameters as solid~ -** Processing line: ~ args.outputs.primitives << {~ -** Processing line: ~ x: 600, # position~ -** Processing line: ~ y: 200,~ -** Processing line: ~ w: 160, # size~ -** Processing line: ~ h: 90,~ -** Processing line: ~ r: 120, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.border~ +** Processing line: ~ # outputs objects onto the screen~ +** Processing line: ~ def render args~ +** Processing line: ~ args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge~ +** Processing line: ~ # sets x by multiplying 64 to index to find pixel value (places all squares side by side)~ +** Processing line: ~ # subtracts 64 from bridge_top because position is denoted by bottom left corner~ +** Processing line: ~ [i * 64, args.state.bridge_top - 64, 64, 64]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs line as primitive using a hash~ -** Processing line: ~ args.outputs.primitives << {~ -** Processing line: ~ x: 900, # starting position~ -** Processing line: ~ y: 200,~ -** Processing line: ~ x2: 1200, # ending position~ -** Processing line: ~ y2: 200,~ -** Processing line: ~ r: 120, # color saturation~ -** Processing line: ~ g: 50,~ -** Processing line: ~ b: 50,~ -** Processing line: ~ a: 255 # transparency~ -** Processing line: ~ }.line~ +** Processing line: ~ args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0]~ +** Processing line: ~ args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box)~ +** Processing line: ~ args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box)~ +** Processing line: ~ args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Performs calculations to move objects on the screen~ +** Processing line: ~ def calc args~ ** Processing line: ~~ +** Processing line: ~ # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.~ +** Processing line: ~ args.state.player.x += args.state.player.dx~ +** Processing line: ~ args.state.player.y += args.state.player.dy~ ** Processing line: ~~ -** Processing line: ~* 08_lerping_easing_functions/01_easing_functions/app/main.rb~ -- H1 detected. -- Formatting line: ~08_lerping_easing_functions/01_easing_functions/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ +** Processing line: ~ args.state.player.dy += args.state.gravity~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ # STOP! Watch the following presentation first!!!!~ -** Processing line: ~ # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations~ -** Processing line: ~ # https://www.youtube.com/watch?v=mr5xkf6zSzk~ +** Processing line: ~ # player's y position is either current y position or y position of top of~ +** Processing line: ~ # bridge, whichever has a greater value~ +** Processing line: ~ # ensures that the player never goes below the bridge~ +** Processing line: ~ args.state.player.y = args.state.player.y.greater(args.state.bridge_top)~ ** Processing line: ~~ -** Processing line: ~ # You've watched the talk, yes? YES???~ +** Processing line: ~ # player's x position is either the current x position or 0, whichever has a greater value~ +** Processing line: ~ # ensures that the player doesn't go too far left (out of the screen's scope)~ +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0)~ ** Processing line: ~~ -** Processing line: ~ # define starting and ending points of properties to animate~ -** Processing line: ~ args.state.target_x = 1180~ -** Processing line: ~ args.state.target_y = 620~ -** Processing line: ~ args.state.target_w = 100~ -** Processing line: ~ args.state.target_h = 100~ -** Processing line: ~ args.state.starting_x = 0~ -** Processing line: ~ args.state.starting_y = 0~ -** Processing line: ~ args.state.starting_w = 300~ -** Processing line: ~ args.state.starting_h = 300~ +** Processing line: ~ # player is not falling if it is located on the top of the bridge~ +** Processing line: ~ args.state.player.falling = false if args.state.player.y == args.state.bridge_top~ +** Processing line: ~ args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player~ ** Processing line: ~~ -** Processing line: ~ # define start time and duration of animation~ -** Processing line: ~ args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300)~ -** Processing line: ~ args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120)~ +** Processing line: ~ args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx~ +** Processing line: ~ args.state.enemy.y += args.state.enemy.dy # same with y and dy~ ** Processing line: ~~ -** Processing line: ~ # define type of animations~ -** Processing line: ~ # Here are all the options you have for values you can put in the array:~ -** Processing line: ~ # :identity, :quad, :cube, :quart, :quint, :flip~ +** Processing line: ~ # ensures that the enemy never goes below the bridge~ +** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ ** Processing line: ~~ -** Processing line: ~ # Linear is defined as:~ -** Processing line: ~ # [:identity]~ -** Processing line: ~ #~ -** Processing line: ~ # Smooth start variations are:~ -** Processing line: ~ # [:quad]~ -** Processing line: ~ # [:cube]~ -** Processing line: ~ # [:quart]~ -** Processing line: ~ # [:quint]~ +** Processing line: ~ # ensures that the enemy never goes too far left (outside the screen's scope)~ +** Processing line: ~ args.state.enemy.x = args.state.enemy.x.greater(0)~ ** Processing line: ~~ -** Processing line: ~ # Linear reversed, and smooth stop are the same as the animations defined above, but reversed:~ -** Processing line: ~ # [:flip, :identity]~ -** Processing line: ~ # [:flip, :quad, :flip]~ -** Processing line: ~ # [:flip, :cube, :flip]~ -** Processing line: ~ # [:flip, :quart, :flip]~ -** Processing line: ~ # [:flip, :quint, :flip]~ +** Processing line: ~ # objects that go up must come down because of gravity~ +** Processing line: ~ args.state.enemy.dy += args.state.gravity~ ** Processing line: ~~ -** Processing line: ~ # You can also do custom definitions. See the bottom of the file details~ -** Processing line: ~ # on how to do that. I've defined a couple for you:~ -** Processing line: ~ # [:smoothest_start]~ -** Processing line: ~ # [:smoothest_stop]~ +** Processing line: ~ args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)~ ** Processing line: ~~ -** Processing line: ~ # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS~ -** Processing line: ~ args.state.animation_type = [:identity]~ -** Processing line: ~ # args.state.animation_type = [:quad]~ -** Processing line: ~ # args.state.animation_type = [:cube]~ -** Processing line: ~ # args.state.animation_type = [:quart]~ -** Processing line: ~ # args.state.animation_type = [:quint]~ -** Processing line: ~ # args.state.animation_type = [:flip, :identity]~ -** Processing line: ~ # args.state.animation_type = [:flip, :quad, :flip]~ -** Processing line: ~ # args.state.animation_type = [:flip, :cube, :flip]~ -** Processing line: ~ # args.state.animation_type = [:flip, :quart, :flip]~ -** Processing line: ~ # args.state.animation_type = [:flip, :quint, :flip]~ -** Processing line: ~ # args.state.animation_type = [:smoothest_start]~ -** Processing line: ~ # args.state.animation_type = [:smoothest_stop]~ +** Processing line: ~ #sets definition of enemy~ +** Processing line: ~ args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w]~ ** Processing line: ~~ -** Processing line: ~ # THIS IS WHERE THE MAGIC HAPPENS!~ -** Processing line: ~ # Numeric#ease~ -** Processing line: ~ progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type)~ +** Processing line: ~ if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge~ +** Processing line: ~ args.state.enemy.dy = 0 # there is no change in y~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Numeric#ease needs to called:~ -** Processing line: ~ # 1. On the number that represents the point in time you want to start, and takes two parameters:~ -** Processing line: ~ # a. The first parameter is how long the animation should take.~ -** Processing line: ~ # b. The second parameter represents the functions that need to be called.~ -** Processing line: ~ #~ -** Processing line: ~ # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds,~ -** Processing line: ~ # and I want to animation to start fast and end slow, I would do:~ -** Processing line: ~ # (60 * 3).ease(60 * 10, :flip, :quint, :flip)~ +** Processing line: ~ # if 60 frames have passed and the enemy is not moving vertically~ +** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0~ +** Processing line: ~ args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # initial value delta to the final value~ -** Processing line: ~ calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress~ -** Processing line: ~ calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress~ -** Processing line: ~ calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress~ -** Processing line: ~ calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress~ +** Processing line: ~ # if 40 frames have passed or 5 frames have passed since the game ended~ +** Processing line: ~ if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5~ +** Processing line: ~ # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded)~ +** Processing line: ~ # that is why we're adding 1, to include the max possibility~ +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations)~ ** Processing line: ~~ -** Processing line: ~ args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0]~ +** Processing line: ~ # if the horizontal distance between the player and enemy is less than 128 pixels~ +** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs < 128~ +** Processing line: ~ # the change in x won't be that great since the enemy and player are closer to each other~ +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # count down~ -** Processing line: ~ count_down = args.state.start_animate_at - args.state.tick_count~ -** Processing line: ~ if count_down > 0~ -** Processing line: ~ args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1]~ -** Processing line: ~ args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1]~ -** Processing line: ~ elsif progress >= 1~ -** Processing line: ~ args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1]~ -** Processing line: ~ if args.inputs.click~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~ # if the horizontal distance between the player and enemy is greater than 300 pixels~ +** Processing line: ~ if (args.state.player.x - args.state.enemy.x).abs > 300~ +** Processing line: ~ # change in x will be more drastic since player and enemy are so far apart~ +** Processing line: ~ volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i|~ +** Processing line: ~ args.state.enemy.hammer_queue << { # stores hammer values in a hash~ +** Processing line: ~ x: args.state.enemy.x,~ +** Processing line: ~ w: args.state.hammer_size,~ +** Processing line: ~ h: args.state.hammer_size,~ +** Processing line: ~ dx: volley_dx, # change in horizontal position~ +** Processing line: ~ # multiplication operator takes precedence over addition operator~ +** Processing line: ~ throw_at: args.state.tick_count + i * args.state.gap_between_hammers~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # $gtk.reset~ +** Processing line: ~ # add elements from hammer_queue collection to the hammers collection by~ +** Processing line: ~ # finding all hammers that were thrown before the current frame (have already been thrown)~ +** Processing line: ~ args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h|~ +** Processing line: ~ h[:throw_at] < args.state.tick_count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # you can make own variations of animations using this~ -** Processing line: ~ module Easing~ -** Processing line: ~ # you have access to all the built in functions: identity, flip, quad, cube, quart, quint~ -** Processing line: ~ def self.smoothest_start x~ -** Processing line: ~ quad(quint(x))~ +** Processing line: ~ args.state.enemy.hammers.each do |h| # sets values for all hammers in collection~ +** Processing line: ~ h[:y] ||= args.state.enemy.y + 130~ +** Processing line: ~ h[:dy] ||= args.state.hammer_upward_launch_power~ +** Processing line: ~ h[:dy] += args.state.gravity # acceleration is change in gravity~ +** Processing line: ~ h[:x] += h[:dx] # incremented by change in position~ +** Processing line: ~ h[:y] += h[:dy]~ +** Processing line: ~ h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.smoothest_stop x~ -** Processing line: ~ flip(quad(quint(flip(x))))~ +** Processing line: ~ # reject hammers that have been thrown before current frame (have already been thrown)~ +** Processing line: ~ args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h|~ +** Processing line: ~ h[:throw_at] < args.state.tick_count~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # this is the source for the existing easing functions~ -** Processing line: ~ def self.identity x~ -** Processing line: ~ x~ +** Processing line: ~ # any hammers with a y position less than 0 are rejected from the hammers collection~ +** Processing line: ~ # since they have gone too far down (outside the scope's screen)~ +** Processing line: ~ args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 }~ +** Processing line: ~~ +** Processing line: ~ # if there are any hammers that intersect with (or hit) the player,~ +** Processing line: ~ # the reset_player method is called (so the game can start over)~ +** Processing line: ~ if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) }~ +** Processing line: ~ reset_player args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.flip x~ -** Processing line: ~ 1 - x~ +** Processing line: ~ # if the enemy's rect intersects with (or hits) the player,~ +** Processing line: ~ # the reset_player method is called (so the game can start over)~ +** Processing line: ~ if args.state.enemy.rect.intersect_rect? args.state.player.rect~ +** Processing line: ~ reset_player args~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.quad x~ -** Processing line: ~ x * x~ +** Processing line: ~ # Resets the player by changing its properties back to the values they had at initialization~ +** Processing line: ~ def reset_player args~ +** Processing line: ~ args.state.player.x = 0~ +** Processing line: ~ args.state.player.y = args.state.bridge_top~ +** Processing line: ~ args.state.player.dy = 0~ +** Processing line: ~ args.state.player.dx = 0~ +** Processing line: ~ args.state.enemy.hammers.clear # empties hammer collection~ +** Processing line: ~ args.state.enemy.hammer_queue.clear # empties hammer_queue~ +** Processing line: ~ args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Processes input from the user to move the player~ +** Processing line: ~ def input args~ +** Processing line: ~ if args.inputs.keyboard.space # if the user presses the space bar~ +** Processing line: ~ args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame~ +** Processing line: ~~ +** Processing line: ~ # if the time that has passed since the jump is less than the player's jump duration and~ +** Processing line: ~ # the player is not falling~ +** Processing line: ~ if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling~ +** Processing line: ~ args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.cube x~ -** Processing line: ~ x * x * x~ +** Processing line: ~ # if the space bar is in the "up" state (or not being pressed down)~ +** Processing line: ~ if args.inputs.keyboard.key_up.space~ +** Processing line: ~ args.state.player.jumped_at = nil # jumped_at is empty~ +** Processing line: ~ args.state.player.falling = true # the player is falling~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.quart x~ -** Processing line: ~ x * x * x * x * x~ +** Processing line: ~ if args.inputs.keyboard.left # if left key is pressed~ +** Processing line: ~ args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)~ +** Processing line: ~ # dx is either set to current dx or the negative max run speed (which would be -10),~ +** Processing line: ~ # whichever has a greater value~ +** Processing line: ~ args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)~ +** Processing line: ~ elsif args.inputs.keyboard.right # if right key is pressed~ +** Processing line: ~ args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)~ +** Processing line: ~ # dx is either set to current dx or max run speed (which would be 10),~ +** Processing line: ~ # whichever has a lesser value~ +** Processing line: ~ args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)~ +** Processing line: ~ else~ +** Processing line: ~ args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def self.quint x~ -** Processing line: ~ x * x * x * x * x * x~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 08_lerping_easing_functions/02_cubic_bezier/app/main.rb~ +** Processing line: ~* Physics And Collisions - Entities - main.rb~ - H1 detected. -- Formatting line: ~08_lerping_easing_functions/02_cubic_bezier/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Entities - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.background_color = [33, 33, 33]~ -** Processing line: ~ args.outputs.lines << bezier(100, 100,~ -** Processing line: ~ 100, 620,~ -** Processing line: ~ 1180, 620,~ -** Processing line: ~ 1180, 100,~ -** Processing line: ~ 0)~ +** Processing line: ~ # ./samples/04_physics_and_collisions/03_entities/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ args.outputs.lines << bezier(100, 100,~ -** Processing line: ~ 100, 620,~ -** Processing line: ~ 1180, 620,~ -** Processing line: ~ 1180, 100,~ -** Processing line: ~ 20)~ -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ ** Processing line: ~~ -** Processing line: ~ def bezier x1, y1, x2, y2, x3, y3, x4, y4, step~ -** Processing line: ~ step ||= 0~ -** Processing line: ~ color = [200, 200, 200]~ -** Processing line: ~ points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ +** Processing line: ~ For example, you can derive an array of odd numbers from an original array of~ +** Processing line: ~ numbers 1 through 10 by rejecting all elements that are even (or divisible by 2).~ ** Processing line: ~~ -** Processing line: ~ points.each_cons(2).map do |p1, p2|~ -** Processing line: ~ [p1, p2, color]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ In this sample app, new_entity is used to define the properties of enemies and bullets.~ +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ ** Processing line: ~~ -** Processing line: ~ def points_for_bezier p1, p2, p3, p4, step~ -** Processing line: ~ points = []~ -** Processing line: ~ if step == 0~ -** Processing line: ~ [p1, p2, p3, p4]~ -** Processing line: ~ else~ -** Processing line: ~ t_step = 1.fdiv(step + 1)~ -** Processing line: ~ t = 0~ -** Processing line: ~ t += t_step~ -** Processing line: ~ points = []~ -** Processing line: ~ while t < 1~ -** Processing line: ~ points << [~ -** Processing line: ~ b_for_t(p1.x, p2.x, p3.x, p4.x, t),~ -** Processing line: ~ b_for_t(p1.y, p2.y, p3.y, p4.y, t),~ -** Processing line: ~ ]~ -** Processing line: ~ t += t_step~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ [~ -** Processing line: ~ p1,~ -** Processing line: ~ *points,~ -** Processing line: ~ p4~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def b_for_t v0, v1, v2, v3, t~ -** Processing line: ~ pow(1 - t, 3) * v0 +~ -** Processing line: ~ 3 * pow(1 - t, 2) * t * v1 +~ -** Processing line: ~ 3 * (1 - t) * pow(t, 2) * v2 +~ -** Processing line: ~ pow(t, 3) * v3~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label on the screen.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ ** Processing line: ~~ -** Processing line: ~ def pow n, to~ -** Processing line: ~ n ** to~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ ** Processing line: ~~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~* 08_lerping_easing_functions/03_easing_using_spline/app/main.rb~ -- H1 detected. -- Formatting line: ~08_lerping_easing_functions/03_easing_using_spline/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # This sample app shows enemies that contain an id value and the time they were created.~ +** Processing line: ~ # These enemies can be removed by shooting at them with bullets.~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. +** Processing line: ~ # Calls all methods necessary for the game to function properly.~ ** Processing line: ~ def tick args~ -** Processing line: ~ args.state.duration = 10.seconds~ -** Processing line: ~ args.state.spline = [~ -** Processing line: ~ [0.0, 0.33, 0.66, 1.0],~ -** Processing line: ~ [1.0, 1.0, 1.0, 1.0],~ -** Processing line: ~ [1.0, 0.66, 0.33, 0.0],~ -** Processing line: ~ ]~ -** Processing line: ~~ -** Processing line: ~ args.state.simulation_tick = args.state.tick_count % args.state.duration~ -** Processing line: ~ progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline~ -** Processing line: ~ args.outputs.borders << args.grid.rect~ -** Processing line: ~ args.outputs.solids << [20 + 1240 * progress,~ -** Processing line: ~ 20 + 680 * progress,~ -** Processing line: ~ 20, 20].anchor_rect(0.5, 0.5)~ -** Processing line: ~ args.outputs.labels << [10,~ -** Processing line: ~ 710,~ -** Processing line: ~ "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb~ -- H1 detected. -- Formatting line: ~08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def new_star args~ -** Processing line: ~ { x: 1280.randomize(:ratio),~ -** Processing line: ~ starting_y: 800,~ -** Processing line: ~ distance_to_travel: 900 + 100.randomize(:ratio),~ -** Processing line: ~ duration: 100.randomize(:ratio) + 60,~ -** Processing line: ~ created_at: args.state.tick_count,~ -** Processing line: ~ max_alpha: 128.randomize(:ratio) + 128,~ -** Processing line: ~ b: 255.randomize(:ratio),~ -** Processing line: ~ g: 200.randomize(:ratio),~ -** Processing line: ~ w: 1.randomize(:ratio) + 1,~ -** Processing line: ~ h: 1.randomize(:ratio) + 1 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def new_enemy args~ -** Processing line: ~ { x: 1280.randomize(:ratio),~ -** Processing line: ~ starting_y: 800,~ -** Processing line: ~ distance_to_travel: -900,~ -** Processing line: ~ duration: 60.randomize(:ratio) + 180,~ -** Processing line: ~ created_at: args.state.tick_count,~ -** Processing line: ~ w: 32,~ -** Processing line: ~ h: 32,~ -** Processing line: ~ fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def new_bullet args, starting_x, starting_y, enemy_speed~ -** Processing line: ~ { x: starting_x,~ -** Processing line: ~ starting_y: starting_y,~ -** Processing line: ~ distance_to_travel: -900,~ -** Processing line: ~ created_at: args.state.tick_count,~ -** Processing line: ~ duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs,~ -** Processing line: ~ w: 5,~ -** Processing line: ~ h: 5 }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def new_player_bullet args, starting_x, starting_y, player_speed~ -** Processing line: ~ { x: starting_x,~ -** Processing line: ~ starting_y: starting_y,~ -** Processing line: ~ distance_to_travel: 900,~ -** Processing line: ~ created_at: args.state.tick_count,~ -** Processing line: ~ duration: 900 / (player_speed + 2.0),~ -** Processing line: ~ w: 5,~ -** Processing line: ~ h: 5 }~ +** Processing line: ~ tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet."~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ +** Processing line: ~ process_inputs args~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Sets default values~ +** Processing line: ~ # Enemies and bullets start off as empty collections~ ** Processing line: ~ def defaults args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.state.score ||= 0~ -** Processing line: ~ args.state.stars ||= []~ -** Processing line: ~ args.state.enemies ||= []~ -** Processing line: ~ args.state.bullets ||= []~ -** Processing line: ~ args.state.player_bullets ||= []~ -** Processing line: ~ args.state.max_stars = 50~ -** Processing line: ~ args.state.max_enemies = 10~ -** Processing line: ~ args.state.player.x ||= 640~ -** Processing line: ~ args.state.player.y ||= 100~ -** Processing line: ~ args.state.player.w ||= 32~ -** Processing line: ~ args.state.player.h ||= 32~ -** Processing line: ~~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars.clear~ -** Processing line: ~ args.state.max_stars.times do~ -** Processing line: ~ s = new_star args~ -** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ -** Processing line: ~ args.state.stars << s~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.enemies.clear~ -** Processing line: ~ args.state.max_enemies.times do~ -** Processing line: ~ s = new_enemy args~ -** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ -** Processing line: ~ args.state.enemies << s~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ args.state.enemies ||= []~ +** Processing line: ~ args.state.bullets ||= []~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input args~ -** Processing line: ~ if args.inputs.keyboard.left~ -** Processing line: ~ args.state.player.x -= 5~ -** Processing line: ~ elsif args.inputs.keyboard.right~ -** Processing line: ~ args.state.player.x += 5~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.up~ -** Processing line: ~ args.state.player.y += 5~ -** Processing line: ~ elsif args.inputs.keyboard.down~ -** Processing line: ~ args.state.player.y -= 5~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.key_down.space~ -** Processing line: ~ args.state.player_bullets << new_player_bullet(args,~ -** Processing line: ~ args.state.player.x + args.state.player.w.half,~ -** Processing line: ~ args.state.player.y + args.state.player.h, 5)~ +** Processing line: ~ # Provides each enemy in enemies collection with rectangular border,~ +** Processing line: ~ # as well as a label showing id and when they were created~ +** Processing line: ~ def render args~ +** Processing line: ~ # When you're calling a method that takes no arguments, you can use this & syntax on map.~ +** Processing line: ~ # Numbers are being added to x and y in order to keep the text within the enemy's borders.~ +** Processing line: ~ args.outputs.borders << args.state.enemies.map(&:rect)~ +** Processing line: ~ args.outputs.labels << args.state.enemies.flat_map do |enemy|~ +** Processing line: ~ [~ +** Processing line: ~ [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0],~ +** Processing line: ~ [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created~ +** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w)~ -** Processing line: ~ args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h)~ +** Processing line: ~ # Outputs bullets in bullets collection as rectangular solids~ +** Processing line: ~ args.outputs.solids << args.state.bullets.map(&:rect)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def completed? entity~ -** Processing line: ~ (entity[:created_at] + entity[:duration]).elapsed_time > 0~ +** Processing line: ~ # Calls all methods necessary for performing calculations~ +** Processing line: ~ def calc args~ +** Processing line: ~ add_new_enemies_if_needed args~ +** Processing line: ~ move_bullets args~ +** Processing line: ~ calculate_collisions args~ +** Processing line: ~ remove_bullets_of_screen args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_stars args~ -** Processing line: ~ if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0~ -** Processing line: ~ stars_to_add.times { args.state.stars << new_star(args) }~ -** Processing line: ~ end~ -** Processing line: ~ args.state.stars = args.state.stars.reject { |s| completed? s }~ -** Processing line: ~ end~ +** Processing line: ~ # Adds enemies to the enemies collection and sets their values~ +** Processing line: ~ def add_new_enemies_if_needed args~ +** Processing line: ~ return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added~ +** Processing line: ~ return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added~ ** Processing line: ~~ -** Processing line: ~ def move_enemies args~ -** Processing line: ~ if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0~ -** Processing line: ~ enemies_to_add.times { args.state.enemies << new_enemy(args) }~ +** Processing line: ~ args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total~ +** Processing line: ~ args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity~ +** Processing line: ~ e.x = 640 + 500 * rand # each enemy is given random position on screen~ +** Processing line: ~ e.y = 600 * rand + 50~ +** Processing line: ~ e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.state.enemies = args.state.enemies.reject { |s| completed? s }~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Moves bullets across screen~ +** Processing line: ~ # Sets definition of the bullets~ ** Processing line: ~ def move_bullets args~ -** Processing line: ~ args.state.enemies.each do |e|~ -** Processing line: ~ if args.state.tick_count.mod_zero?(e[:fire_rate])~ -** Processing line: ~ args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration])~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.state.bullets = args.state.bullets.reject { |s| completed? s }~ -** Processing line: ~ args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s }~ -** Processing line: ~ end~ +** Processing line: ~ args.state.bullets.each do |bullet| # perform action on each bullet in collection~ +** Processing line: ~ bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)~ ** Processing line: ~~ -** Processing line: ~ def intersect? entity_one, entity_two~ -** Processing line: ~ entity_one.merge(y: current_y(entity_one))~ -** Processing line: ~ .intersect_rect? entity_two.merge(y: current_y(entity_two))~ +** Processing line: ~ # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out~ +** Processing line: ~ # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to~ +** Processing line: ~ # see what happens to the bullet's movement.~ +** Processing line: ~ bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)~ +** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def kill args~ -** Processing line: ~ bullets_hitting_enemies = []~ -** Processing line: ~ dead_bullets = []~ -** Processing line: ~ dead_enemies = []~ -** Processing line: ~~ -** Processing line: ~ args.state.player_bullets.each do |b|~ -** Processing line: ~ args.state.enemies.each do |e|~ -** Processing line: ~ if intersect? b, e~ -** Processing line: ~ dead_bullets << b~ -** Processing line: ~ dead_enemies << e~ +** Processing line: ~ # Determines if a bullet hits an enemy~ +** Processing line: ~ def calculate_collisions args~ +** Processing line: ~ args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections~ +** Processing line: ~ args.state.enemies.each do |enemy|~ +** Processing line: ~ # if bullet has not exploded yet and the bullet hits an enemy~ +** Processing line: ~ if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)~ +** Processing line: ~ bullet.exploded = true # bullet explodes~ +** Processing line: ~ enemy.dead = true # enemy is killed~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.score += dead_enemies.length~ -** Processing line: ~~ -** Processing line: ~ args.state.player_bullets.reject! { |b| dead_bullets.include? b }~ -** Processing line: ~ args.state.enemies.reject! { |e| dead_enemies.include? e }~ -** Processing line: ~~ -** Processing line: ~ dead = args.state.bullets.any? do |b|~ -** Processing line: ~ [args.state.player.x,~ -** Processing line: ~ args.state.player.y,~ -** Processing line: ~ args.state.player.w,~ -** Processing line: ~ args.state.player.h].intersect_rect? b.merge(y: current_y(b))~ -** Processing line: ~ end~ -** Processing line: ~ return unless dead~ -** Processing line: ~ args.gtk.reset~ -** Processing line: ~ defaults args~ +** Processing line: ~ # All exploded bullets are rejected or removed from the bullets collection~ +** Processing line: ~ # and any dead enemy is rejected from the enemies collection.~ +** Processing line: ~ args.state.bullets = args.state.bullets.reject(&:exploded)~ +** Processing line: ~ args.state.enemies = args.state.enemies.reject(&:dead)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc args~ -** Processing line: ~ calc_stars args~ -** Processing line: ~ move_enemies args~ -** Processing line: ~ move_bullets args~ -** Processing line: ~ kill args~ +** Processing line: ~ # Bullets are rejected from bullets collection once their position exceeds the width of screen~ +** Processing line: ~ def remove_bullets_of_screen args~ +** Processing line: ~ args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def current_y entity~ -** Processing line: ~ entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity))~ +** Processing line: ~ # Calls fire_bullet method~ +** Processing line: ~ def process_inputs args~ +** Processing line: ~ fire_bullet args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ args.outputs.solids << args.state.stars.map do |s|~ -** Processing line: ~ [s[:x],~ -** Processing line: ~ current_y(s),~ -** Processing line: ~ s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.borders << args.state.enemies.map do |s|~ -** Processing line: ~ [s[:x],~ -** Processing line: ~ current_y(s),~ -** Processing line: ~ s[:w], s[:h], 255, 0, 0]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.outputs.borders << args.state.bullets.map do |b|~ -** Processing line: ~ [b[:x],~ -** Processing line: ~ current_y(b),~ -** Processing line: ~ b[:w], b[:h], 255, 0, 0]~ +** Processing line: ~ # Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection~ +** Processing line: ~ def fire_bullet args~ +** Processing line: ~ return unless args.inputs.mouse.click # return unless mouse is clicked~ +** Processing line: ~ args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity~ +** Processing line: ~ bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked~ +** Processing line: ~ bullet.x = 0 # starts on the left side of the screen~ +** Processing line: ~ bullet.size = 10~ +** Processing line: ~ bullet.speed = 10 * rand + 2 # speed of a bullet is randomized~ +** Processing line: ~ bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.borders << args.state.player_bullets.map do |b|~ -** Processing line: ~ [b[:x],~ -** Processing line: ~ current_y(b),~ -** Processing line: ~ b[:w], b[:h], 255, 255, 255]~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.space ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.borders << [args.state.player.x,~ -** Processing line: ~ args.state.player.y,~ -** Processing line: ~ args.state.player.w,~ -** Processing line: ~ args.state.player.h, 255, 255, 255]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args~ -** Processing line: ~ input args~ -** Processing line: ~ calc args~ -** Processing line: ~ render args~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 09_performance/01_sprites_as_hash/app/main.rb~ +** Processing line: ~* Physics And Collisions - Box Collision - main.rb~ - H1 detected. -- Formatting line: ~09_performance/01_sprites_as_hash/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Box Collision - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # Sprites represented as Hashes using the queue ~args.outputs.sprites~~ -** Processing line: ~ # code up, but are the "slowest" to render.~ -** Processing line: ~ # The reason for this is the access of the key in the Hash and also~ -** Processing line: ~ # because the data args.outputs.sprites is cleared every tick.~ -** Processing line: ~ def random_x args~ -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def random_y args~ -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/04_physics_and_collisions/04_box_collision/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ def random_speed~ -** Processing line: ~ 1 + (4.randomize :ratio)~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ def new_star args~ -** Processing line: ~ {~ -** Processing line: ~ x: (random_x args),~ -** Processing line: ~ y: (random_y args),~ -** Processing line: ~ w: 4, h: 4, path: 'sprites/tiny-star.png',~ -** Processing line: ~ s: random_speed~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ - first: Returns the first element of the array.~ +** Processing line: ~ For example, if we have an array~ +** Processing line: ~ numbers = [1, 2, 3, 4, 5]~ +** Processing line: ~ and we call first by saying~ +** Processing line: ~ numbers.first~ +** Processing line: ~ the number 1 will be returned because it is the first element of the numbers array.~ ** Processing line: ~~ -** Processing line: ~ def move_star args, star~ -** Processing line: ~ star.x += star[:s]~ -** Processing line: ~ star.y += star[:s]~ -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ -** Processing line: ~ star.x = (random_x args)~ -** Processing line: ~ star.y = (random_y args)~ -** Processing line: ~ star[:s] = random_speed~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ +** Processing line: ~ For example,~ +** Processing line: ~ 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer.~ +** Processing line: ~ 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal.~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.star_count ||= 0~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ -** Processing line: ~ end~ +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#intersect_rect?: An array with at least four values is~ +** Processing line: ~ considered a rect. The intersect_rect? function returns true~ +** Processing line: ~ or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ # update~ -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ ** Processing line: ~~ -** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app allows users to create tiles and place them anywhere on the screen as obstacles.~ +** Processing line: ~ # The player can then move and maneuver around them.~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ class PoorManPlatformerPhysics~ +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ ** Processing line: ~~ +** Processing line: ~ # Calls all methods necessary for the app to run successfully.~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ process_inputs~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 09_performance/02_sprites_as_entities/app/main.rb~ -- H1 detected. -- Formatting line: ~09_performance/02_sprites_as_entities/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Sets default values for variables.~ +** Processing line: ~ # The ||= sign means that the variable will only be set to the value following the = sign if the value has~ +** Processing line: ~ # not already been set before. Intialization happens only in the first frame.~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.tile_size = 64~ +** Processing line: ~ state.gravity = -0.2~ +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ +** Processing line: ~ state.x ||= 0~ +** Processing line: ~ state.y ||= 800~ +** Processing line: ~ state.dy ||= 0~ +** Processing line: ~ state.dx ||= 0~ +** Processing line: ~ state.world ||= []~ +** Processing line: ~ state.world_lookup ||= {}~ +** Processing line: ~ state.world_collision_rects ||= []~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Sprites represented as Entities using the queue ~args.outputs.sprites~~ -** Processing line: ~ # yields nicer access apis over Hashes, but require a bit more code upfront.~ -** Processing line: ~ # The hash sample has to use star[:s] to get the speed of the star, but~ -** Processing line: ~ # an entity can use .s instead.~ -** Processing line: ~ def random_x args~ -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs solids and borders of different colors for the world and collision_rects collections.~ +** Processing line: ~ def render~ ** Processing line: ~~ -** Processing line: ~ def random_y args~ -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ -** Processing line: ~ end~ +** Processing line: ~ # Sets a black background on the screen (Comment this line out and the background will become white.)~ +** Processing line: ~ # Also note that black is the default color for when no color is assigned.~ +** Processing line: ~ outputs.solids << grid.rect~ ** Processing line: ~~ -** Processing line: ~ def random_speed~ -** Processing line: ~ 1 + (4.randomize :ratio)~ -** Processing line: ~ end~ +** Processing line: ~ # The position, size, and color (white) are set for borders given to the world collection.~ +** Processing line: ~ # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.~ +** Processing line: ~ outputs.borders << state.world.map do |x, y|~ +** Processing line: ~ [x * state.tile_size,~ +** Processing line: ~ y * state.tile_size,~ +** Processing line: ~ state.tile_size,~ +** Processing line: ~ state.tile_size, 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def new_star args~ -** Processing line: ~ args.state.new_entity :star, {~ -** Processing line: ~ x: (random_x args),~ -** Processing line: ~ y: (random_y args),~ -** Processing line: ~ w: 4, h: 4,~ -** Processing line: ~ path: 'sprites/tiny-star.png',~ -** Processing line: ~ s: random_speed~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # The top, bottom, and sides of the borders for collision_rects are different colors.~ +** Processing line: ~ outputs.borders << state.world_collision_rects.map do |e|~ +** Processing line: ~ [~ +** Processing line: ~ [e[:top], 0, 170, 0], # top is a shade of green~ +** Processing line: ~ [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue~ +** Processing line: ~ [e[:left_right], 170, 0, 0], # left and right are a shade of red~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def move_star args, star~ -** Processing line: ~ star.x += star.s~ -** Processing line: ~ star.y += star.s~ -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ -** Processing line: ~ star.x = (random_x args)~ -** Processing line: ~ star.y = (random_y args)~ -** Processing line: ~ star.s = random_speed~ +** Processing line: ~ # Sets the position, size, and color (a shade of green) of the borders of only the player's~ +** Processing line: ~ # box and outputs it. If you change the 180 to 0, the player's box will be black and you~ +** Processing line: ~ # won't be able to see it (because it will match the black background).~ +** Processing line: ~ outputs.borders << [state.x,~ +** Processing line: ~ state.y,~ +** Processing line: ~ state.tile_size,~ +** Processing line: ~ state.tile_size, 0, 180, 0]~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.star_count ||= 0~ ** Processing line: ~~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ # Calls methods needed to perform calculations.~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_world_lookup~ +** Processing line: ~ calc_player~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # update~ -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ +** Processing line: ~ # Performs calculations on world_lookup and sets values.~ +** Processing line: ~ def calc_world_lookup~ ** Processing line: ~~ -** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ +** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ +** Processing line: ~ # the previous tile size is set to the tile size,~ +** Processing line: ~ # and world_lookup hash is set to empty.~ +** Processing line: ~ if state.tile_size != state.previous_tile_size~ +** Processing line: ~ state.previous_tile_size = state.tile_size~ +** Processing line: ~ state.world_lookup = {} # empty hash~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ -** Processing line: ~ end~ +** Processing line: ~ # return if the world_lookup hash has keys (or, in other words, is not empty)~ +** Processing line: ~ # return unless the world collection has values inside of it (or is not empty)~ +** Processing line: ~ return if state.world_lookup.keys.length > 0~ +** Processing line: ~ return unless state.world.length > 0~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Starts with an empty hash for world_lookup.~ +** Processing line: ~ # Searches through the world and finds the coordinates that exist.~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ ** Processing line: ~~ +** Processing line: ~ # Assigns world_collision_rects for every sprite drawn.~ +** Processing line: ~ state.world_collision_rects =~ +** Processing line: ~ state.world_lookup~ +** Processing line: ~ .keys~ +** Processing line: ~ .map do |coord_x, coord_y|~ +** Processing line: ~ s = state.tile_size~ +** Processing line: ~ # multiply by tile size so the grid coordinates; sets pixel value~ +** Processing line: ~ # don't forget that position is denoted by bottom left corner~ +** Processing line: ~ # set x = coord_x or y = coord_y and see what happens!~ +** Processing line: ~ x = s * coord_x~ +** Processing line: ~ y = s * coord_y~ +** Processing line: ~ {~ +** Processing line: ~ # The values added to x, y, and s position the world_collision_rects so they all appear~ +** Processing line: ~ # stacked (on top of world rects) but don't directly overlap.~ +** Processing line: ~ # Remove these added values and mess around with the rect placement!~ +** Processing line: ~ args: [coord_x, coord_y],~ +** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ +** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ +** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 09_performance/03_sprites_as_strict_entities/app/main.rb~ -- H1 detected. -- Formatting line: ~09_performance/03_sprites_as_strict_entities/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Performs calculations to change the x and y values of the player's box.~ +** Processing line: ~ def calc_player~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ -** Processing line: ~ # yields apis access similar to Entities, but all properties that can be set on the~ -** Processing line: ~ # entity must be predefined with a default value. Strict entities do not support the~ -** Processing line: ~ # addition of new properties after the fact. They are more performant than OpenEntities~ -** Processing line: ~ # because of this constraint.~ -** Processing line: ~ def random_x args~ -** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ -** Processing line: ~ end~ +** Processing line: ~ # Since acceleration is the change in velocity, the change in y (dy) increases every frame.~ +** Processing line: ~ # What goes up must come down because of gravity.~ +** Processing line: ~ state.dy += state.gravity~ ** Processing line: ~~ -** Processing line: ~ def random_y args~ -** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ -** Processing line: ~ end~ +** Processing line: ~ # Calls the calc_box_collision and calc_edge_collision methods.~ +** Processing line: ~ calc_box_collision~ +** Processing line: ~ calc_edge_collision~ ** Processing line: ~~ -** Processing line: ~ def random_speed~ -** Processing line: ~ 1 + (4.randomize :ratio)~ -** Processing line: ~ end~ +** Processing line: ~ # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.~ +** Processing line: ~ state.y += state.dy~ +** Processing line: ~ state.x += state.dx~ ** Processing line: ~~ -** Processing line: ~ def new_star args~ -** Processing line: ~ args.state.new_entity_strict(:star,~ -** Processing line: ~ x: (random_x args),~ -** Processing line: ~ y: (random_y args),~ -** Processing line: ~ w: 4, h: 4,~ -** Processing line: ~ path: 'sprites/tiny-star.png',~ -** Processing line: ~ s: random_speed) do |entity|~ -** Processing line: ~ # invoke attr_sprite so that it responds to~ -** Processing line: ~ # all properties that are required to render a sprite~ -** Processing line: ~ entity.attr_sprite~ +** Processing line: ~ # Scales dx down.~ +** Processing line: ~ state.dx *= 0.8~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def move_star args, star~ -** Processing line: ~ star.x += star.s~ -** Processing line: ~ star.y += star.s~ -** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ -** Processing line: ~ star.x = (random_x args)~ -** Processing line: ~ star.y = (random_y args)~ -** Processing line: ~ star.s = random_speed~ +** Processing line: ~ # Calls methods needed to determine collisions between player and world_collision rects.~ +** Processing line: ~ def calc_box_collision~ +** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ +** Processing line: ~ collision_floor!~ +** Processing line: ~ collision_left!~ +** Processing line: ~ collision_right!~ +** Processing line: ~ collision_ceiling!~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.state.star_count ||= 0~ +** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ +** Processing line: ~ def collision_floor!~ +** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ +** Processing line: ~ player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player~ ** Processing line: ~~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ -** Processing line: ~ end~ +** Processing line: ~ # Goes through world_collision_rects to find all intersections between the bottom of player's rect and~ +** Processing line: ~ # the top of a world_collision_rect (hence the "-0.1" above)~ +** Processing line: ~ floor_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ +** Processing line: ~ return unless floor_collisions # return unless collision occurred~ +** Processing line: ~ state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect~ +** Processing line: ~ state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # update~ -** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ -** Processing line: ~~ -** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 09_performance/04_sprites_as_classes/app/main.rb~ -- H1 detected. -- Formatting line: ~09_performance/04_sprites_as_classes/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ -** Processing line: ~ # gives you full control of property declaration and method invocation.~ -** Processing line: ~ # They are more performant than OpenEntities and StrictEntities, but more code upfront.~ -** Processing line: ~ class Star~ -** Processing line: ~ attr_sprite~ -** Processing line: ~~ -** Processing line: ~ def initialize grid~ -** Processing line: ~ @grid = grid~ -** Processing line: ~ @x = (rand @grid.w) * -1~ -** Processing line: ~ @y = (rand @grid.h) * -1~ -** Processing line: ~ @w = 4~ -** Processing line: ~ @h = 4~ -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ -** Processing line: ~ @path = 'sprites/tiny-star.png'~ -** Processing line: ~ end~ +** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ +** Processing line: ~ def collision_left!~ +** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ +** Processing line: ~ player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~ def move~ -** Processing line: ~ @x += @s~ -** Processing line: ~ @y += @s~ -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Goes through world_collision_rects to find all intersections beween the player's left side and the~ +** Processing line: ~ # right side of a world_collision_rect.~ +** Processing line: ~ left_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~ # calls methods needed for game to run properly~ -** Processing line: ~ def tick args~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ -** Processing line: ~ end~ +** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ +** Processing line: ~ # player's x is set to the value of the x of the collided rect's right side~ +** Processing line: ~ state.x = left_side_collisions[:left_right].right~ +** Processing line: ~ state.dx = 0 # player isn't moving left because its path is blocked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # update~ -** Processing line: ~ args.state.stars.each(&:move)~ -** Processing line: ~~ -** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ -** Processing line: ~ end~ +** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ +** Processing line: ~ def collision_right!~ +** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ +** Processing line: ~ player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Goes through world_collision_rects to find all intersections between the player's right side~ +** Processing line: ~ # and the left side of a world_collision_rect (hence the "+0.1" above)~ +** Processing line: ~ right_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ +** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ ** Processing line: ~~ -** Processing line: ~* 09_performance/05_static_sprites_as_classes/app/main.rb~ -- H1 detected. -- Formatting line: ~09_performance/05_static_sprites_as_classes/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # player's x is set to the value of the collided rect's left, minus the size of a rect~ +** Processing line: ~ # tile size is subtracted because player's position is denoted by bottom left corner~ +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ +** Processing line: ~ state.dx = 0 # player isn't moving right because its path is blocked~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ -** Processing line: ~ # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held~ -** Processing line: ~ # by reference. You get better performance, but you are mutating state of held objects~ -** Processing line: ~ # which is less functional/data oriented.~ -** Processing line: ~ class Star~ -** Processing line: ~ attr_sprite~ +** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ +** Processing line: ~ def collision_ceiling!~ +** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ +** Processing line: ~ player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~ def initialize grid~ -** Processing line: ~ @grid = grid~ -** Processing line: ~ @x = (rand @grid.w) * -1~ -** Processing line: ~ @y = (rand @grid.h) * -1~ -** Processing line: ~ @w = 4~ -** Processing line: ~ @h = 4~ -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ -** Processing line: ~ @path = 'sprites/tiny-star.png'~ -** Processing line: ~ end~ +** Processing line: ~ # Goes through world_collision_rects to find intersections between the bottom of a~ +** Processing line: ~ # world_collision_rect and the top of the player's rect (hence the "+0.1" above)~ +** Processing line: ~ ceil_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~ def move~ -** Processing line: ~ @x += @s~ -** Processing line: ~ @y += @s~ -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ ** Processing line: ~~ -** Processing line: ~ # calls methods needed for game to run properly~ -** Processing line: ~ def tick args~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ # player's y is set to the bottom y of the rect it collided with, minus the size of a rect~ +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ +** Processing line: ~ state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ -** Processing line: ~ end~ +** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ +** Processing line: ~ def calc_edge_collision~ ** Processing line: ~~ -** Processing line: ~ # update~ -** Processing line: ~ args.state.stars.each(&:move)~ +** Processing line: ~ #Ensures that the player doesn't fall below the map.~ +** Processing line: ~ if state.y < 0~ +** Processing line: ~ state.y = 0~ +** Processing line: ~ state.dy = 0~ ** Processing line: ~~ -** Processing line: ~ # render~ -** Processing line: ~ args.outputs.sprites << args.state.stars~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ +** Processing line: ~ #Ensures that the player doesn't go too high.~ +** Processing line: ~ # Position of player is denoted by bottom left hand corner, which is why we have to subtract the~ +** Processing line: ~ # size of the player's box (so it remains visible on the screen)~ +** Processing line: ~ elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen~ +** Processing line: ~ state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ -** Processing line: ~ end~ +** Processing line: ~ # Ensures that the player remains in the horizontal range that it is supposed to.~ +** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right~ +** Processing line: ~ state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if player moves too far left~ +** Processing line: ~ state.x = 0 # player will remain as left as possible while remaining on screen~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Processes input from the user on the keyboard.~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ if inputs.mouse.down~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ ** Processing line: ~~ +** Processing line: ~ if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate~ +** Processing line: ~ state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space~ +** Processing line: ~ else~ +** Processing line: ~ state.world << [x, y] # If no duplicates, adds to world collection~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ -- H1 detected. -- Formatting line: ~09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys.~ +** Processing line: ~ if inputs.keyboard.key_up.right~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ elsif inputs.keyboard.key_up.left~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ -** Processing line: ~ # is the fastest approach. This is comparable to what other game engines set as the default behavior.~ -** Processing line: ~ # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing~ -** Processing line: ~ # functional/data-oriented practices.~ -** Processing line: ~ class Star~ -** Processing line: ~ def initialize grid~ -** Processing line: ~ @grid = grid~ -** Processing line: ~ @x = (rand @grid.w) * -1~ -** Processing line: ~ @y = (rand @grid.h) * -1~ -** Processing line: ~ @w = 4~ -** Processing line: ~ @h = 4~ -** Processing line: ~ @s = 1 + (4.randomize :ratio)~ -** Processing line: ~ @path = 'sprites/tiny-star.png'~ -** Processing line: ~ end~ +** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses.~ +** Processing line: ~ if inputs.keyboard.key_held.right # if right key is pressed~ +** Processing line: ~ state.dx = 3~ +** Processing line: ~ elsif inputs.keyboard.key_held.left # if left key is pressed~ +** Processing line: ~ state.dx = -3~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def move~ -** Processing line: ~ @x += @s~ -** Processing line: ~ @y += @s~ -** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ -** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ +** Processing line: ~ #Sets dy to 5 to make the player ~fly~ when they press the space bar~ +** Processing line: ~ if inputs.keyboard.key_held.space~ +** Processing line: ~ state.dy = 5~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if the object that is in args.outputs.sprites (or static_sprites)~ -** Processing line: ~ # respond_to? :draw_override, then the method is invoked giving you~ -** Processing line: ~ # access to the class used to draw to the canvas.~ -** Processing line: ~ def draw_override ffi_draw~ -** Processing line: ~ # first move then draw~ -** Processing line: ~ move~ -** Processing line: ~~ -** Processing line: ~ # The argument order for ffi.draw_sprite is:~ -** Processing line: ~ # x, y, w, h, path~ -** Processing line: ~ ffi_draw.draw_sprite @x, @y, @w, @h, @path~ +** Processing line: ~ def to_coord point~ ** Processing line: ~~ -** Processing line: ~ # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value):~ -** Processing line: ~ # x, y, w, h, path,~ -** Processing line: ~ # angle, alpha~ +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size later so the grid coordinates.~ +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The argument order for ffi_draw.draw_sprite_3 is:~ -** Processing line: ~ # x, y, w, h,~ -** Processing line: ~ # path,~ -** Processing line: ~ # angle,~ -** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ -** Processing line: ~ # flip_horizontally, flip_vertically,~ -** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ -** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ -** Processing line: ~ # source_x, source_y, source_w, source_h~ +** Processing line: ~ # Represents the tolerance for a collision between the player's rect and another rect.~ +** Processing line: ~ def collision_tollerance~ +** Processing line: ~ 0.0~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ $platformer_physics = PoorManPlatformerPhysics.new~ +** Processing line: ~~ ** Processing line: ~ def tick args~ -** Processing line: ~ # sets console command when sample app initially opens~ -** Processing line: ~ if Kernel.global_tick_count == 0~ -** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ -** Processing line: ~ end~ +** Processing line: ~ $platformer_physics.grid = args.grid~ +** Processing line: ~ $platformer_physics.inputs = args.inputs~ +** Processing line: ~ $platformer_physics.state = args.state~ +** Processing line: ~ $platformer_physics.outputs = args.outputs~ +** Processing line: ~ $platformer_physics.tick~ +** Processing line: ~ tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # init~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ -** Processing line: ~ args.outputs.static_sprites << args.state.stars~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # render framerate~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # resets game, and assigns star count given by user~ -** Processing line: ~ def reset_with count: count~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 09_performance/07_collision_limits/app/main.rb~ +** Processing line: ~* Physics And Collisions - Box Collision 2 - main.rb~ - H1 detected. -- Formatting line: ~09_performance/07_collision_limits/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Box Collision 2 - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/04_physics_and_collisions/05_box_collision_2/app/main.rb~ ** Processing line: ~ =begin~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~~ +** Processing line: ~ - times: Performs an action a specific number of times.~ +** Processing line: ~ For example, if we said~ +** Processing line: ~ 5.times puts "Hello DragonRuby",~ +** Processing line: ~ then we'd see the words "Hello DragonRuby" printed on the console 5 times.~ +** Processing line: ~~ +** Processing line: ~ - split: Divides a string into substrings based on a delimiter.~ +** Processing line: ~ For example, if we had a command~ +** Processing line: ~ "DragonRuby is awesome".split(" ")~ +** Processing line: ~ then the result would be~ +** Processing line: ~ ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter.~ +** Processing line: ~~ +** Processing line: ~ - join: Opposite of split; converts each element of array to a string separated by delimiter.~ +** Processing line: ~ For example, if we had a command~ +** Processing line: ~ ["DragonRuby","is","awesome"].join(" ")~ +** Processing line: ~ then the result would be~ +** Processing line: ~ "DragonRuby is awesome".~ ** Processing line: ~~ ** Processing line: ~ Reminders:~ -** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ -** Processing line: ~ In this sample app, we're finding all bodies that intersect with the center body.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ - to_s: Returns a string representation of an object.~ +** Processing line: ~ For example, if we had~ +** Processing line: ~ 500.to_s~ +** Processing line: ~ the string "500" would be returned.~ +** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ - elapsed_time: How many frames have passed since the click event.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.labels: An array. Values in the array generate labels on the screen.~ +** Processing line: ~ The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ ** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ +** Processing line: ~ - inputs.mouse.down: Determines whether or not the mouse is being pressed down.~ +** Processing line: ~ The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y).~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ - first: Returns the first element of the array.~ ** Processing line: ~~ -** Processing line: ~ # This code demonstrates moving objects that loop around once they exceed the scope of the screen,~ -** Processing line: ~ # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies".~ +** Processing line: ~ - num1.idiv(num2): Divides two numbers and returns an integer.~ ** Processing line: ~~ -** Processing line: ~ def body_count num~ -** Processing line: ~ $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection~ -** Processing line: ~ end~ +** Processing line: ~ - find_all: Finds all values that satisfy specific requirements.~ ** Processing line: ~~ -** Processing line: ~ def tick args~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ # Center body's values are set using an array~ -** Processing line: ~ # Map is used to set values of 2000 other bodies~ -** Processing line: ~ # All bodies that intersect with center body are stored in collisions collection~ -** Processing line: ~ args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center~ -** Processing line: ~ args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen~ +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ ** Processing line: ~~ -** Processing line: ~ # finds all bodies that intersect with center body, stores them in collisions~ -** Processing line: ~ collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body }~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ args.borders << args.state.center_body # outputs center body as a black border~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes~ -** Processing line: ~ args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid~ -** Processing line: ~ args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well~ +** Processing line: ~ MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map~ ** Processing line: ~~ -** Processing line: ~ args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner~ +** Processing line: ~ class MetroidvaniaStarter~ +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs, :gtk~ ** Processing line: ~~ -** Processing line: ~ # Bodies are returned to bottom left corner if positions exceed scope of screen~ -** Processing line: ~ args.state.other_bodies.each do |b| # for each body in the other_bodies collection~ -** Processing line: ~ b.x += 5 # x and y are both incremented by 5~ -** Processing line: ~ b.y += 5~ -** Processing line: ~ b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right)~ -** Processing line: ~ b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up)~ +** Processing line: ~ # Calls methods needed to run the game properly.~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ process_inputs~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Resets the game.~ -** Processing line: ~ $gtk.reset~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Sets all the default variables.~ +** Processing line: ~ # '||' states that initialization occurs only in the first frame.~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.tile_size = 64~ +** Processing line: ~ state.gravity = -0.2~ +** Processing line: ~ state.player_width = 60~ +** Processing line: ~ state.player_height = 64~ +** Processing line: ~ state.collision_tolerance = 0.0~ +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ +** Processing line: ~ state.x ||= 0~ +** Processing line: ~ state.y ||= 800~ +** Processing line: ~ state.dy ||= 0~ +** Processing line: ~ state.dx ||= 0~ +** Processing line: ~ attempt_load_world_from_file~ +** Processing line: ~ state.world_lookup ||= { }~ +** Processing line: ~ state.world_collision_rects ||= []~ +** Processing line: ~ state.mode ||= :creating # alternates between :creating and :selecting for sprite selection~ +** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ +** Processing line: ~ #=======================================IMPORTANT=======================================#~ +** Processing line: ~ # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc.~ +** Processing line: ~ # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have.~ +** Processing line: ~ #=======================================================================================#~ +** Processing line: ~ state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES~ +** Processing line: ~ state.sprite_coords ||= []~ +** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ +** Processing line: ~ state.sprite_selected ||= 1~ +** Processing line: ~ state.map_saved_at ||= 0~ ** Processing line: ~~ +** Processing line: ~ # Sets all the cordinate values for the sprite selection screen into a grid~ +** Processing line: ~ # Displayed when 's' is pressed by player to access sprites~ +** Processing line: ~ if state.sprite_coords == [] # if sprite_coords is an empty array~ +** Processing line: ~ count = 1~ +** Processing line: ~ temp_x = 165 # sets a starting x and y position for display~ +** Processing line: ~ temp_y = 500 + 720~ +** Processing line: ~ state.sprite_quantity.times do # for the number of sprites you have~ +** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array~ +** Processing line: ~ temp_x += 100 # increment temp_x~ +** Processing line: ~ count += 1 # increment count~ +** Processing line: ~ if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen~ +** Processing line: ~ temp_x = 165 # a new row of sprites starts~ +** Processing line: ~ temp_y -= 75 # new row of sprites starts 75 units lower than the previous row~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/01_trace_debugging/app/main.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/01_trace_debugging/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Places sprites~ +** Processing line: ~ def render~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ class Game~ -** Processing line: ~ attr_gtk~ +** Processing line: ~ # Sets the x, y, width, height, and image path for each sprite in the world collection.~ +** Processing line: ~ outputs.sprites << state.world.map do |x, y, sprite|~ +** Processing line: ~ [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location~ +** Processing line: ~ y * state.tile_size,~ +** Processing line: ~ state.tile_size,~ +** Processing line: ~ state.tile_size,~ +** Processing line: ~ 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def method1 num~ -** Processing line: ~ method2 num~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs sprite for the player by setting x, y, width, height, and image path~ +** Processing line: ~ outputs.sprites << [state.x,~ +** Processing line: ~ state.y,~ +** Processing line: ~ state.player_width,~ +** Processing line: ~ state.player_height,'sprites/player.png']~ ** Processing line: ~~ -** Processing line: ~ def method2 num~ -** Processing line: ~ method3 num~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs labels as primitives in top right of the screen~ +** Processing line: ~ outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label~ +** Processing line: ~ outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label~ ** Processing line: ~~ -** Processing line: ~ def method3 num~ -** Processing line: ~ method4 num~ -** Processing line: ~ end~ +** Processing line: ~ outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label~ +** Processing line: ~ outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label~ ** Processing line: ~~ -** Processing line: ~ def method4 num~ -** Processing line: ~ if num == 1~ -** Processing line: ~ puts "UNLUCKY #{num}."~ -** Processing line: ~ state.unlucky_count += 1~ -** Processing line: ~ if state.unlucky_count > 3~ -** Processing line: ~ raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history."~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ puts "LUCKY #{num}."~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label~ ** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ state.roll_history ||= []~ -** Processing line: ~ state.roll_history << rand(20) + 1~ -** Processing line: ~ state.countdown ||= 600~ -** Processing line: ~ state.countdown -= 1~ -** Processing line: ~ state.unlucky_count ||= 0~ -** Processing line: ~ outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1]~ -** Processing line: ~ if state.countdown > 0~ -** Processing line: ~ outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1]~ -** Processing line: ~ else~ -** Processing line: ~ state.attempts ||= 0~ -** Processing line: ~ state.attempts += 1~ -** Processing line: ~ outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1]~ +** Processing line: ~ # if the map is saved and less than 120 frames have passed, the label is displayed~ +** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ +** Processing line: ~ outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label~ ** Processing line: ~ end~ -** Processing line: ~ return if state.countdown > 0~ -** Processing line: ~ method1 state.roll_history[-1]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $game = Game.new~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # If player hits 's', following appears~ +** Processing line: ~ if state.mode == :selecting~ +** Processing line: ~ # White background for sprite selection~ +** Processing line: ~ outputs.primitives << [state.select_menu, 255, 255, 255].solid~ ** Processing line: ~~ +** Processing line: ~ # Select tile label at the top of the screen~ +** Processing line: ~ outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/02_trace_debugging_classes/app/main.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/02_trace_debugging_classes/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Places sprites in locations calculated in the defaults function~ +** Processing line: ~ outputs.primitives << state.sprite_coords.map do |x, y, order|~ +** Processing line: ~ [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ class Foobar~ -** Processing line: ~ def initialize~ -** Processing line: ~ trace! # Trace is added to the constructor.~ +** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ +** Processing line: ~ # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon~ +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y,~ +** Processing line: ~ 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def clicky args~ -** Processing line: ~ return unless args.inputs.mouse.click~ -** Processing line: ~ try_rand rand~ +** Processing line: ~ # Calls methods that perform calculations~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_in_game~ +** Processing line: ~ calc_sprite_selection~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def try_rand num~ -** Processing line: ~ return if num < 0.9~ -** Processing line: ~ raise "Exception finally occurred. Take a look at logs/trace.txt #{num}."~ +** Processing line: ~ # Calls methods that perform calculations (if in creating mode)~ +** Processing line: ~ def calc_in_game~ +** Processing line: ~ return unless state.mode == :creating~ +** Processing line: ~ calc_world_lookup~ +** Processing line: ~ calc_player~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1]~ -** Processing line: ~ args.state.foobar = Foobar.new if args.tick_count~ -** Processing line: ~ return unless args.state.foobar~ -** Processing line: ~ args.state.foobar.clicky args~ -** Processing line: ~ end~ +** Processing line: ~ def calc_world_lookup~ +** Processing line: ~ # If the tile size isn't equal to the previous tile size,~ +** Processing line: ~ # the previous tile size is set to the tile size,~ +** Processing line: ~ # and world_lookup hash is set to empty.~ +** Processing line: ~ if state.tile_size != state.previous_tile_size~ +** Processing line: ~ state.previous_tile_size = state.tile_size~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # return if world_lookup is not empty or if world is empty~ +** Processing line: ~ return if state.world_lookup.keys.length > 0~ +** Processing line: ~ return unless state.world.length > 0~ ** Processing line: ~~ +** Processing line: ~ # Searches through the world and finds the coordinates that exist~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ state.world.each { |x, y| state.world_lookup[[x, y]] = true }~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/exception_raising_tests.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/exception_raising_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Assigns collision rects for every sprite drawn~ +** Processing line: ~ state.world_collision_rects =~ +** Processing line: ~ state.world_lookup~ +** Processing line: ~ .keys~ +** Processing line: ~ .map do |coord_x, coord_y|~ +** Processing line: ~ s = state.tile_size~ +** Processing line: ~ # Multiplying by s (the size of a tile) ensures that the rect is~ +** Processing line: ~ # placed exactly where you want it to be placed (causes grid to coordinate)~ +** Processing line: ~ # How many pixels horizontally across and vertically up and down~ +** Processing line: ~ x = s * coord_x~ +** Processing line: ~ y = s * coord_y~ +** Processing line: ~ {~ +** Processing line: ~ args: [coord_x, coord_y],~ +** Processing line: ~ left_right: [x, y + 4, s, s - 6], # hash keys and values~ +** Processing line: ~ top: [x + 4, y + 6, s - 8, s - 6],~ +** Processing line: ~ bottom: [x + 1, y - 1, s - 2, s - 8],~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ begin :shared~ -** Processing line: ~ class ExceptionalClass~ -** Processing line: ~ def initialize exception_to_throw = nil~ -** Processing line: ~ raise exception_to_throw if exception_to_throw~ -** Processing line: ~ end~ +** Processing line: ~ # Calculates movement of player and calls methods that perform collision calculations~ +** Processing line: ~ def calc_player~ +** Processing line: ~ state.dy += state.gravity # what goes up must come down because of gravity~ +** Processing line: ~ calc_box_collision~ +** Processing line: ~ calc_edge_collision~ +** Processing line: ~ state.y += state.dy # Since velocity is the change in position, the change in y increases by dy~ +** Processing line: ~ state.x += state.dx # Ditto line above but dx and x~ +** Processing line: ~ state.dx *= 0.8 # Scales dx down~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_exception_in_newing_object args, assert~ -** Processing line: ~ begin~ -** Processing line: ~ ExceptionalClass.new TypeError~ -** Processing line: ~ raise "Exception wasn't thrown!"~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ assert.equal! e.class, TypeError, "Exceptions within constructor should be retained."~ +** Processing line: ~ # Calls methods that determine whether the player collides with any world_collision_rects.~ +** Processing line: ~ def calc_box_collision~ +** Processing line: ~ return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key~ +** Processing line: ~ collision_floor~ +** Processing line: ~ collision_left~ +** Processing line: ~ collision_right~ +** Processing line: ~ collision_ceiling~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ puts "running tests"~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect.~ +** Processing line: ~ def collision_floor~ +** Processing line: ~ return unless state.dy <= 0 # return unless player is going down or is as far down as possible~ +** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between player's~ +** Processing line: ~ # bottom and the top of a rect.~ +** Processing line: ~ floor_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ +** Processing line: ~ return unless floor_collisions # performs following changes if a collision has occurred~ +** Processing line: ~ state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top~ +** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/gen_docs.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/gen_docs.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Finds collisions between the player's left side and the right side of a world_collision_rect.~ +** Processing line: ~ def collision_left~ +** Processing line: ~ return unless state.dx < 0 # return unless player is moving left~ +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick~ -** Processing line: ~ Kernel.export_docs!~ +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's left side~ +** Processing line: ~ # and the right side of a rect.~ +** Processing line: ~ left_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ return unless left_side_collisions # return unless collision occurred~ +** Processing line: ~ state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side~ +** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Finds collisions between the right side of the player and the left side of a world_collision_rect.~ +** Processing line: ~ def collision_right~ +** Processing line: ~ return unless state.dx > 0 # return unless player is moving right~ +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/geometry_tests.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/geometry_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's~ +** Processing line: ~ # right side and the left side of a rect.~ +** Processing line: ~ right_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ begin :shared~ -** Processing line: ~ def primitive_representations x, y, w, h~ -** Processing line: ~ [~ -** Processing line: ~ [x, y, w, h],~ -** Processing line: ~ { x: x, y: y, w: w, h: h },~ -** Processing line: ~ RectForTest.new(x, y, w, h)~ -** Processing line: ~ ]~ +** Processing line: ~ return unless right_side_collisions # return unless collision occurred~ +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner)~ +** Processing line: ~ state.dx = 0 # no change in x because the player's path is blocked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class RectForTest~ -** Processing line: ~ attr_sprite~ -** Processing line: ~~ -** Processing line: ~ def initialize x, y, w, h~ -** Processing line: ~ @x = x~ -** Processing line: ~ @y = y~ -** Processing line: ~ @w = w~ -** Processing line: ~ @h = h~ -** Processing line: ~ end~ +** Processing line: ~ # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect.~ +** Processing line: ~ def collision_ceiling~ +** Processing line: ~ return unless state.dy > 0 # return unless player is moving up~ +** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ ** Processing line: ~~ -** Processing line: ~ def to_s~ -** Processing line: ~ "RectForTest: #{[x, y, w, h]}"~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Runs through all the sprites on the field and finds all intersections between the player's top~ +** Processing line: ~ # and the bottom of a rect.~ +** Processing line: ~ ceil_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ ** Processing line: ~~ -** Processing line: ~ begin :intersect_rect?~ -** Processing line: ~ def test_intersect_rect_point args, assert~ -** Processing line: ~ assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect."~ +** Processing line: ~ return unless ceil_collisions # return unless collision occurred~ +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size)~ +** Processing line: ~ state.dy = 0 # no change in y because the player's path is blocked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_intersect_rect args, assert~ -** Processing line: ~ intersecting = primitive_representations(0, 0, 100, 100) +~ -** Processing line: ~ primitive_representations(20, 20, 20, 20)~ -** Processing line: ~~ -** Processing line: ~ intersecting.product(intersecting).each do |rect_one, rect_two|~ -** Processing line: ~ assert.true! rect_one.intersect_rect?(rect_two),~ -** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)."~ +** Processing line: ~ # Makes sure the player remains within the screen's dimensions.~ +** Processing line: ~ def calc_edge_collision~ +** Processing line: ~ # Ensures that player doesn't fall below the map~ +** Processing line: ~ if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope~ +** Processing line: ~ state.y = 0 # 0 is the lowest the player can be while staying on the screen~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ # Ensures player doesn't go insanely high~ +** Processing line: ~ elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope~ +** Processing line: ~ state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen~ +** Processing line: ~ state.dy = 0~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ not_intersecting = [~ -** Processing line: ~ [ 0, 0, 5, 5],~ -** Processing line: ~ { x: 10, y: 10, w: 5, h: 5 },~ -** Processing line: ~ RectForTest.new(20, 20, 5, 5)~ -** Processing line: ~ ]~ -** Processing line: ~~ -** Processing line: ~ not_intersecting.product(not_intersecting)~ -** Processing line: ~ .reject { |rect_one, rect_two| rect_one == rect_two }~ -** Processing line: ~ .each do |rect_one, rect_two|~ -** Processing line: ~ assert.false! rect_one.intersect_rect?(rect_two),~ -** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)."~ +** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ +** Processing line: ~ if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right~ +** Processing line: ~ state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left~ +** Processing line: ~ state.x = 0 # farthest left the player can be while remaining in the screen's scope~ +** Processing line: ~ state.dx = 0~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ begin :inside_rect?~ -** Processing line: ~ def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil~ -** Processing line: ~ assert.true! inner.inside_rect?(outer) == expected,~ -** Processing line: ~ "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})."~ -** Processing line: ~ end~ +** Processing line: ~ def calc_sprite_selection~ +** Processing line: ~ # Does the transition to bring down the select sprite screen~ +** Processing line: ~ if state.mode == :selecting && state.select_menu.y != 0~ +** Processing line: ~ state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed)~ +** Processing line: ~ state.banner_coords.y = 680 # sets y position of Select Sprite banner~ +** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ +** Processing line: ~ [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen)~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_inside_rect args, assert~ -** Processing line: ~ outer_rects = primitive_representations(0, 0, 10, 10)~ -** Processing line: ~ inner_rects = primitive_representations(1, 1, 5, 5)~ -** Processing line: ~ primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5))~ -** Processing line: ~ .each do |outer, inner|~ -** Processing line: ~ assert_inside_rect outer: outer, inner: inner,~ -** Processing line: ~ expected: true, assert: assert~ +** Processing line: ~ # Does the transition to leave the select sprite screen~ +** Processing line: ~ if state.mode == :creating && state.select_menu.y != 720~ +** Processing line: ~ state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up)~ +** Processing line: ~ state.banner_coords.y = 1000 # sets y position of Select Sprite banner~ +** Processing line: ~ state.sprite_coords = state.sprite_coords.map do |x, y, w, h|~ +** Processing line: ~ [x, y + 720, w, h] # sets definition of all elements in collection~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ begin :angle_to~ -** Processing line: ~ def test_angle_to args, assert~ -** Processing line: ~ origins = primitive_representations(0, 0, 0, 0)~ -** Processing line: ~ rights = primitive_representations(1, 0, 0, 0)~ -** Processing line: ~ aboves = primitive_representations(0, 1, 0, 0)~ -** Processing line: ~~ -** Processing line: ~ origins.product(aboves).each do |origin, above|~ -** Processing line: ~ assert.equal! origin.angle_to(above), 90,~ -** Processing line: ~ "A point directly above should be 90 degrees."~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ # If the state.mode is back and if the menu has retreated back up~ +** Processing line: ~ # call methods that process user inputs~ +** Processing line: ~ if state.mode == :creating~ +** Processing line: ~ process_inputs_player_movement~ +** Processing line: ~ process_inputs_place_tile~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! above.angle_from(origin), 90,~ -** Processing line: ~ "A point coming from above should be 90 degrees."~ +** Processing line: ~ # For each sprite_coordinate added, check what sprite was selected~ +** Processing line: ~ if state.mode == :selecting~ +** Processing line: ~ state.sprite_coords.map do |x, y, order| # goes through all sprites in collection~ +** Processing line: ~ # checks that a specific sprite was pressed based on x, y position~ +** Processing line: ~ if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true~ +** Processing line: ~ inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and~ +** Processing line: ~ inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right~ +** Processing line: ~ inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y~ +** Processing line: ~ inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up~ +** Processing line: ~ state.sprite_selected = order # sprite is chosen~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ origins.product(rights).each do |origin, right|~ -** Processing line: ~ assert.equal! origin.angle_to(right) % 360, 0,~ -** Processing line: ~ "A point directly to the right should be 0 degrees."~ +** Processing line: ~ inputs_export_stage~ +** Processing line: ~ process_inputs_show_available_sprites~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! right.angle_from(origin) % 360, 0,~ -** Processing line: ~ "A point coming from the right should be 0 degrees."~ +** Processing line: ~ # Moves the player based on the keys they press on their keyboard~ +** Processing line: ~ def process_inputs_player_movement~ +** Processing line: ~ # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right)~ +** Processing line: ~ if inputs.keyboard.key_up.right~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ elsif inputs.keyboard.key_up.left~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys~ +** Processing line: ~ if inputs.keyboard.key_held.right~ +** Processing line: ~ state.dx = 3~ +** Processing line: ~ elsif inputs.keyboard.key_held.left~ +** Processing line: ~ state.dx = -3~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard~ +** Processing line: ~ if inputs.keyboard.key_held.space~ +** Processing line: ~ state.dy = 5~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ begin :scale_rect~ -** Processing line: ~ def test_scale_rect args, assert~ -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5),~ -** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ +** Processing line: ~ # Adds tile in the place the user holds down the mouse~ +** Processing line: ~ def process_inputs_place_tile~ +** Processing line: ~ if inputs.mouse.down # if mouse is pressed~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid~ ** Processing line: ~~ -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5),~ -** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ +** Processing line: ~ # Checks if any coordinates duplicate (already exist in world)~ +** Processing line: ~ if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y }~ +** Processing line: ~ #erases existing tile space by rejecting them from world~ +** Processing line: ~ state.world = state.world.reject do |existing_x, existing_y, n|~ +** Processing line: ~ existing_x == x && existing_y == y~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5),~ -** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ +** Processing line: ~ # Stores/exports world collection's info (coordinates, sprite number) into a file~ +** Processing line: ~ def inputs_export_stage~ +** Processing line: ~ if inputs.keyboard.key_down.e # if "e" is pressed~ +** Processing line: ~ export_string = state.world.map do |x, y, sprite_number| # stores world info in a string~ +** Processing line: ~ "#{x},#{y},#{sprite_number}" # using string interpolation~ +** Processing line: ~ end~ +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file~ +** Processing line: ~ state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0),~ -** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ +** Processing line: ~ def process_inputs_show_available_sprites~ +** Processing line: ~ # Based on keyboard input, the entity (:creating and :selecting) switch~ +** Processing line: ~ if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating~ +** Processing line: ~ state.mode = :selecting # will change to selecting~ +** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ +** Processing line: ~ elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting~ +** Processing line: ~ state.mode = :creating # will change to creating~ +** Processing line: ~ inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ puts "running tests"~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. ** Processing line: ~~ +** Processing line: ~ # Loads the world collection by reading from the map.txt file in the app folder~ +** Processing line: ~ def attempt_load_world_from_file~ +** Processing line: ~ return if state.world # return if the world collection is already populated~ +** Processing line: ~ state.world ||= [] # initialized as an empty collection~ +** Processing line: ~ exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code~ +** Processing line: ~ return unless exported_world # return unless the file read was successful~ +** Processing line: ~ state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world~ +** Processing line: ~ l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection,~ +** Processing line: ~ # calling to_i (converts to integers) on each element~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/http_tests.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/http_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Adds the change in y to y to determine the next y position of the player.~ +** Processing line: ~ def next_y~ +** Processing line: ~ state.y + state.dy~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def try_assert_or_schedule args, assert~ -** Processing line: ~ if $result[:complete]~ -** Processing line: ~ log_info "Request completed! Verifying."~ -** Processing line: ~ if $result[:http_response_code] != 200~ -** Processing line: ~ log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200."~ -** Processing line: ~ exit~ -** Processing line: ~ end~ -** Processing line: ~ log_info ":try_assert_or_schedule succeeded!"~ -** Processing line: ~ else~ -** Processing line: ~ args.gtk.schedule_callback Kernel.tick_count + 10 do~ -** Processing line: ~ try_assert_or_schedule args, assert~ +** Processing line: ~ # Determines next x position of player~ +** Processing line: ~ def next_x~ +** Processing line: ~ if state.dx < 0 # if the player moves left~ +** Processing line: ~ return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)~ +** Processing line: ~ else~ +** Processing line: ~ return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_http args, assert~ -** Processing line: ~ $result = $gtk.http_get 'http://dragonruby.org'~ -** Processing line: ~ try_assert_or_schedule args, assert~ +** Processing line: ~ def to_coord point~ +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ +** Processing line: ~ # later and huzzah. Grid coordinates~ +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ puts "running tests"~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ $metroidvania_starter = MetroidvaniaStarter.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $metroidvania_starter.grid = args.grid~ +** Processing line: ~ $metroidvania_starter.inputs = args.inputs~ +** Processing line: ~ $metroidvania_starter.state = args.state~ +** Processing line: ~ $metroidvania_starter.outputs = args.outputs~ +** Processing line: ~ $metroidvania_starter.gtk = args.gtk~ +** Processing line: ~ $metroidvania_starter.tick~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb~ +** Processing line: ~* Physics And Collisions - Jump Physics - main.rb~ - H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Physics And Collisions - Jump Physics - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class PlayerSpriteForTest~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def test_array_to_sprite args, assert~ -** Processing line: ~ array = [[0, 0, 100, 100, "test.png"]].sprites~ -** Processing line: ~ puts "No exception was thrown. Sweet!"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def test_class_to_sprite args, assert~ -** Processing line: ~ array = [PlayerSprite.new].sprites~ -** Processing line: ~ assert.true! array.first.is_a?(PlayerSprite)~ -** Processing line: ~ puts "No exception was thrown. Sweet!"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ # ./samples/04_physics_and_collisions/06_jump_physics/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ Reminders:~ ** Processing line: ~~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ +** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ +** Processing line: ~ be retained across frames.)~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/parsing_tests.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/parsing_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def test_parse_json args, assert~ -** Processing line: ~ result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }'~ -** Processing line: ~ assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed."~ -** Processing line: ~ end~ +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ ** Processing line: ~~ -** Processing line: ~ def test_parse_xml args, assert~ -** Processing line: ~ result = args.gtk.parse_xml <<-S~ -** Processing line: ~ ~ -** Processing line: ~ John Doe~ -** Processing line: ~ ~ -** Processing line: ~ S~ +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ using their keys.~ ** Processing line: ~~ -** Processing line: ~ expected = {:type=>:element,~ -** Processing line: ~ :name=>nil,~ -** Processing line: ~ :children=>[{:type=>:element,~ -** Processing line: ~ :name=>"Person",~ -** Processing line: ~ :children=>[{:type=>:element,~ -** Processing line: ~ :name=>"Name",~ -** Processing line: ~ :children=>[{:type=>:content,~ -** Processing line: ~ :data=>"John Doe"}]}],~ -** Processing line: ~ :attributes=>{"id"=>"100"}}]}~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ assert.equal! result, expected, "Parsing xml failed."~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ puts "running tests"~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ # This sample app is a game that requires the user to jump from one platform to the next.~ +** Processing line: ~ # As the player successfully clears platforms, they become smaller and move faster.~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ class VerticalPlatformer~ +** Processing line: ~ attr_gtk~ ** Processing line: ~~ +** Processing line: ~ # declares vertical platformer as new entity~ +** Processing line: ~ def s~ +** Processing line: ~ state.vertical_platformer ||= state.new_entity(:vertical_platformer)~ +** Processing line: ~ state.vertical_platformer~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb~ -- H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # creates a new platform using a hash~ +** Processing line: ~ def new_platform hash~ +** Processing line: ~ s.new_entity_strict(:platform, hash) # platform key~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def test_serialize args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.state.player_one = "test"~ -** Processing line: ~ result = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ +** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ input~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.gtk.write_file 'state.txt', ''~ -** Processing line: ~ result = args.gtk.serialize_state 'state.txt', args.state~ -** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ -** Processing line: ~ end~ +** Processing line: ~ # Sets default values~ +** Processing line: ~ def defaults~ +** Processing line: ~ s.platforms ||= [ # initializes platforms collection with two platforms using hashes~ +** Processing line: ~ new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil),~ +** Processing line: ~ new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ def test_deserialize args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ -** Processing line: ~ assert.equal! result.player_one, "test"~ +** Processing line: ~ s.tick_count = args.state.tick_count~ +** Processing line: ~ s.gravity = -0.3 # what goes up must come down because of gravity~ +** Processing line: ~ s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared~ +** Processing line: ~ s.player.x ||= 0 # sets player values~ +** Processing line: ~ s.player.y ||= 100~ +** Processing line: ~ s.player.w ||= 64~ +** Processing line: ~ s.player.h ||= 64~ +** Processing line: ~ s.player.dy ||= 0 # change in position~ +** Processing line: ~ s.player.dx ||= 0~ +** Processing line: ~ s.player_jump_power = 15~ +** Processing line: ~ s.player_jump_power_duration = 10~ +** Processing line: ~ s.player_max_run_speed = 5~ +** Processing line: ~ s.player_speed_slowdown_rate = 0.9~ +** Processing line: ~ s.player_acceleration = 1~ +** Processing line: ~ s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ -** Processing line: ~ result = args.gtk.deserialize_state 'state.txt'~ -** Processing line: ~ assert.equal! result.player_one, "test"~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs objects onto the screen~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.solids << s.platforms.map do |p| # outputs platforms onto screen~ +** Processing line: ~ [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center~ +** Processing line: ~ # don't forget, position of platform is denoted by bottom left hand corner~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_very_large_serialization args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ size = 3000~ -** Processing line: ~ size.map_with_index do |i|~ -** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ +** Processing line: ~ # outputs player using hash~ +** Processing line: ~ outputs.solids << {~ +** Processing line: ~ x: s.player.x + 300, # player positioned on top of platform~ +** Processing line: ~ y: s.player.y - s.camera[:y],~ +** Processing line: ~ w: s.player.w,~ +** Processing line: ~ h: s.player.h,~ +** Processing line: ~ r: 100, # color saturation~ +** Processing line: ~ g: 100,~ +** Processing line: ~ b: 200~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ result = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly")~ -** Processing line: ~ end~ +** Processing line: ~ # Performs calculations~ +** Processing line: ~ def calc~ +** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ +** Processing line: ~ p.rect = [p.x, p.y, p.w, p.h] # set the definition~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_strict_entity_serialization args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ -** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken")~ +** Processing line: ~ # sets player point by adding half the player's width to the player's x~ +** Processing line: ~ s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens!~ ** Processing line: ~~ -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}'~ +** Processing line: ~ # search the platforms collection to find if the player's point is inside the rect of a platform~ +** Processing line: ~ collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect }~ ** Processing line: ~~ -** Processing line: ~ deserialize_state = args.gtk.deserialize_state serialized_state~ +** Processing line: ~ # if collision occurred and player is moving down (or not moving vertically at all)~ +** Processing line: ~ if collision && s.player.dy <= 0~ +** Processing line: ~ s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform~ +** Processing line: ~ s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically~ +** Processing line: ~ if !s.player.platform~ +** Processing line: ~ s.player.dx = 0 # no horizontal movement~ +** Processing line: ~ end~ +** Processing line: ~ # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x~ +** Processing line: ~ s.player.x += collision.dx * collision.speed~ +** Processing line: ~ s.player.platform = collision # player is on the platform that it collided with (or landed on)~ +** Processing line: ~ if s.player.falling # if player is falling~ +** Processing line: ~ s.player.dx = 0 # no horizontal movement~ +** Processing line: ~ end~ +** Processing line: ~ s.player.falling = false~ +** Processing line: ~ s.player.jumped_at = nil~ +** Processing line: ~ else~ +** Processing line: ~ s.player.platform = nil # player is not on a platform~ +** Processing line: ~ s.player.y += s.player.dy # velocity is the change in position~ +** Processing line: ~ s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! args.state.player_one.name, deserialize_state.player_one.name~ -** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ +** Processing line: ~ s.platforms.each do |p| # for each platform in the collection~ +** Processing line: ~ p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally)~ +** Processing line: ~ # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels)~ +** Processing line: ~ if p.x < -300 # if platform goes too far left~ +** Processing line: ~ p.dx *= -1 # dx is scaled down~ +** Processing line: ~ p.x = -300 # as far left as possible within scope~ +** Processing line: ~ elsif p.x > (1000 - p.w) # if platform's x is greater than 300~ +** Processing line: ~ p.dx *= -1~ +** Processing line: ~ p.x = (1000 - p.w) # set to 300 (as far right as possible within scope)~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! args.state.player_two.name, deserialize_state.player_two.name~ -** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ -** Processing line: ~ end~ +** Processing line: ~ delta = (s.player.y - s.camera[:y] - 100) # used to position camera view~ ** Processing line: ~~ -** Processing line: ~ def test_strict_entity_serialization_with_nil args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ -** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil)~ +** Processing line: ~ if delta > -200~ +** Processing line: ~ s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards~ +** Processing line: ~ s.player.x += s.player.dx # velocity is change in position; change in x increases by dx~ ** Processing line: ~~ -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ -** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}'~ +** Processing line: ~ # searches platform collection to find platforms located more than 300 pixels above the player~ +** Processing line: ~ has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) }~ +** Processing line: ~ if !has_platforms # if there are no platforms 300 pixels above the player~ +** Processing line: ~ width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous~ +** Processing line: ~ s.player.platforms_cleared += 1 # player successfully cleared another platform~ +** Processing line: ~ last_platform = s.platforms[-1] # platform just cleared becomes last platform~ +** Processing line: ~ # another platform is created 300 pixels above the last platform, and this~ +** Processing line: ~ # new platform has a smaller width and moves faster than all previous platforms~ +** Processing line: ~ s.platforms << new_platform(x: (700 - width) * rand, # random x position~ +** Processing line: ~ y: last_platform.y + 300,~ +** Processing line: ~ w: width,~ +** Processing line: ~ h: 32,~ +** Processing line: ~ dx: 1.randomize(:sign), # random change in x~ +** Processing line: ~ speed: 2 * s.player.platforms_cleared,~ +** Processing line: ~ rect: nil)~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ s.as_hash.clear # otherwise clear the hash (no new platform is necessary)~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ +** Processing line: ~ # Takes input from the user to move the player~ +** Processing line: ~ def input~ +** Processing line: ~ if inputs.keyboard.space # if the space bar is pressed~ +** Processing line: ~ s.player.jumped_at ||= s.tick_count # set to current frame~ ** Processing line: ~~ -** Processing line: ~ assert.equal! args.state.player_one.name, deserialized_state.player_one.name~ -** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ +** Processing line: ~ # if the time that has passed since the jump is less than the duration of a jump (10 frames)~ +** Processing line: ~ # and the player is not falling~ +** Processing line: ~ if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling~ +** Processing line: ~ s.player.dy = s.player_jump_power # player jumps up~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ assert.equal! args.state.player_two.name, deserialized_state.player_two.name~ -** Processing line: ~ assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type~ -** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, nil~ -** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ +** Processing line: ~ if inputs.keyboard.key_up.space # if space bar is in "up" state~ +** Processing line: ~ s.player.falling = true # player is falling~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ deserialized_state.player_two.blood_type = :O~ -** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, :O~ +** Processing line: ~ if inputs.keyboard.left # if left key is pressed~ +** Processing line: ~ s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration~ +** Processing line: ~ s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater~ +** Processing line: ~ elsif inputs.keyboard.right # if right key is pressed~ +** Processing line: ~ s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration~ +** Processing line: ~ s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser~ +** Processing line: ~ else~ +** Processing line: ~ s.player.dx *= s.player_speed_slowdown_rate # scales dx down~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def test_multiple_strict_entities args, assert~ -** Processing line: ~ GTK::Entity.__reset_id__!~ -** Processing line: ~ args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu")~ -** Processing line: ~ args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean')~ -** Processing line: ~~ -** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ -** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ +** Processing line: ~ $game = VerticalPlatformer.new~ ** Processing line: ~~ -** Processing line: ~ assert.equal! deserialized_state.player.name, "Ryu"~ -** Processing line: ~ assert.equal! deserialized_state.enemy.other_property, "extra mean"~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $tests.start~ -** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb~ +** Processing line: ~* Mouse - Mouse Click - main.rb~ - H1 detected. -- Formatting line: ~10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Mouse - Mouse Click - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ MAX_CODE_GEN_LENGTH = 50~ -** Processing line: ~~ -** Processing line: ~ # NOTE: This is experimental/advanced stuff.~ -** Processing line: ~ def needs_partitioning? target~ -** Processing line: ~ target[:value].to_s.length > MAX_CODE_GEN_LENGTH~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/05_mouse/01_mouse_click/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ def partition target~ -** Processing line: ~ return [] unless needs_partitioning? target~ -** Processing line: ~ if target[:value].is_a? GTK::OpenEntity~ -** Processing line: ~ target[:value] = target[:value].hash~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ results = []~ -** Processing line: ~ idx = 0~ -** Processing line: ~ left, right = target[:value].partition do~ -** Processing line: ~ idx += 1~ -** Processing line: ~ idx.even?~ -** Processing line: ~ end~ -** Processing line: ~ left, right = Hash[left], Hash[right]~ -** Processing line: ~ left = { value: left }~ -** Processing line: ~ right = { value: right}~ -** Processing line: ~ [left, right]~ -** Processing line: ~ end~ +** Processing line: ~ - product: Returns an array of all combinations of elements from all arrays.~ ** Processing line: ~~ -** Processing line: ~ def add_partition target, path, aggregate, final_result~ -** Processing line: ~ partitions = partition target~ -** Processing line: ~ partitions.each do |part|~ -** Processing line: ~ if needs_partitioning? part~ -** Processing line: ~ if part[:value].keys.length == 1~ -** Processing line: ~ first_key = part[:value].keys[0]~ -** Processing line: ~ new_part = { value: part[:value][first_key] }~ -** Processing line: ~ path.push first_key~ -** Processing line: ~ add_partition new_part, path, aggregate, final_result~ -** Processing line: ~ path.pop~ -** Processing line: ~ else~ -** Processing line: ~ add_partition part, path, aggregate, final_result~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ final_result << { value: { __path__: [*path] } }~ -** Processing line: ~ final_result << { value: part[:value] }~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ For example, [1,2].product([1,2]) would return the following array...~ +** Processing line: ~ [[1,1], [1,2], [2,1], [2,2]]~ +** Processing line: ~ More than two arrays can be given to product and it will still work,~ +** Processing line: ~ such as [1,2].product([1,2],[3,4]). What would product return in this case?~ ** Processing line: ~~ -** Processing line: ~ def state_to_string state~ -** Processing line: ~ parts_queue = []~ -** Processing line: ~ final_queue = []~ -** Processing line: ~ add_partition({ value: state.hash },~ -** Processing line: ~ [],~ -** Processing line: ~ parts_queue,~ -** Processing line: ~ final_queue)~ -** Processing line: ~ final_queue.reject {|i| i[:value].keys.length == 0}.map do |i|~ -** Processing line: ~ i[:value].to_s~ -** Processing line: ~ end.join("\n#==================================================#\n")~ -** Processing line: ~ end~ +** Processing line: ~ Answer:~ +** Processing line: ~ [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]]~ ** Processing line: ~~ -** Processing line: ~ def state_from_string string~ -** Processing line: ~ Kernel.eval("$load_data = {}")~ -** Processing line: ~ lines = string.split("\n#==================================================#\n")~ -** Processing line: ~ lines.each do |l|~ -** Processing line: ~ puts "todo: #{l}"~ -** Processing line: ~ end~ +** Processing line: ~ - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers.~ +** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ ** Processing line: ~~ -** Processing line: ~ GTK::OpenEntity.parse_from_hash $load_data~ -** Processing line: ~ end~ +** Processing line: ~ - yield: Allows you to call a method with a code block and yield to that block.~ ** Processing line: ~~ -** Processing line: ~ def test_save_and_load args, assert~ -** Processing line: ~ args.state.item_1.name = "Jane"~ -** Processing line: ~ string = state_to_string args.state~ -** Processing line: ~ state = state_from_string string~ -** Processing line: ~ assert.equal! args.state.item_1.name, state.item_1.name~ -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ def test_save_and_load_big args, assert~ -** Processing line: ~ size = 1000~ -** Processing line: ~ size.map_with_index do |i|~ -** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ string = state_to_string args.state~ -** Processing line: ~ state = state_from_string string~ -** Processing line: ~ size.map_with_index do |i|~ -** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym)~ -** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), i~ -** Processing line: ~ assert.equal! state.send("k#{i}".to_sym), i~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ def test_save_and_load_big_nested args, assert~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k0 = 0~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k1 = 1~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k2 = 2~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k3 = 3~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k4 = 4~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k5 = 5~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k6 = 6~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k7 = 7~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k8 = 8~ -** Processing line: ~ args.state.player_one.friend.nested_hash.k9 = 9~ -** Processing line: ~ string = state_to_string args.state~ -** Processing line: ~ state = state_from_string string~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ ** Processing line: ~~ -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.log_level = :off~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ - Ternary operator (?): Will evaluate a statement (just like an if statement)~ +** Processing line: ~ and perform an action if the result is true or another action if it is false.~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ - reject: Removes elements from a collection if they meet certain requirements.~ ** Processing line: ~~ +** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~* 11_http/01_retrieve_images/app/main.rb~ -- H1 detected. -- Formatting line: ~11_http/01_retrieve_images/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # Show a warning at the start.~ -** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ -** Processing line: ~ if args.state.warning_debounce > 0~ -** Processing line: ~ args.state.warning_debounce -= 1~ -** Processing line: ~ args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255]~ -** Processing line: ~ args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255]~ -** Processing line: ~ args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255]~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app is a classic game of Tic Tac Toe.~ ** Processing line: ~~ -** Processing line: ~ args.state.download_debounce ||= 0 # start immediately, reset to non zero later.~ -** Processing line: ~ args.state.photos ||= []~ +** Processing line: ~ class TicTacToe~ +** Processing line: ~ attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk~ ** Processing line: ~~ -** Processing line: ~ # Put a little pause between each download.~ -** Processing line: ~ if args.state.download.nil?~ -** Processing line: ~ if args.state.download_debounce > 0~ -** Processing line: ~ args.state.download_debounce -= 1~ -** Processing line: ~ else~ -** Processing line: ~ args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg'~ -** Processing line: ~ end~ +** Processing line: ~ # Starts the game with player x's turn and creates an array (to_a) for space combinations.~ +** Processing line: ~ # Calls methods necessary for the game to run properly.~ +** Processing line: ~ def tick~ +** Processing line: ~ state.current_turn ||= :x~ +** Processing line: ~ state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a~ +** Processing line: ~ render_board~ +** Processing line: ~ input_board~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if !args.state.download.nil?~ -** Processing line: ~ if args.state.download[:complete]~ -** Processing line: ~ if args.state.download[:http_response_code] == 200~ -** Processing line: ~ fname = "sprites/#{args.state.photos.length}.jpg"~ -** Processing line: ~ $gtk.write_file fname, args.state.download[:response_data]~ -** Processing line: ~ args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ]~ -** Processing line: ~ end~ -** Processing line: ~ args.state.download = nil~ -** Processing line: ~ args.state.download_debounce = (rand(3) + 2) * 60~ +** Processing line: ~ # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels.~ +** Processing line: ~ def render_board~ +** Processing line: ~ square_size = 80~ +** Processing line: ~~ +** Processing line: ~ # Positions the game's board in the center of the screen.~ +** Processing line: ~ # Try removing what follows grid.w_half or grid.h_half and see how the position changes!~ +** Processing line: ~ board_left = grid.w_half - square_size * 1.5~ +** Processing line: ~ board_top = grid.h_half - square_size * 1.5~ +** Processing line: ~~ +** Processing line: ~ # At first glance, the add(1) looks pretty trivial. But if you remove it,~ +** Processing line: ~ # you'll see that the positioning of the board would be skewed without it!~ +** Processing line: ~ # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares~ +** Processing line: ~ # due to the change in board placement.~ +** Processing line: ~ outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces~ +** Processing line: ~ space.border ||= [~ +** Processing line: ~ board_left + x.add(1) * square_size, # space.border is initialized using this definition~ +** Processing line: ~ board_top + y.add(1) * square_size,~ +** Processing line: ~ square_size,~ +** Processing line: ~ square_size~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Again, the calculations ensure that the piece is placed in the center of the grid square.~ +** Processing line: ~ # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center.~ +** Processing line: ~ outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board~ +** Processing line: ~ label board_left + x.add(1) * square_size + square_size.fdiv(2),~ +** Processing line: ~ board_top + y.add(1) * square_size + square_size - 20,~ +** Processing line: ~ space.piece # text of label, either "x" or "o"~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Uses a label to output whether x or o won, or if a draw occurred.~ +** Processing line: ~ # If the game is ongoing, a label shows whose turn it currently is.~ +** Processing line: ~ outputs.labels << if state.x_won~ +** Processing line: ~ label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top~ +** Processing line: ~ elsif state.o_won~ +** Processing line: ~ label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally~ +** Processing line: ~ elsif state.draw~ +** Processing line: ~ label grid.w_half, grid.top - 80, "a draw"~ +** Processing line: ~ else # if no one won and the game is ongoing~ +** Processing line: ~ label grid.w_half, grid.top - 80, "turn: #{state.current_turn}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # draw any downloaded photos...~ -** Processing line: ~ args.state.photos.each { |i|~ -** Processing line: ~ args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite~ -** Processing line: ~ }~ +** Processing line: ~ # Calls the methods responsible for handling user input and determining the winner.~ +** Processing line: ~ # Does nothing unless the mouse is clicked.~ +** Processing line: ~ def input_board~ +** Processing line: ~ return unless inputs.mouse.click~ +** Processing line: ~ input_place_piece~ +** Processing line: ~ input_restart_game~ +** Processing line: ~ determine_winner~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Draw a download progress bar...~ -** Processing line: ~ args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid~ -** Processing line: ~ if !args.state.download.nil?~ -** Processing line: ~ br = args.state.download[:response_read]~ -** Processing line: ~ total = args.state.download[:response_total]~ -** Processing line: ~ if total != 0~ -** Processing line: ~ pct = br.to_f / total.to_f~ -** Processing line: ~ args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid~ +** Processing line: ~ # Handles user input for placing pieces on the board.~ +** Processing line: ~ def input_place_piece~ +** Processing line: ~ return if state.game_over~ +** Processing line: ~~ +** Processing line: ~ # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already~ +** Processing line: ~ # have a piece in it.~ +** Processing line: ~ __, __, space = all_spaces.find do |__, __, space|~ +** Processing line: ~ inputs.mouse.click.point.inside_rect?(space.border) && !space.piece~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # The piece that goes into the space belongs to the player whose turn it currently is.~ +** Processing line: ~ return unless space~ +** Processing line: ~ space.piece = state.current_turn~ +** Processing line: ~~ +** Processing line: ~ # This ternary operator statement allows us to change the current player's turn.~ +** Processing line: ~ # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn.~ +** Processing line: ~ state.current_turn = state.current_turn == :x ? :o : :x~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Resets the game.~ +** Processing line: ~ def input_restart_game~ +** Processing line: ~ return unless state.game_over~ +** Processing line: ~ gtk.reset~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Checks if x or o won the game.~ +** Processing line: ~ # If neither player wins and all nine squares are filled, a draw happens.~ +** Processing line: ~ # Once a player is chosen as the winner or a draw happens, the game is over.~ +** Processing line: ~ def determine_winner~ +** Processing line: ~ state.x_won = won? :x # evaluates to either true or false (boolean values)~ +** Processing line: ~ state.o_won = won? :o~ +** Processing line: ~ state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won~ +** Processing line: ~ state.game_over = state.x_won || state.o_won || state.draw~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 99_genre_3d/3d_cube/app/main.rb~ -- H1 detected. -- Formatting line: ~99_genre_3d/3d_cube/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Determines if a player won by checking if there is a horizontal match or vertical match.~ +** Processing line: ~ # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won.~ +** Processing line: ~ def won? piece~ +** Processing line: ~ # performs action on all space combinations~ +** Processing line: ~ won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y|~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ STARTX = 0.0~ -** Processing line: ~ STARTY = 0.0~ -** Processing line: ~ ENDY = 20.0~ -** Processing line: ~ ENDX = 20.0~ -** Processing line: ~ SPINPOINT = 10~ -** Processing line: ~ SPINDURATION = 400~ -** Processing line: ~ POINTSIZE = 8~ -** Processing line: ~ BOXDEPTH = 40~ -** Processing line: ~ YAW = 1~ -** Processing line: ~ DISTANCE = 10~ +** Processing line: ~ # Checks if the 3 grid spaces with the same y value (or same row) and~ +** Processing line: ~ # x values that are next to each other have pieces that belong to the same player.~ +** Processing line: ~ # Remember, the value of piece is equal to the current turn (which is the player).~ +** Processing line: ~ horizontal_match = state.spaces[xs[0]][y].piece == piece &&~ +** Processing line: ~ state.spaces[xs[1]][y].piece == piece &&~ +** Processing line: ~ state.spaces[xs[2]][y].piece == piece~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION)~ -** Processing line: ~ s = Math.sin(a)~ -** Processing line: ~ c = Math.cos(a)~ -** Processing line: ~ x = STARTX~ -** Processing line: ~ y = STARTY~ -** Processing line: ~ offset_x = (1280 - (ENDX - STARTX)) / 2~ -** Processing line: ~ offset_y = (360 - (ENDY - STARTY)) / 2~ +** Processing line: ~ # Checks if the 3 grid spaces with the same x value (or same column) and~ +** Processing line: ~ # y values that are next to each other have pieces that belong to the same player.~ +** Processing line: ~ # The && represents an "and" statement: if even one part of the statement is false,~ +** Processing line: ~ # the entire statement evaluates to false.~ +** Processing line: ~ vertical_match = state.spaces[y][xs[0]].piece == piece &&~ +** Processing line: ~ state.spaces[y][xs[1]].piece == piece &&~ +** Processing line: ~ state.spaces[y][xs[2]].piece == piece~ ** Processing line: ~~ -** Processing line: ~ srand(1)~ -** Processing line: ~ while y < ENDY do~ -** Processing line: ~ while x < ENDX do~ -** Processing line: ~ if (y == STARTY ||~ -** Processing line: ~ y == (ENDY / 0.5) * 2 ||~ -** Processing line: ~ y == (ENDY / 0.5) * 2 + 0.5 ||~ -** Processing line: ~ y == ENDY - 0.5 ||~ -** Processing line: ~ x == STARTX ||~ -** Processing line: ~ x == ENDX - 0.5)~ -** Processing line: ~ z = rand(BOXDEPTH)~ -** Processing line: ~ z *= Math.sin(a / 2)~ -** Processing line: ~ x -= SPINPOINT~ -** Processing line: ~ u = (x * c) - (z * s)~ -** Processing line: ~ v = (x * s) + (z * c)~ -** Processing line: ~ k = DISTANCE.fdiv(100) + (v / 500 * YAW)~ -** Processing line: ~ u = u / k~ -** Processing line: ~ v = y / k~ -** Processing line: ~ w = POINTSIZE / 10 / k~ -** Processing line: ~ args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'}~ -** Processing line: ~ x += SPINPOINT~ +** Processing line: ~ horizontal_match || vertical_match # if either is true, true is returned~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sees if there is a diagonal match, starting from the bottom left and ending at the top right.~ +** Processing line: ~ # Is added to won regardless of whether the statement is true or false.~ +** Processing line: ~ won << (state.spaces[-1][-1].piece == piece && # bottom left~ +** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ +** Processing line: ~ state.spaces[ 1][ 1].piece == piece) # top right~ +** Processing line: ~~ +** Processing line: ~ # Sees if there is a diagonal match, starting at the bottom right and ending at the top left~ +** Processing line: ~ # and is added to won.~ +** Processing line: ~ won << (state.spaces[ 1][-1].piece == piece && # bottom right~ +** Processing line: ~ state.spaces[ 0][ 0].piece == piece && # center~ +** Processing line: ~ state.spaces[-1][ 1].piece == piece) # top left~ +** Processing line: ~~ +** Processing line: ~ # Any false statements (meaning false diagonal matches) are rejected from won~ +** Processing line: ~ won.reject_false.any?~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them.~ +** Processing line: ~ # The ! before a statement means "not". For example, we are rejecting any space combinations that do~ +** Processing line: ~ # NOT have pieces in them.~ +** Processing line: ~ def filled_spaces~ +** Processing line: ~ state.space_combinations~ +** Processing line: ~ .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them~ +** Processing line: ~ .map do |x, y|~ +** Processing line: ~ if block_given?~ +** Processing line: ~ yield x, y, state.spaces[x][y]~ +** Processing line: ~ else~ +** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Defines all spaces on the board.~ +** Processing line: ~ def all_spaces~ +** Processing line: ~ if !block_given?~ +** Processing line: ~ state.space_combinations.map do |x, y|~ +** Processing line: ~ [x, y, state.spaces[x][y]] # sets definition of space~ +** Processing line: ~ end~ +** Processing line: ~ else # if a block is given (block_given? is true)~ +** Processing line: ~ state.space_combinations.map do |x, y|~ +** Processing line: ~ yield x, y, state.spaces[x][y] # yield if a block is given~ ** Processing line: ~ end~ -** Processing line: ~ x += 0.5~ ** Processing line: ~ end~ -** Processing line: ~ y += 0.5~ -** Processing line: ~ x = STARTX~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets values for a label, such as the position, value, size, alignment, and color.~ +** Processing line: ~ def label x, y, value~ +** Processing line: ~ [x, y + 10, value, 20, 1, 0, 0, 0]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~ $tic_tac_toe = TicTacToe.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $tic_tac_toe._ = args~ +** Processing line: ~ $tic_tac_toe.state = args.state~ +** Processing line: ~ $tic_tac_toe.outputs = args.outputs~ +** Processing line: ~ $tic_tac_toe.inputs = args.inputs~ +** Processing line: ~ $tic_tac_toe.grid = args.grid~ +** Processing line: ~ $tic_tac_toe.gtk = args.gtk~ +** Processing line: ~ $tic_tac_toe.tick~ +** Processing line: ~ tick_instructions args, "Sample app shows how to work with mouse clicks."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_arcade/dueling_starships/app/main.rb~ +** Processing line: ~* Mouse - Mouse Move - main.rb~ - H1 detected. -- Formatting line: ~99_genre_arcade/dueling_starships/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Mouse - Mouse Move - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class DuelingSpaceships~ -** Processing line: ~ attr_accessor :state, :inputs, :outputs, :grid~ +** Processing line: ~ # ./samples/05_mouse/02_mouse_move/app/main.rb~ +** Processing line: ~ =begin~ +** Processing line: ~~ +** Processing line: ~ Reminders:~ +** Processing line: ~~ +** Processing line: ~ - num1.greater(num2): Returns the greater value.~ +** Processing line: ~ For example, if we have the command~ +** Processing line: ~ puts 4.greater(3)~ +** Processing line: ~ the number 4 would be printed to the console since it has a greater value than 3.~ +** Processing line: ~ Similar to lesser, which returns the lesser value.~ +** Processing line: ~~ +** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ +** Processing line: ~ For example, in this sample app, we're using find_all to find all zombies that have intersected~ +** Processing line: ~ or hit the player's sprite since these zombies have been killed.~ +** Processing line: ~~ +** Processing line: ~ - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed.~ +** Processing line: ~ Stores the frame the "down" event occurred.~ +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ When we want to create a new object, we can declare it as a new entity and then define~ +** Processing line: ~ its properties. (Remember, you can use state to define ANY property and it will~ +** Processing line: ~ be retained across frames.)~ +** Processing line: ~~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~~ +** Processing line: ~ - map: Ruby method used to transform data; used in arrays, hashes, and collections.~ +** Processing line: ~ Can be used to perform an action on every element of a collection, such as multiplying~ +** Processing line: ~ each element by 2 or declaring every element as a new entity.~ +** Processing line: ~~ +** Processing line: ~ - sample: Chooses a random element from the array.~ +** Processing line: ~~ +** Processing line: ~ - reject: Removes elements that meet certain requirements.~ +** Processing line: ~ In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also~ +** Processing line: ~ rejecting zombies that were killed more than 30 frames ago.~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal~ +** Processing line: ~ # is to kill the zombies as fast as possible!~ ** Processing line: ~~ +** Processing line: ~ class ProtectThePuppiesFromTheZombies~ +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ +** Processing line: ~~ +** Processing line: ~ # Calls the methods necessary for the game to run properly.~ ** Processing line: ~ def tick~ ** Processing line: ~ defaults~ ** Processing line: ~ render~ @@ -108393,6597 +117079,8244 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ input~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Sets default values for the zombies and for the player.~ +** Processing line: ~ # Initialization happens only in the first frame.~ ** Processing line: ~ def defaults~ -** Processing line: ~ outputs.background_color = [0, 0, 0]~ -** Processing line: ~ state.ship_blue ||= new_blue_ship~ -** Processing line: ~ state.ship_red ||= new_red_ship~ -** Processing line: ~ state.flames ||= []~ -** Processing line: ~ state.bullets ||= []~ -** Processing line: ~ state.ship_blue_score ||= 0~ -** Processing line: ~ state.ship_red_score ||= 0~ -** Processing line: ~ state.stars ||= 100.map do~ -** Processing line: ~ [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio),~ -** Processing line: ~ grid.h_half.randomize(:sign, :ratio)),~ -** Processing line: ~ 128 + 128.randomize(:ratio), 255, 255]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ state.flash_at ||= 0~ +** Processing line: ~ state.zombie_min_spawn_rate ||= 60~ +** Processing line: ~ state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate~ +** Processing line: ~ state.zombies ||= []~ +** Processing line: ~ state.killed_zombies ||= []~ ** Processing line: ~~ -** Processing line: ~ def default_ship x, y, angle, sprite_path, bullet_sprite_path, color~ -** Processing line: ~ state.new_entity(:ship,~ -** Processing line: ~ { x: x,~ -** Processing line: ~ y: y,~ -** Processing line: ~ dy: 0,~ -** Processing line: ~ dx: 0,~ -** Processing line: ~ damage: 0,~ -** Processing line: ~ dead: false,~ -** Processing line: ~ angle: angle,~ -** Processing line: ~ max_alpha: 255,~ -** Processing line: ~ sprite_path: sprite_path,~ -** Processing line: ~ bullet_sprite_path: bullet_sprite_path,~ -** Processing line: ~ color: color })~ +** Processing line: ~ # Declares player as a new entity and sets its properties.~ +** Processing line: ~ # The player begins the game in the center of the screen, not moving in any direction.~ +** Processing line: ~ state.player ||= state.new_entity(:player, { x: 640,~ +** Processing line: ~ y: 360,~ +** Processing line: ~ attack_angle: 0,~ +** Processing line: ~ dx: 0,~ +** Processing line: ~ dy: 0 })~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def new_red_ship~ -** Processing line: ~ default_ship(400, 250.randomize(:sign, :ratio),~ -** Processing line: ~ 180, 'sprites/ship_red.png', 'sprites/red_bullet.png',~ -** Processing line: ~ [255, 90, 90])~ +** Processing line: ~ # Outputs a gray background.~ +** Processing line: ~ # Calls the methods needed to output the player, zombies, etc onto the screen.~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.solids << [grid.rect, 100, 100, 100]~ +** Processing line: ~ render_zombies~ +** Processing line: ~ render_killed_zombies~ +** Processing line: ~ render_player~ +** Processing line: ~ render_flash~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def new_blue_ship~ -** Processing line: ~ default_ship(-400, 250.randomize(:sign, :ratio),~ -** Processing line: ~ 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png',~ -** Processing line: ~ [110, 140, 255])~ +** Processing line: ~ # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation.~ +** Processing line: ~ def render_zombies~ +** Processing line: ~ outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection~ +** Processing line: ~ z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method~ +** Processing line: ~ z.sprite~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render~ -** Processing line: ~ render_instructions~ -** Processing line: ~ render_score~ -** Processing line: ~ render_universe~ -** Processing line: ~ render_flames~ -** Processing line: ~ render_ships~ -** Processing line: ~ render_bullets~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed.~ +** Processing line: ~ def render_killed_zombies~ +** Processing line: ~ outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection~ +** Processing line: ~ z.sprite = [z.x,~ +** Processing line: ~ z.y,~ +** Processing line: ~ 4 * 3,~ +** Processing line: ~ 8 * 3,~ +** Processing line: ~ animation_sprite(z, z.death_at), # calls animation_sprite method~ +** Processing line: ~ 0, # angle~ +** Processing line: ~ 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die~ +** Processing line: ~ # change the value of 30 and see what happens when a zombie is killed~ ** Processing line: ~~ -** Processing line: ~ def render_ships~ -** Processing line: ~ update_ship_outputs(state.ship_blue)~ -** Processing line: ~ update_ship_outputs(state.ship_red)~ -** Processing line: ~ outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite]~ -** Processing line: ~ outputs.labels << [state.ship_blue.label, state.ship_red.label]~ +** Processing line: ~ # Sets values to output the slash over the zombie's sprite when a zombie is killed.~ +** Processing line: ~ # The slash is tilted 45 degrees from the angle of the player's attack.~ +** Processing line: ~ # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions~ +** Processing line: ~ # the slash over the killed zombie's sprite.~ +** Processing line: ~ [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)]~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_instructions~ -** Processing line: ~ return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 ||~ -** Processing line: ~ state.ship_red.dx > 0 || state.ship_red.dy > 0 ||~ -** Processing line: ~ state.flames.length > 0~ +** Processing line: ~ # Outputs the player sprite using the images in the sprites folder.~ +** Processing line: ~ def render_player~ +** Processing line: ~ state.player_sprite = [state.player.x,~ +** Processing line: ~ state.player.y,~ +** Processing line: ~ 4 * 3,~ +** Processing line: ~ 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation~ +** Processing line: ~ outputs.sprites << state.player_sprite~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [grid.left.shift_right(30),~ -** Processing line: ~ grid.bottom.shift_up(30),~ -** Processing line: ~ "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.",~ -** Processing line: ~ 0, 0, 255, 255, 255]~ +** Processing line: ~ # Outputs a small red square that previews the angles that the player can attack in.~ +** Processing line: ~ # It can be moved in a perfect circle around the player to show possible movements.~ +** Processing line: ~ # Change the 60 in the parenthesis and see what happens to the movement of the red square.~ +** Processing line: ~ outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),~ +** Processing line: ~ state.player.y + state.player.attack_angle.vector_y(60),~ +** Processing line: ~ 3, 3, 255, 0, 0]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_thrusts~ -** Processing line: ~ calc_ships~ -** Processing line: ~ calc_bullets~ -** Processing line: ~ calc_winner~ +** Processing line: ~ # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed.~ +** Processing line: ~ def render_flash~ +** Processing line: ~ return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash.~ +** Processing line: ~ # Transparency gradually changes (or eases) during the 10 frames of flash.~ +** Processing line: ~ outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input~ -** Processing line: ~ input_accelerate~ -** Processing line: ~ input_turn~ -** Processing line: ~ input_bullets_and_mines~ +** Processing line: ~ # Calls all methods necessary for performing calculations.~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_spawn_zombie~ +** Processing line: ~ calc_move_zombies~ +** Processing line: ~ calc_player~ +** Processing line: ~ calc_kill_zombie~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_score~ -** Processing line: ~ outputs.labels << [grid.left.shift_right(80),~ -** Processing line: ~ grid.top.shift_down(40),~ -** Processing line: ~ state.ship_blue_score, 30, 1, state.ship_blue.color]~ +** Processing line: ~ # Decreases the zombie spawn countdown by 1 if it has a value greater than 0.~ +** Processing line: ~ def calc_spawn_zombie~ +** Processing line: ~ if state.zombie_spawn_countdown > 0~ +** Processing line: ~ state.zombie_spawn_countdown -= 1~ +** Processing line: ~ return~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [grid.right.shift_left(80),~ -** Processing line: ~ grid.top.shift_down(40),~ -** Processing line: ~ state.ship_red_score, 30, 1, state.ship_red.color]~ -** Processing line: ~ end~ +** Processing line: ~ # New zombies are created, positioned on the screen, and added to the zombies collection.~ +** Processing line: ~ state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity~ +** Processing line: ~ if rand > 0.5~ +** Processing line: ~ z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope)~ +** Processing line: ~ z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen)~ +** Processing line: ~ # the possible values exceed the screen's scope so zombies appear to be coming from far away~ +** Processing line: ~ else~ +** Processing line: ~ z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen)~ +** Processing line: ~ z.y = grid.rect.w.randomize(:ratio) # random y position on screen~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_universe~ -** Processing line: ~ return if outputs.static_solids.any?~ -** Processing line: ~ outputs.static_solids << grid.rect~ -** Processing line: ~ outputs.static_solids << state.stars~ +** Processing line: ~ # Calls random_spawn_countdown method (determines how fast new zombies appear)~ +** Processing line: ~ state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate~ +** Processing line: ~ state.zombie_min_spawn_rate -= 1~ +** Processing line: ~ # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater~ +** Processing line: ~ state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def apply_round_finished_alpha entity~ -** Processing line: ~ return entity unless state.round_finished_debounce~ -** Processing line: ~ entity.a *= state.round_finished_debounce.percentage_of(2.seconds)~ -** Processing line: ~ return entity~ +** Processing line: ~ # Moves all zombies towards the center of the screen.~ +** Processing line: ~ # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear.~ +** Processing line: ~ def calc_move_zombies~ +** Processing line: ~ state.zombies.each do |z| # for each zombie in the collection~ +** Processing line: ~ z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1~ +** Processing line: ~ z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center~ +** Processing line: ~ end~ +** Processing line: ~ state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def update_ship_outputs ship, sprite_size = 66~ -** Processing line: ~ ship.sprite =~ -** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y),~ -** Processing line: ~ ship.sprite_path,~ -** Processing line: ~ ship.angle,~ -** Processing line: ~ ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite~ -** Processing line: ~ ship.label =~ -** Processing line: ~ apply_round_finished_alpha [ship.x,~ -** Processing line: ~ ship.y + 100,~ -** Processing line: ~ "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label~ -** Processing line: ~ end~ +** Processing line: ~ # Calculates the position and movement of the player on the screen.~ +** Processing line: ~ def calc_player~ +** Processing line: ~ state.player.x += state.player.dx # changes x based on dx (change in x)~ +** Processing line: ~ state.player.y += state.player.dy # changes y based on dy (change in y)~ ** Processing line: ~~ -** Processing line: ~ def render_flames sprite_size = 6~ -** Processing line: ~ outputs.sprites << state.flames.map do |p|~ -** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(p.x, p.y),~ -** Processing line: ~ 'sprites/flame.png', 0,~ -** Processing line: ~ p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ state.player.dx *= 0.9 # scales dx down~ +** Processing line: ~ state.player.dy *= 0.9 # scales dy down~ ** Processing line: ~~ -** Processing line: ~ def render_bullets sprite_size = 10~ -** Processing line: ~ outputs.sprites << state.bullets.map do |b|~ -** Processing line: ~ apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y),~ -** Processing line: ~ b.owner.bullet_sprite_path,~ -** Processing line: ~ 0, b.max_alpha].sprite~ -** Processing line: ~ end~ +** Processing line: ~ # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value.~ +** Processing line: ~ # This ensures that the player remains within the screen's scope.~ +** Processing line: ~ state.player.x = state.player.x.lesser(1280).greater(0)~ +** Processing line: ~ state.player.y = state.player.y.lesser(720).greater(0) # same with player's y~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def wrap_location! location~ -** Processing line: ~ location.x = grid.left if location.x > grid.right~ -** Processing line: ~ location.x = grid.right if location.x < grid.left~ -** Processing line: ~ location.y = grid.top if location.y < grid.bottom~ -** Processing line: ~ location.y = grid.bottom if location.y > grid.top~ -** Processing line: ~ location~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_thrusts~ -** Processing line: ~ state.flames =~ -** Processing line: ~ state.flames~ -** Processing line: ~ .reject(&:old?)~ -** Processing line: ~ .map do |p|~ -** Processing line: ~ p.speed *= 0.9~ -** Processing line: ~ p.y += p.angle.vector_y(p.speed)~ -** Processing line: ~ p.x += p.angle.vector_x(p.speed)~ -** Processing line: ~ wrap_location! p~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def all_ships~ -** Processing line: ~ [state.ship_blue, state.ship_red]~ -** Processing line: ~ end~ +** Processing line: ~ # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection~ +** Processing line: ~ # and added to the killed_zombies collection since any zombie that intersects with the player is killed.~ +** Processing line: ~ def calc_kill_zombie~ ** Processing line: ~~ -** Processing line: ~ def alive_ships~ -** Processing line: ~ all_ships.reject { |s| s.dead }~ -** Processing line: ~ end~ +** Processing line: ~ # Find all zombies that intersect with the player. They are considered killed.~ +** Processing line: ~ killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite }~ +** Processing line: ~ state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection~ +** Processing line: ~ state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies~ ** Processing line: ~~ -** Processing line: ~ def calc_bullet bullet~ -** Processing line: ~ bullet.y += bullet.angle.vector_y(bullet.speed)~ -** Processing line: ~ bullet.x += bullet.angle.vector_x(bullet.speed)~ -** Processing line: ~ wrap_location! bullet~ -** Processing line: ~ explode_bullet! bullet if bullet.old?~ -** Processing line: ~ return if bullet.exploded~ -** Processing line: ~ return if state.round_finished~ -** Processing line: ~ alive_ships.each do |s|~ -** Processing line: ~ if s != bullet.owner &&~ -** Processing line: ~ s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y))~ -** Processing line: ~ explode_bullet! bullet, 10, 5, 30~ -** Processing line: ~ s.damage += 1~ -** Processing line: ~ end~ +** Processing line: ~ if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame~ +** Processing line: ~ state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed~ +** Processing line: ~ # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method)~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_bullets~ -** Processing line: ~ state.bullets.each { |b| calc_bullet b }~ -** Processing line: ~ state.bullets.reject! { |b| b.exploded }~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255~ -** Processing line: ~ flame_count.times do~ -** Processing line: ~ state.flames << state.new_entity(type,~ -** Processing line: ~ { angle: 360.randomize(:ratio),~ -** Processing line: ~ speed: max_speed.randomize(:ratio),~ -** Processing line: ~ lifetime: lifetime,~ -** Processing line: ~ x: entity.x,~ -** Processing line: ~ y: entity.y,~ -** Processing line: ~ max_alpha: max_alpha })~ +** Processing line: ~ # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie.~ +** Processing line: ~ # Death_at stores the frame a zombie was killed.~ +** Processing line: ~ killed_this_frame.each do |z|~ +** Processing line: ~ z.death_at = state.tick_count~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10~ -** Processing line: ~ bullet.exploded = true~ -** Processing line: ~ create_explosion! :bullet_explosion,~ -** Processing line: ~ bullet,~ -** Processing line: ~ flame_override,~ -** Processing line: ~ max_speed,~ -** Processing line: ~ lifetime,~ -** Processing line: ~ bullet.max_alpha~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_ship ship~ -** Processing line: ~ ship.x += ship.dx~ -** Processing line: ~ ship.y += ship.dy~ -** Processing line: ~ wrap_location! ship~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_ships~ -** Processing line: ~ all_ships.each { |s| calc_ship s }~ -** Processing line: ~ return if all_ships.any? { |s| s.dead }~ -** Processing line: ~ return if state.round_finished~ -** Processing line: ~ return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite)~ -** Processing line: ~ state.ship_blue.damage = 5~ -** Processing line: ~ state.ship_red.damage = 5~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def create_thruster_flames! ship~ -** Processing line: ~ state.flames << state.new_entity(:ship_thruster,~ -** Processing line: ~ { angle: ship.angle + 180 + 60.randomize(:sign, :ratio),~ -** Processing line: ~ speed: 5.randomize(:ratio),~ -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ -** Processing line: ~ lifetime: 30,~ -** Processing line: ~ x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio),~ -** Processing line: ~ y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) })~ +** Processing line: ~ # Zombies are rejected from the killed_zombies collection depending on when they were killed.~ +** Processing line: ~ # They are rejected if more than 30 frames have passed since their death.~ +** Processing line: ~ state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_accelerate_ship should_move_ship, ship~ -** Processing line: ~ return if ship.dead~ -** Processing line: ~~ -** Processing line: ~ should_move_ship &&= (ship.dx + ship.dy).abs < 5~ +** Processing line: ~ # Uses input from the user to move the player around the screen.~ +** Processing line: ~ def input~ ** Processing line: ~~ -** Processing line: ~ if should_move_ship~ -** Processing line: ~ create_thruster_flames! ship~ -** Processing line: ~ ship.dx += ship.angle.vector_x 0.050~ -** Processing line: ~ ship.dy += ship.angle.vector_y 0.050~ -** Processing line: ~ else~ -** Processing line: ~ ship.dx *= 0.99~ -** Processing line: ~ ship.dy *= 0.99~ +** Processing line: ~ # If the "a" key or left key is pressed, the x position of the player decreases.~ +** Processing line: ~ # Otherwise, if the "d" key or right key is pressed, the x position of the player increases.~ +** Processing line: ~ if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left~ +** Processing line: ~ state.player.x -= 5~ +** Processing line: ~ elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right~ +** Processing line: ~ state.player.x += 5~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_accelerate~ -** Processing line: ~ input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue~ -** Processing line: ~ input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_turn_ship direction, ship~ -** Processing line: ~ ship.angle -= 3 * direction~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_turn~ -** Processing line: ~ input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue~ -** Processing line: ~ input_turn_ship inputs.controller_two.left_right, state.ship_red~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_bullet create_bullet, ship~ -** Processing line: ~ return unless create_bullet~ -** Processing line: ~ return if ship.dead~ -** Processing line: ~~ -** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ -** Processing line: ~ { owner: ship,~ -** Processing line: ~ angle: ship.angle,~ -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ -** Processing line: ~ speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y),~ -** Processing line: ~ lifetime: 120,~ -** Processing line: ~ sprite_size: 10,~ -** Processing line: ~ x: ship.x + ship.angle.vector_x * 32,~ -** Processing line: ~ y: ship.y + ship.angle.vector_y * 32 })~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_mine create_mine, ship~ -** Processing line: ~ return unless create_mine~ -** Processing line: ~ return if ship.dead~ -** Processing line: ~~ -** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ -** Processing line: ~ { owner: ship,~ -** Processing line: ~ angle: 360.randomize(:sign, :ratio),~ -** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ -** Processing line: ~ speed: 0.02,~ -** Processing line: ~ sprite_size: 10,~ -** Processing line: ~ lifetime: 600,~ -** Processing line: ~ x: ship.x + ship.angle.vector_x * -50,~ -** Processing line: ~ y: ship.y + ship.angle.vector_y * -50 })~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def input_bullets_and_mines~ -** Processing line: ~ return if state.bullets.length > 100~ ** Processing line: ~~ -** Processing line: ~ [~ -** Processing line: ~ [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space,~ -** Processing line: ~ inputs.controller_one.key_down.b || inputs.keyboard.key_down.down,~ -** Processing line: ~ state.ship_blue],~ -** Processing line: ~ [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red]~ -** Processing line: ~ ].each do |a_held, b_down, ship|~ -** Processing line: ~ input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship)~ -** Processing line: ~ input_mine(b_down, ship)~ +** Processing line: ~ # If the "w" or up key is pressed, the y position of the player increases.~ +** Processing line: ~ # Otherwise, if the "s" or down key is pressed, the y position of the player decreases.~ +** Processing line: ~ if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up~ +** Processing line: ~ state.player.y += 5~ +** Processing line: ~ elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down~ +** Processing line: ~ state.player.y -= 5~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_kill_ships~ -** Processing line: ~ alive_ships.find_all { |s| s.damage >= 5 }.each do |s|~ -** Processing line: ~ s.dead = true~ -** Processing line: ~ create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha~ +** Processing line: ~ # Sets the attack angle so the player can move and attack in the precise direction it wants to go.~ +** Processing line: ~ # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position).~ +** Processing line: ~ # Attack angle also contributes to the position of red square.~ +** Processing line: ~ if inputs.mouse.moved~ +** Processing line: ~ state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def calc_score~ -** Processing line: ~ return if state.round_finished~ -** Processing line: ~ return if alive_ships.length > 1~ ** Processing line: ~~ -** Processing line: ~ if alive_ships.first == state.ship_red~ -** Processing line: ~ state.ship_red_score += 1~ -** Processing line: ~ elsif alive_ships.first == state.ship_blue~ -** Processing line: ~ state.ship_blue_score += 1~ +** Processing line: ~ if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5~ +** Processing line: ~ state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y]~ +** Processing line: ~ state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set~ +** Processing line: ~ state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position~ +** Processing line: ~ state.player.dy = state.player.attack_angle.vector_y(25)~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ state.round_finished = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_reset_ships~ -** Processing line: ~ return unless state.round_finished~ -** Processing line: ~ state.round_finished_debounce ||= 2.seconds~ -** Processing line: ~ state.round_finished_debounce -= 1~ -** Processing line: ~ return if state.round_finished_debounce > 0~ -** Processing line: ~ start_new_round!~ +** Processing line: ~ # Sets the zombie spawn's countdown to a random number.~ +** Processing line: ~ # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!)~ +** Processing line: ~ def random_spawn_countdown minimum~ +** Processing line: ~ 10.randomize(:ratio, :sign).to_i + 60~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def start_new_round!~ -** Processing line: ~ state.ship_blue = new_blue_ship~ -** Processing line: ~ state.ship_red = new_red_ship~ -** Processing line: ~ state.round_finished = false~ -** Processing line: ~ state.round_finished_debounce = nil~ -** Processing line: ~ state.flames.clear~ -** Processing line: ~ state.bullets.clear~ +** Processing line: ~ # Helps to iterate through the images in the sprites folder by setting the animation index.~ +** Processing line: ~ # 3 frames is how long to show an image, and 6 is how many images to flip through.~ +** Processing line: ~ def animation_index at~ +** Processing line: ~ at.idiv(3).mod(6)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_winner~ -** Processing line: ~ calc_kill_ships~ -** Processing line: ~ calc_score~ -** Processing line: ~ calc_reset_ships~ +** Processing line: ~ # Animates the zombies by using the animation index to go through the images in the sprites folder.~ +** Processing line: ~ def animation_sprite zombie, at = nil~ +** Processing line: ~ at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created~ +** Processing line: ~ index = animation_index at~ +** Processing line: ~ "sprites/zombie-#{index}.png" # string interpolation to iterate through images~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $dueling_spaceship = DuelingSpaceships.new~ +** Processing line: ~ $protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new~ ** Processing line: ~~ ** Processing line: ~ def tick args~ -** Processing line: ~ args.grid.origin_center!~ -** Processing line: ~ $dueling_spaceship.inputs = args.inputs~ -** Processing line: ~ $dueling_spaceship.outputs = args.outputs~ -** Processing line: ~ $dueling_spaceship.state = args.state~ -** Processing line: ~ $dueling_spaceship.grid = args.grid~ -** Processing line: ~ $dueling_spaceship.tick~ +** Processing line: ~ $protect_the_puppies_from_the_zombies.grid = args.grid~ +** Processing line: ~ $protect_the_puppies_from_the_zombies.inputs = args.inputs~ +** Processing line: ~ $protect_the_puppies_from_the_zombies.state = args.state~ +** Processing line: ~ $protect_the_puppies_from_the_zombies.outputs = args.outputs~ +** Processing line: ~ $protect_the_puppies_from_the_zombies.tick~ +** Processing line: ~ tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_arcade/flappy_dragon/app/main.rb~ +** Processing line: ~* Mouse - Mouse Move Paint App - main.rb~ - H1 detected. -- Formatting line: ~99_genre_arcade/flappy_dragon/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Mouse - Mouse Move Paint App - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class FlappyDragon~ -** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ +** Processing line: ~ # ./samples/05_mouse/03_mouse_move_paint_app/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ process_inputs~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.flap_power = 11~ -** Processing line: ~ state.gravity = 0.9~ -** Processing line: ~ state.ceiling = 600~ -** Processing line: ~ state.ceiling_flap_power = 6~ -** Processing line: ~ state.wall_countdown_length = 100~ -** Processing line: ~ state.wall_gap_size = 100~ -** Processing line: ~ state.wall_countdown ||= 0~ -** Processing line: ~ state.hi_score ||= 0~ -** Processing line: ~ state.score ||= 0~ -** Processing line: ~ state.walls ||= []~ -** Processing line: ~ state.x ||= 50~ -** Processing line: ~ state.y ||= 500~ -** Processing line: ~ state.dy ||= 0~ -** Processing line: ~ state.scene ||= :menu~ -** Processing line: ~ state.scene_at ||= 0~ -** Processing line: ~ state.difficulty ||= :normal~ -** Processing line: ~ state.new_difficulty ||= :normal~ -** Processing line: ~ state.countdown ||= 4.seconds~ -** Processing line: ~ state.flash_at ||= 0~ -** Processing line: ~ end~ +** Processing line: ~ - Floor: Method that returns an integer number smaller than or equal to the original with no decimal.~ ** Processing line: ~~ -** Processing line: ~ def render~ -** Processing line: ~ outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1~ -** Processing line: ~ render_score~ -** Processing line: ~ render_menu~ -** Processing line: ~ render_game~ -** Processing line: ~ end~ +** Processing line: ~ For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this...~ +** Processing line: ~ puts a.floor()~ +** Processing line: ~ which would print out 13.~ +** Processing line: ~ (There is also a ceil method, which returns an integer number greater than or equal to the original~ +** Processing line: ~ with no decimal. If we had called ceil on the variable a, the result would have been 14.)~ ** Processing line: ~~ -** Processing line: ~ def render_score~ -** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ -** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ -** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ def render_menu~ -** Processing line: ~ return unless state.scene == :menu~ -** Processing line: ~ render_overlay~ +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ using their keys.~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ +** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ +** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ +** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ +** Processing line: ~ and on it goes.~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ -** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ +** Processing line: ~ puts numbers["one"]~ +** Processing line: ~ which would print "uno" to the console.~ ** Processing line: ~~ -** Processing line: ~ def render_overlay~ -** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ -** Processing line: ~ end~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ ** Processing line: ~~ -** Processing line: ~ def render_game~ -** Processing line: ~ render_game_over~ -** Processing line: ~ render_background~ -** Processing line: ~ render_walls~ -** Processing line: ~ render_dragon~ -** Processing line: ~ render_flash~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ ** Processing line: ~~ -** Processing line: ~ def render_game_over~ -** Processing line: ~ return unless state.scene == :game~ -** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ -** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ -** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in.~ ** Processing line: ~~ -** Processing line: ~ def render_background~ -** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ +** Processing line: ~ - args.outputs.labels: An array. The values in the array generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ scroll_point_at = state.tick_count~ -** Processing line: ~ scroll_point_at = state.scene_at if state.scene == :menu~ -** Processing line: ~ scroll_point_at = state.death_at if state.countdown > 0~ -** Processing line: ~ scroll_point_at ||= 0~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25)~ -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50)~ -** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80)~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ def render_walls~ -** Processing line: ~ state.walls.each do |w|~ -** Processing line: ~ w.sprites = [~ -** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ -** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ outputs.sprites << state.walls.map(&:sprites)~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app shows an empty grid that the user can paint on.~ +** Processing line: ~ # To paint, the user must keep their mouse presssed and drag it around the grid.~ +** Processing line: ~ # The "clear" button allows users to clear the grid so they can start over.~ ** Processing line: ~~ -** Processing line: ~ def render_dragon~ -** Processing line: ~ state.show_death = true if state.countdown == 3.seconds~ +** Processing line: ~ class PaintApp~ +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ ** Processing line: ~~ -** Processing line: ~ render_debug_hitbox false~ +** Processing line: ~ # Runs methods necessary for the game to function properly.~ +** Processing line: ~ def tick~ +** Processing line: ~ print_title~ +** Processing line: ~ add_grid~ +** Processing line: ~ check_click~ +** Processing line: ~ draw_buttons~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.show_death == false || !state.death_at~ -** Processing line: ~ animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at~ -** Processing line: ~ sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png"~ -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ -** Processing line: ~ else~ -** Processing line: ~ sprite_name = "sprites/dragon_die.png"~ -** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ -** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ -** Processing line: ~ state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1~ -** Processing line: ~ state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction~ -** Processing line: ~ state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6)~ -** Processing line: ~ end~ +** Processing line: ~ # Prints the title onto the screen by using a label.~ +** Processing line: ~ # Also separates the title from the grid with a line as a horizontal separator.~ +** Processing line: ~ def print_title~ +** Processing line: ~ args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ]~ +** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << state.dragon_sprite~ +** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ +** Processing line: ~ # The starting and ending positions have the same y values.~ +** Processing line: ~ def horizontal_separator y, x, x2~ +** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_debug_hitbox show~ -** Processing line: ~ return unless show~ -** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ -** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ -** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ -** Processing line: ~ end~ +** Processing line: ~ # Sets the starting position, ending position, and color for the vertical separator.~ +** Processing line: ~ # The starting and ending positions have the same x values.~ +** Processing line: ~ def vertical_separator x, y, y2~ +** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_flash~ -** Processing line: ~ return unless state.flash_at~ +** Processing line: ~ # Outputs a border and a grid containing empty squares onto the screen.~ +** Processing line: ~ def add_grid~ ** Processing line: ~~ -** Processing line: ~ outputs.primitives << [grid.rect,~ -** Processing line: ~ white,~ -** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ +** Processing line: ~ # Sets the x, y, height, and width of the grid.~ +** Processing line: ~ # There are 31 horizontal lines and 31 vertical lines in the grid.~ +** Processing line: ~ # Feel free to count them yourself before continuing!~ +** Processing line: ~ x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center~ +** Processing line: ~ lines_h = 31~ +** Processing line: ~ lines_v = 31~ ** Processing line: ~~ -** Processing line: ~ state.flash_at = 0 if state.flash_at.elapsed_time > 20~ -** Processing line: ~ end~ +** Processing line: ~ # Sets values for the grid's border, grid lines, and filled squares.~ +** Processing line: ~ # The filled_squares variable is initially set to an empty array.~ +** Processing line: ~ state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border~ +** Processing line: ~ state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method~ +** Processing line: ~ state.filled_squares ||= [] # there are no filled squares until the user fills them in~ ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ return unless state.scene == :game~ -** Processing line: ~ reset_game if state.countdown == 1~ -** Processing line: ~ state.countdown -= 1 and return if state.countdown > 0~ -** Processing line: ~ calc_walls~ -** Processing line: ~ calc_flap~ -** Processing line: ~ calc_game_over~ +** Processing line: ~ # Outputs the grid lines, border, and filled squares onto the screen.~ +** Processing line: ~ outputs.lines.concat state.grid_lines~ +** Processing line: ~ outputs.borders << state.grid_border~ +** Processing line: ~ outputs.solids << state.filled_squares~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_walls~ -** Processing line: ~ state.walls.each { |w| w.x -= 8 }~ -** Processing line: ~~ -** Processing line: ~ walls_count_before_removal = state.walls.length~ -** Processing line: ~~ -** Processing line: ~ state.walls.reject! { |w| w.x < -100 }~ +** Processing line: ~ # Draws the grid by adding in vertical and horizontal separators.~ +** Processing line: ~ def draw_grid x, y, h, w, lines_h, lines_v~ ** Processing line: ~~ -** Processing line: ~ state.score += 1 if state.walls.count < walls_count_before_removal~ +** Processing line: ~ # The grid starts off empty.~ +** Processing line: ~ grid = []~ ** Processing line: ~~ -** Processing line: ~ state.wall_countdown -= 1 and return if state.wall_countdown > 0~ +** Processing line: ~ # Calculates the placement and adds horizontal lines or separators into the grid.~ +** Processing line: ~ curr_y = y # start at the bottom of the box~ +** Processing line: ~ dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid~ +** Processing line: ~ lines_h.times do~ +** Processing line: ~ curr_y += dist_y # increment curr_y by the distance between the horizontal lines~ +** Processing line: ~ grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.walls << state.new_entity(:wall) do |w|~ -** Processing line: ~ w.x = grid.right~ -** Processing line: ~ w.opening = grid.top~ -** Processing line: ~ .randomize(:ratio)~ -** Processing line: ~ .greater(200)~ -** Processing line: ~ .lesser(520)~ -** Processing line: ~ w.bottom_height = w.opening - state.wall_gap_size~ -** Processing line: ~ w.top_y = w.opening + state.wall_gap_size~ +** Processing line: ~ # Calculates the placement and adds vertical lines or separators into the grid.~ +** Processing line: ~ curr_x = x # now start at the left of the box~ +** Processing line: ~ dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid~ +** Processing line: ~ lines_v.times do~ +** Processing line: ~ curr_x += dist_x # increment curr_x by the distance between the vertical lines~ +** Processing line: ~ grid << vertical_separator(curr_x, y + 1, y + h) # add separator~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.wall_countdown = state.wall_countdown_length~ -** Processing line: ~ end~ +** Processing line: ~ # paint_grid uses a hash to assign values to keys.~ +** Processing line: ~ state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h,~ +** Processing line: ~ "lines_v" => lines_v, "dist_x" => dist_x,~ +** Processing line: ~ "dist_y" => dist_y }~ ** Processing line: ~~ -** Processing line: ~ def calc_flap~ -** Processing line: ~ state.y += state.dy~ -** Processing line: ~ state.dy = state.dy.lesser state.flap_power~ -** Processing line: ~ state.dy -= state.gravity~ -** Processing line: ~ return if state.y < state.ceiling~ -** Processing line: ~ state.y = state.ceiling~ -** Processing line: ~ state.dy = state.dy.lesser state.ceiling_flap_power~ +** Processing line: ~ return grid~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_game_over~ -** Processing line: ~ return unless game_over?~ -** Processing line: ~~ -** Processing line: ~ state.death_at = state.tick_count~ -** Processing line: ~ state.death_from = state.walls.first~ -** Processing line: ~ state.death_fall_direction = -1~ -** Processing line: ~ state.death_fall_direction = 1 if state.x > state.death_from.x~ -** Processing line: ~ outputs.sounds << "sounds/hit-sound.wav"~ -** Processing line: ~ begin_countdown~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ process_inputs_menu~ -** Processing line: ~ process_inputs_game~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def process_inputs_menu~ -** Processing line: ~ return unless state.scene == :menu~ -** Processing line: ~~ -** Processing line: ~ changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select~ -** Processing line: ~ if inputs.mouse.click~ -** Processing line: ~ p = inputs.mouse.click.point~ -** Processing line: ~ if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800)~ -** Processing line: ~ changediff = true~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if changediff~ -** Processing line: ~ case state.new_difficulty~ -** Processing line: ~ when :easy~ -** Processing line: ~ state.new_difficulty = :normal~ -** Processing line: ~ when :normal~ -** Processing line: ~ state.new_difficulty = :hard~ -** Processing line: ~ when :hard~ -** Processing line: ~ state.new_difficulty = :flappy~ -** Processing line: ~ when :flappy~ -** Processing line: ~ state.new_difficulty = :easy~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a~ -** Processing line: ~ state.difficulty = state.new_difficulty~ -** Processing line: ~ change_to_scene :game~ -** Processing line: ~ reset_game false~ -** Processing line: ~ state.hi_score = 0~ -** Processing line: ~ begin_countdown~ +** Processing line: ~ # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values.~ +** Processing line: ~ # If the mouse is up, the user cannot drag the mouse.~ +** Processing line: ~ def check_click~ +** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ +** Processing line: ~ state.mouse_held = true # mouse is being held down~ +** Processing line: ~ elsif inputs.mouse.up # if mouse is up~ +** Processing line: ~ state.mouse_held = false # mouse is not being held down or dragged~ +** Processing line: ~ state.mouse_dragging = false~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b~ -** Processing line: ~ state.new_difficulty = state.difficulty~ -** Processing line: ~ change_to_scene :game~ +** Processing line: ~ if state.mouse_held && # mouse needs to be down~ +** Processing line: ~ !inputs.mouse.click && # must not be first click~ +** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag"~ +** Processing line: ~ state.mouse_dragging = true~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def process_inputs_game~ -** Processing line: ~ return unless state.scene == :game~ ** Processing line: ~~ -** Processing line: ~ clicked_menu = false~ -** Processing line: ~ if inputs.mouse.click~ -** Processing line: ~ p = inputs.mouse.click.point~ -** Processing line: ~ clicked_menu = (p.y >= 620) && (p.x < 275)~ -** Processing line: ~ end~ +** Processing line: ~ # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type.~ +** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ +** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ ** Processing line: ~~ -** Processing line: ~ if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start~ -** Processing line: ~ change_to_scene :menu~ -** Processing line: ~ elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ state.dy += state.flap_power~ -** Processing line: ~ state.flapped_at = state.tick_count~ -** Processing line: ~ outputs.sounds << "sounds/fly-sound.wav"~ +** Processing line: ~ # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type.~ +** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ +** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def scrolling_background at, path, rate, y = 0~ -** Processing line: ~ [~ -** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ -** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ # Sets the definition of a grid box and handles user input to fill in or clear grid boxes.~ +** Processing line: ~ def search_lines (point, input_type)~ +** Processing line: ~ point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash~ +** Processing line: ~ point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash~ ** Processing line: ~~ -** Processing line: ~ def white~ -** Processing line: ~ [255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ # Remove code following the .floor and see what happens when you try to fill in grid squares~ +** Processing line: ~ point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"]~ +** Processing line: ~ point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"]~ ** Processing line: ~~ -** Processing line: ~ def large_white_typeset~ -** Processing line: ~ [5, 0, 255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ point.x += state.paint_grid["x"]~ +** Processing line: ~ point.y += state.paint_grid["y"]~ ** Processing line: ~~ -** Processing line: ~ def at_beginning?~ -** Processing line: ~ state.walls.count == 0~ -** Processing line: ~ end~ +** Processing line: ~ # Sets definition of a grid box, meaning its x, y, width, and height.~ +** Processing line: ~ # Floor is called on the point.x and point.y variables.~ +** Processing line: ~ # Ceil method is called on values of the distance hash keys, setting the width and height of a box.~ +** Processing line: ~ grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ]~ ** Processing line: ~~ -** Processing line: ~ def dragon_collision_box~ -** Processing line: ~ state.dragon_sprite~ -** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ -** Processing line: ~ .rect_shift_right(10)~ -** Processing line: ~ .rect_shift_up(state.dy * 2)~ +** Processing line: ~ if input_type == :click # if user clicks their mouse~ +** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ +** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ +** Processing line: ~ else~ +** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ +** Processing line: ~ end~ +** Processing line: ~ elsif input_type == :drag # if user drags mouse~ +** Processing line: ~ unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in~ +** Processing line: ~ state.filled_squares << grid_box # the box is filled in and added to filled_squares~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def game_over?~ -** Processing line: ~ return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning?~ +** Processing line: ~ # Creates and outputs a "Clear" button on the screen using a label and a border.~ +** Processing line: ~ # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty.~ +** Processing line: ~ def draw_buttons~ +** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ +** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ ** Processing line: ~~ -** Processing line: ~ state.walls~ -** Processing line: ~ .flat_map { |w| w.sprites }~ -** Processing line: ~ .any? do |s|~ -** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # The x and y positions are set to display the label in the center of the button.~ +** Processing line: ~ # Try changing the first two parameters to simply x, y and see what happens to the text placement!~ +** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border~ +** Processing line: ~ state.clear_button.border ||= [x, y, w, h]~ ** Processing line: ~~ -** Processing line: ~ def collision_forgiveness~ -** Processing line: ~ case state.difficulty~ -** Processing line: ~ when :easy~ -** Processing line: ~ 0.9~ -** Processing line: ~ when :normal~ -** Processing line: ~ 0.7~ -** Processing line: ~ when :hard~ -** Processing line: ~ 0.5~ -** Processing line: ~ when :flappy~ -** Processing line: ~ 0.3~ -** Processing line: ~ else~ -** Processing line: ~ 0.9~ +** Processing line: ~ # If the mouse is clicked inside the borders of the clear button,~ +** Processing line: ~ # the filled_squares collection is emptied and the squares are cleared.~ +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ +** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred~ +** Processing line: ~ state.filled_squares.clear~ +** Processing line: ~ inputs.mouse.previous_click = nil~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def countdown_text~ -** Processing line: ~ state.countdown ||= -1~ -** Processing line: ~ return "" if state.countdown == 0~ -** Processing line: ~ return "GO!" if state.countdown.idiv(60) == 0~ -** Processing line: ~ return "GAME OVER" if state.death_at~ -** Processing line: ~ return "READY?"~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def begin_countdown~ -** Processing line: ~ state.countdown = 4.seconds~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << state.clear_button.label~ +** Processing line: ~ outputs.borders << state.clear_button.border~ ** Processing line: ~~ -** Processing line: ~ def score_text~ -** Processing line: ~ return "" unless state.countdown > 1.seconds~ -** Processing line: ~ return "" unless state.death_at~ -** Processing line: ~ return "SCORE: 0 (LOL)" if state.score == 0~ -** Processing line: ~ return "HI SCORE: #{state.score}" if state.score == state.hi_score~ -** Processing line: ~ return "SCORE: #{state.score}"~ +** Processing line: ~ # When the clear button is clicked, the color of the button changes~ +** Processing line: ~ # and the transparency changes, as well. If you change the time from~ +** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ +** Processing line: ~ if state.clear_button.clicked_at~ +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def reset_game set_flash = true~ -** Processing line: ~ state.flash_at = state.tick_count if set_flash~ -** Processing line: ~ state.walls = []~ -** Processing line: ~ state.y = 500~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ state.hi_score = state.hi_score.greater(state.score)~ -** Processing line: ~ state.score = 0~ -** Processing line: ~ state.wall_countdown = state.wall_countdown_length.fdiv(2)~ -** Processing line: ~ state.show_death = false~ -** Processing line: ~ state.death_at = nil~ -** Processing line: ~ end~ +** Processing line: ~ $paint_app = PaintApp.new~ ** Processing line: ~~ -** Processing line: ~ def change_to_scene scene~ -** Processing line: ~ state.scene = scene~ -** Processing line: ~ state.scene_at = state.tick_count~ -** Processing line: ~ inputs.keyboard.clear~ -** Processing line: ~ inputs.controller_one.clear~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ $paint_app.inputs = args.inputs~ +** Processing line: ~ $paint_app.state = args.state~ +** Processing line: ~ $paint_app.grid = args.grid~ +** Processing line: ~ $paint_app.args = args~ +** Processing line: ~ $paint_app.outputs = args.outputs~ +** Processing line: ~ $paint_app.tick~ +** Processing line: ~ tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw."~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $flappy_dragon = FlappyDragon.new~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $flappy_dragon.grid = args.grid~ -** Processing line: ~ $flappy_dragon.inputs = args.inputs~ -** Processing line: ~ $flappy_dragon.state = args.state~ -** Processing line: ~ $flappy_dragon.outputs = args.outputs~ -** Processing line: ~ $flappy_dragon.tick~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_arcade/pong/app/main.rb~ +** Processing line: ~* Mouse - Coordinate Systems - main.rb~ - H1 detected. -- Formatting line: ~99_genre_arcade/pong/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Mouse - Coordinate Systems - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ input args~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/05_mouse/04_coordinate_systems/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.state.ball.debounce ||= 3 * 60~ -** Processing line: ~ args.state.ball.size ||= 10~ -** Processing line: ~ args.state.ball.size_half ||= args.state.ball.size / 2~ -** Processing line: ~ args.state.ball.x ||= 640~ -** Processing line: ~ args.state.ball.y ||= 360~ -** Processing line: ~ args.state.ball.dx ||= 5.randomize(:sign)~ -** Processing line: ~ args.state.ball.dy ||= 5.randomize(:sign)~ -** Processing line: ~ args.state.left_paddle.y ||= 360~ -** Processing line: ~ args.state.right_paddle.y ||= 360~ -** Processing line: ~ args.state.paddle.h ||= 120~ -** Processing line: ~ args.state.paddle.w ||= 10~ -** Processing line: ~ args.state.left_paddle.score ||= 0~ -** Processing line: ~ args.state.right_paddle.score ||= 0~ -** Processing line: ~ end~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ render_center_line args~ -** Processing line: ~ render_scores args~ -** Processing line: ~ render_countdown args~ -** Processing line: ~ render_ball args~ -** Processing line: ~ render_paddles args~ -** Processing line: ~ render_instructions args~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen.~ +** Processing line: ~ Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for~ +** Processing line: ~ position to know the mouse's coordinates.~ +** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ ** Processing line: ~~ -** Processing line: ~ begin :render_methods~ -** Processing line: ~ def render_center_line args~ -** Processing line: ~ args.outputs.lines << [640, 0, 640, 720]~ -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ def render_scores args~ -** Processing line: ~ args.outputs.labels << [~ -** Processing line: ~ [320, 650, args.state.left_paddle.score, 10, 1],~ -** Processing line: ~ [960, 650, args.state.right_paddle.score, 10, 1]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ ** Processing line: ~~ -** Processing line: ~ def render_countdown args~ -** Processing line: ~ return unless args.state.ball.debounce > 0~ -** Processing line: ~ args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1]~ -** Processing line: ~ end~ +** Processing line: ~ - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse.~ ** Processing line: ~~ -** Processing line: ~ def render_ball args~ -** Processing line: ~ args.outputs.solids << solid_ball(args)~ -** Processing line: ~ end~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ def render_paddles args~ -** Processing line: ~ args.outputs.solids << solid_left_paddle(args)~ -** Processing line: ~ args.outputs.solids << solid_right_paddle(args)~ -** Processing line: ~ end~ +** Processing line: ~ In this sample app, string interpolation is used to show the current position of the mouse~ +** Processing line: ~ in a label.~ ** Processing line: ~~ -** Processing line: ~ def render_instructions args~ -** Processing line: ~ args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1]~ -** Processing line: ~ args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.labels: An array that generates a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ def calc args~ -** Processing line: ~ args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0~ -** Processing line: ~ calc_move_ball args~ -** Processing line: ~ calc_collision_with_left_paddle args~ -** Processing line: ~ calc_collision_with_right_paddle args~ -** Processing line: ~ calc_collision_with_walls args~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.solids: An array that generates a solid.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ begin :calc_methods~ -** Processing line: ~ def calc_move_ball args~ -** Processing line: ~ args.state.ball.x += args.state.ball.dx~ -** Processing line: ~ args.state.ball.y += args.state.ball.dy~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.lines: An array that generates a line.~ +** Processing line: ~ The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA]~ +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ ** Processing line: ~~ -** Processing line: ~ def calc_collision_with_left_paddle args~ -** Processing line: ~ if solid_left_paddle(args).intersect_rect? solid_ball(args)~ -** Processing line: ~ args.state.ball.dx *= -1~ -** Processing line: ~ elsif args.state.ball.x < 0~ -** Processing line: ~ args.state.right_paddle.score += 1~ -** Processing line: ~ calc_reset_round args~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ def calc_collision_with_right_paddle args~ -** Processing line: ~ if solid_right_paddle(args).intersect_rect? solid_ball(args)~ -** Processing line: ~ args.state.ball.dx *= -1~ -** Processing line: ~ elsif args.state.ball.x > 1280~ -** Processing line: ~ args.state.left_paddle.score += 1~ -** Processing line: ~ calc_reset_round args~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the~ +** Processing line: ~ # coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or~ +** Processing line: ~ # four quadrants by pressing the button.~ ** Processing line: ~~ -** Processing line: ~ def calc_collision_with_walls args~ -** Processing line: ~ if args.state.ball.y + args.state.ball.size_half > 720~ -** Processing line: ~ args.state.ball.y = 720 - args.state.ball.size_half~ -** Processing line: ~ args.state.ball.dy *= -1~ -** Processing line: ~ elsif args.state.ball.y - args.state.ball.size_half < 0~ -** Processing line: ~ args.state.ball.y = args.state.ball.size_half~ -** Processing line: ~ args.state.ball.dy *= -1~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ ** Processing line: ~~ -** Processing line: ~ def calc_reset_round args~ -** Processing line: ~ args.state.ball.x = 640~ -** Processing line: ~ args.state.ball.y = 360~ -** Processing line: ~ args.state.ball.dx = 5.randomize(:sign)~ -** Processing line: ~ args.state.ball.dy = 5.randomize(:sign)~ -** Processing line: ~ args.state.ball.debounce = 3 * 60~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # The addition and subtraction in the first two parameters of the label and solid~ +** Processing line: ~ # ensure that the outputs don't overlap each other. Try removing them and see what happens.~ +** Processing line: ~ pos = args.inputs.mouse.position # stores coordinates of mouse's position~ +** Processing line: ~ args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates~ +** Processing line: ~ args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering~ ** Processing line: ~~ -** Processing line: ~ def input args~ -** Processing line: ~ input_left_paddle args~ -** Processing line: ~ input_right_paddle args~ -** Processing line: ~ end~ +** Processing line: ~ button = [0, 0, 370, 50] # sets definition of toggle button~ +** Processing line: ~ args.outputs.borders << button # outputs button as border (not filled in)~ +** Processing line: ~ args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button~ +** Processing line: ~ args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants~ +** Processing line: ~ args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants~ ** Processing line: ~~ -** Processing line: ~ begin :input_methods~ -** Processing line: ~ def input_left_paddle args~ -** Processing line: ~ if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s~ -** Processing line: ~ args.state.left_paddle.y -= 40~ -** Processing line: ~ elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w~ -** Processing line: ~ args.state.left_paddle.y += 40~ +** Processing line: ~ if args.inputs.mouse.click # if the user clicks the mouse~ +** Processing line: ~ pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates)~ +** Processing line: ~ if pos.inside_rect? button # if the click occurred inside the button~ +** Processing line: ~ if args.grid.name == :bottom_left # if the grid shows bottom left as origin~ +** Processing line: ~ args.grid.origin_center! # origin will be shown in center~ +** Processing line: ~ else~ +** Processing line: ~ args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_right_paddle args~ -** Processing line: ~ if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l~ -** Processing line: ~ args.state.right_paddle.y -= 40~ -** Processing line: ~ elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o~ -** Processing line: ~ args.state.right_paddle.y += 40~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit."~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ begin :assets~ -** Processing line: ~ def solid_ball args~ -** Processing line: ~ centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def solid_left_paddle args~ -** Processing line: ~ centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def solid_right_paddle args~ -** Processing line: ~ centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def centered_rect x, y, w, h~ -** Processing line: ~ [x - w / 2, y - h / 2, w, h]~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def centered_rect_vertically x, y, w, h~ -** Processing line: ~ [x, y - h / 2, w, h]~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_arcade/snakemoji/app/main.rb~ +** Processing line: ~* Save Load - Save Load Game - main.rb~ - H1 detected. -- Formatting line: ~99_genre_arcade/snakemoji/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Save Load - Save Load Game - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # coding: utf-8~ -** Processing line: ~ ################################~ -** Processing line: ~ # So I was working on a snake game while~ -** Processing line: ~ # learning DragonRuby, and at some point I had a thought~ -** Processing line: ~ # what if I use "😀" as a function name, surely it wont work right...?~ -** Processing line: ~ # RIGHT....?~ -** Processing line: ~ # BUT IT DID, IT WORKED~ -** Processing line: ~ # it all went downhill from then~ -** Processing line: ~ # Created by Anton K. (ai Doge)~ -** Processing line: ~ # https://gist.github.com/scorp200~ -** Processing line: ~ #############LICENSE############~ -** Processing line: ~ # Feel free to use this anywhere and however you want~ -** Processing line: ~ # You can sell this to EA for $1,000,000 if you want, its completely free.~ -** Processing line: ~ # Just rememeber you are helping this... thing... to spread...~ -** Processing line: ~ # ALSO! I am not liable for any mental, physical or financial damage caused.~ -** Processing line: ~ #############LICENSE############~ +** Processing line: ~ # ./samples/06_save_load/01_save_load_game/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ class Array~ -** Processing line: ~ #Helper function~ -** Processing line: ~ def move! vector~ -** Processing line: ~ self.x += vector.x~ -** Processing line: ~ self.y += vector.y~ -** Processing line: ~ return self~ -** Processing line: ~ end~ +** Processing line: ~ - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful~ +** Processing line: ~ because with a given symbol name, you can refer to the same object throughout~ +** Processing line: ~ a Ruby program.~ ** Processing line: ~~ -** Processing line: ~ #Helper function to draw snake body~ -** Processing line: ~ def draw! 🎮, 📺, color~ -** Processing line: ~ translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]~ -** Processing line: ~ end~ +** Processing line: ~ In this sample app, we're using symbols for our buttons. We have buttons that~ +** Processing line: ~ light fires, save, load, etc. Each of these buttons has a distinct symbol like~ +** Processing line: ~ :light_fire, :save_game, :load_game, etc.~ ** Processing line: ~~ -** Processing line: ~ #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is **~ -** Processing line: ~ #I kept trying different combinations of symbols, when suddenly...~ -** Processing line: ~ def 😀 value~ -** Processing line: ~ self.map {|d| d * value}~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - to_sym: Returns the symbol corresponding to the given string; creates the symbol~ +** Processing line: ~ if it does not already exist.~ +** Processing line: ~ For example,~ +** Processing line: ~ 'car'.to_sym~ +** Processing line: ~ would return the symbol :car.~ ** Processing line: ~~ -** Processing line: ~ #Draw stuff with an offset~ -** Processing line: ~ def translate output_collection, ⛓, what~ -** Processing line: ~ what.x += ⛓.x~ -** Processing line: ~ what.y += ⛓.y~ -** Processing line: ~ output_collection << what~ -** Processing line: ~ end~ +** Processing line: ~ - last: Returns the last element of an array.~ ** Processing line: ~~ -** Processing line: ~ BLUE = [33, 150, 243]~ -** Processing line: ~ RED = [244, 67, 54]~ -** Processing line: ~ GOLD = [255, 193, 7]~ -** Processing line: ~ LAST = 0~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args.state~ -** Processing line: ~ render args.state, args.outputs~ -** Processing line: ~ input args.state, args.inputs~ -** Processing line: ~ update args.state~ -** Processing line: ~ end~ +** Processing line: ~ - num1.lesser(num2): finds the lower value of the given options.~ +** Processing line: ~ For example, in the statement~ +** Processing line: ~ a = 4.lesser(3)~ +** Processing line: ~ 3 has a lower value than 4, which means that the value of a would be set to 3,~ +** Processing line: ~ but if the statement had been~ +** Processing line: ~ a = 4.lesser(5)~ +** Processing line: ~ 4 has a lower value than 5, which means that the value of a would be set to 4.~ ** Processing line: ~~ -** Processing line: ~ def update 🎮~ -** Processing line: ~ #Update every 10 frames~ -** Processing line: ~ if 🎮.tick_count.mod_zero? 10~ -** Processing line: ~ #Add new snake body piece at head's location~ -** Processing line: ~ 🎮.🐍 << [*🎮.🤖]~ -** Processing line: ~ #Assign Next Direction to Direction~ -** Processing line: ~ 🎮.🚗 = *🎮.🚦~ +** Processing line: ~ - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers.~ +** Processing line: ~ For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0~ ** Processing line: ~~ -** Processing line: ~ #Trim the snake a bit if its longer than current size~ -** Processing line: ~ if 🎮.🐍.length > 🎮.🛒~ -** Processing line: ~ 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1]~ -** Processing line: ~ end~ +** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ #Move the head in the Direction~ -** Processing line: ~ 🎮.🤖.move! 🎮.🚗~ +** Processing line: ~ - args.outputs.labels: An array. Values generate a label.~ +** Processing line: ~ Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ #If Head is outside the playing field, or inside snake's body restart game~ -** Processing line: ~ if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖}~ -** Processing line: ~ LAST = 🎮.💰~ -** Processing line: ~ 🎮.as_hash.clear~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ +** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ +** Processing line: ~ or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ #If head lands on food add size and score~ -** Processing line: ~ if 🎮.🤖 == 🎮.🍎~ -** Processing line: ~ 🎮.🛒 += 1~ -** Processing line: ~ 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5~ -** Processing line: ~ spawn_🍎 🎮~ -** Processing line: ~ puts 🎮.🍎~ -** Processing line: ~ end~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This code allows users to perform different tasks, such as saving and loading the game.~ +** Processing line: ~ # Users also have options to reset the game and light a fire.~ +** Processing line: ~~ +** Processing line: ~ class TextedBasedGame~ +** Processing line: ~~ +** Processing line: ~ # Contains methods needed for game to run properly.~ +** Processing line: ~ # Increments tick count by 1 each time it runs (60 times in a single second)~ +** Processing line: ~ def tick~ +** Processing line: ~ default~ +** Processing line: ~ show_intro~ +** Processing line: ~ state.engine_tick_count += 1~ +** Processing line: ~ tick_fire~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ #Every second remove 1 point~ -** Processing line: ~ if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60)~ -** Processing line: ~ 🎮.💰 -= 1~ +** Processing line: ~ # Sets default values.~ +** Processing line: ~ # The ||= ensures that a variable's value is only set to the value following the = sign~ +** Processing line: ~ # if the value has not already been set before. Intialization happens only in the first frame.~ +** Processing line: ~ def default~ +** Processing line: ~ state.engine_tick_count ||= 0~ +** Processing line: ~ state.active_module ||= :room~ +** Processing line: ~ state.fire_progress ||= 0~ +** Processing line: ~ state.fire_ready_in ||= 10~ +** Processing line: ~ state.previous_fire ||= :dead~ +** Processing line: ~ state.fire ||= :dead~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def spawn_🍎 🎮~ -** Processing line: ~ #Food~ -** Processing line: ~ 🎮.🍎 ||= [*🎮.🤖]~ -** Processing line: ~ #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body~ -** Processing line: ~ while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do~ -** Processing line: ~ 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)]~ +** Processing line: ~ def show_intro~ +** Processing line: ~ return unless state.engine_tick_count == 0 # return unless the game just started~ +** Processing line: ~ set_story_line "awake." # calls set_story_line method, sets to "awake"~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render 🎮, 📺~ -** Processing line: ~ #Paint the background black~ -** Processing line: ~ 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255]~ -** Processing line: ~ #Draw a border for the playing field~ -** Processing line: ~ translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255]~ +** Processing line: ~ # Sets story line.~ +** Processing line: ~ def set_story_line story_line~ +** Processing line: ~ state.story_line = story_line # story line set to value of parameter~ +** Processing line: ~ state.active_module = :alert # active module set to alert~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ #Draw the snake's body~ -** Processing line: ~ 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end~ -** Processing line: ~ #Draw the head~ -** Processing line: ~ 🎮.🤖.draw! 🎮, 📺, BLUE~ -** Processing line: ~ #Draw the food~ -** Processing line: ~ 🎮.🍎.draw! 🎮, 📺, RED~ +** Processing line: ~ # Clears story line.~ +** Processing line: ~ def clear_storyline~ +** Processing line: ~ state.active_module = :none # active module set to none~ +** Processing line: ~ state.story_line = nil # story line is cleared, set to nil (or empty)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ #Draw current score~ -** Processing line: ~ translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD]~ -** Processing line: ~ #Draw your last score, if any~ -** Processing line: ~ translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0]~ -** Processing line: ~ #Draw starting message, only if Direction is 0~ -** Processing line: ~ translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0]~ -** Processing line: ~ end~ +** Processing line: ~ # Determines fire progress (how close the fire is to being ready to light).~ +** Processing line: ~ def tick_fire~ +** Processing line: ~ return if state.active_module == :alert # return if active module is alert~ +** Processing line: ~ state.fire_progress += 1 # increment fire progress~ +** Processing line: ~ # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value.~ +** Processing line: ~ state.fire_progress = state.fire_progress.lesser(state.fire_ready_in)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input 🎮, 🕹~ -** Processing line: ~ #Left and Right keyboard input, only change if X direction is 0~ -** Processing line: ~ if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0~ -** Processing line: ~ 🎮.🚦 = [-1, 0]~ -** Processing line: ~ elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0~ -** Processing line: ~ 🎮.🚦 = [1, 0]~ +** Processing line: ~ # Sets the value of fire (whether it is dead or roaring), and the story line~ +** Processing line: ~ def light_fire~ +** Processing line: ~ return unless fire_ready? # returns unless the fire is ready to be lit~ +** Processing line: ~ state.fire = :roaring # fire is lit, set to roaring~ +** Processing line: ~ state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit~ +** Processing line: ~ if state.fire != state.previous_fire~ +** Processing line: ~ set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation~ +** Processing line: ~ state.previous_fire = state.fire~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ #Up and Down keyboard input, only change if Y direction is 0~ -** Processing line: ~ if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0~ -** Processing line: ~ 🎮.🚦 = [0, 1]~ -** Processing line: ~ elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0~ -** Processing line: ~ 🎮.🚦 = [0, -1]~ +** Processing line: ~ # Checks if the fire is ready to be lit. Returns a boolean value.~ +** Processing line: ~ def fire_ready?~ +** Processing line: ~ # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10),~ +** Processing line: ~ # the fire is ready to be lit.~ +** Processing line: ~ state.fire_progress == state.fire_ready_in~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults 🎮~ -** Processing line: ~ #Playing field size~ -** Processing line: ~ 🎮.🗺 ||= [20, 20]~ -** Processing line: ~ #Scale for drawing, screen height / Field height~ -** Processing line: ~ 🎮.⚖️ ||= 720 / 🎮.🗺.y~ -** Processing line: ~ #Offset, offset all rendering to the center of the screen~ -** Processing line: ~ 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0]~ -** Processing line: ~ #Padding, make the snake body slightly smaller than the scale~ -** Processing line: ~ 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i~ -** Processing line: ~ #Snake Size~ -** Processing line: ~ 🎮.🛒 ||= 3~ -** Processing line: ~ #Snake head, the only part we are actually controlling~ -** Processing line: ~ 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2]~ -** Processing line: ~ #Snake body map, follows the head~ -** Processing line: ~ 🎮.🐍 ||= []~ -** Processing line: ~ #Direction the head moves to~ -** Processing line: ~ 🎮.🚗 ||= [0, 0]~ -** Processing line: ~ #Next_Direction, during input check only change this variable and then when game updates asign this to Direction~ -** Processing line: ~ 🎮.🚦 ||= [*🎮.🚗]~ -** Processing line: ~ #Your score~ -** Processing line: ~ 🎮.💰 ||= 0~ -** Processing line: ~ #Spawns Food randomly~ -** Processing line: ~ spawn_🍎(🎮) unless 🎮.🍎?~ -** Processing line: ~ end~ +** Processing line: ~ # Divides the value of the fire_progress variable by 10 to determine how close the user is to~ +** Processing line: ~ # being able to light a fire.~ +** Processing line: ~ def light_fire_progress~ +** Processing line: ~ state.fire_progress.fdiv(10) # float division~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # Defines fire as the state.fire variable.~ +** Processing line: ~ def fire~ +** Processing line: ~ state.fire~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Sets the title of the room.~ +** Processing line: ~ def room_title~ +** Processing line: ~ return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead~ +** Processing line: ~ return "a room that is lit" # room is lit if the fire is not dead~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 99_genre_arcade/solar_system/app/main.rb~ -- H1 detected. -- Formatting line: ~99_genre_arcade/solar_system/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ # Sets the active_module to room.~ +** Processing line: ~ def go_to_room~ +** Processing line: ~ state.active_module = :room~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4~ -** Processing line: ~ # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8~ +** Processing line: ~ # Defines active_module as the state.active_module variable.~ +** Processing line: ~ def active_module~ +** Processing line: ~ state.active_module~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.state.x ||= 640~ -** Processing line: ~ args.state.y ||= 360~ -** Processing line: ~ args.state.stars ||= 100.map do~ -** Processing line: ~ [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand]~ +** Processing line: ~ # Defines story_line as the state.story_line variable.~ +** Processing line: ~ def story_line~ +** Processing line: ~ state.story_line~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ -** Processing line: ~ s.s = 100~ -** Processing line: ~ s.path = 'sprites/sun.png'~ +** Processing line: ~ # Update every 60 frames (or every second)~ +** Processing line: ~ def should_tick?~ +** Processing line: ~ state.tick_count.mod_zero?(60)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.planets = [~ -** Processing line: ~ [:mercury, 65, 5, 88],~ -** Processing line: ~ [:venus, 100, 10, 225],~ -** Processing line: ~ [:earth, 120, 10, 365],~ -** Processing line: ~ [:mars, 140, 8, 687],~ -** Processing line: ~ [:jupiter, 280, 30, 365 * 11.8],~ -** Processing line: ~ [:saturn, 350, 20, 365 * 29.5],~ -** Processing line: ~ [:uranus, 400, 15, 365 * 84],~ -** Processing line: ~ [:neptune, 440, 15, 365 * 164.8],~ -** Processing line: ~ [:pluto, 480, 5, 365 * 247.8],~ -** Processing line: ~ ].map do |name, distance, size, year_in_days|~ -** Processing line: ~ args.state.new_entity(name) do |p|~ -** Processing line: ~ p.path = "sprites/#{name}.png"~ -** Processing line: ~ p.distance = distance * 0.7~ -** Processing line: ~ p.s = size * 0.7~ -** Processing line: ~ p.year_in_days = year_in_days~ +** Processing line: ~ # Sets the value of the game state provider.~ +** Processing line: ~ def initialize game_state_provider~ +** Processing line: ~ @game_state_provider = game_state_provider~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Defines the game state.~ +** Processing line: ~ # Any variable prefixed with an @ symbol is an instance variable.~ +** Processing line: ~ def state~ +** Processing line: ~ @game_state_provider.state~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Saves the state of the game in a text file called game_state.txt.~ +** Processing line: ~ def save~ +** Processing line: ~ $gtk.serialize_state('game_state.txt', state)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Loads the game state from the game_state.txt text file.~ +** Processing line: ~ # If the load is unsuccessful, the user is informed since the story line indicates the failure.~ +** Processing line: ~ def load~ +** Processing line: ~ parsed_state = $gtk.deserialize_state('game_state.txt')~ +** Processing line: ~ if !parsed_state~ +** Processing line: ~ set_story_line "no game to load. press save first."~ +** Processing line: ~ else~ +** Processing line: ~ $gtk.args.state = parsed_state~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.ship ||= args.state.new_entity(:ship) do |s|~ -** Processing line: ~ s.x = 1280 * rand~ -** Processing line: ~ s.y = 720 * rand~ -** Processing line: ~ s.angle = 0~ +** Processing line: ~ # Resets the game.~ +** Processing line: ~ def reset~ +** Processing line: ~ $gtk.reset~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def to_sprite args, entity~ -** Processing line: ~ x = 0~ -** Processing line: ~ y = 0~ +** Processing line: ~ class TextedBasedGamePresenter~ +** Processing line: ~ attr_accessor :state, :outputs, :inputs~ ** Processing line: ~~ -** Processing line: ~ if entity.year_in_days~ -** Processing line: ~ day = args.state.tick_count~ -** Processing line: ~ day_in_year = day % entity.year_in_days~ -** Processing line: ~ entity.random_start_day ||= day_in_year * rand~ -** Processing line: ~ percentage_of_year = day_in_year.fdiv(entity.year_in_days)~ -** Processing line: ~ angle = 365 * percentage_of_year~ -** Processing line: ~ x = angle.vector_x(entity.distance)~ -** Processing line: ~ y = angle.vector_y(entity.distance)~ +** Processing line: ~ # Creates empty collection called highlights.~ +** Processing line: ~ # Calls methods necessary to run the game.~ +** Processing line: ~ def tick~ +** Processing line: ~ state.layout.highlights ||= []~ +** Processing line: ~ game.tick if game.should_tick?~ +** Processing line: ~ render~ +** Processing line: ~ process_input~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path]~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs a label of the tick count (passage of time) and calls all render methods.~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.labels << [10, 30, state.tick_count]~ +** Processing line: ~ render_alert~ +** Processing line: ~ render_room~ +** Processing line: ~ render_highlights~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ args.outputs.solids << [0, 0, 1280, 720]~ +** Processing line: ~ # Outputs a label onto the screen that shows the story line, and also outputs a "close" button.~ +** Processing line: ~ def render_alert~ +** Processing line: ~ return unless game.active_module == :alert~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b|~ -** Processing line: ~ [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b]~ +** Processing line: ~ outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label~ +** Processing line: ~ outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << to_sprite(args, args.state.sun)~ -** Processing line: ~ args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p }~ -** Processing line: ~ args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle]~ -** Processing line: ~ end~ +** Processing line: ~ def render_room~ +** Processing line: ~ return unless game.active_module == :room~ +** Processing line: ~ outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen~ ** Processing line: ~~ -** Processing line: ~ def calc args~ -** Processing line: ~ args.state.stars = args.state.stars.map do |x, y, speed, r, g, b|~ -** Processing line: ~ x += speed~ -** Processing line: ~ y += speed~ -** Processing line: ~ x = 0 if x > 1280~ -** Processing line: ~ y = 0 if y > 720~ -** Processing line: ~ [x, y, speed, r, g, b]~ +** Processing line: ~ # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value~ +** Processing line: ~ # that positions it 60 pixels lower than the previous output.~ +** Processing line: ~~ +** Processing line: ~ # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance)~ +** Processing line: ~ outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress)~ +** Processing line: ~ outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button~ +** Processing line: ~ outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button~ +** Processing line: ~ outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button~ +** Processing line: ~ outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.outputs.sounds << 'sounds/bg.ogg'~ +** Processing line: ~ # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection.~ +** Processing line: ~ def render_highlights~ +** Processing line: ~ state.layout.highlights.each do |h| # for each highlight in the collection~ +** Processing line: ~ h.lifetime -= 1 # decrease the value of its lifetime~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection~ +** Processing line: ~ [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight~ +** Processing line: ~ # transparency changes; divide lifetime by max_lifetime, multiply result by 255~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # reject highlights from collection that have no remaining lifetime~ +** Processing line: ~ state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 }~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs args~ -** Processing line: ~ if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left~ -** Processing line: ~ args.state.ship.angle += 1~ -** Processing line: ~ elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right~ -** Processing line: ~ args.state.ship.angle -= 1~ +** Processing line: ~ # Checks whether or not a button was clicked.~ +** Processing line: ~ # Returns a boolean value.~ +** Processing line: ~ def process_input~ +** Processing line: ~ button = button_clicked? # calls button_clicked? method~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a~ -** Processing line: ~ args.state.ship.x += args.state.ship.angle.x_vector~ -** Processing line: ~ args.state.ship.y += args.state.ship.angle.y_vector~ +** Processing line: ~ # Returns a boolean value.~ +** Processing line: ~ # Finds the button that was clicked from the button list and determines what method to call.~ +** Processing line: ~ # Adds a highlight to the highlights collection.~ +** Processing line: ~ def button_clicked?~ +** Processing line: ~ return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click~ +** Processing line: ~ button = @button_list.find do |k, v| # goes through button_list to find button clicked~ +** Processing line: ~ click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button?~ +** Processing line: ~ end~ +** Processing line: ~ return unless button # return unless a button was clicked~ +** Processing line: ~ method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game)~ +** Processing line: ~ if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists)~ +** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in button list hash~ +** Processing line: ~~ +** Processing line: ~ # declares each highlight as a new entity, sets properties~ +** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ +** Processing line: ~ h.x = border.x~ +** Processing line: ~ h.y = border.y~ +** Processing line: ~ h.w = border.w~ +** Processing line: ~ h.h = border.h~ +** Processing line: ~ h.max_lifetime = 10~ +** Processing line: ~ h.lifetime = h.max_lifetime~ +** Processing line: ~ h.color = [120, 120, 180] # sets color to shade of purple~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ self.send method_to_call # invoke method identified by symbol~ +** Processing line: ~ else # otherwise, if self doesn't respond to given method~ +** Processing line: ~ border = button[1][:primitives].last # sets border definition using value of last key in hash~ +** Processing line: ~~ +** Processing line: ~ # declares each highlight as a new entity, sets properties~ +** Processing line: ~ state.layout.highlights << state.new_entity(:highlight) do |h|~ +** Processing line: ~ h.x = border.x~ +** Processing line: ~ h.y = border.y~ +** Processing line: ~ h.w = border.w~ +** Processing line: ~ h.h = border.h~ +** Processing line: ~ h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true~ +** Processing line: ~ h.lifetime = h.max_lifetime~ +** Processing line: ~ h.color = [120, 80, 80] # sets color to dark color~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # instructions for users on how to add the missing method_to_call to the code~ +** Processing line: ~ puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:"~ +** Processing line: ~ puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition."~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "```"~ +** Processing line: ~ puts "class TextedBasedGamePresenter <--- find this class and put the method below in it"~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts " def #{method_to_call}"~ +** Processing line: ~ puts " puts 'Yay that worked!'"~ +** Processing line: ~ puts " end"~ +** Processing line: ~ puts ""~ +** Processing line: ~ puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement."~ +** Processing line: ~ puts "```"~ +** Processing line: ~ puts ""~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ defaults args~ -** Processing line: ~ render args~ -** Processing line: ~ calc args~ -** Processing line: ~ process_inputs args~ +** Processing line: ~ # Returns the position of the mouse when it is clicked.~ +** Processing line: ~ def click_pos~ +** Processing line: ~ return nil unless inputs.mouse.click # returns nil unless the mouse was clicked~ +** Processing line: ~ return inputs.mouse.click.point # returns location of mouse click (coordinates)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)~ +** Processing line: ~ def button id, x, y, text~ +** Processing line: ~ @button_list[id] ||= { # assigns values to hash keys~ +** Processing line: ~ id: id,~ +** Processing line: ~ text: text,~ +** Processing line: ~ primitives: [~ +** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # positions label inside border~ +** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ @button_list[id][:primitives] # returns label and border for buttons~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Creates a progress bar (used for lighting the fire) and sets its values.~ +** Processing line: ~ def progress_bar id, x, y, text, percentage~ +** Processing line: ~ @button_list[id] = { # assigns values to hash keys~ +** Processing line: ~ id: id,~ +** Processing line: ~ text: text,~ +** Processing line: ~ primitives: [~ +** Processing line: ~ [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray)~ +** Processing line: ~ [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border~ +** Processing line: ~ [x, y, 300, 50].border, # sets definition of border~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by~ +** Processing line: ~ # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in.~ +** Processing line: ~ @button_list[id][:primitives][0][2] = 300 * percentage~ +** Processing line: ~ @button_list[id][:primitives]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Defines the game.~ +** Processing line: ~ def game~ +** Processing line: ~ @game~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Initalizes the game and creates an empty list of buttons.~ +** Processing line: ~ def initialize~ +** Processing line: ~ @game = TextedBasedGame.new self~ +** Processing line: ~ @button_list ||= {}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Clears the storyline and takes the user to the room.~ +** Processing line: ~ def alert_dismiss_clicked~ +** Processing line: ~ game.clear_storyline~ +** Processing line: ~ game.go_to_room~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Lights the fire when the user clicks the "light fire" option.~ +** Processing line: ~ def light_fire_clicked~ +** Processing line: ~ game.light_fire~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Saves the game when the user clicks the "save" option.~ +** Processing line: ~ def save_game_clicked~ +** Processing line: ~ game.save~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Resets the game when the user clicks the "reset" option.~ +** Processing line: ~ def reset_game_clicked~ +** Processing line: ~ game.reset~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Loads the game when the user clicks the "load" option.~ +** Processing line: ~ def load_game_clicked~ +** Processing line: ~ game.load~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def r~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~ $text_based_rpg = TextedBasedGamePresenter.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $text_based_rpg.state = args.state~ +** Processing line: ~ $text_based_rpg.outputs = args.outputs~ +** Processing line: ~ $text_based_rpg.inputs = args.inputs~ +** Processing line: ~ $text_based_rpg.tick~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_crafting/craft_game_starting_point/app/main.rb~ +** Processing line: ~* Advanced Rendering - Simple Render Targets - main.rb~ - H1 detected. -- Formatting line: ~99_genre_crafting/craft_game_starting_point/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Simple Render Targets - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # ==================================================~ -** Processing line: ~ # A NOTE TO JAM CRAFT PARTICIPANTS:~ -** Processing line: ~ # The comments and code in here are just as small piece of DragonRuby's capabilities.~ -** Processing line: ~ # Be sure to check out the rest of the sample apps. Start with README.txt and go from there!~ -** Processing line: ~ # ==================================================~ -** Processing line: ~~ -** Processing line: ~ # def tick args is the entry point into your game. This function is called at~ -** Processing line: ~ # a fixed update time of 60hz (60 fps).~ +** Processing line: ~ # ./samples/07_advanced_rendering/01_simple_render_targets/app/main.rb~ ** Processing line: ~ def tick args~ -** Processing line: ~ # The defaults function intitializes the game.~ -** Processing line: ~ defaults args~ -** Processing line: ~~ -** Processing line: ~ # After the game is initialized, render it.~ -** Processing line: ~ render args~ -** Processing line: ~~ -** Processing line: ~ # After rendering the player should be able to respond to input.~ -** Processing line: ~ input args~ -** Processing line: ~~ -** Processing line: ~ # After responding to input, the game performs any additional calculations.~ -** Processing line: ~ calc args~ -** Processing line: ~ end~ +** Processing line: ~ # args.outputs.render_targets are really really powerful.~ +** Processing line: ~ # They essentially allow you to create a sprite programmatically and cache the result.~ ** Processing line: ~~ -** Processing line: ~ def defaults args~ -** Processing line: ~ # hide the mouse cursor for this game, we are going to render our own cursor~ +** Processing line: ~ # Create a render_target of a :block and a :gradient on tick zero.~ ** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.gtk.hide_cursor~ +** Processing line: ~ args.render_target(:block).solids << [0, 0, 1280, 100]~ +** Processing line: ~~ +** Processing line: ~ # The gradient is actually just a collection of black solids with increasing~ +** Processing line: ~ # opacities.~ +** Processing line: ~ args.render_target(:gradient).solids << 90.map_with_index do |x|~ +** Processing line: ~ 50.map_with_index do |y|~ +** Processing line: ~ [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255]~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.click_ripples ||= []~ +** Processing line: ~ # Take the :block render_target and present it horizontally centered.~ +** Processing line: ~ # Use a subsection of the render_targetd specified by source_x,~ +** Processing line: ~ # source_y, source_w, source_h.~ +** Processing line: ~ args.outputs.sprites << { x: 0,~ +** Processing line: ~ y: 310,~ +** Processing line: ~ w: 1280,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ path: :block,~ +** Processing line: ~ source_x: 0,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: 1280,~ +** Processing line: ~ source_h: 100 }~ ** Processing line: ~~ -** Processing line: ~ # everything is on a 1280x720 virtual canvas, so you can~ -** Processing line: ~ # hardcode locations~ -** Processing line: ~~ -** Processing line: ~ # define the borders for where the inventory is located~ -** Processing line: ~ # args.state is a data structure that accepts any arbitrary parameters~ -** Processing line: ~ # so you can create an object graph without having to create any classes.~ -** Processing line: ~~ -** Processing line: ~ # Bottom left is 0, 0. Top right is 1280, 720.~ -** Processing line: ~ # The inventory area is at the top of the screen~ -** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ -** Processing line: ~ # used to decide the with and height~ -** Processing line: ~ args.state.sprite_size = 80~ +** Processing line: ~ # After rendering :block, render gradient on top of :block.~ +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :gradient]~ ** Processing line: ~~ -** Processing line: ~ args.state.inventory_border.w = args.state.sprite_size * 10~ -** Processing line: ~ args.state.inventory_border.h = args.state.sprite_size * 3~ -** Processing line: ~ args.state.inventory_border.x = 10~ -** Processing line: ~ args.state.inventory_border.y = 710 - args.state.inventory_border.h~ +** Processing line: ~ args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255]~ +** Processing line: ~ tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # define the borders for where the crafting area is located~ -** Processing line: ~ # the crafting area is below the inventory area~ -** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ -** Processing line: ~ # used to decide the with and height~ -** Processing line: ~ args.state.craft_border.x = 10~ -** Processing line: ~ args.state.craft_border.y = 220~ -** Processing line: ~ args.state.craft_border.w = args.state.sprite_size * 3~ -** Processing line: ~ args.state.craft_border.h = args.state.sprite_size * 3~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # define the area where results are located~ -** Processing line: ~ # the crafting result is to the right of the craft area~ -** Processing line: ~ args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size~ -** Processing line: ~ args.state.result_border.y = 220 + args.state.sprite_size~ -** Processing line: ~ args.state.result_border.w = args.state.sprite_size~ -** Processing line: ~ args.state.result_border.h = args.state.sprite_size~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # initialize items for the first time if they are nil~ -** Processing line: ~ # you start with 15 wood, 1 chest, and 5 plank~ -** Processing line: ~ # Ruby has built in syntax for dictionaries (they look a lot like json objects).~ -** Processing line: ~ # Ruby also has a special type called a Symbol denoted with a : followed by a word.~ -** Processing line: ~ # Symbols are nice because they remove the need for magic strings.~ -** Processing line: ~ if !args.state.items~ -** Processing line: ~ args.state.items = [~ -** Processing line: ~ {~ -** Processing line: ~ id: :wood, # :wood is a Symbol, this is better than using "wood" for the id~ -** Processing line: ~ quantity: 15,~ -** Processing line: ~ path: 'sprites/wood.png',~ -** Processing line: ~ location: :inventory,~ -** Processing line: ~ ordinal_x: 0, ordinal_y: 0~ -** Processing line: ~ },~ -** Processing line: ~ {~ -** Processing line: ~ id: :chest,~ -** Processing line: ~ quantity: 1,~ -** Processing line: ~ path: 'sprites/chest.png',~ -** Processing line: ~ location: :inventory,~ -** Processing line: ~ ordinal_x: 1, ordinal_y: 0~ -** Processing line: ~ },~ -** Processing line: ~ {~ -** Processing line: ~ id: :plank,~ -** Processing line: ~ quantity: 5,~ -** Processing line: ~ path: 'sprites/plank.png',~ -** Processing line: ~ location: :inventory,~ -** Processing line: ~ ordinal_x: 2, ordinal_y: 0~ -** Processing line: ~ },~ -** Processing line: ~ ]~ +** Processing line: ~ $gtk.reset~ ** Processing line: ~~ -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ -** Processing line: ~ # locations assuming that the width and height are 80~ -** Processing line: ~ args.state.items.each { |item| set_inventory_position args, item }~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # define all the oridinal positions of the inventory slots~ -** Processing line: ~ if !args.state.inventory_area~ -** Processing line: ~ args.state.inventory_area = [~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 3, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 4, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 5, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 6, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 7, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 8, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 9, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 3, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 4, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 5, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 6, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 7, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 8, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 9, ordinal_y: 2 },~ -** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ -** Processing line: ~ # locations assuming that the width and height are 80~ -** Processing line: ~ args.state.inventory_area.each { |i| set_inventory_position args, i }~ +** Processing line: ~* Advanced Rendering - Render Targets With Alphas - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Targets With Alphas - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # if you want to see the result you can use the Ruby function called "puts".~ -** Processing line: ~ # Uncomment this line to see the value.~ -** Processing line: ~ # puts args.state.inventory_area~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/02_render_targets_with_alphas/app/main.rb~ +** Processing line: ~ # This sample is meant to show you how to do that dripping transition thing~ +** Processing line: ~ # at the start of the original Doom. Most of this file is here to animate~ +** Processing line: ~ # a scene to wipe away; the actual wipe effect is in the last 20 lines or~ +** Processing line: ~ # so.~ ** Processing line: ~~ -** Processing line: ~ # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt.~ -** Processing line: ~ # To bring up DragonRuby's Console, press the ~ key within the game.~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.reset # reset all game state if reloaded.~ ** Processing line: ~~ -** Processing line: ~ # define all the oridinal positions of the craft slots~ -** Processing line: ~ if !args.state.craft_area~ -** Processing line: ~ args.state.craft_area = [~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ -** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ -** Processing line: ~ ]~ +** Processing line: ~ def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance~ +** Processing line: ~ numblocks = 10~ ** Processing line: ~~ -** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ -** Processing line: ~ # locations assuming that the width and height are 80~ -** Processing line: ~ args.state.craft_area.each { |c| set_craft_position args, c }~ +** Processing line: ~ for i in 1..numblocks do~ +** Processing line: ~ angle = ((360 / numblocks) * i) + angleoffset~ +** Processing line: ~ radians = angle * (Math::PI / 180)~ +** Processing line: ~ x = (xoffset + (distance * Math.cos(radians))).round~ +** Processing line: ~ y = (yoffset + (distance * Math.sin(radians))).round~ +** Processing line: ~ pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def draw_scene args, pass~ +** Processing line: ~ pass.solids << [0, 360, 1280, 360, 0, 0, 200]~ +** Processing line: ~ pass.solids << [0, 0, 1280, 360, 0, 127, 0]~ ** Processing line: ~~ -** Processing line: ~ def render args~ -** Processing line: ~ # for the results area, create a sprite that show its boundaries~ -** Processing line: ~ args.outputs.primitives << { x: args.state.result_border.x,~ -** Processing line: ~ y: args.state.result_border.y,~ -** Processing line: ~ w: args.state.result_border.w,~ -** Processing line: ~ h: args.state.result_border.h,~ -** Processing line: ~ path: 'sprites/border-black.png' }~ +** Processing line: ~ blocksize = 100~ +** Processing line: ~ angleoffset = args.state.tick_count * 2.5~ +** Processing line: ~ centerx = (1280 - blocksize) / 2~ +** Processing line: ~ centery = (720 - blocksize) / 2~ ** Processing line: ~~ -** Processing line: ~ # for each inventory spot, create a sprite~ -** Processing line: ~ # args.outputs.primitives is how DragonRuby performs a render.~ -** Processing line: ~ # Adding a single hash or multiple hashes to this array will tell~ -** Processing line: ~ # DragonRuby to render those primitives on that frame.~ +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500~ +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325~ +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200~ +** Processing line: ~ circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The .map function on Array is used instead of any kind of looping.~ -** Processing line: ~ # .map returns a new object for every object within an Array.~ -** Processing line: ~ args.outputs.primitives << args.state.inventory_area.map do |a|~ -** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ segments = 160~ ** Processing line: ~~ -** Processing line: ~ # for each craft spot, create a sprite~ -** Processing line: ~ args.outputs.primitives << args.state.craft_area.map do |a|~ -** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ +** Processing line: ~ # On the first tick, initialize some stuff.~ +** Processing line: ~ if !args.state.yoffsets~ +** Processing line: ~ args.state.baseyoff = 0~ +** Processing line: ~ args.state.yoffsets = []~ +** Processing line: ~ for i in 0..segments do~ +** Processing line: ~ args.state.yoffsets << rand * 100~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # after the borders have been rendered, render the~ -** Processing line: ~ # items within those slots (and allow for highlighting)~ -** Processing line: ~ # if an item isn't currently being held~ -** Processing line: ~ allow_inventory_highlighting = !args.state.held_item~ -** Processing line: ~~ -** Processing line: ~ # go through each item and render them~ -** Processing line: ~ # use Array's find_all method to remove any items that are currently being held~ -** Processing line: ~ args.state.items.find_all { |item| item[:location] != :held }.map do |item|~ -** Processing line: ~ # if an item is currently being held, don't render it in it's spot within the~ -** Processing line: ~ # inventory or craft area (this is handled via the find_all method).~ -** Processing line: ~~ -** Processing line: ~ # the item_prefab returns a hash containing all the visual components of an item.~ -** Processing line: ~ # the main sprite, the black background, the quantity text, and a hover indication~ -** Processing line: ~ # if the mouse is currently hovering over the item.~ -** Processing line: ~ args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse)~ +** Processing line: ~ # Just draw some random stuff for a few seconds.~ +** Processing line: ~ args.state.static_debounce ||= 60 * 2.5~ +** Processing line: ~ if args.state.static_debounce > 0~ +** Processing line: ~ last_frame = args.state.static_debounce == 1~ +** Processing line: ~ target = last_frame ? args.render_target(:last_frame) : args.outputs~ +** Processing line: ~ draw_scene args, target~ +** Processing line: ~ args.state.static_debounce -= 1~ +** Processing line: ~ return unless last_frame~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # The last thing we want to render is the item currently being held.~ -** Processing line: ~ args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse)~ -** Processing line: ~~ -** Processing line: ~ args.outputs.primitives << args.state.click_ripples~ +** Processing line: ~ # build up the wipe...~ ** Processing line: ~~ -** Processing line: ~ # render a mouse cursor since we have the OS cursor hidden~ -** Processing line: ~ args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ -** Processing line: ~ end~ +** Processing line: ~ # this is the thing we're wiping to.~ +** Processing line: ~ args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ]~ ** Processing line: ~~ -** Processing line: ~ # Alrighty! This is where all the fun happens~ -** Processing line: ~ def input args~ -** Processing line: ~ # if the mouse is clicked and not item is currently being held~ -** Processing line: ~ # args.state.held_item is nil when the game starts.~ -** Processing line: ~ # If the player clicks, the property args.inputs.mouse.click will~ -** Processing line: ~ # be a non nil value, we don't want to process any of the code here~ -** Processing line: ~ # if the mouse hasn't been clicked~ -** Processing line: ~ return if !args.inputs.mouse.click~ +** Processing line: ~ return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding~ ** Processing line: ~~ -** Processing line: ~ # if a click occurred, add a ripple to the ripple queue~ -** Processing line: ~ args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ +** Processing line: ~ segmentw = 1280 / segments~ ** Processing line: ~~ -** Processing line: ~ # if the mouse has been clicked, and no item is currently held...~ -** Processing line: ~ if !args.state.held_item~ -** Processing line: ~ # see if any of the items intersect the pointer using the inside_rect? method~ -** Processing line: ~ # the find method will either return the first object that returns true~ -** Processing line: ~ # for the match clause, or it'll return nil if nothing matches the match clause~ -** Processing line: ~ found = args.state.items.find do |item|~ -** Processing line: ~ # for each item in args.state.items, run the following boolean check~ -** Processing line: ~ args.inputs.mouse.click.point.inside_rect?(item)~ +** Processing line: ~ x = 0~ +** Processing line: ~ for i in 0..segments do~ +** Processing line: ~ yoffset = 0~ +** Processing line: ~ if args.state.yoffsets[i] < args.state.baseyoff~ +** Processing line: ~ yoffset = args.state.baseyoff - args.state.yoffsets[i]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if an item intersects the mouse pointer, then set the item's location to :held and~ -** Processing line: ~ # set args.state.held_item to the item for later reference~ -** Processing line: ~ if found~ -** Processing line: ~ args.state.held_item = found~ -** Processing line: ~ found[:location] = :held~ -** Processing line: ~ end~ +** Processing line: ~ # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment.~ +** Processing line: ~ args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ]~ +** Processing line: ~ x += segmentw~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if the mouse is clicked and an item is currently beign held....~ -** Processing line: ~ elsif args.state.held_item~ -** Processing line: ~ # determine if a slot within the craft area was clicked~ -** Processing line: ~ craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ +** Processing line: ~ args.state.baseyoff += 4~ ** Processing line: ~~ -** Processing line: ~ # also determine if a slot within the inventory area was clicked~ -** Processing line: ~ inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ +** Processing line: ~ tick_instructions args, "Sample app shows an advanced usage of render_target."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if the click was within a craft area~ -** Processing line: ~ if craft_area~ -** Processing line: ~ # check to see if an item is already there and ignore the click if an item is found~ -** Processing line: ~ # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal~ -** Processing line: ~ # position~ -** Processing line: ~ item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y]~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if an item *doesn't* exist in the craft area~ -** Processing line: ~ if !item_already_there~ -** Processing line: ~ # if the quantity they are currently holding is greater than 1~ -** Processing line: ~ if args.state.held_item[:quantity] > 1~ -** Processing line: ~ # remove one item (creating a seperate item of the same type), and place it~ -** Processing line: ~ # at the oridinal position and location of the craft area~ -** Processing line: ~ # the .merge method on Hash creates a new Hash, but updates any values~ -** Processing line: ~ # passed as arguments to merge~ -** Processing line: ~ new_item = args.state.held_item.merge(quantity: 1,~ -** Processing line: ~ location: :craft,~ -** Processing line: ~ ordinal_x: craft_area[:ordinal_x],~ -** Processing line: ~ ordinal_y: craft_area[:ordinal_y])~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # after the item is crated, place it into the args.state.items collection~ -** Processing line: ~ args.state.items << new_item~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # then subtract one from the held item~ -** Processing line: ~ args.state.held_item[:quantity] -= 1~ ** Processing line: ~~ -** Processing line: ~ # if the craft area is available and there is only one item being held~ -** Processing line: ~ elsif args.state.held_item[:quantity] == 1~ -** Processing line: ~ # instead of creating any new items just set the location of the held item~ -** Processing line: ~ # to the oridinal position of the craft area, and then nil out the~ -** Processing line: ~ # held item state so that a new item can be picked up~ -** Processing line: ~ args.state.held_item[:location] = :craft~ -** Processing line: ~ args.state.held_item[:ordinal_x] = craft_area[:ordinal_x]~ -** Processing line: ~ args.state.held_item[:ordinal_y] = craft_area[:ordinal_y]~ -** Processing line: ~ args.state.held_item = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Advanced Rendering - Render Target Viewports - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Target Viewports - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # if the selected area is an inventory area (as opposed to within the craft area)~ -** Processing line: ~ elsif inventory_area~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/03_render_target_viewports/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # check to see if there is already an item in that inventory slot~ -** Processing line: ~ # the item_at_inventory_slot helper method returns an item or nil~ -** Processing line: ~ item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y]~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ # if there is already an item there, and the item types/id match~ -** Processing line: ~ if item_already_there && item_already_there[:id] == args.state.held_item[:id]~ -** Processing line: ~ # then merge the item quantities~ -** Processing line: ~ held_quantity = args.state.held_item[:quantity]~ -** Processing line: ~ item_already_there[:quantity] += held_quantity~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ For example, if we want to create a new button, we would declare it as a new entity and~ +** Processing line: ~ then define its properties. (Remember, you can use state to define ANY property and it will~ +** Processing line: ~ be retained across frames.)~ ** Processing line: ~~ -** Processing line: ~ # remove the item being held from the items collection (since it's quantity is now 0)~ -** Processing line: ~ args.state.items.reject! { |i| i[:location] == :held }~ +** Processing line: ~ If you have a solar system and you're creating args.state.sun and setting its image path to an~ +** Processing line: ~ image in the sprites folder, you would do the following:~ +** Processing line: ~ (See samples/99_sample_nddnug_workshop for more details.)~ ** Processing line: ~~ -** Processing line: ~ # nil out the held_item so a new item can be picked up~ -** Processing line: ~ args.state.held_item = nil~ +** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ +** Processing line: ~ s.path = 'sprites/sun.png'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if there currently isn't an item there, then put the held item in the slot~ -** Processing line: ~ elsif !item_already_there~ -** Processing line: ~ args.state.held_item[:location] = :inventory~ -** Processing line: ~ args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x]~ -** Processing line: ~ args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y]~ +** Processing line: ~ - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ ** Processing line: ~~ -** Processing line: ~ # nil out the held_item so a new item can be picked up~ -** Processing line: ~ args.state.held_item = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ For example, if we have a variable~ +** Processing line: ~ name = "Ruby"~ +** Processing line: ~ then the line~ +** Processing line: ~ puts "How are you, #{name}?"~ +** Processing line: ~ would print "How are you, Ruby?" to the console.~ +** Processing line: ~ (Remember, string interpolation only works with double quotes!)~ ** Processing line: ~~ -** Processing line: ~ # the calc method is executed after input~ -** Processing line: ~ def calc args~ -** Processing line: ~ # make sure that the real position of the inventory~ -** Processing line: ~ # items are updated every frame to ensure that they~ -** Processing line: ~ # are placed correctly given their location and oridinal positions~ -** Processing line: ~ # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place)~ -** Processing line: ~ args.state.items.each do |item|~ -** Processing line: ~ # based on the location of the item, invoke the correct pixel conversion method~ -** Processing line: ~ if item[:location] == :inventory~ -** Processing line: ~ set_inventory_position args, item~ -** Processing line: ~ elsif item[:location] == :craft~ -** Processing line: ~ set_craft_position args, item~ -** Processing line: ~ elsif item[:location] == :held~ -** Processing line: ~ # if the item is held, center the item around the mouse pointer~ -** Processing line: ~ args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half~ -** Processing line: ~ args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - Ternary operator (?): Similar to if statement; first evalulates whether a statement is~ +** Processing line: ~ true or false, and then executes a command depending on that result.~ +** Processing line: ~ For example, if we had a variable~ +** Processing line: ~ grade = 75~ +** Processing line: ~ and used the ternary operator in the command~ +** Processing line: ~ pass_or_fail = grade > 65 ? "pass" : "fail"~ +** Processing line: ~ then the value of pass_or_fail would be "pass" since grade's value was greater than 65.~ ** Processing line: ~~ -** Processing line: ~ # for each hash/sprite in the click ripples queue,~ -** Processing line: ~ # expand its size by 20 percent and decrease its alpha~ -** Processing line: ~ # by 10.~ -** Processing line: ~ args.state.click_ripples.each do |ripple|~ -** Processing line: ~ delta_w = ripple.w * 1.2 - ripple.w~ -** Processing line: ~ delta_h = ripple.h * 1.2 - ripple.h~ -** Processing line: ~ ripple.x -= delta_w.half~ -** Processing line: ~ ripple.y -= delta_h.half~ -** Processing line: ~ ripple.w += delta_w~ -** Processing line: ~ ripple.h += delta_h~ -** Processing line: ~ ripple.a -= 10~ -** Processing line: ~ end~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ # remove any items from the collection where the alpha value is less than equal to~ -** Processing line: ~ # zero using the reject! method (reject with an exclamation point at the end changes the~ -** Processing line: ~ # array value in place, while reject without the exclamation point returns a new array).~ -** Processing line: ~ args.state.click_ripples.reject! { |ripple| ripple.a <= 0 }~ -** Processing line: ~ end~ +** Processing line: ~ - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual~ +** Processing line: ~ 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720).~ ** Processing line: ~~ -** Processing line: ~ # helper function for finding an item at a craft slot~ -** Processing line: ~ def item_at_craft_slot args, ordinal_x, ordinal_y~ -** Processing line: ~ args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ -** Processing line: ~ end~ +** Processing line: ~ - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction~ +** Processing line: ~ by adding or subracting.~ ** Processing line: ~~ -** Processing line: ~ # helper function for finding an item at an inventory slot~ -** Processing line: ~ def item_at_inventory_slot args, ordinal_x, ordinal_y~ -** Processing line: ~ args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#inside_rect?: An array with at least two values is considered a point. An array~ +** Processing line: ~ with at least four values is considered a rect. The inside_rect? function returns true~ +** Processing line: ~ or false depending on if the point is inside the rect.~ ** Processing line: ~~ -** Processing line: ~ # helper function that creates a visual representation of an item~ -** Processing line: ~ def item_prefab args, item, should_highlight, mouse~ -** Processing line: ~ return nil unless item~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ overlay = nil~ +** Processing line: ~ - args.inputs.mouse.click: This property will be set if the mouse was clicked.~ +** Processing line: ~ For more information about the mouse, go to mygame/documentation/07-mouse.md.~ ** Processing line: ~~ -** Processing line: ~ x = item.x~ -** Processing line: ~ y = item.y~ -** Processing line: ~ w = item.w~ -** Processing line: ~ h = item.h~ +** Processing line: ~ - args.inputs.keyboard.key_up.KEY: The value of the properties will be set~ +** Processing line: ~ to the frame that the key_up event occurred (the frame correlates~ +** Processing line: ~ to args.state.tick_count).~ +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ ** Processing line: ~~ -** Processing line: ~ if should_highlight && mouse.point.inside_rect?(item)~ -** Processing line: ~ overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, }~ -** Processing line: ~ end~ +** Processing line: ~ - args.state.labels:~ +** Processing line: ~ The parameters for a label are~ +** Processing line: ~ 1. the position (x, y)~ +** Processing line: ~ 2. the text~ +** Processing line: ~ 3. the size~ +** Processing line: ~ 4. the alignment~ +** Processing line: ~ 5. the color (red, green, and blue saturations)~ +** Processing line: ~ 6. the alpha (or transparency)~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ [~ -** Processing line: ~ # sprites are hashes with a path property, this is the main sprite~ -** Processing line: ~ { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], },~ +** Processing line: ~ - args.state.lines:~ +** Processing line: ~ The parameters for a line are~ +** Processing line: ~ 1. the starting position (x, y)~ +** Processing line: ~ 2. the ending position (x2, y2)~ +** Processing line: ~ 3. the color (red, green, and blue saturations)~ +** Processing line: ~ 4. the alpha (or transparency)~ +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ ** Processing line: ~~ -** Processing line: ~ # this represents the black area in the bottom right corner of the main sprite so that the~ -** Processing line: ~ # quantity is visible~ -** Processing line: ~ { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property~ +** Processing line: ~ - args.state.solids (and args.state.borders):~ +** Processing line: ~ The parameters for a solid (or border) are~ +** Processing line: ~ 1. the position (x, y)~ +** Processing line: ~ 2. the width (w)~ +** Processing line: ~ 3. the height (h)~ +** Processing line: ~ 4. the color (r, g, b)~ +** Processing line: ~ 5. the alpha (or transparency)~ +** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ # labels are hashes with a text property~ -** Processing line: ~ { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, },~ +** Processing line: ~ - args.state.sprites:~ +** Processing line: ~ The parameters for a sprite are~ +** Processing line: ~ 1. the position (x, y)~ +** Processing line: ~ 2. the width (w)~ +** Processing line: ~ 3. the height (h)~ +** Processing line: ~ 4. the image path~ +** Processing line: ~ 5. the angle~ +** Processing line: ~ 6. the alpha (or transparency)~ +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered)~ -** Processing line: ~ overlay~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app shows different objects that can be used when making games, such as labels,~ +** Processing line: ~ # lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used.~ ** Processing line: ~~ -** Processing line: ~ # helper function for deriving the position of an item within inventory~ -** Processing line: ~ def set_inventory_position args, item~ -** Processing line: ~ item.x = args.state.inventory_border.x + item[:ordinal_x] * 80~ -** Processing line: ~ item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ -** Processing line: ~ item.w = 80~ -** Processing line: ~ item.h = 80~ -** Processing line: ~ end~ +** Processing line: ~ # Also note that state.tick_count refers to the passage of time, or current frame.~ ** Processing line: ~~ -** Processing line: ~ # helper function for deriving the position of an item within the craft area~ -** Processing line: ~ def set_craft_position args, item~ -** Processing line: ~ item.x = args.state.craft_border.x + item[:ordinal_x] * 80~ -** Processing line: ~ item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ -** Processing line: ~ item.w = 80~ -** Processing line: ~ item.h = 80~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Any lines outside of a function will be executed when the file is reloaded.~ -** Processing line: ~ # So every time you save main.rb, the game will be reset.~ -** Processing line: ~ # Comment out the line below if you don't want this to happen.~ -** Processing line: ~ $gtk.reset~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. -** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~* 99_genre_dev_tools/animation_creator_starting_point/app/main.rb~ -- H1 detected. -- Formatting line: ~99_genre_dev_tools/animation_creator_starting_point/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false -** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ class OneBitLowrezPaint~ -** Processing line: ~ attr_gtk~ +** Processing line: ~ class TechDemo~ +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ ** Processing line: ~~ +** Processing line: ~ # Calls all methods necessary for the app to run properly.~ ** Processing line: ~ def tick~ -** Processing line: ~ outputs.background_color = [0, 0, 0]~ -** Processing line: ~ defaults~ -** Processing line: ~ render_instructions~ -** Processing line: ~ render_canvas~ -** Processing line: ~ render_buttons_frame_selection~ -** Processing line: ~ render_animation_frame_thumbnails~ -** Processing line: ~ render_animation~ -** Processing line: ~ input_mouse_click~ -** Processing line: ~ input_keyboard~ -** Processing line: ~ calc_auto_export~ -** Processing line: ~ calc_buttons_frame_selection~ -** Processing line: ~ calc_animation_frames~ -** Processing line: ~ process_queue_create_sprite~ -** Processing line: ~ process_queue_reset_sprite~ -** Processing line: ~ process_queue_update_rt_animation_frame~ +** Processing line: ~ labels_tech_demo~ +** Processing line: ~ lines_tech_demo~ +** Processing line: ~ solids_tech_demo~ +** Processing line: ~ borders_tech_demo~ +** Processing line: ~ sprites_tech_demo~ +** Processing line: ~ keyboards_tech_demo~ +** Processing line: ~ controller_tech_demo~ +** Processing line: ~ mouse_tech_demo~ +** Processing line: ~ point_to_rect_tech_demo~ +** Processing line: ~ rect_to_rect_tech_demo~ +** Processing line: ~ button_tech_demo~ +** Processing line: ~ export_game_state_demo~ +** Processing line: ~ window_state_demo~ +** Processing line: ~ render_seperators~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.animation_frames_per_second = 12~ -** Processing line: ~ queues.create_sprite ||= []~ -** Processing line: ~ queues.reset_sprite ||= []~ -** Processing line: ~ queues.update_rt_animation_frame ||= []~ -** Processing line: ~~ -** Processing line: ~ if !state.animation_frames~ -** Processing line: ~ state.animation_frames ||= []~ -** Processing line: ~ add_animation_frame_to_end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ state.last_mouse_down ||= 0~ -** Processing line: ~ state.last_mouse_up ||= 0~ -** Processing line: ~~ -** Processing line: ~ state.buttons_frame_selection.left = 10~ -** Processing line: ~ state.buttons_frame_selection.top = grid.top - 10~ -** Processing line: ~ state.buttons_frame_selection.size = 20~ -** Processing line: ~~ -** Processing line: ~ defaults_canvas_sprite~ -** Processing line: ~~ -** Processing line: ~ state.edit_mode ||= :drawing~ +** Processing line: ~ # Shows output of different kinds of labels on the screen~ +** Processing line: ~ def labels_tech_demo~ +** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."]~ +** Processing line: ~ outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."]~ +** Processing line: ~ outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"]~ +** Processing line: ~ outputs.labels << [ 5, 660, "Smaller label.", -2]~ +** Processing line: ~ outputs.labels << [ 5, 630, "Small label.", -1]~ +** Processing line: ~ outputs.labels << [ 5, 600, "Medium label.", 0]~ +** Processing line: ~ outputs.labels << [ 5, 570, "Large label.", 1]~ +** Processing line: ~ outputs.labels << [ 5, 540, "Larger label.", 2]~ +** Processing line: ~ outputs.labels << [300, 660, "Left aligned.", 0, 2]~ +** Processing line: ~ outputs.labels << [300, 640, "Center aligned.", 0, 1]~ +** Processing line: ~ outputs.labels << [300, 620, "Right aligned.", 0, 0]~ +** Processing line: ~ outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0]~ +** Processing line: ~ outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0]~ +** Processing line: ~ outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255]~ +** Processing line: ~ outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults_canvas_sprite~ -** Processing line: ~ rt_canvas.size = 16~ -** Processing line: ~ rt_canvas.zoom = 30~ -** Processing line: ~ rt_canvas.width = rt_canvas.size * rt_canvas.zoom~ -** Processing line: ~ rt_canvas.height = rt_canvas.size * rt_canvas.zoom~ -** Processing line: ~ rt_canvas.sprite = { x: 0,~ -** Processing line: ~ y: 0,~ -** Processing line: ~ w: rt_canvas.width,~ -** Processing line: ~ h: rt_canvas.height,~ -** Processing line: ~ path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720)~ -** Processing line: ~~ -** Processing line: ~ return unless state.tick_count == 1~ -** Processing line: ~~ -** Processing line: ~ outputs[:rt_canvas].width = rt_canvas.width~ -** Processing line: ~ outputs[:rt_canvas].height = rt_canvas.height~ -** Processing line: ~ outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x|~ -** Processing line: ~ (rt_canvas.size + 1).map_with_index do |y|~ -** Processing line: ~ path = 'sprites/square-white.png'~ -** Processing line: ~ path = 'sprites/square-blue.png' if x == 7 || x == 8~ -** Processing line: ~ { x: x * rt_canvas.zoom,~ -** Processing line: ~ y: y * rt_canvas.zoom,~ -** Processing line: ~ w: rt_canvas.zoom,~ -** Processing line: ~ h: rt_canvas.zoom,~ -** Processing line: ~ path: path,~ -** Processing line: ~ a: 50 }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Shows output of lines on the screen~ +** Processing line: ~ def lines_tech_demo~ +** Processing line: ~ outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"]~ +** Processing line: ~ outputs.lines << [5, 450, 100, 450]~ +** Processing line: ~ outputs.lines << [5, 430, 300, 430]~ +** Processing line: ~ outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes~ +** Processing line: ~ outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes~ +** Processing line: ~ outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_instructions~ -** Processing line: ~ instructions = <<-S~ -** Processing line: ~ * Instructions:~ -** Processing line: ~ - All data is stored in the ~canvas~ directory.~ -** Processing line: ~ - Hold ~d~ to set the edit mode to erase.~ -** Processing line: ~ - Release ~d~ to set the edit mode drawing.~ -** Processing line: ~ - Press ~a~ to added a frame to the end.~ -** Processing line: ~ - Press ~b~ to select the previous frame.~ -** Processing line: ~ - Press ~f~ to select the next frame.~ -** Processing line: ~ - Press ~c~ to copy a frame.~ -** Processing line: ~ - Press ~v~ to paste a copied frame into the selected frame.~ -** Processing line: ~ - Press ~x~ to delete the currently selected frame.~ -** Processing line: ~ - Press ~w~ to save the canvas and export all sprites.~ -** Processing line: ~ - Press ~l~ to load the canvas.~ -** Processing line: ~ S~ -** Processing line: ~~ -** Processing line: ~ instructions.strip.each_line.with_index do |l, i|~ -** Processing line: ~ outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}",~ -** Processing line: ~ r: 180, g: 180, b: 180, size_enum: -3 }~ -** Processing line: ~ end~ +** Processing line: ~ # Shows output of different kinds of solids on the screen~ +** Processing line: ~ def solids_tech_demo~ +** Processing line: ~ outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"]~ +** Processing line: ~ outputs.solids << [ 10, 270, 50, 50]~ +** Processing line: ~ outputs.solids << [ 70, 270, 50, 50, 0, 0, 0]~ +** Processing line: ~ outputs.solids << [130, 270, 50, 50, 255, 0, 0]~ +** Processing line: ~ outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128]~ +** Processing line: ~ outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_canvas~ -** Processing line: ~ return if state.tick_count.zero?~ -** Processing line: ~ outputs.sprites << rt_canvas.sprite~ +** Processing line: ~ # Shows output of different kinds of borders on the screen~ +** Processing line: ~ # The parameters for a border are the same as the parameters for a solid~ +** Processing line: ~ def borders_tech_demo~ +** Processing line: ~ outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"]~ +** Processing line: ~ outputs.borders << [ 10, 180, 50, 50]~ +** Processing line: ~ outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]~ +** Processing line: ~ outputs.borders << [130, 180, 50, 50, 255, 0, 0]~ +** Processing line: ~ outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]~ +** Processing line: ~ outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_buttons_frame_selection~ -** Processing line: ~ args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i|~ -** Processing line: ~ label = { x: b.x + state.buttons_frame_selection.size.half,~ -** Processing line: ~ y: b.y,~ -** Processing line: ~ text: "#{i + 1}", r: 180, g: 180, b: 180,~ -** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ +** Processing line: ~ # Shows output of different kinds of sprites on the screen~ +** Processing line: ~ def sprites_tech_demo~ +** Processing line: ~ outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"]~ +** Processing line: ~ outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']~ +** Processing line: ~ outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes~ +** Processing line: ~ outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ +** Processing line: ~ # Holds size, alignment, color (black), and alpha (transparency) parameters~ +** Processing line: ~ # Using small_font as a parameter accounts for all remaining parameters~ +** Processing line: ~ # so they don't have to be repeatedly typed~ +** Processing line: ~ def small_font~ +** Processing line: ~ [-2, 0, 0, 0, 0, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if i == state.animation_frames_selected_index~ -** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ -** Processing line: ~ end~ +** Processing line: ~ # Sets position of each row~ +** Processing line: ~ # Converts given row value to pixels that DragonRuby understands~ +** Processing line: ~ def row_to_px row_number~ ** Processing line: ~~ -** Processing line: ~ [selection_border, label]~ -** Processing line: ~ end~ +** Processing line: ~ # Row 0 starts 5 units below the top of the grid.~ +** Processing line: ~ # Each row afterward is 20 units lower.~ +** Processing line: ~ grid.top.shift_down(5).shift_down(20 * row_number)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_animation_frame_thumbnails~ -** Processing line: ~ return if state.tick_count.zero?~ +** Processing line: ~ # Uses labels to output current game time (passage of time), and whether or not "h" was pressed~ +** Processing line: ~ # If "h" is pressed, the frame is output when the key_up event occurred~ +** Processing line: ~ def keyboards_tech_demo~ +** Processing line: ~ outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font]~ +** Processing line: ~ outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font]~ +** Processing line: ~ outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font]~ ** Processing line: ~~ -** Processing line: ~ outputs[:current_animation_frame].width = rt_canvas.size~ -** Processing line: ~ outputs[:current_animation_frame].height = rt_canvas.size~ -** Processing line: ~ outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i|~ -** Processing line: ~ { x: f.x,~ -** Processing line: ~ y: f.y,~ -** Processing line: ~ w: 1,~ -** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ +** Processing line: ~ if inputs.keyboard.key_up.h # if "h" key_up event occurs~ +** Processing line: ~ state.h_pressed_at = state.tick_count # frame it occurred is stored~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame)~ +** Processing line: ~ # h_pressed_at is initially set to false, and changes once the user presses the "h" key.~ +** Processing line: ~ state.h_pressed_at ||= false~ ** Processing line: ~~ -** Processing line: ~ state.animation_frames.map_with_index do |animation_frame, animation_frame_index|~ -** Processing line: ~ outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect]~ -** Processing line: ~ .merge(path: animation_frame[:rt_name])~ +** Processing line: ~ if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false)~ +** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font]~ +** Processing line: ~ else # otherwise, label says "h" was never pressed~ +** Processing line: ~ outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font]~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_animation~ -** Processing line: ~ sprite_index = 0.frame_index count: state.animation_frames.length,~ -** Processing line: ~ hold_for: 60 / state.animation_frames_per_second,~ -** Processing line: ~ repeat: true~ +** Processing line: ~ # border around keyboard input demo section~ +** Processing line: ~ outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << { x: 700 - 8,~ -** Processing line: ~ y: 120,~ -** Processing line: ~ w: 16,~ -** Processing line: ~ h: 16,~ -** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~ # Sets definition for a small label~ +** Processing line: ~ # Makes it easier to position labels in respect to the position of other labels~ +** Processing line: ~ def small_label x, row, message~ +** Processing line: ~ [x, row_to_px(row), message, small_font]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << { x: 700 - 16,~ -** Processing line: ~ y: 230,~ -** Processing line: ~ w: 32,~ -** Processing line: ~ h: 32,~ -** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~ # Uses small labels to show whether the "a" button on the controller is down, held, or up.~ +** Processing line: ~ # y value of each small label is set by calling the row_to_px method~ +** Processing line: ~ def controller_tech_demo~ +** Processing line: ~ x = 460~ +** Processing line: ~ outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one")~ +** Processing line: ~ outputs.labels << small_label(x, 7, "Current state of the \"a\" button.")~ +** Processing line: ~ outputs.labels << small_label(x, 8, "Check console window for more info.")~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << { x: 700 - 32,~ -** Processing line: ~ y: 360,~ -** Processing line: ~ w: 64,~ -** Processing line: ~ h: 64,~ -** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~ if inputs.controller_one.key_down.a # if "a" is in "down" state~ +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}")~ +** Processing line: ~ puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred~ +** Processing line: ~ elsif inputs.controller_one.key_held.a # if "a" is held down~ +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}")~ +** Processing line: ~ elsif inputs.controller_one.key_up.a # if "a" is in up state~ +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}")~ +** Processing line: ~ puts "\"a\" key up at #{inputs.controller_one.key_up.a}"~ +** Processing line: ~ else # if no event has occurred~ +** Processing line: ~ outputs.labels << small_label(x, 9, "\"a\" button state is nil.")~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.sprites << { x: 700 - 64,~ -** Processing line: ~ y: 520,~ -** Processing line: ~ w: 128,~ -** Processing line: ~ h: 128,~ -** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~ # border around controller input demo section~ +** Processing line: ~ outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_mouse_click~ -** Processing line: ~ if inputs.mouse.up~ -** Processing line: ~ state.last_mouse_up = state.tick_count~ -** Processing line: ~ elsif inputs.mouse.moved && user_is_editing?~ -** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ return unless inputs.mouse.click~ +** Processing line: ~ # Outputs when the mouse was clicked, as well as the coordinates on the screen~ +** Processing line: ~ # of where the click occurred~ +** Processing line: ~ def mouse_tech_demo~ +** Processing line: ~ x = 460~ ** Processing line: ~~ -** Processing line: ~ clicked_frame_button = state.buttons_frame_selection.items.find do |b|~ -** Processing line: ~ inputs.mouse.point.inside_rect? b~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse")~ ** Processing line: ~~ -** Processing line: ~ if (clicked_frame_button)~ -** Processing line: ~ state.animation_frames_selected_index = clicked_frame_button[:index]~ +** Processing line: ~ if inputs.mouse.click # if click has a value and is not nil~ +** Processing line: ~ state.last_mouse_click = inputs.mouse.click # coordinates of click are stored~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if (inputs.mouse.point.inside_rect? rt_canvas.sprite)~ -** Processing line: ~ state.last_mouse_down = state.tick_count~ -** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ +** Processing line: ~ if state.last_mouse_click # if mouse is clicked (has coordinates as value)~ +** Processing line: ~ # outputs the time (frame) the click occurred, as well as how many frames have passed since the event~ +** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}")~ +** Processing line: ~ # outputs coordinates of click~ +** Processing line: ~ outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}")~ +** Processing line: ~ else # otherwise if the mouse has not been clicked~ +** Processing line: ~ outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.")~ +** Processing line: ~ outputs.labels << small_label(x, 13, "Please click mouse.")~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_keyboard~ -** Processing line: ~ # w to save~ -** Processing line: ~ if inputs.keyboard.key_down.w~ -** Processing line: ~ t = Time.now~ -** Processing line: ~ state.save_description = "Time: #{t} (#{t.to_i})"~ -** Processing line: ~ gtk.serialize_state 'canvas/state.txt', state~ -** Processing line: ~ gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state~ -** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ -** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ -** Processing line: ~ at: state.tick_count + i,~ -** Processing line: ~ queue_sprite_creation: true }~ -** Processing line: ~ queues.create_sprite << { index: i,~ -** Processing line: ~ at: state.tick_count + animation_frames.length + i,~ -** Processing line: ~ path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" }~ -** Processing line: ~ end~ -** Processing line: ~ gtk.notify! "Canvas saved."~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs whether a mouse click occurred inside or outside of a box~ +** Processing line: ~ def point_to_rect_tech_demo~ +** Processing line: ~ x = 460~ ** Processing line: ~~ -** Processing line: ~ # l to load~ -** Processing line: ~ if inputs.keyboard.key_down.l~ -** Processing line: ~ args.state = gtk.deserialize_state 'canvas/state.txt'~ -** Processing line: ~ animation_frames.each_with_index do |a, i|~ -** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ -** Processing line: ~ at: state.tick_count + i,~ -** Processing line: ~ queue_sprite_creation: true }~ +** Processing line: ~ outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->")~ +** Processing line: ~~ +** Processing line: ~ box = [765, 370, 50, 50, 0, 0, 170] # blue box~ +** Processing line: ~ outputs.borders << box~ +** Processing line: ~~ +** Processing line: ~ if state.last_mouse_click # if the mouse was clicked~ +** Processing line: ~ if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box~ +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened inside the box.")~ +** Processing line: ~ else # otherwise, if mouse was clicked outside the box~ +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click happened outside the box.")~ ** Processing line: ~ end~ -** Processing line: ~ gtk.notify! "Canvas loaded."~ +** Processing line: ~ else # otherwise, if was not clicked at all~ +** Processing line: ~ outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # d to go into delete mode, release to paint~ -** Processing line: ~ if inputs.keyboard.key_held.d~ -** Processing line: ~ state.edit_mode = :erasing~ -** Processing line: ~ gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1)~ -** Processing line: ~ elsif inputs.keyboard.key_up.d~ -** Processing line: ~ state.edit_mode = :drawing~ -** Processing line: ~ gtk.notify! "Drawing."~ -** Processing line: ~ end~ +** Processing line: ~ # border around mouse input demo section~ +** Processing line: ~ outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # a to add a frame to the end~ -** Processing line: ~ if inputs.keyboard.key_down.a~ -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count }~ -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index + 1,~ -** Processing line: ~ at: state.tick_count }~ -** Processing line: ~ add_animation_frame_to_end~ -** Processing line: ~ gtk.notify! "Frame added to end."~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output~ +** Processing line: ~ # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not~ +** Processing line: ~ # they intersect.~ +** Processing line: ~ def rect_to_rect_tech_demo~ +** Processing line: ~ x = 460~ ** Processing line: ~~ -** Processing line: ~ # c or t to copy~ -** Processing line: ~ if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t)~ -** Processing line: ~ state.clipboard = [selected_animation_frame[:pixels]].flatten~ -** Processing line: ~ gtk.notify! "Current frame copied."~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions~ +** Processing line: ~ red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box~ +** Processing line: ~ outputs.borders << red_box # output as a border (not filled in)~ ** Processing line: ~~ -** Processing line: ~ # v or q to paste~ -** Processing line: ~ if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard~ -** Processing line: ~ selected_animation_frame[:pixels] = [state.clipboard].flatten~ -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count,~ -** Processing line: ~ queue_sprite_creation: true }~ -** Processing line: ~ gtk.notify! "Pasted."~ +** Processing line: ~ # If the mouse is clicked inside the red box, two collision boxes are created.~ +** Processing line: ~ if inputs.mouse.click~ +** Processing line: ~ if inputs.mouse.click.point.inside_rect? red_box~ +** Processing line: ~ if !state.box_collision_one # if the collision_one box does not yet have a definition~ +** Processing line: ~ # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.~ +** Processing line: ~ # You can try deleting the subtraction to see how it impacts the box placement.~ +** Processing line: ~ state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition~ +** Processing line: ~ elsif !state.box_collision_two # if collision_two does not yet have a definition~ +** Processing line: ~ state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition~ +** Processing line: ~ else~ +** Processing line: ~ state.box_collision_one = nil # both boxes are empty~ +** Processing line: ~ state.box_collision_two = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # f to go forward/next frame~ -** Processing line: ~ if (inputs.keyboard.key_down.f)~ -** Processing line: ~ if (state.animation_frames_selected_index == (state.animation_frames.length - 1))~ -** Processing line: ~ state.animation_frames_selected_index = 0~ -** Processing line: ~ else~ -** Processing line: ~ state.animation_frames_selected_index += 1~ -** Processing line: ~ end~ -** Processing line: ~ gtk.notify! "Next frame."~ +** Processing line: ~ # If collision boxes exist, they are output onto screen inside the red box as solids~ +** Processing line: ~ if state.box_collision_one~ +** Processing line: ~ outputs.solids << state.box_collision_one~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # b to go back/previous frame~ -** Processing line: ~ if (inputs.keyboard.key_down.b)~ -** Processing line: ~ if (state.animation_frames_selected_index == 0)~ -** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ -** Processing line: ~ else~ -** Processing line: ~ state.animation_frames_selected_index -= 1~ -** Processing line: ~ end~ -** Processing line: ~ gtk.notify! "Previous frame."~ +** Processing line: ~ if state.box_collision_two~ +** Processing line: ~ outputs.solids << state.box_collision_two~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # x to delete frame~ -** Processing line: ~ if (inputs.keyboard.key_down.x) && animation_frames.length > 1~ -** Processing line: ~ state.clipboard = selected_animation_frame[:pixels]~ -** Processing line: ~ state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index }~ -** Processing line: ~ if state.animation_frames_selected_index >= state.animation_frames.length~ -** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ +** Processing line: ~ # Outputs whether or not the two collision boxes intersect.~ +** Processing line: ~ if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)~ +** Processing line: ~ if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect~ +** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes intersect.')~ +** Processing line: ~ else # otherwise, if the two boxes do not intersect~ +** Processing line: ~ outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')~ ** Processing line: ~ end~ -** Processing line: ~ gtk.notify! "Frame deleted."~ +** Processing line: ~ else~ +** Processing line: ~ outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_auto_export~ -** Processing line: ~ return if user_is_editing?~ -** Processing line: ~ return if state.last_mouse_up.elapsed_time != 30~ -** Processing line: ~ # auto export current animation frame if there is no editing for 30 ticks~ -** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count }~ -** Processing line: ~ end~ +** Processing line: ~ # Creates a button and outputs it onto the screen using labels and borders.~ +** Processing line: ~ # If the button is clicked, the color changes to make it look faded.~ +** Processing line: ~ def button_tech_demo~ +** Processing line: ~ x, y, w, h = 460, 160, 300, 50~ +** Processing line: ~ state.button ||= state.new_entity(:button_with_fade)~ ** Processing line: ~~ -** Processing line: ~ def calc_buttons_frame_selection~ -** Processing line: ~ state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i|~ -** Processing line: ~ { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size,~ -** Processing line: ~ y: state.buttons_frame_selection.top - state.buttons_frame_selection.size,~ -** Processing line: ~ inner_rect: {~ -** Processing line: ~ x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size,~ -** Processing line: ~ y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2),~ -** Processing line: ~ w: 16,~ -** Processing line: ~ h: 16,~ -** Processing line: ~ },~ -** Processing line: ~ w: state.buttons_frame_selection.size,~ -** Processing line: ~ h: state.buttons_frame_selection.size,~ -** Processing line: ~ index: i }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.~ +** Processing line: ~ state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1]~ +** Processing line: ~ state.button.border ||= [x, y, w, h]~ ** Processing line: ~~ -** Processing line: ~ def calc_animation_frames~ -** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ -** Processing line: ~ animation_frame[:index] = i~ -** Processing line: ~ animation_frame[:rt_name] = "animation_frame_#{i}"~ +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border~ +** Processing line: ~ state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_queue_create_sprite~ -** Processing line: ~ sprites_to_create = queues.create_sprite~ -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +** Processing line: ~ outputs.labels << state.button.label~ +** Processing line: ~ outputs.borders << state.button.border~ ** Processing line: ~~ -** Processing line: ~ queues.create_sprite = queues.create_sprite - sprites_to_create~ +** Processing line: ~ if state.button.clicked_at # if button was clicked (variable has a value and is not nil)~ ** Processing line: ~~ -** Processing line: ~ sprites_to_create.each do |h|~ -** Processing line: ~ export_animation_frame h[:index], h[:path_override]~ +** Processing line: ~ # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.~ +** Processing line: ~ # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.~ +** Processing line: ~ # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.~ +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_queue_reset_sprite~ -** Processing line: ~ sprites_to_reset = queues.reset_sprite~ -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ -** Processing line: ~~ -** Processing line: ~ queues.reset_sprite -= sprites_to_reset~ -** Processing line: ~~ -** Processing line: ~ sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) }~ +** Processing line: ~ # Creates a new button by declaring it as a new entity, and sets values.~ +** Processing line: ~ def new_button_prefab x, y, message~ +** Processing line: ~ w, h = 300, 50~ +** Processing line: ~ button = state.new_entity(:button_with_fade)~ +** Processing line: ~ button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders~ +** Processing line: ~ button.border = [x, y, w, h] # sets border definition~ +** Processing line: ~ button~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_queue_update_rt_animation_frame~ -** Processing line: ~ animation_frames_to_update = queues.update_rt_animation_frame~ -** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +** Processing line: ~ # If the mouse has been clicked and the click's location is inside of the button's border, that means~ +** Processing line: ~ # that the button has been clicked. This method returns a boolean value.~ +** Processing line: ~ def button_clicked? button~ +** Processing line: ~ inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ queues.update_rt_animation_frame -= animation_frames_to_update~ +** Processing line: ~ # Determines if button was clicked, and changes its appearance if it is clicked~ +** Processing line: ~ def tick_button_prefab button~ +** Processing line: ~ outputs.labels << button.label # outputs button's label and border~ +** Processing line: ~ outputs.borders << button.border~ ** Processing line: ~~ -** Processing line: ~ animation_frames_to_update.each do |h|~ -** Processing line: ~ update_animation_frame_render_target animation_frames[h[:index]]~ -** Processing line: ~~ -** Processing line: ~ if h[:queue_sprite_creation]~ -** Processing line: ~ queues.create_sprite << { index: h[:index],~ -** Processing line: ~ at: state.tick_count + 1 }~ -** Processing line: ~ end~ +** Processing line: ~ if button_clicked? button # if button is clicked~ +** Processing line: ~ button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def update_animation_frame_render_target animation_frame~ -** Processing line: ~ return if !animation_frame~ ** Processing line: ~~ -** Processing line: ~ outputs[animation_frame[:rt_name]].width = state.rt_canvas.size~ -** Processing line: ~ outputs[animation_frame[:rt_name]].height = state.rt_canvas.size~ -** Processing line: ~ outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f|~ -** Processing line: ~ { x: f.x,~ -** Processing line: ~ y: f.y,~ -** Processing line: ~ w: 1,~ -** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ +** Processing line: ~ if button.clicked_at # if clicked_at has a frame value and is not nil~ +** Processing line: ~ # button is output; color changes and transparency changes for 0.25 seconds after click occurs~ +** Processing line: ~ outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,~ +** Processing line: ~ 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def animation_frames~ -** Processing line: ~ state.animation_frames~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def add_animation_frame_to_end~ -** Processing line: ~ animation_frames << {~ -** Processing line: ~ index: animation_frames.length,~ -** Processing line: ~ pixels: [],~ -** Processing line: ~ rt_name: "animation_frame_#{animation_frames.length}"~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ state.animation_frames_selected_index = (animation_frames.length - 1)~ -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count,~ -** Processing line: ~ queue_sprite_creation: true }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def sprite_path i~ -** Processing line: ~ "canvas/sprite-#{i}.png"~ +** Processing line: ~ # Exports the app's game state if the export button is clicked.~ +** Processing line: ~ def export_game_state_demo~ +** Processing line: ~ state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state")~ +** Processing line: ~ tick_button_prefab(state.export_game_state_button) # calls method to output button~ +** Processing line: ~ if button_clicked? state.export_game_state_button # if the export button is clicked~ +** Processing line: ~ args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def export_animation_frame i, path_override = nil~ -** Processing line: ~ return if !state.animation_frames[i]~ -** Processing line: ~~ -** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ -** Processing line: ~ .items[i][:inner_rect]~ -** Processing line: ~ .merge(path: path_override || (sprite_path i))~ -** Processing line: ~~ -** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ -** Processing line: ~ .items[i][:inner_rect]~ -** Processing line: ~ .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png")~ -** Processing line: ~~ -** Processing line: ~ queues.reset_sprite << { index: i, at: state.tick_count }~ +** Processing line: ~ # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window.~ +** Processing line: ~ def window_state_demo~ +** Processing line: ~ m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement)~ +** Processing line: ~ k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N'~ +** Processing line: ~ outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def selected_animation_frame~ -** Processing line: ~ state.animation_frames[state.animation_frames_selected_index]~ +** Processing line: ~ #Sets values for the horizontal separator (divides demo sections)~ +** Processing line: ~ def horizontal_seperator y, x, x2~ +** Processing line: ~ [x, y, x2, y, 150, 150, 150]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def edit_current_animation_frame point~ -** Processing line: ~ draw_area_point = (to_draw_area point)~ -** Processing line: ~ if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point)~ -** Processing line: ~ selected_animation_frame[:pixels] << draw_area_point~ -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count,~ -** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ -** Processing line: ~ elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point)~ -** Processing line: ~ selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point }~ -** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ -** Processing line: ~ at: state.tick_count,~ -** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ -** Processing line: ~ end~ +** Processing line: ~ #Sets the values for the vertical separator (divides demo sections)~ +** Processing line: ~ def vertical_seperator x, y, y2~ +** Processing line: ~ [x, y, x, y2, 150, 150, 150]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def user_is_editing?~ -** Processing line: ~ state.last_mouse_down > state.last_mouse_up~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs vertical and horizontal separators onto the screen to separate each demo section.~ +** Processing line: ~ def render_seperators~ +** Processing line: ~ outputs.lines << horizontal_seperator(505, grid.left, 445)~ +** Processing line: ~ outputs.lines << horizontal_seperator(353, grid.left, 445)~ +** Processing line: ~ outputs.lines << horizontal_seperator(264, grid.left, 445)~ +** Processing line: ~ outputs.lines << horizontal_seperator(174, grid.left, 445)~ ** Processing line: ~~ -** Processing line: ~ def to_draw_area point~ -** Processing line: ~ x, y = point~ -** Processing line: ~ x -= rt_canvas.sprite.x~ -** Processing line: ~ y -= rt_canvas.sprite.y~ -** Processing line: ~ { x: x.idiv(rt_canvas.zoom),~ -** Processing line: ~ y: y.idiv(rt_canvas.zoom) }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.lines << vertical_seperator(445, grid.top, grid.bottom)~ ** Processing line: ~~ -** Processing line: ~ def rt_canvas~ -** Processing line: ~ state.rt_canvas ||= state.new_entity(:rt_canvas)~ -** Processing line: ~ end~ +** Processing line: ~ outputs.lines << horizontal_seperator(690, 445, 820)~ +** Processing line: ~ outputs.lines << horizontal_seperator(426, 445, 820)~ ** Processing line: ~~ -** Processing line: ~ def queues~ -** Processing line: ~ state.queues ||= state.new_entity(:queues)~ +** Processing line: ~ outputs.lines << vertical_seperator(820, grid.top, grid.bottom)~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $game = OneBitLowrezPaint.new~ +** Processing line: ~ $tech_demo = TechDemo.new~ ** Processing line: ~~ ** Processing line: ~ def tick args~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ +** Processing line: ~ $tech_demo.inputs = args.inputs~ +** Processing line: ~ $tech_demo.state = args.state~ +** Processing line: ~ $tech_demo.grid = args.grid~ +** Processing line: ~ $tech_demo.args = args~ +** Processing line: ~ $tech_demo.outputs = args.render_target(:mini_map)~ +** Processing line: ~ $tech_demo.tick~ +** Processing line: ~ args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]]~ +** Processing line: ~ args.outputs.sprites << [0, 0, 1280, 720, :mini_map]~ +** Processing line: ~ args.outputs.sprites << [830, 300, 675, 379, :mini_map]~ +** Processing line: ~ tick_instructions args, "Sample app shows all the rendering apis available."~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # $gtk.reset~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_dev_tools/tile_editor_starting_point/app/main.rb~ +** Processing line: ~* Advanced Rendering - Render Primitive Hierarchies - main.rb~ - H1 detected. -- Formatting line: ~99_genre_dev_tools/tile_editor_starting_point/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Primitive Hierarchies - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/04_render_primitive_hierarchies/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ ** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ ** Processing line: ~~ -** Processing line: ~ - to_s: Returns a string representation of an object.~ -** Processing line: ~ For example, if we had~ -** Processing line: ~ 500.to_s~ -** Processing line: ~ the string "500" would be returned.~ -** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ +** Processing line: ~ - Nested array: An array whose individual elements are also arrays; useful for~ +** Processing line: ~ storing groups of similar data. Also called multidimensional arrays.~ ** Processing line: ~~ -** Processing line: ~ - Ceil: Returns an integer number greater than or equal to the original~ -** Processing line: ~ with no decimal.~ +** Processing line: ~ In this sample app, we see nested arrays being used in object definitions.~ +** Processing line: ~ Notice the parameters for solids, listed below. Parameters 1-3 set the~ +** Processing line: ~ definition for the rect, and parameter 4 sets the definition of the color.~ +** Processing line: ~~ +** Processing line: ~ Instead of having a solid definition that looks like this,~ +** Processing line: ~ [X, Y, W, H, R, G, B]~ +** Processing line: ~ we can separate it into two separate array definitions in one, like this~ +** Processing line: ~ [[X, Y, W, H], [R, G, B]]~ +** Processing line: ~ and both options work fine in defining our solid (or any object).~ +** Processing line: ~~ +** Processing line: ~ - Collections: Lists of data; useful for organizing large amounts of data.~ +** Processing line: ~ One element of a collection could be an array (which itself contains many elements).~ +** Processing line: ~ For example, a collection that stores two solid objects would look like this:~ +** Processing line: ~ [~ +** Processing line: ~ [100, 100, 50, 50, 0, 0, 0],~ +** Processing line: ~ [100, 150, 50, 50, 255, 255, 255]~ +** Processing line: ~ ]~ +** Processing line: ~ If this collection was added to args.outputs.solids, two solids would be output~ +** Processing line: ~ next to each other, one black and one white.~ +** Processing line: ~ Nested arrays can be used in collections, as you will see in this sample app.~ ** Processing line: ~~ ** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect.~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters for a solid are~ +** Processing line: ~ 1. The position on the screen (x, y)~ +** Processing line: ~ 2. The width (w)~ +** Processing line: ~ 3. The height (h)~ +** Processing line: ~ 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black)~ +** Processing line: ~ NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS!~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~ Here is an example of a (red) border or solid definition:~ +** Processing line: ~ [100, 100, 400, 500, 255, 0, 0]~ +** Processing line: ~ It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders.~ +** Processing line: ~ For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ ** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ +** Processing line: ~ The parameters for sprites are~ +** Processing line: ~ 1. The position on the screen (x, y)~ +** Processing line: ~ 2. The width (w)~ +** Processing line: ~ 3. The height (h)~ +** Processing line: ~ 4. The image path (p)~ +** Processing line: ~~ +** Processing line: ~ Here is an example of a sprite definition:~ +** Processing line: ~ [100, 100, 400, 500, 'sprites/dragonruby.png']~ ** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ -** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ -** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ -** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ +** Processing line: ~ # This code demonstrates the creation and output of objects like sprites, borders, and solids~ +** Processing line: ~ # If filled in, they are solids~ +** Processing line: ~ # If hollow, they are borders~ +** Processing line: ~ # If images, they are sprites~ ** Processing line: ~~ -** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ -** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ -** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ +** Processing line: ~ # Solids are added to args.outputs.solids~ +** Processing line: ~ # Borders are added to args.outputs.borders~ +** Processing line: ~ # Sprites are added to args.outputs.sprites~ ** Processing line: ~~ -** Processing line: ~ =end~ +** Processing line: ~ # The tick method runs 60 frames every second.~ +** Processing line: ~ # Your game is going to happen under this one function.~ +** Processing line: ~ def tick args~ +** Processing line: ~ border_as_solid_and_solid_as_border args~ +** Processing line: ~ sprite_as_border_or_solids args~ +** Processing line: ~ collection_of_borders_and_solids args~ +** Processing line: ~ collection_of_sprites args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # This sample app shows an empty grid that the user can paint in. There are different image tiles that~ -** Processing line: ~ # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes.~ +** Processing line: ~ # Shows a border being output onto the screen as a border and a solid~ +** Processing line: ~ # Also shows how colors can be set~ +** Processing line: ~ def border_as_solid_and_solid_as_border args~ +** Processing line: ~ border = [0, 0, 50, 50]~ +** Processing line: ~ args.outputs.borders << border~ +** Processing line: ~ args.outputs.solids << border~ ** Processing line: ~~ -** Processing line: ~ class TileEditor~ -** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ +** Processing line: ~ # Red, green, blue saturations (last three parameters) can be any number between 0 and 255~ +** Processing line: ~ border_with_color = [0, 100, 50, 50, 255, 0, 0]~ +** Processing line: ~ args.outputs.borders << border_with_color~ +** Processing line: ~ args.outputs.solids << border_with_color~ ** Processing line: ~~ -** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ check_click~ -** Processing line: ~ draw_buttons~ -** Processing line: ~ end~ +** Processing line: ~ border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color~ +** Processing line: ~ args.outputs.borders << border_with_nested_color~ +** Processing line: ~ args.outputs.solids << border_with_nested_color~ ** Processing line: ~~ -** Processing line: ~ # Sets default values~ -** Processing line: ~ # Initialization only happens in the first frame~ -** Processing line: ~ # NOTE: The values of some of these variables may seem confusingly large at first.~ -** Processing line: ~ # The gridSize is 1600 but it seems a lot smaller on the screen, for example.~ -** Processing line: ~ # But keep in mind that by using the "W", "A", "S", and "D" keys, you can~ -** Processing line: ~ # move the grid's view in all four directions for more grid spaces.~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.tileCords ||= []~ -** Processing line: ~ state.tileQuantity ||= 6~ -** Processing line: ~ state.tileSize ||= 50~ -** Processing line: ~ state.tileSelected ||= 1~ -** Processing line: ~ state.tempX ||= 50~ -** Processing line: ~ state.tempY ||= 500~ -** Processing line: ~ state.speed ||= 4~ -** Processing line: ~ state.centerX ||= 4000~ -** Processing line: ~ state.centerY ||= 4000~ -** Processing line: ~ state.originalCenter ||= [state.centerX, state.centerY]~ -** Processing line: ~ state.gridSize ||= 1600~ -** Processing line: ~ state.lineQuantity ||= 50~ -** Processing line: ~ state.increment ||= state.gridSize / state.lineQuantity~ -** Processing line: ~ state.gridX ||= []~ -** Processing line: ~ state.gridY ||= []~ -** Processing line: ~ state.filled_squares ||= []~ -** Processing line: ~ state.grid_border ||= [390, 140, 500, 500]~ +** Processing line: ~ border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect~ +** Processing line: ~ args.outputs.borders << border_with_nested_rect~ +** Processing line: ~ args.outputs.solids << border_with_nested_rect~ ** Processing line: ~~ -** Processing line: ~ get_grid unless state.tempX == 0 # calls get_grid in the first frame only~ -** Processing line: ~ determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame~ -** Processing line: ~ state.tempX = 0 # sets tempX to 0; the two methods aren't called again~ -** Processing line: ~ end~ +** Processing line: ~ border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color~ +** Processing line: ~ args.outputs.borders << border_with_nested_color_and_rect~ +** Processing line: ~ args.outputs.solids << border_with_nested_color_and_rect~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Calculates the placement of lines or separators in the grid~ -** Processing line: ~ def get_grid~ -** Processing line: ~ curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid~ -** Processing line: ~ deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid~ -** Processing line: ~ (state.lineQuantity + 2).times do~ -** Processing line: ~ state.gridX << curr_x # adds curr_x to gridX collection~ -** Processing line: ~ curr_x += deltaX # increment curr_x by the distance between vertical lines~ -** Processing line: ~ end~ +** Processing line: ~ # Shows a sprite output onto the screen as a sprite, border, and solid~ +** Processing line: ~ # Demonstrates that all three outputs appear differently on screen~ +** Processing line: ~ def sprite_as_border_or_solids args~ +** Processing line: ~ sprite = [100, 0, 50, 50, 'sprites/ship.png']~ +** Processing line: ~ args.outputs.sprites << sprite~ ** Processing line: ~~ -** Processing line: ~ curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid~ -** Processing line: ~ deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid~ -** Processing line: ~ (state.lineQuantity + 2).times do~ -** Processing line: ~ state.gridY << curr_y # adds curr_y to gridY collection~ -** Processing line: ~ curr_y += deltaY # increments curr_y to distance between horizontal lines~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Sprite_as_border variable has same parameters (excluding position) as above object,~ +** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.borders~ +** Processing line: ~ sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png']~ +** Processing line: ~ args.outputs.borders << sprite_as_border~ ** Processing line: ~~ -** Processing line: ~ # Determines coordinate positions of patterned tiles (on the left side of the grid)~ -** Processing line: ~ def determineTileCords~ -** Processing line: ~ state.tempCounter ||= 1 # initializes tempCounter to 1~ -** Processing line: ~ state.tileQuantity.times do # there are 6 different kinds of tiles~ -** Processing line: ~ state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection~ -** Processing line: ~ state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles~ -** Processing line: ~ state.tempCounter += 1 # increments tempCounter~ -** Processing line: ~ if state.tempX > 200 # if tempX exceeds 200 pixels~ -** Processing line: ~ state.tempX = 50 # a new row of patterned tiles begins~ -** Processing line: ~ state.tempY -= 75 # the new row is 75 pixels lower than the previous row~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Sprite_as_solid variable has same parameters (excluding position) as above object,~ +** Processing line: ~ # but will appear differently on screen because it is added to args.outputs.solids~ +** Processing line: ~ sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png']~ +** Processing line: ~ args.outputs.solids << sprite_as_solid~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs objects (grid, tiles, etc) onto the screen~ -** Processing line: ~ def render~ -** Processing line: ~ outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder~ -** Processing line: ~ |x, y, order|~ -** Processing line: ~ [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"]~ -** Processing line: ~ end~ -** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background~ -** Processing line: ~ add_grid # outputs grid~ -** Processing line: ~ print_title # outputs title and current tile pattern~ -** Processing line: ~ end~ +** Processing line: ~ # Holds and outputs a collection of borders and a collection of solids~ +** Processing line: ~ # Collections are created by using arrays to hold parameters of each individual object~ +** Processing line: ~ def collection_of_borders_and_solids args~ +** Processing line: ~ collection_borders = [~ +** Processing line: ~ [~ +** Processing line: ~ [200, 0, 50, 50], # black border~ +** Processing line: ~ [200, 100, 50, 50, 255, 0, 0], # red border~ +** Processing line: ~ [200, 200, 50, 50, [0, 255, 0]], # nested color~ +** Processing line: ~ ],~ +** Processing line: ~ [[200, 300, 50, 50], 0, 0, 255], # nested rect~ +** Processing line: ~ [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # Creates a grid by outputting vertical and horizontal grid lines onto the screen.~ -** Processing line: ~ # Outputs sprites for the filled_squares collection onto the screen.~ -** Processing line: ~ def add_grid~ +** Processing line: ~ args.outputs.borders << collection_borders~ ** Processing line: ~~ -** Processing line: ~ # Outputs the grid's border.~ -** Processing line: ~ outputs.borders << state.grid_border~ -** Processing line: ~ temp = 0~ +** Processing line: ~ collection_solids = [~ +** Processing line: ~ [~ +** Processing line: ~ [[300, 300, 50, 50], 0, 0, 255], # nested rect~ +** Processing line: ~ [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color~ +** Processing line: ~ ],~ +** Processing line: ~ [300, 0, 50, 50],~ +** Processing line: ~ [300, 100, 50, 50, 255, 0, 0],~ +** Processing line: ~ [300, 200, 50, 50, [0, 255, 0]], # nested color~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # Before looking at the code that outputs the vertical and horizontal lines in the~ -** Processing line: ~ # grid, take note of the fact that:~ -** Processing line: ~ # grid_border[1] refers to the border's bottom line (running horizontally),~ -** Processing line: ~ # grid_border[2] refers to the border's top line (running (horizontally),~ -** Processing line: ~ # grid_border[0] refers to the border's left line (running vertically),~ -** Processing line: ~ # and grid_border[3] refers to the border's right line (running vertically).~ +** Processing line: ~ args.outputs.solids << collection_solids~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # [2]~ -** Processing line: ~ # ----------~ -** Processing line: ~ # | |~ -** Processing line: ~ # [0] | | [3]~ -** Processing line: ~ # | |~ -** Processing line: ~ # ----------~ -** Processing line: ~ # [1]~ +** Processing line: ~ # Holds and outputs a collection of sprites by adding it to args.outputs.sprites~ +** Processing line: ~ # Also outputs a collection with same parameters (excluding position) by adding~ +** Processing line: ~ # it to args.outputs.solids and another to args.outputs.borders~ +** Processing line: ~ def collection_of_sprites args~ +** Processing line: ~ sprites_collection = [~ +** Processing line: ~ [~ +** Processing line: ~ [400, 0, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ [400, 100, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ ],~ +** Processing line: ~ [400, 200, 50, 50, 'sprites/ship.png']~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # Calculates the positions and outputs the x grid lines in the color gray.~ -** Processing line: ~ state.gridX.map do # perform an action on all elements of the gridX collection~ -** Processing line: ~ |x|~ -** Processing line: ~ temp += 1 # increment temp~ +** Processing line: ~ args.outputs.sprites << sprites_collection~ ** Processing line: ~~ -** Processing line: ~ # if x's value is greater than (or equal to) the x value of the border's left side~ -** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ -** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2)~ -** Processing line: ~ delta = state.centerX - 640~ -** Processing line: ~ # vertical lines have the same starting and ending x positions~ -** Processing line: ~ # starting y and ending y positions lead from the bottom of the border to the top of the border~ -** Processing line: ~ outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ temp = 0~ +** Processing line: ~ args.outputs.solids << [~ +** Processing line: ~ [500, 0, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ [500, 100, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ [[[500, 200, 50, 50, 'sprites/ship.png']]]~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # Calculates the positions and outputs the y grid lines in the color gray.~ -** Processing line: ~ state.gridY.map do # perform an action on all elements of the gridY collection~ -** Processing line: ~ |y|~ -** Processing line: ~ temp += 1 # increment temp~ +** Processing line: ~ args.outputs.borders << [~ +** Processing line: ~ [~ +** Processing line: ~ [600, 0, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ [600, 100, 50, 50, 'sprites/ship.png'],~ +** Processing line: ~ ],~ +** Processing line: ~ [600, 200, 50, 50, 'sprites/ship.png']~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if y's value is greater than (or equal to) the y value of the border's bottom side~ -** Processing line: ~ # and less than (or equal to) the y value of the border's top side~ -** Processing line: ~ if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2)~ -** Processing line: ~ delta = state.centerY - 393~ -** Processing line: ~ # horizontal lines have the same starting and ending y positions~ -** Processing line: ~ # starting x and ending x positions lead from the left side of the border to the right side of the border~ -** Processing line: ~ outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Sets values and outputs sprites for the filled_squares collection.~ -** Processing line: ~ state.filled_squares.map do # perform an action on every element of the filled_squares collection~ -** Processing line: ~ |x, y, w, h, sprite|~ -** Processing line: ~ # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side~ -** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ -** Processing line: ~ # and y's value is greater than (or equal to) the y value of the border's bottom side~ -** Processing line: ~ # and less than (or equal to) the y value of 25 pixels above the border's top side~ -** Processing line: ~ # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or~ -** Processing line: ~ # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D")~ -** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) &&~ -** Processing line: ~ y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25~ -** Processing line: ~ # calculations done to place sprites in grid spaces that are meant to filled in~ -** Processing line: ~ # mess around with the x and y values and see how the sprite placement changes~ -** Processing line: ~ outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite]~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background)~ -** Processing line: ~ # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner~ -** Processing line: ~ # state.increment subtracted in y parameter to avoid covering the title label~ -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment,~ -** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ -** Processing line: ~ 255, 255, 255].solid~ +** Processing line: ~* Advanced Rendering - Render Primitives As Hash - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Rendering - Render Primitives As Hash - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # outputs a white solid along the right side of the grid~ -** Processing line: ~ # state.increment subtracted from y parameter to avoid covering title label~ -** Processing line: ~ outputs.primitives << [state.grid_border[0] + state.grid_border[2],~ -** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ -** Processing line: ~ 255, 255, 255].solid~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ # outputs a white solid along the bottom of the grid~ -** Processing line: ~ # state.increment subtracted from y parameter to avoid covering last row of grid boxes~ -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment,~ -** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ +** Processing line: ~ Reminders:~ ** Processing line: ~~ -** Processing line: ~ # outputs a white solid along the top of the grid~ -** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3],~ -** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The value can be found~ +** Processing line: ~ using their keys.~ ** Processing line: ~~ -** Processing line: ~ end~ +** Processing line: ~ For example, if we have a "numbers" hash that stores numbers in English as the~ +** Processing line: ~ key and numbers in Spanish as the value, we'd have a hash that looks like this...~ +** Processing line: ~ numbers = { "one" => "uno", "two" => "dos", "three" => "tres" }~ +** Processing line: ~ and on it goes.~ ** Processing line: ~~ -** Processing line: ~ # Outputs title and current tile pattern~ -** Processing line: ~ def print_title~ -** Processing line: ~ outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label~ -** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator~ -** Processing line: ~ outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label~ -** Processing line: ~ outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile~ -** Processing line: ~ end~ +** Processing line: ~ Now if we wanted to find the corresponding value of the "one" key, we could say~ +** Processing line: ~ puts numbers["one"]~ +** Processing line: ~ which would print "uno" to the console.~ ** Processing line: ~~ -** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ -** Processing line: ~ def horizontal_separator y, x, x2~ -** Processing line: ~ [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ ** Processing line: ~~ -** Processing line: ~ # Checks if the mouse is being clicked or dragged~ -** Processing line: ~ def check_click~ -** Processing line: ~ if inputs.keyboard.key_down.r # if the "r" key is pressed down~ -** Processing line: ~ $dragon.reset~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ -** Processing line: ~ state.mouse_held = true~ -** Processing line: ~ if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders~ -** Processing line: ~ state.tileCords.map do # perform action on all elements of tileCords collection~ -** Processing line: ~ |x, y, order|~ -** Processing line: ~ # if mouse's x position is greater than (or equal to) the starting x position of a tile~ -** Processing line: ~ # and the mouse's x position is also less than (or equal to) the ending x position of that tile,~ -** Processing line: ~ # and the mouse's y position is greater than (or equal to) the starting y position of that tile,~ -** Processing line: ~ # and the mouse's y position is also less than (or equal to) the ending y position of that tile,~ -** Processing line: ~ # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE)~ -** Processing line: ~ if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize &&~ -** Processing line: ~ inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize~ -** Processing line: ~ state.tileSelected = order # that tile is selected~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state~ -** Processing line: ~ state.mouse_held = false # mouse is not held down or dragged~ -** Processing line: ~ state.mouse_dragging = false~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if state.mouse_held && # mouse needs to be down~ -** Processing line: ~ !inputs.mouse.click && # must not be first click~ -** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 ||~ -** Processing line: ~ (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag"~ -** Processing line: ~ state.mouse_dragging = true~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # if mouse is clicked inside grid's border, search_lines method is called with click input type~ -** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ -** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ -** Processing line: ~~ -** Processing line: ~ # if mouse is dragged inside grid's border, search_lines method is called with drag input type~ -** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ -** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ # Changes grid's position on screen by moving it up, down, left, or right.~ +** Processing line: ~ - args.outputs.borders: An array. The values generate a border.~ +** Processing line: ~ The parameters are the same as a solid.~ +** Processing line: ~ For more information about borders, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ # centerX is incremented by speed if the "d" key is pressed and if that sum is less than~ -** Processing line: ~ # the original left side of the center plus half the grid, minus half the top border of grid.~ -** Processing line: ~ # MOVES GRID RIGHT (increasing x)~ -** Processing line: ~ state.centerX += state.speed if inputs.keyboard.key_held.d &&~ -** Processing line: ~ (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2)~ -** Processing line: ~ # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than~ -** Processing line: ~ # the original left side of the center minus half the grid, plus half the top border of grid.~ -** Processing line: ~ # MOVES GRID LEFT (decreasing x)~ -** Processing line: ~ state.centerX -= state.speed if inputs.keyboard.key_held.a &&~ -** Processing line: ~ (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2)~ -** Processing line: ~ # centerY is incremented by speed if the "w" key is pressed and if that sum is less than~ -** Processing line: ~ # the original bottom of the center plus half the grid, minus half the right border of grid.~ -** Processing line: ~ # MOVES GRID UP (increasing y)~ -** Processing line: ~ state.centerY += state.speed if inputs.keyboard.key_held.w &&~ -** Processing line: ~ (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2)~ -** Processing line: ~ # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than~ -** Processing line: ~ # the original bottom of the center minus half the grid, plus half the right border of grid.~ -** Processing line: ~ # MOVES GRID DOWN (decreasing y)~ -** Processing line: ~ state.centerY -= state.speed if inputs.keyboard.key_held.s &&~ -** Processing line: ~ (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2)~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ +** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ # Performs calculations on the gridX and gridY collections, and sets values.~ -** Processing line: ~ # Sets the definition of a grid box, including the image that it is filled with.~ -** Processing line: ~ def search_lines (point, input_type)~ -** Processing line: ~ point.x += state.centerX - 630 # increments x and y~ -** Processing line: ~ point.y += state.centerY - 360~ -** Processing line: ~ findX = 0~ -** Processing line: ~ findY = 0~ -** Processing line: ~ increment = state.gridSize / state.lineQuantity # divides grid by number of separators~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ state.gridX.map do # perform an action on every element of collection~ -** Processing line: ~ |x|~ -** Processing line: ~ # findX increments x by 10 if point.x is less than that sum and findX is currently 0~ -** Processing line: ~ findX = x + 10 if point.x < (x + 10) && findX == 0~ -** Processing line: ~ end~ +** Processing line: ~ # This sample app demonstrates how hashes can be used to output different kinds of objects.~ ** Processing line: ~~ -** Processing line: ~ state.gridY.map do~ -** Processing line: ~ |y|~ -** Processing line: ~ # findY is set to y if point.y is less than that value and findY is currently 0~ -** Processing line: ~ findY = y if point.y < (y) && findY == 0~ -** Processing line: ~ end~ -** Processing line: ~ # position of a box is denoted by bottom left corner, which is why the increment is being subtracted~ -** Processing line: ~ grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil,~ -** Processing line: ~ "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.angle ||= 0 # initializes angle to 0~ +** Processing line: ~ args.state.angle += 1 # increments angle by 1 every frame (60 times a second)~ ** Processing line: ~~ -** Processing line: ~ if input_type == :click # if user clicks their mouse~ -** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ -** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ -** Processing line: ~ else~ -** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ -** Processing line: ~ end~ -** Processing line: ~ elsif input_type == :drag # if user drags mouse~ -** Processing line: ~ unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in~ -** Processing line: ~ state.filled_squares << grid_box # box is filled in and added to filled_squares~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs sprite using a hash~ +** Processing line: ~ args.outputs.sprites << {~ +** Processing line: ~ x: 30, # sprite position~ +** Processing line: ~ y: 550,~ +** Processing line: ~ w: 128, # sprite size~ +** Processing line: ~ h: 101,~ +** Processing line: ~ path: "dragonruby.png", # image path~ +** Processing line: ~ angle: args.state.angle, # angle~ +** Processing line: ~ a: 255, # alpha (transparency)~ +** Processing line: ~ r: 255, # color saturation~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ tile_x: 0, # sprite sub division/tile~ +** Processing line: ~ tile_y: 0,~ +** Processing line: ~ tile_w: -1,~ +** Processing line: ~ tile_h: -1,~ +** Processing line: ~ flip_vertically: false, # don't flip sprite~ +** Processing line: ~ flip_horizontally: false,~ +** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ +** Processing line: ~ angle_anchor_y: 0.5~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ # Creates a "Clear" button using labels and borders.~ -** Processing line: ~ def draw_buttons~ -** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ -** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ +** Processing line: ~ # Outputs label using a hash~ +** Processing line: ~ args.outputs.labels << {~ +** Processing line: ~ x: 200, # label position~ +** Processing line: ~ y: 550,~ +** Processing line: ~ text: "dragonruby", # label text~ +** Processing line: ~ size_enum: 2,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 155, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255, # transparency~ +** Processing line: ~ font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ # x and y positions are set to display "Clear" label in center of the button~ -** Processing line: ~ # Try changing first two parameters to simply x, y and see what happens to the text placement~ -** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1]~ -** Processing line: ~ state.clear_button.border ||= [x, y, w, h] # definition of button's border~ +** Processing line: ~ # Outputs solid using a hash~ +** Processing line: ~ # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA]~ +** Processing line: ~ args.outputs.solids << {~ +** Processing line: ~ x: 400, # position~ +** Processing line: ~ y: 550,~ +** Processing line: ~ w: 160, # size~ +** Processing line: ~ h: 90,~ +** Processing line: ~ r: 120, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255 # transparency~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ # If the mouse is clicked inside the borders of the clear button~ -** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ -** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click~ -** Processing line: ~ state.filled_squares.clear # filled squares collection is emptied (squares are cleared)~ -** Processing line: ~ inputs.mouse.previous_click = nil # no previous click~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs border using a hash~ +** Processing line: ~ # Same parameters as a solid~ +** Processing line: ~ args.outputs.borders << {~ +** Processing line: ~ x: 600,~ +** Processing line: ~ y: 550,~ +** Processing line: ~ w: 160,~ +** Processing line: ~ h: 90,~ +** Processing line: ~ r: 120,~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << state.clear_button.label # outputs clear button~ -** Processing line: ~ outputs.borders << state.clear_button.border~ +** Processing line: ~ # Outputs line using a hash~ +** Processing line: ~ args.outputs.lines << {~ +** Processing line: ~ x: 900, # starting position~ +** Processing line: ~ y: 550,~ +** Processing line: ~ x2: 1200, # ending position~ +** Processing line: ~ y2: 550,~ +** Processing line: ~ r: 120, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255 # transparency~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ # When the clear button is clicked, the color of the button changes~ -** Processing line: ~ # and the transparency changes, as well. If you change the time from~ -** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ -** Processing line: ~ if state.clear_button.clicked_at~ -** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs sprite as a primitive using a hash~ +** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ x: 30, # position~ +** Processing line: ~ y: 200,~ +** Processing line: ~ w: 128, # size~ +** Processing line: ~ h: 101,~ +** Processing line: ~ path: "dragonruby.png", # image path~ +** Processing line: ~ angle: args.state.angle, # angle~ +** Processing line: ~ a: 255, # transparency~ +** Processing line: ~ r: 255, # color saturation~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ tile_x: 0, # sprite sub division/tile~ +** Processing line: ~ tile_y: 0,~ +** Processing line: ~ tile_w: -1,~ +** Processing line: ~ tile_h: -1,~ +** Processing line: ~ flip_vertically: false, # don't flip~ +** Processing line: ~ flip_horizontally: false,~ +** Processing line: ~ angle_anchor_x: 0.5, # rotation center set to middle~ +** Processing line: ~ angle_anchor_y: 0.5~ +** Processing line: ~ }.sprite~ ** Processing line: ~~ -** Processing line: ~ $tile_editor = TileEditor.new~ +** Processing line: ~ # Outputs label as primitive using a hash~ +** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ x: 200, # position~ +** Processing line: ~ y: 200,~ +** Processing line: ~ text: "dragonruby", # text~ +** Processing line: ~ size: 2,~ +** Processing line: ~ alignment: 1,~ +** Processing line: ~ r: 155, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255, # transparency~ +** Processing line: ~ font: "fonts/manaspc.ttf" # font style~ +** Processing line: ~ }.label~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $tile_editor.inputs = args.inputs~ -** Processing line: ~ $tile_editor.grid = args.grid~ -** Processing line: ~ $tile_editor.args = args~ -** Processing line: ~ $tile_editor.outputs = args.outputs~ -** Processing line: ~ $tile_editor.state = args.state~ -** Processing line: ~ $tile_editor.tick~ -** Processing line: ~ tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around."~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs solid as primitive using a hash~ +** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ x: 400, # position~ +** Processing line: ~ y: 200,~ +** Processing line: ~ w: 160, # size~ +** Processing line: ~ h: 90,~ +** Processing line: ~ r: 120, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255 # transparency~ +** Processing line: ~ }.solid~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.mouse.click ||~ -** Processing line: ~ args.inputs.keyboard.directional_vector ||~ -** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ -** Processing line: ~ args.inputs.keyboard.key_down.escape~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~ # Outputs border as primitive using a hash~ +** Processing line: ~ # Same parameters as solid~ +** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ x: 600, # position~ +** Processing line: ~ y: 200,~ +** Processing line: ~ w: 160, # size~ +** Processing line: ~ h: 90,~ +** Processing line: ~ r: 120, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255 # transparency~ +** Processing line: ~ }.border~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ # Outputs line as primitive using a hash~ +** Processing line: ~ args.outputs.primitives << {~ +** Processing line: ~ x: 900, # starting position~ +** Processing line: ~ y: 200,~ +** Processing line: ~ x2: 1200, # ending position~ +** Processing line: ~ y2: 200,~ +** Processing line: ~ r: 120, # color saturation~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255 # transparency~ +** Processing line: ~ }.line~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_lowrez/resolution_64x64/app/lowrez.rb~ +** Processing line: ~* Tweening Lerping Easing Functions - Easing Functions - main.rb~ - H1 detected. -- Formatting line: ~99_genre_lowrez/resolution_64x64/app/lowrez.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Tweening Lerping Easing Functions - Easing Functions - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)~ -** Processing line: ~ # Head over to main.rb and study the code there.~ +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ # STOP! Watch the following presentation first!!!!~ +** Processing line: ~ # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations~ +** Processing line: ~ # https://www.youtube.com/watch?v=mr5xkf6zSzk~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_SIZE = 64~ -** Processing line: ~ LOWREZ_ZOOM = 10~ -** Processing line: ~ LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM~ -** Processing line: ~ LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half~ -** Processing line: ~ LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half~ +** Processing line: ~ # You've watched the talk, yes? YES???~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_FONT_XL = -1~ -** Processing line: ~ LOWREZ_FONT_XL_HEIGHT = 20~ +** Processing line: ~ # define starting and ending points of properties to animate~ +** Processing line: ~ args.state.target_x = 1180~ +** Processing line: ~ args.state.target_y = 620~ +** Processing line: ~ args.state.target_w = 100~ +** Processing line: ~ args.state.target_h = 100~ +** Processing line: ~ args.state.starting_x = 0~ +** Processing line: ~ args.state.starting_y = 0~ +** Processing line: ~ args.state.starting_w = 300~ +** Processing line: ~ args.state.starting_h = 300~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_FONT_LG = -3.5~ -** Processing line: ~ LOWREZ_FONT_LG_HEIGHT = 15~ +** Processing line: ~ # define start time and duration of animation~ +** Processing line: ~ args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300)~ +** Processing line: ~ args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120)~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_FONT_MD = -6~ -** Processing line: ~ LOWREZ_FONT_MD_HEIGHT = 10~ +** Processing line: ~ # define type of animations~ +** Processing line: ~ # Here are all the options you have for values you can put in the array:~ +** Processing line: ~ # :identity, :quad, :cube, :quart, :quint, :flip~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_FONT_SM = -8.5~ -** Processing line: ~ LOWREZ_FONT_SM_HEIGHT = 5~ +** Processing line: ~ # Linear is defined as:~ +** Processing line: ~ # [:identity]~ +** Processing line: ~ #~ +** Processing line: ~ # Smooth start variations are:~ +** Processing line: ~ # [:quad]~ +** Processing line: ~ # [:cube]~ +** Processing line: ~ # [:quart]~ +** Processing line: ~ # [:quint]~ ** Processing line: ~~ -** Processing line: ~ LOWREZ_FONT_PATH = 'fonts/lowrez.ttf'~ +** Processing line: ~ # Linear reversed, and smooth stop are the same as the animations defined above, but reversed:~ +** Processing line: ~ # [:flip, :identity]~ +** Processing line: ~ # [:flip, :quad, :flip]~ +** Processing line: ~ # [:flip, :cube, :flip]~ +** Processing line: ~ # [:flip, :quart, :flip]~ +** Processing line: ~ # [:flip, :quint, :flip]~ ** Processing line: ~~ +** Processing line: ~ # You can also do custom definitions. See the bottom of the file details~ +** Processing line: ~ # on how to do that. I've defined a couple for you:~ +** Processing line: ~ # [:smoothest_start]~ +** Processing line: ~ # [:smoothest_stop]~ ** Processing line: ~~ -** Processing line: ~ class LowrezOutputs~ -** Processing line: ~ attr_accessor :width, :height~ +** Processing line: ~ # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS~ +** Processing line: ~ args.state.animation_type = [:identity]~ +** Processing line: ~ # args.state.animation_type = [:quad]~ +** Processing line: ~ # args.state.animation_type = [:cube]~ +** Processing line: ~ # args.state.animation_type = [:quart]~ +** Processing line: ~ # args.state.animation_type = [:quint]~ +** Processing line: ~ # args.state.animation_type = [:flip, :identity]~ +** Processing line: ~ # args.state.animation_type = [:flip, :quad, :flip]~ +** Processing line: ~ # args.state.animation_type = [:flip, :cube, :flip]~ +** Processing line: ~ # args.state.animation_type = [:flip, :quart, :flip]~ +** Processing line: ~ # args.state.animation_type = [:flip, :quint, :flip]~ +** Processing line: ~ # args.state.animation_type = [:smoothest_start]~ +** Processing line: ~ # args.state.animation_type = [:smoothest_stop]~ ** Processing line: ~~ -** Processing line: ~ def initialize args~ -** Processing line: ~ @args = args~ -** Processing line: ~ @background_color ||= [0, 0, 0]~ -** Processing line: ~ @args.outputs.background_color = @background_color~ -** Processing line: ~ end~ +** Processing line: ~ # THIS IS WHERE THE MAGIC HAPPENS!~ +** Processing line: ~ # Numeric#ease~ +** Processing line: ~ progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type)~ ** Processing line: ~~ -** Processing line: ~ def background_color~ -** Processing line: ~ @background_color ||= [0, 0, 0]~ -** Processing line: ~ end~ +** Processing line: ~ # Numeric#ease needs to called:~ +** Processing line: ~ # 1. On the number that represents the point in time you want to start, and takes two parameters:~ +** Processing line: ~ # a. The first parameter is how long the animation should take.~ +** Processing line: ~ # b. The second parameter represents the functions that need to be called.~ +** Processing line: ~ #~ +** Processing line: ~ # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds,~ +** Processing line: ~ # and I want to animation to start fast and end slow, I would do:~ +** Processing line: ~ # (60 * 3).ease(60 * 10, :flip, :quint, :flip)~ ** Processing line: ~~ -** Processing line: ~ def background_color= opts~ -** Processing line: ~ @background_color = opts~ -** Processing line: ~ @args.outputs.background_color = @background_color~ +** Processing line: ~ # initial value delta to the final value~ +** Processing line: ~ calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress~ +** Processing line: ~ calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress~ +** Processing line: ~ calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress~ +** Processing line: ~ calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress~ ** Processing line: ~~ -** Processing line: ~ outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color]~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0]~ ** Processing line: ~~ -** Processing line: ~ def outputs_lowrez~ -** Processing line: ~ return @args.outputs if @args.state.tick_count <= 0~ -** Processing line: ~ return @args.outputs[:lowrez]~ +** Processing line: ~ # count down~ +** Processing line: ~ count_down = args.state.start_animate_at - args.state.tick_count~ +** Processing line: ~ if count_down > 0~ +** Processing line: ~ args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1]~ +** Processing line: ~ args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1]~ +** Processing line: ~ elsif progress >= 1~ +** Processing line: ~ args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1]~ +** Processing line: ~ if args.inputs.click~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def solids~ -** Processing line: ~ outputs_lowrez.solids~ -** Processing line: ~ end~ +** Processing line: ~ # $gtk.reset~ ** Processing line: ~~ -** Processing line: ~ def borders~ -** Processing line: ~ outputs_lowrez.borders~ +** Processing line: ~ # you can make own variations of animations using this~ +** Processing line: ~ module Easing~ +** Processing line: ~ # you have access to all the built in functions: identity, flip, quad, cube, quart, quint~ +** Processing line: ~ def self.smoothest_start x~ +** Processing line: ~ quad(quint(x))~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def sprites~ -** Processing line: ~ outputs_lowrez.sprites~ +** Processing line: ~ def self.smoothest_stop x~ +** Processing line: ~ flip(quad(quint(flip(x))))~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def labels~ -** Processing line: ~ outputs_lowrez.labels~ +** Processing line: ~ # this is the source for the existing easing functions~ +** Processing line: ~ def self.identity x~ +** Processing line: ~ x~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def default_label~ -** Processing line: ~ {~ -** Processing line: ~ x: 0,~ -** Processing line: ~ y: 63,~ -** Processing line: ~ text: "",~ -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ -** Processing line: ~ alignment_enum: 0,~ -** Processing line: ~ r: 0,~ -** Processing line: ~ g: 0,~ -** Processing line: ~ b: 0,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH~ -** Processing line: ~ }~ +** Processing line: ~ def self.flip x~ +** Processing line: ~ 1 - x~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def lines~ -** Processing line: ~ outputs_lowrez.lines~ +** Processing line: ~ def self.quad x~ +** Processing line: ~ x * x~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def primitives~ -** Processing line: ~ outputs_lowrez.primitives~ +** Processing line: ~ def self.cube x~ +** Processing line: ~ x * x * x~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def click~ -** Processing line: ~ return nil unless @args.inputs.mouse.click~ -** Processing line: ~ mouse~ +** Processing line: ~ def self.quart x~ +** Processing line: ~ x * x * x * x * x~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def mouse_click~ -** Processing line: ~ click~ +** Processing line: ~ def self.quint x~ +** Processing line: ~ x * x * x * x * x * x~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def mouse_down~ -** Processing line: ~ @args.inputs.mouse.down~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def mouse_up~ -** Processing line: ~ @args.inputs.mouse.up~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def mouse~ -** Processing line: ~ [~ -** Processing line: ~ ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)),~ -** Processing line: ~ ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM))~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~* Tweening Lerping Easing Functions - Cubic Bezier - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Tweening Lerping Easing Functions - Cubic Bezier - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def mouse_position~ -** Processing line: ~ mouse~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.background_color = [33, 33, 33]~ +** Processing line: ~ args.outputs.lines << bezier(100, 100,~ +** Processing line: ~ 100, 620,~ +** Processing line: ~ 1180, 620,~ +** Processing line: ~ 1180, 100,~ +** Processing line: ~ 0)~ ** Processing line: ~~ -** Processing line: ~ def keyboard~ -** Processing line: ~ @args.inputs.keyboard~ -** Processing line: ~ end~ +** Processing line: ~ args.outputs.lines << bezier(100, 100,~ +** Processing line: ~ 100, 620,~ +** Processing line: ~ 1180, 620,~ +** Processing line: ~ 1180, 100,~ +** Processing line: ~ 20)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class GTK::Args~ -** Processing line: ~ def init_lowrez~ -** Processing line: ~ return if @lowrez~ -** Processing line: ~ @lowrez = LowrezOutputs.new self~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def lowrez~ -** Processing line: ~ @lowrez~ +** Processing line: ~ def bezier x1, y1, x2, y2, x3, y3, x4, y4, step~ +** Processing line: ~ step ||= 0~ +** Processing line: ~ color = [200, 200, 200]~ +** Processing line: ~ points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step~ +** Processing line: ~~ +** Processing line: ~ points.each_cons(2).map do |p1, p2|~ +** Processing line: ~ [p1, p2, color]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ module GTK~ -** Processing line: ~ class Runtime~ -** Processing line: ~ alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__)~ +** Processing line: ~ def points_for_bezier p1, p2, p3, p4, step~ +** Processing line: ~ points = []~ +** Processing line: ~ if step == 0~ +** Processing line: ~ [p1, p2, p3, p4]~ +** Processing line: ~ else~ +** Processing line: ~ t_step = 1.fdiv(step + 1)~ +** Processing line: ~ t = 0~ +** Processing line: ~ t += t_step~ +** Processing line: ~ points = []~ +** Processing line: ~ while t < 1~ +** Processing line: ~ points << [~ +** Processing line: ~ b_for_t(p1.x, p2.x, p3.x, p4.x, t),~ +** Processing line: ~ b_for_t(p1.y, p2.y, p3.y, p4.y, t),~ +** Processing line: ~ ]~ +** Processing line: ~ t += t_step~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_core~ -** Processing line: ~ @args.init_lowrez~ -** Processing line: ~ __original_tick_core__~ -** Processing line: ~~ -** Processing line: ~ return if @args.state.tick_count <= 0~ -** Processing line: ~~ -** Processing line: ~ @args.render_target(:lowrez)~ -** Processing line: ~ .labels~ -** Processing line: ~ .each do |l|~ -** Processing line: ~ l.y += 1~ -** Processing line: ~ end~ +** Processing line: ~ [~ +** Processing line: ~ p1,~ +** Processing line: ~ *points,~ +** Processing line: ~ p4~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ @args.render_target(:lowrez)~ -** Processing line: ~ .lines~ -** Processing line: ~ .each do |l|~ -** Processing line: ~ l.y += 1~ -** Processing line: ~ l.y2 += 1~ -** Processing line: ~ l.y2 += 1 if l.y1 != l.y2~ -** Processing line: ~ l.x2 += 1 if l.x1 != l.x2~ -** Processing line: ~ end~ +** Processing line: ~ def b_for_t v0, v1, v2, v3, t~ +** Processing line: ~ pow(1 - t, 3) * v0 +~ +** Processing line: ~ 3 * pow(1 - t, 2) * t * v1 +~ +** Processing line: ~ 3 * (1 - t) * pow(t, 2) * v2 +~ +** Processing line: ~ pow(t, 3) * v3~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ @args.outputs~ -** Processing line: ~ .sprites << { x: 320,~ -** Processing line: ~ y: 40,~ -** Processing line: ~ w: 640,~ -** Processing line: ~ h: 640,~ -** Processing line: ~ source_x: 0,~ -** Processing line: ~ source_y: 0,~ -** Processing line: ~ source_w: 64,~ -** Processing line: ~ source_h: 64,~ -** Processing line: ~ path: :lowrez }~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def pow n, to~ +** Processing line: ~ n ** to~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_lowrez/resolution_64x64/app/main.rb~ +** Processing line: ~* Tweening Lerping Easing Functions - Easing Using Spline - main.rb~ - H1 detected. -- Formatting line: ~99_genre_lowrez/resolution_64x64/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Tweening Lerping Easing Functions - Easing Using Spline - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ require 'app/lowrez.rb'~ -** Processing line: ~~ +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb~ ** Processing line: ~ def tick args~ -** Processing line: ~ # How to set the background color~ -** Processing line: ~ args.lowrez.background_color = [255, 255, 255]~ -** Processing line: ~~ -** Processing line: ~ # ==== HELLO WORLD ======================================================~ -** Processing line: ~ # Steps to get started:~ -** Processing line: ~ # 1. ~def tick args~ is the entry point for your game.~ -** Processing line: ~ # 2. There are quite a few code samples below, remove the "##"~ -** Processing line: ~ # before each line and save the file to see the changes.~ -** Processing line: ~ # 3. 0, 0 is in bottom left and 63, 63 is in top right corner.~ -** Processing line: ~ # 4. Be sure to come to the discord channel if you need~ -** Processing line: ~ # more help: [[http://discord.dragonruby.org]].~ -** Processing line: ~~ -** Processing line: ~ # Commenting and uncommenting code:~ -** Processing line: ~ # - Add a "#" infront of lines to comment out code~ -** Processing line: ~ # - Remove the "#" infront of lines to comment out code~ +** Processing line: ~ args.state.duration = 10.seconds~ +** Processing line: ~ args.state.spline = [~ +** Processing line: ~ [0.0, 0.33, 0.66, 1.0],~ +** Processing line: ~ [1.0, 1.0, 1.0, 1.0],~ +** Processing line: ~ [1.0, 0.66, 0.33, 0.0],~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ # Invoke the hello_world subroutine/method~ -** Processing line: ~ hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method.~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ args.state.simulation_tick = args.state.tick_count % args.state.duration~ +** Processing line: ~ progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline~ +** Processing line: ~ args.outputs.borders << args.grid.rect~ +** Processing line: ~ args.outputs.solids << [20 + 1240 * progress,~ +** Processing line: ~ 20 + 680 * progress,~ +** Processing line: ~ 20, 20].anchor_rect(0.5, 0.5)~ +** Processing line: ~ args.outputs.labels << [10,~ +** Processing line: ~ 710,~ +** Processing line: ~ "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"]~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ -** Processing line: ~ # Uncomment the line below to invoke the how_to_render_a_label subroutine/method.~ -** Processing line: ~ # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~~ -** Processing line: ~ # Scroll down to the method to see the details.~ ** Processing line: ~~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~* Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Tweening Lerping Easing Functions - Parametric Enemy Movement - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb~ +** Processing line: ~ def new_star args~ +** Processing line: ~ { x: 1280.randomize(:ratio),~ +** Processing line: ~ starting_y: 800,~ +** Processing line: ~ distance_to_travel: 900 + 100.randomize(:ratio),~ +** Processing line: ~ duration: 100.randomize(:ratio) + 60,~ +** Processing line: ~ created_at: args.state.tick_count,~ +** Processing line: ~ max_alpha: 128.randomize(:ratio) + 128,~ +** Processing line: ~ b: 255.randomize(:ratio),~ +** Processing line: ~ g: 200.randomize(:ratio),~ +** Processing line: ~ w: 1.randomize(:ratio) + 1,~ +** Processing line: ~ h: 1.randomize(:ratio) + 1 }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_render_solids args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def new_enemy args~ +** Processing line: ~ { x: 1280.randomize(:ratio),~ +** Processing line: ~ starting_y: 800,~ +** Processing line: ~ distance_to_travel: -900,~ +** Processing line: ~ duration: 60.randomize(:ratio) + 180,~ +** Processing line: ~ created_at: args.state.tick_count,~ +** Processing line: ~ w: 32,~ +** Processing line: ~ h: 32,~ +** Processing line: ~ fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i }~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def new_bullet args, starting_x, starting_y, enemy_speed~ +** Processing line: ~ { x: starting_x,~ +** Processing line: ~ starting_y: starting_y,~ +** Processing line: ~ distance_to_travel: -900,~ +** Processing line: ~ created_at: args.state.tick_count,~ +** Processing line: ~ duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs,~ +** Processing line: ~ w: 5,~ +** Processing line: ~ h: 5 }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ========================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_render_borders args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def new_player_bullet args, starting_x, starting_y, player_speed~ +** Processing line: ~ { x: starting_x,~ +** Processing line: ~ starting_y: starting_y,~ +** Processing line: ~ distance_to_travel: 900,~ +** Processing line: ~ created_at: args.state.tick_count,~ +** Processing line: ~ duration: 900 / (player_speed + 2.0),~ +** Processing line: ~ w: 5,~ +** Processing line: ~ h: 5 }~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.state.score ||= 0~ +** Processing line: ~ args.state.stars ||= []~ +** Processing line: ~ args.state.enemies ||= []~ +** Processing line: ~ args.state.bullets ||= []~ +** Processing line: ~ args.state.player_bullets ||= []~ +** Processing line: ~ args.state.max_stars = 50~ +** Processing line: ~ args.state.max_enemies = 10~ +** Processing line: ~ args.state.player.x ||= 640~ +** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ args.state.player.w ||= 32~ +** Processing line: ~ args.state.player.h ||= 32~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO RENDER A LINE =============================================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_render_lines args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars.clear~ +** Processing line: ~ args.state.max_stars.times do~ +** Processing line: ~ s = new_star args~ +** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ +** Processing line: ~ args.state.stars << s~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.enemies.clear~ +** Processing line: ~ args.state.max_enemies.times do~ +** Processing line: ~ s = new_enemy args~ +** Processing line: ~ s[:created_at] += s[:duration].randomize(:ratio)~ +** Processing line: ~ args.state.enemies << s~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # == HOW TO RENDER A SPRITE =============================================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_render_sprites args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def input args~ +** Processing line: ~ if args.inputs.keyboard.left~ +** Processing line: ~ args.state.player.x -= 5~ +** Processing line: ~ elsif args.inputs.keyboard.right~ +** Processing line: ~ args.state.player.x += 5~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ if args.inputs.keyboard.up~ +** Processing line: ~ args.state.player.y += 5~ +** Processing line: ~ elsif args.inputs.keyboard.down~ +** Processing line: ~ args.state.player.y -= 5~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT =====================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_move_a_sprite args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ if args.inputs.keyboard.key_down.space~ +** Processing line: ~ args.state.player_bullets << new_player_bullet(args,~ +** Processing line: ~ args.state.player.x + args.state.player.w.half,~ +** Processing line: ~ args.state.player.y + args.state.player.h, 5)~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w)~ +** Processing line: ~ args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_animate_a_sprite args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def completed? entity~ +** Processing line: ~ (entity[:created_at] + entity[:duration]).elapsed_time > 0~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def calc_stars args~ +** Processing line: ~ if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0~ +** Processing line: ~ stars_to_add.times { args.state.stars << new_star(args) }~ +** Processing line: ~ end~ +** Processing line: ~ args.state.stars = args.state.stars.reject { |s| completed? s }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ===========================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_animate_a_sprite_sheet args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def move_enemies args~ +** Processing line: ~ if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0~ +** Processing line: ~ enemies_to_add.times { args.state.enemies << new_enemy(args) }~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ args.state.enemies = args.state.enemies.reject { |s| completed? s }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =============================================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_determine_collision args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def move_bullets args~ +** Processing line: ~ args.state.enemies.each do |e|~ +** Processing line: ~ if args.state.tick_count.mod_zero?(e[:fire_rate])~ +** Processing line: ~ args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration])~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ args.state.bullets = args.state.bullets.reject { |s| completed? s }~ +** Processing line: ~ args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # ==== HOW TO CREATE BUTTONS ==================================================~ -** Processing line: ~ # Remove the "#" at the beginning of the line below~ -** Processing line: ~ # how_to_create_buttons args~ -** Processing line: ~ # =======================================================================~ +** Processing line: ~ def intersect? entity_one, entity_two~ +** Processing line: ~ entity_one.merge(y: current_y(entity_one))~ +** Processing line: ~ .intersect_rect? entity_two.merge(y: current_y(entity_two))~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def kill args~ +** Processing line: ~ bullets_hitting_enemies = []~ +** Processing line: ~ dead_bullets = []~ +** Processing line: ~ dead_enemies = []~ ** Processing line: ~~ -** Processing line: ~ # ==== The line below renders a debug grid, mouse information, and current tick~ -** Processing line: ~ render_debug args~ -** Processing line: ~ end~ +** Processing line: ~ args.state.player_bullets.each do |b|~ +** Processing line: ~ args.state.enemies.each do |e|~ +** Processing line: ~ if intersect? b, e~ +** Processing line: ~ dead_bullets << b~ +** Processing line: ~ dead_enemies << e~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def hello_world args~ -** Processing line: ~ args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 }~ +** Processing line: ~ args.state.score += dead_enemies.length~ ** Processing line: ~~ -** Processing line: ~ args.lowrez.labels << {~ -** Processing line: ~ x: 32,~ -** Processing line: ~ y: 63,~ -** Processing line: ~ text: "lowrezjam 2020",~ -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ -** Processing line: ~ alignment_enum: 1,~ -** Processing line: ~ r: 0,~ -** Processing line: ~ g: 0,~ -** Processing line: ~ b: 0,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH~ -** Processing line: ~ }~ +** Processing line: ~ args.state.player_bullets.reject! { |b| dead_bullets.include? b }~ +** Processing line: ~ args.state.enemies.reject! { |e| dead_enemies.include? e }~ ** Processing line: ~~ -** Processing line: ~ args.lowrez.sprites << {~ -** Processing line: ~ x: 32 - 10,~ -** Processing line: ~ y: 32 - 10,~ -** Processing line: ~ w: 20,~ -** Processing line: ~ h: 20,~ -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ -** Processing line: ~ a: args.state.tick_count % 255,~ -** Processing line: ~ angle: args.state.tick_count % 360~ -** Processing line: ~ }~ +** Processing line: ~ dead = args.state.bullets.any? do |b|~ +** Processing line: ~ [args.state.player.x,~ +** Processing line: ~ args.state.player.y,~ +** Processing line: ~ args.state.player.w,~ +** Processing line: ~ args.state.player.h].intersect_rect? b.merge(y: current_y(b))~ +** Processing line: ~ end~ +** Processing line: ~ return unless dead~ +** Processing line: ~ args.gtk.reset~ +** Processing line: ~ defaults args~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def calc args~ +** Processing line: ~ calc_stars args~ +** Processing line: ~ move_enemies args~ +** Processing line: ~ move_bullets args~ +** Processing line: ~ kill args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # =======================================================================~ -** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ -** Processing line: ~ # =======================================================================~ -** Processing line: ~ def how_to_render_a_label args~ -** Processing line: ~ # NOTE: Text is aligned from the TOP LEFT corner~ +** Processing line: ~ def current_y entity~ +** Processing line: ~ entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity))~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below)~ -** Processing line: ~ args.lowrez.labels << { x: 0, y: 57, text: "Hello World",~ -** Processing line: ~ size_enum: LOWREZ_FONT_XL,~ -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~ def render args~ +** Processing line: ~ args.outputs.solids << args.state.stars.map do |s|~ +** Processing line: ~ [s[:x],~ +** Processing line: ~ current_y(s),~ +** Processing line: ~ s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a LARGE/LG label (remove the "#" in front of each line below)~ -** Processing line: ~ args.lowrez.labels << { x: 0, y: 36, text: "Hello World",~ -** Processing line: ~ size_enum: LOWREZ_FONT_LG,~ -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~ args.outputs.borders << args.state.enemies.map do |s|~ +** Processing line: ~ [s[:x],~ +** Processing line: ~ current_y(s),~ +** Processing line: ~ s[:w], s[:h], 255, 0, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a MEDIUM/MD label (remove the "#" in front of each line below)~ -** Processing line: ~ args.lowrez.labels << { x: 0, y: 20, text: "Hello World",~ -** Processing line: ~ size_enum: LOWREZ_FONT_MD,~ -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~ args.outputs.borders << args.state.bullets.map do |b|~ +** Processing line: ~ [b[:x],~ +** Processing line: ~ current_y(b),~ +** Processing line: ~ b[:w], b[:h], 255, 0, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a SMALL/SM label (remove the "#" in front of each line below)~ -** Processing line: ~ args.lowrez.labels << { x: 0, y: 9, text: "Hello World",~ -** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ -** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ -** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~ args.outputs.borders << args.state.player_bullets.map do |b|~ +** Processing line: ~ [b[:x],~ +** Processing line: ~ current_y(b),~ +** Processing line: ~ b[:w], b[:h], 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # You are provided args.lowrez.default_label which returns a Hash that you~ -** Processing line: ~ # can ~merge~ properties with~ -** Processing line: ~ # Example 1~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(text: "Default")~ +** Processing line: ~ args.borders << [args.state.player.x,~ +** Processing line: ~ args.state.player.y,~ +** Processing line: ~ args.state.player.w,~ +** Processing line: ~ args.state.player.h, 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Example 2~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 31,~ -** Processing line: ~ text: "Default",~ -** Processing line: ~ r: 128,~ -** Processing line: ~ g: 128,~ -** Processing line: ~ b: 128)~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ input args~ +** Processing line: ~ calc args~ +** Processing line: ~ render args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ==================================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_render_solids args~ -** Processing line: ~ # Render a red square at 0, 0 with a width and height of 1~ -** Processing line: ~ args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # Render a red square at 1, 1 with a width and height of 2~ -** Processing line: ~ args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 }~ ** Processing line: ~~ -** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ -** Processing line: ~ args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 }~ +** Processing line: ~* Performance - Sprites As Hash - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Hash - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Render a red square at 6, 6 with a width and height of 4~ -** Processing line: ~ args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 }~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/09_performance/01_sprites_as_hash/app/main.rb~ +** Processing line: ~ # Sprites represented as Hashes using the queue ~args.outputs.sprites~~ +** Processing line: ~ # code up, but are the "slowest" to render.~ +** Processing line: ~ # The reason for this is the access of the key in the Hash and also~ +** Processing line: ~ # because the data args.outputs.sprites is cleared every tick.~ +** Processing line: ~ def random_x args~ +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) ===============================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_render_borders args~ -** Processing line: ~ # Render a red square at 0, 0 with a width and height of 3~ -** Processing line: ~ args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~ def random_y args~ +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ -** Processing line: ~ args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~ def random_speed~ +** Processing line: ~ 1 + (4.randomize :ratio)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a red square at 5, 5 with a width and height of 4~ -** Processing line: ~ args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~ def new_star args~ +** Processing line: ~ {~ +** Processing line: ~ x: (random_x args),~ +** Processing line: ~ y: (random_y args),~ +** Processing line: ~ w: 4, h: 4, path: 'sprites/tiny-star.png',~ +** Processing line: ~ s: random_speed~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO RENDER A LINE ===================================================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_render_lines args~ -** Processing line: ~ # Render a horizontal line at the bottom~ -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 }~ +** Processing line: ~ def move_star args, star~ +** Processing line: ~ star.x += star[:s]~ +** Processing line: ~ star.y += star[:s]~ +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ +** Processing line: ~ star.x = (random_x args)~ +** Processing line: ~ star.y = (random_y args)~ +** Processing line: ~ star[:s] = random_speed~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render a vertical line at the left~ -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 }~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.star_count ||= 0~ ** Processing line: ~~ -** Processing line: ~ # Render a diagonal line starting from the bottom left and going to the top right~ -** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 }~ -** Processing line: ~ end~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # == HOW TO RENDER A SPRITE ===================================================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_render_sprites args~ -** Processing line: ~ # Loop 10 times and create 10 sprites in 10 positions~ -** Processing line: ~ # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png'~ -** Processing line: ~ 10.times do |i|~ -** Processing line: ~ args.lowrez.sprites << {~ -** Processing line: ~ x: i * 5,~ -** Processing line: ~ y: i * 5,~ -** Processing line: ~ w: 5,~ -** Processing line: ~ h: 5,~ -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png'~ -** Processing line: ~ }~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Given an array of positions create sprites~ -** Processing line: ~ positions = [~ -** Processing line: ~ { x: 10, y: 42 },~ -** Processing line: ~ { x: 15, y: 45 },~ -** Processing line: ~ { x: 22, y: 33 },~ -** Processing line: ~ ]~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ ** Processing line: ~~ -** Processing line: ~ positions.each do |position|~ -** Processing line: ~ # use Ruby's ~Hash#merge~ function to create a sprite~ -** Processing line: ~ args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png',~ -** Processing line: ~ w: 5,~ -** Processing line: ~ h: 5)~ -** Processing line: ~ end~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_animate_a_sprite args~ -** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ -** Processing line: ~ start_animation_on_tick = 180~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ -** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ -** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ -** Processing line: ~ repeat: true # should it repeat?~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ -** Processing line: ~ if sprite_index~ -** Processing line: ~ # if the sprite_index is populated, use it to determine the sprite path and render it~ -** Processing line: ~ sprite_path = "sprites/explosion-#{sprite_index}.png"~ -** Processing line: ~ args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path }~ -** Processing line: ~ else~ -** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ -** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ ** Processing line: ~~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 32,~ -** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ end~ +** Processing line: ~* Performance - Sprites As Entities - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Entities - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # render the current tick and the resolved sprite index~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 0,~ -** Processing line: ~ y: 11,~ -** Processing line: ~ text: "Tick: #{args.state.tick_count}")~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 0,~ -** Processing line: ~ y: 5,~ -** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/09_performance/02_sprites_as_entities/app/main.rb~ +** Processing line: ~ # Sprites represented as Entities using the queue ~args.outputs.sprites~~ +** Processing line: ~ # yields nicer access apis over Hashes, but require a bit more code upfront.~ +** Processing line: ~ # The hash sample has to use star[:s] to get the speed of the star, but~ +** Processing line: ~ # an entity can use .s instead.~ +** Processing line: ~ def random_x args~ +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =================================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_animate_a_sprite_sheet args~ -** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ -** Processing line: ~ start_animation_on_tick = 180~ -** Processing line: ~~ -** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ -** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ -** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ -** Processing line: ~ repeat: true # should it repeat?~ -** Processing line: ~~ -** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ -** Processing line: ~ if sprite_index~ -** Processing line: ~ # if the sprite_index is populated, use it to determine the source rectangle and render it~ -** Processing line: ~ args.lowrez.sprites << {~ -** Processing line: ~ x: 0,~ -** Processing line: ~ y: 0,~ -** Processing line: ~ w: 64,~ -** Processing line: ~ h: 64,~ -** Processing line: ~ path: "sprites/explosion-sheet.png",~ -** Processing line: ~ source_x: 32 * sprite_index,~ -** Processing line: ~ source_y: 0,~ -** Processing line: ~ source_w: 32,~ -** Processing line: ~ source_h: 32~ -** Processing line: ~ }~ -** Processing line: ~ else~ -** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ -** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ -** Processing line: ~~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 32,~ -** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # render the current tick and the resolved sprite index~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 0,~ -** Processing line: ~ y: 11,~ -** Processing line: ~ text: "tick: #{args.state.tick_count}")~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 0,~ -** Processing line: ~ y: 5,~ -** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +** Processing line: ~ def random_y args~ +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE =~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_move_a_sprite args~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 62, text: "Use Arrow Keys",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 56, text: "Use WASD",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 50, text: "Or Click",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~~ -** Processing line: ~ # set the initial values for x and y using ||= ("or equal operator")~ -** Processing line: ~ args.state.ship.x ||= 0~ -** Processing line: ~ args.state.ship.y ||= 0~ -** Processing line: ~~ -** Processing line: ~ # if a mouse click occurs, update the ship's x and y to be the location of the click~ -** Processing line: ~ if args.lowrez.mouse_click~ -** Processing line: ~ args.state.ship.x = args.lowrez.mouse_click.x~ -** Processing line: ~ args.state.ship.y = args.lowrez.mouse_click.y~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # if a or left arrow is pressed/held, decrement the ships x position~ -** Processing line: ~ if args.lowrez.keyboard.left~ -** Processing line: ~ args.state.ship.x -= 1~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # if d or right arrow is pressed/held, increment the ships x position~ -** Processing line: ~ if args.lowrez.keyboard.right~ -** Processing line: ~ args.state.ship.x += 1~ -** Processing line: ~ end~ +** Processing line: ~ def random_speed~ +** Processing line: ~ 1 + (4.randomize :ratio)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if s or down arrow is pressed/held, decrement the ships y position~ -** Processing line: ~ if args.lowrez.keyboard.down~ -** Processing line: ~ args.state.ship.y -= 1~ -** Processing line: ~ end~ +** Processing line: ~ def new_star args~ +** Processing line: ~ args.state.new_entity :star, {~ +** Processing line: ~ x: (random_x args),~ +** Processing line: ~ y: (random_y args),~ +** Processing line: ~ w: 4, h: 4,~ +** Processing line: ~ path: 'sprites/tiny-star.png',~ +** Processing line: ~ s: random_speed~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # if w or up arrow is pressed/held, increment the ships y position~ -** Processing line: ~ if args.lowrez.keyboard.up~ -** Processing line: ~ args.state.ship.y += 1~ +** Processing line: ~ def move_star args, star~ +** Processing line: ~ star.x += star.s~ +** Processing line: ~ star.y += star.s~ +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ +** Processing line: ~ star.x = (random_x args)~ +** Processing line: ~ star.y = (random_y args)~ +** Processing line: ~ star.s = random_speed~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # render the sprite to the screen using the position stored in args.state.ship~ -** Processing line: ~ args.lowrez.sprites << {~ -** Processing line: ~ x: args.state.ship.x,~ -** Processing line: ~ y: args.state.ship.y,~ -** Processing line: ~ w: 5,~ -** Processing line: ~ h: 5,~ -** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ -** Processing line: ~ # parameters beyond this point are optional~ -** Processing line: ~ angle: 0, # Note: rotation angle is denoted in degrees NOT radians~ -** Processing line: ~ r: 255,~ -** Processing line: ~ g: 255,~ -** Processing line: ~ b: 255,~ -** Processing line: ~ a: 255~ -** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # =======================================================================~ -** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =======================================~ -** Processing line: ~ # =======================================================================~ -** Processing line: ~ def how_to_determine_collision args~ -** Processing line: ~ # Render the instructions~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 62, text: "Click Anywhere",~ -** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.star_count ||= 0~ ** Processing line: ~~ -** Processing line: ~ # if a mouse click occurs:~ -** Processing line: ~ # - set ship_one if it isn't set~ -** Processing line: ~ # - set ship_two if it isn't set~ -** Processing line: ~ # - otherwise reset ship one and ship two~ -** Processing line: ~ if args.lowrez.mouse_click~ -** Processing line: ~ # is ship_one set?~ -** Processing line: ~ if !args.state.ship_one~ -** Processing line: ~ args.state.ship_one = { x: args.lowrez.mouse_click.x - 10,~ -** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ -** Processing line: ~ w: 20,~ -** Processing line: ~ h: 20 }~ -** Processing line: ~ # is ship_one set?~ -** Processing line: ~ elsif !args.state.ship_two~ -** Processing line: ~ args.state.ship_two = { x: args.lowrez.mouse_click.x - 10,~ -** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ -** Processing line: ~ w: 20,~ -** Processing line: ~ h: 20 }~ -** Processing line: ~ # should we reset?~ -** Processing line: ~ else~ -** Processing line: ~ args.state.ship_one = nil~ -** Processing line: ~ args.state.ship_two = nil~ -** Processing line: ~ end~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # render ship one if it's set~ -** Processing line: ~ if args.state.ship_one~ -** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ -** Processing line: ~ # render ship one~ -** Processing line: ~ args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100)~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.state.ship_two~ -** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ -** Processing line: ~ # render ship two~ -** Processing line: ~ args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100)~ -** Processing line: ~ end~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ ** Processing line: ~~ -** Processing line: ~ # if both ship one and ship two are set, then determine collision~ -** Processing line: ~ if args.state.ship_one && args.state.ship_two~ -** Processing line: ~ # collision is determined using the intersect_rect? method~ -** Processing line: ~ if args.state.ship_one.intersect_rect? args.state.ship_two~ -** Processing line: ~ # if collision occurred, render the words collision!~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 31,~ -** Processing line: ~ y: 5,~ -** Processing line: ~ text: "Collision!",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ else~ -** Processing line: ~ # if collision occurred, render the words no collision.~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 31,~ -** Processing line: ~ y: 5,~ -** Processing line: ~ text: "No Collision.",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ # if both ship one and ship two aren't set, then render --~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(x: 31,~ -** Processing line: ~ y: 6,~ -** Processing line: ~ text: "--",~ -** Processing line: ~ alignment_enum: 1)~ -** Processing line: ~ end~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ ## # ==== HOW TO CREATE BUTTONS ==================================================~ -** Processing line: ~ ## # =============================================================================~ -** Processing line: ~ def how_to_create_buttons args~ -** Processing line: ~ # Define a button style~ -** Processing line: ~ args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 }~ -** Processing line: ~ args.state.label_style = { r: 80, g: 80, b: 80 }~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Render instructions~ -** Processing line: ~ args.state.button_message ||= "Press a Button!"~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(args.state.label_style)~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 62,~ -** Processing line: ~ text: args.state.button_message,~ -** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~ # Creates button one using a border and a label~ -** Processing line: ~ args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)~ -** Processing line: ~ args.lowrez.borders << args.state.button_one_border~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(args.state.label_style)~ -** Processing line: ~ .merge(x: args.state.button_one_border.x + 2,~ -** Processing line: ~ y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ -** Processing line: ~ text: "Button One")~ +** Processing line: ~* Performance - Sprites As Strict Entities - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Strict Entities - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # Creates button two using a border and a label~ -** Processing line: ~ args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/09_performance/03_sprites_as_strict_entities/app/main.rb~ +** Processing line: ~ # Sprites represented as StrictEntities using the queue ~args.outputs.sprites~~ +** Processing line: ~ # yields apis access similar to Entities, but all properties that can be set on the~ +** Processing line: ~ # entity must be predefined with a default value. Strict entities do not support the~ +** Processing line: ~ # addition of new properties after the fact. They are more performant than OpenEntities~ +** Processing line: ~ # because of this constraint.~ +** Processing line: ~ def random_x args~ +** Processing line: ~ (args.grid.w.randomize :ratio) * -1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.lowrez.borders << args.state.button_two_border~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(args.state.label_style)~ -** Processing line: ~ .merge(x: args.state.button_two_border.x + 2,~ -** Processing line: ~ y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ -** Processing line: ~ text: "Button Two")~ +** Processing line: ~ def random_y args~ +** Processing line: ~ (args.grid.h.randomize :ratio) * -1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Initialize the state variable that tracks which button was clicked to "" (empty stringI~ -** Processing line: ~ args.state.last_button_clicked ||= "--"~ +** Processing line: ~ def random_speed~ +** Processing line: ~ 1 + (4.randomize :ratio)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # If a click occurs, check to see if either button one, or button two was clicked~ -** Processing line: ~ # using the inside_rect? method of the mouse~ -** Processing line: ~ # set args.state.last_button_clicked accordingly~ -** Processing line: ~ if args.lowrez.mouse_click~ -** Processing line: ~ if args.lowrez.mouse_click.inside_rect? args.state.button_one_border~ -** Processing line: ~ args.state.last_button_clicked = "One Clicked!"~ -** Processing line: ~ elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border~ -** Processing line: ~ args.state.last_button_clicked = "Two Clicked!"~ -** Processing line: ~ else~ -** Processing line: ~ args.state.last_button_clicked = "--"~ -** Processing line: ~ end~ +** Processing line: ~ def new_star args~ +** Processing line: ~ args.state.new_entity_strict(:star,~ +** Processing line: ~ x: (random_x args),~ +** Processing line: ~ y: (random_y args),~ +** Processing line: ~ w: 4, h: 4,~ +** Processing line: ~ path: 'sprites/tiny-star.png',~ +** Processing line: ~ s: random_speed) do |entity|~ +** Processing line: ~ # invoke attr_sprite so that it responds to~ +** Processing line: ~ # all properties that are required to render a sprite~ +** Processing line: ~ entity.attr_sprite~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ # Render the current value of args.state.last_button_clicked~ -** Processing line: ~ args.lowrez.labels << args.lowrez~ -** Processing line: ~ .default_label~ -** Processing line: ~ .merge(args.state.label_style)~ -** Processing line: ~ .merge(x: 32,~ -** Processing line: ~ y: 5,~ -** Processing line: ~ text: args.state.last_button_clicked,~ -** Processing line: ~ alignment_enum: 1)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~~ -** Processing line: ~ def render_debug args~ -** Processing line: ~ if !args.state.grid_rendered~ -** Processing line: ~ 65.map_with_index do |i|~ -** Processing line: ~ args.outputs.static_debug << {~ -** Processing line: ~ x: LOWREZ_X_OFFSET,~ -** Processing line: ~ y: LOWREZ_Y_OFFSET + (i * 10),~ -** Processing line: ~ x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE,~ -** Processing line: ~ y2: LOWREZ_Y_OFFSET + (i * 10),~ -** Processing line: ~ r: 128,~ -** Processing line: ~ g: 128,~ -** Processing line: ~ b: 128,~ -** Processing line: ~ a: 80~ -** Processing line: ~ }.line~ -** Processing line: ~~ -** Processing line: ~ args.outputs.static_debug << {~ -** Processing line: ~ x: LOWREZ_X_OFFSET + (i * 10),~ -** Processing line: ~ y: LOWREZ_Y_OFFSET,~ -** Processing line: ~ x2: LOWREZ_X_OFFSET + (i * 10),~ -** Processing line: ~ y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE,~ -** Processing line: ~ r: 128,~ -** Processing line: ~ g: 128,~ -** Processing line: ~ b: 128,~ -** Processing line: ~ a: 80~ -** Processing line: ~ }.line~ -** Processing line: ~ end~ +** Processing line: ~ def move_star args, star~ +** Processing line: ~ star.x += star.s~ +** Processing line: ~ star.y += star.s~ +** Processing line: ~ if star.x > args.grid.w || star.y > args.grid.h~ +** Processing line: ~ star.x = (random_x args)~ +** Processing line: ~ star.y = (random_y args)~ +** Processing line: ~ star.s = random_speed~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.state.grid_rendered = true~ -** Processing line: ~~ -** Processing line: ~ args.state.last_click ||= 0~ -** Processing line: ~ args.state.last_up ||= 0~ -** Processing line: ~ args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click~ -** Processing line: ~ args.state.last_up = args.state.tick_count if args.lowrez.mouse_up~ -** Processing line: ~ args.state.label_style = { size_enum: -1.5 }~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.star_count ||= 0~ ** Processing line: ~~ -** Processing line: ~ args.state.watch_list = [~ -** Processing line: ~ "args.state.tick_count is: #{args.state.tick_count}",~ -** Processing line: ~ "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}",~ -** Processing line: ~ "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}",~ -** Processing line: ~ "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}",~ -** Processing line: ~ ]~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ puts "* INFO - Please specify the number of sprites to render."~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << args.state~ -** Processing line: ~ .watch_list~ -** Processing line: ~ .map_with_index do |text, i|~ -** Processing line: ~ {~ -** Processing line: ~ x: 5,~ -** Processing line: ~ y: 720 - (i * 20),~ -** Processing line: ~ text: text,~ -** Processing line: ~ size_enum: -1.5~ -** Processing line: ~ }.label~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| new_star args }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << {~ -** Processing line: ~ x: 640,~ -** Processing line: ~ y: 25,~ -** Processing line: ~ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",~ -** Processing line: ~ size_enum: -0.5,~ -** Processing line: ~ alignment_enum: 1~ -** Processing line: ~ }.label~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each { |s| move_star args, s }~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb~ +** Processing line: ~* Performance - Sprites As Classes - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Sprites As Classes - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # Hey there! Welcome to Four Decisions. Here is how you~ -** Processing line: ~ # create your decision tree. Remove =being and =end from the text to~ -** Processing line: ~ # enable the game (just save the file). Change stuff and see what happens!~ +** Processing line: ~ # ./samples/09_performance/04_sprites_as_classes/app/main.rb~ +** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.sprites~.~ +** Processing line: ~ # gives you full control of property declaration and method invocation.~ +** Processing line: ~ # They are more performant than OpenEntities and StrictEntities, but more code upfront.~ +** Processing line: ~ class Star~ +** Processing line: ~ attr_sprite~ ** Processing line: ~~ -** Processing line: ~ def game~ -** Processing line: ~ {~ -** Processing line: ~ starting_decision: :stormy_night,~ -** Processing line: ~ decisions: {~ -** Processing line: ~ stormy_night: {~ -** Processing line: ~ description: 'It was a dark and stormy night. (storyline located in decision.rb)',~ -** Processing line: ~ option_one: {~ -** Processing line: ~ description: 'Go to sleep.',~ -** Processing line: ~ decision: :nap~ -** Processing line: ~ },~ -** Processing line: ~ option_two: {~ -** Processing line: ~ description: 'Watch a movie.',~ -** Processing line: ~ decision: :movie~ -** Processing line: ~ },~ -** Processing line: ~ option_three: {~ -** Processing line: ~ description: 'Go outside.',~ -** Processing line: ~ decision: :go_outside~ -** Processing line: ~ },~ -** Processing line: ~ option_four: {~ -** Processing line: ~ description: 'Get a snack.',~ -** Processing line: ~ decision: :get_a_snack~ -** Processing line: ~ }~ -** Processing line: ~ },~ -** Processing line: ~ nap: {~ -** Processing line: ~ description: 'You took a nap. The end.',~ -** Processing line: ~ option_one: {~ -** Processing line: ~ description: 'Start over.',~ -** Processing line: ~ decision: :stormy_night~ -** Processing line: ~ }~ -** Processing line: ~ }~ -** Processing line: ~ }~ -** Processing line: ~ }~ +** Processing line: ~ def initialize grid~ +** Processing line: ~ @grid = grid~ +** Processing line: ~ @x = (rand @grid.w) * -1~ +** Processing line: ~ @y = (rand @grid.h) * -1~ +** Processing line: ~ @w = 4~ +** Processing line: ~ @h = 4~ +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ +** Processing line: ~ @path = 'sprites/tiny-star.png'~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def move~ +** Processing line: ~ @x += @s~ +** Processing line: ~ @y += @s~ +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def tick args~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each(&:move)~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb~ +** Processing line: ~* Performance - Static Sprites As Classes - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Static Sprites As Classes - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ =begin~ -** Processing line: ~~ -** Processing line: ~ Reminders:~ -** Processing line: ~~ -** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The values can be found~ -** Processing line: ~ using their keys.~ -** Processing line: ~~ -** Processing line: ~ In this sample app, the decisions needed for the game are stored in a hash. In fact, the~ -** Processing line: ~ decision.rb file contains hashes inside of other hashes!~ -** Processing line: ~~ -** Processing line: ~ Each option is a key in the first hash, but also contains a hash (description and~ -** Processing line: ~ decision being its keys) as its value.~ -** Processing line: ~ Go into the decision.rb file and take a look before diving into the code below.~ -** Processing line: ~~ -** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ -** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ -** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ -** Processing line: ~~ -** Processing line: ~ - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.~ -** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ -** Processing line: ~~ -** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ -** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ -** Processing line: ~~ -** Processing line: ~ =end~ -** Processing line: ~~ -** Processing line: ~ # This sample app provides users with a story and multiple decisions that they can choose to make.~ -** Processing line: ~ # Users can make a decision using their keyboard, and the story will move forward based on user choices.~ +** Processing line: ~ # ./samples/09_performance/05_static_sprites_as_classes/app/main.rb~ +** Processing line: ~ # Sprites represented as Classes using the queue ~args.outputs.static_sprites~.~ +** Processing line: ~ # bypasses the queue behavior of ~args.outputs.sprites~. All instances are held~ +** Processing line: ~ # by reference. You get better performance, but you are mutating state of held objects~ +** Processing line: ~ # which is less functional/data oriented.~ +** Processing line: ~ class Star~ +** Processing line: ~ attr_sprite~ ** Processing line: ~~ -** Processing line: ~ # The decisions available to users are stored in the decision.rb file.~ -** Processing line: ~ # We must have access to it for the game to function properly.~ -** Processing line: ~ GAME_FILE = 'app/decision.rb' # found in app folder~ +** Processing line: ~ def initialize grid~ +** Processing line: ~ @grid = grid~ +** Processing line: ~ @x = (rand @grid.w) * -1~ +** Processing line: ~ @y = (rand @grid.h) * -1~ +** Processing line: ~ @w = 4~ +** Processing line: ~ @h = 4~ +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ +** Processing line: ~ @path = 'sprites/tiny-star.png'~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ require GAME_FILE # require used to load another file, import class/method definitions~ +** Processing line: ~ def move~ +** Processing line: ~ @x += @s~ +** Processing line: ~ @y += @s~ +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.~ -** Processing line: ~ # Otherwise, the game is run.~ +** Processing line: ~ # calls methods needed for game to run properly~ ** Processing line: ~ def tick args~ -** Processing line: ~ if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method~ -** Processing line: ~ args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown~ -** Processing line: ~ args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]~ -** Processing line: ~ elsif respond_to?(:game) # otherwise, if responds to game~ -** Processing line: ~ args.state.loaded = true~ -** Processing line: ~ tick_game args # calls tick_game method, runs game~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.state.tick_count.mod_zero? 60 # update every 60 frames~ -** Processing line: ~ t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file~ -** Processing line: ~ if t != args.state.mtime~ -** Processing line: ~ args.state.mtime = t~ -** Processing line: ~ require GAME_FILE # require used to load file~ -** Processing line: ~ args.state.game_definition = nil # game definition and decision are empty~ -** Processing line: ~ args.state.decision_id = nil~ -** Processing line: ~ end~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Runs methods needed for game to function properly~ -** Processing line: ~ # Creates a rectangular border around the screen~ -** Processing line: ~ def tick_game args~ -** Processing line: ~ defaults args~ -** Processing line: ~ args.borders << args.grid.rect~ -** Processing line: ~ render_decision args~ -** Processing line: ~ process_inputs args~ +** Processing line: ~ # update~ +** Processing line: ~ args.state.stars.each(&:move)~ +** Processing line: ~~ +** Processing line: ~ # render~ +** Processing line: ~ args.outputs.sprites << args.state.stars~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Sets default values and uses decision.rb file to define game and decision_id~ -** Processing line: ~ # variable using the starting decision~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.state.game_definition ||= game~ -** Processing line: ~ args.state.decision_id ||= args.state.game_definition[:starting_decision]~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Outputs the possible decision descriptions the user can choose onto the screen~ -** Processing line: ~ # as well as what key to press on their keyboard to make their decision~ -** Processing line: ~ def render_decision args~ -** Processing line: ~ decision = current_decision args~ -** Processing line: ~ # text is either the value of decision's description key or warning that no description exists~ -** Processing line: ~ args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ # All decisions are stored in a hash~ -** Processing line: ~ # The descriptions output onto the screen are the values for the description keys of the hash.~ -** Processing line: ~ if decision[:option_one]~ -** Processing line: ~ args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label~ -** Processing line: ~ args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if decision[:option_two]~ -** Processing line: ~ args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description~ -** Processing line: ~ args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]~ -** Processing line: ~ end~ +** Processing line: ~* Performance - Static Sprites As Classes With Custom Drawing - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Static Sprites As Classes With Custom Drawing - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if decision[:option_three]~ -** Processing line: ~ args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description~ -** Processing line: ~ args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb~ +** Processing line: ~ # Sprites represented as Classes, with a draw_override method, and using the queue ~args.outputs.static_sprites~.~ +** Processing line: ~ # is the fastest approach. This is comparable to what other game engines set as the default behavior.~ +** Processing line: ~ # There are tradeoffs for all this speed if the creation of a full blown class, and bypassing~ +** Processing line: ~ # functional/data-oriented practices.~ +** Processing line: ~ class Star~ +** Processing line: ~ def initialize grid~ +** Processing line: ~ @grid = grid~ +** Processing line: ~ @x = (rand @grid.w) * -1~ +** Processing line: ~ @y = (rand @grid.h) * -1~ +** Processing line: ~ @w = 4~ +** Processing line: ~ @h = 4~ +** Processing line: ~ @s = 1 + (4.randomize :ratio)~ +** Processing line: ~ @path = 'sprites/tiny-star.png'~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if decision[:option_four]~ -** Processing line: ~ args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description~ -** Processing line: ~ args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]~ +** Processing line: ~ def move~ +** Processing line: ~ @x += @s~ +** Processing line: ~ @y += @s~ +** Processing line: ~ @x = (rand @grid.w) * -1 if @x > @grid.right~ +** Processing line: ~ @y = (rand @grid.h) * -1 if @y > @grid.top~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses keyboard input from the user to make a decision~ -** Processing line: ~ # Assigns the decision as the value of the decision_id variable~ -** Processing line: ~ def process_inputs args~ -** Processing line: ~ decision = current_decision args # calls current_decision method~ +** Processing line: ~ # if the object that is in args.outputs.sprites (or static_sprites)~ +** Processing line: ~ # respond_to? :draw_override, then the method is invoked giving you~ +** Processing line: ~ # access to the class used to draw to the canvas.~ +** Processing line: ~ def draw_override ffi_draw~ +** Processing line: ~ # first move then draw~ +** Processing line: ~ move~ ** Processing line: ~~ -** Processing line: ~ if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists~ -** Processing line: ~ args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id~ -** Processing line: ~ end~ +** Processing line: ~ # The argument order for ffi.draw_sprite is:~ +** Processing line: ~ # x, y, w, h, path~ +** Processing line: ~ ffi_draw.draw_sprite @x, @y, @w, @h, @path~ ** Processing line: ~~ -** Processing line: ~ if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists~ -** Processing line: ~ args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id~ +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_2 is (pass in nil for default value):~ +** Processing line: ~ # x, y, w, h, path,~ +** Processing line: ~ # angle, alpha~ +** Processing line: ~~ +** Processing line: ~ # The argument order for ffi_draw.draw_sprite_3 is:~ +** Processing line: ~ # x, y, w, h,~ +** Processing line: ~ # path,~ +** Processing line: ~ # angle,~ +** Processing line: ~ # alpha, red_saturation, green_saturation, blue_saturation~ +** Processing line: ~ # flip_horizontally, flip_vertically,~ +** Processing line: ~ # tile_x, tile_y, tile_w, tile_h~ +** Processing line: ~ # angle_anchor_x, angle_anchor_y,~ +** Processing line: ~ # source_x, source_y, source_w, source_h~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists~ -** Processing line: ~ args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id~ +** Processing line: ~ # calls methods needed for game to run properly~ +** Processing line: ~ def tick args~ +** Processing line: ~ # sets console command when sample app initially opens~ +** Processing line: ~ if Kernel.global_tick_count == 0~ +** Processing line: ~ args.gtk.console.set_command "reset_with count: 100"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists~ -** Processing line: ~ args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id~ +** Processing line: ~ # init~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.state.stars = args.state.star_count.map { |i| Star.new args.grid }~ +** Processing line: ~ args.outputs.static_sprites << args.state.stars~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Uses decision_id's value to keep track of current decision being made~ -** Processing line: ~ def current_decision args~ -** Processing line: ~ args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty~ +** Processing line: ~ # render framerate~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.outputs.primitives << args.gtk.current_framerate_primitives~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Resets the game.~ -** Processing line: ~ $gtk.reset~ +** Processing line: ~ # resets game, and assigns star count given by user~ +** Processing line: ~ def reset_with count: count~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ $gtk.args.state.star_count = count~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb~ +** Processing line: ~* Performance - Collision Limits - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Performance - Collision Limits - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ ###################################################################################~ -** Processing line: ~ # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES~ -** Processing line: ~ # THE 64x64 CANVAS.~ -** Processing line: ~ ###################################################################################~ +** Processing line: ~ # ./samples/09_performance/07_collision_limits/app/main.rb~ +** Processing line: ~ =begin~ ** Processing line: ~~ -** Processing line: ~ TINY_RESOLUTION = 64~ -** Processing line: ~ TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5)~ -** Processing line: ~ CENTER_OFFSET = 10~ -** Processing line: ~ EMULATED_FONT_SIZE = 20~ -** Processing line: ~ EMULATED_FONT_X_ZERO = 0~ -** Processing line: ~ EMULATED_FONT_Y_ZERO = 46~ +** Processing line: ~ Reminders:~ +** Processing line: ~ - find_all: Finds all elements of a collection that meet certain requirements.~ +** Processing line: ~ In this sample app, we're finding all bodies that intersect with the center body.~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ sprites = []~ -** Processing line: ~ labels = []~ -** Processing line: ~ borders = []~ -** Processing line: ~ solids = []~ -** Processing line: ~ mouse = emulate_lowrez_mouse args~ -** Processing line: ~ args.state.show_gridlines = false~ -** Processing line: ~ lowrez_tick args, sprites, labels, borders, solids, mouse~ -** Processing line: ~ render_gridlines_if_needed args~ -** Processing line: ~ render_mouse_crosshairs args, mouse~ -** Processing line: ~ emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ ** Processing line: ~~ -** Processing line: ~ def emulate_lowrez_mouse args~ -** Processing line: ~ args.state.new_entity_strict(:lowrez_mouse) do |m|~ -** Processing line: ~ m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1~ -** Processing line: ~ m.y = args.mouse.y.idiv(TINY_SCALE)~ -** Processing line: ~ if args.mouse.click~ -** Processing line: ~ m.click = [~ -** Processing line: ~ args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ -** Processing line: ~ args.mouse.click.point.y.idiv(TINY_SCALE)~ -** Processing line: ~ ]~ -** Processing line: ~ m.down = m.click~ -** Processing line: ~ else~ -** Processing line: ~ m.click = nil~ -** Processing line: ~ m.down = nil~ -** Processing line: ~ end~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ ** Processing line: ~~ -** Processing line: ~ if args.mouse.up~ -** Processing line: ~ m.up = [~ -** Processing line: ~ args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ -** Processing line: ~ args.mouse.up.point.y.idiv(TINY_SCALE)~ -** Processing line: ~ ]~ -** Processing line: ~ else~ -** Processing line: ~ m.up = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.~ ** Processing line: ~~ -** Processing line: ~ def render_mouse_crosshairs args, mouse~ -** Processing line: ~ return unless args.state.show_gridlines~ -** Processing line: ~ args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ =end~ ** Processing line: ~~ -** Processing line: ~ def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ -** Processing line: ~ args.render_target(:lowrez).solids << [0, 0, 1280, 720]~ -** Processing line: ~ args.render_target(:lowrez).sprites << sprites~ -** Processing line: ~ args.render_target(:lowrez).borders << borders~ -** Processing line: ~ args.render_target(:lowrez).solids << solids~ -** Processing line: ~ args.outputs.primitives << labels.map do |l|~ -** Processing line: ~ as_label = l.label~ -** Processing line: ~ l.text.each_char.each_with_index.map do |char, i|~ -** Processing line: ~ [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,~ -** Processing line: ~ EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,~ -** Processing line: ~ EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ # This code demonstrates moving objects that loop around once they exceed the scope of the screen,~ +** Processing line: ~ # which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies".~ ** Processing line: ~~ -** Processing line: ~ args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]~ +** Processing line: ~ def body_count num~ +** Processing line: ~ $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_gridlines_if_needed args~ -** Processing line: ~ if args.state.show_gridlines && args.static_lines.length == 0~ -** Processing line: ~ args.static_lines << 65.times.map do |i|~ -** Processing line: ~ [~ -** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE + 1, 0,~ -** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],~ -** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE, 0,~ -** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],~ -** Processing line: ~ [CENTER_OFFSET, 0 + i * TINY_SCALE,~ -** Processing line: ~ CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],~ -** Processing line: ~ [CENTER_OFFSET, 1 + i * TINY_SCALE,~ -** Processing line: ~ CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ elsif !args.state.show_gridlines~ -** Processing line: ~ args.static_lines.clear~ +** Processing line: ~ def tick args~ +** Processing line: ~~ +** Processing line: ~ # Center body's values are set using an array~ +** Processing line: ~ # Map is used to set values of 2000 other bodies~ +** Processing line: ~ # All bodies that intersect with center body are stored in collisions collection~ +** Processing line: ~ args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center~ +** Processing line: ~ args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen~ +** Processing line: ~~ +** Processing line: ~ # finds all bodies that intersect with center body, stores them in collisions~ +** Processing line: ~ collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body }~ +** Processing line: ~~ +** Processing line: ~ args.borders << args.state.center_body # outputs center body as a black border~ +** Processing line: ~~ +** Processing line: ~ # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes~ +** Processing line: ~ args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid~ +** Processing line: ~ args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well~ +** Processing line: ~~ +** Processing line: ~ args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner~ +** Processing line: ~~ +** Processing line: ~ # Bodies are returned to bottom left corner if positions exceed scope of screen~ +** Processing line: ~ args.state.other_bodies.each do |b| # for each body in the other_bodies collection~ +** Processing line: ~ b.x += 5 # x and y are both incremented by 5~ +** Processing line: ~ b.y += 5~ +** Processing line: ~ b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right)~ +** Processing line: ~ b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up)~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # Resets the game.~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/main.rb~ +** Processing line: ~* Advanced Debugging - Trace Debugging - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Trace Debugging - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ require 'app/require.rb'~ +** Processing line: ~ # ./samples/10_advanced_debugging/01_trace_debugging/app/main.rb~ +** Processing line: ~ class Game~ +** Processing line: ~ attr_gtk~ ** Processing line: ~~ -** Processing line: ~ def defaults args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ args.state.last_story_line_text ||= ""~ -** Processing line: ~ args.state.scene_history ||= []~ -** Processing line: ~ args.state.storyline_history ||= []~ -** Processing line: ~ args.state.word_delay ||= 8~ -** Processing line: ~ if args.state.tick_count == 0~ -** Processing line: ~ args.gtk.stop_music~ -** Processing line: ~ args.outputs.sounds << 'sounds/static-loop.ogg'~ +** Processing line: ~ def method1 num~ +** Processing line: ~ method2 num~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at~ -** Processing line: ~ lines = args.state~ -** Processing line: ~ .storyline_history[-1]~ -** Processing line: ~ .gsub("-", "")~ -** Processing line: ~ .gsub("~", "")~ -** Processing line: ~ .wrapped_lines(55)~ -** Processing line: ~~ -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0)~ -** Processing line: ~ elsif !args.state.is_storyline_dialog_active~ -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50))~ +** Processing line: ~ def method2 num~ +** Processing line: ~ method3 num~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return if args.state.current_scene~ -** Processing line: ~ set_scene(args, day_one_beginning(args))~ -** Processing line: ~ end~ +** Processing line: ~ def method3 num~ +** Processing line: ~ method4 num~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def inputs_move_player args~ -** Processing line: ~ if args.state.scene_changed_at.elapsed_time > 5~ -** Processing line: ~ if args.keyboard.down || args.keyboard.s || args.keyboard.j~ -** Processing line: ~ args.state.player.y -= 0.25~ -** Processing line: ~ elsif args.keyboard.up || args.keyboard.w || args.keyboard.k~ -** Processing line: ~ args.state.player.y += 0.25~ +** Processing line: ~ def method4 num~ +** Processing line: ~ if num == 1~ +** Processing line: ~ puts "UNLUCKY #{num}."~ +** Processing line: ~ state.unlucky_count += 1~ +** Processing line: ~ if state.unlucky_count > 3~ +** Processing line: ~ raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history."~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ puts "LUCKY #{num}."~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.keyboard.left || args.keyboard.a || args.keyboard.h~ -** Processing line: ~ args.state.player.x -= 0.25~ -** Processing line: ~ elsif args.keyboard.right || args.keyboard.d || args.keyboard.l~ -** Processing line: ~ args.state.player.x += 0.25~ +** Processing line: ~ def tick~ +** Processing line: ~ state.roll_history ||= []~ +** Processing line: ~ state.roll_history << rand(20) + 1~ +** Processing line: ~ state.countdown ||= 600~ +** Processing line: ~ state.countdown -= 1~ +** Processing line: ~ state.unlucky_count ||= 0~ +** Processing line: ~ outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1]~ +** Processing line: ~ if state.countdown > 0~ +** Processing line: ~ outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1]~ +** Processing line: ~ else~ +** Processing line: ~ state.attempts ||= 0~ +** Processing line: ~ state.attempts += 1~ +** Processing line: ~ outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1]~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ args.state.player.y = 60 if args.state.player.y > 63~ -** Processing line: ~ args.state.player.y = 0 if args.state.player.y < -3~ -** Processing line: ~ args.state.player.x = 60 if args.state.player.x > 63~ -** Processing line: ~ args.state.player.x = 0 if args.state.player.x < -3~ +** Processing line: ~ return if state.countdown > 0~ +** Processing line: ~ method1 state.roll_history[-1]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def null_or_empty? ary~ -** Processing line: ~ return true unless ary~ -** Processing line: ~ return true if ary.length == 0~ -** Processing line: ~ return false~ +** Processing line: ~ $game = Game.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_storyline_hotspot args~ -** Processing line: ~ hotspots = args.state.storylines.find_all do |hs|~ -** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot~ -** Processing line: ~ _, _, _, _, storyline = hotspots.first~ -** Processing line: ~ queue_storyline_text(args, storyline)~ -** Processing line: ~ args.state.inside_storyline_hotspot = true~ -** Processing line: ~ elsif null_or_empty?(hotspots)~ -** Processing line: ~ args.state.inside_storyline_hotspot = false~ +** Processing line: ~~ +** Processing line: ~* Advanced Debugging - Trace Debugging Classes - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Trace Debugging Classes - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/02_trace_debugging_classes/app/main.rb~ +** Processing line: ~ class Foobar~ +** Processing line: ~ def initialize~ +** Processing line: ~ trace! # Trace is added to the constructor.~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_scenes args~ -** Processing line: ~ hotspots = args.state.scenes.find_all do |hs|~ -** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ +** Processing line: ~ def clicky args~ +** Processing line: ~ return unless args.inputs.mouse.click~ +** Processing line: ~ try_rand rand~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot~ -** Processing line: ~ _, _, _, _, scene_method_or_hash = hotspots.first~ -** Processing line: ~ if scene_method_or_hash.is_a? Symbol~ -** Processing line: ~ set_scene(args, send(scene_method_or_hash, args))~ -** Processing line: ~ args.state.last_hotspot_scene = scene_method_or_hash~ -** Processing line: ~ args.state.scene_history << scene_method_or_hash~ -** Processing line: ~ else~ -** Processing line: ~ set_scene(args, scene_method_or_hash)~ -** Processing line: ~ end~ -** Processing line: ~ args.state.inside_scene_hotspot = true~ -** Processing line: ~ elsif null_or_empty?(hotspots)~ -** Processing line: ~ args.state.inside_scene_hotspot = false~ +** Processing line: ~ def try_rand num~ +** Processing line: ~ return if num < 0.9~ +** Processing line: ~ raise "Exception finally occurred. Take a look at logs/trace.txt #{num}."~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def null_or_whitespace? word~ -** Processing line: ~ return true if !word~ -** Processing line: ~ return true if word.strip.length == 0~ -** Processing line: ~ return false~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1]~ +** Processing line: ~ args.state.foobar = Foobar.new if args.tick_count~ +** Processing line: ~ return unless args.state.foobar~ +** Processing line: ~ args.state.foobar.clicky args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_storyline_presentation args~ -** Processing line: ~ return unless args.state.tick_count > args.state.next_storyline~ -** Processing line: ~ return unless args.state.scene_storyline_queue~ -** Processing line: ~ next_storyline = args.state.scene_storyline_queue.shift~ -** Processing line: ~ if null_or_whitespace? next_storyline~ -** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ -** Processing line: ~ args.state.is_storyline_dialog_active = false~ -** Processing line: ~ return~ -** Processing line: ~ end~ -** Processing line: ~ args.state.storyline_to_show = next_storyline~ -** Processing line: ~ args.state.is_storyline_dialog_active = true~ -** Processing line: ~ args.state.storyline_queue_empty_at = nil~ -** Processing line: ~ if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")~ -** Processing line: ~ args.state.next_storyline += 60~ -** Processing line: ~ elsif next_storyline.end_with?(",")~ -** Processing line: ~ args.state.next_storyline += 50~ -** Processing line: ~ elsif next_storyline.end_with?(":")~ -** Processing line: ~ args.state.next_storyline += 60~ -** Processing line: ~ else~ -** Processing line: ~ default_word_delay = 13 + args.state.word_delay - 8~ -** Processing line: ~ if next_storyline.gsub("-", "").gsub("~", "").length <= 4~ -** Processing line: ~ default_word_delay = 11 + args.state.word_delay - 8~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Advanced Debugging - Unit Tests - exception_raising_tests.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - exception_raising_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/exception_raising_tests.rb~ +** Processing line: ~ begin :shared~ +** Processing line: ~ class ExceptionalClass~ +** Processing line: ~ def initialize exception_to_throw = nil~ +** Processing line: ~ raise exception_to_throw if exception_to_throw~ ** Processing line: ~ end~ -** Processing line: ~ number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length~ -** Processing line: ~ args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def inputs_reload_current_scene args~ -** Processing line: ~ return~ -** Processing line: ~ if args.inputs.keyboard.key_down.r!~ -** Processing line: ~ reload_current_scene~ +** Processing line: ~ def test_exception_in_newing_object args, assert~ +** Processing line: ~ begin~ +** Processing line: ~ ExceptionalClass.new TypeError~ +** Processing line: ~ raise "Exception wasn't thrown!"~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ assert.equal! e.class, TypeError, "Exceptions within constructor should be retained."~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def inputs_dismiss_current_storyline args~ -** Processing line: ~ if args.inputs.keyboard.key_down.x!~ -** Processing line: ~ args.state.scene_storyline_queue.clear~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ puts "running tests"~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ ** Processing line: ~~ -** Processing line: ~ def inputs_restart_game args~ -** Processing line: ~ if args.inputs.keyboard.exclamation_point~ -** Processing line: ~ args.gtk.reset_state~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def inputs_change_word_delay args~ -** Processing line: ~ if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign~ -** Processing line: ~ args.state.word_delay -= 2~ -** Processing line: ~ if args.state.word_delay < 0~ -** Processing line: ~ args.state.word_delay = 0~ -** Processing line: ~ # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"~ -** Processing line: ~ else~ -** Processing line: ~ # queue_storyline_text args, "Text speed INCREASED."~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore~ -** Processing line: ~ args.state.word_delay += 2~ -** Processing line: ~ # queue_storyline_text args, "Text speed DECREASED."~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Advanced Debugging - Unit Tests - gen_docs.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - gen_docs.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil~ -** Processing line: ~ texts.each_with_index.map do |t, i|~ -** Processing line: ~ [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/gen_docs.rb~ +** Processing line: ~ # sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick~ +** Processing line: ~ Kernel.export_docs!~ ** Processing line: ~~ -** Processing line: ~ def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse~ -** Processing line: ~ # args.state.show_gridlines = true~ -** Processing line: ~ defaults args~ -** Processing line: ~ render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_solids << [0, 0, 64, 64, 0, 0, 0]~ -** Processing line: ~ calc_storyline_presentation args~ -** Processing line: ~ calc_scenes args~ -** Processing line: ~ calc_storyline_hotspot args~ -** Processing line: ~ inputs_move_player args~ -** Processing line: ~ inputs_print_mouse_rect args, lowrez_mouse~ -** Processing line: ~ inputs_reload_current_scene args~ -** Processing line: ~ inputs_dismiss_current_storyline args~ -** Processing line: ~ inputs_change_word_delay args~ -** Processing line: ~ inputs_restart_game args~ -** Processing line: ~ if !args.state.storyline_queue_empty_at~ -** Processing line: ~ args.outputs.labels << multiple_lines(args, 690, 80,~ -** Processing line: ~ ["Press \"X\" on the keyboard to dismiss dialog.",~ -** Processing line: ~ "Press \"+\" on the keyboard to INCREASE text speed.",~ -** Processing line: ~ "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def inputs_print_mouse_rect args, lowrez_mouse~ -** Processing line: ~ if lowrez_mouse.click~ -** Processing line: ~ if args.state.previous_mouse_click~ -** Processing line: ~ dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x~ -** Processing line: ~ dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y~ -** Processing line: ~ x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy~ ** Processing line: ~~ -** Processing line: ~ if dx < 0 && dx < 0~ -** Processing line: ~ x = x + w~ -** Processing line: ~ w = w.abs~ -** Processing line: ~ y = y + h~ -** Processing line: ~ h = h.abs~ -** Processing line: ~ end~ +** Processing line: ~* Advanced Debugging - Unit Tests - geometry_tests.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - geometry_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ w += 1~ -** Processing line: ~ h += 1~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/geometry_tests.rb~ +** Processing line: ~ begin :shared~ +** Processing line: ~ def primitive_representations x, y, w, h~ +** Processing line: ~ [~ +** Processing line: ~ [x, y, w, h],~ +** Processing line: ~ { x: x, y: y, w: w, h: h },~ +** Processing line: ~ RectForTest.new(x, y, w, h)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ puts [x, y, w, h]~ -** Processing line: ~ args.state.previous_mouse_click = nil~ -** Processing line: ~ else~ -** Processing line: ~ args.state.previous_mouse_click = lowrez_mouse.click~ -** Processing line: ~ square_x, square_y = lowrez_mouse.click~ -** Processing line: ~ puts [square_x, square_y]~ -** Processing line: ~ 8.map_with_index do |i|~ -** Processing line: ~ puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1]~ -** Processing line: ~ end~ +** Processing line: ~ class RectForTest~ +** Processing line: ~ attr_sprite~ +** Processing line: ~~ +** Processing line: ~ def initialize x, y, w, h~ +** Processing line: ~ @x = x~ +** Processing line: ~ @y = y~ +** Processing line: ~ @w = w~ +** Processing line: ~ @h = h~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def to_s~ +** Processing line: ~ "RectForTest: #{[x, y, w, h]}"~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def try_centering! word~ -** Processing line: ~ word ||= ""~ -** Processing line: ~ just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")~ -** Processing line: ~ return word if just_word.strip.length == 0~ -** Processing line: ~ return word if just_word.include? "~"~ -** Processing line: ~ return "~#{word}" if just_word.length <= 2~ -** Processing line: ~ if just_word.length.mod_zero? 2~ -** Processing line: ~ center_index = just_word.length.idiv(2) - 1~ -** Processing line: ~ else~ -** Processing line: ~ center_index = (just_word.length - 1).idiv(2)~ +** Processing line: ~ begin :intersect_rect?~ +** Processing line: ~ def test_intersect_rect_point args, assert~ +** Processing line: ~ assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect."~ ** Processing line: ~ end~ -** Processing line: ~ return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def queue_storyline args, scene~ -** Processing line: ~ queue_storyline_text args, scene[:storyline]~ -** Processing line: ~ end~ +** Processing line: ~ def test_intersect_rect args, assert~ +** Processing line: ~ intersecting = primitive_representations(0, 0, 100, 100) +~ +** Processing line: ~ primitive_representations(20, 20, 20, 20)~ ** Processing line: ~~ -** Processing line: ~ def queue_storyline_text args, text~ -** Processing line: ~ args.state.last_story_line_text = text~ -** Processing line: ~ args.state.storyline_history << text if text~ -** Processing line: ~ words = (text || "").split(" ")~ -** Processing line: ~ words = words.map { |w| try_centering! w }~ -** Processing line: ~ args.state.scene_storyline_queue = words~ -** Processing line: ~ if args.state.scene_storyline_queue.length != 0~ -** Processing line: ~ args.state.scene_storyline_queue.unshift "~$--"~ -** Processing line: ~ args.state.storyline_to_show = "~."~ -** Processing line: ~ else~ -** Processing line: ~ args.state.storyline_to_show = ""~ +** Processing line: ~ intersecting.product(intersecting).each do |rect_one, rect_two|~ +** Processing line: ~ assert.true! rect_one.intersect_rect?(rect_two),~ +** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ not_intersecting = [~ +** Processing line: ~ [ 0, 0, 5, 5],~ +** Processing line: ~ { x: 10, y: 10, w: 5, h: 5 },~ +** Processing line: ~ RectForTest.new(20, 20, 5, 5)~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ not_intersecting.product(not_intersecting)~ +** Processing line: ~ .reject { |rect_one, rect_two| rect_one == rect_two }~ +** Processing line: ~ .each do |rect_one, rect_two|~ +** Processing line: ~ assert.false! rect_one.intersect_rect?(rect_two),~ +** Processing line: ~ "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)."~ +** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~ args.state.scene_storyline_queue << ""~ -** Processing line: ~ args.state.next_storyline = args.state.tick_count~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def set_scene args, scene~ -** Processing line: ~ args.state.current_scene = scene~ -** Processing line: ~ args.state.background = scene[:background] || 'sprites/todo.png'~ -** Processing line: ~ args.state.scene_fade = scene[:fade] || 0~ -** Processing line: ~ args.state.scenes = (scene[:scenes] || []).reject { |s| !s }~ -** Processing line: ~ args.state.scene_render_override = scene[:render_override]~ -** Processing line: ~ args.state.storylines = (scene[:storylines] || []).reject { |s| !s }~ -** Processing line: ~ args.state.scene_changed_at = args.state.tick_count~ -** Processing line: ~ if scene[:player]~ -** Processing line: ~ args.state.player = scene[:player]~ +** Processing line: ~ begin :inside_rect?~ +** Processing line: ~ def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil~ +** Processing line: ~ assert.true! inner.inside_rect?(outer) == expected,~ +** Processing line: ~ "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})."~ ** Processing line: ~ end~ -** Processing line: ~ args.state.inside_scene_hotspot = false~ -** Processing line: ~ args.state.inside_storyline_hotspot = false~ -** Processing line: ~ queue_storyline args, scene~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replay_storyline_rect~ -** Processing line: ~ [26, -1, 7, 4]~ +** Processing line: ~ def test_inside_rect args, assert~ +** Processing line: ~ outer_rects = primitive_representations(0, 0, 10, 10)~ +** Processing line: ~ inner_rects = primitive_representations(1, 1, 5, 5)~ +** Processing line: ~ primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5))~ +** Processing line: ~ .each do |outer, inner|~ +** Processing line: ~ assert_inside_rect outer: outer, inner: inner,~ +** Processing line: ~ expected: true, assert: assert~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def labels_for_word word~ -** Processing line: ~ left_side_of_word = ""~ -** Processing line: ~ center_letter = ""~ -** Processing line: ~ right_side_of_word = ""~ +** Processing line: ~ begin :angle_to~ +** Processing line: ~ def test_angle_to args, assert~ +** Processing line: ~ origins = primitive_representations(0, 0, 0, 0)~ +** Processing line: ~ rights = primitive_representations(1, 0, 0, 0)~ +** Processing line: ~ aboves = primitive_representations(0, 1, 0, 0)~ ** Processing line: ~~ -** Processing line: ~ if word[0] == "~"~ -** Processing line: ~ left_side_of_word = ""~ -** Processing line: ~ center_letter = word[1]~ -** Processing line: ~ right_side_of_word = word[2..-1]~ -** Processing line: ~ elsif word.length > 0~ -** Processing line: ~ left_side_of_word, right_side_of_word = word.split("~")~ -** Processing line: ~ center_letter = right_side_of_word[0]~ -** Processing line: ~ right_side_of_word = right_side_of_word[1..-1]~ -** Processing line: ~ end~ +** Processing line: ~ origins.product(aboves).each do |origin, above|~ +** Processing line: ~ assert.equal! origin.angle_to(above), 90,~ +** Processing line: ~ "A point directly above should be 90 degrees."~ ** Processing line: ~~ -** Processing line: ~ right_side_of_word = right_side_of_word.gsub("-", "")~ +** Processing line: ~ assert.equal! above.angle_from(origin), 90,~ +** Processing line: ~ "A point coming from above should be 90 degrees."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ {~ -** Processing line: ~ left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],~ -** Processing line: ~ center: [29, 2, center_letter, 255, 0, 0],~ -** Processing line: ~ right: [34, 2, right_side_of_word]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ origins.product(rights).each do |origin, right|~ +** Processing line: ~ assert.equal! origin.angle_to(right) % 360, 0,~ +** Processing line: ~ "A point directly to the right should be 0 degrees."~ ** Processing line: ~~ -** Processing line: ~ def render_scenes args, lowrez_sprites~ -** Processing line: ~ lowrez_sprites << args.state.scenes.flat_map do |hs|~ -** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ assert.equal! right.angle_from(origin) % 360, 0,~ +** Processing line: ~ "A point coming from the right should be 0 degrees."~ ** Processing line: ~~ -** Processing line: ~ def render_storylines args, lowrez_sprites~ -** Processing line: ~ lowrez_sprites << args.state.storylines.flat_map do |hs|~ -** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def adornments_alpha args, target_alpha = nil, minimum_alpha = nil~ -** Processing line: ~ return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at~ -** Processing line: ~ target_alpha ||= 255~ -** Processing line: ~ target_alpha * args.state.storyline_queue_empty_at.ease(60)~ -** Processing line: ~ end~ +** Processing line: ~ begin :scale_rect~ +** Processing line: ~ def test_scale_rect args, assert~ +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5),~ +** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ ** Processing line: ~~ -** Processing line: ~ def hotspot_square args, x, y, w, h~ -** Processing line: ~ if w >= 3 && h >= 3~ -** Processing line: ~ [~ -** Processing line: ~ [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],~ -** Processing line: ~ [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],~ -** Processing line: ~ [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],~ -** Processing line: ~ ]~ -** Processing line: ~ else~ -** Processing line: ~ [~ -** Processing line: ~ [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect(0.5),~ +** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ ** Processing line: ~~ -** Processing line: ~ def render_storyline_dialog args, lowrez_labels, lowrez_sprites~ -** Processing line: ~ return unless args.state.is_storyline_dialog_active~ -** Processing line: ~ return unless args.state.storyline_to_show~ -** Processing line: ~ labels = labels_for_word args.state.storyline_to_show~ -** Processing line: ~ if true # high rez version~ -** Processing line: ~ scale = 8.88~ -** Processing line: ~ offset = 45~ -** Processing line: ~ size = 25~ -** Processing line: ~ args.outputs.labels << [offset + labels[:left].x.-(1) * scale,~ -** Processing line: ~ labels[:left].y * TINY_SCALE + 55,~ -** Processing line: ~ labels[:left].text, size, 0, 0, 0, 0, 255,~ -** Processing line: ~ 'fonts/manaspc.ttf']~ -** Processing line: ~ center_text = labels[:center].text~ -** Processing line: ~ center_text = "|" if center_text == "$"~ -** Processing line: ~ args.outputs.labels << [offset + labels[:center].x * scale,~ -** Processing line: ~ labels[:center].y * TINY_SCALE + 55,~ -** Processing line: ~ center_text, size, 0, 255, 0, 0, 255,~ -** Processing line: ~ 'fonts/manaspc.ttf']~ -** Processing line: ~ args.outputs.labels << [offset + labels[:right].x * scale,~ -** Processing line: ~ labels[:right].y * TINY_SCALE + 55,~ -** Processing line: ~ labels[:right].text, size, 0, 0, 0, 0, 255,~ -** Processing line: ~ 'fonts/manaspc.ttf']~ -** Processing line: ~ else~ -** Processing line: ~ lowrez_labels << labels[:left]~ -** Processing line: ~ lowrez_labels << labels[:center]~ -** Processing line: ~ lowrez_labels << labels[:right]~ +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5),~ +** Processing line: ~ [25.0, 25.0, 50.0, 50.0]~ +** Processing line: ~~ +** Processing line: ~ assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0),~ +** Processing line: ~ [0.0, 0.0, 50.0, 50.0]~ ** Processing line: ~ end~ -** Processing line: ~ args.state.is_storyline_dialog_active = true~ -** Processing line: ~ render_player args, lowrez_sprites~ -** Processing line: ~ lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png']~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_player args, lowrez_sprites~ -** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ -** Processing line: ~ end~ +** Processing line: ~ puts "running tests"~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ ** Processing line: ~~ -** Processing line: ~ def render_adornments args, lowrez_sprites~ -** Processing line: ~ render_scenes args, lowrez_sprites~ -** Processing line: ~ render_storylines args, lowrez_sprites~ -** Processing line: ~ return if args.state.is_storyline_dialog_active~ -** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def global_alpha_percentage args, max_alpha = 255~ -** Processing line: ~ return 255 unless args.state.scene_changed_at~ -** Processing line: ~ return 255 unless args.state.scene_fade~ -** Processing line: ~ return 255 unless args.state.scene_fade > 0~ -** Processing line: ~ return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]~ -** Processing line: ~ if args.state.scene_render_override~ -** Processing line: ~ send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ end~ -** Processing line: ~ storyline_to_show = args.state.storyline_to_show || ""~ -** Processing line: ~ render_adornments args, lowrez_sprites~ -** Processing line: ~ render_storyline_dialog args, lowrez_labels, lowrez_sprites~ +** Processing line: ~* Advanced Debugging - Unit Tests - http_tests.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - http_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if args.state.background == 'sprites/tribute-game-over.png'~ -** Processing line: ~ lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]~ -** Processing line: ~ lowrez_labels << [9, 6, 'Return of', 255, 255, 255]~ -** Processing line: ~ lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]~ -** Processing line: ~ if !args.state.ended~ -** Processing line: ~ args.gtk.stop_music~ -** Processing line: ~ args.outputs.sounds << 'sounds/music-loop.ogg'~ -** Processing line: ~ args.state.ended = true~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/http_tests.rb~ +** Processing line: ~ def try_assert_or_schedule args, assert~ +** Processing line: ~ if $result[:complete]~ +** Processing line: ~ log_info "Request completed! Verifying."~ +** Processing line: ~ if $result[:http_response_code] != 200~ +** Processing line: ~ log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200."~ +** Processing line: ~ exit~ +** Processing line: ~ end~ +** Processing line: ~ log_info ":try_assert_or_schedule succeeded!"~ +** Processing line: ~ else~ +** Processing line: ~ args.gtk.schedule_callback Kernel.tick_count + 10 do~ +** Processing line: ~ try_assert_or_schedule args, assert~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def player_md_right args, x, y~ -** Processing line: ~ [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def player_md_left args, x, y~ -** Processing line: ~ [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def player_md_up args, x, y~ -** Processing line: ~ [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def player_md_down args, x, y~ -** Processing line: ~ [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def player_sm args, x, y~ -** Processing line: ~ [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ def test_http args, assert~ +** Processing line: ~ $result = $gtk.http_get 'http://dragonruby.org'~ +** Processing line: ~ try_assert_or_schedule args, assert~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def player_xs args, x, y~ -** Processing line: ~ [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ -** Processing line: ~ end~ +** Processing line: ~ puts "running tests"~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/repl.rb~ +** Processing line: ~* Advanced Debugging - Unit Tests - object_to_primitive_tests.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/repl.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - object_to_primitive_tests.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ puts $gtk.args.state.current_scene~ +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/object_to_primitive_tests.rb~ +** Processing line: ~ class PlayerSpriteForTest~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_array_to_sprite args, assert~ +** Processing line: ~ array = [[0, 0, 100, 100, "test.png"]].sprites~ +** Processing line: ~ puts "No exception was thrown. Sweet!"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_class_to_sprite args, assert~ +** Processing line: ~ array = [PlayerSprite.new].sprites~ +** Processing line: ~ assert.true! array.first.is_a?(PlayerSprite)~ +** Processing line: ~ puts "No exception was thrown. Sweet!"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/require.rb~ +** Processing line: ~* Advanced Debugging - Unit Tests - parsing_tests.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/require.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - parsing_tests.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ require 'app/lowrez_simulator.rb'~ -** Processing line: ~ require 'app/storyline_day_one.rb'~ -** Processing line: ~ require 'app/storyline_blinking_light.rb'~ -** Processing line: ~ require 'app/storyline_serenity_introduction.rb'~ -** Processing line: ~ require 'app/storyline_speed_of_light.rb'~ -** Processing line: ~ require 'app/storyline_serenity_alive.rb'~ -** Processing line: ~ require 'app/storyline_serenity_bio.rb'~ -** Processing line: ~ require 'app/storyline_anka.rb'~ -** Processing line: ~ require 'app/storyline_final_message.rb'~ -** Processing line: ~ require 'app/storyline_final_decision.rb'~ -** Processing line: ~ require 'app/storyline.rb'~ +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/parsing_tests.rb~ +** Processing line: ~ def test_parse_json args, assert~ +** Processing line: ~ result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }'~ +** Processing line: ~ assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def test_parse_xml args, assert~ +** Processing line: ~ result = args.gtk.parse_xml <<-S~ +** Processing line: ~ ~ +** Processing line: ~ John Doe~ +** Processing line: ~ ~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ expected = {:type=>:element,~ +** Processing line: ~ :name=>nil,~ +** Processing line: ~ :children=>[{:type=>:element,~ +** Processing line: ~ :name=>"Person",~ +** Processing line: ~ :children=>[{:type=>:element,~ +** Processing line: ~ :name=>"Name",~ +** Processing line: ~ :children=>[{:type=>:content,~ +** Processing line: ~ :data=>"John Doe"}]}],~ +** Processing line: ~ :attributes=>{"id"=>"100"}}]}~ +** Processing line: ~~ +** Processing line: ~ assert.equal! result, expected, "Parsing xml failed."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ puts "running tests"~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline.rb~ +** Processing line: ~* Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - serialize_deserialize_tests.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def hotspot_top~ -** Processing line: ~ [4, 61, 56, 3]~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/serialize_deserialize_tests.rb~ +** Processing line: ~ def test_serialize args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.state.player_one = "test"~ +** Processing line: ~ result = args.gtk.serialize_state args.state~ +** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ ** Processing line: ~~ -** Processing line: ~ def hotspot_bottom~ -** Processing line: ~ [4, 0, 56, 3]~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.gtk.write_file 'state.txt', ''~ +** Processing line: ~ result = args.gtk.serialize_state 'state.txt', args.state~ +** Processing line: ~ assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def hotspot_top_right~ -** Processing line: ~ [62, 35, 3, 25]~ -** Processing line: ~ end~ +** Processing line: ~ def test_deserialize args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ +** Processing line: ~ assert.equal! result.player_one, "test"~ ** Processing line: ~~ -** Processing line: ~ def hotspot_bottom_right~ -** Processing line: ~ [62, 0, 3, 25]~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}'~ +** Processing line: ~ result = args.gtk.deserialize_state 'state.txt'~ +** Processing line: ~ assert.equal! result.player_one, "test"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def storyline_history_include? args, text~ -** Processing line: ~ args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }~ -** Processing line: ~ end~ +** Processing line: ~ def test_very_large_serialization args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ size = 3000~ +** Processing line: ~ size.map_with_index do |i|~ +** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ result = args.gtk.serialize_state args.state~ +** Processing line: ~ assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly")~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ end~ +** Processing line: ~ def test_strict_entity_serialization args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ +** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken")~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ end~ +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}'~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ end~ +** Processing line: ~ deserialize_state = args.gtk.deserialize_state serialized_state~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ -** Processing line: ~ lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ -** Processing line: ~ lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ assert.equal! args.state.player_one.name, deserialize_state.player_one.name~ +** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ +** Processing line: ~~ +** Processing line: ~ assert.equal! args.state.player_two.name, deserialize_state.player_two.name~ +** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []~ -** Processing line: ~ result_one_scene, result_one_label, result_one_text = context_result_one~ -** Processing line: ~ result_two_scene, result_two_label, result_two_text = context_result_two~ -** Processing line: ~ result_three_scene, result_three_label, result_three_text = context_result_three~ -** Processing line: ~ result_four_scene, result_four_label, result_four_text = context_result_four~ +** Processing line: ~ def test_strict_entity_serialization_with_nil args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.state.player_one = args.state.new_entity(:player, name: "Ryu")~ +** Processing line: ~ args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil)~ ** Processing line: ~~ -** Processing line: ~ top_level_hash = {~ -** Processing line: ~ background: 'sprites/decision.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [20, 36],~ -** Processing line: ~ storylines: [ ],~ -** Processing line: ~ scenes: [ ]~ -** Processing line: ~ }~ +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +** Processing line: ~ assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}'~ ** Processing line: ~~ -** Processing line: ~ confirmation_result_one_hash = {~ -** Processing line: ~ background: 'sprites/decision.png',~ -** Processing line: ~ scenes: [ ],~ -** Processing line: ~ storylines: [ ]~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ confirmation_result_two_hash = {~ -** Processing line: ~ background: 'sprites/decision.png',~ -** Processing line: ~ scenes: [ ],~ -** Processing line: ~ storylines: [ ]~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ confirmation_result_three_hash = {~ -** Processing line: ~ background: 'sprites/decision.png',~ -** Processing line: ~ scenes: [ ],~ -** Processing line: ~ storylines: [ ]~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ confirmation_result_four_hash = {~ -** Processing line: ~ background: 'sprites/decision.png',~ -** Processing line: ~ scenes: [ ],~ -** Processing line: ~ storylines: [ ]~ -** Processing line: ~ }~ -** Processing line: ~~ -** Processing line: ~ top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]~ -** Processing line: ~ top_level_hash[:storylines] << [20, 35, 4, 4, context_action]~ -** Processing line: ~~ -** Processing line: ~ confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ -** Processing line: ~ confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene]~ -** Processing line: ~ confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]~ -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ -** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ ** Processing line: ~~ -** Processing line: ~ confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ -** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ -** Processing line: ~ confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene]~ -** Processing line: ~ confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]~ +** Processing line: ~ assert.equal! args.state.player_one.name, deserialized_state.player_one.name~ +** Processing line: ~ assert.true! args.state.player_one.is_a? GTK::OpenEntity~ ** Processing line: ~~ -** Processing line: ~ confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash]~ -** Processing line: ~ confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene]~ -** Processing line: ~ confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]~ -** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~ assert.equal! args.state.player_two.name, deserialized_state.player_two.name~ +** Processing line: ~ assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type~ +** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, nil~ +** Processing line: ~ assert.true! args.state.player_two.is_a? GTK::StrictEntity~ ** Processing line: ~~ -** Processing line: ~ confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ -** Processing line: ~ confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene]~ -** Processing line: ~ confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]~ -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash]~ -** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~ deserialized_state.player_two.blood_type = :O~ +** Processing line: ~ assert.equal! deserialized_state.player_two.blood_type, :O~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ -** Processing line: ~ top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ -** Processing line: ~ top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ -** Processing line: ~ top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~ def test_multiple_strict_entities args, assert~ +** Processing line: ~ GTK::Entity.__reset_id__!~ +** Processing line: ~ args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu")~ +** Processing line: ~ args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean')~ ** Processing line: ~~ -** Processing line: ~ top_level_hash~ -** Processing line: ~ end~ +** Processing line: ~ serialized_state = args.gtk.serialize_state args.state~ +** Processing line: ~ deserialized_state = args.gtk.deserialize_state serialized_state~ ** Processing line: ~~ -** Processing line: ~ def ship_control_hotspot offset_x, offset_y, a, b, c, d~ -** Processing line: ~ results = []~ -** Processing line: ~ results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a~ -** Processing line: ~ results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b~ -** Processing line: ~ results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c~ -** Processing line: ~ results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d~ -** Processing line: ~ results~ +** Processing line: ~ assert.equal! deserialized_state.player.name, "Ryu"~ +** Processing line: ~ assert.equal! deserialized_state.enemy.other_property, "extra mean"~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def reload_current_scene~ -** Processing line: ~ if $gtk.args.state.last_hotspot_scene~ -** Processing line: ~ set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)~ -** Processing line: ~ tick $gtk.args~ -** Processing line: ~ elsif respond_to? :set_scene~ -** Processing line: ~ set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)~ -** Processing line: ~ tick $gtk.args~ -** Processing line: ~ end~ -** Processing line: ~ $gtk.console.close~ -** Processing line: ~ end~ +** Processing line: ~ $tests.start~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb~ +** Processing line: ~* Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Advanced Debugging - Unit Tests - state_serialization_experimental_tests.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def anka_inside_room args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 35],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, -1, 8, 3, :anka_observatory]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/10_advanced_debugging/03_unit_tests/state_serialization_experimental_tests.rb~ +** Processing line: ~ MAX_CODE_GEN_LENGTH = 50~ ** Processing line: ~~ -** Processing line: ~ def anka_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [51, 12],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :anka_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ +** Processing line: ~ # NOTE: This is experimental/advanced stuff.~ +** Processing line: ~ def needs_partitioning? target~ +** Processing line: ~ target[:value].to_s.length > MAX_CODE_GEN_LENGTH~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def anka_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ player: [32, 4],~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 45, 17, 4, (anka_last_reply args)],~ -** Processing line: ~ [45, 45, 4, 4, (anka_current_reply args)],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_top_right, :reply_to_anka]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def partition target~ +** Processing line: ~ return [] unless needs_partitioning? target~ +** Processing line: ~ if target[:value].is_a? GTK::OpenEntity~ +** Processing line: ~ target[:value] = target[:value].hash~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def reply_to_anka args~ -** Processing line: ~ decision_graph anka_current_reply(args),~ -** Processing line: ~ "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",~ -** Processing line: ~ [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],~ -** Processing line: ~ [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]~ +** Processing line: ~ results = []~ +** Processing line: ~ idx = 0~ +** Processing line: ~ left, right = target[:value].partition do~ +** Processing line: ~ idx += 1~ +** Processing line: ~ idx.even?~ +** Processing line: ~ end~ +** Processing line: ~ left, right = Hash[left], Hash[right]~ +** Processing line: ~ left = { value: left }~ +** Processing line: ~ right = { value: right}~ +** Processing line: ~ [left, right]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def anka_last_reply args~ -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ -** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ -** Processing line: ~ else~ -** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ +** Processing line: ~ def add_partition target, path, aggregate, final_result~ +** Processing line: ~ partitions = partition target~ +** Processing line: ~ partitions.each do |part|~ +** Processing line: ~ if needs_partitioning? part~ +** Processing line: ~ if part[:value].keys.length == 1~ +** Processing line: ~ first_key = part[:value].keys[0]~ +** Processing line: ~ new_part = { value: part[:value][first_key] }~ +** Processing line: ~ path.push first_key~ +** Processing line: ~ add_partition new_part, path, aggregate, final_result~ +** Processing line: ~ path.pop~ +** Processing line: ~ else~ +** Processing line: ~ add_partition part, path, aggregate, final_result~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ final_result << { value: { __path__: [*path] } }~ +** Processing line: ~ final_result << { value: part[:value] }~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def anka_reply_whole_truth~ -** Processing line: ~ "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."~ +** Processing line: ~ def state_to_string state~ +** Processing line: ~ parts_queue = []~ +** Processing line: ~ final_queue = []~ +** Processing line: ~ add_partition({ value: state.hash },~ +** Processing line: ~ [],~ +** Processing line: ~ parts_queue,~ +** Processing line: ~ final_queue)~ +** Processing line: ~ final_queue.reject {|i| i[:value].keys.length == 0}.map do |i|~ +** Processing line: ~ i[:value].to_s~ +** Processing line: ~ end.join("\n#==================================================#\n")~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def anka_reply_half_truth~ -** Processing line: ~ "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."~ -** Processing line: ~ end~ +** Processing line: ~ def state_from_string string~ +** Processing line: ~ Kernel.eval("$load_data = {}")~ +** Processing line: ~ lines = string.split("\n#==================================================#\n")~ +** Processing line: ~ lines.each do |l|~ +** Processing line: ~ puts "todo: #{l}"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_with_whole_truth args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],~ -** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ GTK::OpenEntity.parse_from_hash $load_data~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_with_half_truth args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],~ -** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ def test_save_and_load args, assert~ +** Processing line: ~ args.state.item_1.name = "Jane"~ +** Processing line: ~ string = state_to_string args.state~ +** Processing line: ~ state = state_from_string string~ +** Processing line: ~ assert.equal! args.state.item_1.name, state.item_1.name~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def anka_current_reply args~ -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ -** Processing line: ~ return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ -** Processing line: ~ else~ -** Processing line: ~ return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ +** Processing line: ~ def test_save_and_load_big args, assert~ +** Processing line: ~ size = 1000~ +** Processing line: ~ size.map_with_index do |i|~ +** Processing line: ~ args.state.send("k#{i}=".to_sym, i)~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_anka_back_home args~ -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ -** Processing line: ~ return {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 4],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 38, 12, 13, :final_message_sad],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ else~ -** Processing line: ~ return {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 4],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 38, 12, 13, :final_message_happy],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ string = state_to_string args.state~ +** Processing line: ~ state = state_from_string string~ +** Processing line: ~ size.map_with_index do |i|~ +** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym)~ +** Processing line: ~ assert.equal! args.state.send("k#{i}".to_sym), i~ +** Processing line: ~ assert.equal! state.send("k#{i}".to_sym), i~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def test_save_and_load_big_nested args, assert~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k0 = 0~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k1 = 1~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k2 = 2~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k3 = 3~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k4 = 4~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k5 = 5~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k6 = 6~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k7 = 7~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k8 = 8~ +** Processing line: ~ args.state.player_one.friend.nested_hash.k9 = 9~ +** Processing line: ~ string = state_to_string args.state~ +** Processing line: ~ state = state_from_string string~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.log_level = :off~ +** Processing line: ~ $gtk.tests.start~ +** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb~ +** Processing line: ~* Http - Retrieve Images - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Http - Retrieve Images - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def the_blinking_light args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [16, 13],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [52, 24, 11, 5, :blinking_light_mountain_pass],~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/11_http/01_retrieve_images/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_mountain_pass args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ -** Processing line: ~ player: [4, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [18, 47, 5, 5, :blinking_light_path_to_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # Show a warning at the start.~ +** Processing line: ~ args.state.warning_debounce ||= 11 * 60~ +** Processing line: ~ if args.state.warning_debounce > 0~ +** Processing line: ~ args.state.warning_debounce -= 1~ +** Processing line: ~ args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255]~ +** Processing line: ~ args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255]~ +** Processing line: ~ args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255]~ +** Processing line: ~ return~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_path_to_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [60, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 26, 5, 5, :blinking_light_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ args.state.download_debounce ||= 0 # start immediately, reset to non zero later.~ +** Processing line: ~ args.state.photos ||= []~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [28, 39, 4, 10, :blinking_light_inside_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # Put a little pause between each download.~ +** Processing line: ~ if args.state.download.nil?~ +** Processing line: ~ if args.state.download_debounce > 0~ +** Processing line: ~ args.state.download_debounce -= 1~ +** Processing line: ~ else~ +** Processing line: ~ args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg'~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_inside_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :blinking_light_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ if !args.state.download.nil?~ +** Processing line: ~ if args.state.download[:complete]~ +** Processing line: ~ if args.state.download[:http_response_code] == 200~ +** Processing line: ~ fname = "sprites/#{args.state.photos.length}.jpg"~ +** Processing line: ~ $gtk.write_file fname, args.state.download[:response_data]~ +** Processing line: ~ args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ]~ +** Processing line: ~ end~ +** Processing line: ~ args.state.download = nil~ +** Processing line: ~ args.state.download_debounce = (rand(3) + 2) * 60~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def blinking_light_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [62, 32, 4, 32, :reply_to_introduction]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],~ -** Processing line: ~ [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],~ -** Processing line: ~ [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],~ -** Processing line: ~ [14, 20, 24, 4, "What the heck activated--- this thing- though?"]~ -** Processing line: ~ ]~ +** Processing line: ~ # draw any downloaded photos...~ +** Processing line: ~ args.state.photos.each { |i|~ +** Processing line: ~ args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite~ ** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ # Draw a download progress bar...~ +** Processing line: ~ args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid~ +** Processing line: ~ if !args.state.download.nil?~ +** Processing line: ~ br = args.state.download[:response_read]~ +** Processing line: ~ total = args.state.download[:response_total]~ +** Processing line: ~ if total != 0~ +** Processing line: ~ pct = br.to_f / total.to_f~ +** Processing line: ~ args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb~ +** Processing line: ~* 12 C Extensions - Basics - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~12 C Extensions - Basics - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def day_one_beginning args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [16, 13],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 0, 64, 2, :day_one_infront_of_home],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/12_c_extensions/01_basics/app/main.rb~ +** Processing line: ~ $gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib")~ +** Processing line: ~ include FFI::CExt~ ** Processing line: ~~ -** Processing line: ~ def day_one_infront_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/front-of-home.png',~ -** Processing line: ~ player: [56, 23],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [43, 34, 10, 16, :day_one_home],~ -** Processing line: ~ [62, 0, 3, 40, :day_one_beginning],~ -** Processing line: ~ [0, 4, 3, 20, :day_one_ceremony]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [460, 600, "square(42) = #{square(42)}"]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def day_one_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 3],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [28, 0, 12, 2, :day_one_infront_of_home]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [~ -** Processing line: ~ 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."~ -** Processing line: ~ ],~ -** Processing line: ~ [~ -** Processing line: ~ 28, 7, 4, 7,~ -** Processing line: ~ "Ahhh. My reading- couch. It's so comfortable--."~ -** Processing line: ~ ],~ -** Processing line: ~ [~ -** Processing line: ~ 38, 21, 4, 4,~ -** Processing line: ~ "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."~ -** Processing line: ~ ],~ -** Processing line: ~ [~ -** Processing line: ~ 45, 37, 4, 8,~ -** Processing line: ~ "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."~ -** Processing line: ~ ],~ -** Processing line: ~ [~ -** Processing line: ~ 32, 40, 8, 10,~ -** Processing line: ~ "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."~ -** Processing line: ~ ],~ -** Processing line: ~ [~ -** Processing line: ~ 25, 21, 5, 12,~ -** Processing line: ~ "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."~ -** Processing line: ~ ]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def day_one_ceremony args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute.png',~ -** Processing line: ~ player: [57, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [62, 0, 2, 40, :day_one_infront_of_home],~ -** Processing line: ~ [0, 24, 2, 40, :day_one_infront_of_library]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],~ -** Processing line: ~ [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],~ -** Processing line: ~ [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],~ -** Processing line: ~ [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def day_one_infront_of_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/outside-library.png',~ -** Processing line: ~ player: [57, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [62, 0, 2, 40, :day_one_ceremony],~ -** Processing line: ~ [49, 39, 6, 9, :day_one_library]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def day_one_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/library.png',~ -** Processing line: ~ player: [27, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 0, 64, 2, :end_day_one_infront_of_library]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],~ -** Processing line: ~ [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~* 3d - 3d Cube - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~3d - 3d Cube - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def end_day_one_infront_of_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/outside-library.png',~ -** Processing line: ~ player: [51, 33],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [49, 39, 6, 9, :day_one_library],~ -** Processing line: ~ [62, 0, 2, 40, :end_day_one_monument],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def end_day_one_monument args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute.png',~ -** Processing line: ~ player: [2, 36],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [62, 0, 2, 40, :end_day_one_infront_of_home],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def end_day_one_infront_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/front-of-home.png',~ -** Processing line: ~ player: [1, 17],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [43, 34, 10, 16, :end_day_one_home],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [20, 10, 4, 4, "It's getting late. Better get some sleep."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def end_day_one_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 3],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, 40, 8, 10, :end_day_one_dream],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [38, 4, 4, 4, "It's getting late. Better get some sleep."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_3d/3d_cube/app/main.rb~ +** Processing line: ~ STARTX = 0.0~ +** Processing line: ~ STARTY = 0.0~ +** Processing line: ~ ENDY = 20.0~ +** Processing line: ~ ENDX = 20.0~ +** Processing line: ~ SPINPOINT = 10~ +** Processing line: ~ SPINDURATION = 400~ +** Processing line: ~ POINTSIZE = 8~ +** Processing line: ~ BOXDEPTH = 40~ +** Processing line: ~ YAW = 1~ +** Processing line: ~ DISTANCE = 10~ ** Processing line: ~~ -** Processing line: ~ def end_day_one_dream args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/dream.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [4, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [62, 0, 2, 64, :explaining_the_special_power]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],~ -** Processing line: ~ [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],~ -** Processing line: ~ [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION)~ +** Processing line: ~ s = Math.sin(a)~ +** Processing line: ~ c = Math.cos(a)~ +** Processing line: ~ x = STARTX~ +** Processing line: ~ y = STARTY~ +** Processing line: ~ offset_x = (1280 - (ENDX - STARTX)) / 2~ +** Processing line: ~ offset_y = (360 - (ENDY - STARTY)) / 2~ ** Processing line: ~~ -** Processing line: ~ def explaining_the_special_power args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [32, 30],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [~ -** Processing line: ~ 38, 21, 4, 4, :explaining_the_special_power_inside_computer~ -** Processing line: ~ ],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ srand(1)~ +** Processing line: ~ while y < ENDY do~ +** Processing line: ~ while x < ENDX do~ +** Processing line: ~ if (y == STARTY ||~ +** Processing line: ~ y == (ENDY / 0.5) * 2 ||~ +** Processing line: ~ y == (ENDY / 0.5) * 2 + 0.5 ||~ +** Processing line: ~ y == ENDY - 0.5 ||~ +** Processing line: ~ x == STARTX ||~ +** Processing line: ~ x == ENDX - 0.5)~ +** Processing line: ~ z = rand(BOXDEPTH)~ +** Processing line: ~ z *= Math.sin(a / 2)~ +** Processing line: ~ x -= SPINPOINT~ +** Processing line: ~ u = (x * c) - (z * s)~ +** Processing line: ~ v = (x * s) + (z * c)~ +** Processing line: ~ k = DISTANCE.fdiv(100) + (v / 500 * YAW)~ +** Processing line: ~ u = u / k~ +** Processing line: ~ v = y / k~ +** Processing line: ~ w = POINTSIZE / 10 / k~ +** Processing line: ~ args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'}~ +** Processing line: ~ x += SPINPOINT~ +** Processing line: ~ end~ +** Processing line: ~ x += 0.5~ +** Processing line: ~ end~ +** Processing line: ~ y += 0.5~ +** Processing line: ~ x = STARTX~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def explaining_the_special_power_inside_computer args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/pc.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [34, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 62, 64, 3, :the_blinking_light]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],~ -** Processing line: ~ [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],~ -** Processing line: ~ [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],~ -** Processing line: ~ [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ $gtk.reset~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb~ +** Processing line: ~* Arcade - Dueling Starships - main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Arcade - Dueling Starships - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def final_decision_side_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 120,~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [16, 13],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [52, 24, 11, 5, :final_decision_mountain_pass],~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_side_of_home_render,~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/99_genre_arcade/dueling_starships/app/main.rb~ +** Processing line: ~ class DuelingSpaceships~ +** Processing line: ~ attr_accessor :state, :inputs, :outputs, :grid~ ** Processing line: ~~ -** Processing line: ~ def final_decision_mountain_pass args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ -** Processing line: ~ player: [4, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [18, 47, 5, 5, :final_decision_path_to_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ input~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_path_to_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [60, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 26, 5, 5, :final_decision_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def defaults~ +** Processing line: ~ outputs.background_color = [0, 0, 0]~ +** Processing line: ~ state.ship_blue ||= new_blue_ship~ +** Processing line: ~ state.ship_red ||= new_red_ship~ +** Processing line: ~ state.flames ||= []~ +** Processing line: ~ state.bullets ||= []~ +** Processing line: ~ state.ship_blue_score ||= 0~ +** Processing line: ~ state.ship_red_score ||= 0~ +** Processing line: ~ state.stars ||= 100.map do~ +** Processing line: ~ [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio),~ +** Processing line: ~ grid.h_half.randomize(:sign, :ratio)),~ +** Processing line: ~ 128 + 128.randomize(:ratio), 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [28, 39, 4, 10, :final_decision_inside_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def default_ship x, y, angle, sprite_path, bullet_sprite_path, color~ +** Processing line: ~ state.new_entity(:ship,~ +** Processing line: ~ { x: x,~ +** Processing line: ~ y: y,~ +** Processing line: ~ dy: 0,~ +** Processing line: ~ dx: 0,~ +** Processing line: ~ damage: 0,~ +** Processing line: ~ dead: false,~ +** Processing line: ~ angle: angle,~ +** Processing line: ~ max_alpha: 255,~ +** Processing line: ~ sprite_path: sprite_path,~ +** Processing line: ~ bullet_sprite_path: bullet_sprite_path,~ +** Processing line: ~ color: color })~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_inside_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ storylines: [],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :final_decision_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def new_red_ship~ +** Processing line: ~ default_ship(400, 250.randomize(:sign, :ratio),~ +** Processing line: ~ 180, 'sprites/ship_red.png', 'sprites/red_bullet.png',~ +** Processing line: ~ [255, 90, 90])~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ player: [32, 4],~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ storylines: [],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_top, :final_decision_ship_status],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def new_blue_ship~ +** Processing line: ~ default_ship(-400, 250.randomize(:sign, :ratio),~ +** Processing line: ~ 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png',~ +** Processing line: ~ [110, 140, 255])~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_ship_status args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/serenity.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 10],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_top_right, :final_decision]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 8, 4, 4, "????"],~ -** Processing line: ~ *final_decision_ship_status_shared(args)~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render~ +** Processing line: ~ render_instructions~ +** Processing line: ~ render_score~ +** Processing line: ~ render_universe~ +** Processing line: ~ render_flames~ +** Processing line: ~ render_ships~ +** Processing line: ~ render_bullets~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision args~ -** Processing line: ~ decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",~ -** Processing line: ~ "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",~ -** Processing line: ~ [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],~ -** Processing line: ~ [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],~ -** Processing line: ~ [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],~ -** Processing line: ~ [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]~ -** Processing line: ~ end~ +** Processing line: ~ def render_ships~ +** Processing line: ~ update_ship_outputs(state.ship_blue)~ +** Processing line: ~ update_ship_outputs(state.ship_red)~ +** Processing line: ~ outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite]~ +** Processing line: ~ outputs.labels << [state.ship_blue.label, state.ship_red.label]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_game_over_noone args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ -** Processing line: ~ player: [53, 14],~ -** Processing line: ~ fade: 600~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_instructions~ +** Processing line: ~ return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 ||~ +** Processing line: ~ state.ship_red.dx > 0 || state.ship_red.dy > 0 ||~ +** Processing line: ~ state.flames.length > 0~ ** Processing line: ~~ -** Processing line: ~ def final_decision_game_over_matthew args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ -** Processing line: ~ player: [53, 14],~ -** Processing line: ~ fade: 600~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << [grid.left.shift_right(30),~ +** Processing line: ~ grid.bottom.shift_up(30),~ +** Processing line: ~ "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.",~ +** Processing line: ~ 0, 0, 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_game_over_anka args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ -** Processing line: ~ player: [53, 14],~ -** Processing line: ~ fade: 600~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_thrusts~ +** Processing line: ~ calc_ships~ +** Processing line: ~ calc_bullets~ +** Processing line: ~ calc_winner~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_game_over_sasha args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/tribute-game-over.png',~ -** Processing line: ~ player: [53, 14],~ -** Processing line: ~ fade: 600~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input~ +** Processing line: ~ input_accelerate~ +** Processing line: ~ input_turn~ +** Processing line: ~ input_bullets_and_mines~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_decision_ship_status_shared args~ -** Processing line: ~ [~ -** Processing line: ~ *ship_control_hotspot(24, 22,~ -** Processing line: ~ "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",~ -** Processing line: ~ "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ -** Processing line: ~ "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ -** Processing line: ~ "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ def render_score~ +** Processing line: ~ outputs.labels << [grid.left.shift_right(80),~ +** Processing line: ~ grid.top.shift_down(40),~ +** Processing line: ~ state.ship_blue_score, 30, 1, state.ship_blue.color]~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ outputs.labels << [grid.right.shift_left(80),~ +** Processing line: ~ grid.top.shift_down(40),~ +** Processing line: ~ state.ship_red_score, 30, 1, state.ship_red.color]~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def render_universe~ +** Processing line: ~ return if outputs.static_solids.any?~ +** Processing line: ~ outputs.static_solids << grid.rect~ +** Processing line: ~ outputs.static_solids << state.stars~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb~ -- H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ def apply_round_finished_alpha entity~ +** Processing line: ~ return entity unless state.round_finished_debounce~ +** Processing line: ~ entity.a *= state.round_finished_debounce.percentage_of(2.seconds)~ +** Processing line: ~ return entity~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def final_message_sad args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 35],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 34, 4, 4, "Another-- sleepless-- night..."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def update_ship_outputs ship, sprite_size = 66~ +** Processing line: ~ ship.sprite =~ +** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y),~ +** Processing line: ~ ship.sprite_path,~ +** Processing line: ~ ship.angle,~ +** Processing line: ~ ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite~ +** Processing line: ~ ship.label =~ +** Processing line: ~ apply_round_finished_alpha [ship.x,~ +** Processing line: ~ ship.y + 100,~ +** Processing line: ~ "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_happy args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 35],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 34, 4, 4, "Oh man, I slept like rock!"],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_flames sprite_size = 6~ +** Processing line: ~ outputs.sprites << state.flames.map do |p|~ +** Processing line: ~ apply_round_finished_alpha [sprite_size.to_square(p.x, p.y),~ +** Processing line: ~ 'sprites/flame.png', 0,~ +** Processing line: ~ p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_side_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [16, 13],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [52, 24, 11, 5, :final_message_mountain_pass],~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_bullets sprite_size = 10~ +** Processing line: ~ outputs.sprites << state.bullets.map do |b|~ +** Processing line: ~ apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y),~ +** Processing line: ~ b.owner.bullet_sprite_path,~ +** Processing line: ~ 0, b.max_alpha].sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_mountain_pass args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ -** Processing line: ~ player: [4, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [18, 47, 5, 5, :final_message_path_to_observatory],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def wrap_location! location~ +** Processing line: ~ location.x = grid.left if location.x > grid.right~ +** Processing line: ~ location.x = grid.right if location.x < grid.left~ +** Processing line: ~ location.y = grid.top if location.y < grid.bottom~ +** Processing line: ~ location.y = grid.bottom if location.y > grid.top~ +** Processing line: ~ location~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_path_to_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [60, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 26, 5, 5, :final_message_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def calc_thrusts~ +** Processing line: ~ state.flames =~ +** Processing line: ~ state.flames~ +** Processing line: ~ .reject(&:old?)~ +** Processing line: ~ .map do |p|~ +** Processing line: ~ p.speed *= 0.9~ +** Processing line: ~ p.y += p.angle.vector_y(p.speed)~ +** Processing line: ~ p.x += p.angle.vector_x(p.speed)~ +** Processing line: ~ wrap_location! p~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_observatory args~ -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ -** Processing line: ~ return {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [51, 12],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 10, 4, 4, "Here-- we- go..."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ else~ -** Processing line: ~ return {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [51, 12],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ +** Processing line: ~ def all_ships~ +** Processing line: ~ [state.ship_blue, state.ship_red]~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ player: [32, 4],~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ scenes: [[45, 45, 4, 4, :final_message_check_ship_status]]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def alive_ships~ +** Processing line: ~ all_ships.reject { |s| s.dead }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_check_ship_status args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [45, 45, 4, 4, (final_message_current args)],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_top, :final_message_ship_status],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def final_message_ship_status args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/serenity.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 10],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 50, 4, 4, :final_message_ship_status_reviewed]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],~ -** Processing line: ~ *final_message_ship_status_shared(args)~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def calc_bullet bullet~ +** Processing line: ~ bullet.y += bullet.angle.vector_y(bullet.speed)~ +** Processing line: ~ bullet.x += bullet.angle.vector_x(bullet.speed)~ +** Processing line: ~ wrap_location! bullet~ +** Processing line: ~ explode_bullet! bullet if bullet.old?~ +** Processing line: ~ return if bullet.exploded~ +** Processing line: ~ return if state.round_finished~ +** Processing line: ~ alive_ships.each do |s|~ +** Processing line: ~ if s != bullet.owner &&~ +** Processing line: ~ s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y))~ +** Processing line: ~ explode_bullet! bullet, 10, 5, 30~ +** Processing line: ~ s.damage += 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_ship_status_reviewed args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/serenity.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom, :final_message_summary]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def calc_bullets~ +** Processing line: ~ state.bullets.each { |b| calc_bullet b }~ +** Processing line: ~ state.bullets.reject! { |b| b.exploded }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_ship_status_shared args~ -** Processing line: ~ [~ -** Processing line: ~ *ship_control_hotspot( 0, 50,~ -** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",~ -** Processing line: ~ "Matthew's--- Chamber--: OCCUPIED----",~ -** Processing line: ~ "Aanka's--- Chamber--: OCCUPIED----",~ -** Processing line: ~ "Sasha's--- Chamber--: OCCUPIED----"),~ -** Processing line: ~ *ship_control_hotspot(12, 35,~ -** Processing line: ~ "Life- Support--: Not-- Needed---",~ -** Processing line: ~ "O2--- Production---: OFF---",~ -** Processing line: ~ "CO2--- Scrubbers---: OFF---",~ -** Processing line: ~ "H2O--- Production---: OFF---"),~ -** Processing line: ~ *ship_control_hotspot(24, 20,~ -** Processing line: ~ "Navigation: Offline---",~ -** Processing line: ~ "Sensor: OFF---",~ -** Processing line: ~ "Heads- Up- Display: DAMAGED---",~ -** Processing line: ~ "Arithmetic--- Unit: DAMAGED----"),~ -** Processing line: ~ *ship_control_hotspot(36, 35,~ -** Processing line: ~ "COMM: Underpowered----",~ -** Processing line: ~ "Text: ON---",~ -** Processing line: ~ "Audio: SEGFAULT---",~ -** Processing line: ~ "Video: DAMAGED---"),~ -** Processing line: ~ *ship_control_hotspot(48, 50,~ -** Processing line: ~ "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",~ -** Processing line: ~ "Engine I: ON---",~ -** Processing line: ~ "Engine II: ON---",~ -** Processing line: ~ "Engine III: ON---")~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255~ +** Processing line: ~ flame_count.times do~ +** Processing line: ~ state.flames << state.new_entity(type,~ +** Processing line: ~ { angle: 360.randomize(:ratio),~ +** Processing line: ~ speed: max_speed.randomize(:ratio),~ +** Processing line: ~ lifetime: lifetime,~ +** Processing line: ~ x: entity.x,~ +** Processing line: ~ y: entity.y,~ +** Processing line: ~ max_alpha: max_alpha })~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_last_reply args~ -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ -** Processing line: ~ return "Buffer--: #{anka_reply_whole_truth.quote}"~ -** Processing line: ~ else~ -** Processing line: ~ return "Buffer--: #{anka_reply_half_truth.quote}"~ +** Processing line: ~ def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10~ +** Processing line: ~ bullet.exploded = true~ +** Processing line: ~ create_explosion! :bullet_explosion,~ +** Processing line: ~ bullet,~ +** Processing line: ~ flame_override,~ +** Processing line: ~ max_speed,~ +** Processing line: ~ lifetime,~ +** Processing line: ~ bullet.max_alpha~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_current args~ -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ -** Processing line: ~ return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."~ -** Processing line: ~ else~ -** Processing line: ~ return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"~ +** Processing line: ~ def calc_ship ship~ +** Processing line: ~ ship.x += ship.dx~ +** Processing line: ~ ship.y += ship.dy~ +** Processing line: ~ wrap_location! ship~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def final_message_summary args~ -** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ -** Processing line: ~ return {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [31, 11],~ -** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ else~ -** Processing line: ~ return {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [31, 11],~ -** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ +** Processing line: ~ def calc_ships~ +** Processing line: ~ all_ships.each { |s| calc_ship s }~ +** Processing line: ~ return if all_ships.any? { |s| s.dead }~ +** Processing line: ~ return if state.round_finished~ +** Processing line: ~ return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite)~ +** Processing line: ~ state.ship_blue.damage = 5~ +** Processing line: ~ state.ship_red.damage = 5~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ def create_thruster_flames! ship~ +** Processing line: ~ state.flames << state.new_entity(:ship_thruster,~ +** Processing line: ~ { angle: ship.angle + 180 + 60.randomize(:sign, :ratio),~ +** Processing line: ~ speed: 5.randomize(:ratio),~ +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ +** Processing line: ~ lifetime: 30,~ +** Processing line: ~ x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio),~ +** Processing line: ~ y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) })~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def input_accelerate_ship should_move_ship, ship~ +** Processing line: ~ return if ship.dead~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb~ -- H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ should_move_ship &&= (ship.dx + ship.dy).abs < 5~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def serenity_alive_side_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [16, 13],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [52, 24, 11, 5, :serenity_alive_mountain_pass],~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_side_of_home_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ if should_move_ship~ +** Processing line: ~ create_thruster_flames! ship~ +** Processing line: ~ ship.dx += ship.angle.vector_x 0.050~ +** Processing line: ~ ship.dy += ship.angle.vector_y 0.050~ +** Processing line: ~ else~ +** Processing line: ~ ship.dx *= 0.99~ +** Processing line: ~ ship.dy *= 0.99~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_mountain_pass args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ -** Processing line: ~ player: [4, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [18, 47, 5, 5, :serenity_alive_path_to_observatory],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input_accelerate~ +** Processing line: ~ input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue~ +** Processing line: ~ input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_path_to_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [60, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 26, 5, 5, :serenity_alive_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input_turn_ship direction, ship~ +** Processing line: ~ ship.angle -= 3 * direction~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [28, 39, 4, 10, :serenity_alive_inside_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input_turn~ +** Processing line: ~ input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue~ +** Processing line: ~ input_turn_ship inputs.controller_two.left_right, state.ship_red~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_inside_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ player: [60, 2],~ -** Processing line: ~ storylines: [],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :serenity_alive_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input_bullet create_bullet, ship~ +** Processing line: ~ return unless create_bullet~ +** Processing line: ~ return if ship.dead~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 4],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_top, :serenity_alive_ship_status],~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 45, 17, 4, (serenity_alive_last_reply args)],~ -** Processing line: ~ [45, 45, 4, 4, (serenity_alive_current_message args)],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ +** Processing line: ~ { owner: ship,~ +** Processing line: ~ angle: ship.angle,~ +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ +** Processing line: ~ speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y),~ +** Processing line: ~ lifetime: 120,~ +** Processing line: ~ sprite_size: 10,~ +** Processing line: ~ x: ship.x + ship.angle.vector_x * 32,~ +** Processing line: ~ y: ship.y + ship.angle.vector_y * 32 })~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_ship_status args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/serenity.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 10],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],~ -** Processing line: ~ [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],~ -** Processing line: ~ *serenity_alive_shared_ship_status(args)~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def input_mine create_mine, ship~ +** Processing line: ~ return unless create_mine~ +** Processing line: ~ return if ship.dead~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_ship_status_reviewed args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/serenity.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom, :serenity_alive_time_to_reply]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ state.bullets << state.new_entity(:ship_bullet,~ +** Processing line: ~ { owner: ship,~ +** Processing line: ~ angle: 360.randomize(:sign, :ratio),~ +** Processing line: ~ max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds),~ +** Processing line: ~ speed: 0.02,~ +** Processing line: ~ sprite_size: 10,~ +** Processing line: ~ lifetime: 600,~ +** Processing line: ~ x: ship.x + ship.angle.vector_x * -50,~ +** Processing line: ~ y: ship.y + ship.angle.vector_y * -50 })~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_time_to_reply args~ -** Processing line: ~ decision_graph serenity_alive_current_message(args),~ -** Processing line: ~ "Okay... time to deliver the bad news...",~ -** Processing line: ~ [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],~ -** Processing line: ~ [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]~ -** Processing line: ~ end~ +** Processing line: ~ def input_bullets_and_mines~ +** Processing line: ~ return if state.bullets.length > 100~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_shared_ship_status args~ -** Processing line: ~ [~ -** Processing line: ~ *ship_control_hotspot( 0, 50,~ -** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",~ -** Processing line: ~ nil,~ -** Processing line: ~ nil,~ -** Processing line: ~ nil),~ -** Processing line: ~ *ship_control_hotspot(12, 35,~ -** Processing line: ~ "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",~ -** Processing line: ~ nil,~ -** Processing line: ~ nil,~ -** Processing line: ~ nil),~ -** Processing line: ~ *ship_control_hotspot(24, 20,~ -** Processing line: ~ "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",~ -** Processing line: ~ nil,~ -** Processing line: ~ nil,~ -** Processing line: ~ nil),~ -** Processing line: ~ *ship_control_hotspot(36, 35,~ -** Processing line: ~ "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",~ -** Processing line: ~ nil,~ -** Processing line: ~ nil,~ -** Processing line: ~ nil),~ -** Processing line: ~ *ship_control_hotspot(48, 50,~ -** Processing line: ~ "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",~ -** Processing line: ~ nil,~ -** Processing line: ~ nil,~ -** Processing line: ~ nil)~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ [~ +** Processing line: ~ [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space,~ +** Processing line: ~ inputs.controller_one.key_down.b || inputs.keyboard.key_down.down,~ +** Processing line: ~ state.ship_blue],~ +** Processing line: ~ [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red]~ +** Processing line: ~ ].each do |a_held, b_down, ship|~ +** Processing line: ~ input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship)~ +** Processing line: ~ input_mine(b_down, ship)~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_firm_reply~ -** Processing line: ~ "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."~ -** Processing line: ~ end~ +** Processing line: ~ def calc_kill_ships~ +** Processing line: ~ alive_ships.find_all { |s| s.damage >= 5 }.each do |s|~ +** Processing line: ~ s.dead = true~ +** Processing line: ~ create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_sugarcoated_reply~ -** Processing line: ~ "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."~ -** Processing line: ~ end~ +** Processing line: ~ def calc_score~ +** Processing line: ~ return if state.round_finished~ +** Processing line: ~ return if alive_ships.length > 1~ ** Processing line: ~~ -** Processing line: ~ def replied_to_serenity_alive_firmly args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],~ -** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ if alive_ships.first == state.ship_red~ +** Processing line: ~ state.ship_red_score += 1~ +** Processing line: ~ elsif alive_ships.first == state.ship_blue~ +** Processing line: ~ state.ship_blue_score += 1~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_serenity_alive_kindly args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],~ -** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ state.round_finished = true~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_path_from_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [4, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom_right, :serenity_bio_infront_of_home]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def calc_reset_ships~ +** Processing line: ~ return unless state.round_finished~ +** Processing line: ~ state.round_finished_debounce ||= 2.seconds~ +** Processing line: ~ state.round_finished_debounce -= 1~ +** Processing line: ~ return if state.round_finished_debounce > 0~ +** Processing line: ~ start_new_round!~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_reply_completed_shared_hotspots args~ -** Processing line: ~ [~ -** Processing line: ~ [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],~ -** Processing line: ~ [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],~ -** Processing line: ~ [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ def start_new_round!~ +** Processing line: ~ state.ship_blue = new_blue_ship~ +** Processing line: ~ state.ship_red = new_red_ship~ +** Processing line: ~ state.round_finished = false~ +** Processing line: ~ state.round_finished_debounce = nil~ +** Processing line: ~ state.flames.clear~ +** Processing line: ~ state.bullets.clear~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_last_reply args~ -** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ -** Processing line: ~ return "Buffer--: \"Hello, Who- is sending-- this message--?\""~ -** Processing line: ~ else~ -** Processing line: ~ return "Buffer--: \"New- phone. Who dis?\""~ +** Processing line: ~ def calc_winner~ +** Processing line: ~ calc_kill_ships~ +** Processing line: ~ calc_score~ +** Processing line: ~ calc_reset_ships~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_alive_current_message args~ -** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ -** Processing line: ~ "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote~ -** Processing line: ~ else~ -** Processing line: ~ "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote~ -** Processing line: ~ end~ +** Processing line: ~ $dueling_spaceship = DuelingSpaceships.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.grid.origin_center!~ +** Processing line: ~ $dueling_spaceship.inputs = args.inputs~ +** Processing line: ~ $dueling_spaceship.outputs = args.outputs~ +** Processing line: ~ $dueling_spaceship.state = args.state~ +** Processing line: ~ $dueling_spaceship.grid = args.grid~ +** Processing line: ~ $dueling_spaceship.tick~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb~ +** Processing line: ~* arcade/flappy dragon/credits.txt~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~arcade/flappy dragon/credits.txt~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ def serenity_bio_infront_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/front-of-home.png',~ -** Processing line: ~ player: [54, 23],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [44, 34, 8, 14, :serenity_bio_inside_home],~ -** Processing line: ~ [0, 3, 3, 22, :serenity_bio_library]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/99_genre_arcade/flappy_dragon/CREDITS.txt~ +** Processing line: ~ code: Amir Rajan, https://twitter.com/amirrajan~ +** Processing line: ~ graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel~ ** Processing line: ~~ -** Processing line: ~ def serenity_bio_inside_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 4],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 4, 4, 4, "I'm--- completely--- exhausted."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 38, 12, 13, :serenity_bio_restless_sleep],~ -** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def serenity_bio_restless_sleep args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def serenity_bio_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/library.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 7],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [21, 35, 3, 18, :serenity_bio_book]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def serenity_bio_book args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/book.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [6, 52],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],~ -** Processing line: ~~ -** Processing line: ~ [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],~ -** Processing line: ~ [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],~ -** Processing line: ~~ -** Processing line: ~ [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],~ -** Processing line: ~ [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],~ -** Processing line: ~~ -** Processing line: ~ [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],~ -** Processing line: ~ [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom, :serenity_bio_finally_to_bed]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def serenity_bio_finally_to_bed args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [35, 3],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, 38, 10, 13, :bad_dream],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bad_dream args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 120,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [34, 35],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, -1, 8, 3, :bad_dream_observatory]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bad_dream_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 120,~ -** Processing line: ~ player: [51, 12],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [30, 18, 5, 12, :bad_dream_inside_mainframe]~ -** Processing line: ~ ],~ -** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bad_dream_inside_mainframe args~ -** Processing line: ~ {~ -** Processing line: ~ player: [32, 4],~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ fade: 120,~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [45, 45, 4, 4, :bad_dream_everyone_dead],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bad_dream_everyone_dead args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mainframe.png',~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ -** Processing line: ~ [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],~ -** Processing line: ~ [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [*hotspot_bottom, :anka_inside_room]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def bad_dream_last_reply args~ -** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ -** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ -** Processing line: ~ else~ -** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb~ +** Processing line: ~* arcade/flappy dragon/main.rb~ - H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~arcade/flappy dragon/main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ # decision_graph "Message from Sasha",~ -** Processing line: ~ # "I should reply.",~ -** Processing line: ~ # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"],~ -** Processing line: ~ # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]~ -** Processing line: ~ def reply_to_introduction args~ -** Processing line: ~ decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",~ -** Processing line: ~ "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",~ -** Processing line: ~ [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"],~ -** Processing line: ~ [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_seriously args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],~ -** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ # ./samples/99_genre_arcade/flappy_dragon/app/main.rb~ +** Processing line: ~ class FlappyDragon~ +** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_humorously args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-observatory.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [32, 21],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],~ -** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ process_inputs~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_shared_storylines args~ -** Processing line: ~ [~ -** Processing line: ~ [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],~ -** Processing line: ~ [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],~ -** Processing line: ~ [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]~ -** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.flap_power = 11~ +** Processing line: ~ state.gravity = 0.9~ +** Processing line: ~ state.ceiling = 600~ +** Processing line: ~ state.ceiling_flap_power = 6~ +** Processing line: ~ state.wall_countdown_length = 100~ +** Processing line: ~ state.wall_gap_size = 100~ +** Processing line: ~ state.wall_countdown ||= 0~ +** Processing line: ~ state.hi_score ||= 0~ +** Processing line: ~ state.score ||= 0~ +** Processing line: ~ state.walls ||= []~ +** Processing line: ~ state.x ||= 50~ +** Processing line: ~ state.y ||= 500~ +** Processing line: ~ state.dy ||= 0~ +** Processing line: ~ state.scene ||= :menu~ +** Processing line: ~ state.scene_at ||= 0~ +** Processing line: ~ state.difficulty ||= :normal~ +** Processing line: ~ state.new_difficulty ||= :normal~ +** Processing line: ~ state.countdown ||= 4.seconds~ +** Processing line: ~ state.flash_at ||= 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_shared_scenes args~ -** Processing line: ~ [[60, 0, 4, 32, :replied_to_introduction_observatory]]~ -** Processing line: ~ end~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1~ +** Processing line: ~ render_score~ +** Processing line: ~ render_menu~ +** Processing line: ~ render_game~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/observatory.png',~ -** Processing line: ~ player: [28, 39],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_score~ +** Processing line: ~ outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label~ +** Processing line: ~ outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label~ +** Processing line: ~ outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_path_to_observatory args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/path-to-observatory.png',~ -** Processing line: ~ player: [0, 26],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [60, 0, 4, 20, :replied_to_introduction_mountain_pass]~ -** Processing line: ~ ],~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_menu~ +** Processing line: ~ return unless state.scene == :menu~ +** Processing line: ~ render_overlay~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_mountain_pass args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ -** Processing line: ~ player: [21, 48],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [0, 0, 15, 4, :replied_to_introduction_side_of_home]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255]~ ** Processing line: ~~ -** Processing line: ~ def replied_to_introduction_side_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/side-of-home.png',~ -** Processing line: ~ player: [58, 29],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [2, 0, 61, 2, :speed_of_light_front_of_home]~ -** Processing line: ~ ],~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255]~ +** Processing line: ~ outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255]~ +** Processing line: ~ outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255]~ +** Processing line: ~ outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ def render_overlay~ +** Processing line: ~ outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def render_game~ +** Processing line: ~ render_game_over~ +** Processing line: ~ render_background~ +** Processing line: ~ render_walls~ +** Processing line: ~ render_dragon~ +** Processing line: ~ render_flash~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb~ -- H1 detected. -- Formatting line: ~99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ def render_game_over~ +** Processing line: ~ return unless state.scene == :game~ +** Processing line: ~ outputs.labels << [638, 358, score_text, 20, 1]~ +** Processing line: ~ outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [638, 428, countdown_text, 20, 1]~ +** Processing line: ~ outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def speed_of_light_front_of_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/front-of-home.png',~ -** Processing line: ~ player: [54, 23],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [44, 34, 8, 14, :speed_of_light_inside_home],~ -** Processing line: ~ [0, 3, 3, 22, :speed_of_light_outside_library]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_background~ +** Processing line: ~ outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png']~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_inside_home args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [35, 4],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [32, 0, 8, 3, :speed_of_light_front_of_home],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ scroll_point_at = state.tick_count~ +** Processing line: ~ scroll_point_at = state.scene_at if state.scene == :menu~ +** Processing line: ~ scroll_point_at = state.death_at if state.countdown > 0~ +** Processing line: ~ scroll_point_at ||= 0~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_outside_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/outside-library.png',~ -** Processing line: ~ player: [55, 19],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [49, 39, 6, 10, :speed_of_light_library],~ -** Processing line: ~ [61, 11, 3, 20, :speed_of_light_front_of_home]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25)~ +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50)~ +** Processing line: ~ outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_library args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/library.png',~ -** Processing line: ~ player: [30, 7],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def render_walls~ +** Processing line: ~ state.walls.each do |w|~ +** Processing line: ~ w.sprites = [~ +** Processing line: ~ [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180],~ +** Processing line: ~ [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ outputs.sprites << state.walls.map(&:sprites)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_celestial_bodies_diagram args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/planets.png',~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ player: [30, 3],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],~ +** Processing line: ~ def render_dragon~ +** Processing line: ~ state.show_death = true if state.countdown == 3.seconds~ ** Processing line: ~~ -** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ -** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ -** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ -** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ -** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ -** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ -** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ -** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ -** Processing line: ~ # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],~ -** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ render_debug_hitbox false~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_distance_discovered args~ -** Processing line: ~ {~ -** Processing line: ~ background: 'sprites/planets.png',~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [13, 0, 44, 3, :speed_of_light_end_of_day]~ -** Processing line: ~ ],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ -** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ -** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ -** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ -** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ -** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ -** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ -** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ -** Processing line: ~ [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],~ -** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ if state.show_death == false || !state.death_at~ +** Processing line: ~ animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at~ +** Processing line: ~ sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png"~ +** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ else~ +** Processing line: ~ sprite_name = "sprites/dragon_die.png"~ +** Processing line: ~ state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2]~ +** Processing line: ~ sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds~ +** Processing line: ~ state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1~ +** Processing line: ~ state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction~ +** Processing line: ~ state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def speed_of_light_end_of_day args~ -** Processing line: ~ {~ -** Processing line: ~ fade: 60,~ -** Processing line: ~ background: 'sprites/inside-home.png',~ -** Processing line: ~ player: [35, 0],~ -** Processing line: ~ storylines: [~ -** Processing line: ~ [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]~ -** Processing line: ~ ],~ -** Processing line: ~ scenes: [~ -** Processing line: ~ [31, 38, 10, 12, :serenity_alive_side_of_home]~ -** Processing line: ~ ]~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ outputs.sprites << state.dragon_sprite~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ def render_debug_hitbox show~ +** Processing line: ~ return unless show~ +** Processing line: ~ outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite~ +** Processing line: ~ outputs.borders << state.walls.flat_map do |w|~ +** Processing line: ~ w.sprites.map { |s| [s.rect, 255, 0, 0] }~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def render_flash~ +** Processing line: ~ return unless state.flash_at~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/clepto_frog/app/main.rb~ -- H1 detected. -- Formatting line: ~99_genre_platformer/clepto_frog/app/main.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ outputs.primitives << [grid.rect,~ +** Processing line: ~ white,~ +** Processing line: ~ 255 * state.flash_at.ease(20, :flip)].solid~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ +** Processing line: ~ state.flash_at = 0 if state.flash_at.elapsed_time > 20~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ require 'app/map.rb'~ +** Processing line: ~ def calc~ +** Processing line: ~ return unless state.scene == :game~ +** Processing line: ~ reset_game if state.countdown == 1~ +** Processing line: ~ state.countdown -= 1 and return if state.countdown > 0~ +** Processing line: ~ calc_walls~ +** Processing line: ~ calc_flap~ +** Processing line: ~ calc_game_over~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ class CleptoFrog~ -** Processing line: ~ attr_gtk~ +** Processing line: ~ def calc_walls~ +** Processing line: ~ state.walls.each { |w| w.x -= 8 }~ ** Processing line: ~~ -** Processing line: ~ def render_ending~ -** Processing line: ~ state.game_over_at ||= state.tick_count~ +** Processing line: ~ walls_count_before_removal = state.walls.length~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +** Processing line: ~ state.walls.reject! { |w| w.x < -100 }~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ -** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ -** Processing line: ~ end~ +** Processing line: ~ state.score += 1 if state.walls.count < walls_count_before_removal~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ -** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ -** Processing line: ~ end~ +** Processing line: ~ state.wall_countdown -= 1 and return if state.wall_countdown > 0~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ -** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ +** Processing line: ~ state.walls << state.new_entity(:wall) do |w|~ +** Processing line: ~ w.x = grid.right~ +** Processing line: ~ w.opening = grid.top~ +** Processing line: ~ .randomize(:ratio)~ +** Processing line: ~ .greater(200)~ +** Processing line: ~ .lesser(520)~ +** Processing line: ~ w.bottom_height = w.opening - state.wall_gap_size~ +** Processing line: ~ w.top_y = w.opening + state.wall_gap_size~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ -** Processing line: ~ "sprites/square-green.png"]~ -** Processing line: ~~ -** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ -** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ -** Processing line: ~~ -** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ -** Processing line: ~ restart_game~ -** Processing line: ~ end~ +** Processing line: ~ state.wall_countdown = state.wall_countdown_length~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def restart_game~ -** Processing line: ~ state.world = nil~ -** Processing line: ~ state.x = nil~ -** Processing line: ~ state.y = nil~ -** Processing line: ~ state.dx = nil~ -** Processing line: ~ state.dy = nil~ -** Processing line: ~ state.stuff_score = 0~ -** Processing line: ~ state.stuff_time = 0~ -** Processing line: ~ state.intro_tick_count = nil~ -** Processing line: ~ defaults~ -** Processing line: ~ state.game_start_at = state.tick_count~ -** Processing line: ~ state.scene = :game~ -** Processing line: ~ state.game_over_at = nil~ +** Processing line: ~ def calc_flap~ +** Processing line: ~ state.y += state.dy~ +** Processing line: ~ state.dy = state.dy.lesser state.flap_power~ +** Processing line: ~ state.dy -= state.gravity~ +** Processing line: ~ return if state.y < state.ceiling~ +** Processing line: ~ state.y = state.ceiling~ +** Processing line: ~ state.dy = state.dy.lesser state.ceiling_flap_power~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_intro~ -** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ -** Processing line: ~ if state.tick_count >= 120~ -** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ -** Processing line: ~ end~ +** Processing line: ~ def calc_game_over~ +** Processing line: ~ return unless game_over?~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 240~ -** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ -** Processing line: ~ end~ +** Processing line: ~ state.death_at = state.tick_count~ +** Processing line: ~ state.death_from = state.walls.first~ +** Processing line: ~ state.death_fall_direction = -1~ +** Processing line: ~ state.death_fall_direction = 1 if state.x > state.death_from.x~ +** Processing line: ~ outputs.sounds << "sounds/hit-sound.wav"~ +** Processing line: ~ begin_countdown~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 360~ -** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ -** Processing line: ~ end~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ process_inputs_menu~ +** Processing line: ~ process_inputs_game~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 480~ -** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ +** Processing line: ~ def process_inputs_menu~ +** Processing line: ~ return unless state.scene == :menu~ +** Processing line: ~~ +** Processing line: ~ changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select~ +** Processing line: ~ if inputs.mouse.click~ +** Processing line: ~ p = inputs.mouse.click.point~ +** Processing line: ~ if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800)~ +** Processing line: ~ changediff = true~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count >= 600~ -** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ -** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ +** Processing line: ~ if changediff~ +** Processing line: ~ case state.new_difficulty~ +** Processing line: ~ when :easy~ +** Processing line: ~ state.new_difficulty = :normal~ +** Processing line: ~ when :normal~ +** Processing line: ~ state.new_difficulty = :hard~ +** Processing line: ~ when :hard~ +** Processing line: ~ state.new_difficulty = :flappy~ +** Processing line: ~ when :flappy~ +** Processing line: ~ state.new_difficulty = :easy~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ -** Processing line: ~ "sprites/square-green.png"]~ +** Processing line: ~ if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a~ +** Processing line: ~ state.difficulty = state.new_difficulty~ +** Processing line: ~ change_to_scene :game~ +** Processing line: ~ reset_game false~ +** Processing line: ~ state.hi_score = 0~ +** Processing line: ~ begin_countdown~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count == 800~ -** Processing line: ~ state.scene = :game~ -** Processing line: ~ state.game_start_at = state.tick_count~ +** Processing line: ~ if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b~ +** Processing line: ~ state.new_difficulty = state.difficulty~ +** Processing line: ~ change_to_scene :game~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ -** Processing line: ~ render_intro~ -** Processing line: ~ elsif state.scene == :ending~ -** Processing line: ~ render_ending~ -** Processing line: ~ else~ -** Processing line: ~ render~ +** Processing line: ~ def process_inputs_game~ +** Processing line: ~ return unless state.scene == :game~ +** Processing line: ~~ +** Processing line: ~ clicked_menu = false~ +** Processing line: ~ if inputs.mouse.click~ +** Processing line: ~ p = inputs.mouse.click.point~ +** Processing line: ~ clicked_menu = (p.y >= 620) && (p.x < 275)~ ** Processing line: ~ end~ -** Processing line: ~ calc~ -** Processing line: ~ process_inputs~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ state.scene ||= :intro~ -** Processing line: ~ state.stuff_score ||= 0~ -** Processing line: ~ state.stuff_time ||= 0~ -** Processing line: ~ state.stuff_best_time ||= nil~ -** Processing line: ~ state.camera_x ||= 0~ -** Processing line: ~ state.camera_y ||= 0~ -** Processing line: ~ state.target_camera_scale ||= 1~ -** Processing line: ~ state.camera_scale ||= 1~ -** Processing line: ~ state.tongue_length ||= 100~ -** Processing line: ~ state.dev_action ||= :collision_mode~ -** Processing line: ~ state.action ||= :aiming~ -** Processing line: ~ state.tongue_angle ||= 90~ -** Processing line: ~ state.tile_size = 64~ -** Processing line: ~ state.gravity = -0.1~ -** Processing line: ~ state.air = -0.01~ -** Processing line: ~ state.player_width = 60~ -** Processing line: ~ state.player_height = 60~ -** Processing line: ~ state.collision_tolerance = 0.0~ -** Processing line: ~ state.previous_tile_size ||= state.tile_size~ -** Processing line: ~ state.x ||= 2400~ -** Processing line: ~ state.y ||= 200~ -** Processing line: ~ state.dy ||= 0~ -** Processing line: ~ state.dx ||= 0~ -** Processing line: ~ attempt_load_world_from_file~ -** Processing line: ~ state.world_lookup ||= { }~ -** Processing line: ~ state.world_collision_rects ||= []~ -** Processing line: ~ state.mode ||= :creating~ -** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ -** Processing line: ~ state.sprite_quantity ||= 20~ -** Processing line: ~ state.sprite_coords ||= []~ -** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ -** Processing line: ~ state.sprite_selected ||= 1~ -** Processing line: ~ state.map_saved_at ||= 0~ -** Processing line: ~ state.intro_tick_count ||= state.tick_count~ -** Processing line: ~ if state.sprite_coords == []~ -** Processing line: ~ count = 1~ -** Processing line: ~ temp_x = 165~ -** Processing line: ~ temp_y = 500 + 720~ -** Processing line: ~ state.sprite_quantity.times do~ -** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]]~ -** Processing line: ~ temp_x += 100~ -** Processing line: ~ count += 1~ -** Processing line: ~ if temp_x > 1280 - (165 + 50)~ -** Processing line: ~ temp_x = 165~ -** Processing line: ~ temp_y -= 75~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start~ +** Processing line: ~ change_to_scene :menu~ +** Processing line: ~ elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ state.dy += state.flap_power~ +** Processing line: ~ state.flapped_at = state.tick_count~ +** Processing line: ~ outputs.sounds << "sounds/fly-sound.wav"~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def start_of_tongue x = nil, y = nil~ -** Processing line: ~ x ||= state.x~ -** Processing line: ~ y ||= state.y~ +** Processing line: ~ def scrolling_background at, path, rate, y = 0~ ** Processing line: ~ [~ -** Processing line: ~ x + state.player_width.half,~ -** Processing line: ~ y + state.player_height.half~ +** Processing line: ~ [ 0 - at.*(rate) % 1440, y, 1440, 720, path],~ +** Processing line: ~ [1440 - at.*(rate) % 1440, y, 1440, 720, path]~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def stage_definition~ -** Processing line: ~ outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']~ +** Processing line: ~ def white~ +** Processing line: ~ [255, 255, 255]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render~ -** Processing line: ~ stage_definition~ -** Processing line: ~ start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]~ -** Processing line: ~ end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]~ +** Processing line: ~ def large_white_typeset~ +** Processing line: ~ [5, 0, 255, 255, 255]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.anchor_point~ -** Processing line: ~ anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]~ -** Processing line: ~ outputs.sprites << { x: start_of_tongue_render.x,~ -** Processing line: ~ y: start_of_tongue_render.y,~ -** Processing line: ~ w: vw(2),~ -** Processing line: ~ h: args.geometry.distance(start_of_tongue_render, anchor_point_render),~ -** Processing line: ~ path: 'sprites/square-pink.png',~ -** Processing line: ~ angle_anchor_y: 0,~ -** Processing line: ~ angle: state.tongue_angle - 90 }~ -** Processing line: ~ else~ -** Processing line: ~ outputs.sprites << { x: vx(start_of_tongue.x),~ -** Processing line: ~ y: vy(start_of_tongue.y),~ -** Processing line: ~ w: vw(2),~ -** Processing line: ~ h: vh(state.tongue_length),~ -** Processing line: ~ path: 'sprites/square-pink.png',~ -** Processing line: ~ angle_anchor_y: 0,~ -** Processing line: ~ angle: state.tongue_angle - 90 }~ -** Processing line: ~ end~ +** Processing line: ~ def at_beginning?~ +** Processing line: ~ state.walls.count == 0~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }~ +** Processing line: ~ def dragon_collision_box~ +** Processing line: ~ state.dragon_sprite~ +** Processing line: ~ .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5)~ +** Processing line: ~ .rect_shift_right(10)~ +** Processing line: ~ .rect_shift_up(state.dy * 2)~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.god_mode~ -** Processing line: ~ # SHOW HIDE COLLISIONS~ -** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ -** Processing line: ~ x = vx(x)~ -** Processing line: ~ y = vy(y)~ -** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ -** Processing line: ~ {~ -** Processing line: ~ x: x,~ -** Processing line: ~ y: y,~ -** Processing line: ~ w: vw(w || state.tile_size),~ -** Processing line: ~ h: vh(h || state.tile_size),~ -** Processing line: ~ path: 'sprites/square-gray.png',~ -** Processing line: ~ a: 128~ -** Processing line: ~ }~ +** Processing line: ~ def game_over?~ +** Processing line: ~ return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning?~ +** Processing line: ~~ +** Processing line: ~ state.walls~ +** Processing line: ~ .flat_map { |w| w.sprites }~ +** Processing line: ~ .any? do |s|~ +** Processing line: ~ s.intersect_rect?(dragon_collision_box)~ ** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ render_player~ -** Processing line: ~ outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]~ +** Processing line: ~ def collision_forgiveness~ +** Processing line: ~ case state.difficulty~ +** Processing line: ~ when :easy~ +** Processing line: ~ 0.9~ +** Processing line: ~ when :normal~ +** Processing line: ~ 0.7~ +** Processing line: ~ when :hard~ +** Processing line: ~ 0.5~ +** Processing line: ~ when :flappy~ +** Processing line: ~ 0.3~ +** Processing line: ~ else~ +** Processing line: ~ 0.9~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Label in top left of the screen~ -** Processing line: ~ outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid~ -** Processing line: ~ outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label~ -** Processing line: ~ outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label~ +** Processing line: ~ def countdown_text~ +** Processing line: ~ state.countdown ||= -1~ +** Processing line: ~ return "" if state.countdown == 0~ +** Processing line: ~ return "GO!" if state.countdown.idiv(60) == 0~ +** Processing line: ~ return "GAME OVER" if state.death_at~ +** Processing line: ~ return "READY?"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.god_mode~ -** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ -** Processing line: ~ outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label~ -** Processing line: ~ end~ +** Processing line: ~ def begin_countdown~ +** Processing line: ~ state.countdown = 4.seconds~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def score_text~ +** Processing line: ~ return "" unless state.countdown > 1.seconds~ +** Processing line: ~ return "" unless state.death_at~ +** Processing line: ~ return "SCORE: 0 (LOL)" if state.score == 0~ +** Processing line: ~ return "HI SCORE: #{state.score}" if state.score == state.hi_score~ +** Processing line: ~ return "SCORE: #{state.score}"~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ -** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ -** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ -** Processing line: ~ end~ +** Processing line: ~ def reset_game set_flash = true~ +** Processing line: ~ state.flash_at = state.tick_count if set_flash~ +** Processing line: ~ state.walls = []~ +** Processing line: ~ state.y = 500~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ state.hi_score = state.hi_score.greater(state.score)~ +** Processing line: ~ state.score = 0~ +** Processing line: ~ state.wall_countdown = state.wall_countdown_length.fdiv(2)~ +** Processing line: ~ state.show_death = false~ +** Processing line: ~ state.death_at = nil~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ render_mini_map~ -** Processing line: ~ outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid~ +** Processing line: ~ def change_to_scene scene~ +** Processing line: ~ state.scene = scene~ +** Processing line: ~ state.scene_at = state.tick_count~ +** Processing line: ~ inputs.keyboard.clear~ +** Processing line: ~ inputs.controller_one.clear~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_mini_map~ -** Processing line: ~ x, y = 1170, 10~ -** Processing line: ~ outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid~ -** Processing line: ~ outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid~ -** Processing line: ~ t_start = start_of_tongue~ -** Processing line: ~ t_end = end_of_tongue~ -** Processing line: ~ outputs.primitives << [~ -** Processing line: ~ x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),~ -** Processing line: ~ x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),~ -** Processing line: ~ 255, 255, 255~ -** Processing line: ~ ].line~ +** Processing line: ~ $flappy_dragon = FlappyDragon.new~ ** Processing line: ~~ -** Processing line: ~ state.objects.each do |o|~ -** Processing line: ~ outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ $flappy_dragon.grid = args.grid~ +** Processing line: ~ $flappy_dragon.inputs = args.inputs~ +** Processing line: ~ $flappy_dragon.state = args.state~ +** Processing line: ~ $flappy_dragon.outputs = args.outputs~ +** Processing line: ~ $flappy_dragon.tick~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_camera percentage_override = nil~ -** Processing line: ~ percentage = percentage_override || (0.2 * state.camera_scale)~ -** Processing line: ~ target_scale = state.target_camera_scale~ -** Processing line: ~ distance_scale = target_scale - state.camera_scale~ -** Processing line: ~ state.camera_scale += distance_scale * percentage~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ target_x = state.x * state.target_camera_scale~ -** Processing line: ~ target_y = state.y * state.target_camera_scale~ ** Processing line: ~~ -** Processing line: ~ distance_x = target_x - (state.camera_x + 640)~ -** Processing line: ~ distance_y = target_y - (state.camera_y + 360)~ -** Processing line: ~ state.camera_x += distance_x * percentage if distance_x.abs > 1~ -** Processing line: ~ state.camera_y += distance_y * percentage if distance_y.abs > 1~ -** Processing line: ~ state.camera_x = 0 if state.camera_x < 0~ -** Processing line: ~ state.camera_y = 0 if state.camera_y < 0~ -** Processing line: ~ end~ +** Processing line: ~* Arcade - Pong - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Arcade - Pong - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def vx x~ -** Processing line: ~ (x * state.camera_scale) - state.camera_x~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_arcade/pong/app/main.rb~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ +** Processing line: ~ input args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.state.ball.debounce ||= 3 * 60~ +** Processing line: ~ args.state.ball.size ||= 10~ +** Processing line: ~ args.state.ball.size_half ||= args.state.ball.size / 2~ +** Processing line: ~ args.state.ball.x ||= 640~ +** Processing line: ~ args.state.ball.y ||= 360~ +** Processing line: ~ args.state.ball.dx ||= 5.randomize(:sign)~ +** Processing line: ~ args.state.ball.dy ||= 5.randomize(:sign)~ +** Processing line: ~ args.state.left_paddle.y ||= 360~ +** Processing line: ~ args.state.right_paddle.y ||= 360~ +** Processing line: ~ args.state.paddle.h ||= 120~ +** Processing line: ~ args.state.paddle.w ||= 10~ +** Processing line: ~ args.state.left_paddle.score ||= 0~ +** Processing line: ~ args.state.right_paddle.score ||= 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render args~ +** Processing line: ~ render_center_line args~ +** Processing line: ~ render_scores args~ +** Processing line: ~ render_countdown args~ +** Processing line: ~ render_ball args~ +** Processing line: ~ render_paddles args~ +** Processing line: ~ render_instructions args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin :render_methods~ +** Processing line: ~ def render_center_line args~ +** Processing line: ~ args.outputs.lines << [640, 0, 640, 720]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def vy y~ -** Processing line: ~ (y * state.camera_scale) - state.camera_y~ +** Processing line: ~ def render_scores args~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ [320, 650, args.state.left_paddle.score, 10, 1],~ +** Processing line: ~ [960, 650, args.state.right_paddle.score, 10, 1]~ +** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def vw w~ -** Processing line: ~ w * state.camera_scale~ +** Processing line: ~ def render_countdown args~ +** Processing line: ~ return unless args.state.ball.debounce > 0~ +** Processing line: ~ args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def vh h~ -** Processing line: ~ h * state.camera_scale~ +** Processing line: ~ def render_ball args~ +** Processing line: ~ args.outputs.solids << solid_ball(args)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_camera~ -** Processing line: ~ calc_world_lookup~ -** Processing line: ~ calc_player~ -** Processing line: ~ calc_on_floor~ -** Processing line: ~ calc_score~ +** Processing line: ~ def render_paddles args~ +** Processing line: ~ args.outputs.solids << solid_left_paddle(args)~ +** Processing line: ~ args.outputs.solids << solid_right_paddle(args)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def set_camera_scale v = nil~ -** Processing line: ~ return if v < 0.1~ -** Processing line: ~ state.target_camera_scale = v~ +** Processing line: ~ def render_instructions args~ +** Processing line: ~ args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1]~ +** Processing line: ~ args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1]~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs_god_mode~ -** Processing line: ~ return unless state.god_mode~ +** Processing line: ~ def calc args~ +** Processing line: ~ args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0~ +** Processing line: ~ calc_move_ball args~ +** Processing line: ~ calc_collision_with_left_paddle args~ +** Processing line: ~ calc_collision_with_right_paddle args~ +** Processing line: ~ calc_collision_with_walls args~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))~ -** Processing line: ~ set_camera_scale state.camera_scale + 0.1~ -** Processing line: ~ elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))~ -** Processing line: ~ set_camera_scale state.camera_scale - 0.1~ -** Processing line: ~ elsif inputs.keyboard.eight || inputs.keyboard.zero~ -** Processing line: ~ set_camera_scale 1~ -** Processing line: ~ end~ +** Processing line: ~ begin :calc_methods~ +** Processing line: ~ def calc_move_ball args~ +** Processing line: ~ args.state.ball.x += args.state.ball.dx~ +** Processing line: ~ args.state.ball.y += args.state.ball.dy~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if input_up?~ -** Processing line: ~ state.y += 10~ -** Processing line: ~ state.dy = 0~ -** Processing line: ~ elsif input_down?~ -** Processing line: ~ state.y -= 10~ -** Processing line: ~ state.dy = 0~ +** Processing line: ~ def calc_collision_with_left_paddle args~ +** Processing line: ~ if solid_left_paddle(args).intersect_rect? solid_ball(args)~ +** Processing line: ~ args.state.ball.dx *= -1~ +** Processing line: ~ elsif args.state.ball.x < 0~ +** Processing line: ~ args.state.right_paddle.score += 1~ +** Processing line: ~ calc_reset_round args~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if input_left?~ -** Processing line: ~ state.x -= 10~ -** Processing line: ~ state.dx = 0~ -** Processing line: ~ elsif input_right?~ -** Processing line: ~ state.x += 10~ -** Processing line: ~ state.dx = 0~ +** Processing line: ~ def calc_collision_with_right_paddle args~ +** Processing line: ~ if solid_right_paddle(args).intersect_rect? solid_ball(args)~ +** Processing line: ~ args.state.ball.dx *= -1~ +** Processing line: ~ elsif args.state.ball.x > 1280~ +** Processing line: ~ args.state.left_paddle.score += 1~ +** Processing line: ~ calc_reset_round args~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ if state.scene == :game~ -** Processing line: ~ process_inputs_player_movement~ -** Processing line: ~ process_inputs_god_mode~ -** Processing line: ~ elsif state.scene == :intro~ -** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ -** Processing line: ~ if Kernel.tick_count < 600~ -** Processing line: ~ Kernel.tick_count = 600~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def calc_collision_with_walls args~ +** Processing line: ~ if args.state.ball.y + args.state.ball.size_half > 720~ +** Processing line: ~ args.state.ball.y = 720 - args.state.ball.size_half~ +** Processing line: ~ args.state.ball.dy *= -1~ +** Processing line: ~ elsif args.state.ball.y - args.state.ball.size_half < 0~ +** Processing line: ~ args.state.ball.y = args.state.ball.size_half~ +** Processing line: ~ args.state.ball.dy *= -1~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_up?~ -** Processing line: ~ inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k~ +** Processing line: ~ def calc_reset_round args~ +** Processing line: ~ args.state.ball.x = 640~ +** Processing line: ~ args.state.ball.y = 360~ +** Processing line: ~ args.state.ball.dx = 5.randomize(:sign)~ +** Processing line: ~ args.state.ball.dy = 5.randomize(:sign)~ +** Processing line: ~ args.state.ball.debounce = 3 * 60~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_up_released?~ -** Processing line: ~ inputs.keyboard.key_up.w ||~ -** Processing line: ~ inputs.keyboard.key_up.up ||~ -** Processing line: ~ inputs.keyboard.key_up.k~ +** Processing line: ~ def input args~ +** Processing line: ~ input_left_paddle args~ +** Processing line: ~ input_right_paddle args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ begin :input_methods~ +** Processing line: ~ def input_left_paddle args~ +** Processing line: ~ if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s~ +** Processing line: ~ args.state.left_paddle.y -= 40~ +** Processing line: ~ elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w~ +** Processing line: ~ args.state.left_paddle.y += 40~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_down?~ -** Processing line: ~ inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j~ +** Processing line: ~ def input_right_paddle args~ +** Processing line: ~ if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l~ +** Processing line: ~ args.state.right_paddle.y -= 40~ +** Processing line: ~ elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o~ +** Processing line: ~ args.state.right_paddle.y += 40~ +** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_down_released?~ -** Processing line: ~ inputs.keyboard.key_up.s ||~ -** Processing line: ~ inputs.keyboard.key_up.down ||~ -** Processing line: ~ inputs.keyboard.key_up.j~ +** Processing line: ~ begin :assets~ +** Processing line: ~ def solid_ball args~ +** Processing line: ~ centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_left?~ -** Processing line: ~ inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h~ +** Processing line: ~ def solid_left_paddle args~ +** Processing line: ~ centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_right?~ -** Processing line: ~ inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l~ +** Processing line: ~ def solid_right_paddle args~ +** Processing line: ~ centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def set_object path, w, h~ -** Processing line: ~ state.object = path~ -** Processing line: ~ state.object_w = w~ -** Processing line: ~ state.object_h = h~ +** Processing line: ~ def centered_rect x, y, w, h~ +** Processing line: ~ [x - w / 2, y - h / 2, w, h]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def collision_mode~ -** Processing line: ~ state.dev_action = :collision_mode~ +** Processing line: ~ def centered_rect_vertically x, y, w, h~ +** Processing line: ~ [x, y - h / 2, w, h]~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs_player_movement~ -** Processing line: ~ if inputs.keyboard.key_down.g~ -** Processing line: ~ state.god_mode = !state.god_mode~ -** Processing line: ~ puts state.god_mode~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.u && state.dev_action == :collision_mode~ -** Processing line: ~ state.world = state.world[0..-2]~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.space && !state.anchor_point~ -** Processing line: ~ state.tongue_length = 0~ -** Processing line: ~ state.action = :shooting~ -** Processing line: ~ outputs.sounds << 'sounds/shooting.wav'~ -** Processing line: ~ elsif inputs.keyboard.key_down.space~ -** Processing line: ~ state.action = :aiming~ -** Processing line: ~ state.anchor_point = nil~ -** Processing line: ~ state.tongue_length = 100~ -** Processing line: ~ end~ +** Processing line: ~* Arcade - Snakemoji - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Arcade - Snakemoji - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if state.anchor_point~ -** Processing line: ~ if input_up?~ -** Processing line: ~ if state.tongue_length >= 105~ -** Processing line: ~ state.tongue_length -= 5~ -** Processing line: ~ state.dy += 0.8~ -** Processing line: ~ end~ -** Processing line: ~ elsif input_down?~ -** Processing line: ~ state.tongue_length += 5~ -** Processing line: ~ state.dy -= 0.8~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_arcade/snakemoji/app/main.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ ################################~ +** Processing line: ~ # So I was working on a snake game while~ +** Processing line: ~ # learning DragonRuby, and at some point I had a thought~ +** Processing line: ~ # what if I use "😀" as a function name, surely it wont work right...?~ +** Processing line: ~ # RIGHT....?~ +** Processing line: ~ # BUT IT DID, IT WORKED~ +** Processing line: ~ # it all went downhill from then~ +** Processing line: ~ # Created by Anton K. (ai Doge)~ +** Processing line: ~ # https://gist.github.com/scorp200~ +** Processing line: ~ #############LICENSE############~ +** Processing line: ~ # Feel free to use this anywhere and however you want~ +** Processing line: ~ # You can sell this to EA for $1,000,000 if you want, its completely free.~ +** Processing line: ~ # Just rememeber you are helping this... thing... to spread...~ +** Processing line: ~ # ALSO! I am not liable for any mental, physical or financial damage caused.~ +** Processing line: ~ #############LICENSE############~ ** Processing line: ~~ -** Processing line: ~ if input_left? && state.dx > 1~ -** Processing line: ~ state.dx *= 0.98~ -** Processing line: ~ elsif input_left? && state.dx < -1~ -** Processing line: ~ state.dx *= 1.03~ -** Processing line: ~ elsif input_left? && !state.on_floor~ -** Processing line: ~ state.dx -= 3~ -** Processing line: ~ elsif input_right? && state.dx > 1~ -** Processing line: ~ state.dx *= 1.03~ -** Processing line: ~ elsif input_right? && state.dx < -1~ -** Processing line: ~ state.dx *= 0.98~ -** Processing line: ~ elsif input_right? && !state.on_floor~ -** Processing line: ~ state.dx += 3~ -** Processing line: ~ end~ -** Processing line: ~ else~ -** Processing line: ~ if input_left?~ -** Processing line: ~ state.tongue_angle += 1.5~ -** Processing line: ~ state.tongue_angle = state.tongue_angle~ -** Processing line: ~ elsif input_right?~ -** Processing line: ~ state.tongue_angle -= 1.5~ -** Processing line: ~ state.tongue_angle = state.tongue_angle~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ class Array~ +** Processing line: ~ #Helper function~ +** Processing line: ~ def move! vector~ +** Processing line: ~ self.x += vector.x~ +** Processing line: ~ self.y += vector.y~ +** Processing line: ~ return self~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def add_floors~ -** Processing line: ~ # floors~ -** Processing line: ~ state.world += [~ -** Processing line: ~ [0, 0, 10000, 40],~ -** Processing line: ~ [0, 1670, 3250, 60],~ -** Processing line: ~ [6691, 1653, 3290, 60],~ -** Processing line: ~ [1521, 3792, 7370, 60],~ -** Processing line: ~ [0, 5137, 3290, 60]~ -** Processing line: ~ ]~ +** Processing line: ~ #Helper function to draw snake body~ +** Processing line: ~ def draw! 🎮, 📺, color~ +** Processing line: ~ translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def attempt_load_world_from_file~ -** Processing line: ~ return if state.world~ -** Processing line: ~ # exported_world = gtk.read_file(MAP_FILE_PATH)~ -** Processing line: ~ state.world = []~ -** Processing line: ~ state.objects = []~ +** Processing line: ~ #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is **~ +** Processing line: ~ #I kept trying different combinations of symbols, when suddenly...~ +** Processing line: ~ def 😀 value~ +** Processing line: ~ self.map {|d| d * value}~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if $collisions~ -** Processing line: ~ $collisions.map do |x, y, w, h|~ -** Processing line: ~ state.world << [x, y, w, h]~ -** Processing line: ~ end~ +** Processing line: ~ #Draw stuff with an offset~ +** Processing line: ~ def translate output_collection, ⛓, what~ +** Processing line: ~ what.x += ⛓.x~ +** Processing line: ~ what.y += ⛓.y~ +** Processing line: ~ output_collection << what~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ add_floors~ -** Processing line: ~ # elsif exported_world~ -** Processing line: ~ # exported_world.each_line.map do |l|~ -** Processing line: ~ # tokens = l.strip.split(',')~ -** Processing line: ~ # x = tokens[0].to_i~ -** Processing line: ~ # y = tokens[1].to_i~ -** Processing line: ~ # type = tokens[2].to_i~ -** Processing line: ~ # if type == 1~ -** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ -** Processing line: ~ # elsif type == 2~ -** Processing line: ~ # w, h, path = tokens[3..-1]~ -** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ -** Processing line: ~ # end~ -** Processing line: ~ # end~ +** Processing line: ~ BLUE = [33, 150, 243]~ +** Processing line: ~ RED = [244, 67, 54]~ +** Processing line: ~ GOLD = [255, 193, 7]~ +** Processing line: ~ LAST = 0~ ** Processing line: ~~ -** Processing line: ~ # add_floors~ -** Processing line: ~ end~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args.state~ +** Processing line: ~ render args.state, args.outputs~ +** Processing line: ~ input args.state, args.inputs~ +** Processing line: ~ update args.state~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if $mugs~ -** Processing line: ~ $mugs.map do |x, y, w, h, path|~ -** Processing line: ~ state.objects << [x, y, w, h, path]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def update 🎮~ +** Processing line: ~ #Update every 10 frames~ +** Processing line: ~ if 🎮.tick_count.mod_zero? 10~ +** Processing line: ~ #Add new snake body piece at head's location~ +** Processing line: ~ 🎮.🐍 << [*🎮.🤖]~ +** Processing line: ~ #Assign Next Direction to Direction~ +** Processing line: ~ 🎮.🚗 = *🎮.🚦~ ** Processing line: ~~ -** Processing line: ~ def calc_world_lookup~ -** Processing line: ~ if state.tile_size != state.previous_tile_size~ -** Processing line: ~ state.previous_tile_size = state.tile_size~ -** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ #Trim the snake a bit if its longer than current size~ +** Processing line: ~ if 🎮.🐍.length > 🎮.🛒~ +** Processing line: ~ 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return if state.world_lookup.keys.length > 0~ -** Processing line: ~ return unless state.world.length > 0~ +** Processing line: ~ #Move the head in the Direction~ +** Processing line: ~ 🎮.🤖.move! 🎮.🚗~ ** Processing line: ~~ -** Processing line: ~ # Searches through the world and finds the cordinates that exist~ -** Processing line: ~ state.world_lookup = {}~ -** Processing line: ~ state.world.each do |x, y, w, h|~ -** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ +** Processing line: ~ #If Head is outside the playing field, or inside snake's body restart game~ +** Processing line: ~ if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖}~ +** Processing line: ~ LAST = 🎮.💰~ +** Processing line: ~ 🎮.as_hash.clear~ +** Processing line: ~ return~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Assigns collision rects for every sprite drawn~ -** Processing line: ~ state.world_collision_rects =~ -** Processing line: ~ state.world_lookup~ -** Processing line: ~ .keys~ -** Processing line: ~ .map do |x, y, w, h|~ -** Processing line: ~ s = state.tile_size~ -** Processing line: ~ w ||= s~ -** Processing line: ~ h ||= s~ -** Processing line: ~ {~ -** Processing line: ~ args: [x, y, w, h],~ -** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ -** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ -** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ -** Processing line: ~ }~ -** Processing line: ~ end~ -** Processing line: ~~ +** Processing line: ~ #If head lands on food add size and score~ +** Processing line: ~ if 🎮.🤖 == 🎮.🍎~ +** Processing line: ~ 🎮.🛒 += 1~ +** Processing line: ~ 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5~ +** Processing line: ~ spawn_🍎 🎮~ +** Processing line: ~ puts 🎮.🍎~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_pendulum~ -** Processing line: ~ return if !state.anchor_point~ -** Processing line: ~ target_x = state.anchor_point.x - start_of_tongue.x~ -** Processing line: ~ target_y = state.anchor_point.y -~ -** Processing line: ~ state.tongue_length - 5 - 20 - state.player_height~ -** Processing line: ~~ -** Processing line: ~ diff_y = state.y - target_y~ -** Processing line: ~~ -** Processing line: ~ if target_x > 0~ -** Processing line: ~ state.dx += 0.6~ -** Processing line: ~ elsif target_x < 0~ -** Processing line: ~ state.dx -= 0.6~ -** Processing line: ~ end~ +** Processing line: ~ #Every second remove 1 point~ +** Processing line: ~ if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60)~ +** Processing line: ~ 🎮.💰 -= 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if diff_y > 0~ -** Processing line: ~ state.dy -= 0.1~ -** Processing line: ~ elsif diff_y < 0~ -** Processing line: ~ state.dy += 0.1~ -** Processing line: ~ end~ +** Processing line: ~ def spawn_🍎 🎮~ +** Processing line: ~ #Food~ +** Processing line: ~ 🎮.🍎 ||= [*🎮.🤖]~ +** Processing line: ~ #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body~ +** Processing line: ~ while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do~ +** Processing line: ~ 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)]~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.dx *= 0.99~ +** Processing line: ~ def render 🎮, 📺~ +** Processing line: ~ #Paint the background black~ +** Processing line: ~ 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255]~ +** Processing line: ~ #Draw a border for the playing field~ +** Processing line: ~ translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255]~ ** Processing line: ~~ -** Processing line: ~ if state.dy.abs < 2~ -** Processing line: ~ state.dy *= 0.8~ -** Processing line: ~ else~ -** Processing line: ~ state.dy *= 0.90~ -** Processing line: ~ end~ +** Processing line: ~ #Draw the snake's body~ +** Processing line: ~ 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end~ +** Processing line: ~ #Draw the head~ +** Processing line: ~ 🎮.🤖.draw! 🎮, 📺, BLUE~ +** Processing line: ~ #Draw the food~ +** Processing line: ~ 🎮.🍎.draw! 🎮, 📺, RED~ ** Processing line: ~~ -** Processing line: ~ if state.tongue_length && state.y~ -** Processing line: ~ state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ #Draw current score~ +** Processing line: ~ translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD]~ +** Processing line: ~ #Draw your last score, if any~ +** Processing line: ~ translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0]~ +** Processing line: ~ #Draw starting message, only if Direction is 0~ +** Processing line: ~ translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_tongue_angle~ -** Processing line: ~ return unless state.anchor_point~ -** Processing line: ~ state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue~ -** Processing line: ~ state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)~ -** Processing line: ~ state.tongue_length = state.tongue_length.greater(100)~ +** Processing line: ~ def input 🎮, 🕹~ +** Processing line: ~ #Left and Right keyboard input, only change if X direction is 0~ +** Processing line: ~ if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0~ +** Processing line: ~ 🎮.🚦 = [-1, 0]~ +** Processing line: ~ elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0~ +** Processing line: ~ 🎮.🚦 = [1, 0]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def player_from_end_of_tongue~ -** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ -** Processing line: ~ derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]~ -** Processing line: ~ derived_start.x -= state.player_width.half~ -** Processing line: ~ derived_start.y -= state.player_height.half~ -** Processing line: ~ derived_start~ +** Processing line: ~ #Up and Down keyboard input, only change if Y direction is 0~ +** Processing line: ~ if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0~ +** Processing line: ~ 🎮.🚦 = [0, 1]~ +** Processing line: ~ elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0~ +** Processing line: ~ 🎮.🚦 = [0, -1]~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def end_of_tongue~ -** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ -** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ -** Processing line: ~ end~ +** Processing line: ~ def defaults 🎮~ +** Processing line: ~ #Playing field size~ +** Processing line: ~ 🎮.🗺 ||= [20, 20]~ +** Processing line: ~ #Scale for drawing, screen height / Field height~ +** Processing line: ~ 🎮.⚖️ ||= 720 / 🎮.🗺.y~ +** Processing line: ~ #Offset, offset all rendering to the center of the screen~ +** Processing line: ~ 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0]~ +** Processing line: ~ #Padding, make the snake body slightly smaller than the scale~ +** Processing line: ~ 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i~ +** Processing line: ~ #Snake Size~ +** Processing line: ~ 🎮.🛒 ||= 3~ +** Processing line: ~ #Snake head, the only part we are actually controlling~ +** Processing line: ~ 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2]~ +** Processing line: ~ #Snake body map, follows the head~ +** Processing line: ~ 🎮.🐍 ||= []~ +** Processing line: ~ #Direction the head moves to~ +** Processing line: ~ 🎮.🚗 ||= [0, 0]~ +** Processing line: ~ #Next_Direction, during input check only change this variable and then when game updates asign this to Direction~ +** Processing line: ~ 🎮.🚦 ||= [*🎮.🚗]~ +** Processing line: ~ #Your score~ +** Processing line: ~ 🎮.💰 ||= 0~ +** Processing line: ~ #Spawns Food randomly~ +** Processing line: ~ spawn_🍎(🎮) unless 🎮.🍎?~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_shooting~ -** Processing line: ~ return unless state.action == :shooting~ -** Processing line: ~ state.tongue_length += 30~ -** Processing line: ~ potential_anchor = end_of_tongue~ -** Processing line: ~ if potential_anchor.x <= 0~ -** Processing line: ~ state.anchor_point = potential_anchor~ -** Processing line: ~ state.action = :anchored~ -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ -** Processing line: ~ elsif potential_anchor.x >= 10000~ -** Processing line: ~ state.anchor_point = potential_anchor~ -** Processing line: ~ state.action = :anchored~ -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ -** Processing line: ~ elsif potential_anchor.y <= 0~ -** Processing line: ~ state.anchor_point = potential_anchor~ -** Processing line: ~ state.action = :anchored~ -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ -** Processing line: ~ elsif potential_anchor.y >= 5875~ -** Processing line: ~ state.anchor_point = potential_anchor~ -** Processing line: ~ state.action = :anchored~ -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ -** Processing line: ~ else~ -** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ -** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ -** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ -** Processing line: ~ end.first~ -** Processing line: ~ if collision~ -** Processing line: ~ state.anchor_point = potential_anchor~ -** Processing line: ~ state.action = :anchored~ -** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def calc_player~ -** Processing line: ~ calc_shooting~ -** Processing line: ~ if !state.god_mode~ -** Processing line: ~ state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ -** Processing line: ~ state.dx += state.dx * state.air~ -** Processing line: ~ end~ -** Processing line: ~ calc_pendulum~ -** Processing line: ~ calc_box_collision~ -** Processing line: ~ calc_edge_collision~ -** Processing line: ~ if !state.god_mode~ -** Processing line: ~ state.y += state.dy~ -** Processing line: ~ state.x += state.dx~ -** Processing line: ~ end~ -** Processing line: ~ calc_tongue_angle~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_box_collision~ -** Processing line: ~ return unless state.world_lookup.keys.length > 0~ -** Processing line: ~ collision_floor~ -** Processing line: ~ collision_left~ -** Processing line: ~ collision_right~ -** Processing line: ~ collision_ceiling~ -** Processing line: ~ end~ +** Processing line: ~* Arcade - Solar System - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Arcade - Solar System - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def calc_edge_collision~ -** Processing line: ~ # Ensures that player doesn't fall below the map~ -** Processing line: ~ if next_y < 0 && state.dy < 0~ -** Processing line: ~ state.y = 0~ -** Processing line: ~ state.dy = state.dy.abs * 0.8~ -** Processing line: ~ state.collision_on_y = true~ -** Processing line: ~ # Ensures player doesn't go insanely high~ -** Processing line: ~ elsif next_y > 5875 - state.tile_size && state.dy > 0~ -** Processing line: ~ state.y = 5875 - state.tile_size~ -** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ -** Processing line: ~ state.collision_on_y = true~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_arcade/solar_system/app/main.rb~ +** Processing line: ~ # Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4~ +** Processing line: ~ # Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8~ ** Processing line: ~~ -** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ -** Processing line: ~ if state.x >= 10000 - state.tile_size && state.dx > 0~ -** Processing line: ~ state.x = 10000 - state.tile_size~ -** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ -** Processing line: ~ state.collision_on_x = true~ -** Processing line: ~ elsif state.x <= 0 && state.dx < 0~ -** Processing line: ~ state.x = 0~ -** Processing line: ~ state.dx = state.dx.abs * 0.8~ -** Processing line: ~ state.collision_on_x = true~ -** Processing line: ~ end~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.state.x ||= 640~ +** Processing line: ~ args.state.y ||= 360~ +** Processing line: ~ args.state.stars ||= 100.map do~ +** Processing line: ~ [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def next_y~ -** Processing line: ~ state.y + state.dy~ +** Processing line: ~ args.state.sun ||= args.state.new_entity(:sun) do |s|~ +** Processing line: ~ s.s = 100~ +** Processing line: ~ s.path = 'sprites/sun.png'~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def next_x~ -** Processing line: ~ if state.dx < 0~ -** Processing line: ~ return (state.x + state.dx) - (state.tile_size - state.player_width)~ -** Processing line: ~ else~ -** Processing line: ~ return (state.x + state.dx) + (state.tile_size - state.player_width)~ +** Processing line: ~ args.state.planets = [~ +** Processing line: ~ [:mercury, 65, 5, 88],~ +** Processing line: ~ [:venus, 100, 10, 225],~ +** Processing line: ~ [:earth, 120, 10, 365],~ +** Processing line: ~ [:mars, 140, 8, 687],~ +** Processing line: ~ [:jupiter, 280, 30, 365 * 11.8],~ +** Processing line: ~ [:saturn, 350, 20, 365 * 29.5],~ +** Processing line: ~ [:uranus, 400, 15, 365 * 84],~ +** Processing line: ~ [:neptune, 440, 15, 365 * 164.8],~ +** Processing line: ~ [:pluto, 480, 5, 365 * 247.8],~ +** Processing line: ~ ].map do |name, distance, size, year_in_days|~ +** Processing line: ~ args.state.new_entity(name) do |p|~ +** Processing line: ~ p.path = "sprites/#{name}.png"~ +** Processing line: ~ p.distance = distance * 0.7~ +** Processing line: ~ p.s = size * 0.7~ +** Processing line: ~ p.year_in_days = year_in_days~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def collision_floor~ -** Processing line: ~ return unless state.dy <= 0~ -** Processing line: ~~ -** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size]~ -** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)~ -** Processing line: ~ floor_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ -** Processing line: ~~ -** Processing line: ~ return unless floor_collisions~ -** Processing line: ~ state.y = floor_collisions[:top].top~ -** Processing line: ~ state.dy = state.dy.abs * 0.8~ +** Processing line: ~ args.state.ship ||= args.state.new_entity(:ship) do |s|~ +** Processing line: ~ s.x = 1280 * rand~ +** Processing line: ~ s.y = 720 * rand~ +** Processing line: ~ s.angle = 0~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def collision_left~ -** Processing line: ~ return unless state.dx < 0~ -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ -** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)~ -** Processing line: ~ left_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ def to_sprite args, entity~ +** Processing line: ~ x = 0~ +** Processing line: ~ y = 0~ ** Processing line: ~~ -** Processing line: ~ return unless left_side_collisions~ -** Processing line: ~ state.x = left_side_collisions[:left_right].right~ -** Processing line: ~ state.dx = state.dy.abs * 0.8~ -** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ if entity.year_in_days~ +** Processing line: ~ day = args.state.tick_count~ +** Processing line: ~ day_in_year = day % entity.year_in_days~ +** Processing line: ~ entity.random_start_day ||= day_in_year * rand~ +** Processing line: ~ percentage_of_year = day_in_year.fdiv(entity.year_in_days)~ +** Processing line: ~ angle = 365 * percentage_of_year~ +** Processing line: ~ x = angle.vector_x(entity.distance)~ +** Processing line: ~ y = angle.vector_y(entity.distance)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def collision_right~ -** Processing line: ~ return unless state.dx > 0~ +** Processing line: ~ [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)~ -** Processing line: ~ right_side_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ def render args~ +** Processing line: ~ args.outputs.solids << [0, 0, 1280, 720]~ ** Processing line: ~~ -** Processing line: ~ return unless right_side_collisions~ -** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ -** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ -** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b|~ +** Processing line: ~ [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b]~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def collision_ceiling~ -** Processing line: ~ return unless state.dy > 0~ +** Processing line: ~ args.outputs.sprites << to_sprite(args, args.state.sun)~ +** Processing line: ~ args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p }~ +** Processing line: ~ args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ +** Processing line: ~ def calc args~ +** Processing line: ~ args.state.stars = args.state.stars.map do |x, y, speed, r, g, b|~ +** Processing line: ~ x += speed~ +** Processing line: ~ y += speed~ +** Processing line: ~ x = 0 if x > 1280~ +** Processing line: ~ y = 0 if y > 720~ +** Processing line: ~ [x, y, speed, r, g, b]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)~ -** Processing line: ~ ceil_collisions = state.world_collision_rects~ -** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ -** Processing line: ~ .first~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.outputs.sounds << 'sounds/bg.ogg'~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless ceil_collisions~ -** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ -** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ -** Processing line: ~ state.collision_on_y = true~ +** Processing line: ~ def process_inputs args~ +** Processing line: ~ if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left~ +** Processing line: ~ args.state.ship.angle += 1~ +** Processing line: ~ elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right~ +** Processing line: ~ args.state.ship.angle -= 1~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def to_coord point~ -** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ -** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ -** Processing line: ~ # later and huzzah. Grid coordinates~ -** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a~ +** Processing line: ~ args.state.ship.x += args.state.ship.angle.x_vector~ +** Processing line: ~ args.state.ship.y += args.state.ship.angle.y_vector~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def export_map~ -** Processing line: ~ export_string = state.world.map do |x, y|~ -** Processing line: ~ "#{x},#{y},1"~ -** Processing line: ~ end~ -** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ -** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ -** Processing line: ~ end~ -** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ -** Processing line: ~ state.map_saved_at = state.tick_count~ +** Processing line: ~ def tick args~ +** Processing line: ~ defaults args~ +** Processing line: ~ render args~ +** Processing line: ~ calc args~ +** Processing line: ~ process_inputs args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def r~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Crafting - Craft Game Starting Point - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Crafting - Craft Game Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_crafting/craft_game_starting_point/app/main.rb~ +** Processing line: ~ # ==================================================~ +** Processing line: ~ # A NOTE TO JAM CRAFT PARTICIPANTS:~ +** Processing line: ~ # The comments and code in here are just as small piece of DragonRuby's capabilities.~ +** Processing line: ~ # Be sure to check out the rest of the sample apps. Start with README.txt and go from there!~ +** Processing line: ~ # ==================================================~ +** Processing line: ~~ +** Processing line: ~ # def tick args is the entry point into your game. This function is called at~ +** Processing line: ~ # a fixed update time of 60hz (60 fps).~ +** Processing line: ~ def tick args~ +** Processing line: ~ # The defaults function intitializes the game.~ +** Processing line: ~ defaults args~ +** Processing line: ~~ +** Processing line: ~ # After the game is initialized, render it.~ +** Processing line: ~ render args~ +** Processing line: ~~ +** Processing line: ~ # After rendering the player should be able to respond to input.~ +** Processing line: ~ input args~ +** Processing line: ~~ +** Processing line: ~ # After responding to input, the game performs any additional calculations.~ +** Processing line: ~ calc args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults args~ +** Processing line: ~ # hide the mouse cursor for this game, we are going to render our own cursor~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.gtk.hide_cursor~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def inputs_export_stage~ +** Processing line: ~ args.state.click_ripples ||= []~ +** Processing line: ~~ +** Processing line: ~ # everything is on a 1280x720 virtual canvas, so you can~ +** Processing line: ~ # hardcode locations~ +** Processing line: ~~ +** Processing line: ~ # define the borders for where the inventory is located~ +** Processing line: ~ # args.state is a data structure that accepts any arbitrary parameters~ +** Processing line: ~ # so you can create an object graph without having to create any classes.~ +** Processing line: ~~ +** Processing line: ~ # Bottom left is 0, 0. Top right is 1280, 720.~ +** Processing line: ~ # The inventory area is at the top of the screen~ +** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ +** Processing line: ~ # used to decide the with and height~ +** Processing line: ~ args.state.sprite_size = 80~ +** Processing line: ~~ +** Processing line: ~ args.state.inventory_border.w = args.state.sprite_size * 10~ +** Processing line: ~ args.state.inventory_border.h = args.state.sprite_size * 3~ +** Processing line: ~ args.state.inventory_border.x = 10~ +** Processing line: ~ args.state.inventory_border.y = 710 - args.state.inventory_border.h~ +** Processing line: ~~ +** Processing line: ~ # define the borders for where the crafting area is located~ +** Processing line: ~ # the crafting area is below the inventory area~ +** Processing line: ~ # the number 80 is the size of all the sprites, so that is what is being~ +** Processing line: ~ # used to decide the with and height~ +** Processing line: ~ args.state.craft_border.x = 10~ +** Processing line: ~ args.state.craft_border.y = 220~ +** Processing line: ~ args.state.craft_border.w = args.state.sprite_size * 3~ +** Processing line: ~ args.state.craft_border.h = args.state.sprite_size * 3~ +** Processing line: ~~ +** Processing line: ~ # define the area where results are located~ +** Processing line: ~ # the crafting result is to the right of the craft area~ +** Processing line: ~ args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size~ +** Processing line: ~ args.state.result_border.y = 220 + args.state.sprite_size~ +** Processing line: ~ args.state.result_border.w = args.state.sprite_size~ +** Processing line: ~ args.state.result_border.h = args.state.sprite_size~ +** Processing line: ~~ +** Processing line: ~ # initialize items for the first time if they are nil~ +** Processing line: ~ # you start with 15 wood, 1 chest, and 5 plank~ +** Processing line: ~ # Ruby has built in syntax for dictionaries (they look a lot like json objects).~ +** Processing line: ~ # Ruby also has a special type called a Symbol denoted with a : followed by a word.~ +** Processing line: ~ # Symbols are nice because they remove the need for magic strings.~ +** Processing line: ~ if !args.state.items~ +** Processing line: ~ args.state.items = [~ +** Processing line: ~ {~ +** Processing line: ~ id: :wood, # :wood is a Symbol, this is better than using "wood" for the id~ +** Processing line: ~ quantity: 15,~ +** Processing line: ~ path: 'sprites/wood.png',~ +** Processing line: ~ location: :inventory,~ +** Processing line: ~ ordinal_x: 0, ordinal_y: 0~ +** Processing line: ~ },~ +** Processing line: ~ {~ +** Processing line: ~ id: :chest,~ +** Processing line: ~ quantity: 1,~ +** Processing line: ~ path: 'sprites/chest.png',~ +** Processing line: ~ location: :inventory,~ +** Processing line: ~ ordinal_x: 1, ordinal_y: 0~ +** Processing line: ~ },~ +** Processing line: ~ {~ +** Processing line: ~ id: :plank,~ +** Processing line: ~ quantity: 5,~ +** Processing line: ~ path: 'sprites/plank.png',~ +** Processing line: ~ location: :inventory,~ +** Processing line: ~ ordinal_x: 2, ordinal_y: 0~ +** Processing line: ~ },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ +** Processing line: ~ # locations assuming that the width and height are 80~ +** Processing line: ~ args.state.items.each { |item| set_inventory_position args, item }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_score~ -** Processing line: ~ return unless state.scene == :game~ -** Processing line: ~ player = [state.x, state.y, state.player_width, state.player_height]~ -** Processing line: ~ collected = state.objects.find_all { |s| s.intersect_rect? player }~ -** Processing line: ~ state.stuff_score += collected.length~ -** Processing line: ~ if collected.length > 0~ -** Processing line: ~ outputs.sounds << 'sounds/collectable.wav'~ -** Processing line: ~ end~ -** Processing line: ~ state.objects = state.objects.reject { |s| collected.include? s }~ -** Processing line: ~ state.stuff_time += 0.01~ -** Processing line: ~ if state.objects.length == 0~ -** Processing line: ~ if !state.stuff_best_time || state.stuff_time < state.stuff_best_time~ -** Processing line: ~ state.stuff_best_time = state.stuff_time~ -** Processing line: ~ end~ -** Processing line: ~ state.game_over_at = nil~ -** Processing line: ~ state.scene = :ending~ -** Processing line: ~ end~ +** Processing line: ~ # define all the oridinal positions of the inventory slots~ +** Processing line: ~ if !args.state.inventory_area~ +** Processing line: ~ args.state.inventory_area = [~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 3, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 4, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 5, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 6, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 7, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 8, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 9, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 3, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 4, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 5, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 6, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 7, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 8, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 9, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 3, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 4, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 5, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 6, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 7, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 8, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 9, ordinal_y: 2 },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ +** Processing line: ~ # locations assuming that the width and height are 80~ +** Processing line: ~ args.state.inventory_area.each { |i| set_inventory_position args, i }~ +** Processing line: ~~ +** Processing line: ~ # if you want to see the result you can use the Ruby function called "puts".~ +** Processing line: ~ # Uncomment this line to see the value.~ +** Processing line: ~ # puts args.state.inventory_area~ +** Processing line: ~~ +** Processing line: ~ # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt.~ +** Processing line: ~ # To bring up DragonRuby's Console, press the ~ key within the game.~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_on_floor~ -** Processing line: ~ if state.action == :anchored~ -** Processing line: ~ state.on_floor = false~ -** Processing line: ~ state.on_floor_debounce = 30~ -** Processing line: ~ else~ -** Processing line: ~ state.on_floor_debounce ||= 30~ +** Processing line: ~ # define all the oridinal positions of the craft slots~ +** Processing line: ~ if !args.state.craft_area~ +** Processing line: ~ args.state.craft_area = [~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 0, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 1, ordinal_y: 2 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 0 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 1 },~ +** Processing line: ~ { ordinal_x: 2, ordinal_y: 2 },~ +** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ if state.dy.round != 0~ -** Processing line: ~ state.on_floor_debounce = 30~ -** Processing line: ~ state.on_floor = false~ -** Processing line: ~ else~ -** Processing line: ~ state.on_floor_debounce -= 1~ -** Processing line: ~ end~ +** Processing line: ~ # after initializing the oridinal positions, derive the pixel~ +** Processing line: ~ # locations assuming that the width and height are 80~ +** Processing line: ~ args.state.craft_area.each { |c| set_craft_position args, c }~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.on_floor_debounce <= 0~ -** Processing line: ~ state.on_floor_debounce = 0~ -** Processing line: ~ state.on_floor = true~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render args~ +** Processing line: ~ # for the results area, create a sprite that show its boundaries~ +** Processing line: ~ args.outputs.primitives << { x: args.state.result_border.x,~ +** Processing line: ~ y: args.state.result_border.y,~ +** Processing line: ~ w: args.state.result_border.w,~ +** Processing line: ~ h: args.state.result_border.h,~ +** Processing line: ~ path: 'sprites/border-black.png' }~ +** Processing line: ~~ +** Processing line: ~ # for each inventory spot, create a sprite~ +** Processing line: ~ # args.outputs.primitives is how DragonRuby performs a render.~ +** Processing line: ~ # Adding a single hash or multiple hashes to this array will tell~ +** Processing line: ~ # DragonRuby to render those primitives on that frame.~ +** Processing line: ~~ +** Processing line: ~ # The .map function on Array is used instead of any kind of looping.~ +** Processing line: ~ # .map returns a new object for every object within an Array.~ +** Processing line: ~ args.outputs.primitives << args.state.inventory_area.map do |a|~ +** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_player~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ angle = 0~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]~ -** Processing line: ~ if state.action == :idle~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ elsif state.action == :aiming && !state.on_floor~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]~ -** Processing line: ~ angle = state.tongue_angle - 90~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ elsif state.action == :aiming # ON THE GROUND~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ elsif state.action == :shooting && !state.on_floor~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ angle = state.tongue_angle - 90~ -** Processing line: ~ elsif state.action == :shooting~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ elsif state.action == :anchored~ -** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]~ -** Processing line: ~ angle = state.tongue_angle - 90~ -** Processing line: ~ path = "sprites/square-green.png"~ -** Processing line: ~ end~ +** Processing line: ~ # for each craft spot, create a sprite~ +** Processing line: ~ args.outputs.primitives << args.state.craft_area.map do |a|~ +** Processing line: ~ { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.sprites << [vx(state.x),~ -** Processing line: ~ vy(state.y),~ -** Processing line: ~ vw(state.player_width),~ -** Processing line: ~ vh(state.player_height),~ -** Processing line: ~ path,~ -** Processing line: ~ angle]~ +** Processing line: ~ # after the borders have been rendered, render the~ +** Processing line: ~ # items within those slots (and allow for highlighting)~ +** Processing line: ~ # if an item isn't currently being held~ +** Processing line: ~ allow_inventory_highlighting = !args.state.held_item~ +** Processing line: ~~ +** Processing line: ~ # go through each item and render them~ +** Processing line: ~ # use Array's find_all method to remove any items that are currently being held~ +** Processing line: ~ args.state.items.find_all { |item| item[:location] != :held }.map do |item|~ +** Processing line: ~ # if an item is currently being held, don't render it in it's spot within the~ +** Processing line: ~ # inventory or craft area (this is handled via the find_all method).~ +** Processing line: ~~ +** Processing line: ~ # the item_prefab returns a hash containing all the visual components of an item.~ +** Processing line: ~ # the main sprite, the black background, the quantity text, and a hover indication~ +** Processing line: ~ # if the mouse is currently hovering over the item.~ +** Processing line: ~ args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse)~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_player_old~ -** Processing line: ~ # Player~ -** Processing line: ~ if state.action == :aiming~ -** Processing line: ~ path = 'sprites\frg\idle\frog_idle.png'~ -** Processing line: ~ if state.dx > 2~ -** Processing line: ~ #directional right sprite was here but i needa redo it~ -** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ -** Processing line: ~ #directional left sprite was here but i needa redo it~ -** Processing line: ~ elsif state.dx < -2~ -** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ +** Processing line: ~ # The last thing we want to render is the item currently being held.~ +** Processing line: ~ args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse)~ +** Processing line: ~~ +** Processing line: ~ args.outputs.primitives << args.state.click_ripples~ +** Processing line: ~~ +** Processing line: ~ # render a mouse cursor since we have the OS cursor hidden~ +** Processing line: ~ args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Alrighty! This is where all the fun happens~ +** Processing line: ~ def input args~ +** Processing line: ~ # if the mouse is clicked and not item is currently being held~ +** Processing line: ~ # args.state.held_item is nil when the game starts.~ +** Processing line: ~ # If the player clicks, the property args.inputs.mouse.click will~ +** Processing line: ~ # be a non nil value, we don't want to process any of the code here~ +** Processing line: ~ # if the mouse hasn't been clicked~ +** Processing line: ~ return if !args.inputs.mouse.click~ +** Processing line: ~~ +** Processing line: ~ # if a click occurred, add a ripple to the ripple queue~ +** Processing line: ~ args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 }~ +** Processing line: ~~ +** Processing line: ~ # if the mouse has been clicked, and no item is currently held...~ +** Processing line: ~ if !args.state.held_item~ +** Processing line: ~ # see if any of the items intersect the pointer using the inside_rect? method~ +** Processing line: ~ # the find method will either return the first object that returns true~ +** Processing line: ~ # for the match clause, or it'll return nil if nothing matches the match clause~ +** Processing line: ~ found = args.state.items.find do |item|~ +** Processing line: ~ # for each item in args.state.items, run the following boolean check~ +** Processing line: ~ args.inputs.mouse.click.point.inside_rect?(item)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if an item intersects the mouse pointer, then set the item's location to :held and~ +** Processing line: ~ # set args.state.held_item to the item for later reference~ +** Processing line: ~ if found~ +** Processing line: ~ args.state.held_item = found~ +** Processing line: ~ found[:location] = :held~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if the mouse is clicked and an item is currently beign held....~ +** Processing line: ~ elsif args.state.held_item~ +** Processing line: ~ # determine if a slot within the craft area was clicked~ +** Processing line: ~ craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ +** Processing line: ~~ +** Processing line: ~ # also determine if a slot within the inventory area was clicked~ +** Processing line: ~ inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a }~ +** Processing line: ~~ +** Processing line: ~ # if the click was within a craft area~ +** Processing line: ~ if craft_area~ +** Processing line: ~ # check to see if an item is already there and ignore the click if an item is found~ +** Processing line: ~ # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal~ +** Processing line: ~ # position~ +** Processing line: ~ item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y]~ +** Processing line: ~~ +** Processing line: ~ # if an item *doesn't* exist in the craft area~ +** Processing line: ~ if !item_already_there~ +** Processing line: ~ # if the quantity they are currently holding is greater than 1~ +** Processing line: ~ if args.state.held_item[:quantity] > 1~ +** Processing line: ~ # remove one item (creating a seperate item of the same type), and place it~ +** Processing line: ~ # at the oridinal position and location of the craft area~ +** Processing line: ~ # the .merge method on Hash creates a new Hash, but updates any values~ +** Processing line: ~ # passed as arguments to merge~ +** Processing line: ~ new_item = args.state.held_item.merge(quantity: 1,~ +** Processing line: ~ location: :craft,~ +** Processing line: ~ ordinal_x: craft_area[:ordinal_x],~ +** Processing line: ~ ordinal_y: craft_area[:ordinal_y])~ +** Processing line: ~~ +** Processing line: ~ # after the item is crated, place it into the args.state.items collection~ +** Processing line: ~ args.state.items << new_item~ +** Processing line: ~~ +** Processing line: ~ # then subtract one from the held item~ +** Processing line: ~ args.state.held_item[:quantity] -= 1~ +** Processing line: ~~ +** Processing line: ~ # if the craft area is available and there is only one item being held~ +** Processing line: ~ elsif args.state.held_item[:quantity] == 1~ +** Processing line: ~ # instead of creating any new items just set the location of the held item~ +** Processing line: ~ # to the oridinal position of the craft area, and then nil out the~ +** Processing line: ~ # held item state so that a new item can be picked up~ +** Processing line: ~ args.state.held_item[:location] = :craft~ +** Processing line: ~ args.state.held_item[:ordinal_x] = craft_area[:ordinal_x]~ +** Processing line: ~ args.state.held_item[:ordinal_y] = craft_area[:ordinal_y]~ +** Processing line: ~ args.state.held_item = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if the selected area is an inventory area (as opposed to within the craft area)~ +** Processing line: ~ elsif inventory_area~ +** Processing line: ~~ +** Processing line: ~ # check to see if there is already an item in that inventory slot~ +** Processing line: ~ # the item_at_inventory_slot helper method returns an item or nil~ +** Processing line: ~ item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y]~ +** Processing line: ~~ +** Processing line: ~ # if there is already an item there, and the item types/id match~ +** Processing line: ~ if item_already_there && item_already_there[:id] == args.state.held_item[:id]~ +** Processing line: ~ # then merge the item quantities~ +** Processing line: ~ held_quantity = args.state.held_item[:quantity]~ +** Processing line: ~ item_already_there[:quantity] += held_quantity~ +** Processing line: ~~ +** Processing line: ~ # remove the item being held from the items collection (since it's quantity is now 0)~ +** Processing line: ~ args.state.items.reject! { |i| i[:location] == :held }~ +** Processing line: ~~ +** Processing line: ~ # nil out the held_item so a new item can be picked up~ +** Processing line: ~ args.state.held_item = nil~ +** Processing line: ~~ +** Processing line: ~ # if there currently isn't an item there, then put the held item in the slot~ +** Processing line: ~ elsif !item_already_there~ +** Processing line: ~ args.state.held_item[:location] = :inventory~ +** Processing line: ~ args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x]~ +** Processing line: ~ args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y]~ +** Processing line: ~~ +** Processing line: ~ # nil out the held_item so a new item can be picked up~ +** Processing line: ~ args.state.held_item = nil~ ** Processing line: ~ end~ -** Processing line: ~ outputs.sprites << [vx(state.x),~ -** Processing line: ~ vy(state.y),~ -** Processing line: ~ vw(state.player_width),~ -** Processing line: ~ vh(state.player_height),~ -** Processing line: ~ path,~ -** Processing line: ~ (state.tongue_angle - 90)]~ -** Processing line: ~ elsif state.action == :anchored || state.action == :shooting~ -** Processing line: ~ outputs.sprites << [vx(state.x),~ -** Processing line: ~ vy(state.y),~ -** Processing line: ~ vw(state.player_width),~ -** Processing line: ~ vw(state.player_height),~ -** Processing line: ~ 'sprites/animations_povfrog/frog_bwah_up.png',~ -** Processing line: ~ (state.tongue_angle - 90)]~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ # the calc method is executed after input~ +** Processing line: ~ def calc args~ +** Processing line: ~ # make sure that the real position of the inventory~ +** Processing line: ~ # items are updated every frame to ensure that they~ +** Processing line: ~ # are placed correctly given their location and oridinal positions~ +** Processing line: ~ # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place)~ +** Processing line: ~ args.state.items.each do |item|~ +** Processing line: ~ # based on the location of the item, invoke the correct pixel conversion method~ +** Processing line: ~ if item[:location] == :inventory~ +** Processing line: ~ set_inventory_position args, item~ +** Processing line: ~ elsif item[:location] == :craft~ +** Processing line: ~ set_craft_position args, item~ +** Processing line: ~ elsif item[:location] == :held~ +** Processing line: ~ # if the item is held, center the item around the mouse pointer~ +** Processing line: ~ args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half~ +** Processing line: ~ args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $game = CleptoFrog.new~ -** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ if args.state.scene == :game~ -** Processing line: ~ tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360~ +** Processing line: ~ # for each hash/sprite in the click ripples queue,~ +** Processing line: ~ # expand its size by 20 percent and decrease its alpha~ +** Processing line: ~ # by 10.~ +** Processing line: ~ args.state.click_ripples.each do |ripple|~ +** Processing line: ~ delta_w = ripple.w * 1.2 - ripple.w~ +** Processing line: ~ delta_h = ripple.h * 1.2 - ripple.h~ +** Processing line: ~ ripple.x -= delta_w.half~ +** Processing line: ~ ripple.y -= delta_h.half~ +** Processing line: ~ ripple.w += delta_w~ +** Processing line: ~ ripple.h += delta_h~ +** Processing line: ~ ripple.a -= 10~ ** Processing line: ~ end~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ +** Processing line: ~~ +** Processing line: ~ # remove any items from the collection where the alpha value is less than equal to~ +** Processing line: ~ # zero using the reject! method (reject with an exclamation point at the end changes the~ +** Processing line: ~ # array value in place, while reject without the exclamation point returns a new array).~ +** Processing line: ~ args.state.click_ripples.reject! { |ripple| ripple.a <= 0 }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_instructions args, text, y = 715~ -** Processing line: ~ return if args.state.key_event_occurred~ -** Processing line: ~ if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space~ -** Processing line: ~ args.state.key_event_occurred = true~ -** Processing line: ~ end~ +** Processing line: ~ # helper function for finding an item at a craft slot~ +** Processing line: ~ def item_at_craft_slot args, ordinal_x, ordinal_y~ +** Processing line: ~ args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ -** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ -** Processing line: ~ args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ # helper function for finding an item at an inventory slot~ +** Processing line: ~ def item_at_inventory_slot args, ordinal_x, ordinal_y~ +** Processing line: ~ args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ # helper function that creates a visual representation of an item~ +** Processing line: ~ def item_prefab args, item, should_highlight, mouse~ +** Processing line: ~ return nil unless item~ ** Processing line: ~~ +** Processing line: ~ overlay = nil~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/clepto_frog/app/map.rb~ -- H1 detected. -- Formatting line: ~99_genre_platformer/clepto_frog/app/map.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ x = item.x~ +** Processing line: ~ y = item.y~ +** Processing line: ~ w = item.w~ +** Processing line: ~ h = item.h~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ $collisions = [~ -** Processing line: ~ [326, 463, 64, 64],~ -** Processing line: ~ [274, 462, 64, 64],~ -** Processing line: ~ [326, 413, 64, 64],~ -** Processing line: ~ [275, 412, 64, 64],~ -** Processing line: ~ [124, 651, 64, 64],~ -** Processing line: ~ [72, 651, 64, 64],~ -** Processing line: ~ [124, 600, 64, 64],~ -** Processing line: ~ [69, 599, 64, 64],~ -** Processing line: ~ [501, 997, 64, 64],~ -** Processing line: ~ [476, 995, 64, 64],~ -** Processing line: ~ [3224, 2057, 64, 64],~ -** Processing line: ~ [3224, 1994, 64, 64],~ -** Processing line: ~ [3225, 1932, 64, 64],~ -** Processing line: ~ [3225, 1870, 64, 64],~ +** Processing line: ~ if should_highlight && mouse.point.inside_rect?(item)~ +** Processing line: ~ overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ [~ +** Processing line: ~ # sprites are hashes with a path property, this is the main sprite~ +** Processing line: ~ { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], },~ +** Processing line: ~~ +** Processing line: ~ # this represents the black area in the bottom right corner of the main sprite so that the~ +** Processing line: ~ # quantity is visible~ +** Processing line: ~ { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property~ +** Processing line: ~~ +** Processing line: ~ # labels are hashes with a text property~ +** Processing line: ~ { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, },~ +** Processing line: ~~ +** Processing line: ~ # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered)~ +** Processing line: ~ overlay~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # helper function for deriving the position of an item within inventory~ +** Processing line: ~ def set_inventory_position args, item~ +** Processing line: ~ item.x = args.state.inventory_border.x + item[:ordinal_x] * 80~ +** Processing line: ~ item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ +** Processing line: ~ item.w = 80~ +** Processing line: ~ item.h = 80~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # helper function for deriving the position of an item within the craft area~ +** Processing line: ~ def set_craft_position args, item~ +** Processing line: ~ item.x = args.state.craft_border.x + item[:ordinal_x] * 80~ +** Processing line: ~ item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80~ +** Processing line: ~ item.w = 80~ +** Processing line: ~ item.h = 80~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Any lines outside of a function will be executed when the file is reloaded.~ +** Processing line: ~ # So every time you save main.rb, the game will be reset.~ +** Processing line: ~ # Comment out the line below if you don't want this to happen.~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Dev Tools - Add Buttons To Console - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Dev Tools - Add Buttons To Console - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb~ +** Processing line: ~ # You can customize the buttons that show up in the Console.~ +** Processing line: ~ class GTK::Console::Menu~ +** Processing line: ~ # STEP 1: Override the custom_buttons function.~ +** Processing line: ~ def custom_buttons~ +** Processing line: ~ [~ +** Processing line: ~ (button id: :yay,~ +** Processing line: ~ # row for button~ +** Processing line: ~ row: 3,~ +** Processing line: ~ # column for button~ +** Processing line: ~ col: 10,~ +** Processing line: ~ # text~ +** Processing line: ~ text: "I AM CUSTOM",~ +** Processing line: ~ # when clicked call the custom_button_clicked function~ +** Processing line: ~ method: :custom_button_clicked),~ +** Processing line: ~~ +** Processing line: ~ (button id: :yay,~ +** Processing line: ~ # row for button~ +** Processing line: ~ row: 3,~ +** Processing line: ~ # column for button~ +** Processing line: ~ col: 9,~ +** Processing line: ~ # text~ +** Processing line: ~ text: "CUSTOM ALSO",~ +** Processing line: ~ # when clicked call the custom_button_also_clicked function~ +** Processing line: ~ method: :custom_button_also_clicked)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # STEP 2: Define the function that should be called.~ +** Processing line: ~ def custom_button_clicked~ +** Processing line: ~ log "* INFO: I AM CUSTOM was clicked!"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def custom_button_also_clicked~ +** Processing line: ~ log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!"~ +** Processing line: ~~ +** Processing line: ~ all_buttons_as_string = $gtk.console.menu.buttons.map do |b|~ +** Processing line: ~ <<-S.strip~ +** Processing line: ~ ** id: #{b[:id]}~ +** Processing line: ~ :PROPERTIES:~ +** Processing line: ~ :id: :#{b[:id]}~ +** Processing line: ~ :method: :#{b[:method]}~ +** Processing line: ~ :text: #{b[:text]}~ +** Processing line: ~ :END:~ +** Processing line: ~ S~ +** Processing line: ~ end.join("\n")~ +** Processing line: ~~ +** Processing line: ~ log <<-S~ +** Processing line: ~ * INFO: Here are all the buttons:~ +** Processing line: ~ #{all_buttons_as_string}~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [args.grid.center.x, args.grid.center.y,~ +** Processing line: ~ "Open the DragonRuby Console to see the custom menu items.",~ +** Processing line: ~ 0, 1]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Dev Tools - Animation Creator Starting Point - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Dev Tools - Animation Creator Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_dev_tools/animation_creator_starting_point/app/main.rb~ +** Processing line: ~ class OneBitLowrezPaint~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ outputs.background_color = [0, 0, 0]~ +** Processing line: ~ defaults~ +** Processing line: ~ render_instructions~ +** Processing line: ~ render_canvas~ +** Processing line: ~ render_buttons_frame_selection~ +** Processing line: ~ render_animation_frame_thumbnails~ +** Processing line: ~ render_animation~ +** Processing line: ~ input_mouse_click~ +** Processing line: ~ input_keyboard~ +** Processing line: ~ calc_auto_export~ +** Processing line: ~ calc_buttons_frame_selection~ +** Processing line: ~ calc_animation_frames~ +** Processing line: ~ process_queue_create_sprite~ +** Processing line: ~ process_queue_reset_sprite~ +** Processing line: ~ process_queue_update_rt_animation_frame~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.animation_frames_per_second = 12~ +** Processing line: ~ queues.create_sprite ||= []~ +** Processing line: ~ queues.reset_sprite ||= []~ +** Processing line: ~ queues.update_rt_animation_frame ||= []~ +** Processing line: ~~ +** Processing line: ~ if !state.animation_frames~ +** Processing line: ~ state.animation_frames ||= []~ +** Processing line: ~ add_animation_frame_to_end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.last_mouse_down ||= 0~ +** Processing line: ~ state.last_mouse_up ||= 0~ +** Processing line: ~~ +** Processing line: ~ state.buttons_frame_selection.left = 10~ +** Processing line: ~ state.buttons_frame_selection.top = grid.top - 10~ +** Processing line: ~ state.buttons_frame_selection.size = 20~ +** Processing line: ~~ +** Processing line: ~ defaults_canvas_sprite~ +** Processing line: ~~ +** Processing line: ~ state.edit_mode ||= :drawing~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults_canvas_sprite~ +** Processing line: ~ rt_canvas.size = 16~ +** Processing line: ~ rt_canvas.zoom = 30~ +** Processing line: ~ rt_canvas.width = rt_canvas.size * rt_canvas.zoom~ +** Processing line: ~ rt_canvas.height = rt_canvas.size * rt_canvas.zoom~ +** Processing line: ~ rt_canvas.sprite = { x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: rt_canvas.width,~ +** Processing line: ~ h: rt_canvas.height,~ +** Processing line: ~ path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720)~ +** Processing line: ~~ +** Processing line: ~ return unless state.tick_count == 1~ +** Processing line: ~~ +** Processing line: ~ outputs[:rt_canvas].width = rt_canvas.width~ +** Processing line: ~ outputs[:rt_canvas].height = rt_canvas.height~ +** Processing line: ~ outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x|~ +** Processing line: ~ (rt_canvas.size + 1).map_with_index do |y|~ +** Processing line: ~ path = 'sprites/square-white.png'~ +** Processing line: ~ path = 'sprites/square-blue.png' if x == 7 || x == 8~ +** Processing line: ~ { x: x * rt_canvas.zoom,~ +** Processing line: ~ y: y * rt_canvas.zoom,~ +** Processing line: ~ w: rt_canvas.zoom,~ +** Processing line: ~ h: rt_canvas.zoom,~ +** Processing line: ~ path: path,~ +** Processing line: ~ a: 50 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_instructions~ +** Processing line: ~ instructions = <<-S~ +** Processing line: ~ * Instructions:~ +** Processing line: ~ - All data is stored in the ~canvas~ directory.~ +** Processing line: ~ - Hold ~d~ to set the edit mode to erase.~ +** Processing line: ~ - Release ~d~ to set the edit mode drawing.~ +** Processing line: ~ - Press ~a~ to added a frame to the end.~ +** Processing line: ~ - Press ~b~ to select the previous frame.~ +** Processing line: ~ - Press ~f~ to select the next frame.~ +** Processing line: ~ - Press ~c~ to copy a frame.~ +** Processing line: ~ - Press ~v~ to paste a copied frame into the selected frame.~ +** Processing line: ~ - Press ~x~ to delete the currently selected frame.~ +** Processing line: ~ - Press ~w~ to save the canvas and export all sprites.~ +** Processing line: ~ - Press ~l~ to load the canvas.~ +** Processing line: ~ S~ +** Processing line: ~~ +** Processing line: ~ instructions.strip.each_line.with_index do |l, i|~ +** Processing line: ~ outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}",~ +** Processing line: ~ r: 180, g: 180, b: 180, size_enum: -3 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_canvas~ +** Processing line: ~ return if state.tick_count.zero?~ +** Processing line: ~ outputs.sprites << rt_canvas.sprite~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_buttons_frame_selection~ +** Processing line: ~ args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i|~ +** Processing line: ~ label = { x: b.x + state.buttons_frame_selection.size.half,~ +** Processing line: ~ y: b.y,~ +** Processing line: ~ text: "#{i + 1}", r: 180, g: 180, b: 180,~ +** Processing line: ~ size_enum: -4, alignment_enum: 1 }.label~ +** Processing line: ~~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 40, b: 40).border~ +** Processing line: ~~ +** Processing line: ~ if i == state.animation_frames_selected_index~ +** Processing line: ~ selection_border = b.merge(r: 40, g: 230, b: 200).border~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ [selection_border, label]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_animation_frame_thumbnails~ +** Processing line: ~ return if state.tick_count.zero?~ +** Processing line: ~~ +** Processing line: ~ outputs[:current_animation_frame].width = rt_canvas.size~ +** Processing line: ~ outputs[:current_animation_frame].height = rt_canvas.size~ +** Processing line: ~ outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i|~ +** Processing line: ~ { x: f.x,~ +** Processing line: ~ y: f.y,~ +** Processing line: ~ w: 1,~ +** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame)~ +** Processing line: ~~ +** Processing line: ~ state.animation_frames.map_with_index do |animation_frame, animation_frame_index|~ +** Processing line: ~ outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect]~ +** Processing line: ~ .merge(path: animation_frame[:rt_name])~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_animation~ +** Processing line: ~ sprite_index = 0.frame_index count: state.animation_frames.length,~ +** Processing line: ~ hold_for: 60 / state.animation_frames_per_second,~ +** Processing line: ~ repeat: true~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 8,~ +** Processing line: ~ y: 120,~ +** Processing line: ~ w: 16,~ +** Processing line: ~ h: 16,~ +** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 16,~ +** Processing line: ~ y: 230,~ +** Processing line: ~ w: 32,~ +** Processing line: ~ h: 32,~ +** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 32,~ +** Processing line: ~ y: 360,~ +** Processing line: ~ w: 64,~ +** Processing line: ~ h: 64,~ +** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << { x: 700 - 64,~ +** Processing line: ~ y: 520,~ +** Processing line: ~ w: 128,~ +** Processing line: ~ h: 128,~ +** Processing line: ~ path: (sprite_path sprite_index) }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_mouse_click~ +** Processing line: ~ if inputs.mouse.up~ +** Processing line: ~ state.last_mouse_up = state.tick_count~ +** Processing line: ~ elsif inputs.mouse.moved && user_is_editing?~ +** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return unless inputs.mouse.click~ +** Processing line: ~~ +** Processing line: ~ clicked_frame_button = state.buttons_frame_selection.items.find do |b|~ +** Processing line: ~ inputs.mouse.point.inside_rect? b~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (clicked_frame_button)~ +** Processing line: ~ state.animation_frames_selected_index = clicked_frame_button[:index]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if (inputs.mouse.point.inside_rect? rt_canvas.sprite)~ +** Processing line: ~ state.last_mouse_down = state.tick_count~ +** Processing line: ~ edit_current_animation_frame inputs.mouse.point~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_keyboard~ +** Processing line: ~ # w to save~ +** Processing line: ~ if inputs.keyboard.key_down.w~ +** Processing line: ~ t = Time.now~ +** Processing line: ~ state.save_description = "Time: #{t} (#{t.to_i})"~ +** Processing line: ~ gtk.serialize_state 'canvas/state.txt', state~ +** Processing line: ~ gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state~ +** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ +** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ +** Processing line: ~ at: state.tick_count + i,~ +** Processing line: ~ queue_sprite_creation: true }~ +** Processing line: ~ queues.create_sprite << { index: i,~ +** Processing line: ~ at: state.tick_count + animation_frames.length + i,~ +** Processing line: ~ path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" }~ +** Processing line: ~ end~ +** Processing line: ~ gtk.notify! "Canvas saved."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # l to load~ +** Processing line: ~ if inputs.keyboard.key_down.l~ +** Processing line: ~ args.state = gtk.deserialize_state 'canvas/state.txt'~ +** Processing line: ~ animation_frames.each_with_index do |a, i|~ +** Processing line: ~ queues.update_rt_animation_frame << { index: i,~ +** Processing line: ~ at: state.tick_count + i,~ +** Processing line: ~ queue_sprite_creation: true }~ +** Processing line: ~ end~ +** Processing line: ~ gtk.notify! "Canvas loaded."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # d to go into delete mode, release to paint~ +** Processing line: ~ if inputs.keyboard.key_held.d~ +** Processing line: ~ state.edit_mode = :erasing~ +** Processing line: ~ gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1)~ +** Processing line: ~ elsif inputs.keyboard.key_up.d~ +** Processing line: ~ state.edit_mode = :drawing~ +** Processing line: ~ gtk.notify! "Drawing."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # a to add a frame to the end~ +** Processing line: ~ if inputs.keyboard.key_down.a~ +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count }~ +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index + 1,~ +** Processing line: ~ at: state.tick_count }~ +** Processing line: ~ add_animation_frame_to_end~ +** Processing line: ~ gtk.notify! "Frame added to end."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # c or t to copy~ +** Processing line: ~ if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t)~ +** Processing line: ~ state.clipboard = [selected_animation_frame[:pixels]].flatten~ +** Processing line: ~ gtk.notify! "Current frame copied."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # v or q to paste~ +** Processing line: ~ if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard~ +** Processing line: ~ selected_animation_frame[:pixels] = [state.clipboard].flatten~ +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count,~ +** Processing line: ~ queue_sprite_creation: true }~ +** Processing line: ~ gtk.notify! "Pasted."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # f to go forward/next frame~ +** Processing line: ~ if (inputs.keyboard.key_down.f)~ +** Processing line: ~ if (state.animation_frames_selected_index == (state.animation_frames.length - 1))~ +** Processing line: ~ state.animation_frames_selected_index = 0~ +** Processing line: ~ else~ +** Processing line: ~ state.animation_frames_selected_index += 1~ +** Processing line: ~ end~ +** Processing line: ~ gtk.notify! "Next frame."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # b to go back/previous frame~ +** Processing line: ~ if (inputs.keyboard.key_down.b)~ +** Processing line: ~ if (state.animation_frames_selected_index == 0)~ +** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ +** Processing line: ~ else~ +** Processing line: ~ state.animation_frames_selected_index -= 1~ +** Processing line: ~ end~ +** Processing line: ~ gtk.notify! "Previous frame."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # x to delete frame~ +** Processing line: ~ if (inputs.keyboard.key_down.x) && animation_frames.length > 1~ +** Processing line: ~ state.clipboard = selected_animation_frame[:pixels]~ +** Processing line: ~ state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index }~ +** Processing line: ~ if state.animation_frames_selected_index >= state.animation_frames.length~ +** Processing line: ~ state.animation_frames_selected_index = state.animation_frames.length - 1~ +** Processing line: ~ end~ +** Processing line: ~ gtk.notify! "Frame deleted."~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_auto_export~ +** Processing line: ~ return if user_is_editing?~ +** Processing line: ~ return if state.last_mouse_up.elapsed_time != 30~ +** Processing line: ~ # auto export current animation frame if there is no editing for 30 ticks~ +** Processing line: ~ queues.create_sprite << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_buttons_frame_selection~ +** Processing line: ~ state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i|~ +** Processing line: ~ { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size,~ +** Processing line: ~ y: state.buttons_frame_selection.top - state.buttons_frame_selection.size,~ +** Processing line: ~ inner_rect: {~ +** Processing line: ~ x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size,~ +** Processing line: ~ y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2),~ +** Processing line: ~ w: 16,~ +** Processing line: ~ h: 16,~ +** Processing line: ~ },~ +** Processing line: ~ w: state.buttons_frame_selection.size,~ +** Processing line: ~ h: state.buttons_frame_selection.size,~ +** Processing line: ~ index: i }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_animation_frames~ +** Processing line: ~ animation_frames.each_with_index do |animation_frame, i|~ +** Processing line: ~ animation_frame[:index] = i~ +** Processing line: ~ animation_frame[:rt_name] = "animation_frame_#{i}"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_queue_create_sprite~ +** Processing line: ~ sprites_to_create = queues.create_sprite~ +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +** Processing line: ~~ +** Processing line: ~ queues.create_sprite = queues.create_sprite - sprites_to_create~ +** Processing line: ~~ +** Processing line: ~ sprites_to_create.each do |h|~ +** Processing line: ~ export_animation_frame h[:index], h[:path_override]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_queue_reset_sprite~ +** Processing line: ~ sprites_to_reset = queues.reset_sprite~ +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +** Processing line: ~~ +** Processing line: ~ queues.reset_sprite -= sprites_to_reset~ +** Processing line: ~~ +** Processing line: ~ sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_queue_update_rt_animation_frame~ +** Processing line: ~ animation_frames_to_update = queues.update_rt_animation_frame~ +** Processing line: ~ .find_all { |h| h[:at].elapsed? }~ +** Processing line: ~~ +** Processing line: ~ queues.update_rt_animation_frame -= animation_frames_to_update~ +** Processing line: ~~ +** Processing line: ~ animation_frames_to_update.each do |h|~ +** Processing line: ~ update_animation_frame_render_target animation_frames[h[:index]]~ +** Processing line: ~~ +** Processing line: ~ if h[:queue_sprite_creation]~ +** Processing line: ~ queues.create_sprite << { index: h[:index],~ +** Processing line: ~ at: state.tick_count + 1 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def update_animation_frame_render_target animation_frame~ +** Processing line: ~ return if !animation_frame~ +** Processing line: ~~ +** Processing line: ~ outputs[animation_frame[:rt_name]].width = state.rt_canvas.size~ +** Processing line: ~ outputs[animation_frame[:rt_name]].height = state.rt_canvas.size~ +** Processing line: ~ outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f|~ +** Processing line: ~ { x: f.x,~ +** Processing line: ~ y: f.y,~ +** Processing line: ~ w: 1,~ +** Processing line: ~ h: 1, r: 255, g: 255, b: 255 }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def animation_frames~ +** Processing line: ~ state.animation_frames~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def add_animation_frame_to_end~ +** Processing line: ~ animation_frames << {~ +** Processing line: ~ index: animation_frames.length,~ +** Processing line: ~ pixels: [],~ +** Processing line: ~ rt_name: "animation_frame_#{animation_frames.length}"~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ state.animation_frames_selected_index = (animation_frames.length - 1)~ +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count,~ +** Processing line: ~ queue_sprite_creation: true }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def sprite_path i~ +** Processing line: ~ "canvas/sprite-#{i}.png"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def export_animation_frame i, path_override = nil~ +** Processing line: ~ return if !state.animation_frames[i]~ +** Processing line: ~~ +** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ +** Processing line: ~ .items[i][:inner_rect]~ +** Processing line: ~ .merge(path: path_override || (sprite_path i))~ +** Processing line: ~~ +** Processing line: ~ outputs.screenshots << state.buttons_frame_selection~ +** Processing line: ~ .items[i][:inner_rect]~ +** Processing line: ~ .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png")~ +** Processing line: ~~ +** Processing line: ~ queues.reset_sprite << { index: i, at: state.tick_count }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def selected_animation_frame~ +** Processing line: ~ state.animation_frames[state.animation_frames_selected_index]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def edit_current_animation_frame point~ +** Processing line: ~ draw_area_point = (to_draw_area point)~ +** Processing line: ~ if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point)~ +** Processing line: ~ selected_animation_frame[:pixels] << draw_area_point~ +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count,~ +** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ +** Processing line: ~ elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point)~ +** Processing line: ~ selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point }~ +** Processing line: ~ queues.update_rt_animation_frame << { index: state.animation_frames_selected_index,~ +** Processing line: ~ at: state.tick_count,~ +** Processing line: ~ queue_sprite_creation: !user_is_editing? }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def user_is_editing?~ +** Processing line: ~ state.last_mouse_down > state.last_mouse_up~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_draw_area point~ +** Processing line: ~ x, y = point~ +** Processing line: ~ x -= rt_canvas.sprite.x~ +** Processing line: ~ y -= rt_canvas.sprite.y~ +** Processing line: ~ { x: x.idiv(rt_canvas.zoom),~ +** Processing line: ~ y: y.idiv(rt_canvas.zoom) }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def rt_canvas~ +** Processing line: ~ state.rt_canvas ||= state.new_entity(:rt_canvas)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queues~ +** Processing line: ~ state.queues ||= state.new_entity(:queues)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $game = OneBitLowrezPaint.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Dev Tools - Tile Editor Starting Point - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Dev Tools - Tile Editor Starting Point - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_dev_tools/tile_editor_starting_point/app/main.rb~ +** Processing line: ~ =begin~ +** Processing line: ~~ +** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ +** Processing line: ~~ +** Processing line: ~ - to_s: Returns a string representation of an object.~ +** Processing line: ~ For example, if we had~ +** Processing line: ~ 500.to_s~ +** Processing line: ~ the string "500" would be returned.~ +** Processing line: ~ Similar to to_i, which returns an integer representation of an object.~ +** Processing line: ~~ +** Processing line: ~ - Ceil: Returns an integer number greater than or equal to the original~ +** Processing line: ~ with no decimal.~ +** Processing line: ~~ +** Processing line: ~ Reminders:~ +** Processing line: ~~ +** Processing line: ~ - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.sprites: An array. The values generate a sprite.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]~ +** Processing line: ~ For more information about sprites, go to mygame/documentation/05-sprites.md.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.solids: An array. The values generate a solid.~ +** Processing line: ~ The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.lines: An array. The values generate a line.~ +** Processing line: ~ The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE]~ +** Processing line: ~ For more information about lines, go to mygame/documentation/04-lines.md.~ +** Processing line: ~~ +** Processing line: ~ - args.state.new_entity: Used when we want to create a new object, like a sprite or button.~ +** Processing line: ~ In this sample app, new_entity is used to create a new button that clears the grid.~ +** Processing line: ~ (Remember, you can use state to define ANY property and it will be retained across frames.)~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This sample app shows an empty grid that the user can paint in. There are different image tiles that~ +** Processing line: ~ # the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes.~ +** Processing line: ~~ +** Processing line: ~ class TileEditor~ +** Processing line: ~ attr_accessor :inputs, :state, :outputs, :grid, :args~ +** Processing line: ~~ +** Processing line: ~ # Runs all the methods necessary for the game to function properly.~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ check_click~ +** Processing line: ~ draw_buttons~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets default values~ +** Processing line: ~ # Initialization only happens in the first frame~ +** Processing line: ~ # NOTE: The values of some of these variables may seem confusingly large at first.~ +** Processing line: ~ # The gridSize is 1600 but it seems a lot smaller on the screen, for example.~ +** Processing line: ~ # But keep in mind that by using the "W", "A", "S", and "D" keys, you can~ +** Processing line: ~ # move the grid's view in all four directions for more grid spaces.~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.tileCords ||= []~ +** Processing line: ~ state.tileQuantity ||= 6~ +** Processing line: ~ state.tileSize ||= 50~ +** Processing line: ~ state.tileSelected ||= 1~ +** Processing line: ~ state.tempX ||= 50~ +** Processing line: ~ state.tempY ||= 500~ +** Processing line: ~ state.speed ||= 4~ +** Processing line: ~ state.centerX ||= 4000~ +** Processing line: ~ state.centerY ||= 4000~ +** Processing line: ~ state.originalCenter ||= [state.centerX, state.centerY]~ +** Processing line: ~ state.gridSize ||= 1600~ +** Processing line: ~ state.lineQuantity ||= 50~ +** Processing line: ~ state.increment ||= state.gridSize / state.lineQuantity~ +** Processing line: ~ state.gridX ||= []~ +** Processing line: ~ state.gridY ||= []~ +** Processing line: ~ state.filled_squares ||= []~ +** Processing line: ~ state.grid_border ||= [390, 140, 500, 500]~ +** Processing line: ~~ +** Processing line: ~ get_grid unless state.tempX == 0 # calls get_grid in the first frame only~ +** Processing line: ~ determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame~ +** Processing line: ~ state.tempX = 0 # sets tempX to 0; the two methods aren't called again~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Calculates the placement of lines or separators in the grid~ +** Processing line: ~ def get_grid~ +** Processing line: ~ curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid~ +** Processing line: ~ deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid~ +** Processing line: ~ (state.lineQuantity + 2).times do~ +** Processing line: ~ state.gridX << curr_x # adds curr_x to gridX collection~ +** Processing line: ~ curr_x += deltaX # increment curr_x by the distance between vertical lines~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid~ +** Processing line: ~ deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid~ +** Processing line: ~ (state.lineQuantity + 2).times do~ +** Processing line: ~ state.gridY << curr_y # adds curr_y to gridY collection~ +** Processing line: ~ curr_y += deltaY # increments curr_y to distance between horizontal lines~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Determines coordinate positions of patterned tiles (on the left side of the grid)~ +** Processing line: ~ def determineTileCords~ +** Processing line: ~ state.tempCounter ||= 1 # initializes tempCounter to 1~ +** Processing line: ~ state.tileQuantity.times do # there are 6 different kinds of tiles~ +** Processing line: ~ state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection~ +** Processing line: ~ state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles~ +** Processing line: ~ state.tempCounter += 1 # increments tempCounter~ +** Processing line: ~ if state.tempX > 200 # if tempX exceeds 200 pixels~ +** Processing line: ~ state.tempX = 50 # a new row of patterned tiles begins~ +** Processing line: ~ state.tempY -= 75 # the new row is 75 pixels lower than the previous row~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Outputs objects (grid, tiles, etc) onto the screen~ +** Processing line: ~ def render~ +** Processing line: ~ outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder~ +** Processing line: ~ |x, y, order|~ +** Processing line: ~ [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"]~ +** Processing line: ~ end~ +** Processing line: ~ outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background~ +** Processing line: ~ add_grid # outputs grid~ +** Processing line: ~ print_title # outputs title and current tile pattern~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Creates a grid by outputting vertical and horizontal grid lines onto the screen.~ +** Processing line: ~ # Outputs sprites for the filled_squares collection onto the screen.~ +** Processing line: ~ def add_grid~ +** Processing line: ~~ +** Processing line: ~ # Outputs the grid's border.~ +** Processing line: ~ outputs.borders << state.grid_border~ +** Processing line: ~ temp = 0~ +** Processing line: ~~ +** Processing line: ~ # Before looking at the code that outputs the vertical and horizontal lines in the~ +** Processing line: ~ # grid, take note of the fact that:~ +** Processing line: ~ # grid_border[1] refers to the border's bottom line (running horizontally),~ +** Processing line: ~ # grid_border[2] refers to the border's top line (running (horizontally),~ +** Processing line: ~ # grid_border[0] refers to the border's left line (running vertically),~ +** Processing line: ~ # and grid_border[3] refers to the border's right line (running vertically).~ +** Processing line: ~~ +** Processing line: ~ # [2]~ +** Processing line: ~ # ----------~ +** Processing line: ~ # | |~ +** Processing line: ~ # [0] | | [3]~ +** Processing line: ~ # | |~ +** Processing line: ~ # ----------~ +** Processing line: ~ # [1]~ +** Processing line: ~~ +** Processing line: ~ # Calculates the positions and outputs the x grid lines in the color gray.~ +** Processing line: ~ state.gridX.map do # perform an action on all elements of the gridX collection~ +** Processing line: ~ |x|~ +** Processing line: ~ temp += 1 # increment temp~ +** Processing line: ~~ +** Processing line: ~ # if x's value is greater than (or equal to) the x value of the border's left side~ +** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ +** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2)~ +** Processing line: ~ delta = state.centerX - 640~ +** Processing line: ~ # vertical lines have the same starting and ending x positions~ +** Processing line: ~ # starting y and ending y positions lead from the bottom of the border to the top of the border~ +** Processing line: ~ outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ temp = 0~ +** Processing line: ~~ +** Processing line: ~ # Calculates the positions and outputs the y grid lines in the color gray.~ +** Processing line: ~ state.gridY.map do # perform an action on all elements of the gridY collection~ +** Processing line: ~ |y|~ +** Processing line: ~ temp += 1 # increment temp~ +** Processing line: ~~ +** Processing line: ~ # if y's value is greater than (or equal to) the y value of the border's bottom side~ +** Processing line: ~ # and less than (or equal to) the y value of the border's top side~ +** Processing line: ~ if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2)~ +** Processing line: ~ delta = state.centerY - 393~ +** Processing line: ~ # horizontal lines have the same starting and ending y positions~ +** Processing line: ~ # starting x and ending x positions lead from the left side of the border to the right side of the border~ +** Processing line: ~ outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets values and outputs sprites for the filled_squares collection.~ +** Processing line: ~ state.filled_squares.map do # perform an action on every element of the filled_squares collection~ +** Processing line: ~ |x, y, w, h, sprite|~ +** Processing line: ~ # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side~ +** Processing line: ~ # and less than (or equal to) the x value of the border's right side~ +** Processing line: ~ # and y's value is greater than (or equal to) the y value of the border's bottom side~ +** Processing line: ~ # and less than (or equal to) the y value of 25 pixels above the border's top side~ +** Processing line: ~ # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or~ +** Processing line: ~ # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D")~ +** Processing line: ~ if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) &&~ +** Processing line: ~ y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25~ +** Processing line: ~ # calculations done to place sprites in grid spaces that are meant to filled in~ +** Processing line: ~ # mess around with the x and y values and see how the sprite placement changes~ +** Processing line: ~ outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background)~ +** Processing line: ~ # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner~ +** Processing line: ~ # state.increment subtracted in y parameter to avoid covering the title label~ +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment,~ +** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ +** Processing line: ~ 255, 255, 255].solid~ +** Processing line: ~~ +** Processing line: ~ # outputs a white solid along the right side of the grid~ +** Processing line: ~ # state.increment subtracted from y parameter to avoid covering title label~ +** Processing line: ~ outputs.primitives << [state.grid_border[0] + state.grid_border[2],~ +** Processing line: ~ state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2),~ +** Processing line: ~ 255, 255, 255].solid~ +** Processing line: ~~ +** Processing line: ~ # outputs a white solid along the bottom of the grid~ +** Processing line: ~ # state.increment subtracted from y parameter to avoid covering last row of grid boxes~ +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment,~ +** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ +** Processing line: ~~ +** Processing line: ~ # outputs a white solid along the top of the grid~ +** Processing line: ~ outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3],~ +** Processing line: ~ state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid~ +** Processing line: ~~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Outputs title and current tile pattern~ +** Processing line: ~ def print_title~ +** Processing line: ~ outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label~ +** Processing line: ~ outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator~ +** Processing line: ~ outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label~ +** Processing line: ~ outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets the starting position, ending position, and color for the horizontal separator.~ +** Processing line: ~ def horizontal_separator y, x, x2~ +** Processing line: ~ [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Checks if the mouse is being clicked or dragged~ +** Processing line: ~ def check_click~ +** Processing line: ~ if inputs.keyboard.key_down.r # if the "r" key is pressed down~ +** Processing line: ~ $dragon.reset~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.mouse.down #is mouse up or down?~ +** Processing line: ~ state.mouse_held = true~ +** Processing line: ~ if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders~ +** Processing line: ~ state.tileCords.map do # perform action on all elements of tileCords collection~ +** Processing line: ~ |x, y, order|~ +** Processing line: ~ # if mouse's x position is greater than (or equal to) the starting x position of a tile~ +** Processing line: ~ # and the mouse's x position is also less than (or equal to) the ending x position of that tile,~ +** Processing line: ~ # and the mouse's y position is greater than (or equal to) the starting y position of that tile,~ +** Processing line: ~ # and the mouse's y position is also less than (or equal to) the ending y position of that tile,~ +** Processing line: ~ # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE)~ +** Processing line: ~ if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize &&~ +** Processing line: ~ inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize~ +** Processing line: ~ state.tileSelected = order # that tile is selected~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state~ +** Processing line: ~ state.mouse_held = false # mouse is not held down or dragged~ +** Processing line: ~ state.mouse_dragging = false~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.mouse_held && # mouse needs to be down~ +** Processing line: ~ !inputs.mouse.click && # must not be first click~ +** Processing line: ~ ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 ||~ +** Processing line: ~ (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag"~ +** Processing line: ~ state.mouse_dragging = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if mouse is clicked inside grid's border, search_lines method is called with click input type~ +** Processing line: ~ if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border))~ +** Processing line: ~ search_lines(inputs.mouse.click.point, :click)~ +** Processing line: ~~ +** Processing line: ~ # if mouse is dragged inside grid's border, search_lines method is called with drag input type~ +** Processing line: ~ elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border))~ +** Processing line: ~ search_lines(inputs.mouse.position, :drag)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Changes grid's position on screen by moving it up, down, left, or right.~ +** Processing line: ~~ +** Processing line: ~ # centerX is incremented by speed if the "d" key is pressed and if that sum is less than~ +** Processing line: ~ # the original left side of the center plus half the grid, minus half the top border of grid.~ +** Processing line: ~ # MOVES GRID RIGHT (increasing x)~ +** Processing line: ~ state.centerX += state.speed if inputs.keyboard.key_held.d &&~ +** Processing line: ~ (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2)~ +** Processing line: ~ # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than~ +** Processing line: ~ # the original left side of the center minus half the grid, plus half the top border of grid.~ +** Processing line: ~ # MOVES GRID LEFT (decreasing x)~ +** Processing line: ~ state.centerX -= state.speed if inputs.keyboard.key_held.a &&~ +** Processing line: ~ (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2)~ +** Processing line: ~ # centerY is incremented by speed if the "w" key is pressed and if that sum is less than~ +** Processing line: ~ # the original bottom of the center plus half the grid, minus half the right border of grid.~ +** Processing line: ~ # MOVES GRID UP (increasing y)~ +** Processing line: ~ state.centerY += state.speed if inputs.keyboard.key_held.w &&~ +** Processing line: ~ (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2)~ +** Processing line: ~ # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than~ +** Processing line: ~ # the original bottom of the center minus half the grid, plus half the right border of grid.~ +** Processing line: ~ # MOVES GRID DOWN (decreasing y)~ +** Processing line: ~ state.centerY -= state.speed if inputs.keyboard.key_held.s &&~ +** Processing line: ~ (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Performs calculations on the gridX and gridY collections, and sets values.~ +** Processing line: ~ # Sets the definition of a grid box, including the image that it is filled with.~ +** Processing line: ~ def search_lines (point, input_type)~ +** Processing line: ~ point.x += state.centerX - 630 # increments x and y~ +** Processing line: ~ point.y += state.centerY - 360~ +** Processing line: ~ findX = 0~ +** Processing line: ~ findY = 0~ +** Processing line: ~ increment = state.gridSize / state.lineQuantity # divides grid by number of separators~ +** Processing line: ~~ +** Processing line: ~ state.gridX.map do # perform an action on every element of collection~ +** Processing line: ~ |x|~ +** Processing line: ~ # findX increments x by 10 if point.x is less than that sum and findX is currently 0~ +** Processing line: ~ findX = x + 10 if point.x < (x + 10) && findX == 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.gridY.map do~ +** Processing line: ~ |y|~ +** Processing line: ~ # findY is set to y if point.y is less than that value and findY is currently 0~ +** Processing line: ~ findY = y if point.y < (y) && findY == 0~ +** Processing line: ~ end~ +** Processing line: ~ # position of a box is denoted by bottom left corner, which is why the increment is being subtracted~ +** Processing line: ~ grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil,~ +** Processing line: ~ "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition~ +** Processing line: ~~ +** Processing line: ~ if input_type == :click # if user clicks their mouse~ +** Processing line: ~ if state.filled_squares.include? grid_box # if grid box is already filled in~ +** Processing line: ~ state.filled_squares.delete grid_box # box is cleared and removed from filled_squares~ +** Processing line: ~ else~ +** Processing line: ~ state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares~ +** Processing line: ~ end~ +** Processing line: ~ elsif input_type == :drag # if user drags mouse~ +** Processing line: ~ unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in~ +** Processing line: ~ state.filled_squares << grid_box # box is filled in and added to filled_squares~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Creates a "Clear" button using labels and borders.~ +** Processing line: ~ def draw_buttons~ +** Processing line: ~ x, y, w, h = 390, 50, 240, 50~ +** Processing line: ~ state.clear_button ||= state.new_entity(:button_with_fade)~ +** Processing line: ~~ +** Processing line: ~ # x and y positions are set to display "Clear" label in center of the button~ +** Processing line: ~ # Try changing first two parameters to simply x, y and see what happens to the text placement~ +** Processing line: ~ state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1]~ +** Processing line: ~ state.clear_button.border ||= [x, y, w, h] # definition of button's border~ +** Processing line: ~~ +** Processing line: ~ # If the mouse is clicked inside the borders of the clear button~ +** Processing line: ~ if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border)~ +** Processing line: ~ state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click~ +** Processing line: ~ state.filled_squares.clear # filled squares collection is emptied (squares are cleared)~ +** Processing line: ~ inputs.mouse.previous_click = nil # no previous click~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << state.clear_button.label # outputs clear button~ +** Processing line: ~ outputs.borders << state.clear_button.border~ +** Processing line: ~~ +** Processing line: ~ # When the clear button is clicked, the color of the button changes~ +** Processing line: ~ # and the transparency changes, as well. If you change the time from~ +** Processing line: ~ # 0.25.seconds to 1.25.seconds or more, the change will last longer.~ +** Processing line: ~ if state.clear_button.clicked_at~ +** Processing line: ~ outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $tile_editor = TileEditor.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $tile_editor.inputs = args.inputs~ +** Processing line: ~ $tile_editor.grid = args.grid~ +** Processing line: ~ $tile_editor.args = args~ +** Processing line: ~ $tile_editor.outputs = args.outputs~ +** Processing line: ~ $tile_editor.state = args.state~ +** Processing line: ~ $tile_editor.tick~ +** Processing line: ~ tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.mouse.click ||~ +** Processing line: ~ args.inputs.keyboard.directional_vector ||~ +** Processing line: ~ args.inputs.keyboard.key_down.enter ||~ +** Processing line: ~ args.inputs.keyboard.key_down.escape~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Lowrez - Resolution 64x64 - lowrez.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Lowrez - Resolution 64x64 - lowrez.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_lowrez/resolution_64x64/app/lowrez.rb~ +** Processing line: ~ # Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)~ +** Processing line: ~ # Head over to main.rb and study the code there.~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_SIZE = 64~ +** Processing line: ~ LOWREZ_ZOOM = 10~ +** Processing line: ~ LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM~ +** Processing line: ~ LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half~ +** Processing line: ~ LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_FONT_XL = -1~ +** Processing line: ~ LOWREZ_FONT_XL_HEIGHT = 20~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_FONT_LG = -3.5~ +** Processing line: ~ LOWREZ_FONT_LG_HEIGHT = 15~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_FONT_MD = -6~ +** Processing line: ~ LOWREZ_FONT_MD_HEIGHT = 10~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_FONT_SM = -8.5~ +** Processing line: ~ LOWREZ_FONT_SM_HEIGHT = 5~ +** Processing line: ~~ +** Processing line: ~ LOWREZ_FONT_PATH = 'fonts/lowrez.ttf'~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ class LowrezOutputs~ +** Processing line: ~ attr_accessor :width, :height~ +** Processing line: ~~ +** Processing line: ~ def initialize args~ +** Processing line: ~ @args = args~ +** Processing line: ~ @background_color ||= [0, 0, 0]~ +** Processing line: ~ @args.outputs.background_color = @background_color~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def background_color~ +** Processing line: ~ @background_color ||= [0, 0, 0]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def background_color= opts~ +** Processing line: ~ @background_color = opts~ +** Processing line: ~ @args.outputs.background_color = @background_color~ +** Processing line: ~~ +** Processing line: ~ outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def outputs_lowrez~ +** Processing line: ~ return @args.outputs if @args.state.tick_count <= 0~ +** Processing line: ~ return @args.outputs[:lowrez]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def solids~ +** Processing line: ~ outputs_lowrez.solids~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def borders~ +** Processing line: ~ outputs_lowrez.borders~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def sprites~ +** Processing line: ~ outputs_lowrez.sprites~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def labels~ +** Processing line: ~ outputs_lowrez.labels~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def default_label~ +** Processing line: ~ {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 63,~ +** Processing line: ~ text: "",~ +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ +** Processing line: ~ alignment_enum: 0,~ +** Processing line: ~ r: 0,~ +** Processing line: ~ g: 0,~ +** Processing line: ~ b: 0,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def lines~ +** Processing line: ~ outputs_lowrez.lines~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def primitives~ +** Processing line: ~ outputs_lowrez.primitives~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def click~ +** Processing line: ~ return nil unless @args.inputs.mouse.click~ +** Processing line: ~ mouse~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mouse_click~ +** Processing line: ~ click~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mouse_down~ +** Processing line: ~ @args.inputs.mouse.down~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mouse_up~ +** Processing line: ~ @args.inputs.mouse.up~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mouse~ +** Processing line: ~ [~ +** Processing line: ~ ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)),~ +** Processing line: ~ ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM))~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def mouse_position~ +** Processing line: ~ mouse~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def keyboard~ +** Processing line: ~ @args.inputs.keyboard~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ class GTK::Args~ +** Processing line: ~ def init_lowrez~ +** Processing line: ~ return if @lowrez~ +** Processing line: ~ @lowrez = LowrezOutputs.new self~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def lowrez~ +** Processing line: ~ @lowrez~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ module GTK~ +** Processing line: ~ class Runtime~ +** Processing line: ~ alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__)~ +** Processing line: ~~ +** Processing line: ~ def tick_core~ +** Processing line: ~ @args.init_lowrez~ +** Processing line: ~ __original_tick_core__~ +** Processing line: ~~ +** Processing line: ~ return if @args.state.tick_count <= 0~ +** Processing line: ~~ +** Processing line: ~ @args.render_target(:lowrez)~ +** Processing line: ~ .labels~ +** Processing line: ~ .each do |l|~ +** Processing line: ~ l.y += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ @args.render_target(:lowrez)~ +** Processing line: ~ .lines~ +** Processing line: ~ .each do |l|~ +** Processing line: ~ l.y += 1~ +** Processing line: ~ l.y2 += 1~ +** Processing line: ~ l.y2 += 1 if l.y1 != l.y2~ +** Processing line: ~ l.x2 += 1 if l.x1 != l.x2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ @args.outputs~ +** Processing line: ~ .sprites << { x: 320,~ +** Processing line: ~ y: 40,~ +** Processing line: ~ w: 640,~ +** Processing line: ~ h: 640,~ +** Processing line: ~ source_x: 0,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: 64,~ +** Processing line: ~ source_h: 64,~ +** Processing line: ~ path: :lowrez }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Lowrez - Resolution 64x64 - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Lowrez - Resolution 64x64 - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_lowrez/resolution_64x64/app/main.rb~ +** Processing line: ~ require 'app/lowrez.rb'~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ # How to set the background color~ +** Processing line: ~ args.lowrez.background_color = [255, 255, 255]~ +** Processing line: ~~ +** Processing line: ~ # ==== HELLO WORLD ======================================================~ +** Processing line: ~ # Steps to get started:~ +** Processing line: ~ # 1. ~def tick args~ is the entry point for your game.~ +** Processing line: ~ # 2. There are quite a few code samples below, remove the "##"~ +** Processing line: ~ # before each line and save the file to see the changes.~ +** Processing line: ~ # 3. 0, 0 is in bottom left and 63, 63 is in top right corner.~ +** Processing line: ~ # 4. Be sure to come to the discord channel if you need~ +** Processing line: ~ # more help: [[http://discord.dragonruby.org]].~ +** Processing line: ~~ +** Processing line: ~ # Commenting and uncommenting code:~ +** Processing line: ~ # - Add a "#" infront of lines to comment out code~ +** Processing line: ~ # - Remove the "#" infront of lines to comment out code~ +** Processing line: ~~ +** Processing line: ~ # Invoke the hello_world subroutine/method~ +** Processing line: ~ hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method.~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ +** Processing line: ~ # Uncomment the line below to invoke the how_to_render_a_label subroutine/method.~ +** Processing line: ~ # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~~ +** Processing line: ~ # Scroll down to the method to see the details.~ +** Processing line: ~~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_render_solids args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ========================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_render_borders args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO RENDER A LINE =============================================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_render_lines args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # == HOW TO RENDER A SPRITE =============================================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_render_sprites args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT =====================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_move_a_sprite args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_animate_a_sprite args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ===========================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_animate_a_sprite_sheet args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =============================================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_determine_collision args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== HOW TO CREATE BUTTONS ==================================================~ +** Processing line: ~ # Remove the "#" at the beginning of the line below~ +** Processing line: ~ # how_to_create_buttons args~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # ==== The line below renders a debug grid, mouse information, and current tick~ +** Processing line: ~ render_debug args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def hello_world args~ +** Processing line: ~ args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 }~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.labels << {~ +** Processing line: ~ x: 32,~ +** Processing line: ~ y: 63,~ +** Processing line: ~ text: "lowrezjam 2020",~ +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 0,~ +** Processing line: ~ g: 0,~ +** Processing line: ~ b: 0,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.sprites << {~ +** Processing line: ~ x: 32 - 10,~ +** Processing line: ~ y: 32 - 10,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20,~ +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ +** Processing line: ~ a: args.state.tick_count % 255,~ +** Processing line: ~ angle: args.state.tick_count % 360~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~ # ==== HOW TO RENDER A LABEL ============================================~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~ def how_to_render_a_label args~ +** Processing line: ~ # NOTE: Text is aligned from the TOP LEFT corner~ +** Processing line: ~~ +** Processing line: ~ # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below)~ +** Processing line: ~ args.lowrez.labels << { x: 0, y: 57, text: "Hello World",~ +** Processing line: ~ size_enum: LOWREZ_FONT_XL,~ +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~~ +** Processing line: ~ # Render a LARGE/LG label (remove the "#" in front of each line below)~ +** Processing line: ~ args.lowrez.labels << { x: 0, y: 36, text: "Hello World",~ +** Processing line: ~ size_enum: LOWREZ_FONT_LG,~ +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~~ +** Processing line: ~ # Render a MEDIUM/MD label (remove the "#" in front of each line below)~ +** Processing line: ~ args.lowrez.labels << { x: 0, y: 20, text: "Hello World",~ +** Processing line: ~ size_enum: LOWREZ_FONT_MD,~ +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~~ +** Processing line: ~ # Render a SMALL/SM label (remove the "#" in front of each line below)~ +** Processing line: ~ args.lowrez.labels << { x: 0, y: 9, text: "Hello World",~ +** Processing line: ~ size_enum: LOWREZ_FONT_SM,~ +** Processing line: ~ r: 0, g: 0, b: 0, a: 255,~ +** Processing line: ~ font: LOWREZ_FONT_PATH }~ +** Processing line: ~~ +** Processing line: ~ # You are provided args.lowrez.default_label which returns a Hash that you~ +** Processing line: ~ # can ~merge~ properties with~ +** Processing line: ~ # Example 1~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(text: "Default")~ +** Processing line: ~~ +** Processing line: ~ # Example 2~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 31,~ +** Processing line: ~ text: "Default",~ +** Processing line: ~ r: 128,~ +** Processing line: ~ g: 128,~ +** Processing line: ~ b: 128)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ==================================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_render_solids args~ +** Processing line: ~ # Render a red square at 0, 0 with a width and height of 1~ +** Processing line: ~ args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a red square at 1, 1 with a width and height of 2~ +** Processing line: ~ args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ +** Processing line: ~ args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 }~ +** Processing line: ~~ +** Processing line: ~ # Render a red square at 6, 6 with a width and height of 4~ +** Processing line: ~ args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) ===============================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_render_borders args~ +** Processing line: ~ # Render a red square at 0, 0 with a width and height of 3~ +** Processing line: ~ args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a red square at 3, 3 with a width and height of 3~ +** Processing line: ~ args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a red square at 5, 5 with a width and height of 4~ +** Processing line: ~ args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO RENDER A LINE ===================================================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_render_lines args~ +** Processing line: ~ # Render a horizontal line at the bottom~ +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a vertical line at the left~ +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 }~ +** Processing line: ~~ +** Processing line: ~ # Render a diagonal line starting from the bottom left and going to the top right~ +** Processing line: ~ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # == HOW TO RENDER A SPRITE ===================================================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_render_sprites args~ +** Processing line: ~ # Loop 10 times and create 10 sprites in 10 positions~ +** Processing line: ~ # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png'~ +** Processing line: ~ 10.times do |i|~ +** Processing line: ~ args.lowrez.sprites << {~ +** Processing line: ~ x: i * 5,~ +** Processing line: ~ y: i * 5,~ +** Processing line: ~ w: 5,~ +** Processing line: ~ h: 5,~ +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png'~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Given an array of positions create sprites~ +** Processing line: ~ positions = [~ +** Processing line: ~ { x: 10, y: 42 },~ +** Processing line: ~ { x: 15, y: 45 },~ +** Processing line: ~ { x: 22, y: 33 },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ positions.each do |position|~ +** Processing line: ~ # use Ruby's ~Hash#merge~ function to create a sprite~ +** Processing line: ~ args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png',~ +** Processing line: ~ w: 5,~ +** Processing line: ~ h: 5)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_animate_a_sprite args~ +** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ +** Processing line: ~ start_animation_on_tick = 180~ +** Processing line: ~~ +** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ +** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ +** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ +** Processing line: ~ repeat: true # should it repeat?~ +** Processing line: ~~ +** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ +** Processing line: ~ if sprite_index~ +** Processing line: ~ # if the sprite_index is populated, use it to determine the sprite path and render it~ +** Processing line: ~ sprite_path = "sprites/explosion-#{sprite_index}.png"~ +** Processing line: ~ args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path }~ +** Processing line: ~ else~ +** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ +** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 32,~ +** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # render the current tick and the resolved sprite index~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 0,~ +** Processing line: ~ y: 11,~ +** Processing line: ~ text: "Tick: #{args.state.tick_count}")~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 0,~ +** Processing line: ~ y: 5,~ +** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =================================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_animate_a_sprite_sheet args~ +** Processing line: ~ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds~ +** Processing line: ~ start_animation_on_tick = 180~ +** Processing line: ~~ +** Processing line: ~ # STEP 2: Get the frame_index given the start tick.~ +** Processing line: ~ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?~ +** Processing line: ~ hold_for: 4, # how long to hold each sprite?~ +** Processing line: ~ repeat: true # should it repeat?~ +** Processing line: ~~ +** Processing line: ~ # STEP 3: frame_index will return nil if the frame hasn't arrived yet~ +** Processing line: ~ if sprite_index~ +** Processing line: ~ # if the sprite_index is populated, use it to determine the source rectangle and render it~ +** Processing line: ~ args.lowrez.sprites << {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: 64,~ +** Processing line: ~ h: 64,~ +** Processing line: ~ path: "sprites/explosion-sheet.png",~ +** Processing line: ~ source_x: 32 * sprite_index,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: 32,~ +** Processing line: ~ source_h: 32~ +** Processing line: ~ }~ +** Processing line: ~ else~ +** Processing line: ~ # if the sprite_index is nil, render a countdown instead~ +** Processing line: ~ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 32,~ +** Processing line: ~ text: "Count Down: #{countdown_in_seconds}",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # render the current tick and the resolved sprite index~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 0,~ +** Processing line: ~ y: 11,~ +** Processing line: ~ text: "tick: #{args.state.tick_count}")~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 0,~ +** Processing line: ~ y: 5,~ +** Processing line: ~ text: "sprite_index: #{sprite_index}")~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE =~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_move_a_sprite args~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 62, text: "Use Arrow Keys",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 56, text: "Use WASD",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 50, text: "Or Click",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ # set the initial values for x and y using ||= ("or equal operator")~ +** Processing line: ~ args.state.ship.x ||= 0~ +** Processing line: ~ args.state.ship.y ||= 0~ +** Processing line: ~~ +** Processing line: ~ # if a mouse click occurs, update the ship's x and y to be the location of the click~ +** Processing line: ~ if args.lowrez.mouse_click~ +** Processing line: ~ args.state.ship.x = args.lowrez.mouse_click.x~ +** Processing line: ~ args.state.ship.y = args.lowrez.mouse_click.y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if a or left arrow is pressed/held, decrement the ships x position~ +** Processing line: ~ if args.lowrez.keyboard.left~ +** Processing line: ~ args.state.ship.x -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if d or right arrow is pressed/held, increment the ships x position~ +** Processing line: ~ if args.lowrez.keyboard.right~ +** Processing line: ~ args.state.ship.x += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if s or down arrow is pressed/held, decrement the ships y position~ +** Processing line: ~ if args.lowrez.keyboard.down~ +** Processing line: ~ args.state.ship.y -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if w or up arrow is pressed/held, increment the ships y position~ +** Processing line: ~ if args.lowrez.keyboard.up~ +** Processing line: ~ args.state.ship.y += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # render the sprite to the screen using the position stored in args.state.ship~ +** Processing line: ~ args.lowrez.sprites << {~ +** Processing line: ~ x: args.state.ship.x,~ +** Processing line: ~ y: args.state.ship.y,~ +** Processing line: ~ w: 5,~ +** Processing line: ~ h: 5,~ +** Processing line: ~ path: 'sprites/lowrez-ship-blue.png',~ +** Processing line: ~ # parameters beyond this point are optional~ +** Processing line: ~ angle: 0, # Note: rotation angle is denoted in degrees NOT radians~ +** Processing line: ~ r: 255,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ a: 255~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~ # ==== HOW TO DETERMINE COLLISION =======================================~ +** Processing line: ~ # =======================================================================~ +** Processing line: ~ def how_to_determine_collision args~ +** Processing line: ~ # Render the instructions~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 62, text: "Click Anywhere",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~ # if a mouse click occurs:~ +** Processing line: ~ # - set ship_one if it isn't set~ +** Processing line: ~ # - set ship_two if it isn't set~ +** Processing line: ~ # - otherwise reset ship one and ship two~ +** Processing line: ~ if args.lowrez.mouse_click~ +** Processing line: ~ # is ship_one set?~ +** Processing line: ~ if !args.state.ship_one~ +** Processing line: ~ args.state.ship_one = { x: args.lowrez.mouse_click.x - 10,~ +** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20 }~ +** Processing line: ~ # is ship_one set?~ +** Processing line: ~ elsif !args.state.ship_two~ +** Processing line: ~ args.state.ship_two = { x: args.lowrez.mouse_click.x - 10,~ +** Processing line: ~ y: args.lowrez.mouse_click.y - 10,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20 }~ +** Processing line: ~ # should we reset?~ +** Processing line: ~ else~ +** Processing line: ~ args.state.ship_one = nil~ +** Processing line: ~ args.state.ship_two = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # render ship one if it's set~ +** Processing line: ~ if args.state.ship_one~ +** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ +** Processing line: ~ # render ship one~ +** Processing line: ~ args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.ship_two~ +** Processing line: ~ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha~ +** Processing line: ~ # render ship two~ +** Processing line: ~ args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # if both ship one and ship two are set, then determine collision~ +** Processing line: ~ if args.state.ship_one && args.state.ship_two~ +** Processing line: ~ # collision is determined using the intersect_rect? method~ +** Processing line: ~ if args.state.ship_one.intersect_rect? args.state.ship_two~ +** Processing line: ~ # if collision occurred, render the words collision!~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 31,~ +** Processing line: ~ y: 5,~ +** Processing line: ~ text: "Collision!",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ else~ +** Processing line: ~ # if collision occurred, render the words no collision.~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 31,~ +** Processing line: ~ y: 5,~ +** Processing line: ~ text: "No Collision.",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ # if both ship one and ship two aren't set, then render --~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(x: 31,~ +** Processing line: ~ y: 6,~ +** Processing line: ~ text: "--",~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ ## # ==== HOW TO CREATE BUTTONS ==================================================~ +** Processing line: ~ ## # =============================================================================~ +** Processing line: ~ def how_to_create_buttons args~ +** Processing line: ~ # Define a button style~ +** Processing line: ~ args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 }~ +** Processing line: ~ args.state.label_style = { r: 80, g: 80, b: 80 }~ +** Processing line: ~~ +** Processing line: ~ # Render instructions~ +** Processing line: ~ args.state.button_message ||= "Press a Button!"~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(args.state.label_style)~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 62,~ +** Processing line: ~ text: args.state.button_message,~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # Creates button one using a border and a label~ +** Processing line: ~ args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)~ +** Processing line: ~ args.lowrez.borders << args.state.button_one_border~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(args.state.label_style)~ +** Processing line: ~ .merge(x: args.state.button_one_border.x + 2,~ +** Processing line: ~ y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ +** Processing line: ~ text: "Button One")~ +** Processing line: ~~ +** Processing line: ~ # Creates button two using a border and a label~ +** Processing line: ~ args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)~ +** Processing line: ~~ +** Processing line: ~ args.lowrez.borders << args.state.button_two_border~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(args.state.label_style)~ +** Processing line: ~ .merge(x: args.state.button_two_border.x + 2,~ +** Processing line: ~ y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2,~ +** Processing line: ~ text: "Button Two")~ +** Processing line: ~~ +** Processing line: ~ # Initialize the state variable that tracks which button was clicked to "" (empty stringI~ +** Processing line: ~ args.state.last_button_clicked ||= "--"~ +** Processing line: ~~ +** Processing line: ~ # If a click occurs, check to see if either button one, or button two was clicked~ +** Processing line: ~ # using the inside_rect? method of the mouse~ +** Processing line: ~ # set args.state.last_button_clicked accordingly~ +** Processing line: ~ if args.lowrez.mouse_click~ +** Processing line: ~ if args.lowrez.mouse_click.inside_rect? args.state.button_one_border~ +** Processing line: ~ args.state.last_button_clicked = "One Clicked!"~ +** Processing line: ~ elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border~ +** Processing line: ~ args.state.last_button_clicked = "Two Clicked!"~ +** Processing line: ~ else~ +** Processing line: ~ args.state.last_button_clicked = "--"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Render the current value of args.state.last_button_clicked~ +** Processing line: ~ args.lowrez.labels << args.lowrez~ +** Processing line: ~ .default_label~ +** Processing line: ~ .merge(args.state.label_style)~ +** Processing line: ~ .merge(x: 32,~ +** Processing line: ~ y: 5,~ +** Processing line: ~ text: args.state.last_button_clicked,~ +** Processing line: ~ alignment_enum: 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ def render_debug args~ +** Processing line: ~ if !args.state.grid_rendered~ +** Processing line: ~ 65.map_with_index do |i|~ +** Processing line: ~ args.outputs.static_debug << {~ +** Processing line: ~ x: LOWREZ_X_OFFSET,~ +** Processing line: ~ y: LOWREZ_Y_OFFSET + (i * 10),~ +** Processing line: ~ x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE,~ +** Processing line: ~ y2: LOWREZ_Y_OFFSET + (i * 10),~ +** Processing line: ~ r: 128,~ +** Processing line: ~ g: 128,~ +** Processing line: ~ b: 128,~ +** Processing line: ~ a: 80~ +** Processing line: ~ }.line~ +** Processing line: ~~ +** Processing line: ~ args.outputs.static_debug << {~ +** Processing line: ~ x: LOWREZ_X_OFFSET + (i * 10),~ +** Processing line: ~ y: LOWREZ_Y_OFFSET,~ +** Processing line: ~ x2: LOWREZ_X_OFFSET + (i * 10),~ +** Processing line: ~ y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE,~ +** Processing line: ~ r: 128,~ +** Processing line: ~ g: 128,~ +** Processing line: ~ b: 128,~ +** Processing line: ~ a: 80~ +** Processing line: ~ }.line~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.grid_rendered = true~ +** Processing line: ~~ +** Processing line: ~ args.state.last_click ||= 0~ +** Processing line: ~ args.state.last_up ||= 0~ +** Processing line: ~ args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click~ +** Processing line: ~ args.state.last_up = args.state.tick_count if args.lowrez.mouse_up~ +** Processing line: ~ args.state.label_style = { size_enum: -1.5 }~ +** Processing line: ~~ +** Processing line: ~ args.state.watch_list = [~ +** Processing line: ~ "args.state.tick_count is: #{args.state.tick_count}",~ +** Processing line: ~ "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}",~ +** Processing line: ~ "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}",~ +** Processing line: ~ "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}",~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << args.state~ +** Processing line: ~ .watch_list~ +** Processing line: ~ .map_with_index do |text, i|~ +** Processing line: ~ {~ +** Processing line: ~ x: 5,~ +** Processing line: ~ y: 720 - (i * 20),~ +** Processing line: ~ text: text,~ +** Processing line: ~ size_enum: -1.5~ +** Processing line: ~ }.label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << {~ +** Processing line: ~ x: 640,~ +** Processing line: ~ y: 25,~ +** Processing line: ~ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",~ +** Processing line: ~ size_enum: -0.5,~ +** Processing line: ~ alignment_enum: 1~ +** Processing line: ~ }.label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Clepto Frog - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Clepto Frog - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/main.rb~ +** Processing line: ~ MAP_FILE_PATH = 'app/map.txt'~ +** Processing line: ~~ +** Processing line: ~ require 'app/map.rb'~ +** Processing line: ~~ +** Processing line: ~ class CleptoFrog~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def render_ending~ +** Processing line: ~ state.game_over_at ||= state.tick_count~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 120)~ +** Processing line: ~ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 240)~ +** Processing line: ~ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 360)~ +** Processing line: ~ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ +** Processing line: ~ "sprites/square-green.png"]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]~ +** Processing line: ~ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= (state.game_over_at + 550)~ +** Processing line: ~ restart_game~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def restart_game~ +** Processing line: ~ state.world = nil~ +** Processing line: ~ state.x = nil~ +** Processing line: ~ state.y = nil~ +** Processing line: ~ state.dx = nil~ +** Processing line: ~ state.dy = nil~ +** Processing line: ~ state.stuff_score = 0~ +** Processing line: ~ state.stuff_time = 0~ +** Processing line: ~ state.intro_tick_count = nil~ +** Processing line: ~ defaults~ +** Processing line: ~ state.game_start_at = state.tick_count~ +** Processing line: ~ state.scene = :game~ +** Processing line: ~ state.game_over_at = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_intro~ +** Processing line: ~ outputs.labels << [640, 700, "Clepto Frog", 4, 1]~ +** Processing line: ~ if state.tick_count >= 120~ +** Processing line: ~ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 120.ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= 240~ +** Processing line: ~ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 240.ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= 360~ +** Processing line: ~ outputs.labels << [640, 540, "\"Uh...\" - New Guy",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 360.ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= 480~ +** Processing line: ~ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 480.ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count >= 600~ +** Processing line: ~ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",~ +** Processing line: ~ 4, 1, 0, 0, 0, 255 * 600.ease(60)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << [640 - 50, 360 - 50, 100, 100,~ +** Processing line: ~ "sprites/square-green.png"]~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count == 800~ +** Processing line: ~ state.scene = :game~ +** Processing line: ~ state.game_start_at = state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ if state.scene == :intro && state.tick_count <= 800~ +** Processing line: ~ render_intro~ +** Processing line: ~ elsif state.scene == :ending~ +** Processing line: ~ render_ending~ +** Processing line: ~ else~ +** Processing line: ~ render~ +** Processing line: ~ end~ +** Processing line: ~ calc~ +** Processing line: ~ process_inputs~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ state.scene ||= :intro~ +** Processing line: ~ state.stuff_score ||= 0~ +** Processing line: ~ state.stuff_time ||= 0~ +** Processing line: ~ state.stuff_best_time ||= nil~ +** Processing line: ~ state.camera_x ||= 0~ +** Processing line: ~ state.camera_y ||= 0~ +** Processing line: ~ state.target_camera_scale ||= 1~ +** Processing line: ~ state.camera_scale ||= 1~ +** Processing line: ~ state.tongue_length ||= 100~ +** Processing line: ~ state.dev_action ||= :collision_mode~ +** Processing line: ~ state.action ||= :aiming~ +** Processing line: ~ state.tongue_angle ||= 90~ +** Processing line: ~ state.tile_size = 64~ +** Processing line: ~ state.gravity = -0.1~ +** Processing line: ~ state.air = -0.01~ +** Processing line: ~ state.player_width = 60~ +** Processing line: ~ state.player_height = 60~ +** Processing line: ~ state.collision_tolerance = 0.0~ +** Processing line: ~ state.previous_tile_size ||= state.tile_size~ +** Processing line: ~ state.x ||= 2400~ +** Processing line: ~ state.y ||= 200~ +** Processing line: ~ state.dy ||= 0~ +** Processing line: ~ state.dx ||= 0~ +** Processing line: ~ attempt_load_world_from_file~ +** Processing line: ~ state.world_lookup ||= { }~ +** Processing line: ~ state.world_collision_rects ||= []~ +** Processing line: ~ state.mode ||= :creating~ +** Processing line: ~ state.select_menu ||= [0, 720, 1280, 720]~ +** Processing line: ~ state.sprite_quantity ||= 20~ +** Processing line: ~ state.sprite_coords ||= []~ +** Processing line: ~ state.banner_coords ||= [640, 680 + 720]~ +** Processing line: ~ state.sprite_selected ||= 1~ +** Processing line: ~ state.map_saved_at ||= 0~ +** Processing line: ~ state.intro_tick_count ||= state.tick_count~ +** Processing line: ~ if state.sprite_coords == []~ +** Processing line: ~ count = 1~ +** Processing line: ~ temp_x = 165~ +** Processing line: ~ temp_y = 500 + 720~ +** Processing line: ~ state.sprite_quantity.times do~ +** Processing line: ~ state.sprite_coords += [[temp_x, temp_y, count]]~ +** Processing line: ~ temp_x += 100~ +** Processing line: ~ count += 1~ +** Processing line: ~ if temp_x > 1280 - (165 + 50)~ +** Processing line: ~ temp_x = 165~ +** Processing line: ~ temp_y -= 75~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def start_of_tongue x = nil, y = nil~ +** Processing line: ~ x ||= state.x~ +** Processing line: ~ y ||= state.y~ +** Processing line: ~ [~ +** Processing line: ~ x + state.player_width.half,~ +** Processing line: ~ y + state.player_height.half~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def stage_definition~ +** Processing line: ~ outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ stage_definition~ +** Processing line: ~ start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]~ +** Processing line: ~ end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]~ +** Processing line: ~~ +** Processing line: ~ if state.anchor_point~ +** Processing line: ~ anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]~ +** Processing line: ~ outputs.sprites << { x: start_of_tongue_render.x,~ +** Processing line: ~ y: start_of_tongue_render.y,~ +** Processing line: ~ w: vw(2),~ +** Processing line: ~ h: args.geometry.distance(start_of_tongue_render, anchor_point_render),~ +** Processing line: ~ path: 'sprites/square-pink.png',~ +** Processing line: ~ angle_anchor_y: 0,~ +** Processing line: ~ angle: state.tongue_angle - 90 }~ +** Processing line: ~ else~ +** Processing line: ~ outputs.sprites << { x: vx(start_of_tongue.x),~ +** Processing line: ~ y: vy(start_of_tongue.y),~ +** Processing line: ~ w: vw(2),~ +** Processing line: ~ h: vh(state.tongue_length),~ +** Processing line: ~ path: 'sprites/square-pink.png',~ +** Processing line: ~ angle_anchor_y: 0,~ +** Processing line: ~ angle: state.tongue_angle - 90 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }~ +** Processing line: ~~ +** Processing line: ~ if state.god_mode~ +** Processing line: ~ # SHOW HIDE COLLISIONS~ +** Processing line: ~ outputs.sprites << state.world.map do |x, y, w, h|~ +** Processing line: ~ x = vx(x)~ +** Processing line: ~ y = vy(y)~ +** Processing line: ~ if x > -80 && x < 1280 && y > -80 && y < 720~ +** Processing line: ~ {~ +** Processing line: ~ x: x,~ +** Processing line: ~ y: y,~ +** Processing line: ~ w: vw(w || state.tile_size),~ +** Processing line: ~ h: vh(h || state.tile_size),~ +** Processing line: ~ path: 'sprites/square-gray.png',~ +** Processing line: ~ a: 128~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ render_player~ +** Processing line: ~ outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]~ +** Processing line: ~~ +** Processing line: ~ # Label in top left of the screen~ +** Processing line: ~ outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid~ +** Processing line: ~ outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label~ +** Processing line: ~ outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label~ +** Processing line: ~~ +** Processing line: ~ if state.god_mode~ +** Processing line: ~ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120~ +** Processing line: ~ outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ # Creates sprite following mouse to help indicate which sprite you have selected~ +** Processing line: ~ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,~ +** Processing line: ~ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ render_mini_map~ +** Processing line: ~ outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_mini_map~ +** Processing line: ~ x, y = 1170, 10~ +** Processing line: ~ outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid~ +** Processing line: ~ outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid~ +** Processing line: ~ t_start = start_of_tongue~ +** Processing line: ~ t_end = end_of_tongue~ +** Processing line: ~ outputs.primitives << [~ +** Processing line: ~ x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),~ +** Processing line: ~ x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),~ +** Processing line: ~ 255, 255, 255~ +** Processing line: ~ ].line~ +** Processing line: ~~ +** Processing line: ~ state.objects.each do |o|~ +** Processing line: ~ outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_camera percentage_override = nil~ +** Processing line: ~ percentage = percentage_override || (0.2 * state.camera_scale)~ +** Processing line: ~ target_scale = state.target_camera_scale~ +** Processing line: ~ distance_scale = target_scale - state.camera_scale~ +** Processing line: ~ state.camera_scale += distance_scale * percentage~ +** Processing line: ~~ +** Processing line: ~ target_x = state.x * state.target_camera_scale~ +** Processing line: ~ target_y = state.y * state.target_camera_scale~ +** Processing line: ~~ +** Processing line: ~ distance_x = target_x - (state.camera_x + 640)~ +** Processing line: ~ distance_y = target_y - (state.camera_y + 360)~ +** Processing line: ~ state.camera_x += distance_x * percentage if distance_x.abs > 1~ +** Processing line: ~ state.camera_y += distance_y * percentage if distance_y.abs > 1~ +** Processing line: ~ state.camera_x = 0 if state.camera_x < 0~ +** Processing line: ~ state.camera_y = 0 if state.camera_y < 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def vx x~ +** Processing line: ~ (x * state.camera_scale) - state.camera_x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def vy y~ +** Processing line: ~ (y * state.camera_scale) - state.camera_y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def vw w~ +** Processing line: ~ w * state.camera_scale~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def vh h~ +** Processing line: ~ h * state.camera_scale~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_camera~ +** Processing line: ~ calc_world_lookup~ +** Processing line: ~ calc_player~ +** Processing line: ~ calc_on_floor~ +** Processing line: ~ calc_score~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_camera_scale v = nil~ +** Processing line: ~ return if v < 0.1~ +** Processing line: ~ state.target_camera_scale = v~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs_god_mode~ +** Processing line: ~ return unless state.god_mode~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))~ +** Processing line: ~ set_camera_scale state.camera_scale + 0.1~ +** Processing line: ~ elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))~ +** Processing line: ~ set_camera_scale state.camera_scale - 0.1~ +** Processing line: ~ elsif inputs.keyboard.eight || inputs.keyboard.zero~ +** Processing line: ~ set_camera_scale 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if input_up?~ +** Processing line: ~ state.y += 10~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ elsif input_down?~ +** Processing line: ~ state.y -= 10~ +** Processing line: ~ state.dy = 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if input_left?~ +** Processing line: ~ state.x -= 10~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ elsif input_right?~ +** Processing line: ~ state.x += 10~ +** Processing line: ~ state.dx = 0~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ if state.scene == :game~ +** Processing line: ~ process_inputs_player_movement~ +** Processing line: ~ process_inputs_god_mode~ +** Processing line: ~ elsif state.scene == :intro~ +** Processing line: ~ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space~ +** Processing line: ~ if Kernel.tick_count < 600~ +** Processing line: ~ Kernel.tick_count = 600~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_up?~ +** Processing line: ~ inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_up_released?~ +** Processing line: ~ inputs.keyboard.key_up.w ||~ +** Processing line: ~ inputs.keyboard.key_up.up ||~ +** Processing line: ~ inputs.keyboard.key_up.k~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_down?~ +** Processing line: ~ inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_down_released?~ +** Processing line: ~ inputs.keyboard.key_up.s ||~ +** Processing line: ~ inputs.keyboard.key_up.down ||~ +** Processing line: ~ inputs.keyboard.key_up.j~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_left?~ +** Processing line: ~ inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_right?~ +** Processing line: ~ inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_object path, w, h~ +** Processing line: ~ state.object = path~ +** Processing line: ~ state.object_w = w~ +** Processing line: ~ state.object_h = h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def collision_mode~ +** Processing line: ~ state.dev_action = :collision_mode~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs_player_movement~ +** Processing line: ~ if inputs.keyboard.key_down.g~ +** Processing line: ~ state.god_mode = !state.god_mode~ +** Processing line: ~ puts state.god_mode~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.key_down.u && state.dev_action == :collision_mode~ +** Processing line: ~ state.world = state.world[0..-2]~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.key_down.space && !state.anchor_point~ +** Processing line: ~ state.tongue_length = 0~ +** Processing line: ~ state.action = :shooting~ +** Processing line: ~ outputs.sounds << 'sounds/shooting.wav'~ +** Processing line: ~ elsif inputs.keyboard.key_down.space~ +** Processing line: ~ state.action = :aiming~ +** Processing line: ~ state.anchor_point = nil~ +** Processing line: ~ state.tongue_length = 100~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.anchor_point~ +** Processing line: ~ if input_up?~ +** Processing line: ~ if state.tongue_length >= 105~ +** Processing line: ~ state.tongue_length -= 5~ +** Processing line: ~ state.dy += 0.8~ +** Processing line: ~ end~ +** Processing line: ~ elsif input_down?~ +** Processing line: ~ state.tongue_length += 5~ +** Processing line: ~ state.dy -= 0.8~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if input_left? && state.dx > 1~ +** Processing line: ~ state.dx *= 0.98~ +** Processing line: ~ elsif input_left? && state.dx < -1~ +** Processing line: ~ state.dx *= 1.03~ +** Processing line: ~ elsif input_left? && !state.on_floor~ +** Processing line: ~ state.dx -= 3~ +** Processing line: ~ elsif input_right? && state.dx > 1~ +** Processing line: ~ state.dx *= 1.03~ +** Processing line: ~ elsif input_right? && state.dx < -1~ +** Processing line: ~ state.dx *= 0.98~ +** Processing line: ~ elsif input_right? && !state.on_floor~ +** Processing line: ~ state.dx += 3~ +** Processing line: ~ end~ +** Processing line: ~ else~ +** Processing line: ~ if input_left?~ +** Processing line: ~ state.tongue_angle += 1.5~ +** Processing line: ~ state.tongue_angle = state.tongue_angle~ +** Processing line: ~ elsif input_right?~ +** Processing line: ~ state.tongue_angle -= 1.5~ +** Processing line: ~ state.tongue_angle = state.tongue_angle~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def add_floors~ +** Processing line: ~ # floors~ +** Processing line: ~ state.world += [~ +** Processing line: ~ [0, 0, 10000, 40],~ +** Processing line: ~ [0, 1670, 3250, 60],~ +** Processing line: ~ [6691, 1653, 3290, 60],~ +** Processing line: ~ [1521, 3792, 7370, 60],~ +** Processing line: ~ [0, 5137, 3290, 60]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def attempt_load_world_from_file~ +** Processing line: ~ return if state.world~ +** Processing line: ~ # exported_world = gtk.read_file(MAP_FILE_PATH)~ +** Processing line: ~ state.world = []~ +** Processing line: ~ state.objects = []~ +** Processing line: ~~ +** Processing line: ~ if $collisions~ +** Processing line: ~ $collisions.map do |x, y, w, h|~ +** Processing line: ~ state.world << [x, y, w, h]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ add_floors~ +** Processing line: ~ # elsif exported_world~ +** Processing line: ~ # exported_world.each_line.map do |l|~ +** Processing line: ~ # tokens = l.strip.split(',')~ +** Processing line: ~ # x = tokens[0].to_i~ +** Processing line: ~ # y = tokens[1].to_i~ +** Processing line: ~ # type = tokens[2].to_i~ +** Processing line: ~ # if type == 1~ +** Processing line: ~ # state.world << [x, y, state.tile_size, state.tile_size]~ +** Processing line: ~ # elsif type == 2~ +** Processing line: ~ # w, h, path = tokens[3..-1]~ +** Processing line: ~ # state.objects << [x, y, w.to_i, h.to_i, path]~ +** Processing line: ~ # end~ +** Processing line: ~ # end~ +** Processing line: ~~ +** Processing line: ~ # add_floors~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if $mugs~ +** Processing line: ~ $mugs.map do |x, y, w, h, path|~ +** Processing line: ~ state.objects << [x, y, w, h, path]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_world_lookup~ +** Processing line: ~ if state.tile_size != state.previous_tile_size~ +** Processing line: ~ state.previous_tile_size = state.tile_size~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return if state.world_lookup.keys.length > 0~ +** Processing line: ~ return unless state.world.length > 0~ +** Processing line: ~~ +** Processing line: ~ # Searches through the world and finds the cordinates that exist~ +** Processing line: ~ state.world_lookup = {}~ +** Processing line: ~ state.world.each do |x, y, w, h|~ +** Processing line: ~ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Assigns collision rects for every sprite drawn~ +** Processing line: ~ state.world_collision_rects =~ +** Processing line: ~ state.world_lookup~ +** Processing line: ~ .keys~ +** Processing line: ~ .map do |x, y, w, h|~ +** Processing line: ~ s = state.tile_size~ +** Processing line: ~ w ||= s~ +** Processing line: ~ h ||= s~ +** Processing line: ~ {~ +** Processing line: ~ args: [x, y, w, h],~ +** Processing line: ~ left_right: [x, y + 4, w, h - 6],~ +** Processing line: ~ top: [x + 4, y + 6, w - 8, h - 6],~ +** Processing line: ~ bottom: [x + 1, y - 1, w - 2, h - 8],~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_pendulum~ +** Processing line: ~ return if !state.anchor_point~ +** Processing line: ~ target_x = state.anchor_point.x - start_of_tongue.x~ +** Processing line: ~ target_y = state.anchor_point.y -~ +** Processing line: ~ state.tongue_length - 5 - 20 - state.player_height~ +** Processing line: ~~ +** Processing line: ~ diff_y = state.y - target_y~ +** Processing line: ~~ +** Processing line: ~ if target_x > 0~ +** Processing line: ~ state.dx += 0.6~ +** Processing line: ~ elsif target_x < 0~ +** Processing line: ~ state.dx -= 0.6~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if diff_y > 0~ +** Processing line: ~ state.dy -= 0.1~ +** Processing line: ~ elsif diff_y < 0~ +** Processing line: ~ state.dy += 0.1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.dx *= 0.99~ +** Processing line: ~~ +** Processing line: ~ if state.dy.abs < 2~ +** Processing line: ~ state.dy *= 0.8~ +** Processing line: ~ else~ +** Processing line: ~ state.dy *= 0.90~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.tongue_length && state.y~ +** Processing line: ~ state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_tongue_angle~ +** Processing line: ~ return unless state.anchor_point~ +** Processing line: ~ state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue~ +** Processing line: ~ state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)~ +** Processing line: ~ state.tongue_length = state.tongue_length.greater(100)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_from_end_of_tongue~ +** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ +** Processing line: ~ derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]~ +** Processing line: ~ derived_start.x -= state.player_width.half~ +** Processing line: ~ derived_start.y -= state.player_height.half~ +** Processing line: ~ derived_start~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def end_of_tongue~ +** Processing line: ~ p = state.tongue_angle.vector(state.tongue_length)~ +** Processing line: ~ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_shooting~ +** Processing line: ~ return unless state.action == :shooting~ +** Processing line: ~ state.tongue_length += 30~ +** Processing line: ~ potential_anchor = end_of_tongue~ +** Processing line: ~ if potential_anchor.x <= 0~ +** Processing line: ~ state.anchor_point = potential_anchor~ +** Processing line: ~ state.action = :anchored~ +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +** Processing line: ~ elsif potential_anchor.x >= 10000~ +** Processing line: ~ state.anchor_point = potential_anchor~ +** Processing line: ~ state.action = :anchored~ +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +** Processing line: ~ elsif potential_anchor.y <= 0~ +** Processing line: ~ state.anchor_point = potential_anchor~ +** Processing line: ~ state.action = :anchored~ +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +** Processing line: ~ elsif potential_anchor.y >= 5875~ +** Processing line: ~ state.anchor_point = potential_anchor~ +** Processing line: ~ state.action = :anchored~ +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +** Processing line: ~ else~ +** Processing line: ~ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]~ +** Processing line: ~ collision = state.world_collision_rects.find_all do |v|~ +** Processing line: ~ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)~ +** Processing line: ~ end.first~ +** Processing line: ~ if collision~ +** Processing line: ~ state.anchor_point = potential_anchor~ +** Processing line: ~ state.action = :anchored~ +** Processing line: ~ outputs.sounds << 'sounds/attached.wav'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_player~ +** Processing line: ~ calc_shooting~ +** Processing line: ~ if !state.god_mode~ +** Processing line: ~ state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame~ +** Processing line: ~ state.dx += state.dx * state.air~ +** Processing line: ~ end~ +** Processing line: ~ calc_pendulum~ +** Processing line: ~ calc_box_collision~ +** Processing line: ~ calc_edge_collision~ +** Processing line: ~ if !state.god_mode~ +** Processing line: ~ state.y += state.dy~ +** Processing line: ~ state.x += state.dx~ +** Processing line: ~ end~ +** Processing line: ~ calc_tongue_angle~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_box_collision~ +** Processing line: ~ return unless state.world_lookup.keys.length > 0~ +** Processing line: ~ collision_floor~ +** Processing line: ~ collision_left~ +** Processing line: ~ collision_right~ +** Processing line: ~ collision_ceiling~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_edge_collision~ +** Processing line: ~ # Ensures that player doesn't fall below the map~ +** Processing line: ~ if next_y < 0 && state.dy < 0~ +** Processing line: ~ state.y = 0~ +** Processing line: ~ state.dy = state.dy.abs * 0.8~ +** Processing line: ~ state.collision_on_y = true~ +** Processing line: ~ # Ensures player doesn't go insanely high~ +** Processing line: ~ elsif next_y > 5875 - state.tile_size && state.dy > 0~ +** Processing line: ~ state.y = 5875 - state.tile_size~ +** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ +** Processing line: ~ state.collision_on_y = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Ensures that player remains in the horizontal range its supposed to~ +** Processing line: ~ if state.x >= 10000 - state.tile_size && state.dx > 0~ +** Processing line: ~ state.x = 10000 - state.tile_size~ +** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ +** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ elsif state.x <= 0 && state.dx < 0~ +** Processing line: ~ state.x = 0~ +** Processing line: ~ state.dx = state.dx.abs * 0.8~ +** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def next_y~ +** Processing line: ~ state.y + state.dy~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def next_x~ +** Processing line: ~ if state.dx < 0~ +** Processing line: ~ return (state.x + state.dx) - (state.tile_size - state.player_width)~ +** Processing line: ~ else~ +** Processing line: ~ return (state.x + state.dx) + (state.tile_size - state.player_width)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def collision_floor~ +** Processing line: ~ return unless state.dy <= 0~ +** Processing line: ~~ +** Processing line: ~ player_rect = [state.x, next_y, state.tile_size, state.tile_size]~ +** Processing line: ~~ +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)~ +** Processing line: ~ floor_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ +** Processing line: ~~ +** Processing line: ~ return unless floor_collisions~ +** Processing line: ~ state.y = floor_collisions[:top].top~ +** Processing line: ~ state.dy = state.dy.abs * 0.8~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def collision_left~ +** Processing line: ~ return unless state.dx < 0~ +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ +** Processing line: ~~ +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)~ +** Processing line: ~ left_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ +** Processing line: ~~ +** Processing line: ~ return unless left_side_collisions~ +** Processing line: ~ state.x = left_side_collisions[:left_right].right~ +** Processing line: ~ state.dx = state.dy.abs * 0.8~ +** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def collision_right~ +** Processing line: ~ return unless state.dx > 0~ +** Processing line: ~~ +** Processing line: ~ player_rect = [next_x, state.y, state.tile_size, state.tile_size]~ +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)~ +** Processing line: ~ right_side_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ +** Processing line: ~~ +** Processing line: ~ return unless right_side_collisions~ +** Processing line: ~ state.x = right_side_collisions[:left_right].left - state.tile_size~ +** Processing line: ~ state.dx = state.dx.abs * 0.8 * -1~ +** Processing line: ~ state.collision_on_x = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def collision_ceiling~ +** Processing line: ~ return unless state.dy > 0~ +** Processing line: ~~ +** Processing line: ~ player_rect = [state.x, next_y, state.player_width, state.player_height]~ +** Processing line: ~~ +** Processing line: ~ # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)~ +** Processing line: ~ ceil_collisions = state.world_collision_rects~ +** Processing line: ~ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }~ +** Processing line: ~ .first~ +** Processing line: ~~ +** Processing line: ~ return unless ceil_collisions~ +** Processing line: ~ state.y = ceil_collisions[:bottom].y - state.tile_size~ +** Processing line: ~ state.dy = state.dy.abs * 0.8 * -1~ +** Processing line: ~ state.collision_on_y = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_coord point~ +** Processing line: ~ # Integer divides (idiv) point.x to turn into grid~ +** Processing line: ~ # Then, you can just multiply each integer by state.tile_size~ +** Processing line: ~ # later and huzzah. Grid coordinates~ +** Processing line: ~ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def export_map~ +** Processing line: ~ export_string = state.world.map do |x, y|~ +** Processing line: ~ "#{x},#{y},1"~ +** Processing line: ~ end~ +** Processing line: ~ export_string += state.objects.map do |x, y, w, h, path|~ +** Processing line: ~ "#{x},#{y},2,#{w},#{h},#{path}"~ +** Processing line: ~ end~ +** Processing line: ~ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))~ +** Processing line: ~ state.map_saved_at = state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_export_stage~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_score~ +** Processing line: ~ return unless state.scene == :game~ +** Processing line: ~ player = [state.x, state.y, state.player_width, state.player_height]~ +** Processing line: ~ collected = state.objects.find_all { |s| s.intersect_rect? player }~ +** Processing line: ~ state.stuff_score += collected.length~ +** Processing line: ~ if collected.length > 0~ +** Processing line: ~ outputs.sounds << 'sounds/collectable.wav'~ +** Processing line: ~ end~ +** Processing line: ~ state.objects = state.objects.reject { |s| collected.include? s }~ +** Processing line: ~ state.stuff_time += 0.01~ +** Processing line: ~ if state.objects.length == 0~ +** Processing line: ~ if !state.stuff_best_time || state.stuff_time < state.stuff_best_time~ +** Processing line: ~ state.stuff_best_time = state.stuff_time~ +** Processing line: ~ end~ +** Processing line: ~ state.game_over_at = nil~ +** Processing line: ~ state.scene = :ending~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_on_floor~ +** Processing line: ~ if state.action == :anchored~ +** Processing line: ~ state.on_floor = false~ +** Processing line: ~ state.on_floor_debounce = 30~ +** Processing line: ~ else~ +** Processing line: ~ state.on_floor_debounce ||= 30~ +** Processing line: ~~ +** Processing line: ~ if state.dy.round != 0~ +** Processing line: ~ state.on_floor_debounce = 30~ +** Processing line: ~ state.on_floor = false~ +** Processing line: ~ else~ +** Processing line: ~ state.on_floor_debounce -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.on_floor_debounce <= 0~ +** Processing line: ~ state.on_floor_debounce = 0~ +** Processing line: ~ state.on_floor = true~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_player~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ angle = 0~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]~ +** Processing line: ~ if state.action == :idle~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ elsif state.action == :aiming && !state.on_floor~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]~ +** Processing line: ~ angle = state.tongue_angle - 90~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ elsif state.action == :aiming # ON THE GROUND~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ elsif state.action == :shooting && !state.on_floor~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ angle = state.tongue_angle - 90~ +** Processing line: ~ elsif state.action == :shooting~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ elsif state.action == :anchored~ +** Processing line: ~ # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]~ +** Processing line: ~ angle = state.tongue_angle - 90~ +** Processing line: ~ path = "sprites/square-green.png"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << [vx(state.x),~ +** Processing line: ~ vy(state.y),~ +** Processing line: ~ vw(state.player_width),~ +** Processing line: ~ vh(state.player_height),~ +** Processing line: ~ path,~ +** Processing line: ~ angle]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_player_old~ +** Processing line: ~ # Player~ +** Processing line: ~ if state.action == :aiming~ +** Processing line: ~ path = 'sprites\frg\idle\frog_idle.png'~ +** Processing line: ~ if state.dx > 2~ +** Processing line: ~ #directional right sprite was here but i needa redo it~ +** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ +** Processing line: ~ #directional left sprite was here but i needa redo it~ +** Processing line: ~ elsif state.dx < -2~ +** Processing line: ~ path = 'sprites\frg\anchor\frog-anchor-0.png'~ +** Processing line: ~ end~ +** Processing line: ~ outputs.sprites << [vx(state.x),~ +** Processing line: ~ vy(state.y),~ +** Processing line: ~ vw(state.player_width),~ +** Processing line: ~ vh(state.player_height),~ +** Processing line: ~ path,~ +** Processing line: ~ (state.tongue_angle - 90)]~ +** Processing line: ~ elsif state.action == :anchored || state.action == :shooting~ +** Processing line: ~ outputs.sprites << [vx(state.x),~ +** Processing line: ~ vy(state.y),~ +** Processing line: ~ vw(state.player_width),~ +** Processing line: ~ vw(state.player_height),~ +** Processing line: ~ 'sprites/animations_povfrog/frog_bwah_up.png',~ +** Processing line: ~ (state.tongue_angle - 90)]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~ $game = CleptoFrog.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ if args.state.scene == :game~ +** Processing line: ~ tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360~ +** Processing line: ~ end~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick_instructions args, text, y = 715~ +** Processing line: ~ return if args.state.key_event_occurred~ +** Processing line: ~ if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space~ +** Processing line: ~ args.state.key_event_occurred = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.debug << [0, y - 50, 1280, 60].solid~ +** Processing line: ~ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label~ +** Processing line: ~ args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Clepto Frog - map.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Clepto Frog - map.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/clepto_frog/app/map.rb~ +** Processing line: ~ $collisions = [~ +** Processing line: ~ [326, 463, 64, 64],~ +** Processing line: ~ [274, 462, 64, 64],~ +** Processing line: ~ [326, 413, 64, 64],~ +** Processing line: ~ [275, 412, 64, 64],~ +** Processing line: ~ [124, 651, 64, 64],~ +** Processing line: ~ [72, 651, 64, 64],~ +** Processing line: ~ [124, 600, 64, 64],~ +** Processing line: ~ [69, 599, 64, 64],~ +** Processing line: ~ [501, 997, 64, 64],~ +** Processing line: ~ [476, 995, 64, 64],~ +** Processing line: ~ [3224, 2057, 64, 64],~ +** Processing line: ~ [3224, 1994, 64, 64],~ +** Processing line: ~ [3225, 1932, 64, 64],~ +** Processing line: ~ [3225, 1870, 64, 64],~ ** Processing line: ~ [3226, 1806, 64, 64],~ ** Processing line: ~ [3224, 1744, 64, 64],~ ** Processing line: ~ [3225, 1689, 64, 64],~ @@ -115962,1412 +126295,5671 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ [39, 5217, 64, 64],~ ** Processing line: ~ ]~ ** Processing line: ~~ -** Processing line: ~ $mugs = [~ -** Processing line: ~ [85, 87, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [958, 1967, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [2537, 1734, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [3755, 2464, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [1548, 3273, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [2050, 220, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [854, 297, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [343, 526, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [3454, 772, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [5041, 298, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [6089, 300, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [6518, 295, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [7661, 47, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [9392, 1125, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [7298, 1152, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [5816, 1843, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [876, 3772, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [1029, 4667, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [823, 5324, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [3251, 5220, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [4747, 5282, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [9325, 5178, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [9635, 4298, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [7837, 4127, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [8651, 1971, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [6892, 2031, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [4626, 3882, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [4024, 4554, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [3925, 3337, 39, 43, "sprites/square-orange.png"],~ -** Processing line: ~ [5064, 1064, 39, 43, "sprites/square-orange.png"]~ -** Processing line: ~ ]~ +** Processing line: ~ $mugs = [~ +** Processing line: ~ [85, 87, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [958, 1967, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [2537, 1734, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [3755, 2464, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [1548, 3273, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [2050, 220, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [854, 297, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [343, 526, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [3454, 772, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [5041, 298, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [6089, 300, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [6518, 295, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [7661, 47, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [9392, 1125, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [7298, 1152, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [5816, 1843, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [876, 3772, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [1029, 4667, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [823, 5324, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [3251, 5220, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [4747, 5282, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [9325, 5178, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [9635, 4298, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [7837, 4127, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [8651, 1971, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [6892, 2031, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [4626, 3882, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [4024, 4554, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [3925, 3337, 39, 43, "sprites/square-orange.png"],~ +** Processing line: ~ [5064, 1064, 39, 43, "sprites/square-orange.png"]~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Gorillas Basic - credits.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Gorillas Basic - credits.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/CREDITS.txt~ +** Processing line: ~ code: Amir Rajan, https://twitter.com/amirrajan~ +** Processing line: ~ graphics: Nick Culbertson, https://twitter.com/MobyPixel~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Gorillas Basic - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Gorillas Basic - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/main.rb~ +** Processing line: ~ class YouSoBasicGorillas~ +** Processing line: ~ attr_accessor :outputs, :grid, :state, :inputs~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ calc~ +** Processing line: ~ process_inputs~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ outputs.background_color = [33, 32, 87]~ +** Processing line: ~ state.building_spacing = 1~ +** Processing line: ~ state.building_room_spacing = 15~ +** Processing line: ~ state.building_room_width = 10~ +** Processing line: ~ state.building_room_height = 15~ +** Processing line: ~ state.building_heights = [4, 4, 6, 8, 15, 20, 18]~ +** Processing line: ~ state.building_room_sizes = [5, 4, 6, 7]~ +** Processing line: ~ state.gravity = 0.25~ +** Processing line: ~ state.first_strike ||= :player_1~ +** Processing line: ~ state.buildings ||= []~ +** Processing line: ~ state.holes ||= []~ +** Processing line: ~ state.player_1_score ||= 0~ +** Processing line: ~ state.player_2_score ||= 0~ +** Processing line: ~ state.wind ||= 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ render_stage~ +** Processing line: ~ render_value_insertion~ +** Processing line: ~ render_gorillas~ +** Processing line: ~ render_holes~ +** Processing line: ~ render_banana~ +** Processing line: ~ render_game_over~ +** Processing line: ~ render_score~ +** Processing line: ~ render_wind~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_score~ +** Processing line: ~ outputs.primitives << [0, 0, 1280, 31, fancy_white].solid~ +** Processing line: ~ outputs.primitives << [1, 1, 1279, 29].solid~ +** Processing line: ~ outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]~ +** Processing line: ~ outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_wind~ +** Processing line: ~ outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid~ +** Processing line: ~ outputs.lines << [640, 30, 640, 0, fancy_white]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_game_over~ +** Processing line: ~ return unless state.over~ +** Processing line: ~ outputs.primitives << [grid.rect, 0, 0, 0, 200].solid~ +** Processing line: ~ outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label~ +** Processing line: ~ if state.winner == :player_1~ +** Processing line: ~ outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label~ +** Processing line: ~ else~ +** Processing line: ~ outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_stage~ +** Processing line: ~ return unless state.stage_generated~ +** Processing line: ~ return if state.stage_rendered~ +** Processing line: ~~ +** Processing line: ~ outputs.static_solids << [grid.rect, 33, 32, 87]~ +** Processing line: ~ outputs.static_solids << state.buildings.map(&:solids)~ +** Processing line: ~ state.stage_rendered = true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_gorilla gorilla, id~ +** Processing line: ~ return unless gorilla~ +** Processing line: ~ if state.banana && state.banana.owner == gorilla~ +** Processing line: ~ animation_index = state.banana.created_at.frame_index(3, 5, false)~ +** Processing line: ~ end~ +** Processing line: ~ if !animation_index~ +** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]~ +** Processing line: ~ else~ +** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_gorillas~ +** Processing line: ~ render_gorilla state.player_1, :left~ +** Processing line: ~ render_gorilla state.player_2, :right~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_value_insertion~ +** Processing line: ~ return if state.banana~ +** Processing line: ~ return if state.over~ +** Processing line: ~~ +** Processing line: ~ if state.current_turn == :player_1_angle~ +** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white]~ +** Processing line: ~ elsif state.current_turn == :player_1_velocity~ +** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white]~ +** Processing line: ~ outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]~ +** Processing line: ~ elsif state.current_turn == :player_2_angle~ +** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white]~ +** Processing line: ~ elsif state.current_turn == :player_2_velocity~ +** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white]~ +** Processing line: ~ outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_banana~ +** Processing line: ~ return unless state.banana~ +** Processing line: ~ rotation = state.tick_count.%(360) * 20~ +** Processing line: ~ rotation *= -1 if state.banana.dx > 0~ +** Processing line: ~ outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_holes~ +** Processing line: ~ outputs.sprites << state.holes.map do |s|~ +** Processing line: ~ animation_index = s.created_at.frame_index(7, 3, false)~ +** Processing line: ~ if animation_index~ +** Processing line: ~ [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]~ +** Processing line: ~ else~ +** Processing line: ~ s.sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ calc_generate_stage~ +** Processing line: ~ calc_current_turn~ +** Processing line: ~ calc_banana~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_current_turn~ +** Processing line: ~ return if state.current_turn~ +** Processing line: ~~ +** Processing line: ~ state.current_turn = :player_1_angle~ +** Processing line: ~ state.current_turn = :player_2_angle if state.first_strike == :player_2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_generate_stage~ +** Processing line: ~ return if state.stage_generated~ +** Processing line: ~~ +** Processing line: ~ state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)~ +** Processing line: ~ 8.numbers.inject(state.buildings) do |buildings, i|~ +** Processing line: ~ buildings <<~ +** Processing line: ~ building_prefab(state.building_spacing +~ +** Processing line: ~ state.buildings.last.right,~ +** Processing line: ~ *random_building_size)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ building_two = state.buildings[1]~ +** Processing line: ~ state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),~ +** Processing line: ~ building_two.h)~ +** Processing line: ~~ +** Processing line: ~ building_nine = state.buildings[-3]~ +** Processing line: ~ state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),~ +** Processing line: ~ building_nine.h)~ +** Processing line: ~ state.stage_generated = true~ +** Processing line: ~ state.wind = 1.randomize(:ratio, :sign)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_player x, y~ +** Processing line: ~ state.new_entity(:gorilla) do |p|~ +** Processing line: ~ p.x = x - 25~ +** Processing line: ~ p.y = y~ +** Processing line: ~ p.solid = [p.x, p.y, 50, 50]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_banana~ +** Processing line: ~ return unless state.banana~ +** Processing line: ~~ +** Processing line: ~ state.banana.x += state.banana.dx~ +** Processing line: ~ state.banana.dx += state.wind.fdiv(50)~ +** Processing line: ~ state.banana.y += state.banana.dy~ +** Processing line: ~ state.banana.dy -= state.gravity~ +** Processing line: ~ banana_collision = [state.banana.x, state.banana.y, 10, 10]~ +** Processing line: ~~ +** Processing line: ~ if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)~ +** Processing line: ~ state.over = true~ +** Processing line: ~ if state.banana.owner == state.player_2~ +** Processing line: ~ state.winner = :player_2~ +** Processing line: ~ else~ +** Processing line: ~ state.winner = :player_1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.player_2_score += 1~ +** Processing line: ~ elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)~ +** Processing line: ~ state.over = true~ +** Processing line: ~ if state.banana.owner == state.player_2~ +** Processing line: ~ state.winner = :player_1~ +** Processing line: ~ else~ +** Processing line: ~ state.winner = :player_2~ +** Processing line: ~ end~ +** Processing line: ~ state.player_1_score += 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.over~ +** Processing line: ~ place_hole~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return if state.holes.any? do |h|~ +** Processing line: ~ h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return unless state.banana.y < 0 || state.buildings.any? do |b|~ +** Processing line: ~ b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ place_hole~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def place_hole~ +** Processing line: ~ return unless state.banana~ +** Processing line: ~~ +** Processing line: ~ state.holes << state.new_entity(:banana) do |b|~ +** Processing line: ~ b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.banana = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs_main~ +** Processing line: ~ return if state.banana~ +** Processing line: ~ return if state.over~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.key_down.enter~ +** Processing line: ~ input_execute_turn~ +** Processing line: ~ elsif inputs.keyboard.key_down.backspace~ +** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ +** Processing line: ~ state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2]~ +** Processing line: ~ elsif inputs.keyboard.key_down.char~ +** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ +** Processing line: ~ state.as_hash[state.current_turn] += inputs.keyboard.key_down.char~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs_game_over~ +** Processing line: ~ return unless state.over~ +** Processing line: ~ return unless inputs.keyboard.key_down.truthy_keys.any?~ +** Processing line: ~ state.over = false~ +** Processing line: ~ outputs.static_solids.clear~ +** Processing line: ~ state.buildings.clear~ +** Processing line: ~ state.holes.clear~ +** Processing line: ~ state.stage_generated = false~ +** Processing line: ~ state.stage_rendered = false~ +** Processing line: ~ if state.first_strike == :player_1~ +** Processing line: ~ state.first_strike = :player_2~ +** Processing line: ~ else~ +** Processing line: ~ state.first_strike = :player_1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def process_inputs~ +** Processing line: ~ process_inputs_main~ +** Processing line: ~ process_inputs_game_over~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_execute_turn~ +** Processing line: ~ return if state.banana~ +** Processing line: ~~ +** Processing line: ~ if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)~ +** Processing line: ~ state.current_turn = :player_1_velocity~ +** Processing line: ~ elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)~ +** Processing line: ~ state.current_turn = :player_2_angle~ +** Processing line: ~ state.banana =~ +** Processing line: ~ new_banana(state.player_1,~ +** Processing line: ~ state.player_1.x + 25,~ +** Processing line: ~ state.player_1.y + 60,~ +** Processing line: ~ state.player_1_angle,~ +** Processing line: ~ state.player_1_velocity)~ +** Processing line: ~ elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)~ +** Processing line: ~ state.current_turn = :player_2_velocity~ +** Processing line: ~ elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)~ +** Processing line: ~ state.current_turn = :player_1_angle~ +** Processing line: ~ state.banana =~ +** Processing line: ~ new_banana(state.player_2,~ +** Processing line: ~ state.player_2.x + 25,~ +** Processing line: ~ state.player_2.y + 60,~ +** Processing line: ~ 180 - state.player_2_angle,~ +** Processing line: ~ state.player_2_velocity)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.banana~ +** Processing line: ~ state.player_1_angle = nil~ +** Processing line: ~ state.player_1_velocity = nil~ +** Processing line: ~ state.player_2_angle = nil~ +** Processing line: ~ state.player_2_velocity = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def random_building_size~ +** Processing line: ~ [state.building_heights.sample, state.building_room_sizes.sample]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def int? v~ +** Processing line: ~ v.to_i.to_s == v.to_s~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def random_building_color~ +** Processing line: ~ [[ 99, 0, 107],~ +** Processing line: ~ [ 35, 64, 124],~ +** Processing line: ~ [ 35, 136, 162],~ +** Processing line: ~ ].sample~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def random_window_color~ +** Processing line: ~ [[ 88, 62, 104],~ +** Processing line: ~ [253, 224, 187]].sample~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def windows_for_building starting_x, floors, rooms~ +** Processing line: ~ floors.-(1).combinations(rooms - 1).map do |floor, room|~ +** Processing line: ~ [starting_x +~ +** Processing line: ~ state.building_room_width.*(room) +~ +** Processing line: ~ state.building_room_spacing.*(room + 1),~ +** Processing line: ~ state.building_room_height.*(floor) +~ +** Processing line: ~ state.building_room_spacing.*(floor + 1),~ +** Processing line: ~ state.building_room_width,~ +** Processing line: ~ state.building_room_height,~ +** Processing line: ~ random_window_color]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def building_prefab starting_x, floors, rooms~ +** Processing line: ~ state.new_entity(:building) do |b|~ +** Processing line: ~ b.x = starting_x~ +** Processing line: ~ b.y = 0~ +** Processing line: ~ b.w = state.building_room_width.*(rooms) +~ +** Processing line: ~ state.building_room_spacing.*(rooms + 1)~ +** Processing line: ~ b.h = state.building_room_height.*(floors) +~ +** Processing line: ~ state.building_room_spacing.*(floors + 1)~ +** Processing line: ~ b.right = b.x + b.w~ +** Processing line: ~ b.rect = [b.x, b.y, b.w, b.h]~ +** Processing line: ~ b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],~ +** Processing line: ~ [b.x, b.y, b.w, b.h, random_building_color],~ +** Processing line: ~ windows_for_building(b.x, floors, rooms)]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def parse_or_clear! game_prop~ +** Processing line: ~ if int? state.as_hash[game_prop]~ +** Processing line: ~ state.as_hash[game_prop] = state.as_hash[game_prop].to_i~ +** Processing line: ~ return true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.as_hash[game_prop] = nil~ +** Processing line: ~ return false~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def new_banana owner, x, y, angle, velocity~ +** Processing line: ~ state.new_entity(:banana) do |b|~ +** Processing line: ~ b.owner = owner~ +** Processing line: ~ b.x = x~ +** Processing line: ~ b.y = y~ +** Processing line: ~ b.angle = angle % 360~ +** Processing line: ~ b.velocity = velocity / 5~ +** Processing line: ~ b.dx = b.angle.vector_x(b.velocity)~ +** Processing line: ~ b.dy = b.angle.vector_y(b.velocity)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def fancy_white~ +** Processing line: ~ [253, 252, 253]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ $you_so_basic_gorillas = YouSoBasicGorillas.new~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ $you_so_basic_gorillas.outputs = args.outputs~ +** Processing line: ~ $you_so_basic_gorillas.grid = args.grid~ +** Processing line: ~ $you_so_basic_gorillas.state = args.state~ +** Processing line: ~ $you_so_basic_gorillas.inputs = args.inputs~ +** Processing line: ~ $you_so_basic_gorillas.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Gorillas Basic - repl.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Gorillas Basic - repl.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/repl.rb~ +** Processing line: ~ begin~ +** Processing line: ~ if $gtk.args.state.current_turn == :player_1_angle~ +** Processing line: ~ $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"~ +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ elsif $gtk.args.state.current_turn == :player_2_angle~ +** Processing line: ~ $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"~ +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ else~ +** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ end~ +** Processing line: ~ rescue Exception => e~ +** Processing line: ~ puts e~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Gorillas Basic - tests.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Gorillas Basic - tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/tests.rb~ +** Processing line: ~ $gtk.reset 100~ +** Processing line: ~ $gtk.supress_framerate_warning = true~ +** Processing line: ~ $gtk.require 'app/tests/building_generation_tests.rb'~ +** Processing line: ~ $gtk.tests.start~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - Gorillas Basic - Tests - building_generation_tests.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - Gorillas Basic - Tests - building_generation_tests.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb~ +** Processing line: ~ def test_solids args, assert~ +** Processing line: ~ game = YouSoBasicGorillas.new~ +** Processing line: ~ game.outputs = args.outputs~ +** Processing line: ~ game.grid = args.grid~ +** Processing line: ~ game.state = args.state~ +** Processing line: ~ game.inputs = args.inputs~ +** Processing line: ~ game.tick~ +** Processing line: ~ assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"~ +** Processing line: ~ game.tick~ +** Processing line: ~ assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"~ +** Processing line: ~ number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)~ +** Processing line: ~ the_only_background = 1~ +** Processing line: ~ static_solids = args.outputs.static_solids.length~ +** Processing line: ~ assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - The Little Probe - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - The Little Probe - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/app/main.rb~ +** Processing line: ~ class FallingCircle~ +** Processing line: ~ attr_gtk~ +** Processing line: ~~ +** Processing line: ~ def tick~ +** Processing line: ~ fiddle~ +** Processing line: ~ defaults~ +** Processing line: ~ render~ +** Processing line: ~ input~ +** Processing line: ~ calc~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def fiddle~ +** Processing line: ~ state.gravity = -0.02~ +** Processing line: ~ circle.radius = 15~ +** Processing line: ~ circle.elasticity = 0.4~ +** Processing line: ~ camera.follow_speed = 0.4 * 0.4~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render~ +** Processing line: ~ render_stage_editor~ +** Processing line: ~ render_debug~ +** Processing line: ~ render_game~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def defaults~ +** Processing line: ~ if state.tick_count == 0~ +** Processing line: ~ outputs.sounds << "sounds/bg.ogg"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.storyline ||= [~ +** Processing line: ~ { text: "<- -> to aim, hold space to charge", distance_gate: 0 },~ +** Processing line: ~ { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },~ +** Processing line: ~ { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },~ +** Processing line: ~ { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 },~ +** Processing line: ~ { text: "jupiter's sure is beautiful...", distance_gate: 4000 },~ +** Processing line: ~ { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 },~ +** Processing line: ~ { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 },~ +** Processing line: ~ { text: "#todo... look i ran out of time -_-", distance_gate: 9000 },~ +** Processing line: ~ { text: "there's never enough time", distance_gate: 9000 },~ +** Processing line: ~ { text: "the game jam was fun though ^_^", distance_gate: 10000 },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ load_level force: args.state.tick_count == 0~ +** Processing line: ~ state.line_mode ||= :terrain~ +** Processing line: ~~ +** Processing line: ~ state.sound_index ||= 1~ +** Processing line: ~ circle.potential_lift ||= 0~ +** Processing line: ~ circle.angle ||= 90~ +** Processing line: ~ circle.check_point_at ||= -1000~ +** Processing line: ~ circle.game_over_at ||= -1000~ +** Processing line: ~ circle.x ||= -485~ +** Processing line: ~ circle.y ||= 12226~ +** Processing line: ~ circle.check_point_x ||= circle.x~ +** Processing line: ~ circle.check_point_y ||= circle.y~ +** Processing line: ~ circle.dy ||= 0~ +** Processing line: ~ circle.dx ||= 0~ +** Processing line: ~ circle.previous_dy ||= 0~ +** Processing line: ~ circle.previous_dx ||= 0~ +** Processing line: ~ circle.angle ||= 0~ +** Processing line: ~ circle.after_images ||= []~ +** Processing line: ~ circle.terrains_to_monitor ||= {}~ +** Processing line: ~ circle.impact_history ||= []~ +** Processing line: ~~ +** Processing line: ~ camera.x ||= 0~ +** Processing line: ~ camera.y ||= 0~ +** Processing line: ~ camera.target_x ||= 0~ +** Processing line: ~ camera.target_y ||= 0~ +** Processing line: ~ state.snaps ||= { }~ +** Processing line: ~ state.snap_number = 10~ +** Processing line: ~~ +** Processing line: ~ args.state.storyline_x ||= -1000~ +** Processing line: ~ args.state.storyline_y ||= -1000~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_game~ +** Processing line: ~ outputs.background_color = [0, 0, 0]~ +** Processing line: ~ outputs.sprites << [-circle.x + 1100,~ +** Processing line: ~ -circle.y - 100,~ +** Processing line: ~ 2416 * 4,~ +** Processing line: ~ 3574 * 4,~ +** Processing line: ~ 'sprites/jupiter.png']~ +** Processing line: ~ outputs.sprites << [-circle.x,~ +** Processing line: ~ -circle.y,~ +** Processing line: ~ 2416 * 4,~ +** Processing line: ~ 3574 * 4,~ +** Processing line: ~ 'sprites/level.png']~ +** Processing line: ~ outputs.sprites << state.whisp_queue~ +** Processing line: ~ render_aiming_retical~ +** Processing line: ~ render_circle~ +** Processing line: ~ render_notification~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_notification~ +** Processing line: ~ toast_length = 500~ +** Processing line: ~ if circle.game_over_at.elapsed_time < toast_length~ +** Processing line: ~ label_text = "..."~ +** Processing line: ~ elsif circle.check_point_at.elapsed_time > toast_length~ +** Processing line: ~ args.state.current_storyline = nil~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~ if circle.check_point_at &&~ +** Processing line: ~ circle.check_point_at.elapsed_time == 1 &&~ +** Processing line: ~ !args.state.current_storyline~ +** Processing line: ~ if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]~ +** Processing line: ~ args.state.current_storyline = args.state.storyline.shift[:text]~ +** Processing line: ~ args.state.distance_traveled ||= 0~ +** Processing line: ~ args.state.storyline_x = circle.x~ +** Processing line: ~ args.state.storyline_y = circle.y~ +** Processing line: ~ end~ +** Processing line: ~ return unless args.state.current_storyline~ +** Processing line: ~ end~ +** Processing line: ~ label_text = args.state.current_storyline~ +** Processing line: ~ return unless label_text~ +** Processing line: ~ x = circle.x + camera.x~ +** Processing line: ~ y = circle.y + camera.y - 40~ +** Processing line: ~ w = 900~ +** Processing line: ~ h = 30~ +** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid~ +** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border~ +** Processing line: ~ outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_aiming_retical~ +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,~ +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,~ +** Processing line: ~ 10, 10, 'sprites/circle-orange.png']~ +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ +** Processing line: ~ 10, 10, 'sprites/circle-orange.png', 0, 128]~ +** Processing line: ~ if rand > 0.9~ +** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ +** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ +** Processing line: ~ 10, 10, 'sprites/circle-white.png', 0, 128]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_circle~ +** Processing line: ~ outputs.sprites << circle.after_images.map do |ai|~ +** Processing line: ~ ai.merge(x: ai.x + state.camera.x - circle.radius,~ +** Processing line: ~ y: ai.y + state.camera.y - circle.radius,~ +** Processing line: ~ w: circle.radius * 2,~ +** Processing line: ~ h: circle.radius * 2,~ +** Processing line: ~ path: 'sprites/circle-white.png')~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.sprites << [(circle.x - circle.radius) + state.camera.x,~ +** Processing line: ~ (circle.y - circle.radius) + state.camera.y,~ +** Processing line: ~ circle.radius * 2,~ +** Processing line: ~ circle.radius * 2,~ +** Processing line: ~ 'sprites/probe.png']~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_debug~ +** Processing line: ~ return unless state.debug_mode~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]~ +** Processing line: ~ outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]~ +** Processing line: ~~ +** Processing line: ~ args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|~ +** Processing line: ~ h[:x] += state.camera.x~ +** Processing line: ~ h[:y] += state.camera.y~ +** Processing line: ~ h[:x2] += state.camera.x~ +** Processing line: ~ h[:y2] += state.camera.y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.primitives << state.terrain.find_all do |t|~ +** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ +** Processing line: ~ end.map do |t|~ +** Processing line: ~ [~ +** Processing line: ~ t.line.associate(r: 0, g: 255, b: 0) do |h|~ +** Processing line: ~ h.x += state.camera.x~ +** Processing line: ~ h.y += state.camera.y~ +** Processing line: ~ h.x2 += state.camera.x~ +** Processing line: ~ h.y2 += state.camera.y~ +** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ +** Processing line: ~ h[:r] = 255~ +** Processing line: ~ h[:g] = 0~ +** Processing line: ~ end~ +** Processing line: ~ h~ +** Processing line: ~ end,~ +** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ +** Processing line: ~ h.x += state.camera.x~ +** Processing line: ~ h.y += state.camera.y~ +** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ +** Processing line: ~ h~ +** Processing line: ~ end~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.primitives << state.lava.find_all do |t|~ +** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ +** Processing line: ~ end.map do |t|~ +** Processing line: ~ [~ +** Processing line: ~ t.line.associate(r: 0, g: 0, b: 255) do |h|~ +** Processing line: ~ h.x += state.camera.x~ +** Processing line: ~ h.y += state.camera.y~ +** Processing line: ~ h.x2 += state.camera.x~ +** Processing line: ~ h.y2 += state.camera.y~ +** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ +** Processing line: ~ h[:r] = 255~ +** Processing line: ~ h[:b] = 0~ +** Processing line: ~ end~ +** Processing line: ~ h~ +** Processing line: ~ end,~ +** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ +** Processing line: ~ h.x += state.camera.x~ +** Processing line: ~ h.y += state.camera.y~ +** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ +** Processing line: ~ h~ +** Processing line: ~ end~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if state.god_mode~ +** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ +** Processing line: ~ y: circle.rect.y + state.camera.y,~ +** Processing line: ~ g: 255)~ +** Processing line: ~ else~ +** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ +** Processing line: ~ y: circle.rect.y + state.camera.y,~ +** Processing line: ~ b: 255)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ outputs.borders << border~ +** Processing line: ~~ +** Processing line: ~ overlapping ||= {}~ +** Processing line: ~~ +** Processing line: ~ circle.impact_history.each do |h|~ +** Processing line: ~ label_mod = 300~ +** Processing line: ~ x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x~ +** Processing line: ~ y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y~ +** Processing line: ~ 10.times do~ +** Processing line: ~ if overlapping[x] && overlapping[x][y]~ +** Processing line: ~ y -= 52~ +** Processing line: ~ else~ +** Processing line: ~ break~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ overlapping[x] ||= {}~ +** Processing line: ~ overlapping[x][y] ||= true~ +** Processing line: ~ outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid~ +** Processing line: ~ outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]~ +** Processing line: ~~ +** Processing line: ~ outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if circle.floor~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0]~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]~ +** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_stage_editor~ +** Processing line: ~ return unless state.god_mode~ +** Processing line: ~ return unless state.point_one~ +** Processing line: ~ args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def trajectory body~ +** Processing line: ~ [body.x + body.dx,~ +** Processing line: ~ body.y + body.dy,~ +** Processing line: ~ body.x + body.dx * 1000,~ +** Processing line: ~ body.y + body.dy * 1000,~ +** Processing line: ~ 0, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def lengthen_line line, num~ +** Processing line: ~ line = normalize_line(line)~ +** Processing line: ~ slope = geometry.line_slope(line, replace_infinity: 10).abs~ +** Processing line: ~ if slope < 2~ +** Processing line: ~ [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash~ +** Processing line: ~ else~ +** Processing line: ~ [line.x, line.y, line.x2, line.y2].line.to_hash~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def normalize_line line~ +** Processing line: ~ if line.x > line.x2~ +** Processing line: ~ x = line.x2~ +** Processing line: ~ y = line.y2~ +** Processing line: ~ x2 = line.x~ +** Processing line: ~ y2 = line.y~ +** Processing line: ~ else~ +** Processing line: ~ x = line.x~ +** Processing line: ~ y = line.y~ +** Processing line: ~ x2 = line.x2~ +** Processing line: ~ y2 = line.y2~ +** Processing line: ~ end~ +** Processing line: ~ [x, y, x2, y2]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def rect_for_line line~ +** Processing line: ~ if line.x > line.x2~ +** Processing line: ~ x = line.x2~ +** Processing line: ~ y = line.y2~ +** Processing line: ~ x2 = line.x~ +** Processing line: ~ y2 = line.y~ +** Processing line: ~ else~ +** Processing line: ~ x = line.x~ +** Processing line: ~ y = line.y~ +** Processing line: ~ x2 = line.x2~ +** Processing line: ~ y2 = line.y2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ w = x2 - x~ +** Processing line: ~ h = y2 - y~ +** Processing line: ~~ +** Processing line: ~ if h < 0~ +** Processing line: ~ y += h~ +** Processing line: ~ h = h.abs~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if w < circle.radius~ +** Processing line: ~ x -= circle.radius~ +** Processing line: ~ w = circle.radius * 2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if h < circle.radius~ +** Processing line: ~ y -= circle.radius~ +** Processing line: ~ h = circle.radius * 2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ { x: x, y: y, w: w, h: h }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def snap_to_grid x, y, snaps~ +** Processing line: ~ snap_number = 10~ +** Processing line: ~ x = x.to_i~ +** Processing line: ~ y = y.to_i~ +** Processing line: ~~ +** Processing line: ~ x_floor = x.idiv(snap_number) * snap_number~ +** Processing line: ~ x_mod = x % snap_number~ +** Processing line: ~ x_ceil = (x.idiv(snap_number) + 1) * snap_number~ +** Processing line: ~~ +** Processing line: ~ y_floor = y.idiv(snap_number) * snap_number~ +** Processing line: ~ y_mod = y % snap_number~ +** Processing line: ~ y_ceil = (y.idiv(snap_number) + 1) * snap_number~ +** Processing line: ~~ +** Processing line: ~ if snaps[x_floor]~ +** Processing line: ~ x_result = x_floor~ +** Processing line: ~ elsif snaps[x_ceil]~ +** Processing line: ~ x_result = x_ceil~ +** Processing line: ~ elsif x_mod < snap_number.idiv(2)~ +** Processing line: ~ x_result = x_floor~ +** Processing line: ~ else~ +** Processing line: ~ x_result = x_ceil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ snaps[x_result] ||= {}~ +** Processing line: ~~ +** Processing line: ~ if snaps[x_result][y_floor]~ +** Processing line: ~ y_result = y_floor~ +** Processing line: ~ elsif snaps[x_result][y_ceil]~ +** Processing line: ~ y_result = y_ceil~ +** Processing line: ~ elsif y_mod < snap_number.idiv(2)~ +** Processing line: ~ y_result = y_floor~ +** Processing line: ~ else~ +** Processing line: ~ y_result = y_ceil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ snaps[x_result][y_result] = true~ +** Processing line: ~ return [x_result, y_result]~ +** Processing line: ~~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def snap_line line~ +** Processing line: ~ x, y, x2, y2 = line~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def string_to_line s~ +** Processing line: ~ x, y, x2, y2 = s.split(',').map(&:to_f)~ +** Processing line: ~~ +** Processing line: ~ if x > x2~ +** Processing line: ~ x2, x = x, x2~ +** Processing line: ~ y2, y = y, y2~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ x, y = snap_to_grid x, y, state.snaps~ +** Processing line: ~ x2, y2 = snap_to_grid x2, y2, state.snaps~ +** Processing line: ~ [x, y, x2, y2].line.to_hash~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def load_lines file~ +** Processing line: ~ data = gtk.read_file(file) || ""~ +** Processing line: ~ data.each_line~ +** Processing line: ~ .reject { |l| l.strip.length == 0 }~ +** Processing line: ~ .map { |l| string_to_line l }~ +** Processing line: ~ .map { |h| h.merge(rect: rect_for_line(h)) }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def load_terrain~ +** Processing line: ~ load_lines 'data/level.txt'~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def load_lava~ +** Processing line: ~ load_lines 'data/level_lava.txt'~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def load_level force: false~ +** Processing line: ~ if force~ +** Processing line: ~ state.snaps = {}~ +** Processing line: ~ state.terrain = load_terrain~ +** Processing line: ~ state.lava = load_lava~ +** Processing line: ~ else~ +** Processing line: ~ state.terrain ||= load_terrain~ +** Processing line: ~ state.lava ||= load_lava~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def save_lines lines, file~ +** Processing line: ~ s = lines.map do |l|~ +** Processing line: ~ "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"~ +** Processing line: ~ end.join("\n")~ +** Processing line: ~ gtk.write_file(file, s)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def save_level~ +** Processing line: ~ save_lines(state.terrain, 'level.txt')~ +** Processing line: ~ save_lines(state.lava, 'level_lava.txt')~ +** Processing line: ~ load_level force: true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def line_near_rect? rect, terrain~ +** Processing line: ~ geometry.intersect_rect?(rect, terrain[:rect])~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def point_within_line? point, line~ +** Processing line: ~ return false if !point~ +** Processing line: ~ return false if !line~ +** Processing line: ~ return true~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_impacts x, dx, y, dy, radius~ +** Processing line: ~ results = { }~ +** Processing line: ~ results[:x] = x~ +** Processing line: ~ results[:y] = y~ +** Processing line: ~ results[:dx] = x~ +** Processing line: ~ results[:dy] = y~ +** Processing line: ~ results[:point] = { x: x, y: y }~ +** Processing line: ~ results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }~ +** Processing line: ~ results[:trajectory] = trajectory(results)~ +** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ +** Processing line: ~ {~ +** Processing line: ~ terrain: t,~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ type: :terrain~ +** Processing line: ~ }~ +** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ +** Processing line: ~~ +** Processing line: ~ results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ +** Processing line: ~ {~ +** Processing line: ~ terrain: t,~ +** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ +** Processing line: ~ type: :lava~ +** Processing line: ~ }~ +** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ +** Processing line: ~~ +** Processing line: ~ results~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_potential_impacts~ +** Processing line: ~ impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius~ +** Processing line: ~ circle.rect = impact_results[:rect]~ +** Processing line: ~ circle.trajectory = impact_results[:trajectory]~ +** Processing line: ~ circle.impacts = impact_results[:impacts]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_terrains_to_monitor~ +** Processing line: ~ circle.impact = nil~ +** Processing line: ~ circle.impacts.each do |i|~ +** Processing line: ~ circle.terrains_to_monitor[i[:terrain]] ||= {~ +** Processing line: ~ ray_start: geometry.ray_test(circle, i[:terrain]),~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])~ +** Processing line: ~ if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]~ +** Processing line: ~ if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)~ +** Processing line: ~ circle.impact = i~ +** Processing line: ~ circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def impact_result body, impact~ +** Processing line: ~ infinity_alias = 1000~ +** Processing line: ~ r = {~ +** Processing line: ~ body: {},~ +** Processing line: ~ terrain: {},~ +** Processing line: ~ impact: {}~ +** Processing line: ~ }~ +** Processing line: ~~ +** Processing line: ~ r[:body][:line] = body.trajectory.dup~ +** Processing line: ~ r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)~ +** Processing line: ~ r[:body][:slope_sign] = r[:body][:slope].sign~ +** Processing line: ~ r[:body][:x] = body.x~ +** Processing line: ~ r[:body][:y] = body.y~ +** Processing line: ~ r[:body][:dy] = body.dy~ +** Processing line: ~ r[:body][:dx] = body.dx~ +** Processing line: ~~ +** Processing line: ~ r[:terrain][:line] = impact[:terrain].dup~ +** Processing line: ~ r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)~ +** Processing line: ~ r[:terrain][:slope_sign] = r[:terrain][:slope].sign~ +** Processing line: ~~ +** Processing line: ~ r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)~ +** Processing line: ~ r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }~ +** Processing line: ~ r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]~ +** Processing line: ~ r[:impact][:ray] = body.ray_current~ +** Processing line: ~ r[:body][:new_on_floor] = body.on_floor~ +** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ +** Processing line: ~~ +** Processing line: ~ if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3~ +** Processing line: ~ play_sound~ +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1~ +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * circle.elasticity~ +** Processing line: ~ r[:impact][:type] = :horizontal~ +** Processing line: ~ r[:body][:new_reason] = "-"~ +** Processing line: ~ elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3~ +** Processing line: ~ play_sound~ +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * 1.1~ +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ +** Processing line: ~ r[:impact][:type] = :vertical~ +** Processing line: ~ r[:body][:new_reason] = "|"~ +** Processing line: ~ else~ +** Processing line: ~ play_sound~ +** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ +** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity~ +** Processing line: ~ r[:impact][:type] = :slanted~ +** Processing line: ~ r[:body][:new_reason] = "/"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs~ +** Processing line: ~~ +** Processing line: ~ if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4~ +** Processing line: ~ r[:body][:new_dx] = 0~ +** Processing line: ~ r[:body][:new_dy] = 0~ +** Processing line: ~ r[:impact][:energy] = 0~ +** Processing line: ~ r[:body][:new_on_floor] = true~ +** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ +** Processing line: ~ r[:body][:new_reason] = "0"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],~ +** Processing line: ~ y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },~ +** Processing line: ~ r[:terrain][:line])~ +** Processing line: ~~ +** Processing line: ~ if r[:impact][:ray_next] == r[:impact][:ray]~ +** Processing line: ~ r[:body][:new_dx] *= -1~ +** Processing line: ~ r[:body][:new_dy] *= -1~ +** Processing line: ~ r[:body][:new_reason] = "clip"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ r~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def game_over!~ +** Processing line: ~ circle.x = circle.check_point_x~ +** Processing line: ~ circle.y = circle.check_point_y~ +** Processing line: ~ circle.dx = 0~ +** Processing line: ~ circle.dy = 0~ +** Processing line: ~ circle.game_over_at = state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def not_game_over!~ +** Processing line: ~ impact_history_entry = impact_result circle, circle.impact~ +** Processing line: ~ circle.impact_history << impact_history_entry~ +** Processing line: ~ circle.x -= circle.dx * 1.1~ +** Processing line: ~ circle.y -= circle.dy * 1.1~ +** Processing line: ~ circle.dx = impact_history_entry[:body][:new_dx]~ +** Processing line: ~ circle.dy = impact_history_entry[:body][:new_dy]~ +** Processing line: ~ circle.on_floor = impact_history_entry[:body][:new_on_floor]~ +** Processing line: ~~ +** Processing line: ~ if circle.on_floor~ +** Processing line: ~ circle.check_point_at = state.tick_count~ +** Processing line: ~ circle.check_point_x = circle.x~ +** Processing line: ~ circle.check_point_y = circle.y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.previous_floor = circle.floor || {}~ +** Processing line: ~ circle.floor = impact_history_entry[:body][:new_floor] || {}~ +** Processing line: ~ circle.floor_point = impact_history_entry[:impact][:point]~ +** Processing line: ~ if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)~ +** Processing line: ~ new_relative_x = if circle.dx > 0~ +** Processing line: ~ :right~ +** Processing line: ~ elsif circle.dx < 0~ +** Processing line: ~ :left~ +** Processing line: ~ else~ +** Processing line: ~ nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ new_relative_y = if circle.dy > 0~ +** Processing line: ~ :above~ +** Processing line: ~ elsif circle.dy < 0~ +** Processing line: ~ :below~ +** Processing line: ~ else~ +** Processing line: ~ nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.floor_relative_x = new_relative_x~ +** Processing line: ~ circle.floor_relative_y = new_relative_y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.impact = nil~ +** Processing line: ~ circle.terrains_to_monitor.clear~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_physics~ +** Processing line: ~ if args.state.god_mode~ +** Processing line: ~ calc_potential_impacts~ +** Processing line: ~ calc_terrains_to_monitor~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if circle.y < -700~ +** Processing line: ~ game_over~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return if state.game_over~ +** Processing line: ~ return if circle.on_floor~ +** Processing line: ~ circle.previous_dy = circle.dy~ +** Processing line: ~ circle.previous_dx = circle.dx~ +** Processing line: ~ circle.x += circle.dx~ +** Processing line: ~ circle.y += circle.dy~ +** Processing line: ~ args.state.distance_traveled ||= 0~ +** Processing line: ~ args.state.distance_traveled += circle.dx.abs + circle.dy.abs~ +** Processing line: ~ circle.dy += state.gravity~ +** Processing line: ~ calc_potential_impacts~ +** Processing line: ~ calc_terrains_to_monitor~ +** Processing line: ~ return unless circle.impact~ +** Processing line: ~ if circle.impact && circle.impact[:type] == :lava~ +** Processing line: ~ game_over!~ +** Processing line: ~ else~ +** Processing line: ~ not_game_over!~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_god_mode~ +** Processing line: ~ state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash~ +** Processing line: ~~ +** Processing line: ~ # toggle god mode~ +** Processing line: ~ if inputs.keyboard.key_down.g~ +** Processing line: ~ state.god_mode = !state.god_mode~ +** Processing line: ~ state.potential_lift = 0~ +** Processing line: ~ circle.floor = nil~ +** Processing line: ~ circle.floor_point = nil~ +** Processing line: ~ circle.floor_relative_x = nil~ +** Processing line: ~ circle.floor_relative_y = nil~ +** Processing line: ~ circle.impact = nil~ +** Processing line: ~ circle.terrains_to_monitor.clear~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ return unless state.god_mode~ +** Processing line: ~~ +** Processing line: ~ circle.x = circle.x.to_i~ +** Processing line: ~ circle.y = circle.y.to_i~ +** Processing line: ~~ +** Processing line: ~ # move god circle~ +** Processing line: ~ if inputs.keyboard.left || inputs.keyboard.a~ +** Processing line: ~ circle.x -= 20~ +** Processing line: ~ elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f~ +** Processing line: ~ circle.x += 20~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.keyboard.up || inputs.keyboard.w~ +** Processing line: ~ circle.y += 20~ +** Processing line: ~ elsif inputs.keyboard.down || inputs.keyboard.s~ +** Processing line: ~ circle.y -= 20~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # delete terrain~ +** Processing line: ~ if inputs.keyboard.key_down.x~ +** Processing line: ~ calc_terrains_to_monitor~ +** Processing line: ~ state.terrain = state.terrain.reject do |t|~ +** Processing line: ~ t[:rect].intersect_rect? circle.rect~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.lava = state.lava.reject do |t|~ +** Processing line: ~ t[:rect].intersect_rect? circle.rect~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ calc_potential_impacts~ +** Processing line: ~ save_level~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # change terrain type~ +** Processing line: ~ if inputs.keyboard.key_down.l~ +** Processing line: ~ if state.line_mode == :terrain~ +** Processing line: ~ state.line_mode = :lava~ +** Processing line: ~ else~ +** Processing line: ~ state.line_mode = :terrain~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if inputs.mouse.click && !state.point_one~ +** Processing line: ~ state.point_one = inputs.mouse.click.point~ +** Processing line: ~ elsif inputs.mouse.click && state.point_one~ +** Processing line: ~ l = [*state.point_one, *inputs.mouse.click.point]~ +** Processing line: ~ l = [l.x - state.camera.x,~ +** Processing line: ~ l.y - state.camera.y,~ +** Processing line: ~ l.x2 - state.camera.x,~ +** Processing line: ~ l.y2 - state.camera.y].line.to_hash~ +** Processing line: ~ l[:rect] = rect_for_line l~ +** Processing line: ~ if state.line_mode == :terrain~ +** Processing line: ~ state.terrain << l~ +** Processing line: ~ else~ +** Processing line: ~ state.lava << l~ +** Processing line: ~ end~ +** Processing line: ~ save_level~ +** Processing line: ~ next_x = inputs.mouse.click.point.x - 640~ +** Processing line: ~ next_y = inputs.mouse.click.point.y - 360~ +** Processing line: ~ circle.x += next_x~ +** Processing line: ~ circle.y += next_y~ +** Processing line: ~ state.point_one = nil~ +** Processing line: ~ elsif inputs.keyboard.one~ +** Processing line: ~ state.point_one = [circle.x + camera.x, circle.y+ camera.y]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # cancel chain lines~ +** Processing line: ~ if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one~ +** Processing line: ~ state.point_one = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def play_sound~ +** Processing line: ~ return if state.sound_debounce > 0~ +** Processing line: ~ state.sound_debounce = 5~ +** Processing line: ~ outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"~ +** Processing line: ~ state.sound_index += 1~ +** Processing line: ~ if state.sound_index > 21~ +** Processing line: ~ state.sound_index = 1~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input_game~ +** Processing line: ~ if inputs.keyboard.down || inputs.keyboard.space~ +** Processing line: ~ circle.potential_lift += 0.03~ +** Processing line: ~ circle.potential_lift = circle.potential_lift.lesser(10)~ +** Processing line: ~ elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space~ +** Processing line: ~ play_sound~ +** Processing line: ~ circle.dy += circle.angle.vector_y circle.potential_lift~ +** Processing line: ~ circle.dx += circle.angle.vector_x circle.potential_lift~ +** Processing line: ~~ +** Processing line: ~ if circle.on_floor~ +** Processing line: ~ if circle.floor_relative_y == :above~ +** Processing line: ~ circle.y += circle.potential_lift.abs * 2~ +** Processing line: ~ elsif circle.floor_relative_y == :below~ +** Processing line: ~ circle.y -= circle.potential_lift.abs * 2~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.on_floor = false~ +** Processing line: ~ circle.potential_lift = 0~ +** Processing line: ~ circle.terrains_to_monitor.clear~ +** Processing line: ~ circle.impact_history.clear~ +** Processing line: ~ circle.impact = nil~ +** Processing line: ~ calc_physics~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # aim probe~ +** Processing line: ~ if inputs.keyboard.right || inputs.keyboard.a~ +** Processing line: ~ circle.angle -= 2~ +** Processing line: ~ elsif inputs.keyboard.left || inputs.keyboard.d~ +** Processing line: ~ circle.angle += 2~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def input~ +** Processing line: ~ input_god_mode~ +** Processing line: ~ input_game~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_camera~ +** Processing line: ~ state.camera.target_x = 640 - circle.x~ +** Processing line: ~ state.camera.target_y = 360 - circle.y~ +** Processing line: ~ xdiff = state.camera.target_x - state.camera.x~ +** Processing line: ~ ydiff = state.camera.target_y - state.camera.y~ +** Processing line: ~ state.camera.x += xdiff * camera.follow_speed~ +** Processing line: ~ state.camera.y += ydiff * camera.follow_speed~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc~ +** Processing line: ~ state.sound_debounce ||= 0~ +** Processing line: ~ state.sound_debounce -= 1~ +** Processing line: ~ state.sound_debounce = 0 if state.sound_debounce < 0~ +** Processing line: ~ if state.god_mode~ +** Processing line: ~ circle.dy *= 0.1~ +** Processing line: ~ circle.dx *= 0.1~ +** Processing line: ~ end~ +** Processing line: ~ calc_camera~ +** Processing line: ~ state.whisp_queue ||= []~ +** Processing line: ~ if state.tick_count.mod_zero?(4)~ +** Processing line: ~ state.whisp_queue << {~ +** Processing line: ~ x: -300,~ +** Processing line: ~ y: 1400 * rand,~ +** Processing line: ~ speed: 2.randomize(:ratio) + 3,~ +** Processing line: ~ w: 20,~ +** Processing line: ~ h: 20, path: 'sprites/whisp.png',~ +** Processing line: ~ a: 0,~ +** Processing line: ~ created_at: state.tick_count,~ +** Processing line: ~ angle: 0,~ +** Processing line: ~ r: 100,~ +** Processing line: ~ g: 128 + 128 * rand,~ +** Processing line: ~ b: 128 + 128 * rand~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.whisp_queue.each do |w|~ +** Processing line: ~ w.x += w[:speed] * 2~ +** Processing line: ~ w.x -= circle.dx * 0.3~ +** Processing line: ~ w.y -= w[:speed]~ +** Processing line: ~ w.y -= circle.dy * 0.3~ +** Processing line: ~ w.angle += w[:speed]~ +** Processing line: ~ w.a = w[:created_at].ease(30) * 255~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }~ +** Processing line: ~~ +** Processing line: ~ if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)~ +** Processing line: ~ circle.after_images << {~ +** Processing line: ~ x: circle.x,~ +** Processing line: ~ y: circle.y,~ +** Processing line: ~ w: circle.radius,~ +** Processing line: ~ h: circle.radius,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ created_at: state.tick_count~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.after_images.each do |ai|~ +** Processing line: ~ ai.a = ai[:created_at].ease(10, :flip) * 255~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }~ +** Processing line: ~ calc_physics~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def circle~ +** Processing line: ~ state.circle~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def camera~ +** Processing line: ~ state.camera~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def terrain~ +** Processing line: ~ state.terrain~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def lava~ +** Processing line: ~ state.lava~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # $gtk.reset~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ if args.inputs.keyboard.r~ +** Processing line: ~ args.gtk.reset~ +** Processing line: ~ return~ +** Processing line: ~ end~ +** Processing line: ~ # uncomment the line below to slow down the game so you~ +** Processing line: ~ # can see each tick as it passes~ +** Processing line: ~ # args.gtk.slowmo! 30~ +** Processing line: ~ $game ||= FallingCircle.new~ +** Processing line: ~ $game.args = args~ +** Processing line: ~ $game.tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def reset~ +** Processing line: ~ $game = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - The Little Probe - Data - level.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - The Little Probe - Data - level.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/data/level.txt~ +** Processing line: ~ 640,8840,1180,8840~ +** Processing line: ~ -60,10220,0,9960~ +** Processing line: ~ -60,10220,0,10500~ +** Processing line: ~ 0,10500,0,10780~ +** Processing line: ~ 0,10780,40,10900~ +** Processing line: ~ 500,10920,760,10960~ +** Processing line: ~ 300,10560,820,10600~ +** Processing line: ~ 420,10320,700,10300~ +** Processing line: ~ 820,10600,1500,10600~ +** Processing line: ~ 1500,10600,1940,10600~ +** Processing line: ~ 1940,10600,2380,10580~ +** Processing line: ~ 2380,10580,2800,10620~ +** Processing line: ~ 2240,11080,2480,11020~ +** Processing line: ~ 2000,11120,2240,11080~ +** Processing line: ~ 1760,11180,2000,11120~ +** Processing line: ~ 1620,11180,1760,11180~ +** Processing line: ~ 1500,11220,1620,11180~ +** Processing line: ~ 1180,11280,1340,11220~ +** Processing line: ~ 1040,11240,1180,11280~ +** Processing line: ~ 840,11280,1040,11240~ +** Processing line: ~ 640,11280,840,11280~ +** Processing line: ~ 500,11220,640,11280~ +** Processing line: ~ 420,11140,500,11220~ +** Processing line: ~ 240,11100,420,11140~ +** Processing line: ~ 100,11120,240,11100~ +** Processing line: ~ 0,11180,100,11120~ +** Processing line: ~ -160,11220,0,11180~ +** Processing line: ~ -260,11240,-160,11220~ +** Processing line: ~ 1340,11220,1500,11220~ +** Processing line: ~ 960,13300,1280,13060~ +** Processing line: ~ 1280,13060,1540,12860~ +** Processing line: ~ 1540,12860,1820,12700~ +** Processing line: ~ 1820,12700,2080,12520~ +** Processing line: ~ 2080,12520,2240,12400~ +** Processing line: ~ 2240,12400,2240,12240~ +** Processing line: ~ 2240,12240,2400,12080~ +** Processing line: ~ 2400,12080,2560,11920~ +** Processing line: ~ 2560,11920,2640,11740~ +** Processing line: ~ 2640,11740,2740,11580~ +** Processing line: ~ 2740,11580,2800,11400~ +** Processing line: ~ 2800,11400,2800,11240~ +** Processing line: ~ 2740,11140,2800,11240~ +** Processing line: ~ 2700,11040,2740,11140~ +** Processing line: ~ 2700,11040,2740,10960~ +** Processing line: ~ 2740,10960,2740,10920~ +** Processing line: ~ 2700,10900,2740,10920~ +** Processing line: ~ 2380,10900,2700,10900~ +** Processing line: ~ 2040,10920,2380,10900~ +** Processing line: ~ 1720,10940,2040,10920~ +** Processing line: ~ 1380,11000,1720,10940~ +** Processing line: ~ 1180,10980,1380,11000~ +** Processing line: ~ 900,10980,1180,10980~ +** Processing line: ~ 760,10960,900,10980~ +** Processing line: ~ 240,10960,500,10920~ +** Processing line: ~ 40,10900,240,10960~ +** Processing line: ~ 0,9700,0,9960~ +** Processing line: ~ -60,9500,0,9700~ +** Processing line: ~ -60,9420,-60,9500~ +** Processing line: ~ -60,9420,-60,9340~ +** Processing line: ~ -60,9340,-60,9280~ +** Processing line: ~ -60,9120,-60,9280~ +** Processing line: ~ -60,8940,-60,9120~ +** Processing line: ~ -60,8940,-60,8780~ +** Processing line: ~ -60,8780,0,8700~ +** Processing line: ~ 0,8700,40,8680~ +** Processing line: ~ 40,8680,240,8700~ +** Processing line: ~ 240,8700,360,8780~ +** Processing line: ~ 360,8780,640,8840~ +** Processing line: ~ 1420,8400,1540,8480~ +** Processing line: ~ 1540,8480,1680,8500~ +** Processing line: ~ 1680,8500,1940,8460~ +** Processing line: ~ 1180,8840,1280,8880~ +** Processing line: ~ 1280,8880,1340,8860~ +** Processing line: ~ 1340,8860,1720,8860~ +** Processing line: ~ 1720,8860,1820,8920~ +** Processing line: ~ 1820,8920,1820,9140~ +** Processing line: ~ 1820,9140,1820,9280~ +** Processing line: ~ 1820,9460,1820,9280~ +** Processing line: ~ 1760,9480,1820,9460~ +** Processing line: ~ 1640,9480,1760,9480~ +** Processing line: ~ 1540,9500,1640,9480~ +** Processing line: ~ 1340,9500,1540,9500~ +** Processing line: ~ 1100,9500,1340,9500~ +** Processing line: ~ 1040,9540,1100,9500~ +** Processing line: ~ 960,9540,1040,9540~ +** Processing line: ~ 300,9420,360,9460~ +** Processing line: ~ 240,9440,300,9420~ +** Processing line: ~ 180,9600,240,9440~ +** Processing line: ~ 120,9660,180,9600~ +** Processing line: ~ 100,9820,120,9660~ +** Processing line: ~ 100,9820,120,9860~ +** Processing line: ~ 120,9860,140,9900~ +** Processing line: ~ 140,9900,140,10000~ +** Processing line: ~ 140,10440,180,10540~ +** Processing line: ~ 100,10080,140,10000~ +** Processing line: ~ 100,10080,140,10100~ +** Processing line: ~ 140,10100,140,10440~ +** Processing line: ~ 180,10540,300,10560~ +** Processing line: ~ 2140,9560,2140,9640~ +** Processing line: ~ 2140,9720,2140,9640~ +** Processing line: ~ 1880,9780,2140,9720~ +** Processing line: ~ 1720,9780,1880,9780~ +** Processing line: ~ 1620,9740,1720,9780~ +** Processing line: ~ 1500,9780,1620,9740~ +** Processing line: ~ 1380,9780,1500,9780~ +** Processing line: ~ 1340,9820,1380,9780~ +** Processing line: ~ 1200,9820,1340,9820~ +** Processing line: ~ 1100,9780,1200,9820~ +** Processing line: ~ 900,9780,1100,9780~ +** Processing line: ~ 820,9720,900,9780~ +** Processing line: ~ 540,9720,820,9720~ +** Processing line: ~ 360,9840,540,9720~ +** Processing line: ~ 360,9840,360,9960~ +** Processing line: ~ 360,9960,360,10080~ +** Processing line: ~ 360,10140,360,10080~ +** Processing line: ~ 360,10140,360,10240~ +** Processing line: ~ 360,10240,420,10320~ +** Processing line: ~ 700,10300,820,10280~ +** Processing line: ~ 820,10280,820,10280~ +** Processing line: ~ 820,10280,900,10320~ +** Processing line: ~ 900,10320,1040,10300~ +** Processing line: ~ 1040,10300,1200,10320~ +** Processing line: ~ 1200,10320,1380,10280~ +** Processing line: ~ 1380,10280,1500,10300~ +** Processing line: ~ 1500,10300,1760,10300~ +** Processing line: ~ 2800,10620,2840,10600~ +** Processing line: ~ 2840,10600,2900,10600~ +** Processing line: ~ 2900,10600,3000,10620~ +** Processing line: ~ 3000,10620,3080,10620~ +** Processing line: ~ 3080,10620,3140,10600~ +** Processing line: ~ 3140,10540,3140,10600~ +** Processing line: ~ 3140,10540,3140,10460~ +** Processing line: ~ 3140,10460,3140,10360~ +** Processing line: ~ 3140,10360,3140,10260~ +** Processing line: ~ 3140,10260,3140,10140~ +** Processing line: ~ 3140,10140,3140,10000~ +** Processing line: ~ 3140,10000,3140,9860~ +** Processing line: ~ 3140,9860,3160,9720~ +** Processing line: ~ 3160,9720,3160,9580~ +** Processing line: ~ 3160,9580,3160,9440~ +** Processing line: ~ 3160,9300,3160,9440~ +** Processing line: ~ 3160,9300,3160,9140~ +** Processing line: ~ 3160,9140,3160,8980~ +** Processing line: ~ 3160,8980,3160,8820~ +** Processing line: ~ 3160,8820,3160,8680~ +** Processing line: ~ 3160,8680,3160,8520~ +** Processing line: ~ 1760,10300,1880,10300~ +** Processing line: ~ 660,9500,960,9540~ +** Processing line: ~ 640,9460,660,9500~ +** Processing line: ~ 360,9460,640,9460~ +** Processing line: ~ -480,10760,-440,10880~ +** Processing line: ~ -480,11020,-440,10880~ +** Processing line: ~ -480,11160,-260,11240~ +** Processing line: ~ -480,11020,-480,11160~ +** Processing line: ~ -600,11420,-380,11320~ +** Processing line: ~ -380,11320,-200,11340~ +** Processing line: ~ -200,11340,0,11340~ +** Processing line: ~ 0,11340,180,11340~ +** Processing line: ~ 960,13420,960,13300~ +** Processing line: ~ 960,13420,960,13520~ +** Processing line: ~ 960,13520,1000,13560~ +** Processing line: ~ 1000,13560,1040,13540~ +** Processing line: ~ 1040,13540,1200,13440~ +** Processing line: ~ 1200,13440,1380,13380~ +** Processing line: ~ 1380,13380,1620,13300~ +** Processing line: ~ 1620,13300,1820,13220~ +** Processing line: ~ 1820,13220,2000,13200~ +** Processing line: ~ 2000,13200,2240,13200~ +** Processing line: ~ 2240,13200,2440,13160~ +** Processing line: ~ 2440,13160,2640,13040~ +** Processing line: ~ -480,10760,-440,10620~ +** Processing line: ~ -440,10620,-360,10560~ +** Processing line: ~ -380,10460,-360,10560~ +** Processing line: ~ -380,10460,-360,10300~ +** Processing line: ~ -380,10140,-360,10300~ +** Processing line: ~ -380,10140,-380,10040~ +** Processing line: ~ -380,9880,-380,10040~ +** Processing line: ~ -380,9720,-380,9880~ +** Processing line: ~ -380,9720,-380,9540~ +** Processing line: ~ -380,9360,-380,9540~ +** Processing line: ~ -380,9180,-380,9360~ +** Processing line: ~ -380,9180,-380,9000~ +** Processing line: ~ -380,8840,-380,9000~ +** Processing line: ~ -380,8840,-380,8760~ +** Processing line: ~ -380,8760,-380,8620~ +** Processing line: ~ -380,8620,-380,8520~ +** Processing line: ~ -380,8520,-360,8400~ +** Processing line: ~ -360,8400,-100,8400~ +** Processing line: ~ -100,8400,-60,8420~ +** Processing line: ~ -60,8420,240,8440~ +** Processing line: ~ 240,8440,240,8380~ +** Processing line: ~ 240,8380,500,8440~ +** Processing line: ~ 500,8440,760,8460~ +** Processing line: ~ 760,8460,1000,8400~ +** Processing line: ~ 1000,8400,1180,8420~ +** Processing line: ~ 1180,8420,1420,8400~ +** Processing line: ~ 1940,8460,2140,8420~ +** Processing line: ~ 2140,8420,2200,8520~ +** Processing line: ~ 2200,8680,2200,8520~ +** Processing line: ~ 2140,8840,2200,8680~ +** Processing line: ~ 2140,8840,2140,9020~ +** Processing line: ~ 2140,9100,2140,9020~ +** Processing line: ~ 2140,9200,2140,9100~ +** Processing line: ~ 2140,9200,2200,9320~ +** Processing line: ~ 2200,9320,2200,9440~ +** Processing line: ~ 2140,9560,2200,9440~ +** Processing line: ~ 1880,10300,2200,10280~ +** Processing line: ~ 2200,10280,2480,10260~ +** Processing line: ~ 2480,10260,2700,10240~ +** Processing line: ~ 2700,10240,2840,10180~ +** Processing line: ~ 2840,10180,2900,10060~ +** Processing line: ~ 2900,9860,2900,10060~ +** Processing line: ~ 2900,9640,2900,9860~ +** Processing line: ~ 2900,9640,2900,9500~ +** Processing line: ~ 2900,9460,2900,9500~ +** Processing line: ~ 2740,9460,2900,9460~ +** Processing line: ~ 2700,9460,2740,9460~ +** Processing line: ~ 2700,9360,2700,9460~ +** Processing line: ~ 2700,9320,2700,9360~ +** Processing line: ~ 2600,9320,2700,9320~ +** Processing line: ~ 2600,9260,2600,9320~ +** Processing line: ~ 2600,9200,2600,9260~ +** Processing line: ~ 2480,9120,2600,9200~ +** Processing line: ~ 2440,9080,2480,9120~ +** Processing line: ~ 2380,9080,2440,9080~ +** Processing line: ~ 2320,9060,2380,9080~ +** Processing line: ~ 2320,8860,2320,9060~ +** Processing line: ~ 2320,8860,2380,8840~ +** Processing line: ~ 2380,8840,2480,8860~ +** Processing line: ~ 2480,8860,2600,8840~ +** Processing line: ~ 2600,8840,2740,8840~ +** Processing line: ~ 2740,8840,2840,8800~ +** Processing line: ~ 2840,8800,2900,8700~ +** Processing line: ~ 2900,8600,2900,8700~ +** Processing line: ~ 2900,8480,2900,8600~ +** Processing line: ~ 2900,8380,2900,8480~ +** Processing line: ~ 2900,8380,2900,8260~ +** Processing line: ~ 2900,8260,2900,8140~ +** Processing line: ~ 2900,8140,2900,8020~ +** Processing line: ~ 2900,8020,2900,7900~ +** Processing line: ~ 2900,7820,2900,7900~ +** Processing line: ~ 2900,7820,2900,7740~ +** Processing line: ~ 2900,7660,2900,7740~ +** Processing line: ~ 2900,7560,2900,7660~ +** Processing line: ~ 2900,7460,2900,7560~ +** Processing line: ~ 2900,7460,2900,7360~ +** Processing line: ~ 2900,7260,2900,7360~ +** Processing line: ~ 2840,7160,2900,7260~ +** Processing line: ~ 2800,7080,2840,7160~ +** Processing line: ~ 2700,7100,2800,7080~ +** Processing line: ~ 2560,7120,2700,7100~ +** Processing line: ~ 2400,7100,2560,7120~ +** Processing line: ~ 2320,7100,2400,7100~ +** Processing line: ~ 2140,7100,2320,7100~ +** Processing line: ~ 2040,7080,2140,7100~ +** Processing line: ~ 1940,7080,2040,7080~ +** Processing line: ~ 1820,7140,1940,7080~ +** Processing line: ~ 1680,7140,1820,7140~ +** Processing line: ~ 1540,7140,1680,7140~ +** Processing line: ~ 1420,7220,1540,7140~ +** Processing line: ~ 1280,7220,1380,7220~ +** Processing line: ~ 1140,7200,1280,7220~ +** Processing line: ~ 1000,7220,1140,7200~ +** Processing line: ~ 760,7280,900,7320~ +** Processing line: ~ 540,7220,760,7280~ +** Processing line: ~ 300,7180,540,7220~ +** Processing line: ~ 180,7120,180,7160~ +** Processing line: ~ 40,7140,180,7120~ +** Processing line: ~ -60,7160,40,7140~ +** Processing line: ~ -200,7120,-60,7160~ +** Processing line: ~ 180,7160,300,7180~ +** Processing line: ~ -260,7060,-200,7120~ +** Processing line: ~ -260,6980,-260,7060~ +** Processing line: ~ -260,6880,-260,6980~ +** Processing line: ~ -260,6880,-260,6820~ +** Processing line: ~ -260,6820,-200,6760~ +** Processing line: ~ -200,6760,-100,6740~ +** Processing line: ~ -100,6740,-60,6740~ +** Processing line: ~ -60,6740,40,6740~ +** Processing line: ~ 40,6740,300,6800~ +** Processing line: ~ 300,6800,420,6760~ +** Processing line: ~ 420,6760,500,6740~ +** Processing line: ~ 500,6740,540,6760~ +** Processing line: ~ 540,6760,540,6760~ +** Processing line: ~ 540,6760,640,6780~ +** Processing line: ~ 640,6660,640,6780~ +** Processing line: ~ 580,6580,640,6660~ +** Processing line: ~ 580,6440,580,6580~ +** Processing line: ~ 580,6440,640,6320~ +** Processing line: ~ 640,6320,640,6180~ +** Processing line: ~ 580,6080,640,6180~ +** Processing line: ~ 580,6080,640,5960~ +** Processing line: ~ 640,5960,640,5840~ +** Processing line: ~ 640,5840,640,5700~ +** Processing line: ~ 640,5700,660,5560~ +** Processing line: ~ 660,5560,660,5440~ +** Processing line: ~ 660,5440,660,5300~ +** Processing line: ~ 660,5140,660,5300~ +** Processing line: ~ 660,5140,660,5000~ +** Processing line: ~ 660,5000,660,4880~ +** Processing line: ~ 660,4880,820,4860~ +** Processing line: ~ 820,4860,1000,4840~ +** Processing line: ~ 1000,4840,1100,4860~ +** Processing line: ~ 1100,4860,1280,4860~ +** Processing line: ~ 1280,4860,1420,4840~ +** Processing line: ~ 1420,4840,1580,4860~ +** Processing line: ~ 1580,4860,1720,4820~ +** Processing line: ~ 1720,4820,1880,4860~ +** Processing line: ~ 1880,4860,2000,4840~ +** Processing line: ~ 2000,4840,2140,4840~ +** Processing line: ~ 2140,4840,2320,4860~ +** Processing line: ~ 2320,4860,2440,4880~ +** Processing line: ~ 2440,4880,2600,4880~ +** Processing line: ~ 2600,4880,2800,4880~ +** Processing line: ~ 2800,4880,2900,4880~ +** Processing line: ~ 2900,4880,2900,4820~ +** Processing line: ~ 2900,4740,2900,4820~ +** Processing line: ~ 2800,4700,2900,4740~ +** Processing line: ~ 2520,4680,2800,4700~ +** Processing line: ~ 2240,4660,2520,4680~ +** Processing line: ~ 1940,4620,2240,4660~ +** Processing line: ~ 1820,4580,1940,4620~ +** Processing line: ~ 1820,4500,1820,4580~ +** Processing line: ~ 1820,4500,1880,4420~ +** Processing line: ~ 1880,4420,2000,4420~ +** Processing line: ~ 2000,4420,2200,4420~ +** Processing line: ~ 2200,4420,2400,4440~ +** Processing line: ~ 2400,4440,2600,4440~ +** Processing line: ~ 2600,4440,2840,4440~ +** Processing line: ~ 2840,4440,2900,4400~ +** Processing line: ~ 2740,4260,2900,4280~ +** Processing line: ~ 2600,4240,2740,4260~ +** Processing line: ~ 2480,4280,2600,4240~ +** Processing line: ~ 2320,4240,2480,4280~ +** Processing line: ~ 2140,4220,2320,4240~ +** Processing line: ~ 1940,4220,2140,4220~ +** Processing line: ~ 1880,4160,1940,4220~ +** Processing line: ~ 1880,4160,1880,4080~ +** Processing line: ~ 1880,4080,2040,4040~ +** Processing line: ~ 2040,4040,2240,4060~ +** Processing line: ~ 2240,4060,2400,4040~ +** Processing line: ~ 2400,4040,2600,4060~ +** Processing line: ~ 2600,4060,2740,4020~ +** Processing line: ~ 2740,4020,2840,3940~ +** Processing line: ~ 2840,3780,2840,3940~ +** Processing line: ~ 2740,3660,2840,3780~ +** Processing line: ~ 2700,3680,2740,3660~ +** Processing line: ~ 2520,3700,2700,3680~ +** Processing line: ~ 2380,3700,2520,3700~ +** Processing line: ~ 2200,3720,2380,3700~ +** Processing line: ~ 2040,3720,2200,3720~ +** Processing line: ~ 1880,3700,2040,3720~ +** Processing line: ~ 1820,3680,1880,3700~ +** Processing line: ~ 1760,3600,1820,3680~ +** Processing line: ~ 1760,3600,1820,3480~ +** Processing line: ~ 1820,3480,1880,3440~ +** Processing line: ~ 1880,3440,1960,3460~ +** Processing line: ~ 1960,3460,2140,3460~ +** Processing line: ~ 2140,3460,2380,3460~ +** Processing line: ~ 2380,3460,2640,3440~ +** Processing line: ~ 2640,3440,2900,3380~ +** Processing line: ~ 2840,3280,2900,3380~ +** Processing line: ~ 2840,3280,2900,3200~ +** Processing line: ~ 2900,3200,2900,3140~ +** Processing line: ~ 2840,3020,2900,3140~ +** Processing line: ~ 2800,2960,2840,3020~ +** Processing line: ~ 2700,3000,2800,2960~ +** Processing line: ~ 2600,2980,2700,3000~ +** Processing line: ~ 2380,3000,2600,2980~ +** Processing line: ~ 2140,3000,2380,3000~ +** Processing line: ~ 1880,3000,2140,3000~ +** Processing line: ~ 1720,3040,1880,3000~ +** Processing line: ~ 1640,2960,1720,3040~ +** Processing line: ~ 1500,2940,1640,2960~ +** Processing line: ~ 1340,3000,1500,2940~ +** Processing line: ~ 1240,3000,1340,3000~ +** Processing line: ~ 1140,3020,1240,3000~ +** Processing line: ~ 1040,3000,1140,3020~ +** Processing line: ~ 960,2960,1040,3000~ +** Processing line: ~ 900,2960,960,2960~ +** Processing line: ~ 840,2840,900,2960~ +** Processing line: ~ 700,2820,840,2840~ +** Processing line: ~ 540,2820,700,2820~ +** Processing line: ~ 420,2820,540,2820~ +** Processing line: ~ 180,2800,420,2820~ +** Processing line: ~ 60,2780,180,2800~ +** Processing line: ~ -60,2800,60,2780~ +** Processing line: ~ -160,2760,-60,2800~ +** Processing line: ~ -260,2740,-160,2760~ +** Processing line: ~ -300,2640,-260,2740~ +** Processing line: ~ -360,2560,-300,2640~ +** Processing line: ~ -380,2460,-360,2560~ +** Processing line: ~ -380,2460,-300,2380~ +** Processing line: ~ -300,2300,-300,2380~ +** Processing line: ~ -300,2300,-300,2220~ +** Processing line: ~ -300,2100,-300,2220~ +** Processing line: ~ -300,2100,-300,2040~ +** Processing line: ~ -300,2040,-160,2040~ +** Processing line: ~ -160,2040,-60,2040~ +** Processing line: ~ -60,2040,60,2040~ +** Processing line: ~ 60,2040,180,2040~ +** Processing line: ~ 180,2040,360,2040~ +** Processing line: ~ 360,2040,540,2040~ +** Processing line: ~ 540,2040,700,2080~ +** Processing line: ~ 660,2160,700,2080~ +** Processing line: ~ 660,2160,700,2260~ +** Processing line: ~ 660,2380,700,2260~ +** Processing line: ~ 500,2340,660,2380~ +** Processing line: ~ 360,2340,500,2340~ +** Processing line: ~ 240,2340,360,2340~ +** Processing line: ~ 40,2320,240,2340~ +** Processing line: ~ -60,2320,40,2320~ +** Processing line: ~ -100,2380,-60,2320~ +** Processing line: ~ -100,2380,-100,2460~ +** Processing line: ~ -100,2460,-100,2540~ +** Processing line: ~ -100,2540,0,2560~ +** Processing line: ~ 0,2560,140,2600~ +** Processing line: ~ 140,2600,300,2600~ +** Processing line: ~ 300,2600,460,2600~ +** Processing line: ~ 460,2600,640,2600~ +** Processing line: ~ 640,2600,760,2580~ +** Processing line: ~ 760,2580,820,2560~ +** Processing line: ~ 820,2560,820,2500~ +** Processing line: ~ 820,2500,820,2400~ +** Processing line: ~ 820,2400,840,2320~ +** Processing line: ~ 840,2320,840,2240~ +** Processing line: ~ 820,2120,840,2240~ +** Processing line: ~ 820,2020,820,2120~ +** Processing line: ~ 820,1900,820,2020~ +** Processing line: ~ 760,1840,820,1900~ +** Processing line: ~ 640,1840,760,1840~ +** Processing line: ~ 500,1840,640,1840~ +** Processing line: ~ 300,1860,420,1880~ +** Processing line: ~ 180,1840,300,1860~ +** Processing line: ~ 420,1880,500,1840~ +** Processing line: ~ 0,1840,180,1840~ +** Processing line: ~ -60,1860,0,1840~ +** Processing line: ~ -160,1840,-60,1860~ +** Processing line: ~ -200,1800,-160,1840~ +** Processing line: ~ -260,1760,-200,1800~ +** Processing line: ~ -260,1680,-260,1760~ +** Processing line: ~ -260,1620,-260,1680~ +** Processing line: ~ -260,1540,-260,1620~ +** Processing line: ~ -260,1540,-260,1460~ +** Processing line: ~ -300,1420,-260,1460~ +** Processing line: ~ -300,1420,-300,1340~ +** Processing line: ~ -300,1340,-260,1260~ +** Processing line: ~ -260,1260,-260,1160~ +** Processing line: ~ -260,1060,-260,1160~ +** Processing line: ~ -260,1060,-260,960~ +** Processing line: ~ -260,880,-260,960~ +** Processing line: ~ -260,880,-260,780~ +** Processing line: ~ -260,780,-260,680~ +** Processing line: ~ -300,580,-260,680~ +** Processing line: ~ -300,580,-300,480~ +** Processing line: ~ -300,480,-260,400~ +** Processing line: ~ -300,320,-260,400~ +** Processing line: ~ -300,320,-300,240~ +** Processing line: ~ -300,240,-200,220~ +** Processing line: ~ -200,220,-200,160~ +** Processing line: ~ -200,160,-100,140~ +** Processing line: ~ -100,140,0,120~ +** Processing line: ~ 0,120,60,120~ +** Processing line: ~ 60,120,180,120~ +** Processing line: ~ 180,120,300,120~ +** Processing line: ~ 300,120,420,140~ +** Processing line: ~ 420,140,580,180~ +** Processing line: ~ 580,180,760,180~ +** Processing line: ~ 760,180,900,180~ +** Processing line: ~ 960,180,1100,180~ +** Processing line: ~ 1100,180,1340,200~ +** Processing line: ~ 1340,200,1580,200~ +** Processing line: ~ 1580,200,1720,180~ +** Processing line: ~ 1720,180,2000,140~ +** Processing line: ~ 2000,140,2240,140~ +** Processing line: ~ 2240,140,2480,140~ +** Processing line: ~ 2520,140,2800,160~ +** Processing line: ~ 2800,160,3000,160~ +** Processing line: ~ 3000,160,3140,160~ +** Processing line: ~ 3140,260,3140,160~ +** Processing line: ~ 3140,260,3140,380~ +** Processing line: ~ 3080,500,3140,380~ +** Processing line: ~ 3080,620,3080,500~ +** Processing line: ~ 3080,620,3080,740~ +** Processing line: ~ 3080,740,3080,840~ +** Processing line: ~ 3080,960,3080,840~ +** Processing line: ~ 3080,1080,3080,960~ +** Processing line: ~ 3080,1080,3080,1200~ +** Processing line: ~ 3080,1200,3080,1340~ +** Processing line: ~ 3080,1340,3080,1460~ +** Processing line: ~ 3080,1580,3080,1460~ +** Processing line: ~ 3080,1700,3080,1580~ +** Processing line: ~ 3080,1700,3080,1760~ +** Processing line: ~ 3080,1760,3200,1760~ +** Processing line: ~ 3200,1760,3320,1760~ +** Processing line: ~ 3320,1760,3520,1760~ +** Processing line: ~ 3520,1760,3680,1740~ +** Processing line: ~ 3680,1740,3780,1700~ +** Processing line: ~ 3780,1700,3840,1620~ +** Processing line: ~ 3840,1620,3840,1520~ +** Processing line: ~ 3840,1520,3840,1420~ +** Processing line: ~ 3840,1320,3840,1420~ +** Processing line: ~ 3840,1120,3840,1320~ +** Processing line: ~ 3840,1120,3840,940~ +** Processing line: ~ 3840,940,3840,760~ +** Processing line: ~ 3780,600,3840,760~ +** Processing line: ~ 3780,600,3780,440~ +** Processing line: ~ 3780,320,3780,440~ +** Processing line: ~ 3780,320,3780,160~ +** Processing line: ~ 3780,60,3780,160~ +** Processing line: ~ 3780,60,4020,60~ +** Processing line: ~ 4020,60,4260,40~ +** Processing line: ~ 4260,40,4500,40~ +** Processing line: ~ 4500,40,4740,40~ +** Processing line: ~ 4740,40,4840,20~ +** Processing line: ~ 4840,20,4880,80~ +** Processing line: ~ 4880,80,5080,40~ +** Processing line: ~ 5080,40,5280,20~ +** Processing line: ~ 5280,20,5500,0~ +** Processing line: ~ 5500,0,5720,0~ +** Processing line: ~ 5720,0,5940,60~ +** Processing line: ~ 5940,60,6240,60~ +** Processing line: ~ 6240,60,6540,20~ +** Processing line: ~ 6540,20,6840,20~ +** Processing line: ~ 6840,20,7040,0~ +** Processing line: ~ 7040,0,7140,0~ +** Processing line: ~ 7140,0,7400,20~ +** Processing line: ~ 7400,20,7680,0~ +** Processing line: ~ 7680,0,7940,0~ +** Processing line: ~ 7940,0,8200,-20~ +** Processing line: ~ 8200,-20,8360,20~ +** Processing line: ~ 8360,20,8560,-40~ +** Processing line: ~ 8560,-40,8760,0~ +** Processing line: ~ 8760,0,8880,40~ +** Processing line: ~ 8880,120,8880,40~ +** Processing line: ~ 8840,220,8840,120~ +** Processing line: ~ 8620,240,8840,220~ +** Processing line: ~ 8420,260,8620,240~ +** Processing line: ~ 8200,280,8420,260~ +** Processing line: ~ 7940,280,8200,280~ +** Processing line: ~ 7760,240,7940,280~ +** Processing line: ~ 7560,220,7760,240~ +** Processing line: ~ 7360,280,7560,220~ +** Processing line: ~ 7140,260,7360,280~ +** Processing line: ~ 6940,240,7140,260~ +** Processing line: ~ 6720,220,6940,240~ +** Processing line: ~ 6480,220,6720,220~ +** Processing line: ~ 6360,300,6480,220~ +** Processing line: ~ 6240,300,6360,300~ +** Processing line: ~ 6200,500,6240,300~ +** Processing line: ~ 6200,500,6360,540~ +** Processing line: ~ 6360,540,6540,520~ +** Processing line: ~ 6540,520,6720,480~ +** Processing line: ~ 6720,480,6880,460~ +** Processing line: ~ 6880,460,7080,500~ +** Processing line: ~ 7080,500,7320,500~ +** Processing line: ~ 7320,500,7680,500~ +** Processing line: ~ 7680,620,7680,500~ +** Processing line: ~ 7520,640,7680,620~ +** Processing line: ~ 7360,640,7520,640~ +** Processing line: ~ 7200,640,7360,640~ +** Processing line: ~ 7040,660,7200,640~ +** Processing line: ~ 6880,720,7040,660~ +** Processing line: ~ 6720,700,6880,720~ +** Processing line: ~ 6540,700,6720,700~ +** Processing line: ~ 6420,760,6540,700~ +** Processing line: ~ 6280,740,6420,760~ +** Processing line: ~ 6240,760,6280,740~ +** Processing line: ~ 6200,920,6240,760~ +** Processing line: ~ 6200,920,6360,960~ +** Processing line: ~ 6360,960,6540,960~ +** Processing line: ~ 6540,960,6720,960~ +** Processing line: ~ 6720,960,6760,980~ +** Processing line: ~ 6760,980,6880,940~ +** Processing line: ~ 6880,940,7080,940~ +** Processing line: ~ 7080,940,7280,940~ +** Processing line: ~ 7280,940,7520,920~ +** Processing line: ~ 7520,920,7760,900~ +** Processing line: ~ 7760,900,7980,860~ +** Processing line: ~ 7980,860,8100,880~ +** Processing line: ~ 8100,880,8280,900~ +** Processing line: ~ 8280,900,8500,820~ +** Processing line: ~ 8500,820,8700,820~ +** Processing line: ~ 8700,820,8760,840~ +** Processing line: ~ 8760,960,8760,840~ +** Processing line: ~ 8700,1040,8760,960~ +** Processing line: ~ 8560,1060,8700,1040~ +** Processing line: ~ 8460,1080,8560,1060~ +** Processing line: ~ 8360,1040,8460,1080~ +** Processing line: ~ 8280,1080,8360,1040~ +** Processing line: ~ 8160,1120,8280,1080~ +** Processing line: ~ 8040,1120,8160,1120~ +** Processing line: ~ 7940,1100,8040,1120~ +** Processing line: ~ 7800,1120,7940,1100~ +** Processing line: ~ 7680,1120,7800,1120~ +** Processing line: ~ 7520,1100,7680,1120~ +** Processing line: ~ 7360,1100,7520,1100~ +** Processing line: ~ 7200,1120,7360,1100~ +** Processing line: ~ 7040,1180,7200,1120~ +** Processing line: ~ 6880,1160,7040,1180~ +** Processing line: ~ 6720,1160,6880,1160~ +** Processing line: ~ 6540,1160,6720,1160~ +** Processing line: ~ 6360,1160,6540,1160~ +** Processing line: ~ 6200,1160,6360,1160~ +** Processing line: ~ 6040,1220,6200,1160~ +** Processing line: ~ 6040,1220,6040,1400~ +** Processing line: ~ 6040,1400,6200,1440~ +** Processing line: ~ 6200,1440,6320,1440~ +** Processing line: ~ 6320,1440,6440,1440~ +** Processing line: ~ 6600,1440,6760,1440~ +** Processing line: ~ 6760,1440,6940,1420~ +** Processing line: ~ 6440,1440,6600,1440~ +** Processing line: ~ 6940,1420,7280,1400~ +** Processing line: ~ 7280,1400,7560,1400~ +** Processing line: ~ 7560,1400,7760,1400~ +** Processing line: ~ 7760,1400,7940,1360~ +** Processing line: ~ 7940,1360,8100,1380~ +** Processing line: ~ 8100,1380,8280,1340~ +** Processing line: ~ 8280,1340,8460,1320~ +** Processing line: ~ 8660,1300,8760,1360~ +** Processing line: ~ 8460,1320,8660,1300~ +** Processing line: ~ 8760,1360,8800,1500~ +** Processing line: ~ 8800,1660,8800,1500~ +** Processing line: ~ 8800,1660,8800,1820~ +** Processing line: ~ 8700,1840,8800,1820~ +** Processing line: ~ 8620,1860,8700,1840~ +** Processing line: ~ 8560,1800,8620,1860~ +** Processing line: ~ 8560,1800,8620,1680~ +** Processing line: ~ 8500,1640,8620,1680~ +** Processing line: ~ 8420,1680,8500,1640~ +** Processing line: ~ 8280,1680,8420,1680~ +** Processing line: ~ 8160,1680,8280,1680~ +** Processing line: ~ 7900,1680,8160,1680~ +** Processing line: ~ 7680,1680,7900,1680~ +** Processing line: ~ 7400,1660,7680,1680~ +** Processing line: ~ 7140,1680,7400,1660~ +** Processing line: ~ 6880,1640,7140,1680~ +** Processing line: ~ 6040,1820,6320,1780~ +** Processing line: ~ 5900,1840,6040,1820~ +** Processing line: ~ 6640,1700,6880,1640~ +** Processing line: ~ 6320,1780,6640,1700~ +** Processing line: ~ 5840,2040,5900,1840~ +** Processing line: ~ 5840,2040,5840,2220~ +** Processing line: ~ 5840,2220,5840,2320~ +** Processing line: ~ 5840,2460,5840,2320~ +** Processing line: ~ 5840,2560,5840,2460~ +** Processing line: ~ 5840,2560,5960,2620~ +** Processing line: ~ 5960,2620,6200,2620~ +** Processing line: ~ 6200,2620,6380,2600~ +** Processing line: ~ 6380,2600,6600,2580~ +** Processing line: ~ 6600,2580,6800,2600~ +** Processing line: ~ 6800,2600,7040,2580~ +** Processing line: ~ 7040,2580,7280,2580~ +** Processing line: ~ 7280,2580,7480,2560~ +** Processing line: ~ 7760,2540,7980,2520~ +** Processing line: ~ 7980,2520,8160,2500~ +** Processing line: ~ 7480,2560,7760,2540~ +** Processing line: ~ 8160,2500,8160,2420~ +** Processing line: ~ 8160,2420,8160,2320~ +** Processing line: ~ 8160,2180,8160,2320~ +** Processing line: ~ 7980,2160,8160,2180~ +** Processing line: ~ 7800,2180,7980,2160~ +** Processing line: ~ 7600,2200,7800,2180~ +** Processing line: ~ 7400,2200,7600,2200~ +** Processing line: ~ 6960,2200,7200,2200~ +** Processing line: ~ 7200,2200,7400,2200~ +** Processing line: ~ 6720,2200,6960,2200~ +** Processing line: ~ 6540,2180,6720,2200~ +** Processing line: ~ 6320,2200,6540,2180~ +** Processing line: ~ 6240,2160,6320,2200~ +** Processing line: ~ 6240,2160,6240,2040~ +** Processing line: ~ 6240,2040,6240,1940~ +** Processing line: ~ 6240,1940,6440,1940~ +** Processing line: ~ 6440,1940,6720,1940~ +** Processing line: ~ 6720,1940,6940,1920~ +** Processing line: ~ 7520,1920,7760,1920~ +** Processing line: ~ 6940,1920,7280,1920~ +** Processing line: ~ 7280,1920,7520,1920~ +** Processing line: ~ 7760,1920,8100,1900~ +** Processing line: ~ 8100,1900,8420,1900~ +** Processing line: ~ 8420,1900,8460,1940~ +** Processing line: ~ 8460,2120,8460,1940~ +** Processing line: ~ 8460,2280,8460,2120~ +** Processing line: ~ 8460,2280,8560,2420~ +** Processing line: ~ 8560,2420,8660,2380~ +** Processing line: ~ 8660,2380,8800,2340~ +** Processing line: ~ 8800,2340,8840,2400~ +** Processing line: ~ 8840,2520,8840,2400~ +** Processing line: ~ 8800,2620,8840,2520~ +** Processing line: ~ 8800,2740,8800,2620~ +** Processing line: ~ 8800,2860,8800,2740~ +** Processing line: ~ 8800,2940,8800,2860~ +** Processing line: ~ 8760,2980,8800,2940~ +** Processing line: ~ 8660,2980,8760,2980~ +** Processing line: ~ 8620,2960,8660,2980~ +** Processing line: ~ 8560,2880,8620,2960~ +** Processing line: ~ 8560,2880,8560,2780~ +** Processing line: ~ 8500,2740,8560,2780~ +** Processing line: ~ 8420,2760,8500,2740~ +** Processing line: ~ 8420,2840,8420,2760~ +** Processing line: ~ 8420,2840,8420,2940~ +** Processing line: ~ 8420,3040,8420,2940~ +** Processing line: ~ 8420,3160,8420,3040~ +** Processing line: ~ 8420,3280,8420,3380~ +** Processing line: ~ 8420,3280,8420,3160~ +** Processing line: ~ 8420,3380,8620,3460~ +** Processing line: ~ 8620,3460,8760,3460~ +** Processing line: ~ 8760,3460,8840,3400~ +** Processing line: ~ 8840,3400,8960,3400~ +** Processing line: ~ 8960,3400,9000,3500~ +** Processing line: ~ 9000,3700,9000,3500~ +** Processing line: ~ 9000,3900,9000,3700~ +** Processing line: ~ 9000,4080,9000,3900~ +** Processing line: ~ 9000,4280,9000,4080~ +** Processing line: ~ 9000,4500,9000,4280~ +** Processing line: ~ 9000,4620,9000,4500~ +** Processing line: ~ 9000,4780,9000,4620~ +** Processing line: ~ 9000,4780,9000,4960~ +** Processing line: ~ 9000,5120,9000,4960~ +** Processing line: ~ 9000,5120,9000,5300~ +** Processing line: ~ 8960,5460,9000,5300~ +** Processing line: ~ 8920,5620,8960,5460~ +** Processing line: ~ 8920,5620,8920,5800~ +** Processing line: ~ 8920,5800,8920,5960~ +** Processing line: ~ 8920,5960,8920,6120~ +** Processing line: ~ 8920,6120,8960,6300~ +** Processing line: ~ 8960,6300,8960,6480~ +** Processing line: ~ 8960,6660,8960,6480~ +** Processing line: ~ 8960,6860,8960,6660~ +** Processing line: ~ 8960,7040,8960,6860~ +** Processing line: ~ 8920,7420,8920,7220~ +** Processing line: ~ 8920,7420,8960,7620~ +** Processing line: ~ 8960,7620,8960,7800~ +** Processing line: ~ 8960,7800,8960,8000~ +** Processing line: ~ 8960,8000,8960,8180~ +** Processing line: ~ 8960,8180,8960,8380~ +** Processing line: ~ 8960,8580,8960,8380~ +** Processing line: ~ 8920,8800,8960,8580~ +** Processing line: ~ 8880,9000,8920,8800~ +** Processing line: ~ 8840,9180,8880,9000~ +** Processing line: ~ 8800,9220,8840,9180~ +** Processing line: ~ 8800,9220,8840,9340~ +** Processing line: ~ 8760,9380,8840,9340~ +** Processing line: ~ 8560,9340,8760,9380~ +** Processing line: ~ 8360,9360,8560,9340~ +** Processing line: ~ 8160,9360,8360,9360~ +** Processing line: ~ 8040,9340,8160,9360~ +** Processing line: ~ 7860,9360,8040,9340~ +** Processing line: ~ 7680,9360,7860,9360~ +** Processing line: ~ 7520,9360,7680,9360~ +** Processing line: ~ 7420,9260,7520,9360~ +** Processing line: ~ 7400,9080,7420,9260~ +** Processing line: ~ 7400,9080,7420,8860~ +** Processing line: ~ 7420,8860,7440,8720~ +** Processing line: ~ 7440,8720,7480,8660~ +** Processing line: ~ 7480,8660,7520,8540~ +** Processing line: ~ 7520,8540,7600,8460~ +** Processing line: ~ 7600,8460,7800,8480~ +** Processing line: ~ 7800,8480,8040,8480~ +** Processing line: ~ 8040,8480,8280,8480~ +** Processing line: ~ 8280,8480,8500,8460~ +** Processing line: ~ 8500,8460,8620,8440~ +** Processing line: ~ 8620,8440,8660,8340~ +** Processing line: ~ 8660,8340,8660,8220~ +** Processing line: ~ 8660,8220,8700,8080~ +** Processing line: ~ 8700,8080,8700,7920~ +** Processing line: ~ 8700,7920,8700,7760~ +** Processing line: ~ 8700,7760,8700,7620~ +** Processing line: ~ 8700,7480,8700,7620~ +** Processing line: ~ 8700,7480,8700,7320~ +** Processing line: ~ 8700,7160,8700,7320~ +** Processing line: ~ 8920,7220,8960,7040~ +** Processing line: ~ 8660,7040,8700,7160~ +** Processing line: ~ 8660,7040,8700,6880~ +** Processing line: ~ 8660,6700,8700,6880~ +** Processing line: ~ 8660,6700,8700,6580~ +** Processing line: ~ 8700,6460,8700,6580~ +** Processing line: ~ 8700,6460,8700,6320~ +** Processing line: ~ 8700,6160,8700,6320~ +** Processing line: ~ 8700,6160,8760,6020~ +** Processing line: ~ 8760,6020,8760,5860~ +** Processing line: ~ 8760,5860,8760,5700~ +** Processing line: ~ 8760,5700,8760,5540~ +** Processing line: ~ 8760,5540,8760,5360~ +** Processing line: ~ 8760,5360,8760,5180~ +** Processing line: ~ 8760,5000,8760,5180~ +** Processing line: ~ 8700,4820,8760,5000~ +** Processing line: ~ 8560,4740,8700,4820~ +** Processing line: ~ 8420,4700,8560,4740~ +** Processing line: ~ 8280,4700,8420,4700~ +** Processing line: ~ 8100,4700,8280,4700~ +** Processing line: ~ 7980,4700,8100,4700~ +** Processing line: ~ 7820,4740,7980,4700~ +** Processing line: ~ 7800,4920,7820,4740~ +** Processing line: ~ 7800,4920,7900,4960~ +** Processing line: ~ 7900,4960,8060,4980~ +** Processing line: ~ 8060,4980,8220,5000~ +** Processing line: ~ 8220,5000,8420,5040~ +** Processing line: ~ 8420,5040,8460,5120~ +** Processing line: ~ 8460,5180,8460,5120~ +** Processing line: ~ 8360,5200,8460,5180~ +** Processing line: ~ 8360,5280,8360,5200~ +** Processing line: ~ 8160,5300,8360,5280~ +** Processing line: ~ 8040,5260,8160,5300~ +** Processing line: ~ 7860,5220,8040,5260~ +** Processing line: ~ 7720,5160,7860,5220~ +** Processing line: ~ 7640,5120,7720,5160~ +** Processing line: ~ 7480,5120,7640,5120~ +** Processing line: ~ 7240,5120,7480,5120~ +** Processing line: ~ 7000,5120,7240,5120~ +** Processing line: ~ 6800,5160,7000,5120~ +** Processing line: ~ 6640,5220,6800,5160~ +** Processing line: ~ 6600,5360,6640,5220~ +** Processing line: ~ 6600,5460,6600,5360~ +** Processing line: ~ 6480,5520,6600,5460~ +** Processing line: ~ 6240,5540,6480,5520~ +** Processing line: ~ 5980,5540,6240,5540~ +** Processing line: ~ 5740,5540,5980,5540~ +** Processing line: ~ 5500,5520,5740,5540~ +** Processing line: ~ 5400,5520,5500,5520~ +** Processing line: ~ 5280,5540,5400,5520~ +** Processing line: ~ 5080,5540,5280,5540~ +** Processing line: ~ 4940,5540,5080,5540~ +** Processing line: ~ 4760,5540,4940,5540~ +** Processing line: ~ 4600,5540,4760,5540~ +** Processing line: ~ 4440,5560,4600,5540~ +** Processing line: ~ 4040,5580,4120,5520~ +** Processing line: ~ 4260,5540,4440,5560~ +** Processing line: ~ 4120,5520,4260,5540~ +** Processing line: ~ 4020,5720,4040,5580~ +** Processing line: ~ 4020,5840,4020,5720~ +** Processing line: ~ 4020,5840,4080,5940~ +** Processing line: ~ 4080,5940,4120,6040~ +** Processing line: ~ 4120,6040,4200,6080~ +** Processing line: ~ 4200,6080,4340,6080~ +** Processing line: ~ 4340,6080,4500,6060~ +** Processing line: ~ 4500,6060,4700,6060~ +** Processing line: ~ 4700,6060,4880,6060~ +** Processing line: ~ 4880,6060,5080,6060~ +** Processing line: ~ 5080,6060,5280,6080~ +** Processing line: ~ 5280,6080,5440,6100~ +** Processing line: ~ 5440,6100,5660,6100~ +** Processing line: ~ 5660,6100,5900,6080~ +** Processing line: ~ 5900,6080,6120,6080~ +** Processing line: ~ 6120,6080,6360,6080~ +** Processing line: ~ 6360,6080,6480,6100~ +** Processing line: ~ 6480,6100,6540,6060~ +** Processing line: ~ 6540,6060,6720,6060~ +** Processing line: ~ 6720,6060,6940,6060~ +** Processing line: ~ 6940,6060,7140,6060~ +** Processing line: ~ 7400,6060,7600,6060~ +** Processing line: ~ 7140,6060,7400,6060~ +** Processing line: ~ 7600,6060,7800,6060~ +** Processing line: ~ 7800,6060,7860,6080~ +** Processing line: ~ 7860,6080,8060,6080~ +** Processing line: ~ 8060,6080,8220,6080~ +** Processing line: ~ 8220,6080,8320,6140~ +** Processing line: ~ 8320,6140,8360,6300~ +** Processing line: ~ 8320,6460,8360,6300~ +** Processing line: ~ 8320,6620,8320,6460~ +** Processing line: ~ 8320,6800,8320,6620~ +** Processing line: ~ 8320,6960,8320,6800~ +** Processing line: ~ 8320,6960,8360,7120~ +** Processing line: ~ 8320,7280,8360,7120~ +** Processing line: ~ 8320,7440,8320,7280~ +** Processing line: ~ 8320,7600,8320,7440~ +** Processing line: ~ 8100,7580,8220,7600~ +** Processing line: ~ 8220,7600,8320,7600~ +** Processing line: ~ 7900,7560,8100,7580~ +** Processing line: ~ 7680,7560,7900,7560~ +** Processing line: ~ 7480,7580,7680,7560~ +** Processing line: ~ 7280,7580,7480,7580~ +** Processing line: ~ 7080,7580,7280,7580~ +** Processing line: ~ 7000,7600,7080,7580~ +** Processing line: ~ 6880,7600,7000,7600~ +** Processing line: ~ 6800,7580,6880,7600~ +** Processing line: ~ 6640,7580,6800,7580~ +** Processing line: ~ 6540,7580,6640,7580~ +** Processing line: ~ 6380,7600,6540,7580~ +** Processing line: ~ 6280,7620,6380,7600~ +** Processing line: ~ 6240,7700,6280,7620~ +** Processing line: ~ 6240,7700,6240,7800~ +** Processing line: ~ 6240,7840,6240,7800~ +** Processing line: ~ 6080,7840,6240,7840~ +** Processing line: ~ 5960,7820,6080,7840~ +** Processing line: ~ 5660,7840,5800,7840~ +** Processing line: ~ 5500,7800,5660,7840~ +** Processing line: ~ 5440,7700,5500,7800~ +** Processing line: ~ 5800,7840,5960,7820~ +** Processing line: ~ 5440,7540,5440,7700~ +** Processing line: ~ 5440,7440,5440,7540~ +** Processing line: ~ 5440,7320,5440,7440~ +** Processing line: ~ 5400,7320,5440,7320~ +** Processing line: ~ 5340,7400,5400,7320~ +** Processing line: ~ 5340,7400,5340,7500~ +** Processing line: ~ 5340,7600,5340,7500~ +** Processing line: ~ 5340,7600,5340,7720~ +** Processing line: ~ 5340,7720,5340,7860~ +** Processing line: ~ 5340,7860,5340,7960~ +** Processing line: ~ 5340,7960,5440,8020~ +** Processing line: ~ 5440,8020,5560,8020~ +** Processing line: ~ 5560,8020,5720,8040~ +** Processing line: ~ 5720,8040,5900,8060~ +** Processing line: ~ 5900,8060,6080,8060~ +** Processing line: ~ 6080,8060,6240,8060~ +** Processing line: ~ 6720,8040,6840,8060~ +** Processing line: ~ 6240,8060,6480,8040~ +** Processing line: ~ 6480,8040,6720,8040~ +** Processing line: ~ 6840,8060,6940,8060~ +** Processing line: ~ 6940,8060,7080,8120~ +** Processing line: ~ 7080,8120,7140,8180~ +** Processing line: ~ 7140,8460,7140,8320~ +** Processing line: ~ 7140,8620,7140,8460~ +** Processing line: ~ 7140,8620,7140,8740~ +** Processing line: ~ 7140,8860,7140,8740~ +** Processing line: ~ 7140,8960,7140,8860~ +** Processing line: ~ 7140,8960,7200,9080~ +** Processing line: ~ 7140,9200,7200,9080~ +** Processing line: ~ 7140,9200,7200,9320~ +** Processing line: ~ 7200,9320,7200,9460~ +** Processing line: ~ 7200,9760,7200,9900~ +** Processing line: ~ 7200,9620,7200,9460~ +** Processing line: ~ 7200,9620,7200,9760~ +** Processing line: ~ 7200,9900,7200,10060~ +** Processing line: ~ 7200,10220,7200,10060~ +** Processing line: ~ 7200,10360,7200,10220~ +** Processing line: ~ 7140,10400,7200,10360~ +** Processing line: ~ 6880,10400,7140,10400~ +** Processing line: ~ 6640,10360,6880,10400~ +** Processing line: ~ 6420,10360,6640,10360~ +** Processing line: ~ 6160,10380,6420,10360~ +** Processing line: ~ 5940,10340,6160,10380~ +** Processing line: ~ 5720,10320,5940,10340~ +** Processing line: ~ 5500,10340,5720,10320~ +** Processing line: ~ 5280,10300,5500,10340~ +** Processing line: ~ 5080,10300,5280,10300~ +** Processing line: ~ 4840,10280,5080,10300~ +** Processing line: ~ 4700,10280,4840,10280~ +** Processing line: ~ 4540,10280,4700,10280~ +** Processing line: ~ 4360,10280,4540,10280~ +** Processing line: ~ 4200,10300,4360,10280~ +** Processing line: ~ 4040,10380,4200,10300~ +** Processing line: ~ 4020,10500,4040,10380~ +** Processing line: ~ 3980,10640,4020,10500~ +** Processing line: ~ 3980,10640,3980,10760~ +** Processing line: ~ 3980,10760,4020,10920~ +** Processing line: ~ 4020,10920,4080,11000~ +** Processing line: ~ 4080,11000,4340,11020~ +** Processing line: ~ 4340,11020,4600,11060~ +** Processing line: ~ 4600,11060,4840,11040~ +** Processing line: ~ 4840,11040,4880,10960~ +** Processing line: ~ 4880,10740,4880,10960~ +** Processing line: ~ 4880,10740,4880,10600~ +** Processing line: ~ 4880,10600,5080,10560~ +** Processing line: ~ 5080,10560,5340,10620~ +** Processing line: ~ 5340,10620,5660,10620~ +** Processing line: ~ 5660,10620,6040,10600~ +** Processing line: ~ 6040,10600,6120,10620~ +** Processing line: ~ 6120,10620,6240,10720~ +** Processing line: ~ 6240,10720,6420,10740~ +** Processing line: ~ 6420,10740,6640,10760~ +** Processing line: ~ 6640,10760,6880,10780~ +** Processing line: ~ 7140,10780,7400,10780~ +** Processing line: ~ 6880,10780,7140,10780~ +** Processing line: ~ 7400,10780,7680,10780~ +** Processing line: ~ 7680,10780,8100,10760~ +** Processing line: ~ 8100,10760,8460,10740~ +** Processing line: ~ 8460,10740,8700,10760~ +** Processing line: ~ 8800,10840,8800,10980~ +** Processing line: ~ 8700,10760,8800,10840~ +** Processing line: ~ 8760,11200,8800,10980~ +** Processing line: ~ 8760,11200,8760,11380~ +** Processing line: ~ 8760,11380,8800,11560~ +** Processing line: ~ 8760,11680,8800,11560~ +** Processing line: ~ 8760,11760,8760,11680~ +** Processing line: ~ 8760,11760,8760,11920~ +** Processing line: ~ 8760,11920,8800,12080~ +** Processing line: ~ 8800,12200,8800,12080~ +** Processing line: ~ 8700,12240,8800,12200~ +** Processing line: ~ 8560,12220,8700,12240~ +** Processing line: ~ 8360,12220,8560,12220~ +** Processing line: ~ 8160,12240,8360,12220~ +** Processing line: ~ 7720,12220,7980,12220~ +** Processing line: ~ 7980,12220,8160,12240~ +** Processing line: ~ 7400,12200,7720,12220~ +** Processing line: ~ 7200,12180,7400,12200~ +** Processing line: ~ 7000,12160,7200,12180~ +** Processing line: ~ 6800,12160,7000,12160~ +** Processing line: ~ 6280,12140,6380,12180~ +** Processing line: ~ 6120,12180,6280,12140~ +** Processing line: ~ 6540,12180,6800,12160~ +** Processing line: ~ 6380,12180,6540,12180~ +** Processing line: ~ 5900,12200,6120,12180~ +** Processing line: ~ 5620,12180,5900,12200~ +** Processing line: ~ 5340,12120,5620,12180~ +** Processing line: ~ 5140,12100,5340,12120~ +** Processing line: ~ 4980,12120,5140,12100~ +** Processing line: ~ 4840,12120,4980,12120~ +** Processing line: ~ 4700,12200,4840,12120~ +** Processing line: ~ 4700,12380,4700,12200~ +** Processing line: ~ 4740,12480,4940,12520~ +** Processing line: ~ 4700,12380,4740,12480~ +** Processing line: ~ 4940,12520,5160,12560~ +** Processing line: ~ 5160,12560,5340,12600~ +** Processing line: ~ 5340,12600,5400,12600~ +** Processing line: ~ 5400,12600,5500,12600~ +** Processing line: ~ 5500,12600,5620,12600~ +** Processing line: ~ 5620,12600,5720,12560~ +** Processing line: ~ 5720,12560,5800,12440~ +** Processing line: ~ 5800,12440,5900,12380~ +** Processing line: ~ 5900,12380,6120,12420~ +** Processing line: ~ 6120,12420,6380,12440~ +** Processing line: ~ 6380,12440,6600,12460~ +** Processing line: ~ 6720,12460,6840,12520~ +** Processing line: ~ 6840,12520,6960,12520~ +** Processing line: ~ 6600,12460,6720,12460~ +** Processing line: ~ 6960,12520,7040,12500~ +** Processing line: ~ 7040,12500,7140,12440~ +** Processing line: ~ 7200,12440,7360,12500~ +** Processing line: ~ 7360,12500,7600,12560~ +** Processing line: ~ 7600,12560,7860,12600~ +** Processing line: ~ 7860,12600,8060,12500~ +** Processing line: ~ 8100,12500,8200,12340~ +** Processing line: ~ 8200,12340,8360,12360~ +** Processing line: ~ 8360,12360,8560,12400~ +** Processing line: ~ 8560,12400,8660,12420~ +** Processing line: ~ 8660,12420,8840,12400~ +** Processing line: ~ 8840,12400,9000,12360~ +** Processing line: ~ 9000,12360,9000,12360~ +** Processing line: ~ 2900,4400,2900,4280~ +** Processing line: ~ 900,7320,1000,7220~ +** Processing line: ~ 2640,13040,2900,12920~ +** Processing line: ~ 2900,12920,3160,12840~ +** Processing line: ~ 3480,12760,3780,12620~ +** Processing line: ~ 3780,12620,4020,12460~ +** Processing line: ~ 4300,12360,4440,12260~ +** Processing line: ~ 4020,12460,4300,12360~ +** Processing line: ~ 3160,12840,3480,12760~ +** Processing line: ~ 4440,12080,4440,12260~ +** Processing line: ~ 4440,12080,4440,11880~ +** Processing line: ~ 4440,11880,4440,11720~ +** Processing line: ~ 4440,11720,4600,11720~ +** Processing line: ~ 4600,11720,4760,11740~ +** Processing line: ~ 4760,11740,4980,11760~ +** Processing line: ~ 4980,11760,5160,11760~ +** Processing line: ~ 5160,11760,5340,11780~ +** Processing line: ~ 6000,11860,6120,11820~ +** Processing line: ~ 5340,11780,5620,11820~ +** Processing line: ~ 5620,11820,6000,11860~ +** Processing line: ~ 6120,11820,6360,11820~ +** Processing line: ~ 6360,11820,6640,11860~ +** Processing line: ~ 6940,11920,7240,11940~ +** Processing line: ~ 7240,11940,7520,11960~ +** Processing line: ~ 7520,11960,7860,11960~ +** Processing line: ~ 7860,11960,8100,11920~ +** Processing line: ~ 8100,11920,8420,11940~ +** Processing line: ~ 8420,11940,8460,11960~ +** Processing line: ~ 8460,11960,8500,11860~ +** Processing line: ~ 8460,11760,8500,11860~ +** Processing line: ~ 8320,11720,8460,11760~ +** Processing line: ~ 8160,11720,8320,11720~ +** Processing line: ~ 7940,11720,8160,11720~ +** Processing line: ~ 7720,11700,7940,11720~ +** Processing line: ~ 7520,11680,7720,11700~ +** Processing line: ~ 7320,11680,7520,11680~ +** Processing line: ~ 7200,11620,7320,11680~ +** Processing line: ~ 7200,11620,7200,11500~ +** Processing line: ~ 7200,11500,7280,11440~ +** Processing line: ~ 7280,11440,7420,11440~ +** Processing line: ~ 7420,11440,7600,11440~ +** Processing line: ~ 7600,11440,7980,11460~ +** Processing line: ~ 7980,11460,8160,11460~ +** Processing line: ~ 8160,11460,8360,11460~ +** Processing line: ~ 8360,11460,8460,11400~ +** Processing line: ~ 8420,11060,8500,11200~ +** Processing line: ~ 8280,11040,8420,11060~ +** Processing line: ~ 8100,11060,8280,11040~ +** Processing line: ~ 8460,11400,8500,11200~ +** Processing line: ~ 7800,11060,8100,11060~ +** Processing line: ~ 7520,11060,7800,11060~ +** Processing line: ~ 7240,11060,7520,11060~ +** Processing line: ~ 6940,11040,7240,11060~ +** Processing line: ~ 6640,11000,6940,11040~ +** Processing line: ~ 6420,10980,6640,11000~ +** Processing line: ~ 6360,11060,6420,10980~ +** Processing line: ~ 6360,11180,6360,11060~ +** Processing line: ~ 6200,11280,6360,11180~ +** Processing line: ~ 5960,11300,6200,11280~ +** Processing line: ~ 5720,11280,5960,11300~ +** Processing line: ~ 5500,11280,5720,11280~ +** Processing line: ~ 4940,11300,5200,11280~ +** Processing line: ~ 4660,11260,4940,11300~ +** Processing line: ~ 4440,11280,4660,11260~ +** Processing line: ~ 4260,11280,4440,11280~ +** Processing line: ~ 4220,11220,4260,11280~ +** Processing line: ~ 4080,11280,4220,11220~ +** Processing line: ~ 3980,11420,4080,11280~ +** Processing line: ~ 3980,11420,4040,11620~ +** Processing line: ~ 4040,11620,4040,11820~ +** Processing line: ~ 3980,11960,4040,11820~ +** Processing line: ~ 3840,12000,3980,11960~ +** Processing line: ~ 3720,11940,3840,12000~ +** Processing line: ~ 3680,11800,3720,11940~ +** Processing line: ~ 3680,11580,3680,11800~ +** Processing line: ~ 3680,11360,3680,11580~ +** Processing line: ~ 3680,11360,3680,11260~ +** Processing line: ~ 3680,11080,3680,11260~ +** Processing line: ~ 3680,11080,3680,10880~ +** Processing line: ~ 3680,10700,3680,10880~ +** Processing line: ~ 3680,10700,3680,10620~ +** Processing line: ~ 3680,10480,3680,10620~ +** Processing line: ~ 3680,10480,3680,10300~ +** Processing line: ~ 3680,10300,3680,10100~ +** Processing line: ~ 3680,10100,3680,9940~ +** Processing line: ~ 3680,9940,3720,9860~ +** Processing line: ~ 3720,9860,3920,9900~ +** Processing line: ~ 3920,9900,4220,9880~ +** Processing line: ~ 4980,9940,5340,9960~ +** Processing line: ~ 4220,9880,4540,9900~ +** Processing line: ~ 4540,9900,4980,9940~ +** Processing line: ~ 5340,9960,5620,9960~ +** Processing line: ~ 5620,9960,5900,9960~ +** Processing line: ~ 5900,9960,6160,10000~ +** Processing line: ~ 6160,10000,6480,10000~ +** Processing line: ~ 6480,10000,6720,10000~ +** Processing line: ~ 6720,10000,6880,9860~ +** Processing line: ~ 6880,9860,6880,9520~ +** Processing line: ~ 6880,9520,6940,9340~ +** Processing line: ~ 6940,9120,6940,9340~ +** Processing line: ~ 6940,9120,6940,8920~ +** Processing line: ~ 6940,8700,6940,8920~ +** Processing line: ~ 6880,8500,6940,8700~ +** Processing line: ~ 6880,8320,6880,8500~ +** Processing line: ~ 7140,8320,7140,8180~ +** Processing line: ~ 6760,8260,6880,8320~ +** Processing line: ~ 6540,8240,6760,8260~ +** Processing line: ~ 6420,8180,6540,8240~ +** Processing line: ~ 6280,8240,6420,8180~ +** Processing line: ~ 6160,8300,6280,8240~ +** Processing line: ~ 6120,8400,6160,8300~ +** Processing line: ~ 6080,8520,6120,8400~ +** Processing line: ~ 5840,8480,6080,8520~ +** Processing line: ~ 5620,8500,5840,8480~ +** Processing line: ~ 5500,8500,5620,8500~ +** Processing line: ~ 5340,8560,5500,8500~ +** Processing line: ~ 5160,8540,5340,8560~ +** Processing line: ~ 4620,8520,4880,8520~ +** Processing line: ~ 4360,8480,4620,8520~ +** Processing line: ~ 4880,8520,5160,8540~ +** Processing line: ~ 4140,8440,4360,8480~ +** Processing line: ~ 3920,8460,4140,8440~ +** Processing line: ~ 3720,8380,3920,8460~ +** Processing line: ~ 3680,8160,3720,8380~ +** Processing line: ~ 3680,8160,3720,7940~ +** Processing line: ~ 3720,7720,3720,7940~ +** Processing line: ~ 3680,7580,3720,7720~ +** Processing line: ~ 3680,7580,3720,7440~ +** Processing line: ~ 3720,7440,3720,7300~ +** Processing line: ~ 3720,7160,3720,7300~ +** Processing line: ~ 3720,7160,3720,7020~ +** Processing line: ~ 3720,7020,3780,6900~ +** Processing line: ~ 3780,6900,4080,6940~ +** Processing line: ~ 4080,6940,4340,6980~ +** Processing line: ~ 4340,6980,4600,6980~ +** Processing line: ~ 4600,6980,4880,6980~ +** Processing line: ~ 4880,6980,5160,6980~ +** Processing line: ~ 5160,6980,5400,7000~ +** Processing line: ~ 5400,7000,5560,7020~ +** Processing line: ~ 5560,7020,5660,7080~ +** Processing line: ~ 5660,7080,5660,7280~ +** Processing line: ~ 5660,7280,5660,7440~ +** Processing line: ~ 5660,7440,5740,7520~ +** Processing line: ~ 5740,7520,5740,7600~ +** Processing line: ~ 5740,7600,5900,7600~ +** Processing line: ~ 5900,7600,6040,7540~ +** Processing line: ~ 6040,7540,6040,7320~ +** Processing line: ~ 6040,7320,6120,7200~ +** Processing line: ~ 6120,7200,6120,7040~ +** Processing line: ~ 6120,7040,6240,7000~ +** Processing line: ~ 6240,7000,6480,7060~ +** Processing line: ~ 6480,7060,6800,7060~ +** Processing line: ~ 6800,7060,7080,7080~ +** Processing line: ~ 7080,7080,7320,7100~ +** Processing line: ~ 7940,7100,7980,6920~ +** Processing line: ~ 7860,6860,7980,6920~ +** Processing line: ~ 7640,6860,7860,6860~ +** Processing line: ~ 7400,6840,7640,6860~ +** Processing line: ~ 7320,7100,7560,7120~ +** Processing line: ~ 7560,7120,7760,7120~ +** Processing line: ~ 7760,7120,7940,7100~ +** Processing line: ~ 7200,6820,7400,6840~ +** Processing line: ~ 7040,6820,7200,6820~ +** Processing line: ~ 6600,6840,6840,6840~ +** Processing line: ~ 6380,6800,6600,6840~ +** Processing line: ~ 6120,6800,6380,6800~ +** Processing line: ~ 5900,6840,6120,6800~ +** Processing line: ~ 5620,6820,5900,6840~ +** Processing line: ~ 5400,6800,5620,6820~ +** Processing line: ~ 5140,6800,5400,6800~ +** Processing line: ~ 4880,6780,5140,6800~ +** Processing line: ~ 4600,6760,4880,6780~ +** Processing line: ~ 4340,6760,4600,6760~ +** Processing line: ~ 4080,6760,4340,6760~ +** Processing line: ~ 3840,6740,4080,6760~ +** Processing line: ~ 3680,6720,3840,6740~ +** Processing line: ~ 3680,6720,3680,6560~ +** Processing line: ~ 3680,6560,3720,6400~ +** Processing line: ~ 3720,6400,3720,6200~ +** Processing line: ~ 3720,6200,3780,6000~ +** Processing line: ~ 3720,5780,3780,6000~ +** Processing line: ~ 3720,5580,3720,5780~ +** Processing line: ~ 3720,5360,3720,5580~ +** Processing line: ~ 3720,5360,3840,5240~ +** Processing line: ~ 3840,5240,4200,5260~ +** Processing line: ~ 4200,5260,4600,5280~ +** Processing line: ~ 4600,5280,4880,5280~ +** Processing line: ~ 4880,5280,5140,5200~ +** Processing line: ~ 5140,5200,5220,5100~ +** Processing line: ~ 5220,5100,5280,4900~ +** Processing line: ~ 5280,4900,5340,4840~ +** Processing line: ~ 5340,4840,5720,4880~ +** Processing line: ~ 6120,4880,6480,4860~ +** Processing line: ~ 6880,4840,7200,4860~ +** Processing line: ~ 6480,4860,6880,4840~ +** Processing line: ~ 7200,4860,7320,4860~ +** Processing line: ~ 7320,4860,7360,4740~ +** Processing line: ~ 7360,4600,7440,4520~ +** Processing line: ~ 7360,4600,7360,4740~ +** Processing line: ~ 7440,4520,7640,4520~ +** Processing line: ~ 7640,4520,7800,4480~ +** Processing line: ~ 7800,4480,7800,4280~ +** Processing line: ~ 7800,4280,7800,4040~ +** Processing line: ~ 7800,4040,7800,3780~ +** Processing line: ~ 7800,3560,7800,3780~ +** Processing line: ~ 7800,3560,7860,3440~ +** Processing line: ~ 7860,3440,8060,3460~ +** Processing line: ~ 8060,3460,8160,3340~ +** Processing line: ~ 8160,3340,8160,3140~ +** Processing line: ~ 8160,3140,8160,2960~ +** Processing line: ~ 8000,2900,8160,2960~ +** Processing line: ~ 7860,2900,8000,2900~ +** Processing line: ~ 7640,2940,7860,2900~ +** Processing line: ~ 7400,2980,7640,2940~ +** Processing line: ~ 7100,2980,7400,2980~ +** Processing line: ~ 6840,3000,7100,2980~ +** Processing line: ~ 5620,2980,5840,2980~ +** Processing line: ~ 5840,2980,6500,3000~ +** Processing line: ~ 6500,3000,6840,3000~ +** Processing line: ~ 5560,2780,5620,2980~ +** Processing line: ~ 5560,2780,5560,2580~ +** Processing line: ~ 5560,2580,5560,2380~ +** Processing line: ~ 5560,2140,5560,2380~ +** Processing line: ~ 5560,2140,5560,1900~ +** Processing line: ~ 5560,1900,5620,1660~ +** Processing line: ~ 5620,1660,5660,1460~ +** Processing line: ~ 5660,1460,5660,1300~ +** Processing line: ~ 5500,1260,5660,1300~ +** Processing line: ~ 5340,1260,5500,1260~ +** Processing line: ~ 4600,1220,4840,1240~ +** Processing line: ~ 4440,1220,4600,1220~ +** Processing line: ~ 4440,1080,4440,1220~ +** Processing line: ~ 4440,1080,4600,1020~ +** Processing line: ~ 5080,1260,5340,1260~ +** Processing line: ~ 4840,1240,5080,1260~ +** Processing line: ~ 4600,1020,4940,1020~ +** Processing line: ~ 4940,1020,5220,1020~ +** Processing line: ~ 5220,1020,5560,960~ +** Processing line: ~ 5560,960,5660,860~ +** Processing line: ~ 5660,740,5660,860~ +** Processing line: ~ 5280,740,5660,740~ +** Processing line: ~ 4940,780,5280,740~ +** Processing line: ~ 4660,760,4940,780~ +** Processing line: ~ 4500,700,4660,760~ +** Processing line: ~ 4500,520,4500,700~ +** Processing line: ~ 4500,520,4700,460~ +** Processing line: ~ 4700,460,5080,440~ +** Processing line: ~ 5440,420,5740,420~ +** Processing line: ~ 5080,440,5440,420~ +** Processing line: ~ 5740,420,5840,360~ +** Processing line: ~ 5800,280,5840,360~ +** Processing line: ~ 5560,280,5800,280~ +** Processing line: ~ 4980,300,5280,320~ +** Processing line: ~ 4360,320,4660,300~ +** Processing line: ~ 4200,360,4360,320~ +** Processing line: ~ 5280,320,5560,280~ +** Processing line: ~ 4660,300,4980,300~ +** Processing line: ~ 4140,480,4200,360~ +** Processing line: ~ 4140,480,4140,640~ +** Processing line: ~ 4140,640,4200,780~ +** Processing line: ~ 4200,780,4200,980~ +** Processing line: ~ 4200,980,4220,1180~ +** Processing line: ~ 4220,1400,4220,1180~ +** Processing line: ~ 4220,1400,4260,1540~ +** Processing line: ~ 4260,1540,4500,1540~ +** Processing line: ~ 4500,1540,4700,1520~ +** Processing line: ~ 4700,1520,4980,1540~ +** Processing line: ~ 5280,1560,5400,1560~ +** Processing line: ~ 4980,1540,5280,1560~ +** Processing line: ~ 5400,1560,5400,1700~ +** Processing line: ~ 5400,1780,5400,1700~ +** Processing line: ~ 5340,1900,5400,1780~ +** Processing line: ~ 5340,2020,5340,1900~ +** Processing line: ~ 5340,2220,5340,2020~ +** Processing line: ~ 5340,2220,5340,2420~ +** Processing line: ~ 5340,2420,5340,2520~ +** Processing line: ~ 5080,2600,5220,2580~ +** Processing line: ~ 5220,2580,5340,2520~ +** Processing line: ~ 4900,2580,5080,2600~ +** Processing line: ~ 4700,2540,4900,2580~ +** Processing line: ~ 4500,2540,4700,2540~ +** Processing line: ~ 4220,2580,4340,2540~ +** Processing line: ~ 4200,2700,4220,2580~ +** Processing line: ~ 4340,2540,4500,2540~ +** Processing line: ~ 3980,2740,4200,2700~ +** Processing line: ~ 3840,2740,3980,2740~ +** Processing line: ~ 3780,2640,3840,2740~ +** Processing line: ~ 3780,2640,3780,2460~ +** Processing line: ~ 3780,2280,3780,2460~ +** Processing line: ~ 3620,2020,3780,2100~ +** Processing line: ~ 3780,2280,3780,2100~ +** Processing line: ~ 3360,2040,3620,2020~ +** Processing line: ~ 3080,2040,3360,2040~ +** Processing line: ~ 2840,2020,3080,2040~ +** Processing line: ~ 2740,1940,2840,2020~ +** Processing line: ~ 2740,1940,2800,1800~ +** Processing line: ~ 2800,1640,2800,1800~ +** Processing line: ~ 2800,1640,2800,1460~ +** Processing line: ~ 2800,1300,2800,1460~ +** Processing line: ~ 2700,1180,2800,1300~ +** Processing line: ~ 2480,1140,2700,1180~ +** Processing line: ~ 1580,1200,1720,1200~ +** Processing line: ~ 2240,1180,2480,1140~ +** Processing line: ~ 1960,1180,2240,1180~ +** Processing line: ~ 1720,1200,1960,1180~ +** Processing line: ~ 1500,1320,1580,1200~ +** Processing line: ~ 1500,1440,1500,1320~ +** Processing line: ~ 1500,1440,1760,1480~ +** Processing line: ~ 1760,1480,1940,1480~ +** Processing line: ~ 1940,1480,2140,1500~ +** Processing line: ~ 2140,1500,2320,1520~ +** Processing line: ~ 2400,1560,2400,1700~ +** Processing line: ~ 2280,1820,2380,1780~ +** Processing line: ~ 2320,1520,2400,1560~ +** Processing line: ~ 2380,1780,2400,1700~ +** Processing line: ~ 2080,1840,2280,1820~ +** Processing line: ~ 1720,1820,2080,1840~ +** Processing line: ~ 1420,1800,1720,1820~ +** Processing line: ~ 1280,1800,1420,1800~ +** Processing line: ~ 1240,1720,1280,1800~ +** Processing line: ~ 1240,1720,1240,1600~ +** Processing line: ~ 1240,1600,1280,1480~ +** Processing line: ~ 1280,1340,1280,1480~ +** Processing line: ~ 1180,1280,1280,1340~ +** Processing line: ~ 1000,1280,1180,1280~ +** Processing line: ~ 760,1280,1000,1280~ +** Processing line: ~ 360,1240,540,1260~ +** Processing line: ~ 180,1220,360,1240~ +** Processing line: ~ 540,1260,760,1280~ +** Processing line: ~ 180,1080,180,1220~ +** Processing line: ~ 180,1080,180,1000~ +** Processing line: ~ 180,1000,360,940~ +** Processing line: ~ 360,940,540,960~ +** Processing line: ~ 540,960,820,980~ +** Processing line: ~ 1100,980,1200,920~ +** Processing line: ~ 820,980,1100,980~ +** Processing line: ~ 6640,11860,6940,11920~ +** Processing line: ~ 5200,11280,5500,11280~ +** Processing line: ~ 4120,7330,4120,7230~ +** Processing line: ~ 4120,7230,4660,7250~ +** Processing line: ~ 4660,7250,4940,7250~ +** Processing line: ~ 4940,7250,5050,7340~ +** Processing line: ~ 5010,7400,5050,7340~ +** Processing line: ~ 4680,7380,5010,7400~ +** Processing line: ~ 4380,7370,4680,7380~ +** Processing line: ~ 4120,7330,4360,7370~ +** Processing line: ~ 4120,7670,4120,7760~ +** Processing line: ~ 4120,7670,4280,7650~ +** Processing line: ~ 4280,7650,4540,7660~ +** Processing line: ~ 4550,7660,4820,7680~ +** Processing line: ~ 4820,7680,4900,7730~ +** Processing line: ~ 4880,7800,4900,7730~ +** Processing line: ~ 4620,7820,4880,7800~ +** Processing line: ~ 4360,7790,4620,7820~ +** Processing line: ~ 4120,7760,4360,7790~ +** Processing line: ~ 6840,6840,7040,6820~ +** Processing line: ~ 5720,4880,6120,4880~ +** Processing line: ~ 1200,920,1340,810~ +** Processing line: ~ 1340,810,1520,790~ +** Processing line: ~ 1520,790,1770,800~ +** Processing line: ~ 2400,790,2600,750~ +** Processing line: ~ 2600,750,2640,520~ +** Processing line: ~ 2520,470,2640,520~ +** Processing line: ~ 2140,470,2520,470~ +** Processing line: ~ 1760,800,2090,800~ +** Processing line: ~ 2080,800,2400,790~ +** Processing line: ~ 1760,450,2140,470~ +** Processing line: ~ 1420,450,1760,450~ +** Processing line: ~ 1180,440,1420,450~ +** Processing line: ~ 900,480,1180,440~ +** Processing line: ~ 640,450,900,480~ +** Processing line: ~ 360,440,620,450~ +** Processing line: ~ 120,430,360,440~ +** Processing line: ~ 0,520,120,430~ +** Processing line: ~ -20,780,0,520~ +** Processing line: ~ -20,780,-20,1020~ +** Processing line: ~ -20,1020,-20,1150~ +** Processing line: ~ -20,1150,0,1300~ +** Processing line: ~ 0,1470,60,1530~ +** Processing line: ~ 0,1300,0,1470~ +** Processing line: ~ 60,1530,360,1530~ +** Processing line: ~ 360,1530,660,1520~ +** Processing line: ~ 660,1520,980,1520~ +** Processing line: ~ 980,1520,1040,1520~ +** Processing line: ~ 1040,1520,1070,1560~ +** Processing line: ~ 1070,1770,1070,1560~ +** Processing line: ~ 1070,1770,1100,2010~ +** Processing line: ~ 1070,2230,1100,2010~ +** Processing line: ~ 1070,2240,1180,2340~ +** Processing line: ~ 1180,2340,1580,2340~ +** Processing line: ~ 1580,2340,1940,2350~ +** Processing line: ~ 1940,2350,2440,2350~ +** Processing line: ~ 2440,2350,2560,2380~ +** Processing line: ~ 2560,2380,2600,2540~ +** Processing line: ~ 2810,2640,3140,2680~ +** Processing line: ~ 2600,2540,2810,2640~ +** Processing line: ~ 3140,2680,3230,2780~ +** Processing line: ~ 3230,2780,3260,2970~ +** Processing line: ~ 3230,3220,3260,2970~ +** Processing line: ~ 3200,3470,3230,3220~ +** Processing line: ~ 3200,3480,3210,3760~ +** Processing line: ~ 3210,3760,3210,4040~ +** Processing line: ~ 3200,4040,3230,4310~ +** Processing line: ~ 3210,4530,3230,4310~ +** Processing line: ~ 3210,4530,3230,4730~ +** Processing line: ~ 3230,4960,3230,4730~ +** Processing line: ~ 3230,4960,3260,5190~ +** Processing line: ~ 3170,5330,3260,5190~ +** Processing line: ~ 2920,5330,3170,5330~ +** Processing line: ~ 2660,5360,2920,5330~ +** Processing line: ~ 2420,5330,2660,5360~ +** Processing line: ~ 2200,5280,2400,5330~ +** Processing line: ~ 2020,5280,2200,5280~ +** Processing line: ~ 1840,5260,2020,5280~ +** Processing line: ~ 1660,5280,1840,5260~ +** Processing line: ~ 1500,5300,1660,5280~ +** Processing line: ~ 1360,5270,1500,5300~ +** Processing line: ~ 1200,5290,1340,5270~ +** Processing line: ~ 1070,5400,1200,5290~ +** Processing line: ~ 1040,5630,1070,5400~ +** Processing line: ~ 1000,5900,1040,5630~ +** Processing line: ~ 980,6170,1000,5900~ +** Processing line: ~ 980,6280,980,6170~ +** Processing line: ~ 980,6540,980,6280~ +** Processing line: ~ 980,6540,1040,6720~ +** Processing line: ~ 1040,6720,1360,6730~ +** Processing line: ~ 1360,6730,1760,6710~ +** Processing line: ~ 2110,6720,2420,6730~ +** Processing line: ~ 1760,6710,2110,6720~ +** Processing line: ~ 2420,6730,2640,6720~ +** Processing line: ~ 2640,6720,2970,6720~ +** Processing line: ~ 2970,6720,3160,6700~ +** Processing line: ~ 3160,6700,3240,6710~ +** Processing line: ~ 3240,6710,3260,6890~ +** Processing line: ~ 3260,7020,3260,6890~ +** Processing line: ~ 3230,7180,3260,7020~ +** Processing line: ~ 3230,7350,3230,7180~ +** Processing line: ~ 3210,7510,3230,7350~ +** Processing line: ~ 3210,7510,3210,7690~ +** Processing line: ~ 3210,7870,3210,7690~ +** Processing line: ~ 3210,7870,3210,7980~ +** Processing line: ~ 3200,8120,3210,7980~ +** Processing line: ~ 3200,8330,3200,8120~ +** Processing line: ~ 3160,8520,3200,8330~ +** Processing line: ~ 2460,11100,2480,11020~ +** Processing line: ~ 2200,11180,2460,11100~ +** Processing line: ~ 1260,11350,1600,11320~ +** Processing line: ~ 600,11430,930,11400~ +** Processing line: ~ 180,11340,620,11430~ +** Processing line: ~ 1600,11320,1910,11280~ +** Processing line: ~ 1910,11280,2200,11180~ +** Processing line: ~ 923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Platformer - The Little Probe - Data - level_lava.txt~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Platformer - The Little Probe - Data - level_lava.txt~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_platformer/the_little_probe/data/level_lava.txt~ +** Processing line: ~ 100,10740,500,10780~ +** Processing line: ~ 500,10780,960,10760~ +** Processing line: ~ 960,10760,1340,10760~ +** Processing line: ~ 1380,10760,1820,10780~ +** Processing line: ~ 1820,10780,2240,10780~ +** Processing line: ~ 2280,10780,2740,10740~ +** Processing line: ~ 2740,10740,3000,10780~ +** Processing line: ~ 3000,10780,3140,11020~ +** Processing line: ~ -520,8820,-480,9160~ +** Processing line: ~ -520,8480,-520,8820~ +** Processing line: ~ -520,8480,-480,8180~ +** Processing line: ~ -480,8180,-200,8120~ +** Processing line: ~ -200,8120,100,8220~ +** Processing line: ~ 100,8220,420,8240~ +** Processing line: ~ 420,8240,760,8260~ +** Processing line: ~ 760,8260,1140,8280~ +** Processing line: ~ 1140,8280,1500,8200~ +** Processing line: ~ 1500,8200,1880,8240~ +** Processing line: ~ 1880,8240,2240,8260~ +** Processing line: ~ 2240,8260,2320,8480~ +** Processing line: ~ 2320,8480,2380,8680~ +** Processing line: ~ 2240,8860,2380,8680~ +** Processing line: ~ 2240,9080,2240,8860~ +** Processing line: ~ 2240,9080,2320,9260~ +** Processing line: ~ 2320,9260,2480,9440~ +** Processing line: ~ 2480,9440,2600,9640~ +** Processing line: ~ 2480,9840,2600,9640~ +** Processing line: ~ 2400,10020,2480,9840~ +** Processing line: ~ 2240,10080,2400,10020~ +** Processing line: ~ 1960,10080,2240,10080~ +** Processing line: ~ 1720,10080,1960,10080~ +** Processing line: ~ 1460,10080,1720,10080~ +** Processing line: ~ 1180,10080,1420,10080~ +** Processing line: ~ 900,10080,1180,10080~ +** Processing line: ~ 640,10080,900,10080~ +** Processing line: ~ 640,10080,640,9900~ +** Processing line: ~ 60,10520,100,10740~ +** Processing line: ~ 40,10240,60,10520~ +** Processing line: ~ 40,10240,40,9960~ +** Processing line: ~ 40,9960,40,9680~ +** Processing line: ~ 40,9680,40,9360~ +** Processing line: ~ 40,9360,60,9080~ +** Processing line: ~ 60,9080,100,8860~ +** Processing line: ~ 100,8860,460,9040~ +** Processing line: ~ 460,9040,760,9220~ +** Processing line: ~ 760,9220,1140,9220~ +** Processing line: ~ 1140,9220,1720,9200~ +** Processing line: ~ -660,11580,-600,11420~ +** Processing line: ~ -660,11800,-660,11580~ +** Processing line: ~ -660,12000,-660,11800~ +** Processing line: ~ -660,12000,-600,12220~ +** Processing line: ~ -600,12220,-600,12440~ +** Processing line: ~ -600,12440,-600,12640~ +** Processing line: ~ -600,11240,-260,11280~ +** Processing line: ~ -260,11280,100,11240~ +** Processing line: ~ 9000,12360,9020,12400~ +** Processing line: ~ 9020,12620,9020,12400~ +** Processing line: ~ 9020,12840,9020,12620~ +** Processing line: ~ 9020,13060,9020,12840~ +** Processing line: ~ 9020,13060,9020,13240~ +** Processing line: ~ 9020,13240,9020,13420~ +** Processing line: ~ 9020,13420,9020,13600~ +** Processing line: ~ 9020,13600,9020,13780~ +** Processing line: ~ 8880,13900,9020,13780~ +** Processing line: ~ 8560,13800,8880,13900~ +** Processing line: ~ 8220,13780,8560,13800~ +** Processing line: ~ 7860,13760,8220,13780~ +** Processing line: ~ 7640,13780,7860,13760~ +** Processing line: ~ 7360,13800,7640,13780~ +** Processing line: ~ 7100,13800,7360,13800~ +** Processing line: ~ 6540,13760,6800,13780~ +** Processing line: ~ 6800,13780,7100,13800~ +** Processing line: ~ 6280,13760,6540,13760~ +** Processing line: ~ 5760,13760,6280,13760~ +** Processing line: ~ 5220,13780,5760,13760~ +** Processing line: ~ 4700,13760,5220,13780~ +** Processing line: ~ 4200,13740,4700,13760~ +** Processing line: ~ 3680,13720,4200,13740~ +** Processing line: ~ 3140,13700,3680,13720~ +** Processing line: ~ 2600,13680,3140,13700~ +** Processing line: ~ 2040,13940,2600,13680~ +** Processing line: ~ 1640,13940,2040,13940~ +** Processing line: ~ 1200,13960,1640,13940~ +** Processing line: ~ 840,14000,1200,13960~ +** Processing line: ~ 300,13960,840,14000~ +** Processing line: ~ -200,13900,300,13960~ +** Processing line: ~ -600,12840,-600,12640~ +** Processing line: ~ -600,13140,-600,12840~ +** Processing line: ~ -600,13140,-600,13420~ +** Processing line: ~ -600,13700,-600,13420~ +** Processing line: ~ -600,13700,-600,13820~ +** Processing line: ~ -600,13820,-200,13900~ +** Processing line: ~ -600,11240,-560,11000~ +** Processing line: ~ -560,11000,-480,10840~ +** Processing line: ~ -520,10660,-480,10840~ +** Processing line: ~ -520,10660,-520,10480~ +** Processing line: ~ -520,10480,-520,10300~ +** Processing line: ~ -520,10260,-480,10080~ +** Processing line: ~ -480,9880,-440,10060~ +** Processing line: ~ -520,9680,-480,9880~ +** Processing line: ~ -520,9680,-480,9400~ +** Processing line: ~ -480,9400,-480,9160~ +** Processing line: ~ 1820,9880,2140,9800~ +** Processing line: ~ 1540,9880,1820,9880~ +** Processing line: ~ 1200,9920,1500,9880~ +** Processing line: ~ 900,9880,1200,9920~ +** Processing line: ~ 640,9900,840,9880~ +** Processing line: ~ 2380,8760,2800,8760~ +** Processing line: ~ 2800,8760,2840,8660~ +** Processing line: ~ 2840,8660,2840,8420~ +** Processing line: ~ 2840,8160,2840,8420~ +** Processing line: ~ 2800,7900,2840,8160~ +** Processing line: ~ 2800,7900,2800,7720~ +** Processing line: ~ 2800,7540,2800,7720~ +** Processing line: ~ 2800,7540,2800,7360~ +** Processing line: ~ 2700,7220,2800,7360~ +** Processing line: ~ 2400,7220,2700,7220~ +** Processing line: ~ 2080,7240,2400,7220~ +** Processing line: ~ 1760,7320,2080,7240~ +** Processing line: ~ 1380,7360,1720,7320~ +** Processing line: ~ 1040,7400,1340,7360~ +** Processing line: ~ 640,7400,1000,7420~ +** Processing line: ~ 300,7380,640,7400~ +** Processing line: ~ 0,7300,240,7380~ +** Processing line: ~ -300,7180,-60,7300~ +** Processing line: ~ -380,6860,-360,7180~ +** Processing line: ~ -380,6880,-360,6700~ +** Processing line: ~ -360,6700,-260,6540~ +** Processing line: ~ -260,6540,0,6520~ +** Processing line: ~ 0,6520,240,6640~ +** Processing line: ~ 240,6640,460,6640~ +** Processing line: ~ 460,6640,500,6480~ +** Processing line: ~ 500,6260,500,6480~ +** Processing line: ~ 460,6060,500,6260~ +** Processing line: ~ 460,5860,460,6060~ +** Processing line: ~ 460,5860,500,5640~ +** Processing line: ~ 500,5640,540,5440~ +** Processing line: ~ 540,5440,580,5220~ +** Processing line: ~ 580,5220,580,5000~ +** Processing line: ~ 580,4960,580,4740~ +** Processing line: ~ 580,4740,960,4700~ +** Processing line: ~ 960,4700,1140,4760~ +** Processing line: ~ 1140,4760,1420,4740~ +** Processing line: ~ 1420,4740,1720,4700~ +** Processing line: ~ 1720,4700,2000,4740~ +** Processing line: ~ 2000,4740,2380,4760~ +** Processing line: ~ 2380,4760,2700,4800~ +** Processing line: ~ 1720,4600,1760,4300~ +** Processing line: ~ 1760,4300,2200,4340~ +** Processing line: ~ 2200,4340,2560,4340~ +** Processing line: ~ 2560,4340,2740,4340~ +** Processing line: ~ 2160,12580,2440,12400~ +** Processing line: ~ 1820,12840,2160,12580~ +** Processing line: ~ 1500,13080,1820,12840~ +** Processing line: ~ 1140,13340,1500,13080~ +** Processing line: ~ 1140,13340,1580,13220~ +** Processing line: ~ 2110,13080,2520,13000~ +** Processing line: ~ 2520,13000,2900,12800~ +** Processing line: ~ 1580,13220,2110,13080~ +** Processing line: ~ 2900,12800,3200,12680~ +** Processing line: ~ 3200,12680,3440,12640~ +** Processing line: ~ 3440,12640,3720,12460~ +** Processing line: ~ 3720,12460,4040,12320~ +** Processing line: ~ 4040,12320,4360,12200~ +** Processing line: ~ 4360,11940,4380,12180~ +** Processing line: ~ 4360,11700,4360,11940~ +** Processing line: ~ 4360,11700,4540,11500~ +** Processing line: ~ 4540,11500,4880,11540~ +** Processing line: ~ 6000,11660,6280,11640~ +** Processing line: ~ 5440,11600,5720,11610~ +** Processing line: ~ 5720,11610,6000,11660~ +** Processing line: ~ 6280,11640,6760,11720~ +** Processing line: ~ 6760,11720,7060,11780~ +** Processing line: ~ 7060,11780,7360,11810~ +** Processing line: ~ 7360,11810,7640,11840~ +** Processing line: ~ 7640,11840,8000,11830~ +** Processing line: ~ 8000,11830,8320,11850~ +** Processing line: ~ 8320,11850,8390,11800~ +** Processing line: ~ 8330,11760,8390,11800~ +** Processing line: ~ 8160,11760,8330,11760~ +** Processing line: ~ 7910,11750,8160,11760~ +** Processing line: ~ 7660,11740,7900,11750~ +** Processing line: ~ 7400,11730,7660,11740~ +** Processing line: ~ 7160,11680,7400,11730~ +** Processing line: ~ 7080,11570,7160,11680~ +** Processing line: ~ 7080,11570,7100,11350~ +** Processing line: ~ 7100,11350,7440,11280~ +** Processing line: ~ 7440,11280,7940,11280~ +** Processing line: ~ 7960,11280,8360,11280~ +** Processing line: ~ 5840,11540,6650,11170~ +** Processing line: ~ 4880,11540,5440,11600~ +** Processing line: ~ 3410,11830,3420,11300~ +** Processing line: ~ 3410,11260,3520,10920~ +** Processing line: ~ 3520,10590,3520,10920~ +** Processing line: ~ 3520,10590,3540,10260~ +** Processing line: ~ 3520,9900,3540,10240~ +** Processing line: ~ 3520,9900,3640,9590~ +** Processing line: ~ 3640,9570,4120,9590~ +** Processing line: ~ 4140,9590,4600,9680~ +** Processing line: ~ 4620,9680,5030,9730~ +** Processing line: ~ 5120,9750,5520,9800~ +** Processing line: ~ 5620,9820,6080,9800~ +** Processing line: ~ 6130,9810,6580,9820~ +** Processing line: ~ 6640,9820,6800,9700~ +** Processing line: ~ 6780,9400,6800,9700~ +** Processing line: ~ 6780,9400,6840,9140~ +** Processing line: ~ 6820,8860,6840,9120~ +** Processing line: ~ 6780,8600,6820,8830~ +** Processing line: ~ 6720,8350,6780,8570~ +** Processing line: ~ 6480,8340,6720,8320~ +** Processing line: ~ 6260,8400,6480,8340~ +** Processing line: ~ 6050,8580,6240,8400~ +** Processing line: ~ 5760,8630,6040,8590~ +** Processing line: ~ 5520,8690,5740,8630~ +** Processing line: ~ 5120,8690,5450,8700~ +** Processing line: ~ 4570,8670,5080,8690~ +** Processing line: ~ 4020,8610,4540,8670~ +** Processing line: ~ 3540,8480,4020,8610~ +** Processing line: ~ 3520,8230,3520,8480~ +** Processing line: ~ 3520,7930,3520,8230~ +** Processing line: ~ 3520,7930,3540,7630~ +** Processing line: ~ 3480,7320,3540,7610~ +** Processing line: ~ 3480,7280,3500,7010~ +** Processing line: ~ 3500,6980,3680,6850~ +** Processing line: ~ 3680,6850,4220,6840~ +** Processing line: ~ 4230,6840,4760,6850~ +** Processing line: ~ 4780,6850,5310,6860~ +** Processing line: ~ 5310,6860,5720,6940~ +** Processing line: ~ 5720,6940,5880,7250~ +** Processing line: ~ 5880,7250,5900,7520~ +** Processing line: ~ 100,11240,440,11300~ +** Processing line: ~ 440,11300,760,11330~ +** Processing line: ~ 1480,11280,1840,11230~ +** Processing line: ~ 2200,11130,2360,11090~ +** Processing line: ~ 1840,11230,2200,11130~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Rpg Narrative - Choose Your Own Adventure - decision.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Choose Your Own Adventure - decision.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb~ +** Processing line: ~ # Hey there! Welcome to Four Decisions. Here is how you~ +** Processing line: ~ # create your decision tree. Remove =being and =end from the text to~ +** Processing line: ~ # enable the game (just save the file). Change stuff and see what happens!~ +** Processing line: ~~ +** Processing line: ~ def game~ +** Processing line: ~ {~ +** Processing line: ~ starting_decision: :stormy_night,~ +** Processing line: ~ decisions: {~ +** Processing line: ~ stormy_night: {~ +** Processing line: ~ description: 'It was a dark and stormy night. (storyline located in decision.rb)',~ +** Processing line: ~ option_one: {~ +** Processing line: ~ description: 'Go to sleep.',~ +** Processing line: ~ decision: :nap~ +** Processing line: ~ },~ +** Processing line: ~ option_two: {~ +** Processing line: ~ description: 'Watch a movie.',~ +** Processing line: ~ decision: :movie~ +** Processing line: ~ },~ +** Processing line: ~ option_three: {~ +** Processing line: ~ description: 'Go outside.',~ +** Processing line: ~ decision: :go_outside~ +** Processing line: ~ },~ +** Processing line: ~ option_four: {~ +** Processing line: ~ description: 'Get a snack.',~ +** Processing line: ~ decision: :get_a_snack~ +** Processing line: ~ }~ +** Processing line: ~ },~ +** Processing line: ~ nap: {~ +** Processing line: ~ description: 'You took a nap. The end.',~ +** Processing line: ~ option_one: {~ +** Processing line: ~ description: 'Start over.',~ +** Processing line: ~ decision: :stormy_night~ +** Processing line: ~ }~ +** Processing line: ~ }~ +** Processing line: ~ }~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Rpg Narrative - Choose Your Own Adventure - main.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Choose Your Own Adventure - main.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb~ +** Processing line: ~ =begin~ +** Processing line: ~~ +** Processing line: ~ Reminders:~ +** Processing line: ~~ +** Processing line: ~ - Hashes: Collection of unique keys and their corresponding values. The values can be found~ +** Processing line: ~ using their keys.~ +** Processing line: ~~ +** Processing line: ~ In this sample app, the decisions needed for the game are stored in a hash. In fact, the~ +** Processing line: ~ decision.rb file contains hashes inside of other hashes!~ +** Processing line: ~~ +** Processing line: ~ Each option is a key in the first hash, but also contains a hash (description and~ +** Processing line: ~ decision being its keys) as its value.~ +** Processing line: ~ Go into the decision.rb file and take a look before diving into the code below.~ +** Processing line: ~~ +** Processing line: ~ - args.outputs.labels: An array. The values generate a label.~ +** Processing line: ~ The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]~ +** Processing line: ~ For more information about labels, go to mygame/documentation/02-labels.md.~ +** Processing line: ~~ +** Processing line: ~ - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down.~ +** Processing line: ~ For more information about the keyboard, go to mygame/documentation/06-keyboard.md.~ +** Processing line: ~~ +** Processing line: ~ - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated~ +** Processing line: ~ as Ruby code, and the placeholder is replaced with its corresponding value or result.~ +** Processing line: ~~ +** Processing line: ~ =end~ +** Processing line: ~~ +** Processing line: ~ # This sample app provides users with a story and multiple decisions that they can choose to make.~ +** Processing line: ~ # Users can make a decision using their keyboard, and the story will move forward based on user choices.~ +** Processing line: ~~ +** Processing line: ~ # The decisions available to users are stored in the decision.rb file.~ +** Processing line: ~ # We must have access to it for the game to function properly.~ +** Processing line: ~ GAME_FILE = 'app/decision.rb' # found in app folder~ +** Processing line: ~~ +** Processing line: ~ require GAME_FILE # require used to load another file, import class/method definitions~ +** Processing line: ~~ +** Processing line: ~ # Instructions are given using labels to users if they have not yet set up their story in the decision.rb file.~ +** Processing line: ~ # Otherwise, the game is run.~ +** Processing line: ~ def tick args~ +** Processing line: ~ if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method~ +** Processing line: ~ args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown~ +** Processing line: ~ args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1]~ +** Processing line: ~ elsif respond_to?(:game) # otherwise, if responds to game~ +** Processing line: ~ args.state.loaded = true~ +** Processing line: ~ tick_game args # calls tick_game method, runs game~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.tick_count.mod_zero? 60 # update every 60 frames~ +** Processing line: ~ t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file~ +** Processing line: ~ if t != args.state.mtime~ +** Processing line: ~ args.state.mtime = t~ +** Processing line: ~ require GAME_FILE # require used to load file~ +** Processing line: ~ args.state.game_definition = nil # game definition and decision are empty~ +** Processing line: ~ args.state.decision_id = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Runs methods needed for game to function properly~ +** Processing line: ~ # Creates a rectangular border around the screen~ +** Processing line: ~ def tick_game args~ +** Processing line: ~ defaults args~ +** Processing line: ~ args.borders << args.grid.rect~ +** Processing line: ~ render_decision args~ +** Processing line: ~ process_inputs args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Sets default values and uses decision.rb file to define game and decision_id~ +** Processing line: ~ # variable using the starting decision~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.state.game_definition ||= game~ +** Processing line: ~ args.state.decision_id ||= args.state.game_definition[:starting_decision]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Outputs the possible decision descriptions the user can choose onto the screen~ +** Processing line: ~ # as well as what key to press on their keyboard to make their decision~ +** Processing line: ~ def render_decision args~ +** Processing line: ~ decision = current_decision args~ +** Processing line: ~ # text is either the value of decision's description key or warning that no description exists~ +** Processing line: ~ args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation~ +** Processing line: ~~ +** Processing line: ~ # All decisions are stored in a hash~ +** Processing line: ~ # The descriptions output onto the screen are the values for the description keys of the hash.~ +** Processing line: ~ if decision[:option_one]~ +** Processing line: ~ args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label~ +** Processing line: ~ args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if decision[:option_two]~ +** Processing line: ~ args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description~ +** Processing line: ~ args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if decision[:option_three]~ +** Processing line: ~ args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description~ +** Processing line: ~ args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if decision[:option_four]~ +** Processing line: ~ args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description~ +** Processing line: ~ args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Uses keyboard input from the user to make a decision~ +** Processing line: ~ # Assigns the decision as the value of the decision_id variable~ +** Processing line: ~ def process_inputs args~ +** Processing line: ~ decision = current_decision args # calls current_decision method~ +** Processing line: ~~ +** Processing line: ~ if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists~ +** Processing line: ~ args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists~ +** Processing line: ~ args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists~ +** Processing line: ~ args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists~ +** Processing line: ~ args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Uses decision_id's value to keep track of current decision being made~ +** Processing line: ~ def current_decision args~ +** Processing line: ~ args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Resets the game.~ +** Processing line: ~ $gtk.reset~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - lowrez_simulator.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - lowrez_simulator.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb~ +** Processing line: ~ ###################################################################################~ +** Processing line: ~ # YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES~ +** Processing line: ~ # THE 64x64 CANVAS.~ +** Processing line: ~ ###################################################################################~ +** Processing line: ~~ +** Processing line: ~ TINY_RESOLUTION = 64~ +** Processing line: ~ TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5)~ +** Processing line: ~ CENTER_OFFSET = 10~ +** Processing line: ~ EMULATED_FONT_SIZE = 20~ +** Processing line: ~ EMULATED_FONT_X_ZERO = 0~ +** Processing line: ~ EMULATED_FONT_Y_ZERO = 46~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ sprites = []~ +** Processing line: ~ labels = []~ +** Processing line: ~ borders = []~ +** Processing line: ~ solids = []~ +** Processing line: ~ mouse = emulate_lowrez_mouse args~ +** Processing line: ~ args.state.show_gridlines = false~ +** Processing line: ~ lowrez_tick args, sprites, labels, borders, solids, mouse~ +** Processing line: ~ render_gridlines_if_needed args~ +** Processing line: ~ render_mouse_crosshairs args, mouse~ +** Processing line: ~ emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def emulate_lowrez_mouse args~ +** Processing line: ~ args.state.new_entity_strict(:lowrez_mouse) do |m|~ +** Processing line: ~ m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1~ +** Processing line: ~ m.y = args.mouse.y.idiv(TINY_SCALE)~ +** Processing line: ~ if args.mouse.click~ +** Processing line: ~ m.click = [~ +** Processing line: ~ args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ +** Processing line: ~ args.mouse.click.point.y.idiv(TINY_SCALE)~ +** Processing line: ~ ]~ +** Processing line: ~ m.down = m.click~ +** Processing line: ~ else~ +** Processing line: ~ m.click = nil~ +** Processing line: ~ m.down = nil~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.mouse.up~ +** Processing line: ~ m.up = [~ +** Processing line: ~ args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,~ +** Processing line: ~ args.mouse.up.point.y.idiv(TINY_SCALE)~ +** Processing line: ~ ]~ +** Processing line: ~ else~ +** Processing line: ~ m.up = nil~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_mouse_crosshairs args, mouse~ +** Processing line: ~ return unless args.state.show_gridlines~ +** Processing line: ~ args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse~ +** Processing line: ~ args.render_target(:lowrez).solids << [0, 0, 1280, 720]~ +** Processing line: ~ args.render_target(:lowrez).sprites << sprites~ +** Processing line: ~ args.render_target(:lowrez).borders << borders~ +** Processing line: ~ args.render_target(:lowrez).solids << solids~ +** Processing line: ~ args.outputs.primitives << labels.map do |l|~ +** Processing line: ~ as_label = l.label~ +** Processing line: ~ l.text.each_char.each_with_index.map do |char, i|~ +** Processing line: ~ [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,~ +** Processing line: ~ EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,~ +** Processing line: ~ EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_gridlines_if_needed args~ +** Processing line: ~ if args.state.show_gridlines && args.static_lines.length == 0~ +** Processing line: ~ args.static_lines << 65.times.map do |i|~ +** Processing line: ~ [~ +** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE + 1, 0,~ +** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],~ +** Processing line: ~ [CENTER_OFFSET + i * TINY_SCALE, 0,~ +** Processing line: ~ CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],~ +** Processing line: ~ [CENTER_OFFSET, 0 + i * TINY_SCALE,~ +** Processing line: ~ CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],~ +** Processing line: ~ [CENTER_OFFSET, 1 + i * TINY_SCALE,~ +** Processing line: ~ CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ elsif !args.state.show_gridlines~ +** Processing line: ~ args.static_lines.clear~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/main.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - main.rb~ - H1 detected. -- Formatting line: ~99_genre_platformer/gorillas_basic/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class YouSoBasicGorillas~ -** Processing line: ~ attr_accessor :outputs, :grid, :state, :inputs~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb~ +** Processing line: ~ require 'app/require.rb'~ ** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ calc~ -** Processing line: ~ process_inputs~ +** Processing line: ~ def defaults args~ +** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ +** Processing line: ~ args.state.last_story_line_text ||= ""~ +** Processing line: ~ args.state.scene_history ||= []~ +** Processing line: ~ args.state.storyline_history ||= []~ +** Processing line: ~ args.state.word_delay ||= 8~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.gtk.stop_music~ +** Processing line: ~ args.outputs.sounds << 'sounds/static-loop.ogg'~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ outputs.background_color = [33, 32, 87]~ -** Processing line: ~ state.building_spacing = 1~ -** Processing line: ~ state.building_room_spacing = 15~ -** Processing line: ~ state.building_room_width = 10~ -** Processing line: ~ state.building_room_height = 15~ -** Processing line: ~ state.building_heights = [4, 4, 6, 8, 15, 20, 18]~ -** Processing line: ~ state.building_room_sizes = [5, 4, 6, 7]~ -** Processing line: ~ state.gravity = 0.25~ -** Processing line: ~ state.first_strike ||= :player_1~ -** Processing line: ~ state.buildings ||= []~ -** Processing line: ~ state.holes ||= []~ -** Processing line: ~ state.player_1_score ||= 0~ -** Processing line: ~ state.player_2_score ||= 0~ -** Processing line: ~ state.wind ||= 0~ +** Processing line: ~ if args.state.last_story_line_text~ +** Processing line: ~ lines = args.state~ +** Processing line: ~ .last_story_line_text~ +** Processing line: ~ .gsub("-", "")~ +** Processing line: ~ .gsub("~", "")~ +** Processing line: ~ .wrapped_lines(50)~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }~ +** Processing line: ~ elsif args.state.storyline_history[-1]~ +** Processing line: ~ lines = args.state~ +** Processing line: ~ .storyline_history[-1]~ +** Processing line: ~ .gsub("-", "")~ +** Processing line: ~ .gsub("~", "")~ +** Processing line: ~ .wrapped_lines(50)~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render~ -** Processing line: ~ render_stage~ -** Processing line: ~ render_value_insertion~ -** Processing line: ~ render_gorillas~ -** Processing line: ~ render_holes~ -** Processing line: ~ render_banana~ -** Processing line: ~ render_game_over~ -** Processing line: ~ render_score~ -** Processing line: ~ render_wind~ +** Processing line: ~ return if args.state.current_scene~ +** Processing line: ~ set_scene(args, day_one_beginning(args))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_move_player args~ +** Processing line: ~ if args.state.scene_changed_at.elapsed_time > 5~ +** Processing line: ~ if args.keyboard.down || args.keyboard.s || args.keyboard.j~ +** Processing line: ~ args.state.player.y -= 0.25~ +** Processing line: ~ elsif args.keyboard.up || args.keyboard.w || args.keyboard.k~ +** Processing line: ~ args.state.player.y += 0.25~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.keyboard.left || args.keyboard.a || args.keyboard.h~ +** Processing line: ~ args.state.player.x -= 0.25~ +** Processing line: ~ elsif args.keyboard.right || args.keyboard.d || args.keyboard.l~ +** Processing line: ~ args.state.player.x += 0.25~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.state.player.y = 60 if args.state.player.y > 63~ +** Processing line: ~ args.state.player.y = 0 if args.state.player.y < -3~ +** Processing line: ~ args.state.player.x = 60 if args.state.player.x > 63~ +** Processing line: ~ args.state.player.x = 0 if args.state.player.x < -3~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_score~ -** Processing line: ~ outputs.primitives << [0, 0, 1280, 31, fancy_white].solid~ -** Processing line: ~ outputs.primitives << [1, 1, 1279, 29].solid~ -** Processing line: ~ outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white]~ -** Processing line: ~ outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white]~ +** Processing line: ~ def null_or_empty? ary~ +** Processing line: ~ return true unless ary~ +** Processing line: ~ return true if ary.length == 0~ +** Processing line: ~ return false~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def calc_storyline_hotspot args~ +** Processing line: ~ hotspots = args.state.storylines.find_all do |hs|~ +** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_wind~ -** Processing line: ~ outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid~ -** Processing line: ~ outputs.lines << [640, 30, 640, 0, fancy_white]~ +** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot~ +** Processing line: ~ _, _, _, _, storyline = hotspots.first~ +** Processing line: ~ queue_storyline_text(args, storyline)~ +** Processing line: ~ args.state.inside_storyline_hotspot = true~ +** Processing line: ~ elsif null_or_empty?(hotspots)~ +** Processing line: ~ args.state.inside_storyline_hotspot = false~ +** Processing line: ~~ +** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ +** Processing line: ~ args.state.is_storyline_dialog_active = false~ +** Processing line: ~ args.state.scene_storyline_queue.clear~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_game_over~ -** Processing line: ~ return unless state.over~ -** Processing line: ~ outputs.primitives << [grid.rect, 0, 0, 0, 200].solid~ -** Processing line: ~ outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label~ -** Processing line: ~ if state.winner == :player_1~ -** Processing line: ~ outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label~ +** Processing line: ~ def calc_scenes args~ +** Processing line: ~ hotspots = args.state.scenes.find_all do |hs|~ +** Processing line: ~ args.state.player.inside_rect?(hs.shift_rect(-2, 0))~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot~ +** Processing line: ~ _, _, _, _, scene_method_or_hash = hotspots.first~ +** Processing line: ~ if scene_method_or_hash.is_a? Symbol~ +** Processing line: ~ set_scene(args, send(scene_method_or_hash, args))~ +** Processing line: ~ args.state.last_hotspot_scene = scene_method_or_hash~ +** Processing line: ~ args.state.scene_history << scene_method_or_hash~ ** Processing line: ~ else~ -** Processing line: ~ outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label~ +** Processing line: ~ set_scene(args, scene_method_or_hash)~ ** Processing line: ~ end~ +** Processing line: ~ args.state.inside_scene_hotspot = true~ +** Processing line: ~ elsif null_or_empty?(hotspots)~ +** Processing line: ~ args.state.inside_scene_hotspot = false~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_stage~ -** Processing line: ~ return unless state.stage_generated~ -** Processing line: ~ return if state.stage_rendered~ +** Processing line: ~ def null_or_whitespace? word~ +** Processing line: ~ return true if !word~ +** Processing line: ~ return true if word.strip.length == 0~ +** Processing line: ~ return false~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.static_solids << [grid.rect, 33, 32, 87]~ -** Processing line: ~ outputs.static_solids << state.buildings.map(&:solids)~ -** Processing line: ~ state.stage_rendered = true~ +** Processing line: ~ def calc_storyline_presentation args~ +** Processing line: ~ return unless args.state.tick_count > args.state.next_storyline~ +** Processing line: ~ return unless args.state.scene_storyline_queue~ +** Processing line: ~ next_storyline = args.state.scene_storyline_queue.shift~ +** Processing line: ~ if null_or_whitespace? next_storyline~ +** Processing line: ~ args.state.storyline_queue_empty_at ||= args.state.tick_count~ +** Processing line: ~ args.state.is_storyline_dialog_active = false~ +** Processing line: ~ return~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_gorilla gorilla, id~ -** Processing line: ~ return unless gorilla~ -** Processing line: ~ if state.banana && state.banana.owner == gorilla~ -** Processing line: ~ animation_index = state.banana.created_at.frame_index(3, 5, false)~ +** Processing line: ~ args.state.storyline_to_show = next_storyline~ +** Processing line: ~ args.state.is_storyline_dialog_active = true~ +** Processing line: ~ args.state.storyline_queue_empty_at = nil~ +** Processing line: ~ if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"")~ +** Processing line: ~ args.state.next_storyline += 60~ +** Processing line: ~ elsif next_storyline.end_with?(",")~ +** Processing line: ~ args.state.next_storyline += 50~ +** Processing line: ~ elsif next_storyline.end_with?(":")~ +** Processing line: ~ args.state.next_storyline += 60~ +** Processing line: ~ else~ +** Processing line: ~ default_word_delay = 13 + args.state.word_delay - 8~ +** Processing line: ~ if next_storyline.gsub("-", "").gsub("~", "").length <= 4~ +** Processing line: ~ default_word_delay = 11 + args.state.word_delay - 8~ ** Processing line: ~ end~ -** Processing line: ~ if !animation_index~ -** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"]~ +** Processing line: ~ number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length~ +** Processing line: ~ args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1)~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_reload_current_scene args~ +** Processing line: ~ return~ +** Processing line: ~ if args.inputs.keyboard.key_down.r!~ +** Processing line: ~ reload_current_scene~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_dismiss_current_storyline args~ +** Processing line: ~ if args.inputs.keyboard.key_down.x!~ +** Processing line: ~ args.state.scene_storyline_queue.clear~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_restart_game args~ +** Processing line: ~ if args.inputs.keyboard.exclamation_point~ +** Processing line: ~ args.gtk.reset_state~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_change_word_delay args~ +** Processing line: ~ if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign~ +** Processing line: ~ args.state.word_delay -= 2~ +** Processing line: ~ if args.state.word_delay < 0~ +** Processing line: ~ args.state.word_delay = 0~ +** Processing line: ~ # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?"~ ** Processing line: ~ else~ -** Processing line: ~ outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"]~ +** Processing line: ~ # queue_storyline_text args, "Text speed INCREASED."~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_gorillas~ -** Processing line: ~ render_gorilla state.player_1, :left~ -** Processing line: ~ render_gorilla state.player_2, :right~ +** Processing line: ~ if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore~ +** Processing line: ~ args.state.word_delay += 2~ +** Processing line: ~ # queue_storyline_text args, "Text speed DECREASED."~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_value_insertion~ -** Processing line: ~ return if state.banana~ -** Processing line: ~ return if state.over~ +** Processing line: ~ def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil~ +** Processing line: ~ texts.each_with_index.map do |t, i|~ +** Processing line: ~ [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)]~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.current_turn == :player_1_angle~ -** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white]~ -** Processing line: ~ elsif state.current_turn == :player_1_velocity~ -** Processing line: ~ outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white]~ -** Processing line: ~ outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white]~ -** Processing line: ~ elsif state.current_turn == :player_2_angle~ -** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white]~ -** Processing line: ~ elsif state.current_turn == :player_2_velocity~ -** Processing line: ~ outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white]~ -** Processing line: ~ outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white]~ +** Processing line: ~ def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse~ +** Processing line: ~ # args.state.show_gridlines = true~ +** Processing line: ~ defaults args~ +** Processing line: ~ render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ render_controller args, lowrez_borders~ +** Processing line: ~ lowrez_solids << [0, 0, 64, 64, 0, 0, 0]~ +** Processing line: ~ calc_storyline_presentation args~ +** Processing line: ~ calc_scenes args~ +** Processing line: ~ calc_storyline_hotspot args~ +** Processing line: ~ inputs_move_player args~ +** Processing line: ~ inputs_print_mouse_rect args, lowrez_mouse~ +** Processing line: ~ inputs_reload_current_scene args~ +** Processing line: ~ inputs_dismiss_current_storyline args~ +** Processing line: ~ inputs_change_word_delay args~ +** Processing line: ~ inputs_restart_game args~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_controller args, lowrez_borders~ +** Processing line: ~ args.state.up_button = [85, 40, 15, 15, 255, 255, 255]~ +** Processing line: ~ args.state.down_button = [85, 20, 15, 15, 255, 255, 255]~ +** Processing line: ~ args.state.left_button = [65, 20, 15, 15, 255, 255, 255]~ +** Processing line: ~ args.state.right_button = [105, 20, 15, 15, 255, 255, 255]~ +** Processing line: ~ lowrez_borders << args.state.up_button~ +** Processing line: ~ lowrez_borders << args.state.down_button~ +** Processing line: ~ lowrez_borders << args.state.left_button~ +** Processing line: ~ lowrez_borders << args.state.right_button~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inputs_print_mouse_rect args, lowrez_mouse~ +** Processing line: ~ if lowrez_mouse.up~ +** Processing line: ~ args.state.mouse_held = false~ +** Processing line: ~ elsif lowrez_mouse.click~ +** Processing line: ~ mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]~ +** Processing line: ~ if args.state.up_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.y += 1~ ** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_banana~ -** Processing line: ~ return unless state.banana~ -** Processing line: ~ rotation = state.tick_count.%(360) * 20~ -** Processing line: ~ rotation *= -1 if state.banana.dx > 0~ -** Processing line: ~ outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation]~ +** Processing line: ~ if args.state.down_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.y -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.left_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.x -= 1~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.right_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.x += 1~ +** Processing line: ~ end~ +** Processing line: ~ args.state.mouse_held = true~ +** Processing line: ~ elsif args.state.mouse_held~ +** Processing line: ~ mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1]~ +** Processing line: ~ if args.state.up_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.y += 0.25~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.down_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.y -= 0.25~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.left_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.x -= 0.25~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ if args.state.right_button.intersect_rect? mouse_rect~ +** Processing line: ~ args.state.player.x += 0.25~ +** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def render_holes~ -** Processing line: ~ outputs.sprites << state.holes.map do |s|~ -** Processing line: ~ animation_index = s.created_at.frame_index(7, 3, false)~ -** Processing line: ~ if animation_index~ -** Processing line: ~ [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]]~ -** Processing line: ~ else~ -** Processing line: ~ s.sprite~ +** Processing line: ~ if lowrez_mouse.click~ +** Processing line: ~ dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x~ +** Processing line: ~ dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y~ +** Processing line: ~ x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy~ +** Processing line: ~ puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}"~ +** Processing line: ~ if args.state.previous_mouse_click~ +** Processing line: ~~ +** Processing line: ~ if dx < 0 && dx < 0~ +** Processing line: ~ x = x + w~ +** Processing line: ~ w = w.abs~ +** Processing line: ~ y = y + h~ +** Processing line: ~ h = h.abs~ ** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ w += 1~ +** Processing line: ~ h += 1~ +** Processing line: ~~ +** Processing line: ~ args.state.previous_mouse_click = nil~ +** Processing line: ~ else~ +** Processing line: ~ args.state.previous_mouse_click = lowrez_mouse.click~ +** Processing line: ~ square_x, square_y = lowrez_mouse.click~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def try_centering! word~ +** Processing line: ~ word ||= ""~ +** Processing line: ~ just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"")~ +** Processing line: ~ return word if just_word.strip.length == 0~ +** Processing line: ~ return word if just_word.include? "~"~ +** Processing line: ~ return "~#{word}" if just_word.length <= 2~ +** Processing line: ~ if just_word.length.mod_zero? 2~ +** Processing line: ~ center_index = just_word.length.idiv(2) - 1~ +** Processing line: ~ else~ +** Processing line: ~ center_index = (just_word.length - 1).idiv(2)~ +** Processing line: ~ end~ +** Processing line: ~ return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_storyline args, scene~ +** Processing line: ~ queue_storyline_text args, scene[:storyline]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def queue_storyline_text args, text~ +** Processing line: ~ args.state.last_story_line_text = text~ +** Processing line: ~ args.state.storyline_history << text if text~ +** Processing line: ~ words = (text || "").split(" ")~ +** Processing line: ~ words = words.map { |w| try_centering! w }~ +** Processing line: ~ args.state.scene_storyline_queue = words~ +** Processing line: ~ if args.state.scene_storyline_queue.length != 0~ +** Processing line: ~ args.state.scene_storyline_queue.unshift "~$--"~ +** Processing line: ~ args.state.storyline_to_show = "~."~ +** Processing line: ~ else~ +** Processing line: ~ args.state.storyline_to_show = ""~ +** Processing line: ~ end~ +** Processing line: ~ args.state.scene_storyline_queue << ""~ +** Processing line: ~ args.state.next_storyline = args.state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def set_scene args, scene~ +** Processing line: ~ args.state.current_scene = scene~ +** Processing line: ~ args.state.background = scene[:background] || 'sprites/todo.png'~ +** Processing line: ~ args.state.scene_fade = scene[:fade] || 0~ +** Processing line: ~ args.state.scenes = (scene[:scenes] || []).reject { |s| !s }~ +** Processing line: ~ args.state.scene_render_override = scene[:render_override]~ +** Processing line: ~ args.state.storylines = (scene[:storylines] || []).reject { |s| !s }~ +** Processing line: ~ args.state.scene_changed_at = args.state.tick_count~ +** Processing line: ~ if scene[:player]~ +** Processing line: ~ args.state.player = scene[:player]~ +** Processing line: ~ end~ +** Processing line: ~ args.state.inside_scene_hotspot = false~ +** Processing line: ~ args.state.inside_storyline_hotspot = false~ +** Processing line: ~ queue_storyline args, scene~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def replay_storyline_rect~ +** Processing line: ~ [26, -1, 7, 4]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def labels_for_word word~ +** Processing line: ~ left_side_of_word = ""~ +** Processing line: ~ center_letter = ""~ +** Processing line: ~ right_side_of_word = ""~ +** Processing line: ~~ +** Processing line: ~ if word[0] == "~"~ +** Processing line: ~ left_side_of_word = ""~ +** Processing line: ~ center_letter = word[1]~ +** Processing line: ~ right_side_of_word = word[2..-1]~ +** Processing line: ~ elsif word.length > 0~ +** Processing line: ~ left_side_of_word, right_side_of_word = word.split("~")~ +** Processing line: ~ center_letter = right_side_of_word[0]~ +** Processing line: ~ right_side_of_word = right_side_of_word[1..-1]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ right_side_of_word = right_side_of_word.gsub("-", "")~ +** Processing line: ~~ +** Processing line: ~ {~ +** Processing line: ~ left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word],~ +** Processing line: ~ center: [29, 2, center_letter, 255, 0, 0],~ +** Processing line: ~ right: [34, 2, right_side_of_word]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_scenes args, lowrez_sprites~ +** Processing line: ~ lowrez_sprites << args.state.scenes.flat_map do |hs|~ +** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_storylines args, lowrez_sprites~ +** Processing line: ~ lowrez_sprites << args.state.storylines.flat_map do |hs|~ +** Processing line: ~ hotspot_square args, hs.x, hs.y, hs.w, hs.h~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def adornments_alpha args, target_alpha = nil, minimum_alpha = nil~ +** Processing line: ~ return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at~ +** Processing line: ~ target_alpha ||= 255~ +** Processing line: ~ target_alpha * args.state.storyline_queue_empty_at.ease(60)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def hotspot_square args, x, y, w, h~ +** Processing line: ~ if w >= 3 && h >= 3~ +** Processing line: ~ [~ +** Processing line: ~ [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23],~ +** Processing line: ~ [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223],~ +** Processing line: ~ [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40],~ +** Processing line: ~ ]~ +** Processing line: ~ else~ +** Processing line: ~ [~ +** Processing line: ~ [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0],~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_storyline_dialog args, lowrez_labels, lowrez_sprites~ +** Processing line: ~ return unless args.state.is_storyline_dialog_active~ +** Processing line: ~ return unless args.state.storyline_to_show~ +** Processing line: ~ labels = labels_for_word args.state.storyline_to_show~ +** Processing line: ~ if true # high rez version~ +** Processing line: ~ scale = 8.88~ +** Processing line: ~ offset = 45~ +** Processing line: ~ size = 25~ +** Processing line: ~ args.outputs.labels << [offset + labels[:left].x.-(1) * scale,~ +** Processing line: ~ labels[:left].y * TINY_SCALE + 55,~ +** Processing line: ~ labels[:left].text, size, 0, 0, 0, 0, 255,~ +** Processing line: ~ 'fonts/manaspc.ttf']~ +** Processing line: ~ center_text = labels[:center].text~ +** Processing line: ~ center_text = "|" if center_text == "$"~ +** Processing line: ~ args.outputs.labels << [offset + labels[:center].x * scale,~ +** Processing line: ~ labels[:center].y * TINY_SCALE + 55,~ +** Processing line: ~ center_text, size, 0, 255, 0, 0, 255,~ +** Processing line: ~ 'fonts/manaspc.ttf']~ +** Processing line: ~ args.outputs.labels << [offset + labels[:right].x * scale,~ +** Processing line: ~ labels[:right].y * TINY_SCALE + 55,~ +** Processing line: ~ labels[:right].text, size, 0, 0, 0, 0, 255,~ +** Processing line: ~ 'fonts/manaspc.ttf']~ +** Processing line: ~ else~ +** Processing line: ~ lowrez_labels << labels[:left]~ +** Processing line: ~ lowrez_labels << labels[:center]~ +** Processing line: ~ lowrez_labels << labels[:right]~ +** Processing line: ~ end~ +** Processing line: ~ args.state.is_storyline_dialog_active = true~ +** Processing line: ~ render_player args, lowrez_sprites~ +** Processing line: ~ lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png']~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_player args, lowrez_sprites~ +** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_adornments args, lowrez_sprites~ +** Processing line: ~ render_scenes args, lowrez_sprites~ +** Processing line: ~ render_storylines args, lowrez_sprites~ +** Processing line: ~ return if args.state.is_storyline_dialog_active~ +** Processing line: ~ lowrez_sprites << player_md_down(args, *args.state.player)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def global_alpha_percentage args, max_alpha = 255~ +** Processing line: ~ return 255 unless args.state.scene_changed_at~ +** Processing line: ~ return 255 unless args.state.scene_fade~ +** Processing line: ~ return 255 unless args.state.scene_fade > 0~ +** Processing line: ~ return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)]~ +** Processing line: ~ if args.state.scene_render_override~ +** Processing line: ~ send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ end~ +** Processing line: ~ storyline_to_show = args.state.storyline_to_show || ""~ +** Processing line: ~ render_adornments args, lowrez_sprites~ +** Processing line: ~ render_storyline_dialog args, lowrez_labels, lowrez_sprites~ +** Processing line: ~~ +** Processing line: ~ if args.state.background == 'sprites/tribute-game-over.png'~ +** Processing line: ~ lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0]~ +** Processing line: ~ lowrez_labels << [9, 6, 'Return of', 255, 255, 255]~ +** Processing line: ~ lowrez_labels << [9, 1, ' Serenity', 255, 255, 255]~ +** Processing line: ~ if !args.state.ended~ +** Processing line: ~ args.gtk.stop_music~ +** Processing line: ~ args.outputs.sounds << 'sounds/music-loop.ogg'~ +** Processing line: ~ args.state.ended = true~ ** Processing line: ~ end~ ** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def player_md_right args, x, y~ +** Processing line: ~ [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ calc_generate_stage~ -** Processing line: ~ calc_current_turn~ -** Processing line: ~ calc_banana~ -** Processing line: ~ end~ +** Processing line: ~ def player_md_left args, x, y~ +** Processing line: ~ [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_current_turn~ -** Processing line: ~ return if state.current_turn~ +** Processing line: ~ def player_md_up args, x, y~ +** Processing line: ~ [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.current_turn = :player_1_angle~ -** Processing line: ~ state.current_turn = :player_2_angle if state.first_strike == :player_2~ -** Processing line: ~ end~ +** Processing line: ~ def player_md_down args, x, y~ +** Processing line: ~ [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_generate_stage~ -** Processing line: ~ return if state.stage_generated~ +** Processing line: ~ def player_sm args, x, y~ +** Processing line: ~ [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.buildings << building_prefab(state.building_spacing + -20, *random_building_size)~ -** Processing line: ~ 8.numbers.inject(state.buildings) do |buildings, i|~ -** Processing line: ~ buildings <<~ -** Processing line: ~ building_prefab(state.building_spacing +~ -** Processing line: ~ state.buildings.last.right,~ -** Processing line: ~ *random_building_size)~ -** Processing line: ~ end~ +** Processing line: ~ def player_xs args, x, y~ +** Processing line: ~ [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ building_two = state.buildings[1]~ -** Processing line: ~ state.player_1 = new_player(building_two.x + building_two.w.fdiv(2),~ -** Processing line: ~ building_two.h)~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ building_nine = state.buildings[-3]~ -** Processing line: ~ state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2),~ -** Processing line: ~ building_nine.h)~ -** Processing line: ~ state.stage_generated = true~ -** Processing line: ~ state.wind = 1.randomize(:ratio, :sign)~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def new_player x, y~ -** Processing line: ~ state.new_entity(:gorilla) do |p|~ -** Processing line: ~ p.x = x - 25~ -** Processing line: ~ p.y = y~ -** Processing line: ~ p.solid = [p.x, p.y, 50, 50]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - repl.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - repl.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def calc_banana~ -** Processing line: ~ return unless state.banana~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb~ +** Processing line: ~ puts $gtk.args.state.current_scene~ ** Processing line: ~~ -** Processing line: ~ state.banana.x += state.banana.dx~ -** Processing line: ~ state.banana.dx += state.wind.fdiv(50)~ -** Processing line: ~ state.banana.y += state.banana.dy~ -** Processing line: ~ state.banana.dy -= state.gravity~ -** Processing line: ~ banana_collision = [state.banana.x, state.banana.y, 10, 10]~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid)~ -** Processing line: ~ state.over = true~ -** Processing line: ~ if state.banana.owner == state.player_2~ -** Processing line: ~ state.winner = :player_2~ -** Processing line: ~ else~ -** Processing line: ~ state.winner = :player_1~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.player_2_score += 1~ -** Processing line: ~ elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid)~ -** Processing line: ~ state.over = true~ -** Processing line: ~ if state.banana.owner == state.player_2~ -** Processing line: ~ state.winner = :player_1~ -** Processing line: ~ else~ -** Processing line: ~ state.winner = :player_2~ -** Processing line: ~ end~ -** Processing line: ~ state.player_1_score += 1~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - require.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - require.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ if state.over~ -** Processing line: ~ place_hole~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb~ +** Processing line: ~ require 'app/lowrez_simulator.rb'~ +** Processing line: ~ require 'app/storyline_day_one.rb'~ +** Processing line: ~ require 'app/storyline_blinking_light.rb'~ +** Processing line: ~ require 'app/storyline_serenity_introduction.rb'~ +** Processing line: ~ require 'app/storyline_speed_of_light.rb'~ +** Processing line: ~ require 'app/storyline_serenity_alive.rb'~ +** Processing line: ~ require 'app/storyline_serenity_bio.rb'~ +** Processing line: ~ require 'app/storyline_anka.rb'~ +** Processing line: ~ require 'app/storyline_final_message.rb'~ +** Processing line: ~ require 'app/storyline_final_decision.rb'~ +** Processing line: ~ require 'app/storyline.rb'~ ** Processing line: ~~ -** Processing line: ~ return if state.holes.any? do |h|~ -** Processing line: ~ h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10]~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ return unless state.banana.y < 0 || state.buildings.any? do |b|~ -** Processing line: ~ b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ place_hole~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def place_hole~ -** Processing line: ~ return unless state.banana~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb~ +** Processing line: ~ def hotspot_top~ +** Processing line: ~ [4, 61, 56, 3]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.holes << state.new_entity(:banana) do |b|~ -** Processing line: ~ b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png']~ -** Processing line: ~ end~ +** Processing line: ~ def hotspot_bottom~ +** Processing line: ~ [4, 0, 56, 3]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.banana = nil~ -** Processing line: ~ end~ +** Processing line: ~ def hotspot_top_right~ +** Processing line: ~ [62, 35, 3, 25]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs_main~ -** Processing line: ~ return if state.banana~ -** Processing line: ~ return if state.over~ +** Processing line: ~ def hotspot_bottom_right~ +** Processing line: ~ [62, 0, 3, 25]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.key_down.enter~ -** Processing line: ~ input_execute_turn~ -** Processing line: ~ elsif inputs.keyboard.key_down.backspace~ -** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ -** Processing line: ~ state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2]~ -** Processing line: ~ elsif inputs.keyboard.key_down.char~ -** Processing line: ~ state.as_hash[state.current_turn] ||= ""~ -** Processing line: ~ state.as_hash[state.current_turn] += inputs.keyboard.key_down.char~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def storyline_history_include? args, text~ +** Processing line: ~ args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs_game_over~ -** Processing line: ~ return unless state.over~ -** Processing line: ~ return unless inputs.keyboard.key_down.truthy_keys.any?~ -** Processing line: ~ state.over = false~ -** Processing line: ~ outputs.static_solids.clear~ -** Processing line: ~ state.buildings.clear~ -** Processing line: ~ state.holes.clear~ -** Processing line: ~ state.stage_generated = false~ -** Processing line: ~ state.stage_rendered = false~ -** Processing line: ~ if state.first_strike == :player_1~ -** Processing line: ~ state.first_strike = :player_2~ -** Processing line: ~ else~ -** Processing line: ~ state.first_strike = :player_1~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def process_inputs~ -** Processing line: ~ process_inputs_main~ -** Processing line: ~ process_inputs_game_over~ -** Processing line: ~ end~ +** Processing line: ~ def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_execute_turn~ -** Processing line: ~ return if state.banana~ +** Processing line: ~ def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle)~ -** Processing line: ~ state.current_turn = :player_1_velocity~ -** Processing line: ~ elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity)~ -** Processing line: ~ state.current_turn = :player_2_angle~ -** Processing line: ~ state.banana =~ -** Processing line: ~ new_banana(state.player_1,~ -** Processing line: ~ state.player_1.x + 25,~ -** Processing line: ~ state.player_1.y + 60,~ -** Processing line: ~ state.player_1_angle,~ -** Processing line: ~ state.player_1_velocity)~ -** Processing line: ~ elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle)~ -** Processing line: ~ state.current_turn = :player_2_velocity~ -** Processing line: ~ elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity)~ -** Processing line: ~ state.current_turn = :player_1_angle~ -** Processing line: ~ state.banana =~ -** Processing line: ~ new_banana(state.player_2,~ -** Processing line: ~ state.player_2.x + 25,~ -** Processing line: ~ state.player_2.y + 60,~ -** Processing line: ~ 180 - state.player_2_angle,~ -** Processing line: ~ state.player_2_velocity)~ -** Processing line: ~ end~ +** Processing line: ~ def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.banana~ -** Processing line: ~ state.player_1_angle = nil~ -** Processing line: ~ state.player_1_velocity = nil~ -** Processing line: ~ state.player_2_angle = nil~ -** Processing line: ~ state.player_2_velocity = nil~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids~ +** Processing line: ~ lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def random_building_size~ -** Processing line: ~ [state.building_heights.sample, state.building_room_sizes.sample]~ -** Processing line: ~ end~ +** Processing line: ~ def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = []~ +** Processing line: ~ result_one_scene, result_one_label, result_one_text = context_result_one~ +** Processing line: ~ result_two_scene, result_two_label, result_two_text = context_result_two~ +** Processing line: ~ result_three_scene, result_three_label, result_three_text = context_result_three~ +** Processing line: ~ result_four_scene, result_four_label, result_four_text = context_result_four~ ** Processing line: ~~ -** Processing line: ~ def int? v~ -** Processing line: ~ v.to_i.to_s == v.to_s~ -** Processing line: ~ end~ +** Processing line: ~ top_level_hash = {~ +** Processing line: ~ background: 'sprites/decision.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [20, 36],~ +** Processing line: ~ storylines: [ ],~ +** Processing line: ~ scenes: [ ]~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ def random_building_color~ -** Processing line: ~ [[ 99, 0, 107],~ -** Processing line: ~ [ 35, 64, 124],~ -** Processing line: ~ [ 35, 136, 162],~ -** Processing line: ~ ].sample~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_one_hash = {~ +** Processing line: ~ background: 'sprites/decision.png',~ +** Processing line: ~ scenes: [ ],~ +** Processing line: ~ storylines: [ ]~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ def random_window_color~ -** Processing line: ~ [[ 88, 62, 104],~ -** Processing line: ~ [253, 224, 187]].sample~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_two_hash = {~ +** Processing line: ~ background: 'sprites/decision.png',~ +** Processing line: ~ scenes: [ ],~ +** Processing line: ~ storylines: [ ]~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ def windows_for_building starting_x, floors, rooms~ -** Processing line: ~ floors.-(1).combinations(rooms - 1).map do |floor, room|~ -** Processing line: ~ [starting_x +~ -** Processing line: ~ state.building_room_width.*(room) +~ -** Processing line: ~ state.building_room_spacing.*(room + 1),~ -** Processing line: ~ state.building_room_height.*(floor) +~ -** Processing line: ~ state.building_room_spacing.*(floor + 1),~ -** Processing line: ~ state.building_room_width,~ -** Processing line: ~ state.building_room_height,~ -** Processing line: ~ random_window_color]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_three_hash = {~ +** Processing line: ~ background: 'sprites/decision.png',~ +** Processing line: ~ scenes: [ ],~ +** Processing line: ~ storylines: [ ]~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ def building_prefab starting_x, floors, rooms~ -** Processing line: ~ state.new_entity(:building) do |b|~ -** Processing line: ~ b.x = starting_x~ -** Processing line: ~ b.y = 0~ -** Processing line: ~ b.w = state.building_room_width.*(rooms) +~ -** Processing line: ~ state.building_room_spacing.*(rooms + 1)~ -** Processing line: ~ b.h = state.building_room_height.*(floors) +~ -** Processing line: ~ state.building_room_spacing.*(floors + 1)~ -** Processing line: ~ b.right = b.x + b.w~ -** Processing line: ~ b.rect = [b.x, b.y, b.w, b.h]~ -** Processing line: ~ b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white],~ -** Processing line: ~ [b.x, b.y, b.w, b.h, random_building_color],~ -** Processing line: ~ windows_for_building(b.x, floors, rooms)]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_four_hash = {~ +** Processing line: ~ background: 'sprites/decision.png',~ +** Processing line: ~ scenes: [ ],~ +** Processing line: ~ storylines: [ ]~ +** Processing line: ~ }~ ** Processing line: ~~ -** Processing line: ~ def parse_or_clear! game_prop~ -** Processing line: ~ if int? state.as_hash[game_prop]~ -** Processing line: ~ state.as_hash[game_prop] = state.as_hash[game_prop].to_i~ -** Processing line: ~ return true~ -** Processing line: ~ end~ +** Processing line: ~ top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message]~ +** Processing line: ~ top_level_hash[:storylines] << [20, 35, 4, 4, context_action]~ ** Processing line: ~~ -** Processing line: ~ state.as_hash[game_prop] = nil~ -** Processing line: ~ return false~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ +** Processing line: ~ confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene]~ +** Processing line: ~ confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""]~ +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ +** Processing line: ~ confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ ** Processing line: ~~ -** Processing line: ~ def new_banana owner, x, y, angle, velocity~ -** Processing line: ~ state.new_entity(:banana) do |b|~ -** Processing line: ~ b.owner = owner~ -** Processing line: ~ b.x = x~ -** Processing line: ~ b.y = y~ -** Processing line: ~ b.angle = angle % 360~ -** Processing line: ~ b.velocity = velocity / 5~ -** Processing line: ~ b.dx = b.angle.vector_x(b.velocity)~ -** Processing line: ~ b.dy = b.angle.vector_y(b.velocity)~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ +** Processing line: ~ confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ +** Processing line: ~ confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene]~ +** Processing line: ~ confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""]~ ** Processing line: ~~ -** Processing line: ~ def fancy_white~ -** Processing line: ~ [253, 252, 253]~ -** Processing line: ~ end~ +** Processing line: ~ confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash]~ +** Processing line: ~ confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene]~ +** Processing line: ~ confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""]~ +** Processing line: ~ confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash]~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene]~ +** Processing line: ~ confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""]~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash]~ +** Processing line: ~ confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~~ +** Processing line: ~ top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash]~ +** Processing line: ~ top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene~ +** Processing line: ~ top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene~ +** Processing line: ~ top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash]~ +** Processing line: ~~ +** Processing line: ~ top_level_hash~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ $you_so_basic_gorillas = YouSoBasicGorillas.new~ +** Processing line: ~ def ship_control_hotspot offset_x, offset_y, a, b, c, d~ +** Processing line: ~ results = []~ +** Processing line: ~ results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a~ +** Processing line: ~ results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b~ +** Processing line: ~ results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c~ +** Processing line: ~ results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d~ +** Processing line: ~ results~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ $you_so_basic_gorillas.outputs = args.outputs~ -** Processing line: ~ $you_so_basic_gorillas.grid = args.grid~ -** Processing line: ~ $you_so_basic_gorillas.state = args.state~ -** Processing line: ~ $you_so_basic_gorillas.inputs = args.inputs~ -** Processing line: ~ $you_so_basic_gorillas.tick~ +** Processing line: ~ def reload_current_scene~ +** Processing line: ~ if $gtk.args.state.last_hotspot_scene~ +** Processing line: ~ set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args)~ +** Processing line: ~ tick $gtk.args~ +** Processing line: ~ elsif respond_to? :set_scene~ +** Processing line: ~ set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args)~ +** Processing line: ~ tick $gtk.args~ +** Processing line: ~ end~ +** Processing line: ~ $gtk.console.close~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/repl.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_anka.rb~ - H1 detected. -- Formatting line: ~99_genre_platformer/gorillas_basic/app/repl.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_anka.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ begin~ -** Processing line: ~ if $gtk.args.state.current_turn == :player_1_angle~ -** Processing line: ~ $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}"~ -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ -** Processing line: ~ $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ -** Processing line: ~ elsif $gtk.args.state.current_turn == :player_2_angle~ -** Processing line: ~ $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}"~ -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ -** Processing line: ~ $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}"~ -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb~ +** Processing line: ~ def anka_inside_room args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 35],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, -1, 8, 3, :anka_observatory]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [51, 12],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :anka_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ player: [32, 4],~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 45, 17, 4, (anka_last_reply args)],~ +** Processing line: ~ [45, 45, 4, 4, (anka_current_reply args)],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_top_right, :reply_to_anka]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def reply_to_anka args~ +** Processing line: ~ decision_graph anka_current_reply(args),~ +** Processing line: ~ "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?",~ +** Processing line: ~ [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth],~ +** Processing line: ~ [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_last_reply args~ +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ +** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ ** Processing line: ~ else~ -** Processing line: ~ $you_so_basic_gorillas.input_execute_turn~ +** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_reply_whole_truth~ +** Processing line: ~ "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_reply_half_truth~ +** Processing line: ~ "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon."~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def replied_with_whole_truth args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"],~ +** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def replied_with_half_truth args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"],~ +** Processing line: ~ [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def anka_current_reply args~ +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ +** Processing line: ~ return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ +** Processing line: ~ else~ +** Processing line: ~ return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay."~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def replied_to_anka_back_home args~ +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ +** Processing line: ~ return {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 4],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 38, 12, 13, :final_message_sad],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ else~ +** Processing line: ~ return {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 4],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 38, 12, 13, :final_message_happy],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ -** Processing line: ~ rescue Exception => e~ -** Processing line: ~ puts e~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/tests.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb~ - H1 detected. -- Formatting line: ~99_genre_platformer/gorillas_basic/app/tests.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_blinking_light.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ $gtk.reset 100~ -** Processing line: ~ $gtk.supress_framerate_warning = true~ -** Processing line: ~ $gtk.require 'app/tests/building_generation_tests.rb'~ -** Processing line: ~ $gtk.tests.start~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb~ +** Processing line: ~ def the_blinking_light args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [16, 13],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [52, 24, 11, 5, :blinking_light_mountain_pass],~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+end_src~ -- PRE end detected. +** Processing line: ~ def blinking_light_mountain_pass args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ +** Processing line: ~ player: [4, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [18, 47, 5, 5, :blinking_light_path_to_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def blinking_light_path_to_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [60, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 26, 5, 5, :blinking_light_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb~ -- H1 detected. -- Formatting line: ~99_genre_platformer/gorillas_basic/app/tests/building_generation_tests.rb~ -- Line's tilde count is: 0 -- Line contains link marker: false +** Processing line: ~ def blinking_light_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [28, 39, 4, 10, :blinking_light_inside_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~#+begin_src ruby~ -- PRE start detected. -** Processing line: ~ def test_solids args, assert~ -** Processing line: ~ game = YouSoBasicGorillas.new~ -** Processing line: ~ game.outputs = args.outputs~ -** Processing line: ~ game.grid = args.grid~ -** Processing line: ~ game.state = args.state~ -** Processing line: ~ game.inputs = args.inputs~ -** Processing line: ~ game.tick~ -** Processing line: ~ assert.true! args.state.stage_generated, "stage wasn't generated but it should have been"~ -** Processing line: ~ game.tick~ -** Processing line: ~ assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered"~ -** Processing line: ~ number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end)~ -** Processing line: ~ the_only_background = 1~ -** Processing line: ~ static_solids = args.outputs.static_solids.length~ -** Processing line: ~ assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered"~ +** Processing line: ~ def blinking_light_inside_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :blinking_light_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def blinking_light_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [62, 32, 4, 32, :reply_to_introduction]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."],~ +** Processing line: ~ [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"],~ +** Processing line: ~ [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."],~ +** Processing line: ~ [14, 20, 24, 4, "What the heck activated--- this thing- though?"]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_platformer/the_little_probe/app/main.rb~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_day_one.rb~ - H1 detected. -- Formatting line: ~99_genre_platformer/the_little_probe/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_day_one.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. -** Processing line: ~ class FallingCircle~ -** Processing line: ~ attr_gtk~ -** Processing line: ~~ -** Processing line: ~ def tick~ -** Processing line: ~ fiddle~ -** Processing line: ~ defaults~ -** Processing line: ~ render~ -** Processing line: ~ input~ -** Processing line: ~ calc~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def fiddle~ -** Processing line: ~ state.gravity = -0.02~ -** Processing line: ~ circle.radius = 15~ -** Processing line: ~ circle.elasticity = 0.4~ -** Processing line: ~ camera.follow_speed = 0.4 * 0.4~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render~ -** Processing line: ~ render_stage_editor~ -** Processing line: ~ render_debug~ -** Processing line: ~ render_game~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def defaults~ -** Processing line: ~ if state.tick_count == 0~ -** Processing line: ~ outputs.sounds << "sounds/bg.ogg"~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ state.storyline ||= [~ -** Processing line: ~ { text: "<- -> to aim, hold space to charge", distance_gate: 0 },~ -** Processing line: ~ { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 },~ -** Processing line: ~ { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 },~ -** Processing line: ~ { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 },~ -** Processing line: ~ { text: "jupiter's sure is beautiful...", distance_gate: 4000 },~ -** Processing line: ~ { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 },~ -** Processing line: ~ { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 },~ -** Processing line: ~ { text: "#todo... look i ran out of time -_-", distance_gate: 9000 },~ -** Processing line: ~ { text: "there's never enough time", distance_gate: 9000 },~ -** Processing line: ~ { text: "the game jam was fun though ^_^", distance_gate: 10000 },~ +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb~ +** Processing line: ~ def day_one_beginning args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [16, 13],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 0, 64, 2, :day_one_infront_of_home],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."]~ ** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ load_level force: args.state.tick_count == 0~ -** Processing line: ~ state.line_mode ||= :terrain~ -** Processing line: ~~ -** Processing line: ~ state.sound_index ||= 1~ -** Processing line: ~ circle.potential_lift ||= 0~ -** Processing line: ~ circle.angle ||= 90~ -** Processing line: ~ circle.check_point_at ||= -1000~ -** Processing line: ~ circle.game_over_at ||= -1000~ -** Processing line: ~ circle.x ||= -485~ -** Processing line: ~ circle.y ||= 12226~ -** Processing line: ~ circle.check_point_x ||= circle.x~ -** Processing line: ~ circle.check_point_y ||= circle.y~ -** Processing line: ~ circle.dy ||= 0~ -** Processing line: ~ circle.dx ||= 0~ -** Processing line: ~ circle.previous_dy ||= 0~ -** Processing line: ~ circle.previous_dx ||= 0~ -** Processing line: ~ circle.angle ||= 0~ -** Processing line: ~ circle.after_images ||= []~ -** Processing line: ~ circle.terrains_to_monitor ||= {}~ -** Processing line: ~ circle.impact_history ||= []~ -** Processing line: ~~ -** Processing line: ~ camera.x ||= 0~ -** Processing line: ~ camera.y ||= 0~ -** Processing line: ~ camera.target_x ||= 0~ -** Processing line: ~ camera.target_y ||= 0~ -** Processing line: ~ state.snaps ||= { }~ -** Processing line: ~ state.snap_number = 10~ -** Processing line: ~~ -** Processing line: ~ args.state.storyline_x ||= -1000~ -** Processing line: ~ args.state.storyline_y ||= -1000~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_game~ -** Processing line: ~ outputs.background_color = [0, 0, 0]~ -** Processing line: ~ outputs.sprites << [-circle.x + 1100,~ -** Processing line: ~ -circle.y - 100,~ -** Processing line: ~ 2416 * 4,~ -** Processing line: ~ 3574 * 4,~ -** Processing line: ~ 'sprites/jupiter.png']~ -** Processing line: ~ outputs.sprites << [-circle.x,~ -** Processing line: ~ -circle.y,~ -** Processing line: ~ 2416 * 4,~ -** Processing line: ~ 3574 * 4,~ -** Processing line: ~ 'sprites/level.png']~ -** Processing line: ~ outputs.sprites << state.whisp_queue~ -** Processing line: ~ render_aiming_retical~ -** Processing line: ~ render_circle~ -** Processing line: ~ render_notification~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_notification~ -** Processing line: ~ toast_length = 500~ -** Processing line: ~ if circle.game_over_at.elapsed_time < toast_length~ -** Processing line: ~ label_text = "..."~ -** Processing line: ~ elsif circle.check_point_at.elapsed_time > toast_length~ -** Processing line: ~ args.state.current_storyline = nil~ -** Processing line: ~ return~ -** Processing line: ~ end~ -** Processing line: ~ if circle.check_point_at &&~ -** Processing line: ~ circle.check_point_at.elapsed_time == 1 &&~ -** Processing line: ~ !args.state.current_storyline~ -** Processing line: ~ if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate]~ -** Processing line: ~ args.state.current_storyline = args.state.storyline.shift[:text]~ -** Processing line: ~ args.state.distance_traveled ||= 0~ -** Processing line: ~ args.state.storyline_x = circle.x~ -** Processing line: ~ args.state.storyline_y = circle.y~ -** Processing line: ~ end~ -** Processing line: ~ return unless args.state.current_storyline~ -** Processing line: ~ end~ -** Processing line: ~ label_text = args.state.current_storyline~ -** Processing line: ~ return unless label_text~ -** Processing line: ~ x = circle.x + camera.x~ -** Processing line: ~ y = circle.y + camera.y - 40~ -** Processing line: ~ w = 900~ -** Processing line: ~ h = 30~ -** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid~ -** Processing line: ~ outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border~ -** Processing line: ~ outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_aiming_retical~ -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5,~ -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5,~ -** Processing line: ~ 10, 10, 'sprites/circle-orange.png']~ -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ -** Processing line: ~ 10, 10, 'sprites/circle-orange.png', 0, 128]~ -** Processing line: ~ if rand > 0.9~ -** Processing line: ~ outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5,~ -** Processing line: ~ state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5,~ -** Processing line: ~ 10, 10, 'sprites/circle-white.png', 0, 128]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_circle~ -** Processing line: ~ outputs.sprites << circle.after_images.map do |ai|~ -** Processing line: ~ ai.merge(x: ai.x + state.camera.x - circle.radius,~ -** Processing line: ~ y: ai.y + state.camera.y - circle.radius,~ -** Processing line: ~ w: circle.radius * 2,~ -** Processing line: ~ h: circle.radius * 2,~ -** Processing line: ~ path: 'sprites/circle-white.png')~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ outputs.sprites << [(circle.x - circle.radius) + state.camera.x,~ -** Processing line: ~ (circle.y - circle.radius) + state.camera.y,~ -** Processing line: ~ circle.radius * 2,~ -** Processing line: ~ circle.radius * 2,~ -** Processing line: ~ 'sprites/probe.png']~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def render_debug~ -** Processing line: ~ return unless state.debug_mode~ -** Processing line: ~~ -** Processing line: ~ outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0]~ -** Processing line: ~ outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255]~ -** Processing line: ~~ -** Processing line: ~ args.outputs.lines << trajectory(circle).line.to_hash.tap do |h|~ -** Processing line: ~ h[:x] += state.camera.x~ -** Processing line: ~ h[:y] += state.camera.y~ -** Processing line: ~ h[:x2] += state.camera.x~ -** Processing line: ~ h[:y2] += state.camera.y~ -** Processing line: ~ end~ +** Processing line: ~ def day_one_infront_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/front-of-home.png',~ +** Processing line: ~ player: [56, 23],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [43, 34, 10, 16, :day_one_home],~ +** Processing line: ~ [62, 0, 3, 40, :day_one_beginning],~ +** Processing line: ~ [0, 4, 3, 20, :day_one_ceremony]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.primitives << state.terrain.find_all do |t|~ -** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ -** Processing line: ~ end.map do |t|~ +** Processing line: ~ def day_one_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 3],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [28, 0, 12, 2, :day_one_infront_of_home]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ ** Processing line: ~ [~ -** Processing line: ~ t.line.associate(r: 0, g: 255, b: 0) do |h|~ -** Processing line: ~ h.x += state.camera.x~ -** Processing line: ~ h.y += state.camera.y~ -** Processing line: ~ h.x2 += state.camera.x~ -** Processing line: ~ h.y2 += state.camera.y~ -** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ -** Processing line: ~ h[:r] = 255~ -** Processing line: ~ h[:g] = 0~ -** Processing line: ~ end~ -** Processing line: ~ h~ -** Processing line: ~ end,~ -** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ -** Processing line: ~ h.x += state.camera.x~ -** Processing line: ~ h.y += state.camera.y~ -** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ -** Processing line: ~ h~ -** Processing line: ~ end~ -** Processing line: ~ ]~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ outputs.primitives << state.lava.find_all do |t|~ -** Processing line: ~ circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360)~ -** Processing line: ~ end.map do |t|~ +** Processing line: ~ 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice."~ +** Processing line: ~ ],~ ** Processing line: ~ [~ -** Processing line: ~ t.line.associate(r: 0, g: 0, b: 255) do |h|~ -** Processing line: ~ h.x += state.camera.x~ -** Processing line: ~ h.y += state.camera.y~ -** Processing line: ~ h.x2 += state.camera.x~ -** Processing line: ~ h.y2 += state.camera.y~ -** Processing line: ~ if circle.rect.intersect_rect? t[:rect]~ -** Processing line: ~ h[:r] = 255~ -** Processing line: ~ h[:b] = 0~ -** Processing line: ~ end~ -** Processing line: ~ h~ -** Processing line: ~ end,~ -** Processing line: ~ t[:rect].border.associate(r: 255, g: 0, b: 0) do |h|~ -** Processing line: ~ h.x += state.camera.x~ -** Processing line: ~ h.y += state.camera.y~ -** Processing line: ~ h.b = 255 if line_near_rect? circle.rect, t~ -** Processing line: ~ h~ -** Processing line: ~ end~ +** Processing line: ~ 28, 7, 4, 7,~ +** Processing line: ~ "Ahhh. My reading- couch. It's so comfortable--."~ +** Processing line: ~ ],~ +** Processing line: ~ [~ +** Processing line: ~ 38, 21, 4, 4,~ +** Processing line: ~ "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use."~ +** Processing line: ~ ],~ +** Processing line: ~ [~ +** Processing line: ~ 45, 37, 4, 8,~ +** Processing line: ~ "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--."~ +** Processing line: ~ ],~ +** Processing line: ~ [~ +** Processing line: ~ 32, 40, 8, 10,~ +** Processing line: ~ "This isn't- a good time- to sleep. I- should probably- head to the ceremony-."~ +** Processing line: ~ ],~ +** Processing line: ~ [~ +** Processing line: ~ 25, 21, 5, 12,~ +** Processing line: ~ "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--."~ ** Processing line: ~ ]~ -** Processing line: ~ end~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.god_mode~ -** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ -** Processing line: ~ y: circle.rect.y + state.camera.y,~ -** Processing line: ~ g: 255)~ -** Processing line: ~ else~ -** Processing line: ~ border = circle.rect.merge(x: circle.rect.x + state.camera.x,~ -** Processing line: ~ y: circle.rect.y + state.camera.y,~ -** Processing line: ~ b: 255)~ -** Processing line: ~ end~ +** Processing line: ~ def day_one_ceremony args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute.png',~ +** Processing line: ~ player: [57, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [62, 0, 2, 40, :day_one_infront_of_home],~ +** Processing line: ~ [0, 24, 2, 40, :day_one_infront_of_library]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."],~ +** Processing line: ~ [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."],~ +** Processing line: ~ [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."],~ +** Processing line: ~ [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.borders << border~ +** Processing line: ~ def day_one_infront_of_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/outside-library.png',~ +** Processing line: ~ player: [57, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [62, 0, 2, 40, :day_one_ceremony],~ +** Processing line: ~ [49, 39, 6, 9, :day_one_library]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ overlapping ||= {}~ +** Processing line: ~ def day_one_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/library.png',~ +** Processing line: ~ player: [27, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 0, 64, 2, :end_day_one_infront_of_library]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."],~ +** Processing line: ~ [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.impact_history.each do |h|~ -** Processing line: ~ label_mod = 300~ -** Processing line: ~ x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x~ -** Processing line: ~ y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y~ -** Processing line: ~ 10.times do~ -** Processing line: ~ if overlapping[x] && overlapping[x][y]~ -** Processing line: ~ y -= 52~ -** Processing line: ~ else~ -** Processing line: ~ break~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def end_day_one_infront_of_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/outside-library.png',~ +** Processing line: ~ player: [51, 33],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [49, 39, 6, 9, :day_one_library],~ +** Processing line: ~ [62, 0, 2, 40, :end_day_one_monument],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ overlapping[x] ||= {}~ -** Processing line: ~ overlapping[x][y] ||= true~ -** Processing line: ~ outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid~ -** Processing line: ~ outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255]~ +** Processing line: ~ def end_day_one_monument args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute.png',~ +** Processing line: ~ player: [2, 36],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [62, 0, 2, 40, :end_day_one_infront_of_home],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 27, 4, 4, "It's getting late. Better get some sleep."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255]~ +** Processing line: ~ def end_day_one_infront_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/front-of-home.png',~ +** Processing line: ~ player: [1, 17],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [43, 34, 10, 16, :end_day_one_home],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [20, 10, 4, 4, "It's getting late. Better get some sleep."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def end_day_one_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 3],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, 40, 8, 10, :end_day_one_dream],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [38, 4, 4, 4, "It's getting late. Better get some sleep."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def end_day_one_dream args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/dream.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [4, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [62, 0, 2, 64, :explaining_the_special_power]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"],~ +** Processing line: ~ [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"],~ +** Processing line: ~ [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def explaining_the_special_power args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [32, 30],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [~ +** Processing line: ~ 38, 21, 4, 4, :explaining_the_special_power_inside_computer~ +** Processing line: ~ ],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~ def explaining_the_special_power_inside_computer args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/pc.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [34, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 62, 64, 3, :the_blinking_light]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."],~ +** Processing line: ~ [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."],~ +** Processing line: ~ [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."],~ +** Processing line: ~ [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if circle.floor~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0]~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0]~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255]~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0]~ -** Processing line: ~ outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255]~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def render_stage_editor~ -** Processing line: ~ return unless state.god_mode~ -** Processing line: ~ return unless state.point_one~ -** Processing line: ~ args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255]~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def trajectory body~ -** Processing line: ~ [body.x + body.dx,~ -** Processing line: ~ body.y + body.dy,~ -** Processing line: ~ body.x + body.dx * 1000,~ -** Processing line: ~ body.y + body.dy * 1000,~ -** Processing line: ~ 0, 255, 255]~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_final_decision.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_final_decision.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def lengthen_line line, num~ -** Processing line: ~ line = normalize_line(line)~ -** Processing line: ~ slope = geometry.line_slope(line, replace_infinity: 10).abs~ -** Processing line: ~ if slope < 2~ -** Processing line: ~ [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash~ -** Processing line: ~ else~ -** Processing line: ~ [line.x, line.y, line.x2, line.y2].line.to_hash~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb~ +** Processing line: ~ def final_decision_side_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 120,~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [16, 13],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [52, 24, 11, 5, :final_decision_mountain_pass],~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_side_of_home_render,~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def normalize_line line~ -** Processing line: ~ if line.x > line.x2~ -** Processing line: ~ x = line.x2~ -** Processing line: ~ y = line.y2~ -** Processing line: ~ x2 = line.x~ -** Processing line: ~ y2 = line.y~ -** Processing line: ~ else~ -** Processing line: ~ x = line.x~ -** Processing line: ~ y = line.y~ -** Processing line: ~ x2 = line.x2~ -** Processing line: ~ y2 = line.y2~ -** Processing line: ~ end~ -** Processing line: ~ [x, y, x2, y2]~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_mountain_pass args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ +** Processing line: ~ player: [4, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [18, 47, 5, 5, :final_decision_path_to_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def rect_for_line line~ -** Processing line: ~ if line.x > line.x2~ -** Processing line: ~ x = line.x2~ -** Processing line: ~ y = line.y2~ -** Processing line: ~ x2 = line.x~ -** Processing line: ~ y2 = line.y~ -** Processing line: ~ else~ -** Processing line: ~ x = line.x~ -** Processing line: ~ y = line.y~ -** Processing line: ~ x2 = line.x2~ -** Processing line: ~ y2 = line.y2~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_path_to_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [60, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 26, 5, 5, :final_decision_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ w = x2 - x~ -** Processing line: ~ h = y2 - y~ +** Processing line: ~ def final_decision_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [28, 39, 4, 10, :final_decision_inside_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if h < 0~ -** Processing line: ~ y += h~ -** Processing line: ~ h = h.abs~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_inside_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ storylines: [],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :final_decision_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if w < circle.radius~ -** Processing line: ~ x -= circle.radius~ -** Processing line: ~ w = circle.radius * 2~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ player: [32, 4],~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ storylines: [],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_top, :final_decision_ship_status],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if h < circle.radius~ -** Processing line: ~ y -= circle.radius~ -** Processing line: ~ h = circle.radius * 2~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_ship_status args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 10],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_top_right, :final_decision]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 8, 4, 4, "????"],~ +** Processing line: ~ *final_decision_ship_status_shared(args)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ { x: x, y: y, w: w, h: h }~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision args~ +** Processing line: ~ decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.",~ +** Processing line: ~ "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...",~ +** Processing line: ~ [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"],~ +** Processing line: ~ [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"],~ +** Processing line: ~ [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"],~ +** Processing line: ~ [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def snap_to_grid x, y, snaps~ -** Processing line: ~ snap_number = 10~ -** Processing line: ~ x = x.to_i~ -** Processing line: ~ y = y.to_i~ +** Processing line: ~ def final_decision_game_over_noone args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ +** Processing line: ~ player: [53, 14],~ +** Processing line: ~ fade: 600~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ x_floor = x.idiv(snap_number) * snap_number~ -** Processing line: ~ x_mod = x % snap_number~ -** Processing line: ~ x_ceil = (x.idiv(snap_number) + 1) * snap_number~ +** Processing line: ~ def final_decision_game_over_matthew args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ +** Processing line: ~ player: [53, 14],~ +** Processing line: ~ fade: 600~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ y_floor = y.idiv(snap_number) * snap_number~ -** Processing line: ~ y_mod = y % snap_number~ -** Processing line: ~ y_ceil = (y.idiv(snap_number) + 1) * snap_number~ +** Processing line: ~ def final_decision_game_over_anka args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ +** Processing line: ~ player: [53, 14],~ +** Processing line: ~ fade: 600~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if snaps[x_floor]~ -** Processing line: ~ x_result = x_floor~ -** Processing line: ~ elsif snaps[x_ceil]~ -** Processing line: ~ x_result = x_ceil~ -** Processing line: ~ elsif x_mod < snap_number.idiv(2)~ -** Processing line: ~ x_result = x_floor~ -** Processing line: ~ else~ -** Processing line: ~ x_result = x_ceil~ -** Processing line: ~ end~ +** Processing line: ~ def final_decision_game_over_sasha args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/tribute-game-over.png',~ +** Processing line: ~ player: [53, 14],~ +** Processing line: ~ fade: 600~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ snaps[x_result] ||= {}~ +** Processing line: ~ def final_decision_ship_status_shared args~ +** Processing line: ~ [~ +** Processing line: ~ *ship_control_hotspot(24, 22,~ +** Processing line: ~ "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!",~ +** Processing line: ~ "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ +** Processing line: ~ "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!",~ +** Processing line: ~ "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"),~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if snaps[x_result][y_floor]~ -** Processing line: ~ y_result = y_floor~ -** Processing line: ~ elsif snaps[x_result][y_ceil]~ -** Processing line: ~ y_result = y_ceil~ -** Processing line: ~ elsif y_mod < snap_number.idiv(2)~ -** Processing line: ~ y_result = y_floor~ -** Processing line: ~ else~ -** Processing line: ~ y_result = y_ceil~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ snaps[x_result][y_result] = true~ -** Processing line: ~ return [x_result, y_result]~ ** Processing line: ~~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_final_message.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_final_message.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def snap_line line~ -** Processing line: ~ x, y, x2, y2 = line~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb~ +** Processing line: ~ def final_message_sad args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 35],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 34, 4, 4, "Another-- sleepless-- night..."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def string_to_line s~ -** Processing line: ~ x, y, x2, y2 = s.split(',').map(&:to_f)~ +** Processing line: ~ def final_message_happy args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 35],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 34, 4, 4, "Oh man, I slept like rock!"],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, -1, 8, 3, :final_message_observatory]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if x > x2~ -** Processing line: ~ x2, x = x, x2~ -** Processing line: ~ y2, y = y, y2~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_side_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [16, 13],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [52, 24, 11, 5, :final_message_mountain_pass],~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ x, y = snap_to_grid x, y, state.snaps~ -** Processing line: ~ x2, y2 = snap_to_grid x2, y2, state.snaps~ -** Processing line: ~ [x, y, x2, y2].line.to_hash~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_mountain_pass args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ +** Processing line: ~ player: [4, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [18, 47, 5, 5, :final_message_path_to_observatory],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def load_lines file~ -** Processing line: ~ data = gtk.read_file(file) || ""~ -** Processing line: ~ data.each_line~ -** Processing line: ~ .reject { |l| l.strip.length == 0 }~ -** Processing line: ~ .map { |l| string_to_line l }~ -** Processing line: ~ .map { |h| h.merge(rect: rect_for_line(h)) }~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_path_to_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [60, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 26, 5, 5, :final_message_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def load_terrain~ -** Processing line: ~ load_lines 'level.txt'~ +** Processing line: ~ def final_message_observatory args~ +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ +** Processing line: ~ return {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [51, 12],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 10, 4, 4, "Here-- we- go..."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ else~ +** Processing line: ~ return {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [51, 12],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :final_message_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def load_lava~ -** Processing line: ~ load_lines 'level_lava.txt'~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ player: [32, 4],~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ scenes: [[45, 45, 4, 4, :final_message_check_ship_status]]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def load_level force: false~ -** Processing line: ~ if force~ -** Processing line: ~ state.snaps = {}~ -** Processing line: ~ state.terrain = load_terrain~ -** Processing line: ~ state.lava = load_lava~ -** Processing line: ~ else~ -** Processing line: ~ state.terrain ||= load_terrain~ -** Processing line: ~ state.lava ||= load_lava~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_check_ship_status args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [45, 45, 4, 4, (final_message_current args)],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_top, :final_message_ship_status],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def save_lines lines, file~ -** Processing line: ~ s = lines.map do |l|~ -** Processing line: ~ "#{l.x1},#{l.y1},#{l.x2},#{l.y2}"~ -** Processing line: ~ end.join("\n")~ -** Processing line: ~ gtk.write_file(file, s)~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_ship_status args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 10],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 50, 4, 4, :final_message_ship_status_reviewed]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."],~ +** Processing line: ~ *final_message_ship_status_shared(args)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def save_level~ -** Processing line: ~ save_lines(state.terrain, 'level.txt')~ -** Processing line: ~ save_lines(state.lava, 'level_lava.txt')~ -** Processing line: ~ load_level force: true~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_ship_status_reviewed args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom, :final_message_summary]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def line_near_rect? rect, terrain~ -** Processing line: ~ geometry.intersect_rect?(rect, terrain[:rect])~ -** Processing line: ~ end~ +** Processing line: ~ def final_message_ship_status_shared args~ +** Processing line: ~ [~ +** Processing line: ~ *ship_control_hotspot( 0, 50,~ +** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.",~ +** Processing line: ~ "Matthew's--- Chamber--: OCCUPIED----",~ +** Processing line: ~ "Aanka's--- Chamber--: OCCUPIED----",~ +** Processing line: ~ "Sasha's--- Chamber--: OCCUPIED----"),~ +** Processing line: ~ *ship_control_hotspot(12, 35,~ +** Processing line: ~ "Life- Support--: Not-- Needed---",~ +** Processing line: ~ "O2--- Production---: OFF---",~ +** Processing line: ~ "CO2--- Scrubbers---: OFF---",~ +** Processing line: ~ "H2O--- Production---: OFF---"),~ +** Processing line: ~ *ship_control_hotspot(24, 20,~ +** Processing line: ~ "Navigation: Offline---",~ +** Processing line: ~ "Sensor: OFF---",~ +** Processing line: ~ "Heads- Up- Display: DAMAGED---",~ +** Processing line: ~ "Arithmetic--- Unit: DAMAGED----"),~ +** Processing line: ~ *ship_control_hotspot(36, 35,~ +** Processing line: ~ "COMM: Underpowered----",~ +** Processing line: ~ "Text: ON---",~ +** Processing line: ~ "Audio: SEGFAULT---",~ +** Processing line: ~ "Video: DAMAGED---"),~ +** Processing line: ~ *ship_control_hotspot(48, 50,~ +** Processing line: ~ "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---",~ +** Processing line: ~ "Engine I: ON---",~ +** Processing line: ~ "Engine II: ON---",~ +** Processing line: ~ "Engine III: ON---")~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def point_within_line? point, line~ -** Processing line: ~ return false if !point~ -** Processing line: ~ return false if !line~ -** Processing line: ~ return true~ +** Processing line: ~ def final_message_last_reply args~ +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ +** Processing line: ~ return "Buffer--: #{anka_reply_whole_truth.quote}"~ +** Processing line: ~ else~ +** Processing line: ~ return "Buffer--: #{anka_reply_half_truth.quote}"~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_impacts x, dx, y, dy, radius~ -** Processing line: ~ results = { }~ -** Processing line: ~ results[:x] = x~ -** Processing line: ~ results[:y] = y~ -** Processing line: ~ results[:dx] = x~ -** Processing line: ~ results[:dy] = y~ -** Processing line: ~ results[:point] = { x: x, y: y }~ -** Processing line: ~ results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 }~ -** Processing line: ~ results[:trajectory] = trajectory(results)~ -** Processing line: ~ results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ -** Processing line: ~ {~ -** Processing line: ~ terrain: t,~ -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ -** Processing line: ~ type: :terrain~ -** Processing line: ~ }~ -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ -** Processing line: ~~ -** Processing line: ~ results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t|~ -** Processing line: ~ {~ -** Processing line: ~ terrain: t,~ -** Processing line: ~ point: geometry.line_intersect(results[:trajectory], t),~ -** Processing line: ~ type: :lava~ -** Processing line: ~ }~ -** Processing line: ~ end.reject { |t| !point_within_line? t[:point], t[:terrain] }~ -** Processing line: ~~ -** Processing line: ~ results~ +** Processing line: ~ def final_message_current args~ +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ +** Processing line: ~ return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person."~ +** Processing line: ~ else~ +** Processing line: ~ return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!"~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_potential_impacts~ -** Processing line: ~ impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius~ -** Processing line: ~ circle.rect = impact_results[:rect]~ -** Processing line: ~ circle.trajectory = impact_results[:trajectory]~ -** Processing line: ~ circle.impacts = impact_results[:impacts]~ +** Processing line: ~ def final_message_summary args~ +** Processing line: ~ if args.state.scene_history.include? :replied_with_whole_truth~ +** Processing line: ~ return {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [31, 11],~ +** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ else~ +** Processing line: ~ return {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [31, 11],~ +** Processing line: ~ scenes: [[60, 0, 4, 32, :final_decision_side_of_home]],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_terrains_to_monitor~ -** Processing line: ~ circle.impact = nil~ -** Processing line: ~ circle.impacts.each do |i|~ -** Processing line: ~ circle.terrains_to_monitor[i[:terrain]] ||= {~ -** Processing line: ~ ray_start: geometry.ray_test(circle, i[:terrain]),~ -** Processing line: ~ }~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain])~ -** Processing line: ~ if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current]~ -** Processing line: ~ if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2)~ -** Processing line: ~ circle.impact = i~ -** Processing line: ~ circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current]~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def impact_result body, impact~ -** Processing line: ~ infinity_alias = 1000~ -** Processing line: ~ r = {~ -** Processing line: ~ body: {},~ -** Processing line: ~ terrain: {},~ -** Processing line: ~ impact: {}~ -** Processing line: ~ }~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_serenity_alive.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ r[:body][:line] = body.trajectory.dup~ -** Processing line: ~ r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias)~ -** Processing line: ~ r[:body][:slope_sign] = r[:body][:slope].sign~ -** Processing line: ~ r[:body][:x] = body.x~ -** Processing line: ~ r[:body][:y] = body.y~ -** Processing line: ~ r[:body][:dy] = body.dy~ -** Processing line: ~ r[:body][:dx] = body.dx~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb~ +** Processing line: ~ def serenity_alive_side_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [16, 13],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [52, 24, 11, 5, :serenity_alive_mountain_pass],~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_side_of_home_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ r[:terrain][:line] = impact[:terrain].dup~ -** Processing line: ~ r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias)~ -** Processing line: ~ r[:terrain][:slope_sign] = r[:terrain][:slope].sign~ +** Processing line: ~ def serenity_alive_mountain_pass args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ +** Processing line: ~ player: [4, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [18, 47, 5, 5, :serenity_alive_path_to_observatory],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_mountain_pass_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias)~ -** Processing line: ~ r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y }~ -** Processing line: ~ r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign]~ -** Processing line: ~ r[:impact][:ray] = body.ray_current~ -** Processing line: ~ r[:body][:new_on_floor] = body.on_floor~ -** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ +** Processing line: ~ def serenity_alive_path_to_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [60, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 26, 5, 5, :serenity_alive_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_path_to_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3~ -** Processing line: ~ play_sound~ -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1~ -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * circle.elasticity~ -** Processing line: ~ r[:impact][:type] = :horizontal~ -** Processing line: ~ r[:body][:new_reason] = "-"~ -** Processing line: ~ elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3~ -** Processing line: ~ play_sound~ -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * 1.1~ -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ -** Processing line: ~ r[:impact][:type] = :vertical~ -** Processing line: ~ r[:body][:new_reason] = "|"~ -** Processing line: ~ else~ -** Processing line: ~ play_sound~ -** Processing line: ~ r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity~ -** Processing line: ~ r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity~ -** Processing line: ~ r[:impact][:type] = :slanted~ -** Processing line: ~ r[:body][:new_reason] = "/"~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [28, 39, 4, 10, :serenity_alive_inside_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs~ +** Processing line: ~ def serenity_alive_inside_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ player: [60, 2],~ +** Processing line: ~ storylines: [],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :serenity_alive_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4~ -** Processing line: ~ r[:body][:new_dx] = 0~ -** Processing line: ~ r[:body][:new_dy] = 0~ -** Processing line: ~ r[:impact][:energy] = 0~ -** Processing line: ~ r[:body][:new_on_floor] = true~ -** Processing line: ~ r[:body][:new_floor] = r[:terrain][:line]~ -** Processing line: ~ r[:body][:new_reason] = "0"~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 4],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_top, :serenity_alive_ship_status],~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 45, 17, 4, (serenity_alive_last_reply args)],~ +** Processing line: ~ [45, 45, 4, 4, (serenity_alive_current_message args)],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx],~ -** Processing line: ~ y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity },~ -** Processing line: ~ r[:terrain][:line])~ +** Processing line: ~ def serenity_alive_ship_status args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 10],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 50, 4, 4, :serenity_alive_ship_status_reviewed]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."],~ +** Processing line: ~ [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."],~ +** Processing line: ~ *serenity_alive_shared_ship_status(args)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if r[:impact][:ray_next] == r[:impact][:ray]~ -** Processing line: ~ r[:body][:new_dx] *= -1~ -** Processing line: ~ r[:body][:new_dy] *= -1~ -** Processing line: ~ r[:body][:new_reason] = "clip"~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_ship_status_reviewed args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/serenity.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom, :serenity_alive_time_to_reply]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ r~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_time_to_reply args~ +** Processing line: ~ decision_graph serenity_alive_current_message(args),~ +** Processing line: ~ "Okay... time to deliver the bad news...",~ +** Processing line: ~ [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply],~ +** Processing line: ~ [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def game_over!~ -** Processing line: ~ circle.x = circle.check_point_x~ -** Processing line: ~ circle.y = circle.check_point_y~ -** Processing line: ~ circle.dx = 0~ -** Processing line: ~ circle.dy = 0~ -** Processing line: ~ circle.game_over_at = state.tick_count~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_shared_ship_status args~ +** Processing line: ~ [~ +** Processing line: ~ *ship_control_hotspot( 0, 50,~ +** Processing line: ~ "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.",~ +** Processing line: ~ nil,~ +** Processing line: ~ nil,~ +** Processing line: ~ nil),~ +** Processing line: ~ *ship_control_hotspot(12, 35,~ +** Processing line: ~ "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.",~ +** Processing line: ~ nil,~ +** Processing line: ~ nil,~ +** Processing line: ~ nil),~ +** Processing line: ~ *ship_control_hotspot(24, 20,~ +** Processing line: ~ "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.",~ +** Processing line: ~ nil,~ +** Processing line: ~ nil,~ +** Processing line: ~ nil),~ +** Processing line: ~ *ship_control_hotspot(36, 35,~ +** Processing line: ~ "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.",~ +** Processing line: ~ nil,~ +** Processing line: ~ nil,~ +** Processing line: ~ nil),~ +** Processing line: ~ *ship_control_hotspot(48, 50,~ +** Processing line: ~ "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.",~ +** Processing line: ~ nil,~ +** Processing line: ~ nil,~ +** Processing line: ~ nil)~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def not_game_over!~ -** Processing line: ~ impact_history_entry = impact_result circle, circle.impact~ -** Processing line: ~ circle.impact_history << impact_history_entry~ -** Processing line: ~ circle.x -= circle.dx * 1.1~ -** Processing line: ~ circle.y -= circle.dy * 1.1~ -** Processing line: ~ circle.dx = impact_history_entry[:body][:new_dx]~ -** Processing line: ~ circle.dy = impact_history_entry[:body][:new_dy]~ -** Processing line: ~ circle.on_floor = impact_history_entry[:body][:new_on_floor]~ +** Processing line: ~ def serenity_alive_firm_reply~ +** Processing line: ~ "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if circle.on_floor~ -** Processing line: ~ circle.check_point_at = state.tick_count~ -** Processing line: ~ circle.check_point_x = circle.x~ -** Processing line: ~ circle.check_point_y = circle.y~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_sugarcoated_reply~ +** Processing line: ~ "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home."~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.previous_floor = circle.floor || {}~ -** Processing line: ~ circle.floor = impact_history_entry[:body][:new_floor] || {}~ -** Processing line: ~ circle.floor_point = impact_history_entry[:impact][:point]~ -** Processing line: ~ if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2)~ -** Processing line: ~ new_relative_x = if circle.dx > 0~ -** Processing line: ~ :right~ -** Processing line: ~ elsif circle.dx < 0~ -** Processing line: ~ :left~ -** Processing line: ~ else~ -** Processing line: ~ nil~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_serenity_alive_firmly args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"],~ +** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ new_relative_y = if circle.dy > 0~ -** Processing line: ~ :above~ -** Processing line: ~ elsif circle.dy < 0~ -** Processing line: ~ :below~ -** Processing line: ~ else~ -** Processing line: ~ nil~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_serenity_alive_kindly args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom_right, :serenity_alive_path_from_observatory]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"],~ +** Processing line: ~ *serenity_alive_reply_completed_shared_hotspots(args),~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.floor_relative_x = new_relative_x~ -** Processing line: ~ circle.floor_relative_y = new_relative_y~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_path_from_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [4, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom_right, :serenity_bio_infront_of_home]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.impact = nil~ -** Processing line: ~ circle.terrains_to_monitor.clear~ +** Processing line: ~ def serenity_alive_reply_completed_shared_hotspots args~ +** Processing line: ~ [~ +** Processing line: ~ [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."],~ +** Processing line: ~ [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."],~ +** Processing line: ~ [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def serenity_alive_last_reply args~ +** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ +** Processing line: ~ return "Buffer--: \"Hello, Who- is sending-- this message--?\""~ +** Processing line: ~ else~ +** Processing line: ~ return "Buffer--: \"New- phone. Who dis?\""~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_physics~ -** Processing line: ~ if args.state.god_mode~ -** Processing line: ~ calc_potential_impacts~ -** Processing line: ~ calc_terrains_to_monitor~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_alive_current_message args~ +** Processing line: ~ if args.state.scene_history.include? :replied_to_introduction_seriously~ +** Processing line: ~ "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote~ +** Processing line: ~ else~ +** Processing line: ~ "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote~ +** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if circle.y < -700~ -** Processing line: ~ game_over~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ return if state.game_over~ -** Processing line: ~ return if circle.on_floor~ -** Processing line: ~ circle.previous_dy = circle.dy~ -** Processing line: ~ circle.previous_dx = circle.dx~ -** Processing line: ~ circle.x += circle.dx~ -** Processing line: ~ circle.y += circle.dy~ -** Processing line: ~ args.state.distance_traveled ||= 0~ -** Processing line: ~ args.state.distance_traveled += circle.dx.abs + circle.dy.abs~ -** Processing line: ~ circle.dy += state.gravity~ -** Processing line: ~ calc_potential_impacts~ -** Processing line: ~ calc_terrains_to_monitor~ -** Processing line: ~ return unless circle.impact~ -** Processing line: ~ if circle.impact && circle.impact[:type] == :lava~ -** Processing line: ~ game_over!~ -** Processing line: ~ else~ -** Processing line: ~ not_game_over!~ -** Processing line: ~ end~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input_god_mode~ -** Processing line: ~ state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_serenity_bio.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ # toggle god mode~ -** Processing line: ~ if inputs.keyboard.key_down.g~ -** Processing line: ~ state.god_mode = !state.god_mode~ -** Processing line: ~ state.potential_lift = 0~ -** Processing line: ~ circle.floor = nil~ -** Processing line: ~ circle.floor_point = nil~ -** Processing line: ~ circle.floor_relative_x = nil~ -** Processing line: ~ circle.floor_relative_y = nil~ -** Processing line: ~ circle.impact = nil~ -** Processing line: ~ circle.terrains_to_monitor.clear~ -** Processing line: ~ return~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb~ +** Processing line: ~ def serenity_bio_infront_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/front-of-home.png',~ +** Processing line: ~ player: [54, 23],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [44, 34, 8, 14, :serenity_bio_inside_home],~ +** Processing line: ~ [0, 3, 3, 22, :serenity_bio_library]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ return unless state.god_mode~ +** Processing line: ~ def serenity_bio_inside_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 4],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 4, 4, 4, "I'm--- completely--- exhausted."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 38, 12, 13, :serenity_bio_restless_sleep],~ +** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.x = circle.x.to_i~ -** Processing line: ~ circle.y = circle.y.to_i~ +** Processing line: ~ def serenity_bio_restless_sleep args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, 0, 8, 3, :serenity_bio_infront_of_home],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # move god circle~ -** Processing line: ~ if inputs.keyboard.left || inputs.keyboard.a~ -** Processing line: ~ circle.x -= 20~ -** Processing line: ~ elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f~ -** Processing line: ~ circle.x += 20~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_bio_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/library.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 7],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [21, 35, 3, 18, :serenity_bio_book]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.keyboard.up || inputs.keyboard.w~ -** Processing line: ~ circle.y += 20~ -** Processing line: ~ elsif inputs.keyboard.down || inputs.keyboard.s~ -** Processing line: ~ circle.y -= 20~ -** Processing line: ~ end~ +** Processing line: ~ def serenity_bio_book args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/book.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [6, 52],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"],~ ** Processing line: ~~ -** Processing line: ~ # delete terrain~ -** Processing line: ~ if inputs.keyboard.key_down.x~ -** Processing line: ~ calc_terrains_to_monitor~ -** Processing line: ~ state.terrain = state.terrain.reject do |t|~ -** Processing line: ~ t[:rect].intersect_rect? circle.rect~ -** Processing line: ~ end~ +** Processing line: ~ [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"],~ +** Processing line: ~ [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."],~ +** Processing line: ~~ +** Processing line: ~ [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"],~ +** Processing line: ~ [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."],~ +** Processing line: ~~ +** Processing line: ~ [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"],~ +** Processing line: ~ [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom, :serenity_bio_finally_to_bed]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def serenity_bio_finally_to_bed args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [35, 3],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, 38, 10, 13, :bad_dream],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.lava = state.lava.reject do |t|~ -** Processing line: ~ t[:rect].intersect_rect? circle.rect~ -** Processing line: ~ end~ +** Processing line: ~ def bad_dream args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 120,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [34, 35],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, -1, 8, 3, :bad_dream_observatory]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ calc_potential_impacts~ -** Processing line: ~ save_level~ -** Processing line: ~ end~ +** Processing line: ~ def bad_dream_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 120,~ +** Processing line: ~ player: [51, 12],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [30, 18, 5, 12, :bad_dream_inside_mainframe]~ +** Processing line: ~ ],~ +** Processing line: ~ render_override: :blinking_light_inside_observatory_render~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # change terrain type~ -** Processing line: ~ if inputs.keyboard.key_down.l~ -** Processing line: ~ if state.line_mode == :terrain~ -** Processing line: ~ state.line_mode = :lava~ -** Processing line: ~ else~ -** Processing line: ~ state.line_mode = :terrain~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def bad_dream_inside_mainframe args~ +** Processing line: ~ {~ +** Processing line: ~ player: [32, 4],~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ fade: 120,~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [45, 45, 4, 4, :bad_dream_everyone_dead],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if inputs.mouse.click && !state.point_one~ -** Processing line: ~ state.point_one = inputs.mouse.click.point~ -** Processing line: ~ elsif inputs.mouse.click && state.point_one~ -** Processing line: ~ l = [*state.point_one, *inputs.mouse.click.point]~ -** Processing line: ~ l = [l.x - state.camera.x,~ -** Processing line: ~ l.y - state.camera.y,~ -** Processing line: ~ l.x2 - state.camera.x,~ -** Processing line: ~ l.y2 - state.camera.y].line.to_hash~ -** Processing line: ~ l[:rect] = rect_for_line l~ -** Processing line: ~ if state.line_mode == :terrain~ -** Processing line: ~ state.terrain << l~ -** Processing line: ~ else~ -** Processing line: ~ state.lava << l~ -** Processing line: ~ end~ -** Processing line: ~ save_level~ -** Processing line: ~ next_x = inputs.mouse.click.point.x - 640~ -** Processing line: ~ next_y = inputs.mouse.click.point.y - 360~ -** Processing line: ~ circle.x += next_x~ -** Processing line: ~ circle.y += next_y~ -** Processing line: ~ state.point_one = nil~ -** Processing line: ~ elsif inputs.keyboard.one~ -** Processing line: ~ state.point_one = [circle.x + camera.x, circle.y+ camera.y]~ -** Processing line: ~ end~ +** Processing line: ~ def bad_dream_everyone_dead args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mainframe.png',~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [22, 45, 17, 4, (bad_dream_last_reply args)],~ +** Processing line: ~ [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"],~ +** Processing line: ~ [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."],~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [*hotspot_bottom, :anka_inside_room]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # cancel chain lines~ -** Processing line: ~ if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one~ -** Processing line: ~ state.point_one = nil~ -** Processing line: ~ end~ +** Processing line: ~ def bad_dream_last_reply args~ +** Processing line: ~ if args.state.scene_history.include? :replied_to_serenity_alive_firmly~ +** Processing line: ~ return "Buffer--: #{serenity_alive_firm_reply.quote}"~ +** Processing line: ~ else~ +** Processing line: ~ return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}"~ ** Processing line: ~ end~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def play_sound~ -** Processing line: ~ return if state.sound_debounce > 0~ -** Processing line: ~ state.sound_debounce = 5~ -** Processing line: ~ outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav"~ -** Processing line: ~ state.sound_index += 1~ -** Processing line: ~ if state.sound_index > 21~ -** Processing line: ~ state.sound_index = 1~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def input_game~ -** Processing line: ~ if inputs.keyboard.down || inputs.keyboard.space~ -** Processing line: ~ circle.potential_lift += 0.03~ -** Processing line: ~ circle.potential_lift = circle.potential_lift.lesser(10)~ -** Processing line: ~ elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space~ -** Processing line: ~ play_sound~ -** Processing line: ~ circle.dy += circle.angle.vector_y circle.potential_lift~ -** Processing line: ~ circle.dx += circle.angle.vector_x circle.potential_lift~ ** Processing line: ~~ -** Processing line: ~ if circle.on_floor~ -** Processing line: ~ if circle.floor_relative_y == :above~ -** Processing line: ~ circle.y += circle.potential_lift.abs * 2~ -** Processing line: ~ elsif circle.floor_relative_y == :below~ -** Processing line: ~ circle.y -= circle.potential_lift.abs * 2~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_serenity_introduction.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ circle.on_floor = false~ -** Processing line: ~ circle.potential_lift = 0~ -** Processing line: ~ circle.terrains_to_monitor.clear~ -** Processing line: ~ circle.impact_history.clear~ -** Processing line: ~ circle.impact = nil~ -** Processing line: ~ calc_physics~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb~ +** Processing line: ~ # decision_graph "Message from Sasha",~ +** Processing line: ~ # "I should reply.",~ +** Processing line: ~ # [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"],~ +** Processing line: ~ # [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"]~ +** Processing line: ~ def reply_to_introduction args~ +** Processing line: ~ decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.",~ +** Processing line: ~ "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.",~ +** Processing line: ~ [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"],~ +** Processing line: ~ [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # aim probe~ -** Processing line: ~ if inputs.keyboard.right || inputs.keyboard.a~ -** Processing line: ~ circle.angle -= 2~ -** Processing line: ~ elsif inputs.keyboard.left || inputs.keyboard.d~ -** Processing line: ~ circle.angle += 2~ -** Processing line: ~ end~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_seriously args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""],~ +** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def input~ -** Processing line: ~ input_god_mode~ -** Processing line: ~ input_game~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_humorously args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-observatory.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [32, 21],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ *replied_to_introduction_shared_scenes(args)~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""],~ +** Processing line: ~ *replied_to_introduction_shared_storylines(args)~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc_camera~ -** Processing line: ~ state.camera.target_x = 640 - circle.x~ -** Processing line: ~ state.camera.target_y = 360 - circle.y~ -** Processing line: ~ xdiff = state.camera.target_x - state.camera.x~ -** Processing line: ~ ydiff = state.camera.target_y - state.camera.y~ -** Processing line: ~ state.camera.x += xdiff * camera.follow_speed~ -** Processing line: ~ state.camera.y += ydiff * camera.follow_speed~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_shared_storylines args~ +** Processing line: ~ [~ +** Processing line: ~ [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."],~ +** Processing line: ~ [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"],~ +** Processing line: ~ [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."]~ +** Processing line: ~ ]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def calc~ -** Processing line: ~ state.sound_debounce ||= 0~ -** Processing line: ~ state.sound_debounce -= 1~ -** Processing line: ~ state.sound_debounce = 0 if state.sound_debounce < 0~ -** Processing line: ~ if state.god_mode~ -** Processing line: ~ circle.dy *= 0.1~ -** Processing line: ~ circle.dx *= 0.1~ -** Processing line: ~ end~ -** Processing line: ~ calc_camera~ -** Processing line: ~ state.whisp_queue ||= []~ -** Processing line: ~ if state.tick_count.mod_zero?(4)~ -** Processing line: ~ state.whisp_queue << {~ -** Processing line: ~ x: -300,~ -** Processing line: ~ y: 1400 * rand,~ -** Processing line: ~ speed: 2.randomize(:ratio) + 3,~ -** Processing line: ~ w: 20,~ -** Processing line: ~ h: 20, path: 'sprites/whisp.png',~ -** Processing line: ~ a: 0,~ -** Processing line: ~ created_at: state.tick_count,~ -** Processing line: ~ angle: 0,~ -** Processing line: ~ r: 100,~ -** Processing line: ~ g: 128 + 128 * rand,~ -** Processing line: ~ b: 128 + 128 * rand~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_shared_scenes args~ +** Processing line: ~ [[60, 0, 4, 32, :replied_to_introduction_observatory]]~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.whisp_queue.each do |w|~ -** Processing line: ~ w.x += w[:speed] * 2~ -** Processing line: ~ w.x -= circle.dx * 0.3~ -** Processing line: ~ w.y -= w[:speed]~ -** Processing line: ~ w.y -= circle.dy * 0.3~ -** Processing line: ~ w.angle += w[:speed]~ -** Processing line: ~ w.a = w[:created_at].ease(30) * 255~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/observatory.png',~ +** Processing line: ~ player: [28, 39],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [60, 0, 4, 32, :replied_to_introduction_path_to_observatory]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 }~ +** Processing line: ~ def replied_to_introduction_path_to_observatory args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/path-to-observatory.png',~ +** Processing line: ~ player: [0, 26],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [60, 0, 4, 20, :replied_to_introduction_mountain_pass]~ +** Processing line: ~ ],~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0)~ -** Processing line: ~ circle.after_images << {~ -** Processing line: ~ x: circle.x,~ -** Processing line: ~ y: circle.y,~ -** Processing line: ~ w: circle.radius,~ -** Processing line: ~ h: circle.radius,~ -** Processing line: ~ a: 255,~ -** Processing line: ~ created_at: state.tick_count~ -** Processing line: ~ }~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_mountain_pass args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/mountain-pass-zoomed-out.png',~ +** Processing line: ~ player: [21, 48],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [0, 0, 15, 4, :replied_to_introduction_side_of_home]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.after_images.each do |ai|~ -** Processing line: ~ ai.a = ai[:created_at].ease(10, :flip) * 255~ -** Processing line: ~ end~ +** Processing line: ~ def replied_to_introduction_side_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/side-of-home.png',~ +** Processing line: ~ player: [58, 29],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [2, 0, 61, 2, :speed_of_light_front_of_home]~ +** Processing line: ~ ],~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 }~ -** Processing line: ~ calc_physics~ -** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. ** Processing line: ~~ -** Processing line: ~ def circle~ -** Processing line: ~ state.circle~ -** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def camera~ -** Processing line: ~ state.camera~ -** Processing line: ~ end~ +** Processing line: ~* Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Narrative - Return Of Serenity - storyline_speed_of_light.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false ** Processing line: ~~ -** Processing line: ~ def terrain~ -** Processing line: ~ state.terrain~ -** Processing line: ~ end~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb~ +** Processing line: ~ def speed_of_light_front_of_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/front-of-home.png',~ +** Processing line: ~ player: [54, 23],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [44, 34, 8, 14, :speed_of_light_inside_home],~ +** Processing line: ~ [0, 3, 3, 22, :speed_of_light_outside_library]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def lava~ -** Processing line: ~ state.lava~ -** Processing line: ~ end~ +** Processing line: ~ def speed_of_light_inside_home args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [35, 4],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [32, 0, 8, 3, :speed_of_light_front_of_home],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ # $gtk.reset~ +** Processing line: ~ def speed_of_light_outside_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/outside-library.png',~ +** Processing line: ~ player: [55, 19],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [49, 39, 6, 10, :speed_of_light_library],~ +** Processing line: ~ [61, 11, 3, 20, :speed_of_light_front_of_home]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick args~ -** Processing line: ~ args.outputs.background_color = [0, 0, 0]~ -** Processing line: ~ if args.inputs.keyboard.r~ -** Processing line: ~ args.gtk.reset~ -** Processing line: ~ return~ -** Processing line: ~ end~ -** Processing line: ~ # uncomment the line below to slow down the game so you~ -** Processing line: ~ # can see each tick as it passes~ -** Processing line: ~ # args.gtk.slowmo! 30~ -** Processing line: ~ $game ||= FallingCircle.new~ -** Processing line: ~ $game.args = args~ -** Processing line: ~ $game.tick~ +** Processing line: ~ def speed_of_light_library args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/library.png',~ +** Processing line: ~ player: [30, 7],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def reset~ -** Processing line: ~ $game = nil~ +** Processing line: ~ def speed_of_light_celestial_bodies_diagram args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/planets.png',~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ player: [30, 3],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."],~ +** Processing line: ~~ +** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ +** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ +** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ +** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ +** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ +** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ +** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ +** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ +** Processing line: ~ # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."],~ +** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def speed_of_light_distance_discovered args~ +** Processing line: ~ {~ +** Processing line: ~ background: 'sprites/planets.png',~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [13, 0, 44, 3, :speed_of_light_end_of_day]~ +** Processing line: ~ ],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."],~ +** Processing line: ~ [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."],~ +** Processing line: ~ [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."],~ +** Processing line: ~ [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."],~ +** Processing line: ~ [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."],~ +** Processing line: ~ [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."],~ +** Processing line: ~ [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."],~ +** Processing line: ~ [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."],~ +** Processing line: ~ [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"],~ +** Processing line: ~ [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"],~ +** Processing line: ~ ]~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def speed_of_light_end_of_day args~ +** Processing line: ~ {~ +** Processing line: ~ fade: 60,~ +** Processing line: ~ background: 'sprites/inside-home.png',~ +** Processing line: ~ player: [35, 0],~ +** Processing line: ~ storylines: [~ +** Processing line: ~ [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."]~ +** Processing line: ~ ],~ +** Processing line: ~ scenes: [~ +** Processing line: ~ [31, 38, 10, 12, :serenity_alive_side_of_home]~ +** Processing line: ~ ]~ +** Processing line: ~ }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~#+end_src~ - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/constants.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - constants.rb~ - H1 detected. -- Formatting line: ~99_genre_roguelike/roguelike_line_of_sight/app/constants.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Roguelike - Roguelike Line Of Sight - constants.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb~ ** Processing line: ~ SHOW_LEGEND = true~ ** Processing line: ~ SOURCE_TILE_SIZE = 16~ ** Processing line: ~ DESTINATION_TILE_SIZE = 16~ @@ -117381,14 +131973,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/legend.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - legend.rb~ - H1 detected. -- Formatting line: ~99_genre_roguelike/roguelike_line_of_sight/app/legend.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Roguelike - Roguelike Line Of Sight - legend.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb~ ** Processing line: ~ def tick_legend args~ ** Processing line: ~ return unless SHOW_LEGEND~ ** Processing line: ~~ @@ -117459,14 +132054,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/main.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - main.rb~ - H1 detected. -- Formatting line: ~99_genre_roguelike/roguelike_line_of_sight/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Roguelike - Roguelike Line Of Sight - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb~ ** Processing line: ~ require 'app/constants.rb'~ ** Processing line: ~ require 'app/sprite_lookup.rb'~ ** Processing line: ~ require 'app/legend.rb'~ @@ -117569,14 +132167,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb~ - H1 detected. -- Formatting line: ~99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Roguelike - Roguelike Line Of Sight - sprite_lookup.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb~ ** Processing line: ~ def sprite_lookup~ ** Processing line: ~ {~ ** Processing line: ~ 0 => [3, 0],~ @@ -117706,14 +132307,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_roguelike/roguelike_starting_point/app/main.rb~ +** Processing line: ~* Rpg Roguelike - Roguelike Starting Point - main.rb~ - H1 detected. -- Formatting line: ~99_genre_roguelike/roguelike_starting_point/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Roguelike - Roguelike Starting Point - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ ** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ @@ -118158,14 +132762,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_tactical_rpg/hexagonal_grid/app/main.rb~ +** Processing line: ~* Rpg Tactical - Hexagonal Grid - main.rb~ - H1 detected. -- Formatting line: ~99_genre_tactical_rpg/hexagonal_grid/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Tactical - Hexagonal Grid - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb~ ** Processing line: ~ class HexagonTileGame~ ** Processing line: ~ attr_gtk~ ** Processing line: ~~ @@ -118239,14 +132846,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_tactical_rpg/isometric_grid/app/main.rb~ +** Processing line: ~* Rpg Tactical - Isometric Grid - main.rb~ - H1 detected. -- Formatting line: ~99_genre_tactical_rpg/isometric_grid/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Tactical - Isometric Grid - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_tactical/isometric_grid/app/main.rb~ ** Processing line: ~ class Isometric~ ** Processing line: ~ attr_accessor :grid, :inputs, :state, :outputs~ ** Processing line: ~~ @@ -118514,14 +133124,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* 99_genre_topdown_rpg/topdown_starting_point/app/main.rb~ +** Processing line: ~* Rpg Topdown - Topdown Starting Point - main.rb~ - H1 detected. -- Formatting line: ~99_genre_topdown_rpg/topdown_starting_point/app/main.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~Rpg Topdown - Topdown Starting Point - main.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb~ ** Processing line: ~ =begin~ ** Processing line: ~~ ** Processing line: ~ APIs listing that haven't been encountered in previous sample apps:~ @@ -118635,14 +133248,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/args.rb~ +** Processing line: ~* args.rb~ - H1 detected. -- Formatting line: ~./dragon/args.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~args.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/args.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -118844,14 +133460,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/assert.rb~ +** Processing line: ~* assert.rb~ - H1 detected. -- Formatting line: ~./dragon/assert.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~assert.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/assert.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -118985,14 +133604,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/attr_gtk.rb~ +** Processing line: ~* attr_gtk.rb~ - H1 detected. -- Formatting line: ~./dragon/attr_gtk.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~attr_gtk.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/attr_gtk.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -119039,14 +133661,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/attr_sprite.rb~ +** Processing line: ~* attr_sprite.rb~ - H1 detected. -- Formatting line: ~./dragon/attr_sprite.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~attr_sprite.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/attr_sprite.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # attr_sprite.rb has been released under MIT (*only this file*).~ @@ -119108,14 +133733,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/console.rb~ +** Processing line: ~* console.rb~ - H1 detected. -- Formatting line: ~./dragon/console.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~console.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/console.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console.rb has been released under MIT (*only this file*).~ @@ -119410,18 +134038,17 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @last_command_errored = false~ ** Processing line: ~ rescue Exception => e~ ** Processing line: ~ string_e = "#{e}"~ +** Processing line: ~ puts "* EXCEPTION: #{e}"~ +** Processing line: ~ log "* EXCEPTION: #{e}"~ ** Processing line: ~ @last_command_errored = true~ ** Processing line: ~ if (string_e.include? "wrong number of arguments")~ ** Processing line: ~ method_name = (string_e.split ":")[0].gsub "'", ""~ -** Processing line: ~ results = Kernel.docs_search method_name~ -** Processing line: ~ if !results.include "* DOCS: No results found."~ +** Processing line: ~ results = (Kernel.docs_search method_name).strip~ +** Processing line: ~ if !results.include? "* DOCS: No results found."~ ** Processing line: ~ puts results~ ** Processing line: ~ log results~ ** Processing line: ~ end~ ** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ puts "#{e}"~ -** Processing line: ~ log "#{e}"~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ end~ @@ -119433,6 +134060,10 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control)~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def scroll_to_bottom~ +** Processing line: ~ @log_offset = 0~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def scroll_up_full~ ** Processing line: ~ @log_offset += lines_on_one_page~ ** Processing line: ~ @log_offset = @log.size if @log_offset > @log.size~ @@ -119628,63 +134259,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ render_log_offset args~ ** Processing line: ~ end~ ** Processing line: ~~ -** Processing line: ~ def tick_help args~ -** Processing line: ~ tick_help_debounce args~ -** Processing line: ~ alpha_rate = 20~ -** Processing line: ~ @render_help_target_alpha ||= 255~ -** Processing line: ~ @render_help_current_alpha ||= 255~ -** Processing line: ~ @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha~ -** Processing line: ~ @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20)~ -** Processing line: ~~ -** Processing line: ~ @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255)~ -** Processing line: ~ @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255)~ -** Processing line: ~~ -** Processing line: ~ [~ -** Processing line: ~ "* Prompt Commands: ",~ -** Processing line: ~ "You can type any of the following ",~ -** Processing line: ~ "commands in the command prompt. ",~ -** Processing line: ~ "** docs: Provides API docs. ",~ -** Processing line: ~ "** $gtk: Accesses the global runtime.",~ -** Processing line: ~ "* Shortcut Keys: ",~ -** Processing line: ~ "** full page up: ctrl + b ",~ -** Processing line: ~ "** full page down: ctrl + f ",~ -** Processing line: ~ "** half page up: ctrl + u ",~ -** Processing line: ~ "** half page down: ctrl + d ",~ -** Processing line: ~ "** clear prompt: ctrl + g ",~ -** Processing line: ~ "** up arrow: next command ",~ -** Processing line: ~ "** down arrow: prev command ",~ -** Processing line: ~ ].each_with_index do |s, i|~ -** Processing line: ~ args.outputs.reserved << [args.grid.right - 10,~ -** Processing line: ~ top - 100 - line_height_px * i * 0.8,~ -** Processing line: ~ s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label~ -** Processing line: ~ end~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ def tick_help_debounce args~ -** Processing line: ~ hide_log_alpha = -255~ -** Processing line: ~ if hidden?~ -** Processing line: ~ @render_help_current_alpha = -255~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if prompt.last_input_str_changed~ -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.moved~ -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if args.inputs.mouse.wheel~ -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ if @render_help_last_log_invocation_count != @log_invocation_count~ -** Processing line: ~ @render_help_target_alpha = hide_log_alpha~ -** Processing line: ~ end~ -** Processing line: ~~ -** Processing line: ~ @render_help_last_log_invocation_count = @log_invocation_count~ -** Processing line: ~ end~ -** Processing line: ~~ ** Processing line: ~ def render_log_offset args~ ** Processing line: ~ return if @log_offset <= 0~ ** Processing line: ~ args.outputs.reserved << font_style.label(~ @@ -119741,7 +134315,6 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ process_inputs args~ ** Processing line: ~ return unless should_tick?~ ** Processing line: ~ calc args~ -** Processing line: ~ tick_help args~ ** Processing line: ~ prompt.tick~ ** Processing line: ~ menu.tick args~ ** Processing line: ~ rescue Exception => e~ @@ -119903,14 +134476,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/console_color.rb~ +** Processing line: ~* console_color.rb~ - H1 detected. -- Formatting line: ~./dragon/console_color.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~console_color.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/console_color.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_color.rb has been released under MIT (*only this file*).~ @@ -119946,14 +134522,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/console_font_style.rb~ +** Processing line: ~* console_font_style.rb~ - H1 detected. -- Formatting line: ~./dragon/console_font_style.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~console_font_style.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/console_font_style.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_font_style.rb has been released under MIT (*only this file*).~ @@ -119999,14 +134578,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/console_menu.rb~ +** Processing line: ~* console_menu.rb~ - H1 detected. -- Formatting line: ~./dragon/console_menu.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~console_menu.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/console_menu.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_menu.rb has been released under MIT (*only this file*).~ @@ -120014,6 +134596,8 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ module GTK~ ** Processing line: ~ class Console~ ** Processing line: ~ class Menu~ +** Processing line: ~ attr_accessor :buttons~ +** Processing line: ~~ ** Processing line: ~ def initialize console~ ** Processing line: ~ @console = console~ ** Processing line: ~ end~ @@ -120047,28 +134631,63 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @console.hide~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def hide_menu_clicked~ +** Processing line: ~ @menu_shown = :hidden~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def framerate_diagnostics_clicked~ +** Processing line: ~ @console.scroll_to_bottom~ ** Processing line: ~ $gtk.framerate_diagnostics~ ** Processing line: ~ end~ ** Processing line: ~~ +** Processing line: ~ def itch_wizard_clicked~ +** Processing line: ~ @console.scroll_to_bottom~ +** Processing line: ~ $wizards.itch.start~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def docs_clicked~ +** Processing line: ~ @console.scroll_to_bottom~ +** Processing line: ~ log Kernel.docs_classes~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def scroll_end_clicked~ +** Processing line: ~ @console.scroll_to_bottom~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def custom_buttons~ +** Processing line: ~ []~ +** Processing line: ~ end~ +** Processing line: ~~ ** Processing line: ~ def tick args~ ** Processing line: ~ return unless @console.visible?~ ** Processing line: ~~ ** Processing line: ~ @menu_shown ||= :hidden~ ** Processing line: ~~ -** Processing line: ~ if @menu_shown == :hidden~ +** Processing line: ~ if $gtk.production~ +** Processing line: ~ @buttons = [~ +** Processing line: ~ (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked),~ +** Processing line: ~ (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked),~ +** Processing line: ~ ]~ +** Processing line: ~ elsif @menu_shown == :hidden~ ** Processing line: ~ @buttons = [~ ** Processing line: ~ (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked),~ ** Processing line: ~ ]~ ** Processing line: ~ else~ ** Processing line: ~ @buttons = [~ -** Processing line: ~ (button id: :record, row: 0, col: 4, text: "framerate diagnostics", method: :framerate_diagnostics_clicked),~ -** Processing line: ~ (button id: :record, row: 0, col: 5, text: "record", method: :record_clicked),~ -** Processing line: ~ (button id: :replay, row: 0, col: 6, text: "replay", method: :replay_clicked),~ -** Processing line: ~ (button id: :reset, row: 0, col: 7, text: "reset", method: :reset_clicked),~ -** Processing line: ~ (button id: :scroll_up, row: 0, col: 8, text: "scroll up", method: :scroll_up_clicked),~ -** Processing line: ~ (button id: :scroll_down, row: 0, col: 9, text: "scroll down", method: :scroll_down_clicked),~ -** Processing line: ~ (button id: :close, row: 0, col: 10, text: "close", method: :close_clicked),~ +** Processing line: ~ (button id: :scroll_up, row: 0, col: 6, text: "scroll up", method: :scroll_up_clicked),~ +** Processing line: ~ (button id: :scroll_down, row: 0, col: 7, text: "scroll down", method: :scroll_down_clicked),~ +** Processing line: ~ (button id: :scroll_down, row: 0, col: 8, text: "scroll end", method: :scroll_end_clicked),~ +** Processing line: ~ (button id: :close, row: 0, col: 9, text: "close console", method: :close_clicked),~ +** Processing line: ~ (button id: :hide, row: 0, col: 10, text: "hide menu", method: :hide_menu_clicked),~ +** Processing line: ~~ +** Processing line: ~ (button id: :record, row: 1, col: 7, text: "record gameplay", method: :record_clicked),~ +** Processing line: ~ (button id: :replay, row: 1, col: 8, text: "start replay", method: :replay_clicked),~ +** Processing line: ~ (button id: :record, row: 1, col: 9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked),~ +** Processing line: ~ (button id: :reset, row: 1, col: 10, text: "reset game", method: :reset_clicked),~ +** Processing line: ~~ +** Processing line: ~ (button id: :reset, row: 2, col: 10, text: "docs", method: :docs_clicked),~ +** Processing line: ~ (button id: :reset, row: 2, col: 9, text: "itch wizard", method: :itch_wizard_clicked),~ +** Processing line: ~ *custom_buttons~ ** Processing line: ~ ]~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -120101,10 +134720,11 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ {~ ** Processing line: ~ id: id,~ ** Processing line: ~ rect: (rect_for_layout row, col),~ +** Processing line: ~ text: text,~ ** Processing line: ~ method: method~ ** Processing line: ~ }.let do |entity|~ ** Processing line: ~ primitives = []~ -** Processing line: ~ primitives << entity[:rect].merge(a: 80).solid~ +** Processing line: ~ primitives << entity[:rect].merge(a: 164).solid~ ** Processing line: ~ primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border~ ** Processing line: ~ primitives << text.wrapped_lines(5)~ ** Processing line: ~ .map_with_index do |l, i|~ @@ -120132,14 +134752,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/console_prompt.rb~ +** Processing line: ~* console_prompt.rb~ - H1 detected. -- Formatting line: ~./dragon/console_prompt.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~console_prompt.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/console_prompt.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # console_prompt.rb has been released under MIT (*only this file*).~ @@ -120315,14 +134938,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/controller.rb~ +** Processing line: ~* controller.rb~ - H1 detected. -- Formatting line: ~./dragon/controller.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~controller.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/controller.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -120450,14 +135076,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/controller/config.rb~ +** Processing line: ~* controller/config.rb~ - H1 detected. -- Formatting line: ~./dragon/controller/config.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~controller/config.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/controller/config.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -120862,14 +135491,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/controller/keys.rb~ +** Processing line: ~* controller/keys.rb~ - H1 detected. -- Formatting line: ~./dragon/controller/keys.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~controller/keys.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/controller/keys.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -120926,14 +135558,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/directional_input_helper_methods.rb~ +** Processing line: ~* directional_input_helper_methods.rb~ - H1 detected. -- Formatting line: ~./dragon/directional_input_helper_methods.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~directional_input_helper_methods.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/directional_input_helper_methods.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -121031,14 +135666,115 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/geometry.rb~ +** Processing line: ~* easing.rb~ +- H1 detected. +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~easing.rb~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # ./dragon/easing.rb~ +** Processing line: ~ # coding: utf-8~ +** Processing line: ~ # Copyright 2019 DragonRuby LLC~ +** Processing line: ~ # MIT License~ +** Processing line: ~ # easing.rb has been released under MIT (*only this file*).~ +** Processing line: ~~ +** Processing line: ~ module GTK~ +** Processing line: ~ module Easing~ +** Processing line: ~ def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions~ +** Processing line: ~ definitions.flatten!~ +** Processing line: ~ definitions = [:identity] if definitions.length == 0~ +** Processing line: ~ duration = end_tick - start_tick~ +** Processing line: ~ elapsed = current_tick - start_tick~ +** Processing line: ~ y = elapsed.percentage_of(duration).cap_min_max(0, 1)~ +** Processing line: ~~ +** Processing line: ~ definitions.map do |definition|~ +** Processing line: ~ y = Easing.exec_definition(definition, start_tick, duration, y)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ y~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.ease_spline_extended start_tick, current_tick, end_tick, spline~ +** Processing line: ~ duration = end_tick - start_tick~ +** Processing line: ~ t = (current_tick - start_tick).fdiv duration~ +** Processing line: ~ time_allocation_per_curve = 1.fdiv(spline.length)~ +** Processing line: ~ curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t|~ +** Processing line: ~ [spline_t.to_i, spline_t - spline_t.to_i]~ +** Processing line: ~ end~ +** Processing line: ~ Geometry.cubic_bezier curve_t, *spline[curve_index]~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.initial_value *definitions~ +** Processing line: ~ definitions.flatten!~ +** Processing line: ~ return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.final_value *definitions~ +** Processing line: ~ definitions.flatten!~ +** Processing line: ~ return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.exec_definition definition, start_tick, duration, x~ +** Processing line: ~ if definition.is_a? Symbol~ +** Processing line: ~ return Easing.send(definition, x).cap_min_max(0, 1)~ +** Processing line: ~ elsif definition.is_a? Proc~ +** Processing line: ~ return definition.call(x, start_tick, duration).cap_min_max(0, 1)~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ raise <<-S~ +** Processing line: ~ * ERROR:~ +** Processing line: ~ I don't know how to execute easing function with definition #{definition}.~ +** Processing line: ~~ +** Processing line: ~ S~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.identity x~ +** Processing line: ~ x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.flip x~ +** Processing line: ~ 1 - x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.quad x~ +** Processing line: ~ x * x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.cube x~ +** Processing line: ~ x * x * x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.quart x~ +** Processing line: ~ x * x * x * x * x~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def self.quint x~ +** Processing line: ~ x * x * x * x * x * x~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ Easing = GTK::Easing~ +** Processing line: ~~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* geometry.rb~ - H1 detected. -- Formatting line: ~./dragon/geometry.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~geometry.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/geometry.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -121413,14 +136149,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/grid.rb~ +** Processing line: ~* grid.rb~ - H1 detected. -- Formatting line: ~./dragon/grid.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~grid.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/grid.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -121615,14 +136354,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/inputs.rb~ +** Processing line: ~* inputs.rb~ - H1 detected. -- Formatting line: ~./dragon/inputs.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~inputs.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/inputs.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -122295,14 +137037,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/log.rb~ +** Processing line: ~* log.rb~ - H1 detected. -- Formatting line: ~./dragon/log.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~log.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/log.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -122332,19 +137077,19 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ class Log~ ** Processing line: ~ def self.write_to_log_and_puts *args~ ** Processing line: ~ return if $gtk.production~ -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n") + "\n"~ +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n"~ ** Processing line: ~ args.each { |obj| $gtk.log obj, self }~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def self.write_to_log_and_print *args~ ** Processing line: ~ return if $gtk.production~ -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n")~ +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n")~ ** Processing line: ~ Object.print(*args)~ ** Processing line: ~ end~ ** Processing line: ~~ ** Processing line: ~ def self.puts_important *args~ ** Processing line: ~ return if $gtk.production~ -** Processing line: ~ $gtk.append_file 'logs/log.txt', args.join("\n")~ +** Processing line: ~ $gtk.append_file_root 'logs/log.txt', args.join("\n")~ ** Processing line: ~ $gtk.notify! "Important notification occurred."~ ** Processing line: ~ args.each { |obj| $gtk.log obj }~ ** Processing line: ~ end~ @@ -122572,14 +137317,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/numeric.rb~ +** Processing line: ~* numeric.rb~ - H1 detected. -- Formatting line: ~./dragon/numeric.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~numeric.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/numeric.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -123227,14 +137975,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/runtime/framerate_diagnostics.rb~ +** Processing line: ~* runtime/framerate_diagnostics.rb~ - H1 detected. -- Formatting line: ~./dragon/runtime/framerate_diagnostics.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~runtime/framerate_diagnostics.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/runtime/framerate_diagnostics.rb~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ ** Processing line: ~ # framerate_diagnostics.rb has been released under MIT (*only this file*).~ @@ -123405,14 +138156,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/string.rb~ +** Processing line: ~* string.rb~ - H1 detected. -- Formatting line: ~./dragon/string.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~string.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/string.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -123519,14 +138273,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/tests.rb~ +** Processing line: ~* tests.rb~ - H1 detected. -- Formatting line: ~./dragon/tests.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~tests.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/tests.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -123671,14 +138428,17 @@ Follows is a source code listing for all files that have been open sourced. This - PRE end detected. ** Processing line: ~~ ** Processing line: ~~ -** Processing line: ~* ./dragon/trace.rb~ +** Processing line: ~* trace.rb~ - H1 detected. -- Formatting line: ~./dragon/trace.rb~ +- Determining if line is a header. +- Line contains ~* ~... gsub-ing empty string +- Formatting line: ~trace.rb~ - Line's tilde count is: 0 - Line contains link marker: false ** Processing line: ~~ ** Processing line: ~#+begin_src ruby~ - PRE start detected. +** Processing line: ~ # ./dragon/trace.rb~ ** Processing line: ~ # coding: utf-8~ ** Processing line: ~ # Copyright 2019 DragonRuby LLC~ ** Processing line: ~ # MIT License~ @@ -123746,7 +138506,7 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ @traced_classes.clear~ ** Processing line: ~ $trace_enabled = false~ ** Processing line: ~ if !$gtk.production~ -** Processing line: ~ $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"~ +** Processing line: ~ $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n"~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~~ @@ -123768,9 +138528,9 @@ Follows is a source code listing for all files that have been open sourced. This ** Processing line: ~ if $trace_puts.length > 0~ ** Processing line: ~ text = $trace_puts.join("")~ ** Processing line: ~ if pad_with_newline~ -** Processing line: ~ $gtk.append_file 'logs/trace.txt', "\n" + text.strip~ +** Processing line: ~ $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip~ ** Processing line: ~ else~ -** Processing line: ~ $gtk.append_file 'logs/trace.txt', text.strip~ +** Processing line: ~ $gtk.append_file_root 'logs/trace.txt', text.strip~ ** Processing line: ~ end~ ** Processing line: ~ end~ ** Processing line: ~ $trace_puts.clear~ diff --git a/docs/search_results.txt b/docs/search_results.txt index 39ac95e..ad996a7 100644 --- a/docs/search_results.txt +++ b/docs/search_results.txt @@ -1,664 +1 @@ -* Hello World - -Welcome to DragonRuby Game Toolkit. Take the steps below to get started. - -* Join the Discord and Subscribe to the News Letter - -Our Discord channel is [[http://discord.dragonruby.org]]. - -The News Letter will keep you in the loop with regards to current -DragonRuby Events: [[http://dragonrubydispatch.com]]. - -Those who use DragonRuby are called Dragon Riders. This identity is -incredibly important to us. When someone asks you: - -#+begin_quote -What game engine do you use? -#+end_quote - -Reply with: - -#+begin_quote -I am a Dragon Rider. -#+end_quote - -* Watch Some Intro Videos - -Each video is only 20 minutes and all of them will fit into a lunch -break. So please watch them: - -1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] -2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] -3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] - -The second and third videos are not required if you are proficient -with Ruby, but *definitely* watch the first one. - -You may also want to try this free course provided at -[[http://dragonruby.school]]. - -* Getting Started Tutorial - -This is a tutorial written by Ryan C Gordon (a Juggernaut in the -industry who has contracted to Valve, Epic, Activision, and -EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]). - -** Introduction - -Welcome! - -Here's just a little push to get you started if you're new to -programming or game development. - -If you want to write a game, it's no different than writing any other -program for any other framework: there are a few simple rules that -might be new to you, but more or less programming is programming no -matter what you are building. - -Did you not know that? Did you think you couldn't write a game because -you're a "web guy" or you're writing Java at a desk job? Stop letting -people tell you that you can't, because you already have everything -you need. - -Here, we're going to be programming in a language called "Ruby." In -the interest of full disclosure, I (Ryan Gordon) wrote the C parts of -this toolkit and Ruby looks a little strange to me (Amir Rajan wrote -the Ruby parts, discounting the parts I mangled), but I'm going to -walk you through the basics because we're all learning together, and -if you mostly think of yourself as someone that writes C (or C++, C#, -Objective-C), PHP, or Java, then you're only a step behind me right -now. - -** Prerequisites - -Here's the most important thing you should know: Ruby lets you do some -complicated things really easily, and you can learn that stuff -later. I'm going to show you one or two cool tricks, but that's all. - -Do you know what an if statement is? A for-loop? An array? That's all -you'll need to start. - -** The Game Loop - -Ok, here are few rules with regards to game development with GTK: - -- Your game is all going to happen under one function ... -- that runs 60 times a second ... -- and has to tell the computer what to draw each time. - -That's an entire video game in one run-on sentence. - -Here's that function. You're going to want to put this in -mygame/app/main.rb, because that's where we'll look for it by -default. Load it up in your favorite text editor. - -#+begin_src ruby - def tick args - args.outputs.labels << [580, 400, 'Hello World!'] - end -#+end_src - -Now run ~dragonruby~ ...did you get a window with "Hello World!" -written in it? Good, you're officially a game developer! - -** Breakdown Of The ~tick~ Method - -~mygame/app/main.rb~, is where the Ruby source code is located. This -looks a little strange, so I'll break it down line by line. In Ruby, a -'#' character starts a single-line comment, so I'll talk about this -inline. - -#+begin_src ruby - # This "def"ines a function, named "tick," which takes a single argument - # named "args". DragonRuby looks for this function and calls it every - # frame, 60 times a second. "args" is a magic structure with lots of - # information in it. You can set variables in there for your own game state, - # and every frame it will updated if keys are pressed, joysticks moved, - # mice clicked, etc. - def tick args - - # One of the things in "args" is the "outputs" object that your game uses - # to draw things. Afraid of rendering APIs? No problem. In DragonRuby, - # you use arrays to draw things and we figure out the details. - # If you want to draw text on the screen, you give it an array (the thing - # in the [ brackets ]), with an X and Y coordinate and the text to draw. - # The "<<" thing says "append this array onto the list of them at - # args.outputs.labels) - args.outputs.labels << [580, 400, 'Hello World!'] - end -#+end_src - -Once your ~tick~ function finishes, we look at all the arrays you made -and figure out how to draw it. You don't need to know about graphics -APIs. You're just setting up some arrays! DragonRuby clears out these -arrays every frame, so you just need to add what you need _right now_ -each time. - -** Rendering A Sprite - -Now let's spice this up a little. - -We're going to add some graphics. Each 2D image in DragonRuby is -called a "sprite," and to use them, you just make sure they exist in a -reasonable file format (png, jpg, gif, bmp, etc) and specify them by -filename. The first time you use one, DragonRuby will load it and keep -it in video memory for fast access in the future. If you use a -filename that doesn't exist, you get a fun checkerboard pattern! - -There's a "dragonruby.png" file included, just to get you -started. Let's have it draw every frame with our text: - -#+begin_src ruby - def tick args - args.outputs.labels << [580, 400, 'Hello World!'] - args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png'] - end -#+end_src - -(Pro Tip: you don't have to restart DragonRuby to test your changes; -when you save main.rb, DragonRuby will notice and reload your -program.) - -That ~.sprites~ line says "add a sprite to the list of sprites we're -drawing, and draw it at position (576, 100) at a size of 128x101 -pixels". You can find the image to draw at dragonruby.png. - -** Coordinate System and Virtual Canvas - -Quick note about coordinates: (0, 0) is the bottom left corner of the -screen, and positive numbers go up and to the right. This is more -"geometrically correct," even if it's not how you remember doing 2D -graphics, but we chose this for a simpler reason: when you're making -Super Mario Brothers and you want Mario to jump, you should be able to -add to Mario's y position as he goes up and subtract as he falls. It -makes things easier to understand. - -Also: your game screen is _always_ 1280x720 pixels. If you resize the -window, we will scale and letterbox everything appropriately, so you -never have to worry about different resolutions. - -Ok, now we have an image on the screen, let's animate it: - -#+begin_src ruby - def tick args - args.state.rotation ||= 0 - args.outputs.labels << [580, 400, 'Hello World!' ] - args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation] - args.state.rotation -= 1 - end -#+end_src - -Now you can see that this function is getting called a lot! - -** Game State - -Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for -"if args.state.rotation isn't initialized, set it to zero." It's a -nice way to embed your initialization code right next to where you -need the variable. - -~args.state~ is a place you can hang your own data and have it survive -past the life of the function call. In this case, the current rotation -of our sprite, which is happily spinning at 60 frames per second. If -you don't specify rotation (or alpha, or color modulation, or a source -rectangle, etc), DragonRuby picks a reasonable default, and the array -is ordered by the most likely things you need to tell us: position, -size, name. - -** There Is No Delta Time - -One thing we decided to do in DragonRuby is not make you worry about -delta time: your function runs at 60 frames per second (about 16 -milliseconds) and that's that. Having to worry about framerate is -something massive triple-AAA games do, but for fun little 2D games? -You'd have to work really hard to not hit 60fps. All your drawing is -happening on a GPU designed to run Fortnite quickly; it can definitely -handle this. - -Since we didn't make you worry about delta time, you can just move the -rotation by 1 every time and it works without you having to keep track -of time and math. Want it to move faster? Subtract 2. - -** Handling User Input - -Now, let's move that image around. - -#+begin_src ruby - def tick args - args.state.rotation ||= 0 - args.state.x ||= 576 - args.state.y ||= 100 - - if args.inputs.mouse.click - args.state.x = args.inputs.mouse.click.point.x - 64 - args.state.y = args.inputs.mouse.click.point.y - 50 - end - - args.outputs.labels << [580, 400, 'Hello World!'] - args.outputs.sprites << [args.state.x, - args.state.y, - 128, - 101, - 'dragonruby.png', - args.state.rotation] - - args.state.rotation -= 1 - end -#+end_src - -Everywhere you click your mouse, the image moves there. We set a -default location for it with ~args.state.x ||= 576~, and then we -change those variables when we see the mouse button in action. You can -get at the keyboard and game controllers in similar ways. - -** Coding On A Raspberry Pi - -We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we -believe it _should_ work on any model with comparable specs. - -If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run -a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- -like one frame every few seconds--then there's likely a simple fix. - -You're probably running a desktop environment: menus, apps, web browsers, -etc. This is okay! Launch the terminal app and type: - -#+begin_src -sudo raspi-config -#+end_src - -It'll ask you for your password (if you don't know, try "raspberry"), and then -give you a menu of options. Find your way to "Advanced Options", then "GL -Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is -also listed there. Save and reboot. In theory, this should fix the problem. - -If you're _still_ having problems and have a Raspberry Pi 2 or better, go back -to raspi-config and head over to "Advanced Options", "Memory split," and give -the GPU 256 megabytes. You might be able to avoid this for simple games, as -this takes RAM away from the system and reserves it for graphics. You can -also try 128 megabytes as a gentler option. - -Note that you can also run DragonRuby without X11 at all: if you run it from -a virtual terminal it will render fullscreen and won't need the "Full KMS" -option. This might be attractive if you want to use it as a game console -sort of thing, or develop over ssh, or launch it from RetroPie, etc. - -** Conclusion - -There is a lot more you can do with DragonRuby, but now you've already -got just about everything you need to make a simple game. After all, -even the most fancy games are just creating objects and moving them -around. Experiment a little. Add a few more things and have them -interact in small ways. Want something to go away? Just don't add it -to ~args.output~ anymore. - -** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! - -Now that you've completed the Hello World tutorial. Head over to the -`samples` directory. It is very very important that you study the -sample apps thoroughly! Go through them in order. Here is a short -description of each sample app. - -1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. -2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. -3. 01_api_01_labels: Various ways to render ~label~s. -4. 01_api_02_lines: Various ways to render ~line~s. -5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. -6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. -7. 01_api_05_keyboard: Hows how to get keyboard input from the user. -8. 01_api_06_mouse: Hows how to get mouse mouse position. -9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. -10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. -11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. -12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. -13. 02_collision_01_simple: Collision detection with dynamically moving bodies. -14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. -15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). -16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. -17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. -18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. -19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. -20. 04_sounds: How to play sounds and work with buttons. -21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. -22. 05_mouse_move_paint_app: Represents a simple paint app. -23. 05_mouse_move_tile_editor: A starting point for a tile editor. -24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. -25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). -26. 07_render_targets_advanced: Advanced usage of ~render_target~s. -27. 08_platformer_collisions: Axis aligned collision along with platformer physics. -28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. -29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. -30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. -31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. -32. 10_save_load_game: Save and load game data. -33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. -34. 11_hash_primitives: How primitives can be represented using a ~Hash~. -35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. -36. 12_top_down_area: How to render a top down map and how to manage collision of a player. -37. 13_01_easing_functions: How to use lerping functions to define animations/movement. -38. 13_02_cubic_bezier: How to create a bezier curve using lines. -39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. -40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. -41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. -42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). -43. 15_collision_limits: How many collisions can be processed across many primitives. -44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). -45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. -46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. -47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. -48. 21_mailbox_usage: How to do interprocess communication. -49. 22_trace_debugging: Debugging techniques and tracing execution through your game. -50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. -51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. -52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. -53. 24_http_example: How to make http requests. -54. 25_3d_experiment_01_square: How to create 3D objects. -55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. -56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. -57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. -58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. -59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. -60. 99_sample_game_pong: Reference implementation of pong. -61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. -62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. -63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. -64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. -65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. - - -* How To Render A Sprite Using An Array - -All file paths should use the forward slash ~/~ *not* backslash -~~. Game Toolkit includes a number of sprites in the ~sprites~ -folder (everything about your game is located in the ~mygame~ directory). - -The following code renders a sprite with a ~width~ and ~height~ of -~100~ in the center of the screen. - -~args.outputs.sprites~ is used to render a sprite. - -#+begin_src ruby - def tick args - args.outputs.sprites << [ - 640 - 50, # X - 360 - 50, # Y - 100, # W - 100, # H - 'sprites/square-blue.png' # PATH - ] - end -#+end_src - -* More Sprite Properties As An Array - -Here are all the properties you can set on a sprite. - -#+begin_src ruby - def tick args - args.outputs.sprites << [ - 100, # X - 100, # Y - 32, # W - 64, # H - 'sprites/square-blue.png', # PATH - 0, # ANGLE - 255, # ALPHA - 0, # RED_SATURATION - 255, # GREEN_SATURATION - 0 # BLUE_SATURATION - ] - end -#+end_src - -* Different Sprite Representations - -Using ordinal positioning can get a little unruly given so many -properties you have control over. - -You can represent a sprite as a ~Hash~: - -#+begin_src ruby - def tick args - args.outputs.sprites << { - x: 640 - 50, - y: 360 - 50, - w: 100, - h: 100, - path: 'sprites/square-blue.png', - angle: 0, - a: 255, - r: 255, - g: 255, - b: 255, - source_x: 0, - source_y: 0, - source_w: -1, - source_h: -1, - flip_vertically: false, - flip_horizontally: false, - angle_anchor_x: 0.5, - angle_anchor_y: 1.0 - } - end -#+end_src - -You can represent a sprite as an ~object~: - -#+begin_src ruby - # Create type with ALL sprite properties AND primitive_marker - class Sprite - attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, - :source_x, :source_y, :source_w, :source_h, - :tile_x, :tile_y, :tile_w, :tile_h, - :flip_horizontally, :flip_vertically, - :angle_anchor_x, :angle_anchor_y - - def primitive_marker - :sprite - end - end - - class BlueSquare < Sprite - def initialize opts - @x = opts[:x] - @y = opts[:y] - @w = opts[:w] - @h = opts[:h] - @path = 'sprites/square-blue.png' - end - end - - def tick args - args.outputs.sprites << (BlueSquare.new x: 640 - 50, - y: 360 - 50, - w: 50, - h: 50) - end -#+end_src - -* Using ~args.state~ To Store Your Game State - -~args.state~ is a open data structure that allows you to define -properties that are arbitrarily nested. You don't need to define any kind of -~class~. - -To initialize your game state, use the ~||=~ operator. Any value on -the right side of ~||=~ will only be assigned _once_. - -To assign a value every frame, just use the ~=~ operator, but _make -sure_ you've initialized a default value. - -#+begin_src - def tick args - # initialize your game state ONCE - args.player.x ||= 0 - args.player.y ||= 0 - args.player.hp ||= 100 - - # increment the x position of the character by one every frame - args.player.x += 1 - - # Render a sprite with a label above the sprite - args.outputs.sprites << [ - args.player.x, - args.player.y, - 32, 32, - "player.png" - ] - - args.outputs.labels << [ - args.player.x, - args.player.y - 50, - args.player.hp - ] - end -#+end_src - -* DOCS: ~Array#map~ - -The function given a block returns a new ~Enumerable~ of values. - -Example of using ~Array#map~ in conjunction with ~args.state~ and -~args.outputs.sprites~ to render sprites to the screen. - -#+begin_src - def tick args - # define the colors of the rainbow in ~args.state~ - # as an ~Array~ of ~Hash~es with :order and :name. - # :order will be used to determine render location - # and :name will be used to determine sprite path. - args.state.rainbow_colors ||= [ - { order: 0, name: :red }, - { order: 1, name: :orange }, - { order: 2, name: :yellow }, - { order: 3, name: :green }, - { order: 4, name: :blue }, - { order: 5, name: :indigo }, - { order: 6, name: :violet }, - ] - - # render sprites diagonally to the screen - # with a width and height of 50. - args.outputs - .sprites << args.state - .rainbow_colors - .map do |color| # <-- ~Array#map~ usage - [ - color[:order] * 50, - color[:order] * 50, - 50, - 50, - "sprites/square-#{color[:name]}.png" - ] - end - end -#+end_src - - -* DOCS: ~Array#each~ - -The function, given a block, invokes the block for each item in the -~Array~. ~Array#each~ is synonymous to foreach constructs in other languages. - -Example of using ~Array#each~ in conjunction with ~args.state~ and -~args.outputs.sprites~ to render sprites to the screen: - -#+begin_src - def tick args - # define the colors of the rainbow in ~args.state~ - # as an ~Array~ of ~Hash~es with :order and :name. - # :order will be used to determine render location - # and :name will be used to determine sprite path. - args.state.rainbow_colors ||= [ - { order: 0, name: :red }, - { order: 1, name: :orange }, - { order: 2, name: :yellow }, - { order: 3, name: :green }, - { order: 4, name: :blue }, - { order: 5, name: :indigo }, - { order: 6, name: :violet }, - ] - - # render sprites diagonally to the screen - # with a width and height of 50. - args.state - .rainbow_colors - .map do |color| # <-- ~Array#each~ usage - args.outputs.sprites << [ - color[:order] * 50, - color[:order] * 50, - 50, - 50, - "sprites/square-#{color[:name]}.png" - ] - end - end -#+end_src - - -* DOCS: ~Numeric#frame_index~ - -This function is helpful for determining the index of frame-by-frame - sprite animation. The numeric value ~self~ represents the moment the - animation started. - -~frame_index~ takes three additional parameters: - -- How many frames exist in the sprite animation. -- How long to hold each animation for. -- Whether the animation should repeat. - -~frame_index~ will return ~nil~ if the time for the animation is out -of bounds of the parameter specification. - -Example using variables: - -#+begin_src ruby - def tick args - start_looping_at = 0 - number_of_sprites = 6 - number_of_frames_to_show_each_sprite = 4 - does_sprite_loop = true - - sprite_index = - start_looping_at.frame_index number_of_sprites, - number_of_frames_to_show_each_sprite, - does_sprite_loop - - sprite_index ||= 0 - - args.outputs.sprites << [ - 640 - 50, - 360 - 50, - 100, - 100, - "sprites/dragon-#{sprite_index}.png" - ] - end -#+end_src - -Example using named parameters: - -#+begin_src ruby - def tick args - start_looping_at = 0 - - sprite_index = - start_looping_at.frame_index count: 6, - hold_for: 4, - repeat: true, - tick_count_override: args.state.tick_count - - sprite_index ||= 0 - - args.outputs.sprites << [ - 640 - 50, - 360 - 50, - 100, - 100, - "sprites/dragon-#{sprite_index}.png" - ] - end -#+end_src - - +* DOCS: No results found. \ No newline at end of file diff --git a/docs/todo/06-keyboard.md b/docs/todo/06-keyboard.md index 6fbe6d2..4037e3f 100644 --- a/docs/todo/06-keyboard.md +++ b/docs/todo/06-keyboard.md @@ -47,7 +47,7 @@ def tick args [args.inputs.controller_two, :controller_two] ].each do |input, name| if input.key_down.truthy_keys.length > 0 - args.gtk.write_file("mygame/app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) + args.gtk.write_file("app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) end end end diff --git a/docs/todo/08-controllers.md b/docs/todo/08-controllers.md index 68bd9c2..aa85ee8 100644 --- a/docs/todo/08-controllers.md +++ b/docs/todo/08-controllers.md @@ -46,7 +46,7 @@ def tick args [args.inputs.controller_two, :controller_two] ].each do |input, name| if input.key_down.truthy_keys.length > 0 - args.gtk.write_file("mygame/app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) + args.gtk.write_file("app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) end end end diff --git a/dragon/console.rb b/dragon/console.rb index 965a459..1dea2e0 100644 --- a/dragon/console.rb +++ b/dragon/console.rb @@ -292,18 +292,17 @@ S @last_command_errored = false rescue Exception => e string_e = "#{e}" + puts "* EXCEPTION: #{e}" + log "* EXCEPTION: #{e}" @last_command_errored = true if (string_e.include? "wrong number of arguments") method_name = (string_e.split ":")[0].gsub "'", "" - results = Kernel.docs_search method_name - if !results.include "* DOCS: No results found." + results = (Kernel.docs_search method_name).strip + if !results.include? "* DOCS: No results found." puts results log results end end - - puts "#{e}" - log "#{e}" end end end @@ -315,6 +314,10 @@ S (args.inputs.keyboard.key_up.b && args.inputs.keyboard.key_up.control) end + def scroll_to_bottom + @log_offset = 0 + end + def scroll_up_full @log_offset += lines_on_one_page @log_offset = @log.size if @log_offset > @log.size @@ -510,63 +513,6 @@ S render_log_offset args end - def tick_help args - tick_help_debounce args - alpha_rate = 20 - @render_help_target_alpha ||= 255 - @render_help_current_alpha ||= 255 - @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha - @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20) - - @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255) - @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255) - - [ - "* Prompt Commands: ", - "You can type any of the following ", - "commands in the command prompt. ", - "** docs: Provides API docs. ", - "** $gtk: Accesses the global runtime.", - "* Shortcut Keys: ", - "** full page up: ctrl + b ", - "** full page down: ctrl + f ", - "** half page up: ctrl + u ", - "** half page down: ctrl + d ", - "** clear prompt: ctrl + g ", - "** up arrow: next command ", - "** down arrow: prev command ", - ].each_with_index do |s, i| - args.outputs.reserved << [args.grid.right - 10, - top - 100 - line_height_px * i * 0.8, - s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label - end - end - - def tick_help_debounce args - hide_log_alpha = -255 - if hidden? - @render_help_current_alpha = -255 - end - - if prompt.last_input_str_changed - @render_help_target_alpha = hide_log_alpha - end - - if args.inputs.mouse.moved - @render_help_target_alpha = hide_log_alpha - end - - if args.inputs.mouse.wheel - @render_help_target_alpha = hide_log_alpha - end - - if @render_help_last_log_invocation_count != @log_invocation_count - @render_help_target_alpha = hide_log_alpha - end - - @render_help_last_log_invocation_count = @log_invocation_count - end - def render_log_offset args return if @log_offset <= 0 args.outputs.reserved << font_style.label( @@ -623,7 +569,6 @@ S process_inputs args return unless should_tick? calc args - tick_help args prompt.tick menu.tick args rescue Exception => e diff --git a/dragon/console_menu.rb b/dragon/console_menu.rb index e7f43ce..7449f4a 100644 --- a/dragon/console_menu.rb +++ b/dragon/console_menu.rb @@ -5,6 +5,8 @@ module GTK class Console class Menu + attr_accessor :buttons + def initialize console @console = console end @@ -38,28 +40,63 @@ module GTK @console.hide end + def hide_menu_clicked + @menu_shown = :hidden + end + def framerate_diagnostics_clicked + @console.scroll_to_bottom $gtk.framerate_diagnostics end + def itch_wizard_clicked + @console.scroll_to_bottom + $wizards.itch.start + end + + def docs_clicked + @console.scroll_to_bottom + log Kernel.docs_classes + end + + def scroll_end_clicked + @console.scroll_to_bottom + end + + def custom_buttons + [] + end + def tick args return unless @console.visible? @menu_shown ||= :hidden - if @menu_shown == :hidden + if $gtk.production + @buttons = [ + (button id: :record, row: 0, col: 9, text: "record gameplay", method: :record_clicked), + (button id: :replay, row: 0, col: 10, text: "start replay", method: :replay_clicked), + ] + elsif @menu_shown == :hidden @buttons = [ (button id: :show_menu, row: 0, col: 10, text: "show menu", method: :show_menu_clicked), ] else @buttons = [ - (button id: :record, row: 0, col: 4, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), - (button id: :record, row: 0, col: 5, text: "record", method: :record_clicked), - (button id: :replay, row: 0, col: 6, text: "replay", method: :replay_clicked), - (button id: :reset, row: 0, col: 7, text: "reset", method: :reset_clicked), - (button id: :scroll_up, row: 0, col: 8, text: "scroll up", method: :scroll_up_clicked), - (button id: :scroll_down, row: 0, col: 9, text: "scroll down", method: :scroll_down_clicked), - (button id: :close, row: 0, col: 10, text: "close", method: :close_clicked), + (button id: :scroll_up, row: 0, col: 6, text: "scroll up", method: :scroll_up_clicked), + (button id: :scroll_down, row: 0, col: 7, text: "scroll down", method: :scroll_down_clicked), + (button id: :scroll_down, row: 0, col: 8, text: "scroll end", method: :scroll_end_clicked), + (button id: :close, row: 0, col: 9, text: "close console", method: :close_clicked), + (button id: :hide, row: 0, col: 10, text: "hide menu", method: :hide_menu_clicked), + + (button id: :record, row: 1, col: 7, text: "record gameplay", method: :record_clicked), + (button id: :replay, row: 1, col: 8, text: "start replay", method: :replay_clicked), + (button id: :record, row: 1, col: 9, text: "framerate diagnostics", method: :framerate_diagnostics_clicked), + (button id: :reset, row: 1, col: 10, text: "reset game", method: :reset_clicked), + + (button id: :reset, row: 2, col: 10, text: "docs", method: :docs_clicked), + (button id: :reset, row: 2, col: 9, text: "itch wizard", method: :itch_wizard_clicked), + *custom_buttons ] end @@ -92,10 +129,11 @@ module GTK { id: id, rect: (rect_for_layout row, col), + text: text, method: method }.let do |entity| primitives = [] - primitives << entity[:rect].merge(a: 80).solid + primitives << entity[:rect].merge(a: 164).solid primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border primitives << text.wrapped_lines(5) .map_with_index do |l, i| diff --git a/dragon/docs.rb b/dragon/docs.rb index 8f5e8bf..67a50e0 100644 --- a/dragon/docs.rb +++ b/dragon/docs.rb @@ -89,7 +89,7 @@ module Docs def docs_classes DocsOrganizer.sort_docs_classes! - list = $docs_classes.map { |mod| "** #{mod.name}" }.join "\n" + list = $docs_classes.map { |mod| "** #{mod.name}.docs" }.join "\n" <<-S * DOCS: @@ -107,7 +107,7 @@ S end def docs - docs_methods = [DocsOrganizer.find_methods_with_docs(self), :docs_classes].flatten.map { |d| "** #{d}" }.join "\n" + docs_methods = [DocsOrganizer.find_methods_with_docs(self), :docs_classes].flatten.map { |d| "** #{self.name}.#{d}" }.join "\n" if self == Kernel <<-S @@ -201,8 +201,10 @@ S final_string = "* DOCS: No results found." end - $gtk.write_file "docs/search_results.txt", final_string - log "* INFO: Search results have been written to docs/search_results.txt." + $gtk.write_file_root "docs/search_results.txt", final_string + if !final_string.include? "* DOCS: No results found." + log "* INFO: Search results have been written to docs/search_results.txt." + end "\n" + final_string end @@ -216,7 +218,7 @@ S (send m).ltrim + "\n" end.join "\n" file_path = "docs/#{self.name}.txt" - $gtk.write_file "#{file_path}", content + $gtk.write_file_root "#{file_path}", content puts "* INFO: Documentation for #{self.name} has been exported to #{file_path}." $gtk.console.set_system_command file_path nil @@ -235,19 +237,21 @@ S # may god have mercy on your soul if you try to expand this def __docs_to_html__ string parse_log = [] - html_string = <<-S + + html_start_to_toc_start = <<-S DragonRuby Game Toolkit Documentation - - +
    - {{toc}} +S + html_toc_end_to_content_start = <<-S
    - {{content}} +S + html_content_end_to_html_end = <<-S
    @@ -319,6 +323,11 @@ S __docs_append_true_line__ true_lines, current_true_line, parse_log __docs_append_true_line__ true_lines, l, parse_log current_true_line = "" + elsif l.start_with? "**** " + parse_log << "- Header detected." + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" else current_true_line += l.rstrip + " " end @@ -330,7 +339,7 @@ S true_lines = true_lines[1..-1] end - toc = "" + toc_html = "" content_html = "" inside_pre = false @@ -371,7 +380,7 @@ S inside_ol = false inside_ul = false - toc = "

    Table Of Contents

    \n
      \n" + toc_html = "

      Table Of Contents

      \n
        \n" parse_log << "* Processing Html Given True Lines" true_lines.each do |l| parse_log << "** Processing line: ~#{l.rstrip}~" @@ -382,7 +391,7 @@ S inside_ul = false formatted_html = __docs_line_to_html__ l, parse_log link_id = text_to_id.call l - toc += "
      • #{formatted_html}
      • \n" + toc_html += "
      • #{formatted_html}
      • \n" content_html += "

        #{formatted_html}

        \n" elsif l.start_with? "** " parse_log << "- H2 detected." @@ -391,7 +400,7 @@ S inside_ul = false formatted_html = __docs_line_to_html__ l, parse_log link_id = text_to_id.call l - # toc += "#{formatted_html}
        \n" + # toc_html += "#{formatted_html}
        \n" content_html += "

        #{__docs_line_to_html__ l, parse_log}

        \n" elsif l.start_with? "*** " parse_log << "- H3 detected." @@ -400,8 +409,17 @@ S inside_ul = false formatted_html = __docs_line_to_html__ l, parse_log link_id = text_to_id.call l - # toc += "#{formatted_html}
        \n" + # toc_html += "#{formatted_html}
        \n" content_html += "

        #{__docs_line_to_html__ l, parse_log}

        \n" + elsif l.start_with? "**** " + parse_log << "- H4 detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + formatted_html = __docs_line_to_html__ l, parse_log + link_id = text_to_id.call l + # toc_html += "#{formatted_html}
        \n" + content_html += "

        #{__docs_line_to_html__ l, parse_log}

        \n" elsif l.strip.length == 0 && !inside_pre # do nothing elsif l.start_with? "#+begin_src" @@ -451,6 +469,8 @@ S l = l[3..-1] elsif l.split(".")[0].length == 3 l = l[4..-1] + elsif l.split(".")[0].length == 4 + l = l[5..-1] end content_html << "
      • #{__docs_line_to_html__ l, parse_log}
      • \n" @@ -493,10 +513,13 @@ S end end end - toc += "
      " + toc_html += "
    " - final_html = (html_string.gsub "{{toc}}", toc) - final_html = (final_html.gsub "{{content}}", content_html) + final_html = html_start_to_toc_start + + toc_html + + html_toc_end_to_content_start + + content_html + + html_content_end_to_html_end { original: string, @@ -504,15 +527,30 @@ S parse_log: parse_log } rescue Exception => e - $gtk.write_file 'docs/parse_log.txt', (parse_log.join "\n") + $gtk.write_file_root 'docs/parse_log.txt', (parse_log.join "\n") raise "* ERROR in Docs::__docs_to_html__. #{e}" end def __docs_line_to_html__ line, parse_log - line = line.gsub "* DOCS: ", "" if line.start_with? "* DOCS: " - line = line.gsub "* ", "" if line.start_with? "* " - line = line.gsub "** ", "" if line.start_with? "** " - line = line.gsub "*** ", "" if line.start_with? "*** " + parse_log << "- Determining if line is a header." + if line.start_with? "**** " + line = line.gsub "**** ", "" + parse_log << "- Line contains ~**** ~... gsub-ing empty string" + elsif line.start_with? "*** " + line = line.gsub "*** ", "" + parse_log << "- Line contains ~*** ~... gsub-ing empty string" + elsif line.start_with? "** " + line = line.gsub "** ", "" + parse_log << "- Line contains ~** ~... gsub-ing empty string" + elsif line.start_with? "* " + line = line.gsub "* ", "" + parse_log << "- Line contains ~* ~... gsub-ing empty string" + elsif line.start_with? "* DOCS: " + line = line.gsub "* DOCS: ", "" + parse_log << "- Line contains ~* DOCS:~... gsub-ing empty string" + else + parse_log << "- Line does not appear to be a header." + end tilde_count = line.count "~" line_has_link_marker = (line.include? "[[") && (line.include? "]]") diff --git a/dragon/easing.rb b/dragon/easing.rb new file mode 100644 index 0000000..310e7ed --- /dev/null +++ b/dragon/easing.rb @@ -0,0 +1,82 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# easing.rb has been released under MIT (*only this file*). + +module GTK + module Easing + def self.ease_extended start_tick, current_tick, end_tick, default_before, default_after, *definitions + definitions.flatten! + definitions = [:identity] if definitions.length == 0 + duration = end_tick - start_tick + elapsed = current_tick - start_tick + y = elapsed.percentage_of(duration).cap_min_max(0, 1) + + definitions.map do |definition| + y = Easing.exec_definition(definition, start_tick, duration, y) + end + + y + end + + def self.ease_spline_extended start_tick, current_tick, end_tick, spline + duration = end_tick - start_tick + t = (current_tick - start_tick).fdiv duration + time_allocation_per_curve = 1.fdiv(spline.length) + curve_index, curve_t = t.fdiv(time_allocation_per_curve).let do |spline_t| + [spline_t.to_i, spline_t - spline_t.to_i] + end + Geometry.cubic_bezier curve_t, *spline[curve_index] + end + + def self.initial_value *definitions + definitions.flatten! + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 0 + end + + def self.final_value *definitions + definitions.flatten! + return Easing.exec_definition (definitions.value(-1) || :identity), 0, 10, 1.0 + end + + def self.exec_definition definition, start_tick, duration, x + if definition.is_a? Symbol + return Easing.send(definition, x).cap_min_max(0, 1) + elsif definition.is_a? Proc + return definition.call(x, start_tick, duration).cap_min_max(0, 1) + end + + raise <<-S +* ERROR: +I don't know how to execute easing function with definition #{definition}. + +S + end + + def self.identity x + x + end + + def self.flip x + 1 - x + end + + def self.quad x + x * x + end + + def self.cube x + x * x * x + end + + def self.quart x + x * x * x * x * x + end + + def self.quint x + x * x * x * x * x * x + end + end +end + +Easing = GTK::Easing diff --git a/dragon/geometry.rb b/dragon/geometry.rb index 607520f..b16c5b7 100644 --- a/dragon/geometry.rb +++ b/dragon/geometry.rb @@ -128,10 +128,6 @@ S raise ":angle_given_point has been deprecated use :angle_from instead." end - def distance_to other_point - Geometry.distance(self, other_point) - end - # @gtk def self.shift_line line, x, y if line.is_a?(Array) || line.is_a?(Hash) diff --git a/dragon/kernel_docs.rb b/dragon/kernel_docs.rb index 00eadf6..95e35be 100644 --- a/dragon/kernel_docs.rb +++ b/dragon/kernel_docs.rb @@ -53,13 +53,13 @@ S final_string += k.docs_all end - final_string += "\n" + (($gtk.read_file "docs/source.txt") || "") + final_string += "\n" + (($gtk.read_file_root "docs/source.txt") || "") html_parse_result = (__docs_to_html__ final_string) - $gtk.write_file 'docs/docs.txt', "#{final_string}" - $gtk.write_file 'docs/docs.html', html_parse_result[:html] - $gtk.write_file 'docs/parse_log.txt', (html_parse_result[:parse_log].join "\n") + $gtk.write_file_root 'docs/docs.txt', "#{final_string}" + $gtk.write_file_root 'docs/docs.html', html_parse_result[:html] + $gtk.write_file_root 'docs/parse_log.txt', (html_parse_result[:parse_log].join "\n") log "* INFO: All docs have been exported to docs/docs.txt." log "* INFO: All docs have been exported to docs/docs.html." diff --git a/dragon/log.rb b/dragon/log.rb index b2ee0e1..7bf09fd 100644 --- a/dragon/log.rb +++ b/dragon/log.rb @@ -27,19 +27,19 @@ module GTK class Log def self.write_to_log_and_puts *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + "\n" + $gtk.append_file_root 'logs/log.txt', args.join("\n") + "\n" args.each { |obj| $gtk.log obj, self } end def self.write_to_log_and_print *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + $gtk.append_file_root 'logs/log.txt', args.join("\n") Object.print(*args) end def self.puts_important *args return if $gtk.production - $gtk.append_file 'logs/log.txt', args.join("\n") + $gtk.append_file_root 'logs/log.txt', args.join("\n") $gtk.notify! "Important notification occurred." args.each { |obj| $gtk.log obj } end diff --git a/dragon/numeric.rb b/dragon/numeric.rb index 5485ff8..6d8b84d 100644 --- a/dragon/numeric.rb +++ b/dragon/numeric.rb @@ -9,11 +9,6 @@ class Numeric alias_method :gte, :>= alias_method :lte, :<= - - # Converts numeric value to distance from top of stage - def from_top - $gtk.args.grid.h - self - end # Converts a numeric value representing seconds into frames. # diff --git a/dragon/readme_docs.rb b/dragon/readme_docs.rb index 92a23b0..f4d3696 100644 --- a/dragon/readme_docs.rb +++ b/dragon/readme_docs.rb @@ -338,79 +338,43 @@ around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore. -** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! +* IMPORTANT: Go through all of the sample apps! Study them thoroughly!! No really, you should definitely do this! Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app. -1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. -2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. -3. 01_api_01_labels: Various ways to render ~label~s. -4. 01_api_02_lines: Various ways to render ~line~s. -5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. -6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. -7. 01_api_05_keyboard: Hows how to get keyboard input from the user. -8. 01_api_06_mouse: Hows how to get mouse mouse position. -9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. -10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. -11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. -12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. -13. 02_collision_01_simple: Collision detection with dynamically moving bodies. -14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. -15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). -16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. -17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. -18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. -19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. -20. 04_sounds: How to play sounds and work with buttons. -21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. -22. 05_mouse_move_paint_app: Represents a simple paint app. -23. 05_mouse_move_tile_editor: A starting point for a tile editor. -24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. -25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). -26. 07_render_targets_advanced: Advanced usage of ~render_target~s. -27. 08_platformer_collisions: Axis aligned collision along with platformer physics. -28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. -29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. -30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. -31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. -32. 10_save_load_game: Save and load game data. -33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. -34. 11_hash_primitives: How primitives can be represented using a ~Hash~. -35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. -36. 12_top_down_area: How to render a top down map and how to manage collision of a player. -37. 13_01_easing_functions: How to use lerping functions to define animations/movement. -38. 13_02_cubic_bezier: How to create a bezier curve using lines. -39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. -40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. -41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. -42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). -43. 15_collision_limits: How many collisions can be processed across many primitives. -44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). -45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. -46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. -47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. -48. 21_mailbox_usage: How to do interprocess communication. -49. 22_trace_debugging: Debugging techniques and tracing execution through your game. -50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. -51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. -52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. -53. 24_http_example: How to make http requests. -54. 25_3d_experiment_01_square: How to create 3D objects. -55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. -56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. -57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. -58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. -59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. -60. 99_sample_game_pong: Reference implementation of pong. -61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. -62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. -63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. -64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. -65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. - +** Guided Samples + +1. ~samples/00_learn_ruby_optional~: This directory contains sample apps that will help you learn the language. +2. ~samples/01_rendering_basics~: This set of samples will show you how to render basic primitives such as ~labels~, ~solids~, ~borders~, ~lines~, ~sprites~, and how to play ~sounds~. +3. ~samples/02_input_basics~: This set of samples show you how to accept input from the ~mouse~, ~keyboard~, and ~controllers~. +4. ~samples/03_rendering_sprites~: This set of samples shows you all the different ways to render sprites (including how to use a sprite sheet). +4. ~samples/04_physics_and_collision~: This set of samples shows how to do various types of collisions and physics. +5. ~samples/05_mouse~: This set of samples show more advanced usages of the mouse. +6. ~samples/06_save_load~: This set of samples show how to save and load game data. +7. ~samples/07_advanced_rendering~: This set of samples show how to programmatically render sprites using render targets. +8. ~samples/08_tweening_lerping_easing_functions~: This set of samples show how to perform animations. +9. ~samples/09_performance~: This set of samples show how to handle performance issues when a large number of sprites on the screen. +10. ~samples/10_advanced_debugging~: This set of samples show how advanced debugging techniques and testing techniques. +11. ~samples/11_http~: This set of samples show how use http. + +** Sample Games + +There are samples that contain the path ~samples/99_*~. The sample apps that are prefixed with ~99_~ show non-trivial implemementations for a real game: + +1. 3D Cube: Shows how to do faux 3D in DragonRuby. +2. Dueling Starships: A two player top-down versus game where each player controls a ship. +3. Flappy Dragon: DragonRuby's clone of Flappy Bird. +4. Pong: A simple implementation of the game Pong. +5. Snakemoji: The classic game of Snake but with all of the code written using emojis (sometimes you just have to have a little fun). +6. Solar System: A simulation of our solar system. +7. Crafting Starting Point: A starting point for those that want to build a crafting game. +8. Dev Tools: A set of sample apps that show how you can extend DragonRuby's Console, starting point for a tile editor, and a starting point for a paint app. +9. LOWREZ: Sample apps that show how to render at different resolutions. +10. RPG: Various sample apps that show how to create narrative, topdown, tactical grid-based, and roguelike RPGs. +11. Platformers: Various sample apps that show how to create different kinds of physics/collision based platformers. S end @@ -444,11 +408,11 @@ make it look like this: NOTE: Remove the ~#~ at the beginning of each line. #+begin_src -devid=bob -devtitle=Bob The Game Developer -gameid=mygame -gametitle=My Game -version=0.1 + devid=bob + devtitle=Bob The Game Developer + gameid=mygame + gametitle=My Game + version=0.1 #+end_src The ~devid~ property is the username you use to log into Itch.io. @@ -462,7 +426,7 @@ The ~version~ can be any ~major.minor~ number format. Open up the terminal and run this from the command line: #+begin_src -./dragonruby-publish --only-package mygame + ./dragonruby-publish --only-package mygame #+end_src (if you're on Windows, don't put the "./" on the front. That's a Mac and @@ -477,7 +441,7 @@ For the HTML version of your game after you upload it. Check the checkbox labele For subsequent updates you can use an automated deployment to Itch.io: #+begin_src -./dragonruby-publish mygame + ./dragonruby-publish mygame #+end_src DragonRuby will package _and publish_ your game to itch.io! Tell your @@ -490,7 +454,7 @@ S def docs_dragonruby_philosophy <<-S -** DragonRuby's Philosophy +* DragonRuby's Philosophy The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, @@ -498,7 +462,7 @@ there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. -*** Challenge The Status Quo +** Challenge The Status Quo Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker @@ -512,7 +476,7 @@ It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us. -*** Continuity of Design +** Continuity of Design There is a programming idiom in software called "the pit of success". The term normalizes up front pain as a necessity in the @@ -527,7 +491,7 @@ render primitives can be represented as tuples/arrays, hashes, open structs/entities, and then finally classes (as opposed to forcing devs to use classes upfront). -*** Release Often And Soon +** Release Often And Soon The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and @@ -544,7 +508,7 @@ Remember: Real artists ship. #+end_quote -*** Sustainable And Ethical Monetization +** Sustainable And Ethical Monetization We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or @@ -554,7 +518,7 @@ Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it. -*** Sustainable And Ethical Open Source +** Sustainable And Ethical Open Source This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense @@ -565,7 +529,7 @@ still trying to figure out the best solution). So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir. -*** People Over Entities +** People Over Entities We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not @@ -573,13 +537,13 @@ insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby. -*** Building A Game Should Be Fun And Bring Happiness +** Building A Game Should Be Fun And Bring Happiness We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine. -*** Real World Application Drives Features +** Real World Application Drives Features We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and @@ -974,11 +938,9 @@ Under DragonRuby LLP, we offer a number of products (with more on the way): - Game Toolkit (GTK): A 2D game engine that is compatible with modern - gaming platforms. [Home Page]() [FAQ Page]() + gaming platforms. - RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile - apps. [Home Page]() [FAQ Page]() -- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby - environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() + apps. [[http://rubymotion.com]] All of the products above leverage a shared core called DragonRuby. @@ -997,7 +959,7 @@ identifier huh? The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. -*** Okay... so what is the difference between a language specification and a runtime? +**** Okay... so what is the difference between a language specification and a runtime? A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language @@ -1006,13 +968,13 @@ specification implemented via the CRuby/MRI Runtime." But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby. -*** Okay... what language specification does DragonRuby use then? +**** Okay... what language specification does DragonRuby use then? DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries. -*** So... why another runtime? +**** So... why another runtime? The elevator pitch is: @@ -1021,7 +983,7 @@ within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. -*** What does Multilevel Cross-platform mean? +**** What does Multilevel Cross-platform mean? There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a @@ -1058,13 +1020,87 @@ implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane. -*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? +**** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. -** Frequent Comments +*** How is DragonRuby different than MRI? + +DragonRuby supports a subset of MRI apis. Our target is to support all +of mRuby's standard lib. There are challenges to this given the number +of platforms we are trying to support (specifically console). + +**** Does DragonRuby support Gems? + +DragonRuby does not support gems because that requires the +installation of MRI Ruby on the developer's machine (which is a +non-starter given that we want DragonRuby to be a zero dependency +runtime). While this seems easy for Mac and Linux, it is much harder +on Windows and Raspberry Pi. mRuby has taken the approach of having a +git repository for compatible gems and we will most likely follow +suite: [[https://github.com/mruby/mgem-list]]. + +**** Does DragonRuby have a REPL/IRB? + +You can use DragonRuby's Console within the game to inspect object and +execute small pieces of code. For more complex pieces of code create a +file called ~repl.rb~ and put it in ~mygame/app/repl.rb~: + +- Any code you write in there will be executed when you change the file. You can organize different pieces of code using the ~repl~ method: + +#+begin_src ruby + repl do + puts "hello world" + puts 1 + 1 + end +#+end_src + +- If you use the `repl` method, the code will be executed and the DragonRuby Console will automatically open so you can see the results (on Mac and Linux, the results will also be printed to the terminal). + +- All ~puts~ statements will also be saved to ~logs/log.txt~. So if you want to stay in your editor and not look at the terminal, or the DragonRuby Console, you can ~tail~ this file. + +4. To ignore code in ~repl.rb~, instead of commenting it out, prefix ~repl~ with the letter ~x~ and it'll be ignored. + +#+begin_src ruby + xrepl do # <------- line is prefixed with an "x" + puts "hello world" + puts 1 + 1 + end + + # This code will be executed when you save the file. + repl do + puts "Hello" + end + + repl do + puts "This code will also be executed." + end + + # use xrepl to "comment out" code + xrepl do + puts "This code will not be executed because of the x infront of repl". + end +#+end_src + +**** Does DragonRuby support ~pry~ or have any other debugging facilities? + +~pry~ is a gem that assumes you are using the MRI Runtime (which is +incompatible with DragonRuby). Eventually DragonRuby will have a pry +based experience that is compatible with a debugging infrastructure +called LLDB. Take the time to read about LLDB as it shows the +challenges in creating something that is compatible. + +You can use DragonRuby's replay capabilities to troubleshoot: + +1. DragonRuby is hot loaded which gives you a very fast feedback loop (if the game throws an exception, it's because of the code you just added). +2. Use ~./dragonruby mygame --record~ to create a game play recording that you can use to find the exception (you can replay a recoding by executing ~./dragonruby mygame --replay last_replay.txt~ or through the DragonRuby Console using ~$gtk.recording.start_replay "last_replay.txt"~. +3. DragonRuby also ships with a unit testing facility. You can invoke the following command to run a test: ~./dragonruby . --eval some_ruby_file.rb --no-tick~. +4. Get into the habit of adding debugging facilities within the game itself. You can add drawing primitives to ~args.outputs.debug~ that will render on top of your game but will be ignored in a production release. +5. Debugging something that runs at 60fps is (imo) not that helpful. The exception you are seeing could have been because of a change that occurred many frames ago. + +** Frequent Comments About Ruby as a Language Choice *** But Ruby is dead. @@ -1116,6 +1152,8 @@ If you have ideas on how we can do this, email us! If the reason above isn't sufficient, then definitely use something else. +All this being said, we do have parts of the engine open sourced on GitHub: [[https://github.com/dragonruby/dragonruby-game-toolkit-contrib/]] + *** DragonRuby is for pay. You should offer a free version. If you can afford to pay for DragonRuby, you should (and will). We don't go diff --git a/dragon/runtime_docs.rb b/dragon/runtime_docs.rb index 09759b4..50734ce 100644 --- a/dragon/runtime_docs.rb +++ b/dragon/runtime_docs.rb @@ -29,6 +29,23 @@ This function returns the width and height of a string. args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" end #+end_src +S + end + + def docs_write_file + <<-S +* DOCS: ~GTK::Runtime#write_file~ +This function takes in two parameters. The first paramter is the file path and assumes the the game +directory is the root. The second parameter is the string that will be written. The method overwrites whatever +is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file as opposed to overwriting. + +#+begin_src ruby + def tick args + if args.inputs.mouse.click + args.gtk.write_file "last-mouse-click.txt", "Mouse was clicked at \#{args.state.tick_count}." + end + end +#+end_src S end end diff --git a/dragon/trace.rb b/dragon/trace.rb index 04067bf..ec154f3 100644 --- a/dragon/trace.rb +++ b/dragon/trace.rb @@ -65,7 +65,7 @@ module GTK @traced_classes.clear $trace_enabled = false if !$gtk.production - $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" + $gtk.write_file_root 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" end end @@ -87,9 +87,9 @@ module GTK if $trace_puts.length > 0 text = $trace_puts.join("") if pad_with_newline - $gtk.append_file 'logs/trace.txt', "\n" + text.strip + $gtk.append_file_root 'logs/trace.txt', "\n" + text.strip else - $gtk.append_file 'logs/trace.txt', text.strip + $gtk.append_file_root 'logs/trace.txt', text.strip end end $trace_puts.clear diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt new file mode 100644 index 0000000..dd86367 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/01_printing.txt @@ -0,0 +1,31 @@ +# ==================================================================================== +# Commenting Code +# ==================================================================================== +# +# Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: +# +# I am commented code. And so are the lines above. +# +# I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's +# an entertaining read. Otherwise, go to the next txt file. +# +# Follow along by visiting: +# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 + +# ==================================================================================== +# Printing to the Console: +# ==================================================================================== +# +# Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text +# to repl.rb and save to see Hello World printed to the console. + +repl do + puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.' + puts '====' + puts '======' + puts '================================' + puts 'Hello World' + puts '================================' + puts '======' + puts '====' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt deleted file mode 100644 index dd86367..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt +++ /dev/null @@ -1,31 +0,0 @@ -# ==================================================================================== -# Commenting Code -# ==================================================================================== -# -# Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: -# -# I am commented code. And so are the lines above. -# -# I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's -# an entertaining read. Otherwise, go to the next txt file. -# -# Follow along by visiting: -# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 - -# ==================================================================================== -# Printing to the Console: -# ==================================================================================== -# -# Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text -# to repl.rb and save to see Hello World printed to the console. - -repl do - puts '* RUBY PRIMER: Printing to the console using the ~puts~ function.' - puts '====' - puts '======' - puts '================================' - puts 'Hello World' - puts '================================' - puts '======' - puts '====' -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt new file mode 100644 index 0000000..34ea252 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/02_strings.txt @@ -0,0 +1,15 @@ +# ==================================================================================== +# Strings +# ==================================================================================== +# +# Here is how you work with strings in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: strings' + message = "Hello World" + puts "The value of message is: " + message + puts "Any value can be interpolated within a string using \#{}." + puts "Interpolated message: #{message}." + puts 'This #{message} is not interpolated because the string uses single quotes.' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt new file mode 100644 index 0000000..dfdf04d --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_numbers.txt @@ -0,0 +1,21 @@ +# ==================================================================================== +# Numerics +# ==================================================================================== +# +# Here is how you work with numbers in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: Fixnum and Floats' + a = 10 + puts "The value of a is: #{a}" + puts "a + 1 is: #{a + 1}" + puts "a / 3 is: #{a / 3}" + puts '' + + b = 10.12 + puts "The value of b is: #{b}" + puts "b + 1 is: #{b + 1}" + puts "b as an integer is: #{b.to_i}" + puts '' +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt deleted file mode 100644 index 34ea252..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/03_strings.txt +++ /dev/null @@ -1,15 +0,0 @@ -# ==================================================================================== -# Strings -# ==================================================================================== -# -# Here is how you work with strings in Ruby. Take the text -# in this file and paste it into repl.rb and save: - -repl do - puts '* RUBY PRIMER: strings' - message = "Hello World" - puts "The value of message is: " + message - puts "Any value can be interpolated within a string using \#{}." - puts "Interpolated message: #{message}." - puts 'This #{message} is not interpolated because the string uses single quotes.' -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt new file mode 100644 index 0000000..2a9060f --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_booleans.txt @@ -0,0 +1,32 @@ +# ==================================================================================== +# Booleans +# ==================================================================================== +# +# Here is how you work with numbers in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)' + puts "Anything that *isn't* false or nil is true." + + c = 30 + puts "The value of c is #{c}." + + if c + puts "This if statement ran because c is truthy." + end + + d = false + puts "The value if d is #{d}. The type for d is #{d.class}." + + if !d + puts "This if statement ran because d is falsey, using the not operator (!)." + end + + e = nil + puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}." + + if !e + puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}." + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt deleted file mode 100644 index dfdf04d..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/04_numbers.txt +++ /dev/null @@ -1,21 +0,0 @@ -# ==================================================================================== -# Numerics -# ==================================================================================== -# -# Here is how you work with numbers in Ruby. Take the text -# in this file and paste it into repl.rb and save: - -repl do - puts '* RUBY PRIMER: Fixnum and Floats' - a = 10 - puts "The value of a is: #{a}" - puts "a + 1 is: #{a + 1}" - puts "a / 3 is: #{a / 3}" - puts '' - - b = 10.12 - puts "The value of b is: #{b}" - puts "b + 1 is: #{b + 1}" - puts "b as an integer is: #{b.to_i}" - puts '' -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt deleted file mode 100644 index 2a9060f..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_booleans.txt +++ /dev/null @@ -1,32 +0,0 @@ -# ==================================================================================== -# Booleans -# ==================================================================================== -# -# Here is how you work with numbers in Ruby. Take the text -# in this file and paste it into repl.rb and save: - -repl do - puts '* RUBY PRIMER: TrueClass, FalseClass, NilClass (truthy / falsey values)' - puts "Anything that *isn't* false or nil is true." - - c = 30 - puts "The value of c is #{c}." - - if c - puts "This if statement ran because c is truthy." - end - - d = false - puts "The value if d is #{d}. The type for d is #{d.class}." - - if !d - puts "This if statement ran because d is falsey, using the not operator (!)." - end - - e = nil - puts "Nil is also considered falsey. The value of e is: #{e} (a blank string when printed). Which is of type #{e.class}." - - if !e - puts "This if statement ran because e is nil and the if statement applied the NOT operator. !e yields a type of #{(!e).class}." - end -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt new file mode 100644 index 0000000..8a0c172 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/05_conditionals.txt @@ -0,0 +1,114 @@ +# ==================================================================================== +# Conditionals +# ==================================================================================== +# +# Here is how you create conditionals in Ruby. Take the text +# in this file and paste it into repl.rb and save: + +repl do + puts "* RUBY PRIMER: Conditionals" +end + +# ==================================================================================== +# if +# ==================================================================================== + +repl do + puts "** INFO: if statement" + i_am_one = 1 + if i_am_one + puts "This was printed because i_am_one is truthy." + end +end + +# ==================================================================================== +# if/else +# ==================================================================================== + +repl do + puts "** INFO: if/else statement" + i_am_false = false + if i_am_false + puts "This will NOT get printed because i_am_false is false." + else + puts "This was printed because i_am_false is false." + end +end + + +# ==================================================================================== +# if/elsif/else +# ==================================================================================== + +repl do + puts "** INFO: if/elsif/else statement" + i_am_false = false + i_am_true = true + if i_am_false + puts "This will NOT get printed because i_am_false is false." + elsif i_am_true + puts "This was printed because i_am_true is true." + else + puts "This will NOT get printed i_am_true was true." + end +end + +# ==================================================================================== +# case +# ==================================================================================== + +repl do + puts "** INFO case statement" + i_am_one = 1 # change this value to see different results + + case i_am_one + when 10 + puts "the value of i_am_one is 10" + when 9 + puts "the value of i_am_one is 9" + when 5 + puts "the value of i_am_one is 5" + when 1 + puts "the value of i_am_one is 1" + else + puts "Value wasn't cased." + end +end + +# ==================================================================================== +# comparison operators +# ==================================================================================== + +repl do + puts "** INFO: Different types of comparisons" + if 4 == 4 + puts "4 equals 4 (==)" + end + + if 4 != 3 + puts "4 does not equal 3 (!=)" + end + + if 3 < 4 + puts "3 is less than 4 (<)" + end + + if 4 > 3 + puts "4 is greater than 3 (>)" + end +end + +# ==================================================================================== +# and/or conditionals +# ==================================================================================== + +repl do + puts "** INFO: AND, OR operator (&&, ||)" + if (4 > 3) || (3 < 4) || false + puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)" + end + + if (4 > 3) && (3 < 4) + puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)" + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt deleted file mode 100644 index 8a0c172..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_conditionals.txt +++ /dev/null @@ -1,114 +0,0 @@ -# ==================================================================================== -# Conditionals -# ==================================================================================== -# -# Here is how you create conditionals in Ruby. Take the text -# in this file and paste it into repl.rb and save: - -repl do - puts "* RUBY PRIMER: Conditionals" -end - -# ==================================================================================== -# if -# ==================================================================================== - -repl do - puts "** INFO: if statement" - i_am_one = 1 - if i_am_one - puts "This was printed because i_am_one is truthy." - end -end - -# ==================================================================================== -# if/else -# ==================================================================================== - -repl do - puts "** INFO: if/else statement" - i_am_false = false - if i_am_false - puts "This will NOT get printed because i_am_false is false." - else - puts "This was printed because i_am_false is false." - end -end - - -# ==================================================================================== -# if/elsif/else -# ==================================================================================== - -repl do - puts "** INFO: if/elsif/else statement" - i_am_false = false - i_am_true = true - if i_am_false - puts "This will NOT get printed because i_am_false is false." - elsif i_am_true - puts "This was printed because i_am_true is true." - else - puts "This will NOT get printed i_am_true was true." - end -end - -# ==================================================================================== -# case -# ==================================================================================== - -repl do - puts "** INFO case statement" - i_am_one = 1 # change this value to see different results - - case i_am_one - when 10 - puts "the value of i_am_one is 10" - when 9 - puts "the value of i_am_one is 9" - when 5 - puts "the value of i_am_one is 5" - when 1 - puts "the value of i_am_one is 1" - else - puts "Value wasn't cased." - end -end - -# ==================================================================================== -# comparison operators -# ==================================================================================== - -repl do - puts "** INFO: Different types of comparisons" - if 4 == 4 - puts "4 equals 4 (==)" - end - - if 4 != 3 - puts "4 does not equal 3 (!=)" - end - - if 3 < 4 - puts "3 is less than 4 (<)" - end - - if 4 > 3 - puts "4 is greater than 3 (>)" - end -end - -# ==================================================================================== -# and/or conditionals -# ==================================================================================== - -repl do - puts "** INFO: AND, OR operator (&&, ||)" - if (4 > 3) || (3 < 4) || false - puts "print this if 4 is greater than 3 OR 3 is less than 4 OR false is true (||)" - end - - if (4 > 3) && (3 < 4) - puts "print this if 4 is greater than 3 AND 3 is less than 4 (&&)" - end -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt new file mode 100644 index 0000000..03c3d28 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/06_looping.txt @@ -0,0 +1,55 @@ +# ==================================================================================== +# Looping +# ==================================================================================== +# +# Looping looks a whole lot different than other languages. +# But it's pretty awesome when you get used to it. + +repl do + puts "* RUBY PRIMER: Loops" +end + +# ==================================================================================== +# times +# ==================================================================================== + +repl do + puts "** INFO: ~Numeric#times~ (for loop)" + 3.times do |i| + puts i + end +end + +# ==================================================================================== +# foreach +# ==================================================================================== + +repl do + puts "** INFO: ~Array#each~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char| + puts char + end + + puts "** INFO: ~Array#each_with_index~ (for each loop)" + array = ["a", "b", "c", "d"] + array.each do |char, i| + puts "index #{i}: #{char}" + end +end + +# ==================================================================================== +# ranges +# ==================================================================================== + +repl do + puts "** INFO: range block exclusive (three dots)" + (0...3).each do |i| + puts i + end + + puts "** INFO: range block inclusive (two dots)" + (0..3).each do |i| + puts i + end +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt new file mode 100644 index 0000000..9ad38de --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_functions.txt @@ -0,0 +1,69 @@ +# ==================================================================================== +# Functions +# ==================================================================================== + +# The last statement of a function is implictly returned. Parenthesis for functions +# are optional as long as the statement can be envaluated disambiguously. + +repl do + puts "* RUBY PRIMER: Functions" +end + +# ==================================================================================== +# Functions single parameter +# ==================================================================================== + +repl do + puts "* INFO: Function with one parameter" + + # function definition + def add_one_to n + n + 1 + end + + # Parenthesis are optional in Ruby as long as the + # parsing is disambiguous. Here are a couple of variations. + # Generally speaking, don't put parenthesis is you don't have to. + + # Conventional Usage of Parenthesis. + puts add_one_to(3) + + # DragonRuby's recommended use of parenthesis (inner function has parenthesis). + puts (add_one_to 3) + + # Full parens. + puts(add_one_to(3)) + + # Outer function has parenthesis + puts(add_one_to 3) +end + +# ==================================================================================== +# Functions with default parameter values +# ==================================================================================== + +repl do + puts "* INFO: Function with default value" + def function_with_default_value v = 10 + v * 10 + end + + puts "Passing the argument three yields: #{function_with_default_value 3}" + puts "Passing no argument yields: #{function_with_default_value}" +end + +# ==================================================================================== +# Nil default parameter value and ||= operator. +# ==================================================================================== + +repl do + puts "* INFO: Using the OR EQUAL operator (||=)" + def function_with_nil_default_with_local a = nil + result = a + result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE" + "value is #{result}." + end + + puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}" + puts "Passing nil: #{function_with_nil_default_with_local}" +end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt deleted file mode 100644 index 03c3d28..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/07_looping.txt +++ /dev/null @@ -1,55 +0,0 @@ -# ==================================================================================== -# Looping -# ==================================================================================== -# -# Looping looks a whole lot different than other languages. -# But it's pretty awesome when you get used to it. - -repl do - puts "* RUBY PRIMER: Loops" -end - -# ==================================================================================== -# times -# ==================================================================================== - -repl do - puts "** INFO: ~Numeric#times~ (for loop)" - 3.times do |i| - puts i - end -end - -# ==================================================================================== -# foreach -# ==================================================================================== - -repl do - puts "** INFO: ~Array#each~ (for each loop)" - array = ["a", "b", "c", "d"] - array.each do |char| - puts char - end - - puts "** INFO: ~Array#each_with_index~ (for each loop)" - array = ["a", "b", "c", "d"] - array.each do |char, i| - puts "index #{i}: #{char}" - end -end - -# ==================================================================================== -# ranges -# ==================================================================================== - -repl do - puts "** INFO: range block exclusive (three dots)" - (0...3).each do |i| - puts i - end - - puts "** INFO: range block inclusive (two dots)" - (0..3).each do |i| - puts i - end -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt new file mode 100644 index 0000000..9904686 --- /dev/null +++ b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_arrays.txt @@ -0,0 +1,210 @@ +# ==================================================================================== +# Arrays +# ==================================================================================== + +# Arrays are incredibly powerful in Ruby. Learn to use them well. + +repl do + puts "* RUBY PRIMER: ARRAYS" +end + +# ==================================================================================== +# Enumerable ranges and .to_a +# ==================================================================================== + +repl do + puts "** INFO: Create an array with the numbers 1 to 10." + one_to_ten = (1..10).to_a + puts one_to_ten +end + +# ==================================================================================== +# Finding elements +# ==================================================================================== + +repl do + puts "** INFO: Finding elements in an array using ~Array#find_all~." + puts "Create a new array that only contains even numbers from the previous array." + + one_to_ten = (1..10).to_a + evens = one_to_ten.find_all do |number| + number % 2 == 0 + end + + puts evens +end + +# ==================================================================================== +# Rejecting elements +# ==================================================================================== + +repl do + puts "** INFO: Removing elements in an array using ~Array#reject~." + puts "Create a new array that rejects odd numbers." + + one_to_ten = (1..10).to_a + also_even = one_to_ten.reject do |number| + number % 2 != 0 + end + + puts also_even +end + +# ==================================================================================== +# Array transform using the map function. +# ==================================================================================== + +repl do + puts "** INFO: Creating new derived values from an array using ~Array#map~." + puts "Create an array that doubles every number." + + one_to_ten = (1..10).to_a + doubled = one_to_ten.map do |number| + number * 2 + end + + puts doubled +end + +# ==================================================================================== +# Combining array functions. +# ==================================================================================== + +repl do + puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~." + puts "Create an array that selects only odd numbers and then multiply those by 10." + + one_to_ten = (1..10).to_a + odd_doubled = one_to_ten.find_all do |number| + number % 2 != 0 + end.map do |odd_number| + odd_number * 10 + end + + puts odd_doubled +end + +# ==================================================================================== +# Product function. +# ==================================================================================== + +repl do + puts "** INFO: Create all combinations of array values using ~Array#product~." + puts "All two-item pairs of numbers 1 to 10." + one_to_ten = (1..10).to_a + all_combinations = one_to_ten.product(one_to_ten) + puts all_combinations +end + +# ==================================================================================== +# Uniq and sort function. +# ==================================================================================== + +repl do + puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~." + puts "All uniq combinations of numbers regardless of order." + puts "For example: [1, 2] is the same as [2, 1]." + one_to_ten = (1..10).to_a + uniq_combinations = + one_to_ten.product(one_to_ten) + .map do |unsorted_number| + unsorted_number.sort + end.uniq + puts uniq_combinations +end + +# ==================================================================================== +# Example of an advanced array transform. +# ==================================================================================== + +repl do + puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~." + puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." + + one_to_hundred = (1..100).to_a + + triples = + one_to_hundred.product(one_to_hundred).map do |width, height| + [width, height, Math.sqrt(width ** 2 + height ** 2)] + end.find_all do |_, _, hypotenuse| + hypotenuse.to_i == hypotenuse + end.map do |triangle| + triangle.map(&:to_i) + end.uniq do |triangle| + triangle.sort + end.map do |width, height, hypotenuse| + [width, height, hypotenuse, (width * height) / 2] + end.sort_by do |_, _, _, area| + area + end + + triples.each do |width, height, hypotenuse, _| + puts "(#{width}, #{height}, #{hypotenuse})" + end +end + +# ==================================================================================== +# Example of an sorting. +# ==================================================================================== + +repl do + puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype." + + things_to_sort = [ + { type: :background, order: 1 }, + { type: :foreground, order: 1 }, + { type: :foreground, order: 2 } + ] + puts "*** Original array." + puts things_to_sort + + puts "*** Simple sort using key." + # For a simple sort, you can use sort_by + results = things_to_sort.sort_by do |hash| + hash[:order] + end + + puts results + + puts "*** Custom sort." + puts "**** Sorting process." + # for a more complicated sort, you can provide a block that returns + # -1, 0, 1 for a left and right operand + results = things_to_sort.sort do |l, r| + sort_result = 0 + puts "here is l: #{l}" + puts "here is r: #{r || "nil"}" + # if either value is nil/false return 0 + if !l || !r + sort_result = 0 + # if the type of "left" is background and the + # type of "right" is foreground, then return + # -1 (which means "left" is less than "right" + elsif l[:type] == :background && r[:type] == :foreground + sort_result = -1 + # if the type of "left" is foreground and the + # type of "right" is background, then return + # 1 (which means "left" is greater than "right" + elsif l[:type] == :foreground && r[:type] == :background + sort_result = 1 + # if "left" and "right"'s type are the same, then + # use the order as the tie breaker + elsif l[:order] < r[:order] + sort_result = -1 + elsif l[:order] > r[:order] + sort_result = 1 + # returning 0 means both values are equal + else + sort_result = 0 + end + sort_result + end.to_a + + puts "**** Sort result." + puts results +end + +# ==================================================================================== +# Api documention for Array that is worth commiting to memory because arrays are so +# awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html +# ==================================================================================== diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt deleted file mode 100644 index 9ad38de..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/08_functions.txt +++ /dev/null @@ -1,69 +0,0 @@ -# ==================================================================================== -# Functions -# ==================================================================================== - -# The last statement of a function is implictly returned. Parenthesis for functions -# are optional as long as the statement can be envaluated disambiguously. - -repl do - puts "* RUBY PRIMER: Functions" -end - -# ==================================================================================== -# Functions single parameter -# ==================================================================================== - -repl do - puts "* INFO: Function with one parameter" - - # function definition - def add_one_to n - n + 1 - end - - # Parenthesis are optional in Ruby as long as the - # parsing is disambiguous. Here are a couple of variations. - # Generally speaking, don't put parenthesis is you don't have to. - - # Conventional Usage of Parenthesis. - puts add_one_to(3) - - # DragonRuby's recommended use of parenthesis (inner function has parenthesis). - puts (add_one_to 3) - - # Full parens. - puts(add_one_to(3)) - - # Outer function has parenthesis - puts(add_one_to 3) -end - -# ==================================================================================== -# Functions with default parameter values -# ==================================================================================== - -repl do - puts "* INFO: Function with default value" - def function_with_default_value v = 10 - v * 10 - end - - puts "Passing the argument three yields: #{function_with_default_value 3}" - puts "Passing no argument yields: #{function_with_default_value}" -end - -# ==================================================================================== -# Nil default parameter value and ||= operator. -# ==================================================================================== - -repl do - puts "* INFO: Using the OR EQUAL operator (||=)" - def function_with_nil_default_with_local a = nil - result = a - result ||= "DEFAULT_VALUE_OF_A_IS_NIL_OR_FALSE" - "value is #{result}." - end - - puts "Passing 'hi' as the argument yields: #{function_with_nil_default_with_local 'hi'}" - puts "Passing nil: #{function_with_nil_default_with_local}" -end diff --git a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt b/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt deleted file mode 100644 index 9904686..0000000 --- a/samples/00_learn_ruby_optional/00_intermediate_ruby_primer/app/09_powerful_arrays.txt +++ /dev/null @@ -1,210 +0,0 @@ -# ==================================================================================== -# Arrays -# ==================================================================================== - -# Arrays are incredibly powerful in Ruby. Learn to use them well. - -repl do - puts "* RUBY PRIMER: ARRAYS" -end - -# ==================================================================================== -# Enumerable ranges and .to_a -# ==================================================================================== - -repl do - puts "** INFO: Create an array with the numbers 1 to 10." - one_to_ten = (1..10).to_a - puts one_to_ten -end - -# ==================================================================================== -# Finding elements -# ==================================================================================== - -repl do - puts "** INFO: Finding elements in an array using ~Array#find_all~." - puts "Create a new array that only contains even numbers from the previous array." - - one_to_ten = (1..10).to_a - evens = one_to_ten.find_all do |number| - number % 2 == 0 - end - - puts evens -end - -# ==================================================================================== -# Rejecting elements -# ==================================================================================== - -repl do - puts "** INFO: Removing elements in an array using ~Array#reject~." - puts "Create a new array that rejects odd numbers." - - one_to_ten = (1..10).to_a - also_even = one_to_ten.reject do |number| - number % 2 != 0 - end - - puts also_even -end - -# ==================================================================================== -# Array transform using the map function. -# ==================================================================================== - -repl do - puts "** INFO: Creating new derived values from an array using ~Array#map~." - puts "Create an array that doubles every number." - - one_to_ten = (1..10).to_a - doubled = one_to_ten.map do |number| - number * 2 - end - - puts doubled -end - -# ==================================================================================== -# Combining array functions. -# ==================================================================================== - -repl do - puts "** INFO: Combining ~Array#find_all~ along with ~Array#map~." - puts "Create an array that selects only odd numbers and then multiply those by 10." - - one_to_ten = (1..10).to_a - odd_doubled = one_to_ten.find_all do |number| - number % 2 != 0 - end.map do |odd_number| - odd_number * 10 - end - - puts odd_doubled -end - -# ==================================================================================== -# Product function. -# ==================================================================================== - -repl do - puts "** INFO: Create all combinations of array values using ~Array#product~." - puts "All two-item pairs of numbers 1 to 10." - one_to_ten = (1..10).to_a - all_combinations = one_to_ten.product(one_to_ten) - puts all_combinations -end - -# ==================================================================================== -# Uniq and sort function. -# ==================================================================================== - -repl do - puts "** INFO: Providing uniq values using ~Array#uniq~ and ~Array#sort~." - puts "All uniq combinations of numbers regardless of order." - puts "For example: [1, 2] is the same as [2, 1]." - one_to_ten = (1..10).to_a - uniq_combinations = - one_to_ten.product(one_to_ten) - .map do |unsorted_number| - unsorted_number.sort - end.uniq - puts uniq_combinations -end - -# ==================================================================================== -# Example of an advanced array transform. -# ==================================================================================== - -repl do - puts "** INFO: Advanced chaining. Combining ~Array's ~map~, ~find_all~, ~sort~, and ~sort_by~." - puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." - - one_to_hundred = (1..100).to_a - - triples = - one_to_hundred.product(one_to_hundred).map do |width, height| - [width, height, Math.sqrt(width ** 2 + height ** 2)] - end.find_all do |_, _, hypotenuse| - hypotenuse.to_i == hypotenuse - end.map do |triangle| - triangle.map(&:to_i) - end.uniq do |triangle| - triangle.sort - end.map do |width, height, hypotenuse| - [width, height, hypotenuse, (width * height) / 2] - end.sort_by do |_, _, _, area| - area - end - - triples.each do |width, height, hypotenuse, _| - puts "(#{width}, #{height}, #{hypotenuse})" - end -end - -# ==================================================================================== -# Example of an sorting. -# ==================================================================================== - -repl do - puts "** INFO: Implementing a custom sort function that operates on the ~Hash~ datatype." - - things_to_sort = [ - { type: :background, order: 1 }, - { type: :foreground, order: 1 }, - { type: :foreground, order: 2 } - ] - puts "*** Original array." - puts things_to_sort - - puts "*** Simple sort using key." - # For a simple sort, you can use sort_by - results = things_to_sort.sort_by do |hash| - hash[:order] - end - - puts results - - puts "*** Custom sort." - puts "**** Sorting process." - # for a more complicated sort, you can provide a block that returns - # -1, 0, 1 for a left and right operand - results = things_to_sort.sort do |l, r| - sort_result = 0 - puts "here is l: #{l}" - puts "here is r: #{r || "nil"}" - # if either value is nil/false return 0 - if !l || !r - sort_result = 0 - # if the type of "left" is background and the - # type of "right" is foreground, then return - # -1 (which means "left" is less than "right" - elsif l[:type] == :background && r[:type] == :foreground - sort_result = -1 - # if the type of "left" is foreground and the - # type of "right" is background, then return - # 1 (which means "left" is greater than "right" - elsif l[:type] == :foreground && r[:type] == :background - sort_result = 1 - # if "left" and "right"'s type are the same, then - # use the order as the tie breaker - elsif l[:order] < r[:order] - sort_result = -1 - elsif l[:order] > r[:order] - sort_result = 1 - # returning 0 means both values are equal - else - sort_result = 0 - end - sort_result - end.to_a - - puts "**** Sort result." - puts results -end - -# ==================================================================================== -# Api documention for Array that is worth commiting to memory because arrays are so -# awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html -# ==================================================================================== diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb b/samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb new file mode 100644 index 0000000..80c40f2 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_separate_pngs/app/main.rb @@ -0,0 +1,131 @@ +=begin + + Reminders: + + - 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. + + In this sample app, we're using string interpolation to iterate through images in the + sprites folder using their image path names. + + - args.outputs.sprites: An array. Values in this array generate sprites on the screen. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. Values in the array generate labels on the screen. + 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.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. + Stores the frame that key was pressed on. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + +=end + +# This sample app demonstrates how sprite animations work. +# There are two sprites that animate forever and one sprite +# that *only* animates when you press the "f" key on the keyboard. + +# This is the entry point to your game. The `tick` method +# executes at 60 frames per second. There are two methods +# in this tick "entry point": `looping_animation`, and the +# second method is `one_time_animation`. +def tick args + looping_animation args + one_time_animation args +end + +# This function shows how to animate a sprite that loops forever. +def looping_animation args + # Here we define a few local variables that will be sent + # into the magic function that gives us the correct sprite image + # over time. There are four things we need in order to figure + # out which sprite to show. + + # 1. When to start the animation. + start_looping_at = 0 + + # 2. The number of pngs that represent the full animation. + number_of_sprites = 6 + + # 3. How long to show each png. + number_of_frames_to_show_each_sprite = 4 + + # 4. Whether the animation should loop once, or forever. + does_sprite_loop = true + + # With the variables defined above, we can get a number + # which represents the sprite to show by calling the `frame_index` function. + # In this case the number will be between 0, and 5 (you can see the sprites + # in the ./sprites directory). + sprite_index = start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # Now that we have `sprite_index, we can present the correct file. + args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + # Try changing the numbers below to see how the animation changes: + args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] +end + +# This function shows how to animate a sprite that executes +# only once when the "f" key is pressed. +def one_time_animation args + # This is just a label the shows instructions within the game. + args.outputs.labels << [220, 350, "(press f to animate)"] + + # If "f" is pressed on the keyboard... + if args.inputs.keyboard.key_down.f + # Print the frame that "f" was pressed on. + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + + # And MOST IMPORTANTLY set the point it time to start the animation, + # equal to "now" which is represented as args.state.tick_count. + + # Also IMPORTANT, you'll notice that the value of when to start looping + # is stored in `args.state`. This construct's values are retained across + # executions of the `tick` method. + args.state.start_looping_at = args.state.tick_count + end + + # These are the same local variables that were defined + # for the `looping_animation` function. + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + + # Except this sprite does not loop again. If the animation time has passed, + # then the frame_index function returns nil. + does_sprite_loop = false + + sprite_index = args.state + .start_looping_at + .frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # This line sets the frame index to zero, if + # the animation duration has passed (frame_index returned nil). + + # Remeber: we are not looping forever here. + sprite_index ||= 0 + + # Present the sprite. + args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/license-for-sample.txt b/samples/03_rendering_sprites/01_animation_using_separate_pngs/license-for-sample.txt new file mode 100644 index 0000000..8fa4d42 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_separate_pngs/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art) + +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/03_rendering_sprites/01_animation_using_separate_pngs/replay.txt b/samples/03_rendering_sprites/01_animation_using_separate_pngs/replay.txt new file mode 100644 index 0000000..33c47c3 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_separate_pngs/replay.txt @@ -0,0 +1,162 @@ +replay_version 2.0 +stopped_at 780 +seed 100 +recorded_at Sun Sep 29 21:41:16 2019 +[:mouse_move, 1081, 144, 2, 1, 54] +[:mouse_move, 1076, 144, 2, 2, 55] +[:mouse_move, 1061, 145, 2, 3, 56] +[:mouse_move, 1049, 146, 2, 4, 57] +[:mouse_move, 964, 148, 2, 5, 58] +[:mouse_move, 899, 148, 2, 6, 59] +[:mouse_move, 795, 153, 2, 7, 60] +[:mouse_move, 728, 160, 2, 8, 61] +[:mouse_move, 644, 175, 2, 9, 62] +[:mouse_move, 597, 185, 2, 10, 63] +[:mouse_move, 519, 206, 2, 11, 64] +[:mouse_move, 488, 217, 2, 12, 65] +[:mouse_move, 451, 229, 2, 13, 66] +[:mouse_move, 443, 231, 2, 14, 67] +[:mouse_move, 438, 233, 2, 15, 68] +[:mouse_move, 423, 238, 2, 16, 69] +[:mouse_move, 420, 239, 2, 17, 70] +[:mouse_move, 416, 240, 2, 18, 71] +[:mouse_move, 415, 240, 2, 19, 84] +[:mouse_move, 394, 253, 2, 20, 85] +[:mouse_move, 376, 264, 2, 21, 86] +[:mouse_move, 329, 296, 2, 22, 87] +[:mouse_move, 303, 315, 2, 23, 88] +[:mouse_move, 268, 342, 2, 24, 89] +[:mouse_move, 249, 356, 2, 25, 90] +[:mouse_move, 234, 372, 2, 26, 91] +[:mouse_move, 228, 380, 2, 27, 92] +[:mouse_move, 223, 388, 2, 28, 93] +[:mouse_move, 222, 391, 2, 29, 94] +[:mouse_move, 221, 394, 2, 30, 95] +[:mouse_move, 221, 396, 2, 31, 96] +[:mouse_move, 223, 397, 2, 32, 97] +[:mouse_move, 229, 397, 2, 33, 98] +[:mouse_move, 231, 397, 2, 34, 99] +[:mouse_move, 235, 397, 2, 35, 100] +[:mouse_move, 237, 397, 2, 36, 101] +[:mouse_move, 238, 397, 2, 37, 102] +[:mouse_move, 238, 398, 2, 38, 105] +[:mouse_move, 237, 398, 2, 39, 108] +[:mouse_move, 236, 397, 2, 40, 110] +[:mouse_move, 235, 397, 2, 41, 111] +[:mouse_move, 237, 397, 2, 42, 139] +[:mouse_move, 240, 397, 2, 43, 140] +[:mouse_move, 245, 398, 2, 44, 141] +[:mouse_move, 248, 398, 2, 45, 142] +[:mouse_move, 255, 399, 2, 46, 143] +[:mouse_move, 258, 399, 2, 47, 144] +[:mouse_move, 266, 400, 2, 48, 145] +[:mouse_move, 268, 400, 2, 49, 146] +[:mouse_move, 273, 400, 2, 50, 147] +[:mouse_move, 275, 400, 2, 51, 148] +[:mouse_move, 277, 400, 2, 52, 149] +[:mouse_move, 280, 400, 2, 53, 150] +[:mouse_move, 282, 400, 2, 54, 151] +[:mouse_move, 285, 400, 2, 55, 152] +[:mouse_move, 286, 399, 2, 56, 153] +[:mouse_move, 288, 399, 2, 57, 154] +[:mouse_move, 289, 399, 2, 58, 155] +[:mouse_move, 290, 399, 2, 59, 156] +[:mouse_move, 291, 399, 2, 60, 157] +[:mouse_move, 294, 399, 2, 61, 158] +[:mouse_move, 295, 399, 2, 62, 159] +[:mouse_move, 297, 399, 2, 63, 160] +[:mouse_move, 298, 399, 2, 64, 161] +[:mouse_move, 300, 398, 2, 65, 162] +[:mouse_move, 302, 398, 2, 66, 163] +[:mouse_move, 305, 398, 2, 67, 164] +[:mouse_move, 307, 398, 2, 68, 165] +[:mouse_move, 310, 398, 2, 69, 166] +[:mouse_move, 312, 398, 2, 70, 167] +[:mouse_move, 315, 397, 2, 71, 168] +[:mouse_move, 317, 397, 2, 72, 169] +[:mouse_move, 320, 397, 2, 73, 170] +[:mouse_move, 321, 397, 2, 74, 171] +[:mouse_move, 323, 397, 2, 75, 172] +[:mouse_move, 325, 397, 2, 76, 173] +[:mouse_move, 327, 397, 2, 77, 174] +[:mouse_move, 328, 397, 2, 78, 175] +[:mouse_move, 329, 397, 2, 79, 176] +[:mouse_move, 332, 397, 2, 80, 177] +[:mouse_move, 333, 397, 2, 81, 178] +[:mouse_move, 336, 397, 2, 82, 179] +[:mouse_move, 338, 397, 2, 83, 180] +[:mouse_move, 341, 397, 2, 84, 181] +[:mouse_move, 342, 397, 2, 85, 182] +[:mouse_move, 345, 397, 2, 86, 183] +[:mouse_move, 346, 397, 2, 87, 184] +[:mouse_move, 350, 397, 2, 88, 185] +[:mouse_move, 352, 397, 2, 89, 186] +[:mouse_move, 355, 397, 2, 90, 187] +[:mouse_move, 356, 397, 2, 91, 188] +[:mouse_move, 359, 397, 2, 92, 189] +[:mouse_move, 360, 397, 2, 93, 190] +[:mouse_move, 363, 397, 2, 94, 191] +[:mouse_move, 365, 397, 2, 95, 192] +[:mouse_move, 367, 397, 2, 96, 193] +[:mouse_move, 369, 397, 2, 97, 194] +[:mouse_move, 372, 397, 2, 98, 195] +[:mouse_move, 373, 397, 2, 99, 196] +[:mouse_move, 376, 397, 2, 100, 197] +[:mouse_move, 377, 397, 2, 101, 198] +[:mouse_move, 379, 397, 2, 102, 199] +[:mouse_move, 381, 397, 2, 103, 200] +[:mouse_move, 383, 397, 2, 104, 201] +[:mouse_move, 385, 397, 2, 105, 202] +[:mouse_move, 386, 397, 2, 106, 203] +[:mouse_move, 389, 397, 2, 107, 204] +[:mouse_move, 391, 397, 2, 108, 205] +[:mouse_move, 397, 397, 2, 109, 206] +[:mouse_move, 398, 397, 2, 110, 207] +[:mouse_move, 403, 397, 2, 111, 208] +[:mouse_move, 405, 397, 2, 112, 209] +[:mouse_move, 407, 397, 2, 113, 210] +[:mouse_move, 409, 397, 2, 114, 211] +[:mouse_move, 410, 397, 2, 115, 212] +[:mouse_move, 411, 397, 2, 116, 218] +[:mouse_move, 411, 395, 2, 117, 328] +[:mouse_move, 411, 393, 2, 118, 329] +[:mouse_move, 412, 387, 2, 119, 330] +[:mouse_move, 413, 382, 2, 120, 331] +[:mouse_move, 415, 371, 2, 121, 332] +[:mouse_move, 416, 364, 2, 122, 333] +[:mouse_move, 417, 349, 2, 123, 334] +[:mouse_move, 418, 343, 2, 124, 335] +[:mouse_move, 419, 335, 2, 125, 336] +[:mouse_move, 419, 332, 2, 126, 337] +[:mouse_move, 420, 328, 2, 127, 338] +[:mouse_move, 420, 327, 2, 128, 339] +[:mouse_move, 420, 329, 2, 129, 345] +[:mouse_move, 421, 331, 2, 130, 346] +[:mouse_move, 421, 332, 2, 131, 347] +[:mouse_move, 421, 333, 2, 132, 348] +[:mouse_move, 422, 334, 2, 133, 349] +[:key_down_raw, 102, 0, 2, 134, 411] +[:key_up_raw, 102, 0, 2, 135, 417] +[:key_down_raw, 102, 0, 2, 136, 470] +[:key_up_raw, 102, 0, 2, 137, 476] +[:key_down_raw, 102, 0, 2, 138, 526] +[:key_up_raw, 102, 0, 2, 139, 531] +[:key_down_raw, 102, 0, 2, 140, 537] +[:key_up_raw, 102, 0, 2, 141, 541] +[:key_down_raw, 102, 0, 2, 142, 546] +[:key_up_raw, 102, 0, 2, 143, 550] +[:key_down_raw, 102, 0, 2, 144, 555] +[:key_up_raw, 102, 0, 2, 145, 558] +[:key_down_raw, 102, 0, 2, 146, 563] +[:key_up_raw, 102, 0, 2, 147, 567] +[:key_down_raw, 102, 0, 2, 148, 572] +[:key_up_raw, 102, 0, 2, 149, 575] +[:key_down_raw, 102, 0, 2, 150, 579] +[:key_up_raw, 102, 0, 2, 151, 582] +[:key_down_raw, 102, 0, 2, 152, 632] +[:key_up_raw, 102, 0, 2, 153, 657] +[:key_down_raw, 102, 0, 2, 154, 687] +[:key_up_raw, 102, 0, 2, 155, 692] +[:key_down_raw, 1073742051, 1024, 2, 156, 779] +[:key_down_raw, 113, 1024, 2, 157, 779] +[:key_up_raw, 113, 1024, 2, 158, 779] diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_0.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_0.png new file mode 100644 index 0000000..fb179af Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_0.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_1.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_1.png new file mode 100644 index 0000000..8cfe531 Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_1.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_2.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_2.png new file mode 100644 index 0000000..cb462e1 Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_2.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_3.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_3.png new file mode 100644 index 0000000..04c4977 Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_3.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_4.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_4.png new file mode 100644 index 0000000..b29fa3d Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_4.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_5.png b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_5.png new file mode 100644 index 0000000..99f4e74 Binary files /dev/null and b/samples/03_rendering_sprites/01_animation_using_separate_pngs/sprites/dragon_fly_5.png differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb deleted file mode 100644 index 80c40f2..0000000 --- a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb +++ /dev/null @@ -1,131 +0,0 @@ -=begin - - Reminders: - - - 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. - - In this sample app, we're using string interpolation to iterate through images in the - sprites folder using their image path names. - - - args.outputs.sprites: An array. Values in this array generate sprites on the screen. - The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] - For more information about sprites, go to mygame/documentation/05-sprites.md. - - - args.outputs.labels: An array. Values in the array generate labels on the screen. - 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.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. - Stores the frame that key was pressed on. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - -=end - -# This sample app demonstrates how sprite animations work. -# There are two sprites that animate forever and one sprite -# that *only* animates when you press the "f" key on the keyboard. - -# This is the entry point to your game. The `tick` method -# executes at 60 frames per second. There are two methods -# in this tick "entry point": `looping_animation`, and the -# second method is `one_time_animation`. -def tick args - looping_animation args - one_time_animation args -end - -# This function shows how to animate a sprite that loops forever. -def looping_animation args - # Here we define a few local variables that will be sent - # into the magic function that gives us the correct sprite image - # over time. There are four things we need in order to figure - # out which sprite to show. - - # 1. When to start the animation. - start_looping_at = 0 - - # 2. The number of pngs that represent the full animation. - number_of_sprites = 6 - - # 3. How long to show each png. - number_of_frames_to_show_each_sprite = 4 - - # 4. Whether the animation should loop once, or forever. - does_sprite_loop = true - - # With the variables defined above, we can get a number - # which represents the sprite to show by calling the `frame_index` function. - # In this case the number will be between 0, and 5 (you can see the sprites - # in the ./sprites directory). - sprite_index = start_looping_at.frame_index number_of_sprites, - number_of_frames_to_show_each_sprite, - does_sprite_loop - - # Now that we have `sprite_index, we can present the correct file. - args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] - - # Try changing the numbers below to see how the animation changes: - args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] -end - -# This function shows how to animate a sprite that executes -# only once when the "f" key is pressed. -def one_time_animation args - # This is just a label the shows instructions within the game. - args.outputs.labels << [220, 350, "(press f to animate)"] - - # If "f" is pressed on the keyboard... - if args.inputs.keyboard.key_down.f - # Print the frame that "f" was pressed on. - puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" - - # And MOST IMPORTANTLY set the point it time to start the animation, - # equal to "now" which is represented as args.state.tick_count. - - # Also IMPORTANT, you'll notice that the value of when to start looping - # is stored in `args.state`. This construct's values are retained across - # executions of the `tick` method. - args.state.start_looping_at = args.state.tick_count - end - - # These are the same local variables that were defined - # for the `looping_animation` function. - number_of_sprites = 6 - number_of_frames_to_show_each_sprite = 4 - - # Except this sprite does not loop again. If the animation time has passed, - # then the frame_index function returns nil. - does_sprite_loop = false - - sprite_index = args.state - .start_looping_at - .frame_index number_of_sprites, - number_of_frames_to_show_each_sprite, - does_sprite_loop - - # This line sets the frame index to zero, if - # the animation duration has passed (frame_index returned nil). - - # Remeber: we are not looping forever here. - sprite_index ||= 0 - - # Present the sprite. - args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] - - tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." -end - -def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -end diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt deleted file mode 100644 index 8fa4d42..0000000 --- a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt +++ /dev/null @@ -1,9 +0,0 @@ -Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art) - -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/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt deleted file mode 100644 index 33c47c3..0000000 --- a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt +++ /dev/null @@ -1,162 +0,0 @@ -replay_version 2.0 -stopped_at 780 -seed 100 -recorded_at Sun Sep 29 21:41:16 2019 -[:mouse_move, 1081, 144, 2, 1, 54] -[:mouse_move, 1076, 144, 2, 2, 55] -[:mouse_move, 1061, 145, 2, 3, 56] -[:mouse_move, 1049, 146, 2, 4, 57] -[:mouse_move, 964, 148, 2, 5, 58] -[:mouse_move, 899, 148, 2, 6, 59] -[:mouse_move, 795, 153, 2, 7, 60] -[:mouse_move, 728, 160, 2, 8, 61] -[:mouse_move, 644, 175, 2, 9, 62] -[:mouse_move, 597, 185, 2, 10, 63] -[:mouse_move, 519, 206, 2, 11, 64] -[:mouse_move, 488, 217, 2, 12, 65] -[:mouse_move, 451, 229, 2, 13, 66] -[:mouse_move, 443, 231, 2, 14, 67] -[:mouse_move, 438, 233, 2, 15, 68] -[:mouse_move, 423, 238, 2, 16, 69] -[:mouse_move, 420, 239, 2, 17, 70] -[:mouse_move, 416, 240, 2, 18, 71] -[:mouse_move, 415, 240, 2, 19, 84] -[:mouse_move, 394, 253, 2, 20, 85] -[:mouse_move, 376, 264, 2, 21, 86] -[:mouse_move, 329, 296, 2, 22, 87] -[:mouse_move, 303, 315, 2, 23, 88] -[:mouse_move, 268, 342, 2, 24, 89] -[:mouse_move, 249, 356, 2, 25, 90] -[:mouse_move, 234, 372, 2, 26, 91] -[:mouse_move, 228, 380, 2, 27, 92] -[:mouse_move, 223, 388, 2, 28, 93] -[:mouse_move, 222, 391, 2, 29, 94] -[:mouse_move, 221, 394, 2, 30, 95] -[:mouse_move, 221, 396, 2, 31, 96] -[:mouse_move, 223, 397, 2, 32, 97] -[:mouse_move, 229, 397, 2, 33, 98] -[:mouse_move, 231, 397, 2, 34, 99] -[:mouse_move, 235, 397, 2, 35, 100] -[:mouse_move, 237, 397, 2, 36, 101] -[:mouse_move, 238, 397, 2, 37, 102] -[:mouse_move, 238, 398, 2, 38, 105] -[:mouse_move, 237, 398, 2, 39, 108] -[:mouse_move, 236, 397, 2, 40, 110] -[:mouse_move, 235, 397, 2, 41, 111] -[:mouse_move, 237, 397, 2, 42, 139] -[:mouse_move, 240, 397, 2, 43, 140] -[:mouse_move, 245, 398, 2, 44, 141] -[:mouse_move, 248, 398, 2, 45, 142] -[:mouse_move, 255, 399, 2, 46, 143] -[:mouse_move, 258, 399, 2, 47, 144] -[:mouse_move, 266, 400, 2, 48, 145] -[:mouse_move, 268, 400, 2, 49, 146] -[:mouse_move, 273, 400, 2, 50, 147] -[:mouse_move, 275, 400, 2, 51, 148] -[:mouse_move, 277, 400, 2, 52, 149] -[:mouse_move, 280, 400, 2, 53, 150] -[:mouse_move, 282, 400, 2, 54, 151] -[:mouse_move, 285, 400, 2, 55, 152] -[:mouse_move, 286, 399, 2, 56, 153] -[:mouse_move, 288, 399, 2, 57, 154] -[:mouse_move, 289, 399, 2, 58, 155] -[:mouse_move, 290, 399, 2, 59, 156] -[:mouse_move, 291, 399, 2, 60, 157] -[:mouse_move, 294, 399, 2, 61, 158] -[:mouse_move, 295, 399, 2, 62, 159] -[:mouse_move, 297, 399, 2, 63, 160] -[:mouse_move, 298, 399, 2, 64, 161] -[:mouse_move, 300, 398, 2, 65, 162] -[:mouse_move, 302, 398, 2, 66, 163] -[:mouse_move, 305, 398, 2, 67, 164] -[:mouse_move, 307, 398, 2, 68, 165] -[:mouse_move, 310, 398, 2, 69, 166] -[:mouse_move, 312, 398, 2, 70, 167] -[:mouse_move, 315, 397, 2, 71, 168] -[:mouse_move, 317, 397, 2, 72, 169] -[:mouse_move, 320, 397, 2, 73, 170] -[:mouse_move, 321, 397, 2, 74, 171] -[:mouse_move, 323, 397, 2, 75, 172] -[:mouse_move, 325, 397, 2, 76, 173] -[:mouse_move, 327, 397, 2, 77, 174] -[:mouse_move, 328, 397, 2, 78, 175] -[:mouse_move, 329, 397, 2, 79, 176] -[:mouse_move, 332, 397, 2, 80, 177] -[:mouse_move, 333, 397, 2, 81, 178] -[:mouse_move, 336, 397, 2, 82, 179] -[:mouse_move, 338, 397, 2, 83, 180] -[:mouse_move, 341, 397, 2, 84, 181] -[:mouse_move, 342, 397, 2, 85, 182] -[:mouse_move, 345, 397, 2, 86, 183] -[:mouse_move, 346, 397, 2, 87, 184] -[:mouse_move, 350, 397, 2, 88, 185] -[:mouse_move, 352, 397, 2, 89, 186] -[:mouse_move, 355, 397, 2, 90, 187] -[:mouse_move, 356, 397, 2, 91, 188] -[:mouse_move, 359, 397, 2, 92, 189] -[:mouse_move, 360, 397, 2, 93, 190] -[:mouse_move, 363, 397, 2, 94, 191] -[:mouse_move, 365, 397, 2, 95, 192] -[:mouse_move, 367, 397, 2, 96, 193] -[:mouse_move, 369, 397, 2, 97, 194] -[:mouse_move, 372, 397, 2, 98, 195] -[:mouse_move, 373, 397, 2, 99, 196] -[:mouse_move, 376, 397, 2, 100, 197] -[:mouse_move, 377, 397, 2, 101, 198] -[:mouse_move, 379, 397, 2, 102, 199] -[:mouse_move, 381, 397, 2, 103, 200] -[:mouse_move, 383, 397, 2, 104, 201] -[:mouse_move, 385, 397, 2, 105, 202] -[:mouse_move, 386, 397, 2, 106, 203] -[:mouse_move, 389, 397, 2, 107, 204] -[:mouse_move, 391, 397, 2, 108, 205] -[:mouse_move, 397, 397, 2, 109, 206] -[:mouse_move, 398, 397, 2, 110, 207] -[:mouse_move, 403, 397, 2, 111, 208] -[:mouse_move, 405, 397, 2, 112, 209] -[:mouse_move, 407, 397, 2, 113, 210] -[:mouse_move, 409, 397, 2, 114, 211] -[:mouse_move, 410, 397, 2, 115, 212] -[:mouse_move, 411, 397, 2, 116, 218] -[:mouse_move, 411, 395, 2, 117, 328] -[:mouse_move, 411, 393, 2, 118, 329] -[:mouse_move, 412, 387, 2, 119, 330] -[:mouse_move, 413, 382, 2, 120, 331] -[:mouse_move, 415, 371, 2, 121, 332] -[:mouse_move, 416, 364, 2, 122, 333] -[:mouse_move, 417, 349, 2, 123, 334] -[:mouse_move, 418, 343, 2, 124, 335] -[:mouse_move, 419, 335, 2, 125, 336] -[:mouse_move, 419, 332, 2, 126, 337] -[:mouse_move, 420, 328, 2, 127, 338] -[:mouse_move, 420, 327, 2, 128, 339] -[:mouse_move, 420, 329, 2, 129, 345] -[:mouse_move, 421, 331, 2, 130, 346] -[:mouse_move, 421, 332, 2, 131, 347] -[:mouse_move, 421, 333, 2, 132, 348] -[:mouse_move, 422, 334, 2, 133, 349] -[:key_down_raw, 102, 0, 2, 134, 411] -[:key_up_raw, 102, 0, 2, 135, 417] -[:key_down_raw, 102, 0, 2, 136, 470] -[:key_up_raw, 102, 0, 2, 137, 476] -[:key_down_raw, 102, 0, 2, 138, 526] -[:key_up_raw, 102, 0, 2, 139, 531] -[:key_down_raw, 102, 0, 2, 140, 537] -[:key_up_raw, 102, 0, 2, 141, 541] -[:key_down_raw, 102, 0, 2, 142, 546] -[:key_up_raw, 102, 0, 2, 143, 550] -[:key_down_raw, 102, 0, 2, 144, 555] -[:key_up_raw, 102, 0, 2, 145, 558] -[:key_down_raw, 102, 0, 2, 146, 563] -[:key_up_raw, 102, 0, 2, 147, 567] -[:key_down_raw, 102, 0, 2, 148, 572] -[:key_up_raw, 102, 0, 2, 149, 575] -[:key_down_raw, 102, 0, 2, 150, 579] -[:key_up_raw, 102, 0, 2, 151, 582] -[:key_down_raw, 102, 0, 2, 152, 632] -[:key_up_raw, 102, 0, 2, 153, 657] -[:key_down_raw, 102, 0, 2, 154, 687] -[:key_up_raw, 102, 0, 2, 155, 692] -[:key_down_raw, 1073742051, 1024, 2, 156, 779] -[:key_down_raw, 113, 1024, 2, 157, 779] -[:key_up_raw, 113, 1024, 2, 158, 779] diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png deleted file mode 100644 index fb179af..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png and /dev/null differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png deleted file mode 100644 index 8cfe531..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png and /dev/null differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png deleted file mode 100644 index cb462e1..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png and /dev/null differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png deleted file mode 100644 index 04c4977..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png and /dev/null differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png deleted file mode 100644 index b29fa3d..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png and /dev/null differ diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png deleted file mode 100644 index 99f4e74..0000000 Binary files a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/app/main.rb b/samples/04_physics_and_collisions/04_box_collision_2/app/main.rb deleted file mode 100644 index 126759a..0000000 --- a/samples/04_physics_and_collisions/04_box_collision_2/app/main.rb +++ /dev/null @@ -1,470 +0,0 @@ -=begin - APIs listing that haven't been encountered in previous sample apps: - - - times: Performs an action a specific number of times. - For example, if we said - 5.times puts "Hello DragonRuby", - then we'd see the words "Hello DragonRuby" printed on the console 5 times. - - - split: Divides a string into substrings based on a delimiter. - For example, if we had a command - "DragonRuby is awesome".split(" ") - then the result would be - ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. - - - join: Opposite of split; converts each element of array to a string separated by delimiter. - For example, if we had a command - ["DragonRuby","is","awesome"].join(" ") - then the result would be - "DragonRuby is awesome". - - Reminders: - - - to_s: Returns a string representation of an object. - For example, if we had - 500.to_s - the string "500" would be returned. - Similar to to_i, which returns an integer representation of an object. - - - elapsed_time: How many frames have passed since the click event. - - - args.outputs.labels: An array. Values in the array generate labels on the screen. - The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. - - - inputs.mouse.down: Determines whether or not the mouse is being pressed down. - The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). - - - first: Returns the first element of the array. - - - num1.idiv(num2): Divides two numbers and returns an integer. - - - find_all: Finds all values that satisfy specific requirements. - - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. - - - reject: Removes elements from a collection if they meet certain requirements. - - - 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. - -=end - -MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map - -class MetroidvaniaStarter - attr_accessor :grid, :inputs, :state, :outputs, :gtk - - # Calls methods needed to run the game properly. - def tick - defaults - render - calc - process_inputs - end - - # Sets all the default variables. - # '||' states that initialization occurs only in the first frame. - def defaults - state.tile_size = 64 - state.gravity = -0.2 - state.player_width = 60 - state.player_height = 64 - state.collision_tolerance = 0.0 - state.previous_tile_size ||= state.tile_size - state.x ||= 0 - state.y ||= 800 - state.dy ||= 0 - state.dx ||= 0 - attempt_load_world_from_file - state.world_lookup ||= { } - state.world_collision_rects ||= [] - state.mode ||= :creating # alternates between :creating and :selecting for sprite selection - state.select_menu ||= [0, 720, 1280, 720] - #=======================================IMPORTANT=======================================# - # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. - # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. - #=======================================================================================# - state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES - state.sprite_coords ||= [] - state.banner_coords ||= [640, 680 + 720] - state.sprite_selected ||= 1 - state.map_saved_at ||= 0 - - # Sets all the cordinate values for the sprite selection screen into a grid - # Displayed when 's' is pressed by player to access sprites - if state.sprite_coords == [] # if sprite_coords is an empty array - count = 1 - temp_x = 165 # sets a starting x and y position for display - temp_y = 500 + 720 - state.sprite_quantity.times do # for the number of sprites you have - state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array - temp_x += 100 # increment temp_x - count += 1 # increment count - if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen - temp_x = 165 # a new row of sprites starts - temp_y -= 75 # new row of sprites starts 75 units lower than the previous row - end - end - end - end - - # Places sprites - def render - - # Sets the x, y, width, height, and image path for each sprite in the world collection. - outputs.sprites << state.world.map do |x, y, sprite| - [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location - y * state.tile_size, - state.tile_size, - state.tile_size, - 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path - end - - # Outputs sprite for the player by setting x, y, width, height, and image path - outputs.sprites << [state.x, - state.y, - state.player_width, - state.player_height,'sprites/player.png'] - - # Outputs labels as primitives in top right of the screen - outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label - outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label - - outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label - outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label - - outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label - - # if the map is saved and less than 120 frames have passed, the label is displayed - if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 - outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label - end - - # If player hits 's', following appears - if state.mode == :selecting - # White background for sprite selection - outputs.primitives << [state.select_menu, 255, 255, 255].solid - - # Select tile label at the top of the screen - outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label - - # Places sprites in locations calculated in the defaults function - outputs.primitives << state.sprite_coords.map do |x, y, order| - [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite - end - end - - # Creates sprite following mouse to help indicate which sprite you have selected - # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon - outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, - 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite - end - - # Calls methods that perform calculations - def calc - calc_in_game - calc_sprite_selection - end - - # Calls methods that perform calculations (if in creating mode) - def calc_in_game - return unless state.mode == :creating - calc_world_lookup - calc_player - end - - def calc_world_lookup - # If the tile size isn't equal to the previous tile size, - # the previous tile size is set to the tile size, - # and world_lookup hash is set to empty. - if state.tile_size != state.previous_tile_size - state.previous_tile_size = state.tile_size - state.world_lookup = {} - end - - # return if world_lookup is not empty or if world is empty - return if state.world_lookup.keys.length > 0 - return unless state.world.length > 0 - - # Searches through the world and finds the coordinates that exist - state.world_lookup = {} - state.world.each { |x, y| state.world_lookup[[x, y]] = true } - - # Assigns collision rects for every sprite drawn - state.world_collision_rects = - state.world_lookup - .keys - .map do |coord_x, coord_y| - s = state.tile_size - # Multiplying by s (the size of a tile) ensures that the rect is - # placed exactly where you want it to be placed (causes grid to coordinate) - # How many pixels horizontally across and vertically up and down - x = s * coord_x - y = s * coord_y - { - args: [coord_x, coord_y], - left_right: [x, y + 4, s, s - 6], # hash keys and values - top: [x + 4, y + 6, s - 8, s - 6], - bottom: [x + 1, y - 1, s - 2, s - 8], - } - end - end - - # Calculates movement of player and calls methods that perform collision calculations - def calc_player - state.dy += state.gravity # what goes up must come down because of gravity - calc_box_collision - calc_edge_collision - state.y += state.dy # Since velocity is the change in position, the change in y increases by dy - state.x += state.dx # Ditto line above but dx and x - state.dx *= 0.8 # Scales dx down - end - - # Calls methods that determine whether the player collides with any world_collision_rects. - def calc_box_collision - return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key - collision_floor - collision_left - collision_right - collision_ceiling - end - - # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. - def collision_floor - return unless state.dy <= 0 # return unless player is going down or is as far down as possible - player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player - - # Runs through all the sprites on the field and finds all intersections between player's - # bottom and the top of a rect. - floor_collisions = state.world_collision_rects - .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless floor_collisions # performs following changes if a collision has occurred - state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top - state.dy = 0 # no change in y because the player's path is blocked - end - - # Finds collisions between the player's left side and the right side of a world_collision_rect. - def collision_left - return unless state.dx < 0 # return unless player is moving left - player_rect = [next_x, state.y, state.tile_size, state.tile_size] - - # Runs through all the sprites on the field and finds all intersections between the player's left side - # and the right side of a rect. - left_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless left_side_collisions # return unless collision occurred - state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side - state.dx = 0 # no change in x because the player's path is blocked - end - - # Finds collisions between the right side of the player and the left side of a world_collision_rect. - def collision_right - return unless state.dx > 0 # return unless player is moving right - player_rect = [next_x, state.y, state.tile_size, state.tile_size] - - # Runs through all the sprites on the field and finds all intersections between the player's - # right side and the left side of a rect. - right_side_collisions = state.world_collision_rects - .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless right_side_collisions # return unless collision occurred - state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) - state.dx = 0 # no change in x because the player's path is blocked - end - - # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. - def collision_ceiling - return unless state.dy > 0 # return unless player is moving up - player_rect = [state.x, next_y, state.player_width, state.player_height] - - # Runs through all the sprites on the field and finds all intersections between the player's top - # and the bottom of a rect. - ceil_collisions = state.world_collision_rects - .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } - .first - - return unless ceil_collisions # return unless collision occurred - state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) - state.dy = 0 # no change in y because the player's path is blocked - end - - # Makes sure the player remains within the screen's dimensions. - def calc_edge_collision - # Ensures that player doesn't fall below the map - if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope - state.y = 0 # 0 is the lowest the player can be while staying on the screen - state.dy = 0 - # Ensures player doesn't go insanely high - elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope - state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen - state.dy = 0 - end - - # Ensures that player remains in the horizontal range its supposed to - if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right - state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope - state.dx = 0 - elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left - state.x = 0 # farthest left the player can be while remaining in the screen's scope - state.dx = 0 - end - end - - def calc_sprite_selection - # Does the transition to bring down the select sprite screen - if state.mode == :selecting && state.select_menu.y != 0 - state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) - state.banner_coords.y = 680 # sets y position of Select Sprite banner - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| - [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) - end - end - - # Does the transition to leave the select sprite screen - if state.mode == :creating && state.select_menu.y != 720 - state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) - state.banner_coords.y = 1000 # sets y position of Select Sprite banner - state.sprite_coords = state.sprite_coords.map do |x, y, w, h| - [x, y + 720, w, h] # sets definition of all elements in collection - end - end - end - - def process_inputs - # If the state.mode is back and if the menu has retreated back up - # call methods that process user inputs - if state.mode == :creating - process_inputs_player_movement - process_inputs_place_tile - end - - # For each sprite_coordinate added, check what sprite was selected - if state.mode == :selecting - state.sprite_coords.map do |x, y, order| # goes through all sprites in collection - # checks that a specific sprite was pressed based on x, y position - if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true - inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and - inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right - inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y - inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up - state.sprite_selected = order # sprite is chosen - end - end - end - - inputs_export_stage - process_inputs_show_available_sprites - end - - # Moves the player based on the keys they press on their keyboard - def process_inputs_player_movement - # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) - if inputs.keyboard.key_up.right - state.dx = 0 - elsif inputs.keyboard.key_up.left - state.dx = 0 - end - - # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys - if inputs.keyboard.key_held.right - state.dx = 3 - elsif inputs.keyboard.key_held.left - state.dx = -3 - end - - # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard - if inputs.keyboard.key_held.space - state.dy = 5 - end - end - - # Adds tile in the place the user holds down the mouse - def process_inputs_place_tile - if inputs.mouse.down # if mouse is pressed - state.world_lookup = {} - x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid - - # Checks if any coordinates duplicate (already exist in world) - if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } - #erases existing tile space by rejecting them from world - state.world = state.world.reject do |existing_x, existing_y, n| - existing_x == x && existing_y == y - end - else - state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite - end - end - end - - # Stores/exports world collection's info (coordinates, sprite number) into a file - def inputs_export_stage - if inputs.keyboard.key_down.e # if "e" is pressed - export_string = state.world.map do |x, y, sprite_number| # stores world info in a string - "#{x},#{y},#{sprite_number}" # using string interpolation - end - gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file - state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved - end - end - - def process_inputs_show_available_sprites - # Based on keyboard input, the entity (:creating and :selecting) switch - if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating - state.mode = :selecting # will change to selecting - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off - elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting - state.mode = :creating # will change to creating - inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off - end - end - - # Loads the world collection by reading from the map.txt file in the app folder - def attempt_load_world_from_file - return if state.world # return if the world collection is already populated - state.world ||= [] # initialized as an empty collection - exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code - return unless exported_world # return unless the file read was successful - state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world - l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, - # calling to_i (converts to integers) on each element - end - end - - # Adds the change in y to y to determine the next y position of the player. - def next_y - state.y + state.dy - end - - # Determines next x position of player - def next_x - if state.dx < 0 # if the player moves left - return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) - else - return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) - end - end - - def to_coord point - # Integer divides (idiv) point.x to turn into grid - # Then, you can just multiply each integer by state.tile_size - # later and huzzah. Grid coordinates - [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] - end -end - -$metroidvania_starter = MetroidvaniaStarter.new - -def tick args - $metroidvania_starter.grid = args.grid - $metroidvania_starter.inputs = args.inputs - $metroidvania_starter.state = args.state - $metroidvania_starter.outputs = args.outputs - $metroidvania_starter.gtk = args.gtk - $metroidvania_starter.tick -end diff --git a/samples/04_physics_and_collisions/04_box_collision_2/app/map.txt b/samples/04_physics_and_collisions/04_box_collision_2/app/map.txt deleted file mode 100644 index abbc046..0000000 --- a/samples/04_physics_and_collisions/04_box_collision_2/app/map.txt +++ /dev/null @@ -1,11 +0,0 @@ -5,7,2 -11,7,2 -15,2,2 -6,5,2 -16,5,2 -13,4,2 -7,2,2 -8,5,2 -8,8,2 -4,6,2 -11,3,2 \ No newline at end of file diff --git a/samples/04_physics_and_collisions/04_box_collision_2/license-for-sample.txt b/samples/04_physics_and_collisions/04_box_collision_2/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/04_physics_and_collisions/04_box_collision_2/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/04_physics_and_collisions/04_box_collision_2/replay.txt b/samples/04_physics_and_collisions/04_box_collision_2/replay.txt deleted file mode 100644 index d53870b..0000000 --- a/samples/04_physics_and_collisions/04_box_collision_2/replay.txt +++ /dev/null @@ -1,819 +0,0 @@ -replay_version 2.0 -stopped_at 1897 -seed 100 -recorded_at Sun Sep 29 22:22:11 2019 -[:mouse_move, 40, 523, 2, 1, 129] -[:mouse_move, 114, 503, 2, 2, 130] -[:mouse_move, 170, 488, 2, 3, 131] -[:mouse_move, 299, 454, 2, 4, 132] -[:mouse_move, 481, 406, 2, 5, 133] -[:mouse_move, 685, 346, 2, 6, 134] -[:mouse_move, 812, 302, 2, 7, 135] -[:mouse_move, 1026, 205, 2, 8, 136] -[:mouse_move, 1062, 184, 2, 9, 137] -[:mouse_move, 1112, 150, 2, 10, 138] -[:mouse_move, 1153, 121, 2, 11, 139] -[:mouse_move, 1169, 107, 2, 12, 140] -[:mouse_move, 1182, 95, 2, 13, 141] -[:mouse_move, 1197, 73, 2, 14, 142] -[:mouse_move, 1197, 70, 2, 15, 143] -[:mouse_move, 1192, 63, 2, 16, 144] -[:mouse_move, 1187, 60, 2, 17, 145] -[:mouse_move, 1170, 50, 2, 18, 146] -[:mouse_move, 1161, 45, 2, 19, 147] -[:mouse_move, 1147, 38, 2, 20, 148] -[:mouse_move, 1140, 34, 2, 21, 149] -[:mouse_move, 1126, 28, 2, 22, 150] -[:mouse_move, 1114, 25, 2, 23, 151] -[:mouse_move, 1098, 23, 2, 24, 152] -[:mouse_move, 1088, 23, 2, 25, 153] -[:mouse_move, 1072, 23, 2, 26, 154] -[:mouse_move, 1055, 24, 2, 27, 155] -[:mouse_move, 1044, 26, 2, 28, 156] -[:mouse_move, 1019, 29, 2, 29, 157] -[:mouse_move, 994, 31, 2, 30, 158] -[:mouse_move, 969, 32, 2, 31, 159] -[:mouse_move, 963, 32, 2, 32, 160] -[:mouse_move, 948, 32, 2, 33, 161] -[:mouse_move, 941, 31, 2, 34, 162] -[:mouse_move, 924, 29, 2, 35, 163] -[:mouse_move, 918, 27, 2, 36, 164] -[:mouse_move, 910, 25, 2, 37, 165] -[:mouse_move, 907, 24, 2, 38, 166] -[:mouse_move, 902, 23, 2, 39, 167] -[:mouse_move, 901, 22, 2, 40, 168] -[:mouse_move, 899, 22, 2, 41, 169] -[:mouse_move, 898, 22, 2, 42, 170] -[:mouse_move, 897, 22, 2, 43, 172] -[:mouse_move, 897, 23, 2, 44, 174] -[:mouse_move, 897, 30, 2, 45, 175] -[:mouse_move, 898, 34, 2, 46, 176] -[:mouse_move, 906, 46, 2, 47, 177] -[:mouse_move, 912, 52, 2, 48, 178] -[:mouse_move, 929, 64, 2, 49, 179] -[:mouse_move, 941, 69, 2, 50, 180] -[:mouse_move, 963, 74, 2, 51, 181] -[:mouse_move, 969, 75, 2, 52, 182] -[:mouse_move, 980, 76, 2, 53, 183] -[:mouse_move, 1001, 76, 2, 54, 184] -[:mouse_move, 1009, 76, 2, 55, 185] -[:mouse_move, 1025, 76, 2, 56, 186] -[:mouse_move, 1028, 76, 2, 57, 187] -[:mouse_move, 1041, 75, 2, 58, 188] -[:mouse_move, 1046, 73, 2, 59, 189] -[:mouse_move, 1055, 71, 2, 60, 190] -[:mouse_move, 1061, 69, 2, 61, 191] -[:mouse_move, 1078, 65, 2, 62, 192] -[:mouse_move, 1086, 64, 2, 63, 193] -[:mouse_move, 1104, 62, 2, 64, 194] -[:mouse_move, 1109, 62, 2, 65, 195] -[:mouse_move, 1126, 61, 2, 66, 196] -[:mouse_move, 1141, 61, 2, 67, 197] -[:mouse_move, 1155, 60, 2, 68, 198] -[:mouse_move, 1162, 60, 2, 69, 199] -[:mouse_move, 1170, 59, 2, 70, 200] -[:mouse_move, 1175, 59, 2, 71, 201] -[:mouse_move, 1181, 58, 2, 72, 202] -[:mouse_move, 1183, 57, 2, 73, 203] -[:mouse_move, 1186, 56, 2, 74, 204] -[:mouse_move, 1189, 55, 2, 75, 205] -[:mouse_move, 1191, 53, 2, 76, 206] -[:mouse_move, 1191, 52, 2, 77, 207] -[:mouse_move, 1193, 48, 2, 78, 208] -[:mouse_move, 1193, 45, 2, 79, 209] -[:mouse_move, 1192, 43, 2, 80, 210] -[:mouse_move, 1186, 38, 2, 81, 211] -[:mouse_move, 1181, 35, 2, 82, 212] -[:mouse_move, 1168, 30, 2, 83, 213] -[:mouse_move, 1161, 27, 2, 84, 214] -[:mouse_move, 1140, 23, 2, 85, 215] -[:mouse_move, 1130, 21, 2, 86, 216] -[:mouse_move, 1109, 19, 2, 87, 217] -[:mouse_move, 1104, 19, 2, 88, 218] -[:mouse_move, 1081, 19, 2, 89, 219] -[:mouse_move, 1064, 19, 2, 90, 220] -[:mouse_move, 1048, 19, 2, 91, 221] -[:mouse_move, 1037, 19, 2, 92, 222] -[:mouse_move, 1012, 20, 2, 93, 223] -[:mouse_move, 1007, 21, 2, 94, 224] -[:mouse_move, 986, 22, 2, 95, 225] -[:mouse_move, 978, 23, 2, 96, 226] -[:mouse_move, 957, 26, 2, 97, 227] -[:mouse_move, 949, 28, 2, 98, 228] -[:mouse_move, 935, 32, 2, 99, 229] -[:mouse_move, 930, 34, 2, 100, 230] -[:mouse_move, 926, 37, 2, 101, 231] -[:mouse_move, 921, 40, 2, 102, 232] -[:mouse_move, 918, 46, 2, 103, 233] -[:mouse_move, 918, 51, 2, 104, 234] -[:mouse_move, 919, 60, 2, 105, 235] -[:mouse_move, 923, 67, 2, 106, 236] -[:mouse_move, 929, 70, 2, 107, 237] -[:mouse_move, 941, 73, 2, 108, 238] -[:mouse_move, 948, 74, 2, 109, 239] -[:mouse_move, 958, 74, 2, 110, 240] -[:mouse_move, 962, 74, 2, 111, 241] -[:mouse_move, 968, 74, 2, 112, 242] -[:mouse_move, 969, 73, 2, 113, 243] -[:mouse_move, 970, 73, 2, 114, 244] -[:mouse_move, 968, 73, 2, 115, 256] -[:mouse_move, 963, 77, 2, 116, 257] -[:mouse_move, 949, 85, 2, 117, 258] -[:mouse_move, 944, 88, 2, 118, 259] -[:mouse_move, 935, 94, 2, 119, 260] -[:mouse_move, 932, 96, 2, 120, 261] -[:mouse_move, 925, 101, 2, 121, 262] -[:mouse_move, 921, 104, 2, 122, 263] -[:mouse_move, 917, 107, 2, 123, 264] -[:mouse_move, 915, 107, 2, 124, 265] -[:mouse_move, 914, 108, 2, 125, 266] -[:mouse_move, 912, 108, 2, 126, 267] -[:mouse_move, 912, 109, 2, 127, 268] -[:mouse_move, 911, 109, 2, 128, 269] -[:mouse_move, 913, 109, 2, 129, 275] -[:mouse_move, 915, 109, 2, 130, 276] -[:mouse_move, 922, 109, 2, 131, 277] -[:mouse_move, 926, 109, 2, 132, 278] -[:mouse_move, 937, 108, 2, 133, 279] -[:mouse_move, 943, 107, 2, 134, 280] -[:mouse_move, 955, 106, 2, 135, 281] -[:mouse_move, 961, 106, 2, 136, 282] -[:mouse_move, 971, 106, 2, 137, 283] -[:mouse_move, 977, 106, 2, 138, 284] -[:mouse_move, 987, 106, 2, 139, 285] -[:mouse_move, 994, 106, 2, 140, 286] -[:mouse_move, 1012, 108, 2, 141, 287] -[:mouse_move, 1016, 109, 2, 142, 288] -[:mouse_move, 1030, 110, 2, 143, 289] -[:mouse_move, 1036, 111, 2, 144, 290] -[:mouse_move, 1050, 111, 2, 145, 291] -[:mouse_move, 1056, 111, 2, 146, 292] -[:mouse_move, 1062, 111, 2, 147, 293] -[:mouse_move, 1074, 111, 2, 148, 294] -[:mouse_move, 1080, 111, 2, 149, 295] -[:mouse_move, 1086, 111, 2, 150, 296] -[:mouse_move, 1094, 111, 2, 151, 297] -[:mouse_move, 1099, 112, 2, 152, 298] -[:mouse_move, 1101, 112, 2, 153, 299] -[:mouse_move, 1106, 112, 2, 154, 300] -[:mouse_move, 1107, 112, 2, 155, 301] -[:mouse_move, 1109, 112, 2, 156, 302] -[:mouse_move, 1104, 112, 2, 157, 306] -[:mouse_move, 1097, 112, 2, 158, 307] -[:mouse_move, 1079, 112, 2, 159, 308] -[:mouse_move, 1067, 111, 2, 160, 309] -[:mouse_move, 1043, 111, 2, 161, 310] -[:mouse_move, 1038, 111, 2, 162, 311] -[:mouse_move, 1018, 111, 2, 163, 312] -[:mouse_move, 1009, 111, 2, 164, 313] -[:mouse_move, 986, 111, 2, 165, 314] -[:mouse_move, 978, 111, 2, 166, 315] -[:mouse_move, 963, 111, 2, 167, 316] -[:mouse_move, 954, 111, 2, 168, 317] -[:mouse_move, 940, 111, 2, 169, 318] -[:mouse_move, 934, 111, 2, 170, 319] -[:mouse_move, 929, 111, 2, 171, 320] -[:mouse_move, 920, 110, 2, 172, 321] -[:mouse_move, 916, 110, 2, 173, 322] -[:mouse_move, 911, 109, 2, 174, 323] -[:mouse_move, 909, 109, 2, 175, 324] -[:mouse_move, 906, 109, 2, 176, 325] -[:mouse_move, 905, 109, 2, 177, 327] -[:mouse_move, 904, 109, 2, 178, 328] -[:mouse_move, 904, 110, 2, 179, 334] -[:mouse_move, 907, 112, 2, 180, 335] -[:mouse_move, 910, 113, 2, 181, 336] -[:mouse_move, 917, 117, 2, 182, 337] -[:mouse_move, 921, 118, 2, 183, 338] -[:mouse_move, 931, 122, 2, 184, 339] -[:mouse_move, 935, 123, 2, 185, 340] -[:mouse_move, 943, 125, 2, 186, 341] -[:mouse_move, 945, 125, 2, 187, 342] -[:mouse_move, 954, 128, 2, 188, 343] -[:mouse_move, 957, 128, 2, 189, 344] -[:mouse_move, 963, 129, 2, 190, 345] -[:mouse_move, 966, 130, 2, 191, 346] -[:mouse_move, 968, 130, 2, 192, 347] -[:mouse_move, 976, 131, 2, 193, 348] -[:mouse_move, 980, 132, 2, 194, 349] -[:mouse_move, 986, 132, 2, 195, 350] -[:mouse_move, 991, 133, 2, 196, 351] -[:mouse_move, 998, 133, 2, 197, 352] -[:mouse_move, 1002, 133, 2, 198, 353] -[:mouse_move, 1010, 133, 2, 199, 354] -[:mouse_move, 1014, 133, 2, 200, 355] -[:mouse_move, 1024, 133, 2, 201, 356] -[:mouse_move, 1030, 133, 2, 202, 357] -[:mouse_move, 1041, 133, 2, 203, 358] -[:mouse_move, 1047, 134, 2, 204, 359] -[:mouse_move, 1062, 134, 2, 205, 360] -[:mouse_move, 1070, 134, 2, 206, 361] -[:mouse_move, 1083, 135, 2, 207, 362] -[:mouse_move, 1091, 135, 2, 208, 363] -[:mouse_move, 1103, 136, 2, 209, 364] -[:mouse_move, 1110, 136, 2, 210, 365] -[:mouse_move, 1123, 138, 2, 211, 366] -[:mouse_move, 1129, 140, 2, 212, 367] -[:mouse_move, 1140, 141, 2, 213, 368] -[:mouse_move, 1145, 142, 2, 214, 369] -[:mouse_move, 1156, 144, 2, 215, 370] -[:mouse_move, 1161, 144, 2, 216, 371] -[:mouse_move, 1171, 145, 2, 217, 372] -[:mouse_move, 1175, 145, 2, 218, 373] -[:mouse_move, 1180, 145, 2, 219, 374] -[:mouse_move, 1188, 145, 2, 220, 375] -[:mouse_move, 1189, 145, 2, 221, 376] -[:mouse_move, 1196, 146, 2, 222, 377] -[:mouse_move, 1199, 146, 2, 223, 378] -[:mouse_move, 1203, 147, 2, 224, 379] -[:mouse_move, 1205, 148, 2, 225, 380] -[:mouse_move, 1208, 150, 2, 226, 381] -[:mouse_move, 1210, 150, 2, 227, 382] -[:mouse_move, 1211, 151, 2, 228, 383] -[:mouse_move, 1212, 151, 2, 229, 384] -[:mouse_move, 1212, 152, 2, 230, 385] -[:mouse_move, 1213, 152, 2, 231, 386] -[:mouse_move, 1212, 152, 2, 232, 422] -[:mouse_move, 1211, 152, 2, 233, 427] -[:mouse_move, 1209, 152, 2, 234, 428] -[:mouse_move, 1194, 159, 2, 235, 429] -[:mouse_move, 1179, 166, 2, 236, 430] -[:mouse_move, 1135, 186, 2, 237, 431] -[:mouse_move, 1123, 191, 2, 238, 432] -[:mouse_move, 1080, 208, 2, 239, 433] -[:mouse_move, 1073, 211, 2, 240, 434] -[:mouse_move, 1045, 219, 2, 241, 435] -[:mouse_move, 1033, 220, 2, 242, 436] -[:mouse_move, 1021, 221, 2, 243, 437] -[:mouse_move, 1016, 221, 2, 244, 438] -[:mouse_move, 1009, 221, 2, 245, 439] -[:mouse_move, 1007, 220, 2, 246, 440] -[:mouse_move, 1002, 218, 2, 247, 441] -[:mouse_move, 999, 216, 2, 248, 442] -[:mouse_move, 987, 210, 2, 249, 443] -[:mouse_move, 979, 207, 2, 250, 444] -[:mouse_move, 958, 199, 2, 251, 445] -[:mouse_move, 947, 196, 2, 252, 446] -[:mouse_move, 929, 191, 2, 253, 447] -[:mouse_move, 920, 189, 2, 254, 448] -[:mouse_move, 910, 186, 2, 255, 449] -[:mouse_move, 906, 185, 2, 256, 450] -[:mouse_move, 901, 184, 2, 257, 451] -[:mouse_move, 900, 183, 2, 258, 452] -[:mouse_move, 899, 183, 2, 259, 453] -[:mouse_move, 898, 183, 2, 260, 457] -[:mouse_move, 892, 183, 2, 261, 458] -[:mouse_move, 885, 183, 2, 262, 459] -[:mouse_move, 864, 183, 2, 263, 460] -[:mouse_move, 841, 182, 2, 264, 461] -[:mouse_move, 811, 180, 2, 265, 462] -[:mouse_move, 775, 178, 2, 266, 463] -[:mouse_move, 754, 176, 2, 267, 464] -[:mouse_move, 748, 176, 2, 268, 465] -[:mouse_move, 728, 175, 2, 269, 466] -[:mouse_move, 723, 174, 2, 270, 467] -[:mouse_move, 717, 174, 2, 271, 468] -[:mouse_move, 716, 174, 2, 272, 469] -[:mouse_move, 719, 174, 2, 273, 472] -[:mouse_move, 724, 174, 2, 274, 473] -[:mouse_move, 734, 176, 2, 275, 474] -[:mouse_move, 741, 177, 2, 276, 475] -[:mouse_move, 758, 178, 2, 277, 476] -[:mouse_move, 772, 179, 2, 278, 477] -[:mouse_move, 792, 180, 2, 279, 478] -[:mouse_move, 796, 180, 2, 280, 479] -[:mouse_move, 813, 181, 2, 281, 480] -[:mouse_move, 822, 181, 2, 282, 481] -[:mouse_move, 830, 181, 2, 283, 482] -[:mouse_move, 854, 182, 2, 284, 483] -[:mouse_move, 866, 183, 2, 285, 484] -[:mouse_move, 891, 183, 2, 286, 485] -[:mouse_move, 905, 184, 2, 287, 486] -[:mouse_move, 938, 185, 2, 288, 487] -[:mouse_move, 970, 186, 2, 289, 488] -[:mouse_move, 1017, 188, 2, 290, 489] -[:mouse_move, 1042, 189, 2, 291, 490] -[:mouse_move, 1079, 190, 2, 292, 491] -[:mouse_move, 1102, 190, 2, 293, 492] -[:mouse_move, 1128, 190, 2, 294, 493] -[:mouse_move, 1142, 190, 2, 295, 494] -[:mouse_move, 1162, 190, 2, 296, 495] -[:mouse_move, 1165, 190, 2, 297, 496] -[:mouse_move, 1175, 190, 2, 298, 497] -[:mouse_move, 1178, 190, 2, 299, 498] -[:mouse_move, 1183, 189, 2, 300, 499] -[:mouse_move, 1185, 189, 2, 301, 500] -[:mouse_move, 1187, 189, 2, 302, 501] -[:mouse_move, 1188, 189, 2, 303, 502] -[:mouse_move, 1190, 189, 2, 304, 503] -[:mouse_move, 1190, 190, 2, 305, 504] -[:mouse_move, 1192, 190, 2, 306, 505] -[:mouse_move, 1193, 191, 2, 307, 506] -[:mouse_move, 1195, 192, 2, 308, 507] -[:mouse_move, 1197, 193, 2, 309, 509] -[:mouse_move, 1198, 194, 2, 310, 510] -[:mouse_move, 1199, 194, 2, 311, 511] -[:mouse_move, 1201, 195, 2, 312, 512] -[:mouse_move, 1202, 196, 2, 313, 513] -[:mouse_move, 1203, 196, 2, 314, 514] -[:mouse_move, 1203, 197, 2, 315, 515] -[:mouse_move, 1204, 197, 2, 316, 516] -[:mouse_move, 1204, 198, 2, 317, 520] -[:mouse_move, 1203, 198, 2, 318, 523] -[:mouse_move, 1202, 199, 2, 319, 524] -[:mouse_move, 1200, 199, 2, 320, 525] -[:mouse_move, 1192, 203, 2, 321, 526] -[:mouse_move, 1177, 209, 2, 322, 527] -[:mouse_move, 1115, 235, 2, 323, 528] -[:mouse_move, 1071, 251, 2, 324, 529] -[:mouse_move, 958, 294, 2, 325, 530] -[:mouse_move, 890, 320, 2, 326, 531] -[:mouse_move, 758, 368, 2, 327, 532] -[:mouse_move, 693, 388, 2, 328, 533] -[:mouse_move, 610, 409, 2, 329, 534] -[:mouse_move, 564, 421, 2, 330, 535] -[:mouse_move, 549, 423, 2, 331, 536] -[:mouse_move, 518, 429, 2, 332, 537] -[:mouse_move, 512, 429, 2, 333, 538] -[:mouse_move, 495, 432, 2, 334, 539] -[:mouse_move, 490, 432, 2, 335, 540] -[:mouse_move, 487, 433, 2, 336, 541] -[:mouse_move, 486, 433, 2, 337, 542] -[:mouse_move, 486, 432, 2, 338, 543] -[:mouse_move, 486, 430, 2, 339, 545] -[:mouse_move, 487, 430, 2, 340, 546] -[:mouse_move, 487, 426, 2, 341, 547] -[:mouse_move, 486, 424, 2, 342, 548] -[:mouse_move, 481, 416, 2, 343, 549] -[:mouse_move, 477, 409, 2, 344, 550] -[:mouse_move, 471, 401, 2, 345, 551] -[:mouse_move, 467, 397, 2, 346, 552] -[:mouse_move, 456, 391, 2, 347, 553] -[:mouse_move, 451, 391, 2, 348, 554] -[:mouse_move, 429, 397, 2, 349, 555] -[:mouse_move, 416, 406, 2, 350, 556] -[:mouse_move, 383, 429, 2, 351, 557] -[:mouse_move, 364, 444, 2, 352, 558] -[:mouse_move, 337, 471, 2, 353, 559] -[:mouse_move, 322, 487, 2, 354, 560] -[:mouse_move, 300, 507, 2, 355, 561] -[:mouse_move, 289, 515, 2, 356, 562] -[:mouse_move, 285, 518, 2, 357, 563] -[:mouse_move, 273, 525, 2, 358, 564] -[:mouse_move, 269, 527, 2, 359, 565] -[:mouse_move, 266, 528, 2, 360, 566] -[:mouse_move, 264, 528, 2, 361, 567] -[:mouse_move, 262, 528, 2, 362, 568] -[:mouse_move, 261, 528, 2, 363, 569] -[:mouse_move, 259, 527, 2, 364, 570] -[:mouse_move, 258, 526, 2, 365, 571] -[:mouse_move, 257, 526, 2, 366, 572] -[:key_down_raw, 115, 0, 2, 367, 589] -[:key_up_raw, 115, 0, 2, 368, 594] -[:mouse_move, 257, 524, 2, 369, 617] -[:mouse_move, 259, 521, 2, 370, 618] -[:mouse_move, 260, 516, 2, 371, 619] -[:mouse_move, 263, 497, 2, 372, 620] -[:mouse_move, 263, 484, 2, 373, 621] -[:mouse_move, 263, 446, 2, 374, 622] -[:mouse_move, 258, 426, 2, 375, 623] -[:mouse_move, 250, 389, 2, 376, 624] -[:mouse_move, 248, 382, 2, 377, 625] -[:mouse_move, 239, 351, 2, 378, 626] -[:mouse_move, 235, 339, 2, 379, 627] -[:mouse_move, 229, 322, 2, 380, 628] -[:mouse_move, 226, 314, 2, 381, 629] -[:mouse_move, 222, 305, 2, 382, 630] -[:mouse_move, 219, 300, 2, 383, 631] -[:mouse_move, 216, 296, 2, 384, 632] -[:mouse_move, 215, 293, 2, 385, 633] -[:mouse_move, 212, 289, 2, 386, 634] -[:mouse_move, 212, 286, 2, 387, 635] -[:mouse_move, 209, 280, 2, 388, 636] -[:mouse_move, 208, 278, 2, 389, 637] -[:mouse_move, 207, 271, 2, 390, 638] -[:mouse_move, 206, 269, 2, 391, 639] -[:mouse_move, 203, 261, 2, 392, 640] -[:mouse_move, 201, 258, 2, 393, 641] -[:mouse_move, 198, 252, 2, 394, 642] -[:mouse_move, 196, 248, 2, 395, 643] -[:mouse_move, 194, 245, 2, 396, 644] -[:mouse_move, 192, 242, 2, 397, 645] -[:mouse_move, 191, 240, 2, 398, 646] -[:mouse_move, 189, 238, 2, 399, 647] -[:mouse_move, 189, 237, 2, 400, 648] -[:mouse_move, 188, 237, 2, 401, 649] -[:mouse_move, 187, 237, 2, 402, 658] -[:mouse_move, 187, 236, 2, 403, 659] -[:mouse_move, 188, 235, 2, 404, 663] -[:mouse_move, 191, 234, 2, 405, 664] -[:mouse_move, 215, 232, 2, 406, 665] -[:mouse_move, 234, 231, 2, 407, 666] -[:mouse_move, 280, 226, 2, 408, 667] -[:mouse_move, 305, 224, 2, 409, 668] -[:mouse_move, 360, 220, 2, 410, 669] -[:mouse_move, 372, 220, 2, 411, 670] -[:mouse_move, 417, 219, 2, 412, 671] -[:mouse_move, 438, 219, 2, 413, 672] -[:mouse_move, 458, 219, 2, 414, 673] -[:mouse_move, 493, 220, 2, 415, 674] -[:mouse_move, 509, 220, 2, 416, 675] -[:mouse_move, 536, 221, 2, 417, 676] -[:mouse_move, 548, 222, 2, 418, 677] -[:mouse_move, 573, 223, 2, 419, 678] -[:mouse_move, 585, 225, 2, 420, 679] -[:mouse_move, 610, 226, 2, 421, 680] -[:mouse_move, 616, 227, 2, 422, 681] -[:mouse_move, 640, 228, 2, 423, 682] -[:mouse_move, 659, 228, 2, 424, 683] -[:mouse_move, 684, 228, 2, 425, 684] -[:mouse_move, 697, 228, 2, 426, 685] -[:mouse_move, 730, 228, 2, 427, 686] -[:mouse_move, 762, 228, 2, 428, 687] -[:mouse_move, 804, 226, 2, 429, 688] -[:mouse_move, 827, 224, 2, 430, 689] -[:mouse_move, 861, 221, 2, 431, 690] -[:mouse_move, 884, 218, 2, 432, 691] -[:mouse_move, 923, 213, 2, 433, 692] -[:mouse_move, 930, 212, 2, 434, 693] -[:mouse_move, 955, 208, 2, 435, 694] -[:mouse_move, 966, 206, 2, 436, 695] -[:mouse_move, 983, 202, 2, 437, 696] -[:mouse_move, 990, 200, 2, 438, 697] -[:mouse_move, 1004, 197, 2, 439, 698] -[:mouse_move, 1009, 197, 2, 440, 699] -[:mouse_move, 1012, 197, 2, 441, 700] -[:mouse_move, 1025, 197, 2, 442, 701] -[:mouse_move, 1028, 197, 2, 443, 702] -[:mouse_move, 1034, 201, 2, 444, 721] -[:mouse_move, 1036, 203, 2, 445, 722] -[:mouse_move, 1041, 208, 2, 446, 723] -[:mouse_move, 1044, 212, 2, 447, 724] -[:mouse_move, 1051, 222, 2, 448, 725] -[:mouse_move, 1054, 229, 2, 449, 726] -[:mouse_move, 1057, 236, 2, 450, 727] -[:mouse_move, 1061, 245, 2, 451, 728] -[:mouse_move, 1064, 254, 2, 452, 729] -[:mouse_move, 1067, 262, 2, 453, 730] -[:mouse_move, 1068, 264, 2, 454, 731] -[:mouse_move, 1070, 270, 2, 455, 732] -[:mouse_move, 1071, 272, 2, 456, 733] -[:mouse_move, 1072, 275, 2, 457, 734] -[:mouse_move, 1072, 277, 2, 458, 735] -[:mouse_move, 1073, 278, 2, 459, 736] -[:mouse_move, 1074, 279, 2, 460, 737] -[:mouse_move, 1075, 280, 2, 461, 738] -[:mouse_move, 1077, 281, 2, 462, 739] -[:mouse_move, 1078, 282, 2, 463, 740] -[:mouse_move, 1080, 282, 2, 464, 741] -[:mouse_move, 1082, 282, 2, 465, 742] -[:mouse_move, 1083, 282, 2, 466, 743] -[:mouse_move, 1084, 282, 2, 467, 744] -[:mouse_move, 1085, 281, 2, 468, 746] -[:mouse_move, 1085, 280, 2, 469, 747] -[:mouse_move, 1086, 280, 2, 470, 748] -[:mouse_move, 1086, 279, 2, 471, 749] -[:mouse_move, 1086, 278, 2, 472, 750] -[:mouse_move, 1087, 278, 2, 473, 751] -[:mouse_move, 1088, 278, 2, 474, 755] -[:mouse_move, 1086, 276, 2, 475, 759] -[:mouse_move, 1082, 273, 2, 476, 760] -[:mouse_move, 1058, 257, 2, 477, 761] -[:mouse_move, 1040, 246, 2, 478, 762] -[:mouse_move, 995, 214, 2, 479, 763] -[:mouse_move, 968, 195, 2, 480, 764] -[:mouse_move, 915, 163, 2, 481, 765] -[:mouse_move, 887, 148, 2, 482, 766] -[:mouse_move, 853, 131, 2, 483, 767] -[:mouse_move, 833, 122, 2, 484, 768] -[:mouse_move, 794, 105, 2, 485, 769] -[:mouse_move, 776, 99, 2, 486, 770] -[:mouse_move, 739, 87, 2, 487, 771] -[:mouse_move, 723, 83, 2, 488, 772] -[:mouse_move, 690, 76, 2, 489, 773] -[:mouse_move, 674, 73, 2, 490, 774] -[:mouse_move, 627, 69, 2, 491, 775] -[:mouse_move, 607, 69, 2, 492, 776] -[:mouse_move, 573, 69, 2, 493, 777] -[:mouse_move, 554, 69, 2, 494, 778] -[:mouse_move, 519, 69, 2, 495, 779] -[:mouse_move, 504, 69, 2, 496, 780] -[:mouse_move, 484, 68, 2, 497, 781] -[:mouse_move, 473, 67, 2, 498, 782] -[:mouse_move, 462, 67, 2, 499, 783] -[:mouse_move, 445, 66, 2, 500, 784] -[:mouse_move, 430, 66, 2, 501, 785] -[:mouse_move, 410, 66, 2, 502, 786] -[:mouse_move, 396, 66, 2, 503, 787] -[:mouse_move, 367, 68, 2, 504, 788] -[:mouse_move, 352, 69, 2, 505, 789] -[:mouse_move, 321, 73, 2, 506, 790] -[:mouse_move, 307, 75, 2, 507, 791] -[:mouse_move, 274, 79, 2, 508, 792] -[:mouse_move, 258, 81, 2, 509, 793] -[:mouse_move, 248, 82, 2, 510, 794] -[:mouse_move, 239, 83, 2, 511, 795] -[:mouse_move, 231, 84, 2, 512, 796] -[:mouse_move, 228, 84, 2, 513, 797] -[:mouse_move, 225, 84, 2, 514, 798] -[:mouse_move, 224, 84, 2, 515, 800] -[:mouse_move, 221, 85, 2, 516, 802] -[:mouse_move, 217, 85, 2, 517, 803] -[:mouse_move, 209, 86, 2, 518, 804] -[:mouse_move, 204, 86, 2, 519, 805] -[:mouse_move, 199, 87, 2, 520, 806] -[:mouse_move, 193, 88, 2, 521, 807] -[:mouse_move, 186, 88, 2, 522, 808] -[:mouse_move, 179, 89, 2, 523, 809] -[:mouse_move, 178, 89, 2, 524, 810] -[:mouse_move, 173, 89, 2, 525, 811] -[:mouse_move, 172, 89, 2, 526, 812] -[:mouse_move, 171, 89, 2, 527, 813] -[:mouse_move, 170, 89, 2, 528, 814] -[:mouse_move, 173, 89, 2, 529, 819] -[:mouse_move, 178, 89, 2, 530, 820] -[:mouse_move, 184, 89, 2, 531, 821] -[:mouse_move, 189, 88, 2, 532, 822] -[:mouse_move, 199, 88, 2, 533, 823] -[:mouse_move, 209, 88, 2, 534, 824] -[:mouse_move, 226, 86, 2, 535, 825] -[:mouse_move, 236, 85, 2, 536, 826] -[:mouse_move, 261, 84, 2, 537, 827] -[:mouse_move, 267, 83, 2, 538, 828] -[:mouse_move, 287, 83, 2, 539, 829] -[:mouse_move, 296, 83, 2, 540, 830] -[:mouse_move, 318, 83, 2, 541, 831] -[:mouse_move, 328, 84, 2, 542, 832] -[:mouse_move, 341, 85, 2, 543, 833] -[:mouse_move, 350, 86, 2, 544, 834] -[:mouse_move, 359, 86, 2, 545, 835] -[:mouse_move, 368, 87, 2, 546, 836] -[:mouse_move, 376, 88, 2, 547, 837] -[:mouse_move, 390, 88, 2, 548, 838] -[:mouse_move, 394, 88, 2, 549, 839] -[:mouse_move, 408, 88, 2, 550, 840] -[:mouse_move, 415, 88, 2, 551, 841] -[:mouse_move, 428, 87, 2, 552, 842] -[:mouse_move, 436, 87, 2, 553, 843] -[:mouse_move, 458, 86, 2, 554, 844] -[:mouse_move, 468, 85, 2, 555, 845] -[:mouse_move, 496, 82, 2, 556, 846] -[:mouse_move, 523, 79, 2, 557, 847] -[:mouse_move, 539, 77, 2, 558, 848] -[:mouse_move, 564, 74, 2, 559, 849] -[:mouse_move, 592, 71, 2, 560, 850] -[:mouse_move, 605, 70, 2, 561, 851] -[:mouse_move, 631, 69, 2, 562, 852] -[:mouse_move, 646, 69, 2, 563, 853] -[:mouse_move, 672, 69, 2, 564, 854] -[:mouse_move, 677, 69, 2, 565, 855] -[:mouse_move, 705, 69, 2, 566, 856] -[:mouse_move, 709, 69, 2, 567, 857] -[:mouse_move, 730, 69, 2, 568, 858] -[:mouse_move, 745, 70, 2, 569, 859] -[:mouse_move, 769, 71, 2, 570, 860] -[:mouse_move, 784, 72, 2, 571, 861] -[:mouse_move, 814, 73, 2, 572, 862] -[:mouse_move, 830, 73, 2, 573, 863] -[:mouse_move, 846, 73, 2, 574, 864] -[:mouse_move, 876, 74, 2, 575, 865] -[:mouse_move, 892, 74, 2, 576, 866] -[:mouse_move, 923, 76, 2, 577, 867] -[:mouse_move, 940, 78, 2, 578, 868] -[:mouse_move, 972, 81, 2, 579, 869] -[:mouse_move, 986, 82, 2, 580, 870] -[:mouse_move, 1014, 85, 2, 581, 871] -[:mouse_move, 1027, 88, 2, 582, 872] -[:mouse_move, 1043, 90, 2, 583, 873] -[:mouse_move, 1053, 92, 2, 584, 874] -[:mouse_move, 1069, 94, 2, 585, 875] -[:mouse_move, 1075, 95, 2, 586, 876] -[:mouse_move, 1083, 96, 2, 587, 877] -[:mouse_move, 1086, 97, 2, 588, 878] -[:mouse_move, 1091, 97, 2, 589, 879] -[:mouse_move, 1092, 97, 2, 590, 880] -[:mouse_move, 1093, 97, 2, 591, 881] -[:mouse_move, 1094, 97, 2, 592, 883] -[:mouse_move, 1094, 106, 2, 593, 898] -[:mouse_move, 1094, 112, 2, 594, 899] -[:mouse_move, 1094, 136, 2, 595, 900] -[:mouse_move, 1094, 142, 2, 596, 901] -[:mouse_move, 1094, 157, 2, 597, 902] -[:mouse_move, 1094, 165, 2, 598, 903] -[:mouse_move, 1094, 182, 2, 599, 904] -[:mouse_move, 1094, 186, 2, 600, 905] -[:mouse_move, 1094, 197, 2, 601, 906] -[:mouse_move, 1093, 200, 2, 602, 907] -[:mouse_move, 1092, 206, 2, 603, 908] -[:mouse_move, 1092, 208, 2, 604, 909] -[:mouse_move, 1092, 210, 2, 605, 910] -[:mouse_move, 1092, 211, 2, 606, 911] -[:mouse_move, 1092, 212, 2, 607, 912] -[:mouse_move, 1092, 213, 2, 608, 913] -[:mouse_move, 1092, 214, 2, 609, 914] -[:mouse_move, 1092, 215, 2, 610, 915] -[:mouse_move, 1092, 220, 2, 611, 916] -[:mouse_move, 1092, 222, 2, 612, 917] -[:mouse_move, 1092, 226, 2, 613, 918] -[:mouse_move, 1092, 236, 2, 614, 919] -[:mouse_move, 1092, 239, 2, 615, 920] -[:mouse_move, 1091, 245, 2, 616, 921] -[:mouse_move, 1091, 248, 2, 617, 922] -[:mouse_move, 1091, 252, 2, 618, 923] -[:mouse_move, 1091, 253, 2, 619, 924] -[:mouse_move, 1091, 255, 2, 620, 925] -[:mouse_move, 1091, 256, 2, 621, 926] -[:mouse_move, 1091, 257, 2, 622, 927] -[:mouse_move, 1091, 258, 2, 623, 928] -[:mouse_move, 1091, 259, 2, 624, 931] -[:mouse_move, 1091, 260, 2, 625, 941] -[:mouse_move, 1091, 261, 2, 626, 942] -[:mouse_move, 1091, 262, 2, 627, 943] -[:mouse_move, 1091, 263, 2, 628, 944] -[:mouse_move, 1091, 264, 2, 629, 945] -[:mouse_move, 1091, 265, 2, 630, 947] -[:mouse_move, 1091, 266, 2, 631, 948] -[:mouse_move, 1091, 267, 2, 632, 949] -[:mouse_move, 1091, 268, 2, 633, 951] -[:mouse_button_pressed, 1, 0, 1, 634, 952] -[:mouse_button_up, 1, 0, 1, 635, 960] -[:mouse_move, 1090, 268, 2, 636, 1062] -[:mouse_move, 1089, 269, 2, 637, 1063] -[:mouse_move, 1084, 271, 2, 638, 1064] -[:mouse_move, 1079, 272, 2, 639, 1065] -[:mouse_move, 1070, 277, 2, 640, 1066] -[:mouse_move, 1065, 279, 2, 641, 1067] -[:mouse_move, 1060, 282, 2, 642, 1068] -[:mouse_move, 1057, 283, 2, 643, 1069] -[:mouse_move, 1053, 286, 2, 644, 1070] -[:mouse_move, 1052, 286, 2, 645, 1071] -[:mouse_move, 1052, 287, 2, 646, 1072] -[:mouse_move, 1051, 287, 2, 647, 1073] -[:mouse_move, 1051, 288, 2, 648, 1074] -[:mouse_move, 1051, 289, 2, 649, 1078] -[:key_down_raw, 115, 0, 2, 650, 1083] -[:key_up_raw, 115, 0, 2, 651, 1088] -[:mouse_move, 1050, 289, 2, 652, 1096] -[:mouse_move, 1042, 294, 2, 653, 1097] -[:mouse_move, 1032, 300, 2, 654, 1098] -[:mouse_move, 979, 325, 2, 655, 1099] -[:mouse_move, 945, 339, 2, 656, 1100] -[:mouse_move, 803, 383, 2, 657, 1101] -[:mouse_move, 722, 403, 2, 658, 1102] -[:mouse_move, 535, 441, 2, 659, 1103] -[:mouse_move, 441, 454, 2, 660, 1104] -[:mouse_move, 311, 467, 2, 661, 1105] -[:mouse_move, 279, 469, 2, 662, 1106] -[:mouse_move, 214, 470, 2, 663, 1107] -[:mouse_move, 149, 469, 2, 664, 1108] -[:mouse_move, 115, 464, 2, 665, 1109] -[:mouse_move, 98, 459, 2, 666, 1110] -[:mouse_move, 84, 456, 2, 667, 1111] -[:mouse_move, 70, 451, 2, 668, 1112] -[:mouse_move, 67, 449, 2, 669, 1113] -[:mouse_move, 64, 447, 2, 670, 1114] -[:mouse_move, 64, 446, 2, 671, 1115] -[:mouse_move, 63, 446, 2, 672, 1116] -[:mouse_move, 63, 445, 2, 673, 1117] -[:mouse_move, 64, 445, 2, 674, 1121] -[:mouse_move, 71, 445, 2, 675, 1122] -[:mouse_move, 78, 445, 2, 676, 1123] -[:mouse_move, 96, 449, 2, 677, 1124] -[:mouse_move, 101, 451, 2, 678, 1125] -[:mouse_move, 113, 455, 2, 679, 1126] -[:mouse_move, 118, 457, 2, 680, 1127] -[:mouse_move, 124, 460, 2, 681, 1128] -[:mouse_move, 126, 460, 2, 682, 1129] -[:mouse_move, 127, 461, 2, 683, 1130] -[:mouse_move, 128, 461, 2, 684, 1131] -[:mouse_move, 128, 462, 2, 685, 1132] -[:mouse_button_pressed, 1, 0, 1, 686, 1137] -[:mouse_button_up, 1, 0, 1, 687, 1145] -[:mouse_move, 128, 457, 2, 688, 1155] -[:mouse_move, 128, 451, 2, 689, 1156] -[:mouse_move, 128, 420, 2, 690, 1157] -[:mouse_move, 128, 397, 2, 691, 1158] -[:mouse_move, 128, 334, 2, 692, 1159] -[:mouse_move, 128, 298, 2, 693, 1160] -[:mouse_move, 128, 282, 2, 694, 1161] -[:mouse_move, 128, 231, 2, 695, 1162] -[:mouse_move, 128, 222, 2, 696, 1163] -[:mouse_move, 128, 192, 2, 697, 1164] -[:mouse_move, 127, 178, 2, 698, 1165] -[:mouse_move, 126, 172, 2, 699, 1166] -[:mouse_move, 126, 168, 2, 700, 1167] -[:mouse_move, 125, 163, 2, 701, 1168] -[:mouse_move, 125, 162, 2, 702, 1169] -[:mouse_move, 124, 161, 2, 703, 1170] -[:mouse_move, 124, 160, 2, 704, 1171] -[:mouse_move, 123, 160, 2, 705, 1173] -[:mouse_button_pressed, 1, 0, 1, 706, 1177] -[:mouse_button_up, 1, 0, 1, 707, 1186] -[:mouse_move, 126, 160, 2, 708, 1190] -[:mouse_move, 149, 160, 2, 709, 1191] -[:mouse_move, 187, 160, 2, 710, 1192] -[:mouse_move, 240, 156, 2, 711, 1193] -[:mouse_move, 274, 150, 2, 712, 1194] -[:mouse_move, 294, 146, 2, 713, 1195] -[:mouse_move, 311, 141, 2, 714, 1196] -[:mouse_move, 324, 139, 2, 715, 1197] -[:mouse_move, 329, 137, 2, 716, 1198] -[:mouse_move, 335, 136, 2, 717, 1199] -[:mouse_button_pressed, 1, 0, 1, 718, 1208] -[:mouse_button_up, 1, 0, 1, 719, 1217] -[:mouse_move, 331, 149, 2, 720, 1220] -[:mouse_move, 325, 159, 2, 721, 1221] -[:mouse_move, 285, 225, 2, 722, 1222] -[:mouse_move, 238, 300, 2, 723, 1223] -[:mouse_move, 159, 435, 2, 724, 1224] -[:mouse_move, 137, 471, 2, 725, 1225] -[:mouse_move, 82, 563, 2, 726, 1226] -[:mouse_move, 51, 612, 2, 727, 1227] -[:mouse_move, 39, 634, 2, 728, 1228] -[:mouse_move, 28, 654, 2, 729, 1229] -[:key_down_raw, 1073741903, 0, 2, 730, 1293] -[:key_down_raw, 1073741903, 0, 2, 731, 1317] -[:key_down_raw, 1073741903, 0, 2, 732, 1319] -[:key_down_raw, 1073741903, 0, 2, 733, 1321] -[:key_down_raw, 1073741903, 0, 2, 734, 1323] -[:key_down_raw, 1073741903, 0, 2, 735, 1325] -[:key_down_raw, 1073741903, 0, 2, 736, 1327] -[:key_down_raw, 1073741903, 0, 2, 737, 1330] -[:key_down_raw, 1073741903, 0, 2, 738, 1332] -[:key_down_raw, 1073741903, 0, 2, 739, 1334] -[:key_down_raw, 1073741903, 0, 2, 740, 1336] -[:key_down_raw, 1073741903, 0, 2, 741, 1338] -[:key_down_raw, 1073741903, 0, 2, 742, 1340] -[:key_up_raw, 1073741903, 0, 2, 743, 1341] -[:key_down_raw, 1073741904, 0, 2, 744, 1341] -[:key_down_raw, 1073741903, 0, 2, 745, 1366] -[:key_up_raw, 1073741904, 0, 2, 746, 1369] -[:key_down_raw, 1073741903, 0, 2, 747, 1391] -[:key_down_raw, 1073741903, 0, 2, 748, 1393] -[:key_down_raw, 1073741903, 0, 2, 749, 1395] -[:key_down_raw, 1073741904, 0, 2, 750, 1397] -[:key_up_raw, 1073741903, 0, 2, 751, 1398] -[:key_down_raw, 32, 0, 2, 752, 1417] -[:key_down_raw, 1073741903, 0, 2, 753, 1420] -[:key_up_raw, 1073741904, 0, 2, 754, 1421] -[:key_down_raw, 1073741904, 0, 2, 755, 1437] -[:key_up_raw, 1073741903, 0, 2, 756, 1438] -[:key_down_raw, 1073741904, 0, 2, 757, 1462] -[:key_down_raw, 1073741904, 0, 2, 758, 1464] -[:key_down_raw, 1073741904, 0, 2, 759, 1466] -[:key_down_raw, 1073741904, 0, 2, 760, 1468] -[:key_down_raw, 1073741904, 0, 2, 761, 1470] -[:key_down_raw, 1073741904, 0, 2, 762, 1472] -[:key_down_raw, 1073741904, 0, 2, 763, 1474] -[:key_down_raw, 1073741903, 0, 2, 764, 1475] -[:key_up_raw, 1073741904, 0, 2, 765, 1490] -[:key_down_raw, 1073741903, 0, 2, 766, 1500] -[:key_down_raw, 1073741903, 0, 2, 767, 1502] -[:key_down_raw, 1073741903, 0, 2, 768, 1504] -[:key_down_raw, 1073741903, 0, 2, 769, 1506] -[:key_down_raw, 1073741903, 0, 2, 770, 1508] -[:key_down_raw, 1073741903, 0, 2, 771, 1510] -[:key_down_raw, 1073741903, 0, 2, 772, 1512] -[:key_up_raw, 32, 0, 2, 773, 1514] -[:key_down_raw, 1073741903, 0, 2, 774, 1514] -[:key_down_raw, 1073741903, 0, 2, 775, 1516] -[:key_up_raw, 1073741903, 0, 2, 776, 1516] -[:mouse_move, 30, 645, 2, 777, 1626] -[:mouse_move, 51, 614, 2, 778, 1627] -[:mouse_move, 61, 599, 2, 779, 1628] -[:mouse_move, 84, 572, 2, 780, 1629] -[:mouse_move, 95, 562, 2, 781, 1630] -[:mouse_move, 110, 552, 2, 782, 1631] -[:mouse_move, 122, 543, 2, 783, 1632] -[:mouse_move, 132, 538, 2, 784, 1633] -[:mouse_move, 137, 536, 2, 785, 1634] -[:mouse_move, 142, 534, 2, 786, 1635] -[:mouse_move, 143, 534, 2, 787, 1636] -[:mouse_move, 144, 534, 2, 788, 1637] -[:mouse_move, 144, 533, 2, 789, 1641] -[:mouse_move, 144, 532, 2, 790, 1642] -[:mouse_move, 145, 527, 2, 791, 1643] -[:mouse_move, 147, 522, 2, 792, 1644] -[:mouse_move, 157, 500, 2, 793, 1645] -[:mouse_move, 160, 493, 2, 794, 1646] -[:mouse_move, 168, 478, 2, 795, 1647] -[:mouse_move, 169, 474, 2, 796, 1648] -[:mouse_move, 175, 463, 2, 797, 1649] -[:mouse_move, 177, 460, 2, 798, 1650] -[:mouse_move, 179, 455, 2, 799, 1651] -[:mouse_move, 179, 453, 2, 800, 1652] -[:mouse_move, 179, 451, 2, 801, 1653] -[:mouse_move, 179, 448, 2, 802, 1654] -[:mouse_move, 179, 447, 2, 803, 1655] -[:mouse_move, 179, 445, 2, 804, 1656] -[:mouse_move, 178, 444, 2, 805, 1657] -[:mouse_move, 177, 443, 2, 806, 1658] -[:mouse_move, 175, 441, 2, 807, 1660] -[:mouse_move, 174, 440, 2, 808, 1661] -[:mouse_move, 173, 438, 2, 809, 1662] -[:mouse_move, 172, 437, 2, 810, 1664] -[:mouse_move, 171, 437, 2, 811, 1666] -[:mouse_button_pressed, 1, 0, 1, 812, 1674] -[:mouse_button_up, 1, 0, 1, 813, 1681] -[:key_down_raw, 1073742051, 1024, 2, 814, 1894] -[:key_down_raw, 113, 1024, 2, 815, 1896] diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image1.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image1.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image1.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image10.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image10.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image10.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image11.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image11.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image11.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image12.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image12.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image12.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image13.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image13.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image13.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image14.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image14.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image14.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image15.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image15.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image15.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image16.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image16.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image16.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image17.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image17.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image17.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image18.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image18.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image18.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image19.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image19.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image19.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image2.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image2.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image2.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image20.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image20.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image20.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image3.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image3.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image3.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image4.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image4.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image4.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image5.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image5.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image5.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image6.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image6.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image6.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image7.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image7.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image7.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image8.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image8.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image8.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image9.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/image9.png deleted file mode 100644 index b0eb399..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/image9.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_box_collision_2/sprites/player.png b/samples/04_physics_and_collisions/04_box_collision_2/sprites/player.png deleted file mode 100644 index 4c733a2..0000000 Binary files a/samples/04_physics_and_collisions/04_box_collision_2/sprites/player.png and /dev/null differ diff --git a/samples/04_physics_and_collisions/04_jump_physics/app/main.rb b/samples/04_physics_and_collisions/04_jump_physics/app/main.rb deleted file mode 100644 index 3fcb9e9..0000000 --- a/samples/04_physics_and_collisions/04_jump_physics/app/main.rb +++ /dev/null @@ -1,196 +0,0 @@ -=begin - - Reminders: - - - 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.) - - - args.outputs.solids: An array. The values generate a solid. - The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - - - num1.greater(num2): Returns the greater value. - - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. - - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. - -=end - -# This sample app is a game that requires the user to jump from one platform to the next. -# As the player successfully clears platforms, they become smaller and move faster. - -class VerticalPlatformer - attr_gtk - - # declares vertical platformer as new entity - def s - state.vertical_platformer ||= state.new_entity(:vertical_platformer) - state.vertical_platformer - end - - # creates a new platform using a hash - def new_platform hash - s.new_entity_strict(:platform, hash) # platform key - end - - # calls methods needed for game to run properly - def tick - defaults - render - calc - input - end - - # Sets default values - def defaults - s.platforms ||= [ # initializes platforms collection with two platforms using hashes - new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), - new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher - ] - - s.tick_count = args.state.tick_count - s.gravity = -0.3 # what goes up must come down because of gravity - s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared - s.player.x ||= 0 # sets player values - s.player.y ||= 100 - s.player.w ||= 64 - s.player.h ||= 64 - s.player.dy ||= 0 # change in position - s.player.dx ||= 0 - s.player_jump_power = 15 - s.player_jump_power_duration = 10 - s.player_max_run_speed = 5 - s.player_speed_slowdown_rate = 0.9 - s.player_acceleration = 1 - s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) - end - - # Outputs objects onto the screen - def render - outputs.solids << s.platforms.map do |p| # outputs platforms onto screen - [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center - # don't forget, position of platform is denoted by bottom left hand corner - end - - # outputs player using hash - outputs.solids << { - x: s.player.x + 300, # player positioned on top of platform - y: s.player.y - s.camera[:y], - w: s.player.w, - h: s.player.h, - r: 100, # color saturation - g: 100, - b: 200 - } - end - - # Performs calculations - def calc - s.platforms.each do |p| # for each platform in the collection - p.rect = [p.x, p.y, p.w, p.h] # set the definition - end - - # sets player point by adding half the player's width to the player's x - s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! - - # search the platforms collection to find if the player's point is inside the rect of a platform - collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } - - # if collision occurred and player is moving down (or not moving vertically at all) - if collision && s.player.dy <= 0 - s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform - s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically - if !s.player.platform - s.player.dx = 0 # no horizontal movement - end - # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x - s.player.x += collision.dx * collision.speed - s.player.platform = collision # player is on the platform that it collided with (or landed on) - if s.player.falling # if player is falling - s.player.dx = 0 # no horizontal movement - end - s.player.falling = false - s.player.jumped_at = nil - else - s.player.platform = nil # player is not on a platform - s.player.y += s.player.dy # velocity is the change in position - s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down - end - - s.platforms.each do |p| # for each platform in the collection - p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) - # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) - if p.x < -300 # if platform goes too far left - p.dx *= -1 # dx is scaled down - p.x = -300 # as far left as possible within scope - elsif p.x > (1000 - p.w) # if platform's x is greater than 300 - p.dx *= -1 - p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) - end - end - - delta = (s.player.y - s.camera[:y] - 100) # used to position camera view - - if delta > -200 - s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards - s.player.x += s.player.dx # velocity is change in position; change in x increases by dx - - # searches platform collection to find platforms located more than 300 pixels above the player - has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } - if !has_platforms # if there are no platforms 300 pixels above the player - width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous - s.player.platforms_cleared += 1 # player successfully cleared another platform - last_platform = s.platforms[-1] # platform just cleared becomes last platform - # another platform is created 300 pixels above the last platform, and this - # new platform has a smaller width and moves faster than all previous platforms - s.platforms << new_platform(x: (700 - width) * rand, # random x position - y: last_platform.y + 300, - w: width, - h: 32, - dx: 1.randomize(:sign), # random change in x - speed: 2 * s.player.platforms_cleared, - rect: nil) - end - else - s.as_hash.clear # otherwise clear the hash (no new platform is necessary) - end - end - - # Takes input from the user to move the player - def input - if inputs.keyboard.space # if the space bar is pressed - s.player.jumped_at ||= s.tick_count # set to current frame - - # if the time that has passed since the jump is less than the duration of a jump (10 frames) - # and the player is not falling - if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling - s.player.dy = s.player_jump_power # player jumps up - end - end - - if inputs.keyboard.key_up.space # if space bar is in "up" state - s.player.falling = true # player is falling - end - - if inputs.keyboard.left # if left key is pressed - s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration - s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater - elsif inputs.keyboard.right # if right key is pressed - s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration - s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser - else - s.player.dx *= s.player_speed_slowdown_rate # scales dx down - end - end -end - -$game = VerticalPlatformer.new - -def tick args - $game.args = args - $game.tick -end diff --git a/samples/04_physics_and_collisions/04_jump_physics/replay.txt b/samples/04_physics_and_collisions/04_jump_physics/replay.txt deleted file mode 100644 index 966dbcd..0000000 --- a/samples/04_physics_and_collisions/04_jump_physics/replay.txt +++ /dev/null @@ -1,124 +0,0 @@ -replay_version 2.0 -stopped_at 1260 -seed 100 -recorded_at Sun Sep 29 22:23:22 2019 -[:key_down_raw, 1073741903, 0, 2, 1, 45] -[:key_down_raw, 1073741903, 0, 2, 2, 70] -[:key_down_raw, 1073741903, 0, 2, 3, 72] -[:key_down_raw, 1073741903, 0, 2, 4, 74] -[:key_down_raw, 1073741903, 0, 2, 5, 76] -[:key_down_raw, 1073741903, 0, 2, 6, 78] -[:key_down_raw, 1073741903, 0, 2, 7, 80] -[:key_down_raw, 1073741903, 0, 2, 8, 82] -[:key_down_raw, 1073741903, 0, 2, 9, 84] -[:key_down_raw, 1073741903, 0, 2, 10, 86] -[:key_down_raw, 1073741903, 0, 2, 11, 88] -[:key_up_raw, 1073741903, 0, 2, 12, 89] -[:key_down_raw, 1073741904, 0, 2, 13, 92] -[:key_down_raw, 1073741903, 0, 2, 14, 112] -[:key_up_raw, 1073741904, 0, 2, 15, 115] -[:key_down_raw, 1073741903, 0, 2, 16, 137] -[:key_down_raw, 1073741903, 0, 2, 17, 139] -[:key_down_raw, 8, 0, 2, 18, 141] -[:key_up_raw, 1073741903, 0, 2, 19, 146] -[:key_down_raw, 1073741903, 0, 2, 20, 147] -[:key_up_raw, 1073741903, 0, 2, 21, 147] -[:key_down_raw, 1073741904, 0, 2, 22, 154] -[:key_up_raw, 8, 0, 2, 23, 172] -[:key_down_raw, 1073741903, 0, 2, 24, 175] -[:key_up_raw, 1073741904, 0, 2, 25, 175] -[:key_down_raw, 32, 0, 2, 26, 194] -[:key_down_raw, 1073741904, 0, 2, 27, 201] -[:key_up_raw, 1073741903, 0, 2, 28, 202] -[:key_down_raw, 1073741903, 0, 2, 29, 222] -[:key_up_raw, 1073741904, 0, 2, 30, 226] -[:key_up_raw, 32, 0, 2, 31, 233] -[:key_down_raw, 1073741903, 0, 2, 32, 247] -[:key_down_raw, 1073741903, 0, 2, 33, 249] -[:key_down_raw, 1073741903, 0, 2, 34, 251] -[:key_down_raw, 1073741903, 0, 2, 35, 253] -[:key_down_raw, 1073741903, 0, 2, 36, 255] -[:key_down_raw, 1073741903, 0, 2, 37, 257] -[:key_down_raw, 1073741903, 0, 2, 38, 259] -[:key_down_raw, 1073741903, 0, 2, 39, 261] -[:key_down_raw, 1073741903, 0, 2, 40, 263] -[:key_down_raw, 1073741903, 0, 2, 41, 265] -[:key_down_raw, 1073741903, 0, 2, 42, 267] -[:key_down_raw, 1073741903, 0, 2, 43, 269] -[:key_down_raw, 1073741903, 0, 2, 44, 271] -[:key_down_raw, 1073741903, 0, 2, 45, 273] -[:key_down_raw, 1073741903, 0, 2, 46, 275] -[:key_up_raw, 1073741903, 0, 2, 47, 276] -[:key_down_raw, 1073741904, 0, 2, 48, 280] -[:key_up_raw, 1073741904, 0, 2, 49, 297] -[:key_down_raw, 1073741903, 0, 2, 50, 300] -[:key_down_raw, 32, 0, 2, 51, 303] -[:key_up_raw, 32, 0, 2, 52, 308] -[:key_up_raw, 1073741903, 0, 2, 53, 334] -[:key_down_raw, 1073741904, 0, 2, 54, 336] -[:key_down_raw, 1073741903, 0, 2, 55, 355] -[:key_up_raw, 1073741904, 0, 2, 56, 355] -[:key_up_raw, 1073741903, 0, 2, 57, 373] -[:key_down_raw, 1073741904, 0, 2, 58, 380] -[:key_down_raw, 32, 0, 2, 59, 398] -[:key_up_raw, 32, 0, 2, 60, 404] -[:key_up_raw, 1073741904, 0, 2, 61, 490] -[:key_down_raw, 32, 0, 2, 62, 510] -[:key_up_raw, 32, 0, 2, 63, 516] -[:key_down_raw, 1073741903, 0, 2, 64, 517] -[:key_up_raw, 1073741903, 0, 2, 65, 537] -[:key_down_raw, 1073741904, 0, 2, 66, 538] -[:key_up_raw, 1073741904, 0, 2, 67, 553] -[:key_down_raw, 32, 0, 2, 68, 653] -[:key_up_raw, 32, 0, 2, 69, 659] -[:key_down_raw, 1073741903, 0, 2, 70, 661] -[:key_down_raw, 1073741903, 0, 2, 71, 686] -[:key_up_raw, 1073741903, 0, 2, 72, 687] -[:key_down_raw, 1073741904, 0, 2, 73, 690] -[:key_down_raw, 1073741904, 0, 2, 74, 715] -[:key_down_raw, 1073741904, 0, 2, 75, 717] -[:key_down_raw, 1073741904, 0, 2, 76, 719] -[:key_down_raw, 1073741904, 0, 2, 77, 721] -[:key_down_raw, 1073741904, 0, 2, 78, 723] -[:key_down_raw, 1073741904, 0, 2, 79, 725] -[:key_down_raw, 1073741904, 0, 2, 80, 727] -[:key_down_raw, 1073741904, 0, 2, 81, 729] -[:key_up_raw, 1073741904, 0, 2, 82, 731] -[:key_down_raw, 1073741903, 0, 2, 83, 740] -[:key_down_raw, 32, 0, 2, 84, 749] -[:key_up_raw, 32, 0, 2, 85, 756] -[:key_up_raw, 1073741903, 0, 2, 86, 789] -[:key_down_raw, 1073741904, 0, 2, 87, 792] -[:key_down_raw, 1073741904, 0, 2, 88, 817] -[:key_up_raw, 1073741904, 0, 2, 89, 817] -[:key_down_raw, 32, 0, 2, 90, 844] -[:key_down_raw, 1073741903, 0, 2, 91, 846] -[:key_up_raw, 32, 0, 2, 92, 852] -[:key_down_raw, 1073741903, 0, 2, 93, 871] -[:key_down_raw, 1073741903, 0, 2, 94, 873] -[:key_down_raw, 1073741903, 0, 2, 95, 875] -[:key_down_raw, 1073741903, 0, 2, 96, 877] -[:key_down_raw, 1073741903, 0, 2, 97, 879] -[:key_down_raw, 1073741903, 0, 2, 98, 881] -[:key_down_raw, 1073741903, 0, 2, 99, 883] -[:key_down_raw, 1073741903, 0, 2, 100, 885] -[:key_down_raw, 1073741903, 0, 2, 101, 887] -[:key_up_raw, 1073741903, 0, 2, 102, 887] -[:key_down_raw, 1073741904, 0, 2, 103, 897] -[:key_up_raw, 1073741904, 0, 2, 104, 901] -[:key_down_raw, 32, 0, 2, 105, 948] -[:key_up_raw, 32, 0, 2, 106, 953] -[:key_down_raw, 1073741904, 0, 2, 107, 977] -[:key_up_raw, 1073741904, 0, 2, 108, 991] -[:key_down_raw, 32, 0, 2, 109, 1056] -[:key_up_raw, 32, 0, 2, 110, 1060] -[:key_down_raw, 1073741904, 0, 2, 111, 1065] -[:key_down_raw, 1073741904, 0, 2, 112, 1090] -[:key_down_raw, 1073741904, 0, 2, 113, 1092] -[:key_down_raw, 1073741904, 0, 2, 114, 1094] -[:key_down_raw, 1073741904, 0, 2, 115, 1096] -[:key_up_raw, 1073741904, 0, 2, 116, 1098] -[:key_down_raw, 1073741903, 0, 2, 117, 1108] -[:key_up_raw, 1073741903, 0, 2, 118, 1127] -[:key_down_raw, 1073742051, 1024, 2, 119, 1258] -[:key_down_raw, 113, 1024, 2, 120, 1259] diff --git a/samples/04_physics_and_collisions/05_box_collision_2/app/main.rb b/samples/04_physics_and_collisions/05_box_collision_2/app/main.rb new file mode 100644 index 0000000..126759a --- /dev/null +++ b/samples/04_physics_and_collisions/05_box_collision_2/app/main.rb @@ -0,0 +1,470 @@ +=begin + APIs listing that haven't been encountered in previous sample apps: + + - times: Performs an action a specific number of times. + For example, if we said + 5.times puts "Hello DragonRuby", + then we'd see the words "Hello DragonRuby" printed on the console 5 times. + + - split: Divides a string into substrings based on a delimiter. + For example, if we had a command + "DragonRuby is awesome".split(" ") + then the result would be + ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. + + - join: Opposite of split; converts each element of array to a string separated by delimiter. + For example, if we had a command + ["DragonRuby","is","awesome"].join(" ") + then the result would be + "DragonRuby is awesome". + + Reminders: + + - to_s: Returns a string representation of an object. + For example, if we had + 500.to_s + the string "500" would be returned. + Similar to to_i, which returns an integer representation of an object. + + - elapsed_time: How many frames have passed since the click event. + + - args.outputs.labels: An array. Values in the array generate labels on the screen. + The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - inputs.mouse.down: Determines whether or not the mouse is being pressed down. + The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). + + - first: Returns the first element of the array. + + - num1.idiv(num2): Divides two numbers and returns an integer. + + - find_all: Finds all values that satisfy specific requirements. + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + + - reject: Removes elements from a collection if they meet certain requirements. + + - 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. + +=end + +MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map + +class MetroidvaniaStarter + attr_accessor :grid, :inputs, :state, :outputs, :gtk + + # Calls methods needed to run the game properly. + def tick + defaults + render + calc + process_inputs + end + + # Sets all the default variables. + # '||' states that initialization occurs only in the first frame. + def defaults + state.tile_size = 64 + state.gravity = -0.2 + state.player_width = 60 + state.player_height = 64 + state.collision_tolerance = 0.0 + state.previous_tile_size ||= state.tile_size + state.x ||= 0 + state.y ||= 800 + state.dy ||= 0 + state.dx ||= 0 + attempt_load_world_from_file + state.world_lookup ||= { } + state.world_collision_rects ||= [] + state.mode ||= :creating # alternates between :creating and :selecting for sprite selection + state.select_menu ||= [0, 720, 1280, 720] + #=======================================IMPORTANT=======================================# + # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. + # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. + #=======================================================================================# + state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES + state.sprite_coords ||= [] + state.banner_coords ||= [640, 680 + 720] + state.sprite_selected ||= 1 + state.map_saved_at ||= 0 + + # Sets all the cordinate values for the sprite selection screen into a grid + # Displayed when 's' is pressed by player to access sprites + if state.sprite_coords == [] # if sprite_coords is an empty array + count = 1 + temp_x = 165 # sets a starting x and y position for display + temp_y = 500 + 720 + state.sprite_quantity.times do # for the number of sprites you have + state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array + temp_x += 100 # increment temp_x + count += 1 # increment count + if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen + temp_x = 165 # a new row of sprites starts + temp_y -= 75 # new row of sprites starts 75 units lower than the previous row + end + end + end + end + + # Places sprites + def render + + # Sets the x, y, width, height, and image path for each sprite in the world collection. + outputs.sprites << state.world.map do |x, y, sprite| + [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location + y * state.tile_size, + state.tile_size, + state.tile_size, + 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path + end + + # Outputs sprite for the player by setting x, y, width, height, and image path + outputs.sprites << [state.x, + state.y, + state.player_width, + state.player_height,'sprites/player.png'] + + # Outputs labels as primitives in top right of the screen + outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label + outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label + + outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label + outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label + + outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label + + # if the map is saved and less than 120 frames have passed, the label is displayed + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 + outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label + end + + # If player hits 's', following appears + if state.mode == :selecting + # White background for sprite selection + outputs.primitives << [state.select_menu, 255, 255, 255].solid + + # Select tile label at the top of the screen + outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label + + # Places sprites in locations calculated in the defaults function + outputs.primitives << state.sprite_coords.map do |x, y, order| + [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite + end + end + + # Creates sprite following mouse to help indicate which sprite you have selected + # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon + outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, + 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite + end + + # Calls methods that perform calculations + def calc + calc_in_game + calc_sprite_selection + end + + # Calls methods that perform calculations (if in creating mode) + def calc_in_game + return unless state.mode == :creating + calc_world_lookup + calc_player + end + + def calc_world_lookup + # If the tile size isn't equal to the previous tile size, + # the previous tile size is set to the tile size, + # and world_lookup hash is set to empty. + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} + end + + # return if world_lookup is not empty or if world is empty + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 + + # Searches through the world and finds the coordinates that exist + state.world_lookup = {} + state.world.each { |x, y| state.world_lookup[[x, y]] = true } + + # Assigns collision rects for every sprite drawn + state.world_collision_rects = + state.world_lookup + .keys + .map do |coord_x, coord_y| + s = state.tile_size + # Multiplying by s (the size of a tile) ensures that the rect is + # placed exactly where you want it to be placed (causes grid to coordinate) + # How many pixels horizontally across and vertically up and down + x = s * coord_x + y = s * coord_y + { + args: [coord_x, coord_y], + left_right: [x, y + 4, s, s - 6], # hash keys and values + top: [x + 4, y + 6, s - 8, s - 6], + bottom: [x + 1, y - 1, s - 2, s - 8], + } + end + end + + # Calculates movement of player and calls methods that perform collision calculations + def calc_player + state.dy += state.gravity # what goes up must come down because of gravity + calc_box_collision + calc_edge_collision + state.y += state.dy # Since velocity is the change in position, the change in y increases by dy + state.x += state.dx # Ditto line above but dx and x + state.dx *= 0.8 # Scales dx down + end + + # Calls methods that determine whether the player collides with any world_collision_rects. + def calc_box_collision + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key + collision_floor + collision_left + collision_right + collision_ceiling + end + + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. + def collision_floor + return unless state.dy <= 0 # return unless player is going down or is as far down as possible + player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player + + # Runs through all the sprites on the field and finds all intersections between player's + # bottom and the top of a rect. + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless floor_collisions # performs following changes if a collision has occurred + state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top + state.dy = 0 # no change in y because the player's path is blocked + end + + # Finds collisions between the player's left side and the right side of a world_collision_rect. + def collision_left + return unless state.dx < 0 # return unless player is moving left + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and finds all intersections between the player's left side + # and the right side of a rect. + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless left_side_collisions # return unless collision occurred + state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side + state.dx = 0 # no change in x because the player's path is blocked + end + + # Finds collisions between the right side of the player and the left side of a world_collision_rect. + def collision_right + return unless state.dx > 0 # return unless player is moving right + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and finds all intersections between the player's + # right side and the left side of a rect. + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless right_side_collisions # return unless collision occurred + state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) + state.dx = 0 # no change in x because the player's path is blocked + end + + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. + def collision_ceiling + return unless state.dy > 0 # return unless player is moving up + player_rect = [state.x, next_y, state.player_width, state.player_height] + + # Runs through all the sprites on the field and finds all intersections between the player's top + # and the bottom of a rect. + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless ceil_collisions # return unless collision occurred + state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) + state.dy = 0 # no change in y because the player's path is blocked + end + + # Makes sure the player remains within the screen's dimensions. + def calc_edge_collision + # Ensures that player doesn't fall below the map + if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope + state.y = 0 # 0 is the lowest the player can be while staying on the screen + state.dy = 0 + # Ensures player doesn't go insanely high + elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope + state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen + state.dy = 0 + end + + # Ensures that player remains in the horizontal range its supposed to + if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right + state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope + state.dx = 0 + elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left + state.x = 0 # farthest left the player can be while remaining in the screen's scope + state.dx = 0 + end + end + + def calc_sprite_selection + # Does the transition to bring down the select sprite screen + if state.mode == :selecting && state.select_menu.y != 0 + state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) + state.banner_coords.y = 680 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) + end + end + + # Does the transition to leave the select sprite screen + if state.mode == :creating && state.select_menu.y != 720 + state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) + state.banner_coords.y = 1000 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y + 720, w, h] # sets definition of all elements in collection + end + end + end + + def process_inputs + # If the state.mode is back and if the menu has retreated back up + # call methods that process user inputs + if state.mode == :creating + process_inputs_player_movement + process_inputs_place_tile + end + + # For each sprite_coordinate added, check what sprite was selected + if state.mode == :selecting + state.sprite_coords.map do |x, y, order| # goes through all sprites in collection + # checks that a specific sprite was pressed based on x, y position + if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true + inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and + inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right + inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y + inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up + state.sprite_selected = order # sprite is chosen + end + end + end + + inputs_export_stage + process_inputs_show_available_sprites + end + + # Moves the player based on the keys they press on their keyboard + def process_inputs_player_movement + # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) + if inputs.keyboard.key_up.right + state.dx = 0 + elsif inputs.keyboard.key_up.left + state.dx = 0 + end + + # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys + if inputs.keyboard.key_held.right + state.dx = 3 + elsif inputs.keyboard.key_held.left + state.dx = -3 + end + + # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard + if inputs.keyboard.key_held.space + state.dy = 5 + end + end + + # Adds tile in the place the user holds down the mouse + def process_inputs_place_tile + if inputs.mouse.down # if mouse is pressed + state.world_lookup = {} + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + + # Checks if any coordinates duplicate (already exist in world) + if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } + #erases existing tile space by rejecting them from world + state.world = state.world.reject do |existing_x, existing_y, n| + existing_x == x && existing_y == y + end + else + state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite + end + end + end + + # Stores/exports world collection's info (coordinates, sprite number) into a file + def inputs_export_stage + if inputs.keyboard.key_down.e # if "e" is pressed + export_string = state.world.map do |x, y, sprite_number| # stores world info in a string + "#{x},#{y},#{sprite_number}" # using string interpolation + end + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file + state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved + end + end + + def process_inputs_show_available_sprites + # Based on keyboard input, the entity (:creating and :selecting) switch + if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating + state.mode = :selecting # will change to selecting + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting + state.mode = :creating # will change to creating + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + end + end + + # Loads the world collection by reading from the map.txt file in the app folder + def attempt_load_world_from_file + return if state.world # return if the world collection is already populated + state.world ||= [] # initialized as an empty collection + exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code + return unless exported_world # return unless the file read was successful + state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world + l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, + # calling to_i (converts to integers) on each element + end + end + + # Adds the change in y to y to determine the next y position of the player. + def next_y + state.y + state.dy + end + + # Determines next x position of player + def next_x + if state.dx < 0 # if the player moves left + return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) + else + return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) + end + end + + def to_coord point + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size + # later and huzzah. Grid coordinates + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + end +end + +$metroidvania_starter = MetroidvaniaStarter.new + +def tick args + $metroidvania_starter.grid = args.grid + $metroidvania_starter.inputs = args.inputs + $metroidvania_starter.state = args.state + $metroidvania_starter.outputs = args.outputs + $metroidvania_starter.gtk = args.gtk + $metroidvania_starter.tick +end diff --git a/samples/04_physics_and_collisions/05_box_collision_2/app/map.txt b/samples/04_physics_and_collisions/05_box_collision_2/app/map.txt new file mode 100644 index 0000000..abbc046 --- /dev/null +++ b/samples/04_physics_and_collisions/05_box_collision_2/app/map.txt @@ -0,0 +1,11 @@ +5,7,2 +11,7,2 +15,2,2 +6,5,2 +16,5,2 +13,4,2 +7,2,2 +8,5,2 +8,8,2 +4,6,2 +11,3,2 \ No newline at end of file diff --git a/samples/04_physics_and_collisions/05_box_collision_2/license-for-sample.txt b/samples/04_physics_and_collisions/05_box_collision_2/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/04_physics_and_collisions/05_box_collision_2/license-for-sample.txt @@ -0,0 +1,9 @@ +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/04_physics_and_collisions/05_box_collision_2/replay.txt b/samples/04_physics_and_collisions/05_box_collision_2/replay.txt new file mode 100644 index 0000000..d53870b --- /dev/null +++ b/samples/04_physics_and_collisions/05_box_collision_2/replay.txt @@ -0,0 +1,819 @@ +replay_version 2.0 +stopped_at 1897 +seed 100 +recorded_at Sun Sep 29 22:22:11 2019 +[:mouse_move, 40, 523, 2, 1, 129] +[:mouse_move, 114, 503, 2, 2, 130] +[:mouse_move, 170, 488, 2, 3, 131] +[:mouse_move, 299, 454, 2, 4, 132] +[:mouse_move, 481, 406, 2, 5, 133] +[:mouse_move, 685, 346, 2, 6, 134] +[:mouse_move, 812, 302, 2, 7, 135] +[:mouse_move, 1026, 205, 2, 8, 136] +[:mouse_move, 1062, 184, 2, 9, 137] +[:mouse_move, 1112, 150, 2, 10, 138] +[:mouse_move, 1153, 121, 2, 11, 139] +[:mouse_move, 1169, 107, 2, 12, 140] +[:mouse_move, 1182, 95, 2, 13, 141] +[:mouse_move, 1197, 73, 2, 14, 142] +[:mouse_move, 1197, 70, 2, 15, 143] +[:mouse_move, 1192, 63, 2, 16, 144] +[:mouse_move, 1187, 60, 2, 17, 145] +[:mouse_move, 1170, 50, 2, 18, 146] +[:mouse_move, 1161, 45, 2, 19, 147] +[:mouse_move, 1147, 38, 2, 20, 148] +[:mouse_move, 1140, 34, 2, 21, 149] +[:mouse_move, 1126, 28, 2, 22, 150] +[:mouse_move, 1114, 25, 2, 23, 151] +[:mouse_move, 1098, 23, 2, 24, 152] +[:mouse_move, 1088, 23, 2, 25, 153] +[:mouse_move, 1072, 23, 2, 26, 154] +[:mouse_move, 1055, 24, 2, 27, 155] +[:mouse_move, 1044, 26, 2, 28, 156] +[:mouse_move, 1019, 29, 2, 29, 157] +[:mouse_move, 994, 31, 2, 30, 158] +[:mouse_move, 969, 32, 2, 31, 159] +[:mouse_move, 963, 32, 2, 32, 160] +[:mouse_move, 948, 32, 2, 33, 161] +[:mouse_move, 941, 31, 2, 34, 162] +[:mouse_move, 924, 29, 2, 35, 163] +[:mouse_move, 918, 27, 2, 36, 164] +[:mouse_move, 910, 25, 2, 37, 165] +[:mouse_move, 907, 24, 2, 38, 166] +[:mouse_move, 902, 23, 2, 39, 167] +[:mouse_move, 901, 22, 2, 40, 168] +[:mouse_move, 899, 22, 2, 41, 169] +[:mouse_move, 898, 22, 2, 42, 170] +[:mouse_move, 897, 22, 2, 43, 172] +[:mouse_move, 897, 23, 2, 44, 174] +[:mouse_move, 897, 30, 2, 45, 175] +[:mouse_move, 898, 34, 2, 46, 176] +[:mouse_move, 906, 46, 2, 47, 177] +[:mouse_move, 912, 52, 2, 48, 178] +[:mouse_move, 929, 64, 2, 49, 179] +[:mouse_move, 941, 69, 2, 50, 180] +[:mouse_move, 963, 74, 2, 51, 181] +[:mouse_move, 969, 75, 2, 52, 182] +[:mouse_move, 980, 76, 2, 53, 183] +[:mouse_move, 1001, 76, 2, 54, 184] +[:mouse_move, 1009, 76, 2, 55, 185] +[:mouse_move, 1025, 76, 2, 56, 186] +[:mouse_move, 1028, 76, 2, 57, 187] +[:mouse_move, 1041, 75, 2, 58, 188] +[:mouse_move, 1046, 73, 2, 59, 189] +[:mouse_move, 1055, 71, 2, 60, 190] +[:mouse_move, 1061, 69, 2, 61, 191] +[:mouse_move, 1078, 65, 2, 62, 192] +[:mouse_move, 1086, 64, 2, 63, 193] +[:mouse_move, 1104, 62, 2, 64, 194] +[:mouse_move, 1109, 62, 2, 65, 195] +[:mouse_move, 1126, 61, 2, 66, 196] +[:mouse_move, 1141, 61, 2, 67, 197] +[:mouse_move, 1155, 60, 2, 68, 198] +[:mouse_move, 1162, 60, 2, 69, 199] +[:mouse_move, 1170, 59, 2, 70, 200] +[:mouse_move, 1175, 59, 2, 71, 201] +[:mouse_move, 1181, 58, 2, 72, 202] +[:mouse_move, 1183, 57, 2, 73, 203] +[:mouse_move, 1186, 56, 2, 74, 204] +[:mouse_move, 1189, 55, 2, 75, 205] +[:mouse_move, 1191, 53, 2, 76, 206] +[:mouse_move, 1191, 52, 2, 77, 207] +[:mouse_move, 1193, 48, 2, 78, 208] +[:mouse_move, 1193, 45, 2, 79, 209] +[:mouse_move, 1192, 43, 2, 80, 210] +[:mouse_move, 1186, 38, 2, 81, 211] +[:mouse_move, 1181, 35, 2, 82, 212] +[:mouse_move, 1168, 30, 2, 83, 213] +[:mouse_move, 1161, 27, 2, 84, 214] +[:mouse_move, 1140, 23, 2, 85, 215] +[:mouse_move, 1130, 21, 2, 86, 216] +[:mouse_move, 1109, 19, 2, 87, 217] +[:mouse_move, 1104, 19, 2, 88, 218] +[:mouse_move, 1081, 19, 2, 89, 219] +[:mouse_move, 1064, 19, 2, 90, 220] +[:mouse_move, 1048, 19, 2, 91, 221] +[:mouse_move, 1037, 19, 2, 92, 222] +[:mouse_move, 1012, 20, 2, 93, 223] +[:mouse_move, 1007, 21, 2, 94, 224] +[:mouse_move, 986, 22, 2, 95, 225] +[:mouse_move, 978, 23, 2, 96, 226] +[:mouse_move, 957, 26, 2, 97, 227] +[:mouse_move, 949, 28, 2, 98, 228] +[:mouse_move, 935, 32, 2, 99, 229] +[:mouse_move, 930, 34, 2, 100, 230] +[:mouse_move, 926, 37, 2, 101, 231] +[:mouse_move, 921, 40, 2, 102, 232] +[:mouse_move, 918, 46, 2, 103, 233] +[:mouse_move, 918, 51, 2, 104, 234] +[:mouse_move, 919, 60, 2, 105, 235] +[:mouse_move, 923, 67, 2, 106, 236] +[:mouse_move, 929, 70, 2, 107, 237] +[:mouse_move, 941, 73, 2, 108, 238] +[:mouse_move, 948, 74, 2, 109, 239] +[:mouse_move, 958, 74, 2, 110, 240] +[:mouse_move, 962, 74, 2, 111, 241] +[:mouse_move, 968, 74, 2, 112, 242] +[:mouse_move, 969, 73, 2, 113, 243] +[:mouse_move, 970, 73, 2, 114, 244] +[:mouse_move, 968, 73, 2, 115, 256] +[:mouse_move, 963, 77, 2, 116, 257] +[:mouse_move, 949, 85, 2, 117, 258] +[:mouse_move, 944, 88, 2, 118, 259] +[:mouse_move, 935, 94, 2, 119, 260] +[:mouse_move, 932, 96, 2, 120, 261] +[:mouse_move, 925, 101, 2, 121, 262] +[:mouse_move, 921, 104, 2, 122, 263] +[:mouse_move, 917, 107, 2, 123, 264] +[:mouse_move, 915, 107, 2, 124, 265] +[:mouse_move, 914, 108, 2, 125, 266] +[:mouse_move, 912, 108, 2, 126, 267] +[:mouse_move, 912, 109, 2, 127, 268] +[:mouse_move, 911, 109, 2, 128, 269] +[:mouse_move, 913, 109, 2, 129, 275] +[:mouse_move, 915, 109, 2, 130, 276] +[:mouse_move, 922, 109, 2, 131, 277] +[:mouse_move, 926, 109, 2, 132, 278] +[:mouse_move, 937, 108, 2, 133, 279] +[:mouse_move, 943, 107, 2, 134, 280] +[:mouse_move, 955, 106, 2, 135, 281] +[:mouse_move, 961, 106, 2, 136, 282] +[:mouse_move, 971, 106, 2, 137, 283] +[:mouse_move, 977, 106, 2, 138, 284] +[:mouse_move, 987, 106, 2, 139, 285] +[:mouse_move, 994, 106, 2, 140, 286] +[:mouse_move, 1012, 108, 2, 141, 287] +[:mouse_move, 1016, 109, 2, 142, 288] +[:mouse_move, 1030, 110, 2, 143, 289] +[:mouse_move, 1036, 111, 2, 144, 290] +[:mouse_move, 1050, 111, 2, 145, 291] +[:mouse_move, 1056, 111, 2, 146, 292] +[:mouse_move, 1062, 111, 2, 147, 293] +[:mouse_move, 1074, 111, 2, 148, 294] +[:mouse_move, 1080, 111, 2, 149, 295] +[:mouse_move, 1086, 111, 2, 150, 296] +[:mouse_move, 1094, 111, 2, 151, 297] +[:mouse_move, 1099, 112, 2, 152, 298] +[:mouse_move, 1101, 112, 2, 153, 299] +[:mouse_move, 1106, 112, 2, 154, 300] +[:mouse_move, 1107, 112, 2, 155, 301] +[:mouse_move, 1109, 112, 2, 156, 302] +[:mouse_move, 1104, 112, 2, 157, 306] +[:mouse_move, 1097, 112, 2, 158, 307] +[:mouse_move, 1079, 112, 2, 159, 308] +[:mouse_move, 1067, 111, 2, 160, 309] +[:mouse_move, 1043, 111, 2, 161, 310] +[:mouse_move, 1038, 111, 2, 162, 311] +[:mouse_move, 1018, 111, 2, 163, 312] +[:mouse_move, 1009, 111, 2, 164, 313] +[:mouse_move, 986, 111, 2, 165, 314] +[:mouse_move, 978, 111, 2, 166, 315] +[:mouse_move, 963, 111, 2, 167, 316] +[:mouse_move, 954, 111, 2, 168, 317] +[:mouse_move, 940, 111, 2, 169, 318] +[:mouse_move, 934, 111, 2, 170, 319] +[:mouse_move, 929, 111, 2, 171, 320] +[:mouse_move, 920, 110, 2, 172, 321] +[:mouse_move, 916, 110, 2, 173, 322] +[:mouse_move, 911, 109, 2, 174, 323] +[:mouse_move, 909, 109, 2, 175, 324] +[:mouse_move, 906, 109, 2, 176, 325] +[:mouse_move, 905, 109, 2, 177, 327] +[:mouse_move, 904, 109, 2, 178, 328] +[:mouse_move, 904, 110, 2, 179, 334] +[:mouse_move, 907, 112, 2, 180, 335] +[:mouse_move, 910, 113, 2, 181, 336] +[:mouse_move, 917, 117, 2, 182, 337] +[:mouse_move, 921, 118, 2, 183, 338] +[:mouse_move, 931, 122, 2, 184, 339] +[:mouse_move, 935, 123, 2, 185, 340] +[:mouse_move, 943, 125, 2, 186, 341] +[:mouse_move, 945, 125, 2, 187, 342] +[:mouse_move, 954, 128, 2, 188, 343] +[:mouse_move, 957, 128, 2, 189, 344] +[:mouse_move, 963, 129, 2, 190, 345] +[:mouse_move, 966, 130, 2, 191, 346] +[:mouse_move, 968, 130, 2, 192, 347] +[:mouse_move, 976, 131, 2, 193, 348] +[:mouse_move, 980, 132, 2, 194, 349] +[:mouse_move, 986, 132, 2, 195, 350] +[:mouse_move, 991, 133, 2, 196, 351] +[:mouse_move, 998, 133, 2, 197, 352] +[:mouse_move, 1002, 133, 2, 198, 353] +[:mouse_move, 1010, 133, 2, 199, 354] +[:mouse_move, 1014, 133, 2, 200, 355] +[:mouse_move, 1024, 133, 2, 201, 356] +[:mouse_move, 1030, 133, 2, 202, 357] +[:mouse_move, 1041, 133, 2, 203, 358] +[:mouse_move, 1047, 134, 2, 204, 359] +[:mouse_move, 1062, 134, 2, 205, 360] +[:mouse_move, 1070, 134, 2, 206, 361] +[:mouse_move, 1083, 135, 2, 207, 362] +[:mouse_move, 1091, 135, 2, 208, 363] +[:mouse_move, 1103, 136, 2, 209, 364] +[:mouse_move, 1110, 136, 2, 210, 365] +[:mouse_move, 1123, 138, 2, 211, 366] +[:mouse_move, 1129, 140, 2, 212, 367] +[:mouse_move, 1140, 141, 2, 213, 368] +[:mouse_move, 1145, 142, 2, 214, 369] +[:mouse_move, 1156, 144, 2, 215, 370] +[:mouse_move, 1161, 144, 2, 216, 371] +[:mouse_move, 1171, 145, 2, 217, 372] +[:mouse_move, 1175, 145, 2, 218, 373] +[:mouse_move, 1180, 145, 2, 219, 374] +[:mouse_move, 1188, 145, 2, 220, 375] +[:mouse_move, 1189, 145, 2, 221, 376] +[:mouse_move, 1196, 146, 2, 222, 377] +[:mouse_move, 1199, 146, 2, 223, 378] +[:mouse_move, 1203, 147, 2, 224, 379] +[:mouse_move, 1205, 148, 2, 225, 380] +[:mouse_move, 1208, 150, 2, 226, 381] +[:mouse_move, 1210, 150, 2, 227, 382] +[:mouse_move, 1211, 151, 2, 228, 383] +[:mouse_move, 1212, 151, 2, 229, 384] +[:mouse_move, 1212, 152, 2, 230, 385] +[:mouse_move, 1213, 152, 2, 231, 386] +[:mouse_move, 1212, 152, 2, 232, 422] +[:mouse_move, 1211, 152, 2, 233, 427] +[:mouse_move, 1209, 152, 2, 234, 428] +[:mouse_move, 1194, 159, 2, 235, 429] +[:mouse_move, 1179, 166, 2, 236, 430] +[:mouse_move, 1135, 186, 2, 237, 431] +[:mouse_move, 1123, 191, 2, 238, 432] +[:mouse_move, 1080, 208, 2, 239, 433] +[:mouse_move, 1073, 211, 2, 240, 434] +[:mouse_move, 1045, 219, 2, 241, 435] +[:mouse_move, 1033, 220, 2, 242, 436] +[:mouse_move, 1021, 221, 2, 243, 437] +[:mouse_move, 1016, 221, 2, 244, 438] +[:mouse_move, 1009, 221, 2, 245, 439] +[:mouse_move, 1007, 220, 2, 246, 440] +[:mouse_move, 1002, 218, 2, 247, 441] +[:mouse_move, 999, 216, 2, 248, 442] +[:mouse_move, 987, 210, 2, 249, 443] +[:mouse_move, 979, 207, 2, 250, 444] +[:mouse_move, 958, 199, 2, 251, 445] +[:mouse_move, 947, 196, 2, 252, 446] +[:mouse_move, 929, 191, 2, 253, 447] +[:mouse_move, 920, 189, 2, 254, 448] +[:mouse_move, 910, 186, 2, 255, 449] +[:mouse_move, 906, 185, 2, 256, 450] +[:mouse_move, 901, 184, 2, 257, 451] +[:mouse_move, 900, 183, 2, 258, 452] +[:mouse_move, 899, 183, 2, 259, 453] +[:mouse_move, 898, 183, 2, 260, 457] +[:mouse_move, 892, 183, 2, 261, 458] +[:mouse_move, 885, 183, 2, 262, 459] +[:mouse_move, 864, 183, 2, 263, 460] +[:mouse_move, 841, 182, 2, 264, 461] +[:mouse_move, 811, 180, 2, 265, 462] +[:mouse_move, 775, 178, 2, 266, 463] +[:mouse_move, 754, 176, 2, 267, 464] +[:mouse_move, 748, 176, 2, 268, 465] +[:mouse_move, 728, 175, 2, 269, 466] +[:mouse_move, 723, 174, 2, 270, 467] +[:mouse_move, 717, 174, 2, 271, 468] +[:mouse_move, 716, 174, 2, 272, 469] +[:mouse_move, 719, 174, 2, 273, 472] +[:mouse_move, 724, 174, 2, 274, 473] +[:mouse_move, 734, 176, 2, 275, 474] +[:mouse_move, 741, 177, 2, 276, 475] +[:mouse_move, 758, 178, 2, 277, 476] +[:mouse_move, 772, 179, 2, 278, 477] +[:mouse_move, 792, 180, 2, 279, 478] +[:mouse_move, 796, 180, 2, 280, 479] +[:mouse_move, 813, 181, 2, 281, 480] +[:mouse_move, 822, 181, 2, 282, 481] +[:mouse_move, 830, 181, 2, 283, 482] +[:mouse_move, 854, 182, 2, 284, 483] +[:mouse_move, 866, 183, 2, 285, 484] +[:mouse_move, 891, 183, 2, 286, 485] +[:mouse_move, 905, 184, 2, 287, 486] +[:mouse_move, 938, 185, 2, 288, 487] +[:mouse_move, 970, 186, 2, 289, 488] +[:mouse_move, 1017, 188, 2, 290, 489] +[:mouse_move, 1042, 189, 2, 291, 490] +[:mouse_move, 1079, 190, 2, 292, 491] +[:mouse_move, 1102, 190, 2, 293, 492] +[:mouse_move, 1128, 190, 2, 294, 493] +[:mouse_move, 1142, 190, 2, 295, 494] +[:mouse_move, 1162, 190, 2, 296, 495] +[:mouse_move, 1165, 190, 2, 297, 496] +[:mouse_move, 1175, 190, 2, 298, 497] +[:mouse_move, 1178, 190, 2, 299, 498] +[:mouse_move, 1183, 189, 2, 300, 499] +[:mouse_move, 1185, 189, 2, 301, 500] +[:mouse_move, 1187, 189, 2, 302, 501] +[:mouse_move, 1188, 189, 2, 303, 502] +[:mouse_move, 1190, 189, 2, 304, 503] +[:mouse_move, 1190, 190, 2, 305, 504] +[:mouse_move, 1192, 190, 2, 306, 505] +[:mouse_move, 1193, 191, 2, 307, 506] +[:mouse_move, 1195, 192, 2, 308, 507] +[:mouse_move, 1197, 193, 2, 309, 509] +[:mouse_move, 1198, 194, 2, 310, 510] +[:mouse_move, 1199, 194, 2, 311, 511] +[:mouse_move, 1201, 195, 2, 312, 512] +[:mouse_move, 1202, 196, 2, 313, 513] +[:mouse_move, 1203, 196, 2, 314, 514] +[:mouse_move, 1203, 197, 2, 315, 515] +[:mouse_move, 1204, 197, 2, 316, 516] +[:mouse_move, 1204, 198, 2, 317, 520] +[:mouse_move, 1203, 198, 2, 318, 523] +[:mouse_move, 1202, 199, 2, 319, 524] +[:mouse_move, 1200, 199, 2, 320, 525] +[:mouse_move, 1192, 203, 2, 321, 526] +[:mouse_move, 1177, 209, 2, 322, 527] +[:mouse_move, 1115, 235, 2, 323, 528] +[:mouse_move, 1071, 251, 2, 324, 529] +[:mouse_move, 958, 294, 2, 325, 530] +[:mouse_move, 890, 320, 2, 326, 531] +[:mouse_move, 758, 368, 2, 327, 532] +[:mouse_move, 693, 388, 2, 328, 533] +[:mouse_move, 610, 409, 2, 329, 534] +[:mouse_move, 564, 421, 2, 330, 535] +[:mouse_move, 549, 423, 2, 331, 536] +[:mouse_move, 518, 429, 2, 332, 537] +[:mouse_move, 512, 429, 2, 333, 538] +[:mouse_move, 495, 432, 2, 334, 539] +[:mouse_move, 490, 432, 2, 335, 540] +[:mouse_move, 487, 433, 2, 336, 541] +[:mouse_move, 486, 433, 2, 337, 542] +[:mouse_move, 486, 432, 2, 338, 543] +[:mouse_move, 486, 430, 2, 339, 545] +[:mouse_move, 487, 430, 2, 340, 546] +[:mouse_move, 487, 426, 2, 341, 547] +[:mouse_move, 486, 424, 2, 342, 548] +[:mouse_move, 481, 416, 2, 343, 549] +[:mouse_move, 477, 409, 2, 344, 550] +[:mouse_move, 471, 401, 2, 345, 551] +[:mouse_move, 467, 397, 2, 346, 552] +[:mouse_move, 456, 391, 2, 347, 553] +[:mouse_move, 451, 391, 2, 348, 554] +[:mouse_move, 429, 397, 2, 349, 555] +[:mouse_move, 416, 406, 2, 350, 556] +[:mouse_move, 383, 429, 2, 351, 557] +[:mouse_move, 364, 444, 2, 352, 558] +[:mouse_move, 337, 471, 2, 353, 559] +[:mouse_move, 322, 487, 2, 354, 560] +[:mouse_move, 300, 507, 2, 355, 561] +[:mouse_move, 289, 515, 2, 356, 562] +[:mouse_move, 285, 518, 2, 357, 563] +[:mouse_move, 273, 525, 2, 358, 564] +[:mouse_move, 269, 527, 2, 359, 565] +[:mouse_move, 266, 528, 2, 360, 566] +[:mouse_move, 264, 528, 2, 361, 567] +[:mouse_move, 262, 528, 2, 362, 568] +[:mouse_move, 261, 528, 2, 363, 569] +[:mouse_move, 259, 527, 2, 364, 570] +[:mouse_move, 258, 526, 2, 365, 571] +[:mouse_move, 257, 526, 2, 366, 572] +[:key_down_raw, 115, 0, 2, 367, 589] +[:key_up_raw, 115, 0, 2, 368, 594] +[:mouse_move, 257, 524, 2, 369, 617] +[:mouse_move, 259, 521, 2, 370, 618] +[:mouse_move, 260, 516, 2, 371, 619] +[:mouse_move, 263, 497, 2, 372, 620] +[:mouse_move, 263, 484, 2, 373, 621] +[:mouse_move, 263, 446, 2, 374, 622] +[:mouse_move, 258, 426, 2, 375, 623] +[:mouse_move, 250, 389, 2, 376, 624] +[:mouse_move, 248, 382, 2, 377, 625] +[:mouse_move, 239, 351, 2, 378, 626] +[:mouse_move, 235, 339, 2, 379, 627] +[:mouse_move, 229, 322, 2, 380, 628] +[:mouse_move, 226, 314, 2, 381, 629] +[:mouse_move, 222, 305, 2, 382, 630] +[:mouse_move, 219, 300, 2, 383, 631] +[:mouse_move, 216, 296, 2, 384, 632] +[:mouse_move, 215, 293, 2, 385, 633] +[:mouse_move, 212, 289, 2, 386, 634] +[:mouse_move, 212, 286, 2, 387, 635] +[:mouse_move, 209, 280, 2, 388, 636] +[:mouse_move, 208, 278, 2, 389, 637] +[:mouse_move, 207, 271, 2, 390, 638] +[:mouse_move, 206, 269, 2, 391, 639] +[:mouse_move, 203, 261, 2, 392, 640] +[:mouse_move, 201, 258, 2, 393, 641] +[:mouse_move, 198, 252, 2, 394, 642] +[:mouse_move, 196, 248, 2, 395, 643] +[:mouse_move, 194, 245, 2, 396, 644] +[:mouse_move, 192, 242, 2, 397, 645] +[:mouse_move, 191, 240, 2, 398, 646] +[:mouse_move, 189, 238, 2, 399, 647] +[:mouse_move, 189, 237, 2, 400, 648] +[:mouse_move, 188, 237, 2, 401, 649] +[:mouse_move, 187, 237, 2, 402, 658] +[:mouse_move, 187, 236, 2, 403, 659] +[:mouse_move, 188, 235, 2, 404, 663] +[:mouse_move, 191, 234, 2, 405, 664] +[:mouse_move, 215, 232, 2, 406, 665] +[:mouse_move, 234, 231, 2, 407, 666] +[:mouse_move, 280, 226, 2, 408, 667] +[:mouse_move, 305, 224, 2, 409, 668] +[:mouse_move, 360, 220, 2, 410, 669] +[:mouse_move, 372, 220, 2, 411, 670] +[:mouse_move, 417, 219, 2, 412, 671] +[:mouse_move, 438, 219, 2, 413, 672] +[:mouse_move, 458, 219, 2, 414, 673] +[:mouse_move, 493, 220, 2, 415, 674] +[:mouse_move, 509, 220, 2, 416, 675] +[:mouse_move, 536, 221, 2, 417, 676] +[:mouse_move, 548, 222, 2, 418, 677] +[:mouse_move, 573, 223, 2, 419, 678] +[:mouse_move, 585, 225, 2, 420, 679] +[:mouse_move, 610, 226, 2, 421, 680] +[:mouse_move, 616, 227, 2, 422, 681] +[:mouse_move, 640, 228, 2, 423, 682] +[:mouse_move, 659, 228, 2, 424, 683] +[:mouse_move, 684, 228, 2, 425, 684] +[:mouse_move, 697, 228, 2, 426, 685] +[:mouse_move, 730, 228, 2, 427, 686] +[:mouse_move, 762, 228, 2, 428, 687] +[:mouse_move, 804, 226, 2, 429, 688] +[:mouse_move, 827, 224, 2, 430, 689] +[:mouse_move, 861, 221, 2, 431, 690] +[:mouse_move, 884, 218, 2, 432, 691] +[:mouse_move, 923, 213, 2, 433, 692] +[:mouse_move, 930, 212, 2, 434, 693] +[:mouse_move, 955, 208, 2, 435, 694] +[:mouse_move, 966, 206, 2, 436, 695] +[:mouse_move, 983, 202, 2, 437, 696] +[:mouse_move, 990, 200, 2, 438, 697] +[:mouse_move, 1004, 197, 2, 439, 698] +[:mouse_move, 1009, 197, 2, 440, 699] +[:mouse_move, 1012, 197, 2, 441, 700] +[:mouse_move, 1025, 197, 2, 442, 701] +[:mouse_move, 1028, 197, 2, 443, 702] +[:mouse_move, 1034, 201, 2, 444, 721] +[:mouse_move, 1036, 203, 2, 445, 722] +[:mouse_move, 1041, 208, 2, 446, 723] +[:mouse_move, 1044, 212, 2, 447, 724] +[:mouse_move, 1051, 222, 2, 448, 725] +[:mouse_move, 1054, 229, 2, 449, 726] +[:mouse_move, 1057, 236, 2, 450, 727] +[:mouse_move, 1061, 245, 2, 451, 728] +[:mouse_move, 1064, 254, 2, 452, 729] +[:mouse_move, 1067, 262, 2, 453, 730] +[:mouse_move, 1068, 264, 2, 454, 731] +[:mouse_move, 1070, 270, 2, 455, 732] +[:mouse_move, 1071, 272, 2, 456, 733] +[:mouse_move, 1072, 275, 2, 457, 734] +[:mouse_move, 1072, 277, 2, 458, 735] +[:mouse_move, 1073, 278, 2, 459, 736] +[:mouse_move, 1074, 279, 2, 460, 737] +[:mouse_move, 1075, 280, 2, 461, 738] +[:mouse_move, 1077, 281, 2, 462, 739] +[:mouse_move, 1078, 282, 2, 463, 740] +[:mouse_move, 1080, 282, 2, 464, 741] +[:mouse_move, 1082, 282, 2, 465, 742] +[:mouse_move, 1083, 282, 2, 466, 743] +[:mouse_move, 1084, 282, 2, 467, 744] +[:mouse_move, 1085, 281, 2, 468, 746] +[:mouse_move, 1085, 280, 2, 469, 747] +[:mouse_move, 1086, 280, 2, 470, 748] +[:mouse_move, 1086, 279, 2, 471, 749] +[:mouse_move, 1086, 278, 2, 472, 750] +[:mouse_move, 1087, 278, 2, 473, 751] +[:mouse_move, 1088, 278, 2, 474, 755] +[:mouse_move, 1086, 276, 2, 475, 759] +[:mouse_move, 1082, 273, 2, 476, 760] +[:mouse_move, 1058, 257, 2, 477, 761] +[:mouse_move, 1040, 246, 2, 478, 762] +[:mouse_move, 995, 214, 2, 479, 763] +[:mouse_move, 968, 195, 2, 480, 764] +[:mouse_move, 915, 163, 2, 481, 765] +[:mouse_move, 887, 148, 2, 482, 766] +[:mouse_move, 853, 131, 2, 483, 767] +[:mouse_move, 833, 122, 2, 484, 768] +[:mouse_move, 794, 105, 2, 485, 769] +[:mouse_move, 776, 99, 2, 486, 770] +[:mouse_move, 739, 87, 2, 487, 771] +[:mouse_move, 723, 83, 2, 488, 772] +[:mouse_move, 690, 76, 2, 489, 773] +[:mouse_move, 674, 73, 2, 490, 774] +[:mouse_move, 627, 69, 2, 491, 775] +[:mouse_move, 607, 69, 2, 492, 776] +[:mouse_move, 573, 69, 2, 493, 777] +[:mouse_move, 554, 69, 2, 494, 778] +[:mouse_move, 519, 69, 2, 495, 779] +[:mouse_move, 504, 69, 2, 496, 780] +[:mouse_move, 484, 68, 2, 497, 781] +[:mouse_move, 473, 67, 2, 498, 782] +[:mouse_move, 462, 67, 2, 499, 783] +[:mouse_move, 445, 66, 2, 500, 784] +[:mouse_move, 430, 66, 2, 501, 785] +[:mouse_move, 410, 66, 2, 502, 786] +[:mouse_move, 396, 66, 2, 503, 787] +[:mouse_move, 367, 68, 2, 504, 788] +[:mouse_move, 352, 69, 2, 505, 789] +[:mouse_move, 321, 73, 2, 506, 790] +[:mouse_move, 307, 75, 2, 507, 791] +[:mouse_move, 274, 79, 2, 508, 792] +[:mouse_move, 258, 81, 2, 509, 793] +[:mouse_move, 248, 82, 2, 510, 794] +[:mouse_move, 239, 83, 2, 511, 795] +[:mouse_move, 231, 84, 2, 512, 796] +[:mouse_move, 228, 84, 2, 513, 797] +[:mouse_move, 225, 84, 2, 514, 798] +[:mouse_move, 224, 84, 2, 515, 800] +[:mouse_move, 221, 85, 2, 516, 802] +[:mouse_move, 217, 85, 2, 517, 803] +[:mouse_move, 209, 86, 2, 518, 804] +[:mouse_move, 204, 86, 2, 519, 805] +[:mouse_move, 199, 87, 2, 520, 806] +[:mouse_move, 193, 88, 2, 521, 807] +[:mouse_move, 186, 88, 2, 522, 808] +[:mouse_move, 179, 89, 2, 523, 809] +[:mouse_move, 178, 89, 2, 524, 810] +[:mouse_move, 173, 89, 2, 525, 811] +[:mouse_move, 172, 89, 2, 526, 812] +[:mouse_move, 171, 89, 2, 527, 813] +[:mouse_move, 170, 89, 2, 528, 814] +[:mouse_move, 173, 89, 2, 529, 819] +[:mouse_move, 178, 89, 2, 530, 820] +[:mouse_move, 184, 89, 2, 531, 821] +[:mouse_move, 189, 88, 2, 532, 822] +[:mouse_move, 199, 88, 2, 533, 823] +[:mouse_move, 209, 88, 2, 534, 824] +[:mouse_move, 226, 86, 2, 535, 825] +[:mouse_move, 236, 85, 2, 536, 826] +[:mouse_move, 261, 84, 2, 537, 827] +[:mouse_move, 267, 83, 2, 538, 828] +[:mouse_move, 287, 83, 2, 539, 829] +[:mouse_move, 296, 83, 2, 540, 830] +[:mouse_move, 318, 83, 2, 541, 831] +[:mouse_move, 328, 84, 2, 542, 832] +[:mouse_move, 341, 85, 2, 543, 833] +[:mouse_move, 350, 86, 2, 544, 834] +[:mouse_move, 359, 86, 2, 545, 835] +[:mouse_move, 368, 87, 2, 546, 836] +[:mouse_move, 376, 88, 2, 547, 837] +[:mouse_move, 390, 88, 2, 548, 838] +[:mouse_move, 394, 88, 2, 549, 839] +[:mouse_move, 408, 88, 2, 550, 840] +[:mouse_move, 415, 88, 2, 551, 841] +[:mouse_move, 428, 87, 2, 552, 842] +[:mouse_move, 436, 87, 2, 553, 843] +[:mouse_move, 458, 86, 2, 554, 844] +[:mouse_move, 468, 85, 2, 555, 845] +[:mouse_move, 496, 82, 2, 556, 846] +[:mouse_move, 523, 79, 2, 557, 847] +[:mouse_move, 539, 77, 2, 558, 848] +[:mouse_move, 564, 74, 2, 559, 849] +[:mouse_move, 592, 71, 2, 560, 850] +[:mouse_move, 605, 70, 2, 561, 851] +[:mouse_move, 631, 69, 2, 562, 852] +[:mouse_move, 646, 69, 2, 563, 853] +[:mouse_move, 672, 69, 2, 564, 854] +[:mouse_move, 677, 69, 2, 565, 855] +[:mouse_move, 705, 69, 2, 566, 856] +[:mouse_move, 709, 69, 2, 567, 857] +[:mouse_move, 730, 69, 2, 568, 858] +[:mouse_move, 745, 70, 2, 569, 859] +[:mouse_move, 769, 71, 2, 570, 860] +[:mouse_move, 784, 72, 2, 571, 861] +[:mouse_move, 814, 73, 2, 572, 862] +[:mouse_move, 830, 73, 2, 573, 863] +[:mouse_move, 846, 73, 2, 574, 864] +[:mouse_move, 876, 74, 2, 575, 865] +[:mouse_move, 892, 74, 2, 576, 866] +[:mouse_move, 923, 76, 2, 577, 867] +[:mouse_move, 940, 78, 2, 578, 868] +[:mouse_move, 972, 81, 2, 579, 869] +[:mouse_move, 986, 82, 2, 580, 870] +[:mouse_move, 1014, 85, 2, 581, 871] +[:mouse_move, 1027, 88, 2, 582, 872] +[:mouse_move, 1043, 90, 2, 583, 873] +[:mouse_move, 1053, 92, 2, 584, 874] +[:mouse_move, 1069, 94, 2, 585, 875] +[:mouse_move, 1075, 95, 2, 586, 876] +[:mouse_move, 1083, 96, 2, 587, 877] +[:mouse_move, 1086, 97, 2, 588, 878] +[:mouse_move, 1091, 97, 2, 589, 879] +[:mouse_move, 1092, 97, 2, 590, 880] +[:mouse_move, 1093, 97, 2, 591, 881] +[:mouse_move, 1094, 97, 2, 592, 883] +[:mouse_move, 1094, 106, 2, 593, 898] +[:mouse_move, 1094, 112, 2, 594, 899] +[:mouse_move, 1094, 136, 2, 595, 900] +[:mouse_move, 1094, 142, 2, 596, 901] +[:mouse_move, 1094, 157, 2, 597, 902] +[:mouse_move, 1094, 165, 2, 598, 903] +[:mouse_move, 1094, 182, 2, 599, 904] +[:mouse_move, 1094, 186, 2, 600, 905] +[:mouse_move, 1094, 197, 2, 601, 906] +[:mouse_move, 1093, 200, 2, 602, 907] +[:mouse_move, 1092, 206, 2, 603, 908] +[:mouse_move, 1092, 208, 2, 604, 909] +[:mouse_move, 1092, 210, 2, 605, 910] +[:mouse_move, 1092, 211, 2, 606, 911] +[:mouse_move, 1092, 212, 2, 607, 912] +[:mouse_move, 1092, 213, 2, 608, 913] +[:mouse_move, 1092, 214, 2, 609, 914] +[:mouse_move, 1092, 215, 2, 610, 915] +[:mouse_move, 1092, 220, 2, 611, 916] +[:mouse_move, 1092, 222, 2, 612, 917] +[:mouse_move, 1092, 226, 2, 613, 918] +[:mouse_move, 1092, 236, 2, 614, 919] +[:mouse_move, 1092, 239, 2, 615, 920] +[:mouse_move, 1091, 245, 2, 616, 921] +[:mouse_move, 1091, 248, 2, 617, 922] +[:mouse_move, 1091, 252, 2, 618, 923] +[:mouse_move, 1091, 253, 2, 619, 924] +[:mouse_move, 1091, 255, 2, 620, 925] +[:mouse_move, 1091, 256, 2, 621, 926] +[:mouse_move, 1091, 257, 2, 622, 927] +[:mouse_move, 1091, 258, 2, 623, 928] +[:mouse_move, 1091, 259, 2, 624, 931] +[:mouse_move, 1091, 260, 2, 625, 941] +[:mouse_move, 1091, 261, 2, 626, 942] +[:mouse_move, 1091, 262, 2, 627, 943] +[:mouse_move, 1091, 263, 2, 628, 944] +[:mouse_move, 1091, 264, 2, 629, 945] +[:mouse_move, 1091, 265, 2, 630, 947] +[:mouse_move, 1091, 266, 2, 631, 948] +[:mouse_move, 1091, 267, 2, 632, 949] +[:mouse_move, 1091, 268, 2, 633, 951] +[:mouse_button_pressed, 1, 0, 1, 634, 952] +[:mouse_button_up, 1, 0, 1, 635, 960] +[:mouse_move, 1090, 268, 2, 636, 1062] +[:mouse_move, 1089, 269, 2, 637, 1063] +[:mouse_move, 1084, 271, 2, 638, 1064] +[:mouse_move, 1079, 272, 2, 639, 1065] +[:mouse_move, 1070, 277, 2, 640, 1066] +[:mouse_move, 1065, 279, 2, 641, 1067] +[:mouse_move, 1060, 282, 2, 642, 1068] +[:mouse_move, 1057, 283, 2, 643, 1069] +[:mouse_move, 1053, 286, 2, 644, 1070] +[:mouse_move, 1052, 286, 2, 645, 1071] +[:mouse_move, 1052, 287, 2, 646, 1072] +[:mouse_move, 1051, 287, 2, 647, 1073] +[:mouse_move, 1051, 288, 2, 648, 1074] +[:mouse_move, 1051, 289, 2, 649, 1078] +[:key_down_raw, 115, 0, 2, 650, 1083] +[:key_up_raw, 115, 0, 2, 651, 1088] +[:mouse_move, 1050, 289, 2, 652, 1096] +[:mouse_move, 1042, 294, 2, 653, 1097] +[:mouse_move, 1032, 300, 2, 654, 1098] +[:mouse_move, 979, 325, 2, 655, 1099] +[:mouse_move, 945, 339, 2, 656, 1100] +[:mouse_move, 803, 383, 2, 657, 1101] +[:mouse_move, 722, 403, 2, 658, 1102] +[:mouse_move, 535, 441, 2, 659, 1103] +[:mouse_move, 441, 454, 2, 660, 1104] +[:mouse_move, 311, 467, 2, 661, 1105] +[:mouse_move, 279, 469, 2, 662, 1106] +[:mouse_move, 214, 470, 2, 663, 1107] +[:mouse_move, 149, 469, 2, 664, 1108] +[:mouse_move, 115, 464, 2, 665, 1109] +[:mouse_move, 98, 459, 2, 666, 1110] +[:mouse_move, 84, 456, 2, 667, 1111] +[:mouse_move, 70, 451, 2, 668, 1112] +[:mouse_move, 67, 449, 2, 669, 1113] +[:mouse_move, 64, 447, 2, 670, 1114] +[:mouse_move, 64, 446, 2, 671, 1115] +[:mouse_move, 63, 446, 2, 672, 1116] +[:mouse_move, 63, 445, 2, 673, 1117] +[:mouse_move, 64, 445, 2, 674, 1121] +[:mouse_move, 71, 445, 2, 675, 1122] +[:mouse_move, 78, 445, 2, 676, 1123] +[:mouse_move, 96, 449, 2, 677, 1124] +[:mouse_move, 101, 451, 2, 678, 1125] +[:mouse_move, 113, 455, 2, 679, 1126] +[:mouse_move, 118, 457, 2, 680, 1127] +[:mouse_move, 124, 460, 2, 681, 1128] +[:mouse_move, 126, 460, 2, 682, 1129] +[:mouse_move, 127, 461, 2, 683, 1130] +[:mouse_move, 128, 461, 2, 684, 1131] +[:mouse_move, 128, 462, 2, 685, 1132] +[:mouse_button_pressed, 1, 0, 1, 686, 1137] +[:mouse_button_up, 1, 0, 1, 687, 1145] +[:mouse_move, 128, 457, 2, 688, 1155] +[:mouse_move, 128, 451, 2, 689, 1156] +[:mouse_move, 128, 420, 2, 690, 1157] +[:mouse_move, 128, 397, 2, 691, 1158] +[:mouse_move, 128, 334, 2, 692, 1159] +[:mouse_move, 128, 298, 2, 693, 1160] +[:mouse_move, 128, 282, 2, 694, 1161] +[:mouse_move, 128, 231, 2, 695, 1162] +[:mouse_move, 128, 222, 2, 696, 1163] +[:mouse_move, 128, 192, 2, 697, 1164] +[:mouse_move, 127, 178, 2, 698, 1165] +[:mouse_move, 126, 172, 2, 699, 1166] +[:mouse_move, 126, 168, 2, 700, 1167] +[:mouse_move, 125, 163, 2, 701, 1168] +[:mouse_move, 125, 162, 2, 702, 1169] +[:mouse_move, 124, 161, 2, 703, 1170] +[:mouse_move, 124, 160, 2, 704, 1171] +[:mouse_move, 123, 160, 2, 705, 1173] +[:mouse_button_pressed, 1, 0, 1, 706, 1177] +[:mouse_button_up, 1, 0, 1, 707, 1186] +[:mouse_move, 126, 160, 2, 708, 1190] +[:mouse_move, 149, 160, 2, 709, 1191] +[:mouse_move, 187, 160, 2, 710, 1192] +[:mouse_move, 240, 156, 2, 711, 1193] +[:mouse_move, 274, 150, 2, 712, 1194] +[:mouse_move, 294, 146, 2, 713, 1195] +[:mouse_move, 311, 141, 2, 714, 1196] +[:mouse_move, 324, 139, 2, 715, 1197] +[:mouse_move, 329, 137, 2, 716, 1198] +[:mouse_move, 335, 136, 2, 717, 1199] +[:mouse_button_pressed, 1, 0, 1, 718, 1208] +[:mouse_button_up, 1, 0, 1, 719, 1217] +[:mouse_move, 331, 149, 2, 720, 1220] +[:mouse_move, 325, 159, 2, 721, 1221] +[:mouse_move, 285, 225, 2, 722, 1222] +[:mouse_move, 238, 300, 2, 723, 1223] +[:mouse_move, 159, 435, 2, 724, 1224] +[:mouse_move, 137, 471, 2, 725, 1225] +[:mouse_move, 82, 563, 2, 726, 1226] +[:mouse_move, 51, 612, 2, 727, 1227] +[:mouse_move, 39, 634, 2, 728, 1228] +[:mouse_move, 28, 654, 2, 729, 1229] +[:key_down_raw, 1073741903, 0, 2, 730, 1293] +[:key_down_raw, 1073741903, 0, 2, 731, 1317] +[:key_down_raw, 1073741903, 0, 2, 732, 1319] +[:key_down_raw, 1073741903, 0, 2, 733, 1321] +[:key_down_raw, 1073741903, 0, 2, 734, 1323] +[:key_down_raw, 1073741903, 0, 2, 735, 1325] +[:key_down_raw, 1073741903, 0, 2, 736, 1327] +[:key_down_raw, 1073741903, 0, 2, 737, 1330] +[:key_down_raw, 1073741903, 0, 2, 738, 1332] +[:key_down_raw, 1073741903, 0, 2, 739, 1334] +[:key_down_raw, 1073741903, 0, 2, 740, 1336] +[:key_down_raw, 1073741903, 0, 2, 741, 1338] +[:key_down_raw, 1073741903, 0, 2, 742, 1340] +[:key_up_raw, 1073741903, 0, 2, 743, 1341] +[:key_down_raw, 1073741904, 0, 2, 744, 1341] +[:key_down_raw, 1073741903, 0, 2, 745, 1366] +[:key_up_raw, 1073741904, 0, 2, 746, 1369] +[:key_down_raw, 1073741903, 0, 2, 747, 1391] +[:key_down_raw, 1073741903, 0, 2, 748, 1393] +[:key_down_raw, 1073741903, 0, 2, 749, 1395] +[:key_down_raw, 1073741904, 0, 2, 750, 1397] +[:key_up_raw, 1073741903, 0, 2, 751, 1398] +[:key_down_raw, 32, 0, 2, 752, 1417] +[:key_down_raw, 1073741903, 0, 2, 753, 1420] +[:key_up_raw, 1073741904, 0, 2, 754, 1421] +[:key_down_raw, 1073741904, 0, 2, 755, 1437] +[:key_up_raw, 1073741903, 0, 2, 756, 1438] +[:key_down_raw, 1073741904, 0, 2, 757, 1462] +[:key_down_raw, 1073741904, 0, 2, 758, 1464] +[:key_down_raw, 1073741904, 0, 2, 759, 1466] +[:key_down_raw, 1073741904, 0, 2, 760, 1468] +[:key_down_raw, 1073741904, 0, 2, 761, 1470] +[:key_down_raw, 1073741904, 0, 2, 762, 1472] +[:key_down_raw, 1073741904, 0, 2, 763, 1474] +[:key_down_raw, 1073741903, 0, 2, 764, 1475] +[:key_up_raw, 1073741904, 0, 2, 765, 1490] +[:key_down_raw, 1073741903, 0, 2, 766, 1500] +[:key_down_raw, 1073741903, 0, 2, 767, 1502] +[:key_down_raw, 1073741903, 0, 2, 768, 1504] +[:key_down_raw, 1073741903, 0, 2, 769, 1506] +[:key_down_raw, 1073741903, 0, 2, 770, 1508] +[:key_down_raw, 1073741903, 0, 2, 771, 1510] +[:key_down_raw, 1073741903, 0, 2, 772, 1512] +[:key_up_raw, 32, 0, 2, 773, 1514] +[:key_down_raw, 1073741903, 0, 2, 774, 1514] +[:key_down_raw, 1073741903, 0, 2, 775, 1516] +[:key_up_raw, 1073741903, 0, 2, 776, 1516] +[:mouse_move, 30, 645, 2, 777, 1626] +[:mouse_move, 51, 614, 2, 778, 1627] +[:mouse_move, 61, 599, 2, 779, 1628] +[:mouse_move, 84, 572, 2, 780, 1629] +[:mouse_move, 95, 562, 2, 781, 1630] +[:mouse_move, 110, 552, 2, 782, 1631] +[:mouse_move, 122, 543, 2, 783, 1632] +[:mouse_move, 132, 538, 2, 784, 1633] +[:mouse_move, 137, 536, 2, 785, 1634] +[:mouse_move, 142, 534, 2, 786, 1635] +[:mouse_move, 143, 534, 2, 787, 1636] +[:mouse_move, 144, 534, 2, 788, 1637] +[:mouse_move, 144, 533, 2, 789, 1641] +[:mouse_move, 144, 532, 2, 790, 1642] +[:mouse_move, 145, 527, 2, 791, 1643] +[:mouse_move, 147, 522, 2, 792, 1644] +[:mouse_move, 157, 500, 2, 793, 1645] +[:mouse_move, 160, 493, 2, 794, 1646] +[:mouse_move, 168, 478, 2, 795, 1647] +[:mouse_move, 169, 474, 2, 796, 1648] +[:mouse_move, 175, 463, 2, 797, 1649] +[:mouse_move, 177, 460, 2, 798, 1650] +[:mouse_move, 179, 455, 2, 799, 1651] +[:mouse_move, 179, 453, 2, 800, 1652] +[:mouse_move, 179, 451, 2, 801, 1653] +[:mouse_move, 179, 448, 2, 802, 1654] +[:mouse_move, 179, 447, 2, 803, 1655] +[:mouse_move, 179, 445, 2, 804, 1656] +[:mouse_move, 178, 444, 2, 805, 1657] +[:mouse_move, 177, 443, 2, 806, 1658] +[:mouse_move, 175, 441, 2, 807, 1660] +[:mouse_move, 174, 440, 2, 808, 1661] +[:mouse_move, 173, 438, 2, 809, 1662] +[:mouse_move, 172, 437, 2, 810, 1664] +[:mouse_move, 171, 437, 2, 811, 1666] +[:mouse_button_pressed, 1, 0, 1, 812, 1674] +[:mouse_button_up, 1, 0, 1, 813, 1681] +[:key_down_raw, 1073742051, 1024, 2, 814, 1894] +[:key_down_raw, 113, 1024, 2, 815, 1896] diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image1.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image1.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image1.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image10.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image10.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image10.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image11.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image11.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image11.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image12.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image12.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image12.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image13.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image13.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image13.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image14.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image14.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image14.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image15.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image15.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image15.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image16.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image16.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image16.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image17.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image17.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image17.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image18.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image18.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image18.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image19.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image19.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image19.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image2.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image2.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image2.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image20.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image20.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image20.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image3.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image3.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image3.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image4.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image4.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image4.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image5.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image5.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image5.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image6.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image6.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image6.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image7.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image7.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image7.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image8.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image8.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image8.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/image9.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image9.png new file mode 100644 index 0000000..b0eb399 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/image9.png differ diff --git a/samples/04_physics_and_collisions/05_box_collision_2/sprites/player.png b/samples/04_physics_and_collisions/05_box_collision_2/sprites/player.png new file mode 100644 index 0000000..4c733a2 Binary files /dev/null and b/samples/04_physics_and_collisions/05_box_collision_2/sprites/player.png differ diff --git a/samples/04_physics_and_collisions/06_jump_physics/app/main.rb b/samples/04_physics_and_collisions/06_jump_physics/app/main.rb new file mode 100644 index 0000000..3fcb9e9 --- /dev/null +++ b/samples/04_physics_and_collisions/06_jump_physics/app/main.rb @@ -0,0 +1,196 @@ +=begin + + Reminders: + + - 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.) + + - args.outputs.solids: An array. The values generate a solid. + The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - num1.greater(num2): Returns the greater value. + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + +=end + +# This sample app is a game that requires the user to jump from one platform to the next. +# As the player successfully clears platforms, they become smaller and move faster. + +class VerticalPlatformer + attr_gtk + + # declares vertical platformer as new entity + def s + state.vertical_platformer ||= state.new_entity(:vertical_platformer) + state.vertical_platformer + end + + # creates a new platform using a hash + def new_platform hash + s.new_entity_strict(:platform, hash) # platform key + end + + # calls methods needed for game to run properly + def tick + defaults + render + calc + input + end + + # Sets default values + def defaults + s.platforms ||= [ # initializes platforms collection with two platforms using hashes + new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), + new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher + ] + + s.tick_count = args.state.tick_count + s.gravity = -0.3 # what goes up must come down because of gravity + s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared + s.player.x ||= 0 # sets player values + s.player.y ||= 100 + s.player.w ||= 64 + s.player.h ||= 64 + s.player.dy ||= 0 # change in position + s.player.dx ||= 0 + s.player_jump_power = 15 + s.player_jump_power_duration = 10 + s.player_max_run_speed = 5 + s.player_speed_slowdown_rate = 0.9 + s.player_acceleration = 1 + s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) + end + + # Outputs objects onto the screen + def render + outputs.solids << s.platforms.map do |p| # outputs platforms onto screen + [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center + # don't forget, position of platform is denoted by bottom left hand corner + end + + # outputs player using hash + outputs.solids << { + x: s.player.x + 300, # player positioned on top of platform + y: s.player.y - s.camera[:y], + w: s.player.w, + h: s.player.h, + r: 100, # color saturation + g: 100, + b: 200 + } + end + + # Performs calculations + def calc + s.platforms.each do |p| # for each platform in the collection + p.rect = [p.x, p.y, p.w, p.h] # set the definition + end + + # sets player point by adding half the player's width to the player's x + s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! + + # search the platforms collection to find if the player's point is inside the rect of a platform + collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } + + # if collision occurred and player is moving down (or not moving vertically at all) + if collision && s.player.dy <= 0 + s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform + s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically + if !s.player.platform + s.player.dx = 0 # no horizontal movement + end + # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x + s.player.x += collision.dx * collision.speed + s.player.platform = collision # player is on the platform that it collided with (or landed on) + if s.player.falling # if player is falling + s.player.dx = 0 # no horizontal movement + end + s.player.falling = false + s.player.jumped_at = nil + else + s.player.platform = nil # player is not on a platform + s.player.y += s.player.dy # velocity is the change in position + s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down + end + + s.platforms.each do |p| # for each platform in the collection + p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) + # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) + if p.x < -300 # if platform goes too far left + p.dx *= -1 # dx is scaled down + p.x = -300 # as far left as possible within scope + elsif p.x > (1000 - p.w) # if platform's x is greater than 300 + p.dx *= -1 + p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) + end + end + + delta = (s.player.y - s.camera[:y] - 100) # used to position camera view + + if delta > -200 + s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards + s.player.x += s.player.dx # velocity is change in position; change in x increases by dx + + # searches platform collection to find platforms located more than 300 pixels above the player + has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } + if !has_platforms # if there are no platforms 300 pixels above the player + width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous + s.player.platforms_cleared += 1 # player successfully cleared another platform + last_platform = s.platforms[-1] # platform just cleared becomes last platform + # another platform is created 300 pixels above the last platform, and this + # new platform has a smaller width and moves faster than all previous platforms + s.platforms << new_platform(x: (700 - width) * rand, # random x position + y: last_platform.y + 300, + w: width, + h: 32, + dx: 1.randomize(:sign), # random change in x + speed: 2 * s.player.platforms_cleared, + rect: nil) + end + else + s.as_hash.clear # otherwise clear the hash (no new platform is necessary) + end + end + + # Takes input from the user to move the player + def input + if inputs.keyboard.space # if the space bar is pressed + s.player.jumped_at ||= s.tick_count # set to current frame + + # if the time that has passed since the jump is less than the duration of a jump (10 frames) + # and the player is not falling + if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling + s.player.dy = s.player_jump_power # player jumps up + end + end + + if inputs.keyboard.key_up.space # if space bar is in "up" state + s.player.falling = true # player is falling + end + + if inputs.keyboard.left # if left key is pressed + s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration + s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater + elsif inputs.keyboard.right # if right key is pressed + s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration + s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser + else + s.player.dx *= s.player_speed_slowdown_rate # scales dx down + end + end +end + +$game = VerticalPlatformer.new + +def tick args + $game.args = args + $game.tick +end diff --git a/samples/04_physics_and_collisions/06_jump_physics/replay.txt b/samples/04_physics_and_collisions/06_jump_physics/replay.txt new file mode 100644 index 0000000..966dbcd --- /dev/null +++ b/samples/04_physics_and_collisions/06_jump_physics/replay.txt @@ -0,0 +1,124 @@ +replay_version 2.0 +stopped_at 1260 +seed 100 +recorded_at Sun Sep 29 22:23:22 2019 +[:key_down_raw, 1073741903, 0, 2, 1, 45] +[:key_down_raw, 1073741903, 0, 2, 2, 70] +[:key_down_raw, 1073741903, 0, 2, 3, 72] +[:key_down_raw, 1073741903, 0, 2, 4, 74] +[:key_down_raw, 1073741903, 0, 2, 5, 76] +[:key_down_raw, 1073741903, 0, 2, 6, 78] +[:key_down_raw, 1073741903, 0, 2, 7, 80] +[:key_down_raw, 1073741903, 0, 2, 8, 82] +[:key_down_raw, 1073741903, 0, 2, 9, 84] +[:key_down_raw, 1073741903, 0, 2, 10, 86] +[:key_down_raw, 1073741903, 0, 2, 11, 88] +[:key_up_raw, 1073741903, 0, 2, 12, 89] +[:key_down_raw, 1073741904, 0, 2, 13, 92] +[:key_down_raw, 1073741903, 0, 2, 14, 112] +[:key_up_raw, 1073741904, 0, 2, 15, 115] +[:key_down_raw, 1073741903, 0, 2, 16, 137] +[:key_down_raw, 1073741903, 0, 2, 17, 139] +[:key_down_raw, 8, 0, 2, 18, 141] +[:key_up_raw, 1073741903, 0, 2, 19, 146] +[:key_down_raw, 1073741903, 0, 2, 20, 147] +[:key_up_raw, 1073741903, 0, 2, 21, 147] +[:key_down_raw, 1073741904, 0, 2, 22, 154] +[:key_up_raw, 8, 0, 2, 23, 172] +[:key_down_raw, 1073741903, 0, 2, 24, 175] +[:key_up_raw, 1073741904, 0, 2, 25, 175] +[:key_down_raw, 32, 0, 2, 26, 194] +[:key_down_raw, 1073741904, 0, 2, 27, 201] +[:key_up_raw, 1073741903, 0, 2, 28, 202] +[:key_down_raw, 1073741903, 0, 2, 29, 222] +[:key_up_raw, 1073741904, 0, 2, 30, 226] +[:key_up_raw, 32, 0, 2, 31, 233] +[:key_down_raw, 1073741903, 0, 2, 32, 247] +[:key_down_raw, 1073741903, 0, 2, 33, 249] +[:key_down_raw, 1073741903, 0, 2, 34, 251] +[:key_down_raw, 1073741903, 0, 2, 35, 253] +[:key_down_raw, 1073741903, 0, 2, 36, 255] +[:key_down_raw, 1073741903, 0, 2, 37, 257] +[:key_down_raw, 1073741903, 0, 2, 38, 259] +[:key_down_raw, 1073741903, 0, 2, 39, 261] +[:key_down_raw, 1073741903, 0, 2, 40, 263] +[:key_down_raw, 1073741903, 0, 2, 41, 265] +[:key_down_raw, 1073741903, 0, 2, 42, 267] +[:key_down_raw, 1073741903, 0, 2, 43, 269] +[:key_down_raw, 1073741903, 0, 2, 44, 271] +[:key_down_raw, 1073741903, 0, 2, 45, 273] +[:key_down_raw, 1073741903, 0, 2, 46, 275] +[:key_up_raw, 1073741903, 0, 2, 47, 276] +[:key_down_raw, 1073741904, 0, 2, 48, 280] +[:key_up_raw, 1073741904, 0, 2, 49, 297] +[:key_down_raw, 1073741903, 0, 2, 50, 300] +[:key_down_raw, 32, 0, 2, 51, 303] +[:key_up_raw, 32, 0, 2, 52, 308] +[:key_up_raw, 1073741903, 0, 2, 53, 334] +[:key_down_raw, 1073741904, 0, 2, 54, 336] +[:key_down_raw, 1073741903, 0, 2, 55, 355] +[:key_up_raw, 1073741904, 0, 2, 56, 355] +[:key_up_raw, 1073741903, 0, 2, 57, 373] +[:key_down_raw, 1073741904, 0, 2, 58, 380] +[:key_down_raw, 32, 0, 2, 59, 398] +[:key_up_raw, 32, 0, 2, 60, 404] +[:key_up_raw, 1073741904, 0, 2, 61, 490] +[:key_down_raw, 32, 0, 2, 62, 510] +[:key_up_raw, 32, 0, 2, 63, 516] +[:key_down_raw, 1073741903, 0, 2, 64, 517] +[:key_up_raw, 1073741903, 0, 2, 65, 537] +[:key_down_raw, 1073741904, 0, 2, 66, 538] +[:key_up_raw, 1073741904, 0, 2, 67, 553] +[:key_down_raw, 32, 0, 2, 68, 653] +[:key_up_raw, 32, 0, 2, 69, 659] +[:key_down_raw, 1073741903, 0, 2, 70, 661] +[:key_down_raw, 1073741903, 0, 2, 71, 686] +[:key_up_raw, 1073741903, 0, 2, 72, 687] +[:key_down_raw, 1073741904, 0, 2, 73, 690] +[:key_down_raw, 1073741904, 0, 2, 74, 715] +[:key_down_raw, 1073741904, 0, 2, 75, 717] +[:key_down_raw, 1073741904, 0, 2, 76, 719] +[:key_down_raw, 1073741904, 0, 2, 77, 721] +[:key_down_raw, 1073741904, 0, 2, 78, 723] +[:key_down_raw, 1073741904, 0, 2, 79, 725] +[:key_down_raw, 1073741904, 0, 2, 80, 727] +[:key_down_raw, 1073741904, 0, 2, 81, 729] +[:key_up_raw, 1073741904, 0, 2, 82, 731] +[:key_down_raw, 1073741903, 0, 2, 83, 740] +[:key_down_raw, 32, 0, 2, 84, 749] +[:key_up_raw, 32, 0, 2, 85, 756] +[:key_up_raw, 1073741903, 0, 2, 86, 789] +[:key_down_raw, 1073741904, 0, 2, 87, 792] +[:key_down_raw, 1073741904, 0, 2, 88, 817] +[:key_up_raw, 1073741904, 0, 2, 89, 817] +[:key_down_raw, 32, 0, 2, 90, 844] +[:key_down_raw, 1073741903, 0, 2, 91, 846] +[:key_up_raw, 32, 0, 2, 92, 852] +[:key_down_raw, 1073741903, 0, 2, 93, 871] +[:key_down_raw, 1073741903, 0, 2, 94, 873] +[:key_down_raw, 1073741903, 0, 2, 95, 875] +[:key_down_raw, 1073741903, 0, 2, 96, 877] +[:key_down_raw, 1073741903, 0, 2, 97, 879] +[:key_down_raw, 1073741903, 0, 2, 98, 881] +[:key_down_raw, 1073741903, 0, 2, 99, 883] +[:key_down_raw, 1073741903, 0, 2, 100, 885] +[:key_down_raw, 1073741903, 0, 2, 101, 887] +[:key_up_raw, 1073741903, 0, 2, 102, 887] +[:key_down_raw, 1073741904, 0, 2, 103, 897] +[:key_up_raw, 1073741904, 0, 2, 104, 901] +[:key_down_raw, 32, 0, 2, 105, 948] +[:key_up_raw, 32, 0, 2, 106, 953] +[:key_down_raw, 1073741904, 0, 2, 107, 977] +[:key_up_raw, 1073741904, 0, 2, 108, 991] +[:key_down_raw, 32, 0, 2, 109, 1056] +[:key_up_raw, 32, 0, 2, 110, 1060] +[:key_down_raw, 1073741904, 0, 2, 111, 1065] +[:key_down_raw, 1073741904, 0, 2, 112, 1090] +[:key_down_raw, 1073741904, 0, 2, 113, 1092] +[:key_down_raw, 1073741904, 0, 2, 114, 1094] +[:key_down_raw, 1073741904, 0, 2, 115, 1096] +[:key_up_raw, 1073741904, 0, 2, 116, 1098] +[:key_down_raw, 1073741903, 0, 2, 117, 1108] +[:key_up_raw, 1073741903, 0, 2, 118, 1127] +[:key_down_raw, 1073742051, 1024, 2, 119, 1258] +[:key_down_raw, 113, 1024, 2, 120, 1259] diff --git a/samples/05_mouse/01_mouse_click/app/main.rb b/samples/05_mouse/01_mouse_click/app/main.rb new file mode 100644 index 0000000..8969a6e --- /dev/null +++ b/samples/05_mouse/01_mouse_click/app/main.rb @@ -0,0 +1,244 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - product: Returns an array of all combinations of elements from all arrays. + + For example, [1,2].product([1,2]) would return the following array... + [[1,1], [1,2], [2,1], [2,2]] + More than two arrays can be given to product and it will still work, + such as [1,2].product([1,2],[3,4]). What would product return in this case? + + Answer: + [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] + + - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + + - yield: Allows you to call a method with a code block and yield to that block. + + Reminders: + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + + - 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.inputs.mouse.click: This property will be set if the mouse was clicked. + + - Ternary operator (?): Will evaluate a statement (just like an if statement) + and perform an action if the result is true or another action if it is false. + + - reject: Removes elements from a collection if they meet certain requirements. + + - args.outputs.borders: An array. The values generate a border. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + + - 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. + +=end + +# This sample app is a classic game of Tic Tac Toe. + +class TicTacToe + attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk + + # Starts the game with player x's turn and creates an array (to_a) for space combinations. + # Calls methods necessary for the game to run properly. + def tick + state.current_turn ||= :x + state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + render_board + input_board + end + + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. + def render_board + square_size = 80 + + # Positions the game's board in the center of the screen. + # Try removing what follows grid.w_half or grid.h_half and see how the position changes! + board_left = grid.w_half - square_size * 1.5 + board_top = grid.h_half - square_size * 1.5 + + # At first glance, the add(1) looks pretty trivial. But if you remove it, + # you'll see that the positioning of the board would be skewed without it! + # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares + # due to the change in board placement. + outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces + space.border ||= [ + board_left + x.add(1) * square_size, # space.border is initialized using this definition + board_top + y.add(1) * square_size, + square_size, + square_size + ] + end + + # Again, the calculations ensure that the piece is placed in the center of the grid square. + # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. + outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board + label board_left + x.add(1) * square_size + square_size.fdiv(2), + board_top + y.add(1) * square_size + square_size - 20, + space.piece # text of label, either "x" or "o" + end + + # Uses a label to output whether x or o won, or if a draw occurred. + # If the game is ongoing, a label shows whose turn it currently is. + outputs.labels << if state.x_won + label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top + elsif state.o_won + label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally + elsif state.draw + label grid.w_half, grid.top - 80, "a draw" + else # if no one won and the game is ongoing + label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" + end + end + + # Calls the methods responsible for handling user input and determining the winner. + # Does nothing unless the mouse is clicked. + def input_board + return unless inputs.mouse.click + input_place_piece + input_restart_game + determine_winner + end + + # Handles user input for placing pieces on the board. + def input_place_piece + return if state.game_over + + # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already + # have a piece in it. + __, __, space = all_spaces.find do |__, __, space| + inputs.mouse.click.point.inside_rect?(space.border) && !space.piece + end + + # The piece that goes into the space belongs to the player whose turn it currently is. + return unless space + space.piece = state.current_turn + + # This ternary operator statement allows us to change the current player's turn. + # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. + state.current_turn = state.current_turn == :x ? :o : :x + end + + # Resets the game. + def input_restart_game + return unless state.game_over + gtk.reset + end + + # Checks if x or o won the game. + # If neither player wins and all nine squares are filled, a draw happens. + # Once a player is chosen as the winner or a draw happens, the game is over. + def determine_winner + state.x_won = won? :x # evaluates to either true or false (boolean values) + state.o_won = won? :o + state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won + state.game_over = state.x_won || state.o_won || state.draw + end + + # Determines if a player won by checking if there is a horizontal match or vertical match. + # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. + def won? piece + # performs action on all space combinations + won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| + + # Checks if the 3 grid spaces with the same y value (or same row) and + # x values that are next to each other have pieces that belong to the same player. + # Remember, the value of piece is equal to the current turn (which is the player). + horizontal_match = state.spaces[xs[0]][y].piece == piece && + state.spaces[xs[1]][y].piece == piece && + state.spaces[xs[2]][y].piece == piece + + # Checks if the 3 grid spaces with the same x value (or same column) and + # y values that are next to each other have pieces that belong to the same player. + # The && represents an "and" statement: if even one part of the statement is false, + # the entire statement evaluates to false. + vertical_match = state.spaces[y][xs[0]].piece == piece && + state.spaces[y][xs[1]].piece == piece && + state.spaces[y][xs[2]].piece == piece + + horizontal_match || vertical_match # if either is true, true is returned + end + + # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. + # Is added to won regardless of whether the statement is true or false. + won << (state.spaces[-1][-1].piece == piece && # bottom left + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[ 1][ 1].piece == piece) # top right + + # Sees if there is a diagonal match, starting at the bottom right and ending at the top left + # and is added to won. + won << (state.spaces[ 1][-1].piece == piece && # bottom right + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[-1][ 1].piece == piece) # top left + + # Any false statements (meaning false diagonal matches) are rejected from won + won.reject_false.any? + end + + # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. + # The ! before a statement means "not". For example, we are rejecting any space combinations that do + # NOT have pieces in them. + def filled_spaces + state.space_combinations + .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them + .map do |x, y| + if block_given? + yield x, y, state.spaces[x][y] + else + [x, y, state.spaces[x][y]] # sets definition of space + end + end + end + + # Defines all spaces on the board. + def all_spaces + if !block_given? + state.space_combinations.map do |x, y| + [x, y, state.spaces[x][y]] # sets definition of space + end + else # if a block is given (block_given? is true) + state.space_combinations.map do |x, y| + yield x, y, state.spaces[x][y] # yield if a block is given + end + end + end + + # Sets values for a label, such as the position, value, size, alignment, and color. + def label x, y, value + [x, y + 10, value, 20, 1, 0, 0, 0] + end +end + +$tic_tac_toe = TicTacToe.new + +def tick args + $tic_tac_toe._ = args + $tic_tac_toe.state = args.state + $tic_tac_toe.outputs = args.outputs + $tic_tac_toe.inputs = args.inputs + $tic_tac_toe.grid = args.grid + $tic_tac_toe.gtk = args.gtk + $tic_tac_toe.tick + tick_instructions args, "Sample app shows how to work with mouse clicks." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse/01_mouse_click/license-for-sample.txt b/samples/05_mouse/01_mouse_click/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/05_mouse/01_mouse_click/license-for-sample.txt @@ -0,0 +1,9 @@ +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/05_mouse/01_mouse_click/replay.txt b/samples/05_mouse/01_mouse_click/replay.txt new file mode 100644 index 0000000..1ea08dc --- /dev/null +++ b/samples/05_mouse/01_mouse_click/replay.txt @@ -0,0 +1,870 @@ +replay_version 2.0 +stopped_at 1699 +seed 100 +recorded_at Sun Sep 29 21:49:02 2019 +[:mouse_move, 297, 112, 2, 1, 34] +[:mouse_move, 305, 112, 2, 2, 35] +[:mouse_move, 311, 112, 2, 3, 36] +[:mouse_move, 337, 111, 2, 4, 38] +[:mouse_move, 359, 110, 2, 5, 40] +[:mouse_move, 398, 112, 2, 6, 41] +[:mouse_move, 415, 118, 2, 7, 42] +[:mouse_move, 422, 124, 2, 8, 43] +[:mouse_move, 441, 140, 2, 9, 44] +[:mouse_move, 448, 148, 2, 10, 45] +[:mouse_move, 455, 163, 2, 11, 46] +[:mouse_move, 457, 174, 2, 12, 47] +[:mouse_move, 450, 183, 2, 13, 48] +[:mouse_move, 441, 187, 2, 14, 49] +[:mouse_move, 420, 190, 2, 15, 50] +[:mouse_move, 414, 190, 2, 16, 51] +[:mouse_move, 409, 190, 2, 17, 52] +[:mouse_move, 398, 188, 2, 18, 53] +[:mouse_move, 395, 187, 2, 19, 54] +[:mouse_move, 390, 185, 2, 20, 55] +[:mouse_move, 390, 184, 2, 21, 57] +[:mouse_move, 401, 189, 2, 22, 121] +[:mouse_move, 444, 221, 2, 23, 123] +[:mouse_move, 485, 255, 2, 24, 124] +[:mouse_move, 510, 280, 2, 25, 125] +[:mouse_move, 526, 296, 2, 26, 126] +[:mouse_move, 530, 301, 2, 27, 127] +[:mouse_move, 545, 317, 2, 28, 128] +[:mouse_move, 548, 321, 2, 29, 129] +[:mouse_move, 550, 324, 2, 30, 130] +[:mouse_move, 550, 326, 2, 31, 131] +[:mouse_move, 548, 324, 2, 32, 133] +[:mouse_move, 546, 319, 2, 33, 134] +[:mouse_move, 546, 306, 2, 34, 136] +[:mouse_move, 546, 301, 2, 35, 137] +[:mouse_move, 553, 282, 2, 36, 138] +[:mouse_move, 557, 271, 2, 37, 139] +[:mouse_move, 566, 232, 2, 38, 140] +[:mouse_move, 567, 215, 2, 39, 142] +[:mouse_move, 567, 203, 2, 40, 143] +[:mouse_move, 565, 184, 2, 41, 144] +[:mouse_move, 560, 177, 2, 42, 145] +[:mouse_move, 547, 163, 2, 43, 146] +[:mouse_move, 540, 159, 2, 44, 148] +[:mouse_move, 539, 157, 2, 45, 149] +[:mouse_move, 536, 156, 2, 46, 150] +[:mouse_move, 535, 154, 2, 47, 151] +[:mouse_move, 534, 153, 2, 48, 153] +[:mouse_move, 534, 152, 2, 49, 155] +[:mouse_move, 534, 151, 2, 50, 156] +[:mouse_move, 534, 150, 2, 51, 158] +[:mouse_move, 537, 150, 2, 52, 159] +[:mouse_move, 542, 149, 2, 53, 160] +[:mouse_move, 587, 152, 2, 54, 161] +[:mouse_move, 612, 155, 2, 55, 162] +[:mouse_move, 669, 161, 2, 56, 163] +[:mouse_move, 681, 161, 2, 57, 164] +[:mouse_move, 713, 160, 2, 58, 165] +[:mouse_move, 741, 155, 2, 59, 167] +[:mouse_move, 744, 154, 2, 60, 168] +[:mouse_move, 758, 151, 2, 61, 169] +[:mouse_move, 759, 151, 2, 62, 170] +[:mouse_move, 760, 151, 2, 63, 171] +[:mouse_move, 761, 151, 2, 64, 172] +[:mouse_move, 761, 152, 2, 65, 187] +[:mouse_move, 757, 160, 2, 66, 188] +[:mouse_move, 724, 198, 2, 67, 190] +[:mouse_move, 706, 214, 2, 68, 191] +[:mouse_move, 659, 243, 2, 69, 192] +[:mouse_move, 617, 259, 2, 70, 194] +[:mouse_move, 603, 264, 2, 71, 195] +[:mouse_move, 597, 265, 2, 72, 196] +[:mouse_move, 589, 268, 2, 73, 197] +[:mouse_move, 578, 271, 2, 74, 198] +[:mouse_move, 572, 272, 2, 75, 199] +[:mouse_move, 571, 272, 2, 76, 200] +[:mouse_move, 570, 272, 2, 77, 201] +[:mouse_move, 568, 273, 2, 78, 202] +[:mouse_move, 565, 273, 2, 79, 204] +[:mouse_move, 562, 275, 2, 80, 205] +[:mouse_move, 560, 276, 2, 81, 206] +[:mouse_move, 558, 276, 2, 82, 207] +[:mouse_move, 555, 277, 2, 83, 208] +[:mouse_move, 554, 278, 2, 84, 209] +[:mouse_move, 552, 279, 2, 85, 210] +[:mouse_move, 551, 279, 2, 86, 212] +[:mouse_button_pressed, 1, 0, 1, 87, 217] +[:mouse_button_up, 1, 0, 1, 88, 225] +[:mouse_move, 551, 280, 2, 89, 270] +[:mouse_move, 551, 283, 2, 90, 271] +[:mouse_move, 552, 296, 2, 91, 272] +[:mouse_move, 553, 314, 2, 92, 273] +[:mouse_move, 560, 391, 2, 93, 274] +[:mouse_move, 562, 409, 2, 94, 275] +[:mouse_move, 566, 440, 2, 95, 276] +[:mouse_move, 567, 448, 2, 96, 277] +[:mouse_move, 568, 464, 2, 97, 278] +[:mouse_move, 570, 482, 2, 98, 279] +[:mouse_move, 571, 488, 2, 99, 280] +[:mouse_move, 571, 489, 2, 100, 281] +[:mouse_move, 570, 489, 2, 101, 285] +[:mouse_move, 570, 488, 2, 102, 286] +[:mouse_move, 570, 487, 2, 103, 287] +[:mouse_move, 570, 486, 2, 104, 288] +[:mouse_move, 569, 483, 2, 105, 289] +[:mouse_move, 569, 475, 2, 106, 290] +[:mouse_move, 568, 473, 2, 107, 291] +[:mouse_move, 568, 467, 2, 108, 292] +[:mouse_move, 567, 464, 2, 109, 293] +[:mouse_move, 567, 461, 2, 110, 294] +[:mouse_move, 567, 460, 2, 111, 295] +[:mouse_move, 567, 459, 2, 112, 296] +[:mouse_move, 567, 458, 2, 113, 298] +[:mouse_move, 567, 457, 2, 114, 300] +[:mouse_move, 567, 456, 2, 115, 301] +[:mouse_move, 567, 455, 2, 116, 303] +[:mouse_button_pressed, 1, 0, 1, 117, 305] +[:mouse_button_up, 1, 0, 1, 118, 311] +[:mouse_move, 576, 455, 2, 119, 325] +[:mouse_move, 585, 455, 2, 120, 326] +[:mouse_move, 592, 455, 2, 121, 327] +[:mouse_move, 616, 457, 2, 122, 328] +[:mouse_move, 637, 458, 2, 123, 329] +[:mouse_move, 656, 458, 2, 124, 331] +[:mouse_move, 665, 458, 2, 125, 332] +[:mouse_move, 670, 458, 2, 126, 333] +[:mouse_move, 673, 458, 2, 127, 334] +[:mouse_move, 679, 458, 2, 128, 335] +[:mouse_move, 680, 458, 2, 129, 336] +[:mouse_move, 685, 458, 2, 130, 337] +[:mouse_move, 686, 458, 2, 131, 338] +[:mouse_move, 687, 458, 2, 132, 339] +[:mouse_move, 691, 458, 2, 133, 340] +[:mouse_move, 693, 458, 2, 134, 341] +[:mouse_move, 696, 458, 2, 135, 342] +[:mouse_move, 700, 458, 2, 136, 343] +[:mouse_move, 702, 458, 2, 137, 344] +[:mouse_move, 706, 458, 2, 138, 345] +[:mouse_move, 707, 458, 2, 139, 346] +[:mouse_move, 708, 458, 2, 140, 347] +[:mouse_move, 709, 458, 2, 141, 349] +[:mouse_button_pressed, 1, 0, 1, 142, 351] +[:mouse_button_up, 1, 0, 1, 143, 358] +[:mouse_move, 708, 458, 2, 144, 365] +[:mouse_move, 704, 455, 2, 145, 366] +[:mouse_move, 702, 454, 2, 146, 367] +[:mouse_move, 696, 448, 2, 147, 368] +[:mouse_move, 693, 444, 2, 148, 369] +[:mouse_move, 686, 437, 2, 149, 370] +[:mouse_move, 683, 433, 2, 150, 371] +[:mouse_move, 673, 419, 2, 151, 372] +[:mouse_move, 666, 410, 2, 152, 373] +[:mouse_move, 660, 402, 2, 153, 374] +[:mouse_move, 654, 394, 2, 154, 375] +[:mouse_move, 651, 390, 2, 155, 376] +[:mouse_move, 646, 384, 2, 156, 377] +[:mouse_move, 644, 381, 2, 157, 378] +[:mouse_move, 643, 379, 2, 158, 379] +[:mouse_move, 640, 375, 2, 159, 380] +[:mouse_move, 639, 374, 2, 160, 381] +[:mouse_move, 638, 371, 2, 161, 382] +[:mouse_move, 637, 369, 2, 162, 383] +[:mouse_move, 637, 367, 2, 163, 385] +[:mouse_move, 636, 366, 2, 164, 386] +[:mouse_move, 636, 365, 2, 165, 387] +[:mouse_button_pressed, 1, 0, 1, 166, 389] +[:mouse_button_up, 1, 0, 1, 167, 395] +[:mouse_move, 638, 364, 2, 168, 409] +[:mouse_move, 648, 356, 2, 169, 410] +[:mouse_move, 655, 350, 2, 170, 411] +[:mouse_move, 664, 342, 2, 171, 412] +[:mouse_move, 673, 334, 2, 172, 413] +[:mouse_move, 685, 325, 2, 173, 414] +[:mouse_move, 692, 319, 2, 174, 415] +[:mouse_move, 699, 312, 2, 175, 416] +[:mouse_move, 708, 304, 2, 176, 417] +[:mouse_move, 712, 301, 2, 177, 418] +[:mouse_move, 713, 300, 2, 178, 419] +[:mouse_move, 716, 297, 2, 179, 420] +[:mouse_move, 718, 296, 2, 180, 421] +[:mouse_move, 720, 293, 2, 181, 422] +[:mouse_move, 721, 292, 2, 182, 423] +[:mouse_move, 722, 292, 2, 183, 426] +[:mouse_move, 722, 291, 2, 184, 427] +[:mouse_button_pressed, 1, 0, 1, 185, 443] +[:mouse_button_up, 1, 0, 1, 186, 450] +[:mouse_move, 719, 291, 2, 187, 488] +[:mouse_move, 716, 290, 2, 188, 489] +[:mouse_move, 707, 288, 2, 189, 490] +[:mouse_move, 696, 287, 2, 190, 491] +[:mouse_move, 689, 286, 2, 191, 492] +[:mouse_move, 677, 286, 2, 192, 493] +[:mouse_move, 672, 286, 2, 193, 494] +[:mouse_move, 664, 286, 2, 194, 495] +[:mouse_move, 660, 286, 2, 195, 496] +[:mouse_move, 654, 286, 2, 196, 497] +[:mouse_move, 650, 286, 2, 197, 499] +[:mouse_move, 648, 286, 2, 198, 501] +[:mouse_button_pressed, 1, 0, 1, 199, 503] +[:mouse_button_up, 1, 0, 1, 200, 509] +[:mouse_move, 648, 287, 2, 201, 514] +[:mouse_move, 648, 288, 2, 202, 515] +[:mouse_move, 648, 289, 2, 203, 518] +[:mouse_move, 648, 290, 2, 204, 521] +[:mouse_move, 652, 296, 2, 205, 522] +[:mouse_move, 657, 303, 2, 206, 523] +[:mouse_move, 667, 314, 2, 207, 524] +[:mouse_move, 676, 323, 2, 208, 526] +[:mouse_move, 688, 334, 2, 209, 527] +[:mouse_move, 694, 340, 2, 210, 528] +[:mouse_move, 697, 342, 2, 211, 529] +[:mouse_move, 700, 344, 2, 212, 530] +[:mouse_move, 703, 346, 2, 213, 531] +[:mouse_move, 705, 347, 2, 214, 532] +[:mouse_move, 707, 348, 2, 215, 533] +[:mouse_move, 708, 349, 2, 216, 534] +[:mouse_move, 708, 350, 2, 217, 535] +[:mouse_move, 709, 352, 2, 218, 536] +[:mouse_move, 710, 353, 2, 219, 537] +[:mouse_move, 711, 354, 2, 220, 538] +[:mouse_move, 712, 354, 2, 221, 539] +[:mouse_move, 712, 355, 2, 222, 540] +[:mouse_move, 713, 355, 2, 223, 543] +[:mouse_button_pressed, 1, 0, 1, 224, 543] +[:mouse_button_up, 1, 0, 1, 225, 550] +[:mouse_move, 713, 353, 2, 226, 572] +[:mouse_move, 715, 341, 2, 227, 574] +[:mouse_move, 716, 333, 2, 228, 575] +[:mouse_move, 718, 310, 2, 229, 576] +[:mouse_move, 719, 290, 2, 230, 577] +[:mouse_move, 717, 259, 2, 231, 578] +[:mouse_move, 711, 247, 2, 232, 580] +[:mouse_move, 701, 233, 2, 233, 581] +[:mouse_move, 696, 227, 2, 234, 582] +[:mouse_move, 689, 222, 2, 235, 583] +[:mouse_move, 668, 208, 2, 236, 584] +[:mouse_move, 656, 201, 2, 237, 585] +[:mouse_move, 650, 197, 2, 238, 586] +[:mouse_move, 638, 189, 2, 239, 587] +[:mouse_move, 627, 181, 2, 240, 588] +[:mouse_move, 623, 179, 2, 241, 589] +[:mouse_move, 605, 164, 2, 242, 590] +[:mouse_move, 600, 160, 2, 243, 591] +[:mouse_move, 592, 153, 2, 244, 592] +[:mouse_move, 583, 145, 2, 245, 593] +[:mouse_move, 580, 143, 2, 246, 594] +[:mouse_move, 576, 140, 2, 247, 595] +[:mouse_move, 572, 139, 2, 248, 597] +[:mouse_move, 571, 138, 2, 249, 598] +[:mouse_move, 586, 146, 2, 250, 603] +[:mouse_move, 600, 152, 2, 251, 604] +[:mouse_move, 636, 161, 2, 252, 605] +[:mouse_move, 665, 164, 2, 253, 607] +[:mouse_move, 672, 164, 2, 254, 608] +[:mouse_move, 704, 162, 2, 255, 609] +[:mouse_move, 715, 156, 2, 256, 611] +[:mouse_move, 723, 148, 2, 257, 612] +[:mouse_move, 725, 144, 2, 258, 613] +[:mouse_move, 729, 135, 2, 259, 614] +[:mouse_move, 730, 131, 2, 260, 615] +[:mouse_move, 730, 126, 2, 261, 616] +[:mouse_move, 730, 117, 2, 262, 617] +[:mouse_move, 721, 101, 2, 263, 618] +[:mouse_move, 713, 92, 2, 264, 619] +[:mouse_move, 705, 83, 2, 265, 620] +[:mouse_move, 691, 71, 2, 266, 621] +[:mouse_move, 682, 65, 2, 267, 622] +[:mouse_move, 666, 55, 2, 268, 623] +[:mouse_move, 657, 52, 2, 269, 624] +[:mouse_move, 635, 48, 2, 270, 625] +[:mouse_move, 621, 48, 2, 271, 626] +[:mouse_move, 613, 48, 2, 272, 627] +[:mouse_move, 589, 52, 2, 273, 628] +[:mouse_move, 570, 61, 2, 274, 630] +[:mouse_move, 544, 85, 2, 275, 632] +[:mouse_move, 540, 90, 2, 276, 633] +[:mouse_move, 532, 101, 2, 277, 634] +[:mouse_move, 525, 116, 2, 278, 636] +[:mouse_move, 523, 123, 2, 279, 637] +[:mouse_move, 523, 127, 2, 280, 638] +[:mouse_move, 526, 139, 2, 281, 639] +[:mouse_move, 531, 145, 2, 282, 640] +[:mouse_move, 550, 159, 2, 283, 641] +[:mouse_move, 563, 166, 2, 284, 642] +[:mouse_move, 587, 175, 2, 285, 643] +[:mouse_move, 655, 186, 2, 286, 644] +[:mouse_move, 674, 186, 2, 287, 645] +[:mouse_move, 718, 186, 2, 288, 646] +[:mouse_move, 745, 183, 2, 289, 647] +[:mouse_move, 757, 180, 2, 290, 648] +[:mouse_move, 760, 178, 2, 291, 649] +[:mouse_move, 773, 173, 2, 292, 650] +[:mouse_move, 778, 169, 2, 293, 651] +[:mouse_move, 781, 161, 2, 294, 652] +[:mouse_move, 782, 154, 2, 295, 653] +[:mouse_move, 780, 146, 2, 296, 654] +[:mouse_move, 765, 125, 2, 297, 655] +[:mouse_move, 730, 95, 2, 298, 657] +[:mouse_move, 713, 84, 2, 299, 658] +[:mouse_move, 678, 69, 2, 300, 659] +[:mouse_move, 658, 65, 2, 301, 661] +[:mouse_move, 636, 63, 2, 302, 662] +[:mouse_move, 609, 65, 2, 303, 663] +[:mouse_move, 601, 68, 2, 304, 664] +[:mouse_move, 594, 71, 2, 305, 665] +[:mouse_move, 587, 76, 2, 306, 666] +[:mouse_move, 573, 92, 2, 307, 667] +[:mouse_move, 561, 125, 2, 308, 668] +[:mouse_move, 557, 145, 2, 309, 669] +[:mouse_move, 555, 168, 2, 310, 670] +[:mouse_move, 557, 220, 2, 311, 671] +[:mouse_move, 566, 247, 2, 312, 672] +[:mouse_move, 595, 302, 2, 313, 673] +[:mouse_move, 603, 311, 2, 314, 674] +[:mouse_move, 620, 337, 2, 315, 675] +[:mouse_move, 629, 348, 2, 316, 676] +[:mouse_move, 633, 353, 2, 317, 677] +[:mouse_move, 635, 356, 2, 318, 678] +[:mouse_move, 637, 358, 2, 319, 679] +[:mouse_move, 638, 359, 2, 320, 681] +[:mouse_button_pressed, 1, 0, 1, 321, 685] +[:mouse_button_up, 1, 0, 1, 322, 691] +[:mouse_move, 631, 359, 2, 323, 707] +[:mouse_move, 626, 358, 2, 324, 708] +[:mouse_move, 622, 357, 2, 325, 709] +[:mouse_move, 618, 354, 2, 326, 710] +[:mouse_move, 612, 347, 2, 327, 711] +[:mouse_move, 608, 342, 2, 328, 712] +[:mouse_move, 598, 325, 2, 329, 713] +[:mouse_move, 593, 313, 2, 330, 714] +[:mouse_move, 588, 303, 2, 331, 715] +[:mouse_move, 586, 296, 2, 332, 716] +[:mouse_move, 580, 284, 2, 333, 717] +[:mouse_move, 577, 279, 2, 334, 719] +[:mouse_move, 576, 278, 2, 335, 720] +[:mouse_move, 574, 277, 2, 336, 721] +[:mouse_move, 572, 276, 2, 337, 722] +[:mouse_move, 569, 276, 2, 338, 723] +[:mouse_move, 567, 275, 2, 339, 724] +[:mouse_move, 566, 275, 2, 340, 725] +[:mouse_move, 565, 275, 2, 341, 726] +[:mouse_move, 564, 275, 2, 342, 729] +[:mouse_button_pressed, 1, 0, 1, 343, 736] +[:mouse_button_up, 1, 0, 1, 344, 743] +[:mouse_move, 572, 275, 2, 345, 761] +[:mouse_move, 577, 275, 2, 346, 762] +[:mouse_move, 591, 275, 2, 347, 763] +[:mouse_move, 596, 275, 2, 348, 764] +[:mouse_move, 603, 274, 2, 349, 765] +[:mouse_move, 606, 274, 2, 350, 766] +[:mouse_move, 619, 273, 2, 351, 767] +[:mouse_move, 620, 273, 2, 352, 768] +[:mouse_move, 623, 273, 2, 353, 769] +[:mouse_move, 625, 273, 2, 354, 771] +[:mouse_move, 626, 273, 2, 355, 774] +[:mouse_button_pressed, 1, 0, 1, 356, 781] +[:mouse_button_up, 1, 0, 1, 357, 788] +[:mouse_move, 629, 273, 2, 358, 795] +[:mouse_move, 637, 273, 2, 359, 796] +[:mouse_move, 646, 273, 2, 360, 797] +[:mouse_move, 654, 273, 2, 361, 798] +[:mouse_move, 664, 273, 2, 362, 799] +[:mouse_move, 677, 273, 2, 363, 800] +[:mouse_move, 687, 273, 2, 364, 801] +[:mouse_move, 692, 273, 2, 365, 802] +[:mouse_move, 697, 273, 2, 366, 803] +[:mouse_move, 702, 273, 2, 367, 804] +[:mouse_move, 704, 273, 2, 368, 805] +[:mouse_move, 705, 273, 2, 369, 806] +[:mouse_move, 707, 273, 2, 370, 807] +[:mouse_move, 708, 273, 2, 371, 808] +[:mouse_move, 711, 274, 2, 372, 809] +[:mouse_move, 713, 274, 2, 373, 810] +[:mouse_move, 715, 274, 2, 374, 811] +[:mouse_move, 716, 274, 2, 375, 812] +[:mouse_move, 717, 274, 2, 376, 814] +[:mouse_move, 718, 274, 2, 377, 815] +[:mouse_button_pressed, 1, 0, 1, 378, 817] +[:mouse_button_up, 1, 0, 1, 379, 825] +[:mouse_move, 717, 274, 2, 380, 829] +[:mouse_move, 711, 276, 2, 381, 830] +[:mouse_move, 708, 277, 2, 382, 831] +[:mouse_move, 701, 280, 2, 383, 832] +[:mouse_move, 697, 283, 2, 384, 833] +[:mouse_move, 693, 284, 2, 385, 834] +[:mouse_move, 679, 291, 2, 386, 835] +[:mouse_move, 672, 296, 2, 387, 836] +[:mouse_move, 668, 299, 2, 388, 837] +[:mouse_move, 662, 305, 2, 389, 838] +[:mouse_move, 658, 308, 2, 390, 839] +[:mouse_move, 653, 314, 2, 391, 840] +[:mouse_move, 649, 321, 2, 392, 842] +[:mouse_move, 648, 323, 2, 393, 843] +[:mouse_move, 647, 325, 2, 394, 844] +[:mouse_move, 645, 329, 2, 395, 845] +[:mouse_move, 644, 331, 2, 396, 846] +[:mouse_move, 642, 336, 2, 397, 847] +[:mouse_move, 641, 337, 2, 398, 848] +[:mouse_move, 639, 341, 2, 399, 849] +[:mouse_move, 638, 343, 2, 400, 850] +[:mouse_move, 637, 344, 2, 401, 851] +[:mouse_move, 636, 345, 2, 402, 852] +[:mouse_move, 635, 346, 2, 403, 853] +[:mouse_move, 635, 347, 2, 404, 854] +[:mouse_move, 634, 348, 2, 405, 855] +[:mouse_move, 634, 349, 2, 406, 857] +[:mouse_button_pressed, 1, 0, 1, 407, 858] +[:mouse_button_up, 1, 0, 1, 408, 866] +[:mouse_move, 634, 350, 2, 409, 887] +[:mouse_move, 634, 351, 2, 410, 889] +[:mouse_move, 633, 352, 2, 411, 891] +[:mouse_move, 632, 352, 2, 412, 893] +[:mouse_move, 628, 352, 2, 413, 894] +[:mouse_move, 625, 353, 2, 414, 895] +[:mouse_move, 617, 354, 2, 415, 896] +[:mouse_move, 613, 356, 2, 416, 897] +[:mouse_move, 605, 359, 2, 417, 898] +[:mouse_move, 603, 360, 2, 418, 899] +[:mouse_move, 600, 362, 2, 419, 900] +[:mouse_move, 596, 364, 2, 420, 901] +[:mouse_move, 592, 366, 2, 421, 902] +[:mouse_move, 590, 367, 2, 422, 904] +[:mouse_move, 588, 367, 2, 423, 905] +[:mouse_move, 581, 367, 2, 424, 906] +[:mouse_move, 579, 366, 2, 425, 907] +[:mouse_move, 577, 366, 2, 426, 908] +[:mouse_move, 575, 365, 2, 427, 909] +[:mouse_move, 571, 364, 2, 428, 910] +[:mouse_move, 570, 363, 2, 429, 911] +[:mouse_move, 568, 362, 2, 430, 912] +[:mouse_button_pressed, 1, 0, 1, 431, 913] +[:mouse_button_up, 1, 0, 1, 432, 921] +[:mouse_move, 568, 366, 2, 433, 927] +[:mouse_move, 568, 369, 2, 434, 928] +[:mouse_move, 568, 373, 2, 435, 929] +[:mouse_move, 568, 376, 2, 436, 930] +[:mouse_move, 569, 384, 2, 437, 931] +[:mouse_move, 571, 388, 2, 438, 932] +[:mouse_move, 580, 401, 2, 439, 933] +[:mouse_move, 592, 413, 2, 440, 934] +[:mouse_move, 596, 416, 2, 441, 935] +[:mouse_move, 607, 426, 2, 442, 936] +[:mouse_move, 612, 431, 2, 443, 937] +[:mouse_move, 618, 435, 2, 444, 938] +[:mouse_move, 620, 437, 2, 445, 939] +[:mouse_move, 625, 441, 2, 446, 940] +[:mouse_move, 627, 442, 2, 447, 941] +[:mouse_move, 630, 444, 2, 448, 942] +[:mouse_move, 631, 444, 2, 449, 943] +[:mouse_move, 634, 445, 2, 450, 944] +[:mouse_move, 635, 446, 2, 451, 945] +[:mouse_move, 636, 446, 2, 452, 946] +[:mouse_move, 638, 447, 2, 453, 947] +[:mouse_move, 639, 447, 2, 454, 949] +[:mouse_button_pressed, 1, 0, 1, 455, 953] +[:mouse_button_up, 1, 0, 1, 456, 961] +[:mouse_move, 639, 446, 2, 457, 977] +[:mouse_move, 640, 443, 2, 458, 978] +[:mouse_move, 641, 438, 2, 459, 979] +[:mouse_move, 641, 430, 2, 460, 980] +[:mouse_move, 644, 395, 2, 461, 981] +[:mouse_move, 645, 373, 2, 462, 982] +[:mouse_move, 645, 315, 2, 463, 983] +[:mouse_move, 644, 275, 2, 464, 984] +[:mouse_move, 642, 266, 2, 465, 985] +[:mouse_move, 636, 236, 2, 466, 986] +[:mouse_move, 633, 226, 2, 467, 987] +[:mouse_move, 630, 217, 2, 468, 988] +[:mouse_move, 618, 200, 2, 469, 989] +[:mouse_move, 610, 192, 2, 470, 990] +[:mouse_move, 604, 188, 2, 471, 991] +[:mouse_move, 594, 181, 2, 472, 992] +[:mouse_move, 591, 180, 2, 473, 993] +[:mouse_move, 584, 176, 2, 474, 994] +[:mouse_move, 579, 174, 2, 475, 995] +[:mouse_move, 576, 173, 2, 476, 996] +[:mouse_move, 571, 172, 2, 477, 997] +[:mouse_move, 569, 172, 2, 478, 998] +[:mouse_move, 565, 171, 2, 479, 999] +[:mouse_move, 564, 170, 2, 480, 1000] +[:mouse_move, 562, 170, 2, 481, 1001] +[:mouse_move, 565, 172, 2, 482, 1005] +[:mouse_move, 570, 175, 2, 483, 1006] +[:mouse_move, 599, 185, 2, 484, 1007] +[:mouse_move, 616, 189, 2, 485, 1008] +[:mouse_move, 647, 192, 2, 486, 1009] +[:mouse_move, 665, 193, 2, 487, 1010] +[:mouse_move, 685, 193, 2, 488, 1011] +[:mouse_move, 719, 186, 2, 489, 1012] +[:mouse_move, 735, 177, 2, 490, 1013] +[:mouse_move, 751, 167, 2, 491, 1014] +[:mouse_move, 755, 161, 2, 492, 1015] +[:mouse_move, 758, 156, 2, 493, 1016] +[:mouse_move, 761, 145, 2, 494, 1017] +[:mouse_move, 762, 139, 2, 495, 1018] +[:mouse_move, 762, 133, 2, 496, 1019] +[:mouse_move, 757, 123, 2, 497, 1020] +[:mouse_move, 753, 117, 2, 498, 1021] +[:mouse_move, 739, 101, 2, 499, 1022] +[:mouse_move, 722, 88, 2, 500, 1023] +[:mouse_move, 711, 81, 2, 501, 1024] +[:mouse_move, 685, 65, 2, 502, 1025] +[:mouse_move, 671, 57, 2, 503, 1026] +[:mouse_move, 656, 49, 2, 504, 1027] +[:mouse_move, 637, 40, 2, 505, 1028] +[:mouse_move, 627, 36, 2, 506, 1029] +[:mouse_move, 617, 33, 2, 507, 1030] +[:mouse_move, 602, 31, 2, 508, 1031] +[:mouse_move, 589, 31, 2, 509, 1032] +[:mouse_move, 582, 31, 2, 510, 1033] +[:mouse_move, 570, 36, 2, 511, 1034] +[:mouse_move, 554, 47, 2, 512, 1035] +[:mouse_move, 547, 53, 2, 513, 1036] +[:mouse_move, 540, 59, 2, 514, 1037] +[:mouse_move, 533, 66, 2, 515, 1038] +[:mouse_move, 517, 84, 2, 516, 1039] +[:mouse_move, 516, 87, 2, 517, 1040] +[:mouse_move, 511, 95, 2, 518, 1041] +[:mouse_move, 506, 107, 2, 519, 1042] +[:mouse_move, 506, 114, 2, 520, 1043] +[:mouse_move, 506, 122, 2, 521, 1044] +[:mouse_move, 515, 139, 2, 522, 1045] +[:mouse_move, 521, 148, 2, 523, 1046] +[:mouse_move, 550, 169, 2, 524, 1047] +[:mouse_move, 576, 178, 2, 525, 1048] +[:mouse_move, 593, 182, 2, 526, 1049] +[:mouse_move, 613, 184, 2, 527, 1050] +[:mouse_move, 650, 184, 2, 528, 1051] +[:mouse_move, 683, 180, 2, 529, 1052] +[:mouse_move, 696, 176, 2, 530, 1053] +[:mouse_move, 709, 171, 2, 531, 1054] +[:mouse_move, 723, 162, 2, 532, 1055] +[:mouse_move, 731, 156, 2, 533, 1056] +[:mouse_move, 744, 142, 2, 534, 1057] +[:mouse_move, 748, 136, 2, 535, 1058] +[:mouse_move, 752, 123, 2, 536, 1059] +[:mouse_move, 753, 117, 2, 537, 1060] +[:mouse_move, 754, 112, 2, 538, 1061] +[:mouse_move, 754, 102, 2, 539, 1062] +[:mouse_move, 750, 93, 2, 540, 1063] +[:mouse_move, 745, 85, 2, 541, 1064] +[:mouse_move, 733, 76, 2, 542, 1065] +[:mouse_move, 728, 73, 2, 543, 1066] +[:mouse_move, 721, 69, 2, 544, 1067] +[:mouse_move, 700, 59, 2, 545, 1068] +[:mouse_move, 678, 51, 2, 546, 1069] +[:mouse_move, 666, 48, 2, 547, 1070] +[:mouse_move, 639, 44, 2, 548, 1071] +[:mouse_move, 627, 42, 2, 549, 1072] +[:mouse_move, 620, 42, 2, 550, 1073] +[:mouse_move, 600, 42, 2, 551, 1074] +[:mouse_move, 590, 44, 2, 552, 1075] +[:mouse_move, 568, 52, 2, 553, 1076] +[:mouse_move, 557, 58, 2, 554, 1077] +[:mouse_move, 550, 62, 2, 555, 1078] +[:mouse_move, 545, 66, 2, 556, 1079] +[:mouse_move, 535, 75, 2, 557, 1080] +[:mouse_move, 526, 87, 2, 558, 1081] +[:mouse_move, 522, 95, 2, 559, 1082] +[:mouse_move, 517, 108, 2, 560, 1083] +[:mouse_move, 515, 116, 2, 561, 1084] +[:mouse_move, 512, 127, 2, 562, 1085] +[:mouse_move, 510, 138, 2, 563, 1086] +[:mouse_move, 510, 143, 2, 564, 1087] +[:mouse_move, 517, 163, 2, 565, 1088] +[:mouse_move, 542, 181, 2, 566, 1089] +[:mouse_move, 552, 185, 2, 567, 1090] +[:mouse_move, 605, 204, 2, 568, 1091] +[:mouse_move, 668, 208, 2, 569, 1093] +[:mouse_move, 677, 208, 2, 570, 1094] +[:mouse_move, 694, 207, 2, 571, 1095] +[:mouse_move, 710, 207, 2, 572, 1096] +[:mouse_move, 714, 207, 2, 573, 1097] +[:mouse_move, 720, 214, 2, 574, 1098] +[:mouse_move, 720, 223, 2, 575, 1099] +[:mouse_move, 720, 240, 2, 576, 1100] +[:mouse_move, 712, 280, 2, 577, 1101] +[:mouse_move, 707, 293, 2, 578, 1102] +[:mouse_move, 696, 319, 2, 579, 1103] +[:mouse_move, 684, 341, 2, 580, 1104] +[:mouse_move, 682, 343, 2, 581, 1105] +[:mouse_move, 677, 350, 2, 582, 1106] +[:mouse_move, 672, 356, 2, 583, 1107] +[:mouse_move, 670, 359, 2, 584, 1108] +[:mouse_move, 669, 359, 2, 585, 1109] +[:mouse_move, 668, 360, 2, 586, 1110] +[:mouse_move, 668, 361, 2, 587, 1112] +[:mouse_button_pressed, 1, 0, 1, 588, 1113] +[:mouse_button_up, 1, 0, 1, 589, 1124] +[:mouse_move, 667, 361, 2, 590, 1141] +[:mouse_move, 661, 356, 2, 591, 1142] +[:mouse_move, 648, 343, 2, 592, 1143] +[:mouse_move, 639, 335, 2, 593, 1144] +[:mouse_move, 625, 324, 2, 594, 1145] +[:mouse_move, 603, 311, 2, 595, 1147] +[:mouse_move, 597, 308, 2, 596, 1148] +[:mouse_move, 585, 302, 2, 597, 1149] +[:mouse_move, 580, 299, 2, 598, 1150] +[:mouse_move, 575, 297, 2, 599, 1151] +[:mouse_move, 574, 296, 2, 600, 1152] +[:mouse_move, 569, 293, 2, 601, 1153] +[:mouse_move, 568, 292, 2, 602, 1154] +[:mouse_move, 567, 291, 2, 603, 1155] +[:mouse_move, 566, 291, 2, 604, 1156] +[:mouse_button_pressed, 1, 0, 1, 605, 1168] +[:mouse_button_up, 1, 0, 1, 606, 1175] +[:mouse_move, 567, 291, 2, 607, 1188] +[:mouse_move, 575, 302, 2, 608, 1189] +[:mouse_move, 580, 307, 2, 609, 1190] +[:mouse_move, 586, 314, 2, 610, 1191] +[:mouse_move, 601, 329, 2, 611, 1192] +[:mouse_move, 609, 337, 2, 612, 1193] +[:mouse_move, 623, 349, 2, 613, 1194] +[:mouse_move, 625, 351, 2, 614, 1195] +[:mouse_move, 633, 358, 2, 615, 1196] +[:mouse_move, 637, 361, 2, 616, 1197] +[:mouse_move, 638, 362, 2, 617, 1198] +[:mouse_move, 639, 363, 2, 618, 1199] +[:mouse_move, 640, 363, 2, 619, 1200] +[:mouse_move, 640, 364, 2, 620, 1201] +[:mouse_move, 640, 365, 2, 621, 1213] +[:mouse_move, 641, 365, 2, 622, 1218] +[:mouse_button_pressed, 1, 0, 1, 623, 1238] +[:mouse_button_up, 1, 0, 1, 624, 1245] +[:mouse_move, 644, 369, 2, 625, 1258] +[:mouse_move, 652, 380, 2, 626, 1259] +[:mouse_move, 656, 384, 2, 627, 1260] +[:mouse_move, 663, 394, 2, 628, 1261] +[:mouse_move, 669, 402, 2, 629, 1262] +[:mouse_move, 682, 415, 2, 630, 1263] +[:mouse_move, 688, 421, 2, 631, 1264] +[:mouse_move, 692, 424, 2, 632, 1265] +[:mouse_move, 694, 427, 2, 633, 1266] +[:mouse_move, 698, 430, 2, 634, 1267] +[:mouse_move, 699, 431, 2, 635, 1268] +[:mouse_move, 700, 432, 2, 636, 1269] +[:mouse_move, 701, 433, 2, 637, 1270] +[:mouse_move, 702, 434, 2, 638, 1271] +[:mouse_move, 703, 435, 2, 639, 1274] +[:mouse_button_pressed, 1, 0, 1, 640, 1279] +[:mouse_button_up, 1, 0, 1, 641, 1285] +[:mouse_move, 701, 435, 2, 642, 1297] +[:mouse_move, 695, 435, 2, 643, 1298] +[:mouse_move, 685, 435, 2, 644, 1299] +[:mouse_move, 680, 435, 2, 645, 1300] +[:mouse_move, 669, 437, 2, 646, 1301] +[:mouse_move, 663, 439, 2, 647, 1302] +[:mouse_move, 661, 439, 2, 648, 1303] +[:mouse_move, 657, 440, 2, 649, 1304] +[:mouse_move, 651, 441, 2, 650, 1305] +[:mouse_move, 646, 442, 2, 651, 1306] +[:mouse_move, 645, 442, 2, 652, 1307] +[:mouse_move, 643, 443, 2, 653, 1308] +[:mouse_move, 642, 443, 2, 654, 1309] +[:mouse_move, 641, 443, 2, 655, 1311] +[:mouse_button_pressed, 1, 0, 1, 656, 1314] +[:mouse_button_up, 1, 0, 1, 657, 1322] +[:mouse_move, 641, 441, 2, 658, 1324] +[:mouse_move, 641, 433, 2, 659, 1325] +[:mouse_move, 641, 425, 2, 660, 1326] +[:mouse_move, 641, 408, 2, 661, 1327] +[:mouse_move, 641, 398, 2, 662, 1328] +[:mouse_move, 641, 373, 2, 663, 1329] +[:mouse_move, 641, 358, 2, 664, 1330] +[:mouse_move, 641, 337, 2, 665, 1331] +[:mouse_move, 641, 323, 2, 666, 1332] +[:mouse_move, 641, 312, 2, 667, 1333] +[:mouse_move, 641, 305, 2, 668, 1334] +[:mouse_move, 641, 301, 2, 669, 1335] +[:mouse_move, 641, 294, 2, 670, 1336] +[:mouse_move, 641, 292, 2, 671, 1337] +[:mouse_move, 641, 290, 2, 672, 1338] +[:mouse_move, 641, 289, 2, 673, 1339] +[:mouse_move, 641, 288, 2, 674, 1341] +[:mouse_move, 641, 287, 2, 675, 1344] +[:mouse_move, 640, 286, 2, 676, 1345] +[:mouse_move, 640, 285, 2, 677, 1346] +[:mouse_move, 640, 284, 2, 678, 1348] +[:mouse_button_pressed, 1, 0, 1, 679, 1349] +[:mouse_button_up, 1, 0, 1, 680, 1356] +[:mouse_move, 642, 284, 2, 681, 1360] +[:mouse_move, 651, 284, 2, 682, 1361] +[:mouse_move, 660, 284, 2, 683, 1362] +[:mouse_move, 671, 284, 2, 684, 1363] +[:mouse_move, 684, 284, 2, 685, 1364] +[:mouse_move, 702, 284, 2, 686, 1365] +[:mouse_move, 714, 284, 2, 687, 1366] +[:mouse_move, 718, 284, 2, 688, 1367] +[:mouse_move, 722, 284, 2, 689, 1368] +[:mouse_move, 726, 284, 2, 690, 1369] +[:mouse_move, 727, 284, 2, 691, 1371] +[:mouse_button_pressed, 1, 0, 1, 692, 1378] +[:mouse_button_up, 1, 0, 1, 693, 1385] +[:mouse_move, 725, 288, 2, 694, 1389] +[:mouse_move, 717, 298, 2, 695, 1390] +[:mouse_move, 710, 306, 2, 696, 1391] +[:mouse_move, 696, 322, 2, 697, 1392] +[:mouse_move, 689, 332, 2, 698, 1393] +[:mouse_move, 674, 353, 2, 699, 1394] +[:mouse_move, 660, 373, 2, 700, 1395] +[:mouse_move, 652, 384, 2, 701, 1396] +[:mouse_move, 650, 387, 2, 702, 1397] +[:mouse_move, 640, 400, 2, 703, 1398] +[:mouse_move, 639, 402, 2, 704, 1399] +[:mouse_move, 634, 409, 2, 705, 1400] +[:mouse_move, 632, 411, 2, 706, 1401] +[:mouse_move, 630, 414, 2, 707, 1402] +[:mouse_move, 629, 415, 2, 708, 1403] +[:mouse_move, 628, 416, 2, 709, 1404] +[:mouse_move, 626, 417, 2, 710, 1405] +[:mouse_move, 626, 418, 2, 711, 1406] +[:mouse_move, 623, 420, 2, 712, 1408] +[:mouse_move, 619, 423, 2, 713, 1409] +[:mouse_move, 618, 424, 2, 714, 1410] +[:mouse_move, 615, 427, 2, 715, 1411] +[:mouse_move, 610, 430, 2, 716, 1412] +[:mouse_move, 604, 433, 2, 717, 1413] +[:mouse_move, 603, 433, 2, 718, 1414] +[:mouse_move, 598, 435, 2, 719, 1415] +[:mouse_move, 595, 437, 2, 720, 1417] +[:mouse_move, 594, 437, 2, 721, 1418] +[:mouse_move, 591, 438, 2, 722, 1419] +[:mouse_move, 590, 439, 2, 723, 1420] +[:mouse_move, 587, 440, 2, 724, 1421] +[:mouse_move, 586, 440, 2, 725, 1422] +[:mouse_move, 585, 440, 2, 726, 1423] +[:mouse_move, 585, 441, 2, 727, 1424] +[:mouse_move, 584, 441, 2, 728, 1425] +[:mouse_button_pressed, 1, 0, 1, 729, 1427] +[:mouse_button_up, 1, 0, 1, 730, 1437] +[:mouse_move, 584, 439, 2, 731, 1446] +[:mouse_move, 584, 438, 2, 732, 1447] +[:mouse_move, 584, 430, 2, 733, 1448] +[:mouse_move, 583, 421, 2, 734, 1449] +[:mouse_move, 582, 416, 2, 735, 1450] +[:mouse_move, 579, 405, 2, 736, 1451] +[:mouse_move, 577, 398, 2, 737, 1452] +[:mouse_move, 570, 381, 2, 738, 1453] +[:mouse_move, 567, 374, 2, 739, 1454] +[:mouse_move, 563, 365, 2, 740, 1455] +[:mouse_move, 560, 357, 2, 741, 1456] +[:mouse_move, 558, 352, 2, 742, 1457] +[:mouse_move, 556, 345, 2, 743, 1458] +[:mouse_move, 555, 343, 2, 744, 1459] +[:mouse_move, 554, 341, 2, 745, 1460] +[:mouse_move, 554, 340, 2, 746, 1461] +[:mouse_move, 553, 340, 2, 747, 1468] +[:mouse_button_pressed, 1, 0, 1, 748, 1476] +[:mouse_button_up, 1, 0, 1, 749, 1484] +[:mouse_move, 554, 340, 2, 750, 1489] +[:mouse_move, 557, 340, 2, 751, 1490] +[:mouse_move, 576, 343, 2, 752, 1491] +[:mouse_move, 582, 344, 2, 753, 1492] +[:mouse_move, 608, 350, 2, 754, 1493] +[:mouse_move, 622, 352, 2, 755, 1494] +[:mouse_move, 639, 353, 2, 756, 1495] +[:mouse_move, 660, 355, 2, 757, 1496] +[:mouse_move, 668, 355, 2, 758, 1497] +[:mouse_move, 684, 355, 2, 759, 1498] +[:mouse_move, 696, 355, 2, 760, 1500] +[:mouse_move, 697, 355, 2, 761, 1501] +[:mouse_move, 705, 355, 2, 762, 1502] +[:mouse_move, 708, 355, 2, 763, 1503] +[:mouse_move, 714, 355, 2, 764, 1504] +[:mouse_move, 716, 355, 2, 765, 1505] +[:mouse_move, 720, 355, 2, 766, 1506] +[:mouse_move, 722, 355, 2, 767, 1507] +[:mouse_move, 724, 355, 2, 768, 1508] +[:mouse_move, 725, 355, 2, 769, 1509] +[:mouse_move, 726, 354, 2, 770, 1510] +[:mouse_button_pressed, 1, 0, 1, 771, 1513] +[:mouse_button_up, 1, 0, 1, 772, 1520] +[:mouse_move, 726, 350, 2, 773, 1539] +[:mouse_move, 726, 344, 2, 774, 1540] +[:mouse_move, 724, 328, 2, 775, 1541] +[:mouse_move, 721, 319, 2, 776, 1542] +[:mouse_move, 707, 271, 2, 777, 1543] +[:mouse_move, 698, 248, 2, 778, 1544] +[:mouse_move, 679, 209, 2, 779, 1545] +[:mouse_move, 674, 201, 2, 780, 1546] +[:mouse_move, 656, 171, 2, 781, 1547] +[:mouse_move, 647, 161, 2, 782, 1548] +[:mouse_move, 640, 153, 2, 783, 1549] +[:mouse_move, 618, 136, 2, 784, 1550] +[:mouse_move, 613, 132, 2, 785, 1551] +[:mouse_move, 609, 130, 2, 786, 1552] +[:mouse_move, 607, 130, 2, 787, 1553] +[:mouse_move, 596, 126, 2, 788, 1554] +[:mouse_move, 593, 125, 2, 789, 1555] +[:mouse_move, 585, 124, 2, 790, 1556] +[:mouse_move, 581, 124, 2, 791, 1557] +[:mouse_move, 575, 124, 2, 792, 1558] +[:mouse_move, 571, 124, 2, 793, 1559] +[:mouse_move, 565, 124, 2, 794, 1560] +[:mouse_move, 560, 124, 2, 795, 1561] +[:mouse_move, 558, 124, 2, 796, 1562] +[:mouse_move, 556, 124, 2, 797, 1563] +[:mouse_move, 555, 124, 2, 798, 1564] +[:mouse_move, 555, 126, 2, 799, 1565] +[:mouse_move, 555, 128, 2, 800, 1566] +[:mouse_move, 555, 130, 2, 801, 1567] +[:mouse_move, 561, 137, 2, 802, 1568] +[:mouse_move, 567, 141, 2, 803, 1569] +[:mouse_move, 586, 148, 2, 804, 1570] +[:mouse_move, 599, 152, 2, 805, 1571] +[:mouse_move, 630, 155, 2, 806, 1572] +[:mouse_move, 661, 156, 2, 807, 1573] +[:mouse_move, 670, 156, 2, 808, 1574] +[:mouse_move, 728, 151, 2, 809, 1575] +[:mouse_move, 743, 147, 2, 810, 1576] +[:mouse_move, 762, 140, 2, 811, 1577] +[:mouse_move, 773, 135, 2, 812, 1578] +[:mouse_move, 781, 130, 2, 813, 1579] +[:mouse_move, 795, 120, 2, 814, 1580] +[:mouse_move, 800, 115, 2, 815, 1581] +[:mouse_move, 804, 109, 2, 816, 1582] +[:mouse_move, 810, 97, 2, 817, 1583] +[:mouse_move, 812, 91, 2, 818, 1584] +[:mouse_move, 812, 74, 2, 819, 1585] +[:mouse_move, 811, 72, 2, 820, 1586] +[:mouse_move, 802, 60, 2, 821, 1587] +[:mouse_move, 793, 52, 2, 822, 1588] +[:mouse_move, 775, 44, 2, 823, 1589] +[:mouse_move, 763, 40, 2, 824, 1590] +[:mouse_move, 737, 33, 2, 825, 1591] +[:mouse_move, 708, 28, 2, 826, 1592] +[:mouse_move, 694, 27, 2, 827, 1593] +[:mouse_move, 679, 26, 2, 828, 1594] +[:mouse_move, 651, 26, 2, 829, 1595] +[:mouse_move, 646, 26, 2, 830, 1596] +[:mouse_move, 616, 31, 2, 831, 1597] +[:mouse_move, 611, 33, 2, 832, 1598] +[:mouse_move, 585, 43, 2, 833, 1599] +[:mouse_move, 581, 46, 2, 834, 1600] +[:mouse_move, 565, 56, 2, 835, 1601] +[:mouse_move, 558, 60, 2, 836, 1602] +[:mouse_move, 542, 76, 2, 837, 1603] +[:mouse_move, 536, 84, 2, 838, 1604] +[:mouse_move, 527, 104, 2, 839, 1605] +[:mouse_move, 522, 115, 2, 840, 1606] +[:mouse_move, 520, 129, 2, 841, 1607] +[:mouse_move, 519, 137, 2, 842, 1608] +[:mouse_move, 519, 145, 2, 843, 1609] +[:mouse_move, 526, 162, 2, 844, 1610] +[:mouse_move, 545, 172, 2, 845, 1611] +[:mouse_move, 564, 180, 2, 846, 1612] +[:mouse_move, 574, 181, 2, 847, 1613] +[:mouse_move, 629, 191, 2, 848, 1614] +[:mouse_move, 658, 192, 2, 849, 1615] +[:mouse_move, 716, 193, 2, 850, 1616] +[:mouse_move, 729, 193, 2, 851, 1617] +[:mouse_move, 773, 183, 2, 852, 1618] +[:mouse_move, 779, 179, 2, 853, 1619] +[:mouse_move, 800, 168, 2, 854, 1620] +[:mouse_move, 806, 163, 2, 855, 1621] +[:mouse_move, 812, 154, 2, 856, 1622] +[:mouse_move, 813, 149, 2, 857, 1623] +[:mouse_move, 814, 140, 2, 858, 1624] +[:mouse_move, 815, 134, 2, 859, 1625] +[:mouse_move, 815, 123, 2, 860, 1626] +[:mouse_move, 815, 121, 2, 861, 1627] +[:mouse_move, 815, 115, 2, 862, 1628] +[:mouse_move, 815, 113, 2, 863, 1629] +[:mouse_move, 816, 111, 2, 864, 1630] +[:key_down_raw, 1073742051, 1024, 2, 865, 1698] +[:key_down_raw, 113, 1024, 2, 866, 1698] diff --git a/samples/05_mouse/02_mouse_move/app/main.rb b/samples/05_mouse/02_mouse_move/app/main.rb new file mode 100644 index 0000000..97edbe7 --- /dev/null +++ b/samples/05_mouse/02_mouse_move/app/main.rb @@ -0,0 +1,296 @@ +=begin + + Reminders: + + - num1.greater(num2): Returns the greater value. + For example, if we have the command + puts 4.greater(3) + the number 4 would be printed to the console since it has a greater value than 3. + Similar to lesser, which returns the lesser value. + + - find_all: Finds all elements of a collection that meet certain requirements. + For example, in this sample app, we're using find_all to find all zombies that have intersected + or hit the player's sprite since these zombies have been killed. + + - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. + Stores the frame the "down" event occurred. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + When we want to create a new object, we can 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.) + + - 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. + + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. + + - sample: Chooses a random element from the array. + + - reject: Removes elements that meet certain requirements. + In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also + rejecting zombies that were killed more than 30 frames ago. + +=end + +# This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal +# is to kill the zombies as fast as possible! + +class ProtectThePuppiesFromTheZombies + attr_accessor :grid, :inputs, :state, :outputs + + # Calls the methods necessary for the game to run properly. + def tick + defaults + render + calc + input + end + + # Sets default values for the zombies and for the player. + # Initialization happens only in the first frame. + def defaults + state.flash_at ||= 0 + state.zombie_min_spawn_rate ||= 60 + state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate + state.zombies ||= [] + state.killed_zombies ||= [] + + # Declares player as a new entity and sets its properties. + # The player begins the game in the center of the screen, not moving in any direction. + state.player ||= state.new_entity(:player, { x: 640, + y: 360, + attack_angle: 0, + dx: 0, + dy: 0 }) + end + + # Outputs a gray background. + # Calls the methods needed to output the player, zombies, etc onto the screen. + def render + outputs.solids << [grid.rect, 100, 100, 100] + render_zombies + render_killed_zombies + render_player + render_flash + end + + # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. + def render_zombies + outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection + z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method + z.sprite + end + end + + # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. + def render_killed_zombies + outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection + z.sprite = [z.x, + z.y, + 4 * 3, + 8 * 3, + animation_sprite(z, z.death_at), # calls animation_sprite method + 0, # angle + 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die + # change the value of 30 and see what happens when a zombie is killed + + # Sets values to output the slash over the zombie's sprite when a zombie is killed. + # The slash is tilted 45 degrees from the angle of the player's attack. + # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions + # the slash over the killed zombie's sprite. + [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] + end + end + + # Outputs the player sprite using the images in the sprites folder. + def render_player + state.player_sprite = [state.player.x, + state.player.y, + 4 * 3, + 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation + outputs.sprites << state.player_sprite + + # Outputs a small red square that previews the angles that the player can attack in. + # It can be moved in a perfect circle around the player to show possible movements. + # Change the 60 in the parenthesis and see what happens to the movement of the red square. + outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), + state.player.y + state.player.attack_angle.vector_y(60), + 3, 3, 255, 0, 0] + end + + # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. + def render_flash + return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. + # Transparency gradually changes (or eases) during the 10 frames of flash. + outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid + end + + # Calls all methods necessary for performing calculations. + def calc + calc_spawn_zombie + calc_move_zombies + calc_player + calc_kill_zombie + end + + # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. + def calc_spawn_zombie + if state.zombie_spawn_countdown > 0 + state.zombie_spawn_countdown -= 1 + return + end + + # New zombies are created, positioned on the screen, and added to the zombies collection. + state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity + if rand > 0.5 + z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) + z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) + # the possible values exceed the screen's scope so zombies appear to be coming from far away + else + z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) + z.y = grid.rect.w.randomize(:ratio) # random y position on screen + end + end + + # Calls random_spawn_countdown method (determines how fast new zombies appear) + state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate + state.zombie_min_spawn_rate -= 1 + # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater + state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) + end + + # Moves all zombies towards the center of the screen. + # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. + def calc_move_zombies + state.zombies.each do |z| # for each zombie in the collection + z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 + z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center + end + state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center + end + + # Calculates the position and movement of the player on the screen. + def calc_player + state.player.x += state.player.dx # changes x based on dx (change in x) + state.player.y += state.player.dy # changes y based on dy (change in y) + + state.player.dx *= 0.9 # scales dx down + state.player.dy *= 0.9 # scales dy down + + # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. + # This ensures that the player remains within the screen's scope. + state.player.x = state.player.x.lesser(1280).greater(0) + state.player.y = state.player.y.lesser(720).greater(0) # same with player's y + end + + # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection + # and added to the killed_zombies collection since any zombie that intersects with the player is killed. + def calc_kill_zombie + + # Find all zombies that intersect with the player. They are considered killed. + killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection + state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies + + if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame + state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed + # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) + end + + # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. + # Death_at stores the frame a zombie was killed. + killed_this_frame.each do |z| + z.death_at = state.tick_count + end + + # Zombies are rejected from the killed_zombies collection depending on when they were killed. + # They are rejected if more than 30 frames have passed since their death. + state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } + end + + # Uses input from the user to move the player around the screen. + def input + + # If the "a" key or left key is pressed, the x position of the player decreases. + # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. + if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left + state.player.x -= 5 + elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right + state.player.x += 5 + end + + # If the "w" or up key is pressed, the y position of the player increases. + # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. + if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up + state.player.y += 5 + elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down + state.player.y -= 5 + end + + # Sets the attack angle so the player can move and attack in the precise direction it wants to go. + # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). + # Attack angle also contributes to the position of red square. + if inputs.mouse.moved + state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] + end + + if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 + state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] + state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set + state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position + state.player.dy = state.player.attack_angle.vector_y(25) + end + end + + # Sets the zombie spawn's countdown to a random number. + # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) + def random_spawn_countdown minimum + 10.randomize(:ratio, :sign).to_i + 60 + end + + # Helps to iterate through the images in the sprites folder by setting the animation index. + # 3 frames is how long to show an image, and 6 is how many images to flip through. + def animation_index at + at.idiv(3).mod(6) + end + + # Animates the zombies by using the animation index to go through the images in the sprites folder. + def animation_sprite zombie, at = nil + at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created + index = animation_index at + "sprites/zombie-#{index}.png" # string interpolation to iterate through images + end +end + +$protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new + +def tick args + $protect_the_puppies_from_the_zombies.grid = args.grid + $protect_the_puppies_from_the_zombies.inputs = args.inputs + $protect_the_puppies_from_the_zombies.state = args.state + $protect_the_puppies_from_the_zombies.outputs = args.outputs + $protect_the_puppies_from_the_zombies.tick + tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse/02_mouse_move/license-for-sample.txt b/samples/05_mouse/02_mouse_move/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/05_mouse/02_mouse_move/license-for-sample.txt @@ -0,0 +1,9 @@ +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/05_mouse/02_mouse_move/replay.txt b/samples/05_mouse/02_mouse_move/replay.txt new file mode 100644 index 0000000..78c183c --- /dev/null +++ b/samples/05_mouse/02_mouse_move/replay.txt @@ -0,0 +1,550 @@ +replay_version 2.0 +stopped_at 1127 +seed 100 +recorded_at Sun Sep 29 23:57:44 2019 +[:mouse_move, 1057, 15, 2, 1, 74] +[:mouse_move, 1029, 68, 2, 2, 75] +[:mouse_move, 1014, 86, 2, 3, 76] +[:mouse_move, 1014, 105, 2, 4, 89] +[:mouse_move, 1009, 132, 2, 5, 92] +[:mouse_move, 984, 181, 2, 6, 93] +[:mouse_move, 966, 213, 2, 7, 93] +[:mouse_move, 945, 245, 2, 8, 94] +[:mouse_move, 922, 276, 2, 9, 95] +[:mouse_move, 899, 305, 2, 10, 95] +[:mouse_move, 889, 316, 2, 11, 96] +[:mouse_move, 868, 336, 2, 12, 97] +[:mouse_move, 849, 353, 2, 13, 97] +[:mouse_move, 831, 365, 2, 14, 98] +[:mouse_move, 801, 384, 2, 15, 99] +[:mouse_move, 792, 386, 2, 16, 99] +[:mouse_move, 760, 399, 2, 17, 100] +[:mouse_move, 750, 400, 2, 18, 101] +[:mouse_move, 732, 403, 2, 19, 101] +[:mouse_move, 697, 406, 2, 20, 102] +[:mouse_move, 676, 406, 2, 21, 103] +[:mouse_move, 666, 406, 2, 22, 103] +[:mouse_move, 647, 401, 2, 23, 104] +[:mouse_move, 628, 395, 2, 24, 105] +[:mouse_move, 610, 388, 2, 25, 105] +[:mouse_move, 594, 378, 2, 26, 106] +[:mouse_move, 565, 360, 2, 27, 107] +[:mouse_move, 546, 346, 2, 28, 107] +[:mouse_move, 538, 339, 2, 29, 108] +[:mouse_move, 523, 326, 2, 30, 109] +[:mouse_move, 518, 322, 2, 31, 109] +[:mouse_move, 515, 318, 2, 32, 110] +[:mouse_move, 509, 312, 2, 33, 111] +[:mouse_move, 507, 311, 2, 34, 111] +[:mouse_move, 501, 305, 2, 35, 112] +[:mouse_move, 499, 302, 2, 36, 113] +[:mouse_move, 497, 300, 2, 37, 114] +[:mouse_move, 497, 299, 2, 38, 115] +[:mouse_move, 497, 295, 2, 39, 116] +[:mouse_move, 498, 290, 2, 40, 131] +[:mouse_move, 498, 287, 2, 41, 132] +[:mouse_move, 498, 284, 2, 42, 132] +[:mouse_move, 497, 279, 2, 43, 133] +[:mouse_move, 490, 240, 2, 44, 135] +[:mouse_move, 486, 221, 2, 45, 136] +[:mouse_move, 480, 198, 2, 46, 136] +[:mouse_move, 477, 187, 2, 47, 137] +[:mouse_move, 469, 165, 2, 48, 138] +[:mouse_move, 458, 146, 2, 49, 138] +[:mouse_move, 436, 115, 2, 50, 139] +[:mouse_move, 416, 99, 2, 51, 140] +[:mouse_move, 369, 82, 2, 52, 141] +[:mouse_move, 341, 79, 2, 53, 142] +[:mouse_move, 288, 79, 2, 54, 143] +[:mouse_move, 277, 82, 2, 55, 144] +[:mouse_move, 238, 97, 2, 56, 145] +[:mouse_move, 224, 107, 2, 57, 146] +[:mouse_move, 196, 130, 2, 58, 147] +[:mouse_move, 187, 143, 2, 59, 148] +[:mouse_move, 179, 159, 2, 60, 149] +[:mouse_move, 175, 176, 2, 61, 149] +[:mouse_move, 175, 192, 2, 62, 150] +[:mouse_move, 175, 207, 2, 63, 151] +[:mouse_move, 175, 213, 2, 64, 151] +[:mouse_move, 178, 223, 2, 65, 152] +[:mouse_move, 181, 232, 2, 66, 153] +[:mouse_move, 184, 238, 2, 67, 153] +[:mouse_move, 187, 242, 2, 68, 154] +[:mouse_move, 191, 247, 2, 69, 155] +[:mouse_move, 196, 251, 2, 70, 155] +[:mouse_move, 202, 254, 2, 71, 156] +[:mouse_move, 206, 257, 2, 72, 157] +[:mouse_move, 208, 258, 2, 73, 157] +[:mouse_move, 212, 260, 2, 74, 158] +[:mouse_move, 213, 261, 2, 75, 159] +[:mouse_move, 215, 262, 2, 76, 159] +[:mouse_move, 216, 262, 2, 77, 160] +[:mouse_move, 217, 262, 2, 78, 161] +[:mouse_move, 217, 263, 2, 79, 161] +[:mouse_button_pressed, 1, 0, 1, 80, 168] +[:mouse_button_up, 1, 0, 1, 81, 175] +[:mouse_move, 218, 263, 2, 82, 193] +[:mouse_move, 219, 264, 2, 83, 194] +[:mouse_move, 221, 267, 2, 84, 195] +[:mouse_move, 222, 270, 2, 85, 196] +[:mouse_move, 222, 281, 2, 86, 197] +[:mouse_move, 222, 286, 2, 87, 198] +[:mouse_move, 212, 299, 2, 88, 199] +[:mouse_move, 207, 302, 2, 89, 200] +[:mouse_move, 184, 304, 2, 90, 201] +[:mouse_move, 171, 298, 2, 91, 202] +[:mouse_move, 154, 284, 2, 92, 203] +[:mouse_move, 130, 255, 2, 93, 204] +[:mouse_move, 116, 237, 2, 94, 205] +[:mouse_move, 104, 213, 2, 95, 206] +[:mouse_move, 98, 201, 2, 96, 207] +[:mouse_move, 90, 181, 2, 97, 208] +[:mouse_move, 87, 166, 2, 98, 209] +[:mouse_move, 83, 154, 2, 99, 210] +[:mouse_move, 81, 147, 2, 100, 211] +[:mouse_move, 79, 139, 2, 101, 212] +[:mouse_move, 78, 136, 2, 102, 213] +[:mouse_move, 76, 132, 2, 103, 214] +[:mouse_move, 76, 131, 2, 104, 215] +[:mouse_move, 75, 130, 2, 105, 216] +[:mouse_move, 74, 130, 2, 106, 218] +[:mouse_move, 73, 130, 2, 107, 219] +[:mouse_move, 71, 132, 2, 108, 220] +[:mouse_move, 69, 133, 2, 109, 221] +[:mouse_move, 66, 138, 2, 110, 222] +[:mouse_move, 65, 140, 2, 111, 223] +[:mouse_move, 63, 147, 2, 112, 224] +[:mouse_move, 62, 150, 2, 113, 225] +[:mouse_move, 62, 161, 2, 114, 226] +[:mouse_move, 62, 165, 2, 115, 227] +[:mouse_move, 62, 173, 2, 116, 228] +[:mouse_move, 62, 177, 2, 117, 229] +[:mouse_move, 62, 180, 2, 118, 230] +[:mouse_move, 62, 184, 2, 119, 231] +[:mouse_move, 62, 185, 2, 120, 232] +[:mouse_move, 62, 187, 2, 121, 233] +[:mouse_move, 62, 188, 2, 122, 234] +[:mouse_move, 62, 190, 2, 123, 235] +[:mouse_move, 61, 191, 2, 124, 236] +[:mouse_move, 60, 193, 2, 125, 237] +[:mouse_move, 60, 194, 2, 126, 238] +[:mouse_move, 59, 195, 2, 127, 239] +[:mouse_move, 59, 196, 2, 128, 240] +[:mouse_move, 59, 197, 2, 129, 243] +[:mouse_move, 59, 196, 2, 130, 252] +[:mouse_move, 59, 195, 2, 131, 257] +[:mouse_move, 59, 194, 2, 132, 258] +[:mouse_move, 59, 193, 2, 133, 260] +[:mouse_move, 58, 193, 2, 134, 267] +[:mouse_move, 57, 193, 2, 135, 272] +[:mouse_move, 56, 194, 2, 136, 274] +[:mouse_move, 55, 195, 2, 137, 276] +[:mouse_move, 54, 195, 2, 138, 278] +[:mouse_button_pressed, 1, 0, 1, 139, 281] +[:mouse_button_up, 1, 0, 1, 140, 289] +[:mouse_move, 53, 195, 2, 141, 318] +[:mouse_move, 51, 195, 2, 142, 319] +[:mouse_move, 47, 195, 2, 143, 320] +[:mouse_move, 45, 195, 2, 144, 321] +[:mouse_move, 42, 195, 2, 145, 322] +[:mouse_move, 41, 194, 2, 146, 323] +[:mouse_move, 40, 194, 2, 147, 324] +[:mouse_move, 40, 193, 2, 148, 325] +[:mouse_move, 39, 193, 2, 149, 326] +[:mouse_move, 38, 192, 2, 150, 328] +[:mouse_button_pressed, 1, 0, 1, 151, 330] +[:mouse_button_up, 1, 0, 1, 152, 338] +[:mouse_move, 38, 193, 2, 153, 347] +[:mouse_move, 39, 197, 2, 154, 348] +[:mouse_move, 47, 216, 2, 155, 349] +[:mouse_move, 61, 246, 2, 156, 350] +[:mouse_move, 93, 319, 2, 157, 351] +[:mouse_move, 116, 361, 2, 158, 352] +[:mouse_move, 145, 412, 2, 159, 353] +[:mouse_move, 164, 440, 2, 160, 354] +[:mouse_move, 192, 468, 2, 161, 355] +[:mouse_move, 209, 480, 2, 162, 356] +[:mouse_move, 227, 487, 2, 163, 357] +[:mouse_move, 243, 489, 2, 164, 358] +[:mouse_move, 269, 479, 2, 165, 359] +[:mouse_move, 282, 466, 2, 166, 360] +[:mouse_move, 295, 451, 2, 167, 361] +[:mouse_move, 309, 437, 2, 168, 362] +[:mouse_move, 315, 431, 2, 169, 363] +[:mouse_move, 320, 427, 2, 170, 364] +[:mouse_move, 327, 421, 2, 171, 365] +[:mouse_move, 328, 421, 2, 172, 366] +[:mouse_button_pressed, 1, 0, 1, 173, 367] +[:mouse_move, 329, 420, 2, 174, 367] +[:mouse_button_up, 1, 0, 1, 175, 375] +[:mouse_move, 326, 423, 2, 176, 388] +[:mouse_move, 316, 431, 2, 177, 389] +[:mouse_move, 290, 450, 2, 178, 390] +[:mouse_move, 266, 463, 2, 179, 391] +[:mouse_move, 180, 494, 2, 180, 392] +[:mouse_move, 159, 497, 2, 181, 393] +[:mouse_move, 121, 504, 2, 182, 394] +[:mouse_move, 93, 509, 2, 183, 395] +[:mouse_move, 70, 514, 2, 184, 396] +[:mouse_move, 52, 517, 2, 185, 397] +[:mouse_move, 44, 518, 2, 186, 398] +[:mouse_move, 36, 519, 2, 187, 399] +[:mouse_move, 34, 519, 2, 188, 400] +[:mouse_move, 32, 519, 2, 189, 401] +[:mouse_move, 31, 518, 2, 190, 404] +[:mouse_move, 31, 516, 2, 191, 405] +[:mouse_move, 30, 515, 2, 192, 406] +[:mouse_move, 28, 509, 2, 193, 407] +[:mouse_move, 27, 506, 2, 194, 408] +[:mouse_move, 23, 500, 2, 195, 409] +[:mouse_move, 22, 498, 2, 196, 410] +[:mouse_move, 19, 494, 2, 197, 411] +[:mouse_move, 18, 492, 2, 198, 412] +[:mouse_move, 17, 491, 2, 199, 413] +[:mouse_move, 16, 490, 2, 200, 414] +[:mouse_move, 15, 490, 2, 201, 415] +[:mouse_button_pressed, 1, 0, 1, 202, 421] +[:mouse_button_up, 1, 0, 1, 203, 431] +[:mouse_move, 16, 490, 2, 204, 443] +[:mouse_move, 17, 490, 2, 205, 444] +[:mouse_move, 20, 491, 2, 206, 445] +[:mouse_move, 22, 493, 2, 207, 446] +[:mouse_move, 24, 493, 2, 208, 447] +[:mouse_move, 25, 494, 2, 209, 448] +[:mouse_move, 26, 495, 2, 210, 449] +[:mouse_move, 27, 495, 2, 211, 450] +[:mouse_move, 27, 496, 2, 212, 453] +[:mouse_move, 28, 496, 2, 213, 455] +[:mouse_move, 30, 497, 2, 214, 465] +[:mouse_move, 32, 498, 2, 215, 466] +[:mouse_move, 43, 505, 2, 216, 467] +[:mouse_move, 50, 510, 2, 217, 468] +[:mouse_move, 74, 526, 2, 218, 469] +[:mouse_move, 87, 536, 2, 219, 470] +[:mouse_move, 100, 545, 2, 220, 471] +[:mouse_move, 126, 565, 2, 221, 472] +[:mouse_move, 150, 584, 2, 222, 473] +[:mouse_move, 160, 594, 2, 223, 474] +[:mouse_move, 165, 598, 2, 224, 475] +[:mouse_move, 185, 622, 2, 225, 476] +[:mouse_move, 187, 626, 2, 226, 477] +[:mouse_move, 192, 637, 2, 227, 478] +[:mouse_move, 194, 642, 2, 228, 479] +[:mouse_move, 196, 647, 2, 229, 480] +[:mouse_move, 197, 649, 2, 230, 481] +[:mouse_move, 197, 650, 2, 231, 482] +[:mouse_move, 198, 651, 2, 232, 483] +[:mouse_button_pressed, 1, 0, 1, 233, 484] +[:mouse_button_up, 1, 0, 1, 234, 495] +[:mouse_move, 201, 649, 2, 235, 510] +[:mouse_move, 231, 638, 2, 236, 511] +[:mouse_move, 265, 631, 2, 237, 512] +[:mouse_move, 312, 622, 2, 238, 513] +[:mouse_move, 474, 600, 2, 239, 514] +[:mouse_move, 528, 593, 2, 240, 515] +[:mouse_move, 544, 590, 2, 241, 516] +[:mouse_move, 555, 589, 2, 242, 517] +[:mouse_move, 559, 589, 2, 243, 530] +[:mouse_move, 567, 592, 2, 244, 531] +[:mouse_move, 594, 607, 2, 245, 532] +[:mouse_move, 602, 612, 2, 246, 533] +[:mouse_move, 624, 627, 2, 247, 534] +[:mouse_move, 645, 640, 2, 248, 536] +[:mouse_move, 651, 644, 2, 249, 537] +[:mouse_move, 666, 654, 2, 250, 538] +[:mouse_move, 672, 659, 2, 251, 539] +[:mouse_move, 680, 668, 2, 252, 540] +[:mouse_move, 682, 670, 2, 253, 541] +[:mouse_move, 687, 675, 2, 254, 542] +[:mouse_move, 689, 677, 2, 255, 543] +[:mouse_move, 691, 680, 2, 256, 544] +[:mouse_move, 692, 680, 2, 257, 545] +[:mouse_move, 693, 681, 2, 258, 546] +[:mouse_move, 694, 682, 2, 259, 547] +[:mouse_move, 695, 682, 2, 260, 548] +[:mouse_button_pressed, 1, 0, 1, 261, 549] +[:mouse_move, 695, 683, 2, 262, 549] +[:mouse_button_up, 1, 0, 1, 263, 560] +[:mouse_move, 696, 683, 2, 264, 565] +[:mouse_move, 698, 683, 2, 265, 566] +[:mouse_move, 705, 683, 2, 266, 567] +[:mouse_move, 716, 683, 2, 267, 568] +[:mouse_move, 726, 683, 2, 268, 569] +[:mouse_move, 734, 683, 2, 269, 570] +[:mouse_move, 748, 683, 2, 270, 571] +[:mouse_move, 761, 683, 2, 271, 573] +[:mouse_move, 765, 683, 2, 272, 574] +[:mouse_move, 771, 683, 2, 273, 575] +[:mouse_move, 774, 683, 2, 274, 577] +[:mouse_move, 777, 683, 2, 275, 578] +[:mouse_move, 779, 683, 2, 276, 579] +[:mouse_move, 780, 683, 2, 277, 582] +[:mouse_move, 781, 683, 2, 278, 586] +[:mouse_button_pressed, 1, 0, 1, 279, 590] +[:mouse_button_up, 1, 0, 1, 280, 600] +[:mouse_move, 781, 679, 2, 281, 646] +[:mouse_move, 780, 675, 2, 282, 647] +[:mouse_move, 777, 659, 2, 283, 648] +[:mouse_move, 775, 648, 2, 284, 649] +[:mouse_move, 760, 580, 2, 285, 650] +[:mouse_move, 750, 537, 2, 286, 651] +[:mouse_move, 715, 420, 2, 287, 652] +[:mouse_move, 700, 393, 2, 288, 653] +[:mouse_move, 644, 307, 2, 289, 654] +[:mouse_move, 599, 268, 2, 290, 656] +[:mouse_move, 569, 248, 2, 291, 657] +[:mouse_move, 555, 240, 2, 292, 658] +[:mouse_button_pressed, 1, 0, 1, 293, 659] +[:mouse_move, 546, 236, 2, 294, 659] +[:mouse_button_up, 1, 0, 1, 295, 670] +[:mouse_move, 540, 236, 2, 296, 675] +[:mouse_move, 535, 236, 2, 297, 676] +[:mouse_move, 524, 232, 2, 298, 677] +[:mouse_move, 506, 224, 2, 299, 678] +[:mouse_move, 495, 219, 2, 300, 679] +[:mouse_move, 483, 213, 2, 301, 680] +[:mouse_move, 457, 202, 2, 302, 681] +[:mouse_move, 433, 193, 2, 303, 682] +[:mouse_move, 427, 193, 2, 304, 683] +[:mouse_move, 424, 192, 2, 305, 684] +[:mouse_move, 418, 191, 2, 306, 685] +[:mouse_move, 412, 189, 2, 307, 686] +[:mouse_move, 406, 187, 2, 308, 687] +[:mouse_move, 401, 186, 2, 309, 688] +[:mouse_button_pressed, 1, 0, 1, 310, 689] +[:mouse_move, 400, 185, 2, 311, 689] +[:mouse_button_up, 1, 0, 1, 312, 698] +[:mouse_move, 400, 182, 2, 313, 714] +[:mouse_move, 400, 176, 2, 314, 715] +[:mouse_move, 395, 157, 2, 315, 716] +[:mouse_move, 391, 146, 2, 316, 717] +[:mouse_move, 386, 130, 2, 317, 718] +[:mouse_move, 384, 127, 2, 318, 719] +[:mouse_move, 380, 114, 2, 319, 720] +[:mouse_move, 376, 103, 2, 320, 721] +[:mouse_move, 375, 101, 2, 321, 722] +[:mouse_move, 373, 95, 2, 322, 723] +[:mouse_move, 372, 94, 2, 323, 724] +[:mouse_move, 371, 92, 2, 324, 725] +[:mouse_button_pressed, 1, 0, 1, 325, 726] +[:mouse_button_up, 1, 0, 1, 326, 735] +[:mouse_move, 371, 90, 2, 327, 747] +[:mouse_move, 371, 89, 2, 328, 748] +[:mouse_move, 371, 88, 2, 329, 749] +[:mouse_move, 371, 86, 2, 330, 750] +[:mouse_move, 370, 84, 2, 331, 752] +[:mouse_move, 370, 83, 2, 332, 753] +[:mouse_move, 368, 80, 2, 333, 754] +[:mouse_move, 367, 76, 2, 334, 755] +[:mouse_move, 365, 74, 2, 335, 756] +[:mouse_move, 363, 70, 2, 336, 757] +[:mouse_move, 358, 61, 2, 337, 758] +[:mouse_move, 356, 56, 2, 338, 759] +[:mouse_move, 352, 48, 2, 339, 760] +[:mouse_move, 351, 45, 2, 340, 761] +[:mouse_move, 348, 40, 2, 341, 762] +[:mouse_move, 347, 38, 2, 342, 763] +[:mouse_move, 346, 37, 2, 343, 764] +[:mouse_move, 345, 36, 2, 344, 765] +[:mouse_move, 344, 36, 2, 345, 766] +[:mouse_move, 343, 36, 2, 346, 768] +[:mouse_move, 342, 36, 2, 347, 770] +[:mouse_move, 341, 36, 2, 348, 772] +[:mouse_move, 340, 36, 2, 349, 774] +[:mouse_move, 339, 35, 2, 350, 777] +[:mouse_move, 338, 33, 2, 351, 778] +[:mouse_move, 338, 32, 2, 352, 779] +[:mouse_move, 337, 32, 2, 353, 780] +[:mouse_move, 337, 31, 2, 354, 781] +[:mouse_move, 336, 30, 2, 355, 783] +[:mouse_button_pressed, 1, 0, 1, 356, 784] +[:mouse_button_up, 1, 0, 1, 357, 795] +[:mouse_move, 336, 31, 2, 358, 825] +[:mouse_move, 335, 32, 2, 359, 827] +[:mouse_move, 335, 33, 2, 360, 828] +[:mouse_move, 334, 35, 2, 361, 829] +[:mouse_move, 333, 35, 2, 362, 830] +[:mouse_move, 332, 37, 2, 363, 831] +[:mouse_move, 332, 39, 2, 364, 832] +[:mouse_move, 332, 41, 2, 365, 833] +[:mouse_move, 332, 46, 2, 366, 834] +[:mouse_move, 332, 59, 2, 367, 835] +[:mouse_move, 335, 85, 2, 368, 836] +[:mouse_move, 336, 111, 2, 369, 837] +[:mouse_move, 336, 133, 2, 370, 838] +[:mouse_move, 336, 188, 2, 371, 839] +[:mouse_move, 335, 220, 2, 372, 840] +[:mouse_move, 335, 266, 2, 373, 841] +[:mouse_move, 335, 291, 2, 374, 842] +[:mouse_move, 347, 327, 2, 375, 843] +[:mouse_move, 361, 352, 2, 376, 844] +[:mouse_move, 403, 378, 2, 377, 845] +[:mouse_move, 435, 385, 2, 378, 846] +[:mouse_move, 523, 396, 2, 379, 847] +[:mouse_move, 544, 396, 2, 380, 848] +[:mouse_move, 585, 395, 2, 381, 849] +[:mouse_move, 600, 390, 2, 382, 850] +[:mouse_move, 647, 367, 2, 383, 851] +[:mouse_move, 662, 355, 2, 384, 852] +[:mouse_move, 679, 316, 2, 385, 853] +[:mouse_move, 679, 302, 2, 386, 854] +[:mouse_move, 654, 244, 2, 387, 855] +[:mouse_move, 603, 180, 2, 388, 857] +[:mouse_move, 552, 131, 2, 389, 858] +[:mouse_move, 531, 116, 2, 390, 859] +[:mouse_move, 512, 104, 2, 391, 860] +[:mouse_move, 477, 91, 2, 392, 861] +[:mouse_move, 460, 89, 2, 393, 862] +[:mouse_move, 442, 88, 2, 394, 863] +[:mouse_move, 409, 88, 2, 395, 864] +[:mouse_move, 402, 88, 2, 396, 865] +[:mouse_move, 373, 92, 2, 397, 866] +[:mouse_move, 363, 96, 2, 398, 867] +[:mouse_move, 335, 105, 2, 399, 868] +[:mouse_move, 326, 110, 2, 400, 869] +[:mouse_move, 314, 115, 2, 401, 870] +[:mouse_move, 306, 120, 2, 402, 871] +[:mouse_move, 293, 129, 2, 403, 872] +[:mouse_move, 288, 134, 2, 404, 873] +[:mouse_move, 277, 151, 2, 405, 874] +[:mouse_move, 272, 172, 2, 406, 875] +[:mouse_move, 272, 185, 2, 407, 876] +[:mouse_move, 273, 210, 2, 408, 877] +[:mouse_move, 282, 224, 2, 409, 878] +[:mouse_move, 288, 235, 2, 410, 879] +[:mouse_move, 294, 243, 2, 411, 880] +[:mouse_move, 298, 247, 2, 412, 881] +[:mouse_move, 302, 251, 2, 413, 882] +[:mouse_move, 304, 252, 2, 414, 883] +[:mouse_button_pressed, 1, 0, 1, 415, 885] +[:mouse_move, 305, 252, 2, 416, 885] +[:mouse_move, 306, 252, 2, 417, 895] +[:mouse_button_up, 1, 0, 1, 418, 896] +[:mouse_move, 314, 252, 2, 419, 896] +[:mouse_move, 337, 252, 2, 420, 896] +[:mouse_move, 364, 252, 2, 421, 897] +[:mouse_move, 402, 252, 2, 422, 898] +[:mouse_move, 494, 266, 2, 423, 899] +[:mouse_move, 597, 295, 2, 424, 900] +[:mouse_move, 629, 309, 2, 425, 901] +[:mouse_move, 753, 372, 2, 426, 902] +[:mouse_move, 788, 393, 2, 427, 903] +[:mouse_move, 800, 400, 2, 428, 904] +[:mouse_move, 827, 414, 2, 429, 905] +[:mouse_move, 840, 420, 2, 430, 906] +[:mouse_move, 846, 425, 2, 431, 907] +[:mouse_move, 851, 428, 2, 432, 908] +[:mouse_move, 854, 433, 2, 433, 909] +[:mouse_move, 854, 434, 2, 434, 910] +[:mouse_move, 849, 434, 2, 435, 912] +[:mouse_move, 846, 434, 2, 436, 913] +[:mouse_move, 834, 430, 2, 437, 914] +[:mouse_move, 827, 426, 2, 438, 915] +[:mouse_move, 798, 409, 2, 439, 916] +[:mouse_move, 779, 401, 2, 440, 917] +[:mouse_move, 726, 384, 2, 441, 918] +[:mouse_move, 659, 371, 2, 442, 919] +[:mouse_move, 599, 364, 2, 443, 920] +[:mouse_move, 538, 356, 2, 444, 922] +[:mouse_move, 525, 353, 2, 445, 923] +[:mouse_move, 454, 338, 2, 446, 924] +[:mouse_move, 416, 324, 2, 447, 925] +[:mouse_move, 407, 319, 2, 448, 926] +[:mouse_move, 391, 314, 2, 449, 927] +[:mouse_move, 379, 307, 2, 450, 928] +[:mouse_move, 373, 305, 2, 451, 929] +[:mouse_move, 367, 301, 2, 452, 930] +[:mouse_move, 366, 300, 2, 453, 931] +[:mouse_move, 366, 294, 2, 454, 932] +[:mouse_move, 370, 291, 2, 455, 933] +[:mouse_move, 396, 277, 2, 456, 934] +[:mouse_move, 405, 272, 2, 457, 935] +[:mouse_move, 426, 260, 2, 458, 936] +[:mouse_move, 447, 246, 2, 459, 937] +[:mouse_move, 457, 236, 2, 460, 938] +[:mouse_move, 466, 222, 2, 461, 939] +[:mouse_move, 474, 206, 2, 462, 940] +[:mouse_move, 476, 185, 2, 463, 941] +[:mouse_move, 476, 173, 2, 464, 942] +[:mouse_move, 466, 139, 2, 465, 943] +[:mouse_move, 461, 133, 2, 466, 944] +[:mouse_move, 440, 114, 2, 467, 945] +[:mouse_move, 428, 106, 2, 468, 946] +[:mouse_move, 400, 96, 2, 469, 947] +[:mouse_move, 385, 93, 2, 470, 948] +[:mouse_move, 355, 92, 2, 471, 949] +[:mouse_move, 324, 92, 2, 472, 950] +[:mouse_move, 309, 92, 2, 473, 951] +[:mouse_move, 302, 92, 2, 474, 952] +[:mouse_move, 271, 101, 2, 475, 953] +[:mouse_move, 260, 105, 2, 476, 954] +[:mouse_move, 245, 113, 2, 477, 955] +[:mouse_move, 224, 129, 2, 478, 956] +[:mouse_move, 218, 137, 2, 479, 957] +[:mouse_move, 203, 157, 2, 480, 958] +[:mouse_move, 195, 170, 2, 481, 959] +[:mouse_move, 187, 183, 2, 482, 960] +[:mouse_move, 174, 209, 2, 483, 961] +[:mouse_move, 169, 221, 2, 484, 962] +[:mouse_move, 161, 244, 2, 485, 963] +[:mouse_move, 158, 258, 2, 486, 964] +[:mouse_move, 156, 272, 2, 487, 965] +[:mouse_move, 160, 327, 2, 488, 966] +[:mouse_move, 163, 334, 2, 489, 967] +[:mouse_move, 177, 367, 2, 490, 968] +[:mouse_move, 195, 387, 2, 491, 970] +[:mouse_move, 231, 416, 2, 492, 971] +[:mouse_move, 251, 429, 2, 493, 972] +[:mouse_move, 272, 442, 2, 494, 973] +[:mouse_move, 301, 458, 2, 495, 974] +[:mouse_move, 319, 467, 2, 496, 975] +[:mouse_move, 352, 478, 2, 497, 976] +[:mouse_move, 381, 482, 2, 498, 977] +[:mouse_move, 405, 482, 2, 499, 978] +[:mouse_move, 420, 480, 2, 500, 979] +[:mouse_move, 453, 461, 2, 501, 980] +[:mouse_move, 479, 431, 2, 502, 981] +[:mouse_move, 492, 413, 2, 503, 982] +[:mouse_move, 510, 383, 2, 504, 983] +[:mouse_move, 521, 362, 2, 505, 984] +[:mouse_move, 528, 346, 2, 506, 985] +[:mouse_move, 538, 314, 2, 507, 986] +[:mouse_move, 540, 299, 2, 508, 987] +[:mouse_move, 541, 285, 2, 509, 988] +[:mouse_move, 541, 256, 2, 510, 989] +[:mouse_move, 538, 241, 2, 511, 990] +[:mouse_move, 526, 211, 2, 512, 991] +[:mouse_move, 516, 192, 2, 513, 993] +[:mouse_move, 507, 179, 2, 514, 994] +[:mouse_move, 492, 164, 2, 515, 995] +[:mouse_move, 484, 156, 2, 516, 996] +[:mouse_move, 466, 144, 2, 517, 997] +[:mouse_move, 455, 139, 2, 518, 998] +[:mouse_move, 430, 132, 2, 519, 999] +[:mouse_move, 405, 128, 2, 520, 1000] +[:mouse_move, 365, 127, 2, 521, 1001] +[:mouse_move, 341, 127, 2, 522, 1002] +[:mouse_move, 304, 129, 2, 523, 1003] +[:mouse_move, 283, 132, 2, 524, 1004] +[:mouse_move, 247, 141, 2, 525, 1005] +[:mouse_move, 231, 146, 2, 526, 1006] +[:mouse_move, 205, 159, 2, 527, 1007] +[:mouse_move, 194, 167, 2, 528, 1008] +[:mouse_move, 166, 197, 2, 529, 1009] +[:mouse_move, 156, 215, 2, 530, 1010] +[:mouse_move, 140, 260, 2, 531, 1011] +[:mouse_move, 135, 286, 2, 532, 1012] +[:mouse_move, 133, 325, 2, 533, 1013] +[:mouse_move, 134, 348, 2, 534, 1014] +[:mouse_move, 161, 410, 2, 535, 1015] +[:mouse_move, 239, 475, 2, 536, 1016] +[:mouse_move, 283, 495, 2, 537, 1017] +[:mouse_move, 304, 500, 2, 538, 1018] +[:mouse_move, 345, 504, 2, 539, 1019] +[:mouse_move, 409, 503, 2, 540, 1020] +[:mouse_move, 420, 495, 2, 541, 1021] +[:mouse_move, 475, 456, 2, 542, 1022] +[:mouse_move, 492, 436, 2, 543, 1023] +[:key_down_raw, 1073742051, 1024, 2, 544, 1126] +[:key_down_raw, 113, 1024, 2, 545, 1126] +[:key_up_raw, 113, 1024, 2, 546, 1126] diff --git a/samples/05_mouse/02_mouse_move/sprites/player-0.png b/samples/05_mouse/02_mouse_move/sprites/player-0.png new file mode 100644 index 0000000..c34dbed Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-0.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/player-1.png b/samples/05_mouse/02_mouse_move/sprites/player-1.png new file mode 100644 index 0000000..54fce3e Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-1.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/player-2.png b/samples/05_mouse/02_mouse_move/sprites/player-2.png new file mode 100644 index 0000000..0007c28 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-2.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/player-3.png b/samples/05_mouse/02_mouse_move/sprites/player-3.png new file mode 100644 index 0000000..c34dbed Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-3.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/player-4.png b/samples/05_mouse/02_mouse_move/sprites/player-4.png new file mode 100644 index 0000000..9897a29 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-4.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/player-5.png b/samples/05_mouse/02_mouse_move/sprites/player-5.png new file mode 100644 index 0000000..69d9c7b Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/player-5.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/slash.png b/samples/05_mouse/02_mouse_move/sprites/slash.png new file mode 100644 index 0000000..33c45e9 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/slash.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-0.png b/samples/05_mouse/02_mouse_move/sprites/zombie-0.png new file mode 100644 index 0000000..2fcc35d Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-0.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-1.png b/samples/05_mouse/02_mouse_move/sprites/zombie-1.png new file mode 100644 index 0000000..2b631ef Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-1.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-2.png b/samples/05_mouse/02_mouse_move/sprites/zombie-2.png new file mode 100644 index 0000000..10e0491 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-2.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-3.png b/samples/05_mouse/02_mouse_move/sprites/zombie-3.png new file mode 100644 index 0000000..2fcc35d Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-3.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-4.png b/samples/05_mouse/02_mouse_move/sprites/zombie-4.png new file mode 100644 index 0000000..cbd3f79 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-4.png differ diff --git a/samples/05_mouse/02_mouse_move/sprites/zombie-5.png b/samples/05_mouse/02_mouse_move/sprites/zombie-5.png new file mode 100644 index 0000000..f146666 Binary files /dev/null and b/samples/05_mouse/02_mouse_move/sprites/zombie-5.png differ diff --git a/samples/05_mouse/03_mouse_click/app/main.rb b/samples/05_mouse/03_mouse_click/app/main.rb deleted file mode 100644 index 8969a6e..0000000 --- a/samples/05_mouse/03_mouse_click/app/main.rb +++ /dev/null @@ -1,244 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - product: Returns an array of all combinations of elements from all arrays. - - For example, [1,2].product([1,2]) would return the following array... - [[1,1], [1,2], [2,1], [2,2]] - More than two arrays can be given to product and it will still work, - such as [1,2].product([1,2],[3,4]). What would product return in this case? - - Answer: - [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] - - - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 - - - yield: Allows you to call a method with a code block and yield to that block. - - Reminders: - - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. - - - 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.inputs.mouse.click: This property will be set if the mouse was clicked. - - - Ternary operator (?): Will evaluate a statement (just like an if statement) - and perform an action if the result is true or another action if it is false. - - - reject: Removes elements from a collection if they meet certain requirements. - - - args.outputs.borders: An array. The values generate a border. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. - - - 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. - -=end - -# This sample app is a classic game of Tic Tac Toe. - -class TicTacToe - attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk - - # Starts the game with player x's turn and creates an array (to_a) for space combinations. - # Calls methods necessary for the game to run properly. - def tick - state.current_turn ||= :x - state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a - render_board - input_board - end - - # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. - def render_board - square_size = 80 - - # Positions the game's board in the center of the screen. - # Try removing what follows grid.w_half or grid.h_half and see how the position changes! - board_left = grid.w_half - square_size * 1.5 - board_top = grid.h_half - square_size * 1.5 - - # At first glance, the add(1) looks pretty trivial. But if you remove it, - # you'll see that the positioning of the board would be skewed without it! - # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares - # due to the change in board placement. - outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces - space.border ||= [ - board_left + x.add(1) * square_size, # space.border is initialized using this definition - board_top + y.add(1) * square_size, - square_size, - square_size - ] - end - - # Again, the calculations ensure that the piece is placed in the center of the grid square. - # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. - outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board - label board_left + x.add(1) * square_size + square_size.fdiv(2), - board_top + y.add(1) * square_size + square_size - 20, - space.piece # text of label, either "x" or "o" - end - - # Uses a label to output whether x or o won, or if a draw occurred. - # If the game is ongoing, a label shows whose turn it currently is. - outputs.labels << if state.x_won - label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top - elsif state.o_won - label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally - elsif state.draw - label grid.w_half, grid.top - 80, "a draw" - else # if no one won and the game is ongoing - label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" - end - end - - # Calls the methods responsible for handling user input and determining the winner. - # Does nothing unless the mouse is clicked. - def input_board - return unless inputs.mouse.click - input_place_piece - input_restart_game - determine_winner - end - - # Handles user input for placing pieces on the board. - def input_place_piece - return if state.game_over - - # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already - # have a piece in it. - __, __, space = all_spaces.find do |__, __, space| - inputs.mouse.click.point.inside_rect?(space.border) && !space.piece - end - - # The piece that goes into the space belongs to the player whose turn it currently is. - return unless space - space.piece = state.current_turn - - # This ternary operator statement allows us to change the current player's turn. - # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. - state.current_turn = state.current_turn == :x ? :o : :x - end - - # Resets the game. - def input_restart_game - return unless state.game_over - gtk.reset - end - - # Checks if x or o won the game. - # If neither player wins and all nine squares are filled, a draw happens. - # Once a player is chosen as the winner or a draw happens, the game is over. - def determine_winner - state.x_won = won? :x # evaluates to either true or false (boolean values) - state.o_won = won? :o - state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won - state.game_over = state.x_won || state.o_won || state.draw - end - - # Determines if a player won by checking if there is a horizontal match or vertical match. - # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. - def won? piece - # performs action on all space combinations - won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| - - # Checks if the 3 grid spaces with the same y value (or same row) and - # x values that are next to each other have pieces that belong to the same player. - # Remember, the value of piece is equal to the current turn (which is the player). - horizontal_match = state.spaces[xs[0]][y].piece == piece && - state.spaces[xs[1]][y].piece == piece && - state.spaces[xs[2]][y].piece == piece - - # Checks if the 3 grid spaces with the same x value (or same column) and - # y values that are next to each other have pieces that belong to the same player. - # The && represents an "and" statement: if even one part of the statement is false, - # the entire statement evaluates to false. - vertical_match = state.spaces[y][xs[0]].piece == piece && - state.spaces[y][xs[1]].piece == piece && - state.spaces[y][xs[2]].piece == piece - - horizontal_match || vertical_match # if either is true, true is returned - end - - # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. - # Is added to won regardless of whether the statement is true or false. - won << (state.spaces[-1][-1].piece == piece && # bottom left - state.spaces[ 0][ 0].piece == piece && # center - state.spaces[ 1][ 1].piece == piece) # top right - - # Sees if there is a diagonal match, starting at the bottom right and ending at the top left - # and is added to won. - won << (state.spaces[ 1][-1].piece == piece && # bottom right - state.spaces[ 0][ 0].piece == piece && # center - state.spaces[-1][ 1].piece == piece) # top left - - # Any false statements (meaning false diagonal matches) are rejected from won - won.reject_false.any? - end - - # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. - # The ! before a statement means "not". For example, we are rejecting any space combinations that do - # NOT have pieces in them. - def filled_spaces - state.space_combinations - .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them - .map do |x, y| - if block_given? - yield x, y, state.spaces[x][y] - else - [x, y, state.spaces[x][y]] # sets definition of space - end - end - end - - # Defines all spaces on the board. - def all_spaces - if !block_given? - state.space_combinations.map do |x, y| - [x, y, state.spaces[x][y]] # sets definition of space - end - else # if a block is given (block_given? is true) - state.space_combinations.map do |x, y| - yield x, y, state.spaces[x][y] # yield if a block is given - end - end - end - - # Sets values for a label, such as the position, value, size, alignment, and color. - def label x, y, value - [x, y + 10, value, 20, 1, 0, 0, 0] - end -end - -$tic_tac_toe = TicTacToe.new - -def tick args - $tic_tac_toe._ = args - $tic_tac_toe.state = args.state - $tic_tac_toe.outputs = args.outputs - $tic_tac_toe.inputs = args.inputs - $tic_tac_toe.grid = args.grid - $tic_tac_toe.gtk = args.gtk - $tic_tac_toe.tick - tick_instructions args, "Sample app shows how to work with mouse clicks." -end - -def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -end diff --git a/samples/05_mouse/03_mouse_click/license-for-sample.txt b/samples/05_mouse/03_mouse_click/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/05_mouse/03_mouse_click/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/05_mouse/03_mouse_click/replay.txt b/samples/05_mouse/03_mouse_click/replay.txt deleted file mode 100644 index 1ea08dc..0000000 --- a/samples/05_mouse/03_mouse_click/replay.txt +++ /dev/null @@ -1,870 +0,0 @@ -replay_version 2.0 -stopped_at 1699 -seed 100 -recorded_at Sun Sep 29 21:49:02 2019 -[:mouse_move, 297, 112, 2, 1, 34] -[:mouse_move, 305, 112, 2, 2, 35] -[:mouse_move, 311, 112, 2, 3, 36] -[:mouse_move, 337, 111, 2, 4, 38] -[:mouse_move, 359, 110, 2, 5, 40] -[:mouse_move, 398, 112, 2, 6, 41] -[:mouse_move, 415, 118, 2, 7, 42] -[:mouse_move, 422, 124, 2, 8, 43] -[:mouse_move, 441, 140, 2, 9, 44] -[:mouse_move, 448, 148, 2, 10, 45] -[:mouse_move, 455, 163, 2, 11, 46] -[:mouse_move, 457, 174, 2, 12, 47] -[:mouse_move, 450, 183, 2, 13, 48] -[:mouse_move, 441, 187, 2, 14, 49] -[:mouse_move, 420, 190, 2, 15, 50] -[:mouse_move, 414, 190, 2, 16, 51] -[:mouse_move, 409, 190, 2, 17, 52] -[:mouse_move, 398, 188, 2, 18, 53] -[:mouse_move, 395, 187, 2, 19, 54] -[:mouse_move, 390, 185, 2, 20, 55] -[:mouse_move, 390, 184, 2, 21, 57] -[:mouse_move, 401, 189, 2, 22, 121] -[:mouse_move, 444, 221, 2, 23, 123] -[:mouse_move, 485, 255, 2, 24, 124] -[:mouse_move, 510, 280, 2, 25, 125] -[:mouse_move, 526, 296, 2, 26, 126] -[:mouse_move, 530, 301, 2, 27, 127] -[:mouse_move, 545, 317, 2, 28, 128] -[:mouse_move, 548, 321, 2, 29, 129] -[:mouse_move, 550, 324, 2, 30, 130] -[:mouse_move, 550, 326, 2, 31, 131] -[:mouse_move, 548, 324, 2, 32, 133] -[:mouse_move, 546, 319, 2, 33, 134] -[:mouse_move, 546, 306, 2, 34, 136] -[:mouse_move, 546, 301, 2, 35, 137] -[:mouse_move, 553, 282, 2, 36, 138] -[:mouse_move, 557, 271, 2, 37, 139] -[:mouse_move, 566, 232, 2, 38, 140] -[:mouse_move, 567, 215, 2, 39, 142] -[:mouse_move, 567, 203, 2, 40, 143] -[:mouse_move, 565, 184, 2, 41, 144] -[:mouse_move, 560, 177, 2, 42, 145] -[:mouse_move, 547, 163, 2, 43, 146] -[:mouse_move, 540, 159, 2, 44, 148] -[:mouse_move, 539, 157, 2, 45, 149] -[:mouse_move, 536, 156, 2, 46, 150] -[:mouse_move, 535, 154, 2, 47, 151] -[:mouse_move, 534, 153, 2, 48, 153] -[:mouse_move, 534, 152, 2, 49, 155] -[:mouse_move, 534, 151, 2, 50, 156] -[:mouse_move, 534, 150, 2, 51, 158] -[:mouse_move, 537, 150, 2, 52, 159] -[:mouse_move, 542, 149, 2, 53, 160] -[:mouse_move, 587, 152, 2, 54, 161] -[:mouse_move, 612, 155, 2, 55, 162] -[:mouse_move, 669, 161, 2, 56, 163] -[:mouse_move, 681, 161, 2, 57, 164] -[:mouse_move, 713, 160, 2, 58, 165] -[:mouse_move, 741, 155, 2, 59, 167] -[:mouse_move, 744, 154, 2, 60, 168] -[:mouse_move, 758, 151, 2, 61, 169] -[:mouse_move, 759, 151, 2, 62, 170] -[:mouse_move, 760, 151, 2, 63, 171] -[:mouse_move, 761, 151, 2, 64, 172] -[:mouse_move, 761, 152, 2, 65, 187] -[:mouse_move, 757, 160, 2, 66, 188] -[:mouse_move, 724, 198, 2, 67, 190] -[:mouse_move, 706, 214, 2, 68, 191] -[:mouse_move, 659, 243, 2, 69, 192] -[:mouse_move, 617, 259, 2, 70, 194] -[:mouse_move, 603, 264, 2, 71, 195] -[:mouse_move, 597, 265, 2, 72, 196] -[:mouse_move, 589, 268, 2, 73, 197] -[:mouse_move, 578, 271, 2, 74, 198] -[:mouse_move, 572, 272, 2, 75, 199] -[:mouse_move, 571, 272, 2, 76, 200] -[:mouse_move, 570, 272, 2, 77, 201] -[:mouse_move, 568, 273, 2, 78, 202] -[:mouse_move, 565, 273, 2, 79, 204] -[:mouse_move, 562, 275, 2, 80, 205] -[:mouse_move, 560, 276, 2, 81, 206] -[:mouse_move, 558, 276, 2, 82, 207] -[:mouse_move, 555, 277, 2, 83, 208] -[:mouse_move, 554, 278, 2, 84, 209] -[:mouse_move, 552, 279, 2, 85, 210] -[:mouse_move, 551, 279, 2, 86, 212] -[:mouse_button_pressed, 1, 0, 1, 87, 217] -[:mouse_button_up, 1, 0, 1, 88, 225] -[:mouse_move, 551, 280, 2, 89, 270] -[:mouse_move, 551, 283, 2, 90, 271] -[:mouse_move, 552, 296, 2, 91, 272] -[:mouse_move, 553, 314, 2, 92, 273] -[:mouse_move, 560, 391, 2, 93, 274] -[:mouse_move, 562, 409, 2, 94, 275] -[:mouse_move, 566, 440, 2, 95, 276] -[:mouse_move, 567, 448, 2, 96, 277] -[:mouse_move, 568, 464, 2, 97, 278] -[:mouse_move, 570, 482, 2, 98, 279] -[:mouse_move, 571, 488, 2, 99, 280] -[:mouse_move, 571, 489, 2, 100, 281] -[:mouse_move, 570, 489, 2, 101, 285] -[:mouse_move, 570, 488, 2, 102, 286] -[:mouse_move, 570, 487, 2, 103, 287] -[:mouse_move, 570, 486, 2, 104, 288] -[:mouse_move, 569, 483, 2, 105, 289] -[:mouse_move, 569, 475, 2, 106, 290] -[:mouse_move, 568, 473, 2, 107, 291] -[:mouse_move, 568, 467, 2, 108, 292] -[:mouse_move, 567, 464, 2, 109, 293] -[:mouse_move, 567, 461, 2, 110, 294] -[:mouse_move, 567, 460, 2, 111, 295] -[:mouse_move, 567, 459, 2, 112, 296] -[:mouse_move, 567, 458, 2, 113, 298] -[:mouse_move, 567, 457, 2, 114, 300] -[:mouse_move, 567, 456, 2, 115, 301] -[:mouse_move, 567, 455, 2, 116, 303] -[:mouse_button_pressed, 1, 0, 1, 117, 305] -[:mouse_button_up, 1, 0, 1, 118, 311] -[:mouse_move, 576, 455, 2, 119, 325] -[:mouse_move, 585, 455, 2, 120, 326] -[:mouse_move, 592, 455, 2, 121, 327] -[:mouse_move, 616, 457, 2, 122, 328] -[:mouse_move, 637, 458, 2, 123, 329] -[:mouse_move, 656, 458, 2, 124, 331] -[:mouse_move, 665, 458, 2, 125, 332] -[:mouse_move, 670, 458, 2, 126, 333] -[:mouse_move, 673, 458, 2, 127, 334] -[:mouse_move, 679, 458, 2, 128, 335] -[:mouse_move, 680, 458, 2, 129, 336] -[:mouse_move, 685, 458, 2, 130, 337] -[:mouse_move, 686, 458, 2, 131, 338] -[:mouse_move, 687, 458, 2, 132, 339] -[:mouse_move, 691, 458, 2, 133, 340] -[:mouse_move, 693, 458, 2, 134, 341] -[:mouse_move, 696, 458, 2, 135, 342] -[:mouse_move, 700, 458, 2, 136, 343] -[:mouse_move, 702, 458, 2, 137, 344] -[:mouse_move, 706, 458, 2, 138, 345] -[:mouse_move, 707, 458, 2, 139, 346] -[:mouse_move, 708, 458, 2, 140, 347] -[:mouse_move, 709, 458, 2, 141, 349] -[:mouse_button_pressed, 1, 0, 1, 142, 351] -[:mouse_button_up, 1, 0, 1, 143, 358] -[:mouse_move, 708, 458, 2, 144, 365] -[:mouse_move, 704, 455, 2, 145, 366] -[:mouse_move, 702, 454, 2, 146, 367] -[:mouse_move, 696, 448, 2, 147, 368] -[:mouse_move, 693, 444, 2, 148, 369] -[:mouse_move, 686, 437, 2, 149, 370] -[:mouse_move, 683, 433, 2, 150, 371] -[:mouse_move, 673, 419, 2, 151, 372] -[:mouse_move, 666, 410, 2, 152, 373] -[:mouse_move, 660, 402, 2, 153, 374] -[:mouse_move, 654, 394, 2, 154, 375] -[:mouse_move, 651, 390, 2, 155, 376] -[:mouse_move, 646, 384, 2, 156, 377] -[:mouse_move, 644, 381, 2, 157, 378] -[:mouse_move, 643, 379, 2, 158, 379] -[:mouse_move, 640, 375, 2, 159, 380] -[:mouse_move, 639, 374, 2, 160, 381] -[:mouse_move, 638, 371, 2, 161, 382] -[:mouse_move, 637, 369, 2, 162, 383] -[:mouse_move, 637, 367, 2, 163, 385] -[:mouse_move, 636, 366, 2, 164, 386] -[:mouse_move, 636, 365, 2, 165, 387] -[:mouse_button_pressed, 1, 0, 1, 166, 389] -[:mouse_button_up, 1, 0, 1, 167, 395] -[:mouse_move, 638, 364, 2, 168, 409] -[:mouse_move, 648, 356, 2, 169, 410] -[:mouse_move, 655, 350, 2, 170, 411] -[:mouse_move, 664, 342, 2, 171, 412] -[:mouse_move, 673, 334, 2, 172, 413] -[:mouse_move, 685, 325, 2, 173, 414] -[:mouse_move, 692, 319, 2, 174, 415] -[:mouse_move, 699, 312, 2, 175, 416] -[:mouse_move, 708, 304, 2, 176, 417] -[:mouse_move, 712, 301, 2, 177, 418] -[:mouse_move, 713, 300, 2, 178, 419] -[:mouse_move, 716, 297, 2, 179, 420] -[:mouse_move, 718, 296, 2, 180, 421] -[:mouse_move, 720, 293, 2, 181, 422] -[:mouse_move, 721, 292, 2, 182, 423] -[:mouse_move, 722, 292, 2, 183, 426] -[:mouse_move, 722, 291, 2, 184, 427] -[:mouse_button_pressed, 1, 0, 1, 185, 443] -[:mouse_button_up, 1, 0, 1, 186, 450] -[:mouse_move, 719, 291, 2, 187, 488] -[:mouse_move, 716, 290, 2, 188, 489] -[:mouse_move, 707, 288, 2, 189, 490] -[:mouse_move, 696, 287, 2, 190, 491] -[:mouse_move, 689, 286, 2, 191, 492] -[:mouse_move, 677, 286, 2, 192, 493] -[:mouse_move, 672, 286, 2, 193, 494] -[:mouse_move, 664, 286, 2, 194, 495] -[:mouse_move, 660, 286, 2, 195, 496] -[:mouse_move, 654, 286, 2, 196, 497] -[:mouse_move, 650, 286, 2, 197, 499] -[:mouse_move, 648, 286, 2, 198, 501] -[:mouse_button_pressed, 1, 0, 1, 199, 503] -[:mouse_button_up, 1, 0, 1, 200, 509] -[:mouse_move, 648, 287, 2, 201, 514] -[:mouse_move, 648, 288, 2, 202, 515] -[:mouse_move, 648, 289, 2, 203, 518] -[:mouse_move, 648, 290, 2, 204, 521] -[:mouse_move, 652, 296, 2, 205, 522] -[:mouse_move, 657, 303, 2, 206, 523] -[:mouse_move, 667, 314, 2, 207, 524] -[:mouse_move, 676, 323, 2, 208, 526] -[:mouse_move, 688, 334, 2, 209, 527] -[:mouse_move, 694, 340, 2, 210, 528] -[:mouse_move, 697, 342, 2, 211, 529] -[:mouse_move, 700, 344, 2, 212, 530] -[:mouse_move, 703, 346, 2, 213, 531] -[:mouse_move, 705, 347, 2, 214, 532] -[:mouse_move, 707, 348, 2, 215, 533] -[:mouse_move, 708, 349, 2, 216, 534] -[:mouse_move, 708, 350, 2, 217, 535] -[:mouse_move, 709, 352, 2, 218, 536] -[:mouse_move, 710, 353, 2, 219, 537] -[:mouse_move, 711, 354, 2, 220, 538] -[:mouse_move, 712, 354, 2, 221, 539] -[:mouse_move, 712, 355, 2, 222, 540] -[:mouse_move, 713, 355, 2, 223, 543] -[:mouse_button_pressed, 1, 0, 1, 224, 543] -[:mouse_button_up, 1, 0, 1, 225, 550] -[:mouse_move, 713, 353, 2, 226, 572] -[:mouse_move, 715, 341, 2, 227, 574] -[:mouse_move, 716, 333, 2, 228, 575] -[:mouse_move, 718, 310, 2, 229, 576] -[:mouse_move, 719, 290, 2, 230, 577] -[:mouse_move, 717, 259, 2, 231, 578] -[:mouse_move, 711, 247, 2, 232, 580] -[:mouse_move, 701, 233, 2, 233, 581] -[:mouse_move, 696, 227, 2, 234, 582] -[:mouse_move, 689, 222, 2, 235, 583] -[:mouse_move, 668, 208, 2, 236, 584] -[:mouse_move, 656, 201, 2, 237, 585] -[:mouse_move, 650, 197, 2, 238, 586] -[:mouse_move, 638, 189, 2, 239, 587] -[:mouse_move, 627, 181, 2, 240, 588] -[:mouse_move, 623, 179, 2, 241, 589] -[:mouse_move, 605, 164, 2, 242, 590] -[:mouse_move, 600, 160, 2, 243, 591] -[:mouse_move, 592, 153, 2, 244, 592] -[:mouse_move, 583, 145, 2, 245, 593] -[:mouse_move, 580, 143, 2, 246, 594] -[:mouse_move, 576, 140, 2, 247, 595] -[:mouse_move, 572, 139, 2, 248, 597] -[:mouse_move, 571, 138, 2, 249, 598] -[:mouse_move, 586, 146, 2, 250, 603] -[:mouse_move, 600, 152, 2, 251, 604] -[:mouse_move, 636, 161, 2, 252, 605] -[:mouse_move, 665, 164, 2, 253, 607] -[:mouse_move, 672, 164, 2, 254, 608] -[:mouse_move, 704, 162, 2, 255, 609] -[:mouse_move, 715, 156, 2, 256, 611] -[:mouse_move, 723, 148, 2, 257, 612] -[:mouse_move, 725, 144, 2, 258, 613] -[:mouse_move, 729, 135, 2, 259, 614] -[:mouse_move, 730, 131, 2, 260, 615] -[:mouse_move, 730, 126, 2, 261, 616] -[:mouse_move, 730, 117, 2, 262, 617] -[:mouse_move, 721, 101, 2, 263, 618] -[:mouse_move, 713, 92, 2, 264, 619] -[:mouse_move, 705, 83, 2, 265, 620] -[:mouse_move, 691, 71, 2, 266, 621] -[:mouse_move, 682, 65, 2, 267, 622] -[:mouse_move, 666, 55, 2, 268, 623] -[:mouse_move, 657, 52, 2, 269, 624] -[:mouse_move, 635, 48, 2, 270, 625] -[:mouse_move, 621, 48, 2, 271, 626] -[:mouse_move, 613, 48, 2, 272, 627] -[:mouse_move, 589, 52, 2, 273, 628] -[:mouse_move, 570, 61, 2, 274, 630] -[:mouse_move, 544, 85, 2, 275, 632] -[:mouse_move, 540, 90, 2, 276, 633] -[:mouse_move, 532, 101, 2, 277, 634] -[:mouse_move, 525, 116, 2, 278, 636] -[:mouse_move, 523, 123, 2, 279, 637] -[:mouse_move, 523, 127, 2, 280, 638] -[:mouse_move, 526, 139, 2, 281, 639] -[:mouse_move, 531, 145, 2, 282, 640] -[:mouse_move, 550, 159, 2, 283, 641] -[:mouse_move, 563, 166, 2, 284, 642] -[:mouse_move, 587, 175, 2, 285, 643] -[:mouse_move, 655, 186, 2, 286, 644] -[:mouse_move, 674, 186, 2, 287, 645] -[:mouse_move, 718, 186, 2, 288, 646] -[:mouse_move, 745, 183, 2, 289, 647] -[:mouse_move, 757, 180, 2, 290, 648] -[:mouse_move, 760, 178, 2, 291, 649] -[:mouse_move, 773, 173, 2, 292, 650] -[:mouse_move, 778, 169, 2, 293, 651] -[:mouse_move, 781, 161, 2, 294, 652] -[:mouse_move, 782, 154, 2, 295, 653] -[:mouse_move, 780, 146, 2, 296, 654] -[:mouse_move, 765, 125, 2, 297, 655] -[:mouse_move, 730, 95, 2, 298, 657] -[:mouse_move, 713, 84, 2, 299, 658] -[:mouse_move, 678, 69, 2, 300, 659] -[:mouse_move, 658, 65, 2, 301, 661] -[:mouse_move, 636, 63, 2, 302, 662] -[:mouse_move, 609, 65, 2, 303, 663] -[:mouse_move, 601, 68, 2, 304, 664] -[:mouse_move, 594, 71, 2, 305, 665] -[:mouse_move, 587, 76, 2, 306, 666] -[:mouse_move, 573, 92, 2, 307, 667] -[:mouse_move, 561, 125, 2, 308, 668] -[:mouse_move, 557, 145, 2, 309, 669] -[:mouse_move, 555, 168, 2, 310, 670] -[:mouse_move, 557, 220, 2, 311, 671] -[:mouse_move, 566, 247, 2, 312, 672] -[:mouse_move, 595, 302, 2, 313, 673] -[:mouse_move, 603, 311, 2, 314, 674] -[:mouse_move, 620, 337, 2, 315, 675] -[:mouse_move, 629, 348, 2, 316, 676] -[:mouse_move, 633, 353, 2, 317, 677] -[:mouse_move, 635, 356, 2, 318, 678] -[:mouse_move, 637, 358, 2, 319, 679] -[:mouse_move, 638, 359, 2, 320, 681] -[:mouse_button_pressed, 1, 0, 1, 321, 685] -[:mouse_button_up, 1, 0, 1, 322, 691] -[:mouse_move, 631, 359, 2, 323, 707] -[:mouse_move, 626, 358, 2, 324, 708] -[:mouse_move, 622, 357, 2, 325, 709] -[:mouse_move, 618, 354, 2, 326, 710] -[:mouse_move, 612, 347, 2, 327, 711] -[:mouse_move, 608, 342, 2, 328, 712] -[:mouse_move, 598, 325, 2, 329, 713] -[:mouse_move, 593, 313, 2, 330, 714] -[:mouse_move, 588, 303, 2, 331, 715] -[:mouse_move, 586, 296, 2, 332, 716] -[:mouse_move, 580, 284, 2, 333, 717] -[:mouse_move, 577, 279, 2, 334, 719] -[:mouse_move, 576, 278, 2, 335, 720] -[:mouse_move, 574, 277, 2, 336, 721] -[:mouse_move, 572, 276, 2, 337, 722] -[:mouse_move, 569, 276, 2, 338, 723] -[:mouse_move, 567, 275, 2, 339, 724] -[:mouse_move, 566, 275, 2, 340, 725] -[:mouse_move, 565, 275, 2, 341, 726] -[:mouse_move, 564, 275, 2, 342, 729] -[:mouse_button_pressed, 1, 0, 1, 343, 736] -[:mouse_button_up, 1, 0, 1, 344, 743] -[:mouse_move, 572, 275, 2, 345, 761] -[:mouse_move, 577, 275, 2, 346, 762] -[:mouse_move, 591, 275, 2, 347, 763] -[:mouse_move, 596, 275, 2, 348, 764] -[:mouse_move, 603, 274, 2, 349, 765] -[:mouse_move, 606, 274, 2, 350, 766] -[:mouse_move, 619, 273, 2, 351, 767] -[:mouse_move, 620, 273, 2, 352, 768] -[:mouse_move, 623, 273, 2, 353, 769] -[:mouse_move, 625, 273, 2, 354, 771] -[:mouse_move, 626, 273, 2, 355, 774] -[:mouse_button_pressed, 1, 0, 1, 356, 781] -[:mouse_button_up, 1, 0, 1, 357, 788] -[:mouse_move, 629, 273, 2, 358, 795] -[:mouse_move, 637, 273, 2, 359, 796] -[:mouse_move, 646, 273, 2, 360, 797] -[:mouse_move, 654, 273, 2, 361, 798] -[:mouse_move, 664, 273, 2, 362, 799] -[:mouse_move, 677, 273, 2, 363, 800] -[:mouse_move, 687, 273, 2, 364, 801] -[:mouse_move, 692, 273, 2, 365, 802] -[:mouse_move, 697, 273, 2, 366, 803] -[:mouse_move, 702, 273, 2, 367, 804] -[:mouse_move, 704, 273, 2, 368, 805] -[:mouse_move, 705, 273, 2, 369, 806] -[:mouse_move, 707, 273, 2, 370, 807] -[:mouse_move, 708, 273, 2, 371, 808] -[:mouse_move, 711, 274, 2, 372, 809] -[:mouse_move, 713, 274, 2, 373, 810] -[:mouse_move, 715, 274, 2, 374, 811] -[:mouse_move, 716, 274, 2, 375, 812] -[:mouse_move, 717, 274, 2, 376, 814] -[:mouse_move, 718, 274, 2, 377, 815] -[:mouse_button_pressed, 1, 0, 1, 378, 817] -[:mouse_button_up, 1, 0, 1, 379, 825] -[:mouse_move, 717, 274, 2, 380, 829] -[:mouse_move, 711, 276, 2, 381, 830] -[:mouse_move, 708, 277, 2, 382, 831] -[:mouse_move, 701, 280, 2, 383, 832] -[:mouse_move, 697, 283, 2, 384, 833] -[:mouse_move, 693, 284, 2, 385, 834] -[:mouse_move, 679, 291, 2, 386, 835] -[:mouse_move, 672, 296, 2, 387, 836] -[:mouse_move, 668, 299, 2, 388, 837] -[:mouse_move, 662, 305, 2, 389, 838] -[:mouse_move, 658, 308, 2, 390, 839] -[:mouse_move, 653, 314, 2, 391, 840] -[:mouse_move, 649, 321, 2, 392, 842] -[:mouse_move, 648, 323, 2, 393, 843] -[:mouse_move, 647, 325, 2, 394, 844] -[:mouse_move, 645, 329, 2, 395, 845] -[:mouse_move, 644, 331, 2, 396, 846] -[:mouse_move, 642, 336, 2, 397, 847] -[:mouse_move, 641, 337, 2, 398, 848] -[:mouse_move, 639, 341, 2, 399, 849] -[:mouse_move, 638, 343, 2, 400, 850] -[:mouse_move, 637, 344, 2, 401, 851] -[:mouse_move, 636, 345, 2, 402, 852] -[:mouse_move, 635, 346, 2, 403, 853] -[:mouse_move, 635, 347, 2, 404, 854] -[:mouse_move, 634, 348, 2, 405, 855] -[:mouse_move, 634, 349, 2, 406, 857] -[:mouse_button_pressed, 1, 0, 1, 407, 858] -[:mouse_button_up, 1, 0, 1, 408, 866] -[:mouse_move, 634, 350, 2, 409, 887] -[:mouse_move, 634, 351, 2, 410, 889] -[:mouse_move, 633, 352, 2, 411, 891] -[:mouse_move, 632, 352, 2, 412, 893] -[:mouse_move, 628, 352, 2, 413, 894] -[:mouse_move, 625, 353, 2, 414, 895] -[:mouse_move, 617, 354, 2, 415, 896] -[:mouse_move, 613, 356, 2, 416, 897] -[:mouse_move, 605, 359, 2, 417, 898] -[:mouse_move, 603, 360, 2, 418, 899] -[:mouse_move, 600, 362, 2, 419, 900] -[:mouse_move, 596, 364, 2, 420, 901] -[:mouse_move, 592, 366, 2, 421, 902] -[:mouse_move, 590, 367, 2, 422, 904] -[:mouse_move, 588, 367, 2, 423, 905] -[:mouse_move, 581, 367, 2, 424, 906] -[:mouse_move, 579, 366, 2, 425, 907] -[:mouse_move, 577, 366, 2, 426, 908] -[:mouse_move, 575, 365, 2, 427, 909] -[:mouse_move, 571, 364, 2, 428, 910] -[:mouse_move, 570, 363, 2, 429, 911] -[:mouse_move, 568, 362, 2, 430, 912] -[:mouse_button_pressed, 1, 0, 1, 431, 913] -[:mouse_button_up, 1, 0, 1, 432, 921] -[:mouse_move, 568, 366, 2, 433, 927] -[:mouse_move, 568, 369, 2, 434, 928] -[:mouse_move, 568, 373, 2, 435, 929] -[:mouse_move, 568, 376, 2, 436, 930] -[:mouse_move, 569, 384, 2, 437, 931] -[:mouse_move, 571, 388, 2, 438, 932] -[:mouse_move, 580, 401, 2, 439, 933] -[:mouse_move, 592, 413, 2, 440, 934] -[:mouse_move, 596, 416, 2, 441, 935] -[:mouse_move, 607, 426, 2, 442, 936] -[:mouse_move, 612, 431, 2, 443, 937] -[:mouse_move, 618, 435, 2, 444, 938] -[:mouse_move, 620, 437, 2, 445, 939] -[:mouse_move, 625, 441, 2, 446, 940] -[:mouse_move, 627, 442, 2, 447, 941] -[:mouse_move, 630, 444, 2, 448, 942] -[:mouse_move, 631, 444, 2, 449, 943] -[:mouse_move, 634, 445, 2, 450, 944] -[:mouse_move, 635, 446, 2, 451, 945] -[:mouse_move, 636, 446, 2, 452, 946] -[:mouse_move, 638, 447, 2, 453, 947] -[:mouse_move, 639, 447, 2, 454, 949] -[:mouse_button_pressed, 1, 0, 1, 455, 953] -[:mouse_button_up, 1, 0, 1, 456, 961] -[:mouse_move, 639, 446, 2, 457, 977] -[:mouse_move, 640, 443, 2, 458, 978] -[:mouse_move, 641, 438, 2, 459, 979] -[:mouse_move, 641, 430, 2, 460, 980] -[:mouse_move, 644, 395, 2, 461, 981] -[:mouse_move, 645, 373, 2, 462, 982] -[:mouse_move, 645, 315, 2, 463, 983] -[:mouse_move, 644, 275, 2, 464, 984] -[:mouse_move, 642, 266, 2, 465, 985] -[:mouse_move, 636, 236, 2, 466, 986] -[:mouse_move, 633, 226, 2, 467, 987] -[:mouse_move, 630, 217, 2, 468, 988] -[:mouse_move, 618, 200, 2, 469, 989] -[:mouse_move, 610, 192, 2, 470, 990] -[:mouse_move, 604, 188, 2, 471, 991] -[:mouse_move, 594, 181, 2, 472, 992] -[:mouse_move, 591, 180, 2, 473, 993] -[:mouse_move, 584, 176, 2, 474, 994] -[:mouse_move, 579, 174, 2, 475, 995] -[:mouse_move, 576, 173, 2, 476, 996] -[:mouse_move, 571, 172, 2, 477, 997] -[:mouse_move, 569, 172, 2, 478, 998] -[:mouse_move, 565, 171, 2, 479, 999] -[:mouse_move, 564, 170, 2, 480, 1000] -[:mouse_move, 562, 170, 2, 481, 1001] -[:mouse_move, 565, 172, 2, 482, 1005] -[:mouse_move, 570, 175, 2, 483, 1006] -[:mouse_move, 599, 185, 2, 484, 1007] -[:mouse_move, 616, 189, 2, 485, 1008] -[:mouse_move, 647, 192, 2, 486, 1009] -[:mouse_move, 665, 193, 2, 487, 1010] -[:mouse_move, 685, 193, 2, 488, 1011] -[:mouse_move, 719, 186, 2, 489, 1012] -[:mouse_move, 735, 177, 2, 490, 1013] -[:mouse_move, 751, 167, 2, 491, 1014] -[:mouse_move, 755, 161, 2, 492, 1015] -[:mouse_move, 758, 156, 2, 493, 1016] -[:mouse_move, 761, 145, 2, 494, 1017] -[:mouse_move, 762, 139, 2, 495, 1018] -[:mouse_move, 762, 133, 2, 496, 1019] -[:mouse_move, 757, 123, 2, 497, 1020] -[:mouse_move, 753, 117, 2, 498, 1021] -[:mouse_move, 739, 101, 2, 499, 1022] -[:mouse_move, 722, 88, 2, 500, 1023] -[:mouse_move, 711, 81, 2, 501, 1024] -[:mouse_move, 685, 65, 2, 502, 1025] -[:mouse_move, 671, 57, 2, 503, 1026] -[:mouse_move, 656, 49, 2, 504, 1027] -[:mouse_move, 637, 40, 2, 505, 1028] -[:mouse_move, 627, 36, 2, 506, 1029] -[:mouse_move, 617, 33, 2, 507, 1030] -[:mouse_move, 602, 31, 2, 508, 1031] -[:mouse_move, 589, 31, 2, 509, 1032] -[:mouse_move, 582, 31, 2, 510, 1033] -[:mouse_move, 570, 36, 2, 511, 1034] -[:mouse_move, 554, 47, 2, 512, 1035] -[:mouse_move, 547, 53, 2, 513, 1036] -[:mouse_move, 540, 59, 2, 514, 1037] -[:mouse_move, 533, 66, 2, 515, 1038] -[:mouse_move, 517, 84, 2, 516, 1039] -[:mouse_move, 516, 87, 2, 517, 1040] -[:mouse_move, 511, 95, 2, 518, 1041] -[:mouse_move, 506, 107, 2, 519, 1042] -[:mouse_move, 506, 114, 2, 520, 1043] -[:mouse_move, 506, 122, 2, 521, 1044] -[:mouse_move, 515, 139, 2, 522, 1045] -[:mouse_move, 521, 148, 2, 523, 1046] -[:mouse_move, 550, 169, 2, 524, 1047] -[:mouse_move, 576, 178, 2, 525, 1048] -[:mouse_move, 593, 182, 2, 526, 1049] -[:mouse_move, 613, 184, 2, 527, 1050] -[:mouse_move, 650, 184, 2, 528, 1051] -[:mouse_move, 683, 180, 2, 529, 1052] -[:mouse_move, 696, 176, 2, 530, 1053] -[:mouse_move, 709, 171, 2, 531, 1054] -[:mouse_move, 723, 162, 2, 532, 1055] -[:mouse_move, 731, 156, 2, 533, 1056] -[:mouse_move, 744, 142, 2, 534, 1057] -[:mouse_move, 748, 136, 2, 535, 1058] -[:mouse_move, 752, 123, 2, 536, 1059] -[:mouse_move, 753, 117, 2, 537, 1060] -[:mouse_move, 754, 112, 2, 538, 1061] -[:mouse_move, 754, 102, 2, 539, 1062] -[:mouse_move, 750, 93, 2, 540, 1063] -[:mouse_move, 745, 85, 2, 541, 1064] -[:mouse_move, 733, 76, 2, 542, 1065] -[:mouse_move, 728, 73, 2, 543, 1066] -[:mouse_move, 721, 69, 2, 544, 1067] -[:mouse_move, 700, 59, 2, 545, 1068] -[:mouse_move, 678, 51, 2, 546, 1069] -[:mouse_move, 666, 48, 2, 547, 1070] -[:mouse_move, 639, 44, 2, 548, 1071] -[:mouse_move, 627, 42, 2, 549, 1072] -[:mouse_move, 620, 42, 2, 550, 1073] -[:mouse_move, 600, 42, 2, 551, 1074] -[:mouse_move, 590, 44, 2, 552, 1075] -[:mouse_move, 568, 52, 2, 553, 1076] -[:mouse_move, 557, 58, 2, 554, 1077] -[:mouse_move, 550, 62, 2, 555, 1078] -[:mouse_move, 545, 66, 2, 556, 1079] -[:mouse_move, 535, 75, 2, 557, 1080] -[:mouse_move, 526, 87, 2, 558, 1081] -[:mouse_move, 522, 95, 2, 559, 1082] -[:mouse_move, 517, 108, 2, 560, 1083] -[:mouse_move, 515, 116, 2, 561, 1084] -[:mouse_move, 512, 127, 2, 562, 1085] -[:mouse_move, 510, 138, 2, 563, 1086] -[:mouse_move, 510, 143, 2, 564, 1087] -[:mouse_move, 517, 163, 2, 565, 1088] -[:mouse_move, 542, 181, 2, 566, 1089] -[:mouse_move, 552, 185, 2, 567, 1090] -[:mouse_move, 605, 204, 2, 568, 1091] -[:mouse_move, 668, 208, 2, 569, 1093] -[:mouse_move, 677, 208, 2, 570, 1094] -[:mouse_move, 694, 207, 2, 571, 1095] -[:mouse_move, 710, 207, 2, 572, 1096] -[:mouse_move, 714, 207, 2, 573, 1097] -[:mouse_move, 720, 214, 2, 574, 1098] -[:mouse_move, 720, 223, 2, 575, 1099] -[:mouse_move, 720, 240, 2, 576, 1100] -[:mouse_move, 712, 280, 2, 577, 1101] -[:mouse_move, 707, 293, 2, 578, 1102] -[:mouse_move, 696, 319, 2, 579, 1103] -[:mouse_move, 684, 341, 2, 580, 1104] -[:mouse_move, 682, 343, 2, 581, 1105] -[:mouse_move, 677, 350, 2, 582, 1106] -[:mouse_move, 672, 356, 2, 583, 1107] -[:mouse_move, 670, 359, 2, 584, 1108] -[:mouse_move, 669, 359, 2, 585, 1109] -[:mouse_move, 668, 360, 2, 586, 1110] -[:mouse_move, 668, 361, 2, 587, 1112] -[:mouse_button_pressed, 1, 0, 1, 588, 1113] -[:mouse_button_up, 1, 0, 1, 589, 1124] -[:mouse_move, 667, 361, 2, 590, 1141] -[:mouse_move, 661, 356, 2, 591, 1142] -[:mouse_move, 648, 343, 2, 592, 1143] -[:mouse_move, 639, 335, 2, 593, 1144] -[:mouse_move, 625, 324, 2, 594, 1145] -[:mouse_move, 603, 311, 2, 595, 1147] -[:mouse_move, 597, 308, 2, 596, 1148] -[:mouse_move, 585, 302, 2, 597, 1149] -[:mouse_move, 580, 299, 2, 598, 1150] -[:mouse_move, 575, 297, 2, 599, 1151] -[:mouse_move, 574, 296, 2, 600, 1152] -[:mouse_move, 569, 293, 2, 601, 1153] -[:mouse_move, 568, 292, 2, 602, 1154] -[:mouse_move, 567, 291, 2, 603, 1155] -[:mouse_move, 566, 291, 2, 604, 1156] -[:mouse_button_pressed, 1, 0, 1, 605, 1168] -[:mouse_button_up, 1, 0, 1, 606, 1175] -[:mouse_move, 567, 291, 2, 607, 1188] -[:mouse_move, 575, 302, 2, 608, 1189] -[:mouse_move, 580, 307, 2, 609, 1190] -[:mouse_move, 586, 314, 2, 610, 1191] -[:mouse_move, 601, 329, 2, 611, 1192] -[:mouse_move, 609, 337, 2, 612, 1193] -[:mouse_move, 623, 349, 2, 613, 1194] -[:mouse_move, 625, 351, 2, 614, 1195] -[:mouse_move, 633, 358, 2, 615, 1196] -[:mouse_move, 637, 361, 2, 616, 1197] -[:mouse_move, 638, 362, 2, 617, 1198] -[:mouse_move, 639, 363, 2, 618, 1199] -[:mouse_move, 640, 363, 2, 619, 1200] -[:mouse_move, 640, 364, 2, 620, 1201] -[:mouse_move, 640, 365, 2, 621, 1213] -[:mouse_move, 641, 365, 2, 622, 1218] -[:mouse_button_pressed, 1, 0, 1, 623, 1238] -[:mouse_button_up, 1, 0, 1, 624, 1245] -[:mouse_move, 644, 369, 2, 625, 1258] -[:mouse_move, 652, 380, 2, 626, 1259] -[:mouse_move, 656, 384, 2, 627, 1260] -[:mouse_move, 663, 394, 2, 628, 1261] -[:mouse_move, 669, 402, 2, 629, 1262] -[:mouse_move, 682, 415, 2, 630, 1263] -[:mouse_move, 688, 421, 2, 631, 1264] -[:mouse_move, 692, 424, 2, 632, 1265] -[:mouse_move, 694, 427, 2, 633, 1266] -[:mouse_move, 698, 430, 2, 634, 1267] -[:mouse_move, 699, 431, 2, 635, 1268] -[:mouse_move, 700, 432, 2, 636, 1269] -[:mouse_move, 701, 433, 2, 637, 1270] -[:mouse_move, 702, 434, 2, 638, 1271] -[:mouse_move, 703, 435, 2, 639, 1274] -[:mouse_button_pressed, 1, 0, 1, 640, 1279] -[:mouse_button_up, 1, 0, 1, 641, 1285] -[:mouse_move, 701, 435, 2, 642, 1297] -[:mouse_move, 695, 435, 2, 643, 1298] -[:mouse_move, 685, 435, 2, 644, 1299] -[:mouse_move, 680, 435, 2, 645, 1300] -[:mouse_move, 669, 437, 2, 646, 1301] -[:mouse_move, 663, 439, 2, 647, 1302] -[:mouse_move, 661, 439, 2, 648, 1303] -[:mouse_move, 657, 440, 2, 649, 1304] -[:mouse_move, 651, 441, 2, 650, 1305] -[:mouse_move, 646, 442, 2, 651, 1306] -[:mouse_move, 645, 442, 2, 652, 1307] -[:mouse_move, 643, 443, 2, 653, 1308] -[:mouse_move, 642, 443, 2, 654, 1309] -[:mouse_move, 641, 443, 2, 655, 1311] -[:mouse_button_pressed, 1, 0, 1, 656, 1314] -[:mouse_button_up, 1, 0, 1, 657, 1322] -[:mouse_move, 641, 441, 2, 658, 1324] -[:mouse_move, 641, 433, 2, 659, 1325] -[:mouse_move, 641, 425, 2, 660, 1326] -[:mouse_move, 641, 408, 2, 661, 1327] -[:mouse_move, 641, 398, 2, 662, 1328] -[:mouse_move, 641, 373, 2, 663, 1329] -[:mouse_move, 641, 358, 2, 664, 1330] -[:mouse_move, 641, 337, 2, 665, 1331] -[:mouse_move, 641, 323, 2, 666, 1332] -[:mouse_move, 641, 312, 2, 667, 1333] -[:mouse_move, 641, 305, 2, 668, 1334] -[:mouse_move, 641, 301, 2, 669, 1335] -[:mouse_move, 641, 294, 2, 670, 1336] -[:mouse_move, 641, 292, 2, 671, 1337] -[:mouse_move, 641, 290, 2, 672, 1338] -[:mouse_move, 641, 289, 2, 673, 1339] -[:mouse_move, 641, 288, 2, 674, 1341] -[:mouse_move, 641, 287, 2, 675, 1344] -[:mouse_move, 640, 286, 2, 676, 1345] -[:mouse_move, 640, 285, 2, 677, 1346] -[:mouse_move, 640, 284, 2, 678, 1348] -[:mouse_button_pressed, 1, 0, 1, 679, 1349] -[:mouse_button_up, 1, 0, 1, 680, 1356] -[:mouse_move, 642, 284, 2, 681, 1360] -[:mouse_move, 651, 284, 2, 682, 1361] -[:mouse_move, 660, 284, 2, 683, 1362] -[:mouse_move, 671, 284, 2, 684, 1363] -[:mouse_move, 684, 284, 2, 685, 1364] -[:mouse_move, 702, 284, 2, 686, 1365] -[:mouse_move, 714, 284, 2, 687, 1366] -[:mouse_move, 718, 284, 2, 688, 1367] -[:mouse_move, 722, 284, 2, 689, 1368] -[:mouse_move, 726, 284, 2, 690, 1369] -[:mouse_move, 727, 284, 2, 691, 1371] -[:mouse_button_pressed, 1, 0, 1, 692, 1378] -[:mouse_button_up, 1, 0, 1, 693, 1385] -[:mouse_move, 725, 288, 2, 694, 1389] -[:mouse_move, 717, 298, 2, 695, 1390] -[:mouse_move, 710, 306, 2, 696, 1391] -[:mouse_move, 696, 322, 2, 697, 1392] -[:mouse_move, 689, 332, 2, 698, 1393] -[:mouse_move, 674, 353, 2, 699, 1394] -[:mouse_move, 660, 373, 2, 700, 1395] -[:mouse_move, 652, 384, 2, 701, 1396] -[:mouse_move, 650, 387, 2, 702, 1397] -[:mouse_move, 640, 400, 2, 703, 1398] -[:mouse_move, 639, 402, 2, 704, 1399] -[:mouse_move, 634, 409, 2, 705, 1400] -[:mouse_move, 632, 411, 2, 706, 1401] -[:mouse_move, 630, 414, 2, 707, 1402] -[:mouse_move, 629, 415, 2, 708, 1403] -[:mouse_move, 628, 416, 2, 709, 1404] -[:mouse_move, 626, 417, 2, 710, 1405] -[:mouse_move, 626, 418, 2, 711, 1406] -[:mouse_move, 623, 420, 2, 712, 1408] -[:mouse_move, 619, 423, 2, 713, 1409] -[:mouse_move, 618, 424, 2, 714, 1410] -[:mouse_move, 615, 427, 2, 715, 1411] -[:mouse_move, 610, 430, 2, 716, 1412] -[:mouse_move, 604, 433, 2, 717, 1413] -[:mouse_move, 603, 433, 2, 718, 1414] -[:mouse_move, 598, 435, 2, 719, 1415] -[:mouse_move, 595, 437, 2, 720, 1417] -[:mouse_move, 594, 437, 2, 721, 1418] -[:mouse_move, 591, 438, 2, 722, 1419] -[:mouse_move, 590, 439, 2, 723, 1420] -[:mouse_move, 587, 440, 2, 724, 1421] -[:mouse_move, 586, 440, 2, 725, 1422] -[:mouse_move, 585, 440, 2, 726, 1423] -[:mouse_move, 585, 441, 2, 727, 1424] -[:mouse_move, 584, 441, 2, 728, 1425] -[:mouse_button_pressed, 1, 0, 1, 729, 1427] -[:mouse_button_up, 1, 0, 1, 730, 1437] -[:mouse_move, 584, 439, 2, 731, 1446] -[:mouse_move, 584, 438, 2, 732, 1447] -[:mouse_move, 584, 430, 2, 733, 1448] -[:mouse_move, 583, 421, 2, 734, 1449] -[:mouse_move, 582, 416, 2, 735, 1450] -[:mouse_move, 579, 405, 2, 736, 1451] -[:mouse_move, 577, 398, 2, 737, 1452] -[:mouse_move, 570, 381, 2, 738, 1453] -[:mouse_move, 567, 374, 2, 739, 1454] -[:mouse_move, 563, 365, 2, 740, 1455] -[:mouse_move, 560, 357, 2, 741, 1456] -[:mouse_move, 558, 352, 2, 742, 1457] -[:mouse_move, 556, 345, 2, 743, 1458] -[:mouse_move, 555, 343, 2, 744, 1459] -[:mouse_move, 554, 341, 2, 745, 1460] -[:mouse_move, 554, 340, 2, 746, 1461] -[:mouse_move, 553, 340, 2, 747, 1468] -[:mouse_button_pressed, 1, 0, 1, 748, 1476] -[:mouse_button_up, 1, 0, 1, 749, 1484] -[:mouse_move, 554, 340, 2, 750, 1489] -[:mouse_move, 557, 340, 2, 751, 1490] -[:mouse_move, 576, 343, 2, 752, 1491] -[:mouse_move, 582, 344, 2, 753, 1492] -[:mouse_move, 608, 350, 2, 754, 1493] -[:mouse_move, 622, 352, 2, 755, 1494] -[:mouse_move, 639, 353, 2, 756, 1495] -[:mouse_move, 660, 355, 2, 757, 1496] -[:mouse_move, 668, 355, 2, 758, 1497] -[:mouse_move, 684, 355, 2, 759, 1498] -[:mouse_move, 696, 355, 2, 760, 1500] -[:mouse_move, 697, 355, 2, 761, 1501] -[:mouse_move, 705, 355, 2, 762, 1502] -[:mouse_move, 708, 355, 2, 763, 1503] -[:mouse_move, 714, 355, 2, 764, 1504] -[:mouse_move, 716, 355, 2, 765, 1505] -[:mouse_move, 720, 355, 2, 766, 1506] -[:mouse_move, 722, 355, 2, 767, 1507] -[:mouse_move, 724, 355, 2, 768, 1508] -[:mouse_move, 725, 355, 2, 769, 1509] -[:mouse_move, 726, 354, 2, 770, 1510] -[:mouse_button_pressed, 1, 0, 1, 771, 1513] -[:mouse_button_up, 1, 0, 1, 772, 1520] -[:mouse_move, 726, 350, 2, 773, 1539] -[:mouse_move, 726, 344, 2, 774, 1540] -[:mouse_move, 724, 328, 2, 775, 1541] -[:mouse_move, 721, 319, 2, 776, 1542] -[:mouse_move, 707, 271, 2, 777, 1543] -[:mouse_move, 698, 248, 2, 778, 1544] -[:mouse_move, 679, 209, 2, 779, 1545] -[:mouse_move, 674, 201, 2, 780, 1546] -[:mouse_move, 656, 171, 2, 781, 1547] -[:mouse_move, 647, 161, 2, 782, 1548] -[:mouse_move, 640, 153, 2, 783, 1549] -[:mouse_move, 618, 136, 2, 784, 1550] -[:mouse_move, 613, 132, 2, 785, 1551] -[:mouse_move, 609, 130, 2, 786, 1552] -[:mouse_move, 607, 130, 2, 787, 1553] -[:mouse_move, 596, 126, 2, 788, 1554] -[:mouse_move, 593, 125, 2, 789, 1555] -[:mouse_move, 585, 124, 2, 790, 1556] -[:mouse_move, 581, 124, 2, 791, 1557] -[:mouse_move, 575, 124, 2, 792, 1558] -[:mouse_move, 571, 124, 2, 793, 1559] -[:mouse_move, 565, 124, 2, 794, 1560] -[:mouse_move, 560, 124, 2, 795, 1561] -[:mouse_move, 558, 124, 2, 796, 1562] -[:mouse_move, 556, 124, 2, 797, 1563] -[:mouse_move, 555, 124, 2, 798, 1564] -[:mouse_move, 555, 126, 2, 799, 1565] -[:mouse_move, 555, 128, 2, 800, 1566] -[:mouse_move, 555, 130, 2, 801, 1567] -[:mouse_move, 561, 137, 2, 802, 1568] -[:mouse_move, 567, 141, 2, 803, 1569] -[:mouse_move, 586, 148, 2, 804, 1570] -[:mouse_move, 599, 152, 2, 805, 1571] -[:mouse_move, 630, 155, 2, 806, 1572] -[:mouse_move, 661, 156, 2, 807, 1573] -[:mouse_move, 670, 156, 2, 808, 1574] -[:mouse_move, 728, 151, 2, 809, 1575] -[:mouse_move, 743, 147, 2, 810, 1576] -[:mouse_move, 762, 140, 2, 811, 1577] -[:mouse_move, 773, 135, 2, 812, 1578] -[:mouse_move, 781, 130, 2, 813, 1579] -[:mouse_move, 795, 120, 2, 814, 1580] -[:mouse_move, 800, 115, 2, 815, 1581] -[:mouse_move, 804, 109, 2, 816, 1582] -[:mouse_move, 810, 97, 2, 817, 1583] -[:mouse_move, 812, 91, 2, 818, 1584] -[:mouse_move, 812, 74, 2, 819, 1585] -[:mouse_move, 811, 72, 2, 820, 1586] -[:mouse_move, 802, 60, 2, 821, 1587] -[:mouse_move, 793, 52, 2, 822, 1588] -[:mouse_move, 775, 44, 2, 823, 1589] -[:mouse_move, 763, 40, 2, 824, 1590] -[:mouse_move, 737, 33, 2, 825, 1591] -[:mouse_move, 708, 28, 2, 826, 1592] -[:mouse_move, 694, 27, 2, 827, 1593] -[:mouse_move, 679, 26, 2, 828, 1594] -[:mouse_move, 651, 26, 2, 829, 1595] -[:mouse_move, 646, 26, 2, 830, 1596] -[:mouse_move, 616, 31, 2, 831, 1597] -[:mouse_move, 611, 33, 2, 832, 1598] -[:mouse_move, 585, 43, 2, 833, 1599] -[:mouse_move, 581, 46, 2, 834, 1600] -[:mouse_move, 565, 56, 2, 835, 1601] -[:mouse_move, 558, 60, 2, 836, 1602] -[:mouse_move, 542, 76, 2, 837, 1603] -[:mouse_move, 536, 84, 2, 838, 1604] -[:mouse_move, 527, 104, 2, 839, 1605] -[:mouse_move, 522, 115, 2, 840, 1606] -[:mouse_move, 520, 129, 2, 841, 1607] -[:mouse_move, 519, 137, 2, 842, 1608] -[:mouse_move, 519, 145, 2, 843, 1609] -[:mouse_move, 526, 162, 2, 844, 1610] -[:mouse_move, 545, 172, 2, 845, 1611] -[:mouse_move, 564, 180, 2, 846, 1612] -[:mouse_move, 574, 181, 2, 847, 1613] -[:mouse_move, 629, 191, 2, 848, 1614] -[:mouse_move, 658, 192, 2, 849, 1615] -[:mouse_move, 716, 193, 2, 850, 1616] -[:mouse_move, 729, 193, 2, 851, 1617] -[:mouse_move, 773, 183, 2, 852, 1618] -[:mouse_move, 779, 179, 2, 853, 1619] -[:mouse_move, 800, 168, 2, 854, 1620] -[:mouse_move, 806, 163, 2, 855, 1621] -[:mouse_move, 812, 154, 2, 856, 1622] -[:mouse_move, 813, 149, 2, 857, 1623] -[:mouse_move, 814, 140, 2, 858, 1624] -[:mouse_move, 815, 134, 2, 859, 1625] -[:mouse_move, 815, 123, 2, 860, 1626] -[:mouse_move, 815, 121, 2, 861, 1627] -[:mouse_move, 815, 115, 2, 862, 1628] -[:mouse_move, 815, 113, 2, 863, 1629] -[:mouse_move, 816, 111, 2, 864, 1630] -[:key_down_raw, 1073742051, 1024, 2, 865, 1698] -[:key_down_raw, 113, 1024, 2, 866, 1698] diff --git a/samples/05_mouse/03_mouse_move_paint_app/app/main.rb b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb new file mode 100644 index 0000000..9303949 --- /dev/null +++ b/samples/05_mouse/03_mouse_move_paint_app/app/main.rb @@ -0,0 +1,240 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. + + For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... + puts a.floor() + which would print out 13. + (There is also a ceil method, which returns an integer number greater than or equal to the original + with no decimal. If we had called ceil on the variable a, the result would have been 14.) + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to create a new button that clears the grid. + (Remember, you can use state to define ANY property and it will be retained across frames.) + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + + - args.outputs.labels: An array. The values in the array generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + +=end + +# This sample app shows an empty grid that the user can paint on. +# To paint, the user must keep their mouse presssed and drag it around the grid. +# The "clear" button allows users to clear the grid so they can start over. + +class PaintApp + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Runs methods necessary for the game to function properly. + def tick + print_title + add_grid + check_click + draw_buttons + end + + # Prints the title onto the screen by using a label. + # Also separates the title from the grid with a line as a horizontal separator. + def print_title + args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] + outputs.lines << horizontal_separator(660, 0, 1280) + end + + # Sets the starting position, ending position, and color for the horizontal separator. + # The starting and ending positions have the same y values. + def horizontal_separator y, x, x2 + [x, y, x2, y, 150, 150, 150] + end + + # Sets the starting position, ending position, and color for the vertical separator. + # The starting and ending positions have the same x values. + def vertical_separator x, y, y2 + [x, y, x, y2, 150, 150, 150] + end + + # Outputs a border and a grid containing empty squares onto the screen. + def add_grid + + # Sets the x, y, height, and width of the grid. + # There are 31 horizontal lines and 31 vertical lines in the grid. + # Feel free to count them yourself before continuing! + x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center + lines_h = 31 + lines_v = 31 + + # Sets values for the grid's border, grid lines, and filled squares. + # The filled_squares variable is initially set to an empty array. + state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border + state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method + state.filled_squares ||= [] # there are no filled squares until the user fills them in + + # Outputs the grid lines, border, and filled squares onto the screen. + outputs.lines.concat state.grid_lines + outputs.borders << state.grid_border + outputs.solids << state.filled_squares + end + + # Draws the grid by adding in vertical and horizontal separators. + def draw_grid x, y, h, w, lines_h, lines_v + + # The grid starts off empty. + grid = [] + + # Calculates the placement and adds horizontal lines or separators into the grid. + curr_y = y # start at the bottom of the box + dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid + lines_h.times do + curr_y += dist_y # increment curr_y by the distance between the horizontal lines + grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid + end + + # Calculates the placement and adds vertical lines or separators into the grid. + curr_x = x # now start at the left of the box + dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid + lines_v.times do + curr_x += dist_x # increment curr_x by the distance between the vertical lines + grid << vertical_separator(curr_x, y + 1, y + h) # add separator + end + + # paint_grid uses a hash to assign values to keys. + state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, + "lines_v" => lines_v, "dist_x" => dist_x, + "dist_y" => dist_y } + + return grid + end + + # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. + # If the mouse is up, the user cannot drag the mouse. + def check_click + if inputs.mouse.down #is mouse up or down? + state.mouse_held = true # mouse is being held down + elsif inputs.mouse.up # if mouse is up + state.mouse_held = false # mouse is not being held down or dragged + state.mouse_dragging = false + end + + if state.mouse_held && # mouse needs to be down + !inputs.mouse.click && # must not be first click + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" + state.mouse_dragging = true + end + + # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click.point, :click) + + # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) + search_lines(inputs.mouse.position, :drag) + end + end + + # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. + def search_lines (point, input_type) + point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash + point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash + + # Remove code following the .floor and see what happens when you try to fill in grid squares + point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] + point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] + + point.x += state.paint_grid["x"] + point.y += state.paint_grid["y"] + + # Sets definition of a grid box, meaning its x, y, width, and height. + # Floor is called on the point.x and point.y variables. + # Ceil method is called on values of the distance hash keys, setting the width and height of a box. + grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] + + if input_type == :click # if user clicks their mouse + if state.filled_squares.include? grid_box # if grid box is already filled in + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + else + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares + end + elsif input_type == :drag # if user drags mouse + unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in + state.filled_squares << grid_box # the box is filled in and added to filled_squares + end + end + end + + # Creates and outputs a "Clear" button on the screen using a label and a border. + # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. + def draw_buttons + x, y, w, h = 390, 50, 240, 50 + state.clear_button ||= state.new_entity(:button_with_fade) + + # The x and y positions are set to display the label in the center of the button. + # Try changing the first two parameters to simply x, y and see what happens to the text placement! + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border + state.clear_button.border ||= [x, y, w, h] + + # If the mouse is clicked inside the borders of the clear button, + # the filled_squares collection is emptied and the squares are cleared. + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred + state.filled_squares.clear + inputs.mouse.previous_click = nil + end + + outputs.labels << state.clear_button.label + outputs.borders << state.clear_button.border + + # When the clear button is clicked, the color of the button changes + # and the transparency changes, as well. If you change the time from + # 0.25.seconds to 1.25.seconds or more, the change will last longer. + if state.clear_button.clicked_at + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + end + end +end + +$paint_app = PaintApp.new + +def tick args + $paint_app.inputs = args.inputs + $paint_app.state = args.state + $paint_app.grid = args.grid + $paint_app.args = args + $paint_app.outputs = args.outputs + $paint_app.tick + tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse/03_mouse_move_paint_app/license-for-sample.txt b/samples/05_mouse/03_mouse_move_paint_app/license-for-sample.txt new file mode 100644 index 0000000..5c0563d --- /dev/null +++ b/samples/05_mouse/03_mouse_move_paint_app/license-for-sample.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 DragonRuby LLC, Ananth Vivekanand, Sahil Jain + +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/05_mouse/03_mouse_move_paint_app/replay.txt b/samples/05_mouse/03_mouse_move_paint_app/replay.txt new file mode 100644 index 0000000..2f4753c --- /dev/null +++ b/samples/05_mouse/03_mouse_move_paint_app/replay.txt @@ -0,0 +1,238 @@ +replay_version 2.0 +stopped_at 629 +seed 100 +recorded_at Sun Sep 29 22:17:52 2019 +[:mouse_move, 539, 647, 2, 1, 151] +[:mouse_move, 545, 636, 2, 2, 152] +[:mouse_move, 552, 618, 2, 3, 153] +[:mouse_move, 556, 607, 2, 4, 154] +[:mouse_move, 572, 557, 2, 5, 155] +[:mouse_move, 576, 542, 2, 6, 156] +[:mouse_move, 593, 468, 2, 7, 157] +[:mouse_move, 594, 454, 2, 8, 158] +[:mouse_move, 600, 410, 2, 9, 159] +[:mouse_move, 602, 354, 2, 10, 160] +[:mouse_move, 603, 327, 2, 11, 161] +[:mouse_move, 605, 290, 2, 12, 162] +[:mouse_move, 605, 281, 2, 13, 163] +[:mouse_move, 606, 265, 2, 14, 164] +[:mouse_move, 606, 256, 2, 15, 165] +[:mouse_move, 606, 246, 2, 16, 166] +[:mouse_move, 606, 242, 2, 17, 167] +[:mouse_move, 606, 240, 2, 18, 168] +[:mouse_move, 606, 239, 2, 19, 171] +[:mouse_move, 606, 238, 2, 20, 174] +[:mouse_move, 606, 239, 2, 21, 191] +[:mouse_move, 606, 241, 2, 22, 199] +[:mouse_move, 606, 243, 2, 23, 200] +[:mouse_move, 606, 249, 2, 24, 201] +[:mouse_move, 605, 253, 2, 25, 203] +[:mouse_move, 603, 254, 2, 26, 204] +[:mouse_move, 601, 257, 2, 27, 205] +[:mouse_move, 599, 258, 2, 28, 206] +[:mouse_move, 595, 259, 2, 29, 207] +[:mouse_move, 594, 260, 2, 30, 208] +[:mouse_move, 589, 260, 2, 31, 209] +[:mouse_move, 587, 260, 2, 32, 210] +[:mouse_move, 580, 259, 2, 33, 211] +[:mouse_move, 579, 258, 2, 34, 212] +[:mouse_move, 576, 257, 2, 35, 214] +[:mouse_move, 575, 257, 2, 36, 215] +[:mouse_move, 574, 257, 2, 37, 216] +[:mouse_move, 573, 257, 2, 38, 217] +[:mouse_move, 570, 257, 2, 39, 218] +[:mouse_move, 566, 257, 2, 40, 219] +[:mouse_move, 562, 258, 2, 41, 220] +[:mouse_move, 558, 259, 2, 42, 222] +[:mouse_move, 557, 259, 2, 43, 223] +[:mouse_move, 554, 260, 2, 44, 224] +[:mouse_move, 553, 260, 2, 45, 226] +[:mouse_move, 552, 260, 2, 46, 228] +[:mouse_move, 551, 260, 2, 47, 229] +[:mouse_move, 550, 260, 2, 48, 230] +[:mouse_move, 548, 259, 2, 49, 232] +[:mouse_move, 547, 259, 2, 50, 234] +[:mouse_move, 546, 259, 2, 51, 235] +[:mouse_move, 545, 259, 2, 52, 239] +[:mouse_move, 544, 259, 2, 53, 242] +[:mouse_move, 542, 259, 2, 54, 243] +[:mouse_move, 540, 259, 2, 55, 245] +[:mouse_move, 539, 259, 2, 56, 246] +[:mouse_move, 537, 259, 2, 57, 247] +[:mouse_move, 536, 259, 2, 58, 248] +[:mouse_move, 535, 259, 2, 59, 249] +[:mouse_move, 534, 259, 2, 60, 250] +[:mouse_move, 533, 259, 2, 61, 251] +[:mouse_button_pressed, 1, 0, 1, 62, 257] +[:mouse_button_up, 1, 0, 1, 63, 265] +[:mouse_move, 535, 261, 2, 64, 278] +[:mouse_move, 544, 266, 2, 65, 279] +[:mouse_move, 550, 270, 2, 66, 280] +[:mouse_move, 559, 274, 2, 67, 281] +[:mouse_move, 581, 280, 2, 68, 282] +[:mouse_move, 606, 287, 2, 69, 283] +[:mouse_move, 635, 291, 2, 70, 284] +[:mouse_move, 654, 293, 2, 71, 285] +[:mouse_move, 677, 293, 2, 72, 286] +[:mouse_move, 691, 293, 2, 73, 287] +[:mouse_move, 721, 290, 2, 74, 288] +[:mouse_move, 734, 286, 2, 75, 290] +[:mouse_move, 740, 283, 2, 76, 291] +[:mouse_move, 746, 279, 2, 77, 292] +[:mouse_move, 748, 277, 2, 78, 293] +[:mouse_move, 752, 273, 2, 79, 294] +[:mouse_move, 753, 271, 2, 80, 295] +[:mouse_move, 754, 268, 2, 81, 296] +[:mouse_move, 755, 265, 2, 82, 297] +[:mouse_move, 756, 265, 2, 83, 298] +[:mouse_move, 756, 263, 2, 84, 299] +[:mouse_move, 757, 262, 2, 85, 300] +[:mouse_move, 757, 261, 2, 86, 302] +[:mouse_move, 756, 260, 2, 87, 311] +[:mouse_move, 755, 260, 2, 88, 312] +[:mouse_move, 752, 259, 2, 89, 313] +[:mouse_move, 751, 258, 2, 90, 314] +[:mouse_move, 748, 258, 2, 91, 315] +[:mouse_move, 747, 258, 2, 92, 316] +[:mouse_move, 746, 257, 2, 93, 317] +[:mouse_move, 745, 257, 2, 94, 318] +[:mouse_move, 743, 257, 2, 95, 330] +[:mouse_move, 742, 258, 2, 96, 331] +[:mouse_move, 738, 259, 2, 97, 332] +[:mouse_move, 736, 260, 2, 98, 334] +[:mouse_move, 735, 260, 2, 99, 335] +[:mouse_move, 734, 260, 2, 100, 336] +[:mouse_move, 733, 260, 2, 101, 338] +[:mouse_move, 732, 260, 2, 102, 340] +[:mouse_move, 731, 260, 2, 103, 341] +[:mouse_move, 730, 260, 2, 104, 343] +[:mouse_move, 729, 260, 2, 105, 347] +[:mouse_move, 727, 260, 2, 106, 349] +[:mouse_move, 723, 260, 2, 107, 351] +[:mouse_move, 721, 260, 2, 108, 353] +[:mouse_move, 720, 260, 2, 109, 354] +[:mouse_button_pressed, 1, 0, 1, 110, 363] +[:mouse_button_up, 1, 0, 1, 111, 368] +[:mouse_move, 720, 271, 2, 112, 382] +[:mouse_move, 720, 279, 2, 113, 383] +[:mouse_move, 714, 297, 2, 114, 384] +[:mouse_move, 710, 307, 2, 115, 385] +[:mouse_move, 687, 346, 2, 116, 386] +[:mouse_move, 670, 365, 2, 117, 387] +[:mouse_move, 632, 399, 2, 118, 388] +[:mouse_move, 612, 411, 2, 119, 389] +[:mouse_move, 584, 420, 2, 120, 390] +[:mouse_move, 577, 420, 2, 121, 391] +[:mouse_move, 548, 422, 2, 122, 392] +[:mouse_move, 537, 416, 2, 123, 394] +[:mouse_move, 533, 411, 2, 124, 395] +[:mouse_move, 526, 401, 2, 125, 396] +[:mouse_move, 524, 396, 2, 126, 397] +[:mouse_move, 520, 386, 2, 127, 398] +[:mouse_move, 518, 381, 2, 128, 399] +[:mouse_move, 514, 371, 2, 129, 400] +[:mouse_move, 513, 370, 2, 130, 401] +[:mouse_move, 510, 366, 2, 131, 402] +[:mouse_move, 509, 364, 2, 132, 403] +[:mouse_move, 507, 362, 2, 133, 404] +[:mouse_move, 501, 362, 2, 134, 405] +[:mouse_move, 496, 362, 2, 135, 406] +[:mouse_move, 487, 362, 2, 136, 407] +[:mouse_move, 482, 362, 2, 137, 408] +[:mouse_move, 475, 362, 2, 138, 409] +[:mouse_move, 472, 362, 2, 139, 410] +[:mouse_move, 468, 363, 2, 140, 411] +[:mouse_move, 467, 363, 2, 141, 412] +[:mouse_move, 466, 363, 2, 142, 413] +[:mouse_move, 470, 363, 2, 143, 442] +[:mouse_move, 473, 363, 2, 144, 443] +[:mouse_move, 474, 362, 2, 145, 444] +[:mouse_move, 474, 361, 2, 146, 445] +[:mouse_move, 476, 360, 2, 147, 446] +[:mouse_move, 477, 358, 2, 148, 447] +[:mouse_move, 478, 355, 2, 149, 448] +[:mouse_move, 479, 354, 2, 150, 449] +[:mouse_move, 480, 351, 2, 151, 450] +[:mouse_move, 481, 350, 2, 152, 452] +[:mouse_move, 481, 349, 2, 153, 453] +[:mouse_button_pressed, 1, 0, 1, 154, 474] +[:mouse_move, 481, 350, 2, 155, 474] +[:mouse_move, 483, 354, 2, 156, 475] +[:mouse_move, 484, 359, 2, 157, 476] +[:mouse_move, 491, 374, 2, 158, 477] +[:mouse_move, 495, 383, 2, 159, 479] +[:mouse_move, 497, 388, 2, 160, 480] +[:mouse_move, 499, 391, 2, 161, 481] +[:mouse_move, 503, 398, 2, 162, 482] +[:mouse_move, 509, 408, 2, 163, 483] +[:mouse_move, 511, 411, 2, 164, 485] +[:mouse_move, 515, 417, 2, 165, 486] +[:mouse_move, 517, 421, 2, 166, 487] +[:mouse_move, 521, 425, 2, 167, 488] +[:mouse_move, 523, 428, 2, 168, 489] +[:mouse_move, 526, 431, 2, 169, 490] +[:mouse_move, 528, 433, 2, 170, 491] +[:mouse_move, 533, 437, 2, 171, 492] +[:mouse_move, 536, 440, 2, 172, 493] +[:mouse_move, 546, 447, 2, 173, 494] +[:mouse_move, 551, 451, 2, 174, 495] +[:mouse_move, 566, 461, 2, 175, 496] +[:mouse_move, 582, 470, 2, 176, 497] +[:mouse_move, 590, 473, 2, 177, 498] +[:mouse_move, 597, 476, 2, 178, 499] +[:mouse_move, 611, 482, 2, 179, 500] +[:mouse_move, 622, 486, 2, 180, 501] +[:mouse_move, 628, 488, 2, 181, 502] +[:mouse_move, 632, 489, 2, 182, 503] +[:mouse_move, 638, 491, 2, 183, 504] +[:mouse_move, 644, 491, 2, 184, 505] +[:mouse_move, 651, 492, 2, 185, 506] +[:mouse_move, 660, 492, 2, 186, 507] +[:mouse_move, 665, 492, 2, 187, 508] +[:mouse_move, 669, 491, 2, 188, 509] +[:mouse_move, 681, 489, 2, 189, 510] +[:mouse_move, 685, 489, 2, 190, 512] +[:mouse_move, 692, 487, 2, 191, 513] +[:mouse_move, 697, 485, 2, 192, 514] +[:mouse_move, 705, 482, 2, 193, 515] +[:mouse_move, 709, 480, 2, 194, 516] +[:mouse_move, 717, 475, 2, 195, 517] +[:mouse_move, 721, 473, 2, 196, 518] +[:mouse_move, 730, 467, 2, 197, 519] +[:mouse_move, 733, 464, 2, 198, 520] +[:mouse_move, 741, 458, 2, 199, 521] +[:mouse_move, 746, 455, 2, 200, 522] +[:mouse_move, 753, 448, 2, 201, 523] +[:mouse_move, 761, 440, 2, 202, 524] +[:mouse_move, 763, 438, 2, 203, 525] +[:mouse_move, 767, 434, 2, 204, 526] +[:mouse_move, 772, 426, 2, 205, 527] +[:mouse_move, 774, 423, 2, 206, 528] +[:mouse_move, 778, 415, 2, 207, 529] +[:mouse_move, 782, 407, 2, 208, 530] +[:mouse_move, 783, 402, 2, 209, 531] +[:mouse_move, 785, 396, 2, 210, 532] +[:mouse_move, 789, 385, 2, 211, 533] +[:mouse_move, 791, 377, 2, 212, 534] +[:mouse_move, 791, 373, 2, 213, 535] +[:mouse_move, 792, 369, 2, 214, 536] +[:mouse_move, 793, 357, 2, 215, 537] +[:mouse_move, 794, 354, 2, 216, 539] +[:mouse_move, 795, 348, 2, 217, 540] +[:mouse_move, 795, 346, 2, 218, 541] +[:mouse_move, 796, 342, 2, 219, 542] +[:mouse_move, 796, 341, 2, 220, 543] +[:mouse_move, 796, 340, 2, 221, 544] +[:mouse_move, 796, 339, 2, 222, 545] +[:mouse_move, 797, 339, 2, 223, 546] +[:mouse_move, 797, 338, 2, 224, 547] +[:mouse_button_up, 1, 0, 1, 225, 564] +[:mouse_move, 807, 344, 2, 226, 564] +[:mouse_move, 834, 357, 2, 227, 566] +[:mouse_move, 858, 367, 2, 228, 567] +[:mouse_move, 870, 370, 2, 229, 568] +[:mouse_move, 912, 379, 2, 230, 569] +[:mouse_move, 929, 380, 2, 231, 570] +[:key_down_raw, 1073742051, 1024, 2, 232, 627] +[:key_down_raw, 113, 1024, 2, 233, 628] +[:key_up_raw, 113, 1024, 2, 234, 628] diff --git a/samples/05_mouse/04_coordinate_systems/app/main.rb b/samples/05_mouse/04_coordinate_systems/app/main.rb new file mode 100644 index 0000000..fcfa090 --- /dev/null +++ b/samples/05_mouse/04_coordinate_systems/app/main.rb @@ -0,0 +1,80 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. + Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for + position to know the mouse's coordinates. + For more information about the mouse, go to mygame/documentation/07-mouse.md. + + Reminders: + + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + + - 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. + + In this sample app, string interpolation is used to show the current position of the mouse + in a label. + + - args.outputs.labels: An array that generates a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.outputs.solids: An array that generates a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.lines: An array that generates a line. + The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] + For more information about lines, go to mygame/documentation/04-lines.md. + +=end + +# This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the +# coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or +# four quadrants by pressing the button. + +def tick args + + # The addition and subtraction in the first two parameters of the label and solid + # ensure that the outputs don't overlap each other. Try removing them and see what happens. + pos = args.inputs.mouse.position # stores coordinates of mouse's position + args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates + args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering + + button = [0, 0, 370, 50] # sets definition of toggle button + args.outputs.borders << button # outputs button as border (not filled in) + args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button + args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants + args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants + + if args.inputs.mouse.click # if the user clicks the mouse + pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) + if pos.inside_rect? button # if the click occurred inside the button + if args.grid.name == :bottom_left # if the grid shows bottom left as origin + args.grid.origin_center! # origin will be shown in center + else + args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin + end + end + end + + tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse/04_coordinate_systems/license-for-sample.txt b/samples/05_mouse/04_coordinate_systems/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/05_mouse/04_coordinate_systems/license-for-sample.txt @@ -0,0 +1,9 @@ +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/05_mouse/04_coordinate_systems/replay.txt b/samples/05_mouse/04_coordinate_systems/replay.txt new file mode 100644 index 0000000..d426464 --- /dev/null +++ b/samples/05_mouse/04_coordinate_systems/replay.txt @@ -0,0 +1,526 @@ +replay_version 2.0 +stopped_at 1360 +seed 100 +recorded_at Sun Sep 29 22:19:52 2019 +[:mouse_move, 1084, 546, 2, 1, 72] +[:mouse_move, 1074, 545, 2, 2, 73] +[:mouse_move, 1022, 539, 2, 3, 74] +[:mouse_move, 984, 535, 2, 4, 75] +[:mouse_move, 885, 523, 2, 5, 76] +[:mouse_move, 862, 521, 2, 6, 77] +[:mouse_move, 755, 515, 2, 7, 78] +[:mouse_move, 712, 515, 2, 8, 79] +[:mouse_move, 660, 515, 2, 9, 80] +[:mouse_move, 629, 516, 2, 10, 81] +[:mouse_move, 579, 524, 2, 11, 82] +[:mouse_move, 558, 530, 2, 12, 83] +[:mouse_move, 518, 543, 2, 13, 84] +[:mouse_move, 500, 550, 2, 14, 85] +[:mouse_move, 467, 562, 2, 15, 86] +[:mouse_move, 454, 567, 2, 16, 87] +[:mouse_move, 439, 573, 2, 17, 88] +[:mouse_move, 431, 577, 2, 18, 89] +[:mouse_move, 412, 586, 2, 19, 90] +[:mouse_move, 404, 589, 2, 20, 91] +[:mouse_move, 384, 597, 2, 21, 92] +[:mouse_move, 371, 601, 2, 22, 93] +[:mouse_move, 358, 605, 2, 23, 94] +[:mouse_move, 341, 611, 2, 24, 95] +[:mouse_move, 330, 615, 2, 25, 96] +[:mouse_move, 311, 622, 2, 26, 97] +[:mouse_move, 302, 625, 2, 27, 98] +[:mouse_move, 280, 635, 2, 28, 99] +[:mouse_move, 274, 637, 2, 29, 100] +[:mouse_move, 261, 642, 2, 30, 101] +[:mouse_move, 256, 642, 2, 31, 119] +[:mouse_move, 255, 641, 2, 32, 120] +[:mouse_move, 252, 641, 2, 33, 121] +[:mouse_move, 248, 640, 2, 34, 122] +[:mouse_move, 243, 639, 2, 35, 123] +[:mouse_move, 240, 637, 2, 36, 124] +[:mouse_move, 238, 636, 2, 37, 125] +[:mouse_move, 235, 634, 2, 38, 126] +[:mouse_move, 234, 633, 2, 39, 127] +[:mouse_move, 230, 631, 2, 40, 128] +[:mouse_move, 230, 630, 2, 41, 129] +[:mouse_move, 225, 628, 2, 42, 130] +[:mouse_move, 223, 628, 2, 43, 131] +[:mouse_move, 216, 626, 2, 44, 132] +[:mouse_move, 212, 626, 2, 45, 133] +[:mouse_move, 203, 626, 2, 46, 134] +[:mouse_move, 198, 626, 2, 47, 135] +[:mouse_move, 188, 626, 2, 48, 136] +[:mouse_move, 183, 626, 2, 49, 137] +[:mouse_move, 173, 626, 2, 50, 138] +[:mouse_move, 171, 626, 2, 51, 139] +[:mouse_move, 165, 625, 2, 52, 140] +[:mouse_move, 163, 625, 2, 53, 141] +[:mouse_move, 161, 624, 2, 54, 142] +[:mouse_move, 160, 624, 2, 55, 143] +[:mouse_move, 160, 623, 2, 56, 144] +[:mouse_move, 158, 622, 2, 57, 147] +[:mouse_move, 157, 621, 2, 58, 148] +[:mouse_move, 149, 618, 2, 59, 149] +[:mouse_move, 145, 616, 2, 60, 150] +[:mouse_move, 135, 613, 2, 61, 151] +[:mouse_move, 132, 612, 2, 62, 152] +[:mouse_move, 125, 610, 2, 63, 153] +[:mouse_move, 122, 609, 2, 64, 154] +[:mouse_move, 114, 608, 2, 65, 155] +[:mouse_move, 111, 608, 2, 66, 156] +[:mouse_move, 107, 608, 2, 67, 157] +[:mouse_move, 104, 608, 2, 68, 158] +[:mouse_move, 99, 608, 2, 69, 159] +[:mouse_move, 95, 608, 2, 70, 160] +[:mouse_move, 89, 607, 2, 71, 161] +[:mouse_move, 85, 607, 2, 72, 162] +[:mouse_move, 75, 605, 2, 73, 163] +[:mouse_move, 70, 604, 2, 74, 164] +[:mouse_move, 60, 602, 2, 75, 165] +[:mouse_move, 55, 601, 2, 76, 166] +[:mouse_move, 48, 599, 2, 77, 167] +[:mouse_move, 44, 598, 2, 78, 168] +[:mouse_move, 35, 595, 2, 79, 169] +[:mouse_move, 35, 598, 2, 80, 190] +[:mouse_move, 35, 601, 2, 81, 191] +[:mouse_move, 34, 608, 2, 82, 192] +[:mouse_move, 33, 613, 2, 83, 193] +[:mouse_move, 32, 625, 2, 84, 194] +[:mouse_move, 31, 630, 2, 85, 195] +[:mouse_move, 29, 636, 2, 86, 196] +[:mouse_move, 29, 640, 2, 87, 197] +[:mouse_move, 27, 645, 2, 88, 198] +[:mouse_move, 26, 647, 2, 89, 199] +[:mouse_move, 25, 650, 2, 90, 200] +[:mouse_move, 24, 657, 2, 91, 201] +[:mouse_move, 24, 661, 2, 92, 202] +[:mouse_move, 23, 672, 2, 93, 203] +[:mouse_move, 23, 678, 2, 94, 204] +[:mouse_move, 23, 684, 2, 95, 205] +[:mouse_move, 23, 689, 2, 96, 219] +[:mouse_move, 22, 692, 2, 97, 220] +[:mouse_move, 22, 697, 2, 98, 221] +[:mouse_move, 22, 699, 2, 99, 222] +[:mouse_move, 20, 705, 2, 100, 223] +[:mouse_move, 20, 707, 2, 101, 224] +[:mouse_move, 19, 709, 2, 102, 225] +[:mouse_move, 19, 710, 2, 103, 226] +[:mouse_move, 18, 711, 2, 104, 228] +[:mouse_move, 17, 712, 2, 105, 229] +[:mouse_move, 16, 712, 2, 106, 230] +[:mouse_move, 15, 712, 2, 107, 231] +[:mouse_move, 14, 713, 2, 108, 232] +[:mouse_move, 13, 714, 2, 109, 233] +[:mouse_move, 12, 714, 2, 110, 234] +[:mouse_move, 10, 715, 2, 111, 236] +[:mouse_move, 8, 715, 2, 112, 238] +[:mouse_move, 6, 715, 2, 113, 240] +[:mouse_move, 5, 715, 2, 114, 241] +[:mouse_move, 4, 714, 2, 115, 242] +[:mouse_move, 3, 713, 2, 116, 243] +[:mouse_move, 3, 712, 2, 117, 244] +[:mouse_move, 2, 712, 2, 118, 245] +[:mouse_move, 2, 711, 2, 119, 246] +[:mouse_move, 2, 710, 2, 120, 249] +[:mouse_move, 2, 709, 2, 121, 261] +[:mouse_move, 3, 709, 2, 122, 262] +[:mouse_move, 3, 710, 2, 123, 275] +[:mouse_move, 4, 710, 2, 124, 292] +[:mouse_move, 5, 710, 2, 125, 296] +[:mouse_move, 6, 710, 2, 126, 302] +[:mouse_move, 5, 710, 2, 127, 336] +[:mouse_move, 5, 711, 2, 128, 339] +[:mouse_move, 4, 711, 2, 129, 342] +[:mouse_move, 3, 711, 2, 130, 347] +[:mouse_move, 3, 712, 2, 131, 350] +[:mouse_move, 3, 713, 2, 132, 355] +[:mouse_move, 3, 714, 2, 133, 359] +[:mouse_move, 9, 713, 2, 134, 394] +[:mouse_move, 19, 712, 2, 135, 395] +[:mouse_move, 24, 711, 2, 136, 396] +[:mouse_move, 30, 711, 2, 137, 397] +[:mouse_move, 41, 710, 2, 138, 398] +[:mouse_move, 46, 710, 2, 139, 399] +[:mouse_move, 55, 710, 2, 140, 400] +[:mouse_move, 57, 710, 2, 141, 401] +[:mouse_move, 63, 709, 2, 142, 402] +[:mouse_move, 66, 709, 2, 143, 403] +[:mouse_move, 69, 709, 2, 144, 404] +[:mouse_move, 70, 708, 2, 145, 405] +[:mouse_move, 71, 708, 2, 146, 406] +[:mouse_move, 72, 708, 2, 147, 408] +[:mouse_move, 73, 707, 2, 148, 410] +[:mouse_move, 74, 707, 2, 149, 413] +[:mouse_move, 75, 707, 2, 150, 414] +[:mouse_move, 75, 706, 2, 151, 415] +[:mouse_move, 76, 706, 2, 152, 416] +[:mouse_move, 77, 706, 2, 153, 417] +[:mouse_move, 78, 705, 2, 154, 420] +[:mouse_button_pressed, 1, 0, 1, 155, 433] +[:mouse_button_up, 1, 0, 1, 156, 439] +[:mouse_move, 86, 704, 2, 157, 464] +[:mouse_move, 95, 702, 2, 158, 465] +[:mouse_move, 117, 697, 2, 159, 466] +[:mouse_move, 144, 690, 2, 160, 467] +[:mouse_move, 210, 668, 2, 161, 468] +[:mouse_move, 246, 654, 2, 162, 469] +[:mouse_move, 319, 621, 2, 163, 470] +[:mouse_move, 352, 605, 2, 164, 471] +[:mouse_move, 384, 590, 2, 165, 472] +[:mouse_move, 423, 571, 2, 166, 473] +[:mouse_move, 442, 562, 2, 167, 474] +[:mouse_move, 473, 544, 2, 168, 475] +[:mouse_move, 484, 535, 2, 169, 476] +[:mouse_move, 497, 523, 2, 170, 477] +[:mouse_move, 505, 516, 2, 171, 478] +[:mouse_move, 514, 505, 2, 172, 479] +[:mouse_move, 520, 500, 2, 173, 480] +[:mouse_move, 528, 490, 2, 174, 481] +[:mouse_move, 531, 486, 2, 175, 482] +[:mouse_move, 538, 479, 2, 176, 483] +[:mouse_move, 541, 475, 2, 177, 484] +[:mouse_move, 551, 461, 2, 178, 485] +[:mouse_move, 555, 453, 2, 179, 486] +[:mouse_move, 567, 432, 2, 180, 487] +[:mouse_move, 575, 421, 2, 181, 488] +[:mouse_move, 594, 392, 2, 182, 489] +[:mouse_move, 603, 380, 2, 183, 490] +[:mouse_move, 616, 363, 2, 184, 491] +[:mouse_move, 619, 360, 2, 185, 492] +[:mouse_move, 627, 351, 2, 186, 493] +[:mouse_move, 629, 349, 2, 187, 494] +[:mouse_move, 631, 349, 2, 188, 507] +[:mouse_move, 632, 350, 2, 189, 508] +[:mouse_move, 633, 350, 2, 190, 509] +[:mouse_move, 633, 351, 2, 191, 510] +[:mouse_move, 634, 351, 2, 192, 511] +[:mouse_move, 634, 352, 2, 193, 513] +[:mouse_move, 635, 353, 2, 194, 514] +[:mouse_move, 636, 354, 2, 195, 515] +[:mouse_move, 636, 356, 2, 196, 516] +[:mouse_move, 637, 356, 2, 197, 517] +[:mouse_move, 637, 357, 2, 198, 518] +[:mouse_move, 638, 357, 2, 199, 520] +[:mouse_move, 638, 358, 2, 200, 521] +[:mouse_move, 639, 358, 2, 201, 523] +[:mouse_move, 639, 359, 2, 202, 531] +[:mouse_move, 640, 359, 2, 203, 537] +[:mouse_move, 640, 360, 2, 204, 545] +[:mouse_move, 641, 360, 2, 205, 547] +[:mouse_move, 641, 361, 2, 206, 550] +[:mouse_move, 641, 360, 2, 207, 573] +[:mouse_move, 640, 360, 2, 208, 617] +[:mouse_move, 639, 360, 2, 209, 623] +[:mouse_move, 638, 360, 2, 210, 626] +[:mouse_move, 639, 360, 2, 211, 648] +[:mouse_move, 640, 360, 2, 212, 664] +[:mouse_move, 639, 360, 2, 213, 792] +[:mouse_move, 636, 361, 2, 214, 793] +[:mouse_move, 617, 369, 2, 215, 794] +[:mouse_move, 599, 375, 2, 216, 795] +[:mouse_move, 524, 405, 2, 217, 796] +[:mouse_move, 486, 421, 2, 218, 797] +[:mouse_move, 467, 431, 2, 219, 798] +[:mouse_move, 394, 468, 2, 220, 799] +[:mouse_move, 361, 484, 2, 221, 800] +[:mouse_move, 324, 502, 2, 222, 801] +[:mouse_move, 304, 512, 2, 223, 802] +[:mouse_move, 285, 522, 2, 224, 803] +[:mouse_move, 273, 528, 2, 225, 804] +[:mouse_move, 257, 536, 2, 226, 805] +[:mouse_move, 251, 538, 2, 227, 806] +[:mouse_move, 240, 543, 2, 228, 807] +[:mouse_move, 236, 545, 2, 229, 808] +[:mouse_move, 227, 549, 2, 230, 809] +[:mouse_move, 223, 551, 2, 231, 810] +[:mouse_move, 212, 557, 2, 232, 811] +[:mouse_move, 205, 560, 2, 233, 812] +[:mouse_move, 193, 565, 2, 234, 813] +[:mouse_move, 187, 568, 2, 235, 814] +[:mouse_move, 173, 574, 2, 236, 815] +[:mouse_move, 165, 577, 2, 237, 816] +[:mouse_move, 151, 583, 2, 238, 817] +[:mouse_move, 139, 590, 2, 239, 818] +[:mouse_move, 124, 600, 2, 240, 819] +[:mouse_move, 115, 606, 2, 241, 820] +[:mouse_move, 103, 617, 2, 242, 821] +[:mouse_move, 96, 623, 2, 243, 822] +[:mouse_move, 85, 636, 2, 244, 823] +[:mouse_move, 80, 641, 2, 245, 824] +[:mouse_move, 78, 644, 2, 246, 825] +[:mouse_move, 71, 653, 2, 247, 826] +[:mouse_move, 67, 659, 2, 248, 827] +[:mouse_move, 64, 665, 2, 249, 828] +[:mouse_move, 63, 668, 2, 250, 829] +[:mouse_move, 61, 672, 2, 251, 830] +[:mouse_move, 60, 675, 2, 252, 831] +[:mouse_move, 59, 678, 2, 253, 832] +[:mouse_move, 59, 680, 2, 254, 833] +[:mouse_move, 58, 682, 2, 255, 834] +[:mouse_move, 58, 683, 2, 256, 835] +[:mouse_move, 57, 684, 2, 257, 836] +[:mouse_move, 57, 685, 2, 258, 837] +[:mouse_move, 57, 686, 2, 259, 838] +[:mouse_move, 56, 686, 2, 260, 839] +[:mouse_move, 55, 687, 2, 261, 840] +[:mouse_move, 54, 688, 2, 262, 841] +[:mouse_move, 50, 689, 2, 263, 842] +[:mouse_move, 48, 689, 2, 264, 843] +[:mouse_move, 43, 690, 2, 265, 844] +[:mouse_move, 41, 691, 2, 266, 845] +[:mouse_move, 36, 692, 2, 267, 846] +[:mouse_move, 34, 692, 2, 268, 847] +[:mouse_move, 31, 693, 2, 269, 848] +[:mouse_move, 30, 693, 2, 270, 849] +[:mouse_move, 28, 694, 2, 271, 850] +[:mouse_move, 27, 694, 2, 272, 853] +[:mouse_move, 26, 695, 2, 273, 855] +[:mouse_move, 25, 696, 2, 274, 858] +[:mouse_move, 25, 697, 2, 275, 859] +[:mouse_move, 25, 698, 2, 276, 861] +[:mouse_move, 24, 699, 2, 277, 863] +[:mouse_move, 24, 700, 2, 278, 865] +[:mouse_move, 24, 701, 2, 279, 867] +[:mouse_move, 24, 702, 2, 280, 869] +[:mouse_move, 23, 703, 2, 281, 872] +[:mouse_move, 23, 704, 2, 282, 875] +[:mouse_move, 22, 704, 2, 283, 878] +[:mouse_move, 23, 704, 2, 284, 925] +[:mouse_move, 24, 703, 2, 285, 928] +[:mouse_move, 27, 702, 2, 286, 929] +[:mouse_move, 33, 699, 2, 287, 930] +[:mouse_move, 62, 686, 2, 288, 931] +[:mouse_move, 101, 668, 2, 289, 932] +[:mouse_move, 186, 626, 2, 290, 933] +[:mouse_move, 242, 597, 2, 291, 934] +[:mouse_move, 344, 544, 2, 292, 935] +[:mouse_move, 451, 486, 2, 293, 936] +[:mouse_move, 518, 450, 2, 294, 937] +[:mouse_move, 602, 404, 2, 295, 938] +[:mouse_move, 647, 378, 2, 296, 939] +[:mouse_move, 716, 337, 2, 297, 940] +[:mouse_move, 744, 321, 2, 298, 941] +[:mouse_move, 776, 300, 2, 299, 942] +[:mouse_move, 783, 295, 2, 300, 943] +[:mouse_move, 808, 276, 2, 301, 944] +[:mouse_move, 817, 268, 2, 302, 945] +[:mouse_move, 836, 248, 2, 303, 946] +[:mouse_move, 840, 244, 2, 304, 947] +[:mouse_move, 853, 229, 2, 305, 948] +[:mouse_move, 859, 223, 2, 306, 949] +[:mouse_move, 868, 214, 2, 307, 950] +[:mouse_move, 872, 211, 2, 308, 951] +[:mouse_move, 878, 206, 2, 309, 952] +[:mouse_move, 880, 205, 2, 310, 953] +[:mouse_move, 882, 204, 2, 311, 954] +[:mouse_move, 883, 204, 2, 312, 956] +[:mouse_move, 882, 208, 2, 313, 958] +[:mouse_move, 880, 211, 2, 314, 959] +[:mouse_move, 875, 219, 2, 315, 960] +[:mouse_move, 872, 223, 2, 316, 961] +[:mouse_move, 865, 231, 2, 317, 962] +[:mouse_move, 850, 243, 2, 318, 963] +[:mouse_move, 843, 249, 2, 319, 964] +[:mouse_move, 830, 260, 2, 320, 965] +[:mouse_move, 822, 265, 2, 321, 966] +[:mouse_move, 811, 276, 2, 322, 967] +[:mouse_move, 807, 281, 2, 323, 968] +[:mouse_move, 799, 290, 2, 324, 969] +[:mouse_move, 796, 295, 2, 325, 970] +[:mouse_move, 792, 303, 2, 326, 971] +[:mouse_move, 790, 307, 2, 327, 972] +[:mouse_move, 788, 313, 2, 328, 973] +[:mouse_move, 787, 316, 2, 329, 974] +[:mouse_move, 786, 318, 2, 330, 975] +[:mouse_move, 786, 319, 2, 331, 976] +[:mouse_move, 786, 320, 2, 332, 978] +[:mouse_move, 785, 320, 2, 333, 989] +[:mouse_move, 785, 321, 2, 334, 990] +[:mouse_move, 784, 322, 2, 335, 991] +[:mouse_move, 783, 324, 2, 336, 992] +[:mouse_move, 782, 325, 2, 337, 993] +[:mouse_move, 781, 326, 2, 338, 994] +[:mouse_move, 781, 327, 2, 339, 995] +[:mouse_button_pressed, 1, 0, 1, 340, 998] +[:mouse_button_up, 1, 0, 1, 341, 1006] +[:mouse_move, 771, 327, 2, 342, 1023] +[:mouse_move, 761, 330, 2, 343, 1024] +[:mouse_move, 704, 344, 2, 344, 1025] +[:mouse_move, 667, 355, 2, 345, 1026] +[:mouse_move, 578, 386, 2, 346, 1027] +[:mouse_move, 532, 407, 2, 347, 1028] +[:mouse_move, 468, 440, 2, 348, 1029] +[:mouse_move, 428, 462, 2, 349, 1030] +[:mouse_move, 360, 505, 2, 350, 1031] +[:mouse_move, 330, 523, 2, 351, 1032] +[:mouse_move, 296, 548, 2, 352, 1033] +[:mouse_move, 275, 564, 2, 353, 1034] +[:mouse_move, 239, 594, 2, 354, 1035] +[:mouse_move, 223, 609, 2, 355, 1036] +[:mouse_move, 194, 634, 2, 356, 1037] +[:mouse_move, 180, 647, 2, 357, 1038] +[:mouse_move, 155, 669, 2, 358, 1039] +[:mouse_move, 143, 680, 2, 359, 1040] +[:mouse_move, 135, 686, 2, 360, 1041] +[:mouse_move, 129, 690, 2, 361, 1042] +[:mouse_move, 119, 690, 2, 362, 1056] +[:mouse_move, 113, 690, 2, 363, 1057] +[:mouse_move, 94, 690, 2, 364, 1058] +[:mouse_move, 89, 690, 2, 365, 1059] +[:mouse_move, 72, 691, 2, 366, 1060] +[:mouse_move, 65, 691, 2, 367, 1061] +[:mouse_move, 57, 691, 2, 368, 1062] +[:mouse_move, 49, 691, 2, 369, 1063] +[:mouse_move, 41, 691, 2, 370, 1064] +[:mouse_move, 38, 691, 2, 371, 1065] +[:mouse_move, 33, 692, 2, 372, 1066] +[:mouse_move, 30, 693, 2, 373, 1067] +[:mouse_move, 22, 695, 2, 374, 1068] +[:mouse_move, 20, 697, 2, 375, 1069] +[:mouse_move, 17, 699, 2, 376, 1070] +[:mouse_move, 14, 702, 2, 377, 1071] +[:mouse_move, 12, 704, 2, 378, 1072] +[:mouse_move, 10, 706, 2, 379, 1073] +[:mouse_move, 9, 707, 2, 380, 1074] +[:mouse_move, 7, 710, 2, 381, 1075] +[:mouse_move, 6, 712, 2, 382, 1076] +[:mouse_move, 5, 714, 2, 383, 1077] +[:mouse_move, 5, 716, 2, 384, 1078] +[:mouse_move, 4, 718, 2, 385, 1079] +[:mouse_move, 4, 719, 2, 386, 1080] +[:mouse_move, 4, 719, 2, 387, 1081] +[:mouse_move, 5, 719, 2, 388, 1099] +[:mouse_move, 5, 718, 2, 389, 1099] +[:mouse_move, 6, 717, 2, 390, 1100] +[:mouse_move, 7, 715, 2, 391, 1101] +[:mouse_move, 7, 714, 2, 392, 1102] +[:mouse_move, 8, 713, 2, 393, 1103] +[:mouse_move, 9, 713, 2, 394, 1106] +[:mouse_move, 8, 713, 2, 395, 1118] +[:mouse_move, 20, 706, 2, 396, 1138] +[:mouse_move, 45, 692, 2, 397, 1139] +[:mouse_move, 77, 672, 2, 398, 1140] +[:mouse_move, 213, 586, 2, 399, 1141] +[:mouse_move, 285, 539, 2, 400, 1142] +[:mouse_move, 393, 465, 2, 401, 1143] +[:mouse_move, 460, 422, 2, 402, 1144] +[:mouse_move, 535, 375, 2, 403, 1145] +[:mouse_move, 577, 352, 2, 404, 1146] +[:mouse_move, 619, 330, 2, 405, 1147] +[:mouse_move, 642, 317, 2, 406, 1148] +[:mouse_move, 665, 304, 2, 407, 1149] +[:mouse_move, 678, 297, 2, 408, 1150] +[:mouse_move, 695, 287, 2, 409, 1151] +[:mouse_move, 702, 282, 2, 410, 1152] +[:mouse_move, 708, 280, 2, 411, 1153] +[:mouse_move, 713, 277, 2, 412, 1153] +[:mouse_move, 719, 275, 2, 413, 1154] +[:mouse_move, 724, 273, 2, 414, 1155] +[:mouse_move, 730, 272, 2, 415, 1155] +[:mouse_move, 735, 270, 2, 416, 1156] +[:mouse_move, 740, 269, 2, 417, 1157] +[:mouse_move, 746, 268, 2, 418, 1157] +[:mouse_move, 752, 266, 2, 419, 1158] +[:mouse_move, 763, 264, 2, 420, 1159] +[:mouse_move, 771, 261, 2, 421, 1159] +[:mouse_move, 779, 259, 2, 422, 1160] +[:mouse_move, 791, 255, 2, 423, 1161] +[:mouse_move, 812, 245, 2, 424, 1161] +[:mouse_move, 821, 241, 2, 425, 1162] +[:mouse_move, 837, 232, 2, 426, 1163] +[:mouse_move, 863, 214, 2, 427, 1163] +[:mouse_move, 872, 209, 2, 428, 1178] +[:mouse_move, 881, 203, 2, 429, 1179] +[:mouse_move, 890, 198, 2, 430, 1180] +[:mouse_move, 901, 192, 2, 431, 1180] +[:mouse_move, 913, 187, 2, 432, 1181] +[:mouse_move, 926, 181, 2, 433, 1182] +[:mouse_move, 950, 169, 2, 434, 1182] +[:mouse_move, 975, 157, 2, 435, 1183] +[:mouse_move, 986, 151, 2, 436, 1184] +[:mouse_move, 994, 147, 2, 437, 1184] +[:mouse_move, 1009, 138, 2, 438, 1185] +[:mouse_move, 1024, 129, 2, 439, 1186] +[:mouse_move, 1035, 122, 2, 440, 1186] +[:mouse_move, 1051, 110, 2, 441, 1187] +[:mouse_move, 1061, 104, 2, 442, 1188] +[:mouse_move, 1069, 98, 2, 443, 1188] +[:mouse_move, 1073, 95, 2, 444, 1189] +[:mouse_move, 1081, 90, 2, 445, 1190] +[:mouse_move, 1086, 86, 2, 446, 1190] +[:mouse_move, 1088, 84, 2, 447, 1191] +[:mouse_move, 1097, 79, 2, 448, 1192] +[:mouse_move, 1101, 76, 2, 449, 1192] +[:mouse_move, 1105, 74, 2, 450, 1193] +[:mouse_move, 1110, 73, 2, 451, 1194] +[:mouse_move, 1112, 72, 2, 452, 1194] +[:mouse_move, 1118, 70, 2, 453, 1195] +[:mouse_move, 1119, 70, 2, 454, 1196] +[:mouse_move, 1124, 68, 2, 455, 1197] +[:mouse_move, 1127, 67, 2, 456, 1198] +[:mouse_move, 1131, 66, 2, 457, 1199] +[:mouse_move, 1132, 65, 2, 458, 1200] +[:mouse_move, 1133, 64, 2, 459, 1201] +[:mouse_move, 1134, 64, 2, 460, 1201] +[:mouse_move, 1134, 63, 2, 461, 1203] +[:mouse_move, 1132, 62, 2, 462, 1204] +[:mouse_move, 1127, 62, 2, 463, 1205] +[:mouse_move, 1124, 62, 2, 464, 1206] +[:mouse_move, 1120, 62, 2, 465, 1207] +[:mouse_move, 1116, 62, 2, 466, 1207] +[:mouse_move, 1111, 62, 2, 467, 1208] +[:mouse_move, 1109, 62, 2, 468, 1209] +[:mouse_move, 1105, 62, 2, 469, 1209] +[:mouse_move, 1103, 63, 2, 470, 1210] +[:mouse_move, 1100, 63, 2, 471, 1211] +[:mouse_move, 1097, 64, 2, 472, 1211] +[:mouse_move, 1096, 64, 2, 473, 1212] +[:mouse_move, 1095, 65, 2, 474, 1213] +[:mouse_move, 1094, 65, 2, 475, 1213] +[:mouse_move, 1093, 65, 2, 476, 1214] +[:mouse_move, 1092, 65, 2, 477, 1216] +[:mouse_move, 1092, 64, 2, 478, 1217] +[:mouse_move, 1091, 63, 2, 479, 1218] +[:mouse_move, 1089, 61, 2, 480, 1219] +[:mouse_move, 1087, 60, 2, 481, 1219] +[:mouse_move, 1085, 59, 2, 482, 1220] +[:mouse_move, 1083, 58, 2, 483, 1221] +[:mouse_move, 1081, 57, 2, 484, 1221] +[:mouse_move, 1079, 56, 2, 485, 1222] +[:mouse_move, 1078, 55, 2, 486, 1223] +[:mouse_move, 1077, 54, 2, 487, 1223] +[:mouse_move, 1076, 54, 2, 488, 1224] +[:mouse_move, 1076, 53, 2, 489, 1225] +[:mouse_move, 1076, 52, 2, 490, 1226] +[:mouse_move, 1076, 51, 2, 491, 1227] +[:mouse_move, 1077, 51, 2, 492, 1228] +[:mouse_move, 1078, 50, 2, 493, 1229] +[:mouse_move, 1079, 50, 2, 494, 1230] +[:mouse_move, 1081, 49, 2, 495, 1231] +[:mouse_move, 1084, 48, 2, 496, 1232] +[:mouse_move, 1085, 48, 2, 497, 1233] +[:mouse_move, 1087, 47, 2, 498, 1234] +[:mouse_move, 1089, 46, 2, 499, 1234] +[:mouse_move, 1092, 45, 2, 500, 1235] +[:mouse_move, 1092, 44, 2, 501, 1236] +[:mouse_move, 1095, 44, 2, 502, 1236] +[:mouse_move, 1097, 43, 2, 503, 1237] +[:mouse_move, 1099, 42, 2, 504, 1238] +[:mouse_move, 1100, 42, 2, 505, 1238] +[:mouse_move, 1102, 41, 2, 506, 1239] +[:mouse_move, 1103, 41, 2, 507, 1240] +[:mouse_move, 1105, 41, 2, 508, 1240] +[:mouse_move, 1107, 40, 2, 509, 1241] +[:mouse_move, 1110, 40, 2, 510, 1242] +[:mouse_move, 1111, 40, 2, 511, 1242] +[:mouse_move, 1113, 40, 2, 512, 1243] +[:mouse_move, 1114, 40, 2, 513, 1244] +[:mouse_move, 1117, 40, 2, 514, 1244] +[:mouse_move, 1118, 40, 2, 515, 1245] +[:mouse_move, 1119, 40, 2, 516, 1246] +[:mouse_move, 1121, 40, 2, 517, 1246] +[:mouse_move, 1122, 40, 2, 518, 1248] +[:mouse_move, 1123, 40, 2, 519, 1249] +[:mouse_move, 1123, 41, 2, 520, 1250] +[:key_down_raw, 1073742051, 1024, 2, 521, 1356] +[:key_down_raw, 113, 1024, 2, 522, 1359] diff --git a/samples/05_mouse/05_mouse_move/app/main.rb b/samples/05_mouse/05_mouse_move/app/main.rb deleted file mode 100644 index 97edbe7..0000000 --- a/samples/05_mouse/05_mouse_move/app/main.rb +++ /dev/null @@ -1,296 +0,0 @@ -=begin - - Reminders: - - - num1.greater(num2): Returns the greater value. - For example, if we have the command - puts 4.greater(3) - the number 4 would be printed to the console since it has a greater value than 3. - Similar to lesser, which returns the lesser value. - - - find_all: Finds all elements of a collection that meet certain requirements. - For example, in this sample app, we're using find_all to find all zombies that have intersected - or hit the player's sprite since these zombies have been killed. - - - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. - Stores the frame the "down" event occurred. - For more information about the keyboard, go to mygame/documentation/06-keyboard.md. - - - args.outputs.sprites: An array. The values generate a sprite. - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] - For more information about sprites, go to mygame/documentation/05-sprites.md. - - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - When we want to create a new object, we can 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.) - - - 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. - - - map: Ruby method used to transform data; used in arrays, hashes, and collections. - Can be used to perform an action on every element of a collection, such as multiplying - each element by 2 or declaring every element as a new entity. - - - sample: Chooses a random element from the array. - - - reject: Removes elements that meet certain requirements. - In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also - rejecting zombies that were killed more than 30 frames ago. - -=end - -# This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal -# is to kill the zombies as fast as possible! - -class ProtectThePuppiesFromTheZombies - attr_accessor :grid, :inputs, :state, :outputs - - # Calls the methods necessary for the game to run properly. - def tick - defaults - render - calc - input - end - - # Sets default values for the zombies and for the player. - # Initialization happens only in the first frame. - def defaults - state.flash_at ||= 0 - state.zombie_min_spawn_rate ||= 60 - state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate - state.zombies ||= [] - state.killed_zombies ||= [] - - # Declares player as a new entity and sets its properties. - # The player begins the game in the center of the screen, not moving in any direction. - state.player ||= state.new_entity(:player, { x: 640, - y: 360, - attack_angle: 0, - dx: 0, - dy: 0 }) - end - - # Outputs a gray background. - # Calls the methods needed to output the player, zombies, etc onto the screen. - def render - outputs.solids << [grid.rect, 100, 100, 100] - render_zombies - render_killed_zombies - render_player - render_flash - end - - # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. - def render_zombies - outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection - z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method - z.sprite - end - end - - # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. - def render_killed_zombies - outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection - z.sprite = [z.x, - z.y, - 4 * 3, - 8 * 3, - animation_sprite(z, z.death_at), # calls animation_sprite method - 0, # angle - 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die - # change the value of 30 and see what happens when a zombie is killed - - # Sets values to output the slash over the zombie's sprite when a zombie is killed. - # The slash is tilted 45 degrees from the angle of the player's attack. - # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions - # the slash over the killed zombie's sprite. - [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] - end - end - - # Outputs the player sprite using the images in the sprites folder. - def render_player - state.player_sprite = [state.player.x, - state.player.y, - 4 * 3, - 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation - outputs.sprites << state.player_sprite - - # Outputs a small red square that previews the angles that the player can attack in. - # It can be moved in a perfect circle around the player to show possible movements. - # Change the 60 in the parenthesis and see what happens to the movement of the red square. - outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), - state.player.y + state.player.attack_angle.vector_y(60), - 3, 3, 255, 0, 0] - end - - # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. - def render_flash - return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. - # Transparency gradually changes (or eases) during the 10 frames of flash. - outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid - end - - # Calls all methods necessary for performing calculations. - def calc - calc_spawn_zombie - calc_move_zombies - calc_player - calc_kill_zombie - end - - # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. - def calc_spawn_zombie - if state.zombie_spawn_countdown > 0 - state.zombie_spawn_countdown -= 1 - return - end - - # New zombies are created, positioned on the screen, and added to the zombies collection. - state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity - if rand > 0.5 - z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) - z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) - # the possible values exceed the screen's scope so zombies appear to be coming from far away - else - z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) - z.y = grid.rect.w.randomize(:ratio) # random y position on screen - end - end - - # Calls random_spawn_countdown method (determines how fast new zombies appear) - state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate - state.zombie_min_spawn_rate -= 1 - # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater - state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) - end - - # Moves all zombies towards the center of the screen. - # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. - def calc_move_zombies - state.zombies.each do |z| # for each zombie in the collection - z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 - z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center - end - state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center - end - - # Calculates the position and movement of the player on the screen. - def calc_player - state.player.x += state.player.dx # changes x based on dx (change in x) - state.player.y += state.player.dy # changes y based on dy (change in y) - - state.player.dx *= 0.9 # scales dx down - state.player.dy *= 0.9 # scales dy down - - # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. - # This ensures that the player remains within the screen's scope. - state.player.x = state.player.x.lesser(1280).greater(0) - state.player.y = state.player.y.lesser(720).greater(0) # same with player's y - end - - # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection - # and added to the killed_zombies collection since any zombie that intersects with the player is killed. - def calc_kill_zombie - - # Find all zombies that intersect with the player. They are considered killed. - killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } - state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection - state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies - - if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame - state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed - # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) - end - - # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. - # Death_at stores the frame a zombie was killed. - killed_this_frame.each do |z| - z.death_at = state.tick_count - end - - # Zombies are rejected from the killed_zombies collection depending on when they were killed. - # They are rejected if more than 30 frames have passed since their death. - state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } - end - - # Uses input from the user to move the player around the screen. - def input - - # If the "a" key or left key is pressed, the x position of the player decreases. - # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. - if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left - state.player.x -= 5 - elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right - state.player.x += 5 - end - - # If the "w" or up key is pressed, the y position of the player increases. - # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. - if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up - state.player.y += 5 - elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down - state.player.y -= 5 - end - - # Sets the attack angle so the player can move and attack in the precise direction it wants to go. - # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). - # Attack angle also contributes to the position of red square. - if inputs.mouse.moved - state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] - end - - if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 - state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] - state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set - state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position - state.player.dy = state.player.attack_angle.vector_y(25) - end - end - - # Sets the zombie spawn's countdown to a random number. - # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) - def random_spawn_countdown minimum - 10.randomize(:ratio, :sign).to_i + 60 - end - - # Helps to iterate through the images in the sprites folder by setting the animation index. - # 3 frames is how long to show an image, and 6 is how many images to flip through. - def animation_index at - at.idiv(3).mod(6) - end - - # Animates the zombies by using the animation index to go through the images in the sprites folder. - def animation_sprite zombie, at = nil - at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created - index = animation_index at - "sprites/zombie-#{index}.png" # string interpolation to iterate through images - end -end - -$protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new - -def tick args - $protect_the_puppies_from_the_zombies.grid = args.grid - $protect_the_puppies_from_the_zombies.inputs = args.inputs - $protect_the_puppies_from_the_zombies.state = args.state - $protect_the_puppies_from_the_zombies.outputs = args.outputs - $protect_the_puppies_from_the_zombies.tick - tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." -end - -def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -end diff --git a/samples/05_mouse/05_mouse_move/license-for-sample.txt b/samples/05_mouse/05_mouse_move/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/05_mouse/05_mouse_move/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/05_mouse/05_mouse_move/replay.txt b/samples/05_mouse/05_mouse_move/replay.txt deleted file mode 100644 index 78c183c..0000000 --- a/samples/05_mouse/05_mouse_move/replay.txt +++ /dev/null @@ -1,550 +0,0 @@ -replay_version 2.0 -stopped_at 1127 -seed 100 -recorded_at Sun Sep 29 23:57:44 2019 -[:mouse_move, 1057, 15, 2, 1, 74] -[:mouse_move, 1029, 68, 2, 2, 75] -[:mouse_move, 1014, 86, 2, 3, 76] -[:mouse_move, 1014, 105, 2, 4, 89] -[:mouse_move, 1009, 132, 2, 5, 92] -[:mouse_move, 984, 181, 2, 6, 93] -[:mouse_move, 966, 213, 2, 7, 93] -[:mouse_move, 945, 245, 2, 8, 94] -[:mouse_move, 922, 276, 2, 9, 95] -[:mouse_move, 899, 305, 2, 10, 95] -[:mouse_move, 889, 316, 2, 11, 96] -[:mouse_move, 868, 336, 2, 12, 97] -[:mouse_move, 849, 353, 2, 13, 97] -[:mouse_move, 831, 365, 2, 14, 98] -[:mouse_move, 801, 384, 2, 15, 99] -[:mouse_move, 792, 386, 2, 16, 99] -[:mouse_move, 760, 399, 2, 17, 100] -[:mouse_move, 750, 400, 2, 18, 101] -[:mouse_move, 732, 403, 2, 19, 101] -[:mouse_move, 697, 406, 2, 20, 102] -[:mouse_move, 676, 406, 2, 21, 103] -[:mouse_move, 666, 406, 2, 22, 103] -[:mouse_move, 647, 401, 2, 23, 104] -[:mouse_move, 628, 395, 2, 24, 105] -[:mouse_move, 610, 388, 2, 25, 105] -[:mouse_move, 594, 378, 2, 26, 106] -[:mouse_move, 565, 360, 2, 27, 107] -[:mouse_move, 546, 346, 2, 28, 107] -[:mouse_move, 538, 339, 2, 29, 108] -[:mouse_move, 523, 326, 2, 30, 109] -[:mouse_move, 518, 322, 2, 31, 109] -[:mouse_move, 515, 318, 2, 32, 110] -[:mouse_move, 509, 312, 2, 33, 111] -[:mouse_move, 507, 311, 2, 34, 111] -[:mouse_move, 501, 305, 2, 35, 112] -[:mouse_move, 499, 302, 2, 36, 113] -[:mouse_move, 497, 300, 2, 37, 114] -[:mouse_move, 497, 299, 2, 38, 115] -[:mouse_move, 497, 295, 2, 39, 116] -[:mouse_move, 498, 290, 2, 40, 131] -[:mouse_move, 498, 287, 2, 41, 132] -[:mouse_move, 498, 284, 2, 42, 132] -[:mouse_move, 497, 279, 2, 43, 133] -[:mouse_move, 490, 240, 2, 44, 135] -[:mouse_move, 486, 221, 2, 45, 136] -[:mouse_move, 480, 198, 2, 46, 136] -[:mouse_move, 477, 187, 2, 47, 137] -[:mouse_move, 469, 165, 2, 48, 138] -[:mouse_move, 458, 146, 2, 49, 138] -[:mouse_move, 436, 115, 2, 50, 139] -[:mouse_move, 416, 99, 2, 51, 140] -[:mouse_move, 369, 82, 2, 52, 141] -[:mouse_move, 341, 79, 2, 53, 142] -[:mouse_move, 288, 79, 2, 54, 143] -[:mouse_move, 277, 82, 2, 55, 144] -[:mouse_move, 238, 97, 2, 56, 145] -[:mouse_move, 224, 107, 2, 57, 146] -[:mouse_move, 196, 130, 2, 58, 147] -[:mouse_move, 187, 143, 2, 59, 148] -[:mouse_move, 179, 159, 2, 60, 149] -[:mouse_move, 175, 176, 2, 61, 149] -[:mouse_move, 175, 192, 2, 62, 150] -[:mouse_move, 175, 207, 2, 63, 151] -[:mouse_move, 175, 213, 2, 64, 151] -[:mouse_move, 178, 223, 2, 65, 152] -[:mouse_move, 181, 232, 2, 66, 153] -[:mouse_move, 184, 238, 2, 67, 153] -[:mouse_move, 187, 242, 2, 68, 154] -[:mouse_move, 191, 247, 2, 69, 155] -[:mouse_move, 196, 251, 2, 70, 155] -[:mouse_move, 202, 254, 2, 71, 156] -[:mouse_move, 206, 257, 2, 72, 157] -[:mouse_move, 208, 258, 2, 73, 157] -[:mouse_move, 212, 260, 2, 74, 158] -[:mouse_move, 213, 261, 2, 75, 159] -[:mouse_move, 215, 262, 2, 76, 159] -[:mouse_move, 216, 262, 2, 77, 160] -[:mouse_move, 217, 262, 2, 78, 161] -[:mouse_move, 217, 263, 2, 79, 161] -[:mouse_button_pressed, 1, 0, 1, 80, 168] -[:mouse_button_up, 1, 0, 1, 81, 175] -[:mouse_move, 218, 263, 2, 82, 193] -[:mouse_move, 219, 264, 2, 83, 194] -[:mouse_move, 221, 267, 2, 84, 195] -[:mouse_move, 222, 270, 2, 85, 196] -[:mouse_move, 222, 281, 2, 86, 197] -[:mouse_move, 222, 286, 2, 87, 198] -[:mouse_move, 212, 299, 2, 88, 199] -[:mouse_move, 207, 302, 2, 89, 200] -[:mouse_move, 184, 304, 2, 90, 201] -[:mouse_move, 171, 298, 2, 91, 202] -[:mouse_move, 154, 284, 2, 92, 203] -[:mouse_move, 130, 255, 2, 93, 204] -[:mouse_move, 116, 237, 2, 94, 205] -[:mouse_move, 104, 213, 2, 95, 206] -[:mouse_move, 98, 201, 2, 96, 207] -[:mouse_move, 90, 181, 2, 97, 208] -[:mouse_move, 87, 166, 2, 98, 209] -[:mouse_move, 83, 154, 2, 99, 210] -[:mouse_move, 81, 147, 2, 100, 211] -[:mouse_move, 79, 139, 2, 101, 212] -[:mouse_move, 78, 136, 2, 102, 213] -[:mouse_move, 76, 132, 2, 103, 214] -[:mouse_move, 76, 131, 2, 104, 215] -[:mouse_move, 75, 130, 2, 105, 216] -[:mouse_move, 74, 130, 2, 106, 218] -[:mouse_move, 73, 130, 2, 107, 219] -[:mouse_move, 71, 132, 2, 108, 220] -[:mouse_move, 69, 133, 2, 109, 221] -[:mouse_move, 66, 138, 2, 110, 222] -[:mouse_move, 65, 140, 2, 111, 223] -[:mouse_move, 63, 147, 2, 112, 224] -[:mouse_move, 62, 150, 2, 113, 225] -[:mouse_move, 62, 161, 2, 114, 226] -[:mouse_move, 62, 165, 2, 115, 227] -[:mouse_move, 62, 173, 2, 116, 228] -[:mouse_move, 62, 177, 2, 117, 229] -[:mouse_move, 62, 180, 2, 118, 230] -[:mouse_move, 62, 184, 2, 119, 231] -[:mouse_move, 62, 185, 2, 120, 232] -[:mouse_move, 62, 187, 2, 121, 233] -[:mouse_move, 62, 188, 2, 122, 234] -[:mouse_move, 62, 190, 2, 123, 235] -[:mouse_move, 61, 191, 2, 124, 236] -[:mouse_move, 60, 193, 2, 125, 237] -[:mouse_move, 60, 194, 2, 126, 238] -[:mouse_move, 59, 195, 2, 127, 239] -[:mouse_move, 59, 196, 2, 128, 240] -[:mouse_move, 59, 197, 2, 129, 243] -[:mouse_move, 59, 196, 2, 130, 252] -[:mouse_move, 59, 195, 2, 131, 257] -[:mouse_move, 59, 194, 2, 132, 258] -[:mouse_move, 59, 193, 2, 133, 260] -[:mouse_move, 58, 193, 2, 134, 267] -[:mouse_move, 57, 193, 2, 135, 272] -[:mouse_move, 56, 194, 2, 136, 274] -[:mouse_move, 55, 195, 2, 137, 276] -[:mouse_move, 54, 195, 2, 138, 278] -[:mouse_button_pressed, 1, 0, 1, 139, 281] -[:mouse_button_up, 1, 0, 1, 140, 289] -[:mouse_move, 53, 195, 2, 141, 318] -[:mouse_move, 51, 195, 2, 142, 319] -[:mouse_move, 47, 195, 2, 143, 320] -[:mouse_move, 45, 195, 2, 144, 321] -[:mouse_move, 42, 195, 2, 145, 322] -[:mouse_move, 41, 194, 2, 146, 323] -[:mouse_move, 40, 194, 2, 147, 324] -[:mouse_move, 40, 193, 2, 148, 325] -[:mouse_move, 39, 193, 2, 149, 326] -[:mouse_move, 38, 192, 2, 150, 328] -[:mouse_button_pressed, 1, 0, 1, 151, 330] -[:mouse_button_up, 1, 0, 1, 152, 338] -[:mouse_move, 38, 193, 2, 153, 347] -[:mouse_move, 39, 197, 2, 154, 348] -[:mouse_move, 47, 216, 2, 155, 349] -[:mouse_move, 61, 246, 2, 156, 350] -[:mouse_move, 93, 319, 2, 157, 351] -[:mouse_move, 116, 361, 2, 158, 352] -[:mouse_move, 145, 412, 2, 159, 353] -[:mouse_move, 164, 440, 2, 160, 354] -[:mouse_move, 192, 468, 2, 161, 355] -[:mouse_move, 209, 480, 2, 162, 356] -[:mouse_move, 227, 487, 2, 163, 357] -[:mouse_move, 243, 489, 2, 164, 358] -[:mouse_move, 269, 479, 2, 165, 359] -[:mouse_move, 282, 466, 2, 166, 360] -[:mouse_move, 295, 451, 2, 167, 361] -[:mouse_move, 309, 437, 2, 168, 362] -[:mouse_move, 315, 431, 2, 169, 363] -[:mouse_move, 320, 427, 2, 170, 364] -[:mouse_move, 327, 421, 2, 171, 365] -[:mouse_move, 328, 421, 2, 172, 366] -[:mouse_button_pressed, 1, 0, 1, 173, 367] -[:mouse_move, 329, 420, 2, 174, 367] -[:mouse_button_up, 1, 0, 1, 175, 375] -[:mouse_move, 326, 423, 2, 176, 388] -[:mouse_move, 316, 431, 2, 177, 389] -[:mouse_move, 290, 450, 2, 178, 390] -[:mouse_move, 266, 463, 2, 179, 391] -[:mouse_move, 180, 494, 2, 180, 392] -[:mouse_move, 159, 497, 2, 181, 393] -[:mouse_move, 121, 504, 2, 182, 394] -[:mouse_move, 93, 509, 2, 183, 395] -[:mouse_move, 70, 514, 2, 184, 396] -[:mouse_move, 52, 517, 2, 185, 397] -[:mouse_move, 44, 518, 2, 186, 398] -[:mouse_move, 36, 519, 2, 187, 399] -[:mouse_move, 34, 519, 2, 188, 400] -[:mouse_move, 32, 519, 2, 189, 401] -[:mouse_move, 31, 518, 2, 190, 404] -[:mouse_move, 31, 516, 2, 191, 405] -[:mouse_move, 30, 515, 2, 192, 406] -[:mouse_move, 28, 509, 2, 193, 407] -[:mouse_move, 27, 506, 2, 194, 408] -[:mouse_move, 23, 500, 2, 195, 409] -[:mouse_move, 22, 498, 2, 196, 410] -[:mouse_move, 19, 494, 2, 197, 411] -[:mouse_move, 18, 492, 2, 198, 412] -[:mouse_move, 17, 491, 2, 199, 413] -[:mouse_move, 16, 490, 2, 200, 414] -[:mouse_move, 15, 490, 2, 201, 415] -[:mouse_button_pressed, 1, 0, 1, 202, 421] -[:mouse_button_up, 1, 0, 1, 203, 431] -[:mouse_move, 16, 490, 2, 204, 443] -[:mouse_move, 17, 490, 2, 205, 444] -[:mouse_move, 20, 491, 2, 206, 445] -[:mouse_move, 22, 493, 2, 207, 446] -[:mouse_move, 24, 493, 2, 208, 447] -[:mouse_move, 25, 494, 2, 209, 448] -[:mouse_move, 26, 495, 2, 210, 449] -[:mouse_move, 27, 495, 2, 211, 450] -[:mouse_move, 27, 496, 2, 212, 453] -[:mouse_move, 28, 496, 2, 213, 455] -[:mouse_move, 30, 497, 2, 214, 465] -[:mouse_move, 32, 498, 2, 215, 466] -[:mouse_move, 43, 505, 2, 216, 467] -[:mouse_move, 50, 510, 2, 217, 468] -[:mouse_move, 74, 526, 2, 218, 469] -[:mouse_move, 87, 536, 2, 219, 470] -[:mouse_move, 100, 545, 2, 220, 471] -[:mouse_move, 126, 565, 2, 221, 472] -[:mouse_move, 150, 584, 2, 222, 473] -[:mouse_move, 160, 594, 2, 223, 474] -[:mouse_move, 165, 598, 2, 224, 475] -[:mouse_move, 185, 622, 2, 225, 476] -[:mouse_move, 187, 626, 2, 226, 477] -[:mouse_move, 192, 637, 2, 227, 478] -[:mouse_move, 194, 642, 2, 228, 479] -[:mouse_move, 196, 647, 2, 229, 480] -[:mouse_move, 197, 649, 2, 230, 481] -[:mouse_move, 197, 650, 2, 231, 482] -[:mouse_move, 198, 651, 2, 232, 483] -[:mouse_button_pressed, 1, 0, 1, 233, 484] -[:mouse_button_up, 1, 0, 1, 234, 495] -[:mouse_move, 201, 649, 2, 235, 510] -[:mouse_move, 231, 638, 2, 236, 511] -[:mouse_move, 265, 631, 2, 237, 512] -[:mouse_move, 312, 622, 2, 238, 513] -[:mouse_move, 474, 600, 2, 239, 514] -[:mouse_move, 528, 593, 2, 240, 515] -[:mouse_move, 544, 590, 2, 241, 516] -[:mouse_move, 555, 589, 2, 242, 517] -[:mouse_move, 559, 589, 2, 243, 530] -[:mouse_move, 567, 592, 2, 244, 531] -[:mouse_move, 594, 607, 2, 245, 532] -[:mouse_move, 602, 612, 2, 246, 533] -[:mouse_move, 624, 627, 2, 247, 534] -[:mouse_move, 645, 640, 2, 248, 536] -[:mouse_move, 651, 644, 2, 249, 537] -[:mouse_move, 666, 654, 2, 250, 538] -[:mouse_move, 672, 659, 2, 251, 539] -[:mouse_move, 680, 668, 2, 252, 540] -[:mouse_move, 682, 670, 2, 253, 541] -[:mouse_move, 687, 675, 2, 254, 542] -[:mouse_move, 689, 677, 2, 255, 543] -[:mouse_move, 691, 680, 2, 256, 544] -[:mouse_move, 692, 680, 2, 257, 545] -[:mouse_move, 693, 681, 2, 258, 546] -[:mouse_move, 694, 682, 2, 259, 547] -[:mouse_move, 695, 682, 2, 260, 548] -[:mouse_button_pressed, 1, 0, 1, 261, 549] -[:mouse_move, 695, 683, 2, 262, 549] -[:mouse_button_up, 1, 0, 1, 263, 560] -[:mouse_move, 696, 683, 2, 264, 565] -[:mouse_move, 698, 683, 2, 265, 566] -[:mouse_move, 705, 683, 2, 266, 567] -[:mouse_move, 716, 683, 2, 267, 568] -[:mouse_move, 726, 683, 2, 268, 569] -[:mouse_move, 734, 683, 2, 269, 570] -[:mouse_move, 748, 683, 2, 270, 571] -[:mouse_move, 761, 683, 2, 271, 573] -[:mouse_move, 765, 683, 2, 272, 574] -[:mouse_move, 771, 683, 2, 273, 575] -[:mouse_move, 774, 683, 2, 274, 577] -[:mouse_move, 777, 683, 2, 275, 578] -[:mouse_move, 779, 683, 2, 276, 579] -[:mouse_move, 780, 683, 2, 277, 582] -[:mouse_move, 781, 683, 2, 278, 586] -[:mouse_button_pressed, 1, 0, 1, 279, 590] -[:mouse_button_up, 1, 0, 1, 280, 600] -[:mouse_move, 781, 679, 2, 281, 646] -[:mouse_move, 780, 675, 2, 282, 647] -[:mouse_move, 777, 659, 2, 283, 648] -[:mouse_move, 775, 648, 2, 284, 649] -[:mouse_move, 760, 580, 2, 285, 650] -[:mouse_move, 750, 537, 2, 286, 651] -[:mouse_move, 715, 420, 2, 287, 652] -[:mouse_move, 700, 393, 2, 288, 653] -[:mouse_move, 644, 307, 2, 289, 654] -[:mouse_move, 599, 268, 2, 290, 656] -[:mouse_move, 569, 248, 2, 291, 657] -[:mouse_move, 555, 240, 2, 292, 658] -[:mouse_button_pressed, 1, 0, 1, 293, 659] -[:mouse_move, 546, 236, 2, 294, 659] -[:mouse_button_up, 1, 0, 1, 295, 670] -[:mouse_move, 540, 236, 2, 296, 675] -[:mouse_move, 535, 236, 2, 297, 676] -[:mouse_move, 524, 232, 2, 298, 677] -[:mouse_move, 506, 224, 2, 299, 678] -[:mouse_move, 495, 219, 2, 300, 679] -[:mouse_move, 483, 213, 2, 301, 680] -[:mouse_move, 457, 202, 2, 302, 681] -[:mouse_move, 433, 193, 2, 303, 682] -[:mouse_move, 427, 193, 2, 304, 683] -[:mouse_move, 424, 192, 2, 305, 684] -[:mouse_move, 418, 191, 2, 306, 685] -[:mouse_move, 412, 189, 2, 307, 686] -[:mouse_move, 406, 187, 2, 308, 687] -[:mouse_move, 401, 186, 2, 309, 688] -[:mouse_button_pressed, 1, 0, 1, 310, 689] -[:mouse_move, 400, 185, 2, 311, 689] -[:mouse_button_up, 1, 0, 1, 312, 698] -[:mouse_move, 400, 182, 2, 313, 714] -[:mouse_move, 400, 176, 2, 314, 715] -[:mouse_move, 395, 157, 2, 315, 716] -[:mouse_move, 391, 146, 2, 316, 717] -[:mouse_move, 386, 130, 2, 317, 718] -[:mouse_move, 384, 127, 2, 318, 719] -[:mouse_move, 380, 114, 2, 319, 720] -[:mouse_move, 376, 103, 2, 320, 721] -[:mouse_move, 375, 101, 2, 321, 722] -[:mouse_move, 373, 95, 2, 322, 723] -[:mouse_move, 372, 94, 2, 323, 724] -[:mouse_move, 371, 92, 2, 324, 725] -[:mouse_button_pressed, 1, 0, 1, 325, 726] -[:mouse_button_up, 1, 0, 1, 326, 735] -[:mouse_move, 371, 90, 2, 327, 747] -[:mouse_move, 371, 89, 2, 328, 748] -[:mouse_move, 371, 88, 2, 329, 749] -[:mouse_move, 371, 86, 2, 330, 750] -[:mouse_move, 370, 84, 2, 331, 752] -[:mouse_move, 370, 83, 2, 332, 753] -[:mouse_move, 368, 80, 2, 333, 754] -[:mouse_move, 367, 76, 2, 334, 755] -[:mouse_move, 365, 74, 2, 335, 756] -[:mouse_move, 363, 70, 2, 336, 757] -[:mouse_move, 358, 61, 2, 337, 758] -[:mouse_move, 356, 56, 2, 338, 759] -[:mouse_move, 352, 48, 2, 339, 760] -[:mouse_move, 351, 45, 2, 340, 761] -[:mouse_move, 348, 40, 2, 341, 762] -[:mouse_move, 347, 38, 2, 342, 763] -[:mouse_move, 346, 37, 2, 343, 764] -[:mouse_move, 345, 36, 2, 344, 765] -[:mouse_move, 344, 36, 2, 345, 766] -[:mouse_move, 343, 36, 2, 346, 768] -[:mouse_move, 342, 36, 2, 347, 770] -[:mouse_move, 341, 36, 2, 348, 772] -[:mouse_move, 340, 36, 2, 349, 774] -[:mouse_move, 339, 35, 2, 350, 777] -[:mouse_move, 338, 33, 2, 351, 778] -[:mouse_move, 338, 32, 2, 352, 779] -[:mouse_move, 337, 32, 2, 353, 780] -[:mouse_move, 337, 31, 2, 354, 781] -[:mouse_move, 336, 30, 2, 355, 783] -[:mouse_button_pressed, 1, 0, 1, 356, 784] -[:mouse_button_up, 1, 0, 1, 357, 795] -[:mouse_move, 336, 31, 2, 358, 825] -[:mouse_move, 335, 32, 2, 359, 827] -[:mouse_move, 335, 33, 2, 360, 828] -[:mouse_move, 334, 35, 2, 361, 829] -[:mouse_move, 333, 35, 2, 362, 830] -[:mouse_move, 332, 37, 2, 363, 831] -[:mouse_move, 332, 39, 2, 364, 832] -[:mouse_move, 332, 41, 2, 365, 833] -[:mouse_move, 332, 46, 2, 366, 834] -[:mouse_move, 332, 59, 2, 367, 835] -[:mouse_move, 335, 85, 2, 368, 836] -[:mouse_move, 336, 111, 2, 369, 837] -[:mouse_move, 336, 133, 2, 370, 838] -[:mouse_move, 336, 188, 2, 371, 839] -[:mouse_move, 335, 220, 2, 372, 840] -[:mouse_move, 335, 266, 2, 373, 841] -[:mouse_move, 335, 291, 2, 374, 842] -[:mouse_move, 347, 327, 2, 375, 843] -[:mouse_move, 361, 352, 2, 376, 844] -[:mouse_move, 403, 378, 2, 377, 845] -[:mouse_move, 435, 385, 2, 378, 846] -[:mouse_move, 523, 396, 2, 379, 847] -[:mouse_move, 544, 396, 2, 380, 848] -[:mouse_move, 585, 395, 2, 381, 849] -[:mouse_move, 600, 390, 2, 382, 850] -[:mouse_move, 647, 367, 2, 383, 851] -[:mouse_move, 662, 355, 2, 384, 852] -[:mouse_move, 679, 316, 2, 385, 853] -[:mouse_move, 679, 302, 2, 386, 854] -[:mouse_move, 654, 244, 2, 387, 855] -[:mouse_move, 603, 180, 2, 388, 857] -[:mouse_move, 552, 131, 2, 389, 858] -[:mouse_move, 531, 116, 2, 390, 859] -[:mouse_move, 512, 104, 2, 391, 860] -[:mouse_move, 477, 91, 2, 392, 861] -[:mouse_move, 460, 89, 2, 393, 862] -[:mouse_move, 442, 88, 2, 394, 863] -[:mouse_move, 409, 88, 2, 395, 864] -[:mouse_move, 402, 88, 2, 396, 865] -[:mouse_move, 373, 92, 2, 397, 866] -[:mouse_move, 363, 96, 2, 398, 867] -[:mouse_move, 335, 105, 2, 399, 868] -[:mouse_move, 326, 110, 2, 400, 869] -[:mouse_move, 314, 115, 2, 401, 870] -[:mouse_move, 306, 120, 2, 402, 871] -[:mouse_move, 293, 129, 2, 403, 872] -[:mouse_move, 288, 134, 2, 404, 873] -[:mouse_move, 277, 151, 2, 405, 874] -[:mouse_move, 272, 172, 2, 406, 875] -[:mouse_move, 272, 185, 2, 407, 876] -[:mouse_move, 273, 210, 2, 408, 877] -[:mouse_move, 282, 224, 2, 409, 878] -[:mouse_move, 288, 235, 2, 410, 879] -[:mouse_move, 294, 243, 2, 411, 880] -[:mouse_move, 298, 247, 2, 412, 881] -[:mouse_move, 302, 251, 2, 413, 882] -[:mouse_move, 304, 252, 2, 414, 883] -[:mouse_button_pressed, 1, 0, 1, 415, 885] -[:mouse_move, 305, 252, 2, 416, 885] -[:mouse_move, 306, 252, 2, 417, 895] -[:mouse_button_up, 1, 0, 1, 418, 896] -[:mouse_move, 314, 252, 2, 419, 896] -[:mouse_move, 337, 252, 2, 420, 896] -[:mouse_move, 364, 252, 2, 421, 897] -[:mouse_move, 402, 252, 2, 422, 898] -[:mouse_move, 494, 266, 2, 423, 899] -[:mouse_move, 597, 295, 2, 424, 900] -[:mouse_move, 629, 309, 2, 425, 901] -[:mouse_move, 753, 372, 2, 426, 902] -[:mouse_move, 788, 393, 2, 427, 903] -[:mouse_move, 800, 400, 2, 428, 904] -[:mouse_move, 827, 414, 2, 429, 905] -[:mouse_move, 840, 420, 2, 430, 906] -[:mouse_move, 846, 425, 2, 431, 907] -[:mouse_move, 851, 428, 2, 432, 908] -[:mouse_move, 854, 433, 2, 433, 909] -[:mouse_move, 854, 434, 2, 434, 910] -[:mouse_move, 849, 434, 2, 435, 912] -[:mouse_move, 846, 434, 2, 436, 913] -[:mouse_move, 834, 430, 2, 437, 914] -[:mouse_move, 827, 426, 2, 438, 915] -[:mouse_move, 798, 409, 2, 439, 916] -[:mouse_move, 779, 401, 2, 440, 917] -[:mouse_move, 726, 384, 2, 441, 918] -[:mouse_move, 659, 371, 2, 442, 919] -[:mouse_move, 599, 364, 2, 443, 920] -[:mouse_move, 538, 356, 2, 444, 922] -[:mouse_move, 525, 353, 2, 445, 923] -[:mouse_move, 454, 338, 2, 446, 924] -[:mouse_move, 416, 324, 2, 447, 925] -[:mouse_move, 407, 319, 2, 448, 926] -[:mouse_move, 391, 314, 2, 449, 927] -[:mouse_move, 379, 307, 2, 450, 928] -[:mouse_move, 373, 305, 2, 451, 929] -[:mouse_move, 367, 301, 2, 452, 930] -[:mouse_move, 366, 300, 2, 453, 931] -[:mouse_move, 366, 294, 2, 454, 932] -[:mouse_move, 370, 291, 2, 455, 933] -[:mouse_move, 396, 277, 2, 456, 934] -[:mouse_move, 405, 272, 2, 457, 935] -[:mouse_move, 426, 260, 2, 458, 936] -[:mouse_move, 447, 246, 2, 459, 937] -[:mouse_move, 457, 236, 2, 460, 938] -[:mouse_move, 466, 222, 2, 461, 939] -[:mouse_move, 474, 206, 2, 462, 940] -[:mouse_move, 476, 185, 2, 463, 941] -[:mouse_move, 476, 173, 2, 464, 942] -[:mouse_move, 466, 139, 2, 465, 943] -[:mouse_move, 461, 133, 2, 466, 944] -[:mouse_move, 440, 114, 2, 467, 945] -[:mouse_move, 428, 106, 2, 468, 946] -[:mouse_move, 400, 96, 2, 469, 947] -[:mouse_move, 385, 93, 2, 470, 948] -[:mouse_move, 355, 92, 2, 471, 949] -[:mouse_move, 324, 92, 2, 472, 950] -[:mouse_move, 309, 92, 2, 473, 951] -[:mouse_move, 302, 92, 2, 474, 952] -[:mouse_move, 271, 101, 2, 475, 953] -[:mouse_move, 260, 105, 2, 476, 954] -[:mouse_move, 245, 113, 2, 477, 955] -[:mouse_move, 224, 129, 2, 478, 956] -[:mouse_move, 218, 137, 2, 479, 957] -[:mouse_move, 203, 157, 2, 480, 958] -[:mouse_move, 195, 170, 2, 481, 959] -[:mouse_move, 187, 183, 2, 482, 960] -[:mouse_move, 174, 209, 2, 483, 961] -[:mouse_move, 169, 221, 2, 484, 962] -[:mouse_move, 161, 244, 2, 485, 963] -[:mouse_move, 158, 258, 2, 486, 964] -[:mouse_move, 156, 272, 2, 487, 965] -[:mouse_move, 160, 327, 2, 488, 966] -[:mouse_move, 163, 334, 2, 489, 967] -[:mouse_move, 177, 367, 2, 490, 968] -[:mouse_move, 195, 387, 2, 491, 970] -[:mouse_move, 231, 416, 2, 492, 971] -[:mouse_move, 251, 429, 2, 493, 972] -[:mouse_move, 272, 442, 2, 494, 973] -[:mouse_move, 301, 458, 2, 495, 974] -[:mouse_move, 319, 467, 2, 496, 975] -[:mouse_move, 352, 478, 2, 497, 976] -[:mouse_move, 381, 482, 2, 498, 977] -[:mouse_move, 405, 482, 2, 499, 978] -[:mouse_move, 420, 480, 2, 500, 979] -[:mouse_move, 453, 461, 2, 501, 980] -[:mouse_move, 479, 431, 2, 502, 981] -[:mouse_move, 492, 413, 2, 503, 982] -[:mouse_move, 510, 383, 2, 504, 983] -[:mouse_move, 521, 362, 2, 505, 984] -[:mouse_move, 528, 346, 2, 506, 985] -[:mouse_move, 538, 314, 2, 507, 986] -[:mouse_move, 540, 299, 2, 508, 987] -[:mouse_move, 541, 285, 2, 509, 988] -[:mouse_move, 541, 256, 2, 510, 989] -[:mouse_move, 538, 241, 2, 511, 990] -[:mouse_move, 526, 211, 2, 512, 991] -[:mouse_move, 516, 192, 2, 513, 993] -[:mouse_move, 507, 179, 2, 514, 994] -[:mouse_move, 492, 164, 2, 515, 995] -[:mouse_move, 484, 156, 2, 516, 996] -[:mouse_move, 466, 144, 2, 517, 997] -[:mouse_move, 455, 139, 2, 518, 998] -[:mouse_move, 430, 132, 2, 519, 999] -[:mouse_move, 405, 128, 2, 520, 1000] -[:mouse_move, 365, 127, 2, 521, 1001] -[:mouse_move, 341, 127, 2, 522, 1002] -[:mouse_move, 304, 129, 2, 523, 1003] -[:mouse_move, 283, 132, 2, 524, 1004] -[:mouse_move, 247, 141, 2, 525, 1005] -[:mouse_move, 231, 146, 2, 526, 1006] -[:mouse_move, 205, 159, 2, 527, 1007] -[:mouse_move, 194, 167, 2, 528, 1008] -[:mouse_move, 166, 197, 2, 529, 1009] -[:mouse_move, 156, 215, 2, 530, 1010] -[:mouse_move, 140, 260, 2, 531, 1011] -[:mouse_move, 135, 286, 2, 532, 1012] -[:mouse_move, 133, 325, 2, 533, 1013] -[:mouse_move, 134, 348, 2, 534, 1014] -[:mouse_move, 161, 410, 2, 535, 1015] -[:mouse_move, 239, 475, 2, 536, 1016] -[:mouse_move, 283, 495, 2, 537, 1017] -[:mouse_move, 304, 500, 2, 538, 1018] -[:mouse_move, 345, 504, 2, 539, 1019] -[:mouse_move, 409, 503, 2, 540, 1020] -[:mouse_move, 420, 495, 2, 541, 1021] -[:mouse_move, 475, 456, 2, 542, 1022] -[:mouse_move, 492, 436, 2, 543, 1023] -[:key_down_raw, 1073742051, 1024, 2, 544, 1126] -[:key_down_raw, 113, 1024, 2, 545, 1126] -[:key_up_raw, 113, 1024, 2, 546, 1126] diff --git a/samples/05_mouse/05_mouse_move/sprites/player-0.png b/samples/05_mouse/05_mouse_move/sprites/player-0.png deleted file mode 100644 index c34dbed..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-0.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/player-1.png b/samples/05_mouse/05_mouse_move/sprites/player-1.png deleted file mode 100644 index 54fce3e..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-1.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/player-2.png b/samples/05_mouse/05_mouse_move/sprites/player-2.png deleted file mode 100644 index 0007c28..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-2.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/player-3.png b/samples/05_mouse/05_mouse_move/sprites/player-3.png deleted file mode 100644 index c34dbed..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-3.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/player-4.png b/samples/05_mouse/05_mouse_move/sprites/player-4.png deleted file mode 100644 index 9897a29..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-4.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/player-5.png b/samples/05_mouse/05_mouse_move/sprites/player-5.png deleted file mode 100644 index 69d9c7b..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/player-5.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/slash.png b/samples/05_mouse/05_mouse_move/sprites/slash.png deleted file mode 100644 index 33c45e9..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/slash.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-0.png b/samples/05_mouse/05_mouse_move/sprites/zombie-0.png deleted file mode 100644 index 2fcc35d..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-0.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-1.png b/samples/05_mouse/05_mouse_move/sprites/zombie-1.png deleted file mode 100644 index 2b631ef..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-1.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-2.png b/samples/05_mouse/05_mouse_move/sprites/zombie-2.png deleted file mode 100644 index 10e0491..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-2.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-3.png b/samples/05_mouse/05_mouse_move/sprites/zombie-3.png deleted file mode 100644 index 2fcc35d..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-3.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-4.png b/samples/05_mouse/05_mouse_move/sprites/zombie-4.png deleted file mode 100644 index cbd3f79..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-4.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move/sprites/zombie-5.png b/samples/05_mouse/05_mouse_move/sprites/zombie-5.png deleted file mode 100644 index f146666..0000000 Binary files a/samples/05_mouse/05_mouse_move/sprites/zombie-5.png and /dev/null differ diff --git a/samples/05_mouse/05_mouse_move_paint_app/app/main.rb b/samples/05_mouse/05_mouse_move_paint_app/app/main.rb deleted file mode 100644 index 9303949..0000000 --- a/samples/05_mouse/05_mouse_move_paint_app/app/main.rb +++ /dev/null @@ -1,240 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. - - For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... - puts a.floor() - which would print out 13. - (There is also a ceil method, which returns an integer number greater than or equal to the original - with no decimal. If we had called ceil on the variable a, the result would have been 14.) - - Reminders: - - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. - - For example, if we have a "numbers" hash that stores numbers in English as the - key and numbers in Spanish as the value, we'd have a hash that looks like this... - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } - and on it goes. - - Now if we wanted to find the corresponding value of the "one" key, we could say - puts numbers["one"] - which would print "uno" to the console. - - - args.state.new_entity: Used when we want to create a new object, like a sprite or button. - In this sample app, new_entity is used to create a new button that clears the grid. - (Remember, you can use state to define ANY property and it will be retained across frames.) - - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - - - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. - - - args.outputs.labels: An array. The values in the array generate a label. - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. - - - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. - -=end - -# This sample app shows an empty grid that the user can paint on. -# To paint, the user must keep their mouse presssed and drag it around the grid. -# The "clear" button allows users to clear the grid so they can start over. - -class PaintApp - attr_accessor :inputs, :state, :outputs, :grid, :args - - # Runs methods necessary for the game to function properly. - def tick - print_title - add_grid - check_click - draw_buttons - end - - # Prints the title onto the screen by using a label. - # Also separates the title from the grid with a line as a horizontal separator. - def print_title - args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] - outputs.lines << horizontal_separator(660, 0, 1280) - end - - # Sets the starting position, ending position, and color for the horizontal separator. - # The starting and ending positions have the same y values. - def horizontal_separator y, x, x2 - [x, y, x2, y, 150, 150, 150] - end - - # Sets the starting position, ending position, and color for the vertical separator. - # The starting and ending positions have the same x values. - def vertical_separator x, y, y2 - [x, y, x, y2, 150, 150, 150] - end - - # Outputs a border and a grid containing empty squares onto the screen. - def add_grid - - # Sets the x, y, height, and width of the grid. - # There are 31 horizontal lines and 31 vertical lines in the grid. - # Feel free to count them yourself before continuing! - x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center - lines_h = 31 - lines_v = 31 - - # Sets values for the grid's border, grid lines, and filled squares. - # The filled_squares variable is initially set to an empty array. - state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border - state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method - state.filled_squares ||= [] # there are no filled squares until the user fills them in - - # Outputs the grid lines, border, and filled squares onto the screen. - outputs.lines.concat state.grid_lines - outputs.borders << state.grid_border - outputs.solids << state.filled_squares - end - - # Draws the grid by adding in vertical and horizontal separators. - def draw_grid x, y, h, w, lines_h, lines_v - - # The grid starts off empty. - grid = [] - - # Calculates the placement and adds horizontal lines or separators into the grid. - curr_y = y # start at the bottom of the box - dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid - lines_h.times do - curr_y += dist_y # increment curr_y by the distance between the horizontal lines - grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid - end - - # Calculates the placement and adds vertical lines or separators into the grid. - curr_x = x # now start at the left of the box - dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid - lines_v.times do - curr_x += dist_x # increment curr_x by the distance between the vertical lines - grid << vertical_separator(curr_x, y + 1, y + h) # add separator - end - - # paint_grid uses a hash to assign values to keys. - state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, - "lines_v" => lines_v, "dist_x" => dist_x, - "dist_y" => dist_y } - - return grid - end - - # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. - # If the mouse is up, the user cannot drag the mouse. - def check_click - if inputs.mouse.down #is mouse up or down? - state.mouse_held = true # mouse is being held down - elsif inputs.mouse.up # if mouse is up - state.mouse_held = false # mouse is not being held down or dragged - state.mouse_dragging = false - end - - if state.mouse_held && # mouse needs to be down - !inputs.mouse.click && # must not be first click - ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" - state.mouse_dragging = true - end - - # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. - if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) - search_lines(inputs.mouse.click.point, :click) - - # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. - elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) - search_lines(inputs.mouse.position, :drag) - end - end - - # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. - def search_lines (point, input_type) - point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash - point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash - - # Remove code following the .floor and see what happens when you try to fill in grid squares - point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] - point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] - - point.x += state.paint_grid["x"] - point.y += state.paint_grid["y"] - - # Sets definition of a grid box, meaning its x, y, width, and height. - # Floor is called on the point.x and point.y variables. - # Ceil method is called on values of the distance hash keys, setting the width and height of a box. - grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] - - if input_type == :click # if user clicks their mouse - if state.filled_squares.include? grid_box # if grid box is already filled in - state.filled_squares.delete grid_box # box is cleared and removed from filled_squares - else - state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares - end - elsif input_type == :drag # if user drags mouse - unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in - state.filled_squares << grid_box # the box is filled in and added to filled_squares - end - end - end - - # Creates and outputs a "Clear" button on the screen using a label and a border. - # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. - def draw_buttons - x, y, w, h = 390, 50, 240, 50 - state.clear_button ||= state.new_entity(:button_with_fade) - - # The x and y positions are set to display the label in the center of the button. - # Try changing the first two parameters to simply x, y and see what happens to the text placement! - state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border - state.clear_button.border ||= [x, y, w, h] - - # If the mouse is clicked inside the borders of the clear button, - # the filled_squares collection is emptied and the squares are cleared. - if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) - state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred - state.filled_squares.clear - inputs.mouse.previous_click = nil - end - - outputs.labels << state.clear_button.label - outputs.borders << state.clear_button.border - - # When the clear button is clicked, the color of the button changes - # and the transparency changes, as well. If you change the time from - # 0.25.seconds to 1.25.seconds or more, the change will last longer. - if state.clear_button.clicked_at - outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] - end - end -end - -$paint_app = PaintApp.new - -def tick args - $paint_app.inputs = args.inputs - $paint_app.state = args.state - $paint_app.grid = args.grid - $paint_app.args = args - $paint_app.outputs = args.outputs - $paint_app.tick - tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." -end - -def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -end diff --git a/samples/05_mouse/05_mouse_move_paint_app/license-for-sample.txt b/samples/05_mouse/05_mouse_move_paint_app/license-for-sample.txt deleted file mode 100644 index 5c0563d..0000000 --- a/samples/05_mouse/05_mouse_move_paint_app/license-for-sample.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 DragonRuby LLC, Ananth Vivekanand, Sahil Jain - -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/05_mouse/05_mouse_move_paint_app/replay.txt b/samples/05_mouse/05_mouse_move_paint_app/replay.txt deleted file mode 100644 index 2f4753c..0000000 --- a/samples/05_mouse/05_mouse_move_paint_app/replay.txt +++ /dev/null @@ -1,238 +0,0 @@ -replay_version 2.0 -stopped_at 629 -seed 100 -recorded_at Sun Sep 29 22:17:52 2019 -[:mouse_move, 539, 647, 2, 1, 151] -[:mouse_move, 545, 636, 2, 2, 152] -[:mouse_move, 552, 618, 2, 3, 153] -[:mouse_move, 556, 607, 2, 4, 154] -[:mouse_move, 572, 557, 2, 5, 155] -[:mouse_move, 576, 542, 2, 6, 156] -[:mouse_move, 593, 468, 2, 7, 157] -[:mouse_move, 594, 454, 2, 8, 158] -[:mouse_move, 600, 410, 2, 9, 159] -[:mouse_move, 602, 354, 2, 10, 160] -[:mouse_move, 603, 327, 2, 11, 161] -[:mouse_move, 605, 290, 2, 12, 162] -[:mouse_move, 605, 281, 2, 13, 163] -[:mouse_move, 606, 265, 2, 14, 164] -[:mouse_move, 606, 256, 2, 15, 165] -[:mouse_move, 606, 246, 2, 16, 166] -[:mouse_move, 606, 242, 2, 17, 167] -[:mouse_move, 606, 240, 2, 18, 168] -[:mouse_move, 606, 239, 2, 19, 171] -[:mouse_move, 606, 238, 2, 20, 174] -[:mouse_move, 606, 239, 2, 21, 191] -[:mouse_move, 606, 241, 2, 22, 199] -[:mouse_move, 606, 243, 2, 23, 200] -[:mouse_move, 606, 249, 2, 24, 201] -[:mouse_move, 605, 253, 2, 25, 203] -[:mouse_move, 603, 254, 2, 26, 204] -[:mouse_move, 601, 257, 2, 27, 205] -[:mouse_move, 599, 258, 2, 28, 206] -[:mouse_move, 595, 259, 2, 29, 207] -[:mouse_move, 594, 260, 2, 30, 208] -[:mouse_move, 589, 260, 2, 31, 209] -[:mouse_move, 587, 260, 2, 32, 210] -[:mouse_move, 580, 259, 2, 33, 211] -[:mouse_move, 579, 258, 2, 34, 212] -[:mouse_move, 576, 257, 2, 35, 214] -[:mouse_move, 575, 257, 2, 36, 215] -[:mouse_move, 574, 257, 2, 37, 216] -[:mouse_move, 573, 257, 2, 38, 217] -[:mouse_move, 570, 257, 2, 39, 218] -[:mouse_move, 566, 257, 2, 40, 219] -[:mouse_move, 562, 258, 2, 41, 220] -[:mouse_move, 558, 259, 2, 42, 222] -[:mouse_move, 557, 259, 2, 43, 223] -[:mouse_move, 554, 260, 2, 44, 224] -[:mouse_move, 553, 260, 2, 45, 226] -[:mouse_move, 552, 260, 2, 46, 228] -[:mouse_move, 551, 260, 2, 47, 229] -[:mouse_move, 550, 260, 2, 48, 230] -[:mouse_move, 548, 259, 2, 49, 232] -[:mouse_move, 547, 259, 2, 50, 234] -[:mouse_move, 546, 259, 2, 51, 235] -[:mouse_move, 545, 259, 2, 52, 239] -[:mouse_move, 544, 259, 2, 53, 242] -[:mouse_move, 542, 259, 2, 54, 243] -[:mouse_move, 540, 259, 2, 55, 245] -[:mouse_move, 539, 259, 2, 56, 246] -[:mouse_move, 537, 259, 2, 57, 247] -[:mouse_move, 536, 259, 2, 58, 248] -[:mouse_move, 535, 259, 2, 59, 249] -[:mouse_move, 534, 259, 2, 60, 250] -[:mouse_move, 533, 259, 2, 61, 251] -[:mouse_button_pressed, 1, 0, 1, 62, 257] -[:mouse_button_up, 1, 0, 1, 63, 265] -[:mouse_move, 535, 261, 2, 64, 278] -[:mouse_move, 544, 266, 2, 65, 279] -[:mouse_move, 550, 270, 2, 66, 280] -[:mouse_move, 559, 274, 2, 67, 281] -[:mouse_move, 581, 280, 2, 68, 282] -[:mouse_move, 606, 287, 2, 69, 283] -[:mouse_move, 635, 291, 2, 70, 284] -[:mouse_move, 654, 293, 2, 71, 285] -[:mouse_move, 677, 293, 2, 72, 286] -[:mouse_move, 691, 293, 2, 73, 287] -[:mouse_move, 721, 290, 2, 74, 288] -[:mouse_move, 734, 286, 2, 75, 290] -[:mouse_move, 740, 283, 2, 76, 291] -[:mouse_move, 746, 279, 2, 77, 292] -[:mouse_move, 748, 277, 2, 78, 293] -[:mouse_move, 752, 273, 2, 79, 294] -[:mouse_move, 753, 271, 2, 80, 295] -[:mouse_move, 754, 268, 2, 81, 296] -[:mouse_move, 755, 265, 2, 82, 297] -[:mouse_move, 756, 265, 2, 83, 298] -[:mouse_move, 756, 263, 2, 84, 299] -[:mouse_move, 757, 262, 2, 85, 300] -[:mouse_move, 757, 261, 2, 86, 302] -[:mouse_move, 756, 260, 2, 87, 311] -[:mouse_move, 755, 260, 2, 88, 312] -[:mouse_move, 752, 259, 2, 89, 313] -[:mouse_move, 751, 258, 2, 90, 314] -[:mouse_move, 748, 258, 2, 91, 315] -[:mouse_move, 747, 258, 2, 92, 316] -[:mouse_move, 746, 257, 2, 93, 317] -[:mouse_move, 745, 257, 2, 94, 318] -[:mouse_move, 743, 257, 2, 95, 330] -[:mouse_move, 742, 258, 2, 96, 331] -[:mouse_move, 738, 259, 2, 97, 332] -[:mouse_move, 736, 260, 2, 98, 334] -[:mouse_move, 735, 260, 2, 99, 335] -[:mouse_move, 734, 260, 2, 100, 336] -[:mouse_move, 733, 260, 2, 101, 338] -[:mouse_move, 732, 260, 2, 102, 340] -[:mouse_move, 731, 260, 2, 103, 341] -[:mouse_move, 730, 260, 2, 104, 343] -[:mouse_move, 729, 260, 2, 105, 347] -[:mouse_move, 727, 260, 2, 106, 349] -[:mouse_move, 723, 260, 2, 107, 351] -[:mouse_move, 721, 260, 2, 108, 353] -[:mouse_move, 720, 260, 2, 109, 354] -[:mouse_button_pressed, 1, 0, 1, 110, 363] -[:mouse_button_up, 1, 0, 1, 111, 368] -[:mouse_move, 720, 271, 2, 112, 382] -[:mouse_move, 720, 279, 2, 113, 383] -[:mouse_move, 714, 297, 2, 114, 384] -[:mouse_move, 710, 307, 2, 115, 385] -[:mouse_move, 687, 346, 2, 116, 386] -[:mouse_move, 670, 365, 2, 117, 387] -[:mouse_move, 632, 399, 2, 118, 388] -[:mouse_move, 612, 411, 2, 119, 389] -[:mouse_move, 584, 420, 2, 120, 390] -[:mouse_move, 577, 420, 2, 121, 391] -[:mouse_move, 548, 422, 2, 122, 392] -[:mouse_move, 537, 416, 2, 123, 394] -[:mouse_move, 533, 411, 2, 124, 395] -[:mouse_move, 526, 401, 2, 125, 396] -[:mouse_move, 524, 396, 2, 126, 397] -[:mouse_move, 520, 386, 2, 127, 398] -[:mouse_move, 518, 381, 2, 128, 399] -[:mouse_move, 514, 371, 2, 129, 400] -[:mouse_move, 513, 370, 2, 130, 401] -[:mouse_move, 510, 366, 2, 131, 402] -[:mouse_move, 509, 364, 2, 132, 403] -[:mouse_move, 507, 362, 2, 133, 404] -[:mouse_move, 501, 362, 2, 134, 405] -[:mouse_move, 496, 362, 2, 135, 406] -[:mouse_move, 487, 362, 2, 136, 407] -[:mouse_move, 482, 362, 2, 137, 408] -[:mouse_move, 475, 362, 2, 138, 409] -[:mouse_move, 472, 362, 2, 139, 410] -[:mouse_move, 468, 363, 2, 140, 411] -[:mouse_move, 467, 363, 2, 141, 412] -[:mouse_move, 466, 363, 2, 142, 413] -[:mouse_move, 470, 363, 2, 143, 442] -[:mouse_move, 473, 363, 2, 144, 443] -[:mouse_move, 474, 362, 2, 145, 444] -[:mouse_move, 474, 361, 2, 146, 445] -[:mouse_move, 476, 360, 2, 147, 446] -[:mouse_move, 477, 358, 2, 148, 447] -[:mouse_move, 478, 355, 2, 149, 448] -[:mouse_move, 479, 354, 2, 150, 449] -[:mouse_move, 480, 351, 2, 151, 450] -[:mouse_move, 481, 350, 2, 152, 452] -[:mouse_move, 481, 349, 2, 153, 453] -[:mouse_button_pressed, 1, 0, 1, 154, 474] -[:mouse_move, 481, 350, 2, 155, 474] -[:mouse_move, 483, 354, 2, 156, 475] -[:mouse_move, 484, 359, 2, 157, 476] -[:mouse_move, 491, 374, 2, 158, 477] -[:mouse_move, 495, 383, 2, 159, 479] -[:mouse_move, 497, 388, 2, 160, 480] -[:mouse_move, 499, 391, 2, 161, 481] -[:mouse_move, 503, 398, 2, 162, 482] -[:mouse_move, 509, 408, 2, 163, 483] -[:mouse_move, 511, 411, 2, 164, 485] -[:mouse_move, 515, 417, 2, 165, 486] -[:mouse_move, 517, 421, 2, 166, 487] -[:mouse_move, 521, 425, 2, 167, 488] -[:mouse_move, 523, 428, 2, 168, 489] -[:mouse_move, 526, 431, 2, 169, 490] -[:mouse_move, 528, 433, 2, 170, 491] -[:mouse_move, 533, 437, 2, 171, 492] -[:mouse_move, 536, 440, 2, 172, 493] -[:mouse_move, 546, 447, 2, 173, 494] -[:mouse_move, 551, 451, 2, 174, 495] -[:mouse_move, 566, 461, 2, 175, 496] -[:mouse_move, 582, 470, 2, 176, 497] -[:mouse_move, 590, 473, 2, 177, 498] -[:mouse_move, 597, 476, 2, 178, 499] -[:mouse_move, 611, 482, 2, 179, 500] -[:mouse_move, 622, 486, 2, 180, 501] -[:mouse_move, 628, 488, 2, 181, 502] -[:mouse_move, 632, 489, 2, 182, 503] -[:mouse_move, 638, 491, 2, 183, 504] -[:mouse_move, 644, 491, 2, 184, 505] -[:mouse_move, 651, 492, 2, 185, 506] -[:mouse_move, 660, 492, 2, 186, 507] -[:mouse_move, 665, 492, 2, 187, 508] -[:mouse_move, 669, 491, 2, 188, 509] -[:mouse_move, 681, 489, 2, 189, 510] -[:mouse_move, 685, 489, 2, 190, 512] -[:mouse_move, 692, 487, 2, 191, 513] -[:mouse_move, 697, 485, 2, 192, 514] -[:mouse_move, 705, 482, 2, 193, 515] -[:mouse_move, 709, 480, 2, 194, 516] -[:mouse_move, 717, 475, 2, 195, 517] -[:mouse_move, 721, 473, 2, 196, 518] -[:mouse_move, 730, 467, 2, 197, 519] -[:mouse_move, 733, 464, 2, 198, 520] -[:mouse_move, 741, 458, 2, 199, 521] -[:mouse_move, 746, 455, 2, 200, 522] -[:mouse_move, 753, 448, 2, 201, 523] -[:mouse_move, 761, 440, 2, 202, 524] -[:mouse_move, 763, 438, 2, 203, 525] -[:mouse_move, 767, 434, 2, 204, 526] -[:mouse_move, 772, 426, 2, 205, 527] -[:mouse_move, 774, 423, 2, 206, 528] -[:mouse_move, 778, 415, 2, 207, 529] -[:mouse_move, 782, 407, 2, 208, 530] -[:mouse_move, 783, 402, 2, 209, 531] -[:mouse_move, 785, 396, 2, 210, 532] -[:mouse_move, 789, 385, 2, 211, 533] -[:mouse_move, 791, 377, 2, 212, 534] -[:mouse_move, 791, 373, 2, 213, 535] -[:mouse_move, 792, 369, 2, 214, 536] -[:mouse_move, 793, 357, 2, 215, 537] -[:mouse_move, 794, 354, 2, 216, 539] -[:mouse_move, 795, 348, 2, 217, 540] -[:mouse_move, 795, 346, 2, 218, 541] -[:mouse_move, 796, 342, 2, 219, 542] -[:mouse_move, 796, 341, 2, 220, 543] -[:mouse_move, 796, 340, 2, 221, 544] -[:mouse_move, 796, 339, 2, 222, 545] -[:mouse_move, 797, 339, 2, 223, 546] -[:mouse_move, 797, 338, 2, 224, 547] -[:mouse_button_up, 1, 0, 1, 225, 564] -[:mouse_move, 807, 344, 2, 226, 564] -[:mouse_move, 834, 357, 2, 227, 566] -[:mouse_move, 858, 367, 2, 228, 567] -[:mouse_move, 870, 370, 2, 229, 568] -[:mouse_move, 912, 379, 2, 230, 569] -[:mouse_move, 929, 380, 2, 231, 570] -[:key_down_raw, 1073742051, 1024, 2, 232, 627] -[:key_down_raw, 113, 1024, 2, 233, 628] -[:key_up_raw, 113, 1024, 2, 234, 628] diff --git a/samples/05_mouse/06_coordinate_systems/app/main.rb b/samples/05_mouse/06_coordinate_systems/app/main.rb deleted file mode 100644 index fcfa090..0000000 --- a/samples/05_mouse/06_coordinate_systems/app/main.rb +++ /dev/null @@ -1,80 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. - Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for - position to know the mouse's coordinates. - For more information about the mouse, go to mygame/documentation/07-mouse.md. - - Reminders: - - - args.inputs.mouse.click: This property will be set if the mouse was clicked. - - - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. - - - 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. - - In this sample app, string interpolation is used to show the current position of the mouse - in a label. - - - args.outputs.labels: An array that generates a label. - The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information about labels, go to mygame/documentation/02-labels.md. - - - args.outputs.solids: An array that generates a solid. - The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - - - args.outputs.lines: An array that generates a line. - The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] - For more information about lines, go to mygame/documentation/04-lines.md. - -=end - -# This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the -# coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or -# four quadrants by pressing the button. - -def tick args - - # The addition and subtraction in the first two parameters of the label and solid - # ensure that the outputs don't overlap each other. Try removing them and see what happens. - pos = args.inputs.mouse.position # stores coordinates of mouse's position - args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates - args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering - - button = [0, 0, 370, 50] # sets definition of toggle button - args.outputs.borders << button # outputs button as border (not filled in) - args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button - args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants - args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants - - if args.inputs.mouse.click # if the user clicks the mouse - pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) - if pos.inside_rect? button # if the click occurred inside the button - if args.grid.name == :bottom_left # if the grid shows bottom left as origin - args.grid.origin_center! # origin will be shown in center - else - args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin - end - end - end - - tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." -end - -def tick_instructions args, text, y = 715 - return if args.state.key_event_occurred - if args.inputs.mouse.click || - args.inputs.keyboard.directional_vector || - args.inputs.keyboard.key_down.enter || - args.inputs.keyboard.key_down.escape - args.state.key_event_occurred = true - end - - args.outputs.debug << [0, y - 50, 1280, 60].solid - args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label - args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label -end diff --git a/samples/05_mouse/06_coordinate_systems/license-for-sample.txt b/samples/05_mouse/06_coordinate_systems/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/05_mouse/06_coordinate_systems/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/05_mouse/06_coordinate_systems/replay.txt b/samples/05_mouse/06_coordinate_systems/replay.txt deleted file mode 100644 index d426464..0000000 --- a/samples/05_mouse/06_coordinate_systems/replay.txt +++ /dev/null @@ -1,526 +0,0 @@ -replay_version 2.0 -stopped_at 1360 -seed 100 -recorded_at Sun Sep 29 22:19:52 2019 -[:mouse_move, 1084, 546, 2, 1, 72] -[:mouse_move, 1074, 545, 2, 2, 73] -[:mouse_move, 1022, 539, 2, 3, 74] -[:mouse_move, 984, 535, 2, 4, 75] -[:mouse_move, 885, 523, 2, 5, 76] -[:mouse_move, 862, 521, 2, 6, 77] -[:mouse_move, 755, 515, 2, 7, 78] -[:mouse_move, 712, 515, 2, 8, 79] -[:mouse_move, 660, 515, 2, 9, 80] -[:mouse_move, 629, 516, 2, 10, 81] -[:mouse_move, 579, 524, 2, 11, 82] -[:mouse_move, 558, 530, 2, 12, 83] -[:mouse_move, 518, 543, 2, 13, 84] -[:mouse_move, 500, 550, 2, 14, 85] -[:mouse_move, 467, 562, 2, 15, 86] -[:mouse_move, 454, 567, 2, 16, 87] -[:mouse_move, 439, 573, 2, 17, 88] -[:mouse_move, 431, 577, 2, 18, 89] -[:mouse_move, 412, 586, 2, 19, 90] -[:mouse_move, 404, 589, 2, 20, 91] -[:mouse_move, 384, 597, 2, 21, 92] -[:mouse_move, 371, 601, 2, 22, 93] -[:mouse_move, 358, 605, 2, 23, 94] -[:mouse_move, 341, 611, 2, 24, 95] -[:mouse_move, 330, 615, 2, 25, 96] -[:mouse_move, 311, 622, 2, 26, 97] -[:mouse_move, 302, 625, 2, 27, 98] -[:mouse_move, 280, 635, 2, 28, 99] -[:mouse_move, 274, 637, 2, 29, 100] -[:mouse_move, 261, 642, 2, 30, 101] -[:mouse_move, 256, 642, 2, 31, 119] -[:mouse_move, 255, 641, 2, 32, 120] -[:mouse_move, 252, 641, 2, 33, 121] -[:mouse_move, 248, 640, 2, 34, 122] -[:mouse_move, 243, 639, 2, 35, 123] -[:mouse_move, 240, 637, 2, 36, 124] -[:mouse_move, 238, 636, 2, 37, 125] -[:mouse_move, 235, 634, 2, 38, 126] -[:mouse_move, 234, 633, 2, 39, 127] -[:mouse_move, 230, 631, 2, 40, 128] -[:mouse_move, 230, 630, 2, 41, 129] -[:mouse_move, 225, 628, 2, 42, 130] -[:mouse_move, 223, 628, 2, 43, 131] -[:mouse_move, 216, 626, 2, 44, 132] -[:mouse_move, 212, 626, 2, 45, 133] -[:mouse_move, 203, 626, 2, 46, 134] -[:mouse_move, 198, 626, 2, 47, 135] -[:mouse_move, 188, 626, 2, 48, 136] -[:mouse_move, 183, 626, 2, 49, 137] -[:mouse_move, 173, 626, 2, 50, 138] -[:mouse_move, 171, 626, 2, 51, 139] -[:mouse_move, 165, 625, 2, 52, 140] -[:mouse_move, 163, 625, 2, 53, 141] -[:mouse_move, 161, 624, 2, 54, 142] -[:mouse_move, 160, 624, 2, 55, 143] -[:mouse_move, 160, 623, 2, 56, 144] -[:mouse_move, 158, 622, 2, 57, 147] -[:mouse_move, 157, 621, 2, 58, 148] -[:mouse_move, 149, 618, 2, 59, 149] -[:mouse_move, 145, 616, 2, 60, 150] -[:mouse_move, 135, 613, 2, 61, 151] -[:mouse_move, 132, 612, 2, 62, 152] -[:mouse_move, 125, 610, 2, 63, 153] -[:mouse_move, 122, 609, 2, 64, 154] -[:mouse_move, 114, 608, 2, 65, 155] -[:mouse_move, 111, 608, 2, 66, 156] -[:mouse_move, 107, 608, 2, 67, 157] -[:mouse_move, 104, 608, 2, 68, 158] -[:mouse_move, 99, 608, 2, 69, 159] -[:mouse_move, 95, 608, 2, 70, 160] -[:mouse_move, 89, 607, 2, 71, 161] -[:mouse_move, 85, 607, 2, 72, 162] -[:mouse_move, 75, 605, 2, 73, 163] -[:mouse_move, 70, 604, 2, 74, 164] -[:mouse_move, 60, 602, 2, 75, 165] -[:mouse_move, 55, 601, 2, 76, 166] -[:mouse_move, 48, 599, 2, 77, 167] -[:mouse_move, 44, 598, 2, 78, 168] -[:mouse_move, 35, 595, 2, 79, 169] -[:mouse_move, 35, 598, 2, 80, 190] -[:mouse_move, 35, 601, 2, 81, 191] -[:mouse_move, 34, 608, 2, 82, 192] -[:mouse_move, 33, 613, 2, 83, 193] -[:mouse_move, 32, 625, 2, 84, 194] -[:mouse_move, 31, 630, 2, 85, 195] -[:mouse_move, 29, 636, 2, 86, 196] -[:mouse_move, 29, 640, 2, 87, 197] -[:mouse_move, 27, 645, 2, 88, 198] -[:mouse_move, 26, 647, 2, 89, 199] -[:mouse_move, 25, 650, 2, 90, 200] -[:mouse_move, 24, 657, 2, 91, 201] -[:mouse_move, 24, 661, 2, 92, 202] -[:mouse_move, 23, 672, 2, 93, 203] -[:mouse_move, 23, 678, 2, 94, 204] -[:mouse_move, 23, 684, 2, 95, 205] -[:mouse_move, 23, 689, 2, 96, 219] -[:mouse_move, 22, 692, 2, 97, 220] -[:mouse_move, 22, 697, 2, 98, 221] -[:mouse_move, 22, 699, 2, 99, 222] -[:mouse_move, 20, 705, 2, 100, 223] -[:mouse_move, 20, 707, 2, 101, 224] -[:mouse_move, 19, 709, 2, 102, 225] -[:mouse_move, 19, 710, 2, 103, 226] -[:mouse_move, 18, 711, 2, 104, 228] -[:mouse_move, 17, 712, 2, 105, 229] -[:mouse_move, 16, 712, 2, 106, 230] -[:mouse_move, 15, 712, 2, 107, 231] -[:mouse_move, 14, 713, 2, 108, 232] -[:mouse_move, 13, 714, 2, 109, 233] -[:mouse_move, 12, 714, 2, 110, 234] -[:mouse_move, 10, 715, 2, 111, 236] -[:mouse_move, 8, 715, 2, 112, 238] -[:mouse_move, 6, 715, 2, 113, 240] -[:mouse_move, 5, 715, 2, 114, 241] -[:mouse_move, 4, 714, 2, 115, 242] -[:mouse_move, 3, 713, 2, 116, 243] -[:mouse_move, 3, 712, 2, 117, 244] -[:mouse_move, 2, 712, 2, 118, 245] -[:mouse_move, 2, 711, 2, 119, 246] -[:mouse_move, 2, 710, 2, 120, 249] -[:mouse_move, 2, 709, 2, 121, 261] -[:mouse_move, 3, 709, 2, 122, 262] -[:mouse_move, 3, 710, 2, 123, 275] -[:mouse_move, 4, 710, 2, 124, 292] -[:mouse_move, 5, 710, 2, 125, 296] -[:mouse_move, 6, 710, 2, 126, 302] -[:mouse_move, 5, 710, 2, 127, 336] -[:mouse_move, 5, 711, 2, 128, 339] -[:mouse_move, 4, 711, 2, 129, 342] -[:mouse_move, 3, 711, 2, 130, 347] -[:mouse_move, 3, 712, 2, 131, 350] -[:mouse_move, 3, 713, 2, 132, 355] -[:mouse_move, 3, 714, 2, 133, 359] -[:mouse_move, 9, 713, 2, 134, 394] -[:mouse_move, 19, 712, 2, 135, 395] -[:mouse_move, 24, 711, 2, 136, 396] -[:mouse_move, 30, 711, 2, 137, 397] -[:mouse_move, 41, 710, 2, 138, 398] -[:mouse_move, 46, 710, 2, 139, 399] -[:mouse_move, 55, 710, 2, 140, 400] -[:mouse_move, 57, 710, 2, 141, 401] -[:mouse_move, 63, 709, 2, 142, 402] -[:mouse_move, 66, 709, 2, 143, 403] -[:mouse_move, 69, 709, 2, 144, 404] -[:mouse_move, 70, 708, 2, 145, 405] -[:mouse_move, 71, 708, 2, 146, 406] -[:mouse_move, 72, 708, 2, 147, 408] -[:mouse_move, 73, 707, 2, 148, 410] -[:mouse_move, 74, 707, 2, 149, 413] -[:mouse_move, 75, 707, 2, 150, 414] -[:mouse_move, 75, 706, 2, 151, 415] -[:mouse_move, 76, 706, 2, 152, 416] -[:mouse_move, 77, 706, 2, 153, 417] -[:mouse_move, 78, 705, 2, 154, 420] -[:mouse_button_pressed, 1, 0, 1, 155, 433] -[:mouse_button_up, 1, 0, 1, 156, 439] -[:mouse_move, 86, 704, 2, 157, 464] -[:mouse_move, 95, 702, 2, 158, 465] -[:mouse_move, 117, 697, 2, 159, 466] -[:mouse_move, 144, 690, 2, 160, 467] -[:mouse_move, 210, 668, 2, 161, 468] -[:mouse_move, 246, 654, 2, 162, 469] -[:mouse_move, 319, 621, 2, 163, 470] -[:mouse_move, 352, 605, 2, 164, 471] -[:mouse_move, 384, 590, 2, 165, 472] -[:mouse_move, 423, 571, 2, 166, 473] -[:mouse_move, 442, 562, 2, 167, 474] -[:mouse_move, 473, 544, 2, 168, 475] -[:mouse_move, 484, 535, 2, 169, 476] -[:mouse_move, 497, 523, 2, 170, 477] -[:mouse_move, 505, 516, 2, 171, 478] -[:mouse_move, 514, 505, 2, 172, 479] -[:mouse_move, 520, 500, 2, 173, 480] -[:mouse_move, 528, 490, 2, 174, 481] -[:mouse_move, 531, 486, 2, 175, 482] -[:mouse_move, 538, 479, 2, 176, 483] -[:mouse_move, 541, 475, 2, 177, 484] -[:mouse_move, 551, 461, 2, 178, 485] -[:mouse_move, 555, 453, 2, 179, 486] -[:mouse_move, 567, 432, 2, 180, 487] -[:mouse_move, 575, 421, 2, 181, 488] -[:mouse_move, 594, 392, 2, 182, 489] -[:mouse_move, 603, 380, 2, 183, 490] -[:mouse_move, 616, 363, 2, 184, 491] -[:mouse_move, 619, 360, 2, 185, 492] -[:mouse_move, 627, 351, 2, 186, 493] -[:mouse_move, 629, 349, 2, 187, 494] -[:mouse_move, 631, 349, 2, 188, 507] -[:mouse_move, 632, 350, 2, 189, 508] -[:mouse_move, 633, 350, 2, 190, 509] -[:mouse_move, 633, 351, 2, 191, 510] -[:mouse_move, 634, 351, 2, 192, 511] -[:mouse_move, 634, 352, 2, 193, 513] -[:mouse_move, 635, 353, 2, 194, 514] -[:mouse_move, 636, 354, 2, 195, 515] -[:mouse_move, 636, 356, 2, 196, 516] -[:mouse_move, 637, 356, 2, 197, 517] -[:mouse_move, 637, 357, 2, 198, 518] -[:mouse_move, 638, 357, 2, 199, 520] -[:mouse_move, 638, 358, 2, 200, 521] -[:mouse_move, 639, 358, 2, 201, 523] -[:mouse_move, 639, 359, 2, 202, 531] -[:mouse_move, 640, 359, 2, 203, 537] -[:mouse_move, 640, 360, 2, 204, 545] -[:mouse_move, 641, 360, 2, 205, 547] -[:mouse_move, 641, 361, 2, 206, 550] -[:mouse_move, 641, 360, 2, 207, 573] -[:mouse_move, 640, 360, 2, 208, 617] -[:mouse_move, 639, 360, 2, 209, 623] -[:mouse_move, 638, 360, 2, 210, 626] -[:mouse_move, 639, 360, 2, 211, 648] -[:mouse_move, 640, 360, 2, 212, 664] -[:mouse_move, 639, 360, 2, 213, 792] -[:mouse_move, 636, 361, 2, 214, 793] -[:mouse_move, 617, 369, 2, 215, 794] -[:mouse_move, 599, 375, 2, 216, 795] -[:mouse_move, 524, 405, 2, 217, 796] -[:mouse_move, 486, 421, 2, 218, 797] -[:mouse_move, 467, 431, 2, 219, 798] -[:mouse_move, 394, 468, 2, 220, 799] -[:mouse_move, 361, 484, 2, 221, 800] -[:mouse_move, 324, 502, 2, 222, 801] -[:mouse_move, 304, 512, 2, 223, 802] -[:mouse_move, 285, 522, 2, 224, 803] -[:mouse_move, 273, 528, 2, 225, 804] -[:mouse_move, 257, 536, 2, 226, 805] -[:mouse_move, 251, 538, 2, 227, 806] -[:mouse_move, 240, 543, 2, 228, 807] -[:mouse_move, 236, 545, 2, 229, 808] -[:mouse_move, 227, 549, 2, 230, 809] -[:mouse_move, 223, 551, 2, 231, 810] -[:mouse_move, 212, 557, 2, 232, 811] -[:mouse_move, 205, 560, 2, 233, 812] -[:mouse_move, 193, 565, 2, 234, 813] -[:mouse_move, 187, 568, 2, 235, 814] -[:mouse_move, 173, 574, 2, 236, 815] -[:mouse_move, 165, 577, 2, 237, 816] -[:mouse_move, 151, 583, 2, 238, 817] -[:mouse_move, 139, 590, 2, 239, 818] -[:mouse_move, 124, 600, 2, 240, 819] -[:mouse_move, 115, 606, 2, 241, 820] -[:mouse_move, 103, 617, 2, 242, 821] -[:mouse_move, 96, 623, 2, 243, 822] -[:mouse_move, 85, 636, 2, 244, 823] -[:mouse_move, 80, 641, 2, 245, 824] -[:mouse_move, 78, 644, 2, 246, 825] -[:mouse_move, 71, 653, 2, 247, 826] -[:mouse_move, 67, 659, 2, 248, 827] -[:mouse_move, 64, 665, 2, 249, 828] -[:mouse_move, 63, 668, 2, 250, 829] -[:mouse_move, 61, 672, 2, 251, 830] -[:mouse_move, 60, 675, 2, 252, 831] -[:mouse_move, 59, 678, 2, 253, 832] -[:mouse_move, 59, 680, 2, 254, 833] -[:mouse_move, 58, 682, 2, 255, 834] -[:mouse_move, 58, 683, 2, 256, 835] -[:mouse_move, 57, 684, 2, 257, 836] -[:mouse_move, 57, 685, 2, 258, 837] -[:mouse_move, 57, 686, 2, 259, 838] -[:mouse_move, 56, 686, 2, 260, 839] -[:mouse_move, 55, 687, 2, 261, 840] -[:mouse_move, 54, 688, 2, 262, 841] -[:mouse_move, 50, 689, 2, 263, 842] -[:mouse_move, 48, 689, 2, 264, 843] -[:mouse_move, 43, 690, 2, 265, 844] -[:mouse_move, 41, 691, 2, 266, 845] -[:mouse_move, 36, 692, 2, 267, 846] -[:mouse_move, 34, 692, 2, 268, 847] -[:mouse_move, 31, 693, 2, 269, 848] -[:mouse_move, 30, 693, 2, 270, 849] -[:mouse_move, 28, 694, 2, 271, 850] -[:mouse_move, 27, 694, 2, 272, 853] -[:mouse_move, 26, 695, 2, 273, 855] -[:mouse_move, 25, 696, 2, 274, 858] -[:mouse_move, 25, 697, 2, 275, 859] -[:mouse_move, 25, 698, 2, 276, 861] -[:mouse_move, 24, 699, 2, 277, 863] -[:mouse_move, 24, 700, 2, 278, 865] -[:mouse_move, 24, 701, 2, 279, 867] -[:mouse_move, 24, 702, 2, 280, 869] -[:mouse_move, 23, 703, 2, 281, 872] -[:mouse_move, 23, 704, 2, 282, 875] -[:mouse_move, 22, 704, 2, 283, 878] -[:mouse_move, 23, 704, 2, 284, 925] -[:mouse_move, 24, 703, 2, 285, 928] -[:mouse_move, 27, 702, 2, 286, 929] -[:mouse_move, 33, 699, 2, 287, 930] -[:mouse_move, 62, 686, 2, 288, 931] -[:mouse_move, 101, 668, 2, 289, 932] -[:mouse_move, 186, 626, 2, 290, 933] -[:mouse_move, 242, 597, 2, 291, 934] -[:mouse_move, 344, 544, 2, 292, 935] -[:mouse_move, 451, 486, 2, 293, 936] -[:mouse_move, 518, 450, 2, 294, 937] -[:mouse_move, 602, 404, 2, 295, 938] -[:mouse_move, 647, 378, 2, 296, 939] -[:mouse_move, 716, 337, 2, 297, 940] -[:mouse_move, 744, 321, 2, 298, 941] -[:mouse_move, 776, 300, 2, 299, 942] -[:mouse_move, 783, 295, 2, 300, 943] -[:mouse_move, 808, 276, 2, 301, 944] -[:mouse_move, 817, 268, 2, 302, 945] -[:mouse_move, 836, 248, 2, 303, 946] -[:mouse_move, 840, 244, 2, 304, 947] -[:mouse_move, 853, 229, 2, 305, 948] -[:mouse_move, 859, 223, 2, 306, 949] -[:mouse_move, 868, 214, 2, 307, 950] -[:mouse_move, 872, 211, 2, 308, 951] -[:mouse_move, 878, 206, 2, 309, 952] -[:mouse_move, 880, 205, 2, 310, 953] -[:mouse_move, 882, 204, 2, 311, 954] -[:mouse_move, 883, 204, 2, 312, 956] -[:mouse_move, 882, 208, 2, 313, 958] -[:mouse_move, 880, 211, 2, 314, 959] -[:mouse_move, 875, 219, 2, 315, 960] -[:mouse_move, 872, 223, 2, 316, 961] -[:mouse_move, 865, 231, 2, 317, 962] -[:mouse_move, 850, 243, 2, 318, 963] -[:mouse_move, 843, 249, 2, 319, 964] -[:mouse_move, 830, 260, 2, 320, 965] -[:mouse_move, 822, 265, 2, 321, 966] -[:mouse_move, 811, 276, 2, 322, 967] -[:mouse_move, 807, 281, 2, 323, 968] -[:mouse_move, 799, 290, 2, 324, 969] -[:mouse_move, 796, 295, 2, 325, 970] -[:mouse_move, 792, 303, 2, 326, 971] -[:mouse_move, 790, 307, 2, 327, 972] -[:mouse_move, 788, 313, 2, 328, 973] -[:mouse_move, 787, 316, 2, 329, 974] -[:mouse_move, 786, 318, 2, 330, 975] -[:mouse_move, 786, 319, 2, 331, 976] -[:mouse_move, 786, 320, 2, 332, 978] -[:mouse_move, 785, 320, 2, 333, 989] -[:mouse_move, 785, 321, 2, 334, 990] -[:mouse_move, 784, 322, 2, 335, 991] -[:mouse_move, 783, 324, 2, 336, 992] -[:mouse_move, 782, 325, 2, 337, 993] -[:mouse_move, 781, 326, 2, 338, 994] -[:mouse_move, 781, 327, 2, 339, 995] -[:mouse_button_pressed, 1, 0, 1, 340, 998] -[:mouse_button_up, 1, 0, 1, 341, 1006] -[:mouse_move, 771, 327, 2, 342, 1023] -[:mouse_move, 761, 330, 2, 343, 1024] -[:mouse_move, 704, 344, 2, 344, 1025] -[:mouse_move, 667, 355, 2, 345, 1026] -[:mouse_move, 578, 386, 2, 346, 1027] -[:mouse_move, 532, 407, 2, 347, 1028] -[:mouse_move, 468, 440, 2, 348, 1029] -[:mouse_move, 428, 462, 2, 349, 1030] -[:mouse_move, 360, 505, 2, 350, 1031] -[:mouse_move, 330, 523, 2, 351, 1032] -[:mouse_move, 296, 548, 2, 352, 1033] -[:mouse_move, 275, 564, 2, 353, 1034] -[:mouse_move, 239, 594, 2, 354, 1035] -[:mouse_move, 223, 609, 2, 355, 1036] -[:mouse_move, 194, 634, 2, 356, 1037] -[:mouse_move, 180, 647, 2, 357, 1038] -[:mouse_move, 155, 669, 2, 358, 1039] -[:mouse_move, 143, 680, 2, 359, 1040] -[:mouse_move, 135, 686, 2, 360, 1041] -[:mouse_move, 129, 690, 2, 361, 1042] -[:mouse_move, 119, 690, 2, 362, 1056] -[:mouse_move, 113, 690, 2, 363, 1057] -[:mouse_move, 94, 690, 2, 364, 1058] -[:mouse_move, 89, 690, 2, 365, 1059] -[:mouse_move, 72, 691, 2, 366, 1060] -[:mouse_move, 65, 691, 2, 367, 1061] -[:mouse_move, 57, 691, 2, 368, 1062] -[:mouse_move, 49, 691, 2, 369, 1063] -[:mouse_move, 41, 691, 2, 370, 1064] -[:mouse_move, 38, 691, 2, 371, 1065] -[:mouse_move, 33, 692, 2, 372, 1066] -[:mouse_move, 30, 693, 2, 373, 1067] -[:mouse_move, 22, 695, 2, 374, 1068] -[:mouse_move, 20, 697, 2, 375, 1069] -[:mouse_move, 17, 699, 2, 376, 1070] -[:mouse_move, 14, 702, 2, 377, 1071] -[:mouse_move, 12, 704, 2, 378, 1072] -[:mouse_move, 10, 706, 2, 379, 1073] -[:mouse_move, 9, 707, 2, 380, 1074] -[:mouse_move, 7, 710, 2, 381, 1075] -[:mouse_move, 6, 712, 2, 382, 1076] -[:mouse_move, 5, 714, 2, 383, 1077] -[:mouse_move, 5, 716, 2, 384, 1078] -[:mouse_move, 4, 718, 2, 385, 1079] -[:mouse_move, 4, 719, 2, 386, 1080] -[:mouse_move, 4, 719, 2, 387, 1081] -[:mouse_move, 5, 719, 2, 388, 1099] -[:mouse_move, 5, 718, 2, 389, 1099] -[:mouse_move, 6, 717, 2, 390, 1100] -[:mouse_move, 7, 715, 2, 391, 1101] -[:mouse_move, 7, 714, 2, 392, 1102] -[:mouse_move, 8, 713, 2, 393, 1103] -[:mouse_move, 9, 713, 2, 394, 1106] -[:mouse_move, 8, 713, 2, 395, 1118] -[:mouse_move, 20, 706, 2, 396, 1138] -[:mouse_move, 45, 692, 2, 397, 1139] -[:mouse_move, 77, 672, 2, 398, 1140] -[:mouse_move, 213, 586, 2, 399, 1141] -[:mouse_move, 285, 539, 2, 400, 1142] -[:mouse_move, 393, 465, 2, 401, 1143] -[:mouse_move, 460, 422, 2, 402, 1144] -[:mouse_move, 535, 375, 2, 403, 1145] -[:mouse_move, 577, 352, 2, 404, 1146] -[:mouse_move, 619, 330, 2, 405, 1147] -[:mouse_move, 642, 317, 2, 406, 1148] -[:mouse_move, 665, 304, 2, 407, 1149] -[:mouse_move, 678, 297, 2, 408, 1150] -[:mouse_move, 695, 287, 2, 409, 1151] -[:mouse_move, 702, 282, 2, 410, 1152] -[:mouse_move, 708, 280, 2, 411, 1153] -[:mouse_move, 713, 277, 2, 412, 1153] -[:mouse_move, 719, 275, 2, 413, 1154] -[:mouse_move, 724, 273, 2, 414, 1155] -[:mouse_move, 730, 272, 2, 415, 1155] -[:mouse_move, 735, 270, 2, 416, 1156] -[:mouse_move, 740, 269, 2, 417, 1157] -[:mouse_move, 746, 268, 2, 418, 1157] -[:mouse_move, 752, 266, 2, 419, 1158] -[:mouse_move, 763, 264, 2, 420, 1159] -[:mouse_move, 771, 261, 2, 421, 1159] -[:mouse_move, 779, 259, 2, 422, 1160] -[:mouse_move, 791, 255, 2, 423, 1161] -[:mouse_move, 812, 245, 2, 424, 1161] -[:mouse_move, 821, 241, 2, 425, 1162] -[:mouse_move, 837, 232, 2, 426, 1163] -[:mouse_move, 863, 214, 2, 427, 1163] -[:mouse_move, 872, 209, 2, 428, 1178] -[:mouse_move, 881, 203, 2, 429, 1179] -[:mouse_move, 890, 198, 2, 430, 1180] -[:mouse_move, 901, 192, 2, 431, 1180] -[:mouse_move, 913, 187, 2, 432, 1181] -[:mouse_move, 926, 181, 2, 433, 1182] -[:mouse_move, 950, 169, 2, 434, 1182] -[:mouse_move, 975, 157, 2, 435, 1183] -[:mouse_move, 986, 151, 2, 436, 1184] -[:mouse_move, 994, 147, 2, 437, 1184] -[:mouse_move, 1009, 138, 2, 438, 1185] -[:mouse_move, 1024, 129, 2, 439, 1186] -[:mouse_move, 1035, 122, 2, 440, 1186] -[:mouse_move, 1051, 110, 2, 441, 1187] -[:mouse_move, 1061, 104, 2, 442, 1188] -[:mouse_move, 1069, 98, 2, 443, 1188] -[:mouse_move, 1073, 95, 2, 444, 1189] -[:mouse_move, 1081, 90, 2, 445, 1190] -[:mouse_move, 1086, 86, 2, 446, 1190] -[:mouse_move, 1088, 84, 2, 447, 1191] -[:mouse_move, 1097, 79, 2, 448, 1192] -[:mouse_move, 1101, 76, 2, 449, 1192] -[:mouse_move, 1105, 74, 2, 450, 1193] -[:mouse_move, 1110, 73, 2, 451, 1194] -[:mouse_move, 1112, 72, 2, 452, 1194] -[:mouse_move, 1118, 70, 2, 453, 1195] -[:mouse_move, 1119, 70, 2, 454, 1196] -[:mouse_move, 1124, 68, 2, 455, 1197] -[:mouse_move, 1127, 67, 2, 456, 1198] -[:mouse_move, 1131, 66, 2, 457, 1199] -[:mouse_move, 1132, 65, 2, 458, 1200] -[:mouse_move, 1133, 64, 2, 459, 1201] -[:mouse_move, 1134, 64, 2, 460, 1201] -[:mouse_move, 1134, 63, 2, 461, 1203] -[:mouse_move, 1132, 62, 2, 462, 1204] -[:mouse_move, 1127, 62, 2, 463, 1205] -[:mouse_move, 1124, 62, 2, 464, 1206] -[:mouse_move, 1120, 62, 2, 465, 1207] -[:mouse_move, 1116, 62, 2, 466, 1207] -[:mouse_move, 1111, 62, 2, 467, 1208] -[:mouse_move, 1109, 62, 2, 468, 1209] -[:mouse_move, 1105, 62, 2, 469, 1209] -[:mouse_move, 1103, 63, 2, 470, 1210] -[:mouse_move, 1100, 63, 2, 471, 1211] -[:mouse_move, 1097, 64, 2, 472, 1211] -[:mouse_move, 1096, 64, 2, 473, 1212] -[:mouse_move, 1095, 65, 2, 474, 1213] -[:mouse_move, 1094, 65, 2, 475, 1213] -[:mouse_move, 1093, 65, 2, 476, 1214] -[:mouse_move, 1092, 65, 2, 477, 1216] -[:mouse_move, 1092, 64, 2, 478, 1217] -[:mouse_move, 1091, 63, 2, 479, 1218] -[:mouse_move, 1089, 61, 2, 480, 1219] -[:mouse_move, 1087, 60, 2, 481, 1219] -[:mouse_move, 1085, 59, 2, 482, 1220] -[:mouse_move, 1083, 58, 2, 483, 1221] -[:mouse_move, 1081, 57, 2, 484, 1221] -[:mouse_move, 1079, 56, 2, 485, 1222] -[:mouse_move, 1078, 55, 2, 486, 1223] -[:mouse_move, 1077, 54, 2, 487, 1223] -[:mouse_move, 1076, 54, 2, 488, 1224] -[:mouse_move, 1076, 53, 2, 489, 1225] -[:mouse_move, 1076, 52, 2, 490, 1226] -[:mouse_move, 1076, 51, 2, 491, 1227] -[:mouse_move, 1077, 51, 2, 492, 1228] -[:mouse_move, 1078, 50, 2, 493, 1229] -[:mouse_move, 1079, 50, 2, 494, 1230] -[:mouse_move, 1081, 49, 2, 495, 1231] -[:mouse_move, 1084, 48, 2, 496, 1232] -[:mouse_move, 1085, 48, 2, 497, 1233] -[:mouse_move, 1087, 47, 2, 498, 1234] -[:mouse_move, 1089, 46, 2, 499, 1234] -[:mouse_move, 1092, 45, 2, 500, 1235] -[:mouse_move, 1092, 44, 2, 501, 1236] -[:mouse_move, 1095, 44, 2, 502, 1236] -[:mouse_move, 1097, 43, 2, 503, 1237] -[:mouse_move, 1099, 42, 2, 504, 1238] -[:mouse_move, 1100, 42, 2, 505, 1238] -[:mouse_move, 1102, 41, 2, 506, 1239] -[:mouse_move, 1103, 41, 2, 507, 1240] -[:mouse_move, 1105, 41, 2, 508, 1240] -[:mouse_move, 1107, 40, 2, 509, 1241] -[:mouse_move, 1110, 40, 2, 510, 1242] -[:mouse_move, 1111, 40, 2, 511, 1242] -[:mouse_move, 1113, 40, 2, 512, 1243] -[:mouse_move, 1114, 40, 2, 513, 1244] -[:mouse_move, 1117, 40, 2, 514, 1244] -[:mouse_move, 1118, 40, 2, 515, 1245] -[:mouse_move, 1119, 40, 2, 516, 1246] -[:mouse_move, 1121, 40, 2, 517, 1246] -[:mouse_move, 1122, 40, 2, 518, 1248] -[:mouse_move, 1123, 40, 2, 519, 1249] -[:mouse_move, 1123, 41, 2, 520, 1250] -[:key_down_raw, 1073742051, 1024, 2, 521, 1356] -[:key_down_raw, 113, 1024, 2, 522, 1359] diff --git a/samples/06_save_load/01_save_load_game/app/main.rb b/samples/06_save_load/01_save_load_game/app/main.rb new file mode 100644 index 0000000..251848a --- /dev/null +++ b/samples/06_save_load/01_save_load_game/app/main.rb @@ -0,0 +1,389 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - 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. + + In this sample app, we're using symbols for our buttons. We have buttons that + light fires, save, load, etc. Each of these buttons has a distinct symbol like + :light_fire, :save_game, :load_game, etc. + + - to_sym: Returns the symbol corresponding to the given string; creates the symbol + if it does not already exist. + For example, + 'car'.to_sym + would return the symbol :car. + + - last: Returns the last element of an array. + + Reminders: + + - num1.lesser(num2): finds the lower value of the given options. + For example, in the statement + a = 4.lesser(3) + 3 has a lower value than 4, which means that the value of a would be set to 3, + but if the statement had been + a = 4.lesser(5) + 4 has a lower value than 5, which means that the value of a would be set to 4. + + - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + + - 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.outputs.labels: An array. Values generate a label. + Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information, go to mygame/documentation/02-labels.md. + + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. + +=end + +# This code allows users to perform different tasks, such as saving and loading the game. +# Users also have options to reset the game and light a fire. + +class TextedBasedGame + + # Contains methods needed for game to run properly. + # Increments tick count by 1 each time it runs (60 times in a single second) + def tick + default + show_intro + state.engine_tick_count += 1 + tick_fire + end + + # Sets default values. + # The ||= ensures that a variable's value is only set to the value following the = sign + # if the value has not already been set before. Intialization happens only in the first frame. + def default + state.engine_tick_count ||= 0 + state.active_module ||= :room + state.fire_progress ||= 0 + state.fire_ready_in ||= 10 + state.previous_fire ||= :dead + state.fire ||= :dead + end + + def show_intro + return unless state.engine_tick_count == 0 # return unless the game just started + set_story_line "awake." # calls set_story_line method, sets to "awake" + end + + # Sets story line. + def set_story_line story_line + state.story_line = story_line # story line set to value of parameter + state.active_module = :alert # active module set to alert + end + + # Clears story line. + def clear_storyline + state.active_module = :none # active module set to none + state.story_line = nil # story line is cleared, set to nil (or empty) + end + + # Determines fire progress (how close the fire is to being ready to light). + def tick_fire + return if state.active_module == :alert # return if active module is alert + state.fire_progress += 1 # increment fire progress + # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. + state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) + end + + # Sets the value of fire (whether it is dead or roaring), and the story line + def light_fire + return unless fire_ready? # returns unless the fire is ready to be lit + state.fire = :roaring # fire is lit, set to roaring + state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit + if state.fire != state.previous_fire + set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation + state.previous_fire = state.fire + end + end + + # Checks if the fire is ready to be lit. Returns a boolean value. + def fire_ready? + # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), + # the fire is ready to be lit. + state.fire_progress == state.fire_ready_in + end + + # Divides the value of the fire_progress variable by 10 to determine how close the user is to + # being able to light a fire. + def light_fire_progress + state.fire_progress.fdiv(10) # float division + end + + # Defines fire as the state.fire variable. + def fire + state.fire + end + + # Sets the title of the room. + def room_title + return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead + return "a room that is lit" # room is lit if the fire is not dead + end + + # Sets the active_module to room. + def go_to_room + state.active_module = :room + end + + # Defines active_module as the state.active_module variable. + def active_module + state.active_module + end + + # Defines story_line as the state.story_line variable. + def story_line + state.story_line + end + + # Update every 60 frames (or every second) + def should_tick? + state.tick_count.mod_zero?(60) + end + + # Sets the value of the game state provider. + def initialize game_state_provider + @game_state_provider = game_state_provider + end + + # Defines the game state. + # Any variable prefixed with an @ symbol is an instance variable. + def state + @game_state_provider.state + end + + # Saves the state of the game in a text file called game_state.txt. + def save + $gtk.serialize_state('game_state.txt', state) + end + + # Loads the game state from the game_state.txt text file. + # If the load is unsuccessful, the user is informed since the story line indicates the failure. + def load + parsed_state = $gtk.deserialize_state('game_state.txt') + if !parsed_state + set_story_line "no game to load. press save first." + else + $gtk.args.state = parsed_state + end + end + + # Resets the game. + def reset + $gtk.reset + end +end + +class TextedBasedGamePresenter + attr_accessor :state, :outputs, :inputs + + # Creates empty collection called highlights. + # Calls methods necessary to run the game. + def tick + state.layout.highlights ||= [] + game.tick if game.should_tick? + render + process_input + end + + # Outputs a label of the tick count (passage of time) and calls all render methods. + def render + outputs.labels << [10, 30, state.tick_count] + render_alert + render_room + render_highlights + end + + # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. + def render_alert + return unless game.active_module == :alert + + outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label + outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line + end + + def render_room + return unless game.active_module == :room + outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen + + # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value + # that positions it 60 pixels lower than the previous output. + + # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) + outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) + outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button + outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button + outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button + outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen + end + + # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. + def render_highlights + state.layout.highlights.each do |h| # for each highlight in the collection + h.lifetime -= 1 # decrease the value of its lifetime + end + + outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection + [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight + # transparency changes; divide lifetime by max_lifetime, multiply result by 255 + end + + # reject highlights from collection that have no remaining lifetime + state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } + end + + # Checks whether or not a button was clicked. + # Returns a boolean value. + def process_input + button = button_clicked? # calls button_clicked? method + end + + # Returns a boolean value. + # Finds the button that was clicked from the button list and determines what method to call. + # Adds a highlight to the highlights collection. + def button_clicked? + return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click + button = @button_list.find do |k, v| # goes through button_list to find button clicked + click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? + end + return unless button # return unless a button was clicked + method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) + if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) + border = button[1][:primitives].last # sets border definition using value of last key in button list hash + + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 10 + h.lifetime = h.max_lifetime + h.color = [120, 120, 180] # sets color to shade of purple + end + + self.send method_to_call # invoke method identified by symbol + else # otherwise, if self doesn't respond to given method + border = button[1][:primitives].last # sets border definition using value of last key in hash + + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true + h.lifetime = h.max_lifetime + h.color = [120, 80, 80] # sets color to dark color + end + + # instructions for users on how to add the missing method_to_call to the code + puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" + puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." + puts "" + puts "```" + puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" + puts "" + puts " def #{method_to_call}" + puts " puts 'Yay that worked!'" + puts " end" + puts "" + puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." + puts "```" + puts "" + end + end + + # Returns the position of the mouse when it is clicked. + def click_pos + return nil unless inputs.mouse.click # returns nil unless the mouse was clicked + return inputs.mouse.click.point # returns location of mouse click (coordinates) + end + + # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) + def button id, x, y, text + @button_list[id] ||= { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x + 10, y + 30, text, 2, 0].label, # positions label inside border + [x, y, 300, 50].border, # sets definition of border + ] + } + + @button_list[id][:primitives] # returns label and border for buttons + end + + # Creates a progress bar (used for lighting the fire) and sets its values. + def progress_bar id, x, y, text, percentage + @button_list[id] = { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) + [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border + [x, y, 300, 50].border, # sets definition of border + ] + } + + # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by + # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. + @button_list[id][:primitives][0][2] = 300 * percentage + @button_list[id][:primitives] + end + + # Defines the game. + def game + @game + end + + # Initalizes the game and creates an empty list of buttons. + def initialize + @game = TextedBasedGame.new self + @button_list ||= {} + end + + # Clears the storyline and takes the user to the room. + def alert_dismiss_clicked + game.clear_storyline + game.go_to_room + end + + # Lights the fire when the user clicks the "light fire" option. + def light_fire_clicked + game.light_fire + end + + # Saves the game when the user clicks the "save" option. + def save_game_clicked + game.save + end + + # Resets the game when the user clicks the "reset" option. + def reset_game_clicked + game.reset + end + + # Loads the game when the user clicks the "load" option. + def load_game_clicked + game.load + end +end + +$text_based_rpg = TextedBasedGamePresenter.new + +def tick args + $text_based_rpg.state = args.state + $text_based_rpg.outputs = args.outputs + $text_based_rpg.inputs = args.inputs + $text_based_rpg.tick +end diff --git a/samples/06_save_load/01_save_load_game/license-for-sample.txt b/samples/06_save_load/01_save_load_game/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/06_save_load/01_save_load_game/license-for-sample.txt @@ -0,0 +1,9 @@ +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/06_save_load/01_save_load_game/replay.txt b/samples/06_save_load/01_save_load_game/replay.txt new file mode 100644 index 0000000..c243f28 --- /dev/null +++ b/samples/06_save_load/01_save_load_game/replay.txt @@ -0,0 +1,1450 @@ +replay_version 2.0 +stopped_at 2867 +seed 100 +recorded_at Sun Sep 29 22:25:40 2019 +[:mouse_move, 175, 437, 2, 1, 96] +[:mouse_move, 181, 437, 2, 2, 97] +[:mouse_move, 198, 437, 2, 3, 98] +[:mouse_move, 210, 438, 2, 4, 99] +[:mouse_move, 255, 440, 2, 5, 100] +[:mouse_move, 266, 441, 2, 6, 101] +[:mouse_move, 303, 442, 2, 7, 102] +[:mouse_move, 310, 443, 2, 8, 103] +[:mouse_move, 326, 444, 2, 9, 104] +[:mouse_move, 332, 445, 2, 10, 105] +[:mouse_move, 342, 445, 2, 11, 106] +[:mouse_move, 345, 445, 2, 12, 107] +[:mouse_move, 350, 445, 2, 13, 108] +[:mouse_move, 354, 445, 2, 14, 109] +[:mouse_move, 359, 445, 2, 15, 110] +[:mouse_move, 363, 443, 2, 16, 111] +[:mouse_move, 371, 439, 2, 17, 112] +[:mouse_move, 386, 431, 2, 18, 113] +[:mouse_move, 394, 425, 2, 19, 114] +[:mouse_move, 406, 417, 2, 20, 115] +[:mouse_move, 413, 411, 2, 21, 116] +[:mouse_move, 426, 398, 2, 22, 117] +[:mouse_move, 431, 391, 2, 23, 118] +[:mouse_move, 436, 378, 2, 24, 119] +[:mouse_move, 436, 369, 2, 25, 120] +[:mouse_move, 436, 368, 2, 26, 153] +[:mouse_move, 435, 368, 2, 27, 155] +[:mouse_move, 436, 368, 2, 28, 172] +[:mouse_move, 437, 368, 2, 29, 177] +[:mouse_move, 438, 367, 2, 30, 179] +[:mouse_move, 440, 366, 2, 31, 180] +[:mouse_move, 449, 362, 2, 32, 181] +[:mouse_move, 457, 359, 2, 33, 182] +[:mouse_move, 495, 348, 2, 34, 183] +[:mouse_move, 537, 341, 2, 35, 184] +[:mouse_move, 587, 334, 2, 36, 185] +[:mouse_move, 602, 333, 2, 37, 186] +[:mouse_move, 638, 329, 2, 38, 187] +[:mouse_move, 644, 328, 2, 39, 188] +[:mouse_move, 665, 326, 2, 40, 189] +[:mouse_move, 671, 326, 2, 41, 190] +[:mouse_move, 676, 325, 2, 42, 191] +[:mouse_move, 677, 325, 2, 43, 192] +[:mouse_move, 678, 325, 2, 44, 193] +[:mouse_move, 677, 324, 2, 45, 196] +[:mouse_move, 675, 323, 2, 46, 197] +[:mouse_move, 671, 321, 2, 47, 198] +[:mouse_move, 667, 320, 2, 48, 199] +[:mouse_move, 664, 320, 2, 49, 200] +[:mouse_move, 661, 320, 2, 50, 201] +[:mouse_move, 656, 319, 2, 51, 202] +[:mouse_move, 654, 319, 2, 52, 203] +[:mouse_move, 652, 319, 2, 53, 204] +[:mouse_move, 651, 319, 2, 54, 206] +[:mouse_button_pressed, 1, 0, 1, 55, 220] +[:mouse_button_up, 1, 0, 1, 56, 227] +[:mouse_move, 651, 320, 2, 57, 259] +[:mouse_move, 648, 321, 2, 58, 331] +[:mouse_move, 643, 323, 2, 59, 332] +[:mouse_move, 597, 339, 2, 60, 333] +[:mouse_move, 526, 366, 2, 61, 334] +[:mouse_move, 380, 433, 2, 62, 335] +[:mouse_move, 272, 486, 2, 63, 336] +[:mouse_move, 242, 499, 2, 64, 337] +[:mouse_move, 188, 520, 2, 65, 338] +[:mouse_move, 177, 527, 2, 66, 351] +[:mouse_move, 162, 537, 2, 67, 352] +[:mouse_move, 96, 582, 2, 68, 353] +[:mouse_move, 78, 594, 2, 69, 354] +[:mouse_move, 32, 630, 2, 70, 355] +[:mouse_move, 24, 637, 2, 71, 356] +[:mouse_move, 7, 652, 2, 72, 357] +[:mouse_move, 0, 664, 2, 73, 358] +[:mouse_move, 0, 702, 2, 74, 374] +[:mouse_move, 1, 702, 2, 75, 375] +[:mouse_move, 3, 703, 2, 76, 375] +[:mouse_move, 5, 704, 2, 77, 376] +[:mouse_move, 8, 705, 2, 78, 377] +[:mouse_move, 11, 705, 2, 79, 378] +[:mouse_move, 13, 706, 2, 80, 379] +[:mouse_move, 16, 707, 2, 81, 380] +[:mouse_move, 18, 707, 2, 82, 381] +[:mouse_move, 22, 708, 2, 83, 382] +[:mouse_move, 24, 708, 2, 84, 383] +[:mouse_move, 26, 708, 2, 85, 384] +[:mouse_move, 28, 708, 2, 86, 384] +[:mouse_move, 30, 708, 2, 87, 385] +[:mouse_move, 31, 708, 2, 88, 386] +[:mouse_move, 34, 708, 2, 89, 386] +[:mouse_move, 35, 707, 2, 90, 387] +[:mouse_move, 37, 706, 2, 91, 388] +[:mouse_move, 39, 705, 2, 92, 388] +[:mouse_move, 40, 705, 2, 93, 389] +[:mouse_move, 42, 704, 2, 94, 390] +[:mouse_move, 43, 703, 2, 95, 390] +[:mouse_move, 45, 701, 2, 96, 391] +[:mouse_move, 45, 700, 2, 97, 392] +[:mouse_move, 47, 698, 2, 98, 392] +[:mouse_move, 47, 696, 2, 99, 393] +[:mouse_move, 48, 694, 2, 100, 394] +[:mouse_move, 48, 691, 2, 101, 394] +[:mouse_move, 48, 689, 2, 102, 395] +[:mouse_move, 47, 688, 2, 103, 396] +[:mouse_move, 46, 686, 2, 104, 396] +[:mouse_move, 45, 684, 2, 105, 397] +[:mouse_move, 44, 683, 2, 106, 398] +[:mouse_move, 42, 682, 2, 107, 398] +[:mouse_move, 41, 681, 2, 108, 399] +[:mouse_move, 39, 681, 2, 109, 400] +[:mouse_move, 35, 681, 2, 110, 401] +[:mouse_move, 34, 681, 2, 111, 402] +[:mouse_move, 32, 681, 2, 112, 402] +[:mouse_move, 30, 681, 2, 113, 403] +[:mouse_move, 28, 681, 2, 114, 404] +[:mouse_move, 26, 681, 2, 115, 404] +[:mouse_move, 24, 681, 2, 116, 405] +[:mouse_move, 20, 682, 2, 117, 406] +[:mouse_move, 17, 683, 2, 118, 407] +[:mouse_move, 16, 684, 2, 119, 408] +[:mouse_move, 14, 685, 2, 120, 409] +[:mouse_move, 13, 685, 2, 121, 410] +[:mouse_move, 13, 686, 2, 122, 411] +[:mouse_move, 12, 686, 2, 123, 411] +[:mouse_move, 12, 687, 2, 124, 412] +[:mouse_move, 12, 688, 2, 125, 413] +[:mouse_move, 12, 691, 2, 126, 415] +[:mouse_move, 12, 694, 2, 127, 416] +[:mouse_move, 12, 697, 2, 128, 417] +[:mouse_move, 15, 700, 2, 129, 417] +[:mouse_move, 16, 702, 2, 130, 418] +[:mouse_move, 18, 704, 2, 131, 419] +[:mouse_move, 20, 707, 2, 132, 419] +[:mouse_move, 22, 708, 2, 133, 420] +[:mouse_move, 24, 709, 2, 134, 421] +[:mouse_move, 26, 710, 2, 135, 421] +[:mouse_move, 28, 710, 2, 136, 422] +[:mouse_move, 29, 710, 2, 137, 423] +[:mouse_move, 31, 710, 2, 138, 423] +[:mouse_move, 32, 710, 2, 139, 424] +[:mouse_move, 33, 710, 2, 140, 425] +[:mouse_move, 34, 709, 2, 141, 425] +[:mouse_move, 35, 708, 2, 142, 426] +[:mouse_move, 36, 707, 2, 143, 427] +[:mouse_move, 38, 706, 2, 144, 427] +[:mouse_move, 39, 705, 2, 145, 428] +[:mouse_move, 40, 704, 2, 146, 429] +[:mouse_move, 41, 703, 2, 147, 429] +[:mouse_move, 41, 701, 2, 148, 430] +[:mouse_move, 42, 700, 2, 149, 431] +[:mouse_move, 42, 696, 2, 150, 432] +[:mouse_move, 42, 693, 2, 151, 433] +[:mouse_move, 39, 689, 2, 152, 434] +[:mouse_move, 38, 688, 2, 153, 435] +[:mouse_move, 34, 685, 2, 154, 436] +[:mouse_move, 31, 683, 2, 155, 437] +[:mouse_move, 26, 683, 2, 156, 438] +[:mouse_move, 23, 682, 2, 157, 439] +[:mouse_move, 21, 682, 2, 158, 440] +[:mouse_move, 19, 682, 2, 159, 440] +[:mouse_move, 16, 682, 2, 160, 441] +[:mouse_move, 14, 682, 2, 161, 442] +[:mouse_move, 12, 682, 2, 162, 442] +[:mouse_move, 10, 682, 2, 163, 443] +[:mouse_move, 9, 682, 2, 164, 444] +[:mouse_move, 8, 682, 2, 165, 444] +[:mouse_move, 7, 682, 2, 166, 445] +[:mouse_move, 6, 683, 2, 167, 446] +[:mouse_move, 5, 683, 2, 168, 446] +[:mouse_move, 4, 684, 2, 169, 447] +[:mouse_move, 4, 685, 2, 170, 448] +[:mouse_move, 4, 686, 2, 171, 449] +[:mouse_move, 4, 688, 2, 172, 450] +[:mouse_move, 4, 689, 2, 173, 450] +[:mouse_move, 4, 690, 2, 174, 451] +[:mouse_move, 4, 692, 2, 175, 452] +[:mouse_move, 4, 695, 2, 176, 453] +[:mouse_move, 4, 696, 2, 177, 454] +[:mouse_move, 4, 697, 2, 178, 454] +[:mouse_move, 4, 698, 2, 179, 456] +[:mouse_move, 5, 699, 2, 180, 457] +[:mouse_move, 7, 700, 2, 181, 458] +[:mouse_move, 8, 700, 2, 182, 458] +[:mouse_move, 11, 701, 2, 183, 459] +[:mouse_move, 13, 701, 2, 184, 460] +[:mouse_move, 19, 702, 2, 185, 461] +[:mouse_move, 22, 702, 2, 186, 462] +[:mouse_move, 28, 702, 2, 187, 463] +[:mouse_move, 30, 702, 2, 188, 464] +[:mouse_move, 34, 702, 2, 189, 465] +[:mouse_move, 36, 701, 2, 190, 466] +[:mouse_move, 38, 700, 2, 191, 467] +[:mouse_move, 39, 699, 2, 192, 468] +[:mouse_move, 40, 699, 2, 193, 469] +[:mouse_move, 40, 698, 2, 194, 469] +[:mouse_move, 41, 696, 2, 195, 470] +[:mouse_move, 41, 692, 2, 196, 471] +[:mouse_move, 41, 690, 2, 197, 472] +[:mouse_move, 41, 688, 2, 198, 473] +[:mouse_move, 41, 686, 2, 199, 473] +[:mouse_move, 40, 684, 2, 200, 474] +[:mouse_move, 39, 682, 2, 201, 475] +[:mouse_move, 38, 681, 2, 202, 475] +[:mouse_move, 36, 680, 2, 203, 476] +[:mouse_move, 34, 679, 2, 204, 477] +[:mouse_move, 32, 679, 2, 205, 477] +[:mouse_move, 30, 679, 2, 206, 478] +[:mouse_move, 28, 679, 2, 207, 479] +[:mouse_move, 26, 679, 2, 208, 479] +[:mouse_move, 24, 679, 2, 209, 480] +[:mouse_move, 23, 679, 2, 210, 481] +[:mouse_move, 21, 679, 2, 211, 481] +[:mouse_move, 19, 679, 2, 212, 482] +[:mouse_move, 18, 679, 2, 213, 483] +[:mouse_move, 17, 680, 2, 214, 483] +[:mouse_move, 16, 681, 2, 215, 484] +[:mouse_move, 15, 682, 2, 216, 485] +[:mouse_move, 13, 684, 2, 217, 486] +[:mouse_move, 12, 686, 2, 218, 487] +[:mouse_move, 11, 688, 2, 219, 488] +[:mouse_move, 11, 689, 2, 220, 489] +[:mouse_move, 11, 690, 2, 221, 490] +[:mouse_move, 11, 693, 2, 222, 491] +[:mouse_move, 11, 696, 2, 223, 492] +[:mouse_move, 11, 699, 2, 224, 493] +[:mouse_move, 13, 702, 2, 225, 494] +[:mouse_move, 13, 704, 2, 226, 495] +[:mouse_move, 17, 707, 2, 227, 496] +[:mouse_move, 20, 708, 2, 228, 497] +[:mouse_move, 25, 709, 2, 229, 498] +[:mouse_move, 29, 709, 2, 230, 499] +[:mouse_move, 32, 709, 2, 231, 500] +[:mouse_move, 35, 708, 2, 232, 500] +[:mouse_move, 36, 708, 2, 233, 501] +[:mouse_move, 38, 706, 2, 234, 502] +[:mouse_move, 41, 706, 2, 235, 502] +[:mouse_move, 42, 704, 2, 236, 503] +[:mouse_move, 43, 703, 2, 237, 504] +[:mouse_move, 44, 702, 2, 238, 504] +[:mouse_move, 45, 701, 2, 239, 505] +[:mouse_move, 45, 699, 2, 240, 506] +[:mouse_move, 45, 697, 2, 241, 506] +[:mouse_move, 45, 695, 2, 242, 507] +[:mouse_move, 45, 693, 2, 243, 508] +[:mouse_move, 45, 691, 2, 244, 508] +[:mouse_move, 43, 689, 2, 245, 509] +[:mouse_move, 42, 687, 2, 246, 510] +[:mouse_move, 41, 685, 2, 247, 510] +[:mouse_move, 38, 682, 2, 248, 511] +[:mouse_move, 36, 681, 2, 249, 512] +[:mouse_move, 31, 679, 2, 250, 513] +[:mouse_move, 28, 679, 2, 251, 514] +[:mouse_move, 23, 679, 2, 252, 515] +[:mouse_move, 21, 679, 2, 253, 516] +[:mouse_move, 17, 681, 2, 254, 517] +[:mouse_move, 16, 681, 2, 255, 518] +[:mouse_move, 14, 683, 2, 256, 519] +[:mouse_move, 13, 683, 2, 257, 520] +[:mouse_move, 13, 684, 2, 258, 521] +[:mouse_move, 13, 685, 2, 259, 521] +[:mouse_move, 12, 685, 2, 260, 522] +[:mouse_move, 12, 689, 2, 261, 523] +[:mouse_move, 12, 691, 2, 262, 524] +[:mouse_move, 12, 692, 2, 263, 525] +[:mouse_move, 12, 694, 2, 264, 525] +[:mouse_move, 12, 696, 2, 265, 526] +[:mouse_move, 12, 699, 2, 266, 527] +[:mouse_move, 12, 700, 2, 267, 529] +[:mouse_move, 12, 701, 2, 268, 529] +[:mouse_move, 12, 702, 2, 269, 530] +[:mouse_move, 13, 702, 2, 270, 531] +[:mouse_move, 14, 703, 2, 271, 531] +[:mouse_move, 17, 703, 2, 272, 532] +[:mouse_move, 19, 704, 2, 273, 533] +[:mouse_move, 22, 704, 2, 274, 534] +[:mouse_move, 27, 705, 2, 275, 535] +[:mouse_move, 32, 705, 2, 276, 536] +[:mouse_move, 35, 705, 2, 277, 537] +[:mouse_move, 36, 705, 2, 278, 537] +[:mouse_move, 39, 705, 2, 279, 538] +[:mouse_move, 41, 704, 2, 280, 539] +[:mouse_move, 42, 703, 2, 281, 539] +[:mouse_move, 44, 703, 2, 282, 540] +[:mouse_move, 45, 702, 2, 283, 541] +[:mouse_move, 46, 702, 2, 284, 542] +[:mouse_move, 47, 702, 2, 285, 543] +[:mouse_move, 47, 701, 2, 286, 544] +[:mouse_move, 48, 701, 2, 287, 547] +[:mouse_move, 54, 698, 2, 288, 570] +[:mouse_move, 75, 683, 2, 289, 571] +[:mouse_move, 107, 657, 2, 290, 572] +[:mouse_move, 171, 589, 2, 291, 573] +[:mouse_move, 212, 537, 2, 292, 574] +[:mouse_move, 299, 409, 2, 293, 575] +[:mouse_move, 341, 340, 2, 294, 576] +[:mouse_move, 364, 296, 2, 295, 577] +[:mouse_move, 371, 283, 2, 296, 578] +[:mouse_move, 375, 275, 2, 297, 579] +[:mouse_move, 384, 258, 2, 298, 579] +[:mouse_move, 390, 247, 2, 299, 580] +[:mouse_move, 395, 236, 2, 300, 581] +[:mouse_move, 395, 234, 2, 301, 582] +[:mouse_move, 396, 234, 2, 302, 583] +[:mouse_move, 396, 233, 2, 303, 583] +[:mouse_move, 395, 232, 2, 304, 584] +[:mouse_move, 395, 229, 2, 305, 604] +[:mouse_move, 395, 227, 2, 306, 604] +[:mouse_move, 395, 221, 2, 307, 606] +[:mouse_move, 395, 217, 2, 308, 607] +[:mouse_move, 395, 212, 2, 309, 608] +[:mouse_move, 395, 202, 2, 310, 608] +[:mouse_move, 395, 195, 2, 311, 609] +[:mouse_move, 395, 185, 2, 312, 610] +[:mouse_move, 395, 173, 2, 313, 610] +[:mouse_move, 396, 160, 2, 314, 611] +[:mouse_move, 396, 155, 2, 315, 612] +[:mouse_move, 397, 150, 2, 316, 612] +[:mouse_move, 398, 144, 2, 317, 613] +[:mouse_move, 399, 138, 2, 318, 614] +[:mouse_move, 401, 130, 2, 319, 615] +[:mouse_move, 401, 127, 2, 320, 616] +[:mouse_move, 401, 126, 2, 321, 616] +[:mouse_move, 402, 125, 2, 322, 617] +[:mouse_move, 402, 123, 2, 323, 618] +[:mouse_move, 402, 122, 2, 324, 618] +[:mouse_move, 402, 119, 2, 325, 619] +[:mouse_move, 403, 118, 2, 326, 620] +[:mouse_move, 403, 116, 2, 327, 620] +[:mouse_move, 404, 114, 2, 328, 621] +[:mouse_move, 405, 113, 2, 329, 622] +[:mouse_move, 405, 112, 2, 330, 622] +[:mouse_move, 406, 111, 2, 331, 623] +[:mouse_move, 406, 110, 2, 332, 624] +[:mouse_move, 407, 109, 2, 333, 625] +[:mouse_move, 407, 108, 2, 334, 626] +[:mouse_move, 408, 108, 2, 335, 627] +[:mouse_move, 408, 107, 2, 336, 638] +[:mouse_move, 407, 106, 2, 337, 639] +[:mouse_move, 407, 105, 2, 338, 639] +[:mouse_move, 407, 103, 2, 339, 640] +[:mouse_move, 407, 100, 2, 340, 641] +[:mouse_move, 408, 96, 2, 341, 641] +[:mouse_move, 412, 89, 2, 342, 642] +[:mouse_move, 415, 82, 2, 343, 643] +[:mouse_move, 418, 78, 2, 344, 643] +[:mouse_move, 422, 72, 2, 345, 644] +[:mouse_move, 426, 65, 2, 346, 645] +[:mouse_move, 431, 59, 2, 347, 645] +[:mouse_move, 437, 55, 2, 348, 646] +[:mouse_move, 441, 51, 2, 349, 647] +[:mouse_move, 447, 49, 2, 350, 648] +[:mouse_move, 450, 47, 2, 351, 649] +[:mouse_move, 454, 46, 2, 352, 650] +[:mouse_move, 455, 46, 2, 353, 651] +[:mouse_move, 456, 46, 2, 354, 652] +[:mouse_move, 457, 46, 2, 355, 653] +[:mouse_move, 458, 46, 2, 356, 655] +[:mouse_move, 460, 47, 2, 357, 656] +[:mouse_move, 462, 47, 2, 358, 657] +[:mouse_move, 463, 47, 2, 359, 658] +[:mouse_move, 466, 47, 2, 360, 694] +[:mouse_move, 468, 47, 2, 361, 695] +[:mouse_move, 471, 47, 2, 362, 695] +[:mouse_move, 478, 47, 2, 363, 696] +[:mouse_move, 485, 47, 2, 364, 697] +[:mouse_move, 505, 47, 2, 365, 698] +[:mouse_move, 527, 47, 2, 366, 699] +[:mouse_move, 537, 47, 2, 367, 699] +[:mouse_move, 554, 47, 2, 368, 700] +[:mouse_move, 572, 47, 2, 369, 701] +[:mouse_move, 608, 48, 2, 370, 702] +[:mouse_move, 625, 49, 2, 371, 703] +[:mouse_move, 657, 50, 2, 372, 704] +[:mouse_move, 673, 51, 2, 373, 705] +[:mouse_move, 700, 53, 2, 374, 706] +[:mouse_move, 713, 53, 2, 375, 707] +[:mouse_move, 739, 55, 2, 376, 708] +[:mouse_move, 744, 55, 2, 377, 709] +[:mouse_move, 762, 57, 2, 378, 710] +[:mouse_move, 770, 59, 2, 379, 711] +[:mouse_move, 782, 61, 2, 380, 712] +[:mouse_move, 788, 63, 2, 381, 713] +[:mouse_move, 798, 66, 2, 382, 714] +[:mouse_move, 800, 67, 2, 383, 715] +[:mouse_move, 805, 69, 2, 384, 716] +[:mouse_move, 807, 71, 2, 385, 717] +[:mouse_move, 809, 72, 2, 386, 718] +[:mouse_move, 810, 72, 2, 387, 718] +[:mouse_move, 812, 75, 2, 388, 719] +[:mouse_move, 813, 76, 2, 389, 720] +[:mouse_move, 815, 79, 2, 390, 720] +[:mouse_move, 816, 83, 2, 391, 721] +[:mouse_move, 818, 86, 2, 392, 722] +[:mouse_move, 819, 89, 2, 393, 722] +[:mouse_move, 821, 91, 2, 394, 723] +[:mouse_move, 822, 93, 2, 395, 724] +[:mouse_move, 823, 95, 2, 396, 724] +[:mouse_move, 824, 96, 2, 397, 725] +[:mouse_move, 825, 97, 2, 398, 726] +[:mouse_move, 826, 98, 2, 399, 726] +[:mouse_move, 827, 98, 2, 400, 727] +[:mouse_move, 828, 98, 2, 401, 728] +[:mouse_move, 829, 98, 2, 402, 729] +[:mouse_move, 830, 98, 2, 403, 731] +[:mouse_move, 831, 98, 2, 404, 733] +[:mouse_move, 832, 98, 2, 405, 758] +[:mouse_move, 833, 98, 2, 406, 788] +[:mouse_move, 836, 98, 2, 407, 789] +[:mouse_move, 838, 99, 2, 408, 790] +[:mouse_move, 841, 99, 2, 409, 791] +[:mouse_move, 843, 99, 2, 410, 792] +[:mouse_move, 845, 99, 2, 411, 793] +[:mouse_move, 845, 100, 2, 412, 794] +[:mouse_move, 846, 100, 2, 413, 795] +[:mouse_move, 844, 100, 2, 414, 808] +[:mouse_move, 841, 99, 2, 415, 809] +[:mouse_move, 828, 96, 2, 416, 810] +[:mouse_move, 818, 94, 2, 417, 811] +[:mouse_move, 807, 92, 2, 418, 811] +[:mouse_move, 794, 91, 2, 419, 812] +[:mouse_move, 778, 90, 2, 420, 813] +[:mouse_move, 745, 88, 2, 421, 814] +[:mouse_move, 728, 88, 2, 422, 815] +[:mouse_move, 704, 88, 2, 423, 816] +[:mouse_move, 691, 88, 2, 424, 817] +[:mouse_move, 673, 88, 2, 425, 818] +[:mouse_move, 666, 89, 2, 426, 819] +[:mouse_move, 656, 90, 2, 427, 820] +[:mouse_move, 651, 90, 2, 428, 821] +[:mouse_move, 647, 90, 2, 429, 822] +[:mouse_move, 645, 90, 2, 430, 823] +[:mouse_move, 643, 90, 2, 431, 824] +[:mouse_move, 642, 90, 2, 432, 825] +[:mouse_move, 642, 89, 2, 433, 826] +[:mouse_move, 641, 89, 2, 434, 828] +[:mouse_button_pressed, 1, 0, 1, 435, 841] +[:mouse_button_up, 1, 0, 1, 436, 848] +[:mouse_move, 639, 91, 2, 437, 893] +[:mouse_move, 635, 93, 2, 438, 894] +[:mouse_move, 615, 106, 2, 439, 895] +[:mouse_move, 598, 117, 2, 440, 896] +[:mouse_move, 554, 145, 2, 441, 897] +[:mouse_move, 529, 160, 2, 442, 898] +[:mouse_move, 498, 181, 2, 443, 899] +[:mouse_move, 482, 195, 2, 444, 900] +[:mouse_move, 467, 209, 2, 445, 901] +[:mouse_move, 460, 217, 2, 446, 902] +[:mouse_move, 458, 221, 2, 447, 916] +[:mouse_move, 457, 223, 2, 448, 917] +[:mouse_move, 455, 226, 2, 449, 918] +[:mouse_move, 454, 228, 2, 450, 919] +[:mouse_move, 453, 232, 2, 451, 920] +[:mouse_move, 453, 233, 2, 452, 921] +[:mouse_move, 452, 235, 2, 453, 922] +[:mouse_move, 452, 236, 2, 454, 924] +[:mouse_move, 452, 237, 2, 455, 926] +[:mouse_move, 452, 238, 2, 456, 932] +[:mouse_move, 452, 239, 2, 457, 935] +[:mouse_move, 453, 239, 2, 458, 936] +[:mouse_move, 453, 240, 2, 459, 937] +[:mouse_move, 453, 241, 2, 460, 938] +[:mouse_move, 454, 243, 2, 461, 939] +[:mouse_move, 455, 244, 2, 462, 940] +[:mouse_move, 455, 247, 2, 463, 941] +[:mouse_move, 456, 248, 2, 464, 942] +[:mouse_move, 456, 250, 2, 465, 943] +[:mouse_move, 457, 251, 2, 466, 944] +[:mouse_move, 460, 253, 2, 467, 945] +[:mouse_move, 463, 255, 2, 468, 946] +[:mouse_move, 472, 259, 2, 469, 947] +[:mouse_move, 483, 262, 2, 470, 948] +[:mouse_move, 501, 265, 2, 471, 949] +[:mouse_move, 506, 266, 2, 472, 950] +[:mouse_move, 526, 268, 2, 473, 951] +[:mouse_move, 536, 268, 2, 474, 952] +[:mouse_move, 555, 269, 2, 475, 953] +[:mouse_move, 563, 269, 2, 476, 954] +[:mouse_move, 571, 270, 2, 477, 955] +[:mouse_move, 595, 271, 2, 478, 956] +[:mouse_move, 603, 272, 2, 479, 957] +[:mouse_move, 617, 273, 2, 480, 958] +[:mouse_move, 627, 273, 2, 481, 959] +[:mouse_move, 652, 275, 2, 482, 960] +[:mouse_move, 657, 275, 2, 483, 961] +[:mouse_move, 674, 276, 2, 484, 962] +[:mouse_move, 683, 276, 2, 485, 963] +[:mouse_move, 696, 276, 2, 486, 964] +[:mouse_move, 702, 276, 2, 487, 965] +[:mouse_move, 712, 276, 2, 488, 966] +[:mouse_move, 715, 276, 2, 489, 967] +[:mouse_move, 721, 276, 2, 490, 968] +[:mouse_move, 724, 276, 2, 491, 969] +[:mouse_move, 728, 276, 2, 492, 970] +[:mouse_move, 731, 276, 2, 493, 971] +[:mouse_move, 734, 277, 2, 494, 972] +[:mouse_move, 736, 277, 2, 495, 974] +[:mouse_move, 737, 277, 2, 496, 977] +[:mouse_move, 735, 277, 2, 497, 984] +[:mouse_move, 731, 278, 2, 498, 985] +[:mouse_move, 726, 279, 2, 499, 986] +[:mouse_move, 713, 283, 2, 500, 987] +[:mouse_move, 704, 286, 2, 501, 988] +[:mouse_move, 681, 293, 2, 502, 989] +[:mouse_move, 657, 300, 2, 503, 990] +[:mouse_move, 619, 313, 2, 504, 991] +[:mouse_move, 593, 321, 2, 505, 992] +[:mouse_move, 538, 340, 2, 506, 993] +[:mouse_move, 526, 344, 2, 507, 994] +[:mouse_move, 478, 360, 2, 508, 995] +[:mouse_move, 458, 367, 2, 509, 996] +[:mouse_move, 426, 379, 2, 510, 997] +[:mouse_move, 420, 381, 2, 511, 998] +[:mouse_move, 407, 385, 2, 512, 999] +[:mouse_move, 400, 388, 2, 513, 1000] +[:mouse_move, 392, 391, 2, 514, 1001] +[:mouse_move, 388, 391, 2, 515, 1002] +[:mouse_move, 385, 393, 2, 516, 1003] +[:mouse_move, 384, 393, 2, 517, 1004] +[:mouse_move, 383, 394, 2, 518, 1005] +[:mouse_move, 384, 394, 2, 519, 1007] +[:mouse_move, 387, 394, 2, 520, 1008] +[:mouse_move, 399, 392, 2, 521, 1009] +[:mouse_move, 408, 391, 2, 522, 1010] +[:mouse_move, 418, 389, 2, 523, 1011] +[:mouse_move, 441, 384, 2, 524, 1012] +[:mouse_move, 451, 382, 2, 525, 1013] +[:mouse_move, 475, 378, 2, 526, 1014] +[:mouse_move, 486, 376, 2, 527, 1015] +[:mouse_move, 507, 374, 2, 528, 1016] +[:mouse_move, 519, 373, 2, 529, 1017] +[:mouse_move, 539, 371, 2, 530, 1018] +[:mouse_move, 544, 371, 2, 531, 1019] +[:mouse_move, 567, 369, 2, 532, 1020] +[:mouse_move, 584, 369, 2, 533, 1021] +[:mouse_move, 598, 369, 2, 534, 1022] +[:mouse_move, 607, 368, 2, 535, 1023] +[:mouse_move, 625, 368, 2, 536, 1024] +[:mouse_move, 632, 368, 2, 537, 1025] +[:mouse_move, 645, 368, 2, 538, 1026] +[:mouse_move, 650, 368, 2, 539, 1027] +[:mouse_move, 657, 368, 2, 540, 1028] +[:mouse_move, 661, 368, 2, 541, 1029] +[:mouse_move, 667, 368, 2, 542, 1030] +[:mouse_move, 670, 368, 2, 543, 1031] +[:mouse_move, 674, 368, 2, 544, 1032] +[:mouse_move, 676, 368, 2, 545, 1033] +[:mouse_move, 679, 367, 2, 546, 1034] +[:mouse_move, 680, 367, 2, 547, 1036] +[:mouse_move, 681, 367, 2, 548, 1037] +[:mouse_move, 681, 366, 2, 549, 1040] +[:mouse_move, 675, 360, 2, 550, 1055] +[:mouse_move, 671, 356, 2, 551, 1056] +[:mouse_move, 664, 348, 2, 552, 1057] +[:mouse_move, 659, 344, 2, 553, 1058] +[:mouse_move, 654, 338, 2, 554, 1059] +[:mouse_move, 650, 332, 2, 555, 1060] +[:mouse_move, 644, 327, 2, 556, 1061] +[:mouse_move, 643, 326, 2, 557, 1062] +[:mouse_move, 641, 324, 2, 558, 1063] +[:mouse_move, 638, 321, 2, 559, 1064] +[:mouse_move, 636, 319, 2, 560, 1065] +[:mouse_move, 635, 319, 2, 561, 1066] +[:mouse_move, 635, 318, 2, 562, 1067] +[:mouse_move, 634, 318, 2, 563, 1068] +[:mouse_move, 634, 317, 2, 564, 1069] +[:mouse_button_pressed, 1, 0, 1, 565, 1071] +[:mouse_button_up, 1, 0, 1, 566, 1079] +[:mouse_move, 633, 317, 2, 567, 1099] +[:mouse_move, 633, 318, 2, 568, 1100] +[:mouse_move, 624, 324, 2, 569, 1101] +[:mouse_move, 613, 331, 2, 570, 1102] +[:mouse_move, 579, 351, 2, 571, 1103] +[:mouse_move, 554, 365, 2, 572, 1104] +[:mouse_move, 497, 393, 2, 573, 1105] +[:mouse_move, 469, 404, 2, 574, 1106] +[:mouse_move, 449, 411, 2, 575, 1107] +[:mouse_move, 432, 417, 2, 576, 1108] +[:mouse_move, 419, 421, 2, 577, 1109] +[:mouse_move, 412, 423, 2, 578, 1110] +[:mouse_move, 406, 425, 2, 579, 1111] +[:mouse_move, 405, 425, 2, 580, 1112] +[:mouse_move, 404, 425, 2, 581, 1113] +[:mouse_move, 397, 425, 2, 582, 1203] +[:mouse_move, 388, 428, 2, 583, 1204] +[:mouse_move, 363, 440, 2, 584, 1205] +[:mouse_move, 348, 447, 2, 585, 1206] +[:mouse_move, 289, 487, 2, 586, 1207] +[:mouse_move, 260, 509, 2, 587, 1208] +[:mouse_move, 223, 542, 2, 588, 1209] +[:mouse_move, 203, 561, 2, 589, 1210] +[:mouse_move, 181, 584, 2, 590, 1211] +[:mouse_move, 170, 595, 2, 591, 1212] +[:mouse_move, 155, 613, 2, 592, 1213] +[:mouse_move, 150, 619, 2, 593, 1214] +[:mouse_move, 143, 629, 2, 594, 1215] +[:mouse_move, 139, 633, 2, 595, 1216] +[:mouse_move, 135, 638, 2, 596, 1217] +[:mouse_move, 133, 641, 2, 597, 1218] +[:mouse_move, 126, 646, 2, 598, 1219] +[:mouse_move, 123, 648, 2, 599, 1220] +[:mouse_move, 116, 653, 2, 600, 1221] +[:mouse_move, 112, 656, 2, 601, 1222] +[:mouse_move, 103, 660, 2, 602, 1223] +[:mouse_move, 99, 662, 2, 603, 1224] +[:mouse_move, 88, 665, 2, 604, 1225] +[:mouse_move, 84, 667, 2, 605, 1226] +[:mouse_move, 76, 671, 2, 606, 1227] +[:mouse_move, 72, 673, 2, 607, 1228] +[:mouse_move, 69, 675, 2, 608, 1229] +[:mouse_move, 63, 679, 2, 609, 1230] +[:mouse_move, 60, 682, 2, 610, 1231] +[:mouse_move, 53, 688, 2, 611, 1232] +[:mouse_move, 50, 690, 2, 612, 1233] +[:mouse_move, 46, 693, 2, 613, 1234] +[:mouse_move, 44, 695, 2, 614, 1235] +[:mouse_move, 39, 697, 2, 615, 1236] +[:mouse_move, 37, 699, 2, 616, 1237] +[:mouse_move, 33, 700, 2, 617, 1238] +[:mouse_move, 32, 700, 2, 618, 1239] +[:mouse_move, 28, 701, 2, 619, 1240] +[:mouse_move, 27, 701, 2, 620, 1241] +[:mouse_move, 25, 702, 2, 621, 1242] +[:mouse_move, 24, 702, 2, 622, 1243] +[:mouse_move, 22, 703, 2, 623, 1244] +[:mouse_move, 20, 703, 2, 624, 1245] +[:mouse_move, 18, 704, 2, 625, 1246] +[:mouse_move, 16, 704, 2, 626, 1247] +[:mouse_move, 14, 704, 2, 627, 1248] +[:mouse_move, 13, 704, 2, 628, 1249] +[:mouse_move, 12, 704, 2, 629, 1250] +[:mouse_move, 11, 704, 2, 630, 1251] +[:mouse_move, 10, 704, 2, 631, 1252] +[:mouse_move, 10, 705, 2, 632, 1253] +[:mouse_move, 11, 705, 2, 633, 1261] +[:mouse_move, 12, 705, 2, 634, 1262] +[:mouse_move, 15, 706, 2, 635, 1263] +[:mouse_move, 17, 706, 2, 636, 1264] +[:mouse_move, 20, 707, 2, 637, 1265] +[:mouse_move, 22, 707, 2, 638, 1266] +[:mouse_move, 26, 708, 2, 639, 1267] +[:mouse_move, 27, 708, 2, 640, 1268] +[:mouse_move, 30, 708, 2, 641, 1269] +[:mouse_move, 31, 708, 2, 642, 1270] +[:mouse_move, 33, 708, 2, 643, 1271] +[:mouse_move, 34, 708, 2, 644, 1272] +[:mouse_move, 37, 708, 2, 645, 1273] +[:mouse_move, 38, 708, 2, 646, 1274] +[:mouse_move, 41, 708, 2, 647, 1275] +[:mouse_move, 42, 708, 2, 648, 1276] +[:mouse_move, 44, 708, 2, 649, 1277] +[:mouse_move, 45, 708, 2, 650, 1279] +[:mouse_move, 46, 708, 2, 651, 1280] +[:mouse_move, 53, 702, 2, 652, 1304] +[:mouse_move, 60, 696, 2, 653, 1305] +[:mouse_move, 81, 674, 2, 654, 1306] +[:mouse_move, 107, 646, 2, 655, 1307] +[:mouse_move, 141, 609, 2, 656, 1308] +[:mouse_move, 234, 517, 2, 657, 1309] +[:mouse_move, 288, 465, 2, 658, 1310] +[:mouse_move, 366, 397, 2, 659, 1311] +[:mouse_move, 412, 362, 2, 660, 1312] +[:mouse_move, 464, 328, 2, 661, 1313] +[:mouse_move, 474, 322, 2, 662, 1314] +[:mouse_move, 495, 310, 2, 663, 1315] +[:mouse_move, 504, 304, 2, 664, 1316] +[:mouse_move, 513, 299, 2, 665, 1317] +[:mouse_move, 514, 298, 2, 666, 1318] +[:mouse_move, 515, 297, 2, 667, 1319] +[:mouse_move, 517, 292, 2, 668, 1333] +[:mouse_move, 519, 288, 2, 669, 1334] +[:mouse_move, 524, 275, 2, 670, 1335] +[:mouse_move, 531, 254, 2, 671, 1336] +[:mouse_move, 536, 238, 2, 672, 1337] +[:mouse_move, 546, 209, 2, 673, 1338] +[:mouse_move, 548, 203, 2, 674, 1339] +[:mouse_move, 555, 188, 2, 675, 1340] +[:mouse_move, 557, 181, 2, 676, 1341] +[:mouse_move, 560, 173, 2, 677, 1342] +[:mouse_move, 561, 171, 2, 678, 1343] +[:mouse_move, 562, 169, 2, 679, 1344] +[:mouse_move, 562, 168, 2, 680, 1345] +[:mouse_move, 562, 167, 2, 681, 1346] +[:mouse_move, 562, 166, 2, 682, 1347] +[:mouse_move, 562, 165, 2, 683, 1348] +[:mouse_move, 562, 164, 2, 684, 1350] +[:mouse_move, 562, 163, 2, 685, 1351] +[:mouse_move, 562, 162, 2, 686, 1354] +[:mouse_button_pressed, 1, 0, 1, 687, 1359] +[:mouse_button_up, 1, 0, 1, 688, 1365] +[:mouse_move, 563, 163, 2, 689, 1401] +[:mouse_move, 563, 164, 2, 690, 1402] +[:mouse_move, 564, 165, 2, 691, 1403] +[:mouse_move, 565, 169, 2, 692, 1404] +[:mouse_move, 566, 173, 2, 693, 1405] +[:mouse_move, 566, 179, 2, 694, 1406] +[:mouse_move, 566, 180, 2, 695, 1407] +[:mouse_move, 566, 186, 2, 696, 1408] +[:mouse_move, 565, 188, 2, 697, 1409] +[:mouse_move, 563, 192, 2, 698, 1410] +[:mouse_move, 562, 195, 2, 699, 1411] +[:mouse_move, 561, 198, 2, 700, 1412] +[:mouse_move, 561, 199, 2, 701, 1413] +[:mouse_move, 560, 202, 2, 702, 1414] +[:mouse_move, 560, 205, 2, 703, 1415] +[:mouse_move, 559, 210, 2, 704, 1416] +[:mouse_move, 558, 213, 2, 705, 1417] +[:mouse_move, 558, 215, 2, 706, 1418] +[:mouse_move, 558, 220, 2, 707, 1419] +[:mouse_move, 558, 222, 2, 708, 1420] +[:mouse_move, 558, 224, 2, 709, 1421] +[:mouse_move, 558, 225, 2, 710, 1422] +[:mouse_move, 558, 226, 2, 711, 1423] +[:mouse_move, 558, 225, 2, 712, 1443] +[:mouse_move, 558, 224, 2, 713, 1444] +[:mouse_move, 558, 225, 2, 714, 1451] +[:mouse_move, 558, 229, 2, 715, 1452] +[:mouse_move, 558, 231, 2, 716, 1453] +[:mouse_move, 556, 236, 2, 717, 1454] +[:mouse_move, 556, 238, 2, 718, 1455] +[:mouse_move, 555, 247, 2, 719, 1456] +[:mouse_move, 555, 252, 2, 720, 1457] +[:mouse_move, 555, 261, 2, 721, 1458] +[:mouse_move, 555, 263, 2, 722, 1459] +[:mouse_move, 555, 269, 2, 723, 1460] +[:mouse_move, 556, 272, 2, 724, 1461] +[:mouse_move, 556, 275, 2, 725, 1462] +[:mouse_move, 556, 276, 2, 726, 1464] +[:mouse_move, 556, 277, 2, 727, 1465] +[:mouse_move, 556, 278, 2, 728, 1467] +[:mouse_move, 556, 279, 2, 729, 1471] +[:mouse_move, 556, 281, 2, 730, 1475] +[:mouse_move, 556, 282, 2, 731, 1476] +[:mouse_move, 556, 283, 2, 732, 1477] +[:mouse_move, 556, 285, 2, 733, 1478] +[:mouse_move, 556, 286, 2, 734, 1479] +[:mouse_move, 556, 287, 2, 735, 1482] +[:mouse_move, 556, 286, 2, 736, 1485] +[:mouse_move, 555, 286, 2, 737, 1487] +[:mouse_move, 555, 285, 2, 738, 1488] +[:mouse_move, 556, 282, 2, 739, 1549] +[:mouse_move, 556, 280, 2, 740, 1550] +[:mouse_move, 557, 271, 2, 741, 1551] +[:mouse_move, 557, 268, 2, 742, 1552] +[:mouse_move, 558, 264, 2, 743, 1553] +[:mouse_move, 559, 258, 2, 744, 1554] +[:mouse_move, 559, 256, 2, 745, 1555] +[:mouse_move, 559, 254, 2, 746, 1556] +[:mouse_move, 559, 256, 2, 747, 1559] +[:mouse_move, 560, 261, 2, 748, 1560] +[:mouse_move, 560, 265, 2, 749, 1561] +[:mouse_move, 561, 270, 2, 750, 1562] +[:mouse_move, 562, 273, 2, 751, 1563] +[:mouse_move, 562, 276, 2, 752, 1564] +[:mouse_move, 562, 277, 2, 753, 1565] +[:mouse_move, 562, 278, 2, 754, 1566] +[:mouse_move, 562, 279, 2, 755, 1567] +[:mouse_button_pressed, 1, 0, 1, 756, 1569] +[:mouse_button_up, 1, 0, 1, 757, 1578] +[:mouse_move, 557, 280, 2, 758, 1609] +[:mouse_move, 543, 284, 2, 759, 1610] +[:mouse_move, 532, 285, 2, 760, 1611] +[:mouse_move, 498, 292, 2, 761, 1612] +[:mouse_move, 475, 296, 2, 762, 1613] +[:mouse_move, 425, 304, 2, 763, 1614] +[:mouse_move, 400, 308, 2, 764, 1615] +[:mouse_move, 348, 314, 2, 765, 1616] +[:mouse_move, 337, 316, 2, 766, 1617] +[:mouse_move, 278, 328, 2, 767, 1618] +[:mouse_move, 267, 333, 2, 768, 1619] +[:mouse_move, 228, 348, 2, 769, 1620] +[:mouse_move, 213, 357, 2, 770, 1621] +[:mouse_move, 195, 366, 2, 771, 1622] +[:mouse_move, 192, 368, 2, 772, 1623] +[:mouse_move, 184, 375, 2, 773, 1624] +[:mouse_move, 182, 376, 2, 774, 1625] +[:mouse_move, 181, 379, 2, 775, 1626] +[:mouse_move, 181, 380, 2, 776, 1627] +[:mouse_move, 185, 385, 2, 777, 1628] +[:mouse_move, 187, 386, 2, 778, 1629] +[:mouse_move, 195, 392, 2, 779, 1630] +[:mouse_move, 198, 394, 2, 780, 1631] +[:mouse_move, 210, 396, 2, 781, 1632] +[:mouse_move, 213, 396, 2, 782, 1633] +[:mouse_move, 219, 396, 2, 783, 1634] +[:mouse_move, 231, 395, 2, 784, 1635] +[:mouse_move, 237, 393, 2, 785, 1636] +[:mouse_move, 247, 392, 2, 786, 1637] +[:mouse_move, 252, 392, 2, 787, 1638] +[:mouse_move, 258, 394, 2, 788, 1639] +[:mouse_move, 261, 397, 2, 789, 1640] +[:mouse_move, 263, 428, 2, 790, 1641] +[:mouse_move, 253, 453, 2, 791, 1642] +[:mouse_move, 210, 531, 2, 792, 1643] +[:mouse_move, 196, 553, 2, 793, 1644] +[:mouse_move, 194, 554, 2, 794, 1656] +[:mouse_move, 174, 575, 2, 795, 1657] +[:mouse_move, 162, 587, 2, 796, 1658] +[:mouse_move, 137, 612, 2, 797, 1659] +[:mouse_move, 114, 635, 2, 798, 1660] +[:mouse_move, 86, 665, 2, 799, 1661] +[:mouse_move, 79, 671, 2, 800, 1662] +[:mouse_move, 69, 681, 2, 801, 1663] +[:mouse_move, 52, 698, 2, 802, 1664] +[:mouse_move, 48, 703, 2, 803, 1665] +[:mouse_move, 41, 711, 2, 804, 1666] +[:mouse_move, 39, 715, 2, 805, 1667] +[:mouse_move, 36, 719, 2, 806, 1668] +[:mouse_move, 35, 719, 2, 807, 1669] +[:mouse_move, 20, 719, 2, 808, 1685] +[:mouse_move, 18, 717, 2, 809, 1686] +[:mouse_move, 18, 716, 2, 810, 1687] +[:mouse_move, 16, 715, 2, 811, 1688] +[:mouse_move, 16, 714, 2, 812, 1688] +[:mouse_move, 15, 714, 2, 813, 1689] +[:mouse_move, 15, 713, 2, 814, 1690] +[:mouse_move, 14, 712, 2, 815, 1691] +[:mouse_move, 15, 712, 2, 816, 1697] +[:mouse_move, 17, 712, 2, 817, 1698] +[:mouse_move, 20, 713, 2, 818, 1698] +[:mouse_move, 22, 713, 2, 819, 1699] +[:mouse_move, 25, 713, 2, 820, 1700] +[:mouse_move, 27, 713, 2, 821, 1700] +[:mouse_move, 30, 713, 2, 822, 1701] +[:mouse_move, 32, 713, 2, 823, 1702] +[:mouse_move, 36, 711, 2, 824, 1702] +[:mouse_move, 38, 710, 2, 825, 1703] +[:mouse_move, 41, 708, 2, 826, 1704] +[:mouse_move, 46, 700, 2, 827, 1705] +[:mouse_move, 47, 698, 2, 828, 1706] +[:mouse_move, 50, 691, 2, 829, 1707] +[:mouse_move, 51, 689, 2, 830, 1708] +[:mouse_move, 52, 685, 2, 831, 1709] +[:mouse_move, 52, 683, 2, 832, 1710] +[:mouse_move, 50, 680, 2, 833, 1711] +[:mouse_move, 47, 679, 2, 834, 1712] +[:mouse_move, 39, 675, 2, 835, 1713] +[:mouse_move, 35, 675, 2, 836, 1714] +[:mouse_move, 26, 672, 2, 837, 1715] +[:mouse_move, 23, 671, 2, 838, 1716] +[:mouse_move, 21, 671, 2, 839, 1717] +[:mouse_move, 18, 671, 2, 840, 1717] +[:mouse_move, 15, 671, 2, 841, 1718] +[:mouse_move, 13, 671, 2, 842, 1719] +[:mouse_move, 12, 671, 2, 843, 1719] +[:mouse_move, 10, 671, 2, 844, 1720] +[:mouse_move, 9, 672, 2, 845, 1721] +[:mouse_move, 8, 673, 2, 846, 1721] +[:mouse_move, 7, 676, 2, 847, 1722] +[:mouse_move, 6, 679, 2, 848, 1723] +[:mouse_move, 6, 680, 2, 849, 1723] +[:mouse_move, 6, 683, 2, 850, 1724] +[:mouse_move, 6, 686, 2, 851, 1725] +[:mouse_move, 5, 688, 2, 852, 1725] +[:mouse_move, 5, 690, 2, 853, 1726] +[:mouse_move, 5, 692, 2, 854, 1727] +[:mouse_move, 5, 693, 2, 855, 1727] +[:mouse_move, 6, 696, 2, 856, 1728] +[:mouse_move, 7, 698, 2, 857, 1729] +[:mouse_move, 11, 701, 2, 858, 1730] +[:mouse_move, 13, 702, 2, 859, 1731] +[:mouse_move, 15, 704, 2, 860, 1731] +[:mouse_move, 17, 705, 2, 861, 1732] +[:mouse_move, 21, 707, 2, 862, 1733] +[:mouse_move, 22, 707, 2, 863, 1733] +[:mouse_move, 26, 707, 2, 864, 1734] +[:mouse_move, 28, 707, 2, 865, 1735] +[:mouse_move, 35, 707, 2, 866, 1736] +[:mouse_move, 37, 705, 2, 867, 1737] +[:mouse_move, 41, 702, 2, 868, 1738] +[:mouse_move, 45, 699, 2, 869, 1739] +[:mouse_move, 48, 696, 2, 870, 1740] +[:mouse_move, 49, 695, 2, 871, 1741] +[:mouse_move, 50, 690, 2, 872, 1742] +[:mouse_move, 50, 687, 2, 873, 1743] +[:mouse_move, 50, 684, 2, 874, 1744] +[:mouse_move, 49, 680, 2, 875, 1744] +[:mouse_move, 46, 677, 2, 876, 1745] +[:mouse_move, 42, 674, 2, 877, 1746] +[:mouse_move, 41, 673, 2, 878, 1746] +[:mouse_move, 37, 671, 2, 879, 1747] +[:mouse_move, 34, 669, 2, 880, 1748] +[:mouse_move, 32, 668, 2, 881, 1748] +[:mouse_move, 30, 667, 2, 882, 1749] +[:mouse_move, 28, 666, 2, 883, 1750] +[:mouse_move, 26, 666, 2, 884, 1750] +[:mouse_move, 24, 666, 2, 885, 1751] +[:mouse_move, 20, 666, 2, 886, 1752] +[:mouse_move, 18, 666, 2, 887, 1752] +[:mouse_move, 16, 668, 2, 888, 1753] +[:mouse_move, 14, 668, 2, 889, 1754] +[:mouse_move, 12, 669, 2, 890, 1754] +[:mouse_move, 10, 671, 2, 891, 1755] +[:mouse_move, 9, 672, 2, 892, 1756] +[:mouse_move, 8, 674, 2, 893, 1756] +[:mouse_move, 7, 675, 2, 894, 1757] +[:mouse_move, 6, 675, 2, 895, 1758] +[:mouse_move, 6, 678, 2, 896, 1758] +[:mouse_move, 6, 680, 2, 897, 1759] +[:mouse_move, 6, 683, 2, 898, 1760] +[:mouse_move, 9, 690, 2, 899, 1761] +[:mouse_move, 12, 693, 2, 900, 1762] +[:mouse_move, 19, 699, 2, 901, 1763] +[:mouse_move, 24, 702, 2, 902, 1764] +[:mouse_move, 37, 705, 2, 903, 1765] +[:mouse_move, 45, 705, 2, 904, 1766] +[:mouse_move, 72, 692, 2, 905, 1767] +[:mouse_move, 88, 682, 2, 906, 1768] +[:mouse_move, 129, 649, 2, 907, 1769] +[:mouse_move, 172, 610, 2, 908, 1770] +[:mouse_move, 234, 545, 2, 909, 1771] +[:mouse_move, 267, 507, 2, 910, 1772] +[:mouse_move, 300, 469, 2, 911, 1773] +[:mouse_move, 318, 451, 2, 912, 1773] +[:mouse_move, 349, 415, 2, 913, 1774] +[:mouse_move, 381, 383, 2, 914, 1775] +[:mouse_move, 393, 370, 2, 915, 1775] +[:mouse_move, 414, 345, 2, 916, 1776] +[:mouse_move, 432, 325, 2, 917, 1777] +[:mouse_move, 437, 318, 2, 918, 1777] +[:mouse_move, 447, 305, 2, 919, 1778] +[:mouse_move, 450, 302, 2, 920, 1779] +[:mouse_move, 455, 295, 2, 921, 1779] +[:mouse_move, 459, 290, 2, 922, 1780] +[:mouse_move, 461, 288, 2, 923, 1781] +[:mouse_move, 463, 285, 2, 924, 1781] +[:mouse_move, 465, 284, 2, 925, 1782] +[:mouse_move, 467, 283, 2, 926, 1783] +[:mouse_move, 470, 283, 2, 927, 1783] +[:mouse_move, 472, 283, 2, 928, 1784] +[:mouse_move, 476, 283, 2, 929, 1785] +[:mouse_move, 483, 284, 2, 930, 1786] +[:mouse_move, 485, 286, 2, 931, 1787] +[:mouse_move, 493, 291, 2, 932, 1788] +[:mouse_move, 495, 294, 2, 933, 1789] +[:mouse_move, 500, 300, 2, 934, 1790] +[:mouse_move, 503, 303, 2, 935, 1791] +[:mouse_move, 507, 309, 2, 936, 1792] +[:mouse_move, 509, 311, 2, 937, 1793] +[:mouse_move, 513, 314, 2, 938, 1794] +[:mouse_move, 514, 314, 2, 939, 1795] +[:mouse_move, 516, 314, 2, 940, 1796] +[:mouse_move, 517, 314, 2, 941, 1797] +[:mouse_move, 518, 314, 2, 942, 1798] +[:mouse_move, 519, 314, 2, 943, 1800] +[:mouse_button_pressed, 1, 0, 1, 944, 1801] +[:mouse_button_up, 1, 0, 1, 945, 1808] +[:mouse_move, 519, 312, 2, 946, 1826] +[:mouse_move, 519, 310, 2, 947, 1827] +[:mouse_move, 522, 303, 2, 948, 1828] +[:mouse_move, 523, 298, 2, 949, 1829] +[:mouse_move, 529, 282, 2, 950, 1830] +[:mouse_move, 532, 273, 2, 951, 1831] +[:mouse_move, 541, 252, 2, 952, 1832] +[:mouse_move, 544, 246, 2, 953, 1833] +[:mouse_move, 549, 233, 2, 954, 1834] +[:mouse_move, 552, 225, 2, 955, 1835] +[:mouse_move, 555, 217, 2, 956, 1836] +[:mouse_move, 556, 214, 2, 957, 1837] +[:mouse_move, 557, 211, 2, 958, 1838] +[:mouse_move, 557, 210, 2, 959, 1839] +[:mouse_move, 558, 210, 2, 960, 1841] +[:mouse_move, 558, 211, 2, 961, 1848] +[:mouse_move, 558, 212, 2, 962, 1849] +[:mouse_move, 558, 213, 2, 963, 1850] +[:mouse_move, 558, 214, 2, 964, 1851] +[:mouse_move, 558, 215, 2, 965, 1853] +[:mouse_button_pressed, 1, 0, 1, 966, 1863] +[:mouse_button_up, 1, 0, 1, 967, 1870] +[:mouse_move, 551, 215, 2, 968, 1907] +[:mouse_move, 544, 216, 2, 969, 1908] +[:mouse_move, 512, 220, 2, 970, 1909] +[:mouse_move, 493, 224, 2, 971, 1910] +[:mouse_move, 447, 239, 2, 972, 1911] +[:mouse_move, 422, 250, 2, 973, 1912] +[:mouse_move, 341, 296, 2, 974, 1913] +[:mouse_move, 325, 309, 2, 975, 1914] +[:mouse_move, 233, 390, 2, 976, 1915] +[:mouse_move, 199, 428, 2, 977, 1916] +[:mouse_move, 138, 510, 2, 978, 1917] +[:mouse_move, 126, 530, 2, 979, 1918] +[:mouse_move, 100, 577, 2, 980, 1919] +[:mouse_move, 95, 586, 2, 981, 1920] +[:mouse_move, 86, 604, 2, 982, 1921] +[:mouse_move, 83, 611, 2, 983, 1922] +[:mouse_move, 79, 618, 2, 984, 1923] +[:mouse_move, 78, 620, 2, 985, 1935] +[:mouse_move, 74, 626, 2, 986, 1936] +[:mouse_move, 68, 633, 2, 987, 1937] +[:mouse_move, 55, 651, 2, 988, 1938] +[:mouse_move, 47, 662, 2, 989, 1939] +[:mouse_move, 34, 679, 2, 990, 1940] +[:mouse_move, 27, 688, 2, 991, 1941] +[:mouse_move, 20, 697, 2, 992, 1942] +[:mouse_move, 16, 701, 2, 993, 1943] +[:mouse_move, 12, 705, 2, 994, 1944] +[:mouse_move, 11, 706, 2, 995, 1945] +[:mouse_move, 9, 707, 2, 996, 1946] +[:mouse_move, 8, 707, 2, 997, 1947] +[:mouse_move, 7, 707, 2, 998, 1948] +[:mouse_move, 7, 706, 2, 999, 1949] +[:mouse_move, 6, 706, 2, 1000, 1953] +[:mouse_move, 7, 706, 2, 1001, 1968] +[:mouse_move, 10, 706, 2, 1002, 1969] +[:mouse_move, 11, 706, 2, 1003, 1970] +[:mouse_move, 14, 706, 2, 1004, 1971] +[:mouse_move, 15, 706, 2, 1005, 1972] +[:mouse_move, 18, 705, 2, 1006, 1973] +[:mouse_move, 20, 705, 2, 1007, 1974] +[:mouse_move, 22, 705, 2, 1008, 1975] +[:mouse_move, 23, 705, 2, 1009, 1976] +[:mouse_move, 25, 705, 2, 1010, 1977] +[:mouse_move, 26, 705, 2, 1011, 1979] +[:mouse_move, 27, 705, 2, 1012, 1980] +[:mouse_move, 29, 705, 2, 1013, 1981] +[:mouse_move, 31, 705, 2, 1014, 1983] +[:mouse_move, 32, 705, 2, 1015, 1984] +[:mouse_move, 33, 705, 2, 1016, 1985] +[:mouse_move, 35, 704, 2, 1017, 1987] +[:mouse_move, 36, 704, 2, 1018, 1989] +[:mouse_move, 37, 704, 2, 1019, 1990] +[:mouse_move, 38, 704, 2, 1020, 1991] +[:mouse_move, 39, 704, 2, 1021, 1992] +[:mouse_move, 40, 704, 2, 1022, 1993] +[:mouse_move, 41, 704, 2, 1023, 1994] +[:mouse_move, 42, 704, 2, 1024, 1995] +[:mouse_move, 43, 704, 2, 1025, 1996] +[:mouse_move, 44, 704, 2, 1026, 1997] +[:mouse_move, 45, 704, 2, 1027, 1999] +[:mouse_move, 46, 704, 2, 1028, 2000] +[:mouse_move, 47, 704, 2, 1029, 2002] +[:mouse_move, 48, 704, 2, 1030, 2003] +[:mouse_move, 49, 704, 2, 1031, 2004] +[:mouse_move, 50, 703, 2, 1032, 2006] +[:mouse_move, 51, 703, 2, 1033, 2009] +[:mouse_move, 52, 703, 2, 1034, 2012] +[:mouse_move, 54, 700, 2, 1035, 2041] +[:mouse_move, 62, 691, 2, 1036, 2042] +[:mouse_move, 72, 678, 2, 1037, 2043] +[:mouse_move, 101, 641, 2, 1038, 2044] +[:mouse_move, 136, 589, 2, 1039, 2045] +[:mouse_move, 224, 445, 2, 1040, 2046] +[:mouse_move, 275, 356, 2, 1041, 2047] +[:mouse_move, 351, 237, 2, 1042, 2048] +[:mouse_move, 372, 211, 2, 1043, 2049] +[:mouse_move, 418, 157, 2, 1044, 2050] +[:mouse_move, 426, 150, 2, 1045, 2051] +[:mouse_move, 444, 133, 2, 1046, 2052] +[:mouse_move, 452, 126, 2, 1047, 2053] +[:mouse_move, 459, 120, 2, 1048, 2054] +[:mouse_move, 461, 119, 2, 1049, 2055] +[:mouse_move, 464, 118, 2, 1050, 2056] +[:mouse_move, 465, 118, 2, 1051, 2057] +[:mouse_move, 468, 117, 2, 1052, 2058] +[:mouse_move, 470, 116, 2, 1053, 2059] +[:mouse_move, 472, 115, 2, 1054, 2060] +[:mouse_move, 473, 115, 2, 1055, 2061] +[:mouse_move, 475, 114, 2, 1056, 2062] +[:mouse_move, 476, 114, 2, 1057, 2063] +[:mouse_move, 479, 111, 2, 1058, 2064] +[:mouse_move, 481, 110, 2, 1059, 2065] +[:mouse_move, 487, 101, 2, 1060, 2066] +[:mouse_move, 488, 97, 2, 1061, 2067] +[:mouse_move, 495, 87, 2, 1062, 2068] +[:mouse_move, 496, 85, 2, 1063, 2069] +[:mouse_move, 497, 80, 2, 1064, 2070] +[:mouse_move, 501, 70, 2, 1065, 2071] +[:mouse_move, 501, 68, 2, 1066, 2072] +[:mouse_move, 502, 63, 2, 1067, 2073] +[:mouse_move, 502, 61, 2, 1068, 2074] +[:mouse_move, 502, 58, 2, 1069, 2075] +[:mouse_move, 502, 57, 2, 1070, 2076] +[:mouse_move, 502, 55, 2, 1071, 2077] +[:mouse_move, 501, 55, 2, 1072, 2078] +[:mouse_move, 501, 53, 2, 1073, 2079] +[:mouse_move, 501, 52, 2, 1074, 2081] +[:mouse_move, 501, 51, 2, 1075, 2082] +[:mouse_move, 501, 50, 2, 1076, 2083] +[:mouse_move, 502, 49, 2, 1077, 2084] +[:mouse_move, 503, 47, 2, 1078, 2085] +[:mouse_move, 505, 46, 2, 1079, 2086] +[:mouse_move, 509, 43, 2, 1080, 2087] +[:mouse_move, 512, 42, 2, 1081, 2088] +[:mouse_move, 519, 40, 2, 1082, 2089] +[:mouse_move, 528, 39, 2, 1083, 2090] +[:mouse_move, 545, 38, 2, 1084, 2091] +[:mouse_move, 555, 38, 2, 1085, 2092] +[:mouse_move, 571, 37, 2, 1086, 2093] +[:mouse_move, 582, 37, 2, 1087, 2094] +[:mouse_move, 603, 35, 2, 1088, 2095] +[:mouse_move, 612, 34, 2, 1089, 2096] +[:mouse_move, 621, 33, 2, 1090, 2097] +[:mouse_move, 636, 33, 2, 1091, 2098] +[:mouse_move, 644, 32, 2, 1092, 2099] +[:mouse_move, 659, 32, 2, 1093, 2100] +[:mouse_move, 665, 32, 2, 1094, 2101] +[:mouse_move, 679, 32, 2, 1095, 2102] +[:mouse_move, 686, 33, 2, 1096, 2103] +[:mouse_move, 696, 34, 2, 1097, 2104] +[:mouse_move, 701, 34, 2, 1098, 2105] +[:mouse_move, 710, 34, 2, 1099, 2106] +[:mouse_move, 714, 34, 2, 1100, 2107] +[:mouse_move, 722, 35, 2, 1101, 2108] +[:mouse_move, 726, 35, 2, 1102, 2109] +[:mouse_move, 735, 36, 2, 1103, 2110] +[:mouse_move, 740, 36, 2, 1104, 2111] +[:mouse_move, 749, 36, 2, 1105, 2112] +[:mouse_move, 753, 36, 2, 1106, 2113] +[:mouse_move, 762, 36, 2, 1107, 2114] +[:mouse_move, 767, 36, 2, 1108, 2115] +[:mouse_move, 775, 36, 2, 1109, 2116] +[:mouse_move, 777, 36, 2, 1110, 2117] +[:mouse_move, 784, 36, 2, 1111, 2118] +[:mouse_move, 787, 36, 2, 1112, 2119] +[:mouse_move, 789, 35, 2, 1113, 2120] +[:mouse_move, 790, 35, 2, 1114, 2121] +[:mouse_move, 791, 35, 2, 1115, 2122] +[:mouse_move, 787, 36, 2, 1116, 2165] +[:mouse_move, 776, 43, 2, 1117, 2166] +[:mouse_move, 771, 47, 2, 1118, 2167] +[:mouse_move, 759, 55, 2, 1119, 2168] +[:mouse_move, 746, 63, 2, 1120, 2169] +[:mouse_move, 719, 79, 2, 1121, 2170] +[:mouse_move, 706, 85, 2, 1122, 2171] +[:mouse_move, 675, 98, 2, 1123, 2172] +[:mouse_move, 669, 100, 2, 1124, 2173] +[:mouse_move, 650, 105, 2, 1125, 2174] +[:mouse_move, 647, 105, 2, 1126, 2175] +[:mouse_move, 637, 107, 2, 1127, 2176] +[:mouse_move, 633, 108, 2, 1128, 2177] +[:mouse_move, 630, 108, 2, 1129, 2178] +[:mouse_move, 626, 108, 2, 1130, 2179] +[:mouse_move, 625, 108, 2, 1131, 2180] +[:mouse_move, 624, 108, 2, 1132, 2181] +[:mouse_move, 623, 108, 2, 1133, 2183] +[:mouse_button_pressed, 1, 0, 1, 1134, 2222] +[:mouse_button_up, 1, 0, 1, 1135, 2228] +[:mouse_move, 614, 115, 2, 1136, 2245] +[:mouse_move, 608, 120, 2, 1137, 2246] +[:mouse_move, 588, 140, 2, 1138, 2247] +[:mouse_move, 571, 158, 2, 1139, 2248] +[:mouse_move, 514, 226, 2, 1140, 2249] +[:mouse_move, 487, 263, 2, 1141, 2250] +[:mouse_move, 427, 346, 2, 1142, 2251] +[:mouse_move, 393, 389, 2, 1143, 2252] +[:mouse_move, 349, 437, 2, 1144, 2253] +[:mouse_move, 337, 448, 2, 1145, 2254] +[:mouse_move, 309, 472, 2, 1146, 2255] +[:mouse_move, 305, 475, 2, 1147, 2256] +[:mouse_move, 302, 476, 2, 1148, 2267] +[:mouse_move, 289, 483, 2, 1149, 2268] +[:mouse_move, 280, 489, 2, 1150, 2269] +[:mouse_move, 247, 512, 2, 1151, 2270] +[:mouse_move, 223, 529, 2, 1152, 2271] +[:mouse_move, 171, 573, 2, 1153, 2272] +[:mouse_move, 160, 583, 2, 1154, 2273] +[:mouse_move, 116, 616, 2, 1155, 2274] +[:mouse_move, 109, 621, 2, 1156, 2275] +[:mouse_move, 85, 637, 2, 1157, 2276] +[:mouse_move, 75, 643, 2, 1158, 2277] +[:mouse_move, 62, 651, 2, 1159, 2278] +[:mouse_move, 58, 654, 2, 1160, 2279] +[:mouse_move, 50, 659, 2, 1161, 2280] +[:mouse_move, 46, 662, 2, 1162, 2281] +[:mouse_move, 37, 667, 2, 1163, 2282] +[:mouse_move, 36, 668, 2, 1164, 2283] +[:mouse_move, 26, 673, 2, 1165, 2284] +[:mouse_move, 23, 675, 2, 1166, 2285] +[:mouse_move, 16, 678, 2, 1167, 2286] +[:mouse_move, 13, 681, 2, 1168, 2287] +[:mouse_move, 7, 686, 2, 1169, 2288] +[:mouse_move, 7, 687, 2, 1170, 2289] +[:mouse_move, 5, 689, 2, 1171, 2290] +[:mouse_move, 3, 694, 2, 1172, 2291] +[:mouse_move, 2, 696, 2, 1173, 2292] +[:mouse_move, 2, 698, 2, 1174, 2293] +[:mouse_move, 1, 699, 2, 1175, 2294] +[:mouse_move, 1, 701, 2, 1176, 2295] +[:mouse_move, 1, 702, 2, 1177, 2297] +[:mouse_move, 2, 703, 2, 1178, 2301] +[:mouse_move, 3, 703, 2, 1179, 2304] +[:mouse_move, 4, 702, 2, 1180, 2305] +[:mouse_move, 6, 700, 2, 1181, 2306] +[:mouse_move, 13, 694, 2, 1182, 2307] +[:mouse_move, 18, 691, 2, 1183, 2308] +[:mouse_move, 30, 682, 2, 1184, 2309] +[:mouse_move, 63, 661, 2, 1185, 2310] +[:mouse_move, 133, 611, 2, 1186, 2311] +[:mouse_move, 171, 579, 2, 1187, 2312] +[:mouse_move, 261, 490, 2, 1188, 2313] +[:mouse_move, 311, 440, 2, 1189, 2314] +[:mouse_move, 364, 387, 2, 1190, 2315] +[:mouse_move, 467, 291, 2, 1191, 2316] +[:mouse_move, 486, 276, 2, 1192, 2317] +[:mouse_move, 513, 255, 2, 1193, 2318] +[:mouse_move, 537, 236, 2, 1194, 2319] +[:mouse_move, 558, 218, 2, 1195, 2320] +[:mouse_move, 566, 212, 2, 1196, 2321] +[:mouse_move, 573, 205, 2, 1197, 2322] +[:mouse_move, 575, 204, 2, 1198, 2323] +[:mouse_move, 576, 203, 2, 1199, 2324] +[:mouse_move, 576, 202, 2, 1200, 2328] +[:mouse_move, 576, 201, 2, 1201, 2329] +[:mouse_move, 577, 198, 2, 1202, 2330] +[:mouse_move, 578, 194, 2, 1203, 2331] +[:mouse_move, 580, 185, 2, 1204, 2332] +[:mouse_move, 581, 181, 2, 1205, 2333] +[:mouse_move, 583, 174, 2, 1206, 2334] +[:mouse_move, 584, 171, 2, 1207, 2335] +[:mouse_move, 585, 166, 2, 1208, 2336] +[:mouse_move, 585, 164, 2, 1209, 2337] +[:mouse_move, 586, 162, 2, 1210, 2338] +[:mouse_move, 586, 161, 2, 1211, 2339] +[:mouse_move, 586, 160, 2, 1212, 2341] +[:mouse_button_pressed, 1, 0, 1, 1213, 2346] +[:mouse_button_up, 1, 0, 1, 1214, 2352] +[:mouse_move, 584, 162, 2, 1215, 2371] +[:mouse_move, 578, 171, 2, 1216, 2372] +[:mouse_move, 569, 185, 2, 1217, 2373] +[:mouse_move, 533, 235, 2, 1218, 2374] +[:mouse_move, 510, 265, 2, 1219, 2375] +[:mouse_move, 441, 337, 2, 1220, 2376] +[:mouse_move, 397, 381, 2, 1221, 2377] +[:mouse_move, 299, 465, 2, 1222, 2378] +[:mouse_move, 254, 505, 2, 1223, 2379] +[:mouse_move, 195, 555, 2, 1224, 2380] +[:mouse_move, 183, 564, 2, 1225, 2381] +[:mouse_move, 155, 587, 2, 1226, 2382] +[:mouse_move, 140, 598, 2, 1227, 2383] +[:mouse_move, 121, 610, 2, 1228, 2384] +[:mouse_move, 120, 611, 2, 1229, 2385] +[:mouse_move, 113, 615, 2, 1230, 2386] +[:mouse_move, 104, 624, 2, 1231, 2399] +[:mouse_move, 97, 630, 2, 1232, 2400] +[:mouse_move, 81, 643, 2, 1233, 2401] +[:mouse_move, 73, 649, 2, 1234, 2402] +[:mouse_move, 59, 662, 2, 1235, 2403] +[:mouse_move, 49, 669, 2, 1236, 2404] +[:mouse_move, 40, 677, 2, 1237, 2405] +[:mouse_move, 34, 681, 2, 1238, 2406] +[:mouse_move, 28, 686, 2, 1239, 2407] +[:mouse_move, 26, 687, 2, 1240, 2408] +[:mouse_move, 24, 689, 2, 1241, 2409] +[:mouse_move, 23, 689, 2, 1242, 2410] +[:mouse_move, 22, 689, 2, 1243, 2411] +[:mouse_move, 22, 690, 2, 1244, 2415] +[:mouse_move, 21, 690, 2, 1245, 2418] +[:mouse_move, 19, 693, 2, 1246, 2419] +[:mouse_move, 18, 694, 2, 1247, 2420] +[:mouse_move, 15, 697, 2, 1248, 2421] +[:mouse_move, 13, 699, 2, 1249, 2422] +[:mouse_move, 10, 701, 2, 1250, 2423] +[:mouse_move, 9, 702, 2, 1251, 2424] +[:mouse_move, 8, 703, 2, 1252, 2425] +[:mouse_move, 7, 704, 2, 1253, 2426] +[:mouse_move, 6, 704, 2, 1254, 2428] +[:mouse_move, 7, 705, 2, 1255, 2432] +[:mouse_move, 8, 705, 2, 1256, 2435] +[:mouse_move, 12, 705, 2, 1257, 2436] +[:mouse_move, 14, 705, 2, 1258, 2437] +[:mouse_move, 21, 705, 2, 1259, 2438] +[:mouse_move, 26, 705, 2, 1260, 2439] +[:mouse_move, 31, 704, 2, 1261, 2440] +[:mouse_move, 35, 703, 2, 1262, 2441] +[:mouse_move, 43, 702, 2, 1263, 2442] +[:mouse_move, 45, 702, 2, 1264, 2443] +[:mouse_move, 50, 701, 2, 1265, 2444] +[:mouse_move, 51, 700, 2, 1266, 2445] +[:mouse_move, 54, 700, 2, 1267, 2446] +[:mouse_move, 55, 700, 2, 1268, 2448] +[:mouse_move, 56, 700, 2, 1269, 2453] +[:mouse_move, 63, 698, 2, 1270, 2461] +[:mouse_move, 75, 693, 2, 1271, 2462] +[:mouse_move, 124, 667, 2, 1272, 2463] +[:mouse_move, 159, 645, 2, 1273, 2464] +[:mouse_move, 308, 537, 2, 1274, 2465] +[:mouse_move, 379, 478, 2, 1275, 2466] +[:mouse_move, 482, 386, 2, 1276, 2467] +[:mouse_move, 507, 363, 2, 1277, 2468] +[:mouse_move, 571, 310, 2, 1278, 2469] +[:mouse_move, 582, 302, 2, 1279, 2470] +[:mouse_move, 604, 284, 2, 1280, 2471] +[:mouse_move, 614, 276, 2, 1281, 2472] +[:mouse_move, 621, 269, 2, 1282, 2473] +[:mouse_move, 623, 267, 2, 1283, 2474] +[:mouse_move, 624, 266, 2, 1284, 2475] +[:mouse_move, 624, 265, 2, 1285, 2476] +[:mouse_move, 624, 264, 2, 1286, 2477] +[:mouse_move, 624, 263, 2, 1287, 2479] +[:mouse_move, 624, 262, 2, 1288, 2481] +[:mouse_move, 624, 261, 2, 1289, 2482] +[:mouse_move, 624, 260, 2, 1290, 2483] +[:mouse_move, 624, 256, 2, 1291, 2484] +[:mouse_move, 624, 253, 2, 1292, 2485] +[:mouse_move, 624, 246, 2, 1293, 2486] +[:mouse_move, 625, 244, 2, 1294, 2487] +[:mouse_move, 625, 239, 2, 1295, 2488] +[:mouse_move, 626, 236, 2, 1296, 2489] +[:mouse_move, 626, 232, 2, 1297, 2490] +[:mouse_move, 626, 231, 2, 1298, 2491] +[:mouse_move, 626, 228, 2, 1299, 2492] +[:mouse_move, 626, 227, 2, 1300, 2493] +[:mouse_move, 626, 226, 2, 1301, 2495] +[:mouse_move, 626, 225, 2, 1302, 2496] +[:mouse_move, 626, 224, 2, 1303, 2505] +[:mouse_button_pressed, 1, 0, 1, 1304, 2509] +[:mouse_button_up, 1, 0, 1, 1305, 2515] +[:mouse_move, 624, 224, 2, 1306, 2521] +[:mouse_move, 621, 227, 2, 1307, 2522] +[:mouse_move, 602, 243, 2, 1308, 2523] +[:mouse_move, 575, 266, 2, 1309, 2524] +[:mouse_move, 519, 327, 2, 1310, 2525] +[:mouse_move, 484, 365, 2, 1311, 2526] +[:mouse_move, 434, 415, 2, 1312, 2527] +[:mouse_move, 402, 444, 2, 1313, 2528] +[:mouse_move, 348, 490, 2, 1314, 2529] +[:mouse_move, 323, 511, 2, 1315, 2530] +[:mouse_move, 296, 535, 2, 1316, 2531] +[:mouse_move, 280, 552, 2, 1317, 2532] +[:mouse_move, 266, 566, 2, 1318, 2533] +[:mouse_move, 242, 590, 2, 1319, 2534] +[:mouse_move, 237, 594, 2, 1320, 2535] +[:mouse_move, 219, 610, 2, 1321, 2536] +[:mouse_move, 210, 616, 2, 1322, 2537] +[:mouse_move, 196, 627, 2, 1323, 2538] +[:mouse_move, 183, 634, 2, 1324, 2539] +[:mouse_move, 166, 639, 2, 1325, 2540] +[:mouse_move, 162, 640, 2, 1326, 2541] +[:mouse_move, 142, 646, 2, 1327, 2542] +[:mouse_move, 134, 649, 2, 1328, 2543] +[:mouse_move, 124, 653, 2, 1329, 2544] +[:mouse_move, 120, 654, 2, 1330, 2545] +[:mouse_move, 115, 656, 2, 1331, 2546] +[:mouse_move, 114, 656, 2, 1332, 2547] +[:mouse_move, 118, 655, 2, 1333, 2548] +[:mouse_move, 123, 652, 2, 1334, 2549] +[:mouse_move, 132, 648, 2, 1335, 2550] +[:mouse_move, 134, 646, 2, 1336, 2551] +[:mouse_move, 141, 644, 2, 1337, 2552] +[:mouse_move, 143, 643, 2, 1338, 2553] +[:mouse_move, 145, 642, 2, 1339, 2554] +[:mouse_move, 146, 641, 2, 1340, 2555] +[:mouse_move, 149, 639, 2, 1341, 2556] +[:mouse_move, 152, 635, 2, 1342, 2557] +[:mouse_move, 169, 614, 2, 1343, 2558] +[:mouse_move, 194, 585, 2, 1344, 2559] +[:mouse_move, 220, 559, 2, 1345, 2560] +[:mouse_move, 298, 486, 2, 1346, 2561] +[:mouse_move, 349, 442, 2, 1347, 2562] +[:mouse_move, 458, 347, 2, 1348, 2563] +[:mouse_move, 480, 326, 2, 1349, 2564] +[:mouse_move, 533, 277, 2, 1350, 2565] +[:mouse_move, 558, 253, 2, 1351, 2566] +[:mouse_move, 579, 232, 2, 1352, 2567] +[:mouse_move, 582, 229, 2, 1353, 2568] +[:mouse_move, 595, 215, 2, 1354, 2569] +[:mouse_move, 598, 211, 2, 1355, 2570] +[:mouse_move, 602, 206, 2, 1356, 2571] +[:mouse_move, 603, 204, 2, 1357, 2572] +[:mouse_move, 606, 199, 2, 1358, 2573] +[:mouse_move, 607, 196, 2, 1359, 2574] +[:mouse_move, 611, 191, 2, 1360, 2575] +[:mouse_move, 612, 190, 2, 1361, 2576] +[:mouse_move, 615, 185, 2, 1362, 2577] +[:mouse_move, 616, 184, 2, 1363, 2578] +[:mouse_move, 618, 182, 2, 1364, 2579] +[:mouse_move, 618, 181, 2, 1365, 2580] +[:mouse_move, 619, 180, 2, 1366, 2581] +[:mouse_move, 619, 183, 2, 1367, 2592] +[:mouse_move, 620, 184, 2, 1368, 2593] +[:mouse_move, 620, 187, 2, 1369, 2594] +[:mouse_move, 621, 189, 2, 1370, 2596] +[:mouse_move, 621, 190, 2, 1371, 2597] +[:mouse_move, 621, 191, 2, 1372, 2598] +[:mouse_move, 621, 192, 2, 1373, 2600] +[:mouse_move, 622, 192, 2, 1374, 2601] +[:mouse_move, 622, 193, 2, 1375, 2602] +[:mouse_move, 622, 194, 2, 1376, 2604] +[:mouse_move, 622, 195, 2, 1377, 2611] +[:mouse_move, 614, 203, 2, 1378, 2613] +[:mouse_move, 603, 212, 2, 1379, 2614] +[:mouse_move, 571, 240, 2, 1380, 2615] +[:mouse_move, 548, 261, 2, 1381, 2616] +[:mouse_move, 464, 335, 2, 1382, 2617] +[:mouse_move, 422, 371, 2, 1383, 2618] +[:mouse_move, 320, 457, 2, 1384, 2619] +[:mouse_move, 269, 501, 2, 1385, 2620] +[:mouse_move, 175, 591, 2, 1386, 2621] +[:mouse_move, 158, 608, 2, 1387, 2622] +[:mouse_move, 121, 644, 2, 1388, 2623] +[:mouse_move, 113, 651, 2, 1389, 2624] +[:mouse_move, 95, 669, 2, 1390, 2625] +[:mouse_move, 87, 677, 2, 1391, 2626] +[:mouse_move, 79, 685, 2, 1392, 2627] +[:mouse_move, 76, 687, 2, 1393, 2628] +[:mouse_move, 74, 689, 2, 1394, 2629] +[:mouse_move, 73, 690, 2, 1395, 2630] +[:mouse_move, 71, 691, 2, 1396, 2631] +[:mouse_move, 70, 692, 2, 1397, 2632] +[:mouse_move, 66, 695, 2, 1398, 2633] +[:mouse_move, 64, 696, 2, 1399, 2634] +[:mouse_move, 60, 699, 2, 1400, 2635] +[:mouse_move, 56, 702, 2, 1401, 2636] +[:mouse_move, 51, 706, 2, 1402, 2637] +[:mouse_move, 48, 709, 2, 1403, 2638] +[:mouse_move, 45, 712, 2, 1404, 2639] +[:mouse_move, 43, 713, 2, 1405, 2640] +[:mouse_move, 41, 715, 2, 1406, 2641] +[:mouse_move, 37, 716, 2, 1407, 2642] +[:mouse_move, 35, 717, 2, 1408, 2643] +[:mouse_move, 31, 717, 2, 1409, 2644] +[:mouse_move, 30, 717, 2, 1410, 2645] +[:mouse_move, 25, 716, 2, 1411, 2646] +[:mouse_move, 24, 716, 2, 1412, 2647] +[:mouse_move, 21, 715, 2, 1413, 2648] +[:mouse_move, 20, 715, 2, 1414, 2649] +[:mouse_move, 19, 715, 2, 1415, 2650] +[:mouse_move, 18, 715, 2, 1416, 2651] +[:mouse_move, 18, 714, 2, 1417, 2652] +[:mouse_move, 20, 713, 2, 1418, 2664] +[:mouse_move, 23, 712, 2, 1419, 2665] +[:mouse_move, 35, 710, 2, 1420, 2666] +[:mouse_move, 39, 709, 2, 1421, 2667] +[:mouse_move, 45, 708, 2, 1422, 2668] +[:mouse_move, 58, 704, 2, 1423, 2669] +[:mouse_move, 63, 703, 2, 1424, 2670] +[:mouse_move, 72, 702, 2, 1425, 2671] +[:mouse_move, 76, 701, 2, 1426, 2672] +[:mouse_move, 82, 701, 2, 1427, 2673] +[:mouse_move, 85, 701, 2, 1428, 2674] +[:mouse_move, 89, 701, 2, 1429, 2675] +[:mouse_move, 91, 701, 2, 1430, 2676] +[:mouse_move, 93, 701, 2, 1431, 2677] +[:mouse_move, 94, 701, 2, 1432, 2678] +[:mouse_move, 95, 701, 2, 1433, 2679] +[:mouse_move, 95, 700, 2, 1434, 2725] +[:mouse_move, 95, 699, 2, 1435, 2726] +[:mouse_move, 98, 694, 2, 1436, 2727] +[:mouse_move, 99, 691, 2, 1437, 2728] +[:mouse_move, 105, 675, 2, 1438, 2729] +[:mouse_move, 108, 666, 2, 1439, 2730] +[:mouse_move, 113, 650, 2, 1440, 2731] +[:mouse_move, 116, 642, 2, 1441, 2732] +[:mouse_move, 118, 633, 2, 1442, 2733] +[:mouse_move, 120, 628, 2, 1443, 2734] +[:mouse_move, 121, 625, 2, 1444, 2735] +[:key_down_raw, 1073742051, 1024, 2, 1445, 2866] +[:key_down_raw, 113, 1024, 2, 1446, 2866] diff --git a/samples/06_save_load/10_save_load_game/app/main.rb b/samples/06_save_load/10_save_load_game/app/main.rb deleted file mode 100644 index 251848a..0000000 --- a/samples/06_save_load/10_save_load_game/app/main.rb +++ /dev/null @@ -1,389 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - 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. - - In this sample app, we're using symbols for our buttons. We have buttons that - light fires, save, load, etc. Each of these buttons has a distinct symbol like - :light_fire, :save_game, :load_game, etc. - - - to_sym: Returns the symbol corresponding to the given string; creates the symbol - if it does not already exist. - For example, - 'car'.to_sym - would return the symbol :car. - - - last: Returns the last element of an array. - - Reminders: - - - num1.lesser(num2): finds the lower value of the given options. - For example, in the statement - a = 4.lesser(3) - 3 has a lower value than 4, which means that the value of a would be set to 3, - but if the statement had been - a = 4.lesser(5) - 4 has a lower value than 5, which means that the value of a would be set to 4. - - - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. - For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 - - - 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.outputs.labels: An array. Values generate a label. - Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] - For more information, go to mygame/documentation/02-labels.md. - - - ARRAY#inside_rect?: An array with at least two values is considered a point. An array - with at least four values is considered a rect. The inside_rect? function returns true - or false depending on if the point is inside the rect. - -=end - -# This code allows users to perform different tasks, such as saving and loading the game. -# Users also have options to reset the game and light a fire. - -class TextedBasedGame - - # Contains methods needed for game to run properly. - # Increments tick count by 1 each time it runs (60 times in a single second) - def tick - default - show_intro - state.engine_tick_count += 1 - tick_fire - end - - # Sets default values. - # The ||= ensures that a variable's value is only set to the value following the = sign - # if the value has not already been set before. Intialization happens only in the first frame. - def default - state.engine_tick_count ||= 0 - state.active_module ||= :room - state.fire_progress ||= 0 - state.fire_ready_in ||= 10 - state.previous_fire ||= :dead - state.fire ||= :dead - end - - def show_intro - return unless state.engine_tick_count == 0 # return unless the game just started - set_story_line "awake." # calls set_story_line method, sets to "awake" - end - - # Sets story line. - def set_story_line story_line - state.story_line = story_line # story line set to value of parameter - state.active_module = :alert # active module set to alert - end - - # Clears story line. - def clear_storyline - state.active_module = :none # active module set to none - state.story_line = nil # story line is cleared, set to nil (or empty) - end - - # Determines fire progress (how close the fire is to being ready to light). - def tick_fire - return if state.active_module == :alert # return if active module is alert - state.fire_progress += 1 # increment fire progress - # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. - state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) - end - - # Sets the value of fire (whether it is dead or roaring), and the story line - def light_fire - return unless fire_ready? # returns unless the fire is ready to be lit - state.fire = :roaring # fire is lit, set to roaring - state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit - if state.fire != state.previous_fire - set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation - state.previous_fire = state.fire - end - end - - # Checks if the fire is ready to be lit. Returns a boolean value. - def fire_ready? - # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), - # the fire is ready to be lit. - state.fire_progress == state.fire_ready_in - end - - # Divides the value of the fire_progress variable by 10 to determine how close the user is to - # being able to light a fire. - def light_fire_progress - state.fire_progress.fdiv(10) # float division - end - - # Defines fire as the state.fire variable. - def fire - state.fire - end - - # Sets the title of the room. - def room_title - return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead - return "a room that is lit" # room is lit if the fire is not dead - end - - # Sets the active_module to room. - def go_to_room - state.active_module = :room - end - - # Defines active_module as the state.active_module variable. - def active_module - state.active_module - end - - # Defines story_line as the state.story_line variable. - def story_line - state.story_line - end - - # Update every 60 frames (or every second) - def should_tick? - state.tick_count.mod_zero?(60) - end - - # Sets the value of the game state provider. - def initialize game_state_provider - @game_state_provider = game_state_provider - end - - # Defines the game state. - # Any variable prefixed with an @ symbol is an instance variable. - def state - @game_state_provider.state - end - - # Saves the state of the game in a text file called game_state.txt. - def save - $gtk.serialize_state('game_state.txt', state) - end - - # Loads the game state from the game_state.txt text file. - # If the load is unsuccessful, the user is informed since the story line indicates the failure. - def load - parsed_state = $gtk.deserialize_state('game_state.txt') - if !parsed_state - set_story_line "no game to load. press save first." - else - $gtk.args.state = parsed_state - end - end - - # Resets the game. - def reset - $gtk.reset - end -end - -class TextedBasedGamePresenter - attr_accessor :state, :outputs, :inputs - - # Creates empty collection called highlights. - # Calls methods necessary to run the game. - def tick - state.layout.highlights ||= [] - game.tick if game.should_tick? - render - process_input - end - - # Outputs a label of the tick count (passage of time) and calls all render methods. - def render - outputs.labels << [10, 30, state.tick_count] - render_alert - render_room - render_highlights - end - - # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. - def render_alert - return unless game.active_module == :alert - - outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label - outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line - end - - def render_room - return unless game.active_module == :room - outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen - - # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value - # that positions it 60 pixels lower than the previous output. - - # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) - outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) - outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button - outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button - outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button - outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen - end - - # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. - def render_highlights - state.layout.highlights.each do |h| # for each highlight in the collection - h.lifetime -= 1 # decrease the value of its lifetime - end - - outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection - [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight - # transparency changes; divide lifetime by max_lifetime, multiply result by 255 - end - - # reject highlights from collection that have no remaining lifetime - state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } - end - - # Checks whether or not a button was clicked. - # Returns a boolean value. - def process_input - button = button_clicked? # calls button_clicked? method - end - - # Returns a boolean value. - # Finds the button that was clicked from the button list and determines what method to call. - # Adds a highlight to the highlights collection. - def button_clicked? - return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click - button = @button_list.find do |k, v| # goes through button_list to find button clicked - click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? - end - return unless button # return unless a button was clicked - method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) - if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) - border = button[1][:primitives].last # sets border definition using value of last key in button list hash - - # declares each highlight as a new entity, sets properties - state.layout.highlights << state.new_entity(:highlight) do |h| - h.x = border.x - h.y = border.y - h.w = border.w - h.h = border.h - h.max_lifetime = 10 - h.lifetime = h.max_lifetime - h.color = [120, 120, 180] # sets color to shade of purple - end - - self.send method_to_call # invoke method identified by symbol - else # otherwise, if self doesn't respond to given method - border = button[1][:primitives].last # sets border definition using value of last key in hash - - # declares each highlight as a new entity, sets properties - state.layout.highlights << state.new_entity(:highlight) do |h| - h.x = border.x - h.y = border.y - h.w = border.w - h.h = border.h - h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true - h.lifetime = h.max_lifetime - h.color = [120, 80, 80] # sets color to dark color - end - - # instructions for users on how to add the missing method_to_call to the code - puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" - puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." - puts "" - puts "```" - puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" - puts "" - puts " def #{method_to_call}" - puts " puts 'Yay that worked!'" - puts " end" - puts "" - puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." - puts "```" - puts "" - end - end - - # Returns the position of the mouse when it is clicked. - def click_pos - return nil unless inputs.mouse.click # returns nil unless the mouse was clicked - return inputs.mouse.click.point # returns location of mouse click (coordinates) - end - - # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) - def button id, x, y, text - @button_list[id] ||= { # assigns values to hash keys - id: id, - text: text, - primitives: [ - [x + 10, y + 30, text, 2, 0].label, # positions label inside border - [x, y, 300, 50].border, # sets definition of border - ] - } - - @button_list[id][:primitives] # returns label and border for buttons - end - - # Creates a progress bar (used for lighting the fire) and sets its values. - def progress_bar id, x, y, text, percentage - @button_list[id] = { # assigns values to hash keys - id: id, - text: text, - primitives: [ - [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) - [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border - [x, y, 300, 50].border, # sets definition of border - ] - } - - # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by - # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. - @button_list[id][:primitives][0][2] = 300 * percentage - @button_list[id][:primitives] - end - - # Defines the game. - def game - @game - end - - # Initalizes the game and creates an empty list of buttons. - def initialize - @game = TextedBasedGame.new self - @button_list ||= {} - end - - # Clears the storyline and takes the user to the room. - def alert_dismiss_clicked - game.clear_storyline - game.go_to_room - end - - # Lights the fire when the user clicks the "light fire" option. - def light_fire_clicked - game.light_fire - end - - # Saves the game when the user clicks the "save" option. - def save_game_clicked - game.save - end - - # Resets the game when the user clicks the "reset" option. - def reset_game_clicked - game.reset - end - - # Loads the game when the user clicks the "load" option. - def load_game_clicked - game.load - end -end - -$text_based_rpg = TextedBasedGamePresenter.new - -def tick args - $text_based_rpg.state = args.state - $text_based_rpg.outputs = args.outputs - $text_based_rpg.inputs = args.inputs - $text_based_rpg.tick -end diff --git a/samples/06_save_load/10_save_load_game/license-for-sample.txt b/samples/06_save_load/10_save_load_game/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/06_save_load/10_save_load_game/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/06_save_load/10_save_load_game/replay.txt b/samples/06_save_load/10_save_load_game/replay.txt deleted file mode 100644 index c243f28..0000000 --- a/samples/06_save_load/10_save_load_game/replay.txt +++ /dev/null @@ -1,1450 +0,0 @@ -replay_version 2.0 -stopped_at 2867 -seed 100 -recorded_at Sun Sep 29 22:25:40 2019 -[:mouse_move, 175, 437, 2, 1, 96] -[:mouse_move, 181, 437, 2, 2, 97] -[:mouse_move, 198, 437, 2, 3, 98] -[:mouse_move, 210, 438, 2, 4, 99] -[:mouse_move, 255, 440, 2, 5, 100] -[:mouse_move, 266, 441, 2, 6, 101] -[:mouse_move, 303, 442, 2, 7, 102] -[:mouse_move, 310, 443, 2, 8, 103] -[:mouse_move, 326, 444, 2, 9, 104] -[:mouse_move, 332, 445, 2, 10, 105] -[:mouse_move, 342, 445, 2, 11, 106] -[:mouse_move, 345, 445, 2, 12, 107] -[:mouse_move, 350, 445, 2, 13, 108] -[:mouse_move, 354, 445, 2, 14, 109] -[:mouse_move, 359, 445, 2, 15, 110] -[:mouse_move, 363, 443, 2, 16, 111] -[:mouse_move, 371, 439, 2, 17, 112] -[:mouse_move, 386, 431, 2, 18, 113] -[:mouse_move, 394, 425, 2, 19, 114] -[:mouse_move, 406, 417, 2, 20, 115] -[:mouse_move, 413, 411, 2, 21, 116] -[:mouse_move, 426, 398, 2, 22, 117] -[:mouse_move, 431, 391, 2, 23, 118] -[:mouse_move, 436, 378, 2, 24, 119] -[:mouse_move, 436, 369, 2, 25, 120] -[:mouse_move, 436, 368, 2, 26, 153] -[:mouse_move, 435, 368, 2, 27, 155] -[:mouse_move, 436, 368, 2, 28, 172] -[:mouse_move, 437, 368, 2, 29, 177] -[:mouse_move, 438, 367, 2, 30, 179] -[:mouse_move, 440, 366, 2, 31, 180] -[:mouse_move, 449, 362, 2, 32, 181] -[:mouse_move, 457, 359, 2, 33, 182] -[:mouse_move, 495, 348, 2, 34, 183] -[:mouse_move, 537, 341, 2, 35, 184] -[:mouse_move, 587, 334, 2, 36, 185] -[:mouse_move, 602, 333, 2, 37, 186] -[:mouse_move, 638, 329, 2, 38, 187] -[:mouse_move, 644, 328, 2, 39, 188] -[:mouse_move, 665, 326, 2, 40, 189] -[:mouse_move, 671, 326, 2, 41, 190] -[:mouse_move, 676, 325, 2, 42, 191] -[:mouse_move, 677, 325, 2, 43, 192] -[:mouse_move, 678, 325, 2, 44, 193] -[:mouse_move, 677, 324, 2, 45, 196] -[:mouse_move, 675, 323, 2, 46, 197] -[:mouse_move, 671, 321, 2, 47, 198] -[:mouse_move, 667, 320, 2, 48, 199] -[:mouse_move, 664, 320, 2, 49, 200] -[:mouse_move, 661, 320, 2, 50, 201] -[:mouse_move, 656, 319, 2, 51, 202] -[:mouse_move, 654, 319, 2, 52, 203] -[:mouse_move, 652, 319, 2, 53, 204] -[:mouse_move, 651, 319, 2, 54, 206] -[:mouse_button_pressed, 1, 0, 1, 55, 220] -[:mouse_button_up, 1, 0, 1, 56, 227] -[:mouse_move, 651, 320, 2, 57, 259] -[:mouse_move, 648, 321, 2, 58, 331] -[:mouse_move, 643, 323, 2, 59, 332] -[:mouse_move, 597, 339, 2, 60, 333] -[:mouse_move, 526, 366, 2, 61, 334] -[:mouse_move, 380, 433, 2, 62, 335] -[:mouse_move, 272, 486, 2, 63, 336] -[:mouse_move, 242, 499, 2, 64, 337] -[:mouse_move, 188, 520, 2, 65, 338] -[:mouse_move, 177, 527, 2, 66, 351] -[:mouse_move, 162, 537, 2, 67, 352] -[:mouse_move, 96, 582, 2, 68, 353] -[:mouse_move, 78, 594, 2, 69, 354] -[:mouse_move, 32, 630, 2, 70, 355] -[:mouse_move, 24, 637, 2, 71, 356] -[:mouse_move, 7, 652, 2, 72, 357] -[:mouse_move, 0, 664, 2, 73, 358] -[:mouse_move, 0, 702, 2, 74, 374] -[:mouse_move, 1, 702, 2, 75, 375] -[:mouse_move, 3, 703, 2, 76, 375] -[:mouse_move, 5, 704, 2, 77, 376] -[:mouse_move, 8, 705, 2, 78, 377] -[:mouse_move, 11, 705, 2, 79, 378] -[:mouse_move, 13, 706, 2, 80, 379] -[:mouse_move, 16, 707, 2, 81, 380] -[:mouse_move, 18, 707, 2, 82, 381] -[:mouse_move, 22, 708, 2, 83, 382] -[:mouse_move, 24, 708, 2, 84, 383] -[:mouse_move, 26, 708, 2, 85, 384] -[:mouse_move, 28, 708, 2, 86, 384] -[:mouse_move, 30, 708, 2, 87, 385] -[:mouse_move, 31, 708, 2, 88, 386] -[:mouse_move, 34, 708, 2, 89, 386] -[:mouse_move, 35, 707, 2, 90, 387] -[:mouse_move, 37, 706, 2, 91, 388] -[:mouse_move, 39, 705, 2, 92, 388] -[:mouse_move, 40, 705, 2, 93, 389] -[:mouse_move, 42, 704, 2, 94, 390] -[:mouse_move, 43, 703, 2, 95, 390] -[:mouse_move, 45, 701, 2, 96, 391] -[:mouse_move, 45, 700, 2, 97, 392] -[:mouse_move, 47, 698, 2, 98, 392] -[:mouse_move, 47, 696, 2, 99, 393] -[:mouse_move, 48, 694, 2, 100, 394] -[:mouse_move, 48, 691, 2, 101, 394] -[:mouse_move, 48, 689, 2, 102, 395] -[:mouse_move, 47, 688, 2, 103, 396] -[:mouse_move, 46, 686, 2, 104, 396] -[:mouse_move, 45, 684, 2, 105, 397] -[:mouse_move, 44, 683, 2, 106, 398] -[:mouse_move, 42, 682, 2, 107, 398] -[:mouse_move, 41, 681, 2, 108, 399] -[:mouse_move, 39, 681, 2, 109, 400] -[:mouse_move, 35, 681, 2, 110, 401] -[:mouse_move, 34, 681, 2, 111, 402] -[:mouse_move, 32, 681, 2, 112, 402] -[:mouse_move, 30, 681, 2, 113, 403] -[:mouse_move, 28, 681, 2, 114, 404] -[:mouse_move, 26, 681, 2, 115, 404] -[:mouse_move, 24, 681, 2, 116, 405] -[:mouse_move, 20, 682, 2, 117, 406] -[:mouse_move, 17, 683, 2, 118, 407] -[:mouse_move, 16, 684, 2, 119, 408] -[:mouse_move, 14, 685, 2, 120, 409] -[:mouse_move, 13, 685, 2, 121, 410] -[:mouse_move, 13, 686, 2, 122, 411] -[:mouse_move, 12, 686, 2, 123, 411] -[:mouse_move, 12, 687, 2, 124, 412] -[:mouse_move, 12, 688, 2, 125, 413] -[:mouse_move, 12, 691, 2, 126, 415] -[:mouse_move, 12, 694, 2, 127, 416] -[:mouse_move, 12, 697, 2, 128, 417] -[:mouse_move, 15, 700, 2, 129, 417] -[:mouse_move, 16, 702, 2, 130, 418] -[:mouse_move, 18, 704, 2, 131, 419] -[:mouse_move, 20, 707, 2, 132, 419] -[:mouse_move, 22, 708, 2, 133, 420] -[:mouse_move, 24, 709, 2, 134, 421] -[:mouse_move, 26, 710, 2, 135, 421] -[:mouse_move, 28, 710, 2, 136, 422] -[:mouse_move, 29, 710, 2, 137, 423] -[:mouse_move, 31, 710, 2, 138, 423] -[:mouse_move, 32, 710, 2, 139, 424] -[:mouse_move, 33, 710, 2, 140, 425] -[:mouse_move, 34, 709, 2, 141, 425] -[:mouse_move, 35, 708, 2, 142, 426] -[:mouse_move, 36, 707, 2, 143, 427] -[:mouse_move, 38, 706, 2, 144, 427] -[:mouse_move, 39, 705, 2, 145, 428] -[:mouse_move, 40, 704, 2, 146, 429] -[:mouse_move, 41, 703, 2, 147, 429] -[:mouse_move, 41, 701, 2, 148, 430] -[:mouse_move, 42, 700, 2, 149, 431] -[:mouse_move, 42, 696, 2, 150, 432] -[:mouse_move, 42, 693, 2, 151, 433] -[:mouse_move, 39, 689, 2, 152, 434] -[:mouse_move, 38, 688, 2, 153, 435] -[:mouse_move, 34, 685, 2, 154, 436] -[:mouse_move, 31, 683, 2, 155, 437] -[:mouse_move, 26, 683, 2, 156, 438] -[:mouse_move, 23, 682, 2, 157, 439] -[:mouse_move, 21, 682, 2, 158, 440] -[:mouse_move, 19, 682, 2, 159, 440] -[:mouse_move, 16, 682, 2, 160, 441] -[:mouse_move, 14, 682, 2, 161, 442] -[:mouse_move, 12, 682, 2, 162, 442] -[:mouse_move, 10, 682, 2, 163, 443] -[:mouse_move, 9, 682, 2, 164, 444] -[:mouse_move, 8, 682, 2, 165, 444] -[:mouse_move, 7, 682, 2, 166, 445] -[:mouse_move, 6, 683, 2, 167, 446] -[:mouse_move, 5, 683, 2, 168, 446] -[:mouse_move, 4, 684, 2, 169, 447] -[:mouse_move, 4, 685, 2, 170, 448] -[:mouse_move, 4, 686, 2, 171, 449] -[:mouse_move, 4, 688, 2, 172, 450] -[:mouse_move, 4, 689, 2, 173, 450] -[:mouse_move, 4, 690, 2, 174, 451] -[:mouse_move, 4, 692, 2, 175, 452] -[:mouse_move, 4, 695, 2, 176, 453] -[:mouse_move, 4, 696, 2, 177, 454] -[:mouse_move, 4, 697, 2, 178, 454] -[:mouse_move, 4, 698, 2, 179, 456] -[:mouse_move, 5, 699, 2, 180, 457] -[:mouse_move, 7, 700, 2, 181, 458] -[:mouse_move, 8, 700, 2, 182, 458] -[:mouse_move, 11, 701, 2, 183, 459] -[:mouse_move, 13, 701, 2, 184, 460] -[:mouse_move, 19, 702, 2, 185, 461] -[:mouse_move, 22, 702, 2, 186, 462] -[:mouse_move, 28, 702, 2, 187, 463] -[:mouse_move, 30, 702, 2, 188, 464] -[:mouse_move, 34, 702, 2, 189, 465] -[:mouse_move, 36, 701, 2, 190, 466] -[:mouse_move, 38, 700, 2, 191, 467] -[:mouse_move, 39, 699, 2, 192, 468] -[:mouse_move, 40, 699, 2, 193, 469] -[:mouse_move, 40, 698, 2, 194, 469] -[:mouse_move, 41, 696, 2, 195, 470] -[:mouse_move, 41, 692, 2, 196, 471] -[:mouse_move, 41, 690, 2, 197, 472] -[:mouse_move, 41, 688, 2, 198, 473] -[:mouse_move, 41, 686, 2, 199, 473] -[:mouse_move, 40, 684, 2, 200, 474] -[:mouse_move, 39, 682, 2, 201, 475] -[:mouse_move, 38, 681, 2, 202, 475] -[:mouse_move, 36, 680, 2, 203, 476] -[:mouse_move, 34, 679, 2, 204, 477] -[:mouse_move, 32, 679, 2, 205, 477] -[:mouse_move, 30, 679, 2, 206, 478] -[:mouse_move, 28, 679, 2, 207, 479] -[:mouse_move, 26, 679, 2, 208, 479] -[:mouse_move, 24, 679, 2, 209, 480] -[:mouse_move, 23, 679, 2, 210, 481] -[:mouse_move, 21, 679, 2, 211, 481] -[:mouse_move, 19, 679, 2, 212, 482] -[:mouse_move, 18, 679, 2, 213, 483] -[:mouse_move, 17, 680, 2, 214, 483] -[:mouse_move, 16, 681, 2, 215, 484] -[:mouse_move, 15, 682, 2, 216, 485] -[:mouse_move, 13, 684, 2, 217, 486] -[:mouse_move, 12, 686, 2, 218, 487] -[:mouse_move, 11, 688, 2, 219, 488] -[:mouse_move, 11, 689, 2, 220, 489] -[:mouse_move, 11, 690, 2, 221, 490] -[:mouse_move, 11, 693, 2, 222, 491] -[:mouse_move, 11, 696, 2, 223, 492] -[:mouse_move, 11, 699, 2, 224, 493] -[:mouse_move, 13, 702, 2, 225, 494] -[:mouse_move, 13, 704, 2, 226, 495] -[:mouse_move, 17, 707, 2, 227, 496] -[:mouse_move, 20, 708, 2, 228, 497] -[:mouse_move, 25, 709, 2, 229, 498] -[:mouse_move, 29, 709, 2, 230, 499] -[:mouse_move, 32, 709, 2, 231, 500] -[:mouse_move, 35, 708, 2, 232, 500] -[:mouse_move, 36, 708, 2, 233, 501] -[:mouse_move, 38, 706, 2, 234, 502] -[:mouse_move, 41, 706, 2, 235, 502] -[:mouse_move, 42, 704, 2, 236, 503] -[:mouse_move, 43, 703, 2, 237, 504] -[:mouse_move, 44, 702, 2, 238, 504] -[:mouse_move, 45, 701, 2, 239, 505] -[:mouse_move, 45, 699, 2, 240, 506] -[:mouse_move, 45, 697, 2, 241, 506] -[:mouse_move, 45, 695, 2, 242, 507] -[:mouse_move, 45, 693, 2, 243, 508] -[:mouse_move, 45, 691, 2, 244, 508] -[:mouse_move, 43, 689, 2, 245, 509] -[:mouse_move, 42, 687, 2, 246, 510] -[:mouse_move, 41, 685, 2, 247, 510] -[:mouse_move, 38, 682, 2, 248, 511] -[:mouse_move, 36, 681, 2, 249, 512] -[:mouse_move, 31, 679, 2, 250, 513] -[:mouse_move, 28, 679, 2, 251, 514] -[:mouse_move, 23, 679, 2, 252, 515] -[:mouse_move, 21, 679, 2, 253, 516] -[:mouse_move, 17, 681, 2, 254, 517] -[:mouse_move, 16, 681, 2, 255, 518] -[:mouse_move, 14, 683, 2, 256, 519] -[:mouse_move, 13, 683, 2, 257, 520] -[:mouse_move, 13, 684, 2, 258, 521] -[:mouse_move, 13, 685, 2, 259, 521] -[:mouse_move, 12, 685, 2, 260, 522] -[:mouse_move, 12, 689, 2, 261, 523] -[:mouse_move, 12, 691, 2, 262, 524] -[:mouse_move, 12, 692, 2, 263, 525] -[:mouse_move, 12, 694, 2, 264, 525] -[:mouse_move, 12, 696, 2, 265, 526] -[:mouse_move, 12, 699, 2, 266, 527] -[:mouse_move, 12, 700, 2, 267, 529] -[:mouse_move, 12, 701, 2, 268, 529] -[:mouse_move, 12, 702, 2, 269, 530] -[:mouse_move, 13, 702, 2, 270, 531] -[:mouse_move, 14, 703, 2, 271, 531] -[:mouse_move, 17, 703, 2, 272, 532] -[:mouse_move, 19, 704, 2, 273, 533] -[:mouse_move, 22, 704, 2, 274, 534] -[:mouse_move, 27, 705, 2, 275, 535] -[:mouse_move, 32, 705, 2, 276, 536] -[:mouse_move, 35, 705, 2, 277, 537] -[:mouse_move, 36, 705, 2, 278, 537] -[:mouse_move, 39, 705, 2, 279, 538] -[:mouse_move, 41, 704, 2, 280, 539] -[:mouse_move, 42, 703, 2, 281, 539] -[:mouse_move, 44, 703, 2, 282, 540] -[:mouse_move, 45, 702, 2, 283, 541] -[:mouse_move, 46, 702, 2, 284, 542] -[:mouse_move, 47, 702, 2, 285, 543] -[:mouse_move, 47, 701, 2, 286, 544] -[:mouse_move, 48, 701, 2, 287, 547] -[:mouse_move, 54, 698, 2, 288, 570] -[:mouse_move, 75, 683, 2, 289, 571] -[:mouse_move, 107, 657, 2, 290, 572] -[:mouse_move, 171, 589, 2, 291, 573] -[:mouse_move, 212, 537, 2, 292, 574] -[:mouse_move, 299, 409, 2, 293, 575] -[:mouse_move, 341, 340, 2, 294, 576] -[:mouse_move, 364, 296, 2, 295, 577] -[:mouse_move, 371, 283, 2, 296, 578] -[:mouse_move, 375, 275, 2, 297, 579] -[:mouse_move, 384, 258, 2, 298, 579] -[:mouse_move, 390, 247, 2, 299, 580] -[:mouse_move, 395, 236, 2, 300, 581] -[:mouse_move, 395, 234, 2, 301, 582] -[:mouse_move, 396, 234, 2, 302, 583] -[:mouse_move, 396, 233, 2, 303, 583] -[:mouse_move, 395, 232, 2, 304, 584] -[:mouse_move, 395, 229, 2, 305, 604] -[:mouse_move, 395, 227, 2, 306, 604] -[:mouse_move, 395, 221, 2, 307, 606] -[:mouse_move, 395, 217, 2, 308, 607] -[:mouse_move, 395, 212, 2, 309, 608] -[:mouse_move, 395, 202, 2, 310, 608] -[:mouse_move, 395, 195, 2, 311, 609] -[:mouse_move, 395, 185, 2, 312, 610] -[:mouse_move, 395, 173, 2, 313, 610] -[:mouse_move, 396, 160, 2, 314, 611] -[:mouse_move, 396, 155, 2, 315, 612] -[:mouse_move, 397, 150, 2, 316, 612] -[:mouse_move, 398, 144, 2, 317, 613] -[:mouse_move, 399, 138, 2, 318, 614] -[:mouse_move, 401, 130, 2, 319, 615] -[:mouse_move, 401, 127, 2, 320, 616] -[:mouse_move, 401, 126, 2, 321, 616] -[:mouse_move, 402, 125, 2, 322, 617] -[:mouse_move, 402, 123, 2, 323, 618] -[:mouse_move, 402, 122, 2, 324, 618] -[:mouse_move, 402, 119, 2, 325, 619] -[:mouse_move, 403, 118, 2, 326, 620] -[:mouse_move, 403, 116, 2, 327, 620] -[:mouse_move, 404, 114, 2, 328, 621] -[:mouse_move, 405, 113, 2, 329, 622] -[:mouse_move, 405, 112, 2, 330, 622] -[:mouse_move, 406, 111, 2, 331, 623] -[:mouse_move, 406, 110, 2, 332, 624] -[:mouse_move, 407, 109, 2, 333, 625] -[:mouse_move, 407, 108, 2, 334, 626] -[:mouse_move, 408, 108, 2, 335, 627] -[:mouse_move, 408, 107, 2, 336, 638] -[:mouse_move, 407, 106, 2, 337, 639] -[:mouse_move, 407, 105, 2, 338, 639] -[:mouse_move, 407, 103, 2, 339, 640] -[:mouse_move, 407, 100, 2, 340, 641] -[:mouse_move, 408, 96, 2, 341, 641] -[:mouse_move, 412, 89, 2, 342, 642] -[:mouse_move, 415, 82, 2, 343, 643] -[:mouse_move, 418, 78, 2, 344, 643] -[:mouse_move, 422, 72, 2, 345, 644] -[:mouse_move, 426, 65, 2, 346, 645] -[:mouse_move, 431, 59, 2, 347, 645] -[:mouse_move, 437, 55, 2, 348, 646] -[:mouse_move, 441, 51, 2, 349, 647] -[:mouse_move, 447, 49, 2, 350, 648] -[:mouse_move, 450, 47, 2, 351, 649] -[:mouse_move, 454, 46, 2, 352, 650] -[:mouse_move, 455, 46, 2, 353, 651] -[:mouse_move, 456, 46, 2, 354, 652] -[:mouse_move, 457, 46, 2, 355, 653] -[:mouse_move, 458, 46, 2, 356, 655] -[:mouse_move, 460, 47, 2, 357, 656] -[:mouse_move, 462, 47, 2, 358, 657] -[:mouse_move, 463, 47, 2, 359, 658] -[:mouse_move, 466, 47, 2, 360, 694] -[:mouse_move, 468, 47, 2, 361, 695] -[:mouse_move, 471, 47, 2, 362, 695] -[:mouse_move, 478, 47, 2, 363, 696] -[:mouse_move, 485, 47, 2, 364, 697] -[:mouse_move, 505, 47, 2, 365, 698] -[:mouse_move, 527, 47, 2, 366, 699] -[:mouse_move, 537, 47, 2, 367, 699] -[:mouse_move, 554, 47, 2, 368, 700] -[:mouse_move, 572, 47, 2, 369, 701] -[:mouse_move, 608, 48, 2, 370, 702] -[:mouse_move, 625, 49, 2, 371, 703] -[:mouse_move, 657, 50, 2, 372, 704] -[:mouse_move, 673, 51, 2, 373, 705] -[:mouse_move, 700, 53, 2, 374, 706] -[:mouse_move, 713, 53, 2, 375, 707] -[:mouse_move, 739, 55, 2, 376, 708] -[:mouse_move, 744, 55, 2, 377, 709] -[:mouse_move, 762, 57, 2, 378, 710] -[:mouse_move, 770, 59, 2, 379, 711] -[:mouse_move, 782, 61, 2, 380, 712] -[:mouse_move, 788, 63, 2, 381, 713] -[:mouse_move, 798, 66, 2, 382, 714] -[:mouse_move, 800, 67, 2, 383, 715] -[:mouse_move, 805, 69, 2, 384, 716] -[:mouse_move, 807, 71, 2, 385, 717] -[:mouse_move, 809, 72, 2, 386, 718] -[:mouse_move, 810, 72, 2, 387, 718] -[:mouse_move, 812, 75, 2, 388, 719] -[:mouse_move, 813, 76, 2, 389, 720] -[:mouse_move, 815, 79, 2, 390, 720] -[:mouse_move, 816, 83, 2, 391, 721] -[:mouse_move, 818, 86, 2, 392, 722] -[:mouse_move, 819, 89, 2, 393, 722] -[:mouse_move, 821, 91, 2, 394, 723] -[:mouse_move, 822, 93, 2, 395, 724] -[:mouse_move, 823, 95, 2, 396, 724] -[:mouse_move, 824, 96, 2, 397, 725] -[:mouse_move, 825, 97, 2, 398, 726] -[:mouse_move, 826, 98, 2, 399, 726] -[:mouse_move, 827, 98, 2, 400, 727] -[:mouse_move, 828, 98, 2, 401, 728] -[:mouse_move, 829, 98, 2, 402, 729] -[:mouse_move, 830, 98, 2, 403, 731] -[:mouse_move, 831, 98, 2, 404, 733] -[:mouse_move, 832, 98, 2, 405, 758] -[:mouse_move, 833, 98, 2, 406, 788] -[:mouse_move, 836, 98, 2, 407, 789] -[:mouse_move, 838, 99, 2, 408, 790] -[:mouse_move, 841, 99, 2, 409, 791] -[:mouse_move, 843, 99, 2, 410, 792] -[:mouse_move, 845, 99, 2, 411, 793] -[:mouse_move, 845, 100, 2, 412, 794] -[:mouse_move, 846, 100, 2, 413, 795] -[:mouse_move, 844, 100, 2, 414, 808] -[:mouse_move, 841, 99, 2, 415, 809] -[:mouse_move, 828, 96, 2, 416, 810] -[:mouse_move, 818, 94, 2, 417, 811] -[:mouse_move, 807, 92, 2, 418, 811] -[:mouse_move, 794, 91, 2, 419, 812] -[:mouse_move, 778, 90, 2, 420, 813] -[:mouse_move, 745, 88, 2, 421, 814] -[:mouse_move, 728, 88, 2, 422, 815] -[:mouse_move, 704, 88, 2, 423, 816] -[:mouse_move, 691, 88, 2, 424, 817] -[:mouse_move, 673, 88, 2, 425, 818] -[:mouse_move, 666, 89, 2, 426, 819] -[:mouse_move, 656, 90, 2, 427, 820] -[:mouse_move, 651, 90, 2, 428, 821] -[:mouse_move, 647, 90, 2, 429, 822] -[:mouse_move, 645, 90, 2, 430, 823] -[:mouse_move, 643, 90, 2, 431, 824] -[:mouse_move, 642, 90, 2, 432, 825] -[:mouse_move, 642, 89, 2, 433, 826] -[:mouse_move, 641, 89, 2, 434, 828] -[:mouse_button_pressed, 1, 0, 1, 435, 841] -[:mouse_button_up, 1, 0, 1, 436, 848] -[:mouse_move, 639, 91, 2, 437, 893] -[:mouse_move, 635, 93, 2, 438, 894] -[:mouse_move, 615, 106, 2, 439, 895] -[:mouse_move, 598, 117, 2, 440, 896] -[:mouse_move, 554, 145, 2, 441, 897] -[:mouse_move, 529, 160, 2, 442, 898] -[:mouse_move, 498, 181, 2, 443, 899] -[:mouse_move, 482, 195, 2, 444, 900] -[:mouse_move, 467, 209, 2, 445, 901] -[:mouse_move, 460, 217, 2, 446, 902] -[:mouse_move, 458, 221, 2, 447, 916] -[:mouse_move, 457, 223, 2, 448, 917] -[:mouse_move, 455, 226, 2, 449, 918] -[:mouse_move, 454, 228, 2, 450, 919] -[:mouse_move, 453, 232, 2, 451, 920] -[:mouse_move, 453, 233, 2, 452, 921] -[:mouse_move, 452, 235, 2, 453, 922] -[:mouse_move, 452, 236, 2, 454, 924] -[:mouse_move, 452, 237, 2, 455, 926] -[:mouse_move, 452, 238, 2, 456, 932] -[:mouse_move, 452, 239, 2, 457, 935] -[:mouse_move, 453, 239, 2, 458, 936] -[:mouse_move, 453, 240, 2, 459, 937] -[:mouse_move, 453, 241, 2, 460, 938] -[:mouse_move, 454, 243, 2, 461, 939] -[:mouse_move, 455, 244, 2, 462, 940] -[:mouse_move, 455, 247, 2, 463, 941] -[:mouse_move, 456, 248, 2, 464, 942] -[:mouse_move, 456, 250, 2, 465, 943] -[:mouse_move, 457, 251, 2, 466, 944] -[:mouse_move, 460, 253, 2, 467, 945] -[:mouse_move, 463, 255, 2, 468, 946] -[:mouse_move, 472, 259, 2, 469, 947] -[:mouse_move, 483, 262, 2, 470, 948] -[:mouse_move, 501, 265, 2, 471, 949] -[:mouse_move, 506, 266, 2, 472, 950] -[:mouse_move, 526, 268, 2, 473, 951] -[:mouse_move, 536, 268, 2, 474, 952] -[:mouse_move, 555, 269, 2, 475, 953] -[:mouse_move, 563, 269, 2, 476, 954] -[:mouse_move, 571, 270, 2, 477, 955] -[:mouse_move, 595, 271, 2, 478, 956] -[:mouse_move, 603, 272, 2, 479, 957] -[:mouse_move, 617, 273, 2, 480, 958] -[:mouse_move, 627, 273, 2, 481, 959] -[:mouse_move, 652, 275, 2, 482, 960] -[:mouse_move, 657, 275, 2, 483, 961] -[:mouse_move, 674, 276, 2, 484, 962] -[:mouse_move, 683, 276, 2, 485, 963] -[:mouse_move, 696, 276, 2, 486, 964] -[:mouse_move, 702, 276, 2, 487, 965] -[:mouse_move, 712, 276, 2, 488, 966] -[:mouse_move, 715, 276, 2, 489, 967] -[:mouse_move, 721, 276, 2, 490, 968] -[:mouse_move, 724, 276, 2, 491, 969] -[:mouse_move, 728, 276, 2, 492, 970] -[:mouse_move, 731, 276, 2, 493, 971] -[:mouse_move, 734, 277, 2, 494, 972] -[:mouse_move, 736, 277, 2, 495, 974] -[:mouse_move, 737, 277, 2, 496, 977] -[:mouse_move, 735, 277, 2, 497, 984] -[:mouse_move, 731, 278, 2, 498, 985] -[:mouse_move, 726, 279, 2, 499, 986] -[:mouse_move, 713, 283, 2, 500, 987] -[:mouse_move, 704, 286, 2, 501, 988] -[:mouse_move, 681, 293, 2, 502, 989] -[:mouse_move, 657, 300, 2, 503, 990] -[:mouse_move, 619, 313, 2, 504, 991] -[:mouse_move, 593, 321, 2, 505, 992] -[:mouse_move, 538, 340, 2, 506, 993] -[:mouse_move, 526, 344, 2, 507, 994] -[:mouse_move, 478, 360, 2, 508, 995] -[:mouse_move, 458, 367, 2, 509, 996] -[:mouse_move, 426, 379, 2, 510, 997] -[:mouse_move, 420, 381, 2, 511, 998] -[:mouse_move, 407, 385, 2, 512, 999] -[:mouse_move, 400, 388, 2, 513, 1000] -[:mouse_move, 392, 391, 2, 514, 1001] -[:mouse_move, 388, 391, 2, 515, 1002] -[:mouse_move, 385, 393, 2, 516, 1003] -[:mouse_move, 384, 393, 2, 517, 1004] -[:mouse_move, 383, 394, 2, 518, 1005] -[:mouse_move, 384, 394, 2, 519, 1007] -[:mouse_move, 387, 394, 2, 520, 1008] -[:mouse_move, 399, 392, 2, 521, 1009] -[:mouse_move, 408, 391, 2, 522, 1010] -[:mouse_move, 418, 389, 2, 523, 1011] -[:mouse_move, 441, 384, 2, 524, 1012] -[:mouse_move, 451, 382, 2, 525, 1013] -[:mouse_move, 475, 378, 2, 526, 1014] -[:mouse_move, 486, 376, 2, 527, 1015] -[:mouse_move, 507, 374, 2, 528, 1016] -[:mouse_move, 519, 373, 2, 529, 1017] -[:mouse_move, 539, 371, 2, 530, 1018] -[:mouse_move, 544, 371, 2, 531, 1019] -[:mouse_move, 567, 369, 2, 532, 1020] -[:mouse_move, 584, 369, 2, 533, 1021] -[:mouse_move, 598, 369, 2, 534, 1022] -[:mouse_move, 607, 368, 2, 535, 1023] -[:mouse_move, 625, 368, 2, 536, 1024] -[:mouse_move, 632, 368, 2, 537, 1025] -[:mouse_move, 645, 368, 2, 538, 1026] -[:mouse_move, 650, 368, 2, 539, 1027] -[:mouse_move, 657, 368, 2, 540, 1028] -[:mouse_move, 661, 368, 2, 541, 1029] -[:mouse_move, 667, 368, 2, 542, 1030] -[:mouse_move, 670, 368, 2, 543, 1031] -[:mouse_move, 674, 368, 2, 544, 1032] -[:mouse_move, 676, 368, 2, 545, 1033] -[:mouse_move, 679, 367, 2, 546, 1034] -[:mouse_move, 680, 367, 2, 547, 1036] -[:mouse_move, 681, 367, 2, 548, 1037] -[:mouse_move, 681, 366, 2, 549, 1040] -[:mouse_move, 675, 360, 2, 550, 1055] -[:mouse_move, 671, 356, 2, 551, 1056] -[:mouse_move, 664, 348, 2, 552, 1057] -[:mouse_move, 659, 344, 2, 553, 1058] -[:mouse_move, 654, 338, 2, 554, 1059] -[:mouse_move, 650, 332, 2, 555, 1060] -[:mouse_move, 644, 327, 2, 556, 1061] -[:mouse_move, 643, 326, 2, 557, 1062] -[:mouse_move, 641, 324, 2, 558, 1063] -[:mouse_move, 638, 321, 2, 559, 1064] -[:mouse_move, 636, 319, 2, 560, 1065] -[:mouse_move, 635, 319, 2, 561, 1066] -[:mouse_move, 635, 318, 2, 562, 1067] -[:mouse_move, 634, 318, 2, 563, 1068] -[:mouse_move, 634, 317, 2, 564, 1069] -[:mouse_button_pressed, 1, 0, 1, 565, 1071] -[:mouse_button_up, 1, 0, 1, 566, 1079] -[:mouse_move, 633, 317, 2, 567, 1099] -[:mouse_move, 633, 318, 2, 568, 1100] -[:mouse_move, 624, 324, 2, 569, 1101] -[:mouse_move, 613, 331, 2, 570, 1102] -[:mouse_move, 579, 351, 2, 571, 1103] -[:mouse_move, 554, 365, 2, 572, 1104] -[:mouse_move, 497, 393, 2, 573, 1105] -[:mouse_move, 469, 404, 2, 574, 1106] -[:mouse_move, 449, 411, 2, 575, 1107] -[:mouse_move, 432, 417, 2, 576, 1108] -[:mouse_move, 419, 421, 2, 577, 1109] -[:mouse_move, 412, 423, 2, 578, 1110] -[:mouse_move, 406, 425, 2, 579, 1111] -[:mouse_move, 405, 425, 2, 580, 1112] -[:mouse_move, 404, 425, 2, 581, 1113] -[:mouse_move, 397, 425, 2, 582, 1203] -[:mouse_move, 388, 428, 2, 583, 1204] -[:mouse_move, 363, 440, 2, 584, 1205] -[:mouse_move, 348, 447, 2, 585, 1206] -[:mouse_move, 289, 487, 2, 586, 1207] -[:mouse_move, 260, 509, 2, 587, 1208] -[:mouse_move, 223, 542, 2, 588, 1209] -[:mouse_move, 203, 561, 2, 589, 1210] -[:mouse_move, 181, 584, 2, 590, 1211] -[:mouse_move, 170, 595, 2, 591, 1212] -[:mouse_move, 155, 613, 2, 592, 1213] -[:mouse_move, 150, 619, 2, 593, 1214] -[:mouse_move, 143, 629, 2, 594, 1215] -[:mouse_move, 139, 633, 2, 595, 1216] -[:mouse_move, 135, 638, 2, 596, 1217] -[:mouse_move, 133, 641, 2, 597, 1218] -[:mouse_move, 126, 646, 2, 598, 1219] -[:mouse_move, 123, 648, 2, 599, 1220] -[:mouse_move, 116, 653, 2, 600, 1221] -[:mouse_move, 112, 656, 2, 601, 1222] -[:mouse_move, 103, 660, 2, 602, 1223] -[:mouse_move, 99, 662, 2, 603, 1224] -[:mouse_move, 88, 665, 2, 604, 1225] -[:mouse_move, 84, 667, 2, 605, 1226] -[:mouse_move, 76, 671, 2, 606, 1227] -[:mouse_move, 72, 673, 2, 607, 1228] -[:mouse_move, 69, 675, 2, 608, 1229] -[:mouse_move, 63, 679, 2, 609, 1230] -[:mouse_move, 60, 682, 2, 610, 1231] -[:mouse_move, 53, 688, 2, 611, 1232] -[:mouse_move, 50, 690, 2, 612, 1233] -[:mouse_move, 46, 693, 2, 613, 1234] -[:mouse_move, 44, 695, 2, 614, 1235] -[:mouse_move, 39, 697, 2, 615, 1236] -[:mouse_move, 37, 699, 2, 616, 1237] -[:mouse_move, 33, 700, 2, 617, 1238] -[:mouse_move, 32, 700, 2, 618, 1239] -[:mouse_move, 28, 701, 2, 619, 1240] -[:mouse_move, 27, 701, 2, 620, 1241] -[:mouse_move, 25, 702, 2, 621, 1242] -[:mouse_move, 24, 702, 2, 622, 1243] -[:mouse_move, 22, 703, 2, 623, 1244] -[:mouse_move, 20, 703, 2, 624, 1245] -[:mouse_move, 18, 704, 2, 625, 1246] -[:mouse_move, 16, 704, 2, 626, 1247] -[:mouse_move, 14, 704, 2, 627, 1248] -[:mouse_move, 13, 704, 2, 628, 1249] -[:mouse_move, 12, 704, 2, 629, 1250] -[:mouse_move, 11, 704, 2, 630, 1251] -[:mouse_move, 10, 704, 2, 631, 1252] -[:mouse_move, 10, 705, 2, 632, 1253] -[:mouse_move, 11, 705, 2, 633, 1261] -[:mouse_move, 12, 705, 2, 634, 1262] -[:mouse_move, 15, 706, 2, 635, 1263] -[:mouse_move, 17, 706, 2, 636, 1264] -[:mouse_move, 20, 707, 2, 637, 1265] -[:mouse_move, 22, 707, 2, 638, 1266] -[:mouse_move, 26, 708, 2, 639, 1267] -[:mouse_move, 27, 708, 2, 640, 1268] -[:mouse_move, 30, 708, 2, 641, 1269] -[:mouse_move, 31, 708, 2, 642, 1270] -[:mouse_move, 33, 708, 2, 643, 1271] -[:mouse_move, 34, 708, 2, 644, 1272] -[:mouse_move, 37, 708, 2, 645, 1273] -[:mouse_move, 38, 708, 2, 646, 1274] -[:mouse_move, 41, 708, 2, 647, 1275] -[:mouse_move, 42, 708, 2, 648, 1276] -[:mouse_move, 44, 708, 2, 649, 1277] -[:mouse_move, 45, 708, 2, 650, 1279] -[:mouse_move, 46, 708, 2, 651, 1280] -[:mouse_move, 53, 702, 2, 652, 1304] -[:mouse_move, 60, 696, 2, 653, 1305] -[:mouse_move, 81, 674, 2, 654, 1306] -[:mouse_move, 107, 646, 2, 655, 1307] -[:mouse_move, 141, 609, 2, 656, 1308] -[:mouse_move, 234, 517, 2, 657, 1309] -[:mouse_move, 288, 465, 2, 658, 1310] -[:mouse_move, 366, 397, 2, 659, 1311] -[:mouse_move, 412, 362, 2, 660, 1312] -[:mouse_move, 464, 328, 2, 661, 1313] -[:mouse_move, 474, 322, 2, 662, 1314] -[:mouse_move, 495, 310, 2, 663, 1315] -[:mouse_move, 504, 304, 2, 664, 1316] -[:mouse_move, 513, 299, 2, 665, 1317] -[:mouse_move, 514, 298, 2, 666, 1318] -[:mouse_move, 515, 297, 2, 667, 1319] -[:mouse_move, 517, 292, 2, 668, 1333] -[:mouse_move, 519, 288, 2, 669, 1334] -[:mouse_move, 524, 275, 2, 670, 1335] -[:mouse_move, 531, 254, 2, 671, 1336] -[:mouse_move, 536, 238, 2, 672, 1337] -[:mouse_move, 546, 209, 2, 673, 1338] -[:mouse_move, 548, 203, 2, 674, 1339] -[:mouse_move, 555, 188, 2, 675, 1340] -[:mouse_move, 557, 181, 2, 676, 1341] -[:mouse_move, 560, 173, 2, 677, 1342] -[:mouse_move, 561, 171, 2, 678, 1343] -[:mouse_move, 562, 169, 2, 679, 1344] -[:mouse_move, 562, 168, 2, 680, 1345] -[:mouse_move, 562, 167, 2, 681, 1346] -[:mouse_move, 562, 166, 2, 682, 1347] -[:mouse_move, 562, 165, 2, 683, 1348] -[:mouse_move, 562, 164, 2, 684, 1350] -[:mouse_move, 562, 163, 2, 685, 1351] -[:mouse_move, 562, 162, 2, 686, 1354] -[:mouse_button_pressed, 1, 0, 1, 687, 1359] -[:mouse_button_up, 1, 0, 1, 688, 1365] -[:mouse_move, 563, 163, 2, 689, 1401] -[:mouse_move, 563, 164, 2, 690, 1402] -[:mouse_move, 564, 165, 2, 691, 1403] -[:mouse_move, 565, 169, 2, 692, 1404] -[:mouse_move, 566, 173, 2, 693, 1405] -[:mouse_move, 566, 179, 2, 694, 1406] -[:mouse_move, 566, 180, 2, 695, 1407] -[:mouse_move, 566, 186, 2, 696, 1408] -[:mouse_move, 565, 188, 2, 697, 1409] -[:mouse_move, 563, 192, 2, 698, 1410] -[:mouse_move, 562, 195, 2, 699, 1411] -[:mouse_move, 561, 198, 2, 700, 1412] -[:mouse_move, 561, 199, 2, 701, 1413] -[:mouse_move, 560, 202, 2, 702, 1414] -[:mouse_move, 560, 205, 2, 703, 1415] -[:mouse_move, 559, 210, 2, 704, 1416] -[:mouse_move, 558, 213, 2, 705, 1417] -[:mouse_move, 558, 215, 2, 706, 1418] -[:mouse_move, 558, 220, 2, 707, 1419] -[:mouse_move, 558, 222, 2, 708, 1420] -[:mouse_move, 558, 224, 2, 709, 1421] -[:mouse_move, 558, 225, 2, 710, 1422] -[:mouse_move, 558, 226, 2, 711, 1423] -[:mouse_move, 558, 225, 2, 712, 1443] -[:mouse_move, 558, 224, 2, 713, 1444] -[:mouse_move, 558, 225, 2, 714, 1451] -[:mouse_move, 558, 229, 2, 715, 1452] -[:mouse_move, 558, 231, 2, 716, 1453] -[:mouse_move, 556, 236, 2, 717, 1454] -[:mouse_move, 556, 238, 2, 718, 1455] -[:mouse_move, 555, 247, 2, 719, 1456] -[:mouse_move, 555, 252, 2, 720, 1457] -[:mouse_move, 555, 261, 2, 721, 1458] -[:mouse_move, 555, 263, 2, 722, 1459] -[:mouse_move, 555, 269, 2, 723, 1460] -[:mouse_move, 556, 272, 2, 724, 1461] -[:mouse_move, 556, 275, 2, 725, 1462] -[:mouse_move, 556, 276, 2, 726, 1464] -[:mouse_move, 556, 277, 2, 727, 1465] -[:mouse_move, 556, 278, 2, 728, 1467] -[:mouse_move, 556, 279, 2, 729, 1471] -[:mouse_move, 556, 281, 2, 730, 1475] -[:mouse_move, 556, 282, 2, 731, 1476] -[:mouse_move, 556, 283, 2, 732, 1477] -[:mouse_move, 556, 285, 2, 733, 1478] -[:mouse_move, 556, 286, 2, 734, 1479] -[:mouse_move, 556, 287, 2, 735, 1482] -[:mouse_move, 556, 286, 2, 736, 1485] -[:mouse_move, 555, 286, 2, 737, 1487] -[:mouse_move, 555, 285, 2, 738, 1488] -[:mouse_move, 556, 282, 2, 739, 1549] -[:mouse_move, 556, 280, 2, 740, 1550] -[:mouse_move, 557, 271, 2, 741, 1551] -[:mouse_move, 557, 268, 2, 742, 1552] -[:mouse_move, 558, 264, 2, 743, 1553] -[:mouse_move, 559, 258, 2, 744, 1554] -[:mouse_move, 559, 256, 2, 745, 1555] -[:mouse_move, 559, 254, 2, 746, 1556] -[:mouse_move, 559, 256, 2, 747, 1559] -[:mouse_move, 560, 261, 2, 748, 1560] -[:mouse_move, 560, 265, 2, 749, 1561] -[:mouse_move, 561, 270, 2, 750, 1562] -[:mouse_move, 562, 273, 2, 751, 1563] -[:mouse_move, 562, 276, 2, 752, 1564] -[:mouse_move, 562, 277, 2, 753, 1565] -[:mouse_move, 562, 278, 2, 754, 1566] -[:mouse_move, 562, 279, 2, 755, 1567] -[:mouse_button_pressed, 1, 0, 1, 756, 1569] -[:mouse_button_up, 1, 0, 1, 757, 1578] -[:mouse_move, 557, 280, 2, 758, 1609] -[:mouse_move, 543, 284, 2, 759, 1610] -[:mouse_move, 532, 285, 2, 760, 1611] -[:mouse_move, 498, 292, 2, 761, 1612] -[:mouse_move, 475, 296, 2, 762, 1613] -[:mouse_move, 425, 304, 2, 763, 1614] -[:mouse_move, 400, 308, 2, 764, 1615] -[:mouse_move, 348, 314, 2, 765, 1616] -[:mouse_move, 337, 316, 2, 766, 1617] -[:mouse_move, 278, 328, 2, 767, 1618] -[:mouse_move, 267, 333, 2, 768, 1619] -[:mouse_move, 228, 348, 2, 769, 1620] -[:mouse_move, 213, 357, 2, 770, 1621] -[:mouse_move, 195, 366, 2, 771, 1622] -[:mouse_move, 192, 368, 2, 772, 1623] -[:mouse_move, 184, 375, 2, 773, 1624] -[:mouse_move, 182, 376, 2, 774, 1625] -[:mouse_move, 181, 379, 2, 775, 1626] -[:mouse_move, 181, 380, 2, 776, 1627] -[:mouse_move, 185, 385, 2, 777, 1628] -[:mouse_move, 187, 386, 2, 778, 1629] -[:mouse_move, 195, 392, 2, 779, 1630] -[:mouse_move, 198, 394, 2, 780, 1631] -[:mouse_move, 210, 396, 2, 781, 1632] -[:mouse_move, 213, 396, 2, 782, 1633] -[:mouse_move, 219, 396, 2, 783, 1634] -[:mouse_move, 231, 395, 2, 784, 1635] -[:mouse_move, 237, 393, 2, 785, 1636] -[:mouse_move, 247, 392, 2, 786, 1637] -[:mouse_move, 252, 392, 2, 787, 1638] -[:mouse_move, 258, 394, 2, 788, 1639] -[:mouse_move, 261, 397, 2, 789, 1640] -[:mouse_move, 263, 428, 2, 790, 1641] -[:mouse_move, 253, 453, 2, 791, 1642] -[:mouse_move, 210, 531, 2, 792, 1643] -[:mouse_move, 196, 553, 2, 793, 1644] -[:mouse_move, 194, 554, 2, 794, 1656] -[:mouse_move, 174, 575, 2, 795, 1657] -[:mouse_move, 162, 587, 2, 796, 1658] -[:mouse_move, 137, 612, 2, 797, 1659] -[:mouse_move, 114, 635, 2, 798, 1660] -[:mouse_move, 86, 665, 2, 799, 1661] -[:mouse_move, 79, 671, 2, 800, 1662] -[:mouse_move, 69, 681, 2, 801, 1663] -[:mouse_move, 52, 698, 2, 802, 1664] -[:mouse_move, 48, 703, 2, 803, 1665] -[:mouse_move, 41, 711, 2, 804, 1666] -[:mouse_move, 39, 715, 2, 805, 1667] -[:mouse_move, 36, 719, 2, 806, 1668] -[:mouse_move, 35, 719, 2, 807, 1669] -[:mouse_move, 20, 719, 2, 808, 1685] -[:mouse_move, 18, 717, 2, 809, 1686] -[:mouse_move, 18, 716, 2, 810, 1687] -[:mouse_move, 16, 715, 2, 811, 1688] -[:mouse_move, 16, 714, 2, 812, 1688] -[:mouse_move, 15, 714, 2, 813, 1689] -[:mouse_move, 15, 713, 2, 814, 1690] -[:mouse_move, 14, 712, 2, 815, 1691] -[:mouse_move, 15, 712, 2, 816, 1697] -[:mouse_move, 17, 712, 2, 817, 1698] -[:mouse_move, 20, 713, 2, 818, 1698] -[:mouse_move, 22, 713, 2, 819, 1699] -[:mouse_move, 25, 713, 2, 820, 1700] -[:mouse_move, 27, 713, 2, 821, 1700] -[:mouse_move, 30, 713, 2, 822, 1701] -[:mouse_move, 32, 713, 2, 823, 1702] -[:mouse_move, 36, 711, 2, 824, 1702] -[:mouse_move, 38, 710, 2, 825, 1703] -[:mouse_move, 41, 708, 2, 826, 1704] -[:mouse_move, 46, 700, 2, 827, 1705] -[:mouse_move, 47, 698, 2, 828, 1706] -[:mouse_move, 50, 691, 2, 829, 1707] -[:mouse_move, 51, 689, 2, 830, 1708] -[:mouse_move, 52, 685, 2, 831, 1709] -[:mouse_move, 52, 683, 2, 832, 1710] -[:mouse_move, 50, 680, 2, 833, 1711] -[:mouse_move, 47, 679, 2, 834, 1712] -[:mouse_move, 39, 675, 2, 835, 1713] -[:mouse_move, 35, 675, 2, 836, 1714] -[:mouse_move, 26, 672, 2, 837, 1715] -[:mouse_move, 23, 671, 2, 838, 1716] -[:mouse_move, 21, 671, 2, 839, 1717] -[:mouse_move, 18, 671, 2, 840, 1717] -[:mouse_move, 15, 671, 2, 841, 1718] -[:mouse_move, 13, 671, 2, 842, 1719] -[:mouse_move, 12, 671, 2, 843, 1719] -[:mouse_move, 10, 671, 2, 844, 1720] -[:mouse_move, 9, 672, 2, 845, 1721] -[:mouse_move, 8, 673, 2, 846, 1721] -[:mouse_move, 7, 676, 2, 847, 1722] -[:mouse_move, 6, 679, 2, 848, 1723] -[:mouse_move, 6, 680, 2, 849, 1723] -[:mouse_move, 6, 683, 2, 850, 1724] -[:mouse_move, 6, 686, 2, 851, 1725] -[:mouse_move, 5, 688, 2, 852, 1725] -[:mouse_move, 5, 690, 2, 853, 1726] -[:mouse_move, 5, 692, 2, 854, 1727] -[:mouse_move, 5, 693, 2, 855, 1727] -[:mouse_move, 6, 696, 2, 856, 1728] -[:mouse_move, 7, 698, 2, 857, 1729] -[:mouse_move, 11, 701, 2, 858, 1730] -[:mouse_move, 13, 702, 2, 859, 1731] -[:mouse_move, 15, 704, 2, 860, 1731] -[:mouse_move, 17, 705, 2, 861, 1732] -[:mouse_move, 21, 707, 2, 862, 1733] -[:mouse_move, 22, 707, 2, 863, 1733] -[:mouse_move, 26, 707, 2, 864, 1734] -[:mouse_move, 28, 707, 2, 865, 1735] -[:mouse_move, 35, 707, 2, 866, 1736] -[:mouse_move, 37, 705, 2, 867, 1737] -[:mouse_move, 41, 702, 2, 868, 1738] -[:mouse_move, 45, 699, 2, 869, 1739] -[:mouse_move, 48, 696, 2, 870, 1740] -[:mouse_move, 49, 695, 2, 871, 1741] -[:mouse_move, 50, 690, 2, 872, 1742] -[:mouse_move, 50, 687, 2, 873, 1743] -[:mouse_move, 50, 684, 2, 874, 1744] -[:mouse_move, 49, 680, 2, 875, 1744] -[:mouse_move, 46, 677, 2, 876, 1745] -[:mouse_move, 42, 674, 2, 877, 1746] -[:mouse_move, 41, 673, 2, 878, 1746] -[:mouse_move, 37, 671, 2, 879, 1747] -[:mouse_move, 34, 669, 2, 880, 1748] -[:mouse_move, 32, 668, 2, 881, 1748] -[:mouse_move, 30, 667, 2, 882, 1749] -[:mouse_move, 28, 666, 2, 883, 1750] -[:mouse_move, 26, 666, 2, 884, 1750] -[:mouse_move, 24, 666, 2, 885, 1751] -[:mouse_move, 20, 666, 2, 886, 1752] -[:mouse_move, 18, 666, 2, 887, 1752] -[:mouse_move, 16, 668, 2, 888, 1753] -[:mouse_move, 14, 668, 2, 889, 1754] -[:mouse_move, 12, 669, 2, 890, 1754] -[:mouse_move, 10, 671, 2, 891, 1755] -[:mouse_move, 9, 672, 2, 892, 1756] -[:mouse_move, 8, 674, 2, 893, 1756] -[:mouse_move, 7, 675, 2, 894, 1757] -[:mouse_move, 6, 675, 2, 895, 1758] -[:mouse_move, 6, 678, 2, 896, 1758] -[:mouse_move, 6, 680, 2, 897, 1759] -[:mouse_move, 6, 683, 2, 898, 1760] -[:mouse_move, 9, 690, 2, 899, 1761] -[:mouse_move, 12, 693, 2, 900, 1762] -[:mouse_move, 19, 699, 2, 901, 1763] -[:mouse_move, 24, 702, 2, 902, 1764] -[:mouse_move, 37, 705, 2, 903, 1765] -[:mouse_move, 45, 705, 2, 904, 1766] -[:mouse_move, 72, 692, 2, 905, 1767] -[:mouse_move, 88, 682, 2, 906, 1768] -[:mouse_move, 129, 649, 2, 907, 1769] -[:mouse_move, 172, 610, 2, 908, 1770] -[:mouse_move, 234, 545, 2, 909, 1771] -[:mouse_move, 267, 507, 2, 910, 1772] -[:mouse_move, 300, 469, 2, 911, 1773] -[:mouse_move, 318, 451, 2, 912, 1773] -[:mouse_move, 349, 415, 2, 913, 1774] -[:mouse_move, 381, 383, 2, 914, 1775] -[:mouse_move, 393, 370, 2, 915, 1775] -[:mouse_move, 414, 345, 2, 916, 1776] -[:mouse_move, 432, 325, 2, 917, 1777] -[:mouse_move, 437, 318, 2, 918, 1777] -[:mouse_move, 447, 305, 2, 919, 1778] -[:mouse_move, 450, 302, 2, 920, 1779] -[:mouse_move, 455, 295, 2, 921, 1779] -[:mouse_move, 459, 290, 2, 922, 1780] -[:mouse_move, 461, 288, 2, 923, 1781] -[:mouse_move, 463, 285, 2, 924, 1781] -[:mouse_move, 465, 284, 2, 925, 1782] -[:mouse_move, 467, 283, 2, 926, 1783] -[:mouse_move, 470, 283, 2, 927, 1783] -[:mouse_move, 472, 283, 2, 928, 1784] -[:mouse_move, 476, 283, 2, 929, 1785] -[:mouse_move, 483, 284, 2, 930, 1786] -[:mouse_move, 485, 286, 2, 931, 1787] -[:mouse_move, 493, 291, 2, 932, 1788] -[:mouse_move, 495, 294, 2, 933, 1789] -[:mouse_move, 500, 300, 2, 934, 1790] -[:mouse_move, 503, 303, 2, 935, 1791] -[:mouse_move, 507, 309, 2, 936, 1792] -[:mouse_move, 509, 311, 2, 937, 1793] -[:mouse_move, 513, 314, 2, 938, 1794] -[:mouse_move, 514, 314, 2, 939, 1795] -[:mouse_move, 516, 314, 2, 940, 1796] -[:mouse_move, 517, 314, 2, 941, 1797] -[:mouse_move, 518, 314, 2, 942, 1798] -[:mouse_move, 519, 314, 2, 943, 1800] -[:mouse_button_pressed, 1, 0, 1, 944, 1801] -[:mouse_button_up, 1, 0, 1, 945, 1808] -[:mouse_move, 519, 312, 2, 946, 1826] -[:mouse_move, 519, 310, 2, 947, 1827] -[:mouse_move, 522, 303, 2, 948, 1828] -[:mouse_move, 523, 298, 2, 949, 1829] -[:mouse_move, 529, 282, 2, 950, 1830] -[:mouse_move, 532, 273, 2, 951, 1831] -[:mouse_move, 541, 252, 2, 952, 1832] -[:mouse_move, 544, 246, 2, 953, 1833] -[:mouse_move, 549, 233, 2, 954, 1834] -[:mouse_move, 552, 225, 2, 955, 1835] -[:mouse_move, 555, 217, 2, 956, 1836] -[:mouse_move, 556, 214, 2, 957, 1837] -[:mouse_move, 557, 211, 2, 958, 1838] -[:mouse_move, 557, 210, 2, 959, 1839] -[:mouse_move, 558, 210, 2, 960, 1841] -[:mouse_move, 558, 211, 2, 961, 1848] -[:mouse_move, 558, 212, 2, 962, 1849] -[:mouse_move, 558, 213, 2, 963, 1850] -[:mouse_move, 558, 214, 2, 964, 1851] -[:mouse_move, 558, 215, 2, 965, 1853] -[:mouse_button_pressed, 1, 0, 1, 966, 1863] -[:mouse_button_up, 1, 0, 1, 967, 1870] -[:mouse_move, 551, 215, 2, 968, 1907] -[:mouse_move, 544, 216, 2, 969, 1908] -[:mouse_move, 512, 220, 2, 970, 1909] -[:mouse_move, 493, 224, 2, 971, 1910] -[:mouse_move, 447, 239, 2, 972, 1911] -[:mouse_move, 422, 250, 2, 973, 1912] -[:mouse_move, 341, 296, 2, 974, 1913] -[:mouse_move, 325, 309, 2, 975, 1914] -[:mouse_move, 233, 390, 2, 976, 1915] -[:mouse_move, 199, 428, 2, 977, 1916] -[:mouse_move, 138, 510, 2, 978, 1917] -[:mouse_move, 126, 530, 2, 979, 1918] -[:mouse_move, 100, 577, 2, 980, 1919] -[:mouse_move, 95, 586, 2, 981, 1920] -[:mouse_move, 86, 604, 2, 982, 1921] -[:mouse_move, 83, 611, 2, 983, 1922] -[:mouse_move, 79, 618, 2, 984, 1923] -[:mouse_move, 78, 620, 2, 985, 1935] -[:mouse_move, 74, 626, 2, 986, 1936] -[:mouse_move, 68, 633, 2, 987, 1937] -[:mouse_move, 55, 651, 2, 988, 1938] -[:mouse_move, 47, 662, 2, 989, 1939] -[:mouse_move, 34, 679, 2, 990, 1940] -[:mouse_move, 27, 688, 2, 991, 1941] -[:mouse_move, 20, 697, 2, 992, 1942] -[:mouse_move, 16, 701, 2, 993, 1943] -[:mouse_move, 12, 705, 2, 994, 1944] -[:mouse_move, 11, 706, 2, 995, 1945] -[:mouse_move, 9, 707, 2, 996, 1946] -[:mouse_move, 8, 707, 2, 997, 1947] -[:mouse_move, 7, 707, 2, 998, 1948] -[:mouse_move, 7, 706, 2, 999, 1949] -[:mouse_move, 6, 706, 2, 1000, 1953] -[:mouse_move, 7, 706, 2, 1001, 1968] -[:mouse_move, 10, 706, 2, 1002, 1969] -[:mouse_move, 11, 706, 2, 1003, 1970] -[:mouse_move, 14, 706, 2, 1004, 1971] -[:mouse_move, 15, 706, 2, 1005, 1972] -[:mouse_move, 18, 705, 2, 1006, 1973] -[:mouse_move, 20, 705, 2, 1007, 1974] -[:mouse_move, 22, 705, 2, 1008, 1975] -[:mouse_move, 23, 705, 2, 1009, 1976] -[:mouse_move, 25, 705, 2, 1010, 1977] -[:mouse_move, 26, 705, 2, 1011, 1979] -[:mouse_move, 27, 705, 2, 1012, 1980] -[:mouse_move, 29, 705, 2, 1013, 1981] -[:mouse_move, 31, 705, 2, 1014, 1983] -[:mouse_move, 32, 705, 2, 1015, 1984] -[:mouse_move, 33, 705, 2, 1016, 1985] -[:mouse_move, 35, 704, 2, 1017, 1987] -[:mouse_move, 36, 704, 2, 1018, 1989] -[:mouse_move, 37, 704, 2, 1019, 1990] -[:mouse_move, 38, 704, 2, 1020, 1991] -[:mouse_move, 39, 704, 2, 1021, 1992] -[:mouse_move, 40, 704, 2, 1022, 1993] -[:mouse_move, 41, 704, 2, 1023, 1994] -[:mouse_move, 42, 704, 2, 1024, 1995] -[:mouse_move, 43, 704, 2, 1025, 1996] -[:mouse_move, 44, 704, 2, 1026, 1997] -[:mouse_move, 45, 704, 2, 1027, 1999] -[:mouse_move, 46, 704, 2, 1028, 2000] -[:mouse_move, 47, 704, 2, 1029, 2002] -[:mouse_move, 48, 704, 2, 1030, 2003] -[:mouse_move, 49, 704, 2, 1031, 2004] -[:mouse_move, 50, 703, 2, 1032, 2006] -[:mouse_move, 51, 703, 2, 1033, 2009] -[:mouse_move, 52, 703, 2, 1034, 2012] -[:mouse_move, 54, 700, 2, 1035, 2041] -[:mouse_move, 62, 691, 2, 1036, 2042] -[:mouse_move, 72, 678, 2, 1037, 2043] -[:mouse_move, 101, 641, 2, 1038, 2044] -[:mouse_move, 136, 589, 2, 1039, 2045] -[:mouse_move, 224, 445, 2, 1040, 2046] -[:mouse_move, 275, 356, 2, 1041, 2047] -[:mouse_move, 351, 237, 2, 1042, 2048] -[:mouse_move, 372, 211, 2, 1043, 2049] -[:mouse_move, 418, 157, 2, 1044, 2050] -[:mouse_move, 426, 150, 2, 1045, 2051] -[:mouse_move, 444, 133, 2, 1046, 2052] -[:mouse_move, 452, 126, 2, 1047, 2053] -[:mouse_move, 459, 120, 2, 1048, 2054] -[:mouse_move, 461, 119, 2, 1049, 2055] -[:mouse_move, 464, 118, 2, 1050, 2056] -[:mouse_move, 465, 118, 2, 1051, 2057] -[:mouse_move, 468, 117, 2, 1052, 2058] -[:mouse_move, 470, 116, 2, 1053, 2059] -[:mouse_move, 472, 115, 2, 1054, 2060] -[:mouse_move, 473, 115, 2, 1055, 2061] -[:mouse_move, 475, 114, 2, 1056, 2062] -[:mouse_move, 476, 114, 2, 1057, 2063] -[:mouse_move, 479, 111, 2, 1058, 2064] -[:mouse_move, 481, 110, 2, 1059, 2065] -[:mouse_move, 487, 101, 2, 1060, 2066] -[:mouse_move, 488, 97, 2, 1061, 2067] -[:mouse_move, 495, 87, 2, 1062, 2068] -[:mouse_move, 496, 85, 2, 1063, 2069] -[:mouse_move, 497, 80, 2, 1064, 2070] -[:mouse_move, 501, 70, 2, 1065, 2071] -[:mouse_move, 501, 68, 2, 1066, 2072] -[:mouse_move, 502, 63, 2, 1067, 2073] -[:mouse_move, 502, 61, 2, 1068, 2074] -[:mouse_move, 502, 58, 2, 1069, 2075] -[:mouse_move, 502, 57, 2, 1070, 2076] -[:mouse_move, 502, 55, 2, 1071, 2077] -[:mouse_move, 501, 55, 2, 1072, 2078] -[:mouse_move, 501, 53, 2, 1073, 2079] -[:mouse_move, 501, 52, 2, 1074, 2081] -[:mouse_move, 501, 51, 2, 1075, 2082] -[:mouse_move, 501, 50, 2, 1076, 2083] -[:mouse_move, 502, 49, 2, 1077, 2084] -[:mouse_move, 503, 47, 2, 1078, 2085] -[:mouse_move, 505, 46, 2, 1079, 2086] -[:mouse_move, 509, 43, 2, 1080, 2087] -[:mouse_move, 512, 42, 2, 1081, 2088] -[:mouse_move, 519, 40, 2, 1082, 2089] -[:mouse_move, 528, 39, 2, 1083, 2090] -[:mouse_move, 545, 38, 2, 1084, 2091] -[:mouse_move, 555, 38, 2, 1085, 2092] -[:mouse_move, 571, 37, 2, 1086, 2093] -[:mouse_move, 582, 37, 2, 1087, 2094] -[:mouse_move, 603, 35, 2, 1088, 2095] -[:mouse_move, 612, 34, 2, 1089, 2096] -[:mouse_move, 621, 33, 2, 1090, 2097] -[:mouse_move, 636, 33, 2, 1091, 2098] -[:mouse_move, 644, 32, 2, 1092, 2099] -[:mouse_move, 659, 32, 2, 1093, 2100] -[:mouse_move, 665, 32, 2, 1094, 2101] -[:mouse_move, 679, 32, 2, 1095, 2102] -[:mouse_move, 686, 33, 2, 1096, 2103] -[:mouse_move, 696, 34, 2, 1097, 2104] -[:mouse_move, 701, 34, 2, 1098, 2105] -[:mouse_move, 710, 34, 2, 1099, 2106] -[:mouse_move, 714, 34, 2, 1100, 2107] -[:mouse_move, 722, 35, 2, 1101, 2108] -[:mouse_move, 726, 35, 2, 1102, 2109] -[:mouse_move, 735, 36, 2, 1103, 2110] -[:mouse_move, 740, 36, 2, 1104, 2111] -[:mouse_move, 749, 36, 2, 1105, 2112] -[:mouse_move, 753, 36, 2, 1106, 2113] -[:mouse_move, 762, 36, 2, 1107, 2114] -[:mouse_move, 767, 36, 2, 1108, 2115] -[:mouse_move, 775, 36, 2, 1109, 2116] -[:mouse_move, 777, 36, 2, 1110, 2117] -[:mouse_move, 784, 36, 2, 1111, 2118] -[:mouse_move, 787, 36, 2, 1112, 2119] -[:mouse_move, 789, 35, 2, 1113, 2120] -[:mouse_move, 790, 35, 2, 1114, 2121] -[:mouse_move, 791, 35, 2, 1115, 2122] -[:mouse_move, 787, 36, 2, 1116, 2165] -[:mouse_move, 776, 43, 2, 1117, 2166] -[:mouse_move, 771, 47, 2, 1118, 2167] -[:mouse_move, 759, 55, 2, 1119, 2168] -[:mouse_move, 746, 63, 2, 1120, 2169] -[:mouse_move, 719, 79, 2, 1121, 2170] -[:mouse_move, 706, 85, 2, 1122, 2171] -[:mouse_move, 675, 98, 2, 1123, 2172] -[:mouse_move, 669, 100, 2, 1124, 2173] -[:mouse_move, 650, 105, 2, 1125, 2174] -[:mouse_move, 647, 105, 2, 1126, 2175] -[:mouse_move, 637, 107, 2, 1127, 2176] -[:mouse_move, 633, 108, 2, 1128, 2177] -[:mouse_move, 630, 108, 2, 1129, 2178] -[:mouse_move, 626, 108, 2, 1130, 2179] -[:mouse_move, 625, 108, 2, 1131, 2180] -[:mouse_move, 624, 108, 2, 1132, 2181] -[:mouse_move, 623, 108, 2, 1133, 2183] -[:mouse_button_pressed, 1, 0, 1, 1134, 2222] -[:mouse_button_up, 1, 0, 1, 1135, 2228] -[:mouse_move, 614, 115, 2, 1136, 2245] -[:mouse_move, 608, 120, 2, 1137, 2246] -[:mouse_move, 588, 140, 2, 1138, 2247] -[:mouse_move, 571, 158, 2, 1139, 2248] -[:mouse_move, 514, 226, 2, 1140, 2249] -[:mouse_move, 487, 263, 2, 1141, 2250] -[:mouse_move, 427, 346, 2, 1142, 2251] -[:mouse_move, 393, 389, 2, 1143, 2252] -[:mouse_move, 349, 437, 2, 1144, 2253] -[:mouse_move, 337, 448, 2, 1145, 2254] -[:mouse_move, 309, 472, 2, 1146, 2255] -[:mouse_move, 305, 475, 2, 1147, 2256] -[:mouse_move, 302, 476, 2, 1148, 2267] -[:mouse_move, 289, 483, 2, 1149, 2268] -[:mouse_move, 280, 489, 2, 1150, 2269] -[:mouse_move, 247, 512, 2, 1151, 2270] -[:mouse_move, 223, 529, 2, 1152, 2271] -[:mouse_move, 171, 573, 2, 1153, 2272] -[:mouse_move, 160, 583, 2, 1154, 2273] -[:mouse_move, 116, 616, 2, 1155, 2274] -[:mouse_move, 109, 621, 2, 1156, 2275] -[:mouse_move, 85, 637, 2, 1157, 2276] -[:mouse_move, 75, 643, 2, 1158, 2277] -[:mouse_move, 62, 651, 2, 1159, 2278] -[:mouse_move, 58, 654, 2, 1160, 2279] -[:mouse_move, 50, 659, 2, 1161, 2280] -[:mouse_move, 46, 662, 2, 1162, 2281] -[:mouse_move, 37, 667, 2, 1163, 2282] -[:mouse_move, 36, 668, 2, 1164, 2283] -[:mouse_move, 26, 673, 2, 1165, 2284] -[:mouse_move, 23, 675, 2, 1166, 2285] -[:mouse_move, 16, 678, 2, 1167, 2286] -[:mouse_move, 13, 681, 2, 1168, 2287] -[:mouse_move, 7, 686, 2, 1169, 2288] -[:mouse_move, 7, 687, 2, 1170, 2289] -[:mouse_move, 5, 689, 2, 1171, 2290] -[:mouse_move, 3, 694, 2, 1172, 2291] -[:mouse_move, 2, 696, 2, 1173, 2292] -[:mouse_move, 2, 698, 2, 1174, 2293] -[:mouse_move, 1, 699, 2, 1175, 2294] -[:mouse_move, 1, 701, 2, 1176, 2295] -[:mouse_move, 1, 702, 2, 1177, 2297] -[:mouse_move, 2, 703, 2, 1178, 2301] -[:mouse_move, 3, 703, 2, 1179, 2304] -[:mouse_move, 4, 702, 2, 1180, 2305] -[:mouse_move, 6, 700, 2, 1181, 2306] -[:mouse_move, 13, 694, 2, 1182, 2307] -[:mouse_move, 18, 691, 2, 1183, 2308] -[:mouse_move, 30, 682, 2, 1184, 2309] -[:mouse_move, 63, 661, 2, 1185, 2310] -[:mouse_move, 133, 611, 2, 1186, 2311] -[:mouse_move, 171, 579, 2, 1187, 2312] -[:mouse_move, 261, 490, 2, 1188, 2313] -[:mouse_move, 311, 440, 2, 1189, 2314] -[:mouse_move, 364, 387, 2, 1190, 2315] -[:mouse_move, 467, 291, 2, 1191, 2316] -[:mouse_move, 486, 276, 2, 1192, 2317] -[:mouse_move, 513, 255, 2, 1193, 2318] -[:mouse_move, 537, 236, 2, 1194, 2319] -[:mouse_move, 558, 218, 2, 1195, 2320] -[:mouse_move, 566, 212, 2, 1196, 2321] -[:mouse_move, 573, 205, 2, 1197, 2322] -[:mouse_move, 575, 204, 2, 1198, 2323] -[:mouse_move, 576, 203, 2, 1199, 2324] -[:mouse_move, 576, 202, 2, 1200, 2328] -[:mouse_move, 576, 201, 2, 1201, 2329] -[:mouse_move, 577, 198, 2, 1202, 2330] -[:mouse_move, 578, 194, 2, 1203, 2331] -[:mouse_move, 580, 185, 2, 1204, 2332] -[:mouse_move, 581, 181, 2, 1205, 2333] -[:mouse_move, 583, 174, 2, 1206, 2334] -[:mouse_move, 584, 171, 2, 1207, 2335] -[:mouse_move, 585, 166, 2, 1208, 2336] -[:mouse_move, 585, 164, 2, 1209, 2337] -[:mouse_move, 586, 162, 2, 1210, 2338] -[:mouse_move, 586, 161, 2, 1211, 2339] -[:mouse_move, 586, 160, 2, 1212, 2341] -[:mouse_button_pressed, 1, 0, 1, 1213, 2346] -[:mouse_button_up, 1, 0, 1, 1214, 2352] -[:mouse_move, 584, 162, 2, 1215, 2371] -[:mouse_move, 578, 171, 2, 1216, 2372] -[:mouse_move, 569, 185, 2, 1217, 2373] -[:mouse_move, 533, 235, 2, 1218, 2374] -[:mouse_move, 510, 265, 2, 1219, 2375] -[:mouse_move, 441, 337, 2, 1220, 2376] -[:mouse_move, 397, 381, 2, 1221, 2377] -[:mouse_move, 299, 465, 2, 1222, 2378] -[:mouse_move, 254, 505, 2, 1223, 2379] -[:mouse_move, 195, 555, 2, 1224, 2380] -[:mouse_move, 183, 564, 2, 1225, 2381] -[:mouse_move, 155, 587, 2, 1226, 2382] -[:mouse_move, 140, 598, 2, 1227, 2383] -[:mouse_move, 121, 610, 2, 1228, 2384] -[:mouse_move, 120, 611, 2, 1229, 2385] -[:mouse_move, 113, 615, 2, 1230, 2386] -[:mouse_move, 104, 624, 2, 1231, 2399] -[:mouse_move, 97, 630, 2, 1232, 2400] -[:mouse_move, 81, 643, 2, 1233, 2401] -[:mouse_move, 73, 649, 2, 1234, 2402] -[:mouse_move, 59, 662, 2, 1235, 2403] -[:mouse_move, 49, 669, 2, 1236, 2404] -[:mouse_move, 40, 677, 2, 1237, 2405] -[:mouse_move, 34, 681, 2, 1238, 2406] -[:mouse_move, 28, 686, 2, 1239, 2407] -[:mouse_move, 26, 687, 2, 1240, 2408] -[:mouse_move, 24, 689, 2, 1241, 2409] -[:mouse_move, 23, 689, 2, 1242, 2410] -[:mouse_move, 22, 689, 2, 1243, 2411] -[:mouse_move, 22, 690, 2, 1244, 2415] -[:mouse_move, 21, 690, 2, 1245, 2418] -[:mouse_move, 19, 693, 2, 1246, 2419] -[:mouse_move, 18, 694, 2, 1247, 2420] -[:mouse_move, 15, 697, 2, 1248, 2421] -[:mouse_move, 13, 699, 2, 1249, 2422] -[:mouse_move, 10, 701, 2, 1250, 2423] -[:mouse_move, 9, 702, 2, 1251, 2424] -[:mouse_move, 8, 703, 2, 1252, 2425] -[:mouse_move, 7, 704, 2, 1253, 2426] -[:mouse_move, 6, 704, 2, 1254, 2428] -[:mouse_move, 7, 705, 2, 1255, 2432] -[:mouse_move, 8, 705, 2, 1256, 2435] -[:mouse_move, 12, 705, 2, 1257, 2436] -[:mouse_move, 14, 705, 2, 1258, 2437] -[:mouse_move, 21, 705, 2, 1259, 2438] -[:mouse_move, 26, 705, 2, 1260, 2439] -[:mouse_move, 31, 704, 2, 1261, 2440] -[:mouse_move, 35, 703, 2, 1262, 2441] -[:mouse_move, 43, 702, 2, 1263, 2442] -[:mouse_move, 45, 702, 2, 1264, 2443] -[:mouse_move, 50, 701, 2, 1265, 2444] -[:mouse_move, 51, 700, 2, 1266, 2445] -[:mouse_move, 54, 700, 2, 1267, 2446] -[:mouse_move, 55, 700, 2, 1268, 2448] -[:mouse_move, 56, 700, 2, 1269, 2453] -[:mouse_move, 63, 698, 2, 1270, 2461] -[:mouse_move, 75, 693, 2, 1271, 2462] -[:mouse_move, 124, 667, 2, 1272, 2463] -[:mouse_move, 159, 645, 2, 1273, 2464] -[:mouse_move, 308, 537, 2, 1274, 2465] -[:mouse_move, 379, 478, 2, 1275, 2466] -[:mouse_move, 482, 386, 2, 1276, 2467] -[:mouse_move, 507, 363, 2, 1277, 2468] -[:mouse_move, 571, 310, 2, 1278, 2469] -[:mouse_move, 582, 302, 2, 1279, 2470] -[:mouse_move, 604, 284, 2, 1280, 2471] -[:mouse_move, 614, 276, 2, 1281, 2472] -[:mouse_move, 621, 269, 2, 1282, 2473] -[:mouse_move, 623, 267, 2, 1283, 2474] -[:mouse_move, 624, 266, 2, 1284, 2475] -[:mouse_move, 624, 265, 2, 1285, 2476] -[:mouse_move, 624, 264, 2, 1286, 2477] -[:mouse_move, 624, 263, 2, 1287, 2479] -[:mouse_move, 624, 262, 2, 1288, 2481] -[:mouse_move, 624, 261, 2, 1289, 2482] -[:mouse_move, 624, 260, 2, 1290, 2483] -[:mouse_move, 624, 256, 2, 1291, 2484] -[:mouse_move, 624, 253, 2, 1292, 2485] -[:mouse_move, 624, 246, 2, 1293, 2486] -[:mouse_move, 625, 244, 2, 1294, 2487] -[:mouse_move, 625, 239, 2, 1295, 2488] -[:mouse_move, 626, 236, 2, 1296, 2489] -[:mouse_move, 626, 232, 2, 1297, 2490] -[:mouse_move, 626, 231, 2, 1298, 2491] -[:mouse_move, 626, 228, 2, 1299, 2492] -[:mouse_move, 626, 227, 2, 1300, 2493] -[:mouse_move, 626, 226, 2, 1301, 2495] -[:mouse_move, 626, 225, 2, 1302, 2496] -[:mouse_move, 626, 224, 2, 1303, 2505] -[:mouse_button_pressed, 1, 0, 1, 1304, 2509] -[:mouse_button_up, 1, 0, 1, 1305, 2515] -[:mouse_move, 624, 224, 2, 1306, 2521] -[:mouse_move, 621, 227, 2, 1307, 2522] -[:mouse_move, 602, 243, 2, 1308, 2523] -[:mouse_move, 575, 266, 2, 1309, 2524] -[:mouse_move, 519, 327, 2, 1310, 2525] -[:mouse_move, 484, 365, 2, 1311, 2526] -[:mouse_move, 434, 415, 2, 1312, 2527] -[:mouse_move, 402, 444, 2, 1313, 2528] -[:mouse_move, 348, 490, 2, 1314, 2529] -[:mouse_move, 323, 511, 2, 1315, 2530] -[:mouse_move, 296, 535, 2, 1316, 2531] -[:mouse_move, 280, 552, 2, 1317, 2532] -[:mouse_move, 266, 566, 2, 1318, 2533] -[:mouse_move, 242, 590, 2, 1319, 2534] -[:mouse_move, 237, 594, 2, 1320, 2535] -[:mouse_move, 219, 610, 2, 1321, 2536] -[:mouse_move, 210, 616, 2, 1322, 2537] -[:mouse_move, 196, 627, 2, 1323, 2538] -[:mouse_move, 183, 634, 2, 1324, 2539] -[:mouse_move, 166, 639, 2, 1325, 2540] -[:mouse_move, 162, 640, 2, 1326, 2541] -[:mouse_move, 142, 646, 2, 1327, 2542] -[:mouse_move, 134, 649, 2, 1328, 2543] -[:mouse_move, 124, 653, 2, 1329, 2544] -[:mouse_move, 120, 654, 2, 1330, 2545] -[:mouse_move, 115, 656, 2, 1331, 2546] -[:mouse_move, 114, 656, 2, 1332, 2547] -[:mouse_move, 118, 655, 2, 1333, 2548] -[:mouse_move, 123, 652, 2, 1334, 2549] -[:mouse_move, 132, 648, 2, 1335, 2550] -[:mouse_move, 134, 646, 2, 1336, 2551] -[:mouse_move, 141, 644, 2, 1337, 2552] -[:mouse_move, 143, 643, 2, 1338, 2553] -[:mouse_move, 145, 642, 2, 1339, 2554] -[:mouse_move, 146, 641, 2, 1340, 2555] -[:mouse_move, 149, 639, 2, 1341, 2556] -[:mouse_move, 152, 635, 2, 1342, 2557] -[:mouse_move, 169, 614, 2, 1343, 2558] -[:mouse_move, 194, 585, 2, 1344, 2559] -[:mouse_move, 220, 559, 2, 1345, 2560] -[:mouse_move, 298, 486, 2, 1346, 2561] -[:mouse_move, 349, 442, 2, 1347, 2562] -[:mouse_move, 458, 347, 2, 1348, 2563] -[:mouse_move, 480, 326, 2, 1349, 2564] -[:mouse_move, 533, 277, 2, 1350, 2565] -[:mouse_move, 558, 253, 2, 1351, 2566] -[:mouse_move, 579, 232, 2, 1352, 2567] -[:mouse_move, 582, 229, 2, 1353, 2568] -[:mouse_move, 595, 215, 2, 1354, 2569] -[:mouse_move, 598, 211, 2, 1355, 2570] -[:mouse_move, 602, 206, 2, 1356, 2571] -[:mouse_move, 603, 204, 2, 1357, 2572] -[:mouse_move, 606, 199, 2, 1358, 2573] -[:mouse_move, 607, 196, 2, 1359, 2574] -[:mouse_move, 611, 191, 2, 1360, 2575] -[:mouse_move, 612, 190, 2, 1361, 2576] -[:mouse_move, 615, 185, 2, 1362, 2577] -[:mouse_move, 616, 184, 2, 1363, 2578] -[:mouse_move, 618, 182, 2, 1364, 2579] -[:mouse_move, 618, 181, 2, 1365, 2580] -[:mouse_move, 619, 180, 2, 1366, 2581] -[:mouse_move, 619, 183, 2, 1367, 2592] -[:mouse_move, 620, 184, 2, 1368, 2593] -[:mouse_move, 620, 187, 2, 1369, 2594] -[:mouse_move, 621, 189, 2, 1370, 2596] -[:mouse_move, 621, 190, 2, 1371, 2597] -[:mouse_move, 621, 191, 2, 1372, 2598] -[:mouse_move, 621, 192, 2, 1373, 2600] -[:mouse_move, 622, 192, 2, 1374, 2601] -[:mouse_move, 622, 193, 2, 1375, 2602] -[:mouse_move, 622, 194, 2, 1376, 2604] -[:mouse_move, 622, 195, 2, 1377, 2611] -[:mouse_move, 614, 203, 2, 1378, 2613] -[:mouse_move, 603, 212, 2, 1379, 2614] -[:mouse_move, 571, 240, 2, 1380, 2615] -[:mouse_move, 548, 261, 2, 1381, 2616] -[:mouse_move, 464, 335, 2, 1382, 2617] -[:mouse_move, 422, 371, 2, 1383, 2618] -[:mouse_move, 320, 457, 2, 1384, 2619] -[:mouse_move, 269, 501, 2, 1385, 2620] -[:mouse_move, 175, 591, 2, 1386, 2621] -[:mouse_move, 158, 608, 2, 1387, 2622] -[:mouse_move, 121, 644, 2, 1388, 2623] -[:mouse_move, 113, 651, 2, 1389, 2624] -[:mouse_move, 95, 669, 2, 1390, 2625] -[:mouse_move, 87, 677, 2, 1391, 2626] -[:mouse_move, 79, 685, 2, 1392, 2627] -[:mouse_move, 76, 687, 2, 1393, 2628] -[:mouse_move, 74, 689, 2, 1394, 2629] -[:mouse_move, 73, 690, 2, 1395, 2630] -[:mouse_move, 71, 691, 2, 1396, 2631] -[:mouse_move, 70, 692, 2, 1397, 2632] -[:mouse_move, 66, 695, 2, 1398, 2633] -[:mouse_move, 64, 696, 2, 1399, 2634] -[:mouse_move, 60, 699, 2, 1400, 2635] -[:mouse_move, 56, 702, 2, 1401, 2636] -[:mouse_move, 51, 706, 2, 1402, 2637] -[:mouse_move, 48, 709, 2, 1403, 2638] -[:mouse_move, 45, 712, 2, 1404, 2639] -[:mouse_move, 43, 713, 2, 1405, 2640] -[:mouse_move, 41, 715, 2, 1406, 2641] -[:mouse_move, 37, 716, 2, 1407, 2642] -[:mouse_move, 35, 717, 2, 1408, 2643] -[:mouse_move, 31, 717, 2, 1409, 2644] -[:mouse_move, 30, 717, 2, 1410, 2645] -[:mouse_move, 25, 716, 2, 1411, 2646] -[:mouse_move, 24, 716, 2, 1412, 2647] -[:mouse_move, 21, 715, 2, 1413, 2648] -[:mouse_move, 20, 715, 2, 1414, 2649] -[:mouse_move, 19, 715, 2, 1415, 2650] -[:mouse_move, 18, 715, 2, 1416, 2651] -[:mouse_move, 18, 714, 2, 1417, 2652] -[:mouse_move, 20, 713, 2, 1418, 2664] -[:mouse_move, 23, 712, 2, 1419, 2665] -[:mouse_move, 35, 710, 2, 1420, 2666] -[:mouse_move, 39, 709, 2, 1421, 2667] -[:mouse_move, 45, 708, 2, 1422, 2668] -[:mouse_move, 58, 704, 2, 1423, 2669] -[:mouse_move, 63, 703, 2, 1424, 2670] -[:mouse_move, 72, 702, 2, 1425, 2671] -[:mouse_move, 76, 701, 2, 1426, 2672] -[:mouse_move, 82, 701, 2, 1427, 2673] -[:mouse_move, 85, 701, 2, 1428, 2674] -[:mouse_move, 89, 701, 2, 1429, 2675] -[:mouse_move, 91, 701, 2, 1430, 2676] -[:mouse_move, 93, 701, 2, 1431, 2677] -[:mouse_move, 94, 701, 2, 1432, 2678] -[:mouse_move, 95, 701, 2, 1433, 2679] -[:mouse_move, 95, 700, 2, 1434, 2725] -[:mouse_move, 95, 699, 2, 1435, 2726] -[:mouse_move, 98, 694, 2, 1436, 2727] -[:mouse_move, 99, 691, 2, 1437, 2728] -[:mouse_move, 105, 675, 2, 1438, 2729] -[:mouse_move, 108, 666, 2, 1439, 2730] -[:mouse_move, 113, 650, 2, 1440, 2731] -[:mouse_move, 116, 642, 2, 1441, 2732] -[:mouse_move, 118, 633, 2, 1442, 2733] -[:mouse_move, 120, 628, 2, 1443, 2734] -[:mouse_move, 121, 625, 2, 1444, 2735] -[:key_down_raw, 1073742051, 1024, 2, 1445, 2866] -[:key_down_raw, 113, 1024, 2, 1446, 2866] diff --git a/samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb b/samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb new file mode 100644 index 0000000..f7e5bac --- /dev/null +++ b/samples/07_advanced_rendering/05_render_primitives_as_hash/app/main.rb @@ -0,0 +1,191 @@ +=begin + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - 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, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.borders: An array. The values generate a border. + The parameters are the same as a solid. + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.lines: An array. The values generate a line. + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] + For more information about labels, go to mygame/documentation/02-labels.md. + +=end + +# This sample app demonstrates how hashes can be used to output different kinds of objects. + +def tick args + args.state.angle ||= 0 # initializes angle to 0 + args.state.angle += 1 # increments angle by 1 every frame (60 times a second) + + # Outputs sprite using a hash + args.outputs.sprites << { + x: 30, # sprite position + y: 550, + w: 128, # sprite size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # alpha (transparency) + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip sprite + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + } + + # Outputs label using a hash + args.outputs.labels << { + x: 200, # label position + y: 550, + text: "dragonruby", # label text + size_enum: 2, + alignment_enum: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly + } + + # Outputs solid using a hash + # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + args.outputs.solids << { + x: 400, # position + y: 550, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } + + # Outputs border using a hash + # Same parameters as a solid + args.outputs.borders << { + x: 600, + y: 550, + w: 160, + h: 90, + r: 120, + g: 50, + b: 50, + a: 255 + } + + # Outputs line using a hash + args.outputs.lines << { + x: 900, # starting position + y: 550, + x2: 1200, # ending position + y2: 550, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } + + # Outputs sprite as a primitive using a hash + args.outputs.primitives << { + x: 30, # position + y: 200, + w: 128, # size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # transparency + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + }.sprite + + # Outputs label as primitive using a hash + args.outputs.primitives << { + x: 200, # position + y: 200, + text: "dragonruby", # text + size: 2, + alignment: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style + }.label + + # Outputs solid as primitive using a hash + args.outputs.primitives << { + x: 400, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.solid + + # Outputs border as primitive using a hash + # Same parameters as solid + args.outputs.primitives << { + x: 600, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.border + + # Outputs line as primitive using a hash + args.outputs.primitives << { + x: 900, # starting position + y: 200, + x2: 1200, # ending position + y2: 200, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.line +end diff --git a/samples/07_advanced_rendering/05_render_primitives_as_hash/fonts/manaspc.ttf b/samples/07_advanced_rendering/05_render_primitives_as_hash/fonts/manaspc.ttf new file mode 100644 index 0000000..0c56733 Binary files /dev/null and b/samples/07_advanced_rendering/05_render_primitives_as_hash/fonts/manaspc.ttf differ diff --git a/samples/07_advanced_rendering/05_render_primitives_as_hash/license-for-sample.txt b/samples/07_advanced_rendering/05_render_primitives_as_hash/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/07_advanced_rendering/05_render_primitives_as_hash/license-for-sample.txt @@ -0,0 +1,9 @@ +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/07_advanced_rendering/11_render_primitives_as_hash/app/main.rb b/samples/07_advanced_rendering/11_render_primitives_as_hash/app/main.rb deleted file mode 100644 index f7e5bac..0000000 --- a/samples/07_advanced_rendering/11_render_primitives_as_hash/app/main.rb +++ /dev/null @@ -1,191 +0,0 @@ -=begin - - Reminders: - - - Hashes: Collection of unique keys and their corresponding values. The value can be found - using their keys. - - For example, if we have a "numbers" hash that stores numbers in English as the - key and numbers in Spanish as the value, we'd have a hash that looks like this... - numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } - and on it goes. - - Now if we wanted to find the corresponding value of the "one" key, we could say - puts numbers["one"] - which would print "uno" to the console. - - - args.outputs.sprites: An array. The values generate a sprite. - The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] - For more information about sprites, go to mygame/documentation/05-sprites.md. - - - 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, ALPHA] - For more information about solids, go to mygame/documentation/03-solids-and-borders.md. - - - args.outputs.borders: An array. The values generate a border. - The parameters are the same as a solid. - For more information about borders, go to mygame/documentation/03-solids-and-borders.md. - - - args.outputs.lines: An array. The values generate a line. - The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] - For more information about labels, go to mygame/documentation/02-labels.md. - -=end - -# This sample app demonstrates how hashes can be used to output different kinds of objects. - -def tick args - args.state.angle ||= 0 # initializes angle to 0 - args.state.angle += 1 # increments angle by 1 every frame (60 times a second) - - # Outputs sprite using a hash - args.outputs.sprites << { - x: 30, # sprite position - y: 550, - w: 128, # sprite size - h: 101, - path: "dragonruby.png", # image path - angle: args.state.angle, # angle - a: 255, # alpha (transparency) - r: 255, # color saturation - g: 255, - b: 255, - tile_x: 0, # sprite sub division/tile - tile_y: 0, - tile_w: -1, - tile_h: -1, - flip_vertically: false, # don't flip sprite - flip_horizontally: false, - angle_anchor_x: 0.5, # rotation center set to middle - angle_anchor_y: 0.5 - } - - # Outputs label using a hash - args.outputs.labels << { - x: 200, # label position - y: 550, - text: "dragonruby", # label text - size_enum: 2, - alignment_enum: 1, - r: 155, # color saturation - g: 50, - b: 50, - a: 255, # transparency - font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly - } - - # Outputs solid using a hash - # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] - args.outputs.solids << { - x: 400, # position - y: 550, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - } - - # Outputs border using a hash - # Same parameters as a solid - args.outputs.borders << { - x: 600, - y: 550, - w: 160, - h: 90, - r: 120, - g: 50, - b: 50, - a: 255 - } - - # Outputs line using a hash - args.outputs.lines << { - x: 900, # starting position - y: 550, - x2: 1200, # ending position - y2: 550, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - } - - # Outputs sprite as a primitive using a hash - args.outputs.primitives << { - x: 30, # position - y: 200, - w: 128, # size - h: 101, - path: "dragonruby.png", # image path - angle: args.state.angle, # angle - a: 255, # transparency - r: 255, # color saturation - g: 255, - b: 255, - tile_x: 0, # sprite sub division/tile - tile_y: 0, - tile_w: -1, - tile_h: -1, - flip_vertically: false, # don't flip - flip_horizontally: false, - angle_anchor_x: 0.5, # rotation center set to middle - angle_anchor_y: 0.5 - }.sprite - - # Outputs label as primitive using a hash - args.outputs.primitives << { - x: 200, # position - y: 200, - text: "dragonruby", # text - size: 2, - alignment: 1, - r: 155, # color saturation - g: 50, - b: 50, - a: 255, # transparency - font: "fonts/manaspc.ttf" # font style - }.label - - # Outputs solid as primitive using a hash - args.outputs.primitives << { - x: 400, # position - y: 200, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.solid - - # Outputs border as primitive using a hash - # Same parameters as solid - args.outputs.primitives << { - x: 600, # position - y: 200, - w: 160, # size - h: 90, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.border - - # Outputs line as primitive using a hash - args.outputs.primitives << { - x: 900, # starting position - y: 200, - x2: 1200, # ending position - y2: 200, - r: 120, # color saturation - g: 50, - b: 50, - a: 255 # transparency - }.line -end diff --git a/samples/07_advanced_rendering/11_render_primitives_as_hash/fonts/manaspc.ttf b/samples/07_advanced_rendering/11_render_primitives_as_hash/fonts/manaspc.ttf deleted file mode 100644 index 0c56733..0000000 Binary files a/samples/07_advanced_rendering/11_render_primitives_as_hash/fonts/manaspc.ttf and /dev/null differ diff --git a/samples/07_advanced_rendering/11_render_primitives_as_hash/license-for-sample.txt b/samples/07_advanced_rendering/11_render_primitives_as_hash/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/07_advanced_rendering/11_render_primitives_as_hash/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/08_lerping_easing_functions/01_easing_functions/app/main.rb b/samples/08_lerping_easing_functions/01_easing_functions/app/main.rb deleted file mode 100644 index 5bb26f9..0000000 --- a/samples/08_lerping_easing_functions/01_easing_functions/app/main.rb +++ /dev/null @@ -1,132 +0,0 @@ -def tick args - # STOP! Watch the following presentation first!!!! - # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations - # https://www.youtube.com/watch?v=mr5xkf6zSzk - - # You've watched the talk, yes? YES??? - - # define starting and ending points of properties to animate - args.state.target_x = 1180 - args.state.target_y = 620 - args.state.target_w = 100 - args.state.target_h = 100 - args.state.starting_x = 0 - args.state.starting_y = 0 - args.state.starting_w = 300 - args.state.starting_h = 300 - - # define start time and duration of animation - args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) - args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) - - # define type of animations - # Here are all the options you have for values you can put in the array: - # :identity, :quad, :cube, :quart, :quint, :flip - - # Linear is defined as: - # [:identity] - # - # Smooth start variations are: - # [:quad] - # [:cube] - # [:quart] - # [:quint] - - # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: - # [:flip, :identity] - # [:flip, :quad, :flip] - # [:flip, :cube, :flip] - # [:flip, :quart, :flip] - # [:flip, :quint, :flip] - - # You can also do custom definitions. See the bottom of the file details - # on how to do that. I've defined a couple for you: - # [:smoothest_start] - # [:smoothest_stop] - - # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS - args.state.animation_type = [:identity] - # args.state.animation_type = [:quad] - # args.state.animation_type = [:cube] - # args.state.animation_type = [:quart] - # args.state.animation_type = [:quint] - # args.state.animation_type = [:flip, :identity] - # args.state.animation_type = [:flip, :quad, :flip] - # args.state.animation_type = [:flip, :cube, :flip] - # args.state.animation_type = [:flip, :quart, :flip] - # args.state.animation_type = [:flip, :quint, :flip] - # args.state.animation_type = [:smoothest_start] - # args.state.animation_type = [:smoothest_stop] - - # THIS IS WHERE THE MAGIC HAPPENS! - # Numeric#ease - progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) - - # Numeric#ease needs to called: - # 1. On the number that represents the point in time you want to start, and takes two parameters: - # a. The first parameter is how long the animation should take. - # b. The second parameter represents the functions that need to be called. - # - # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, - # and I want to animation to start fast and end slow, I would do: - # (60 * 3).ease(60 * 10, :flip, :quint, :flip) - - # initial value delta to the final value - calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress - calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress - calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress - calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress - - args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] - - # count down - count_down = args.state.start_animate_at - args.state.tick_count - if count_down > 0 - args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] - args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] - elsif progress >= 1 - args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] - if args.inputs.click - $gtk.reset - end - end -end - -# $gtk.reset - -# you can make own variations of animations using this -module Easing - # you have access to all the built in functions: identity, flip, quad, cube, quart, quint - def self.smoothest_start x - quad(quint(x)) - end - - def self.smoothest_stop x - flip(quad(quint(flip(x)))) - end - - # this is the source for the existing easing functions - def self.identity x - x - end - - def self.flip x - 1 - x - end - - def self.quad x - x * x - end - - def self.cube x - x * x * x - end - - def self.quart x - x * x * x * x * x - end - - def self.quint x - x * x * x * x * x * x - end -end diff --git a/samples/08_lerping_easing_functions/01_easing_functions/license-for-sample.txt b/samples/08_lerping_easing_functions/01_easing_functions/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/08_lerping_easing_functions/01_easing_functions/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/08_lerping_easing_functions/02_cubic_bezier/app/main.rb b/samples/08_lerping_easing_functions/02_cubic_bezier/app/main.rb deleted file mode 100644 index 93dba31..0000000 --- a/samples/08_lerping_easing_functions/02_cubic_bezier/app/main.rb +++ /dev/null @@ -1,61 +0,0 @@ -def tick args - args.outputs.background_color = [33, 33, 33] - args.outputs.lines << bezier(100, 100, - 100, 620, - 1180, 620, - 1180, 100, - 0) - - args.outputs.lines << bezier(100, 100, - 100, 620, - 1180, 620, - 1180, 100, - 20) -end - - -def bezier x1, y1, x2, y2, x3, y3, x4, y4, step - step ||= 0 - color = [200, 200, 200] - points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step - - points.each_cons(2).map do |p1, p2| - [p1, p2, color] - end -end - -def points_for_bezier p1, p2, p3, p4, step - points = [] - if step == 0 - [p1, p2, p3, p4] - else - t_step = 1.fdiv(step + 1) - t = 0 - t += t_step - points = [] - while t < 1 - points << [ - b_for_t(p1.x, p2.x, p3.x, p4.x, t), - b_for_t(p1.y, p2.y, p3.y, p4.y, t), - ] - t += t_step - end - - [ - p1, - *points, - p4 - ] - end -end - -def b_for_t v0, v1, v2, v3, t - pow(1 - t, 3) * v0 + - 3 * pow(1 - t, 2) * t * v1 + - 3 * (1 - t) * pow(t, 2) * v2 + - pow(t, 3) * v3 -end - -def pow n, to - n ** to -end diff --git a/samples/08_lerping_easing_functions/03_easing_using_spline/app/main.rb b/samples/08_lerping_easing_functions/03_easing_using_spline/app/main.rb deleted file mode 100644 index c30c0e6..0000000 --- a/samples/08_lerping_easing_functions/03_easing_using_spline/app/main.rb +++ /dev/null @@ -1,18 +0,0 @@ -def tick args - args.state.duration = 10.seconds - args.state.spline = [ - [0.0, 0.33, 0.66, 1.0], - [1.0, 1.0, 1.0, 1.0], - [1.0, 0.66, 0.33, 0.0], - ] - - args.state.simulation_tick = args.state.tick_count % args.state.duration - progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline - args.outputs.borders << args.grid.rect - args.outputs.solids << [20 + 1240 * progress, - 20 + 680 * progress, - 20, 20].anchor_rect(0.5, 0.5) - args.outputs.labels << [10, - 710, - "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] -end diff --git a/samples/08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb b/samples/08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb deleted file mode 100644 index 8e73fb0..0000000 --- a/samples/08_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb +++ /dev/null @@ -1,213 +0,0 @@ -def new_star args - { x: 1280.randomize(:ratio), - starting_y: 800, - distance_to_travel: 900 + 100.randomize(:ratio), - duration: 100.randomize(:ratio) + 60, - created_at: args.state.tick_count, - max_alpha: 128.randomize(:ratio) + 128, - b: 255.randomize(:ratio), - g: 200.randomize(:ratio), - w: 1.randomize(:ratio) + 1, - h: 1.randomize(:ratio) + 1 } -end - -def new_enemy args - { x: 1280.randomize(:ratio), - starting_y: 800, - distance_to_travel: -900, - duration: 60.randomize(:ratio) + 180, - created_at: args.state.tick_count, - w: 32, - h: 32, - fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } -end - -def new_bullet args, starting_x, starting_y, enemy_speed - { x: starting_x, - starting_y: starting_y, - distance_to_travel: -900, - created_at: args.state.tick_count, - duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, - w: 5, - h: 5 } -end - -def new_player_bullet args, starting_x, starting_y, player_speed - { x: starting_x, - starting_y: starting_y, - distance_to_travel: 900, - created_at: args.state.tick_count, - duration: 900 / (player_speed + 2.0), - w: 5, - h: 5 } -end - -def defaults args - args.outputs.background_color = [0, 0, 0] - args.state.score ||= 0 - args.state.stars ||= [] - args.state.enemies ||= [] - args.state.bullets ||= [] - args.state.player_bullets ||= [] - args.state.max_stars = 50 - args.state.max_enemies = 10 - args.state.player.x ||= 640 - args.state.player.y ||= 100 - args.state.player.w ||= 32 - args.state.player.h ||= 32 - - if args.state.tick_count == 0 - args.state.stars.clear - args.state.max_stars.times do - s = new_star args - s[:created_at] += s[:duration].randomize(:ratio) - args.state.stars << s - end - end - - if args.state.tick_count == 0 - args.state.enemies.clear - args.state.max_enemies.times do - s = new_enemy args - s[:created_at] += s[:duration].randomize(:ratio) - args.state.enemies << s - end - end -end - -def input args - if args.inputs.keyboard.left - args.state.player.x -= 5 - elsif args.inputs.keyboard.right - args.state.player.x += 5 - end - - if args.inputs.keyboard.up - args.state.player.y += 5 - elsif args.inputs.keyboard.down - args.state.player.y -= 5 - end - - if args.inputs.keyboard.key_down.space - args.state.player_bullets << new_player_bullet(args, - args.state.player.x + args.state.player.w.half, - args.state.player.y + args.state.player.h, 5) - end - - args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) - args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) -end - -def completed? entity - (entity[:created_at] + entity[:duration]).elapsed_time > 0 -end - -def calc_stars args - if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 - stars_to_add.times { args.state.stars << new_star(args) } - end - args.state.stars = args.state.stars.reject { |s| completed? s } -end - -def move_enemies args - if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 - enemies_to_add.times { args.state.enemies << new_enemy(args) } - end - - args.state.enemies = args.state.enemies.reject { |s| completed? s } -end - -def move_bullets args - args.state.enemies.each do |e| - if args.state.tick_count.mod_zero?(e[:fire_rate]) - args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) - end - end - - args.state.bullets = args.state.bullets.reject { |s| completed? s } - args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } -end - -def intersect? entity_one, entity_two - entity_one.merge(y: current_y(entity_one)) - .intersect_rect? entity_two.merge(y: current_y(entity_two)) -end - -def kill args - bullets_hitting_enemies = [] - dead_bullets = [] - dead_enemies = [] - - args.state.player_bullets.each do |b| - args.state.enemies.each do |e| - if intersect? b, e - dead_bullets << b - dead_enemies << e - end - end - end - - args.state.score += dead_enemies.length - - args.state.player_bullets.reject! { |b| dead_bullets.include? b } - args.state.enemies.reject! { |e| dead_enemies.include? e } - - dead = args.state.bullets.any? do |b| - [args.state.player.x, - args.state.player.y, - args.state.player.w, - args.state.player.h].intersect_rect? b.merge(y: current_y(b)) - end - return unless dead - args.gtk.reset - defaults args -end - -def calc args - calc_stars args - move_enemies args - move_bullets args - kill args -end - -def current_y entity - entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) -end - -def render args - args.outputs.solids << args.state.stars.map do |s| - [s[:x], - current_y(s), - s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] - end - - args.outputs.borders << args.state.enemies.map do |s| - [s[:x], - current_y(s), - s[:w], s[:h], 255, 0, 0] - end - - args.outputs.borders << args.state.bullets.map do |b| - [b[:x], - current_y(b), - b[:w], b[:h], 255, 0, 0] - end - - args.outputs.borders << args.state.player_bullets.map do |b| - [b[:x], - current_y(b), - b[:w], b[:h], 255, 255, 255] - end - - args.borders << [args.state.player.x, - args.state.player.y, - args.state.player.w, - args.state.player.h, 255, 255, 255] -end - -def tick args - defaults args - input args - calc args - render args -end diff --git a/samples/08_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt b/samples/08_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/08_lerping_easing_functions/04_parametric_enemy_movement/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/08_lerping_easing_functions/04_parametric_enemy_movement/replay.txt b/samples/08_lerping_easing_functions/04_parametric_enemy_movement/replay.txt deleted file mode 100644 index 6580c5b..0000000 --- a/samples/08_lerping_easing_functions/04_parametric_enemy_movement/replay.txt +++ /dev/null @@ -1,94 +0,0 @@ -replay_version 2.0 -stopped_at 673 -seed 100 -recorded_at Sun Sep 29 22:32:05 2019 -[:key_down_raw, 1073741904, 0, 2, 1, 63] -[:key_up_raw, 1073741904, 0, 2, 2, 85] -[:key_down_raw, 1073741903, 0, 2, 3, 93] -[:key_up_raw, 1073741903, 0, 2, 4, 111] -[:key_down_raw, 1073741904, 0, 2, 5, 114] -[:key_up_raw, 1073741904, 0, 2, 6, 136] -[:key_down_raw, 1073741903, 0, 2, 7, 162] -[:key_up_raw, 1073741903, 0, 2, 8, 183] -[:key_down_raw, 32, 0, 2, 9, 184] -[:key_up_raw, 32, 0, 2, 10, 189] -[:key_down_raw, 32, 0, 2, 11, 194] -[:key_up_raw, 32, 0, 2, 12, 198] -[:key_down_raw, 32, 0, 2, 13, 202] -[:key_down_raw, 1073741904, 0, 2, 14, 205] -[:key_up_raw, 32, 0, 2, 15, 207] -[:key_down_raw, 1073741904, 0, 2, 16, 229] -[:key_down_raw, 1073741904, 0, 2, 17, 231] -[:key_down_raw, 32, 0, 2, 18, 232] -[:key_up_raw, 1073741904, 0, 2, 19, 235] -[:key_up_raw, 32, 0, 2, 20, 237] -[:key_down_raw, 1073741903, 0, 2, 21, 238] -[:key_down_raw, 32, 0, 2, 22, 241] -[:key_up_raw, 32, 0, 2, 23, 245] -[:key_down_raw, 32, 0, 2, 24, 249] -[:key_up_raw, 32, 0, 2, 25, 253] -[:key_down_raw, 32, 0, 2, 26, 258] -[:key_up_raw, 32, 0, 2, 27, 262] -[:key_down_raw, 32, 0, 2, 28, 266] -[:key_up_raw, 1073741903, 0, 2, 29, 267] -[:key_down_raw, 1073741904, 0, 2, 30, 269] -[:key_up_raw, 32, 0, 2, 31, 271] -[:key_up_raw, 1073741904, 0, 2, 32, 291] -[:key_down_raw, 1073741903, 0, 2, 33, 293] -[:key_down_raw, 32, 0, 2, 34, 301] -[:key_up_raw, 32, 0, 2, 35, 307] -[:key_down_raw, 32, 0, 2, 36, 346] -[:key_up_raw, 1073741903, 0, 2, 37, 347] -[:key_down_raw, 1073741904, 0, 2, 38, 350] -[:key_up_raw, 32, 0, 2, 39, 351] -[:key_down_raw, 1073741904, 0, 2, 40, 373] -[:key_down_raw, 1073741904, 0, 2, 41, 375] -[:key_down_raw, 1073741904, 0, 2, 42, 377] -[:key_down_raw, 1073741904, 0, 2, 43, 378] -[:key_down_raw, 1073741904, 0, 2, 44, 380] -[:key_down_raw, 1073741904, 0, 2, 45, 382] -[:key_down_raw, 1073741904, 0, 2, 46, 384] -[:key_down_raw, 1073741904, 0, 2, 47, 386] -[:key_up_raw, 1073741904, 0, 2, 48, 386] -[:key_down_raw, 32, 0, 2, 49, 387] -[:key_up_raw, 32, 0, 2, 50, 394] -[:key_down_raw, 1073741903, 0, 2, 51, 398] -[:key_down_raw, 32, 0, 2, 52, 399] -[:key_up_raw, 32, 0, 2, 53, 403] -[:key_down_raw, 32, 0, 2, 54, 408] -[:key_up_raw, 32, 0, 2, 55, 413] -[:key_down_raw, 32, 0, 2, 56, 418] -[:key_up_raw, 32, 0, 2, 57, 422] -[:key_down_raw, 32, 0, 2, 58, 427] -[:key_up_raw, 32, 0, 2, 59, 431] -[:key_down_raw, 32, 0, 2, 60, 435] -[:key_up_raw, 32, 0, 2, 61, 439] -[:key_up_raw, 1073741903, 0, 2, 62, 440] -[:key_down_raw, 1073741904, 0, 2, 63, 441] -[:key_down_raw, 1073741904, 0, 2, 64, 461] -[:key_down_raw, 1073741904, 0, 2, 65, 463] -[:key_down_raw, 1073741904, 0, 2, 66, 465] -[:key_down_raw, 1073741904, 0, 2, 67, 466] -[:key_down_raw, 1073741904, 0, 2, 68, 468] -[:key_up_raw, 1073741904, 0, 2, 69, 468] -[:key_down_raw, 1073741904, 0, 2, 70, 483] -[:key_down_raw, 1073741904, 0, 2, 71, 503] -[:key_down_raw, 1073741904, 0, 2, 72, 505] -[:key_down_raw, 1073741904, 0, 2, 73, 507] -[:key_down_raw, 32, 0, 2, 74, 508] -[:key_up_raw, 1073741904, 0, 2, 75, 509] -[:key_up_raw, 32, 0, 2, 76, 512] -[:key_down_raw, 1073741903, 0, 2, 77, 515] -[:key_down_raw, 32, 0, 2, 78, 516] -[:key_up_raw, 32, 0, 2, 79, 520] -[:key_up_raw, 1073741903, 0, 2, 80, 521] -[:key_down_raw, 32, 0, 2, 81, 524] -[:key_up_raw, 32, 0, 2, 82, 528] -[:key_down_raw, 32, 0, 2, 83, 532] -[:key_up_raw, 32, 0, 2, 84, 535] -[:key_down_raw, 32, 0, 2, 85, 539] -[:key_up_raw, 32, 0, 2, 86, 543] -[:key_down_raw, 32, 0, 2, 87, 551] -[:key_up_raw, 32, 0, 2, 88, 555] -[:key_down_raw, 1073742051, 1024, 2, 89, 656] -[:key_down_raw, 113, 1024, 2, 90, 672] diff --git a/samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb b/samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb new file mode 100644 index 0000000..5bb26f9 --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/01_easing_functions/app/main.rb @@ -0,0 +1,132 @@ +def tick args + # STOP! Watch the following presentation first!!!! + # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations + # https://www.youtube.com/watch?v=mr5xkf6zSzk + + # You've watched the talk, yes? YES??? + + # define starting and ending points of properties to animate + args.state.target_x = 1180 + args.state.target_y = 620 + args.state.target_w = 100 + args.state.target_h = 100 + args.state.starting_x = 0 + args.state.starting_y = 0 + args.state.starting_w = 300 + args.state.starting_h = 300 + + # define start time and duration of animation + args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) + args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) + + # define type of animations + # Here are all the options you have for values you can put in the array: + # :identity, :quad, :cube, :quart, :quint, :flip + + # Linear is defined as: + # [:identity] + # + # Smooth start variations are: + # [:quad] + # [:cube] + # [:quart] + # [:quint] + + # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: + # [:flip, :identity] + # [:flip, :quad, :flip] + # [:flip, :cube, :flip] + # [:flip, :quart, :flip] + # [:flip, :quint, :flip] + + # You can also do custom definitions. See the bottom of the file details + # on how to do that. I've defined a couple for you: + # [:smoothest_start] + # [:smoothest_stop] + + # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS + args.state.animation_type = [:identity] + # args.state.animation_type = [:quad] + # args.state.animation_type = [:cube] + # args.state.animation_type = [:quart] + # args.state.animation_type = [:quint] + # args.state.animation_type = [:flip, :identity] + # args.state.animation_type = [:flip, :quad, :flip] + # args.state.animation_type = [:flip, :cube, :flip] + # args.state.animation_type = [:flip, :quart, :flip] + # args.state.animation_type = [:flip, :quint, :flip] + # args.state.animation_type = [:smoothest_start] + # args.state.animation_type = [:smoothest_stop] + + # THIS IS WHERE THE MAGIC HAPPENS! + # Numeric#ease + progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) + + # Numeric#ease needs to called: + # 1. On the number that represents the point in time you want to start, and takes two parameters: + # a. The first parameter is how long the animation should take. + # b. The second parameter represents the functions that need to be called. + # + # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, + # and I want to animation to start fast and end slow, I would do: + # (60 * 3).ease(60 * 10, :flip, :quint, :flip) + + # initial value delta to the final value + calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress + calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress + calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress + calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress + + args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] + + # count down + count_down = args.state.start_animate_at - args.state.tick_count + if count_down > 0 + args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] + args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] + elsif progress >= 1 + args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] + if args.inputs.click + $gtk.reset + end + end +end + +# $gtk.reset + +# you can make own variations of animations using this +module Easing + # you have access to all the built in functions: identity, flip, quad, cube, quart, quint + def self.smoothest_start x + quad(quint(x)) + end + + def self.smoothest_stop x + flip(quad(quint(flip(x)))) + end + + # this is the source for the existing easing functions + def self.identity x + x + end + + def self.flip x + 1 - x + end + + def self.quad x + x * x + end + + def self.cube x + x * x * x + end + + def self.quart x + x * x * x * x * x + end + + def self.quint x + x * x * x * x * x * x + end +end diff --git a/samples/08_tweening_lerping_easing_functions/01_easing_functions/license-for-sample.txt b/samples/08_tweening_lerping_easing_functions/01_easing_functions/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/01_easing_functions/license-for-sample.txt @@ -0,0 +1,9 @@ +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/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb b/samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb new file mode 100644 index 0000000..93dba31 --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/02_cubic_bezier/app/main.rb @@ -0,0 +1,61 @@ +def tick args + args.outputs.background_color = [33, 33, 33] + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 0) + + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 20) +end + + +def bezier x1, y1, x2, y2, x3, y3, x4, y4, step + step ||= 0 + color = [200, 200, 200] + points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step + + points.each_cons(2).map do |p1, p2| + [p1, p2, color] + end +end + +def points_for_bezier p1, p2, p3, p4, step + points = [] + if step == 0 + [p1, p2, p3, p4] + else + t_step = 1.fdiv(step + 1) + t = 0 + t += t_step + points = [] + while t < 1 + points << [ + b_for_t(p1.x, p2.x, p3.x, p4.x, t), + b_for_t(p1.y, p2.y, p3.y, p4.y, t), + ] + t += t_step + end + + [ + p1, + *points, + p4 + ] + end +end + +def b_for_t v0, v1, v2, v3, t + pow(1 - t, 3) * v0 + + 3 * pow(1 - t, 2) * t * v1 + + 3 * (1 - t) * pow(t, 2) * v2 + + pow(t, 3) * v3 +end + +def pow n, to + n ** to +end diff --git a/samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb b/samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb new file mode 100644 index 0000000..c30c0e6 --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/03_easing_using_spline/app/main.rb @@ -0,0 +1,18 @@ +def tick args + args.state.duration = 10.seconds + args.state.spline = [ + [0.0, 0.33, 0.66, 1.0], + [1.0, 1.0, 1.0, 1.0], + [1.0, 0.66, 0.33, 0.0], + ] + + args.state.simulation_tick = args.state.tick_count % args.state.duration + progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline + args.outputs.borders << args.grid.rect + args.outputs.solids << [20 + 1240 * progress, + 20 + 680 * progress, + 20, 20].anchor_rect(0.5, 0.5) + args.outputs.labels << [10, + 710, + "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] +end diff --git a/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb new file mode 100644 index 0000000..8e73fb0 --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/app/main.rb @@ -0,0 +1,213 @@ +def new_star args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: 900 + 100.randomize(:ratio), + duration: 100.randomize(:ratio) + 60, + created_at: args.state.tick_count, + max_alpha: 128.randomize(:ratio) + 128, + b: 255.randomize(:ratio), + g: 200.randomize(:ratio), + w: 1.randomize(:ratio) + 1, + h: 1.randomize(:ratio) + 1 } +end + +def new_enemy args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: -900, + duration: 60.randomize(:ratio) + 180, + created_at: args.state.tick_count, + w: 32, + h: 32, + fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } +end + +def new_bullet args, starting_x, starting_y, enemy_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: -900, + created_at: args.state.tick_count, + duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, + w: 5, + h: 5 } +end + +def new_player_bullet args, starting_x, starting_y, player_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: 900, + created_at: args.state.tick_count, + duration: 900 / (player_speed + 2.0), + w: 5, + h: 5 } +end + +def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.score ||= 0 + args.state.stars ||= [] + args.state.enemies ||= [] + args.state.bullets ||= [] + args.state.player_bullets ||= [] + args.state.max_stars = 50 + args.state.max_enemies = 10 + args.state.player.x ||= 640 + args.state.player.y ||= 100 + args.state.player.w ||= 32 + args.state.player.h ||= 32 + + if args.state.tick_count == 0 + args.state.stars.clear + args.state.max_stars.times do + s = new_star args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.stars << s + end + end + + if args.state.tick_count == 0 + args.state.enemies.clear + args.state.max_enemies.times do + s = new_enemy args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.enemies << s + end + end +end + +def input args + if args.inputs.keyboard.left + args.state.player.x -= 5 + elsif args.inputs.keyboard.right + args.state.player.x += 5 + end + + if args.inputs.keyboard.up + args.state.player.y += 5 + elsif args.inputs.keyboard.down + args.state.player.y -= 5 + end + + if args.inputs.keyboard.key_down.space + args.state.player_bullets << new_player_bullet(args, + args.state.player.x + args.state.player.w.half, + args.state.player.y + args.state.player.h, 5) + end + + args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) + args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) +end + +def completed? entity + (entity[:created_at] + entity[:duration]).elapsed_time > 0 +end + +def calc_stars args + if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 + stars_to_add.times { args.state.stars << new_star(args) } + end + args.state.stars = args.state.stars.reject { |s| completed? s } +end + +def move_enemies args + if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 + enemies_to_add.times { args.state.enemies << new_enemy(args) } + end + + args.state.enemies = args.state.enemies.reject { |s| completed? s } +end + +def move_bullets args + args.state.enemies.each do |e| + if args.state.tick_count.mod_zero?(e[:fire_rate]) + args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) + end + end + + args.state.bullets = args.state.bullets.reject { |s| completed? s } + args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } +end + +def intersect? entity_one, entity_two + entity_one.merge(y: current_y(entity_one)) + .intersect_rect? entity_two.merge(y: current_y(entity_two)) +end + +def kill args + bullets_hitting_enemies = [] + dead_bullets = [] + dead_enemies = [] + + args.state.player_bullets.each do |b| + args.state.enemies.each do |e| + if intersect? b, e + dead_bullets << b + dead_enemies << e + end + end + end + + args.state.score += dead_enemies.length + + args.state.player_bullets.reject! { |b| dead_bullets.include? b } + args.state.enemies.reject! { |e| dead_enemies.include? e } + + dead = args.state.bullets.any? do |b| + [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h].intersect_rect? b.merge(y: current_y(b)) + end + return unless dead + args.gtk.reset + defaults args +end + +def calc args + calc_stars args + move_enemies args + move_bullets args + kill args +end + +def current_y entity + entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) +end + +def render args + args.outputs.solids << args.state.stars.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] + end + + args.outputs.borders << args.state.enemies.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 255, 0, 0] + end + + args.outputs.borders << args.state.bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 0, 0] + end + + args.outputs.borders << args.state.player_bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 255, 255] + end + + args.borders << [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h, 255, 255, 255] +end + +def tick args + defaults args + input args + calc args + render args +end diff --git a/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/license-for-sample.txt @@ -0,0 +1,9 @@ +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/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/replay.txt b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/replay.txt new file mode 100644 index 0000000..6580c5b --- /dev/null +++ b/samples/08_tweening_lerping_easing_functions/04_parametric_enemy_movement/replay.txt @@ -0,0 +1,94 @@ +replay_version 2.0 +stopped_at 673 +seed 100 +recorded_at Sun Sep 29 22:32:05 2019 +[:key_down_raw, 1073741904, 0, 2, 1, 63] +[:key_up_raw, 1073741904, 0, 2, 2, 85] +[:key_down_raw, 1073741903, 0, 2, 3, 93] +[:key_up_raw, 1073741903, 0, 2, 4, 111] +[:key_down_raw, 1073741904, 0, 2, 5, 114] +[:key_up_raw, 1073741904, 0, 2, 6, 136] +[:key_down_raw, 1073741903, 0, 2, 7, 162] +[:key_up_raw, 1073741903, 0, 2, 8, 183] +[:key_down_raw, 32, 0, 2, 9, 184] +[:key_up_raw, 32, 0, 2, 10, 189] +[:key_down_raw, 32, 0, 2, 11, 194] +[:key_up_raw, 32, 0, 2, 12, 198] +[:key_down_raw, 32, 0, 2, 13, 202] +[:key_down_raw, 1073741904, 0, 2, 14, 205] +[:key_up_raw, 32, 0, 2, 15, 207] +[:key_down_raw, 1073741904, 0, 2, 16, 229] +[:key_down_raw, 1073741904, 0, 2, 17, 231] +[:key_down_raw, 32, 0, 2, 18, 232] +[:key_up_raw, 1073741904, 0, 2, 19, 235] +[:key_up_raw, 32, 0, 2, 20, 237] +[:key_down_raw, 1073741903, 0, 2, 21, 238] +[:key_down_raw, 32, 0, 2, 22, 241] +[:key_up_raw, 32, 0, 2, 23, 245] +[:key_down_raw, 32, 0, 2, 24, 249] +[:key_up_raw, 32, 0, 2, 25, 253] +[:key_down_raw, 32, 0, 2, 26, 258] +[:key_up_raw, 32, 0, 2, 27, 262] +[:key_down_raw, 32, 0, 2, 28, 266] +[:key_up_raw, 1073741903, 0, 2, 29, 267] +[:key_down_raw, 1073741904, 0, 2, 30, 269] +[:key_up_raw, 32, 0, 2, 31, 271] +[:key_up_raw, 1073741904, 0, 2, 32, 291] +[:key_down_raw, 1073741903, 0, 2, 33, 293] +[:key_down_raw, 32, 0, 2, 34, 301] +[:key_up_raw, 32, 0, 2, 35, 307] +[:key_down_raw, 32, 0, 2, 36, 346] +[:key_up_raw, 1073741903, 0, 2, 37, 347] +[:key_down_raw, 1073741904, 0, 2, 38, 350] +[:key_up_raw, 32, 0, 2, 39, 351] +[:key_down_raw, 1073741904, 0, 2, 40, 373] +[:key_down_raw, 1073741904, 0, 2, 41, 375] +[:key_down_raw, 1073741904, 0, 2, 42, 377] +[:key_down_raw, 1073741904, 0, 2, 43, 378] +[:key_down_raw, 1073741904, 0, 2, 44, 380] +[:key_down_raw, 1073741904, 0, 2, 45, 382] +[:key_down_raw, 1073741904, 0, 2, 46, 384] +[:key_down_raw, 1073741904, 0, 2, 47, 386] +[:key_up_raw, 1073741904, 0, 2, 48, 386] +[:key_down_raw, 32, 0, 2, 49, 387] +[:key_up_raw, 32, 0, 2, 50, 394] +[:key_down_raw, 1073741903, 0, 2, 51, 398] +[:key_down_raw, 32, 0, 2, 52, 399] +[:key_up_raw, 32, 0, 2, 53, 403] +[:key_down_raw, 32, 0, 2, 54, 408] +[:key_up_raw, 32, 0, 2, 55, 413] +[:key_down_raw, 32, 0, 2, 56, 418] +[:key_up_raw, 32, 0, 2, 57, 422] +[:key_down_raw, 32, 0, 2, 58, 427] +[:key_up_raw, 32, 0, 2, 59, 431] +[:key_down_raw, 32, 0, 2, 60, 435] +[:key_up_raw, 32, 0, 2, 61, 439] +[:key_up_raw, 1073741903, 0, 2, 62, 440] +[:key_down_raw, 1073741904, 0, 2, 63, 441] +[:key_down_raw, 1073741904, 0, 2, 64, 461] +[:key_down_raw, 1073741904, 0, 2, 65, 463] +[:key_down_raw, 1073741904, 0, 2, 66, 465] +[:key_down_raw, 1073741904, 0, 2, 67, 466] +[:key_down_raw, 1073741904, 0, 2, 68, 468] +[:key_up_raw, 1073741904, 0, 2, 69, 468] +[:key_down_raw, 1073741904, 0, 2, 70, 483] +[:key_down_raw, 1073741904, 0, 2, 71, 503] +[:key_down_raw, 1073741904, 0, 2, 72, 505] +[:key_down_raw, 1073741904, 0, 2, 73, 507] +[:key_down_raw, 32, 0, 2, 74, 508] +[:key_up_raw, 1073741904, 0, 2, 75, 509] +[:key_up_raw, 32, 0, 2, 76, 512] +[:key_down_raw, 1073741903, 0, 2, 77, 515] +[:key_down_raw, 32, 0, 2, 78, 516] +[:key_up_raw, 32, 0, 2, 79, 520] +[:key_up_raw, 1073741903, 0, 2, 80, 521] +[:key_down_raw, 32, 0, 2, 81, 524] +[:key_up_raw, 32, 0, 2, 82, 528] +[:key_down_raw, 32, 0, 2, 83, 532] +[:key_up_raw, 32, 0, 2, 84, 535] +[:key_down_raw, 32, 0, 2, 85, 539] +[:key_up_raw, 32, 0, 2, 86, 543] +[:key_down_raw, 32, 0, 2, 87, 551] +[:key_up_raw, 32, 0, 2, 88, 555] +[:key_down_raw, 1073742051, 1024, 2, 89, 656] +[:key_down_raw, 113, 1024, 2, 90, 672] diff --git a/samples/12_c_extensions/01_basics/.gitignore b/samples/12_c_extensions/01_basics/.gitignore new file mode 100644 index 0000000..4a0a124 --- /dev/null +++ b/samples/12_c_extensions/01_basics/.gitignore @@ -0,0 +1 @@ +build.dir diff --git a/samples/12_c_extensions/01_basics/app/ext.c b/samples/12_c_extensions/01_basics/app/ext.c new file mode 100644 index 0000000..a087919 --- /dev/null +++ b/samples/12_c_extensions/01_basics/app/ext.c @@ -0,0 +1,4 @@ +int square(int x) { + return x * x; +} + diff --git a/samples/12_c_extensions/01_basics/app/main.rb b/samples/12_c_extensions/01_basics/app/main.rb new file mode 100644 index 0000000..537b9b1 --- /dev/null +++ b/samples/12_c_extensions/01_basics/app/main.rb @@ -0,0 +1,7 @@ +$gtk.ffi_misc.gtk_dlopen("./samples/12_c_extensions/01_basics/build.dir/ext.lib") +include FFI::CExt + +def tick args + args.outputs.labels << [460, 600, "square(42) = #{square(42)}"] +end + diff --git a/samples/12_c_extensions/01_basics/license-for-sample.txt b/samples/12_c_extensions/01_basics/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/12_c_extensions/01_basics/license-for-sample.txt @@ -0,0 +1,9 @@ +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/12_c_extensions/01_basics/metadata/game_metadata.txt b/samples/12_c_extensions/01_basics/metadata/game_metadata.txt new file mode 100644 index 0000000..a8772d0 --- /dev/null +++ b/samples/12_c_extensions/01_basics/metadata/game_metadata.txt @@ -0,0 +1,5 @@ +devid=dragonruby +devtitle=DragonRuby LLC +gameid=cbasics +gametitle=C Basics +version=1.0 diff --git a/samples/12_c_extensions/01_basics/pre.bat b/samples/12_c_extensions/01_basics/pre.bat new file mode 100644 index 0000000..3b3e27d --- /dev/null +++ b/samples/12_c_extensions/01_basics/pre.bat @@ -0,0 +1,4 @@ +set DRB_ROOT=..\..\..\ +md build.dir +%DRB_ROOT%\dragonruby-bind.exe --output=build.dir\ext-bind.c app\ext.c +clang -shared .\build.dir\ext-bind.c --sysroot=C:\mingw-w64\x86_64-8.1.0\mingw64 --target=x86_64-w64-mingw32 -fuse-ld=lld -isystem %DRB_ROOT%\include -I. -o build.dir\ext.lib diff --git a/samples/12_c_extensions/01_basics/pre.sh b/samples/12_c_extensions/01_basics/pre.sh new file mode 100755 index 0000000..8aa9eb7 --- /dev/null +++ b/samples/12_c_extensions/01_basics/pre.sh @@ -0,0 +1,10 @@ +#!/bin/sh +DRB_ROOT=../../.. +mkdir -p build.dir + +$DRB_ROOT/dragonruby-bind --output=build.dir/ext-bindings.c app/ext.c +clang \ + -isystem $DRB_ROOT/include -I. \ + -undefined dynamic_lookup \ + -fPIC -shared build.dir/ext-bindings.c -o build.dir/ext.lib + diff --git a/samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb b/samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb new file mode 100644 index 0000000..b580477 --- /dev/null +++ b/samples/99_genre_dev_tools/add_buttons_to_console/app/main.rb @@ -0,0 +1,58 @@ +# You can customize the buttons that show up in the Console. +class GTK::Console::Menu + # STEP 1: Override the custom_buttons function. + def custom_buttons + [ + (button id: :yay, + # row for button + row: 3, + # column for button + col: 10, + # text + text: "I AM CUSTOM", + # when clicked call the custom_button_clicked function + method: :custom_button_clicked), + + (button id: :yay, + # row for button + row: 3, + # column for button + col: 9, + # text + text: "CUSTOM ALSO", + # when clicked call the custom_button_also_clicked function + method: :custom_button_also_clicked) + ] + end + + # STEP 2: Define the function that should be called. + def custom_button_clicked + log "* INFO: I AM CUSTOM was clicked!" + end + + def custom_button_also_clicked + log "* INFO: Custom Button Clicked at #{Kernel.global_tick_count}!" + + all_buttons_as_string = $gtk.console.menu.buttons.map do |b| + <<-S.strip +** id: #{b[:id]} +:PROPERTIES: +:id: :#{b[:id]} +:method: :#{b[:method]} +:text: #{b[:text]} +:END: +S + end.join("\n") + + log <<-S +* INFO: Here are all the buttons: +#{all_buttons_as_string} +S + end +end + +def tick args + args.outputs.labels << [args.grid.center.x, args.grid.center.y, + "Open the DragonRuby Console to see the custom menu items.", + 0, 1] +end diff --git a/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb b/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb deleted file mode 100644 index 2921076..0000000 --- a/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/decision.rb +++ /dev/null @@ -1,37 +0,0 @@ -# Hey there! Welcome to Four Decisions. Here is how you -# create your decision tree. Remove =being and =end from the text to -# enable the game (just save the file). Change stuff and see what happens! - -def game - { - starting_decision: :stormy_night, - decisions: { - stormy_night: { - description: 'It was a dark and stormy night. (storyline located in decision.rb)', - option_one: { - description: 'Go to sleep.', - decision: :nap - }, - option_two: { - description: 'Watch a movie.', - decision: :movie - }, - option_three: { - description: 'Go outside.', - decision: :go_outside - }, - option_four: { - description: 'Get a snack.', - decision: :get_a_snack - } - }, - nap: { - description: 'You took a nap. The end.', - option_one: { - description: 'Start over.', - decision: :stormy_night - } - } - } - } -end diff --git a/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb b/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb deleted file mode 100644 index 22faad1..0000000 --- a/samples/99_genre_narrative_rpg/choose_your_own_adventure/app/main.rb +++ /dev/null @@ -1,132 +0,0 @@ -=begin - - Reminders: - - - Hashes: Collection of unique keys and their corresponding values. The values can be found - using their keys. - - In this sample app, the decisions needed for the game are stored in a hash. In fact, the - decision.rb file contains hashes inside of other hashes! - - Each option is a key in the first hash, but also contains a hash (description and - decision being its keys) as its value. - Go into the decision.rb file and take a look before diving into the code below. - - - 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.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. - For more information about the keyboard, go to mygame/documentation/06-keyboard.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. - -=end - -# This sample app provides users with a story and multiple decisions that they can choose to make. -# Users can make a decision using their keyboard, and the story will move forward based on user choices. - -# The decisions available to users are stored in the decision.rb file. -# We must have access to it for the game to function properly. -GAME_FILE = 'app/decision.rb' # found in app folder - -require GAME_FILE # require used to load another file, import class/method definitions - -# Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. -# Otherwise, the game is run. -def tick args - if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method - args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown - args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] - elsif respond_to?(:game) # otherwise, if responds to game - args.state.loaded = true - tick_game args # calls tick_game method, runs game - end - - if args.state.tick_count.mod_zero? 60 # update every 60 frames - t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file - if t != args.state.mtime - args.state.mtime = t - require GAME_FILE # require used to load file - args.state.game_definition = nil # game definition and decision are empty - args.state.decision_id = nil - end - end -end - -# Runs methods needed for game to function properly -# Creates a rectangular border around the screen -def tick_game args - defaults args - args.borders << args.grid.rect - render_decision args - process_inputs args -end - -# Sets default values and uses decision.rb file to define game and decision_id -# variable using the starting decision -def defaults args - args.state.game_definition ||= game - args.state.decision_id ||= args.state.game_definition[:starting_decision] -end - -# Outputs the possible decision descriptions the user can choose onto the screen -# as well as what key to press on their keyboard to make their decision -def render_decision args - decision = current_decision args - # text is either the value of decision's description key or warning that no description exists - args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation - - # All decisions are stored in a hash - # The descriptions output onto the screen are the values for the description keys of the hash. - if decision[:option_one] - args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label - args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision - end - - if decision[:option_two] - args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description - args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] - end - - if decision[:option_three] - args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description - args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] - end - - if decision[:option_four] - args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description - args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] - end -end - -# Uses keyboard input from the user to make a decision -# Assigns the decision as the value of the decision_id variable -def process_inputs args - decision = current_decision args # calls current_decision method - - if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists - args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id - end - - if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists - args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id - end - - if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists - args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id - end - - if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists - args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id - end -end - -# Uses decision_id's value to keep track of current decision being made -def current_decision args - args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty -end - -# Resets the game. -$gtk.reset diff --git a/samples/99_genre_narrative_rpg/choose_your_own_adventure/license-for-sample.txt b/samples/99_genre_narrative_rpg/choose_your_own_adventure/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_narrative_rpg/choose_your_own_adventure/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/99_genre_narrative_rpg/choose_your_own_adventure/replay.txt b/samples/99_genre_narrative_rpg/choose_your_own_adventure/replay.txt deleted file mode 100644 index 7de4ea1..0000000 --- a/samples/99_genre_narrative_rpg/choose_your_own_adventure/replay.txt +++ /dev/null @@ -1,701 +0,0 @@ -replay_version 2.0 -stopped_at 1227 -seed 100 -recorded_at Sun Sep 29 22:35:15 2019 -[:mouse_move, 610, 150, 2, 1, 136] -[:mouse_move, 595, 157, 2, 2, 137] -[:mouse_move, 580, 169, 2, 3, 138] -[:mouse_move, 558, 189, 2, 4, 139] -[:mouse_move, 546, 200, 2, 5, 140] -[:mouse_move, 522, 222, 2, 6, 141] -[:mouse_move, 472, 262, 2, 7, 142] -[:mouse_move, 461, 270, 2, 8, 143] -[:mouse_move, 432, 291, 2, 9, 144] -[:mouse_move, 417, 301, 2, 10, 145] -[:mouse_move, 409, 306, 2, 11, 146] -[:mouse_move, 399, 313, 2, 12, 147] -[:mouse_move, 391, 315, 2, 13, 148] -[:mouse_move, 386, 315, 2, 14, 149] -[:mouse_move, 380, 317, 2, 15, 150] -[:mouse_move, 378, 317, 2, 16, 151] -[:mouse_move, 375, 318, 2, 17, 152] -[:mouse_move, 373, 319, 2, 18, 153] -[:mouse_move, 377, 329, 2, 19, 154] -[:mouse_move, 401, 349, 2, 20, 155] -[:mouse_move, 528, 437, 2, 21, 156] -[:mouse_move, 612, 485, 2, 22, 157] -[:mouse_move, 724, 531, 2, 23, 158] -[:mouse_move, 746, 532, 2, 24, 159] -[:mouse_move, 760, 532, 2, 25, 160] -[:mouse_move, 754, 521, 2, 26, 171] -[:mouse_move, 744, 504, 2, 27, 172] -[:mouse_move, 738, 496, 2, 28, 173] -[:mouse_move, 721, 476, 2, 29, 174] -[:mouse_move, 711, 465, 2, 30, 175] -[:mouse_move, 701, 454, 2, 31, 176] -[:mouse_move, 681, 435, 2, 32, 177] -[:mouse_move, 672, 427, 2, 33, 178] -[:mouse_move, 662, 417, 2, 34, 179] -[:mouse_move, 656, 412, 2, 35, 180] -[:mouse_move, 649, 406, 2, 36, 181] -[:mouse_move, 645, 403, 2, 37, 182] -[:mouse_move, 641, 401, 2, 38, 183] -[:mouse_move, 639, 399, 2, 39, 184] -[:mouse_move, 637, 399, 2, 40, 185] -[:mouse_move, 636, 398, 2, 41, 186] -[:mouse_move, 633, 398, 2, 42, 187] -[:mouse_move, 632, 398, 2, 43, 188] -[:mouse_move, 630, 398, 2, 44, 189] -[:mouse_move, 638, 399, 2, 45, 193] -[:mouse_move, 641, 399, 2, 46, 194] -[:mouse_move, 648, 400, 2, 47, 195] -[:mouse_move, 667, 400, 2, 48, 196] -[:mouse_move, 677, 400, 2, 49, 197] -[:mouse_move, 698, 397, 2, 50, 198] -[:mouse_move, 707, 395, 2, 51, 199] -[:mouse_move, 728, 391, 2, 52, 200] -[:mouse_move, 744, 390, 2, 53, 201] -[:mouse_move, 754, 389, 2, 54, 202] -[:mouse_move, 763, 389, 2, 55, 203] -[:mouse_move, 777, 389, 2, 56, 204] -[:mouse_move, 785, 389, 2, 57, 205] -[:mouse_move, 797, 389, 2, 58, 206] -[:mouse_move, 803, 389, 2, 59, 207] -[:mouse_move, 814, 389, 2, 60, 208] -[:mouse_move, 818, 389, 2, 61, 209] -[:mouse_move, 826, 389, 2, 62, 210] -[:mouse_move, 829, 389, 2, 63, 211] -[:mouse_move, 837, 388, 2, 64, 212] -[:mouse_move, 842, 388, 2, 65, 213] -[:mouse_move, 850, 388, 2, 66, 214] -[:mouse_move, 855, 388, 2, 67, 215] -[:mouse_move, 864, 388, 2, 68, 216] -[:mouse_move, 870, 388, 2, 69, 217] -[:mouse_move, 881, 389, 2, 70, 218] -[:mouse_move, 886, 390, 2, 71, 219] -[:mouse_move, 896, 390, 2, 72, 220] -[:mouse_move, 901, 390, 2, 73, 221] -[:mouse_move, 910, 390, 2, 74, 222] -[:mouse_move, 914, 390, 2, 75, 223] -[:mouse_move, 918, 390, 2, 76, 224] -[:mouse_move, 926, 390, 2, 77, 225] -[:mouse_move, 928, 390, 2, 78, 226] -[:mouse_move, 937, 390, 2, 79, 227] -[:mouse_move, 940, 390, 2, 80, 228] -[:mouse_move, 945, 390, 2, 81, 229] -[:mouse_move, 948, 390, 2, 82, 230] -[:mouse_move, 954, 390, 2, 83, 231] -[:mouse_move, 957, 390, 2, 84, 232] -[:mouse_move, 961, 390, 2, 85, 233] -[:mouse_move, 963, 390, 2, 86, 234] -[:mouse_move, 965, 390, 2, 87, 235] -[:mouse_move, 963, 390, 2, 88, 238] -[:mouse_move, 955, 390, 2, 89, 239] -[:mouse_move, 951, 390, 2, 90, 240] -[:mouse_move, 941, 390, 2, 91, 241] -[:mouse_move, 930, 388, 2, 92, 242] -[:mouse_move, 912, 388, 2, 93, 243] -[:mouse_move, 892, 388, 2, 94, 244] -[:mouse_move, 866, 388, 2, 95, 245] -[:mouse_move, 830, 390, 2, 96, 247] -[:mouse_move, 804, 393, 2, 97, 248] -[:mouse_move, 777, 396, 2, 98, 249] -[:mouse_move, 757, 398, 2, 99, 250] -[:mouse_move, 746, 399, 2, 100, 251] -[:mouse_move, 731, 399, 2, 101, 252] -[:mouse_move, 715, 399, 2, 102, 253] -[:mouse_move, 712, 399, 2, 103, 254] -[:mouse_move, 703, 399, 2, 104, 255] -[:mouse_move, 700, 399, 2, 105, 256] -[:mouse_move, 698, 399, 2, 106, 257] -[:mouse_move, 697, 399, 2, 107, 258] -[:mouse_move, 696, 399, 2, 108, 259] -[:mouse_move, 697, 399, 2, 109, 263] -[:mouse_move, 708, 399, 2, 110, 264] -[:mouse_move, 722, 399, 2, 111, 265] -[:mouse_move, 755, 398, 2, 112, 266] -[:mouse_move, 775, 396, 2, 113, 267] -[:mouse_move, 805, 393, 2, 114, 268] -[:mouse_move, 820, 392, 2, 115, 269] -[:mouse_move, 840, 392, 2, 116, 270] -[:mouse_move, 852, 392, 2, 117, 271] -[:mouse_move, 871, 392, 2, 118, 272] -[:mouse_move, 878, 392, 2, 119, 273] -[:mouse_move, 893, 393, 2, 120, 274] -[:mouse_move, 899, 393, 2, 121, 275] -[:mouse_move, 907, 394, 2, 122, 276] -[:mouse_move, 910, 394, 2, 123, 277] -[:mouse_move, 913, 395, 2, 124, 278] -[:mouse_move, 917, 395, 2, 125, 279] -[:mouse_move, 918, 395, 2, 126, 280] -[:mouse_move, 919, 395, 2, 127, 281] -[:mouse_move, 918, 395, 2, 128, 283] -[:mouse_move, 917, 395, 2, 129, 284] -[:mouse_move, 913, 395, 2, 130, 285] -[:mouse_move, 908, 395, 2, 131, 286] -[:mouse_move, 888, 397, 2, 132, 287] -[:mouse_move, 856, 399, 2, 133, 288] -[:mouse_move, 739, 406, 2, 134, 289] -[:mouse_move, 666, 412, 2, 135, 290] -[:mouse_move, 536, 422, 2, 136, 291] -[:mouse_move, 450, 429, 2, 137, 292] -[:mouse_move, 347, 438, 2, 138, 293] -[:mouse_move, 323, 442, 2, 139, 294] -[:mouse_move, 248, 455, 2, 140, 295] -[:mouse_move, 235, 455, 2, 141, 308] -[:mouse_move, 225, 454, 2, 142, 309] -[:mouse_move, 200, 450, 2, 143, 310] -[:mouse_move, 186, 447, 2, 144, 311] -[:mouse_move, 154, 437, 2, 145, 312] -[:mouse_move, 135, 433, 2, 146, 313] -[:mouse_move, 113, 427, 2, 147, 314] -[:mouse_move, 101, 424, 2, 148, 315] -[:mouse_move, 82, 421, 2, 149, 316] -[:mouse_move, 75, 420, 2, 150, 317] -[:mouse_move, 64, 419, 2, 151, 318] -[:mouse_move, 59, 418, 2, 152, 319] -[:mouse_move, 49, 416, 2, 153, 320] -[:mouse_move, 47, 416, 2, 154, 321] -[:mouse_move, 39, 414, 2, 155, 322] -[:mouse_move, 38, 414, 2, 156, 323] -[:mouse_move, 34, 413, 2, 157, 324] -[:mouse_move, 33, 413, 2, 158, 325] -[:mouse_move, 35, 414, 2, 159, 329] -[:mouse_move, 47, 420, 2, 160, 330] -[:mouse_move, 56, 424, 2, 161, 331] -[:mouse_move, 67, 427, 2, 162, 332] -[:mouse_move, 96, 432, 2, 163, 333] -[:mouse_move, 112, 434, 2, 164, 334] -[:mouse_move, 142, 434, 2, 165, 335] -[:mouse_move, 161, 433, 2, 166, 336] -[:mouse_move, 173, 431, 2, 167, 337] -[:mouse_move, 190, 426, 2, 168, 338] -[:mouse_move, 210, 418, 2, 169, 339] -[:mouse_move, 218, 414, 2, 170, 340] -[:mouse_move, 231, 408, 2, 171, 341] -[:mouse_move, 237, 405, 2, 172, 342] -[:mouse_move, 248, 398, 2, 173, 343] -[:mouse_move, 252, 394, 2, 174, 344] -[:mouse_move, 257, 387, 2, 175, 345] -[:mouse_move, 259, 383, 2, 176, 346] -[:mouse_move, 260, 372, 2, 177, 347] -[:mouse_move, 260, 367, 2, 178, 348] -[:mouse_move, 249, 353, 2, 179, 349] -[:mouse_move, 240, 345, 2, 180, 350] -[:mouse_move, 226, 335, 2, 181, 351] -[:mouse_move, 217, 329, 2, 182, 352] -[:mouse_move, 193, 315, 2, 183, 353] -[:mouse_move, 184, 310, 2, 184, 354] -[:mouse_move, 164, 304, 2, 185, 355] -[:mouse_move, 152, 301, 2, 186, 356] -[:mouse_move, 123, 299, 2, 187, 357] -[:mouse_move, 109, 299, 2, 188, 358] -[:mouse_move, 94, 299, 2, 189, 359] -[:mouse_move, 73, 300, 2, 190, 360] -[:mouse_move, 53, 305, 2, 191, 361] -[:mouse_move, 31, 313, 2, 192, 362] -[:mouse_move, 27, 315, 2, 193, 363] -[:mouse_move, 11, 324, 2, 194, 364] -[:mouse_move, 3, 329, 2, 195, 365] -[:mouse_move, 0, 337, 2, 196, 366] -[:mouse_move, 15, 433, 2, 197, 374] -[:mouse_move, 31, 437, 2, 198, 375] -[:mouse_move, 38, 438, 2, 199, 375] -[:mouse_move, 50, 440, 2, 200, 376] -[:mouse_move, 53, 440, 2, 201, 377] -[:mouse_move, 65, 441, 2, 202, 378] -[:mouse_move, 68, 442, 2, 203, 379] -[:mouse_move, 70, 442, 2, 204, 380] -[:mouse_move, 71, 442, 2, 205, 381] -[:mouse_move, 72, 442, 2, 206, 382] -[:mouse_move, 72, 441, 2, 207, 383] -[:mouse_move, 72, 439, 2, 208, 384] -[:mouse_move, 72, 438, 2, 209, 385] -[:mouse_move, 71, 436, 2, 210, 386] -[:mouse_move, 71, 434, 2, 211, 386] -[:mouse_move, 70, 433, 2, 212, 387] -[:mouse_move, 69, 431, 2, 213, 388] -[:mouse_move, 68, 429, 2, 214, 388] -[:mouse_move, 66, 427, 2, 215, 389] -[:mouse_move, 66, 426, 2, 216, 390] -[:mouse_move, 63, 423, 2, 217, 390] -[:mouse_move, 62, 422, 2, 218, 391] -[:mouse_move, 59, 419, 2, 219, 392] -[:mouse_move, 58, 418, 2, 220, 392] -[:mouse_move, 57, 416, 2, 221, 393] -[:mouse_move, 56, 414, 2, 222, 394] -[:mouse_move, 55, 413, 2, 223, 394] -[:mouse_move, 54, 412, 2, 224, 395] -[:mouse_move, 53, 410, 2, 225, 396] -[:mouse_move, 53, 409, 2, 226, 396] -[:mouse_move, 52, 408, 2, 227, 397] -[:mouse_move, 52, 407, 2, 228, 398] -[:mouse_move, 51, 405, 2, 229, 399] -[:mouse_move, 51, 404, 2, 230, 400] -[:mouse_move, 53, 404, 2, 231, 411] -[:mouse_move, 57, 404, 2, 232, 412] -[:mouse_move, 61, 405, 2, 233, 413] -[:mouse_move, 66, 405, 2, 234, 413] -[:mouse_move, 68, 405, 2, 235, 414] -[:mouse_move, 75, 405, 2, 236, 415] -[:mouse_move, 77, 405, 2, 237, 416] -[:mouse_move, 81, 402, 2, 238, 417] -[:mouse_move, 82, 400, 2, 239, 418] -[:mouse_move, 83, 398, 2, 240, 419] -[:mouse_move, 83, 395, 2, 241, 419] -[:mouse_move, 83, 391, 2, 242, 420] -[:mouse_move, 83, 387, 2, 243, 421] -[:mouse_move, 81, 383, 2, 244, 421] -[:mouse_move, 80, 379, 2, 245, 422] -[:mouse_move, 77, 375, 2, 246, 423] -[:mouse_move, 74, 371, 2, 247, 423] -[:mouse_move, 71, 368, 2, 248, 424] -[:mouse_move, 67, 366, 2, 249, 425] -[:mouse_move, 62, 364, 2, 250, 425] -[:mouse_move, 56, 364, 2, 251, 426] -[:mouse_move, 51, 364, 2, 252, 427] -[:mouse_move, 49, 364, 2, 253, 427] -[:mouse_move, 45, 364, 2, 254, 428] -[:mouse_move, 42, 364, 2, 255, 429] -[:mouse_move, 36, 367, 2, 256, 430] -[:mouse_move, 35, 370, 2, 257, 431] -[:mouse_move, 32, 377, 2, 258, 432] -[:mouse_move, 32, 382, 2, 259, 433] -[:mouse_move, 32, 392, 2, 260, 434] -[:mouse_move, 32, 396, 2, 261, 435] -[:mouse_move, 41, 408, 2, 262, 436] -[:mouse_move, 47, 411, 2, 263, 437] -[:mouse_move, 57, 414, 2, 264, 438] -[:mouse_move, 64, 415, 2, 265, 439] -[:mouse_move, 70, 415, 2, 266, 440] -[:mouse_move, 76, 415, 2, 267, 440] -[:mouse_move, 81, 415, 2, 268, 441] -[:mouse_move, 85, 414, 2, 269, 442] -[:mouse_move, 89, 411, 2, 270, 442] -[:mouse_move, 92, 408, 2, 271, 443] -[:mouse_move, 95, 404, 2, 272, 444] -[:mouse_move, 96, 400, 2, 273, 444] -[:mouse_move, 96, 395, 2, 274, 445] -[:mouse_move, 97, 391, 2, 275, 446] -[:mouse_move, 97, 387, 2, 276, 446] -[:mouse_move, 96, 384, 2, 277, 447] -[:mouse_move, 91, 379, 2, 278, 448] -[:mouse_move, 84, 376, 2, 279, 448] -[:mouse_move, 71, 374, 2, 280, 449] -[:mouse_move, 63, 374, 2, 281, 450] -[:mouse_move, 53, 374, 2, 282, 451] -[:mouse_move, 47, 374, 2, 283, 452] -[:mouse_move, 37, 376, 2, 284, 453] -[:mouse_move, 31, 380, 2, 285, 454] -[:mouse_move, 25, 394, 2, 286, 455] -[:mouse_move, 24, 407, 2, 287, 456] -[:mouse_move, 24, 427, 2, 288, 457] -[:key_down_raw, 1073741904, 0, 2, 289, 512] -[:key_up_raw, 1073741904, 0, 2, 290, 516] -[:mouse_move, 48, 426, 2, 291, 580] -[:mouse_move, 62, 426, 2, 292, 581] -[:mouse_move, 77, 425, 2, 293, 581] -[:mouse_move, 92, 425, 2, 294, 581] -[:mouse_move, 111, 424, 2, 295, 582] -[:mouse_move, 134, 424, 2, 296, 583] -[:mouse_move, 186, 423, 2, 297, 583] -[:mouse_move, 248, 420, 2, 298, 584] -[:mouse_move, 313, 417, 2, 299, 585] -[:mouse_move, 375, 411, 2, 300, 585] -[:mouse_move, 434, 403, 2, 301, 586] -[:mouse_move, 456, 397, 2, 302, 587] -[:mouse_move, 472, 393, 2, 303, 587] -[:mouse_move, 483, 388, 2, 304, 588] -[:mouse_move, 490, 385, 2, 305, 589] -[:mouse_move, 514, 378, 2, 306, 590] -[:mouse_move, 520, 375, 2, 307, 591] -[:mouse_move, 524, 373, 2, 308, 592] -[:mouse_move, 524, 372, 2, 309, 593] -[:mouse_move, 514, 372, 2, 310, 594] -[:mouse_move, 510, 372, 2, 311, 595] -[:mouse_move, 503, 373, 2, 312, 596] -[:mouse_move, 501, 374, 2, 313, 597] -[:mouse_move, 497, 374, 2, 314, 598] -[:mouse_move, 496, 375, 2, 315, 599] -[:mouse_move, 495, 375, 2, 316, 600] -[:mouse_move, 494, 376, 2, 317, 601] -[:mouse_move, 493, 376, 2, 318, 602] -[:mouse_move, 492, 376, 2, 319, 602] -[:mouse_move, 491, 377, 2, 320, 603] -[:mouse_move, 490, 377, 2, 321, 604] -[:mouse_move, 490, 378, 2, 322, 604] -[:mouse_move, 489, 378, 2, 323, 605] -[:mouse_move, 489, 379, 2, 324, 606] -[:mouse_move, 488, 379, 2, 325, 606] -[:mouse_move, 488, 380, 2, 326, 608] -[:mouse_move, 491, 381, 2, 327, 610] -[:mouse_move, 494, 382, 2, 328, 610] -[:mouse_move, 498, 384, 2, 329, 611] -[:mouse_move, 503, 385, 2, 330, 612] -[:mouse_move, 522, 387, 2, 331, 613] -[:mouse_move, 527, 387, 2, 332, 614] -[:mouse_move, 542, 387, 2, 333, 614] -[:mouse_move, 553, 387, 2, 334, 615] -[:mouse_move, 562, 387, 2, 335, 616] -[:mouse_move, 576, 387, 2, 336, 617] -[:mouse_move, 585, 387, 2, 337, 618] -[:mouse_move, 598, 387, 2, 338, 619] -[:mouse_move, 605, 387, 2, 339, 620] -[:mouse_move, 616, 388, 2, 340, 621] -[:mouse_move, 621, 388, 2, 341, 622] -[:mouse_move, 632, 390, 2, 342, 623] -[:mouse_move, 637, 391, 2, 343, 624] -[:mouse_move, 649, 393, 2, 344, 625] -[:mouse_move, 660, 395, 2, 345, 626] -[:mouse_move, 672, 397, 2, 346, 627] -[:mouse_move, 679, 398, 2, 347, 628] -[:mouse_move, 686, 398, 2, 348, 629] -[:mouse_move, 692, 398, 2, 349, 629] -[:mouse_move, 699, 398, 2, 350, 630] -[:mouse_move, 707, 398, 2, 351, 631] -[:mouse_move, 714, 398, 2, 352, 631] -[:mouse_move, 720, 398, 2, 353, 632] -[:mouse_move, 726, 398, 2, 354, 633] -[:mouse_move, 731, 398, 2, 355, 633] -[:mouse_move, 733, 397, 2, 356, 634] -[:mouse_move, 737, 397, 2, 357, 635] -[:mouse_move, 744, 396, 2, 358, 635] -[:mouse_move, 747, 396, 2, 359, 636] -[:mouse_move, 749, 396, 2, 360, 637] -[:mouse_move, 754, 396, 2, 361, 637] -[:mouse_move, 756, 396, 2, 362, 638] -[:mouse_move, 758, 396, 2, 363, 639] -[:mouse_move, 760, 395, 2, 364, 639] -[:mouse_move, 762, 395, 2, 365, 640] -[:mouse_move, 763, 395, 2, 366, 641] -[:mouse_move, 764, 395, 2, 367, 642] -[:mouse_move, 765, 395, 2, 368, 643] -[:mouse_move, 764, 395, 2, 369, 658] -[:mouse_move, 763, 397, 2, 370, 658] -[:mouse_move, 758, 401, 2, 371, 659] -[:mouse_move, 749, 406, 2, 372, 660] -[:mouse_move, 736, 412, 2, 373, 660] -[:mouse_move, 717, 420, 2, 374, 661] -[:mouse_move, 673, 432, 2, 375, 662] -[:mouse_move, 632, 443, 2, 376, 662] -[:mouse_move, 579, 455, 2, 377, 663] -[:mouse_move, 517, 465, 2, 378, 664] -[:mouse_move, 407, 483, 2, 379, 664] -[:mouse_move, 369, 488, 2, 380, 665] -[:mouse_move, 296, 497, 2, 381, 666] -[:mouse_move, 270, 499, 2, 382, 666] -[:mouse_move, 216, 503, 2, 383, 667] -[:mouse_move, 200, 503, 2, 384, 668] -[:mouse_move, 143, 500, 2, 385, 669] -[:mouse_move, 138, 497, 2, 386, 670] -[:mouse_move, 115, 489, 2, 387, 671] -[:mouse_move, 113, 487, 2, 388, 672] -[:mouse_move, 105, 483, 2, 389, 673] -[:mouse_move, 99, 480, 2, 390, 674] -[:mouse_move, 93, 476, 2, 391, 675] -[:mouse_move, 87, 472, 2, 392, 676] -[:mouse_move, 79, 469, 2, 393, 677] -[:mouse_move, 74, 465, 2, 394, 678] -[:mouse_move, 65, 460, 2, 395, 679] -[:mouse_move, 61, 457, 2, 396, 680] -[:mouse_move, 57, 454, 2, 397, 681] -[:mouse_move, 54, 450, 2, 398, 681] -[:mouse_move, 51, 446, 2, 399, 682] -[:mouse_move, 47, 442, 2, 400, 683] -[:mouse_move, 44, 438, 2, 401, 683] -[:mouse_move, 40, 434, 2, 402, 684] -[:mouse_move, 36, 430, 2, 403, 685] -[:mouse_move, 32, 426, 2, 404, 685] -[:mouse_move, 29, 422, 2, 405, 686] -[:mouse_move, 25, 418, 2, 406, 687] -[:mouse_move, 22, 414, 2, 407, 687] -[:mouse_move, 18, 410, 2, 408, 688] -[:mouse_move, 15, 406, 2, 409, 689] -[:mouse_move, 13, 405, 2, 410, 689] -[:mouse_move, 10, 402, 2, 411, 690] -[:mouse_move, 8, 400, 2, 412, 691] -[:mouse_move, 5, 398, 2, 413, 691] -[:mouse_move, 3, 396, 2, 414, 692] -[:mouse_move, 2, 395, 2, 415, 693] -[:mouse_move, 1, 393, 2, 416, 694] -[:mouse_move, 0, 393, 2, 417, 695] -[:mouse_move, 3, 393, 2, 418, 701] -[:mouse_move, 7, 393, 2, 419, 701] -[:mouse_move, 12, 393, 2, 420, 702] -[:mouse_move, 21, 394, 2, 421, 703] -[:mouse_move, 39, 396, 2, 422, 704] -[:mouse_move, 44, 396, 2, 423, 705] -[:mouse_move, 61, 397, 2, 424, 706] -[:mouse_move, 70, 399, 2, 425, 707] -[:mouse_move, 79, 399, 2, 426, 708] -[:mouse_move, 87, 400, 2, 427, 708] -[:mouse_move, 95, 400, 2, 428, 709] -[:mouse_move, 104, 401, 2, 429, 711] -[:mouse_move, 118, 403, 2, 430, 712] -[:mouse_move, 125, 403, 2, 431, 712] -[:mouse_move, 140, 404, 2, 432, 713] -[:mouse_move, 147, 404, 2, 433, 714] -[:mouse_move, 163, 404, 2, 434, 715] -[:mouse_move, 171, 404, 2, 435, 716] -[:mouse_move, 178, 404, 2, 436, 716] -[:mouse_move, 194, 404, 2, 437, 718] -[:mouse_move, 202, 404, 2, 438, 718] -[:mouse_move, 217, 404, 2, 439, 720] -[:mouse_move, 231, 404, 2, 440, 721] -[:mouse_move, 238, 404, 2, 441, 722] -[:mouse_move, 245, 404, 2, 442, 722] -[:mouse_move, 252, 404, 2, 443, 723] -[:mouse_move, 257, 404, 2, 444, 724] -[:mouse_move, 268, 404, 2, 445, 725] -[:mouse_move, 271, 405, 2, 446, 726] -[:mouse_move, 278, 406, 2, 447, 727] -[:mouse_move, 281, 407, 2, 448, 728] -[:mouse_move, 285, 408, 2, 449, 729] -[:mouse_move, 286, 408, 2, 450, 730] -[:mouse_move, 287, 409, 2, 451, 731] -[:mouse_move, 288, 409, 2, 452, 732] -[:mouse_move, 289, 409, 2, 453, 735] -[:key_down_raw, 1073741904, 0, 2, 454, 785] -[:key_up_raw, 1073741904, 0, 2, 455, 789] -[:mouse_move, 289, 408, 2, 456, 840] -[:mouse_move, 291, 393, 2, 457, 841] -[:mouse_move, 296, 381, 2, 458, 842] -[:mouse_move, 316, 352, 2, 459, 843] -[:mouse_move, 328, 334, 2, 460, 844] -[:mouse_move, 350, 300, 2, 461, 845] -[:mouse_move, 364, 279, 2, 462, 845] -[:mouse_move, 387, 242, 2, 463, 846] -[:mouse_move, 410, 206, 2, 464, 847] -[:mouse_move, 420, 192, 2, 465, 847] -[:mouse_move, 439, 168, 2, 466, 848] -[:mouse_move, 446, 161, 2, 467, 849] -[:mouse_move, 459, 146, 2, 468, 849] -[:mouse_move, 469, 137, 2, 469, 850] -[:mouse_move, 471, 134, 2, 470, 851] -[:mouse_move, 477, 128, 2, 471, 851] -[:mouse_move, 479, 125, 2, 472, 852] -[:mouse_move, 481, 123, 2, 473, 853] -[:mouse_move, 482, 121, 2, 474, 853] -[:mouse_move, 482, 120, 2, 475, 854] -[:mouse_move, 482, 119, 2, 476, 855] -[:mouse_move, 480, 117, 2, 477, 855] -[:mouse_move, 478, 115, 2, 478, 856] -[:mouse_move, 475, 113, 2, 479, 857] -[:mouse_move, 473, 110, 2, 480, 857] -[:mouse_move, 473, 109, 2, 481, 858] -[:mouse_move, 471, 106, 2, 482, 859] -[:mouse_move, 469, 102, 2, 483, 860] -[:mouse_move, 469, 98, 2, 484, 861] -[:mouse_move, 469, 94, 2, 485, 861] -[:mouse_move, 470, 91, 2, 486, 862] -[:mouse_move, 472, 86, 2, 487, 863] -[:mouse_move, 476, 81, 2, 488, 864] -[:mouse_move, 477, 78, 2, 489, 865] -[:mouse_move, 480, 75, 2, 490, 866] -[:mouse_move, 481, 74, 2, 491, 867] -[:mouse_move, 482, 73, 2, 492, 868] -[:mouse_move, 482, 72, 2, 493, 869] -[:mouse_move, 484, 72, 2, 494, 873] -[:mouse_move, 486, 72, 2, 495, 874] -[:mouse_move, 488, 73, 2, 496, 874] -[:mouse_move, 492, 74, 2, 497, 875] -[:mouse_move, 497, 75, 2, 498, 876] -[:mouse_move, 502, 76, 2, 499, 876] -[:mouse_move, 509, 77, 2, 500, 877] -[:mouse_move, 517, 77, 2, 501, 878] -[:mouse_move, 530, 78, 2, 502, 878] -[:mouse_move, 540, 79, 2, 503, 879] -[:mouse_move, 550, 79, 2, 504, 880] -[:mouse_move, 555, 80, 2, 505, 880] -[:mouse_move, 563, 81, 2, 506, 881] -[:mouse_move, 572, 81, 2, 507, 882] -[:mouse_move, 580, 82, 2, 508, 882] -[:mouse_move, 587, 82, 2, 509, 883] -[:mouse_move, 593, 82, 2, 510, 884] -[:mouse_move, 599, 82, 2, 511, 884] -[:mouse_move, 602, 83, 2, 512, 885] -[:mouse_move, 608, 83, 2, 513, 886] -[:mouse_move, 616, 83, 2, 514, 887] -[:mouse_move, 620, 84, 2, 515, 888] -[:mouse_move, 627, 84, 2, 516, 889] -[:mouse_move, 631, 84, 2, 517, 890] -[:mouse_move, 636, 84, 2, 518, 890] -[:mouse_move, 640, 84, 2, 519, 891] -[:mouse_move, 645, 84, 2, 520, 892] -[:mouse_move, 656, 84, 2, 521, 893] -[:mouse_move, 661, 84, 2, 522, 894] -[:mouse_move, 671, 84, 2, 523, 895] -[:mouse_move, 676, 84, 2, 524, 896] -[:mouse_move, 682, 83, 2, 525, 897] -[:mouse_move, 689, 82, 2, 526, 898] -[:mouse_move, 693, 82, 2, 527, 899] -[:mouse_move, 696, 81, 2, 528, 899] -[:mouse_move, 700, 81, 2, 529, 900] -[:mouse_move, 704, 81, 2, 530, 901] -[:mouse_move, 707, 80, 2, 531, 901] -[:mouse_move, 711, 80, 2, 532, 902] -[:mouse_move, 714, 79, 2, 533, 903] -[:mouse_move, 718, 79, 2, 534, 903] -[:mouse_move, 720, 79, 2, 535, 904] -[:mouse_move, 724, 78, 2, 536, 905] -[:mouse_move, 727, 77, 2, 537, 905] -[:mouse_move, 730, 76, 2, 538, 906] -[:mouse_move, 733, 76, 2, 539, 907] -[:mouse_move, 737, 75, 2, 540, 907] -[:mouse_move, 740, 75, 2, 541, 908] -[:mouse_move, 742, 74, 2, 542, 909] -[:mouse_move, 746, 74, 2, 543, 909] -[:mouse_move, 749, 73, 2, 544, 910] -[:mouse_move, 753, 73, 2, 545, 911] -[:mouse_move, 760, 73, 2, 546, 912] -[:mouse_move, 763, 73, 2, 547, 913] -[:mouse_move, 767, 72, 2, 548, 913] -[:mouse_move, 768, 72, 2, 549, 914] -[:mouse_move, 771, 72, 2, 550, 915] -[:mouse_move, 777, 71, 2, 551, 916] -[:mouse_move, 778, 70, 2, 552, 917] -[:mouse_move, 781, 70, 2, 553, 918] -[:mouse_move, 782, 70, 2, 554, 919] -[:mouse_move, 784, 70, 2, 555, 920] -[:mouse_move, 786, 70, 2, 556, 921] -[:mouse_move, 788, 70, 2, 557, 922] -[:mouse_move, 789, 70, 2, 558, 923] -[:mouse_move, 790, 70, 2, 559, 924] -[:key_down_raw, 1073741906, 0, 2, 560, 990] -[:key_up_raw, 1073741906, 0, 2, 561, 994] -[:mouse_move, 722, 94, 2, 562, 1047] -[:mouse_move, 699, 106, 2, 563, 1048] -[:mouse_move, 679, 118, 2, 564, 1048] -[:mouse_move, 658, 130, 2, 565, 1049] -[:mouse_move, 640, 142, 2, 566, 1050] -[:mouse_move, 616, 164, 2, 567, 1051] -[:mouse_move, 597, 185, 2, 568, 1052] -[:mouse_move, 579, 211, 2, 569, 1053] -[:mouse_move, 572, 222, 2, 570, 1054] -[:mouse_move, 564, 249, 2, 571, 1055] -[:mouse_move, 561, 269, 2, 572, 1056] -[:mouse_move, 558, 307, 2, 573, 1057] -[:mouse_move, 558, 334, 2, 574, 1058] -[:mouse_move, 560, 370, 2, 575, 1059] -[:mouse_move, 556, 369, 2, 576, 1073] -[:mouse_move, 548, 366, 2, 577, 1074] -[:mouse_move, 533, 361, 2, 578, 1075] -[:mouse_move, 512, 354, 2, 579, 1075] -[:mouse_move, 486, 347, 2, 580, 1076] -[:mouse_move, 455, 342, 2, 581, 1077] -[:mouse_move, 416, 339, 2, 582, 1078] -[:mouse_move, 391, 339, 2, 583, 1079] -[:mouse_move, 354, 341, 2, 584, 1080] -[:mouse_move, 339, 345, 2, 585, 1081] -[:mouse_move, 321, 351, 2, 586, 1082] -[:mouse_move, 312, 354, 2, 587, 1083] -[:mouse_move, 305, 358, 2, 588, 1084] -[:mouse_move, 301, 360, 2, 589, 1085] -[:mouse_move, 297, 364, 2, 590, 1086] -[:mouse_move, 296, 367, 2, 591, 1087] -[:mouse_move, 296, 369, 2, 592, 1088] -[:mouse_move, 296, 372, 2, 593, 1088] -[:mouse_move, 297, 375, 2, 594, 1089] -[:mouse_move, 301, 382, 2, 595, 1090] -[:mouse_move, 308, 387, 2, 596, 1090] -[:mouse_move, 316, 392, 2, 597, 1091] -[:mouse_move, 328, 397, 2, 598, 1092] -[:mouse_move, 352, 407, 2, 599, 1092] -[:mouse_move, 370, 411, 2, 600, 1093] -[:mouse_move, 392, 416, 2, 601, 1094] -[:mouse_move, 418, 419, 2, 602, 1094] -[:mouse_move, 449, 422, 2, 603, 1095] -[:mouse_move, 481, 424, 2, 604, 1096] -[:mouse_move, 517, 428, 2, 605, 1096] -[:mouse_move, 549, 432, 2, 606, 1097] -[:mouse_move, 583, 435, 2, 607, 1098] -[:mouse_move, 617, 438, 2, 608, 1098] -[:mouse_move, 651, 439, 2, 609, 1099] -[:mouse_move, 686, 440, 2, 610, 1100] -[:mouse_move, 718, 443, 2, 611, 1100] -[:mouse_move, 750, 444, 2, 612, 1101] -[:mouse_move, 782, 444, 2, 613, 1102] -[:mouse_move, 795, 444, 2, 614, 1102] -[:mouse_move, 822, 444, 2, 615, 1103] -[:mouse_move, 847, 444, 2, 616, 1104] -[:mouse_move, 867, 441, 2, 617, 1104] -[:mouse_move, 885, 438, 2, 618, 1105] -[:mouse_move, 900, 434, 2, 619, 1106] -[:mouse_move, 917, 427, 2, 620, 1107] -[:mouse_move, 934, 420, 2, 621, 1108] -[:mouse_move, 946, 412, 2, 622, 1109] -[:mouse_move, 953, 406, 2, 623, 1110] -[:mouse_move, 965, 392, 2, 624, 1111] -[:mouse_move, 974, 380, 2, 625, 1112] -[:mouse_move, 983, 359, 2, 626, 1113] -[:mouse_move, 986, 347, 2, 627, 1114] -[:mouse_move, 988, 334, 2, 628, 1115] -[:mouse_move, 990, 318, 2, 629, 1115] -[:mouse_move, 991, 301, 2, 630, 1116] -[:mouse_move, 991, 285, 2, 631, 1117] -[:mouse_move, 987, 270, 2, 632, 1117] -[:mouse_move, 973, 244, 2, 633, 1118] -[:mouse_move, 957, 229, 2, 634, 1119] -[:mouse_move, 934, 214, 2, 635, 1119] -[:mouse_move, 886, 190, 2, 636, 1120] -[:mouse_move, 847, 177, 2, 637, 1121] -[:mouse_move, 804, 167, 2, 638, 1121] -[:mouse_move, 755, 159, 2, 639, 1122] -[:mouse_move, 705, 154, 2, 640, 1123] -[:mouse_move, 682, 153, 2, 641, 1123] -[:mouse_move, 599, 151, 2, 642, 1124] -[:mouse_move, 577, 151, 2, 643, 1125] -[:mouse_move, 532, 151, 2, 644, 1125] -[:mouse_move, 492, 152, 2, 645, 1126] -[:mouse_move, 476, 155, 2, 646, 1127] -[:mouse_move, 444, 158, 2, 647, 1127] -[:mouse_move, 418, 163, 2, 648, 1128] -[:mouse_move, 394, 169, 2, 649, 1129] -[:mouse_move, 373, 174, 2, 650, 1129] -[:mouse_move, 353, 181, 2, 651, 1130] -[:mouse_move, 336, 189, 2, 652, 1131] -[:mouse_move, 307, 203, 2, 653, 1132] -[:mouse_move, 302, 207, 2, 654, 1133] -[:mouse_move, 284, 223, 2, 655, 1134] -[:mouse_move, 272, 236, 2, 656, 1135] -[:mouse_move, 261, 259, 2, 657, 1136] -[:mouse_move, 256, 272, 2, 658, 1137] -[:mouse_move, 251, 300, 2, 659, 1138] -[:mouse_move, 250, 314, 2, 660, 1139] -[:mouse_move, 250, 331, 2, 661, 1140] -[:mouse_move, 250, 334, 2, 662, 1141] -[:mouse_move, 251, 342, 2, 663, 1142] -[:mouse_move, 251, 348, 2, 664, 1142] -[:mouse_move, 255, 358, 2, 665, 1143] -[:mouse_move, 258, 365, 2, 666, 1144] -[:mouse_move, 261, 371, 2, 667, 1144] -[:mouse_move, 266, 378, 2, 668, 1145] -[:mouse_move, 273, 386, 2, 669, 1146] -[:mouse_move, 281, 395, 2, 670, 1146] -[:mouse_move, 286, 400, 2, 671, 1147] -[:mouse_move, 293, 408, 2, 672, 1148] -[:mouse_move, 300, 415, 2, 673, 1148] -[:mouse_move, 315, 427, 2, 674, 1149] -[:mouse_move, 325, 432, 2, 675, 1150] -[:mouse_move, 344, 441, 2, 676, 1150] -[:mouse_move, 358, 446, 2, 677, 1151] -[:mouse_move, 379, 452, 2, 678, 1152] -[:mouse_move, 402, 458, 2, 679, 1152] -[:mouse_move, 425, 464, 2, 680, 1153] -[:mouse_move, 454, 470, 2, 681, 1154] -[:mouse_move, 480, 474, 2, 682, 1154] -[:mouse_move, 511, 478, 2, 683, 1155] -[:mouse_move, 541, 480, 2, 684, 1156] -[:mouse_move, 573, 482, 2, 685, 1156] -[:mouse_move, 609, 485, 2, 686, 1157] -[:mouse_move, 647, 488, 2, 687, 1158] -[:mouse_move, 685, 492, 2, 688, 1158] -[:mouse_move, 719, 496, 2, 689, 1159] -[:mouse_move, 734, 497, 2, 690, 1160] -[:mouse_move, 761, 498, 2, 691, 1160] -[:mouse_move, 769, 498, 2, 692, 1161] -[:mouse_move, 784, 498, 2, 693, 1162] -[:mouse_move, 799, 493, 2, 694, 1163] -[:mouse_move, 802, 491, 2, 695, 1164] -[:key_down_raw, 1073742051, 1024, 2, 696, 1225] -[:key_down_raw, 113, 1024, 2, 697, 1226] diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb deleted file mode 100644 index cc1e021..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/lowrez_simulator.rb +++ /dev/null @@ -1,91 +0,0 @@ -################################################################################### -# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES -# THE 64x64 CANVAS. -################################################################################### - -TINY_RESOLUTION = 64 -TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) -CENTER_OFFSET = 10 -EMULATED_FONT_SIZE = 20 -EMULATED_FONT_X_ZERO = 0 -EMULATED_FONT_Y_ZERO = 46 - -def tick args - sprites = [] - labels = [] - borders = [] - solids = [] - mouse = emulate_lowrez_mouse args - args.state.show_gridlines = false - lowrez_tick args, sprites, labels, borders, solids, mouse - render_gridlines_if_needed args - render_mouse_crosshairs args, mouse - emulate_lowrez_scene args, sprites, labels, borders, solids, mouse -end - -def emulate_lowrez_mouse args - args.state.new_entity_strict(:lowrez_mouse) do |m| - 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 - m.click = [ - 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 - else - m.click = nil - m.down = nil - end - - if args.mouse.up - m.up = [ - 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 - end - end -end - -def render_mouse_crosshairs args, mouse - return unless args.state.show_gridlines - args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] -end - -def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse - args.render_target(:lowrez).solids << [0, 0, 1280, 720] - args.render_target(:lowrez).sprites << sprites - args.render_target(:lowrez).borders << borders - args.render_target(:lowrez).solids << solids - args.outputs.primitives << labels.map do |l| - as_label = l.label - l.text.each_char.each_with_index.map do |char, i| - [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, 'fonts/dragonruby-gtk-4x4.ttf'].label - end - end - - args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] -end - -def render_gridlines_if_needed args - if args.state.show_gridlines && args.static_lines.length == 0 - args.static_lines << 65.times.map do |i| - [ - [CENTER_OFFSET + i * TINY_SCALE + 1, 0, - CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], - [CENTER_OFFSET + i * TINY_SCALE, 0, - CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], - [CENTER_OFFSET, 0 + i * TINY_SCALE, - CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], - [CENTER_OFFSET, 1 + i * TINY_SCALE, - CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] - ] - end - elsif !args.state.show_gridlines - args.static_lines.clear - end -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/main.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/main.rb deleted file mode 100644 index b6573a3..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/main.rb +++ /dev/null @@ -1,423 +0,0 @@ -require 'app/require.rb' - -def defaults args - args.outputs.background_color = [0, 0, 0] - args.state.last_story_line_text ||= "" - args.state.scene_history ||= [] - args.state.storyline_history ||= [] - args.state.word_delay ||= 8 - if args.state.tick_count == 0 - args.gtk.stop_music - args.outputs.sounds << 'sounds/static-loop.ogg' - end - - if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at - lines = args.state - .storyline_history[-1] - .gsub("-", "") - .gsub("~", "") - .wrapped_lines(55) - - args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0) - elsif !args.state.is_storyline_dialog_active - args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50)) - end - - return if args.state.current_scene - set_scene(args, day_one_beginning(args)) -end - -def inputs_move_player args - if args.state.scene_changed_at.elapsed_time > 5 - if args.keyboard.down || args.keyboard.s || args.keyboard.j - args.state.player.y -= 0.25 - elsif args.keyboard.up || args.keyboard.w || args.keyboard.k - args.state.player.y += 0.25 - end - - if args.keyboard.left || args.keyboard.a || args.keyboard.h - args.state.player.x -= 0.25 - elsif args.keyboard.right || args.keyboard.d || args.keyboard.l - args.state.player.x += 0.25 - end - - args.state.player.y = 60 if args.state.player.y > 63 - args.state.player.y = 0 if args.state.player.y < -3 - args.state.player.x = 60 if args.state.player.x > 63 - args.state.player.x = 0 if args.state.player.x < -3 - end -end - -def null_or_empty? ary - return true unless ary - return true if ary.length == 0 - return false -end - -def calc_storyline_hotspot args - hotspots = args.state.storylines.find_all do |hs| - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) - end - - if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot - _, _, _, _, storyline = hotspots.first - queue_storyline_text(args, storyline) - args.state.inside_storyline_hotspot = true - elsif null_or_empty?(hotspots) - args.state.inside_storyline_hotspot = false - end -end - -def calc_scenes args - hotspots = args.state.scenes.find_all do |hs| - args.state.player.inside_rect?(hs.shift_rect(-2, 0)) - end - - if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot - _, _, _, _, scene_method_or_hash = hotspots.first - if scene_method_or_hash.is_a? Symbol - set_scene(args, send(scene_method_or_hash, args)) - args.state.last_hotspot_scene = scene_method_or_hash - args.state.scene_history << scene_method_or_hash - else - set_scene(args, scene_method_or_hash) - end - args.state.inside_scene_hotspot = true - elsif null_or_empty?(hotspots) - args.state.inside_scene_hotspot = false - end -end - -def null_or_whitespace? word - return true if !word - return true if word.strip.length == 0 - return false -end - -def calc_storyline_presentation args - return unless args.state.tick_count > args.state.next_storyline - return unless args.state.scene_storyline_queue - next_storyline = args.state.scene_storyline_queue.shift - if null_or_whitespace? next_storyline - args.state.storyline_queue_empty_at ||= args.state.tick_count - args.state.is_storyline_dialog_active = false - return - end - args.state.storyline_to_show = next_storyline - args.state.is_storyline_dialog_active = true - args.state.storyline_queue_empty_at = nil - if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") - args.state.next_storyline += 60 - elsif next_storyline.end_with?(",") - args.state.next_storyline += 50 - elsif next_storyline.end_with?(":") - args.state.next_storyline += 60 - else - default_word_delay = 13 + args.state.word_delay - 8 - if next_storyline.gsub("-", "").gsub("~", "").length <= 4 - default_word_delay = 11 + args.state.word_delay - 8 - end - number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length - args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) - end -end - -def inputs_reload_current_scene args - return - if args.inputs.keyboard.key_down.r! - reload_current_scene - end -end - -def inputs_dismiss_current_storyline args - if args.inputs.keyboard.key_down.x! - args.state.scene_storyline_queue.clear - end -end - -def inputs_restart_game args - if args.inputs.keyboard.exclamation_point - args.gtk.reset_state - end -end - -def inputs_change_word_delay args - if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign - args.state.word_delay -= 2 - if args.state.word_delay < 0 - args.state.word_delay = 0 - # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" - else - # queue_storyline_text args, "Text speed INCREASED." - end - end - - if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore - args.state.word_delay += 2 - # queue_storyline_text args, "Text speed DECREASED." - end -end - -def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil - texts.each_with_index.map do |t, i| - [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] - end -end - -def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse - # args.state.show_gridlines = true - defaults args - render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_solids << [0, 0, 64, 64, 0, 0, 0] - calc_storyline_presentation args - calc_scenes args - calc_storyline_hotspot args - inputs_move_player args - inputs_print_mouse_rect args, lowrez_mouse - inputs_reload_current_scene args - inputs_dismiss_current_storyline args - inputs_change_word_delay args - inputs_restart_game args - if !args.state.storyline_queue_empty_at - args.outputs.labels << multiple_lines(args, 690, 80, - ["Press \"X\" on the keyboard to dismiss dialog.", - "Press \"+\" on the keyboard to INCREASE text speed.", - "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255) - end -end - -def inputs_print_mouse_rect args, lowrez_mouse - if lowrez_mouse.click - if args.state.previous_mouse_click - dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x - dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y - x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy - - if dx < 0 && dx < 0 - x = x + w - w = w.abs - y = y + h - h = h.abs - end - - w += 1 - h += 1 - - puts [x, y, w, h] - args.state.previous_mouse_click = nil - else - args.state.previous_mouse_click = lowrez_mouse.click - square_x, square_y = lowrez_mouse.click - puts [square_x, square_y] - 8.map_with_index do |i| - puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1] - end - end - - end -end - -def try_centering! word - word ||= "" - just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") - return word if just_word.strip.length == 0 - return word if just_word.include? "~" - return "~#{word}" if just_word.length <= 2 - if just_word.length.mod_zero? 2 - center_index = just_word.length.idiv(2) - 1 - else - center_index = (just_word.length - 1).idiv(2) - end - return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" -end - -def queue_storyline args, scene - queue_storyline_text args, scene[:storyline] -end - -def queue_storyline_text args, text - args.state.last_story_line_text = text - args.state.storyline_history << text if text - words = (text || "").split(" ") - words = words.map { |w| try_centering! w } - args.state.scene_storyline_queue = words - if args.state.scene_storyline_queue.length != 0 - args.state.scene_storyline_queue.unshift "~$--" - args.state.storyline_to_show = "~." - else - args.state.storyline_to_show = "" - end - args.state.scene_storyline_queue << "" - args.state.next_storyline = args.state.tick_count -end - -def set_scene args, scene - args.state.current_scene = scene - args.state.background = scene[:background] || 'sprites/todo.png' - args.state.scene_fade = scene[:fade] || 0 - args.state.scenes = (scene[:scenes] || []).reject { |s| !s } - args.state.scene_render_override = scene[:render_override] - args.state.storylines = (scene[:storylines] || []).reject { |s| !s } - args.state.scene_changed_at = args.state.tick_count - if scene[:player] - args.state.player = scene[:player] - end - args.state.inside_scene_hotspot = false - args.state.inside_storyline_hotspot = false - queue_storyline args, scene -end - -def replay_storyline_rect - [26, -1, 7, 4] -end - -def labels_for_word word - left_side_of_word = "" - center_letter = "" - right_side_of_word = "" - - if word[0] == "~" - left_side_of_word = "" - center_letter = word[1] - right_side_of_word = word[2..-1] - elsif word.length > 0 - left_side_of_word, right_side_of_word = word.split("~") - center_letter = right_side_of_word[0] - right_side_of_word = right_side_of_word[1..-1] - end - - right_side_of_word = right_side_of_word.gsub("-", "") - - { - left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], - center: [29, 2, center_letter, 255, 0, 0], - right: [34, 2, right_side_of_word] - } -end - -def render_scenes args, lowrez_sprites - lowrez_sprites << args.state.scenes.flat_map do |hs| - hotspot_square args, hs.x, hs.y, hs.w, hs.h - end -end - -def render_storylines args, lowrez_sprites - lowrez_sprites << args.state.storylines.flat_map do |hs| - hotspot_square args, hs.x, hs.y, hs.w, hs.h - end -end - -def adornments_alpha args, target_alpha = nil, minimum_alpha = nil - return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at - target_alpha ||= 255 - target_alpha * args.state.storyline_queue_empty_at.ease(60) -end - -def hotspot_square args, x, y, w, h - if w >= 3 && h >= 3 - [ - [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], - [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], - [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], - ] - else - [ - [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], - ] - end -end - -def render_storyline_dialog args, lowrez_labels, lowrez_sprites - return unless args.state.is_storyline_dialog_active - return unless args.state.storyline_to_show - labels = labels_for_word args.state.storyline_to_show - if true # high rez version - scale = 8.88 - offset = 45 - size = 25 - args.outputs.labels << [offset + labels[:left].x.-(1) * scale, - labels[:left].y * TINY_SCALE + 55, - labels[:left].text, size, 0, 0, 0, 0, 255, - 'fonts/manaspc.ttf'] - center_text = labels[:center].text - center_text = "|" if center_text == "$" - args.outputs.labels << [offset + labels[:center].x * scale, - labels[:center].y * TINY_SCALE + 55, - center_text, size, 0, 255, 0, 0, 255, - 'fonts/manaspc.ttf'] - args.outputs.labels << [offset + labels[:right].x * scale, - labels[:right].y * TINY_SCALE + 55, - labels[:right].text, size, 0, 0, 0, 0, 255, - 'fonts/manaspc.ttf'] - else - lowrez_labels << labels[:left] - lowrez_labels << labels[:center] - lowrez_labels << labels[:right] - end - args.state.is_storyline_dialog_active = true - render_player args, lowrez_sprites - lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] -end - -def render_player args, lowrez_sprites - lowrez_sprites << player_md_down(args, *args.state.player) -end - -def render_adornments args, lowrez_sprites - render_scenes args, lowrez_sprites - render_storylines args, lowrez_sprites - return if args.state.is_storyline_dialog_active - lowrez_sprites << player_md_down(args, *args.state.player) -end - -def global_alpha_percentage args, max_alpha = 255 - return 255 unless args.state.scene_changed_at - return 255 unless args.state.scene_fade - return 255 unless args.state.scene_fade > 0 - return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) -end - -def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] - if args.state.scene_render_override - send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids - end - storyline_to_show = args.state.storyline_to_show || "" - render_adornments args, lowrez_sprites - render_storyline_dialog args, lowrez_labels, lowrez_sprites - - if args.state.background == 'sprites/tribute-game-over.png' - lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] - lowrez_labels << [9, 6, 'Return of', 255, 255, 255] - lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] - if !args.state.ended - args.gtk.stop_music - args.outputs.sounds << 'sounds/music-loop.ogg' - args.state.ended = true - end - end -end - -def player_md_right args, x, y - [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] -end - -def player_md_left args, x, y - [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] -end - -def player_md_up args, x, y - [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] -end - -def player_md_down args, x, y - [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] -end - -def player_sm args, x, y - [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] -end - -def player_xs args, x, y - [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/repl.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/repl.rb deleted file mode 100644 index a59baf5..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/repl.rb +++ /dev/null @@ -1 +0,0 @@ -puts $gtk.args.state.current_scene diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/require.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/require.rb deleted file mode 100644 index 35d0ff0..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/require.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'app/lowrez_simulator.rb' -require 'app/storyline_day_one.rb' -require 'app/storyline_blinking_light.rb' -require 'app/storyline_serenity_introduction.rb' -require 'app/storyline_speed_of_light.rb' -require 'app/storyline_serenity_alive.rb' -require 'app/storyline_serenity_bio.rb' -require 'app/storyline_anka.rb' -require 'app/storyline_final_message.rb' -require 'app/storyline_final_decision.rb' -require 'app/storyline.rb' diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline.rb deleted file mode 100644 index e881861..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline.rb +++ /dev/null @@ -1,146 +0,0 @@ -def hotspot_top - [4, 61, 56, 3] -end - -def hotspot_bottom - [4, 0, 56, 3] -end - -def hotspot_top_right - [62, 35, 3, 25] -end - -def hotspot_bottom_right - [62, 0, 3, 25] -end - -def storyline_history_include? args, text - args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } -end - -def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -end - -def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -end - -def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -end - -def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -end - -def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids - lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] - lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] -end - -def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] - result_one_scene, result_one_label, result_one_text = context_result_one - result_two_scene, result_two_label, result_two_text = context_result_two - result_three_scene, result_three_label, result_three_text = context_result_three - result_four_scene, result_four_label, result_four_text = context_result_four - - top_level_hash = { - background: 'sprites/decision.png', - fade: 60, - player: [20, 36], - storylines: [ ], - scenes: [ ] - } - - confirmation_result_one_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } - - confirmation_result_two_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } - - confirmation_result_three_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } - - confirmation_result_four_hash = { - background: 'sprites/decision.png', - scenes: [ ], - storylines: [ ] - } - - top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] - top_level_hash[:storylines] << [20, 35, 4, 4, context_action] - - confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] - confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] - confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] - - confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] - confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] - - confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] - confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] - confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] - confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] - - confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] - confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] - confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] - confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] - confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] - - top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] - top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene - top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene - top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] - - top_level_hash -end - -def ship_control_hotspot offset_x, offset_y, a, b, c, d - results = [] - results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a - results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b - results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c - results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d - results -end - -def reload_current_scene - if $gtk.args.state.last_hotspot_scene - set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) - tick $gtk.args - elsif respond_to? :set_scene - set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) - tick $gtk.args - end - $gtk.console.close -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb deleted file mode 100644 index bad7795..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_anka.rb +++ /dev/null @@ -1,127 +0,0 @@ -def anka_inside_room args - { - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], - ], - scenes: [ - [32, -1, 8, 3, :anka_observatory] - ] - } -end - -def anka_observatory args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] - ], - scenes: [ - [30, 18, 5, 12, :anka_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } -end - -def anka_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 60, - storylines: [ - [22, 45, 17, 4, (anka_last_reply args)], - [45, 45, 4, 4, (anka_current_reply args)], - ], - scenes: [ - [*hotspot_top_right, :reply_to_anka] - ] - } -end - -def reply_to_anka args - decision_graph anka_current_reply(args), - "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", - [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], - [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] -end - -def anka_last_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Buffer--: #{serenity_alive_firm_reply.quote}" - else - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" - end -end - -def anka_reply_whole_truth - "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." -end - -def anka_reply_half_truth - "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." -end - -def replied_with_whole_truth args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], - [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], - ] - } -end - -def replied_with_half_truth args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], - [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], - ] - } -end - -def anka_current_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." - else - return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." - end -end - -def replied_to_anka_back_home args - if args.state.scene_history.include? :replied_with_whole_truth - return { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], - ], - scenes: [ - [30, 38, 12, 13, :final_message_sad], - ] - } - else - return { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], - ], - scenes: [ - [30, 38, 12, 13, :final_message_happy], - ] - } - end -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb deleted file mode 100644 index ba9e8a2..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_blinking_light.rb +++ /dev/null @@ -1,75 +0,0 @@ -def the_blinking_light args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :blinking_light_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } -end - -def blinking_light_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :blinking_light_path_to_observatory] - ], - render_override: :blinking_light_mountain_pass_render - } -end - -def blinking_light_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :blinking_light_observatory] - ], - render_override: :blinking_light_path_to_observatory_render - } -end - -def blinking_light_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :blinking_light_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } -end - -def blinking_light_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [ - [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] - ], - scenes: [ - [30, 18, 5, 12, :blinking_light_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } -end - -def blinking_light_inside_mainframe args - { - background: 'sprites/mainframe.png', - fade: 60, - player: [30, 4], - scenes: [ - [62, 32, 4, 32, :reply_to_introduction] - ], - storylines: [ - [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], - [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], - [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], - [14, 20, 24, 4, "What the heck activated--- this thing- though?"] - ] - } -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb deleted file mode 100644 index 24b2b45..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_day_one.rb +++ /dev/null @@ -1,206 +0,0 @@ -def day_one_beginning args - { - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [0, 0, 64, 2, :day_one_infront_of_home], - ], - storylines: [ - [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] - ] - } -end - -def day_one_infront_of_home args - { - background: 'sprites/front-of-home.png', - player: [56, 23], - scenes: [ - [43, 34, 10, 16, :day_one_home], - [62, 0, 3, 40, :day_one_beginning], - [0, 4, 3, 20, :day_one_ceremony] - ], - storylines: [ - [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], - ] - } -end - -def day_one_home args - { - background: 'sprites/inside-home.png', - player: [34, 3], - scenes: [ - [28, 0, 12, 2, :day_one_infront_of_home] - ], - storylines: [ - [ - 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." - ], - [ - 28, 7, 4, 7, - "Ahhh. My reading- couch. It's so comfortable--." - ], - [ - 38, 21, 4, 4, - "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." - ], - [ - 45, 37, 4, 8, - "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." - ], - [ - 32, 40, 8, 10, - "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." - ], - [ - 25, 21, 5, 12, - "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." - ] - ] - } -end - -def day_one_ceremony args - { - background: 'sprites/tribute.png', - player: [57, 21], - scenes: [ - [62, 0, 2, 40, :day_one_infront_of_home], - [0, 24, 2, 40, :day_one_infront_of_library] - ], - storylines: [ - [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], - [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], - [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], - [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], - ] - } -end - -def day_one_infront_of_library args - { - background: 'sprites/outside-library.png', - player: [57, 21], - scenes: [ - [62, 0, 2, 40, :day_one_ceremony], - [49, 39, 6, 9, :day_one_library] - ], - storylines: [ - [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] - ] - } -end - -def day_one_library args - { - background: 'sprites/library.png', - player: [27, 4], - scenes: [ - [0, 0, 64, 2, :end_day_one_infront_of_library] - ], - storylines: [ - [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], - [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] - ] - } -end - -def end_day_one_infront_of_library args - { - background: 'sprites/outside-library.png', - player: [51, 33], - scenes: [ - [49, 39, 6, 9, :day_one_library], - [62, 0, 2, 40, :end_day_one_monument], - ], - storylines: [ - [50, 27, 4, 4, "It's getting late. Better get some sleep."] - ] - } -end - -def end_day_one_monument args - { - background: 'sprites/tribute.png', - player: [2, 36], - scenes: [ - [62, 0, 2, 40, :end_day_one_infront_of_home], - ], - storylines: [ - [50, 27, 4, 4, "It's getting late. Better get some sleep."], - ] - } -end - -def end_day_one_infront_of_home args - { - background: 'sprites/front-of-home.png', - player: [1, 17], - scenes: [ - [43, 34, 10, 16, :end_day_one_home], - ], - storylines: [ - [20, 10, 4, 4, "It's getting late. Better get some sleep."], - ] - } -end - -def end_day_one_home args - { - background: 'sprites/inside-home.png', - player: [34, 3], - scenes: [ - [32, 40, 8, 10, :end_day_one_dream], - ], - storylines: [ - [38, 4, 4, 4, "It's getting late. Better get some sleep."], - ] - } -end - -def end_day_one_dream args - { - background: 'sprites/dream.png', - fade: 60, - player: [4, 4], - scenes: [ - [62, 0, 2, 64, :explaining_the_special_power] - ], - storylines: [ - [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], - [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], - [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] - ] - } -end - -def explaining_the_special_power args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [32, 30], - scenes: [ - [ - 38, 21, 4, 4, :explaining_the_special_power_inside_computer - ], - ] - } -end - -def explaining_the_special_power_inside_computer args - { - background: 'sprites/pc.png', - fade: 60, - player: [34, 4], - scenes: [ - [0, 62, 64, 3, :the_blinking_light] - ], - storylines: [ - [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], - [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], - [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], - [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] - ] - } -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb deleted file mode 100644 index 0ea190f..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_decision.rb +++ /dev/null @@ -1,136 +0,0 @@ -def final_decision_side_of_home args - { - fade: 120, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :final_decision_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render, - storylines: [ - [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] - ] - } -end - -def final_decision_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :final_decision_path_to_observatory] - ], - render_override: :blinking_light_mountain_pass_render - } -end - -def final_decision_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :final_decision_observatory] - ], - render_override: :blinking_light_path_to_observatory_render - } -end - -def final_decision_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :final_decision_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } -end - -def final_decision_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [], - scenes: [ - [30, 18, 5, 12, :final_decision_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } -end - -def final_decision_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - storylines: [], - scenes: [ - [*hotspot_top, :final_decision_ship_status], - ] - } -end - -def final_decision_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [*hotspot_top_right, :final_decision] - ], - storylines: [ - [30, 8, 4, 4, "????"], - *final_decision_ship_status_shared(args) - ] - } -end - -def final_decision args - decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", - "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", - [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], - [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], - [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], - [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] -end - -def final_decision_game_over_noone args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } -end - -def final_decision_game_over_matthew args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } -end - -def final_decision_game_over_anka args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } -end - -def final_decision_game_over_sasha args - { - background: 'sprites/tribute-game-over.png', - player: [53, 14], - fade: 600 - } -end - -def final_decision_ship_status_shared args - [ - *ship_control_hotspot(24, 22, - "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", - "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", - "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", - "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), - ] -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb deleted file mode 100644 index c7737e2..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_final_message.rb +++ /dev/null @@ -1,216 +0,0 @@ -def final_message_sad args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Another-- sleepless-- night..."], - ], - scenes: [ - [32, -1, 8, 3, :final_message_observatory] - ] - } -end - -def final_message_happy args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Oh man, I slept like rock!"], - ], - scenes: [ - [32, -1, 8, 3, :final_message_observatory] - ] - } -end - -def final_message_side_of_home args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :final_message_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } -end - -def final_message_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :final_message_path_to_observatory], - ], - storylines: [ - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] - ], - render_override: :blinking_light_mountain_pass_render - } -end - -def final_message_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :final_message_observatory] - ], - storylines: [ - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] - ], - render_override: :blinking_light_path_to_observatory_render - } -end - -def final_message_observatory args - if args.state.scene_history.include? :replied_with_whole_truth - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Here-- we- go..."] - ], - scenes: [ - [30, 18, 5, 12, :final_message_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - else - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] - ], - scenes: [ - [30, 18, 5, 12, :final_message_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } - end -end - -def final_message_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 60, - scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] - } -end - -def final_message_check_ship_status args - { - background: 'sprites/mainframe.png', - storylines: [ - [45, 45, 4, 4, (final_message_current args)], - ], - scenes: [ - [*hotspot_top, :final_message_ship_status], - ] - } -end - -def final_message_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [30, 50, 4, 4, :final_message_ship_status_reviewed] - ], - storylines: [ - [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], - *final_message_ship_status_shared(args) - ] - } -end - -def final_message_ship_status_reviewed args - { - background: 'sprites/serenity.png', - fade: 60, - scenes: [ - [*hotspot_bottom, :final_message_summary] - ], - storylines: [ - [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], - ] - } -end - -def final_message_ship_status_shared args - [ - *ship_control_hotspot( 0, 50, - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", - "Matthew's--- Chamber--: OCCUPIED----", - "Aanka's--- Chamber--: OCCUPIED----", - "Sasha's--- Chamber--: OCCUPIED----"), - *ship_control_hotspot(12, 35, - "Life- Support--: Not-- Needed---", - "O2--- Production---: OFF---", - "CO2--- Scrubbers---: OFF---", - "H2O--- Production---: OFF---"), - *ship_control_hotspot(24, 20, - "Navigation: Offline---", - "Sensor: OFF---", - "Heads- Up- Display: DAMAGED---", - "Arithmetic--- Unit: DAMAGED----"), - *ship_control_hotspot(36, 35, - "COMM: Underpowered----", - "Text: ON---", - "Audio: SEGFAULT---", - "Video: DAMAGED---"), - *ship_control_hotspot(48, 50, - "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", - "Engine I: ON---", - "Engine II: ON---", - "Engine III: ON---") - ] -end - -def final_message_last_reply args - if args.state.scene_history.include? :replied_with_whole_truth - return "Buffer--: #{anka_reply_whole_truth.quote}" - else - return "Buffer--: #{anka_reply_half_truth.quote}" - end -end - -def final_message_current args - if args.state.scene_history.include? :replied_with_whole_truth - return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." - else - return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" - end -end - -def final_message_summary args - if args.state.scene_history.include? :replied_with_whole_truth - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [31, 11], - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], - storylines: [ - [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], - ] - } - else - return { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [31, 11], - scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], - storylines: [ - [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], - ] - } - end -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb deleted file mode 100644 index 4407699..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_alive.rb +++ /dev/null @@ -1,219 +0,0 @@ -def serenity_alive_side_of_home args - { - fade: 60, - background: 'sprites/side-of-home.png', - player: [16, 13], - scenes: [ - [52, 24, 11, 5, :serenity_alive_mountain_pass], - ], - render_override: :blinking_light_side_of_home_render - } -end - -def serenity_alive_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [4, 4], - scenes: [ - [18, 47, 5, 5, :serenity_alive_path_to_observatory], - ], - storylines: [ - [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] - ], - render_override: :blinking_light_mountain_pass_render - } -end - -def serenity_alive_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [60, 4], - scenes: [ - [0, 26, 5, 5, :serenity_alive_observatory] - ], - storylines: [ - [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] - ], - render_override: :blinking_light_path_to_observatory_render - } -end - -def serenity_alive_observatory args - { - background: 'sprites/observatory.png', - player: [60, 2], - scenes: [ - [28, 39, 4, 10, :serenity_alive_inside_observatory] - ], - render_override: :blinking_light_observatory_render - } -end - -def serenity_alive_inside_observatory args - { - background: 'sprites/inside-observatory.png', - player: [60, 2], - storylines: [], - scenes: [ - [30, 18, 5, 12, :serenity_alive_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } -end - -def serenity_alive_inside_mainframe args - { - background: 'sprites/mainframe.png', - fade: 60, - player: [30, 4], - scenes: [ - [*hotspot_top, :serenity_alive_ship_status], - ], - storylines: [ - [22, 45, 17, 4, (serenity_alive_last_reply args)], - [45, 45, 4, 4, (serenity_alive_current_message args)], - ] - } -end - -def serenity_alive_ship_status args - { - background: 'sprites/serenity.png', - fade: 60, - player: [30, 10], - scenes: [ - [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] - ], - storylines: [ - [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], - [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], - *serenity_alive_shared_ship_status(args) - ] - } -end - -def serenity_alive_ship_status_reviewed args - { - background: 'sprites/serenity.png', - fade: 60, - scenes: [ - [*hotspot_bottom, :serenity_alive_time_to_reply] - ], - storylines: [ - [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], - ] - } -end - -def serenity_alive_time_to_reply args - decision_graph serenity_alive_current_message(args), - "Okay... time to deliver the bad news...", - [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], - [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] -end - -def serenity_alive_shared_ship_status args - [ - *ship_control_hotspot( 0, 50, - "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", - nil, - nil, - nil), - *ship_control_hotspot(12, 35, - "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", - nil, - nil, - nil), - *ship_control_hotspot(24, 20, - "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", - nil, - nil, - nil), - *ship_control_hotspot(36, 35, - "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", - nil, - nil, - nil), - *ship_control_hotspot(48, 50, - "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", - nil, - nil, - nil) - ] -end - -def serenity_alive_firm_reply - "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." -end - -def serenity_alive_sugarcoated_reply - "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." -end - -def replied_to_serenity_alive_firmly args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], - *serenity_alive_reply_completed_shared_hotspots(args), - ] - } -end - -def replied_to_serenity_alive_kindly args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_alive_path_from_observatory] - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], - *serenity_alive_reply_completed_shared_hotspots(args), - ] - } -end - -def serenity_alive_path_from_observatory args - { - fade: 60, - background: 'sprites/path-to-observatory.png', - player: [4, 21], - scenes: [ - [*hotspot_bottom_right, :serenity_bio_infront_of_home] - ], - storylines: [ - [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] - ] - } -end - -def serenity_alive_reply_completed_shared_hotspots args - [ - [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], - [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], - [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] - ] -end - -def serenity_alive_last_reply args - if args.state.scene_history.include? :replied_to_introduction_seriously - return "Buffer--: \"Hello, Who- is sending-- this message--?\"" - else - return "Buffer--: \"New- phone. Who dis?\"" - end -end - -def serenity_alive_current_message args - if args.state.scene_history.include? :replied_to_introduction_seriously - "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote - else - "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote - end -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb deleted file mode 100644 index 587f5f4..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_bio.rb +++ /dev/null @@ -1,151 +0,0 @@ -def serenity_bio_infront_of_home args - { - fade: 60, - background: 'sprites/front-of-home.png', - player: [54, 23], - scenes: [ - [44, 34, 8, 14, :serenity_bio_inside_home], - [0, 3, 3, 22, :serenity_bio_library] - ] - } -end - -def serenity_bio_inside_home args - { - background: 'sprites/inside-home.png', - player: [34, 4], - storylines: [ - [34, 4, 4, 4, "I'm--- completely--- exhausted."], - ], - scenes: [ - [30, 38, 12, 13, :serenity_bio_restless_sleep], - [32, 0, 8, 3, :serenity_bio_infront_of_home], - ] - } -end - -def serenity_bio_restless_sleep args - { - fade: 60, - background: 'sprites/inside-home.png', - storylines: [ - [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], - ], - scenes: [ - [32, 0, 8, 3, :serenity_bio_infront_of_home], - ] - } -end - -def serenity_bio_library args - { - background: 'sprites/library.png', - fade: 60, - player: [30, 7], - scenes: [ - [21, 35, 3, 18, :serenity_bio_book] - ] - } -end - -def serenity_bio_book args - { - background: 'sprites/book.png', - fade: 60, - player: [6, 52], - storylines: [ - [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], - - [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], - [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], - - [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], - [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], - - [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], - [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], - ], - scenes: [ - [*hotspot_bottom, :serenity_bio_finally_to_bed] - ] - } -end - -def serenity_bio_finally_to_bed args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [35, 3], - storylines: [ - [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], - ], - scenes: [ - [32, 38, 10, 13, :bad_dream], - ] - } -end - -def bad_dream args - { - fade: 120, - background: 'sprites/inside-home.png', - player: [34, 35], - storylines: [ - [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], - ], - scenes: [ - [32, -1, 8, 3, :bad_dream_observatory] - ] - } -end - -def bad_dream_observatory args - { - background: 'sprites/inside-observatory.png', - fade: 120, - player: [51, 12], - storylines: [ - [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] - ], - scenes: [ - [30, 18, 5, 12, :bad_dream_inside_mainframe] - ], - render_override: :blinking_light_inside_observatory_render - } -end - -def bad_dream_inside_mainframe args - { - player: [32, 4], - background: 'sprites/mainframe.png', - fade: 120, - storylines: [ - [22, 45, 17, 4, (bad_dream_last_reply args)], - ], - scenes: [ - [45, 45, 4, 4, :bad_dream_everyone_dead], - ] - } -end - -def bad_dream_everyone_dead args - { - background: 'sprites/mainframe.png', - storylines: [ - [22, 45, 17, 4, (bad_dream_last_reply args)], - [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], - [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], - ], - scenes: [ - [*hotspot_bottom, :anka_inside_room] - ] - } -end - -def bad_dream_last_reply args - if args.state.scene_history.include? :replied_to_serenity_alive_firmly - return "Buffer--: #{serenity_alive_firm_reply.quote}" - else - return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" - end -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb deleted file mode 100644 index d1a5a50..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_serenity_introduction.rb +++ /dev/null @@ -1,95 +0,0 @@ -# decision_graph "Message from Sasha", -# "I should reply.", -# [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], -# [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] -def reply_to_introduction args - decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", - "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", - [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], - [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] -end - -def replied_to_introduction_seriously args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - *replied_to_introduction_shared_scenes(args) - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], - *replied_to_introduction_shared_storylines(args) - ] - } -end - -def replied_to_introduction_humorously args - { - background: 'sprites/inside-observatory.png', - fade: 60, - player: [32, 21], - scenes: [ - *replied_to_introduction_shared_scenes(args) - ], - storylines: [ - [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], - *replied_to_introduction_shared_storylines(args) - ] - } -end - -def replied_to_introduction_shared_storylines args - [ - [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], - [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], - [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] - ] -end - -def replied_to_introduction_shared_scenes args - [[60, 0, 4, 32, :replied_to_introduction_observatory]] -end - -def replied_to_introduction_observatory args - { - background: 'sprites/observatory.png', - player: [28, 39], - scenes: [ - [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] - ] - } -end - -def replied_to_introduction_path_to_observatory args - { - background: 'sprites/path-to-observatory.png', - player: [0, 26], - scenes: [ - [60, 0, 4, 20, :replied_to_introduction_mountain_pass] - ], - } -end - -def replied_to_introduction_mountain_pass args - { - background: 'sprites/mountain-pass-zoomed-out.png', - player: [21, 48], - scenes: [ - [0, 0, 15, 4, :replied_to_introduction_side_of_home] - ], - storylines: [ - [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] - ] - } -end - -def replied_to_introduction_side_of_home args - { - background: 'sprites/side-of-home.png', - player: [58, 29], - scenes: [ - [2, 0, 61, 2, :speed_of_light_front_of_home] - ], - } -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb b/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb deleted file mode 100644 index fdd6b47..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/app/storyline_speed_of_light.rb +++ /dev/null @@ -1,104 +0,0 @@ -def speed_of_light_front_of_home args - { - background: 'sprites/front-of-home.png', - player: [54, 23], - scenes: [ - [44, 34, 8, 14, :speed_of_light_inside_home], - [0, 3, 3, 22, :speed_of_light_outside_library] - ] - } -end - -def speed_of_light_inside_home args - { - background: 'sprites/inside-home.png', - player: [35, 4], - storylines: [ - [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] - ], - scenes: [ - [32, 0, 8, 3, :speed_of_light_front_of_home], - ] - } -end - -def speed_of_light_outside_library args - { - background: 'sprites/outside-library.png', - player: [55, 19], - scenes: [ - [49, 39, 6, 10, :speed_of_light_library], - [61, 11, 3, 20, :speed_of_light_front_of_home] - ] - } -end - -def speed_of_light_library args - { - background: 'sprites/library.png', - player: [30, 7], - scenes: [ - [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] - ] - } -end - -def speed_of_light_celestial_bodies_diagram args - { - background: 'sprites/planets.png', - fade: 60, - player: [30, 3], - scenes: [ - [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] - ], - storylines: [ - [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], - - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], - # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], - ] - } -end - -def speed_of_light_distance_discovered args - { - background: 'sprites/planets.png', - scenes: [ - [13, 0, 44, 3, :speed_of_light_end_of_day] - ], - storylines: [ - [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], - [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], - [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], - [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], - [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], - [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], - [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], - [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], - [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], - [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], - ] - } -end - -def speed_of_light_end_of_day args - { - fade: 60, - background: 'sprites/inside-home.png', - player: [35, 0], - storylines: [ - [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] - ], - scenes: [ - [31, 38, 10, 12, :serenity_alive_side_of_home] - ] - } -end diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf b/samples/99_genre_narrative_rpg/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf deleted file mode 100644 index 24cc711..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/fonts/manaspc.ttf b/samples/99_genre_narrative_rpg/return_of_serenity/fonts/manaspc.ttf deleted file mode 100644 index 0c56733..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/fonts/manaspc.ttf and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/license-for-sample.txt b/samples/99_genre_narrative_rpg/return_of_serenity/license-for-sample.txt deleted file mode 100644 index b1005ed..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/license-for-sample.txt +++ /dev/null @@ -1,9 +0,0 @@ -Copyright 2019 DragonRuby LLC, Amir Rajan - -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/99_genre_narrative_rpg/return_of_serenity/replay.txt b/samples/99_genre_narrative_rpg/return_of_serenity/replay.txt deleted file mode 100644 index 428883e..0000000 --- a/samples/99_genre_narrative_rpg/return_of_serenity/replay.txt +++ /dev/null @@ -1,793 +0,0 @@ -replay_version 2.0 -stopped_at 2284 -seed 100 -recorded_at Sun Sep 29 23:33:07 2019 -[:mouse_move, 758, 597, 2, 1, 353] -[:mouse_move, 556, 669, 2, 2, 353] -[:mouse_move, 550, 669, 2, 3, 353] -[:mouse_move, 543, 670, 2, 4, 357] -[:mouse_move, 540, 670, 2, 5, 358] -[:mouse_move, 536, 670, 2, 6, 359] -[:mouse_move, 535, 670, 2, 7, 360] -[:mouse_move, 534, 669, 2, 8, 361] -[:mouse_move, 533, 668, 2, 9, 362] -[:mouse_move, 534, 667, 2, 10, 364] -[:mouse_move, 539, 666, 2, 11, 365] -[:mouse_move, 564, 665, 2, 12, 366] -[:mouse_move, 580, 665, 2, 13, 367] -[:mouse_move, 598, 665, 2, 14, 368] -[:mouse_move, 611, 666, 2, 15, 369] -[:mouse_move, 623, 668, 2, 16, 370] -[:mouse_move, 629, 669, 2, 17, 371] -[:mouse_move, 637, 672, 2, 18, 372] -[:mouse_move, 638, 673, 2, 19, 373] -[:mouse_move, 642, 677, 2, 20, 374] -[:mouse_move, 645, 680, 2, 21, 375] -[:mouse_move, 655, 686, 2, 22, 376] -[:mouse_move, 664, 690, 2, 23, 377] -[:mouse_move, 686, 694, 2, 24, 378] -[:mouse_move, 699, 696, 2, 25, 379] -[:mouse_move, 717, 697, 2, 26, 380] -[:mouse_move, 728, 698, 2, 27, 381] -[:mouse_move, 745, 698, 2, 28, 382] -[:mouse_move, 748, 698, 2, 29, 383] -[:mouse_move, 757, 698, 2, 30, 384] -[:mouse_move, 761, 698, 2, 31, 385] -[:mouse_move, 766, 698, 2, 32, 386] -[:mouse_move, 769, 698, 2, 33, 387] -[:mouse_move, 771, 699, 2, 34, 388] -[:mouse_move, 773, 699, 2, 35, 389] -[:mouse_move, 774, 699, 2, 36, 390] -[:mouse_move, 775, 699, 2, 37, 391] -[:mouse_move, 768, 699, 2, 38, 393] -[:mouse_move, 762, 698, 2, 39, 394] -[:mouse_move, 748, 695, 2, 40, 395] -[:mouse_move, 733, 693, 2, 41, 396] -[:mouse_move, 712, 689, 2, 42, 397] -[:mouse_move, 700, 688, 2, 43, 398] -[:mouse_move, 675, 685, 2, 44, 399] -[:mouse_move, 661, 684, 2, 45, 400] -[:mouse_move, 631, 684, 2, 46, 401] -[:mouse_move, 615, 684, 2, 47, 402] -[:mouse_move, 595, 685, 2, 48, 403] -[:mouse_move, 582, 685, 2, 49, 404] -[:mouse_move, 564, 687, 2, 50, 405] -[:mouse_move, 558, 688, 2, 51, 406] -[:mouse_move, 551, 689, 2, 52, 407] -[:mouse_move, 547, 689, 2, 53, 408] -[:mouse_move, 543, 690, 2, 54, 409] -[:mouse_move, 541, 690, 2, 55, 410] -[:mouse_move, 540, 690, 2, 56, 411] -[:mouse_move, 539, 690, 2, 57, 412] -[:mouse_move, 547, 691, 2, 58, 416] -[:mouse_move, 559, 692, 2, 59, 417] -[:mouse_move, 592, 697, 2, 60, 418] -[:mouse_move, 613, 698, 2, 61, 419] -[:mouse_move, 645, 701, 2, 62, 420] -[:mouse_move, 664, 701, 2, 63, 421] -[:mouse_move, 687, 702, 2, 64, 422] -[:mouse_move, 700, 702, 2, 65, 423] -[:mouse_move, 717, 702, 2, 66, 424] -[:mouse_move, 720, 702, 2, 67, 425] -[:mouse_move, 728, 702, 2, 68, 426] -[:mouse_move, 731, 702, 2, 69, 427] -[:mouse_move, 735, 702, 2, 70, 428] -[:mouse_move, 736, 702, 2, 71, 429] -[:mouse_move, 737, 702, 2, 72, 430] -[:mouse_move, 735, 702, 2, 73, 432] -[:mouse_move, 730, 702, 2, 74, 433] -[:mouse_move, 716, 702, 2, 75, 434] -[:mouse_move, 707, 701, 2, 76, 435] -[:mouse_move, 684, 700, 2, 77, 436] -[:mouse_move, 672, 699, 2, 78, 437] -[:mouse_move, 645, 698, 2, 79, 438] -[:mouse_move, 640, 698, 2, 80, 439] -[:mouse_move, 619, 698, 2, 81, 440] -[:mouse_move, 609, 698, 2, 82, 441] -[:mouse_move, 603, 698, 2, 83, 442] -[:mouse_move, 595, 698, 2, 84, 443] -[:mouse_move, 591, 698, 2, 85, 444] -[:mouse_move, 586, 699, 2, 86, 445] -[:mouse_move, 585, 699, 2, 87, 446] -[:mouse_move, 583, 699, 2, 88, 447] -[:mouse_move, 587, 699, 2, 89, 451] -[:mouse_move, 593, 699, 2, 90, 452] -[:mouse_move, 608, 700, 2, 91, 453] -[:mouse_move, 618, 700, 2, 92, 454] -[:mouse_move, 643, 700, 2, 93, 455] -[:mouse_move, 655, 700, 2, 94, 456] -[:mouse_move, 671, 700, 2, 95, 457] -[:mouse_move, 681, 700, 2, 96, 458] -[:mouse_move, 692, 700, 2, 97, 459] -[:mouse_move, 698, 700, 2, 98, 460] -[:mouse_move, 705, 700, 2, 99, 461] -[:mouse_move, 706, 700, 2, 100, 462] -[:mouse_move, 708, 700, 2, 101, 463] -[:mouse_move, 709, 700, 2, 102, 464] -[:mouse_move, 708, 700, 2, 103, 465] -[:mouse_move, 703, 700, 2, 104, 466] -[:mouse_move, 689, 700, 2, 105, 467] -[:mouse_move, 680, 700, 2, 106, 468] -[:mouse_move, 670, 700, 2, 107, 469] -[:mouse_move, 644, 700, 2, 108, 470] -[:mouse_move, 631, 700, 2, 109, 471] -[:mouse_move, 612, 700, 2, 110, 472] -[:mouse_move, 600, 700, 2, 111, 473] -[:mouse_move, 582, 700, 2, 112, 474] -[:mouse_move, 579, 700, 2, 113, 475] -[:mouse_move, 570, 700, 2, 114, 476] -[:mouse_move, 567, 700, 2, 115, 477] -[:mouse_move, 564, 700, 2, 116, 478] -[:mouse_move, 563, 700, 2, 117, 479] -[:mouse_move, 562, 700, 2, 118, 480] -[:mouse_move, 563, 700, 2, 119, 482] -[:mouse_move, 568, 701, 2, 120, 483] -[:mouse_move, 584, 702, 2, 121, 484] -[:mouse_move, 606, 703, 2, 122, 485] -[:mouse_move, 632, 704, 2, 123, 486] -[:mouse_move, 649, 705, 2, 124, 487] -[:mouse_move, 669, 706, 2, 125, 488] -[:mouse_move, 673, 706, 2, 126, 489] -[:mouse_move, 689, 706, 2, 127, 490] -[:mouse_move, 694, 706, 2, 128, 491] -[:mouse_move, 698, 706, 2, 129, 492] -[:mouse_move, 693, 706, 2, 130, 495] -[:mouse_move, 685, 706, 2, 131, 496] -[:mouse_move, 663, 705, 2, 132, 497] -[:mouse_move, 649, 704, 2, 133, 498] -[:mouse_move, 620, 703, 2, 134, 499] -[:mouse_move, 614, 703, 2, 135, 500] -[:mouse_move, 601, 703, 2, 136, 501] -[:mouse_move, 595, 703, 2, 137, 502] -[:mouse_move, 589, 703, 2, 138, 503] -[:mouse_move, 587, 703, 2, 139, 504] -[:mouse_move, 586, 704, 2, 140, 505] -[:mouse_move, 591, 704, 2, 141, 507] -[:mouse_move, 597, 704, 2, 142, 508] -[:mouse_move, 613, 705, 2, 143, 509] -[:mouse_move, 618, 705, 2, 144, 510] -[:mouse_move, 633, 705, 2, 145, 511] -[:mouse_move, 641, 705, 2, 146, 512] -[:mouse_move, 648, 705, 2, 147, 513] -[:mouse_move, 651, 705, 2, 148, 514] -[:mouse_move, 654, 705, 2, 149, 515] -[:mouse_move, 655, 705, 2, 150, 516] -[:mouse_move, 657, 705, 2, 151, 517] -[:mouse_move, 658, 705, 2, 152, 565] -[:mouse_move, 651, 701, 2, 153, 611] -[:mouse_move, 645, 699, 2, 154, 612] -[:mouse_move, 625, 692, 2, 155, 613] -[:mouse_move, 611, 689, 2, 156, 614] -[:mouse_move, 590, 687, 2, 157, 615] -[:mouse_move, 578, 687, 2, 158, 616] -[:mouse_move, 564, 687, 2, 159, 617] -[:mouse_move, 559, 687, 2, 160, 618] -[:mouse_move, 553, 687, 2, 161, 619] -[:mouse_move, 551, 687, 2, 162, 620] -[:mouse_move, 550, 687, 2, 163, 621] -[:mouse_move, 553, 688, 2, 164, 623] -[:mouse_move, 558, 690, 2, 165, 624] -[:mouse_move, 578, 694, 2, 166, 625] -[:mouse_move, 591, 696, 2, 167, 626] -[:mouse_move, 634, 703, 2, 168, 627] -[:mouse_move, 645, 704, 2, 169, 628] -[:mouse_move, 682, 708, 2, 170, 629] -[:mouse_move, 698, 709, 2, 171, 630] -[:mouse_move, 704, 710, 2, 172, 631] -[:mouse_move, 720, 710, 2, 173, 632] -[:mouse_move, 726, 710, 2, 174, 633] -[:mouse_move, 732, 710, 2, 175, 634] -[:mouse_move, 733, 710, 2, 176, 635] -[:mouse_move, 729, 710, 2, 177, 637] -[:mouse_move, 716, 710, 2, 178, 638] -[:mouse_move, 711, 710, 2, 179, 639] -[:mouse_move, 693, 710, 2, 180, 640] -[:mouse_move, 684, 710, 2, 181, 641] -[:mouse_move, 669, 710, 2, 182, 642] -[:mouse_move, 663, 709, 2, 183, 643] -[:mouse_move, 652, 708, 2, 184, 644] -[:mouse_move, 650, 707, 2, 185, 645] -[:mouse_move, 644, 705, 2, 186, 646] -[:mouse_move, 641, 705, 2, 187, 647] -[:mouse_move, 638, 703, 2, 188, 648] -[:mouse_move, 636, 702, 2, 189, 649] -[:mouse_move, 631, 699, 2, 190, 650] -[:mouse_move, 628, 696, 2, 191, 651] -[:mouse_move, 622, 690, 2, 192, 652] -[:mouse_move, 619, 686, 2, 193, 653] -[:mouse_move, 613, 675, 2, 194, 654] -[:mouse_move, 610, 669, 2, 195, 655] -[:mouse_move, 601, 656, 2, 196, 656] -[:mouse_move, 597, 650, 2, 197, 657] -[:mouse_move, 592, 644, 2, 198, 658] -[:mouse_move, 583, 634, 2, 199, 659] -[:mouse_move, 582, 632, 2, 200, 660] -[:mouse_move, 575, 626, 2, 201, 661] -[:mouse_move, 573, 624, 2, 202, 662] -[:mouse_move, 566, 619, 2, 203, 663] -[:mouse_move, 564, 617, 2, 204, 664] -[:mouse_move, 558, 612, 2, 205, 665] -[:mouse_move, 554, 609, 2, 206, 666] -[:mouse_move, 545, 601, 2, 207, 667] -[:mouse_move, 540, 596, 2, 208, 668] -[:mouse_move, 532, 588, 2, 209, 669] -[:mouse_move, 527, 584, 2, 210, 670] -[:mouse_move, 522, 579, 2, 211, 671] -[:mouse_move, 518, 576, 2, 212, 672] -[:mouse_move, 514, 571, 2, 213, 673] -[:mouse_move, 512, 570, 2, 214, 674] -[:mouse_move, 508, 568, 2, 215, 675] -[:mouse_move, 507, 567, 2, 216, 677] -[:mouse_move, 506, 567, 2, 217, 678] -[:mouse_move, 506, 568, 2, 218, 679] -[:mouse_move, 506, 570, 2, 219, 680] -[:mouse_move, 510, 580, 2, 220, 681] -[:mouse_move, 514, 586, 2, 221, 682] -[:mouse_move, 523, 596, 2, 222, 683] -[:mouse_move, 526, 597, 2, 223, 684] -[:mouse_move, 533, 602, 2, 224, 685] -[:mouse_move, 536, 603, 2, 225, 686] -[:mouse_move, 537, 604, 2, 226, 687] -[:mouse_move, 541, 603, 2, 227, 688] -[:mouse_move, 542, 601, 2, 228, 689] -[:mouse_move, 546, 594, 2, 229, 690] -[:mouse_move, 548, 590, 2, 230, 691] -[:mouse_move, 551, 580, 2, 231, 692] -[:mouse_move, 552, 575, 2, 232, 693] -[:mouse_move, 554, 568, 2, 233, 694] -[:mouse_move, 555, 563, 2, 234, 695] -[:mouse_move, 556, 556, 2, 235, 696] -[:mouse_move, 556, 552, 2, 236, 697] -[:mouse_move, 556, 548, 2, 237, 698] -[:mouse_move, 555, 545, 2, 238, 699] -[:mouse_move, 550, 541, 2, 239, 700] -[:mouse_move, 547, 539, 2, 240, 701] -[:mouse_move, 539, 536, 2, 241, 702] -[:mouse_move, 536, 535, 2, 242, 703] -[:mouse_move, 527, 534, 2, 243, 704] -[:mouse_move, 525, 534, 2, 244, 705] -[:mouse_move, 518, 534, 2, 245, 706] -[:mouse_move, 516, 534, 2, 246, 707] -[:mouse_move, 511, 536, 2, 247, 708] -[:mouse_move, 509, 537, 2, 248, 709] -[:mouse_move, 506, 540, 2, 249, 710] -[:mouse_move, 505, 542, 2, 250, 711] -[:mouse_move, 503, 545, 2, 251, 712] -[:mouse_move, 503, 551, 2, 252, 713] -[:mouse_move, 503, 554, 2, 253, 714] -[:mouse_move, 503, 565, 2, 254, 715] -[:mouse_move, 504, 570, 2, 255, 716] -[:mouse_move, 511, 582, 2, 256, 717] -[:mouse_move, 515, 586, 2, 257, 718] -[:mouse_move, 521, 591, 2, 258, 719] -[:mouse_move, 524, 593, 2, 259, 720] -[:mouse_move, 530, 594, 2, 260, 721] -[:mouse_move, 535, 594, 2, 261, 722] -[:mouse_move, 538, 592, 2, 262, 723] -[:mouse_move, 540, 589, 2, 263, 724] -[:mouse_move, 542, 583, 2, 264, 725] -[:mouse_move, 543, 579, 2, 265, 726] -[:mouse_move, 543, 574, 2, 266, 727] -[:mouse_move, 543, 571, 2, 267, 728] -[:mouse_move, 543, 568, 2, 268, 729] -[:mouse_move, 543, 567, 2, 269, 730] -[:mouse_move, 543, 566, 2, 270, 731] -[:mouse_move, 544, 566, 2, 271, 749] -[:mouse_move, 547, 565, 2, 272, 750] -[:mouse_move, 548, 565, 2, 273, 751] -[:mouse_move, 550, 564, 2, 274, 752] -[:mouse_move, 551, 564, 2, 275, 753] -[:mouse_move, 552, 563, 2, 276, 754] -[:mouse_move, 553, 562, 2, 277, 755] -[:mouse_move, 552, 562, 2, 278, 761] -[:mouse_move, 552, 564, 2, 279, 762] -[:mouse_move, 552, 565, 2, 280, 763] -[:mouse_move, 552, 569, 2, 281, 764] -[:mouse_move, 552, 572, 2, 282, 765] -[:mouse_move, 556, 581, 2, 283, 766] -[:mouse_move, 559, 586, 2, 284, 767] -[:mouse_move, 563, 592, 2, 285, 768] -[:mouse_move, 574, 601, 2, 286, 769] -[:mouse_move, 580, 605, 2, 287, 770] -[:mouse_move, 591, 610, 2, 288, 771] -[:mouse_move, 597, 611, 2, 289, 772] -[:mouse_move, 607, 611, 2, 290, 773] -[:mouse_move, 611, 609, 2, 291, 774] -[:mouse_move, 617, 599, 2, 292, 775] -[:mouse_move, 619, 593, 2, 293, 776] -[:mouse_move, 619, 579, 2, 294, 777] -[:mouse_move, 619, 572, 2, 295, 778] -[:mouse_move, 615, 560, 2, 296, 779] -[:mouse_move, 612, 556, 2, 297, 780] -[:mouse_move, 604, 548, 2, 298, 781] -[:mouse_move, 602, 547, 2, 299, 782] -[:mouse_move, 597, 543, 2, 300, 783] -[:mouse_move, 592, 541, 2, 301, 784] -[:mouse_move, 586, 539, 2, 302, 785] -[:mouse_move, 583, 539, 2, 303, 786] -[:mouse_move, 576, 539, 2, 304, 787] -[:mouse_move, 574, 539, 2, 305, 788] -[:mouse_move, 569, 539, 2, 306, 789] -[:mouse_move, 567, 539, 2, 307, 790] -[:mouse_move, 564, 540, 2, 308, 791] -[:mouse_move, 563, 540, 2, 309, 792] -[:mouse_move, 560, 543, 2, 310, 793] -[:mouse_move, 559, 546, 2, 311, 794] -[:mouse_move, 559, 549, 2, 312, 795] -[:mouse_move, 559, 557, 2, 313, 796] -[:mouse_move, 559, 562, 2, 314, 797] -[:mouse_move, 563, 571, 2, 315, 798] -[:mouse_move, 566, 576, 2, 316, 799] -[:mouse_move, 572, 582, 2, 317, 800] -[:mouse_move, 575, 584, 2, 318, 801] -[:mouse_move, 586, 587, 2, 319, 802] -[:mouse_move, 590, 587, 2, 320, 803] -[:mouse_move, 601, 587, 2, 321, 804] -[:mouse_move, 606, 585, 2, 322, 805] -[:mouse_move, 612, 583, 2, 323, 806] -[:mouse_move, 615, 580, 2, 324, 807] -[:mouse_move, 620, 575, 2, 325, 808] -[:mouse_move, 621, 570, 2, 326, 809] -[:mouse_move, 620, 563, 2, 327, 810] -[:mouse_move, 617, 557, 2, 328, 811] -[:mouse_move, 613, 552, 2, 329, 812] -[:mouse_move, 610, 549, 2, 330, 813] -[:mouse_move, 607, 546, 2, 331, 814] -[:mouse_move, 606, 545, 2, 332, 815] -[:mouse_move, 605, 545, 2, 333, 816] -[:mouse_move, 605, 549, 2, 334, 831] -[:mouse_move, 605, 552, 2, 335, 832] -[:mouse_move, 605, 559, 2, 336, 833] -[:mouse_move, 605, 565, 2, 337, 834] -[:mouse_move, 609, 583, 2, 338, 835] -[:mouse_move, 613, 592, 2, 339, 836] -[:mouse_move, 622, 605, 2, 340, 837] -[:mouse_move, 628, 611, 2, 341, 838] -[:mouse_move, 635, 616, 2, 342, 839] -[:mouse_move, 638, 619, 2, 343, 840] -[:mouse_move, 642, 620, 2, 344, 841] -[:mouse_move, 644, 621, 2, 345, 842] -[:mouse_move, 646, 621, 2, 346, 843] -[:mouse_move, 647, 621, 2, 347, 845] -[:mouse_move, 651, 622, 2, 348, 847] -[:mouse_move, 654, 624, 2, 349, 848] -[:mouse_move, 660, 627, 2, 350, 849] -[:mouse_move, 676, 632, 2, 351, 850] -[:mouse_move, 687, 635, 2, 352, 851] -[:mouse_move, 713, 637, 2, 353, 852] -[:mouse_move, 728, 637, 2, 354, 853] -[:mouse_move, 755, 635, 2, 355, 854] -[:mouse_move, 769, 630, 2, 356, 855] -[:mouse_move, 784, 621, 2, 357, 856] -[:mouse_move, 792, 614, 2, 358, 857] -[:mouse_move, 809, 593, 2, 359, 858] -[:mouse_move, 811, 584, 2, 360, 859] -[:mouse_move, 812, 571, 2, 361, 860] -[:mouse_move, 812, 556, 2, 362, 861] -[:mouse_move, 805, 540, 2, 363, 862] -[:mouse_move, 796, 531, 2, 364, 863] -[:mouse_move, 782, 518, 2, 365, 864] -[:mouse_move, 773, 511, 2, 366, 865] -[:mouse_move, 757, 502, 2, 367, 866] -[:mouse_move, 749, 499, 2, 368, 867] -[:mouse_move, 735, 496, 2, 369, 868] -[:mouse_move, 722, 496, 2, 370, 869] -[:mouse_move, 710, 496, 2, 371, 870] -[:mouse_move, 702, 498, 2, 372, 871] -[:mouse_move, 687, 506, 2, 373, 872] -[:mouse_move, 680, 511, 2, 374, 873] -[:mouse_move, 665, 528, 2, 375, 874] -[:mouse_move, 661, 535, 2, 376, 875] -[:mouse_move, 657, 544, 2, 377, 876] -[:mouse_move, 653, 557, 2, 378, 877] -[:mouse_move, 652, 567, 2, 379, 878] -[:mouse_move, 652, 590, 2, 380, 879] -[:mouse_move, 652, 599, 2, 381, 880] -[:mouse_move, 666, 616, 2, 382, 881] -[:mouse_move, 677, 625, 2, 383, 882] -[:mouse_move, 702, 638, 2, 384, 883] -[:mouse_move, 717, 643, 2, 385, 884] -[:mouse_move, 747, 649, 2, 386, 885] -[:mouse_move, 761, 650, 2, 387, 886] -[:mouse_move, 780, 650, 2, 388, 887] -[:mouse_move, 790, 647, 2, 389, 888] -[:mouse_move, 810, 634, 2, 390, 889] -[:mouse_move, 814, 625, 2, 391, 890] -[:mouse_move, 817, 606, 2, 392, 891] -[:mouse_move, 817, 595, 2, 393, 892] -[:mouse_move, 809, 570, 2, 394, 893] -[:mouse_move, 801, 559, 2, 395, 894] -[:mouse_move, 784, 540, 2, 396, 895] -[:mouse_move, 780, 537, 2, 397, 896] -[:mouse_move, 765, 526, 2, 398, 897] -[:mouse_move, 758, 522, 2, 399, 898] -[:mouse_move, 747, 518, 2, 400, 899] -[:mouse_move, 742, 517, 2, 401, 900] -[:key_down_raw, 1073741905, 0, 2, 402, 940] -[:key_up_raw, 1073741905, 0, 2, 403, 944] -[:key_down_raw, 1073741905, 0, 2, 404, 949] -[:key_up_raw, 1073741905, 0, 2, 405, 954] -[:key_down_raw, 1073741905, 0, 2, 406, 968] -[:key_up_raw, 1073741905, 0, 2, 407, 972] -[:key_down_raw, 1073741903, 0, 2, 408, 974] -[:key_down_raw, 1073741903, 0, 2, 409, 999] -[:key_down_raw, 1073741903, 0, 2, 410, 1001] -[:key_down_raw, 1073741903, 0, 2, 411, 1003] -[:key_down_raw, 1073741903, 0, 2, 412, 1005] -[:key_down_raw, 1073741903, 0, 2, 413, 1007] -[:key_down_raw, 1073741903, 0, 2, 414, 1009] -[:key_down_raw, 1073741903, 0, 2, 415, 1011] -[:key_down_raw, 1073741903, 0, 2, 416, 1013] -[:key_down_raw, 1073741903, 0, 2, 417, 1015] -[:key_down_raw, 1073741903, 0, 2, 418, 1017] -[:key_down_raw, 1073741903, 0, 2, 419, 1019] -[:key_down_raw, 1073741903, 0, 2, 420, 1021] -[:key_down_raw, 1073741903, 0, 2, 421, 1023] -[:key_down_raw, 1073741903, 0, 2, 422, 1025] -[:key_down_raw, 1073741903, 0, 2, 423, 1027] -[:key_down_raw, 1073741903, 0, 2, 424, 1029] -[:key_down_raw, 1073741903, 0, 2, 425, 1031] -[:key_down_raw, 1073741903, 0, 2, 426, 1033] -[:key_down_raw, 1073741903, 0, 2, 427, 1035] -[:key_down_raw, 1073741903, 0, 2, 428, 1037] -[:key_down_raw, 1073741903, 0, 2, 429, 1039] -[:key_down_raw, 1073741903, 0, 2, 430, 1041] -[:key_down_raw, 1073741903, 0, 2, 431, 1043] -[:key_down_raw, 1073741903, 0, 2, 432, 1045] -[:key_down_raw, 1073741903, 0, 2, 433, 1047] -[:key_up_raw, 1073741903, 0, 2, 434, 1049] -[:key_down_raw, 1073741903, 0, 2, 435, 1069] -[:key_up_raw, 1073741903, 0, 2, 436, 1077] -[:key_down_raw, 1073741903, 0, 2, 437, 1085] -[:key_up_raw, 1073741903, 0, 2, 438, 1089] -[:key_down_raw, 1073741906, 0, 2, 439, 1101] -[:key_up_raw, 1073741906, 0, 2, 440, 1106] -[:mouse_move, 735, 526, 2, 441, 1232] -[:mouse_move, 730, 531, 2, 442, 1233] -[:mouse_move, 721, 540, 2, 443, 1234] -[:mouse_move, 716, 543, 2, 444, 1235] -[:mouse_move, 709, 549, 2, 445, 1236] -[:mouse_move, 705, 551, 2, 446, 1237] -[:mouse_move, 697, 557, 2, 447, 1238] -[:mouse_move, 693, 559, 2, 448, 1239] -[:mouse_move, 677, 571, 2, 449, 1240] -[:mouse_move, 655, 583, 2, 450, 1241] -[:mouse_move, 588, 608, 2, 451, 1242] -[:mouse_move, 577, 612, 2, 452, 1243] -[:mouse_move, 560, 616, 2, 453, 1244] -[:mouse_move, 525, 626, 2, 454, 1245] -[:mouse_move, 495, 634, 2, 455, 1246] -[:mouse_move, 481, 640, 2, 456, 1247] -[:mouse_move, 455, 652, 2, 457, 1248] -[:mouse_move, 433, 664, 2, 458, 1249] -[:mouse_move, 412, 681, 2, 459, 1250] -[:mouse_move, 399, 692, 2, 460, 1251] -[:mouse_move, 372, 713, 2, 461, 1252] -[:mouse_move, 367, 717, 2, 462, 1253] -[:mouse_move, 354, 719, 2, 463, 1254] -[:mouse_move, 440, 719, 2, 464, 1271] -[:mouse_move, 446, 717, 2, 465, 1272] -[:mouse_move, 452, 715, 2, 466, 1272] -[:mouse_move, 457, 713, 2, 467, 1273] -[:mouse_move, 462, 710, 2, 468, 1274] -[:mouse_move, 470, 707, 2, 469, 1275] -[:mouse_move, 473, 705, 2, 470, 1276] -[:mouse_move, 478, 704, 2, 471, 1277] -[:mouse_move, 483, 703, 2, 472, 1278] -[:mouse_move, 489, 702, 2, 473, 1279] -[:mouse_move, 492, 702, 2, 474, 1280] -[:mouse_move, 499, 701, 2, 475, 1281] -[:mouse_move, 503, 701, 2, 476, 1282] -[:mouse_move, 512, 701, 2, 477, 1283] -[:mouse_move, 518, 701, 2, 478, 1284] -[:mouse_move, 523, 701, 2, 479, 1285] -[:mouse_move, 529, 701, 2, 480, 1285] -[:mouse_move, 534, 701, 2, 481, 1286] -[:mouse_move, 539, 701, 2, 482, 1287] -[:mouse_move, 544, 702, 2, 483, 1287] -[:mouse_move, 549, 702, 2, 484, 1288] -[:mouse_move, 554, 702, 2, 485, 1289] -[:mouse_move, 558, 702, 2, 486, 1289] -[:mouse_move, 563, 702, 2, 487, 1290] -[:mouse_move, 568, 702, 2, 488, 1291] -[:mouse_move, 572, 702, 2, 489, 1291] -[:mouse_move, 576, 702, 2, 490, 1292] -[:mouse_move, 581, 702, 2, 491, 1293] -[:mouse_move, 586, 702, 2, 492, 1293] -[:mouse_move, 590, 701, 2, 493, 1294] -[:mouse_move, 595, 701, 2, 494, 1295] -[:mouse_move, 601, 700, 2, 495, 1295] -[:mouse_move, 606, 700, 2, 496, 1296] -[:mouse_move, 612, 699, 2, 497, 1297] -[:mouse_move, 617, 699, 2, 498, 1297] -[:mouse_move, 623, 698, 2, 499, 1298] -[:mouse_move, 629, 698, 2, 500, 1299] -[:mouse_move, 641, 697, 2, 501, 1300] -[:mouse_move, 647, 697, 2, 502, 1301] -[:mouse_move, 658, 696, 2, 503, 1302] -[:mouse_move, 664, 696, 2, 504, 1303] -[:mouse_move, 677, 695, 2, 505, 1304] -[:mouse_move, 690, 694, 2, 506, 1306] -[:mouse_move, 696, 693, 2, 507, 1307] -[:mouse_move, 701, 693, 2, 508, 1308] -[:mouse_move, 712, 692, 2, 509, 1309] -[:mouse_move, 717, 692, 2, 510, 1310] -[:mouse_move, 722, 692, 2, 511, 1310] -[:mouse_move, 727, 692, 2, 512, 1312] -[:mouse_move, 731, 692, 2, 513, 1313] -[:mouse_move, 736, 692, 2, 514, 1315] -[:mouse_move, 741, 692, 2, 515, 1316] -[:mouse_move, 749, 691, 2, 516, 1316] -[:mouse_move, 751, 691, 2, 517, 1317] -[:mouse_move, 757, 691, 2, 518, 1319] -[:mouse_move, 773, 690, 2, 519, 1321] -[:mouse_move, 797, 690, 2, 520, 1323] -[:mouse_move, 801, 690, 2, 521, 1324] -[:mouse_move, 805, 690, 2, 522, 1324] -[:mouse_move, 809, 690, 2, 523, 1325] -[:mouse_move, 818, 690, 2, 524, 1327] -[:mouse_move, 827, 691, 2, 525, 1328] -[:mouse_move, 835, 691, 2, 526, 1329] -[:mouse_move, 840, 691, 2, 527, 1330] -[:mouse_move, 853, 691, 2, 528, 1331] -[:mouse_move, 861, 691, 2, 529, 1332] -[:mouse_move, 870, 691, 2, 530, 1333] -[:mouse_move, 875, 691, 2, 531, 1335] -[:mouse_move, 881, 691, 2, 532, 1336] -[:mouse_move, 885, 691, 2, 533, 1337] -[:mouse_move, 887, 691, 2, 534, 1337] -[:mouse_move, 889, 691, 2, 535, 1338] -[:mouse_move, 891, 691, 2, 536, 1339] -[:mouse_move, 893, 691, 2, 537, 1339] -[:mouse_move, 895, 691, 2, 538, 1340] -[:mouse_move, 896, 692, 2, 539, 1341] -[:mouse_move, 898, 692, 2, 540, 1341] -[:mouse_move, 899, 692, 2, 541, 1343] -[:mouse_move, 900, 692, 2, 542, 1343] -[:mouse_move, 901, 692, 2, 543, 1344] -[:mouse_move, 902, 692, 2, 544, 1347] -[:mouse_move, 903, 692, 2, 545, 1349] -[:mouse_move, 904, 691, 2, 546, 1351] -[:mouse_move, 905, 688, 2, 547, 1351] -[:mouse_move, 906, 684, 2, 548, 1352] -[:mouse_move, 909, 674, 2, 549, 1353] -[:mouse_move, 912, 661, 2, 550, 1353] -[:mouse_move, 915, 640, 2, 551, 1354] -[:mouse_move, 924, 593, 2, 552, 1355] -[:mouse_move, 934, 552, 2, 553, 1355] -[:mouse_move, 939, 532, 2, 554, 1356] -[:mouse_move, 950, 491, 2, 555, 1357] -[:mouse_move, 955, 466, 2, 556, 1358] -[:mouse_move, 959, 442, 2, 557, 1359] -[:mouse_move, 963, 409, 2, 558, 1360] -[:mouse_move, 964, 388, 2, 559, 1361] -[:mouse_move, 965, 351, 2, 560, 1362] -[:key_down_raw, 1073741905, 0, 2, 561, 1480] -[:key_down_raw, 1073741905, 0, 2, 562, 1505] -[:key_down_raw, 1073741905, 0, 2, 563, 1507] -[:key_down_raw, 1073741905, 0, 2, 564, 1509] -[:key_up_raw, 1073741905, 0, 2, 565, 1511] -[:key_down_raw, 1073741905, 0, 2, 566, 1532] -[:key_up_raw, 1073741905, 0, 2, 567, 1537] -[:key_down_raw, 1073741905, 0, 2, 568, 1550] -[:key_up_raw, 1073741905, 0, 2, 569, 1555] -[:key_down_raw, 1073741904, 0, 2, 570, 1622] -[:key_down_raw, 1073741904, 0, 2, 571, 1647] -[:key_down_raw, 1073741904, 0, 2, 572, 1649] -[:key_down_raw, 1073741904, 0, 2, 573, 1651] -[:key_down_raw, 1073741904, 0, 2, 574, 1653] -[:key_up_raw, 1073741904, 0, 2, 575, 1654] -[:key_down_raw, 1073741906, 0, 2, 576, 1670] -[:key_up_raw, 1073741906, 0, 2, 577, 1691] -[:key_down_raw, 1073741904, 0, 2, 578, 1692] -[:key_up_raw, 1073741904, 0, 2, 579, 1699] -[:key_down_raw, 1073741906, 0, 2, 580, 1708] -[:key_down_raw, 1073741906, 0, 2, 581, 1733] -[:key_down_raw, 1073741906, 0, 2, 582, 1735] -[:key_down_raw, 1073741906, 0, 2, 583, 1737] -[:key_down_raw, 1073741906, 0, 2, 584, 1739] -[:key_down_raw, 1073741906, 0, 2, 585, 1741] -[:key_up_raw, 1073741906, 0, 2, 586, 1741] -[:key_down_raw, 1073741906, 0, 2, 587, 1808] -[:key_up_raw, 1073741906, 0, 2, 588, 1817] -[:key_down_raw, 1073741903, 0, 2, 589, 1821] -[:key_up_raw, 1073741903, 0, 2, 590, 1836] -[:mouse_move, 962, 350, 2, 591, 1924] -[:mouse_move, 957, 348, 2, 592, 1924] -[:mouse_move, 949, 345, 2, 593, 1925] -[:mouse_move, 940, 341, 2, 594, 1926] -[:mouse_move, 916, 331, 2, 595, 1927] -[:mouse_move, 902, 326, 2, 596, 1928] -[:mouse_move, 862, 312, 2, 597, 1929] -[:mouse_move, 853, 309, 2, 598, 1930] -[:mouse_move, 818, 298, 2, 599, 1931] -[:mouse_move, 812, 297, 2, 600, 1932] -[:mouse_move, 798, 293, 2, 601, 1933] -[:mouse_move, 791, 292, 2, 602, 1934] -[:mouse_move, 777, 290, 2, 603, 1935] -[:mouse_move, 773, 290, 2, 604, 1936] -[:mouse_move, 765, 290, 2, 605, 1937] -[:mouse_move, 761, 292, 2, 606, 1938] -[:mouse_move, 760, 292, 2, 607, 1939] -[:mouse_move, 757, 293, 2, 608, 1939] -[:mouse_move, 755, 295, 2, 609, 1940] -[:mouse_move, 754, 295, 2, 610, 1941] -[:mouse_move, 753, 296, 2, 611, 1941] -[:mouse_move, 753, 297, 2, 612, 1942] -[:mouse_move, 753, 298, 2, 613, 1944] -[:mouse_move, 753, 299, 2, 614, 1957] -[:mouse_move, 754, 299, 2, 615, 1969] -[:mouse_move, 755, 299, 2, 616, 1997] -[:mouse_move, 755, 300, 2, 617, 1997] -[:mouse_move, 756, 305, 2, 618, 1998] -[:mouse_move, 760, 316, 2, 619, 1999] -[:mouse_move, 763, 332, 2, 620, 1999] -[:mouse_move, 767, 353, 2, 621, 2000] -[:mouse_move, 771, 380, 2, 622, 2001] -[:mouse_move, 772, 393, 2, 623, 2001] -[:mouse_move, 774, 417, 2, 624, 2002] -[:mouse_move, 775, 425, 2, 625, 2003] -[:mouse_move, 775, 444, 2, 626, 2003] -[:mouse_move, 775, 472, 2, 627, 2004] -[:mouse_move, 775, 487, 2, 628, 2005] -[:mouse_move, 775, 492, 2, 629, 2005] -[:mouse_move, 774, 501, 2, 630, 2006] -[:mouse_move, 771, 508, 2, 631, 2007] -[:mouse_move, 769, 514, 2, 632, 2007] -[:mouse_move, 766, 520, 2, 633, 2008] -[:mouse_move, 761, 529, 2, 634, 2009] -[:mouse_move, 755, 534, 2, 635, 2009] -[:mouse_move, 749, 539, 2, 636, 2010] -[:mouse_move, 741, 545, 2, 637, 2011] -[:mouse_move, 720, 558, 2, 638, 2012] -[:mouse_move, 707, 565, 2, 639, 2013] -[:mouse_move, 678, 582, 2, 640, 2014] -[:mouse_move, 664, 590, 2, 641, 2015] -[:mouse_move, 634, 608, 2, 642, 2016] -[:mouse_move, 621, 616, 2, 643, 2017] -[:mouse_move, 607, 624, 2, 644, 2018] -[:mouse_move, 596, 631, 2, 645, 2018] -[:mouse_move, 584, 638, 2, 646, 2019] -[:mouse_move, 573, 644, 2, 647, 2020] -[:mouse_move, 569, 646, 2, 648, 2020] -[:mouse_move, 552, 654, 2, 649, 2021] -[:mouse_move, 542, 657, 2, 650, 2022] -[:mouse_move, 537, 659, 2, 651, 2022] -[:mouse_move, 529, 662, 2, 652, 2023] -[:mouse_move, 521, 665, 2, 653, 2024] -[:mouse_move, 513, 669, 2, 654, 2024] -[:mouse_move, 507, 671, 2, 655, 2025] -[:mouse_move, 501, 674, 2, 656, 2026] -[:mouse_move, 496, 676, 2, 657, 2026] -[:mouse_move, 494, 677, 2, 658, 2027] -[:mouse_move, 491, 679, 2, 659, 2028] -[:mouse_move, 488, 680, 2, 660, 2028] -[:mouse_move, 486, 682, 2, 661, 2029] -[:mouse_move, 484, 683, 2, 662, 2030] -[:mouse_move, 483, 683, 2, 663, 2030] -[:mouse_move, 482, 684, 2, 664, 2031] -[:mouse_move, 481, 684, 2, 665, 2032] -[:mouse_move, 481, 685, 2, 666, 2032] -[:mouse_move, 480, 685, 2, 667, 2033] -[:mouse_move, 480, 686, 2, 668, 2035] -[:mouse_move, 481, 687, 2, 669, 2037] -[:mouse_move, 483, 688, 2, 670, 2038] -[:mouse_move, 485, 689, 2, 671, 2038] -[:mouse_move, 487, 689, 2, 672, 2039] -[:mouse_move, 490, 690, 2, 673, 2040] -[:mouse_move, 498, 690, 2, 674, 2041] -[:mouse_move, 503, 690, 2, 675, 2042] -[:mouse_move, 513, 690, 2, 676, 2043] -[:mouse_move, 517, 689, 2, 677, 2044] -[:mouse_move, 522, 687, 2, 678, 2045] -[:mouse_move, 527, 686, 2, 679, 2045] -[:mouse_move, 531, 685, 2, 680, 2046] -[:mouse_move, 537, 684, 2, 681, 2047] -[:mouse_move, 540, 683, 2, 682, 2047] -[:mouse_move, 545, 682, 2, 683, 2048] -[:mouse_move, 549, 681, 2, 684, 2049] -[:mouse_move, 553, 680, 2, 685, 2049] -[:mouse_move, 557, 680, 2, 686, 2050] -[:mouse_move, 562, 679, 2, 687, 2051] -[:mouse_move, 566, 679, 2, 688, 2051] -[:mouse_move, 571, 678, 2, 689, 2052] -[:mouse_move, 576, 677, 2, 690, 2053] -[:mouse_move, 581, 677, 2, 691, 2053] -[:mouse_move, 584, 676, 2, 692, 2054] -[:mouse_move, 588, 676, 2, 693, 2055] -[:mouse_move, 592, 675, 2, 694, 2055] -[:mouse_move, 595, 675, 2, 695, 2056] -[:mouse_move, 597, 675, 2, 696, 2057] -[:mouse_move, 599, 675, 2, 697, 2057] -[:mouse_move, 602, 675, 2, 698, 2058] -[:mouse_move, 604, 674, 2, 699, 2059] -[:mouse_move, 607, 674, 2, 700, 2059] -[:mouse_move, 609, 674, 2, 701, 2060] -[:mouse_move, 610, 674, 2, 702, 2061] -[:mouse_move, 614, 674, 2, 703, 2061] -[:mouse_move, 615, 674, 2, 704, 2062] -[:mouse_move, 619, 674, 2, 705, 2063] -[:mouse_move, 624, 673, 2, 706, 2064] -[:mouse_move, 626, 673, 2, 707, 2065] -[:mouse_move, 631, 672, 2, 708, 2066] -[:mouse_move, 634, 672, 2, 709, 2067] -[:mouse_move, 640, 672, 2, 710, 2068] -[:mouse_move, 643, 672, 2, 711, 2069] -[:mouse_move, 649, 671, 2, 712, 2070] -[:mouse_move, 653, 671, 2, 713, 2071] -[:mouse_move, 661, 670, 2, 714, 2072] -[:mouse_move, 666, 670, 2, 715, 2073] -[:mouse_move, 670, 670, 2, 716, 2074] -[:mouse_move, 672, 670, 2, 717, 2074] -[:mouse_move, 676, 669, 2, 718, 2075] -[:mouse_move, 679, 669, 2, 719, 2076] -[:mouse_move, 684, 669, 2, 720, 2076] -[:mouse_move, 686, 669, 2, 721, 2077] -[:mouse_move, 690, 669, 2, 722, 2078] -[:mouse_move, 694, 669, 2, 723, 2078] -[:mouse_move, 697, 669, 2, 724, 2079] -[:mouse_move, 701, 669, 2, 725, 2080] -[:mouse_move, 704, 668, 2, 726, 2080] -[:mouse_move, 707, 668, 2, 727, 2081] -[:mouse_move, 713, 668, 2, 728, 2082] -[:mouse_move, 715, 668, 2, 729, 2082] -[:mouse_move, 720, 668, 2, 730, 2083] -[:mouse_move, 721, 668, 2, 731, 2084] -[:mouse_move, 727, 668, 2, 732, 2084] -[:mouse_move, 730, 668, 2, 733, 2085] -[:mouse_move, 733, 668, 2, 734, 2086] -[:mouse_move, 737, 668, 2, 735, 2086] -[:mouse_move, 740, 668, 2, 736, 2087] -[:mouse_move, 744, 668, 2, 737, 2088] -[:mouse_move, 748, 667, 2, 738, 2088] -[:mouse_move, 752, 667, 2, 739, 2089] -[:mouse_move, 754, 667, 2, 740, 2090] -[:mouse_move, 761, 666, 2, 741, 2091] -[:mouse_move, 764, 666, 2, 742, 2092] -[:mouse_move, 769, 666, 2, 743, 2093] -[:mouse_move, 771, 666, 2, 744, 2094] -[:mouse_move, 775, 666, 2, 745, 2095] -[:mouse_move, 776, 666, 2, 746, 2096] -[:mouse_move, 780, 666, 2, 747, 2097] -[:mouse_move, 781, 667, 2, 748, 2098] -[:mouse_move, 784, 667, 2, 749, 2099] -[:mouse_move, 785, 667, 2, 750, 2100] -[:mouse_move, 786, 667, 2, 751, 2101] -[:mouse_move, 787, 667, 2, 752, 2103] -[:mouse_move, 789, 667, 2, 753, 2121] -[:mouse_move, 798, 667, 2, 754, 2122] -[:mouse_move, 804, 667, 2, 755, 2123] -[:mouse_move, 837, 664, 2, 756, 2124] -[:mouse_move, 860, 660, 2, 757, 2125] -[:mouse_move, 913, 648, 2, 758, 2126] -[:mouse_move, 941, 639, 2, 759, 2127] -[:mouse_move, 972, 629, 2, 760, 2128] -[:mouse_move, 998, 616, 2, 761, 2128] -[:mouse_move, 1024, 603, 2, 762, 2129] -[:mouse_move, 1035, 598, 2, 763, 2130] -[:mouse_move, 1055, 586, 2, 764, 2130] -[:mouse_move, 1071, 576, 2, 765, 2131] -[:mouse_move, 1077, 572, 2, 766, 2132] -[:mouse_move, 1088, 563, 2, 767, 2132] -[:mouse_move, 1096, 557, 2, 768, 2133] -[:mouse_move, 1102, 551, 2, 769, 2134] -[:mouse_move, 1104, 549, 2, 770, 2134] -[:mouse_move, 1111, 542, 2, 771, 2135] -[:mouse_move, 1114, 538, 2, 772, 2136] -[:mouse_move, 1117, 534, 2, 773, 2136] -[:mouse_move, 1121, 531, 2, 774, 2137] -[:mouse_move, 1125, 527, 2, 775, 2138] -[:mouse_move, 1130, 523, 2, 776, 2138] -[:mouse_move, 1135, 519, 2, 777, 2139] -[:mouse_move, 1140, 515, 2, 778, 2140] -[:mouse_move, 1145, 511, 2, 779, 2140] -[:mouse_move, 1148, 509, 2, 780, 2141] -[:mouse_move, 1151, 506, 2, 781, 2142] -[:mouse_move, 1154, 504, 2, 782, 2142] -[:mouse_move, 1156, 503, 2, 783, 2143] -[:mouse_move, 1157, 502, 2, 784, 2144] -[:mouse_move, 1159, 501, 2, 785, 2145] -[:mouse_move, 1159, 500, 2, 786, 2147] -[:key_down_raw, 1073742051, 1024, 2, 787, 2282] -[:key_down_raw, 113, 1024, 2, 788, 2283] -[:key_up_raw, 113, 1024, 2, 789, 2283] diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sounds/music-loop.ogg b/samples/99_genre_narrative_rpg/return_of_serenity/sounds/music-loop.ogg deleted file mode 100644 index bec1275..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sounds/music-loop.ogg and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sounds/static-loop.ogg b/samples/99_genre_narrative_rpg/return_of_serenity/sounds/static-loop.ogg deleted file mode 100644 index bb4ac6b..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sounds/static-loop.ogg and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/book.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/book.png deleted file mode 100644 index 97859c0..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/book.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/decision.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/decision.png deleted file mode 100644 index e323cea..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/decision.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/dream.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/dream.png deleted file mode 100644 index 0b6f982..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/dream.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/front-of-home.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/front-of-home.png deleted file mode 100644 index ca865fe..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/front-of-home.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-home.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-home.png deleted file mode 100644 index 3bc4804..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-home.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-observatory.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-observatory.png deleted file mode 100644 index af1d25d..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/inside-observatory.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/label-background.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/label-background.png deleted file mode 100644 index 80a682f..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/label-background.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/library.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/library.png deleted file mode 100644 index 60f8908..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/library.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mainframe.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mainframe.png deleted file mode 100644 index aed8813..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mainframe.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mountain-pass-zoomed-out.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mountain-pass-zoomed-out.png deleted file mode 100644 index b39ab78..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/mountain-pass-zoomed-out.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/observatory.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/observatory.png deleted file mode 100644 index 925886b..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/observatory.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/outside-library.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/outside-library.png deleted file mode 100644 index df42ccf..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/outside-library.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/path-to-observatory.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/path-to-observatory.png deleted file mode 100644 index 7e740ac..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/path-to-observatory.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/pc.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/pc.png deleted file mode 100644 index e5f4218..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/pc.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/planets.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/planets.png deleted file mode 100644 index 537dd8f..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/planets.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-down.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-down.png deleted file mode 100644 index 161ea69..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-down.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-left.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-left.png deleted file mode 100644 index 5f682fd..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-left.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-right.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-right.png deleted file mode 100644 index 798f97e..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-right.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-up.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-up.png deleted file mode 100644 index 161ea69..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-up.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-zoomed-out.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-zoomed-out.png deleted file mode 100644 index 804cd72..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/player-zoomed-out.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/serenity.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/serenity.png deleted file mode 100644 index def5bea..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/serenity.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/side-of-home.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/side-of-home.png deleted file mode 100644 index 6a17e93..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/side-of-home.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/square.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/square.png deleted file mode 100644 index 80a682f..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/square.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/todo.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/todo.png deleted file mode 100644 index 5cd3b13..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/todo.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute-game-over.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute-game-over.png deleted file mode 100644 index 99991fb..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute-game-over.png and /dev/null differ diff --git a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute.png b/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute.png deleted file mode 100644 index 8686cca..0000000 Binary files a/samples/99_genre_narrative_rpg/return_of_serenity/sprites/tribute.png and /dev/null differ diff --git a/samples/99_genre_platformer/the_little_probe/app/main.rb b/samples/99_genre_platformer/the_little_probe/app/main.rb index 1c90218..8fcf279 100644 --- a/samples/99_genre_platformer/the_little_probe/app/main.rb +++ b/samples/99_genre_platformer/the_little_probe/app/main.rb @@ -256,8 +256,8 @@ class FallingCircle if circle.floor outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0] outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255] - outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0] - outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0] + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.as_hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0] outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255] end @@ -402,11 +402,11 @@ class FallingCircle end def load_terrain - load_lines 'level.txt' + load_lines 'data/level.txt' end def load_lava - load_lines 'level_lava.txt' + load_lines 'data/level_lava.txt' end def load_level force: false diff --git a/samples/99_genre_platformer/the_little_probe/data/level.txt b/samples/99_genre_platformer/the_little_probe/data/level.txt new file mode 100644 index 0000000..62caf2d --- /dev/null +++ b/samples/99_genre_platformer/the_little_probe/data/level.txt @@ -0,0 +1,1481 @@ +640,8840,1180,8840 +-60,10220,0,9960 +-60,10220,0,10500 +0,10500,0,10780 +0,10780,40,10900 +500,10920,760,10960 +300,10560,820,10600 +420,10320,700,10300 +820,10600,1500,10600 +1500,10600,1940,10600 +1940,10600,2380,10580 +2380,10580,2800,10620 +2240,11080,2480,11020 +2000,11120,2240,11080 +1760,11180,2000,11120 +1620,11180,1760,11180 +1500,11220,1620,11180 +1180,11280,1340,11220 +1040,11240,1180,11280 +840,11280,1040,11240 +640,11280,840,11280 +500,11220,640,11280 +420,11140,500,11220 +240,11100,420,11140 +100,11120,240,11100 +0,11180,100,11120 +-160,11220,0,11180 +-260,11240,-160,11220 +1340,11220,1500,11220 +960,13300,1280,13060 +1280,13060,1540,12860 +1540,12860,1820,12700 +1820,12700,2080,12520 +2080,12520,2240,12400 +2240,12400,2240,12240 +2240,12240,2400,12080 +2400,12080,2560,11920 +2560,11920,2640,11740 +2640,11740,2740,11580 +2740,11580,2800,11400 +2800,11400,2800,11240 +2740,11140,2800,11240 +2700,11040,2740,11140 +2700,11040,2740,10960 +2740,10960,2740,10920 +2700,10900,2740,10920 +2380,10900,2700,10900 +2040,10920,2380,10900 +1720,10940,2040,10920 +1380,11000,1720,10940 +1180,10980,1380,11000 +900,10980,1180,10980 +760,10960,900,10980 +240,10960,500,10920 +40,10900,240,10960 +0,9700,0,9960 +-60,9500,0,9700 +-60,9420,-60,9500 +-60,9420,-60,9340 +-60,9340,-60,9280 +-60,9120,-60,9280 +-60,8940,-60,9120 +-60,8940,-60,8780 +-60,8780,0,8700 +0,8700,40,8680 +40,8680,240,8700 +240,8700,360,8780 +360,8780,640,8840 +1420,8400,1540,8480 +1540,8480,1680,8500 +1680,8500,1940,8460 +1180,8840,1280,8880 +1280,8880,1340,8860 +1340,8860,1720,8860 +1720,8860,1820,8920 +1820,8920,1820,9140 +1820,9140,1820,9280 +1820,9460,1820,9280 +1760,9480,1820,9460 +1640,9480,1760,9480 +1540,9500,1640,9480 +1340,9500,1540,9500 +1100,9500,1340,9500 +1040,9540,1100,9500 +960,9540,1040,9540 +300,9420,360,9460 +240,9440,300,9420 +180,9600,240,9440 +120,9660,180,9600 +100,9820,120,9660 +100,9820,120,9860 +120,9860,140,9900 +140,9900,140,10000 +140,10440,180,10540 +100,10080,140,10000 +100,10080,140,10100 +140,10100,140,10440 +180,10540,300,10560 +2140,9560,2140,9640 +2140,9720,2140,9640 +1880,9780,2140,9720 +1720,9780,1880,9780 +1620,9740,1720,9780 +1500,9780,1620,9740 +1380,9780,1500,9780 +1340,9820,1380,9780 +1200,9820,1340,9820 +1100,9780,1200,9820 +900,9780,1100,9780 +820,9720,900,9780 +540,9720,820,9720 +360,9840,540,9720 +360,9840,360,9960 +360,9960,360,10080 +360,10140,360,10080 +360,10140,360,10240 +360,10240,420,10320 +700,10300,820,10280 +820,10280,820,10280 +820,10280,900,10320 +900,10320,1040,10300 +1040,10300,1200,10320 +1200,10320,1380,10280 +1380,10280,1500,10300 +1500,10300,1760,10300 +2800,10620,2840,10600 +2840,10600,2900,10600 +2900,10600,3000,10620 +3000,10620,3080,10620 +3080,10620,3140,10600 +3140,10540,3140,10600 +3140,10540,3140,10460 +3140,10460,3140,10360 +3140,10360,3140,10260 +3140,10260,3140,10140 +3140,10140,3140,10000 +3140,10000,3140,9860 +3140,9860,3160,9720 +3160,9720,3160,9580 +3160,9580,3160,9440 +3160,9300,3160,9440 +3160,9300,3160,9140 +3160,9140,3160,8980 +3160,8980,3160,8820 +3160,8820,3160,8680 +3160,8680,3160,8520 +1760,10300,1880,10300 +660,9500,960,9540 +640,9460,660,9500 +360,9460,640,9460 +-480,10760,-440,10880 +-480,11020,-440,10880 +-480,11160,-260,11240 +-480,11020,-480,11160 +-600,11420,-380,11320 +-380,11320,-200,11340 +-200,11340,0,11340 +0,11340,180,11340 +960,13420,960,13300 +960,13420,960,13520 +960,13520,1000,13560 +1000,13560,1040,13540 +1040,13540,1200,13440 +1200,13440,1380,13380 +1380,13380,1620,13300 +1620,13300,1820,13220 +1820,13220,2000,13200 +2000,13200,2240,13200 +2240,13200,2440,13160 +2440,13160,2640,13040 +-480,10760,-440,10620 +-440,10620,-360,10560 +-380,10460,-360,10560 +-380,10460,-360,10300 +-380,10140,-360,10300 +-380,10140,-380,10040 +-380,9880,-380,10040 +-380,9720,-380,9880 +-380,9720,-380,9540 +-380,9360,-380,9540 +-380,9180,-380,9360 +-380,9180,-380,9000 +-380,8840,-380,9000 +-380,8840,-380,8760 +-380,8760,-380,8620 +-380,8620,-380,8520 +-380,8520,-360,8400 +-360,8400,-100,8400 +-100,8400,-60,8420 +-60,8420,240,8440 +240,8440,240,8380 +240,8380,500,8440 +500,8440,760,8460 +760,8460,1000,8400 +1000,8400,1180,8420 +1180,8420,1420,8400 +1940,8460,2140,8420 +2140,8420,2200,8520 +2200,8680,2200,8520 +2140,8840,2200,8680 +2140,8840,2140,9020 +2140,9100,2140,9020 +2140,9200,2140,9100 +2140,9200,2200,9320 +2200,9320,2200,9440 +2140,9560,2200,9440 +1880,10300,2200,10280 +2200,10280,2480,10260 +2480,10260,2700,10240 +2700,10240,2840,10180 +2840,10180,2900,10060 +2900,9860,2900,10060 +2900,9640,2900,9860 +2900,9640,2900,9500 +2900,9460,2900,9500 +2740,9460,2900,9460 +2700,9460,2740,9460 +2700,9360,2700,9460 +2700,9320,2700,9360 +2600,9320,2700,9320 +2600,9260,2600,9320 +2600,9200,2600,9260 +2480,9120,2600,9200 +2440,9080,2480,9120 +2380,9080,2440,9080 +2320,9060,2380,9080 +2320,8860,2320,9060 +2320,8860,2380,8840 +2380,8840,2480,8860 +2480,8860,2600,8840 +2600,8840,2740,8840 +2740,8840,2840,8800 +2840,8800,2900,8700 +2900,8600,2900,8700 +2900,8480,2900,8600 +2900,8380,2900,8480 +2900,8380,2900,8260 +2900,8260,2900,8140 +2900,8140,2900,8020 +2900,8020,2900,7900 +2900,7820,2900,7900 +2900,7820,2900,7740 +2900,7660,2900,7740 +2900,7560,2900,7660 +2900,7460,2900,7560 +2900,7460,2900,7360 +2900,7260,2900,7360 +2840,7160,2900,7260 +2800,7080,2840,7160 +2700,7100,2800,7080 +2560,7120,2700,7100 +2400,7100,2560,7120 +2320,7100,2400,7100 +2140,7100,2320,7100 +2040,7080,2140,7100 +1940,7080,2040,7080 +1820,7140,1940,7080 +1680,7140,1820,7140 +1540,7140,1680,7140 +1420,7220,1540,7140 +1280,7220,1380,7220 +1140,7200,1280,7220 +1000,7220,1140,7200 +760,7280,900,7320 +540,7220,760,7280 +300,7180,540,7220 +180,7120,180,7160 +40,7140,180,7120 +-60,7160,40,7140 +-200,7120,-60,7160 +180,7160,300,7180 +-260,7060,-200,7120 +-260,6980,-260,7060 +-260,6880,-260,6980 +-260,6880,-260,6820 +-260,6820,-200,6760 +-200,6760,-100,6740 +-100,6740,-60,6740 +-60,6740,40,6740 +40,6740,300,6800 +300,6800,420,6760 +420,6760,500,6740 +500,6740,540,6760 +540,6760,540,6760 +540,6760,640,6780 +640,6660,640,6780 +580,6580,640,6660 +580,6440,580,6580 +580,6440,640,6320 +640,6320,640,6180 +580,6080,640,6180 +580,6080,640,5960 +640,5960,640,5840 +640,5840,640,5700 +640,5700,660,5560 +660,5560,660,5440 +660,5440,660,5300 +660,5140,660,5300 +660,5140,660,5000 +660,5000,660,4880 +660,4880,820,4860 +820,4860,1000,4840 +1000,4840,1100,4860 +1100,4860,1280,4860 +1280,4860,1420,4840 +1420,4840,1580,4860 +1580,4860,1720,4820 +1720,4820,1880,4860 +1880,4860,2000,4840 +2000,4840,2140,4840 +2140,4840,2320,4860 +2320,4860,2440,4880 +2440,4880,2600,4880 +2600,4880,2800,4880 +2800,4880,2900,4880 +2900,4880,2900,4820 +2900,4740,2900,4820 +2800,4700,2900,4740 +2520,4680,2800,4700 +2240,4660,2520,4680 +1940,4620,2240,4660 +1820,4580,1940,4620 +1820,4500,1820,4580 +1820,4500,1880,4420 +1880,4420,2000,4420 +2000,4420,2200,4420 +2200,4420,2400,4440 +2400,4440,2600,4440 +2600,4440,2840,4440 +2840,4440,2900,4400 +2740,4260,2900,4280 +2600,4240,2740,4260 +2480,4280,2600,4240 +2320,4240,2480,4280 +2140,4220,2320,4240 +1940,4220,2140,4220 +1880,4160,1940,4220 +1880,4160,1880,4080 +1880,4080,2040,4040 +2040,4040,2240,4060 +2240,4060,2400,4040 +2400,4040,2600,4060 +2600,4060,2740,4020 +2740,4020,2840,3940 +2840,3780,2840,3940 +2740,3660,2840,3780 +2700,3680,2740,3660 +2520,3700,2700,3680 +2380,3700,2520,3700 +2200,3720,2380,3700 +2040,3720,2200,3720 +1880,3700,2040,3720 +1820,3680,1880,3700 +1760,3600,1820,3680 +1760,3600,1820,3480 +1820,3480,1880,3440 +1880,3440,1960,3460 +1960,3460,2140,3460 +2140,3460,2380,3460 +2380,3460,2640,3440 +2640,3440,2900,3380 +2840,3280,2900,3380 +2840,3280,2900,3200 +2900,3200,2900,3140 +2840,3020,2900,3140 +2800,2960,2840,3020 +2700,3000,2800,2960 +2600,2980,2700,3000 +2380,3000,2600,2980 +2140,3000,2380,3000 +1880,3000,2140,3000 +1720,3040,1880,3000 +1640,2960,1720,3040 +1500,2940,1640,2960 +1340,3000,1500,2940 +1240,3000,1340,3000 +1140,3020,1240,3000 +1040,3000,1140,3020 +960,2960,1040,3000 +900,2960,960,2960 +840,2840,900,2960 +700,2820,840,2840 +540,2820,700,2820 +420,2820,540,2820 +180,2800,420,2820 +60,2780,180,2800 +-60,2800,60,2780 +-160,2760,-60,2800 +-260,2740,-160,2760 +-300,2640,-260,2740 +-360,2560,-300,2640 +-380,2460,-360,2560 +-380,2460,-300,2380 +-300,2300,-300,2380 +-300,2300,-300,2220 +-300,2100,-300,2220 +-300,2100,-300,2040 +-300,2040,-160,2040 +-160,2040,-60,2040 +-60,2040,60,2040 +60,2040,180,2040 +180,2040,360,2040 +360,2040,540,2040 +540,2040,700,2080 +660,2160,700,2080 +660,2160,700,2260 +660,2380,700,2260 +500,2340,660,2380 +360,2340,500,2340 +240,2340,360,2340 +40,2320,240,2340 +-60,2320,40,2320 +-100,2380,-60,2320 +-100,2380,-100,2460 +-100,2460,-100,2540 +-100,2540,0,2560 +0,2560,140,2600 +140,2600,300,2600 +300,2600,460,2600 +460,2600,640,2600 +640,2600,760,2580 +760,2580,820,2560 +820,2560,820,2500 +820,2500,820,2400 +820,2400,840,2320 +840,2320,840,2240 +820,2120,840,2240 +820,2020,820,2120 +820,1900,820,2020 +760,1840,820,1900 +640,1840,760,1840 +500,1840,640,1840 +300,1860,420,1880 +180,1840,300,1860 +420,1880,500,1840 +0,1840,180,1840 +-60,1860,0,1840 +-160,1840,-60,1860 +-200,1800,-160,1840 +-260,1760,-200,1800 +-260,1680,-260,1760 +-260,1620,-260,1680 +-260,1540,-260,1620 +-260,1540,-260,1460 +-300,1420,-260,1460 +-300,1420,-300,1340 +-300,1340,-260,1260 +-260,1260,-260,1160 +-260,1060,-260,1160 +-260,1060,-260,960 +-260,880,-260,960 +-260,880,-260,780 +-260,780,-260,680 +-300,580,-260,680 +-300,580,-300,480 +-300,480,-260,400 +-300,320,-260,400 +-300,320,-300,240 +-300,240,-200,220 +-200,220,-200,160 +-200,160,-100,140 +-100,140,0,120 +0,120,60,120 +60,120,180,120 +180,120,300,120 +300,120,420,140 +420,140,580,180 +580,180,760,180 +760,180,900,180 +960,180,1100,180 +1100,180,1340,200 +1340,200,1580,200 +1580,200,1720,180 +1720,180,2000,140 +2000,140,2240,140 +2240,140,2480,140 +2520,140,2800,160 +2800,160,3000,160 +3000,160,3140,160 +3140,260,3140,160 +3140,260,3140,380 +3080,500,3140,380 +3080,620,3080,500 +3080,620,3080,740 +3080,740,3080,840 +3080,960,3080,840 +3080,1080,3080,960 +3080,1080,3080,1200 +3080,1200,3080,1340 +3080,1340,3080,1460 +3080,1580,3080,1460 +3080,1700,3080,1580 +3080,1700,3080,1760 +3080,1760,3200,1760 +3200,1760,3320,1760 +3320,1760,3520,1760 +3520,1760,3680,1740 +3680,1740,3780,1700 +3780,1700,3840,1620 +3840,1620,3840,1520 +3840,1520,3840,1420 +3840,1320,3840,1420 +3840,1120,3840,1320 +3840,1120,3840,940 +3840,940,3840,760 +3780,600,3840,760 +3780,600,3780,440 +3780,320,3780,440 +3780,320,3780,160 +3780,60,3780,160 +3780,60,4020,60 +4020,60,4260,40 +4260,40,4500,40 +4500,40,4740,40 +4740,40,4840,20 +4840,20,4880,80 +4880,80,5080,40 +5080,40,5280,20 +5280,20,5500,0 +5500,0,5720,0 +5720,0,5940,60 +5940,60,6240,60 +6240,60,6540,20 +6540,20,6840,20 +6840,20,7040,0 +7040,0,7140,0 +7140,0,7400,20 +7400,20,7680,0 +7680,0,7940,0 +7940,0,8200,-20 +8200,-20,8360,20 +8360,20,8560,-40 +8560,-40,8760,0 +8760,0,8880,40 +8880,120,8880,40 +8840,220,8840,120 +8620,240,8840,220 +8420,260,8620,240 +8200,280,8420,260 +7940,280,8200,280 +7760,240,7940,280 +7560,220,7760,240 +7360,280,7560,220 +7140,260,7360,280 +6940,240,7140,260 +6720,220,6940,240 +6480,220,6720,220 +6360,300,6480,220 +6240,300,6360,300 +6200,500,6240,300 +6200,500,6360,540 +6360,540,6540,520 +6540,520,6720,480 +6720,480,6880,460 +6880,460,7080,500 +7080,500,7320,500 +7320,500,7680,500 +7680,620,7680,500 +7520,640,7680,620 +7360,640,7520,640 +7200,640,7360,640 +7040,660,7200,640 +6880,720,7040,660 +6720,700,6880,720 +6540,700,6720,700 +6420,760,6540,700 +6280,740,6420,760 +6240,760,6280,740 +6200,920,6240,760 +6200,920,6360,960 +6360,960,6540,960 +6540,960,6720,960 +6720,960,6760,980 +6760,980,6880,940 +6880,940,7080,940 +7080,940,7280,940 +7280,940,7520,920 +7520,920,7760,900 +7760,900,7980,860 +7980,860,8100,880 +8100,880,8280,900 +8280,900,8500,820 +8500,820,8700,820 +8700,820,8760,840 +8760,960,8760,840 +8700,1040,8760,960 +8560,1060,8700,1040 +8460,1080,8560,1060 +8360,1040,8460,1080 +8280,1080,8360,1040 +8160,1120,8280,1080 +8040,1120,8160,1120 +7940,1100,8040,1120 +7800,1120,7940,1100 +7680,1120,7800,1120 +7520,1100,7680,1120 +7360,1100,7520,1100 +7200,1120,7360,1100 +7040,1180,7200,1120 +6880,1160,7040,1180 +6720,1160,6880,1160 +6540,1160,6720,1160 +6360,1160,6540,1160 +6200,1160,6360,1160 +6040,1220,6200,1160 +6040,1220,6040,1400 +6040,1400,6200,1440 +6200,1440,6320,1440 +6320,1440,6440,1440 +6600,1440,6760,1440 +6760,1440,6940,1420 +6440,1440,6600,1440 +6940,1420,7280,1400 +7280,1400,7560,1400 +7560,1400,7760,1400 +7760,1400,7940,1360 +7940,1360,8100,1380 +8100,1380,8280,1340 +8280,1340,8460,1320 +8660,1300,8760,1360 +8460,1320,8660,1300 +8760,1360,8800,1500 +8800,1660,8800,1500 +8800,1660,8800,1820 +8700,1840,8800,1820 +8620,1860,8700,1840 +8560,1800,8620,1860 +8560,1800,8620,1680 +8500,1640,8620,1680 +8420,1680,8500,1640 +8280,1680,8420,1680 +8160,1680,8280,1680 +7900,1680,8160,1680 +7680,1680,7900,1680 +7400,1660,7680,1680 +7140,1680,7400,1660 +6880,1640,7140,1680 +6040,1820,6320,1780 +5900,1840,6040,1820 +6640,1700,6880,1640 +6320,1780,6640,1700 +5840,2040,5900,1840 +5840,2040,5840,2220 +5840,2220,5840,2320 +5840,2460,5840,2320 +5840,2560,5840,2460 +5840,2560,5960,2620 +5960,2620,6200,2620 +6200,2620,6380,2600 +6380,2600,6600,2580 +6600,2580,6800,2600 +6800,2600,7040,2580 +7040,2580,7280,2580 +7280,2580,7480,2560 +7760,2540,7980,2520 +7980,2520,8160,2500 +7480,2560,7760,2540 +8160,2500,8160,2420 +8160,2420,8160,2320 +8160,2180,8160,2320 +7980,2160,8160,2180 +7800,2180,7980,2160 +7600,2200,7800,2180 +7400,2200,7600,2200 +6960,2200,7200,2200 +7200,2200,7400,2200 +6720,2200,6960,2200 +6540,2180,6720,2200 +6320,2200,6540,2180 +6240,2160,6320,2200 +6240,2160,6240,2040 +6240,2040,6240,1940 +6240,1940,6440,1940 +6440,1940,6720,1940 +6720,1940,6940,1920 +7520,1920,7760,1920 +6940,1920,7280,1920 +7280,1920,7520,1920 +7760,1920,8100,1900 +8100,1900,8420,1900 +8420,1900,8460,1940 +8460,2120,8460,1940 +8460,2280,8460,2120 +8460,2280,8560,2420 +8560,2420,8660,2380 +8660,2380,8800,2340 +8800,2340,8840,2400 +8840,2520,8840,2400 +8800,2620,8840,2520 +8800,2740,8800,2620 +8800,2860,8800,2740 +8800,2940,8800,2860 +8760,2980,8800,2940 +8660,2980,8760,2980 +8620,2960,8660,2980 +8560,2880,8620,2960 +8560,2880,8560,2780 +8500,2740,8560,2780 +8420,2760,8500,2740 +8420,2840,8420,2760 +8420,2840,8420,2940 +8420,3040,8420,2940 +8420,3160,8420,3040 +8420,3280,8420,3380 +8420,3280,8420,3160 +8420,3380,8620,3460 +8620,3460,8760,3460 +8760,3460,8840,3400 +8840,3400,8960,3400 +8960,3400,9000,3500 +9000,3700,9000,3500 +9000,3900,9000,3700 +9000,4080,9000,3900 +9000,4280,9000,4080 +9000,4500,9000,4280 +9000,4620,9000,4500 +9000,4780,9000,4620 +9000,4780,9000,4960 +9000,5120,9000,4960 +9000,5120,9000,5300 +8960,5460,9000,5300 +8920,5620,8960,5460 +8920,5620,8920,5800 +8920,5800,8920,5960 +8920,5960,8920,6120 +8920,6120,8960,6300 +8960,6300,8960,6480 +8960,6660,8960,6480 +8960,6860,8960,6660 +8960,7040,8960,6860 +8920,7420,8920,7220 +8920,7420,8960,7620 +8960,7620,8960,7800 +8960,7800,8960,8000 +8960,8000,8960,8180 +8960,8180,8960,8380 +8960,8580,8960,8380 +8920,8800,8960,8580 +8880,9000,8920,8800 +8840,9180,8880,9000 +8800,9220,8840,9180 +8800,9220,8840,9340 +8760,9380,8840,9340 +8560,9340,8760,9380 +8360,9360,8560,9340 +8160,9360,8360,9360 +8040,9340,8160,9360 +7860,9360,8040,9340 +7680,9360,7860,9360 +7520,9360,7680,9360 +7420,9260,7520,9360 +7400,9080,7420,9260 +7400,9080,7420,8860 +7420,8860,7440,8720 +7440,8720,7480,8660 +7480,8660,7520,8540 +7520,8540,7600,8460 +7600,8460,7800,8480 +7800,8480,8040,8480 +8040,8480,8280,8480 +8280,8480,8500,8460 +8500,8460,8620,8440 +8620,8440,8660,8340 +8660,8340,8660,8220 +8660,8220,8700,8080 +8700,8080,8700,7920 +8700,7920,8700,7760 +8700,7760,8700,7620 +8700,7480,8700,7620 +8700,7480,8700,7320 +8700,7160,8700,7320 +8920,7220,8960,7040 +8660,7040,8700,7160 +8660,7040,8700,6880 +8660,6700,8700,6880 +8660,6700,8700,6580 +8700,6460,8700,6580 +8700,6460,8700,6320 +8700,6160,8700,6320 +8700,6160,8760,6020 +8760,6020,8760,5860 +8760,5860,8760,5700 +8760,5700,8760,5540 +8760,5540,8760,5360 +8760,5360,8760,5180 +8760,5000,8760,5180 +8700,4820,8760,5000 +8560,4740,8700,4820 +8420,4700,8560,4740 +8280,4700,8420,4700 +8100,4700,8280,4700 +7980,4700,8100,4700 +7820,4740,7980,4700 +7800,4920,7820,4740 +7800,4920,7900,4960 +7900,4960,8060,4980 +8060,4980,8220,5000 +8220,5000,8420,5040 +8420,5040,8460,5120 +8460,5180,8460,5120 +8360,5200,8460,5180 +8360,5280,8360,5200 +8160,5300,8360,5280 +8040,5260,8160,5300 +7860,5220,8040,5260 +7720,5160,7860,5220 +7640,5120,7720,5160 +7480,5120,7640,5120 +7240,5120,7480,5120 +7000,5120,7240,5120 +6800,5160,7000,5120 +6640,5220,6800,5160 +6600,5360,6640,5220 +6600,5460,6600,5360 +6480,5520,6600,5460 +6240,5540,6480,5520 +5980,5540,6240,5540 +5740,5540,5980,5540 +5500,5520,5740,5540 +5400,5520,5500,5520 +5280,5540,5400,5520 +5080,5540,5280,5540 +4940,5540,5080,5540 +4760,5540,4940,5540 +4600,5540,4760,5540 +4440,5560,4600,5540 +4040,5580,4120,5520 +4260,5540,4440,5560 +4120,5520,4260,5540 +4020,5720,4040,5580 +4020,5840,4020,5720 +4020,5840,4080,5940 +4080,5940,4120,6040 +4120,6040,4200,6080 +4200,6080,4340,6080 +4340,6080,4500,6060 +4500,6060,4700,6060 +4700,6060,4880,6060 +4880,6060,5080,6060 +5080,6060,5280,6080 +5280,6080,5440,6100 +5440,6100,5660,6100 +5660,6100,5900,6080 +5900,6080,6120,6080 +6120,6080,6360,6080 +6360,6080,6480,6100 +6480,6100,6540,6060 +6540,6060,6720,6060 +6720,6060,6940,6060 +6940,6060,7140,6060 +7400,6060,7600,6060 +7140,6060,7400,6060 +7600,6060,7800,6060 +7800,6060,7860,6080 +7860,6080,8060,6080 +8060,6080,8220,6080 +8220,6080,8320,6140 +8320,6140,8360,6300 +8320,6460,8360,6300 +8320,6620,8320,6460 +8320,6800,8320,6620 +8320,6960,8320,6800 +8320,6960,8360,7120 +8320,7280,8360,7120 +8320,7440,8320,7280 +8320,7600,8320,7440 +8100,7580,8220,7600 +8220,7600,8320,7600 +7900,7560,8100,7580 +7680,7560,7900,7560 +7480,7580,7680,7560 +7280,7580,7480,7580 +7080,7580,7280,7580 +7000,7600,7080,7580 +6880,7600,7000,7600 +6800,7580,6880,7600 +6640,7580,6800,7580 +6540,7580,6640,7580 +6380,7600,6540,7580 +6280,7620,6380,7600 +6240,7700,6280,7620 +6240,7700,6240,7800 +6240,7840,6240,7800 +6080,7840,6240,7840 +5960,7820,6080,7840 +5660,7840,5800,7840 +5500,7800,5660,7840 +5440,7700,5500,7800 +5800,7840,5960,7820 +5440,7540,5440,7700 +5440,7440,5440,7540 +5440,7320,5440,7440 +5400,7320,5440,7320 +5340,7400,5400,7320 +5340,7400,5340,7500 +5340,7600,5340,7500 +5340,7600,5340,7720 +5340,7720,5340,7860 +5340,7860,5340,7960 +5340,7960,5440,8020 +5440,8020,5560,8020 +5560,8020,5720,8040 +5720,8040,5900,8060 +5900,8060,6080,8060 +6080,8060,6240,8060 +6720,8040,6840,8060 +6240,8060,6480,8040 +6480,8040,6720,8040 +6840,8060,6940,8060 +6940,8060,7080,8120 +7080,8120,7140,8180 +7140,8460,7140,8320 +7140,8620,7140,8460 +7140,8620,7140,8740 +7140,8860,7140,8740 +7140,8960,7140,8860 +7140,8960,7200,9080 +7140,9200,7200,9080 +7140,9200,7200,9320 +7200,9320,7200,9460 +7200,9760,7200,9900 +7200,9620,7200,9460 +7200,9620,7200,9760 +7200,9900,7200,10060 +7200,10220,7200,10060 +7200,10360,7200,10220 +7140,10400,7200,10360 +6880,10400,7140,10400 +6640,10360,6880,10400 +6420,10360,6640,10360 +6160,10380,6420,10360 +5940,10340,6160,10380 +5720,10320,5940,10340 +5500,10340,5720,10320 +5280,10300,5500,10340 +5080,10300,5280,10300 +4840,10280,5080,10300 +4700,10280,4840,10280 +4540,10280,4700,10280 +4360,10280,4540,10280 +4200,10300,4360,10280 +4040,10380,4200,10300 +4020,10500,4040,10380 +3980,10640,4020,10500 +3980,10640,3980,10760 +3980,10760,4020,10920 +4020,10920,4080,11000 +4080,11000,4340,11020 +4340,11020,4600,11060 +4600,11060,4840,11040 +4840,11040,4880,10960 +4880,10740,4880,10960 +4880,10740,4880,10600 +4880,10600,5080,10560 +5080,10560,5340,10620 +5340,10620,5660,10620 +5660,10620,6040,10600 +6040,10600,6120,10620 +6120,10620,6240,10720 +6240,10720,6420,10740 +6420,10740,6640,10760 +6640,10760,6880,10780 +7140,10780,7400,10780 +6880,10780,7140,10780 +7400,10780,7680,10780 +7680,10780,8100,10760 +8100,10760,8460,10740 +8460,10740,8700,10760 +8800,10840,8800,10980 +8700,10760,8800,10840 +8760,11200,8800,10980 +8760,11200,8760,11380 +8760,11380,8800,11560 +8760,11680,8800,11560 +8760,11760,8760,11680 +8760,11760,8760,11920 +8760,11920,8800,12080 +8800,12200,8800,12080 +8700,12240,8800,12200 +8560,12220,8700,12240 +8360,12220,8560,12220 +8160,12240,8360,12220 +7720,12220,7980,12220 +7980,12220,8160,12240 +7400,12200,7720,12220 +7200,12180,7400,12200 +7000,12160,7200,12180 +6800,12160,7000,12160 +6280,12140,6380,12180 +6120,12180,6280,12140 +6540,12180,6800,12160 +6380,12180,6540,12180 +5900,12200,6120,12180 +5620,12180,5900,12200 +5340,12120,5620,12180 +5140,12100,5340,12120 +4980,12120,5140,12100 +4840,12120,4980,12120 +4700,12200,4840,12120 +4700,12380,4700,12200 +4740,12480,4940,12520 +4700,12380,4740,12480 +4940,12520,5160,12560 +5160,12560,5340,12600 +5340,12600,5400,12600 +5400,12600,5500,12600 +5500,12600,5620,12600 +5620,12600,5720,12560 +5720,12560,5800,12440 +5800,12440,5900,12380 +5900,12380,6120,12420 +6120,12420,6380,12440 +6380,12440,6600,12460 +6720,12460,6840,12520 +6840,12520,6960,12520 +6600,12460,6720,12460 +6960,12520,7040,12500 +7040,12500,7140,12440 +7200,12440,7360,12500 +7360,12500,7600,12560 +7600,12560,7860,12600 +7860,12600,8060,12500 +8100,12500,8200,12340 +8200,12340,8360,12360 +8360,12360,8560,12400 +8560,12400,8660,12420 +8660,12420,8840,12400 +8840,12400,9000,12360 +9000,12360,9000,12360 +2900,4400,2900,4280 +900,7320,1000,7220 +2640,13040,2900,12920 +2900,12920,3160,12840 +3480,12760,3780,12620 +3780,12620,4020,12460 +4300,12360,4440,12260 +4020,12460,4300,12360 +3160,12840,3480,12760 +4440,12080,4440,12260 +4440,12080,4440,11880 +4440,11880,4440,11720 +4440,11720,4600,11720 +4600,11720,4760,11740 +4760,11740,4980,11760 +4980,11760,5160,11760 +5160,11760,5340,11780 +6000,11860,6120,11820 +5340,11780,5620,11820 +5620,11820,6000,11860 +6120,11820,6360,11820 +6360,11820,6640,11860 +6940,11920,7240,11940 +7240,11940,7520,11960 +7520,11960,7860,11960 +7860,11960,8100,11920 +8100,11920,8420,11940 +8420,11940,8460,11960 +8460,11960,8500,11860 +8460,11760,8500,11860 +8320,11720,8460,11760 +8160,11720,8320,11720 +7940,11720,8160,11720 +7720,11700,7940,11720 +7520,11680,7720,11700 +7320,11680,7520,11680 +7200,11620,7320,11680 +7200,11620,7200,11500 +7200,11500,7280,11440 +7280,11440,7420,11440 +7420,11440,7600,11440 +7600,11440,7980,11460 +7980,11460,8160,11460 +8160,11460,8360,11460 +8360,11460,8460,11400 +8420,11060,8500,11200 +8280,11040,8420,11060 +8100,11060,8280,11040 +8460,11400,8500,11200 +7800,11060,8100,11060 +7520,11060,7800,11060 +7240,11060,7520,11060 +6940,11040,7240,11060 +6640,11000,6940,11040 +6420,10980,6640,11000 +6360,11060,6420,10980 +6360,11180,6360,11060 +6200,11280,6360,11180 +5960,11300,6200,11280 +5720,11280,5960,11300 +5500,11280,5720,11280 +4940,11300,5200,11280 +4660,11260,4940,11300 +4440,11280,4660,11260 +4260,11280,4440,11280 +4220,11220,4260,11280 +4080,11280,4220,11220 +3980,11420,4080,11280 +3980,11420,4040,11620 +4040,11620,4040,11820 +3980,11960,4040,11820 +3840,12000,3980,11960 +3720,11940,3840,12000 +3680,11800,3720,11940 +3680,11580,3680,11800 +3680,11360,3680,11580 +3680,11360,3680,11260 +3680,11080,3680,11260 +3680,11080,3680,10880 +3680,10700,3680,10880 +3680,10700,3680,10620 +3680,10480,3680,10620 +3680,10480,3680,10300 +3680,10300,3680,10100 +3680,10100,3680,9940 +3680,9940,3720,9860 +3720,9860,3920,9900 +3920,9900,4220,9880 +4980,9940,5340,9960 +4220,9880,4540,9900 +4540,9900,4980,9940 +5340,9960,5620,9960 +5620,9960,5900,9960 +5900,9960,6160,10000 +6160,10000,6480,10000 +6480,10000,6720,10000 +6720,10000,6880,9860 +6880,9860,6880,9520 +6880,9520,6940,9340 +6940,9120,6940,9340 +6940,9120,6940,8920 +6940,8700,6940,8920 +6880,8500,6940,8700 +6880,8320,6880,8500 +7140,8320,7140,8180 +6760,8260,6880,8320 +6540,8240,6760,8260 +6420,8180,6540,8240 +6280,8240,6420,8180 +6160,8300,6280,8240 +6120,8400,6160,8300 +6080,8520,6120,8400 +5840,8480,6080,8520 +5620,8500,5840,8480 +5500,8500,5620,8500 +5340,8560,5500,8500 +5160,8540,5340,8560 +4620,8520,4880,8520 +4360,8480,4620,8520 +4880,8520,5160,8540 +4140,8440,4360,8480 +3920,8460,4140,8440 +3720,8380,3920,8460 +3680,8160,3720,8380 +3680,8160,3720,7940 +3720,7720,3720,7940 +3680,7580,3720,7720 +3680,7580,3720,7440 +3720,7440,3720,7300 +3720,7160,3720,7300 +3720,7160,3720,7020 +3720,7020,3780,6900 +3780,6900,4080,6940 +4080,6940,4340,6980 +4340,6980,4600,6980 +4600,6980,4880,6980 +4880,6980,5160,6980 +5160,6980,5400,7000 +5400,7000,5560,7020 +5560,7020,5660,7080 +5660,7080,5660,7280 +5660,7280,5660,7440 +5660,7440,5740,7520 +5740,7520,5740,7600 +5740,7600,5900,7600 +5900,7600,6040,7540 +6040,7540,6040,7320 +6040,7320,6120,7200 +6120,7200,6120,7040 +6120,7040,6240,7000 +6240,7000,6480,7060 +6480,7060,6800,7060 +6800,7060,7080,7080 +7080,7080,7320,7100 +7940,7100,7980,6920 +7860,6860,7980,6920 +7640,6860,7860,6860 +7400,6840,7640,6860 +7320,7100,7560,7120 +7560,7120,7760,7120 +7760,7120,7940,7100 +7200,6820,7400,6840 +7040,6820,7200,6820 +6600,6840,6840,6840 +6380,6800,6600,6840 +6120,6800,6380,6800 +5900,6840,6120,6800 +5620,6820,5900,6840 +5400,6800,5620,6820 +5140,6800,5400,6800 +4880,6780,5140,6800 +4600,6760,4880,6780 +4340,6760,4600,6760 +4080,6760,4340,6760 +3840,6740,4080,6760 +3680,6720,3840,6740 +3680,6720,3680,6560 +3680,6560,3720,6400 +3720,6400,3720,6200 +3720,6200,3780,6000 +3720,5780,3780,6000 +3720,5580,3720,5780 +3720,5360,3720,5580 +3720,5360,3840,5240 +3840,5240,4200,5260 +4200,5260,4600,5280 +4600,5280,4880,5280 +4880,5280,5140,5200 +5140,5200,5220,5100 +5220,5100,5280,4900 +5280,4900,5340,4840 +5340,4840,5720,4880 +6120,4880,6480,4860 +6880,4840,7200,4860 +6480,4860,6880,4840 +7200,4860,7320,4860 +7320,4860,7360,4740 +7360,4600,7440,4520 +7360,4600,7360,4740 +7440,4520,7640,4520 +7640,4520,7800,4480 +7800,4480,7800,4280 +7800,4280,7800,4040 +7800,4040,7800,3780 +7800,3560,7800,3780 +7800,3560,7860,3440 +7860,3440,8060,3460 +8060,3460,8160,3340 +8160,3340,8160,3140 +8160,3140,8160,2960 +8000,2900,8160,2960 +7860,2900,8000,2900 +7640,2940,7860,2900 +7400,2980,7640,2940 +7100,2980,7400,2980 +6840,3000,7100,2980 +5620,2980,5840,2980 +5840,2980,6500,3000 +6500,3000,6840,3000 +5560,2780,5620,2980 +5560,2780,5560,2580 +5560,2580,5560,2380 +5560,2140,5560,2380 +5560,2140,5560,1900 +5560,1900,5620,1660 +5620,1660,5660,1460 +5660,1460,5660,1300 +5500,1260,5660,1300 +5340,1260,5500,1260 +4600,1220,4840,1240 +4440,1220,4600,1220 +4440,1080,4440,1220 +4440,1080,4600,1020 +5080,1260,5340,1260 +4840,1240,5080,1260 +4600,1020,4940,1020 +4940,1020,5220,1020 +5220,1020,5560,960 +5560,960,5660,860 +5660,740,5660,860 +5280,740,5660,740 +4940,780,5280,740 +4660,760,4940,780 +4500,700,4660,760 +4500,520,4500,700 +4500,520,4700,460 +4700,460,5080,440 +5440,420,5740,420 +5080,440,5440,420 +5740,420,5840,360 +5800,280,5840,360 +5560,280,5800,280 +4980,300,5280,320 +4360,320,4660,300 +4200,360,4360,320 +5280,320,5560,280 +4660,300,4980,300 +4140,480,4200,360 +4140,480,4140,640 +4140,640,4200,780 +4200,780,4200,980 +4200,980,4220,1180 +4220,1400,4220,1180 +4220,1400,4260,1540 +4260,1540,4500,1540 +4500,1540,4700,1520 +4700,1520,4980,1540 +5280,1560,5400,1560 +4980,1540,5280,1560 +5400,1560,5400,1700 +5400,1780,5400,1700 +5340,1900,5400,1780 +5340,2020,5340,1900 +5340,2220,5340,2020 +5340,2220,5340,2420 +5340,2420,5340,2520 +5080,2600,5220,2580 +5220,2580,5340,2520 +4900,2580,5080,2600 +4700,2540,4900,2580 +4500,2540,4700,2540 +4220,2580,4340,2540 +4200,2700,4220,2580 +4340,2540,4500,2540 +3980,2740,4200,2700 +3840,2740,3980,2740 +3780,2640,3840,2740 +3780,2640,3780,2460 +3780,2280,3780,2460 +3620,2020,3780,2100 +3780,2280,3780,2100 +3360,2040,3620,2020 +3080,2040,3360,2040 +2840,2020,3080,2040 +2740,1940,2840,2020 +2740,1940,2800,1800 +2800,1640,2800,1800 +2800,1640,2800,1460 +2800,1300,2800,1460 +2700,1180,2800,1300 +2480,1140,2700,1180 +1580,1200,1720,1200 +2240,1180,2480,1140 +1960,1180,2240,1180 +1720,1200,1960,1180 +1500,1320,1580,1200 +1500,1440,1500,1320 +1500,1440,1760,1480 +1760,1480,1940,1480 +1940,1480,2140,1500 +2140,1500,2320,1520 +2400,1560,2400,1700 +2280,1820,2380,1780 +2320,1520,2400,1560 +2380,1780,2400,1700 +2080,1840,2280,1820 +1720,1820,2080,1840 +1420,1800,1720,1820 +1280,1800,1420,1800 +1240,1720,1280,1800 +1240,1720,1240,1600 +1240,1600,1280,1480 +1280,1340,1280,1480 +1180,1280,1280,1340 +1000,1280,1180,1280 +760,1280,1000,1280 +360,1240,540,1260 +180,1220,360,1240 +540,1260,760,1280 +180,1080,180,1220 +180,1080,180,1000 +180,1000,360,940 +360,940,540,960 +540,960,820,980 +1100,980,1200,920 +820,980,1100,980 +6640,11860,6940,11920 +5200,11280,5500,11280 +4120,7330,4120,7230 +4120,7230,4660,7250 +4660,7250,4940,7250 +4940,7250,5050,7340 +5010,7400,5050,7340 +4680,7380,5010,7400 +4380,7370,4680,7380 +4120,7330,4360,7370 +4120,7670,4120,7760 +4120,7670,4280,7650 +4280,7650,4540,7660 +4550,7660,4820,7680 +4820,7680,4900,7730 +4880,7800,4900,7730 +4620,7820,4880,7800 +4360,7790,4620,7820 +4120,7760,4360,7790 +6840,6840,7040,6820 +5720,4880,6120,4880 +1200,920,1340,810 +1340,810,1520,790 +1520,790,1770,800 +2400,790,2600,750 +2600,750,2640,520 +2520,470,2640,520 +2140,470,2520,470 +1760,800,2090,800 +2080,800,2400,790 +1760,450,2140,470 +1420,450,1760,450 +1180,440,1420,450 +900,480,1180,440 +640,450,900,480 +360,440,620,450 +120,430,360,440 +0,520,120,430 +-20,780,0,520 +-20,780,-20,1020 +-20,1020,-20,1150 +-20,1150,0,1300 +0,1470,60,1530 +0,1300,0,1470 +60,1530,360,1530 +360,1530,660,1520 +660,1520,980,1520 +980,1520,1040,1520 +1040,1520,1070,1560 +1070,1770,1070,1560 +1070,1770,1100,2010 +1070,2230,1100,2010 +1070,2240,1180,2340 +1180,2340,1580,2340 +1580,2340,1940,2350 +1940,2350,2440,2350 +2440,2350,2560,2380 +2560,2380,2600,2540 +2810,2640,3140,2680 +2600,2540,2810,2640 +3140,2680,3230,2780 +3230,2780,3260,2970 +3230,3220,3260,2970 +3200,3470,3230,3220 +3200,3480,3210,3760 +3210,3760,3210,4040 +3200,4040,3230,4310 +3210,4530,3230,4310 +3210,4530,3230,4730 +3230,4960,3230,4730 +3230,4960,3260,5190 +3170,5330,3260,5190 +2920,5330,3170,5330 +2660,5360,2920,5330 +2420,5330,2660,5360 +2200,5280,2400,5330 +2020,5280,2200,5280 +1840,5260,2020,5280 +1660,5280,1840,5260 +1500,5300,1660,5280 +1360,5270,1500,5300 +1200,5290,1340,5270 +1070,5400,1200,5290 +1040,5630,1070,5400 +1000,5900,1040,5630 +980,6170,1000,5900 +980,6280,980,6170 +980,6540,980,6280 +980,6540,1040,6720 +1040,6720,1360,6730 +1360,6730,1760,6710 +2110,6720,2420,6730 +1760,6710,2110,6720 +2420,6730,2640,6720 +2640,6720,2970,6720 +2970,6720,3160,6700 +3160,6700,3240,6710 +3240,6710,3260,6890 +3260,7020,3260,6890 +3230,7180,3260,7020 +3230,7350,3230,7180 +3210,7510,3230,7350 +3210,7510,3210,7690 +3210,7870,3210,7690 +3210,7870,3210,7980 +3200,8120,3210,7980 +3200,8330,3200,8120 +3160,8520,3200,8330 +2460,11100,2480,11020 +2200,11180,2460,11100 +1260,11350,1600,11320 +600,11430,930,11400 +180,11340,620,11430 +1600,11320,1910,11280 +1910,11280,2200,11180 +923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157 \ No newline at end of file diff --git a/samples/99_genre_platformer/the_little_probe/data/level_lava.txt b/samples/99_genre_platformer/the_little_probe/data/level_lava.txt new file mode 100644 index 0000000..e2bc2bd --- /dev/null +++ b/samples/99_genre_platformer/the_little_probe/data/level_lava.txt @@ -0,0 +1,235 @@ +100,10740,500,10780 +500,10780,960,10760 +960,10760,1340,10760 +1380,10760,1820,10780 +1820,10780,2240,10780 +2280,10780,2740,10740 +2740,10740,3000,10780 +3000,10780,3140,11020 +-520,8820,-480,9160 +-520,8480,-520,8820 +-520,8480,-480,8180 +-480,8180,-200,8120 +-200,8120,100,8220 +100,8220,420,8240 +420,8240,760,8260 +760,8260,1140,8280 +1140,8280,1500,8200 +1500,8200,1880,8240 +1880,8240,2240,8260 +2240,8260,2320,8480 +2320,8480,2380,8680 +2240,8860,2380,8680 +2240,9080,2240,8860 +2240,9080,2320,9260 +2320,9260,2480,9440 +2480,9440,2600,9640 +2480,9840,2600,9640 +2400,10020,2480,9840 +2240,10080,2400,10020 +1960,10080,2240,10080 +1720,10080,1960,10080 +1460,10080,1720,10080 +1180,10080,1420,10080 +900,10080,1180,10080 +640,10080,900,10080 +640,10080,640,9900 +60,10520,100,10740 +40,10240,60,10520 +40,10240,40,9960 +40,9960,40,9680 +40,9680,40,9360 +40,9360,60,9080 +60,9080,100,8860 +100,8860,460,9040 +460,9040,760,9220 +760,9220,1140,9220 +1140,9220,1720,9200 +-660,11580,-600,11420 +-660,11800,-660,11580 +-660,12000,-660,11800 +-660,12000,-600,12220 +-600,12220,-600,12440 +-600,12440,-600,12640 +-600,11240,-260,11280 +-260,11280,100,11240 +9000,12360,9020,12400 +9020,12620,9020,12400 +9020,12840,9020,12620 +9020,13060,9020,12840 +9020,13060,9020,13240 +9020,13240,9020,13420 +9020,13420,9020,13600 +9020,13600,9020,13780 +8880,13900,9020,13780 +8560,13800,8880,13900 +8220,13780,8560,13800 +7860,13760,8220,13780 +7640,13780,7860,13760 +7360,13800,7640,13780 +7100,13800,7360,13800 +6540,13760,6800,13780 +6800,13780,7100,13800 +6280,13760,6540,13760 +5760,13760,6280,13760 +5220,13780,5760,13760 +4700,13760,5220,13780 +4200,13740,4700,13760 +3680,13720,4200,13740 +3140,13700,3680,13720 +2600,13680,3140,13700 +2040,13940,2600,13680 +1640,13940,2040,13940 +1200,13960,1640,13940 +840,14000,1200,13960 +300,13960,840,14000 +-200,13900,300,13960 +-600,12840,-600,12640 +-600,13140,-600,12840 +-600,13140,-600,13420 +-600,13700,-600,13420 +-600,13700,-600,13820 +-600,13820,-200,13900 +-600,11240,-560,11000 +-560,11000,-480,10840 +-520,10660,-480,10840 +-520,10660,-520,10480 +-520,10480,-520,10300 +-520,10260,-480,10080 +-480,9880,-440,10060 +-520,9680,-480,9880 +-520,9680,-480,9400 +-480,9400,-480,9160 +1820,9880,2140,9800 +1540,9880,1820,9880 +1200,9920,1500,9880 +900,9880,1200,9920 +640,9900,840,9880 +2380,8760,2800,8760 +2800,8760,2840,8660 +2840,8660,2840,8420 +2840,8160,2840,8420 +2800,7900,2840,8160 +2800,7900,2800,7720 +2800,7540,2800,7720 +2800,7540,2800,7360 +2700,7220,2800,7360 +2400,7220,2700,7220 +2080,7240,2400,7220 +1760,7320,2080,7240 +1380,7360,1720,7320 +1040,7400,1340,7360 +640,7400,1000,7420 +300,7380,640,7400 +0,7300,240,7380 +-300,7180,-60,7300 +-380,6860,-360,7180 +-380,6880,-360,6700 +-360,6700,-260,6540 +-260,6540,0,6520 +0,6520,240,6640 +240,6640,460,6640 +460,6640,500,6480 +500,6260,500,6480 +460,6060,500,6260 +460,5860,460,6060 +460,5860,500,5640 +500,5640,540,5440 +540,5440,580,5220 +580,5220,580,5000 +580,4960,580,4740 +580,4740,960,4700 +960,4700,1140,4760 +1140,4760,1420,4740 +1420,4740,1720,4700 +1720,4700,2000,4740 +2000,4740,2380,4760 +2380,4760,2700,4800 +1720,4600,1760,4300 +1760,4300,2200,4340 +2200,4340,2560,4340 +2560,4340,2740,4340 +2160,12580,2440,12400 +1820,12840,2160,12580 +1500,13080,1820,12840 +1140,13340,1500,13080 +1140,13340,1580,13220 +2110,13080,2520,13000 +2520,13000,2900,12800 +1580,13220,2110,13080 +2900,12800,3200,12680 +3200,12680,3440,12640 +3440,12640,3720,12460 +3720,12460,4040,12320 +4040,12320,4360,12200 +4360,11940,4380,12180 +4360,11700,4360,11940 +4360,11700,4540,11500 +4540,11500,4880,11540 +6000,11660,6280,11640 +5440,11600,5720,11610 +5720,11610,6000,11660 +6280,11640,6760,11720 +6760,11720,7060,11780 +7060,11780,7360,11810 +7360,11810,7640,11840 +7640,11840,8000,11830 +8000,11830,8320,11850 +8320,11850,8390,11800 +8330,11760,8390,11800 +8160,11760,8330,11760 +7910,11750,8160,11760 +7660,11740,7900,11750 +7400,11730,7660,11740 +7160,11680,7400,11730 +7080,11570,7160,11680 +7080,11570,7100,11350 +7100,11350,7440,11280 +7440,11280,7940,11280 +7960,11280,8360,11280 +5840,11540,6650,11170 +4880,11540,5440,11600 +3410,11830,3420,11300 +3410,11260,3520,10920 +3520,10590,3520,10920 +3520,10590,3540,10260 +3520,9900,3540,10240 +3520,9900,3640,9590 +3640,9570,4120,9590 +4140,9590,4600,9680 +4620,9680,5030,9730 +5120,9750,5520,9800 +5620,9820,6080,9800 +6130,9810,6580,9820 +6640,9820,6800,9700 +6780,9400,6800,9700 +6780,9400,6840,9140 +6820,8860,6840,9120 +6780,8600,6820,8830 +6720,8350,6780,8570 +6480,8340,6720,8320 +6260,8400,6480,8340 +6050,8580,6240,8400 +5760,8630,6040,8590 +5520,8690,5740,8630 +5120,8690,5450,8700 +4570,8670,5080,8690 +4020,8610,4540,8670 +3540,8480,4020,8610 +3520,8230,3520,8480 +3520,7930,3520,8230 +3520,7930,3540,7630 +3480,7320,3540,7610 +3480,7280,3500,7010 +3500,6980,3680,6850 +3680,6850,4220,6840 +4230,6840,4760,6850 +4780,6850,5310,6860 +5310,6860,5720,6940 +5720,6940,5880,7250 +5880,7250,5900,7520 +100,11240,440,11300 +440,11300,760,11330 +1480,11280,1840,11230 +2200,11130,2360,11090 +1840,11230,2200,11130 \ No newline at end of file diff --git a/samples/99_genre_platformer/the_little_probe/level.txt b/samples/99_genre_platformer/the_little_probe/level.txt deleted file mode 100644 index 62caf2d..0000000 --- a/samples/99_genre_platformer/the_little_probe/level.txt +++ /dev/null @@ -1,1481 +0,0 @@ -640,8840,1180,8840 --60,10220,0,9960 --60,10220,0,10500 -0,10500,0,10780 -0,10780,40,10900 -500,10920,760,10960 -300,10560,820,10600 -420,10320,700,10300 -820,10600,1500,10600 -1500,10600,1940,10600 -1940,10600,2380,10580 -2380,10580,2800,10620 -2240,11080,2480,11020 -2000,11120,2240,11080 -1760,11180,2000,11120 -1620,11180,1760,11180 -1500,11220,1620,11180 -1180,11280,1340,11220 -1040,11240,1180,11280 -840,11280,1040,11240 -640,11280,840,11280 -500,11220,640,11280 -420,11140,500,11220 -240,11100,420,11140 -100,11120,240,11100 -0,11180,100,11120 --160,11220,0,11180 --260,11240,-160,11220 -1340,11220,1500,11220 -960,13300,1280,13060 -1280,13060,1540,12860 -1540,12860,1820,12700 -1820,12700,2080,12520 -2080,12520,2240,12400 -2240,12400,2240,12240 -2240,12240,2400,12080 -2400,12080,2560,11920 -2560,11920,2640,11740 -2640,11740,2740,11580 -2740,11580,2800,11400 -2800,11400,2800,11240 -2740,11140,2800,11240 -2700,11040,2740,11140 -2700,11040,2740,10960 -2740,10960,2740,10920 -2700,10900,2740,10920 -2380,10900,2700,10900 -2040,10920,2380,10900 -1720,10940,2040,10920 -1380,11000,1720,10940 -1180,10980,1380,11000 -900,10980,1180,10980 -760,10960,900,10980 -240,10960,500,10920 -40,10900,240,10960 -0,9700,0,9960 --60,9500,0,9700 --60,9420,-60,9500 --60,9420,-60,9340 --60,9340,-60,9280 --60,9120,-60,9280 --60,8940,-60,9120 --60,8940,-60,8780 --60,8780,0,8700 -0,8700,40,8680 -40,8680,240,8700 -240,8700,360,8780 -360,8780,640,8840 -1420,8400,1540,8480 -1540,8480,1680,8500 -1680,8500,1940,8460 -1180,8840,1280,8880 -1280,8880,1340,8860 -1340,8860,1720,8860 -1720,8860,1820,8920 -1820,8920,1820,9140 -1820,9140,1820,9280 -1820,9460,1820,9280 -1760,9480,1820,9460 -1640,9480,1760,9480 -1540,9500,1640,9480 -1340,9500,1540,9500 -1100,9500,1340,9500 -1040,9540,1100,9500 -960,9540,1040,9540 -300,9420,360,9460 -240,9440,300,9420 -180,9600,240,9440 -120,9660,180,9600 -100,9820,120,9660 -100,9820,120,9860 -120,9860,140,9900 -140,9900,140,10000 -140,10440,180,10540 -100,10080,140,10000 -100,10080,140,10100 -140,10100,140,10440 -180,10540,300,10560 -2140,9560,2140,9640 -2140,9720,2140,9640 -1880,9780,2140,9720 -1720,9780,1880,9780 -1620,9740,1720,9780 -1500,9780,1620,9740 -1380,9780,1500,9780 -1340,9820,1380,9780 -1200,9820,1340,9820 -1100,9780,1200,9820 -900,9780,1100,9780 -820,9720,900,9780 -540,9720,820,9720 -360,9840,540,9720 -360,9840,360,9960 -360,9960,360,10080 -360,10140,360,10080 -360,10140,360,10240 -360,10240,420,10320 -700,10300,820,10280 -820,10280,820,10280 -820,10280,900,10320 -900,10320,1040,10300 -1040,10300,1200,10320 -1200,10320,1380,10280 -1380,10280,1500,10300 -1500,10300,1760,10300 -2800,10620,2840,10600 -2840,10600,2900,10600 -2900,10600,3000,10620 -3000,10620,3080,10620 -3080,10620,3140,10600 -3140,10540,3140,10600 -3140,10540,3140,10460 -3140,10460,3140,10360 -3140,10360,3140,10260 -3140,10260,3140,10140 -3140,10140,3140,10000 -3140,10000,3140,9860 -3140,9860,3160,9720 -3160,9720,3160,9580 -3160,9580,3160,9440 -3160,9300,3160,9440 -3160,9300,3160,9140 -3160,9140,3160,8980 -3160,8980,3160,8820 -3160,8820,3160,8680 -3160,8680,3160,8520 -1760,10300,1880,10300 -660,9500,960,9540 -640,9460,660,9500 -360,9460,640,9460 --480,10760,-440,10880 --480,11020,-440,10880 --480,11160,-260,11240 --480,11020,-480,11160 --600,11420,-380,11320 --380,11320,-200,11340 --200,11340,0,11340 -0,11340,180,11340 -960,13420,960,13300 -960,13420,960,13520 -960,13520,1000,13560 -1000,13560,1040,13540 -1040,13540,1200,13440 -1200,13440,1380,13380 -1380,13380,1620,13300 -1620,13300,1820,13220 -1820,13220,2000,13200 -2000,13200,2240,13200 -2240,13200,2440,13160 -2440,13160,2640,13040 --480,10760,-440,10620 --440,10620,-360,10560 --380,10460,-360,10560 --380,10460,-360,10300 --380,10140,-360,10300 --380,10140,-380,10040 --380,9880,-380,10040 --380,9720,-380,9880 --380,9720,-380,9540 --380,9360,-380,9540 --380,9180,-380,9360 --380,9180,-380,9000 --380,8840,-380,9000 --380,8840,-380,8760 --380,8760,-380,8620 --380,8620,-380,8520 --380,8520,-360,8400 --360,8400,-100,8400 --100,8400,-60,8420 --60,8420,240,8440 -240,8440,240,8380 -240,8380,500,8440 -500,8440,760,8460 -760,8460,1000,8400 -1000,8400,1180,8420 -1180,8420,1420,8400 -1940,8460,2140,8420 -2140,8420,2200,8520 -2200,8680,2200,8520 -2140,8840,2200,8680 -2140,8840,2140,9020 -2140,9100,2140,9020 -2140,9200,2140,9100 -2140,9200,2200,9320 -2200,9320,2200,9440 -2140,9560,2200,9440 -1880,10300,2200,10280 -2200,10280,2480,10260 -2480,10260,2700,10240 -2700,10240,2840,10180 -2840,10180,2900,10060 -2900,9860,2900,10060 -2900,9640,2900,9860 -2900,9640,2900,9500 -2900,9460,2900,9500 -2740,9460,2900,9460 -2700,9460,2740,9460 -2700,9360,2700,9460 -2700,9320,2700,9360 -2600,9320,2700,9320 -2600,9260,2600,9320 -2600,9200,2600,9260 -2480,9120,2600,9200 -2440,9080,2480,9120 -2380,9080,2440,9080 -2320,9060,2380,9080 -2320,8860,2320,9060 -2320,8860,2380,8840 -2380,8840,2480,8860 -2480,8860,2600,8840 -2600,8840,2740,8840 -2740,8840,2840,8800 -2840,8800,2900,8700 -2900,8600,2900,8700 -2900,8480,2900,8600 -2900,8380,2900,8480 -2900,8380,2900,8260 -2900,8260,2900,8140 -2900,8140,2900,8020 -2900,8020,2900,7900 -2900,7820,2900,7900 -2900,7820,2900,7740 -2900,7660,2900,7740 -2900,7560,2900,7660 -2900,7460,2900,7560 -2900,7460,2900,7360 -2900,7260,2900,7360 -2840,7160,2900,7260 -2800,7080,2840,7160 -2700,7100,2800,7080 -2560,7120,2700,7100 -2400,7100,2560,7120 -2320,7100,2400,7100 -2140,7100,2320,7100 -2040,7080,2140,7100 -1940,7080,2040,7080 -1820,7140,1940,7080 -1680,7140,1820,7140 -1540,7140,1680,7140 -1420,7220,1540,7140 -1280,7220,1380,7220 -1140,7200,1280,7220 -1000,7220,1140,7200 -760,7280,900,7320 -540,7220,760,7280 -300,7180,540,7220 -180,7120,180,7160 -40,7140,180,7120 --60,7160,40,7140 --200,7120,-60,7160 -180,7160,300,7180 --260,7060,-200,7120 --260,6980,-260,7060 --260,6880,-260,6980 --260,6880,-260,6820 --260,6820,-200,6760 --200,6760,-100,6740 --100,6740,-60,6740 --60,6740,40,6740 -40,6740,300,6800 -300,6800,420,6760 -420,6760,500,6740 -500,6740,540,6760 -540,6760,540,6760 -540,6760,640,6780 -640,6660,640,6780 -580,6580,640,6660 -580,6440,580,6580 -580,6440,640,6320 -640,6320,640,6180 -580,6080,640,6180 -580,6080,640,5960 -640,5960,640,5840 -640,5840,640,5700 -640,5700,660,5560 -660,5560,660,5440 -660,5440,660,5300 -660,5140,660,5300 -660,5140,660,5000 -660,5000,660,4880 -660,4880,820,4860 -820,4860,1000,4840 -1000,4840,1100,4860 -1100,4860,1280,4860 -1280,4860,1420,4840 -1420,4840,1580,4860 -1580,4860,1720,4820 -1720,4820,1880,4860 -1880,4860,2000,4840 -2000,4840,2140,4840 -2140,4840,2320,4860 -2320,4860,2440,4880 -2440,4880,2600,4880 -2600,4880,2800,4880 -2800,4880,2900,4880 -2900,4880,2900,4820 -2900,4740,2900,4820 -2800,4700,2900,4740 -2520,4680,2800,4700 -2240,4660,2520,4680 -1940,4620,2240,4660 -1820,4580,1940,4620 -1820,4500,1820,4580 -1820,4500,1880,4420 -1880,4420,2000,4420 -2000,4420,2200,4420 -2200,4420,2400,4440 -2400,4440,2600,4440 -2600,4440,2840,4440 -2840,4440,2900,4400 -2740,4260,2900,4280 -2600,4240,2740,4260 -2480,4280,2600,4240 -2320,4240,2480,4280 -2140,4220,2320,4240 -1940,4220,2140,4220 -1880,4160,1940,4220 -1880,4160,1880,4080 -1880,4080,2040,4040 -2040,4040,2240,4060 -2240,4060,2400,4040 -2400,4040,2600,4060 -2600,4060,2740,4020 -2740,4020,2840,3940 -2840,3780,2840,3940 -2740,3660,2840,3780 -2700,3680,2740,3660 -2520,3700,2700,3680 -2380,3700,2520,3700 -2200,3720,2380,3700 -2040,3720,2200,3720 -1880,3700,2040,3720 -1820,3680,1880,3700 -1760,3600,1820,3680 -1760,3600,1820,3480 -1820,3480,1880,3440 -1880,3440,1960,3460 -1960,3460,2140,3460 -2140,3460,2380,3460 -2380,3460,2640,3440 -2640,3440,2900,3380 -2840,3280,2900,3380 -2840,3280,2900,3200 -2900,3200,2900,3140 -2840,3020,2900,3140 -2800,2960,2840,3020 -2700,3000,2800,2960 -2600,2980,2700,3000 -2380,3000,2600,2980 -2140,3000,2380,3000 -1880,3000,2140,3000 -1720,3040,1880,3000 -1640,2960,1720,3040 -1500,2940,1640,2960 -1340,3000,1500,2940 -1240,3000,1340,3000 -1140,3020,1240,3000 -1040,3000,1140,3020 -960,2960,1040,3000 -900,2960,960,2960 -840,2840,900,2960 -700,2820,840,2840 -540,2820,700,2820 -420,2820,540,2820 -180,2800,420,2820 -60,2780,180,2800 --60,2800,60,2780 --160,2760,-60,2800 --260,2740,-160,2760 --300,2640,-260,2740 --360,2560,-300,2640 --380,2460,-360,2560 --380,2460,-300,2380 --300,2300,-300,2380 --300,2300,-300,2220 --300,2100,-300,2220 --300,2100,-300,2040 --300,2040,-160,2040 --160,2040,-60,2040 --60,2040,60,2040 -60,2040,180,2040 -180,2040,360,2040 -360,2040,540,2040 -540,2040,700,2080 -660,2160,700,2080 -660,2160,700,2260 -660,2380,700,2260 -500,2340,660,2380 -360,2340,500,2340 -240,2340,360,2340 -40,2320,240,2340 --60,2320,40,2320 --100,2380,-60,2320 --100,2380,-100,2460 --100,2460,-100,2540 --100,2540,0,2560 -0,2560,140,2600 -140,2600,300,2600 -300,2600,460,2600 -460,2600,640,2600 -640,2600,760,2580 -760,2580,820,2560 -820,2560,820,2500 -820,2500,820,2400 -820,2400,840,2320 -840,2320,840,2240 -820,2120,840,2240 -820,2020,820,2120 -820,1900,820,2020 -760,1840,820,1900 -640,1840,760,1840 -500,1840,640,1840 -300,1860,420,1880 -180,1840,300,1860 -420,1880,500,1840 -0,1840,180,1840 --60,1860,0,1840 --160,1840,-60,1860 --200,1800,-160,1840 --260,1760,-200,1800 --260,1680,-260,1760 --260,1620,-260,1680 --260,1540,-260,1620 --260,1540,-260,1460 --300,1420,-260,1460 --300,1420,-300,1340 --300,1340,-260,1260 --260,1260,-260,1160 --260,1060,-260,1160 --260,1060,-260,960 --260,880,-260,960 --260,880,-260,780 --260,780,-260,680 --300,580,-260,680 --300,580,-300,480 --300,480,-260,400 --300,320,-260,400 --300,320,-300,240 --300,240,-200,220 --200,220,-200,160 --200,160,-100,140 --100,140,0,120 -0,120,60,120 -60,120,180,120 -180,120,300,120 -300,120,420,140 -420,140,580,180 -580,180,760,180 -760,180,900,180 -960,180,1100,180 -1100,180,1340,200 -1340,200,1580,200 -1580,200,1720,180 -1720,180,2000,140 -2000,140,2240,140 -2240,140,2480,140 -2520,140,2800,160 -2800,160,3000,160 -3000,160,3140,160 -3140,260,3140,160 -3140,260,3140,380 -3080,500,3140,380 -3080,620,3080,500 -3080,620,3080,740 -3080,740,3080,840 -3080,960,3080,840 -3080,1080,3080,960 -3080,1080,3080,1200 -3080,1200,3080,1340 -3080,1340,3080,1460 -3080,1580,3080,1460 -3080,1700,3080,1580 -3080,1700,3080,1760 -3080,1760,3200,1760 -3200,1760,3320,1760 -3320,1760,3520,1760 -3520,1760,3680,1740 -3680,1740,3780,1700 -3780,1700,3840,1620 -3840,1620,3840,1520 -3840,1520,3840,1420 -3840,1320,3840,1420 -3840,1120,3840,1320 -3840,1120,3840,940 -3840,940,3840,760 -3780,600,3840,760 -3780,600,3780,440 -3780,320,3780,440 -3780,320,3780,160 -3780,60,3780,160 -3780,60,4020,60 -4020,60,4260,40 -4260,40,4500,40 -4500,40,4740,40 -4740,40,4840,20 -4840,20,4880,80 -4880,80,5080,40 -5080,40,5280,20 -5280,20,5500,0 -5500,0,5720,0 -5720,0,5940,60 -5940,60,6240,60 -6240,60,6540,20 -6540,20,6840,20 -6840,20,7040,0 -7040,0,7140,0 -7140,0,7400,20 -7400,20,7680,0 -7680,0,7940,0 -7940,0,8200,-20 -8200,-20,8360,20 -8360,20,8560,-40 -8560,-40,8760,0 -8760,0,8880,40 -8880,120,8880,40 -8840,220,8840,120 -8620,240,8840,220 -8420,260,8620,240 -8200,280,8420,260 -7940,280,8200,280 -7760,240,7940,280 -7560,220,7760,240 -7360,280,7560,220 -7140,260,7360,280 -6940,240,7140,260 -6720,220,6940,240 -6480,220,6720,220 -6360,300,6480,220 -6240,300,6360,300 -6200,500,6240,300 -6200,500,6360,540 -6360,540,6540,520 -6540,520,6720,480 -6720,480,6880,460 -6880,460,7080,500 -7080,500,7320,500 -7320,500,7680,500 -7680,620,7680,500 -7520,640,7680,620 -7360,640,7520,640 -7200,640,7360,640 -7040,660,7200,640 -6880,720,7040,660 -6720,700,6880,720 -6540,700,6720,700 -6420,760,6540,700 -6280,740,6420,760 -6240,760,6280,740 -6200,920,6240,760 -6200,920,6360,960 -6360,960,6540,960 -6540,960,6720,960 -6720,960,6760,980 -6760,980,6880,940 -6880,940,7080,940 -7080,940,7280,940 -7280,940,7520,920 -7520,920,7760,900 -7760,900,7980,860 -7980,860,8100,880 -8100,880,8280,900 -8280,900,8500,820 -8500,820,8700,820 -8700,820,8760,840 -8760,960,8760,840 -8700,1040,8760,960 -8560,1060,8700,1040 -8460,1080,8560,1060 -8360,1040,8460,1080 -8280,1080,8360,1040 -8160,1120,8280,1080 -8040,1120,8160,1120 -7940,1100,8040,1120 -7800,1120,7940,1100 -7680,1120,7800,1120 -7520,1100,7680,1120 -7360,1100,7520,1100 -7200,1120,7360,1100 -7040,1180,7200,1120 -6880,1160,7040,1180 -6720,1160,6880,1160 -6540,1160,6720,1160 -6360,1160,6540,1160 -6200,1160,6360,1160 -6040,1220,6200,1160 -6040,1220,6040,1400 -6040,1400,6200,1440 -6200,1440,6320,1440 -6320,1440,6440,1440 -6600,1440,6760,1440 -6760,1440,6940,1420 -6440,1440,6600,1440 -6940,1420,7280,1400 -7280,1400,7560,1400 -7560,1400,7760,1400 -7760,1400,7940,1360 -7940,1360,8100,1380 -8100,1380,8280,1340 -8280,1340,8460,1320 -8660,1300,8760,1360 -8460,1320,8660,1300 -8760,1360,8800,1500 -8800,1660,8800,1500 -8800,1660,8800,1820 -8700,1840,8800,1820 -8620,1860,8700,1840 -8560,1800,8620,1860 -8560,1800,8620,1680 -8500,1640,8620,1680 -8420,1680,8500,1640 -8280,1680,8420,1680 -8160,1680,8280,1680 -7900,1680,8160,1680 -7680,1680,7900,1680 -7400,1660,7680,1680 -7140,1680,7400,1660 -6880,1640,7140,1680 -6040,1820,6320,1780 -5900,1840,6040,1820 -6640,1700,6880,1640 -6320,1780,6640,1700 -5840,2040,5900,1840 -5840,2040,5840,2220 -5840,2220,5840,2320 -5840,2460,5840,2320 -5840,2560,5840,2460 -5840,2560,5960,2620 -5960,2620,6200,2620 -6200,2620,6380,2600 -6380,2600,6600,2580 -6600,2580,6800,2600 -6800,2600,7040,2580 -7040,2580,7280,2580 -7280,2580,7480,2560 -7760,2540,7980,2520 -7980,2520,8160,2500 -7480,2560,7760,2540 -8160,2500,8160,2420 -8160,2420,8160,2320 -8160,2180,8160,2320 -7980,2160,8160,2180 -7800,2180,7980,2160 -7600,2200,7800,2180 -7400,2200,7600,2200 -6960,2200,7200,2200 -7200,2200,7400,2200 -6720,2200,6960,2200 -6540,2180,6720,2200 -6320,2200,6540,2180 -6240,2160,6320,2200 -6240,2160,6240,2040 -6240,2040,6240,1940 -6240,1940,6440,1940 -6440,1940,6720,1940 -6720,1940,6940,1920 -7520,1920,7760,1920 -6940,1920,7280,1920 -7280,1920,7520,1920 -7760,1920,8100,1900 -8100,1900,8420,1900 -8420,1900,8460,1940 -8460,2120,8460,1940 -8460,2280,8460,2120 -8460,2280,8560,2420 -8560,2420,8660,2380 -8660,2380,8800,2340 -8800,2340,8840,2400 -8840,2520,8840,2400 -8800,2620,8840,2520 -8800,2740,8800,2620 -8800,2860,8800,2740 -8800,2940,8800,2860 -8760,2980,8800,2940 -8660,2980,8760,2980 -8620,2960,8660,2980 -8560,2880,8620,2960 -8560,2880,8560,2780 -8500,2740,8560,2780 -8420,2760,8500,2740 -8420,2840,8420,2760 -8420,2840,8420,2940 -8420,3040,8420,2940 -8420,3160,8420,3040 -8420,3280,8420,3380 -8420,3280,8420,3160 -8420,3380,8620,3460 -8620,3460,8760,3460 -8760,3460,8840,3400 -8840,3400,8960,3400 -8960,3400,9000,3500 -9000,3700,9000,3500 -9000,3900,9000,3700 -9000,4080,9000,3900 -9000,4280,9000,4080 -9000,4500,9000,4280 -9000,4620,9000,4500 -9000,4780,9000,4620 -9000,4780,9000,4960 -9000,5120,9000,4960 -9000,5120,9000,5300 -8960,5460,9000,5300 -8920,5620,8960,5460 -8920,5620,8920,5800 -8920,5800,8920,5960 -8920,5960,8920,6120 -8920,6120,8960,6300 -8960,6300,8960,6480 -8960,6660,8960,6480 -8960,6860,8960,6660 -8960,7040,8960,6860 -8920,7420,8920,7220 -8920,7420,8960,7620 -8960,7620,8960,7800 -8960,7800,8960,8000 -8960,8000,8960,8180 -8960,8180,8960,8380 -8960,8580,8960,8380 -8920,8800,8960,8580 -8880,9000,8920,8800 -8840,9180,8880,9000 -8800,9220,8840,9180 -8800,9220,8840,9340 -8760,9380,8840,9340 -8560,9340,8760,9380 -8360,9360,8560,9340 -8160,9360,8360,9360 -8040,9340,8160,9360 -7860,9360,8040,9340 -7680,9360,7860,9360 -7520,9360,7680,9360 -7420,9260,7520,9360 -7400,9080,7420,9260 -7400,9080,7420,8860 -7420,8860,7440,8720 -7440,8720,7480,8660 -7480,8660,7520,8540 -7520,8540,7600,8460 -7600,8460,7800,8480 -7800,8480,8040,8480 -8040,8480,8280,8480 -8280,8480,8500,8460 -8500,8460,8620,8440 -8620,8440,8660,8340 -8660,8340,8660,8220 -8660,8220,8700,8080 -8700,8080,8700,7920 -8700,7920,8700,7760 -8700,7760,8700,7620 -8700,7480,8700,7620 -8700,7480,8700,7320 -8700,7160,8700,7320 -8920,7220,8960,7040 -8660,7040,8700,7160 -8660,7040,8700,6880 -8660,6700,8700,6880 -8660,6700,8700,6580 -8700,6460,8700,6580 -8700,6460,8700,6320 -8700,6160,8700,6320 -8700,6160,8760,6020 -8760,6020,8760,5860 -8760,5860,8760,5700 -8760,5700,8760,5540 -8760,5540,8760,5360 -8760,5360,8760,5180 -8760,5000,8760,5180 -8700,4820,8760,5000 -8560,4740,8700,4820 -8420,4700,8560,4740 -8280,4700,8420,4700 -8100,4700,8280,4700 -7980,4700,8100,4700 -7820,4740,7980,4700 -7800,4920,7820,4740 -7800,4920,7900,4960 -7900,4960,8060,4980 -8060,4980,8220,5000 -8220,5000,8420,5040 -8420,5040,8460,5120 -8460,5180,8460,5120 -8360,5200,8460,5180 -8360,5280,8360,5200 -8160,5300,8360,5280 -8040,5260,8160,5300 -7860,5220,8040,5260 -7720,5160,7860,5220 -7640,5120,7720,5160 -7480,5120,7640,5120 -7240,5120,7480,5120 -7000,5120,7240,5120 -6800,5160,7000,5120 -6640,5220,6800,5160 -6600,5360,6640,5220 -6600,5460,6600,5360 -6480,5520,6600,5460 -6240,5540,6480,5520 -5980,5540,6240,5540 -5740,5540,5980,5540 -5500,5520,5740,5540 -5400,5520,5500,5520 -5280,5540,5400,5520 -5080,5540,5280,5540 -4940,5540,5080,5540 -4760,5540,4940,5540 -4600,5540,4760,5540 -4440,5560,4600,5540 -4040,5580,4120,5520 -4260,5540,4440,5560 -4120,5520,4260,5540 -4020,5720,4040,5580 -4020,5840,4020,5720 -4020,5840,4080,5940 -4080,5940,4120,6040 -4120,6040,4200,6080 -4200,6080,4340,6080 -4340,6080,4500,6060 -4500,6060,4700,6060 -4700,6060,4880,6060 -4880,6060,5080,6060 -5080,6060,5280,6080 -5280,6080,5440,6100 -5440,6100,5660,6100 -5660,6100,5900,6080 -5900,6080,6120,6080 -6120,6080,6360,6080 -6360,6080,6480,6100 -6480,6100,6540,6060 -6540,6060,6720,6060 -6720,6060,6940,6060 -6940,6060,7140,6060 -7400,6060,7600,6060 -7140,6060,7400,6060 -7600,6060,7800,6060 -7800,6060,7860,6080 -7860,6080,8060,6080 -8060,6080,8220,6080 -8220,6080,8320,6140 -8320,6140,8360,6300 -8320,6460,8360,6300 -8320,6620,8320,6460 -8320,6800,8320,6620 -8320,6960,8320,6800 -8320,6960,8360,7120 -8320,7280,8360,7120 -8320,7440,8320,7280 -8320,7600,8320,7440 -8100,7580,8220,7600 -8220,7600,8320,7600 -7900,7560,8100,7580 -7680,7560,7900,7560 -7480,7580,7680,7560 -7280,7580,7480,7580 -7080,7580,7280,7580 -7000,7600,7080,7580 -6880,7600,7000,7600 -6800,7580,6880,7600 -6640,7580,6800,7580 -6540,7580,6640,7580 -6380,7600,6540,7580 -6280,7620,6380,7600 -6240,7700,6280,7620 -6240,7700,6240,7800 -6240,7840,6240,7800 -6080,7840,6240,7840 -5960,7820,6080,7840 -5660,7840,5800,7840 -5500,7800,5660,7840 -5440,7700,5500,7800 -5800,7840,5960,7820 -5440,7540,5440,7700 -5440,7440,5440,7540 -5440,7320,5440,7440 -5400,7320,5440,7320 -5340,7400,5400,7320 -5340,7400,5340,7500 -5340,7600,5340,7500 -5340,7600,5340,7720 -5340,7720,5340,7860 -5340,7860,5340,7960 -5340,7960,5440,8020 -5440,8020,5560,8020 -5560,8020,5720,8040 -5720,8040,5900,8060 -5900,8060,6080,8060 -6080,8060,6240,8060 -6720,8040,6840,8060 -6240,8060,6480,8040 -6480,8040,6720,8040 -6840,8060,6940,8060 -6940,8060,7080,8120 -7080,8120,7140,8180 -7140,8460,7140,8320 -7140,8620,7140,8460 -7140,8620,7140,8740 -7140,8860,7140,8740 -7140,8960,7140,8860 -7140,8960,7200,9080 -7140,9200,7200,9080 -7140,9200,7200,9320 -7200,9320,7200,9460 -7200,9760,7200,9900 -7200,9620,7200,9460 -7200,9620,7200,9760 -7200,9900,7200,10060 -7200,10220,7200,10060 -7200,10360,7200,10220 -7140,10400,7200,10360 -6880,10400,7140,10400 -6640,10360,6880,10400 -6420,10360,6640,10360 -6160,10380,6420,10360 -5940,10340,6160,10380 -5720,10320,5940,10340 -5500,10340,5720,10320 -5280,10300,5500,10340 -5080,10300,5280,10300 -4840,10280,5080,10300 -4700,10280,4840,10280 -4540,10280,4700,10280 -4360,10280,4540,10280 -4200,10300,4360,10280 -4040,10380,4200,10300 -4020,10500,4040,10380 -3980,10640,4020,10500 -3980,10640,3980,10760 -3980,10760,4020,10920 -4020,10920,4080,11000 -4080,11000,4340,11020 -4340,11020,4600,11060 -4600,11060,4840,11040 -4840,11040,4880,10960 -4880,10740,4880,10960 -4880,10740,4880,10600 -4880,10600,5080,10560 -5080,10560,5340,10620 -5340,10620,5660,10620 -5660,10620,6040,10600 -6040,10600,6120,10620 -6120,10620,6240,10720 -6240,10720,6420,10740 -6420,10740,6640,10760 -6640,10760,6880,10780 -7140,10780,7400,10780 -6880,10780,7140,10780 -7400,10780,7680,10780 -7680,10780,8100,10760 -8100,10760,8460,10740 -8460,10740,8700,10760 -8800,10840,8800,10980 -8700,10760,8800,10840 -8760,11200,8800,10980 -8760,11200,8760,11380 -8760,11380,8800,11560 -8760,11680,8800,11560 -8760,11760,8760,11680 -8760,11760,8760,11920 -8760,11920,8800,12080 -8800,12200,8800,12080 -8700,12240,8800,12200 -8560,12220,8700,12240 -8360,12220,8560,12220 -8160,12240,8360,12220 -7720,12220,7980,12220 -7980,12220,8160,12240 -7400,12200,7720,12220 -7200,12180,7400,12200 -7000,12160,7200,12180 -6800,12160,7000,12160 -6280,12140,6380,12180 -6120,12180,6280,12140 -6540,12180,6800,12160 -6380,12180,6540,12180 -5900,12200,6120,12180 -5620,12180,5900,12200 -5340,12120,5620,12180 -5140,12100,5340,12120 -4980,12120,5140,12100 -4840,12120,4980,12120 -4700,12200,4840,12120 -4700,12380,4700,12200 -4740,12480,4940,12520 -4700,12380,4740,12480 -4940,12520,5160,12560 -5160,12560,5340,12600 -5340,12600,5400,12600 -5400,12600,5500,12600 -5500,12600,5620,12600 -5620,12600,5720,12560 -5720,12560,5800,12440 -5800,12440,5900,12380 -5900,12380,6120,12420 -6120,12420,6380,12440 -6380,12440,6600,12460 -6720,12460,6840,12520 -6840,12520,6960,12520 -6600,12460,6720,12460 -6960,12520,7040,12500 -7040,12500,7140,12440 -7200,12440,7360,12500 -7360,12500,7600,12560 -7600,12560,7860,12600 -7860,12600,8060,12500 -8100,12500,8200,12340 -8200,12340,8360,12360 -8360,12360,8560,12400 -8560,12400,8660,12420 -8660,12420,8840,12400 -8840,12400,9000,12360 -9000,12360,9000,12360 -2900,4400,2900,4280 -900,7320,1000,7220 -2640,13040,2900,12920 -2900,12920,3160,12840 -3480,12760,3780,12620 -3780,12620,4020,12460 -4300,12360,4440,12260 -4020,12460,4300,12360 -3160,12840,3480,12760 -4440,12080,4440,12260 -4440,12080,4440,11880 -4440,11880,4440,11720 -4440,11720,4600,11720 -4600,11720,4760,11740 -4760,11740,4980,11760 -4980,11760,5160,11760 -5160,11760,5340,11780 -6000,11860,6120,11820 -5340,11780,5620,11820 -5620,11820,6000,11860 -6120,11820,6360,11820 -6360,11820,6640,11860 -6940,11920,7240,11940 -7240,11940,7520,11960 -7520,11960,7860,11960 -7860,11960,8100,11920 -8100,11920,8420,11940 -8420,11940,8460,11960 -8460,11960,8500,11860 -8460,11760,8500,11860 -8320,11720,8460,11760 -8160,11720,8320,11720 -7940,11720,8160,11720 -7720,11700,7940,11720 -7520,11680,7720,11700 -7320,11680,7520,11680 -7200,11620,7320,11680 -7200,11620,7200,11500 -7200,11500,7280,11440 -7280,11440,7420,11440 -7420,11440,7600,11440 -7600,11440,7980,11460 -7980,11460,8160,11460 -8160,11460,8360,11460 -8360,11460,8460,11400 -8420,11060,8500,11200 -8280,11040,8420,11060 -8100,11060,8280,11040 -8460,11400,8500,11200 -7800,11060,8100,11060 -7520,11060,7800,11060 -7240,11060,7520,11060 -6940,11040,7240,11060 -6640,11000,6940,11040 -6420,10980,6640,11000 -6360,11060,6420,10980 -6360,11180,6360,11060 -6200,11280,6360,11180 -5960,11300,6200,11280 -5720,11280,5960,11300 -5500,11280,5720,11280 -4940,11300,5200,11280 -4660,11260,4940,11300 -4440,11280,4660,11260 -4260,11280,4440,11280 -4220,11220,4260,11280 -4080,11280,4220,11220 -3980,11420,4080,11280 -3980,11420,4040,11620 -4040,11620,4040,11820 -3980,11960,4040,11820 -3840,12000,3980,11960 -3720,11940,3840,12000 -3680,11800,3720,11940 -3680,11580,3680,11800 -3680,11360,3680,11580 -3680,11360,3680,11260 -3680,11080,3680,11260 -3680,11080,3680,10880 -3680,10700,3680,10880 -3680,10700,3680,10620 -3680,10480,3680,10620 -3680,10480,3680,10300 -3680,10300,3680,10100 -3680,10100,3680,9940 -3680,9940,3720,9860 -3720,9860,3920,9900 -3920,9900,4220,9880 -4980,9940,5340,9960 -4220,9880,4540,9900 -4540,9900,4980,9940 -5340,9960,5620,9960 -5620,9960,5900,9960 -5900,9960,6160,10000 -6160,10000,6480,10000 -6480,10000,6720,10000 -6720,10000,6880,9860 -6880,9860,6880,9520 -6880,9520,6940,9340 -6940,9120,6940,9340 -6940,9120,6940,8920 -6940,8700,6940,8920 -6880,8500,6940,8700 -6880,8320,6880,8500 -7140,8320,7140,8180 -6760,8260,6880,8320 -6540,8240,6760,8260 -6420,8180,6540,8240 -6280,8240,6420,8180 -6160,8300,6280,8240 -6120,8400,6160,8300 -6080,8520,6120,8400 -5840,8480,6080,8520 -5620,8500,5840,8480 -5500,8500,5620,8500 -5340,8560,5500,8500 -5160,8540,5340,8560 -4620,8520,4880,8520 -4360,8480,4620,8520 -4880,8520,5160,8540 -4140,8440,4360,8480 -3920,8460,4140,8440 -3720,8380,3920,8460 -3680,8160,3720,8380 -3680,8160,3720,7940 -3720,7720,3720,7940 -3680,7580,3720,7720 -3680,7580,3720,7440 -3720,7440,3720,7300 -3720,7160,3720,7300 -3720,7160,3720,7020 -3720,7020,3780,6900 -3780,6900,4080,6940 -4080,6940,4340,6980 -4340,6980,4600,6980 -4600,6980,4880,6980 -4880,6980,5160,6980 -5160,6980,5400,7000 -5400,7000,5560,7020 -5560,7020,5660,7080 -5660,7080,5660,7280 -5660,7280,5660,7440 -5660,7440,5740,7520 -5740,7520,5740,7600 -5740,7600,5900,7600 -5900,7600,6040,7540 -6040,7540,6040,7320 -6040,7320,6120,7200 -6120,7200,6120,7040 -6120,7040,6240,7000 -6240,7000,6480,7060 -6480,7060,6800,7060 -6800,7060,7080,7080 -7080,7080,7320,7100 -7940,7100,7980,6920 -7860,6860,7980,6920 -7640,6860,7860,6860 -7400,6840,7640,6860 -7320,7100,7560,7120 -7560,7120,7760,7120 -7760,7120,7940,7100 -7200,6820,7400,6840 -7040,6820,7200,6820 -6600,6840,6840,6840 -6380,6800,6600,6840 -6120,6800,6380,6800 -5900,6840,6120,6800 -5620,6820,5900,6840 -5400,6800,5620,6820 -5140,6800,5400,6800 -4880,6780,5140,6800 -4600,6760,4880,6780 -4340,6760,4600,6760 -4080,6760,4340,6760 -3840,6740,4080,6760 -3680,6720,3840,6740 -3680,6720,3680,6560 -3680,6560,3720,6400 -3720,6400,3720,6200 -3720,6200,3780,6000 -3720,5780,3780,6000 -3720,5580,3720,5780 -3720,5360,3720,5580 -3720,5360,3840,5240 -3840,5240,4200,5260 -4200,5260,4600,5280 -4600,5280,4880,5280 -4880,5280,5140,5200 -5140,5200,5220,5100 -5220,5100,5280,4900 -5280,4900,5340,4840 -5340,4840,5720,4880 -6120,4880,6480,4860 -6880,4840,7200,4860 -6480,4860,6880,4840 -7200,4860,7320,4860 -7320,4860,7360,4740 -7360,4600,7440,4520 -7360,4600,7360,4740 -7440,4520,7640,4520 -7640,4520,7800,4480 -7800,4480,7800,4280 -7800,4280,7800,4040 -7800,4040,7800,3780 -7800,3560,7800,3780 -7800,3560,7860,3440 -7860,3440,8060,3460 -8060,3460,8160,3340 -8160,3340,8160,3140 -8160,3140,8160,2960 -8000,2900,8160,2960 -7860,2900,8000,2900 -7640,2940,7860,2900 -7400,2980,7640,2940 -7100,2980,7400,2980 -6840,3000,7100,2980 -5620,2980,5840,2980 -5840,2980,6500,3000 -6500,3000,6840,3000 -5560,2780,5620,2980 -5560,2780,5560,2580 -5560,2580,5560,2380 -5560,2140,5560,2380 -5560,2140,5560,1900 -5560,1900,5620,1660 -5620,1660,5660,1460 -5660,1460,5660,1300 -5500,1260,5660,1300 -5340,1260,5500,1260 -4600,1220,4840,1240 -4440,1220,4600,1220 -4440,1080,4440,1220 -4440,1080,4600,1020 -5080,1260,5340,1260 -4840,1240,5080,1260 -4600,1020,4940,1020 -4940,1020,5220,1020 -5220,1020,5560,960 -5560,960,5660,860 -5660,740,5660,860 -5280,740,5660,740 -4940,780,5280,740 -4660,760,4940,780 -4500,700,4660,760 -4500,520,4500,700 -4500,520,4700,460 -4700,460,5080,440 -5440,420,5740,420 -5080,440,5440,420 -5740,420,5840,360 -5800,280,5840,360 -5560,280,5800,280 -4980,300,5280,320 -4360,320,4660,300 -4200,360,4360,320 -5280,320,5560,280 -4660,300,4980,300 -4140,480,4200,360 -4140,480,4140,640 -4140,640,4200,780 -4200,780,4200,980 -4200,980,4220,1180 -4220,1400,4220,1180 -4220,1400,4260,1540 -4260,1540,4500,1540 -4500,1540,4700,1520 -4700,1520,4980,1540 -5280,1560,5400,1560 -4980,1540,5280,1560 -5400,1560,5400,1700 -5400,1780,5400,1700 -5340,1900,5400,1780 -5340,2020,5340,1900 -5340,2220,5340,2020 -5340,2220,5340,2420 -5340,2420,5340,2520 -5080,2600,5220,2580 -5220,2580,5340,2520 -4900,2580,5080,2600 -4700,2540,4900,2580 -4500,2540,4700,2540 -4220,2580,4340,2540 -4200,2700,4220,2580 -4340,2540,4500,2540 -3980,2740,4200,2700 -3840,2740,3980,2740 -3780,2640,3840,2740 -3780,2640,3780,2460 -3780,2280,3780,2460 -3620,2020,3780,2100 -3780,2280,3780,2100 -3360,2040,3620,2020 -3080,2040,3360,2040 -2840,2020,3080,2040 -2740,1940,2840,2020 -2740,1940,2800,1800 -2800,1640,2800,1800 -2800,1640,2800,1460 -2800,1300,2800,1460 -2700,1180,2800,1300 -2480,1140,2700,1180 -1580,1200,1720,1200 -2240,1180,2480,1140 -1960,1180,2240,1180 -1720,1200,1960,1180 -1500,1320,1580,1200 -1500,1440,1500,1320 -1500,1440,1760,1480 -1760,1480,1940,1480 -1940,1480,2140,1500 -2140,1500,2320,1520 -2400,1560,2400,1700 -2280,1820,2380,1780 -2320,1520,2400,1560 -2380,1780,2400,1700 -2080,1840,2280,1820 -1720,1820,2080,1840 -1420,1800,1720,1820 -1280,1800,1420,1800 -1240,1720,1280,1800 -1240,1720,1240,1600 -1240,1600,1280,1480 -1280,1340,1280,1480 -1180,1280,1280,1340 -1000,1280,1180,1280 -760,1280,1000,1280 -360,1240,540,1260 -180,1220,360,1240 -540,1260,760,1280 -180,1080,180,1220 -180,1080,180,1000 -180,1000,360,940 -360,940,540,960 -540,960,820,980 -1100,980,1200,920 -820,980,1100,980 -6640,11860,6940,11920 -5200,11280,5500,11280 -4120,7330,4120,7230 -4120,7230,4660,7250 -4660,7250,4940,7250 -4940,7250,5050,7340 -5010,7400,5050,7340 -4680,7380,5010,7400 -4380,7370,4680,7380 -4120,7330,4360,7370 -4120,7670,4120,7760 -4120,7670,4280,7650 -4280,7650,4540,7660 -4550,7660,4820,7680 -4820,7680,4900,7730 -4880,7800,4900,7730 -4620,7820,4880,7800 -4360,7790,4620,7820 -4120,7760,4360,7790 -6840,6840,7040,6820 -5720,4880,6120,4880 -1200,920,1340,810 -1340,810,1520,790 -1520,790,1770,800 -2400,790,2600,750 -2600,750,2640,520 -2520,470,2640,520 -2140,470,2520,470 -1760,800,2090,800 -2080,800,2400,790 -1760,450,2140,470 -1420,450,1760,450 -1180,440,1420,450 -900,480,1180,440 -640,450,900,480 -360,440,620,450 -120,430,360,440 -0,520,120,430 --20,780,0,520 --20,780,-20,1020 --20,1020,-20,1150 --20,1150,0,1300 -0,1470,60,1530 -0,1300,0,1470 -60,1530,360,1530 -360,1530,660,1520 -660,1520,980,1520 -980,1520,1040,1520 -1040,1520,1070,1560 -1070,1770,1070,1560 -1070,1770,1100,2010 -1070,2230,1100,2010 -1070,2240,1180,2340 -1180,2340,1580,2340 -1580,2340,1940,2350 -1940,2350,2440,2350 -2440,2350,2560,2380 -2560,2380,2600,2540 -2810,2640,3140,2680 -2600,2540,2810,2640 -3140,2680,3230,2780 -3230,2780,3260,2970 -3230,3220,3260,2970 -3200,3470,3230,3220 -3200,3480,3210,3760 -3210,3760,3210,4040 -3200,4040,3230,4310 -3210,4530,3230,4310 -3210,4530,3230,4730 -3230,4960,3230,4730 -3230,4960,3260,5190 -3170,5330,3260,5190 -2920,5330,3170,5330 -2660,5360,2920,5330 -2420,5330,2660,5360 -2200,5280,2400,5330 -2020,5280,2200,5280 -1840,5260,2020,5280 -1660,5280,1840,5260 -1500,5300,1660,5280 -1360,5270,1500,5300 -1200,5290,1340,5270 -1070,5400,1200,5290 -1040,5630,1070,5400 -1000,5900,1040,5630 -980,6170,1000,5900 -980,6280,980,6170 -980,6540,980,6280 -980,6540,1040,6720 -1040,6720,1360,6730 -1360,6730,1760,6710 -2110,6720,2420,6730 -1760,6710,2110,6720 -2420,6730,2640,6720 -2640,6720,2970,6720 -2970,6720,3160,6700 -3160,6700,3240,6710 -3240,6710,3260,6890 -3260,7020,3260,6890 -3230,7180,3260,7020 -3230,7350,3230,7180 -3210,7510,3230,7350 -3210,7510,3210,7690 -3210,7870,3210,7690 -3210,7870,3210,7980 -3200,8120,3210,7980 -3200,8330,3200,8120 -3160,8520,3200,8330 -2460,11100,2480,11020 -2200,11180,2460,11100 -1260,11350,1600,11320 -600,11430,930,11400 -180,11340,620,11430 -1600,11320,1910,11280 -1910,11280,2200,11180 -923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157 \ No newline at end of file diff --git a/samples/99_genre_platformer/the_little_probe/level_lava.txt b/samples/99_genre_platformer/the_little_probe/level_lava.txt deleted file mode 100644 index e2bc2bd..0000000 --- a/samples/99_genre_platformer/the_little_probe/level_lava.txt +++ /dev/null @@ -1,235 +0,0 @@ -100,10740,500,10780 -500,10780,960,10760 -960,10760,1340,10760 -1380,10760,1820,10780 -1820,10780,2240,10780 -2280,10780,2740,10740 -2740,10740,3000,10780 -3000,10780,3140,11020 --520,8820,-480,9160 --520,8480,-520,8820 --520,8480,-480,8180 --480,8180,-200,8120 --200,8120,100,8220 -100,8220,420,8240 -420,8240,760,8260 -760,8260,1140,8280 -1140,8280,1500,8200 -1500,8200,1880,8240 -1880,8240,2240,8260 -2240,8260,2320,8480 -2320,8480,2380,8680 -2240,8860,2380,8680 -2240,9080,2240,8860 -2240,9080,2320,9260 -2320,9260,2480,9440 -2480,9440,2600,9640 -2480,9840,2600,9640 -2400,10020,2480,9840 -2240,10080,2400,10020 -1960,10080,2240,10080 -1720,10080,1960,10080 -1460,10080,1720,10080 -1180,10080,1420,10080 -900,10080,1180,10080 -640,10080,900,10080 -640,10080,640,9900 -60,10520,100,10740 -40,10240,60,10520 -40,10240,40,9960 -40,9960,40,9680 -40,9680,40,9360 -40,9360,60,9080 -60,9080,100,8860 -100,8860,460,9040 -460,9040,760,9220 -760,9220,1140,9220 -1140,9220,1720,9200 --660,11580,-600,11420 --660,11800,-660,11580 --660,12000,-660,11800 --660,12000,-600,12220 --600,12220,-600,12440 --600,12440,-600,12640 --600,11240,-260,11280 --260,11280,100,11240 -9000,12360,9020,12400 -9020,12620,9020,12400 -9020,12840,9020,12620 -9020,13060,9020,12840 -9020,13060,9020,13240 -9020,13240,9020,13420 -9020,13420,9020,13600 -9020,13600,9020,13780 -8880,13900,9020,13780 -8560,13800,8880,13900 -8220,13780,8560,13800 -7860,13760,8220,13780 -7640,13780,7860,13760 -7360,13800,7640,13780 -7100,13800,7360,13800 -6540,13760,6800,13780 -6800,13780,7100,13800 -6280,13760,6540,13760 -5760,13760,6280,13760 -5220,13780,5760,13760 -4700,13760,5220,13780 -4200,13740,4700,13760 -3680,13720,4200,13740 -3140,13700,3680,13720 -2600,13680,3140,13700 -2040,13940,2600,13680 -1640,13940,2040,13940 -1200,13960,1640,13940 -840,14000,1200,13960 -300,13960,840,14000 --200,13900,300,13960 --600,12840,-600,12640 --600,13140,-600,12840 --600,13140,-600,13420 --600,13700,-600,13420 --600,13700,-600,13820 --600,13820,-200,13900 --600,11240,-560,11000 --560,11000,-480,10840 --520,10660,-480,10840 --520,10660,-520,10480 --520,10480,-520,10300 --520,10260,-480,10080 --480,9880,-440,10060 --520,9680,-480,9880 --520,9680,-480,9400 --480,9400,-480,9160 -1820,9880,2140,9800 -1540,9880,1820,9880 -1200,9920,1500,9880 -900,9880,1200,9920 -640,9900,840,9880 -2380,8760,2800,8760 -2800,8760,2840,8660 -2840,8660,2840,8420 -2840,8160,2840,8420 -2800,7900,2840,8160 -2800,7900,2800,7720 -2800,7540,2800,7720 -2800,7540,2800,7360 -2700,7220,2800,7360 -2400,7220,2700,7220 -2080,7240,2400,7220 -1760,7320,2080,7240 -1380,7360,1720,7320 -1040,7400,1340,7360 -640,7400,1000,7420 -300,7380,640,7400 -0,7300,240,7380 --300,7180,-60,7300 --380,6860,-360,7180 --380,6880,-360,6700 --360,6700,-260,6540 --260,6540,0,6520 -0,6520,240,6640 -240,6640,460,6640 -460,6640,500,6480 -500,6260,500,6480 -460,6060,500,6260 -460,5860,460,6060 -460,5860,500,5640 -500,5640,540,5440 -540,5440,580,5220 -580,5220,580,5000 -580,4960,580,4740 -580,4740,960,4700 -960,4700,1140,4760 -1140,4760,1420,4740 -1420,4740,1720,4700 -1720,4700,2000,4740 -2000,4740,2380,4760 -2380,4760,2700,4800 -1720,4600,1760,4300 -1760,4300,2200,4340 -2200,4340,2560,4340 -2560,4340,2740,4340 -2160,12580,2440,12400 -1820,12840,2160,12580 -1500,13080,1820,12840 -1140,13340,1500,13080 -1140,13340,1580,13220 -2110,13080,2520,13000 -2520,13000,2900,12800 -1580,13220,2110,13080 -2900,12800,3200,12680 -3200,12680,3440,12640 -3440,12640,3720,12460 -3720,12460,4040,12320 -4040,12320,4360,12200 -4360,11940,4380,12180 -4360,11700,4360,11940 -4360,11700,4540,11500 -4540,11500,4880,11540 -6000,11660,6280,11640 -5440,11600,5720,11610 -5720,11610,6000,11660 -6280,11640,6760,11720 -6760,11720,7060,11780 -7060,11780,7360,11810 -7360,11810,7640,11840 -7640,11840,8000,11830 -8000,11830,8320,11850 -8320,11850,8390,11800 -8330,11760,8390,11800 -8160,11760,8330,11760 -7910,11750,8160,11760 -7660,11740,7900,11750 -7400,11730,7660,11740 -7160,11680,7400,11730 -7080,11570,7160,11680 -7080,11570,7100,11350 -7100,11350,7440,11280 -7440,11280,7940,11280 -7960,11280,8360,11280 -5840,11540,6650,11170 -4880,11540,5440,11600 -3410,11830,3420,11300 -3410,11260,3520,10920 -3520,10590,3520,10920 -3520,10590,3540,10260 -3520,9900,3540,10240 -3520,9900,3640,9590 -3640,9570,4120,9590 -4140,9590,4600,9680 -4620,9680,5030,9730 -5120,9750,5520,9800 -5620,9820,6080,9800 -6130,9810,6580,9820 -6640,9820,6800,9700 -6780,9400,6800,9700 -6780,9400,6840,9140 -6820,8860,6840,9120 -6780,8600,6820,8830 -6720,8350,6780,8570 -6480,8340,6720,8320 -6260,8400,6480,8340 -6050,8580,6240,8400 -5760,8630,6040,8590 -5520,8690,5740,8630 -5120,8690,5450,8700 -4570,8670,5080,8690 -4020,8610,4540,8670 -3540,8480,4020,8610 -3520,8230,3520,8480 -3520,7930,3520,8230 -3520,7930,3540,7630 -3480,7320,3540,7610 -3480,7280,3500,7010 -3500,6980,3680,6850 -3680,6850,4220,6840 -4230,6840,4760,6850 -4780,6850,5310,6860 -5310,6860,5720,6940 -5720,6940,5880,7250 -5880,7250,5900,7520 -100,11240,440,11300 -440,11300,760,11330 -1480,11280,1840,11230 -2200,11130,2360,11090 -1840,11230,2200,11130 \ No newline at end of file diff --git a/samples/99_genre_roguelike/roguelike_line_of_sight/app/constants.rb b/samples/99_genre_roguelike/roguelike_line_of_sight/app/constants.rb deleted file mode 100644 index 37dd493..0000000 --- a/samples/99_genre_roguelike/roguelike_line_of_sight/app/constants.rb +++ /dev/null @@ -1,8 +0,0 @@ -SHOW_LEGEND = true -SOURCE_TILE_SIZE = 16 -DESTINATION_TILE_SIZE = 16 -TILE_SHEET_SIZE = 256 -TILE_R = 0 -TILE_G = 0 -TILE_B = 0 -TILE_A = 255 diff --git a/samples/99_genre_roguelike/roguelike_line_of_sight/app/legend.rb b/samples/99_genre_roguelike/roguelike_line_of_sight/app/legend.rb deleted file mode 100644 index 4d07b79..0000000 --- a/samples/99_genre_roguelike/roguelike_line_of_sight/app/legend.rb +++ /dev/null @@ -1,65 +0,0 @@ -def tick_legend args - return unless SHOW_LEGEND - - legend_padding = 16 - legend_x = 1280 - TILE_SHEET_SIZE - legend_padding - legend_y = 720 - TILE_SHEET_SIZE - legend_padding - tile_sheet_sprite = [legend_x, - legend_y, - TILE_SHEET_SIZE, - TILE_SHEET_SIZE, - 'sprites/simple-mood-16x16.png', 0, - TILE_A, - TILE_R, - TILE_G, - TILE_B] - - if args.inputs.mouse.point.inside_rect? tile_sheet_sprite - mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE) - tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE)) - - mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE) - tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE)) - - args.outputs.primitives << [legend_x - legend_padding * 2, - mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid - - args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE, - legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid - - sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] } - if sprite_key - member_name, _ = sprite_key - member_name = member_name_as_code member_name - args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0] - args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0] - args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0] - else - args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0] - args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0] - end - - end - - # render the sprite in the top right with a padding to the top and right so it's - # not flush against the edge - args.outputs.sprites << tile_sheet_sprite - - # carefully place some ascii arrows to show the legend labels - args.outputs.labels << [895, 707, "ROW --->"] - args.outputs.labels << [943, 412, " ^"] - args.outputs.labels << [943, 412, " |"] - args.outputs.labels << [943, 394, "COL ---+"] - - # use the tile sheet to print out row and column numbers - args.outputs.sprites << 16.map_with_index do |i| - sprite_key = i % 10 - [ - tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE, - 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i), - sprite(sprite_key)), - tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i), - 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key)) - ] - end -end diff --git a/samples/99_genre_roguelike/roguelike_line_of_sight/app/main.rb b/samples/99_genre_roguelike/roguelike_line_of_sight/app/main.rb deleted file mode 100644 index bd5f521..0000000 --- a/samples/99_genre_roguelike/roguelike_line_of_sight/app/main.rb +++ /dev/null @@ -1,97 +0,0 @@ -require 'app/constants.rb' -require 'app/sprite_lookup.rb' -require 'app/legend.rb' - -def tick args - tick_game args - tick_legend args -end - -def tick_game args - # setup the grid - args.state.grid.padding = 104 - args.state.grid.size = 512 - - # set up your game - # initialize the game/game defaults. ||= means that you only initialize it if - # the value isn't alread initialized - args.state.player.x ||= 0 - args.state.player.y ||= 0 - - args.state.enemies ||= [ - { x: 10, y: 10, type: :goblin, tile_key: :G }, - { x: 15, y: 30, type: :rat, tile_key: :R } - ] - - args.state.info_message ||= "Use arrow keys to move around." - - # handle keyboard input - # keyboard input (arrow keys to move player) - new_player_x = args.state.player.x - new_player_y = args.state.player.y - player_direction = "" - player_moved = false - if args.inputs.keyboard.key_down.up - new_player_y += 1 - player_direction = "north" - player_moved = true - elsif args.inputs.keyboard.key_down.down - new_player_y -= 1 - player_direction = "south" - player_moved = true - elsif args.inputs.keyboard.key_down.right - new_player_x += 1 - player_direction = "east" - player_moved = true - elsif args.inputs.keyboard.key_down.left - new_player_x -= 1 - player_direction = "west" - player_moved = true - end - - #handle game logic - # determine if there is an enemy on that square, - # if so, don't let the player move there - if player_moved - found_enemy = args.state.enemies.find do |e| - e[:x] == new_player_x && e[:y] == new_player_y - end - - if !found_enemy - args.state.player.x = new_player_x - args.state.player.y = new_player_y - args.state.info_message = "You moved #{player_direction}." - else - args.state.info_message = "You cannot move into a square an enemy occupies." - end - end - - args.outputs.sprites << tile_in_game(args.state.player.x, - args.state.player.y, '@') - - # render game - # render enemies at locations - args.outputs.sprites << args.state.enemies.map do |e| - tile_in_game(e[:x], e[:y], e[:tile_key]) - end - - # render the border - border_x = args.state.grid.padding - DESTINATION_TILE_SIZE - border_y = args.state.grid.padding - DESTINATION_TILE_SIZE - border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2 - - args.outputs.borders << [border_x, - border_y, - border_size, - border_size] - - # render label stuff - args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"] - args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message] -end - -def tile_in_game x, y, tile_key - tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE, - $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE, - tile_key) -end diff --git a/samples/99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb b/samples/99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb deleted file mode 100644 index f129e25..0000000 --- a/samples/99_genre_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb +++ /dev/null @@ -1,124 +0,0 @@ -def sprite_lookup - { - 0 => [3, 0], - 1 => [3, 1], - 2 => [3, 2], - 3 => [3, 3], - 4 => [3, 4], - 5 => [3, 5], - 6 => [3, 6], - 7 => [3, 7], - 8 => [3, 8], - 9 => [3, 9], - '@' => [4, 0], - A: [ 4, 1], - B: [ 4, 2], - C: [ 4, 3], - D: [ 4, 4], - E: [ 4, 5], - F: [ 4, 6], - G: [ 4, 7], - H: [ 4, 8], - I: [ 4, 9], - J: [ 4, 10], - K: [ 4, 11], - L: [ 4, 12], - M: [ 4, 13], - N: [ 4, 14], - O: [ 4, 15], - P: [ 5, 0], - Q: [ 5, 1], - R: [ 5, 2], - S: [ 5, 3], - T: [ 5, 4], - U: [ 5, 5], - V: [ 5, 6], - W: [ 5, 7], - X: [ 5, 8], - Y: [ 5, 9], - Z: [ 5, 10], - a: [ 6, 1], - b: [ 6, 2], - c: [ 6, 3], - d: [ 6, 4], - e: [ 6, 5], - f: [ 6, 6], - g: [ 6, 7], - h: [ 6, 8], - i: [ 6, 9], - j: [ 6, 10], - k: [ 6, 11], - l: [ 6, 12], - m: [ 6, 13], - n: [ 6, 14], - o: [ 6, 15], - p: [ 7, 0], - q: [ 7, 1], - r: [ 7, 2], - s: [ 7, 3], - t: [ 7, 4], - u: [ 7, 5], - v: [ 7, 6], - w: [ 7, 7], - x: [ 7, 8], - y: [ 7, 9], - z: [ 7, 10], - '|' => [ 7, 12] - } -end - -def sprite key - $gtk.args.state.reserved.sprite_lookup[key] -end - -def member_name_as_code raw_member_name - if raw_member_name.is_a? Symbol - ":#{raw_member_name}" - elsif raw_member_name.is_a? String - "'#{raw_member_name}'" - elsif raw_member_name.is_a? Fixnum - "#{raw_member_name}" - else - "UNKNOWN: #{raw_member_name}" - end -end - -def tile x, y, tile_row_column_or_key - tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key -end - -def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key - row_or_key, column = tile_row_column_or_key - if !column - row, column = sprite row_or_key - else - row, column = row_or_key, column - end - - if !row - member_name = member_name_as_code tile_row_column_or_key - raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb." - end - - # Sprite provided by Rogue Yun - # http://www.bay12forums.com/smf/index.php?topic=144897.0 - # License: Public Domain - - { - x: x, - y: y, - w: w, - h: h, - tile_x: column * 16, - tile_y: (row * 16), - tile_w: 16, - tile_h: 16, - r: r, - g: g, - b: b, - a: a, - path: 'sprites/simple-mood-16x16.png' - } -end - -$gtk.args.state.reserved.sprite_lookup = sprite_lookup diff --git a/samples/99_genre_roguelike/roguelike_line_of_sight/license-for-sample.txt b/samples/99_genre_roguelike/roguelike_line_of_sight/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_roguelike/roguelike_line_of_sight/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/99_genre_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png b/samples/99_genre_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png deleted file mode 100644 index 0eca11e..0000000 Binary files a/samples/99_genre_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png and /dev/null differ diff --git a/samples/99_genre_roguelike/roguelike_starting_point/app/main.rb b/samples/99_genre_roguelike/roguelike_starting_point/app/main.rb deleted file mode 100644 index 66ff027..0000000 --- a/samples/99_genre_roguelike/roguelike_starting_point/app/main.rb +++ /dev/null @@ -1,439 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - lambda: A way to define a block and its parameters with special syntax. - For example, the syntax of lambda looks like this: - my_lambda = -> { puts "This is my lambda" } - - Reminders: - - 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. - - - ARRAY#inside_rect?: Returns whether or not the point is inside a rect. - - - product: Returns an array of all combinations of elements from all arrays. - - - find: Finds all elements of a collection that meet requirements. - - - abs: Returns the absolute value. - -=end - -# This sample app allows the player to move around in the dungeon, which becomes more or less visible -# depending on the player's location, and also has enemies. - -class Game - attr_accessor :args, :state, :inputs, :outputs, :grid - - # Calls all the methods needed for the game to run properly. - def tick - defaults - render_canvas - render_dungeon - render_player - render_enemies - print_cell_coordinates - calc_canvas - input_move - input_click_map - end - - # Sets default values and initializes variables - def defaults - outputs.background_color = [0, 0, 0] # black background - - # Initializes empty canvas, dungeon, and enemies collections. - state.canvas ||= [] - state.dungeon ||= [] - state.enemies ||= [] - - # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called - if !state.area - load_area_one - derive_dungeon_from_area - - # Changing these values will change the position of player - state.x = 7 - state.y = 5 - - # Creates new enemies, sets their values, and adds them to the enemies collection. - state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity - e.x = 13 # position - e.y = 5 - e.previous_hp = 3 - e.hp = 3 - e.max_hp = 3 - e.is_dead = false # the enemy is alive - end - - update_line_of_sight # updates line of sight by adding newly visible cells - end - end - - # Adds elements into the state.area collection - # The dungeon is derived using the coordinates of this collection - def load_area_one - state.area ||= [] - state.area << [8, 6] - state.area << [7, 6] - state.area << [7, 7] - state.area << [8, 9] - state.area << [7, 8] - state.area << [7, 9] - state.area << [6, 4] - state.area << [7, 3] - state.area << [7, 4] - state.area << [6, 5] - state.area << [7, 5] - state.area << [8, 5] - state.area << [8, 4] - state.area << [1, 1] - state.area << [0, 1] - state.area << [0, 2] - state.area << [1, 2] - state.area << [2, 2] - state.area << [2, 1] - state.area << [2, 3] - state.area << [1, 3] - state.area << [1, 4] - state.area << [2, 4] - state.area << [2, 5] - state.area << [1, 5] - state.area << [2, 6] - state.area << [3, 6] - state.area << [4, 6] - state.area << [4, 7] - state.area << [4, 8] - state.area << [5, 8] - state.area << [5, 9] - state.area << [6, 9] - state.area << [7, 10] - state.area << [7, 11] - state.area << [7, 12] - state.area << [7, 12] - state.area << [7, 13] - state.area << [8, 13] - state.area << [9, 13] - state.area << [10, 13] - state.area << [11, 13] - state.area << [12, 13] - state.area << [12, 12] - state.area << [8, 12] - state.area << [9, 12] - state.area << [10, 12] - state.area << [11, 12] - state.area << [12, 11] - state.area << [13, 11] - state.area << [13, 10] - state.area << [13, 9] - state.area << [13, 8] - state.area << [13, 7] - state.area << [13, 6] - state.area << [12, 6] - state.area << [14, 6] - state.area << [14, 5] - state.area << [13, 5] - state.area << [12, 5] - state.area << [12, 4] - state.area << [13, 4] - state.area << [14, 4] - state.area << [1, 6] - state.area << [6, 6] - end - - # Starts with an empty dungeon collection, and adds dungeon cells into it. - def derive_dungeon_from_area - state.dungeon = [] # starts as empty collection - - state.area.each do |a| # for each element of the area collection - state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity - d.x = a.x # dungeon cell position using coordinates from area - d.y = a.y - d.is_visible = false # cell is not visible - d.alpha = 0 # not transparent at all - d.border = [left_margin + a.x * grid_size, - bottom_margin + a.y * grid_size, - grid_size, - grid_size, - *blue, - 255] # sets border definition for dungeon cell - d # returns dungeon cell - end - end - end - - def left_margin - 40 # sets left margin - end - - def bottom_margin - 60 # sets bottom margin - end - - def grid_size - 40 # sets size of grid square - end - - # Updates the line of sight by calling the thick_line_of_sight method and - # adding dungeon cells to the newly_visible collection - def update_line_of_sight - variations = [-1, 0, 1] - # creates collection of newly visible dungeon cells - newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements - thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method - lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists - end.uniq# removes duplicates - - state.dungeon.each do |d| # perform action on each element of dungeons collection - d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection - end - end - - #Returns a boolean value - def dungeon_cell_exists? x, y - # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists - state.dungeon.find { |d| d.x == x && d.y == y } - end - - # Calls line_of_sight method to add elements to result collection - def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda - result = [] - result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda - result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left - result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right - result - end - - # Adds points to the result collection to create the player's line of sight - def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda - result = [] # starts as empty collection - points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method - points.each do |p| # for each point in collection - if cell_exists_lambda.call(p.x, p.y) # if the cell exists - result << p # add it to result collection - else # if cell does not exist - return result # return result collection as it is - end - end - - result # return result collection - end - - # Finds the coordinates of the points on the line by performing calculations - def points_on_line start_x, start_y, rise, run, distance - distance.times.map do |i| # perform an action - [start_x + run * i, start_y + rise * i] # definition of point - end - end - - def render_canvas - return - outputs.borders << state.canvas.map do |c| # on each element of canvas collection - c.border # outputs border - end - end - - # Outputs the dungeon cells. - def render_dungeon - outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid - - # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method. - outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection - d.alpha += if d.is_visible # if cell is visible - 255.fdiv(30) # increment opacity (transparency) - else # if cell is not visible - 255.fdiv(600) * -1 # decrease opacity - end - d.alpha = d.alpha.cap_min_max(0, 255) - cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value - end.reject_nil - end - - # Sets definition of a cell border using the parameters - def cell_border x, y, color = nil - [left_margin + x * grid_size, - bottom_margin + y * grid_size, - grid_size, - grid_size, - *color] - end - - # Sets the values for the player and outputs it as a label - def render_player - outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square - grid_y(state.y) + 35, - "@", # player is represented by a white "@" character - 1, 1, *white] - end - - def grid_x x - left_margin + x * grid_size # positions horizontally on grid - end - - def grid_y y - bottom_margin + y * grid_size # positions vertically on grid - end - - # Outputs enemies onto the screen. - def render_enemies - state.enemies.map do |e| # for each enemy in the collection - alpha = 255 # set opacity (full transparency) - - # Outputs an enemy using a label. - outputs.labels << [ - left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square - bottom_margin + 35 + e.y * grid_size, - "r", # enemy's text - 1, 1, *white, alpha] - - # Creates a red border around an enemy. - outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red] - end - end - - #White labels are output for the cell coordinates of each element in the dungeon collection. - def print_cell_coordinates - return unless state.debug - state.dungeon.each do |d| - outputs.labels << [grid_x(d.x) + 2, - grid_y(d.y) - 2, - "#{d.x},#{d.y}", - -2, 0, *white] - end - end - - # Adds new elements into the canvas collection and sets their values. - def calc_canvas - return if state.canvas.length > 0 # return if canvas collection has at least one element - 15.times do |x| # 15 times perform an action - 15.times do |y| - state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity - c.x = x # set position - c.y = y - c.border = [left_margin + x * grid_size, - bottom_margin + y * grid_size, - grid_size, - grid_size, - *white, 30] # sets border definition - end - end - end - end - - # Updates x and y values of the player, and updates player's line of sight - def input_move - x, y, x_diff, y_diff = input_target_cell - - return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location - return if enemy_at x, y # player can't move there if there is an enemy in that location - - state.x += x_diff # increments x by x_diff (so player moves left or right) - state.y += y_diff # same with y and y_diff ( so player moves up or down) - update_line_of_sight # updates visible cells - end - - def enemy_at x, y - # Finds if coordinates exist in enemies collection and enemy is not dead - state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead } - end - - #M oves the user based on their keyboard input and sets values for target cell - def input_target_cell - if inputs.keyboard.key_down.up # if "up" key is in "down" state - [state.x, state.y + 1, 0, 1] # user moves up - elsif inputs.keyboard.key_down.down # if "down" key is pressed - [state.x, state.y - 1, 0, -1] # user moves down - elsif inputs.keyboard.key_down.left # if "left" key is pressed - [state.x - 1, state.y, -1, 0] # user moves left - elsif inputs.keyboard.key_down.right # if "right" key is pressed - [state.x + 1, state.y, 1, 0] # user moves right - else - nil # otherwise, empty - end - end - - # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element. - def input_click_map - return unless inputs.mouse.click # return unless the mouse is clicked - canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements - inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of - end - puts canvas_entry # prints canvas_entry value - end - - # Sets the definition of a label using the parameters. - def label text, x, y, color = nil - color ||= white # color is initialized to white - [x, y, text, 1, 1, *color] # sets label definition - end - - def green - [60, 200, 100] # sets color saturation to shade of green - end - - def blue - [50, 50, 210] # sets color saturation to shade of blue - end - - def white - [255, 255, 255] # sets color saturation to white - end - - def red - [230, 80, 80] # sets color saturation to shade of red - end - - def orange - [255, 80, 60] # sets color saturation to shade of orange - end - - def pink - [255, 0, 200] # sets color saturation to shade of pink - end - - def gray - [75, 75, 75] # sets color saturation to shade of gray - end - - # Recolors the border using the parameters. - def recolor_border border, r, g, b - border[4] = r - border[5] = g - border[6] = b - border - end - - # Returns a boolean value. - def visible? cell - # finds cell's coordinates inside visible_cells collections to determine if cell is visible - state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y} - end - - # Exports dungeon by printing dungeon cell coordinates - def export_dungeon - state.dungeon.each do |d| # on each element of dungeon collection - puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates - end - end - - def distance_to_cell cell - distance_to state.x, cell.x, state.y, cell.y # calls distance_to method - end - - def distance_to from_x, x, from_y, y - (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates - end -end - -$game = Game.new - -def tick args - $game.args = args - $game.state = args.state - $game.inputs = args.inputs - $game.outputs = args.outputs - $game.grid = args.grid - $game.tick -end diff --git a/samples/99_genre_roguelike/roguelike_starting_point/license-for-sample.txt b/samples/99_genre_roguelike/roguelike_starting_point/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_roguelike/roguelike_starting_point/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/99_genre_roguelike/roguelike_starting_point/replay.txt b/samples/99_genre_roguelike/roguelike_starting_point/replay.txt deleted file mode 100644 index a2b4c52..0000000 --- a/samples/99_genre_roguelike/roguelike_starting_point/replay.txt +++ /dev/null @@ -1,555 +0,0 @@ -replay_version 2.0 -stopped_at 1731 -seed 100 -recorded_at Sun Sep 29 22:38:52 2019 -[:mouse_move, 785, 468, 2, 1, 114] -[:mouse_move, 756, 468, 2, 2, 115] -[:mouse_move, 745, 468, 2, 3, 117] -[:mouse_move, 718, 470, 2, 4, 118] -[:mouse_move, 705, 472, 2, 5, 119] -[:mouse_move, 680, 476, 2, 6, 120] -[:mouse_move, 668, 478, 2, 7, 121] -[:mouse_move, 606, 492, 2, 8, 122] -[:mouse_move, 581, 499, 2, 9, 123] -[:mouse_move, 523, 511, 2, 10, 124] -[:mouse_move, 417, 527, 2, 11, 125] -[:mouse_move, 387, 528, 2, 12, 126] -[:mouse_move, 344, 528, 2, 13, 127] -[:mouse_move, 324, 526, 2, 14, 128] -[:mouse_move, 295, 520, 2, 15, 129] -[:mouse_move, 285, 518, 2, 16, 130] -[:mouse_move, 276, 515, 2, 17, 131] -[:mouse_move, 255, 512, 2, 18, 132] -[:mouse_move, 244, 511, 2, 19, 133] -[:mouse_move, 228, 511, 2, 20, 134] -[:mouse_move, 213, 513, 2, 21, 135] -[:mouse_move, 194, 523, 2, 22, 136] -[:mouse_move, 190, 526, 2, 23, 137] -[:mouse_move, 183, 532, 2, 24, 138] -[:mouse_move, 180, 533, 2, 25, 139] -[:mouse_move, 177, 536, 2, 26, 140] -[:mouse_move, 177, 537, 2, 27, 141] -[:mouse_move, 193, 537, 2, 28, 142] -[:mouse_move, 208, 536, 2, 29, 143] -[:mouse_move, 222, 536, 2, 30, 144] -[:mouse_move, 232, 535, 2, 31, 145] -[:mouse_move, 241, 535, 2, 32, 146] -[:mouse_move, 245, 535, 2, 33, 147] -[:mouse_move, 249, 535, 2, 34, 148] -[:mouse_move, 250, 535, 2, 35, 149] -[:mouse_move, 251, 535, 2, 36, 150] -[:mouse_move, 252, 534, 2, 37, 151] -[:mouse_move, 256, 531, 2, 38, 152] -[:mouse_move, 259, 527, 2, 39, 153] -[:mouse_move, 265, 520, 2, 40, 154] -[:mouse_move, 270, 515, 2, 41, 155] -[:mouse_move, 274, 511, 2, 42, 156] -[:mouse_move, 282, 501, 2, 43, 157] -[:mouse_move, 293, 490, 2, 44, 159] -[:mouse_move, 295, 489, 2, 45, 160] -[:mouse_move, 299, 487, 2, 46, 161] -[:mouse_move, 301, 485, 2, 47, 162] -[:mouse_move, 303, 484, 2, 48, 163] -[:mouse_move, 304, 484, 2, 49, 164] -[:mouse_move, 306, 484, 2, 50, 165] -[:mouse_move, 307, 484, 2, 51, 166] -[:mouse_move, 308, 484, 2, 52, 167] -[:mouse_move, 310, 484, 2, 53, 168] -[:mouse_move, 314, 484, 2, 54, 169] -[:mouse_move, 316, 484, 2, 55, 170] -[:mouse_move, 317, 484, 2, 56, 171] -[:mouse_move, 318, 484, 2, 57, 172] -[:mouse_move, 319, 484, 2, 58, 173] -[:key_down_raw, 1073741906, 0, 2, 59, 232] -[:key_up_raw, 1073741906, 0, 2, 60, 237] -[:key_down_raw, 1073741906, 0, 2, 61, 243] -[:key_up_raw, 1073741906, 0, 2, 62, 247] -[:key_down_raw, 1073741906, 0, 2, 63, 254] -[:key_up_raw, 1073741906, 0, 2, 64, 257] -[:key_down_raw, 1073741906, 0, 2, 65, 266] -[:key_up_raw, 1073741906, 0, 2, 66, 272] -[:key_down_raw, 1073741906, 0, 2, 67, 279] -[:key_up_raw, 1073741906, 0, 2, 68, 284] -[:key_down_raw, 1073741905, 0, 2, 69, 326] -[:key_up_raw, 1073741905, 0, 2, 70, 334] -[:key_down_raw, 1073741904, 0, 2, 71, 421] -[:key_up_raw, 1073741904, 0, 2, 72, 428] -[:key_down_raw, 1073741904, 0, 2, 73, 438] -[:key_up_raw, 1073741904, 0, 2, 74, 445] -[:key_down_raw, 1073741905, 0, 2, 75, 459] -[:key_up_raw, 1073741905, 0, 2, 76, 466] -[:key_down_raw, 1073741904, 0, 2, 77, 480] -[:key_up_raw, 1073741904, 0, 2, 78, 488] -[:key_down_raw, 1073741905, 0, 2, 79, 499] -[:key_up_raw, 1073741905, 0, 2, 80, 507] -[:mouse_move, 289, 484, 2, 81, 545] -[:mouse_move, 274, 484, 2, 82, 546] -[:mouse_move, 244, 484, 2, 83, 547] -[:mouse_move, 231, 485, 2, 84, 548] -[:mouse_move, 208, 485, 2, 85, 549] -[:mouse_move, 199, 485, 2, 86, 550] -[:mouse_move, 178, 485, 2, 87, 551] -[:mouse_move, 174, 485, 2, 88, 552] -[:mouse_move, 162, 483, 2, 89, 553] -[:mouse_move, 159, 482, 2, 90, 554] -[:mouse_move, 157, 477, 2, 91, 555] -[:mouse_move, 157, 473, 2, 92, 556] -[:mouse_move, 161, 465, 2, 93, 557] -[:mouse_move, 165, 459, 2, 94, 558] -[:mouse_move, 174, 449, 2, 95, 559] -[:mouse_move, 179, 443, 2, 96, 560] -[:mouse_move, 191, 431, 2, 97, 561] -[:mouse_move, 196, 425, 2, 98, 562] -[:mouse_move, 205, 413, 2, 99, 563] -[:mouse_move, 210, 408, 2, 100, 564] -[:mouse_move, 212, 406, 2, 101, 565] -[:mouse_move, 219, 397, 2, 102, 566] -[:mouse_move, 223, 395, 2, 103, 567] -[:mouse_move, 228, 390, 2, 104, 568] -[:mouse_move, 230, 388, 2, 105, 569] -[:mouse_move, 233, 386, 2, 106, 570] -[:mouse_move, 234, 385, 2, 107, 571] -[:mouse_move, 235, 384, 2, 108, 573] -[:mouse_move, 234, 384, 2, 109, 580] -[:mouse_move, 234, 382, 2, 110, 622] -[:mouse_move, 234, 379, 2, 111, 623] -[:mouse_move, 236, 374, 2, 112, 624] -[:mouse_move, 237, 371, 2, 113, 625] -[:mouse_move, 240, 366, 2, 114, 626] -[:mouse_move, 241, 364, 2, 115, 627] -[:mouse_move, 243, 362, 2, 116, 628] -[:mouse_move, 243, 361, 2, 117, 629] -[:mouse_move, 242, 361, 2, 118, 632] -[:mouse_move, 239, 361, 2, 119, 633] -[:mouse_move, 229, 367, 2, 120, 634] -[:mouse_move, 223, 372, 2, 121, 635] -[:mouse_move, 208, 385, 2, 122, 636] -[:mouse_move, 198, 393, 2, 123, 637] -[:mouse_move, 179, 410, 2, 124, 638] -[:mouse_move, 169, 421, 2, 125, 639] -[:mouse_move, 149, 440, 2, 126, 640] -[:mouse_move, 139, 451, 2, 127, 641] -[:mouse_move, 127, 465, 2, 128, 642] -[:mouse_move, 119, 473, 2, 129, 643] -[:mouse_move, 108, 486, 2, 130, 644] -[:mouse_move, 103, 491, 2, 131, 645] -[:mouse_move, 98, 496, 2, 132, 646] -[:mouse_move, 96, 498, 2, 133, 647] -[:mouse_move, 94, 500, 2, 134, 648] -[:mouse_move, 92, 501, 2, 135, 649] -[:mouse_move, 91, 502, 2, 136, 650] -[:mouse_move, 92, 500, 2, 137, 653] -[:mouse_move, 95, 498, 2, 138, 654] -[:mouse_move, 105, 488, 2, 139, 655] -[:mouse_move, 112, 482, 2, 140, 656] -[:mouse_move, 128, 463, 2, 141, 657] -[:mouse_move, 138, 450, 2, 142, 658] -[:mouse_move, 159, 419, 2, 143, 659] -[:mouse_move, 168, 403, 2, 144, 660] -[:mouse_move, 182, 382, 2, 145, 661] -[:mouse_move, 188, 370, 2, 146, 662] -[:mouse_move, 200, 354, 2, 147, 663] -[:mouse_move, 205, 348, 2, 148, 664] -[:mouse_move, 214, 338, 2, 149, 665] -[:mouse_move, 218, 335, 2, 150, 666] -[:mouse_move, 222, 331, 2, 151, 667] -[:mouse_move, 224, 330, 2, 152, 668] -[:mouse_move, 226, 328, 2, 153, 669] -[:mouse_move, 227, 328, 2, 154, 670] -[:mouse_move, 222, 329, 2, 155, 674] -[:mouse_move, 219, 332, 2, 156, 675] -[:mouse_move, 207, 342, 2, 157, 676] -[:mouse_move, 201, 350, 2, 158, 677] -[:mouse_move, 184, 370, 2, 159, 678] -[:mouse_move, 173, 384, 2, 160, 679] -[:mouse_move, 151, 415, 2, 161, 680] -[:mouse_move, 140, 431, 2, 162, 681] -[:mouse_move, 119, 458, 2, 163, 682] -[:mouse_move, 114, 463, 2, 164, 683] -[:mouse_move, 99, 478, 2, 165, 684] -[:mouse_move, 97, 480, 2, 166, 685] -[:mouse_move, 88, 490, 2, 167, 686] -[:mouse_move, 85, 493, 2, 168, 687] -[:mouse_move, 82, 496, 2, 169, 688] -[:mouse_move, 81, 497, 2, 170, 689] -[:mouse_move, 82, 497, 2, 171, 692] -[:mouse_move, 84, 496, 2, 172, 693] -[:mouse_move, 94, 489, 2, 173, 694] -[:mouse_move, 101, 482, 2, 174, 695] -[:mouse_move, 119, 463, 2, 175, 696] -[:mouse_move, 129, 451, 2, 176, 697] -[:mouse_move, 151, 426, 2, 177, 698] -[:mouse_move, 155, 420, 2, 178, 699] -[:mouse_move, 172, 401, 2, 179, 700] -[:mouse_move, 178, 393, 2, 180, 701] -[:mouse_move, 185, 387, 2, 181, 702] -[:mouse_move, 197, 376, 2, 182, 703] -[:mouse_move, 202, 371, 2, 183, 704] -[:mouse_move, 209, 365, 2, 184, 705] -[:mouse_move, 215, 360, 2, 185, 706] -[:mouse_move, 218, 357, 2, 186, 707] -[:mouse_move, 222, 353, 2, 187, 708] -[:mouse_move, 225, 351, 2, 188, 709] -[:mouse_move, 226, 350, 2, 189, 710] -[:mouse_move, 227, 348, 2, 190, 711] -[:mouse_move, 228, 348, 2, 191, 712] -[:mouse_move, 229, 347, 2, 192, 713] -[:mouse_move, 229, 346, 2, 193, 715] -[:mouse_move, 225, 352, 2, 194, 721] -[:mouse_move, 219, 361, 2, 195, 722] -[:mouse_move, 201, 385, 2, 196, 723] -[:mouse_move, 193, 393, 2, 197, 724] -[:mouse_move, 165, 424, 2, 198, 725] -[:mouse_move, 151, 439, 2, 199, 726] -[:mouse_move, 127, 468, 2, 200, 727] -[:mouse_move, 116, 480, 2, 201, 728] -[:mouse_move, 106, 490, 2, 202, 729] -[:mouse_move, 92, 504, 2, 203, 730] -[:mouse_move, 84, 512, 2, 204, 731] -[:mouse_move, 77, 519, 2, 205, 732] -[:mouse_move, 73, 523, 2, 206, 733] -[:mouse_move, 69, 527, 2, 207, 734] -[:mouse_move, 68, 527, 2, 208, 735] -[:mouse_move, 68, 528, 2, 209, 736] -[:mouse_move, 70, 525, 2, 210, 738] -[:mouse_move, 73, 522, 2, 211, 739] -[:mouse_move, 86, 511, 2, 212, 740] -[:mouse_move, 93, 503, 2, 213, 741] -[:mouse_move, 117, 477, 2, 214, 742] -[:mouse_move, 123, 469, 2, 215, 743] -[:mouse_move, 156, 427, 2, 216, 744] -[:mouse_move, 169, 407, 2, 217, 745] -[:mouse_move, 187, 376, 2, 218, 746] -[:mouse_move, 199, 356, 2, 219, 747] -[:mouse_move, 221, 318, 2, 220, 748] -[:mouse_move, 231, 302, 2, 221, 749] -[:mouse_move, 250, 276, 2, 222, 750] -[:mouse_move, 260, 266, 2, 223, 751] -[:mouse_move, 267, 259, 2, 224, 752] -[:mouse_move, 272, 254, 2, 225, 753] -[:mouse_move, 279, 247, 2, 226, 754] -[:mouse_move, 281, 245, 2, 227, 755] -[:mouse_move, 282, 245, 2, 228, 756] -[:mouse_move, 283, 244, 2, 229, 757] -[:key_down_raw, 1073741906, 0, 2, 230, 813] -[:key_up_raw, 1073741906, 0, 2, 231, 820] -[:key_down_raw, 1073741903, 0, 2, 232, 833] -[:key_up_raw, 1073741903, 0, 2, 233, 840] -[:key_down_raw, 1073741903, 0, 2, 234, 848] -[:key_up_raw, 1073741903, 0, 2, 235, 855] -[:key_down_raw, 1073741906, 0, 2, 236, 862] -[:key_up_raw, 1073741906, 0, 2, 237, 870] -[:key_down_raw, 1073741903, 0, 2, 238, 880] -[:key_up_raw, 1073741903, 0, 2, 239, 901] -[:key_down_raw, 1073741903, 0, 2, 240, 917] -[:key_up_raw, 1073741903, 0, 2, 241, 924] -[:key_down_raw, 1073741905, 0, 2, 242, 943] -[:key_up_raw, 1073741905, 0, 2, 243, 948] -[:key_down_raw, 1073741905, 0, 2, 244, 952] -[:key_up_raw, 1073741905, 0, 2, 245, 956] -[:key_down_raw, 1073741905, 0, 2, 246, 960] -[:key_up_raw, 1073741905, 0, 2, 247, 963] -[:key_down_raw, 1073741905, 0, 2, 248, 967] -[:key_up_raw, 1073741905, 0, 2, 249, 972] -[:mouse_move, 244, 247, 2, 250, 997] -[:mouse_move, 229, 253, 2, 251, 998] -[:mouse_move, 174, 283, 2, 252, 999] -[:mouse_move, 152, 299, 2, 253, 1000] -[:mouse_move, 133, 313, 2, 254, 1001] -[:mouse_move, 63, 372, 2, 255, 1002] -[:mouse_move, 53, 384, 2, 256, 1003] -[:mouse_move, 40, 399, 2, 257, 1004] -[:mouse_move, 20, 424, 2, 258, 1005] -[:mouse_move, 13, 440, 2, 259, 1006] -[:mouse_move, 12, 445, 2, 260, 1007] -[:mouse_move, 12, 450, 2, 261, 1008] -[:mouse_move, 12, 451, 2, 262, 1009] -[:mouse_move, 13, 454, 2, 263, 1010] -[:mouse_move, 14, 454, 2, 264, 1011] -[:mouse_move, 15, 455, 2, 265, 1012] -[:mouse_move, 15, 454, 2, 266, 1014] -[:mouse_move, 15, 452, 2, 267, 1015] -[:mouse_move, 15, 447, 2, 268, 1016] -[:mouse_move, 15, 443, 2, 269, 1017] -[:mouse_move, 16, 438, 2, 270, 1018] -[:mouse_move, 17, 435, 2, 271, 1019] -[:mouse_move, 19, 431, 2, 272, 1020] -[:mouse_move, 20, 430, 2, 273, 1021] -[:mouse_move, 22, 428, 2, 274, 1022] -[:mouse_move, 23, 427, 2, 275, 1023] -[:mouse_move, 25, 426, 2, 276, 1024] -[:mouse_move, 26, 426, 2, 277, 1025] -[:mouse_move, 29, 426, 2, 278, 1026] -[:mouse_move, 30, 426, 2, 279, 1028] -[:mouse_move, 31, 427, 2, 280, 1029] -[:mouse_move, 32, 428, 2, 281, 1030] -[:mouse_move, 33, 431, 2, 282, 1031] -[:mouse_move, 34, 432, 2, 283, 1032] -[:mouse_move, 35, 437, 2, 284, 1033] -[:mouse_move, 36, 439, 2, 285, 1034] -[:mouse_move, 37, 444, 2, 286, 1035] -[:mouse_move, 39, 449, 2, 287, 1036] -[:mouse_move, 44, 460, 2, 288, 1037] -[:mouse_move, 45, 464, 2, 289, 1038] -[:mouse_move, 52, 475, 2, 290, 1039] -[:mouse_move, 55, 479, 2, 291, 1040] -[:mouse_move, 62, 485, 2, 292, 1041] -[:mouse_move, 66, 487, 2, 293, 1042] -[:mouse_move, 74, 488, 2, 294, 1043] -[:mouse_move, 79, 488, 2, 295, 1044] -[:mouse_move, 89, 484, 2, 296, 1045] -[:mouse_move, 95, 480, 2, 297, 1046] -[:mouse_move, 111, 468, 2, 298, 1047] -[:mouse_move, 115, 466, 2, 299, 1048] -[:mouse_move, 134, 453, 2, 300, 1049] -[:mouse_move, 142, 447, 2, 301, 1050] -[:mouse_move, 160, 437, 2, 302, 1051] -[:mouse_move, 170, 431, 2, 303, 1052] -[:mouse_move, 179, 425, 2, 304, 1053] -[:mouse_move, 192, 417, 2, 305, 1054] -[:mouse_move, 200, 411, 2, 306, 1055] -[:mouse_move, 213, 401, 2, 307, 1056] -[:mouse_move, 219, 396, 2, 308, 1057] -[:mouse_move, 230, 386, 2, 309, 1058] -[:mouse_move, 238, 375, 2, 310, 1059] -[:mouse_move, 244, 363, 2, 311, 1060] -[:mouse_move, 247, 355, 2, 312, 1061] -[:mouse_move, 253, 341, 2, 313, 1062] -[:mouse_move, 255, 335, 2, 314, 1063] -[:mouse_move, 257, 321, 2, 315, 1064] -[:mouse_move, 258, 309, 2, 316, 1065] -[:mouse_move, 257, 298, 2, 317, 1066] -[:mouse_move, 255, 291, 2, 318, 1067] -[:mouse_move, 249, 281, 2, 319, 1068] -[:mouse_move, 242, 271, 2, 320, 1069] -[:mouse_move, 233, 264, 2, 321, 1070] -[:mouse_move, 226, 260, 2, 322, 1071] -[:mouse_move, 207, 252, 2, 323, 1072] -[:mouse_move, 203, 251, 2, 324, 1073] -[:mouse_move, 185, 249, 2, 325, 1074] -[:mouse_move, 178, 249, 2, 326, 1075] -[:mouse_move, 161, 249, 2, 327, 1076] -[:mouse_move, 153, 250, 2, 328, 1077] -[:mouse_move, 139, 256, 2, 329, 1078] -[:mouse_move, 132, 259, 2, 330, 1079] -[:mouse_move, 120, 269, 2, 331, 1080] -[:mouse_move, 110, 279, 2, 332, 1081] -[:mouse_move, 104, 287, 2, 333, 1082] -[:mouse_move, 93, 304, 2, 334, 1083] -[:mouse_move, 87, 313, 2, 335, 1084] -[:mouse_move, 80, 326, 2, 336, 1085] -[:mouse_move, 75, 335, 2, 337, 1086] -[:mouse_move, 69, 351, 2, 338, 1087] -[:mouse_move, 67, 359, 2, 339, 1088] -[:mouse_move, 64, 376, 2, 340, 1089] -[:mouse_move, 64, 383, 2, 341, 1090] -[:mouse_move, 62, 399, 2, 342, 1091] -[:mouse_move, 62, 406, 2, 343, 1092] -[:mouse_move, 62, 418, 2, 344, 1093] -[:mouse_move, 62, 423, 2, 345, 1094] -[:mouse_move, 66, 433, 2, 346, 1095] -[:mouse_move, 69, 437, 2, 347, 1096] -[:mouse_move, 78, 444, 2, 348, 1097] -[:mouse_move, 86, 450, 2, 349, 1098] -[:mouse_move, 102, 457, 2, 350, 1099] -[:mouse_move, 112, 458, 2, 351, 1100] -[:mouse_move, 136, 461, 2, 352, 1101] -[:mouse_move, 142, 461, 2, 353, 1102] -[:mouse_move, 162, 460, 2, 354, 1103] -[:mouse_move, 172, 459, 2, 355, 1104] -[:mouse_move, 188, 454, 2, 356, 1105] -[:mouse_move, 195, 451, 2, 357, 1106] -[:mouse_move, 211, 443, 2, 358, 1107] -[:mouse_move, 214, 440, 2, 359, 1108] -[:mouse_move, 222, 432, 2, 360, 1109] -[:mouse_move, 233, 412, 2, 361, 1110] -[:mouse_move, 238, 400, 2, 362, 1111] -[:mouse_move, 248, 375, 2, 363, 1112] -[:mouse_move, 250, 370, 2, 364, 1113] -[:mouse_move, 258, 351, 2, 365, 1114] -[:mouse_move, 261, 343, 2, 366, 1115] -[:mouse_move, 264, 328, 2, 367, 1116] -[:mouse_move, 264, 321, 2, 368, 1117] -[:mouse_move, 265, 307, 2, 369, 1118] -[:mouse_move, 265, 305, 2, 370, 1119] -[:mouse_move, 264, 296, 2, 371, 1120] -[:mouse_move, 262, 289, 2, 372, 1121] -[:mouse_move, 257, 282, 2, 373, 1122] -[:mouse_move, 252, 277, 2, 374, 1123] -[:mouse_move, 237, 271, 2, 375, 1124] -[:mouse_move, 227, 269, 2, 376, 1125] -[:mouse_move, 211, 268, 2, 377, 1126] -[:mouse_move, 201, 268, 2, 378, 1127] -[:mouse_move, 177, 268, 2, 379, 1128] -[:mouse_move, 168, 269, 2, 380, 1129] -[:mouse_move, 149, 274, 2, 381, 1130] -[:mouse_move, 137, 279, 2, 382, 1131] -[:mouse_move, 124, 288, 2, 383, 1132] -[:mouse_move, 116, 294, 2, 384, 1133] -[:mouse_move, 102, 307, 2, 385, 1134] -[:mouse_move, 91, 319, 2, 386, 1135] -[:mouse_move, 88, 323, 2, 387, 1136] -[:mouse_move, 73, 344, 2, 388, 1137] -[:mouse_move, 68, 353, 2, 389, 1138] -[:mouse_move, 57, 374, 2, 390, 1139] -[:mouse_move, 52, 386, 2, 391, 1140] -[:mouse_move, 44, 412, 2, 392, 1141] -[:mouse_move, 42, 418, 2, 393, 1142] -[:mouse_move, 36, 437, 2, 394, 1143] -[:mouse_move, 34, 445, 2, 395, 1144] -[:mouse_move, 33, 453, 2, 396, 1145] -[:mouse_move, 32, 457, 2, 397, 1146] -[:mouse_move, 32, 466, 2, 398, 1147] -[:mouse_move, 33, 468, 2, 399, 1148] -[:mouse_move, 38, 475, 2, 400, 1149] -[:mouse_move, 44, 482, 2, 401, 1150] -[:mouse_move, 56, 492, 2, 402, 1151] -[:mouse_move, 64, 496, 2, 403, 1152] -[:mouse_move, 81, 503, 2, 404, 1153] -[:mouse_move, 92, 503, 2, 405, 1154] -[:mouse_move, 106, 503, 2, 406, 1155] -[:mouse_move, 115, 501, 2, 407, 1156] -[:mouse_move, 134, 492, 2, 408, 1157] -[:mouse_move, 147, 485, 2, 409, 1158] -[:mouse_move, 163, 471, 2, 410, 1159] -[:mouse_move, 171, 463, 2, 411, 1160] -[:mouse_move, 183, 451, 2, 412, 1161] -[:mouse_move, 202, 425, 2, 413, 1163] -[:mouse_move, 215, 401, 2, 414, 1164] -[:mouse_move, 217, 395, 2, 415, 1165] -[:mouse_move, 226, 373, 2, 416, 1166] -[:mouse_move, 234, 357, 2, 417, 1167] -[:mouse_move, 238, 343, 2, 418, 1168] -[:mouse_move, 240, 334, 2, 419, 1169] -[:mouse_move, 247, 310, 2, 420, 1170] -[:mouse_move, 249, 299, 2, 421, 1171] -[:mouse_move, 250, 290, 2, 422, 1172] -[:mouse_move, 251, 283, 2, 423, 1173] -[:mouse_move, 251, 269, 2, 424, 1174] -[:mouse_move, 248, 263, 2, 425, 1175] -[:mouse_move, 237, 256, 2, 426, 1176] -[:mouse_move, 229, 254, 2, 427, 1177] -[:mouse_move, 210, 250, 2, 428, 1178] -[:mouse_move, 199, 249, 2, 429, 1179] -[:mouse_move, 184, 248, 2, 430, 1180] -[:mouse_move, 173, 248, 2, 431, 1181] -[:mouse_move, 153, 248, 2, 432, 1182] -[:mouse_move, 145, 249, 2, 433, 1183] -[:mouse_move, 138, 251, 2, 434, 1184] -[:mouse_move, 125, 257, 2, 435, 1185] -[:mouse_move, 121, 260, 2, 436, 1186] -[:mouse_move, 112, 267, 2, 437, 1187] -[:mouse_move, 101, 280, 2, 438, 1188] -[:mouse_move, 97, 287, 2, 439, 1189] -[:mouse_move, 86, 306, 2, 440, 1190] -[:mouse_move, 81, 316, 2, 441, 1191] -[:mouse_move, 79, 322, 2, 442, 1192] -[:mouse_move, 70, 345, 2, 443, 1193] -[:mouse_move, 63, 365, 2, 444, 1194] -[:mouse_move, 59, 389, 2, 445, 1195] -[:mouse_move, 59, 401, 2, 446, 1196] -[:mouse_move, 59, 416, 2, 447, 1197] -[:mouse_move, 59, 425, 2, 448, 1198] -[:mouse_move, 60, 439, 2, 449, 1199] -[:mouse_move, 60, 442, 2, 450, 1200] -[:mouse_move, 64, 454, 2, 451, 1201] -[:mouse_move, 66, 457, 2, 452, 1202] -[:mouse_move, 70, 462, 2, 453, 1203] -[:mouse_move, 74, 464, 2, 454, 1204] -[:mouse_move, 81, 467, 2, 455, 1205] -[:mouse_move, 85, 468, 2, 456, 1206] -[:mouse_move, 97, 469, 2, 457, 1207] -[:mouse_move, 107, 469, 2, 458, 1208] -[:mouse_move, 124, 471, 2, 459, 1209] -[:mouse_move, 134, 471, 2, 460, 1210] -[:mouse_move, 148, 471, 2, 461, 1211] -[:mouse_move, 161, 468, 2, 462, 1212] -[:mouse_move, 178, 457, 2, 463, 1213] -[:mouse_move, 186, 451, 2, 464, 1214] -[:mouse_move, 202, 434, 2, 465, 1215] -[:mouse_move, 210, 424, 2, 466, 1216] -[:mouse_move, 227, 400, 2, 467, 1217] -[:mouse_move, 234, 388, 2, 468, 1218] -[:mouse_move, 237, 383, 2, 469, 1219] -[:mouse_move, 250, 360, 2, 470, 1220] -[:mouse_move, 254, 351, 2, 471, 1221] -[:mouse_move, 261, 334, 2, 472, 1222] -[:mouse_move, 262, 326, 2, 473, 1223] -[:mouse_move, 264, 312, 2, 474, 1224] -[:mouse_move, 265, 305, 2, 475, 1225] -[:mouse_move, 265, 293, 2, 476, 1226] -[:mouse_move, 265, 287, 2, 477, 1227] -[:mouse_move, 259, 272, 2, 478, 1228] -[:mouse_move, 255, 267, 2, 479, 1229] -[:mouse_move, 246, 260, 2, 480, 1230] -[:mouse_move, 239, 257, 2, 481, 1231] -[:mouse_move, 226, 253, 2, 482, 1232] -[:mouse_move, 213, 251, 2, 483, 1233] -[:mouse_move, 194, 251, 2, 484, 1234] -[:mouse_move, 184, 252, 2, 485, 1235] -[:mouse_move, 163, 259, 2, 486, 1236] -[:mouse_move, 153, 263, 2, 487, 1237] -[:mouse_move, 133, 274, 2, 488, 1238] -[:mouse_move, 128, 278, 2, 489, 1239] -[:mouse_move, 107, 297, 2, 490, 1240] -[:mouse_move, 100, 305, 2, 491, 1241] -[:mouse_move, 86, 324, 2, 492, 1242] -[:mouse_move, 79, 335, 2, 493, 1243] -[:mouse_move, 74, 348, 2, 494, 1244] -[:mouse_move, 66, 388, 2, 495, 1245] -[:mouse_move, 66, 399, 2, 496, 1246] -[:mouse_move, 68, 429, 2, 497, 1247] -[:mouse_move, 73, 441, 2, 498, 1248] -[:mouse_move, 83, 452, 2, 499, 1249] -[:mouse_move, 89, 457, 2, 500, 1250] -[:mouse_move, 97, 462, 2, 501, 1251] -[:key_down_raw, 1073741906, 0, 2, 502, 1292] -[:key_up_raw, 1073741906, 0, 2, 503, 1296] -[:key_down_raw, 1073741906, 0, 2, 504, 1309] -[:key_up_raw, 1073741906, 0, 2, 505, 1314] -[:key_down_raw, 1073741906, 0, 2, 506, 1319] -[:key_up_raw, 1073741906, 0, 2, 507, 1322] -[:key_down_raw, 1073741906, 0, 2, 508, 1327] -[:key_up_raw, 1073741906, 0, 2, 509, 1331] -[:key_down_raw, 1073741906, 0, 2, 510, 1336] -[:key_up_raw, 1073741906, 0, 2, 511, 1339] -[:key_down_raw, 1073741906, 0, 2, 512, 1345] -[:key_up_raw, 1073741906, 0, 2, 513, 1348] -[:key_down_raw, 1073741906, 0, 2, 514, 1354] -[:key_up_raw, 1073741906, 0, 2, 515, 1358] -[:key_down_raw, 1073741906, 0, 2, 516, 1362] -[:key_up_raw, 1073741906, 0, 2, 517, 1370] -[:key_down_raw, 1073741903, 0, 2, 518, 1386] -[:key_up_raw, 1073741903, 0, 2, 519, 1392] -[:key_down_raw, 1073741903, 0, 2, 520, 1397] -[:key_up_raw, 1073741903, 0, 2, 521, 1401] -[:key_down_raw, 1073741903, 0, 2, 522, 1407] -[:key_up_raw, 1073741903, 0, 2, 523, 1412] -[:key_down_raw, 1073741903, 0, 2, 524, 1415] -[:key_up_raw, 1073741903, 0, 2, 525, 1421] -[:key_down_raw, 1073741903, 0, 2, 526, 1428] -[:key_up_raw, 1073741903, 0, 2, 527, 1436] -[:key_down_raw, 1073741905, 0, 2, 528, 1446] -[:key_up_raw, 1073741905, 0, 2, 529, 1458] -[:key_down_raw, 1073741905, 0, 2, 530, 1466] -[:key_up_raw, 1073741905, 0, 2, 531, 1472] -[:key_down_raw, 1073741903, 0, 2, 532, 1479] -[:key_up_raw, 1073741903, 0, 2, 533, 1489] -[:key_down_raw, 1073741905, 0, 2, 534, 1513] -[:key_up_raw, 1073741905, 0, 2, 535, 1517] -[:key_down_raw, 1073741905, 0, 2, 536, 1522] -[:key_up_raw, 1073741905, 0, 2, 537, 1526] -[:key_down_raw, 1073741905, 0, 2, 538, 1531] -[:key_up_raw, 1073741905, 0, 2, 539, 1535] -[:key_down_raw, 1073741905, 0, 2, 540, 1540] -[:key_up_raw, 1073741905, 0, 2, 541, 1544] -[:key_down_raw, 1073741905, 0, 2, 542, 1549] -[:key_up_raw, 1073741905, 0, 2, 543, 1554] -[:key_down_raw, 1073741905, 0, 2, 544, 1558] -[:key_up_raw, 1073741905, 0, 2, 545, 1564] -[:key_down_raw, 1073742051, 1024, 2, 546, 1663] -[:key_down_raw, 114, 1024, 2, 547, 1664] -[:key_up_raw, 114, 1024, 2, 548, 1669] -[:key_up_raw, 1073742051, 0, 2, 549, 1677] -[:key_down_raw, 1073742051, 1024, 2, 550, 1729] -[:key_down_raw, 113, 1024, 2, 551, 1730] diff --git a/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb b/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb new file mode 100644 index 0000000..2921076 --- /dev/null +++ b/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/decision.rb @@ -0,0 +1,37 @@ +# Hey there! Welcome to Four Decisions. Here is how you +# create your decision tree. Remove =being and =end from the text to +# enable the game (just save the file). Change stuff and see what happens! + +def game + { + starting_decision: :stormy_night, + decisions: { + stormy_night: { + description: 'It was a dark and stormy night. (storyline located in decision.rb)', + option_one: { + description: 'Go to sleep.', + decision: :nap + }, + option_two: { + description: 'Watch a movie.', + decision: :movie + }, + option_three: { + description: 'Go outside.', + decision: :go_outside + }, + option_four: { + description: 'Get a snack.', + decision: :get_a_snack + } + }, + nap: { + description: 'You took a nap. The end.', + option_one: { + description: 'Start over.', + decision: :stormy_night + } + } + } + } +end diff --git a/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb b/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb new file mode 100644 index 0000000..22faad1 --- /dev/null +++ b/samples/99_genre_rpg_narrative/choose_your_own_adventure/app/main.rb @@ -0,0 +1,132 @@ +=begin + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The values can be found + using their keys. + + In this sample app, the decisions needed for the game are stored in a hash. In fact, the + decision.rb file contains hashes inside of other hashes! + + Each option is a key in the first hash, but also contains a hash (description and + decision being its keys) as its value. + Go into the decision.rb file and take a look before diving into the code below. + + - 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.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. + For more information about the keyboard, go to mygame/documentation/06-keyboard.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. + +=end + +# This sample app provides users with a story and multiple decisions that they can choose to make. +# Users can make a decision using their keyboard, and the story will move forward based on user choices. + +# The decisions available to users are stored in the decision.rb file. +# We must have access to it for the game to function properly. +GAME_FILE = 'app/decision.rb' # found in app folder + +require GAME_FILE # require used to load another file, import class/method definitions + +# Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. +# Otherwise, the game is run. +def tick args + if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method + args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown + args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] + elsif respond_to?(:game) # otherwise, if responds to game + args.state.loaded = true + tick_game args # calls tick_game method, runs game + end + + if args.state.tick_count.mod_zero? 60 # update every 60 frames + t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file + if t != args.state.mtime + args.state.mtime = t + require GAME_FILE # require used to load file + args.state.game_definition = nil # game definition and decision are empty + args.state.decision_id = nil + end + end +end + +# Runs methods needed for game to function properly +# Creates a rectangular border around the screen +def tick_game args + defaults args + args.borders << args.grid.rect + render_decision args + process_inputs args +end + +# Sets default values and uses decision.rb file to define game and decision_id +# variable using the starting decision +def defaults args + args.state.game_definition ||= game + args.state.decision_id ||= args.state.game_definition[:starting_decision] +end + +# Outputs the possible decision descriptions the user can choose onto the screen +# as well as what key to press on their keyboard to make their decision +def render_decision args + decision = current_decision args + # text is either the value of decision's description key or warning that no description exists + args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation + + # All decisions are stored in a hash + # The descriptions output onto the screen are the values for the description keys of the hash. + if decision[:option_one] + args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label + args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision + end + + if decision[:option_two] + args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description + args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] + end + + if decision[:option_three] + args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description + args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] + end + + if decision[:option_four] + args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description + args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] + end +end + +# Uses keyboard input from the user to make a decision +# Assigns the decision as the value of the decision_id variable +def process_inputs args + decision = current_decision args # calls current_decision method + + if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists + args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id + end + + if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists + args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id + end + + if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists + args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id + end + + if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists + args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id + end +end + +# Uses decision_id's value to keep track of current decision being made +def current_decision args + args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty +end + +# Resets the game. +$gtk.reset diff --git a/samples/99_genre_rpg_narrative/choose_your_own_adventure/license-for-sample.txt b/samples/99_genre_rpg_narrative/choose_your_own_adventure/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_narrative/choose_your_own_adventure/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_narrative/choose_your_own_adventure/replay.txt b/samples/99_genre_rpg_narrative/choose_your_own_adventure/replay.txt new file mode 100644 index 0000000..7de4ea1 --- /dev/null +++ b/samples/99_genre_rpg_narrative/choose_your_own_adventure/replay.txt @@ -0,0 +1,701 @@ +replay_version 2.0 +stopped_at 1227 +seed 100 +recorded_at Sun Sep 29 22:35:15 2019 +[:mouse_move, 610, 150, 2, 1, 136] +[:mouse_move, 595, 157, 2, 2, 137] +[:mouse_move, 580, 169, 2, 3, 138] +[:mouse_move, 558, 189, 2, 4, 139] +[:mouse_move, 546, 200, 2, 5, 140] +[:mouse_move, 522, 222, 2, 6, 141] +[:mouse_move, 472, 262, 2, 7, 142] +[:mouse_move, 461, 270, 2, 8, 143] +[:mouse_move, 432, 291, 2, 9, 144] +[:mouse_move, 417, 301, 2, 10, 145] +[:mouse_move, 409, 306, 2, 11, 146] +[:mouse_move, 399, 313, 2, 12, 147] +[:mouse_move, 391, 315, 2, 13, 148] +[:mouse_move, 386, 315, 2, 14, 149] +[:mouse_move, 380, 317, 2, 15, 150] +[:mouse_move, 378, 317, 2, 16, 151] +[:mouse_move, 375, 318, 2, 17, 152] +[:mouse_move, 373, 319, 2, 18, 153] +[:mouse_move, 377, 329, 2, 19, 154] +[:mouse_move, 401, 349, 2, 20, 155] +[:mouse_move, 528, 437, 2, 21, 156] +[:mouse_move, 612, 485, 2, 22, 157] +[:mouse_move, 724, 531, 2, 23, 158] +[:mouse_move, 746, 532, 2, 24, 159] +[:mouse_move, 760, 532, 2, 25, 160] +[:mouse_move, 754, 521, 2, 26, 171] +[:mouse_move, 744, 504, 2, 27, 172] +[:mouse_move, 738, 496, 2, 28, 173] +[:mouse_move, 721, 476, 2, 29, 174] +[:mouse_move, 711, 465, 2, 30, 175] +[:mouse_move, 701, 454, 2, 31, 176] +[:mouse_move, 681, 435, 2, 32, 177] +[:mouse_move, 672, 427, 2, 33, 178] +[:mouse_move, 662, 417, 2, 34, 179] +[:mouse_move, 656, 412, 2, 35, 180] +[:mouse_move, 649, 406, 2, 36, 181] +[:mouse_move, 645, 403, 2, 37, 182] +[:mouse_move, 641, 401, 2, 38, 183] +[:mouse_move, 639, 399, 2, 39, 184] +[:mouse_move, 637, 399, 2, 40, 185] +[:mouse_move, 636, 398, 2, 41, 186] +[:mouse_move, 633, 398, 2, 42, 187] +[:mouse_move, 632, 398, 2, 43, 188] +[:mouse_move, 630, 398, 2, 44, 189] +[:mouse_move, 638, 399, 2, 45, 193] +[:mouse_move, 641, 399, 2, 46, 194] +[:mouse_move, 648, 400, 2, 47, 195] +[:mouse_move, 667, 400, 2, 48, 196] +[:mouse_move, 677, 400, 2, 49, 197] +[:mouse_move, 698, 397, 2, 50, 198] +[:mouse_move, 707, 395, 2, 51, 199] +[:mouse_move, 728, 391, 2, 52, 200] +[:mouse_move, 744, 390, 2, 53, 201] +[:mouse_move, 754, 389, 2, 54, 202] +[:mouse_move, 763, 389, 2, 55, 203] +[:mouse_move, 777, 389, 2, 56, 204] +[:mouse_move, 785, 389, 2, 57, 205] +[:mouse_move, 797, 389, 2, 58, 206] +[:mouse_move, 803, 389, 2, 59, 207] +[:mouse_move, 814, 389, 2, 60, 208] +[:mouse_move, 818, 389, 2, 61, 209] +[:mouse_move, 826, 389, 2, 62, 210] +[:mouse_move, 829, 389, 2, 63, 211] +[:mouse_move, 837, 388, 2, 64, 212] +[:mouse_move, 842, 388, 2, 65, 213] +[:mouse_move, 850, 388, 2, 66, 214] +[:mouse_move, 855, 388, 2, 67, 215] +[:mouse_move, 864, 388, 2, 68, 216] +[:mouse_move, 870, 388, 2, 69, 217] +[:mouse_move, 881, 389, 2, 70, 218] +[:mouse_move, 886, 390, 2, 71, 219] +[:mouse_move, 896, 390, 2, 72, 220] +[:mouse_move, 901, 390, 2, 73, 221] +[:mouse_move, 910, 390, 2, 74, 222] +[:mouse_move, 914, 390, 2, 75, 223] +[:mouse_move, 918, 390, 2, 76, 224] +[:mouse_move, 926, 390, 2, 77, 225] +[:mouse_move, 928, 390, 2, 78, 226] +[:mouse_move, 937, 390, 2, 79, 227] +[:mouse_move, 940, 390, 2, 80, 228] +[:mouse_move, 945, 390, 2, 81, 229] +[:mouse_move, 948, 390, 2, 82, 230] +[:mouse_move, 954, 390, 2, 83, 231] +[:mouse_move, 957, 390, 2, 84, 232] +[:mouse_move, 961, 390, 2, 85, 233] +[:mouse_move, 963, 390, 2, 86, 234] +[:mouse_move, 965, 390, 2, 87, 235] +[:mouse_move, 963, 390, 2, 88, 238] +[:mouse_move, 955, 390, 2, 89, 239] +[:mouse_move, 951, 390, 2, 90, 240] +[:mouse_move, 941, 390, 2, 91, 241] +[:mouse_move, 930, 388, 2, 92, 242] +[:mouse_move, 912, 388, 2, 93, 243] +[:mouse_move, 892, 388, 2, 94, 244] +[:mouse_move, 866, 388, 2, 95, 245] +[:mouse_move, 830, 390, 2, 96, 247] +[:mouse_move, 804, 393, 2, 97, 248] +[:mouse_move, 777, 396, 2, 98, 249] +[:mouse_move, 757, 398, 2, 99, 250] +[:mouse_move, 746, 399, 2, 100, 251] +[:mouse_move, 731, 399, 2, 101, 252] +[:mouse_move, 715, 399, 2, 102, 253] +[:mouse_move, 712, 399, 2, 103, 254] +[:mouse_move, 703, 399, 2, 104, 255] +[:mouse_move, 700, 399, 2, 105, 256] +[:mouse_move, 698, 399, 2, 106, 257] +[:mouse_move, 697, 399, 2, 107, 258] +[:mouse_move, 696, 399, 2, 108, 259] +[:mouse_move, 697, 399, 2, 109, 263] +[:mouse_move, 708, 399, 2, 110, 264] +[:mouse_move, 722, 399, 2, 111, 265] +[:mouse_move, 755, 398, 2, 112, 266] +[:mouse_move, 775, 396, 2, 113, 267] +[:mouse_move, 805, 393, 2, 114, 268] +[:mouse_move, 820, 392, 2, 115, 269] +[:mouse_move, 840, 392, 2, 116, 270] +[:mouse_move, 852, 392, 2, 117, 271] +[:mouse_move, 871, 392, 2, 118, 272] +[:mouse_move, 878, 392, 2, 119, 273] +[:mouse_move, 893, 393, 2, 120, 274] +[:mouse_move, 899, 393, 2, 121, 275] +[:mouse_move, 907, 394, 2, 122, 276] +[:mouse_move, 910, 394, 2, 123, 277] +[:mouse_move, 913, 395, 2, 124, 278] +[:mouse_move, 917, 395, 2, 125, 279] +[:mouse_move, 918, 395, 2, 126, 280] +[:mouse_move, 919, 395, 2, 127, 281] +[:mouse_move, 918, 395, 2, 128, 283] +[:mouse_move, 917, 395, 2, 129, 284] +[:mouse_move, 913, 395, 2, 130, 285] +[:mouse_move, 908, 395, 2, 131, 286] +[:mouse_move, 888, 397, 2, 132, 287] +[:mouse_move, 856, 399, 2, 133, 288] +[:mouse_move, 739, 406, 2, 134, 289] +[:mouse_move, 666, 412, 2, 135, 290] +[:mouse_move, 536, 422, 2, 136, 291] +[:mouse_move, 450, 429, 2, 137, 292] +[:mouse_move, 347, 438, 2, 138, 293] +[:mouse_move, 323, 442, 2, 139, 294] +[:mouse_move, 248, 455, 2, 140, 295] +[:mouse_move, 235, 455, 2, 141, 308] +[:mouse_move, 225, 454, 2, 142, 309] +[:mouse_move, 200, 450, 2, 143, 310] +[:mouse_move, 186, 447, 2, 144, 311] +[:mouse_move, 154, 437, 2, 145, 312] +[:mouse_move, 135, 433, 2, 146, 313] +[:mouse_move, 113, 427, 2, 147, 314] +[:mouse_move, 101, 424, 2, 148, 315] +[:mouse_move, 82, 421, 2, 149, 316] +[:mouse_move, 75, 420, 2, 150, 317] +[:mouse_move, 64, 419, 2, 151, 318] +[:mouse_move, 59, 418, 2, 152, 319] +[:mouse_move, 49, 416, 2, 153, 320] +[:mouse_move, 47, 416, 2, 154, 321] +[:mouse_move, 39, 414, 2, 155, 322] +[:mouse_move, 38, 414, 2, 156, 323] +[:mouse_move, 34, 413, 2, 157, 324] +[:mouse_move, 33, 413, 2, 158, 325] +[:mouse_move, 35, 414, 2, 159, 329] +[:mouse_move, 47, 420, 2, 160, 330] +[:mouse_move, 56, 424, 2, 161, 331] +[:mouse_move, 67, 427, 2, 162, 332] +[:mouse_move, 96, 432, 2, 163, 333] +[:mouse_move, 112, 434, 2, 164, 334] +[:mouse_move, 142, 434, 2, 165, 335] +[:mouse_move, 161, 433, 2, 166, 336] +[:mouse_move, 173, 431, 2, 167, 337] +[:mouse_move, 190, 426, 2, 168, 338] +[:mouse_move, 210, 418, 2, 169, 339] +[:mouse_move, 218, 414, 2, 170, 340] +[:mouse_move, 231, 408, 2, 171, 341] +[:mouse_move, 237, 405, 2, 172, 342] +[:mouse_move, 248, 398, 2, 173, 343] +[:mouse_move, 252, 394, 2, 174, 344] +[:mouse_move, 257, 387, 2, 175, 345] +[:mouse_move, 259, 383, 2, 176, 346] +[:mouse_move, 260, 372, 2, 177, 347] +[:mouse_move, 260, 367, 2, 178, 348] +[:mouse_move, 249, 353, 2, 179, 349] +[:mouse_move, 240, 345, 2, 180, 350] +[:mouse_move, 226, 335, 2, 181, 351] +[:mouse_move, 217, 329, 2, 182, 352] +[:mouse_move, 193, 315, 2, 183, 353] +[:mouse_move, 184, 310, 2, 184, 354] +[:mouse_move, 164, 304, 2, 185, 355] +[:mouse_move, 152, 301, 2, 186, 356] +[:mouse_move, 123, 299, 2, 187, 357] +[:mouse_move, 109, 299, 2, 188, 358] +[:mouse_move, 94, 299, 2, 189, 359] +[:mouse_move, 73, 300, 2, 190, 360] +[:mouse_move, 53, 305, 2, 191, 361] +[:mouse_move, 31, 313, 2, 192, 362] +[:mouse_move, 27, 315, 2, 193, 363] +[:mouse_move, 11, 324, 2, 194, 364] +[:mouse_move, 3, 329, 2, 195, 365] +[:mouse_move, 0, 337, 2, 196, 366] +[:mouse_move, 15, 433, 2, 197, 374] +[:mouse_move, 31, 437, 2, 198, 375] +[:mouse_move, 38, 438, 2, 199, 375] +[:mouse_move, 50, 440, 2, 200, 376] +[:mouse_move, 53, 440, 2, 201, 377] +[:mouse_move, 65, 441, 2, 202, 378] +[:mouse_move, 68, 442, 2, 203, 379] +[:mouse_move, 70, 442, 2, 204, 380] +[:mouse_move, 71, 442, 2, 205, 381] +[:mouse_move, 72, 442, 2, 206, 382] +[:mouse_move, 72, 441, 2, 207, 383] +[:mouse_move, 72, 439, 2, 208, 384] +[:mouse_move, 72, 438, 2, 209, 385] +[:mouse_move, 71, 436, 2, 210, 386] +[:mouse_move, 71, 434, 2, 211, 386] +[:mouse_move, 70, 433, 2, 212, 387] +[:mouse_move, 69, 431, 2, 213, 388] +[:mouse_move, 68, 429, 2, 214, 388] +[:mouse_move, 66, 427, 2, 215, 389] +[:mouse_move, 66, 426, 2, 216, 390] +[:mouse_move, 63, 423, 2, 217, 390] +[:mouse_move, 62, 422, 2, 218, 391] +[:mouse_move, 59, 419, 2, 219, 392] +[:mouse_move, 58, 418, 2, 220, 392] +[:mouse_move, 57, 416, 2, 221, 393] +[:mouse_move, 56, 414, 2, 222, 394] +[:mouse_move, 55, 413, 2, 223, 394] +[:mouse_move, 54, 412, 2, 224, 395] +[:mouse_move, 53, 410, 2, 225, 396] +[:mouse_move, 53, 409, 2, 226, 396] +[:mouse_move, 52, 408, 2, 227, 397] +[:mouse_move, 52, 407, 2, 228, 398] +[:mouse_move, 51, 405, 2, 229, 399] +[:mouse_move, 51, 404, 2, 230, 400] +[:mouse_move, 53, 404, 2, 231, 411] +[:mouse_move, 57, 404, 2, 232, 412] +[:mouse_move, 61, 405, 2, 233, 413] +[:mouse_move, 66, 405, 2, 234, 413] +[:mouse_move, 68, 405, 2, 235, 414] +[:mouse_move, 75, 405, 2, 236, 415] +[:mouse_move, 77, 405, 2, 237, 416] +[:mouse_move, 81, 402, 2, 238, 417] +[:mouse_move, 82, 400, 2, 239, 418] +[:mouse_move, 83, 398, 2, 240, 419] +[:mouse_move, 83, 395, 2, 241, 419] +[:mouse_move, 83, 391, 2, 242, 420] +[:mouse_move, 83, 387, 2, 243, 421] +[:mouse_move, 81, 383, 2, 244, 421] +[:mouse_move, 80, 379, 2, 245, 422] +[:mouse_move, 77, 375, 2, 246, 423] +[:mouse_move, 74, 371, 2, 247, 423] +[:mouse_move, 71, 368, 2, 248, 424] +[:mouse_move, 67, 366, 2, 249, 425] +[:mouse_move, 62, 364, 2, 250, 425] +[:mouse_move, 56, 364, 2, 251, 426] +[:mouse_move, 51, 364, 2, 252, 427] +[:mouse_move, 49, 364, 2, 253, 427] +[:mouse_move, 45, 364, 2, 254, 428] +[:mouse_move, 42, 364, 2, 255, 429] +[:mouse_move, 36, 367, 2, 256, 430] +[:mouse_move, 35, 370, 2, 257, 431] +[:mouse_move, 32, 377, 2, 258, 432] +[:mouse_move, 32, 382, 2, 259, 433] +[:mouse_move, 32, 392, 2, 260, 434] +[:mouse_move, 32, 396, 2, 261, 435] +[:mouse_move, 41, 408, 2, 262, 436] +[:mouse_move, 47, 411, 2, 263, 437] +[:mouse_move, 57, 414, 2, 264, 438] +[:mouse_move, 64, 415, 2, 265, 439] +[:mouse_move, 70, 415, 2, 266, 440] +[:mouse_move, 76, 415, 2, 267, 440] +[:mouse_move, 81, 415, 2, 268, 441] +[:mouse_move, 85, 414, 2, 269, 442] +[:mouse_move, 89, 411, 2, 270, 442] +[:mouse_move, 92, 408, 2, 271, 443] +[:mouse_move, 95, 404, 2, 272, 444] +[:mouse_move, 96, 400, 2, 273, 444] +[:mouse_move, 96, 395, 2, 274, 445] +[:mouse_move, 97, 391, 2, 275, 446] +[:mouse_move, 97, 387, 2, 276, 446] +[:mouse_move, 96, 384, 2, 277, 447] +[:mouse_move, 91, 379, 2, 278, 448] +[:mouse_move, 84, 376, 2, 279, 448] +[:mouse_move, 71, 374, 2, 280, 449] +[:mouse_move, 63, 374, 2, 281, 450] +[:mouse_move, 53, 374, 2, 282, 451] +[:mouse_move, 47, 374, 2, 283, 452] +[:mouse_move, 37, 376, 2, 284, 453] +[:mouse_move, 31, 380, 2, 285, 454] +[:mouse_move, 25, 394, 2, 286, 455] +[:mouse_move, 24, 407, 2, 287, 456] +[:mouse_move, 24, 427, 2, 288, 457] +[:key_down_raw, 1073741904, 0, 2, 289, 512] +[:key_up_raw, 1073741904, 0, 2, 290, 516] +[:mouse_move, 48, 426, 2, 291, 580] +[:mouse_move, 62, 426, 2, 292, 581] +[:mouse_move, 77, 425, 2, 293, 581] +[:mouse_move, 92, 425, 2, 294, 581] +[:mouse_move, 111, 424, 2, 295, 582] +[:mouse_move, 134, 424, 2, 296, 583] +[:mouse_move, 186, 423, 2, 297, 583] +[:mouse_move, 248, 420, 2, 298, 584] +[:mouse_move, 313, 417, 2, 299, 585] +[:mouse_move, 375, 411, 2, 300, 585] +[:mouse_move, 434, 403, 2, 301, 586] +[:mouse_move, 456, 397, 2, 302, 587] +[:mouse_move, 472, 393, 2, 303, 587] +[:mouse_move, 483, 388, 2, 304, 588] +[:mouse_move, 490, 385, 2, 305, 589] +[:mouse_move, 514, 378, 2, 306, 590] +[:mouse_move, 520, 375, 2, 307, 591] +[:mouse_move, 524, 373, 2, 308, 592] +[:mouse_move, 524, 372, 2, 309, 593] +[:mouse_move, 514, 372, 2, 310, 594] +[:mouse_move, 510, 372, 2, 311, 595] +[:mouse_move, 503, 373, 2, 312, 596] +[:mouse_move, 501, 374, 2, 313, 597] +[:mouse_move, 497, 374, 2, 314, 598] +[:mouse_move, 496, 375, 2, 315, 599] +[:mouse_move, 495, 375, 2, 316, 600] +[:mouse_move, 494, 376, 2, 317, 601] +[:mouse_move, 493, 376, 2, 318, 602] +[:mouse_move, 492, 376, 2, 319, 602] +[:mouse_move, 491, 377, 2, 320, 603] +[:mouse_move, 490, 377, 2, 321, 604] +[:mouse_move, 490, 378, 2, 322, 604] +[:mouse_move, 489, 378, 2, 323, 605] +[:mouse_move, 489, 379, 2, 324, 606] +[:mouse_move, 488, 379, 2, 325, 606] +[:mouse_move, 488, 380, 2, 326, 608] +[:mouse_move, 491, 381, 2, 327, 610] +[:mouse_move, 494, 382, 2, 328, 610] +[:mouse_move, 498, 384, 2, 329, 611] +[:mouse_move, 503, 385, 2, 330, 612] +[:mouse_move, 522, 387, 2, 331, 613] +[:mouse_move, 527, 387, 2, 332, 614] +[:mouse_move, 542, 387, 2, 333, 614] +[:mouse_move, 553, 387, 2, 334, 615] +[:mouse_move, 562, 387, 2, 335, 616] +[:mouse_move, 576, 387, 2, 336, 617] +[:mouse_move, 585, 387, 2, 337, 618] +[:mouse_move, 598, 387, 2, 338, 619] +[:mouse_move, 605, 387, 2, 339, 620] +[:mouse_move, 616, 388, 2, 340, 621] +[:mouse_move, 621, 388, 2, 341, 622] +[:mouse_move, 632, 390, 2, 342, 623] +[:mouse_move, 637, 391, 2, 343, 624] +[:mouse_move, 649, 393, 2, 344, 625] +[:mouse_move, 660, 395, 2, 345, 626] +[:mouse_move, 672, 397, 2, 346, 627] +[:mouse_move, 679, 398, 2, 347, 628] +[:mouse_move, 686, 398, 2, 348, 629] +[:mouse_move, 692, 398, 2, 349, 629] +[:mouse_move, 699, 398, 2, 350, 630] +[:mouse_move, 707, 398, 2, 351, 631] +[:mouse_move, 714, 398, 2, 352, 631] +[:mouse_move, 720, 398, 2, 353, 632] +[:mouse_move, 726, 398, 2, 354, 633] +[:mouse_move, 731, 398, 2, 355, 633] +[:mouse_move, 733, 397, 2, 356, 634] +[:mouse_move, 737, 397, 2, 357, 635] +[:mouse_move, 744, 396, 2, 358, 635] +[:mouse_move, 747, 396, 2, 359, 636] +[:mouse_move, 749, 396, 2, 360, 637] +[:mouse_move, 754, 396, 2, 361, 637] +[:mouse_move, 756, 396, 2, 362, 638] +[:mouse_move, 758, 396, 2, 363, 639] +[:mouse_move, 760, 395, 2, 364, 639] +[:mouse_move, 762, 395, 2, 365, 640] +[:mouse_move, 763, 395, 2, 366, 641] +[:mouse_move, 764, 395, 2, 367, 642] +[:mouse_move, 765, 395, 2, 368, 643] +[:mouse_move, 764, 395, 2, 369, 658] +[:mouse_move, 763, 397, 2, 370, 658] +[:mouse_move, 758, 401, 2, 371, 659] +[:mouse_move, 749, 406, 2, 372, 660] +[:mouse_move, 736, 412, 2, 373, 660] +[:mouse_move, 717, 420, 2, 374, 661] +[:mouse_move, 673, 432, 2, 375, 662] +[:mouse_move, 632, 443, 2, 376, 662] +[:mouse_move, 579, 455, 2, 377, 663] +[:mouse_move, 517, 465, 2, 378, 664] +[:mouse_move, 407, 483, 2, 379, 664] +[:mouse_move, 369, 488, 2, 380, 665] +[:mouse_move, 296, 497, 2, 381, 666] +[:mouse_move, 270, 499, 2, 382, 666] +[:mouse_move, 216, 503, 2, 383, 667] +[:mouse_move, 200, 503, 2, 384, 668] +[:mouse_move, 143, 500, 2, 385, 669] +[:mouse_move, 138, 497, 2, 386, 670] +[:mouse_move, 115, 489, 2, 387, 671] +[:mouse_move, 113, 487, 2, 388, 672] +[:mouse_move, 105, 483, 2, 389, 673] +[:mouse_move, 99, 480, 2, 390, 674] +[:mouse_move, 93, 476, 2, 391, 675] +[:mouse_move, 87, 472, 2, 392, 676] +[:mouse_move, 79, 469, 2, 393, 677] +[:mouse_move, 74, 465, 2, 394, 678] +[:mouse_move, 65, 460, 2, 395, 679] +[:mouse_move, 61, 457, 2, 396, 680] +[:mouse_move, 57, 454, 2, 397, 681] +[:mouse_move, 54, 450, 2, 398, 681] +[:mouse_move, 51, 446, 2, 399, 682] +[:mouse_move, 47, 442, 2, 400, 683] +[:mouse_move, 44, 438, 2, 401, 683] +[:mouse_move, 40, 434, 2, 402, 684] +[:mouse_move, 36, 430, 2, 403, 685] +[:mouse_move, 32, 426, 2, 404, 685] +[:mouse_move, 29, 422, 2, 405, 686] +[:mouse_move, 25, 418, 2, 406, 687] +[:mouse_move, 22, 414, 2, 407, 687] +[:mouse_move, 18, 410, 2, 408, 688] +[:mouse_move, 15, 406, 2, 409, 689] +[:mouse_move, 13, 405, 2, 410, 689] +[:mouse_move, 10, 402, 2, 411, 690] +[:mouse_move, 8, 400, 2, 412, 691] +[:mouse_move, 5, 398, 2, 413, 691] +[:mouse_move, 3, 396, 2, 414, 692] +[:mouse_move, 2, 395, 2, 415, 693] +[:mouse_move, 1, 393, 2, 416, 694] +[:mouse_move, 0, 393, 2, 417, 695] +[:mouse_move, 3, 393, 2, 418, 701] +[:mouse_move, 7, 393, 2, 419, 701] +[:mouse_move, 12, 393, 2, 420, 702] +[:mouse_move, 21, 394, 2, 421, 703] +[:mouse_move, 39, 396, 2, 422, 704] +[:mouse_move, 44, 396, 2, 423, 705] +[:mouse_move, 61, 397, 2, 424, 706] +[:mouse_move, 70, 399, 2, 425, 707] +[:mouse_move, 79, 399, 2, 426, 708] +[:mouse_move, 87, 400, 2, 427, 708] +[:mouse_move, 95, 400, 2, 428, 709] +[:mouse_move, 104, 401, 2, 429, 711] +[:mouse_move, 118, 403, 2, 430, 712] +[:mouse_move, 125, 403, 2, 431, 712] +[:mouse_move, 140, 404, 2, 432, 713] +[:mouse_move, 147, 404, 2, 433, 714] +[:mouse_move, 163, 404, 2, 434, 715] +[:mouse_move, 171, 404, 2, 435, 716] +[:mouse_move, 178, 404, 2, 436, 716] +[:mouse_move, 194, 404, 2, 437, 718] +[:mouse_move, 202, 404, 2, 438, 718] +[:mouse_move, 217, 404, 2, 439, 720] +[:mouse_move, 231, 404, 2, 440, 721] +[:mouse_move, 238, 404, 2, 441, 722] +[:mouse_move, 245, 404, 2, 442, 722] +[:mouse_move, 252, 404, 2, 443, 723] +[:mouse_move, 257, 404, 2, 444, 724] +[:mouse_move, 268, 404, 2, 445, 725] +[:mouse_move, 271, 405, 2, 446, 726] +[:mouse_move, 278, 406, 2, 447, 727] +[:mouse_move, 281, 407, 2, 448, 728] +[:mouse_move, 285, 408, 2, 449, 729] +[:mouse_move, 286, 408, 2, 450, 730] +[:mouse_move, 287, 409, 2, 451, 731] +[:mouse_move, 288, 409, 2, 452, 732] +[:mouse_move, 289, 409, 2, 453, 735] +[:key_down_raw, 1073741904, 0, 2, 454, 785] +[:key_up_raw, 1073741904, 0, 2, 455, 789] +[:mouse_move, 289, 408, 2, 456, 840] +[:mouse_move, 291, 393, 2, 457, 841] +[:mouse_move, 296, 381, 2, 458, 842] +[:mouse_move, 316, 352, 2, 459, 843] +[:mouse_move, 328, 334, 2, 460, 844] +[:mouse_move, 350, 300, 2, 461, 845] +[:mouse_move, 364, 279, 2, 462, 845] +[:mouse_move, 387, 242, 2, 463, 846] +[:mouse_move, 410, 206, 2, 464, 847] +[:mouse_move, 420, 192, 2, 465, 847] +[:mouse_move, 439, 168, 2, 466, 848] +[:mouse_move, 446, 161, 2, 467, 849] +[:mouse_move, 459, 146, 2, 468, 849] +[:mouse_move, 469, 137, 2, 469, 850] +[:mouse_move, 471, 134, 2, 470, 851] +[:mouse_move, 477, 128, 2, 471, 851] +[:mouse_move, 479, 125, 2, 472, 852] +[:mouse_move, 481, 123, 2, 473, 853] +[:mouse_move, 482, 121, 2, 474, 853] +[:mouse_move, 482, 120, 2, 475, 854] +[:mouse_move, 482, 119, 2, 476, 855] +[:mouse_move, 480, 117, 2, 477, 855] +[:mouse_move, 478, 115, 2, 478, 856] +[:mouse_move, 475, 113, 2, 479, 857] +[:mouse_move, 473, 110, 2, 480, 857] +[:mouse_move, 473, 109, 2, 481, 858] +[:mouse_move, 471, 106, 2, 482, 859] +[:mouse_move, 469, 102, 2, 483, 860] +[:mouse_move, 469, 98, 2, 484, 861] +[:mouse_move, 469, 94, 2, 485, 861] +[:mouse_move, 470, 91, 2, 486, 862] +[:mouse_move, 472, 86, 2, 487, 863] +[:mouse_move, 476, 81, 2, 488, 864] +[:mouse_move, 477, 78, 2, 489, 865] +[:mouse_move, 480, 75, 2, 490, 866] +[:mouse_move, 481, 74, 2, 491, 867] +[:mouse_move, 482, 73, 2, 492, 868] +[:mouse_move, 482, 72, 2, 493, 869] +[:mouse_move, 484, 72, 2, 494, 873] +[:mouse_move, 486, 72, 2, 495, 874] +[:mouse_move, 488, 73, 2, 496, 874] +[:mouse_move, 492, 74, 2, 497, 875] +[:mouse_move, 497, 75, 2, 498, 876] +[:mouse_move, 502, 76, 2, 499, 876] +[:mouse_move, 509, 77, 2, 500, 877] +[:mouse_move, 517, 77, 2, 501, 878] +[:mouse_move, 530, 78, 2, 502, 878] +[:mouse_move, 540, 79, 2, 503, 879] +[:mouse_move, 550, 79, 2, 504, 880] +[:mouse_move, 555, 80, 2, 505, 880] +[:mouse_move, 563, 81, 2, 506, 881] +[:mouse_move, 572, 81, 2, 507, 882] +[:mouse_move, 580, 82, 2, 508, 882] +[:mouse_move, 587, 82, 2, 509, 883] +[:mouse_move, 593, 82, 2, 510, 884] +[:mouse_move, 599, 82, 2, 511, 884] +[:mouse_move, 602, 83, 2, 512, 885] +[:mouse_move, 608, 83, 2, 513, 886] +[:mouse_move, 616, 83, 2, 514, 887] +[:mouse_move, 620, 84, 2, 515, 888] +[:mouse_move, 627, 84, 2, 516, 889] +[:mouse_move, 631, 84, 2, 517, 890] +[:mouse_move, 636, 84, 2, 518, 890] +[:mouse_move, 640, 84, 2, 519, 891] +[:mouse_move, 645, 84, 2, 520, 892] +[:mouse_move, 656, 84, 2, 521, 893] +[:mouse_move, 661, 84, 2, 522, 894] +[:mouse_move, 671, 84, 2, 523, 895] +[:mouse_move, 676, 84, 2, 524, 896] +[:mouse_move, 682, 83, 2, 525, 897] +[:mouse_move, 689, 82, 2, 526, 898] +[:mouse_move, 693, 82, 2, 527, 899] +[:mouse_move, 696, 81, 2, 528, 899] +[:mouse_move, 700, 81, 2, 529, 900] +[:mouse_move, 704, 81, 2, 530, 901] +[:mouse_move, 707, 80, 2, 531, 901] +[:mouse_move, 711, 80, 2, 532, 902] +[:mouse_move, 714, 79, 2, 533, 903] +[:mouse_move, 718, 79, 2, 534, 903] +[:mouse_move, 720, 79, 2, 535, 904] +[:mouse_move, 724, 78, 2, 536, 905] +[:mouse_move, 727, 77, 2, 537, 905] +[:mouse_move, 730, 76, 2, 538, 906] +[:mouse_move, 733, 76, 2, 539, 907] +[:mouse_move, 737, 75, 2, 540, 907] +[:mouse_move, 740, 75, 2, 541, 908] +[:mouse_move, 742, 74, 2, 542, 909] +[:mouse_move, 746, 74, 2, 543, 909] +[:mouse_move, 749, 73, 2, 544, 910] +[:mouse_move, 753, 73, 2, 545, 911] +[:mouse_move, 760, 73, 2, 546, 912] +[:mouse_move, 763, 73, 2, 547, 913] +[:mouse_move, 767, 72, 2, 548, 913] +[:mouse_move, 768, 72, 2, 549, 914] +[:mouse_move, 771, 72, 2, 550, 915] +[:mouse_move, 777, 71, 2, 551, 916] +[:mouse_move, 778, 70, 2, 552, 917] +[:mouse_move, 781, 70, 2, 553, 918] +[:mouse_move, 782, 70, 2, 554, 919] +[:mouse_move, 784, 70, 2, 555, 920] +[:mouse_move, 786, 70, 2, 556, 921] +[:mouse_move, 788, 70, 2, 557, 922] +[:mouse_move, 789, 70, 2, 558, 923] +[:mouse_move, 790, 70, 2, 559, 924] +[:key_down_raw, 1073741906, 0, 2, 560, 990] +[:key_up_raw, 1073741906, 0, 2, 561, 994] +[:mouse_move, 722, 94, 2, 562, 1047] +[:mouse_move, 699, 106, 2, 563, 1048] +[:mouse_move, 679, 118, 2, 564, 1048] +[:mouse_move, 658, 130, 2, 565, 1049] +[:mouse_move, 640, 142, 2, 566, 1050] +[:mouse_move, 616, 164, 2, 567, 1051] +[:mouse_move, 597, 185, 2, 568, 1052] +[:mouse_move, 579, 211, 2, 569, 1053] +[:mouse_move, 572, 222, 2, 570, 1054] +[:mouse_move, 564, 249, 2, 571, 1055] +[:mouse_move, 561, 269, 2, 572, 1056] +[:mouse_move, 558, 307, 2, 573, 1057] +[:mouse_move, 558, 334, 2, 574, 1058] +[:mouse_move, 560, 370, 2, 575, 1059] +[:mouse_move, 556, 369, 2, 576, 1073] +[:mouse_move, 548, 366, 2, 577, 1074] +[:mouse_move, 533, 361, 2, 578, 1075] +[:mouse_move, 512, 354, 2, 579, 1075] +[:mouse_move, 486, 347, 2, 580, 1076] +[:mouse_move, 455, 342, 2, 581, 1077] +[:mouse_move, 416, 339, 2, 582, 1078] +[:mouse_move, 391, 339, 2, 583, 1079] +[:mouse_move, 354, 341, 2, 584, 1080] +[:mouse_move, 339, 345, 2, 585, 1081] +[:mouse_move, 321, 351, 2, 586, 1082] +[:mouse_move, 312, 354, 2, 587, 1083] +[:mouse_move, 305, 358, 2, 588, 1084] +[:mouse_move, 301, 360, 2, 589, 1085] +[:mouse_move, 297, 364, 2, 590, 1086] +[:mouse_move, 296, 367, 2, 591, 1087] +[:mouse_move, 296, 369, 2, 592, 1088] +[:mouse_move, 296, 372, 2, 593, 1088] +[:mouse_move, 297, 375, 2, 594, 1089] +[:mouse_move, 301, 382, 2, 595, 1090] +[:mouse_move, 308, 387, 2, 596, 1090] +[:mouse_move, 316, 392, 2, 597, 1091] +[:mouse_move, 328, 397, 2, 598, 1092] +[:mouse_move, 352, 407, 2, 599, 1092] +[:mouse_move, 370, 411, 2, 600, 1093] +[:mouse_move, 392, 416, 2, 601, 1094] +[:mouse_move, 418, 419, 2, 602, 1094] +[:mouse_move, 449, 422, 2, 603, 1095] +[:mouse_move, 481, 424, 2, 604, 1096] +[:mouse_move, 517, 428, 2, 605, 1096] +[:mouse_move, 549, 432, 2, 606, 1097] +[:mouse_move, 583, 435, 2, 607, 1098] +[:mouse_move, 617, 438, 2, 608, 1098] +[:mouse_move, 651, 439, 2, 609, 1099] +[:mouse_move, 686, 440, 2, 610, 1100] +[:mouse_move, 718, 443, 2, 611, 1100] +[:mouse_move, 750, 444, 2, 612, 1101] +[:mouse_move, 782, 444, 2, 613, 1102] +[:mouse_move, 795, 444, 2, 614, 1102] +[:mouse_move, 822, 444, 2, 615, 1103] +[:mouse_move, 847, 444, 2, 616, 1104] +[:mouse_move, 867, 441, 2, 617, 1104] +[:mouse_move, 885, 438, 2, 618, 1105] +[:mouse_move, 900, 434, 2, 619, 1106] +[:mouse_move, 917, 427, 2, 620, 1107] +[:mouse_move, 934, 420, 2, 621, 1108] +[:mouse_move, 946, 412, 2, 622, 1109] +[:mouse_move, 953, 406, 2, 623, 1110] +[:mouse_move, 965, 392, 2, 624, 1111] +[:mouse_move, 974, 380, 2, 625, 1112] +[:mouse_move, 983, 359, 2, 626, 1113] +[:mouse_move, 986, 347, 2, 627, 1114] +[:mouse_move, 988, 334, 2, 628, 1115] +[:mouse_move, 990, 318, 2, 629, 1115] +[:mouse_move, 991, 301, 2, 630, 1116] +[:mouse_move, 991, 285, 2, 631, 1117] +[:mouse_move, 987, 270, 2, 632, 1117] +[:mouse_move, 973, 244, 2, 633, 1118] +[:mouse_move, 957, 229, 2, 634, 1119] +[:mouse_move, 934, 214, 2, 635, 1119] +[:mouse_move, 886, 190, 2, 636, 1120] +[:mouse_move, 847, 177, 2, 637, 1121] +[:mouse_move, 804, 167, 2, 638, 1121] +[:mouse_move, 755, 159, 2, 639, 1122] +[:mouse_move, 705, 154, 2, 640, 1123] +[:mouse_move, 682, 153, 2, 641, 1123] +[:mouse_move, 599, 151, 2, 642, 1124] +[:mouse_move, 577, 151, 2, 643, 1125] +[:mouse_move, 532, 151, 2, 644, 1125] +[:mouse_move, 492, 152, 2, 645, 1126] +[:mouse_move, 476, 155, 2, 646, 1127] +[:mouse_move, 444, 158, 2, 647, 1127] +[:mouse_move, 418, 163, 2, 648, 1128] +[:mouse_move, 394, 169, 2, 649, 1129] +[:mouse_move, 373, 174, 2, 650, 1129] +[:mouse_move, 353, 181, 2, 651, 1130] +[:mouse_move, 336, 189, 2, 652, 1131] +[:mouse_move, 307, 203, 2, 653, 1132] +[:mouse_move, 302, 207, 2, 654, 1133] +[:mouse_move, 284, 223, 2, 655, 1134] +[:mouse_move, 272, 236, 2, 656, 1135] +[:mouse_move, 261, 259, 2, 657, 1136] +[:mouse_move, 256, 272, 2, 658, 1137] +[:mouse_move, 251, 300, 2, 659, 1138] +[:mouse_move, 250, 314, 2, 660, 1139] +[:mouse_move, 250, 331, 2, 661, 1140] +[:mouse_move, 250, 334, 2, 662, 1141] +[:mouse_move, 251, 342, 2, 663, 1142] +[:mouse_move, 251, 348, 2, 664, 1142] +[:mouse_move, 255, 358, 2, 665, 1143] +[:mouse_move, 258, 365, 2, 666, 1144] +[:mouse_move, 261, 371, 2, 667, 1144] +[:mouse_move, 266, 378, 2, 668, 1145] +[:mouse_move, 273, 386, 2, 669, 1146] +[:mouse_move, 281, 395, 2, 670, 1146] +[:mouse_move, 286, 400, 2, 671, 1147] +[:mouse_move, 293, 408, 2, 672, 1148] +[:mouse_move, 300, 415, 2, 673, 1148] +[:mouse_move, 315, 427, 2, 674, 1149] +[:mouse_move, 325, 432, 2, 675, 1150] +[:mouse_move, 344, 441, 2, 676, 1150] +[:mouse_move, 358, 446, 2, 677, 1151] +[:mouse_move, 379, 452, 2, 678, 1152] +[:mouse_move, 402, 458, 2, 679, 1152] +[:mouse_move, 425, 464, 2, 680, 1153] +[:mouse_move, 454, 470, 2, 681, 1154] +[:mouse_move, 480, 474, 2, 682, 1154] +[:mouse_move, 511, 478, 2, 683, 1155] +[:mouse_move, 541, 480, 2, 684, 1156] +[:mouse_move, 573, 482, 2, 685, 1156] +[:mouse_move, 609, 485, 2, 686, 1157] +[:mouse_move, 647, 488, 2, 687, 1158] +[:mouse_move, 685, 492, 2, 688, 1158] +[:mouse_move, 719, 496, 2, 689, 1159] +[:mouse_move, 734, 497, 2, 690, 1160] +[:mouse_move, 761, 498, 2, 691, 1160] +[:mouse_move, 769, 498, 2, 692, 1161] +[:mouse_move, 784, 498, 2, 693, 1162] +[:mouse_move, 799, 493, 2, 694, 1163] +[:mouse_move, 802, 491, 2, 695, 1164] +[:key_down_raw, 1073742051, 1024, 2, 696, 1225] +[:key_down_raw, 113, 1024, 2, 697, 1226] diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb new file mode 100644 index 0000000..cc1e021 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/lowrez_simulator.rb @@ -0,0 +1,91 @@ +################################################################################### +# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES +# THE 64x64 CANVAS. +################################################################################### + +TINY_RESOLUTION = 64 +TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) +CENTER_OFFSET = 10 +EMULATED_FONT_SIZE = 20 +EMULATED_FONT_X_ZERO = 0 +EMULATED_FONT_Y_ZERO = 46 + +def tick args + sprites = [] + labels = [] + borders = [] + solids = [] + mouse = emulate_lowrez_mouse args + args.state.show_gridlines = false + lowrez_tick args, sprites, labels, borders, solids, mouse + render_gridlines_if_needed args + render_mouse_crosshairs args, mouse + emulate_lowrez_scene args, sprites, labels, borders, solids, mouse +end + +def emulate_lowrez_mouse args + args.state.new_entity_strict(:lowrez_mouse) do |m| + 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 + m.click = [ + 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 + else + m.click = nil + m.down = nil + end + + if args.mouse.up + m.up = [ + 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 + end + end +end + +def render_mouse_crosshairs args, mouse + return unless args.state.show_gridlines + args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] +end + +def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse + args.render_target(:lowrez).solids << [0, 0, 1280, 720] + args.render_target(:lowrez).sprites << sprites + args.render_target(:lowrez).borders << borders + args.render_target(:lowrez).solids << solids + args.outputs.primitives << labels.map do |l| + as_label = l.label + l.text.each_char.each_with_index.map do |char, i| + [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, 'fonts/dragonruby-gtk-4x4.ttf'].label + end + end + + args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] +end + +def render_gridlines_if_needed args + if args.state.show_gridlines && args.static_lines.length == 0 + args.static_lines << 65.times.map do |i| + [ + [CENTER_OFFSET + i * TINY_SCALE + 1, 0, + CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], + [CENTER_OFFSET + i * TINY_SCALE, 0, + CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], + [CENTER_OFFSET, 0 + i * TINY_SCALE, + CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], + [CENTER_OFFSET, 1 + i * TINY_SCALE, + CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] + ] + end + elsif !args.state.show_gridlines + args.static_lines.clear + end +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb new file mode 100644 index 0000000..43a35cf --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/main.rb @@ -0,0 +1,473 @@ +require 'app/require.rb' + +def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.last_story_line_text ||= "" + args.state.scene_history ||= [] + args.state.storyline_history ||= [] + args.state.word_delay ||= 8 + if args.state.tick_count == 0 + args.gtk.stop_music + args.outputs.sounds << 'sounds/static-loop.ogg' + end + + if args.state.last_story_line_text + lines = args.state + .last_story_line_text + .gsub("-", "") + .gsub("~", "") + .wrapped_lines(50) + + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } + elsif args.state.storyline_history[-1] + lines = args.state + .storyline_history[-1] + .gsub("-", "") + .gsub("~", "") + .wrapped_lines(50) + + args.outputs.labels << lines.map_with_index { |l, i| [690, 200 - (i * 25), l, 1, 0, 255, 255, 255] } + end + + return if args.state.current_scene + set_scene(args, day_one_beginning(args)) +end + +def inputs_move_player args + if args.state.scene_changed_at.elapsed_time > 5 + if args.keyboard.down || args.keyboard.s || args.keyboard.j + args.state.player.y -= 0.25 + elsif args.keyboard.up || args.keyboard.w || args.keyboard.k + args.state.player.y += 0.25 + end + + if args.keyboard.left || args.keyboard.a || args.keyboard.h + args.state.player.x -= 0.25 + elsif args.keyboard.right || args.keyboard.d || args.keyboard.l + args.state.player.x += 0.25 + end + + args.state.player.y = 60 if args.state.player.y > 63 + args.state.player.y = 0 if args.state.player.y < -3 + args.state.player.x = 60 if args.state.player.x > 63 + args.state.player.x = 0 if args.state.player.x < -3 + end +end + +def null_or_empty? ary + return true unless ary + return true if ary.length == 0 + return false +end + +def calc_storyline_hotspot args + hotspots = args.state.storylines.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot + _, _, _, _, storyline = hotspots.first + queue_storyline_text(args, storyline) + args.state.inside_storyline_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_storyline_hotspot = false + + args.state.storyline_queue_empty_at ||= args.state.tick_count + args.state.is_storyline_dialog_active = false + args.state.scene_storyline_queue.clear + end +end + +def calc_scenes args + hotspots = args.state.scenes.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot + _, _, _, _, scene_method_or_hash = hotspots.first + if scene_method_or_hash.is_a? Symbol + set_scene(args, send(scene_method_or_hash, args)) + args.state.last_hotspot_scene = scene_method_or_hash + args.state.scene_history << scene_method_or_hash + else + set_scene(args, scene_method_or_hash) + end + args.state.inside_scene_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_scene_hotspot = false + end +end + +def null_or_whitespace? word + return true if !word + return true if word.strip.length == 0 + return false +end + +def calc_storyline_presentation args + return unless args.state.tick_count > args.state.next_storyline + return unless args.state.scene_storyline_queue + next_storyline = args.state.scene_storyline_queue.shift + if null_or_whitespace? next_storyline + args.state.storyline_queue_empty_at ||= args.state.tick_count + args.state.is_storyline_dialog_active = false + return + end + args.state.storyline_to_show = next_storyline + args.state.is_storyline_dialog_active = true + args.state.storyline_queue_empty_at = nil + if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") + args.state.next_storyline += 60 + elsif next_storyline.end_with?(",") + args.state.next_storyline += 50 + elsif next_storyline.end_with?(":") + args.state.next_storyline += 60 + else + default_word_delay = 13 + args.state.word_delay - 8 + if next_storyline.gsub("-", "").gsub("~", "").length <= 4 + default_word_delay = 11 + args.state.word_delay - 8 + end + number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length + args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) + end +end + +def inputs_reload_current_scene args + return + if args.inputs.keyboard.key_down.r! + reload_current_scene + end +end + +def inputs_dismiss_current_storyline args + if args.inputs.keyboard.key_down.x! + args.state.scene_storyline_queue.clear + end +end + +def inputs_restart_game args + if args.inputs.keyboard.exclamation_point + args.gtk.reset_state + end +end + +def inputs_change_word_delay args + if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign + args.state.word_delay -= 2 + if args.state.word_delay < 0 + args.state.word_delay = 0 + # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" + else + # queue_storyline_text args, "Text speed INCREASED." + end + end + + if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore + args.state.word_delay += 2 + # queue_storyline_text args, "Text speed DECREASED." + end +end + +def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil + texts.each_with_index.map do |t, i| + [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] + end +end + +def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse + # args.state.show_gridlines = true + defaults args + render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + render_controller args, lowrez_borders + lowrez_solids << [0, 0, 64, 64, 0, 0, 0] + calc_storyline_presentation args + calc_scenes args + calc_storyline_hotspot args + inputs_move_player args + inputs_print_mouse_rect args, lowrez_mouse + inputs_reload_current_scene args + inputs_dismiss_current_storyline args + inputs_change_word_delay args + inputs_restart_game args +end + +def render_controller args, lowrez_borders + args.state.up_button = [85, 40, 15, 15, 255, 255, 255] + args.state.down_button = [85, 20, 15, 15, 255, 255, 255] + args.state.left_button = [65, 20, 15, 15, 255, 255, 255] + args.state.right_button = [105, 20, 15, 15, 255, 255, 255] + lowrez_borders << args.state.up_button + lowrez_borders << args.state.down_button + lowrez_borders << args.state.left_button + lowrez_borders << args.state.right_button +end + +def inputs_print_mouse_rect args, lowrez_mouse + if lowrez_mouse.up + args.state.mouse_held = false + elsif lowrez_mouse.click + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] + if args.state.up_button.intersect_rect? mouse_rect + args.state.player.y += 1 + end + + if args.state.down_button.intersect_rect? mouse_rect + args.state.player.y -= 1 + end + + if args.state.left_button.intersect_rect? mouse_rect + args.state.player.x -= 1 + end + + if args.state.right_button.intersect_rect? mouse_rect + args.state.player.x += 1 + end + args.state.mouse_held = true + elsif args.state.mouse_held + mouse_rect = [lowrez_mouse.x, lowrez_mouse.y, 1, 1] + if args.state.up_button.intersect_rect? mouse_rect + args.state.player.y += 0.25 + end + + if args.state.down_button.intersect_rect? mouse_rect + args.state.player.y -= 0.25 + end + + if args.state.left_button.intersect_rect? mouse_rect + args.state.player.x -= 0.25 + end + + if args.state.right_button.intersect_rect? mouse_rect + args.state.player.x += 0.25 + end + end + + if lowrez_mouse.click + dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x + dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y + x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy + puts "x #{lowrez_mouse.click.x}, y: #{lowrez_mouse.click.y}" + if args.state.previous_mouse_click + + if dx < 0 && dx < 0 + x = x + w + w = w.abs + y = y + h + h = h.abs + end + + w += 1 + h += 1 + + args.state.previous_mouse_click = nil + else + args.state.previous_mouse_click = lowrez_mouse.click + square_x, square_y = lowrez_mouse.click + end + end +end + +def try_centering! word + word ||= "" + just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") + return word if just_word.strip.length == 0 + return word if just_word.include? "~" + return "~#{word}" if just_word.length <= 2 + if just_word.length.mod_zero? 2 + center_index = just_word.length.idiv(2) - 1 + else + center_index = (just_word.length - 1).idiv(2) + end + return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" +end + +def queue_storyline args, scene + queue_storyline_text args, scene[:storyline] +end + +def queue_storyline_text args, text + args.state.last_story_line_text = text + args.state.storyline_history << text if text + words = (text || "").split(" ") + words = words.map { |w| try_centering! w } + args.state.scene_storyline_queue = words + if args.state.scene_storyline_queue.length != 0 + args.state.scene_storyline_queue.unshift "~$--" + args.state.storyline_to_show = "~." + else + args.state.storyline_to_show = "" + end + args.state.scene_storyline_queue << "" + args.state.next_storyline = args.state.tick_count +end + +def set_scene args, scene + args.state.current_scene = scene + args.state.background = scene[:background] || 'sprites/todo.png' + args.state.scene_fade = scene[:fade] || 0 + args.state.scenes = (scene[:scenes] || []).reject { |s| !s } + args.state.scene_render_override = scene[:render_override] + args.state.storylines = (scene[:storylines] || []).reject { |s| !s } + args.state.scene_changed_at = args.state.tick_count + if scene[:player] + args.state.player = scene[:player] + end + args.state.inside_scene_hotspot = false + args.state.inside_storyline_hotspot = false + queue_storyline args, scene +end + +def replay_storyline_rect + [26, -1, 7, 4] +end + +def labels_for_word word + left_side_of_word = "" + center_letter = "" + right_side_of_word = "" + + if word[0] == "~" + left_side_of_word = "" + center_letter = word[1] + right_side_of_word = word[2..-1] + elsif word.length > 0 + left_side_of_word, right_side_of_word = word.split("~") + center_letter = right_side_of_word[0] + right_side_of_word = right_side_of_word[1..-1] + end + + right_side_of_word = right_side_of_word.gsub("-", "") + + { + left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], + center: [29, 2, center_letter, 255, 0, 0], + right: [34, 2, right_side_of_word] + } +end + +def render_scenes args, lowrez_sprites + lowrez_sprites << args.state.scenes.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end +end + +def render_storylines args, lowrez_sprites + lowrez_sprites << args.state.storylines.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end +end + +def adornments_alpha args, target_alpha = nil, minimum_alpha = nil + return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at + target_alpha ||= 255 + target_alpha * args.state.storyline_queue_empty_at.ease(60) +end + +def hotspot_square args, x, y, w, h + if w >= 3 && h >= 3 + [ + [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], + [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], + [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], + ] + else + [ + [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], + ] + end +end + +def render_storyline_dialog args, lowrez_labels, lowrez_sprites + return unless args.state.is_storyline_dialog_active + return unless args.state.storyline_to_show + labels = labels_for_word args.state.storyline_to_show + if true # high rez version + scale = 8.88 + offset = 45 + size = 25 + args.outputs.labels << [offset + labels[:left].x.-(1) * scale, + labels[:left].y * TINY_SCALE + 55, + labels[:left].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + center_text = labels[:center].text + center_text = "|" if center_text == "$" + args.outputs.labels << [offset + labels[:center].x * scale, + labels[:center].y * TINY_SCALE + 55, + center_text, size, 0, 255, 0, 0, 255, + 'fonts/manaspc.ttf'] + args.outputs.labels << [offset + labels[:right].x * scale, + labels[:right].y * TINY_SCALE + 55, + labels[:right].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + else + lowrez_labels << labels[:left] + lowrez_labels << labels[:center] + lowrez_labels << labels[:right] + end + args.state.is_storyline_dialog_active = true + render_player args, lowrez_sprites + lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] +end + +def render_player args, lowrez_sprites + lowrez_sprites << player_md_down(args, *args.state.player) +end + +def render_adornments args, lowrez_sprites + render_scenes args, lowrez_sprites + render_storylines args, lowrez_sprites + return if args.state.is_storyline_dialog_active + lowrez_sprites << player_md_down(args, *args.state.player) +end + +def global_alpha_percentage args, max_alpha = 255 + return 255 unless args.state.scene_changed_at + return 255 unless args.state.scene_fade + return 255 unless args.state.scene_fade > 0 + return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) +end + +def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] + if args.state.scene_render_override + send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids + end + storyline_to_show = args.state.storyline_to_show || "" + render_adornments args, lowrez_sprites + render_storyline_dialog args, lowrez_labels, lowrez_sprites + + if args.state.background == 'sprites/tribute-game-over.png' + lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] + lowrez_labels << [9, 6, 'Return of', 255, 255, 255] + lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] + if !args.state.ended + args.gtk.stop_music + args.outputs.sounds << 'sounds/music-loop.ogg' + args.state.ended = true + end + end +end + +def player_md_right args, x, y + [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] +end + +def player_md_left args, x, y + [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] +end + +def player_md_up args, x, y + [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] +end + +def player_md_down args, x, y + [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] +end + +def player_sm args, x, y + [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +end + +def player_xs args, x, y + [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb new file mode 100644 index 0000000..a59baf5 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/repl.rb @@ -0,0 +1 @@ +puts $gtk.args.state.current_scene diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb new file mode 100644 index 0000000..35d0ff0 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/require.rb @@ -0,0 +1,11 @@ +require 'app/lowrez_simulator.rb' +require 'app/storyline_day_one.rb' +require 'app/storyline_blinking_light.rb' +require 'app/storyline_serenity_introduction.rb' +require 'app/storyline_speed_of_light.rb' +require 'app/storyline_serenity_alive.rb' +require 'app/storyline_serenity_bio.rb' +require 'app/storyline_anka.rb' +require 'app/storyline_final_message.rb' +require 'app/storyline_final_decision.rb' +require 'app/storyline.rb' diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb new file mode 100644 index 0000000..e881861 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline.rb @@ -0,0 +1,146 @@ +def hotspot_top + [4, 61, 56, 3] +end + +def hotspot_bottom + [4, 0, 56, 3] +end + +def hotspot_top_right + [62, 35, 3, 25] +end + +def hotspot_bottom_right + [62, 0, 3, 25] +end + +def storyline_history_include? args, text + args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } +end + +def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] + result_one_scene, result_one_label, result_one_text = context_result_one + result_two_scene, result_two_label, result_two_text = context_result_two + result_three_scene, result_three_label, result_three_text = context_result_three + result_four_scene, result_four_label, result_four_text = context_result_four + + top_level_hash = { + background: 'sprites/decision.png', + fade: 60, + player: [20, 36], + storylines: [ ], + scenes: [ ] + } + + confirmation_result_one_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_two_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_three_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_four_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] + top_level_hash[:storylines] << [20, 35, 4, 4, context_action] + + confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] + confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] + confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] + confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] + + confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] + confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] + confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] + confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] + confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] + confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] + confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash +end + +def ship_control_hotspot offset_x, offset_y, a, b, c, d + results = [] + results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a + results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b + results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c + results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d + results +end + +def reload_current_scene + if $gtk.args.state.last_hotspot_scene + set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) + tick $gtk.args + elsif respond_to? :set_scene + set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) + tick $gtk.args + end + $gtk.console.close +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb new file mode 100644 index 0000000..bad7795 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_anka.rb @@ -0,0 +1,127 @@ +def anka_inside_room args + { + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], + ], + scenes: [ + [32, -1, 8, 3, :anka_observatory] + ] + } +end + +def anka_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :anka_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def anka_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + storylines: [ + [22, 45, 17, 4, (anka_last_reply args)], + [45, 45, 4, 4, (anka_current_reply args)], + ], + scenes: [ + [*hotspot_top_right, :reply_to_anka] + ] + } +end + +def reply_to_anka args + decision_graph anka_current_reply(args), + "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", + [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], + [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] +end + +def anka_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end +end + +def anka_reply_whole_truth + "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." +end + +def anka_reply_half_truth + "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." +end + +def replied_with_whole_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], + ] + } +end + +def replied_with_half_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], + ] + } +end + +def anka_current_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + else + return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + end +end + +def replied_to_anka_back_home args + if args.state.scene_history.include? :replied_with_whole_truth + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_sad], + ] + } + else + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_happy], + ] + } + end +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb new file mode 100644 index 0000000..ba9e8a2 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_blinking_light.rb @@ -0,0 +1,75 @@ +def the_blinking_light args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :blinking_light_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def blinking_light_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :blinking_light_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def blinking_light_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :blinking_light_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def blinking_light_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :blinking_light_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def blinking_light_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [ + [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] + ], + scenes: [ + [30, 18, 5, 12, :blinking_light_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def blinking_light_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [62, 32, 4, 32, :reply_to_introduction] + ], + storylines: [ + [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], + [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], + [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], + [14, 20, 24, 4, "What the heck activated--- this thing- though?"] + ] + } +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb new file mode 100644 index 0000000..24b2b45 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_day_one.rb @@ -0,0 +1,206 @@ +def day_one_beginning args + { + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [0, 0, 64, 2, :day_one_infront_of_home], + ], + storylines: [ + [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] + ] + } +end + +def day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [56, 23], + scenes: [ + [43, 34, 10, 16, :day_one_home], + [62, 0, 3, 40, :day_one_beginning], + [0, 4, 3, 20, :day_one_ceremony] + ], + storylines: [ + [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], + ] + } +end + +def day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [28, 0, 12, 2, :day_one_infront_of_home] + ], + storylines: [ + [ + 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." + ], + [ + 28, 7, 4, 7, + "Ahhh. My reading- couch. It's so comfortable--." + ], + [ + 38, 21, 4, 4, + "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." + ], + [ + 45, 37, 4, 8, + "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." + ], + [ + 32, 40, 8, 10, + "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." + ], + [ + 25, 21, 5, 12, + "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." + ] + ] + } +end + +def day_one_ceremony args + { + background: 'sprites/tribute.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_infront_of_home], + [0, 24, 2, 40, :day_one_infront_of_library] + ], + storylines: [ + [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], + [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], + [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], + [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], + ] + } +end + +def day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_ceremony], + [49, 39, 6, 9, :day_one_library] + ], + storylines: [ + [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] + ] + } +end + +def day_one_library args + { + background: 'sprites/library.png', + player: [27, 4], + scenes: [ + [0, 0, 64, 2, :end_day_one_infront_of_library] + ], + storylines: [ + [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], + [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] + ] + } +end + +def end_day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [51, 33], + scenes: [ + [49, 39, 6, 9, :day_one_library], + [62, 0, 2, 40, :end_day_one_monument], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."] + ] + } +end + +def end_day_one_monument args + { + background: 'sprites/tribute.png', + player: [2, 36], + scenes: [ + [62, 0, 2, 40, :end_day_one_infront_of_home], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [1, 17], + scenes: [ + [43, 34, 10, 16, :end_day_one_home], + ], + storylines: [ + [20, 10, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [32, 40, 8, 10, :end_day_one_dream], + ], + storylines: [ + [38, 4, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_dream args + { + background: 'sprites/dream.png', + fade: 60, + player: [4, 4], + scenes: [ + [62, 0, 2, 64, :explaining_the_special_power] + ], + storylines: [ + [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], + [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], + [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] + ] + } +end + +def explaining_the_special_power args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [32, 30], + scenes: [ + [ + 38, 21, 4, 4, :explaining_the_special_power_inside_computer + ], + ] + } +end + +def explaining_the_special_power_inside_computer args + { + background: 'sprites/pc.png', + fade: 60, + player: [34, 4], + scenes: [ + [0, 62, 64, 3, :the_blinking_light] + ], + storylines: [ + [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], + [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], + [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], + [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] + ] + } +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb new file mode 100644 index 0000000..0ea190f --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_decision.rb @@ -0,0 +1,136 @@ +def final_decision_side_of_home args + { + fade: 120, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_decision_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render, + storylines: [ + [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] + ] + } +end + +def final_decision_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_decision_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def final_decision_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_decision_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def final_decision_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :final_decision_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def final_decision_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :final_decision_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def final_decision_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + storylines: [], + scenes: [ + [*hotspot_top, :final_decision_ship_status], + ] + } +end + +def final_decision_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [*hotspot_top_right, :final_decision] + ], + storylines: [ + [30, 8, 4, 4, "????"], + *final_decision_ship_status_shared(args) + ] + } +end + +def final_decision args + decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", + "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", + [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], + [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], + [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], + [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] +end + +def final_decision_game_over_noone args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_matthew args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_anka args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_sasha args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_ship_status_shared args + [ + *ship_control_hotspot(24, 22, + "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", + "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), + ] +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb new file mode 100644 index 0000000..c7737e2 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_final_message.rb @@ -0,0 +1,216 @@ +def final_message_sad args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Another-- sleepless-- night..."], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } +end + +def final_message_happy args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Oh man, I slept like rock!"], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } +end + +def final_message_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_message_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def final_message_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_message_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def final_message_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_message_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def final_message_observatory args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Here-- we- go..."] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end +end + +def final_message_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] + } +end + +def final_message_check_ship_status args + { + background: 'sprites/mainframe.png', + storylines: [ + [45, 45, 4, 4, (final_message_current args)], + ], + scenes: [ + [*hotspot_top, :final_message_ship_status], + ] + } +end + +def final_message_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :final_message_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], + *final_message_ship_status_shared(args) + ] + } +end + +def final_message_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :final_message_summary] + ], + storylines: [ + [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], + ] + } +end + +def final_message_ship_status_shared args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", + "Matthew's--- Chamber--: OCCUPIED----", + "Aanka's--- Chamber--: OCCUPIED----", + "Sasha's--- Chamber--: OCCUPIED----"), + *ship_control_hotspot(12, 35, + "Life- Support--: Not-- Needed---", + "O2--- Production---: OFF---", + "CO2--- Scrubbers---: OFF---", + "H2O--- Production---: OFF---"), + *ship_control_hotspot(24, 20, + "Navigation: Offline---", + "Sensor: OFF---", + "Heads- Up- Display: DAMAGED---", + "Arithmetic--- Unit: DAMAGED----"), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----", + "Text: ON---", + "Audio: SEGFAULT---", + "Video: DAMAGED---"), + *ship_control_hotspot(48, 50, + "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", + "Engine I: ON---", + "Engine II: ON---", + "Engine III: ON---") + ] +end + +def final_message_last_reply args + if args.state.scene_history.include? :replied_with_whole_truth + return "Buffer--: #{anka_reply_whole_truth.quote}" + else + return "Buffer--: #{anka_reply_half_truth.quote}" + end +end + +def final_message_current args + if args.state.scene_history.include? :replied_with_whole_truth + return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." + else + return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" + end +end + +def final_message_summary args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], + ] + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], + ] + } + end +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb new file mode 100644 index 0000000..4407699 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_alive.rb @@ -0,0 +1,219 @@ +def serenity_alive_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :serenity_alive_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def serenity_alive_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :serenity_alive_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def serenity_alive_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :serenity_alive_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def serenity_alive_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :serenity_alive_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def serenity_alive_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :serenity_alive_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def serenity_alive_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [*hotspot_top, :serenity_alive_ship_status], + ], + storylines: [ + [22, 45, 17, 4, (serenity_alive_last_reply args)], + [45, 45, 4, 4, (serenity_alive_current_message args)], + ] + } +end + +def serenity_alive_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], + [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], + *serenity_alive_shared_ship_status(args) + ] + } +end + +def serenity_alive_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :serenity_alive_time_to_reply] + ], + storylines: [ + [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], + ] + } +end + +def serenity_alive_time_to_reply args + decision_graph serenity_alive_current_message(args), + "Okay... time to deliver the bad news...", + [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], + [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] +end + +def serenity_alive_shared_ship_status args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", + nil, + nil, + nil), + *ship_control_hotspot(12, 35, + "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", + nil, + nil, + nil), + *ship_control_hotspot(24, 20, + "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", + nil, + nil, + nil), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", + nil, + nil, + nil), + *ship_control_hotspot(48, 50, + "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", + nil, + nil, + nil) + ] +end + +def serenity_alive_firm_reply + "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." +end + +def serenity_alive_sugarcoated_reply + "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." +end + +def replied_to_serenity_alive_firmly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } +end + +def replied_to_serenity_alive_kindly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } +end + +def serenity_alive_path_from_observatory args + { + fade: 60, + background: 'sprites/path-to-observatory.png', + player: [4, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_bio_infront_of_home] + ], + storylines: [ + [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] + ] + } +end + +def serenity_alive_reply_completed_shared_hotspots args + [ + [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], + [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], + [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] + ] +end + +def serenity_alive_last_reply args + if args.state.scene_history.include? :replied_to_introduction_seriously + return "Buffer--: \"Hello, Who- is sending-- this message--?\"" + else + return "Buffer--: \"New- phone. Who dis?\"" + end +end + +def serenity_alive_current_message args + if args.state.scene_history.include? :replied_to_introduction_seriously + "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote + else + "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote + end +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb new file mode 100644 index 0000000..587f5f4 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_bio.rb @@ -0,0 +1,151 @@ +def serenity_bio_infront_of_home args + { + fade: 60, + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :serenity_bio_inside_home], + [0, 3, 3, 22, :serenity_bio_library] + ] + } +end + +def serenity_bio_inside_home args + { + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I'm--- completely--- exhausted."], + ], + scenes: [ + [30, 38, 12, 13, :serenity_bio_restless_sleep], + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } +end + +def serenity_bio_restless_sleep args + { + fade: 60, + background: 'sprites/inside-home.png', + storylines: [ + [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], + ], + scenes: [ + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } +end + +def serenity_bio_library args + { + background: 'sprites/library.png', + fade: 60, + player: [30, 7], + scenes: [ + [21, 35, 3, 18, :serenity_bio_book] + ] + } +end + +def serenity_bio_book args + { + background: 'sprites/book.png', + fade: 60, + player: [6, 52], + storylines: [ + [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], + + [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], + [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], + + [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], + [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], + + [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], + [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], + ], + scenes: [ + [*hotspot_bottom, :serenity_bio_finally_to_bed] + ] + } +end + +def serenity_bio_finally_to_bed args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 3], + storylines: [ + [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], + ], + scenes: [ + [32, 38, 10, 13, :bad_dream], + ] + } +end + +def bad_dream args + { + fade: 120, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], + ], + scenes: [ + [32, -1, 8, 3, :bad_dream_observatory] + ] + } +end + +def bad_dream_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 120, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :bad_dream_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def bad_dream_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 120, + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + ], + scenes: [ + [45, 45, 4, 4, :bad_dream_everyone_dead], + ] + } +end + +def bad_dream_everyone_dead args + { + background: 'sprites/mainframe.png', + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], + [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], + ], + scenes: [ + [*hotspot_bottom, :anka_inside_room] + ] + } +end + +def bad_dream_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb new file mode 100644 index 0000000..d1a5a50 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_serenity_introduction.rb @@ -0,0 +1,95 @@ +# decision_graph "Message from Sasha", +# "I should reply.", +# [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], +# [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] +def reply_to_introduction args + decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", + "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", + [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], + [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] +end + +def replied_to_introduction_seriously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], + *replied_to_introduction_shared_storylines(args) + ] + } +end + +def replied_to_introduction_humorously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], + *replied_to_introduction_shared_storylines(args) + ] + } +end + +def replied_to_introduction_shared_storylines args + [ + [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], + [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], + [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] + ] +end + +def replied_to_introduction_shared_scenes args + [[60, 0, 4, 32, :replied_to_introduction_observatory]] +end + +def replied_to_introduction_observatory args + { + background: 'sprites/observatory.png', + player: [28, 39], + scenes: [ + [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] + ] + } +end + +def replied_to_introduction_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [0, 26], + scenes: [ + [60, 0, 4, 20, :replied_to_introduction_mountain_pass] + ], + } +end + +def replied_to_introduction_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [21, 48], + scenes: [ + [0, 0, 15, 4, :replied_to_introduction_side_of_home] + ], + storylines: [ + [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] + ] + } +end + +def replied_to_introduction_side_of_home args + { + background: 'sprites/side-of-home.png', + player: [58, 29], + scenes: [ + [2, 0, 61, 2, :speed_of_light_front_of_home] + ], + } +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb new file mode 100644 index 0000000..fdd6b47 --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/app/storyline_speed_of_light.rb @@ -0,0 +1,104 @@ +def speed_of_light_front_of_home args + { + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :speed_of_light_inside_home], + [0, 3, 3, 22, :speed_of_light_outside_library] + ] + } +end + +def speed_of_light_inside_home args + { + background: 'sprites/inside-home.png', + player: [35, 4], + storylines: [ + [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] + ], + scenes: [ + [32, 0, 8, 3, :speed_of_light_front_of_home], + ] + } +end + +def speed_of_light_outside_library args + { + background: 'sprites/outside-library.png', + player: [55, 19], + scenes: [ + [49, 39, 6, 10, :speed_of_light_library], + [61, 11, 3, 20, :speed_of_light_front_of_home] + ] + } +end + +def speed_of_light_library args + { + background: 'sprites/library.png', + player: [30, 7], + scenes: [ + [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] + ] + } +end + +def speed_of_light_celestial_bodies_diagram args + { + background: 'sprites/planets.png', + fade: 60, + player: [30, 3], + scenes: [ + [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] + ], + storylines: [ + [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], + + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], + ] + } +end + +def speed_of_light_distance_discovered args + { + background: 'sprites/planets.png', + scenes: [ + [13, 0, 44, 3, :speed_of_light_end_of_day] + ], + storylines: [ + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], + ] + } +end + +def speed_of_light_end_of_day args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 0], + storylines: [ + [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] + ], + scenes: [ + [31, 38, 10, 12, :serenity_alive_side_of_home] + ] + } +end diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf b/samples/99_genre_rpg_narrative/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf new file mode 100644 index 0000000..24cc711 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/fonts/dragonruby-gtk-4x4.ttf differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/fonts/manaspc.ttf b/samples/99_genre_rpg_narrative/return_of_serenity/fonts/manaspc.ttf new file mode 100644 index 0000000..0c56733 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/fonts/manaspc.ttf differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/license-for-sample.txt b/samples/99_genre_rpg_narrative/return_of_serenity/license-for-sample.txt new file mode 100644 index 0000000..b1005ed --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC, Amir Rajan + +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/99_genre_rpg_narrative/return_of_serenity/replay.txt b/samples/99_genre_rpg_narrative/return_of_serenity/replay.txt new file mode 100644 index 0000000..428883e --- /dev/null +++ b/samples/99_genre_rpg_narrative/return_of_serenity/replay.txt @@ -0,0 +1,793 @@ +replay_version 2.0 +stopped_at 2284 +seed 100 +recorded_at Sun Sep 29 23:33:07 2019 +[:mouse_move, 758, 597, 2, 1, 353] +[:mouse_move, 556, 669, 2, 2, 353] +[:mouse_move, 550, 669, 2, 3, 353] +[:mouse_move, 543, 670, 2, 4, 357] +[:mouse_move, 540, 670, 2, 5, 358] +[:mouse_move, 536, 670, 2, 6, 359] +[:mouse_move, 535, 670, 2, 7, 360] +[:mouse_move, 534, 669, 2, 8, 361] +[:mouse_move, 533, 668, 2, 9, 362] +[:mouse_move, 534, 667, 2, 10, 364] +[:mouse_move, 539, 666, 2, 11, 365] +[:mouse_move, 564, 665, 2, 12, 366] +[:mouse_move, 580, 665, 2, 13, 367] +[:mouse_move, 598, 665, 2, 14, 368] +[:mouse_move, 611, 666, 2, 15, 369] +[:mouse_move, 623, 668, 2, 16, 370] +[:mouse_move, 629, 669, 2, 17, 371] +[:mouse_move, 637, 672, 2, 18, 372] +[:mouse_move, 638, 673, 2, 19, 373] +[:mouse_move, 642, 677, 2, 20, 374] +[:mouse_move, 645, 680, 2, 21, 375] +[:mouse_move, 655, 686, 2, 22, 376] +[:mouse_move, 664, 690, 2, 23, 377] +[:mouse_move, 686, 694, 2, 24, 378] +[:mouse_move, 699, 696, 2, 25, 379] +[:mouse_move, 717, 697, 2, 26, 380] +[:mouse_move, 728, 698, 2, 27, 381] +[:mouse_move, 745, 698, 2, 28, 382] +[:mouse_move, 748, 698, 2, 29, 383] +[:mouse_move, 757, 698, 2, 30, 384] +[:mouse_move, 761, 698, 2, 31, 385] +[:mouse_move, 766, 698, 2, 32, 386] +[:mouse_move, 769, 698, 2, 33, 387] +[:mouse_move, 771, 699, 2, 34, 388] +[:mouse_move, 773, 699, 2, 35, 389] +[:mouse_move, 774, 699, 2, 36, 390] +[:mouse_move, 775, 699, 2, 37, 391] +[:mouse_move, 768, 699, 2, 38, 393] +[:mouse_move, 762, 698, 2, 39, 394] +[:mouse_move, 748, 695, 2, 40, 395] +[:mouse_move, 733, 693, 2, 41, 396] +[:mouse_move, 712, 689, 2, 42, 397] +[:mouse_move, 700, 688, 2, 43, 398] +[:mouse_move, 675, 685, 2, 44, 399] +[:mouse_move, 661, 684, 2, 45, 400] +[:mouse_move, 631, 684, 2, 46, 401] +[:mouse_move, 615, 684, 2, 47, 402] +[:mouse_move, 595, 685, 2, 48, 403] +[:mouse_move, 582, 685, 2, 49, 404] +[:mouse_move, 564, 687, 2, 50, 405] +[:mouse_move, 558, 688, 2, 51, 406] +[:mouse_move, 551, 689, 2, 52, 407] +[:mouse_move, 547, 689, 2, 53, 408] +[:mouse_move, 543, 690, 2, 54, 409] +[:mouse_move, 541, 690, 2, 55, 410] +[:mouse_move, 540, 690, 2, 56, 411] +[:mouse_move, 539, 690, 2, 57, 412] +[:mouse_move, 547, 691, 2, 58, 416] +[:mouse_move, 559, 692, 2, 59, 417] +[:mouse_move, 592, 697, 2, 60, 418] +[:mouse_move, 613, 698, 2, 61, 419] +[:mouse_move, 645, 701, 2, 62, 420] +[:mouse_move, 664, 701, 2, 63, 421] +[:mouse_move, 687, 702, 2, 64, 422] +[:mouse_move, 700, 702, 2, 65, 423] +[:mouse_move, 717, 702, 2, 66, 424] +[:mouse_move, 720, 702, 2, 67, 425] +[:mouse_move, 728, 702, 2, 68, 426] +[:mouse_move, 731, 702, 2, 69, 427] +[:mouse_move, 735, 702, 2, 70, 428] +[:mouse_move, 736, 702, 2, 71, 429] +[:mouse_move, 737, 702, 2, 72, 430] +[:mouse_move, 735, 702, 2, 73, 432] +[:mouse_move, 730, 702, 2, 74, 433] +[:mouse_move, 716, 702, 2, 75, 434] +[:mouse_move, 707, 701, 2, 76, 435] +[:mouse_move, 684, 700, 2, 77, 436] +[:mouse_move, 672, 699, 2, 78, 437] +[:mouse_move, 645, 698, 2, 79, 438] +[:mouse_move, 640, 698, 2, 80, 439] +[:mouse_move, 619, 698, 2, 81, 440] +[:mouse_move, 609, 698, 2, 82, 441] +[:mouse_move, 603, 698, 2, 83, 442] +[:mouse_move, 595, 698, 2, 84, 443] +[:mouse_move, 591, 698, 2, 85, 444] +[:mouse_move, 586, 699, 2, 86, 445] +[:mouse_move, 585, 699, 2, 87, 446] +[:mouse_move, 583, 699, 2, 88, 447] +[:mouse_move, 587, 699, 2, 89, 451] +[:mouse_move, 593, 699, 2, 90, 452] +[:mouse_move, 608, 700, 2, 91, 453] +[:mouse_move, 618, 700, 2, 92, 454] +[:mouse_move, 643, 700, 2, 93, 455] +[:mouse_move, 655, 700, 2, 94, 456] +[:mouse_move, 671, 700, 2, 95, 457] +[:mouse_move, 681, 700, 2, 96, 458] +[:mouse_move, 692, 700, 2, 97, 459] +[:mouse_move, 698, 700, 2, 98, 460] +[:mouse_move, 705, 700, 2, 99, 461] +[:mouse_move, 706, 700, 2, 100, 462] +[:mouse_move, 708, 700, 2, 101, 463] +[:mouse_move, 709, 700, 2, 102, 464] +[:mouse_move, 708, 700, 2, 103, 465] +[:mouse_move, 703, 700, 2, 104, 466] +[:mouse_move, 689, 700, 2, 105, 467] +[:mouse_move, 680, 700, 2, 106, 468] +[:mouse_move, 670, 700, 2, 107, 469] +[:mouse_move, 644, 700, 2, 108, 470] +[:mouse_move, 631, 700, 2, 109, 471] +[:mouse_move, 612, 700, 2, 110, 472] +[:mouse_move, 600, 700, 2, 111, 473] +[:mouse_move, 582, 700, 2, 112, 474] +[:mouse_move, 579, 700, 2, 113, 475] +[:mouse_move, 570, 700, 2, 114, 476] +[:mouse_move, 567, 700, 2, 115, 477] +[:mouse_move, 564, 700, 2, 116, 478] +[:mouse_move, 563, 700, 2, 117, 479] +[:mouse_move, 562, 700, 2, 118, 480] +[:mouse_move, 563, 700, 2, 119, 482] +[:mouse_move, 568, 701, 2, 120, 483] +[:mouse_move, 584, 702, 2, 121, 484] +[:mouse_move, 606, 703, 2, 122, 485] +[:mouse_move, 632, 704, 2, 123, 486] +[:mouse_move, 649, 705, 2, 124, 487] +[:mouse_move, 669, 706, 2, 125, 488] +[:mouse_move, 673, 706, 2, 126, 489] +[:mouse_move, 689, 706, 2, 127, 490] +[:mouse_move, 694, 706, 2, 128, 491] +[:mouse_move, 698, 706, 2, 129, 492] +[:mouse_move, 693, 706, 2, 130, 495] +[:mouse_move, 685, 706, 2, 131, 496] +[:mouse_move, 663, 705, 2, 132, 497] +[:mouse_move, 649, 704, 2, 133, 498] +[:mouse_move, 620, 703, 2, 134, 499] +[:mouse_move, 614, 703, 2, 135, 500] +[:mouse_move, 601, 703, 2, 136, 501] +[:mouse_move, 595, 703, 2, 137, 502] +[:mouse_move, 589, 703, 2, 138, 503] +[:mouse_move, 587, 703, 2, 139, 504] +[:mouse_move, 586, 704, 2, 140, 505] +[:mouse_move, 591, 704, 2, 141, 507] +[:mouse_move, 597, 704, 2, 142, 508] +[:mouse_move, 613, 705, 2, 143, 509] +[:mouse_move, 618, 705, 2, 144, 510] +[:mouse_move, 633, 705, 2, 145, 511] +[:mouse_move, 641, 705, 2, 146, 512] +[:mouse_move, 648, 705, 2, 147, 513] +[:mouse_move, 651, 705, 2, 148, 514] +[:mouse_move, 654, 705, 2, 149, 515] +[:mouse_move, 655, 705, 2, 150, 516] +[:mouse_move, 657, 705, 2, 151, 517] +[:mouse_move, 658, 705, 2, 152, 565] +[:mouse_move, 651, 701, 2, 153, 611] +[:mouse_move, 645, 699, 2, 154, 612] +[:mouse_move, 625, 692, 2, 155, 613] +[:mouse_move, 611, 689, 2, 156, 614] +[:mouse_move, 590, 687, 2, 157, 615] +[:mouse_move, 578, 687, 2, 158, 616] +[:mouse_move, 564, 687, 2, 159, 617] +[:mouse_move, 559, 687, 2, 160, 618] +[:mouse_move, 553, 687, 2, 161, 619] +[:mouse_move, 551, 687, 2, 162, 620] +[:mouse_move, 550, 687, 2, 163, 621] +[:mouse_move, 553, 688, 2, 164, 623] +[:mouse_move, 558, 690, 2, 165, 624] +[:mouse_move, 578, 694, 2, 166, 625] +[:mouse_move, 591, 696, 2, 167, 626] +[:mouse_move, 634, 703, 2, 168, 627] +[:mouse_move, 645, 704, 2, 169, 628] +[:mouse_move, 682, 708, 2, 170, 629] +[:mouse_move, 698, 709, 2, 171, 630] +[:mouse_move, 704, 710, 2, 172, 631] +[:mouse_move, 720, 710, 2, 173, 632] +[:mouse_move, 726, 710, 2, 174, 633] +[:mouse_move, 732, 710, 2, 175, 634] +[:mouse_move, 733, 710, 2, 176, 635] +[:mouse_move, 729, 710, 2, 177, 637] +[:mouse_move, 716, 710, 2, 178, 638] +[:mouse_move, 711, 710, 2, 179, 639] +[:mouse_move, 693, 710, 2, 180, 640] +[:mouse_move, 684, 710, 2, 181, 641] +[:mouse_move, 669, 710, 2, 182, 642] +[:mouse_move, 663, 709, 2, 183, 643] +[:mouse_move, 652, 708, 2, 184, 644] +[:mouse_move, 650, 707, 2, 185, 645] +[:mouse_move, 644, 705, 2, 186, 646] +[:mouse_move, 641, 705, 2, 187, 647] +[:mouse_move, 638, 703, 2, 188, 648] +[:mouse_move, 636, 702, 2, 189, 649] +[:mouse_move, 631, 699, 2, 190, 650] +[:mouse_move, 628, 696, 2, 191, 651] +[:mouse_move, 622, 690, 2, 192, 652] +[:mouse_move, 619, 686, 2, 193, 653] +[:mouse_move, 613, 675, 2, 194, 654] +[:mouse_move, 610, 669, 2, 195, 655] +[:mouse_move, 601, 656, 2, 196, 656] +[:mouse_move, 597, 650, 2, 197, 657] +[:mouse_move, 592, 644, 2, 198, 658] +[:mouse_move, 583, 634, 2, 199, 659] +[:mouse_move, 582, 632, 2, 200, 660] +[:mouse_move, 575, 626, 2, 201, 661] +[:mouse_move, 573, 624, 2, 202, 662] +[:mouse_move, 566, 619, 2, 203, 663] +[:mouse_move, 564, 617, 2, 204, 664] +[:mouse_move, 558, 612, 2, 205, 665] +[:mouse_move, 554, 609, 2, 206, 666] +[:mouse_move, 545, 601, 2, 207, 667] +[:mouse_move, 540, 596, 2, 208, 668] +[:mouse_move, 532, 588, 2, 209, 669] +[:mouse_move, 527, 584, 2, 210, 670] +[:mouse_move, 522, 579, 2, 211, 671] +[:mouse_move, 518, 576, 2, 212, 672] +[:mouse_move, 514, 571, 2, 213, 673] +[:mouse_move, 512, 570, 2, 214, 674] +[:mouse_move, 508, 568, 2, 215, 675] +[:mouse_move, 507, 567, 2, 216, 677] +[:mouse_move, 506, 567, 2, 217, 678] +[:mouse_move, 506, 568, 2, 218, 679] +[:mouse_move, 506, 570, 2, 219, 680] +[:mouse_move, 510, 580, 2, 220, 681] +[:mouse_move, 514, 586, 2, 221, 682] +[:mouse_move, 523, 596, 2, 222, 683] +[:mouse_move, 526, 597, 2, 223, 684] +[:mouse_move, 533, 602, 2, 224, 685] +[:mouse_move, 536, 603, 2, 225, 686] +[:mouse_move, 537, 604, 2, 226, 687] +[:mouse_move, 541, 603, 2, 227, 688] +[:mouse_move, 542, 601, 2, 228, 689] +[:mouse_move, 546, 594, 2, 229, 690] +[:mouse_move, 548, 590, 2, 230, 691] +[:mouse_move, 551, 580, 2, 231, 692] +[:mouse_move, 552, 575, 2, 232, 693] +[:mouse_move, 554, 568, 2, 233, 694] +[:mouse_move, 555, 563, 2, 234, 695] +[:mouse_move, 556, 556, 2, 235, 696] +[:mouse_move, 556, 552, 2, 236, 697] +[:mouse_move, 556, 548, 2, 237, 698] +[:mouse_move, 555, 545, 2, 238, 699] +[:mouse_move, 550, 541, 2, 239, 700] +[:mouse_move, 547, 539, 2, 240, 701] +[:mouse_move, 539, 536, 2, 241, 702] +[:mouse_move, 536, 535, 2, 242, 703] +[:mouse_move, 527, 534, 2, 243, 704] +[:mouse_move, 525, 534, 2, 244, 705] +[:mouse_move, 518, 534, 2, 245, 706] +[:mouse_move, 516, 534, 2, 246, 707] +[:mouse_move, 511, 536, 2, 247, 708] +[:mouse_move, 509, 537, 2, 248, 709] +[:mouse_move, 506, 540, 2, 249, 710] +[:mouse_move, 505, 542, 2, 250, 711] +[:mouse_move, 503, 545, 2, 251, 712] +[:mouse_move, 503, 551, 2, 252, 713] +[:mouse_move, 503, 554, 2, 253, 714] +[:mouse_move, 503, 565, 2, 254, 715] +[:mouse_move, 504, 570, 2, 255, 716] +[:mouse_move, 511, 582, 2, 256, 717] +[:mouse_move, 515, 586, 2, 257, 718] +[:mouse_move, 521, 591, 2, 258, 719] +[:mouse_move, 524, 593, 2, 259, 720] +[:mouse_move, 530, 594, 2, 260, 721] +[:mouse_move, 535, 594, 2, 261, 722] +[:mouse_move, 538, 592, 2, 262, 723] +[:mouse_move, 540, 589, 2, 263, 724] +[:mouse_move, 542, 583, 2, 264, 725] +[:mouse_move, 543, 579, 2, 265, 726] +[:mouse_move, 543, 574, 2, 266, 727] +[:mouse_move, 543, 571, 2, 267, 728] +[:mouse_move, 543, 568, 2, 268, 729] +[:mouse_move, 543, 567, 2, 269, 730] +[:mouse_move, 543, 566, 2, 270, 731] +[:mouse_move, 544, 566, 2, 271, 749] +[:mouse_move, 547, 565, 2, 272, 750] +[:mouse_move, 548, 565, 2, 273, 751] +[:mouse_move, 550, 564, 2, 274, 752] +[:mouse_move, 551, 564, 2, 275, 753] +[:mouse_move, 552, 563, 2, 276, 754] +[:mouse_move, 553, 562, 2, 277, 755] +[:mouse_move, 552, 562, 2, 278, 761] +[:mouse_move, 552, 564, 2, 279, 762] +[:mouse_move, 552, 565, 2, 280, 763] +[:mouse_move, 552, 569, 2, 281, 764] +[:mouse_move, 552, 572, 2, 282, 765] +[:mouse_move, 556, 581, 2, 283, 766] +[:mouse_move, 559, 586, 2, 284, 767] +[:mouse_move, 563, 592, 2, 285, 768] +[:mouse_move, 574, 601, 2, 286, 769] +[:mouse_move, 580, 605, 2, 287, 770] +[:mouse_move, 591, 610, 2, 288, 771] +[:mouse_move, 597, 611, 2, 289, 772] +[:mouse_move, 607, 611, 2, 290, 773] +[:mouse_move, 611, 609, 2, 291, 774] +[:mouse_move, 617, 599, 2, 292, 775] +[:mouse_move, 619, 593, 2, 293, 776] +[:mouse_move, 619, 579, 2, 294, 777] +[:mouse_move, 619, 572, 2, 295, 778] +[:mouse_move, 615, 560, 2, 296, 779] +[:mouse_move, 612, 556, 2, 297, 780] +[:mouse_move, 604, 548, 2, 298, 781] +[:mouse_move, 602, 547, 2, 299, 782] +[:mouse_move, 597, 543, 2, 300, 783] +[:mouse_move, 592, 541, 2, 301, 784] +[:mouse_move, 586, 539, 2, 302, 785] +[:mouse_move, 583, 539, 2, 303, 786] +[:mouse_move, 576, 539, 2, 304, 787] +[:mouse_move, 574, 539, 2, 305, 788] +[:mouse_move, 569, 539, 2, 306, 789] +[:mouse_move, 567, 539, 2, 307, 790] +[:mouse_move, 564, 540, 2, 308, 791] +[:mouse_move, 563, 540, 2, 309, 792] +[:mouse_move, 560, 543, 2, 310, 793] +[:mouse_move, 559, 546, 2, 311, 794] +[:mouse_move, 559, 549, 2, 312, 795] +[:mouse_move, 559, 557, 2, 313, 796] +[:mouse_move, 559, 562, 2, 314, 797] +[:mouse_move, 563, 571, 2, 315, 798] +[:mouse_move, 566, 576, 2, 316, 799] +[:mouse_move, 572, 582, 2, 317, 800] +[:mouse_move, 575, 584, 2, 318, 801] +[:mouse_move, 586, 587, 2, 319, 802] +[:mouse_move, 590, 587, 2, 320, 803] +[:mouse_move, 601, 587, 2, 321, 804] +[:mouse_move, 606, 585, 2, 322, 805] +[:mouse_move, 612, 583, 2, 323, 806] +[:mouse_move, 615, 580, 2, 324, 807] +[:mouse_move, 620, 575, 2, 325, 808] +[:mouse_move, 621, 570, 2, 326, 809] +[:mouse_move, 620, 563, 2, 327, 810] +[:mouse_move, 617, 557, 2, 328, 811] +[:mouse_move, 613, 552, 2, 329, 812] +[:mouse_move, 610, 549, 2, 330, 813] +[:mouse_move, 607, 546, 2, 331, 814] +[:mouse_move, 606, 545, 2, 332, 815] +[:mouse_move, 605, 545, 2, 333, 816] +[:mouse_move, 605, 549, 2, 334, 831] +[:mouse_move, 605, 552, 2, 335, 832] +[:mouse_move, 605, 559, 2, 336, 833] +[:mouse_move, 605, 565, 2, 337, 834] +[:mouse_move, 609, 583, 2, 338, 835] +[:mouse_move, 613, 592, 2, 339, 836] +[:mouse_move, 622, 605, 2, 340, 837] +[:mouse_move, 628, 611, 2, 341, 838] +[:mouse_move, 635, 616, 2, 342, 839] +[:mouse_move, 638, 619, 2, 343, 840] +[:mouse_move, 642, 620, 2, 344, 841] +[:mouse_move, 644, 621, 2, 345, 842] +[:mouse_move, 646, 621, 2, 346, 843] +[:mouse_move, 647, 621, 2, 347, 845] +[:mouse_move, 651, 622, 2, 348, 847] +[:mouse_move, 654, 624, 2, 349, 848] +[:mouse_move, 660, 627, 2, 350, 849] +[:mouse_move, 676, 632, 2, 351, 850] +[:mouse_move, 687, 635, 2, 352, 851] +[:mouse_move, 713, 637, 2, 353, 852] +[:mouse_move, 728, 637, 2, 354, 853] +[:mouse_move, 755, 635, 2, 355, 854] +[:mouse_move, 769, 630, 2, 356, 855] +[:mouse_move, 784, 621, 2, 357, 856] +[:mouse_move, 792, 614, 2, 358, 857] +[:mouse_move, 809, 593, 2, 359, 858] +[:mouse_move, 811, 584, 2, 360, 859] +[:mouse_move, 812, 571, 2, 361, 860] +[:mouse_move, 812, 556, 2, 362, 861] +[:mouse_move, 805, 540, 2, 363, 862] +[:mouse_move, 796, 531, 2, 364, 863] +[:mouse_move, 782, 518, 2, 365, 864] +[:mouse_move, 773, 511, 2, 366, 865] +[:mouse_move, 757, 502, 2, 367, 866] +[:mouse_move, 749, 499, 2, 368, 867] +[:mouse_move, 735, 496, 2, 369, 868] +[:mouse_move, 722, 496, 2, 370, 869] +[:mouse_move, 710, 496, 2, 371, 870] +[:mouse_move, 702, 498, 2, 372, 871] +[:mouse_move, 687, 506, 2, 373, 872] +[:mouse_move, 680, 511, 2, 374, 873] +[:mouse_move, 665, 528, 2, 375, 874] +[:mouse_move, 661, 535, 2, 376, 875] +[:mouse_move, 657, 544, 2, 377, 876] +[:mouse_move, 653, 557, 2, 378, 877] +[:mouse_move, 652, 567, 2, 379, 878] +[:mouse_move, 652, 590, 2, 380, 879] +[:mouse_move, 652, 599, 2, 381, 880] +[:mouse_move, 666, 616, 2, 382, 881] +[:mouse_move, 677, 625, 2, 383, 882] +[:mouse_move, 702, 638, 2, 384, 883] +[:mouse_move, 717, 643, 2, 385, 884] +[:mouse_move, 747, 649, 2, 386, 885] +[:mouse_move, 761, 650, 2, 387, 886] +[:mouse_move, 780, 650, 2, 388, 887] +[:mouse_move, 790, 647, 2, 389, 888] +[:mouse_move, 810, 634, 2, 390, 889] +[:mouse_move, 814, 625, 2, 391, 890] +[:mouse_move, 817, 606, 2, 392, 891] +[:mouse_move, 817, 595, 2, 393, 892] +[:mouse_move, 809, 570, 2, 394, 893] +[:mouse_move, 801, 559, 2, 395, 894] +[:mouse_move, 784, 540, 2, 396, 895] +[:mouse_move, 780, 537, 2, 397, 896] +[:mouse_move, 765, 526, 2, 398, 897] +[:mouse_move, 758, 522, 2, 399, 898] +[:mouse_move, 747, 518, 2, 400, 899] +[:mouse_move, 742, 517, 2, 401, 900] +[:key_down_raw, 1073741905, 0, 2, 402, 940] +[:key_up_raw, 1073741905, 0, 2, 403, 944] +[:key_down_raw, 1073741905, 0, 2, 404, 949] +[:key_up_raw, 1073741905, 0, 2, 405, 954] +[:key_down_raw, 1073741905, 0, 2, 406, 968] +[:key_up_raw, 1073741905, 0, 2, 407, 972] +[:key_down_raw, 1073741903, 0, 2, 408, 974] +[:key_down_raw, 1073741903, 0, 2, 409, 999] +[:key_down_raw, 1073741903, 0, 2, 410, 1001] +[:key_down_raw, 1073741903, 0, 2, 411, 1003] +[:key_down_raw, 1073741903, 0, 2, 412, 1005] +[:key_down_raw, 1073741903, 0, 2, 413, 1007] +[:key_down_raw, 1073741903, 0, 2, 414, 1009] +[:key_down_raw, 1073741903, 0, 2, 415, 1011] +[:key_down_raw, 1073741903, 0, 2, 416, 1013] +[:key_down_raw, 1073741903, 0, 2, 417, 1015] +[:key_down_raw, 1073741903, 0, 2, 418, 1017] +[:key_down_raw, 1073741903, 0, 2, 419, 1019] +[:key_down_raw, 1073741903, 0, 2, 420, 1021] +[:key_down_raw, 1073741903, 0, 2, 421, 1023] +[:key_down_raw, 1073741903, 0, 2, 422, 1025] +[:key_down_raw, 1073741903, 0, 2, 423, 1027] +[:key_down_raw, 1073741903, 0, 2, 424, 1029] +[:key_down_raw, 1073741903, 0, 2, 425, 1031] +[:key_down_raw, 1073741903, 0, 2, 426, 1033] +[:key_down_raw, 1073741903, 0, 2, 427, 1035] +[:key_down_raw, 1073741903, 0, 2, 428, 1037] +[:key_down_raw, 1073741903, 0, 2, 429, 1039] +[:key_down_raw, 1073741903, 0, 2, 430, 1041] +[:key_down_raw, 1073741903, 0, 2, 431, 1043] +[:key_down_raw, 1073741903, 0, 2, 432, 1045] +[:key_down_raw, 1073741903, 0, 2, 433, 1047] +[:key_up_raw, 1073741903, 0, 2, 434, 1049] +[:key_down_raw, 1073741903, 0, 2, 435, 1069] +[:key_up_raw, 1073741903, 0, 2, 436, 1077] +[:key_down_raw, 1073741903, 0, 2, 437, 1085] +[:key_up_raw, 1073741903, 0, 2, 438, 1089] +[:key_down_raw, 1073741906, 0, 2, 439, 1101] +[:key_up_raw, 1073741906, 0, 2, 440, 1106] +[:mouse_move, 735, 526, 2, 441, 1232] +[:mouse_move, 730, 531, 2, 442, 1233] +[:mouse_move, 721, 540, 2, 443, 1234] +[:mouse_move, 716, 543, 2, 444, 1235] +[:mouse_move, 709, 549, 2, 445, 1236] +[:mouse_move, 705, 551, 2, 446, 1237] +[:mouse_move, 697, 557, 2, 447, 1238] +[:mouse_move, 693, 559, 2, 448, 1239] +[:mouse_move, 677, 571, 2, 449, 1240] +[:mouse_move, 655, 583, 2, 450, 1241] +[:mouse_move, 588, 608, 2, 451, 1242] +[:mouse_move, 577, 612, 2, 452, 1243] +[:mouse_move, 560, 616, 2, 453, 1244] +[:mouse_move, 525, 626, 2, 454, 1245] +[:mouse_move, 495, 634, 2, 455, 1246] +[:mouse_move, 481, 640, 2, 456, 1247] +[:mouse_move, 455, 652, 2, 457, 1248] +[:mouse_move, 433, 664, 2, 458, 1249] +[:mouse_move, 412, 681, 2, 459, 1250] +[:mouse_move, 399, 692, 2, 460, 1251] +[:mouse_move, 372, 713, 2, 461, 1252] +[:mouse_move, 367, 717, 2, 462, 1253] +[:mouse_move, 354, 719, 2, 463, 1254] +[:mouse_move, 440, 719, 2, 464, 1271] +[:mouse_move, 446, 717, 2, 465, 1272] +[:mouse_move, 452, 715, 2, 466, 1272] +[:mouse_move, 457, 713, 2, 467, 1273] +[:mouse_move, 462, 710, 2, 468, 1274] +[:mouse_move, 470, 707, 2, 469, 1275] +[:mouse_move, 473, 705, 2, 470, 1276] +[:mouse_move, 478, 704, 2, 471, 1277] +[:mouse_move, 483, 703, 2, 472, 1278] +[:mouse_move, 489, 702, 2, 473, 1279] +[:mouse_move, 492, 702, 2, 474, 1280] +[:mouse_move, 499, 701, 2, 475, 1281] +[:mouse_move, 503, 701, 2, 476, 1282] +[:mouse_move, 512, 701, 2, 477, 1283] +[:mouse_move, 518, 701, 2, 478, 1284] +[:mouse_move, 523, 701, 2, 479, 1285] +[:mouse_move, 529, 701, 2, 480, 1285] +[:mouse_move, 534, 701, 2, 481, 1286] +[:mouse_move, 539, 701, 2, 482, 1287] +[:mouse_move, 544, 702, 2, 483, 1287] +[:mouse_move, 549, 702, 2, 484, 1288] +[:mouse_move, 554, 702, 2, 485, 1289] +[:mouse_move, 558, 702, 2, 486, 1289] +[:mouse_move, 563, 702, 2, 487, 1290] +[:mouse_move, 568, 702, 2, 488, 1291] +[:mouse_move, 572, 702, 2, 489, 1291] +[:mouse_move, 576, 702, 2, 490, 1292] +[:mouse_move, 581, 702, 2, 491, 1293] +[:mouse_move, 586, 702, 2, 492, 1293] +[:mouse_move, 590, 701, 2, 493, 1294] +[:mouse_move, 595, 701, 2, 494, 1295] +[:mouse_move, 601, 700, 2, 495, 1295] +[:mouse_move, 606, 700, 2, 496, 1296] +[:mouse_move, 612, 699, 2, 497, 1297] +[:mouse_move, 617, 699, 2, 498, 1297] +[:mouse_move, 623, 698, 2, 499, 1298] +[:mouse_move, 629, 698, 2, 500, 1299] +[:mouse_move, 641, 697, 2, 501, 1300] +[:mouse_move, 647, 697, 2, 502, 1301] +[:mouse_move, 658, 696, 2, 503, 1302] +[:mouse_move, 664, 696, 2, 504, 1303] +[:mouse_move, 677, 695, 2, 505, 1304] +[:mouse_move, 690, 694, 2, 506, 1306] +[:mouse_move, 696, 693, 2, 507, 1307] +[:mouse_move, 701, 693, 2, 508, 1308] +[:mouse_move, 712, 692, 2, 509, 1309] +[:mouse_move, 717, 692, 2, 510, 1310] +[:mouse_move, 722, 692, 2, 511, 1310] +[:mouse_move, 727, 692, 2, 512, 1312] +[:mouse_move, 731, 692, 2, 513, 1313] +[:mouse_move, 736, 692, 2, 514, 1315] +[:mouse_move, 741, 692, 2, 515, 1316] +[:mouse_move, 749, 691, 2, 516, 1316] +[:mouse_move, 751, 691, 2, 517, 1317] +[:mouse_move, 757, 691, 2, 518, 1319] +[:mouse_move, 773, 690, 2, 519, 1321] +[:mouse_move, 797, 690, 2, 520, 1323] +[:mouse_move, 801, 690, 2, 521, 1324] +[:mouse_move, 805, 690, 2, 522, 1324] +[:mouse_move, 809, 690, 2, 523, 1325] +[:mouse_move, 818, 690, 2, 524, 1327] +[:mouse_move, 827, 691, 2, 525, 1328] +[:mouse_move, 835, 691, 2, 526, 1329] +[:mouse_move, 840, 691, 2, 527, 1330] +[:mouse_move, 853, 691, 2, 528, 1331] +[:mouse_move, 861, 691, 2, 529, 1332] +[:mouse_move, 870, 691, 2, 530, 1333] +[:mouse_move, 875, 691, 2, 531, 1335] +[:mouse_move, 881, 691, 2, 532, 1336] +[:mouse_move, 885, 691, 2, 533, 1337] +[:mouse_move, 887, 691, 2, 534, 1337] +[:mouse_move, 889, 691, 2, 535, 1338] +[:mouse_move, 891, 691, 2, 536, 1339] +[:mouse_move, 893, 691, 2, 537, 1339] +[:mouse_move, 895, 691, 2, 538, 1340] +[:mouse_move, 896, 692, 2, 539, 1341] +[:mouse_move, 898, 692, 2, 540, 1341] +[:mouse_move, 899, 692, 2, 541, 1343] +[:mouse_move, 900, 692, 2, 542, 1343] +[:mouse_move, 901, 692, 2, 543, 1344] +[:mouse_move, 902, 692, 2, 544, 1347] +[:mouse_move, 903, 692, 2, 545, 1349] +[:mouse_move, 904, 691, 2, 546, 1351] +[:mouse_move, 905, 688, 2, 547, 1351] +[:mouse_move, 906, 684, 2, 548, 1352] +[:mouse_move, 909, 674, 2, 549, 1353] +[:mouse_move, 912, 661, 2, 550, 1353] +[:mouse_move, 915, 640, 2, 551, 1354] +[:mouse_move, 924, 593, 2, 552, 1355] +[:mouse_move, 934, 552, 2, 553, 1355] +[:mouse_move, 939, 532, 2, 554, 1356] +[:mouse_move, 950, 491, 2, 555, 1357] +[:mouse_move, 955, 466, 2, 556, 1358] +[:mouse_move, 959, 442, 2, 557, 1359] +[:mouse_move, 963, 409, 2, 558, 1360] +[:mouse_move, 964, 388, 2, 559, 1361] +[:mouse_move, 965, 351, 2, 560, 1362] +[:key_down_raw, 1073741905, 0, 2, 561, 1480] +[:key_down_raw, 1073741905, 0, 2, 562, 1505] +[:key_down_raw, 1073741905, 0, 2, 563, 1507] +[:key_down_raw, 1073741905, 0, 2, 564, 1509] +[:key_up_raw, 1073741905, 0, 2, 565, 1511] +[:key_down_raw, 1073741905, 0, 2, 566, 1532] +[:key_up_raw, 1073741905, 0, 2, 567, 1537] +[:key_down_raw, 1073741905, 0, 2, 568, 1550] +[:key_up_raw, 1073741905, 0, 2, 569, 1555] +[:key_down_raw, 1073741904, 0, 2, 570, 1622] +[:key_down_raw, 1073741904, 0, 2, 571, 1647] +[:key_down_raw, 1073741904, 0, 2, 572, 1649] +[:key_down_raw, 1073741904, 0, 2, 573, 1651] +[:key_down_raw, 1073741904, 0, 2, 574, 1653] +[:key_up_raw, 1073741904, 0, 2, 575, 1654] +[:key_down_raw, 1073741906, 0, 2, 576, 1670] +[:key_up_raw, 1073741906, 0, 2, 577, 1691] +[:key_down_raw, 1073741904, 0, 2, 578, 1692] +[:key_up_raw, 1073741904, 0, 2, 579, 1699] +[:key_down_raw, 1073741906, 0, 2, 580, 1708] +[:key_down_raw, 1073741906, 0, 2, 581, 1733] +[:key_down_raw, 1073741906, 0, 2, 582, 1735] +[:key_down_raw, 1073741906, 0, 2, 583, 1737] +[:key_down_raw, 1073741906, 0, 2, 584, 1739] +[:key_down_raw, 1073741906, 0, 2, 585, 1741] +[:key_up_raw, 1073741906, 0, 2, 586, 1741] +[:key_down_raw, 1073741906, 0, 2, 587, 1808] +[:key_up_raw, 1073741906, 0, 2, 588, 1817] +[:key_down_raw, 1073741903, 0, 2, 589, 1821] +[:key_up_raw, 1073741903, 0, 2, 590, 1836] +[:mouse_move, 962, 350, 2, 591, 1924] +[:mouse_move, 957, 348, 2, 592, 1924] +[:mouse_move, 949, 345, 2, 593, 1925] +[:mouse_move, 940, 341, 2, 594, 1926] +[:mouse_move, 916, 331, 2, 595, 1927] +[:mouse_move, 902, 326, 2, 596, 1928] +[:mouse_move, 862, 312, 2, 597, 1929] +[:mouse_move, 853, 309, 2, 598, 1930] +[:mouse_move, 818, 298, 2, 599, 1931] +[:mouse_move, 812, 297, 2, 600, 1932] +[:mouse_move, 798, 293, 2, 601, 1933] +[:mouse_move, 791, 292, 2, 602, 1934] +[:mouse_move, 777, 290, 2, 603, 1935] +[:mouse_move, 773, 290, 2, 604, 1936] +[:mouse_move, 765, 290, 2, 605, 1937] +[:mouse_move, 761, 292, 2, 606, 1938] +[:mouse_move, 760, 292, 2, 607, 1939] +[:mouse_move, 757, 293, 2, 608, 1939] +[:mouse_move, 755, 295, 2, 609, 1940] +[:mouse_move, 754, 295, 2, 610, 1941] +[:mouse_move, 753, 296, 2, 611, 1941] +[:mouse_move, 753, 297, 2, 612, 1942] +[:mouse_move, 753, 298, 2, 613, 1944] +[:mouse_move, 753, 299, 2, 614, 1957] +[:mouse_move, 754, 299, 2, 615, 1969] +[:mouse_move, 755, 299, 2, 616, 1997] +[:mouse_move, 755, 300, 2, 617, 1997] +[:mouse_move, 756, 305, 2, 618, 1998] +[:mouse_move, 760, 316, 2, 619, 1999] +[:mouse_move, 763, 332, 2, 620, 1999] +[:mouse_move, 767, 353, 2, 621, 2000] +[:mouse_move, 771, 380, 2, 622, 2001] +[:mouse_move, 772, 393, 2, 623, 2001] +[:mouse_move, 774, 417, 2, 624, 2002] +[:mouse_move, 775, 425, 2, 625, 2003] +[:mouse_move, 775, 444, 2, 626, 2003] +[:mouse_move, 775, 472, 2, 627, 2004] +[:mouse_move, 775, 487, 2, 628, 2005] +[:mouse_move, 775, 492, 2, 629, 2005] +[:mouse_move, 774, 501, 2, 630, 2006] +[:mouse_move, 771, 508, 2, 631, 2007] +[:mouse_move, 769, 514, 2, 632, 2007] +[:mouse_move, 766, 520, 2, 633, 2008] +[:mouse_move, 761, 529, 2, 634, 2009] +[:mouse_move, 755, 534, 2, 635, 2009] +[:mouse_move, 749, 539, 2, 636, 2010] +[:mouse_move, 741, 545, 2, 637, 2011] +[:mouse_move, 720, 558, 2, 638, 2012] +[:mouse_move, 707, 565, 2, 639, 2013] +[:mouse_move, 678, 582, 2, 640, 2014] +[:mouse_move, 664, 590, 2, 641, 2015] +[:mouse_move, 634, 608, 2, 642, 2016] +[:mouse_move, 621, 616, 2, 643, 2017] +[:mouse_move, 607, 624, 2, 644, 2018] +[:mouse_move, 596, 631, 2, 645, 2018] +[:mouse_move, 584, 638, 2, 646, 2019] +[:mouse_move, 573, 644, 2, 647, 2020] +[:mouse_move, 569, 646, 2, 648, 2020] +[:mouse_move, 552, 654, 2, 649, 2021] +[:mouse_move, 542, 657, 2, 650, 2022] +[:mouse_move, 537, 659, 2, 651, 2022] +[:mouse_move, 529, 662, 2, 652, 2023] +[:mouse_move, 521, 665, 2, 653, 2024] +[:mouse_move, 513, 669, 2, 654, 2024] +[:mouse_move, 507, 671, 2, 655, 2025] +[:mouse_move, 501, 674, 2, 656, 2026] +[:mouse_move, 496, 676, 2, 657, 2026] +[:mouse_move, 494, 677, 2, 658, 2027] +[:mouse_move, 491, 679, 2, 659, 2028] +[:mouse_move, 488, 680, 2, 660, 2028] +[:mouse_move, 486, 682, 2, 661, 2029] +[:mouse_move, 484, 683, 2, 662, 2030] +[:mouse_move, 483, 683, 2, 663, 2030] +[:mouse_move, 482, 684, 2, 664, 2031] +[:mouse_move, 481, 684, 2, 665, 2032] +[:mouse_move, 481, 685, 2, 666, 2032] +[:mouse_move, 480, 685, 2, 667, 2033] +[:mouse_move, 480, 686, 2, 668, 2035] +[:mouse_move, 481, 687, 2, 669, 2037] +[:mouse_move, 483, 688, 2, 670, 2038] +[:mouse_move, 485, 689, 2, 671, 2038] +[:mouse_move, 487, 689, 2, 672, 2039] +[:mouse_move, 490, 690, 2, 673, 2040] +[:mouse_move, 498, 690, 2, 674, 2041] +[:mouse_move, 503, 690, 2, 675, 2042] +[:mouse_move, 513, 690, 2, 676, 2043] +[:mouse_move, 517, 689, 2, 677, 2044] +[:mouse_move, 522, 687, 2, 678, 2045] +[:mouse_move, 527, 686, 2, 679, 2045] +[:mouse_move, 531, 685, 2, 680, 2046] +[:mouse_move, 537, 684, 2, 681, 2047] +[:mouse_move, 540, 683, 2, 682, 2047] +[:mouse_move, 545, 682, 2, 683, 2048] +[:mouse_move, 549, 681, 2, 684, 2049] +[:mouse_move, 553, 680, 2, 685, 2049] +[:mouse_move, 557, 680, 2, 686, 2050] +[:mouse_move, 562, 679, 2, 687, 2051] +[:mouse_move, 566, 679, 2, 688, 2051] +[:mouse_move, 571, 678, 2, 689, 2052] +[:mouse_move, 576, 677, 2, 690, 2053] +[:mouse_move, 581, 677, 2, 691, 2053] +[:mouse_move, 584, 676, 2, 692, 2054] +[:mouse_move, 588, 676, 2, 693, 2055] +[:mouse_move, 592, 675, 2, 694, 2055] +[:mouse_move, 595, 675, 2, 695, 2056] +[:mouse_move, 597, 675, 2, 696, 2057] +[:mouse_move, 599, 675, 2, 697, 2057] +[:mouse_move, 602, 675, 2, 698, 2058] +[:mouse_move, 604, 674, 2, 699, 2059] +[:mouse_move, 607, 674, 2, 700, 2059] +[:mouse_move, 609, 674, 2, 701, 2060] +[:mouse_move, 610, 674, 2, 702, 2061] +[:mouse_move, 614, 674, 2, 703, 2061] +[:mouse_move, 615, 674, 2, 704, 2062] +[:mouse_move, 619, 674, 2, 705, 2063] +[:mouse_move, 624, 673, 2, 706, 2064] +[:mouse_move, 626, 673, 2, 707, 2065] +[:mouse_move, 631, 672, 2, 708, 2066] +[:mouse_move, 634, 672, 2, 709, 2067] +[:mouse_move, 640, 672, 2, 710, 2068] +[:mouse_move, 643, 672, 2, 711, 2069] +[:mouse_move, 649, 671, 2, 712, 2070] +[:mouse_move, 653, 671, 2, 713, 2071] +[:mouse_move, 661, 670, 2, 714, 2072] +[:mouse_move, 666, 670, 2, 715, 2073] +[:mouse_move, 670, 670, 2, 716, 2074] +[:mouse_move, 672, 670, 2, 717, 2074] +[:mouse_move, 676, 669, 2, 718, 2075] +[:mouse_move, 679, 669, 2, 719, 2076] +[:mouse_move, 684, 669, 2, 720, 2076] +[:mouse_move, 686, 669, 2, 721, 2077] +[:mouse_move, 690, 669, 2, 722, 2078] +[:mouse_move, 694, 669, 2, 723, 2078] +[:mouse_move, 697, 669, 2, 724, 2079] +[:mouse_move, 701, 669, 2, 725, 2080] +[:mouse_move, 704, 668, 2, 726, 2080] +[:mouse_move, 707, 668, 2, 727, 2081] +[:mouse_move, 713, 668, 2, 728, 2082] +[:mouse_move, 715, 668, 2, 729, 2082] +[:mouse_move, 720, 668, 2, 730, 2083] +[:mouse_move, 721, 668, 2, 731, 2084] +[:mouse_move, 727, 668, 2, 732, 2084] +[:mouse_move, 730, 668, 2, 733, 2085] +[:mouse_move, 733, 668, 2, 734, 2086] +[:mouse_move, 737, 668, 2, 735, 2086] +[:mouse_move, 740, 668, 2, 736, 2087] +[:mouse_move, 744, 668, 2, 737, 2088] +[:mouse_move, 748, 667, 2, 738, 2088] +[:mouse_move, 752, 667, 2, 739, 2089] +[:mouse_move, 754, 667, 2, 740, 2090] +[:mouse_move, 761, 666, 2, 741, 2091] +[:mouse_move, 764, 666, 2, 742, 2092] +[:mouse_move, 769, 666, 2, 743, 2093] +[:mouse_move, 771, 666, 2, 744, 2094] +[:mouse_move, 775, 666, 2, 745, 2095] +[:mouse_move, 776, 666, 2, 746, 2096] +[:mouse_move, 780, 666, 2, 747, 2097] +[:mouse_move, 781, 667, 2, 748, 2098] +[:mouse_move, 784, 667, 2, 749, 2099] +[:mouse_move, 785, 667, 2, 750, 2100] +[:mouse_move, 786, 667, 2, 751, 2101] +[:mouse_move, 787, 667, 2, 752, 2103] +[:mouse_move, 789, 667, 2, 753, 2121] +[:mouse_move, 798, 667, 2, 754, 2122] +[:mouse_move, 804, 667, 2, 755, 2123] +[:mouse_move, 837, 664, 2, 756, 2124] +[:mouse_move, 860, 660, 2, 757, 2125] +[:mouse_move, 913, 648, 2, 758, 2126] +[:mouse_move, 941, 639, 2, 759, 2127] +[:mouse_move, 972, 629, 2, 760, 2128] +[:mouse_move, 998, 616, 2, 761, 2128] +[:mouse_move, 1024, 603, 2, 762, 2129] +[:mouse_move, 1035, 598, 2, 763, 2130] +[:mouse_move, 1055, 586, 2, 764, 2130] +[:mouse_move, 1071, 576, 2, 765, 2131] +[:mouse_move, 1077, 572, 2, 766, 2132] +[:mouse_move, 1088, 563, 2, 767, 2132] +[:mouse_move, 1096, 557, 2, 768, 2133] +[:mouse_move, 1102, 551, 2, 769, 2134] +[:mouse_move, 1104, 549, 2, 770, 2134] +[:mouse_move, 1111, 542, 2, 771, 2135] +[:mouse_move, 1114, 538, 2, 772, 2136] +[:mouse_move, 1117, 534, 2, 773, 2136] +[:mouse_move, 1121, 531, 2, 774, 2137] +[:mouse_move, 1125, 527, 2, 775, 2138] +[:mouse_move, 1130, 523, 2, 776, 2138] +[:mouse_move, 1135, 519, 2, 777, 2139] +[:mouse_move, 1140, 515, 2, 778, 2140] +[:mouse_move, 1145, 511, 2, 779, 2140] +[:mouse_move, 1148, 509, 2, 780, 2141] +[:mouse_move, 1151, 506, 2, 781, 2142] +[:mouse_move, 1154, 504, 2, 782, 2142] +[:mouse_move, 1156, 503, 2, 783, 2143] +[:mouse_move, 1157, 502, 2, 784, 2144] +[:mouse_move, 1159, 501, 2, 785, 2145] +[:mouse_move, 1159, 500, 2, 786, 2147] +[:key_down_raw, 1073742051, 1024, 2, 787, 2282] +[:key_down_raw, 113, 1024, 2, 788, 2283] +[:key_up_raw, 113, 1024, 2, 789, 2283] diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sounds/music-loop.ogg b/samples/99_genre_rpg_narrative/return_of_serenity/sounds/music-loop.ogg new file mode 100644 index 0000000..bec1275 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sounds/music-loop.ogg differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sounds/static-loop.ogg b/samples/99_genre_rpg_narrative/return_of_serenity/sounds/static-loop.ogg new file mode 100644 index 0000000..bb4ac6b Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sounds/static-loop.ogg differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/book.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/book.png new file mode 100644 index 0000000..97859c0 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/book.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/decision.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/decision.png new file mode 100644 index 0000000..e323cea Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/decision.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/dream.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/dream.png new file mode 100644 index 0000000..0b6f982 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/dream.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/front-of-home.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/front-of-home.png new file mode 100644 index 0000000..ca865fe Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/front-of-home.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-home.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-home.png new file mode 100644 index 0000000..3bc4804 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-home.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-observatory.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-observatory.png new file mode 100644 index 0000000..af1d25d Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/inside-observatory.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/label-background.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/label-background.png new file mode 100644 index 0000000..80a682f Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/label-background.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/library.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/library.png new file mode 100644 index 0000000..60f8908 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/library.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mainframe.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mainframe.png new file mode 100644 index 0000000..aed8813 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mainframe.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mountain-pass-zoomed-out.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mountain-pass-zoomed-out.png new file mode 100644 index 0000000..b39ab78 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/mountain-pass-zoomed-out.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/observatory.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/observatory.png new file mode 100644 index 0000000..925886b Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/observatory.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/outside-library.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/outside-library.png new file mode 100644 index 0000000..df42ccf Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/outside-library.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/path-to-observatory.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/path-to-observatory.png new file mode 100644 index 0000000..7e740ac Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/path-to-observatory.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/pc.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/pc.png new file mode 100644 index 0000000..e5f4218 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/pc.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/planets.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/planets.png new file mode 100644 index 0000000..537dd8f Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/planets.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-down.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-down.png new file mode 100644 index 0000000..161ea69 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-down.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-left.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-left.png new file mode 100644 index 0000000..5f682fd Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-left.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-right.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-right.png new file mode 100644 index 0000000..798f97e Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-right.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-up.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-up.png new file mode 100644 index 0000000..161ea69 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-up.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-zoomed-out.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-zoomed-out.png new file mode 100644 index 0000000..804cd72 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/player-zoomed-out.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/serenity.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/serenity.png new file mode 100644 index 0000000..def5bea Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/serenity.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/side-of-home.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/side-of-home.png new file mode 100644 index 0000000..6a17e93 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/side-of-home.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/square.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/square.png new file mode 100644 index 0000000..80a682f Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/square.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/todo.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/todo.png new file mode 100644 index 0000000..5cd3b13 Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/todo.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute-game-over.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute-game-over.png new file mode 100644 index 0000000..99991fb Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute-game-over.png differ diff --git a/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute.png b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute.png new file mode 100644 index 0000000..8686cca Binary files /dev/null and b/samples/99_genre_rpg_narrative/return_of_serenity/sprites/tribute.png differ diff --git a/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb new file mode 100644 index 0000000..37dd493 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/constants.rb @@ -0,0 +1,8 @@ +SHOW_LEGEND = true +SOURCE_TILE_SIZE = 16 +DESTINATION_TILE_SIZE = 16 +TILE_SHEET_SIZE = 256 +TILE_R = 0 +TILE_G = 0 +TILE_B = 0 +TILE_A = 255 diff --git a/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb new file mode 100644 index 0000000..4d07b79 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/legend.rb @@ -0,0 +1,65 @@ +def tick_legend args + return unless SHOW_LEGEND + + legend_padding = 16 + legend_x = 1280 - TILE_SHEET_SIZE - legend_padding + legend_y = 720 - TILE_SHEET_SIZE - legend_padding + tile_sheet_sprite = [legend_x, + legend_y, + TILE_SHEET_SIZE, + TILE_SHEET_SIZE, + 'sprites/simple-mood-16x16.png', 0, + TILE_A, + TILE_R, + TILE_G, + TILE_B] + + if args.inputs.mouse.point.inside_rect? tile_sheet_sprite + mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE) + tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE)) + + mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE) + tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE)) + + args.outputs.primitives << [legend_x - legend_padding * 2, + mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid + + args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE, + legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid + + sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] } + if sprite_key + member_name, _ = sprite_key + member_name = member_name_as_code member_name + args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0] + args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0] + args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0] + else + args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0] + args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0] + end + + end + + # render the sprite in the top right with a padding to the top and right so it's + # not flush against the edge + args.outputs.sprites << tile_sheet_sprite + + # carefully place some ascii arrows to show the legend labels + args.outputs.labels << [895, 707, "ROW --->"] + args.outputs.labels << [943, 412, " ^"] + args.outputs.labels << [943, 412, " |"] + args.outputs.labels << [943, 394, "COL ---+"] + + # use the tile sheet to print out row and column numbers + args.outputs.sprites << 16.map_with_index do |i| + sprite_key = i % 10 + [ + tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE, + 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i), + sprite(sprite_key)), + tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i), + 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key)) + ] + end +end diff --git a/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb new file mode 100644 index 0000000..bd5f521 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/main.rb @@ -0,0 +1,97 @@ +require 'app/constants.rb' +require 'app/sprite_lookup.rb' +require 'app/legend.rb' + +def tick args + tick_game args + tick_legend args +end + +def tick_game args + # setup the grid + args.state.grid.padding = 104 + args.state.grid.size = 512 + + # set up your game + # initialize the game/game defaults. ||= means that you only initialize it if + # the value isn't alread initialized + args.state.player.x ||= 0 + args.state.player.y ||= 0 + + args.state.enemies ||= [ + { x: 10, y: 10, type: :goblin, tile_key: :G }, + { x: 15, y: 30, type: :rat, tile_key: :R } + ] + + args.state.info_message ||= "Use arrow keys to move around." + + # handle keyboard input + # keyboard input (arrow keys to move player) + new_player_x = args.state.player.x + new_player_y = args.state.player.y + player_direction = "" + player_moved = false + if args.inputs.keyboard.key_down.up + new_player_y += 1 + player_direction = "north" + player_moved = true + elsif args.inputs.keyboard.key_down.down + new_player_y -= 1 + player_direction = "south" + player_moved = true + elsif args.inputs.keyboard.key_down.right + new_player_x += 1 + player_direction = "east" + player_moved = true + elsif args.inputs.keyboard.key_down.left + new_player_x -= 1 + player_direction = "west" + player_moved = true + end + + #handle game logic + # determine if there is an enemy on that square, + # if so, don't let the player move there + if player_moved + found_enemy = args.state.enemies.find do |e| + e[:x] == new_player_x && e[:y] == new_player_y + end + + if !found_enemy + args.state.player.x = new_player_x + args.state.player.y = new_player_y + args.state.info_message = "You moved #{player_direction}." + else + args.state.info_message = "You cannot move into a square an enemy occupies." + end + end + + args.outputs.sprites << tile_in_game(args.state.player.x, + args.state.player.y, '@') + + # render game + # render enemies at locations + args.outputs.sprites << args.state.enemies.map do |e| + tile_in_game(e[:x], e[:y], e[:tile_key]) + end + + # render the border + border_x = args.state.grid.padding - DESTINATION_TILE_SIZE + border_y = args.state.grid.padding - DESTINATION_TILE_SIZE + border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2 + + args.outputs.borders << [border_x, + border_y, + border_size, + border_size] + + # render label stuff + args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"] + args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message] +end + +def tile_in_game x, y, tile_key + tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE, + $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE, + tile_key) +end diff --git a/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb new file mode 100644 index 0000000..f129e25 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/app/sprite_lookup.rb @@ -0,0 +1,124 @@ +def sprite_lookup + { + 0 => [3, 0], + 1 => [3, 1], + 2 => [3, 2], + 3 => [3, 3], + 4 => [3, 4], + 5 => [3, 5], + 6 => [3, 6], + 7 => [3, 7], + 8 => [3, 8], + 9 => [3, 9], + '@' => [4, 0], + A: [ 4, 1], + B: [ 4, 2], + C: [ 4, 3], + D: [ 4, 4], + E: [ 4, 5], + F: [ 4, 6], + G: [ 4, 7], + H: [ 4, 8], + I: [ 4, 9], + J: [ 4, 10], + K: [ 4, 11], + L: [ 4, 12], + M: [ 4, 13], + N: [ 4, 14], + O: [ 4, 15], + P: [ 5, 0], + Q: [ 5, 1], + R: [ 5, 2], + S: [ 5, 3], + T: [ 5, 4], + U: [ 5, 5], + V: [ 5, 6], + W: [ 5, 7], + X: [ 5, 8], + Y: [ 5, 9], + Z: [ 5, 10], + a: [ 6, 1], + b: [ 6, 2], + c: [ 6, 3], + d: [ 6, 4], + e: [ 6, 5], + f: [ 6, 6], + g: [ 6, 7], + h: [ 6, 8], + i: [ 6, 9], + j: [ 6, 10], + k: [ 6, 11], + l: [ 6, 12], + m: [ 6, 13], + n: [ 6, 14], + o: [ 6, 15], + p: [ 7, 0], + q: [ 7, 1], + r: [ 7, 2], + s: [ 7, 3], + t: [ 7, 4], + u: [ 7, 5], + v: [ 7, 6], + w: [ 7, 7], + x: [ 7, 8], + y: [ 7, 9], + z: [ 7, 10], + '|' => [ 7, 12] + } +end + +def sprite key + $gtk.args.state.reserved.sprite_lookup[key] +end + +def member_name_as_code raw_member_name + if raw_member_name.is_a? Symbol + ":#{raw_member_name}" + elsif raw_member_name.is_a? String + "'#{raw_member_name}'" + elsif raw_member_name.is_a? Fixnum + "#{raw_member_name}" + else + "UNKNOWN: #{raw_member_name}" + end +end + +def tile x, y, tile_row_column_or_key + tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key +end + +def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key + row_or_key, column = tile_row_column_or_key + if !column + row, column = sprite row_or_key + else + row, column = row_or_key, column + end + + if !row + member_name = member_name_as_code tile_row_column_or_key + raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb." + end + + # Sprite provided by Rogue Yun + # http://www.bay12forums.com/smf/index.php?topic=144897.0 + # License: Public Domain + + { + x: x, + y: y, + w: w, + h: h, + tile_x: column * 16, + tile_y: (row * 16), + tile_w: 16, + tile_h: 16, + r: r, + g: g, + b: b, + a: a, + path: 'sprites/simple-mood-16x16.png' + } +end + +$gtk.args.state.reserved.sprite_lookup = sprite_lookup diff --git a/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/license-for-sample.txt b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png new file mode 100644 index 0000000..0eca11e Binary files /dev/null and b/samples/99_genre_rpg_roguelike/roguelike_line_of_sight/sprites/simple-mood-16x16.png differ diff --git a/samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb b/samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb new file mode 100644 index 0000000..66ff027 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_starting_point/app/main.rb @@ -0,0 +1,439 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - lambda: A way to define a block and its parameters with special syntax. + For example, the syntax of lambda looks like this: + my_lambda = -> { puts "This is my lambda" } + + Reminders: + - 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. + + - ARRAY#inside_rect?: Returns whether or not the point is inside a rect. + + - product: Returns an array of all combinations of elements from all arrays. + + - find: Finds all elements of a collection that meet requirements. + + - abs: Returns the absolute value. + +=end + +# This sample app allows the player to move around in the dungeon, which becomes more or less visible +# depending on the player's location, and also has enemies. + +class Game + attr_accessor :args, :state, :inputs, :outputs, :grid + + # Calls all the methods needed for the game to run properly. + def tick + defaults + render_canvas + render_dungeon + render_player + render_enemies + print_cell_coordinates + calc_canvas + input_move + input_click_map + end + + # Sets default values and initializes variables + def defaults + outputs.background_color = [0, 0, 0] # black background + + # Initializes empty canvas, dungeon, and enemies collections. + state.canvas ||= [] + state.dungeon ||= [] + state.enemies ||= [] + + # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called + if !state.area + load_area_one + derive_dungeon_from_area + + # Changing these values will change the position of player + state.x = 7 + state.y = 5 + + # Creates new enemies, sets their values, and adds them to the enemies collection. + state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity + e.x = 13 # position + e.y = 5 + e.previous_hp = 3 + e.hp = 3 + e.max_hp = 3 + e.is_dead = false # the enemy is alive + end + + update_line_of_sight # updates line of sight by adding newly visible cells + end + end + + # Adds elements into the state.area collection + # The dungeon is derived using the coordinates of this collection + def load_area_one + state.area ||= [] + state.area << [8, 6] + state.area << [7, 6] + state.area << [7, 7] + state.area << [8, 9] + state.area << [7, 8] + state.area << [7, 9] + state.area << [6, 4] + state.area << [7, 3] + state.area << [7, 4] + state.area << [6, 5] + state.area << [7, 5] + state.area << [8, 5] + state.area << [8, 4] + state.area << [1, 1] + state.area << [0, 1] + state.area << [0, 2] + state.area << [1, 2] + state.area << [2, 2] + state.area << [2, 1] + state.area << [2, 3] + state.area << [1, 3] + state.area << [1, 4] + state.area << [2, 4] + state.area << [2, 5] + state.area << [1, 5] + state.area << [2, 6] + state.area << [3, 6] + state.area << [4, 6] + state.area << [4, 7] + state.area << [4, 8] + state.area << [5, 8] + state.area << [5, 9] + state.area << [6, 9] + state.area << [7, 10] + state.area << [7, 11] + state.area << [7, 12] + state.area << [7, 12] + state.area << [7, 13] + state.area << [8, 13] + state.area << [9, 13] + state.area << [10, 13] + state.area << [11, 13] + state.area << [12, 13] + state.area << [12, 12] + state.area << [8, 12] + state.area << [9, 12] + state.area << [10, 12] + state.area << [11, 12] + state.area << [12, 11] + state.area << [13, 11] + state.area << [13, 10] + state.area << [13, 9] + state.area << [13, 8] + state.area << [13, 7] + state.area << [13, 6] + state.area << [12, 6] + state.area << [14, 6] + state.area << [14, 5] + state.area << [13, 5] + state.area << [12, 5] + state.area << [12, 4] + state.area << [13, 4] + state.area << [14, 4] + state.area << [1, 6] + state.area << [6, 6] + end + + # Starts with an empty dungeon collection, and adds dungeon cells into it. + def derive_dungeon_from_area + state.dungeon = [] # starts as empty collection + + state.area.each do |a| # for each element of the area collection + state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity + d.x = a.x # dungeon cell position using coordinates from area + d.y = a.y + d.is_visible = false # cell is not visible + d.alpha = 0 # not transparent at all + d.border = [left_margin + a.x * grid_size, + bottom_margin + a.y * grid_size, + grid_size, + grid_size, + *blue, + 255] # sets border definition for dungeon cell + d # returns dungeon cell + end + end + end + + def left_margin + 40 # sets left margin + end + + def bottom_margin + 60 # sets bottom margin + end + + def grid_size + 40 # sets size of grid square + end + + # Updates the line of sight by calling the thick_line_of_sight method and + # adding dungeon cells to the newly_visible collection + def update_line_of_sight + variations = [-1, 0, 1] + # creates collection of newly visible dungeon cells + newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements + thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method + lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists + end.uniq# removes duplicates + + state.dungeon.each do |d| # perform action on each element of dungeons collection + d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection + end + end + + #Returns a boolean value + def dungeon_cell_exists? x, y + # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists + state.dungeon.find { |d| d.x == x && d.y == y } + end + + # Calls line_of_sight method to add elements to result collection + def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result = [] + result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left + result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right + result + end + + # Adds points to the result collection to create the player's line of sight + def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result = [] # starts as empty collection + points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method + points.each do |p| # for each point in collection + if cell_exists_lambda.call(p.x, p.y) # if the cell exists + result << p # add it to result collection + else # if cell does not exist + return result # return result collection as it is + end + end + + result # return result collection + end + + # Finds the coordinates of the points on the line by performing calculations + def points_on_line start_x, start_y, rise, run, distance + distance.times.map do |i| # perform an action + [start_x + run * i, start_y + rise * i] # definition of point + end + end + + def render_canvas + return + outputs.borders << state.canvas.map do |c| # on each element of canvas collection + c.border # outputs border + end + end + + # Outputs the dungeon cells. + def render_dungeon + outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid + + # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method. + outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection + d.alpha += if d.is_visible # if cell is visible + 255.fdiv(30) # increment opacity (transparency) + else # if cell is not visible + 255.fdiv(600) * -1 # decrease opacity + end + d.alpha = d.alpha.cap_min_max(0, 255) + cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value + end.reject_nil + end + + # Sets definition of a cell border using the parameters + def cell_border x, y, color = nil + [left_margin + x * grid_size, + bottom_margin + y * grid_size, + grid_size, + grid_size, + *color] + end + + # Sets the values for the player and outputs it as a label + def render_player + outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square + grid_y(state.y) + 35, + "@", # player is represented by a white "@" character + 1, 1, *white] + end + + def grid_x x + left_margin + x * grid_size # positions horizontally on grid + end + + def grid_y y + bottom_margin + y * grid_size # positions vertically on grid + end + + # Outputs enemies onto the screen. + def render_enemies + state.enemies.map do |e| # for each enemy in the collection + alpha = 255 # set opacity (full transparency) + + # Outputs an enemy using a label. + outputs.labels << [ + left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square + bottom_margin + 35 + e.y * grid_size, + "r", # enemy's text + 1, 1, *white, alpha] + + # Creates a red border around an enemy. + outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red] + end + end + + #White labels are output for the cell coordinates of each element in the dungeon collection. + def print_cell_coordinates + return unless state.debug + state.dungeon.each do |d| + outputs.labels << [grid_x(d.x) + 2, + grid_y(d.y) - 2, + "#{d.x},#{d.y}", + -2, 0, *white] + end + end + + # Adds new elements into the canvas collection and sets their values. + def calc_canvas + return if state.canvas.length > 0 # return if canvas collection has at least one element + 15.times do |x| # 15 times perform an action + 15.times do |y| + state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity + c.x = x # set position + c.y = y + c.border = [left_margin + x * grid_size, + bottom_margin + y * grid_size, + grid_size, + grid_size, + *white, 30] # sets border definition + end + end + end + end + + # Updates x and y values of the player, and updates player's line of sight + def input_move + x, y, x_diff, y_diff = input_target_cell + + return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location + return if enemy_at x, y # player can't move there if there is an enemy in that location + + state.x += x_diff # increments x by x_diff (so player moves left or right) + state.y += y_diff # same with y and y_diff ( so player moves up or down) + update_line_of_sight # updates visible cells + end + + def enemy_at x, y + # Finds if coordinates exist in enemies collection and enemy is not dead + state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead } + end + + #M oves the user based on their keyboard input and sets values for target cell + def input_target_cell + if inputs.keyboard.key_down.up # if "up" key is in "down" state + [state.x, state.y + 1, 0, 1] # user moves up + elsif inputs.keyboard.key_down.down # if "down" key is pressed + [state.x, state.y - 1, 0, -1] # user moves down + elsif inputs.keyboard.key_down.left # if "left" key is pressed + [state.x - 1, state.y, -1, 0] # user moves left + elsif inputs.keyboard.key_down.right # if "right" key is pressed + [state.x + 1, state.y, 1, 0] # user moves right + else + nil # otherwise, empty + end + end + + # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element. + def input_click_map + return unless inputs.mouse.click # return unless the mouse is clicked + canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements + inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of + end + puts canvas_entry # prints canvas_entry value + end + + # Sets the definition of a label using the parameters. + def label text, x, y, color = nil + color ||= white # color is initialized to white + [x, y, text, 1, 1, *color] # sets label definition + end + + def green + [60, 200, 100] # sets color saturation to shade of green + end + + def blue + [50, 50, 210] # sets color saturation to shade of blue + end + + def white + [255, 255, 255] # sets color saturation to white + end + + def red + [230, 80, 80] # sets color saturation to shade of red + end + + def orange + [255, 80, 60] # sets color saturation to shade of orange + end + + def pink + [255, 0, 200] # sets color saturation to shade of pink + end + + def gray + [75, 75, 75] # sets color saturation to shade of gray + end + + # Recolors the border using the parameters. + def recolor_border border, r, g, b + border[4] = r + border[5] = g + border[6] = b + border + end + + # Returns a boolean value. + def visible? cell + # finds cell's coordinates inside visible_cells collections to determine if cell is visible + state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y} + end + + # Exports dungeon by printing dungeon cell coordinates + def export_dungeon + state.dungeon.each do |d| # on each element of dungeon collection + puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates + end + end + + def distance_to_cell cell + distance_to state.x, cell.x, state.y, cell.y # calls distance_to method + end + + def distance_to from_x, x, from_y, y + (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.state = args.state + $game.inputs = args.inputs + $game.outputs = args.outputs + $game.grid = args.grid + $game.tick +end diff --git a/samples/99_genre_rpg_roguelike/roguelike_starting_point/license-for-sample.txt b/samples/99_genre_rpg_roguelike/roguelike_starting_point/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_starting_point/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_roguelike/roguelike_starting_point/replay.txt b/samples/99_genre_rpg_roguelike/roguelike_starting_point/replay.txt new file mode 100644 index 0000000..a2b4c52 --- /dev/null +++ b/samples/99_genre_rpg_roguelike/roguelike_starting_point/replay.txt @@ -0,0 +1,555 @@ +replay_version 2.0 +stopped_at 1731 +seed 100 +recorded_at Sun Sep 29 22:38:52 2019 +[:mouse_move, 785, 468, 2, 1, 114] +[:mouse_move, 756, 468, 2, 2, 115] +[:mouse_move, 745, 468, 2, 3, 117] +[:mouse_move, 718, 470, 2, 4, 118] +[:mouse_move, 705, 472, 2, 5, 119] +[:mouse_move, 680, 476, 2, 6, 120] +[:mouse_move, 668, 478, 2, 7, 121] +[:mouse_move, 606, 492, 2, 8, 122] +[:mouse_move, 581, 499, 2, 9, 123] +[:mouse_move, 523, 511, 2, 10, 124] +[:mouse_move, 417, 527, 2, 11, 125] +[:mouse_move, 387, 528, 2, 12, 126] +[:mouse_move, 344, 528, 2, 13, 127] +[:mouse_move, 324, 526, 2, 14, 128] +[:mouse_move, 295, 520, 2, 15, 129] +[:mouse_move, 285, 518, 2, 16, 130] +[:mouse_move, 276, 515, 2, 17, 131] +[:mouse_move, 255, 512, 2, 18, 132] +[:mouse_move, 244, 511, 2, 19, 133] +[:mouse_move, 228, 511, 2, 20, 134] +[:mouse_move, 213, 513, 2, 21, 135] +[:mouse_move, 194, 523, 2, 22, 136] +[:mouse_move, 190, 526, 2, 23, 137] +[:mouse_move, 183, 532, 2, 24, 138] +[:mouse_move, 180, 533, 2, 25, 139] +[:mouse_move, 177, 536, 2, 26, 140] +[:mouse_move, 177, 537, 2, 27, 141] +[:mouse_move, 193, 537, 2, 28, 142] +[:mouse_move, 208, 536, 2, 29, 143] +[:mouse_move, 222, 536, 2, 30, 144] +[:mouse_move, 232, 535, 2, 31, 145] +[:mouse_move, 241, 535, 2, 32, 146] +[:mouse_move, 245, 535, 2, 33, 147] +[:mouse_move, 249, 535, 2, 34, 148] +[:mouse_move, 250, 535, 2, 35, 149] +[:mouse_move, 251, 535, 2, 36, 150] +[:mouse_move, 252, 534, 2, 37, 151] +[:mouse_move, 256, 531, 2, 38, 152] +[:mouse_move, 259, 527, 2, 39, 153] +[:mouse_move, 265, 520, 2, 40, 154] +[:mouse_move, 270, 515, 2, 41, 155] +[:mouse_move, 274, 511, 2, 42, 156] +[:mouse_move, 282, 501, 2, 43, 157] +[:mouse_move, 293, 490, 2, 44, 159] +[:mouse_move, 295, 489, 2, 45, 160] +[:mouse_move, 299, 487, 2, 46, 161] +[:mouse_move, 301, 485, 2, 47, 162] +[:mouse_move, 303, 484, 2, 48, 163] +[:mouse_move, 304, 484, 2, 49, 164] +[:mouse_move, 306, 484, 2, 50, 165] +[:mouse_move, 307, 484, 2, 51, 166] +[:mouse_move, 308, 484, 2, 52, 167] +[:mouse_move, 310, 484, 2, 53, 168] +[:mouse_move, 314, 484, 2, 54, 169] +[:mouse_move, 316, 484, 2, 55, 170] +[:mouse_move, 317, 484, 2, 56, 171] +[:mouse_move, 318, 484, 2, 57, 172] +[:mouse_move, 319, 484, 2, 58, 173] +[:key_down_raw, 1073741906, 0, 2, 59, 232] +[:key_up_raw, 1073741906, 0, 2, 60, 237] +[:key_down_raw, 1073741906, 0, 2, 61, 243] +[:key_up_raw, 1073741906, 0, 2, 62, 247] +[:key_down_raw, 1073741906, 0, 2, 63, 254] +[:key_up_raw, 1073741906, 0, 2, 64, 257] +[:key_down_raw, 1073741906, 0, 2, 65, 266] +[:key_up_raw, 1073741906, 0, 2, 66, 272] +[:key_down_raw, 1073741906, 0, 2, 67, 279] +[:key_up_raw, 1073741906, 0, 2, 68, 284] +[:key_down_raw, 1073741905, 0, 2, 69, 326] +[:key_up_raw, 1073741905, 0, 2, 70, 334] +[:key_down_raw, 1073741904, 0, 2, 71, 421] +[:key_up_raw, 1073741904, 0, 2, 72, 428] +[:key_down_raw, 1073741904, 0, 2, 73, 438] +[:key_up_raw, 1073741904, 0, 2, 74, 445] +[:key_down_raw, 1073741905, 0, 2, 75, 459] +[:key_up_raw, 1073741905, 0, 2, 76, 466] +[:key_down_raw, 1073741904, 0, 2, 77, 480] +[:key_up_raw, 1073741904, 0, 2, 78, 488] +[:key_down_raw, 1073741905, 0, 2, 79, 499] +[:key_up_raw, 1073741905, 0, 2, 80, 507] +[:mouse_move, 289, 484, 2, 81, 545] +[:mouse_move, 274, 484, 2, 82, 546] +[:mouse_move, 244, 484, 2, 83, 547] +[:mouse_move, 231, 485, 2, 84, 548] +[:mouse_move, 208, 485, 2, 85, 549] +[:mouse_move, 199, 485, 2, 86, 550] +[:mouse_move, 178, 485, 2, 87, 551] +[:mouse_move, 174, 485, 2, 88, 552] +[:mouse_move, 162, 483, 2, 89, 553] +[:mouse_move, 159, 482, 2, 90, 554] +[:mouse_move, 157, 477, 2, 91, 555] +[:mouse_move, 157, 473, 2, 92, 556] +[:mouse_move, 161, 465, 2, 93, 557] +[:mouse_move, 165, 459, 2, 94, 558] +[:mouse_move, 174, 449, 2, 95, 559] +[:mouse_move, 179, 443, 2, 96, 560] +[:mouse_move, 191, 431, 2, 97, 561] +[:mouse_move, 196, 425, 2, 98, 562] +[:mouse_move, 205, 413, 2, 99, 563] +[:mouse_move, 210, 408, 2, 100, 564] +[:mouse_move, 212, 406, 2, 101, 565] +[:mouse_move, 219, 397, 2, 102, 566] +[:mouse_move, 223, 395, 2, 103, 567] +[:mouse_move, 228, 390, 2, 104, 568] +[:mouse_move, 230, 388, 2, 105, 569] +[:mouse_move, 233, 386, 2, 106, 570] +[:mouse_move, 234, 385, 2, 107, 571] +[:mouse_move, 235, 384, 2, 108, 573] +[:mouse_move, 234, 384, 2, 109, 580] +[:mouse_move, 234, 382, 2, 110, 622] +[:mouse_move, 234, 379, 2, 111, 623] +[:mouse_move, 236, 374, 2, 112, 624] +[:mouse_move, 237, 371, 2, 113, 625] +[:mouse_move, 240, 366, 2, 114, 626] +[:mouse_move, 241, 364, 2, 115, 627] +[:mouse_move, 243, 362, 2, 116, 628] +[:mouse_move, 243, 361, 2, 117, 629] +[:mouse_move, 242, 361, 2, 118, 632] +[:mouse_move, 239, 361, 2, 119, 633] +[:mouse_move, 229, 367, 2, 120, 634] +[:mouse_move, 223, 372, 2, 121, 635] +[:mouse_move, 208, 385, 2, 122, 636] +[:mouse_move, 198, 393, 2, 123, 637] +[:mouse_move, 179, 410, 2, 124, 638] +[:mouse_move, 169, 421, 2, 125, 639] +[:mouse_move, 149, 440, 2, 126, 640] +[:mouse_move, 139, 451, 2, 127, 641] +[:mouse_move, 127, 465, 2, 128, 642] +[:mouse_move, 119, 473, 2, 129, 643] +[:mouse_move, 108, 486, 2, 130, 644] +[:mouse_move, 103, 491, 2, 131, 645] +[:mouse_move, 98, 496, 2, 132, 646] +[:mouse_move, 96, 498, 2, 133, 647] +[:mouse_move, 94, 500, 2, 134, 648] +[:mouse_move, 92, 501, 2, 135, 649] +[:mouse_move, 91, 502, 2, 136, 650] +[:mouse_move, 92, 500, 2, 137, 653] +[:mouse_move, 95, 498, 2, 138, 654] +[:mouse_move, 105, 488, 2, 139, 655] +[:mouse_move, 112, 482, 2, 140, 656] +[:mouse_move, 128, 463, 2, 141, 657] +[:mouse_move, 138, 450, 2, 142, 658] +[:mouse_move, 159, 419, 2, 143, 659] +[:mouse_move, 168, 403, 2, 144, 660] +[:mouse_move, 182, 382, 2, 145, 661] +[:mouse_move, 188, 370, 2, 146, 662] +[:mouse_move, 200, 354, 2, 147, 663] +[:mouse_move, 205, 348, 2, 148, 664] +[:mouse_move, 214, 338, 2, 149, 665] +[:mouse_move, 218, 335, 2, 150, 666] +[:mouse_move, 222, 331, 2, 151, 667] +[:mouse_move, 224, 330, 2, 152, 668] +[:mouse_move, 226, 328, 2, 153, 669] +[:mouse_move, 227, 328, 2, 154, 670] +[:mouse_move, 222, 329, 2, 155, 674] +[:mouse_move, 219, 332, 2, 156, 675] +[:mouse_move, 207, 342, 2, 157, 676] +[:mouse_move, 201, 350, 2, 158, 677] +[:mouse_move, 184, 370, 2, 159, 678] +[:mouse_move, 173, 384, 2, 160, 679] +[:mouse_move, 151, 415, 2, 161, 680] +[:mouse_move, 140, 431, 2, 162, 681] +[:mouse_move, 119, 458, 2, 163, 682] +[:mouse_move, 114, 463, 2, 164, 683] +[:mouse_move, 99, 478, 2, 165, 684] +[:mouse_move, 97, 480, 2, 166, 685] +[:mouse_move, 88, 490, 2, 167, 686] +[:mouse_move, 85, 493, 2, 168, 687] +[:mouse_move, 82, 496, 2, 169, 688] +[:mouse_move, 81, 497, 2, 170, 689] +[:mouse_move, 82, 497, 2, 171, 692] +[:mouse_move, 84, 496, 2, 172, 693] +[:mouse_move, 94, 489, 2, 173, 694] +[:mouse_move, 101, 482, 2, 174, 695] +[:mouse_move, 119, 463, 2, 175, 696] +[:mouse_move, 129, 451, 2, 176, 697] +[:mouse_move, 151, 426, 2, 177, 698] +[:mouse_move, 155, 420, 2, 178, 699] +[:mouse_move, 172, 401, 2, 179, 700] +[:mouse_move, 178, 393, 2, 180, 701] +[:mouse_move, 185, 387, 2, 181, 702] +[:mouse_move, 197, 376, 2, 182, 703] +[:mouse_move, 202, 371, 2, 183, 704] +[:mouse_move, 209, 365, 2, 184, 705] +[:mouse_move, 215, 360, 2, 185, 706] +[:mouse_move, 218, 357, 2, 186, 707] +[:mouse_move, 222, 353, 2, 187, 708] +[:mouse_move, 225, 351, 2, 188, 709] +[:mouse_move, 226, 350, 2, 189, 710] +[:mouse_move, 227, 348, 2, 190, 711] +[:mouse_move, 228, 348, 2, 191, 712] +[:mouse_move, 229, 347, 2, 192, 713] +[:mouse_move, 229, 346, 2, 193, 715] +[:mouse_move, 225, 352, 2, 194, 721] +[:mouse_move, 219, 361, 2, 195, 722] +[:mouse_move, 201, 385, 2, 196, 723] +[:mouse_move, 193, 393, 2, 197, 724] +[:mouse_move, 165, 424, 2, 198, 725] +[:mouse_move, 151, 439, 2, 199, 726] +[:mouse_move, 127, 468, 2, 200, 727] +[:mouse_move, 116, 480, 2, 201, 728] +[:mouse_move, 106, 490, 2, 202, 729] +[:mouse_move, 92, 504, 2, 203, 730] +[:mouse_move, 84, 512, 2, 204, 731] +[:mouse_move, 77, 519, 2, 205, 732] +[:mouse_move, 73, 523, 2, 206, 733] +[:mouse_move, 69, 527, 2, 207, 734] +[:mouse_move, 68, 527, 2, 208, 735] +[:mouse_move, 68, 528, 2, 209, 736] +[:mouse_move, 70, 525, 2, 210, 738] +[:mouse_move, 73, 522, 2, 211, 739] +[:mouse_move, 86, 511, 2, 212, 740] +[:mouse_move, 93, 503, 2, 213, 741] +[:mouse_move, 117, 477, 2, 214, 742] +[:mouse_move, 123, 469, 2, 215, 743] +[:mouse_move, 156, 427, 2, 216, 744] +[:mouse_move, 169, 407, 2, 217, 745] +[:mouse_move, 187, 376, 2, 218, 746] +[:mouse_move, 199, 356, 2, 219, 747] +[:mouse_move, 221, 318, 2, 220, 748] +[:mouse_move, 231, 302, 2, 221, 749] +[:mouse_move, 250, 276, 2, 222, 750] +[:mouse_move, 260, 266, 2, 223, 751] +[:mouse_move, 267, 259, 2, 224, 752] +[:mouse_move, 272, 254, 2, 225, 753] +[:mouse_move, 279, 247, 2, 226, 754] +[:mouse_move, 281, 245, 2, 227, 755] +[:mouse_move, 282, 245, 2, 228, 756] +[:mouse_move, 283, 244, 2, 229, 757] +[:key_down_raw, 1073741906, 0, 2, 230, 813] +[:key_up_raw, 1073741906, 0, 2, 231, 820] +[:key_down_raw, 1073741903, 0, 2, 232, 833] +[:key_up_raw, 1073741903, 0, 2, 233, 840] +[:key_down_raw, 1073741903, 0, 2, 234, 848] +[:key_up_raw, 1073741903, 0, 2, 235, 855] +[:key_down_raw, 1073741906, 0, 2, 236, 862] +[:key_up_raw, 1073741906, 0, 2, 237, 870] +[:key_down_raw, 1073741903, 0, 2, 238, 880] +[:key_up_raw, 1073741903, 0, 2, 239, 901] +[:key_down_raw, 1073741903, 0, 2, 240, 917] +[:key_up_raw, 1073741903, 0, 2, 241, 924] +[:key_down_raw, 1073741905, 0, 2, 242, 943] +[:key_up_raw, 1073741905, 0, 2, 243, 948] +[:key_down_raw, 1073741905, 0, 2, 244, 952] +[:key_up_raw, 1073741905, 0, 2, 245, 956] +[:key_down_raw, 1073741905, 0, 2, 246, 960] +[:key_up_raw, 1073741905, 0, 2, 247, 963] +[:key_down_raw, 1073741905, 0, 2, 248, 967] +[:key_up_raw, 1073741905, 0, 2, 249, 972] +[:mouse_move, 244, 247, 2, 250, 997] +[:mouse_move, 229, 253, 2, 251, 998] +[:mouse_move, 174, 283, 2, 252, 999] +[:mouse_move, 152, 299, 2, 253, 1000] +[:mouse_move, 133, 313, 2, 254, 1001] +[:mouse_move, 63, 372, 2, 255, 1002] +[:mouse_move, 53, 384, 2, 256, 1003] +[:mouse_move, 40, 399, 2, 257, 1004] +[:mouse_move, 20, 424, 2, 258, 1005] +[:mouse_move, 13, 440, 2, 259, 1006] +[:mouse_move, 12, 445, 2, 260, 1007] +[:mouse_move, 12, 450, 2, 261, 1008] +[:mouse_move, 12, 451, 2, 262, 1009] +[:mouse_move, 13, 454, 2, 263, 1010] +[:mouse_move, 14, 454, 2, 264, 1011] +[:mouse_move, 15, 455, 2, 265, 1012] +[:mouse_move, 15, 454, 2, 266, 1014] +[:mouse_move, 15, 452, 2, 267, 1015] +[:mouse_move, 15, 447, 2, 268, 1016] +[:mouse_move, 15, 443, 2, 269, 1017] +[:mouse_move, 16, 438, 2, 270, 1018] +[:mouse_move, 17, 435, 2, 271, 1019] +[:mouse_move, 19, 431, 2, 272, 1020] +[:mouse_move, 20, 430, 2, 273, 1021] +[:mouse_move, 22, 428, 2, 274, 1022] +[:mouse_move, 23, 427, 2, 275, 1023] +[:mouse_move, 25, 426, 2, 276, 1024] +[:mouse_move, 26, 426, 2, 277, 1025] +[:mouse_move, 29, 426, 2, 278, 1026] +[:mouse_move, 30, 426, 2, 279, 1028] +[:mouse_move, 31, 427, 2, 280, 1029] +[:mouse_move, 32, 428, 2, 281, 1030] +[:mouse_move, 33, 431, 2, 282, 1031] +[:mouse_move, 34, 432, 2, 283, 1032] +[:mouse_move, 35, 437, 2, 284, 1033] +[:mouse_move, 36, 439, 2, 285, 1034] +[:mouse_move, 37, 444, 2, 286, 1035] +[:mouse_move, 39, 449, 2, 287, 1036] +[:mouse_move, 44, 460, 2, 288, 1037] +[:mouse_move, 45, 464, 2, 289, 1038] +[:mouse_move, 52, 475, 2, 290, 1039] +[:mouse_move, 55, 479, 2, 291, 1040] +[:mouse_move, 62, 485, 2, 292, 1041] +[:mouse_move, 66, 487, 2, 293, 1042] +[:mouse_move, 74, 488, 2, 294, 1043] +[:mouse_move, 79, 488, 2, 295, 1044] +[:mouse_move, 89, 484, 2, 296, 1045] +[:mouse_move, 95, 480, 2, 297, 1046] +[:mouse_move, 111, 468, 2, 298, 1047] +[:mouse_move, 115, 466, 2, 299, 1048] +[:mouse_move, 134, 453, 2, 300, 1049] +[:mouse_move, 142, 447, 2, 301, 1050] +[:mouse_move, 160, 437, 2, 302, 1051] +[:mouse_move, 170, 431, 2, 303, 1052] +[:mouse_move, 179, 425, 2, 304, 1053] +[:mouse_move, 192, 417, 2, 305, 1054] +[:mouse_move, 200, 411, 2, 306, 1055] +[:mouse_move, 213, 401, 2, 307, 1056] +[:mouse_move, 219, 396, 2, 308, 1057] +[:mouse_move, 230, 386, 2, 309, 1058] +[:mouse_move, 238, 375, 2, 310, 1059] +[:mouse_move, 244, 363, 2, 311, 1060] +[:mouse_move, 247, 355, 2, 312, 1061] +[:mouse_move, 253, 341, 2, 313, 1062] +[:mouse_move, 255, 335, 2, 314, 1063] +[:mouse_move, 257, 321, 2, 315, 1064] +[:mouse_move, 258, 309, 2, 316, 1065] +[:mouse_move, 257, 298, 2, 317, 1066] +[:mouse_move, 255, 291, 2, 318, 1067] +[:mouse_move, 249, 281, 2, 319, 1068] +[:mouse_move, 242, 271, 2, 320, 1069] +[:mouse_move, 233, 264, 2, 321, 1070] +[:mouse_move, 226, 260, 2, 322, 1071] +[:mouse_move, 207, 252, 2, 323, 1072] +[:mouse_move, 203, 251, 2, 324, 1073] +[:mouse_move, 185, 249, 2, 325, 1074] +[:mouse_move, 178, 249, 2, 326, 1075] +[:mouse_move, 161, 249, 2, 327, 1076] +[:mouse_move, 153, 250, 2, 328, 1077] +[:mouse_move, 139, 256, 2, 329, 1078] +[:mouse_move, 132, 259, 2, 330, 1079] +[:mouse_move, 120, 269, 2, 331, 1080] +[:mouse_move, 110, 279, 2, 332, 1081] +[:mouse_move, 104, 287, 2, 333, 1082] +[:mouse_move, 93, 304, 2, 334, 1083] +[:mouse_move, 87, 313, 2, 335, 1084] +[:mouse_move, 80, 326, 2, 336, 1085] +[:mouse_move, 75, 335, 2, 337, 1086] +[:mouse_move, 69, 351, 2, 338, 1087] +[:mouse_move, 67, 359, 2, 339, 1088] +[:mouse_move, 64, 376, 2, 340, 1089] +[:mouse_move, 64, 383, 2, 341, 1090] +[:mouse_move, 62, 399, 2, 342, 1091] +[:mouse_move, 62, 406, 2, 343, 1092] +[:mouse_move, 62, 418, 2, 344, 1093] +[:mouse_move, 62, 423, 2, 345, 1094] +[:mouse_move, 66, 433, 2, 346, 1095] +[:mouse_move, 69, 437, 2, 347, 1096] +[:mouse_move, 78, 444, 2, 348, 1097] +[:mouse_move, 86, 450, 2, 349, 1098] +[:mouse_move, 102, 457, 2, 350, 1099] +[:mouse_move, 112, 458, 2, 351, 1100] +[:mouse_move, 136, 461, 2, 352, 1101] +[:mouse_move, 142, 461, 2, 353, 1102] +[:mouse_move, 162, 460, 2, 354, 1103] +[:mouse_move, 172, 459, 2, 355, 1104] +[:mouse_move, 188, 454, 2, 356, 1105] +[:mouse_move, 195, 451, 2, 357, 1106] +[:mouse_move, 211, 443, 2, 358, 1107] +[:mouse_move, 214, 440, 2, 359, 1108] +[:mouse_move, 222, 432, 2, 360, 1109] +[:mouse_move, 233, 412, 2, 361, 1110] +[:mouse_move, 238, 400, 2, 362, 1111] +[:mouse_move, 248, 375, 2, 363, 1112] +[:mouse_move, 250, 370, 2, 364, 1113] +[:mouse_move, 258, 351, 2, 365, 1114] +[:mouse_move, 261, 343, 2, 366, 1115] +[:mouse_move, 264, 328, 2, 367, 1116] +[:mouse_move, 264, 321, 2, 368, 1117] +[:mouse_move, 265, 307, 2, 369, 1118] +[:mouse_move, 265, 305, 2, 370, 1119] +[:mouse_move, 264, 296, 2, 371, 1120] +[:mouse_move, 262, 289, 2, 372, 1121] +[:mouse_move, 257, 282, 2, 373, 1122] +[:mouse_move, 252, 277, 2, 374, 1123] +[:mouse_move, 237, 271, 2, 375, 1124] +[:mouse_move, 227, 269, 2, 376, 1125] +[:mouse_move, 211, 268, 2, 377, 1126] +[:mouse_move, 201, 268, 2, 378, 1127] +[:mouse_move, 177, 268, 2, 379, 1128] +[:mouse_move, 168, 269, 2, 380, 1129] +[:mouse_move, 149, 274, 2, 381, 1130] +[:mouse_move, 137, 279, 2, 382, 1131] +[:mouse_move, 124, 288, 2, 383, 1132] +[:mouse_move, 116, 294, 2, 384, 1133] +[:mouse_move, 102, 307, 2, 385, 1134] +[:mouse_move, 91, 319, 2, 386, 1135] +[:mouse_move, 88, 323, 2, 387, 1136] +[:mouse_move, 73, 344, 2, 388, 1137] +[:mouse_move, 68, 353, 2, 389, 1138] +[:mouse_move, 57, 374, 2, 390, 1139] +[:mouse_move, 52, 386, 2, 391, 1140] +[:mouse_move, 44, 412, 2, 392, 1141] +[:mouse_move, 42, 418, 2, 393, 1142] +[:mouse_move, 36, 437, 2, 394, 1143] +[:mouse_move, 34, 445, 2, 395, 1144] +[:mouse_move, 33, 453, 2, 396, 1145] +[:mouse_move, 32, 457, 2, 397, 1146] +[:mouse_move, 32, 466, 2, 398, 1147] +[:mouse_move, 33, 468, 2, 399, 1148] +[:mouse_move, 38, 475, 2, 400, 1149] +[:mouse_move, 44, 482, 2, 401, 1150] +[:mouse_move, 56, 492, 2, 402, 1151] +[:mouse_move, 64, 496, 2, 403, 1152] +[:mouse_move, 81, 503, 2, 404, 1153] +[:mouse_move, 92, 503, 2, 405, 1154] +[:mouse_move, 106, 503, 2, 406, 1155] +[:mouse_move, 115, 501, 2, 407, 1156] +[:mouse_move, 134, 492, 2, 408, 1157] +[:mouse_move, 147, 485, 2, 409, 1158] +[:mouse_move, 163, 471, 2, 410, 1159] +[:mouse_move, 171, 463, 2, 411, 1160] +[:mouse_move, 183, 451, 2, 412, 1161] +[:mouse_move, 202, 425, 2, 413, 1163] +[:mouse_move, 215, 401, 2, 414, 1164] +[:mouse_move, 217, 395, 2, 415, 1165] +[:mouse_move, 226, 373, 2, 416, 1166] +[:mouse_move, 234, 357, 2, 417, 1167] +[:mouse_move, 238, 343, 2, 418, 1168] +[:mouse_move, 240, 334, 2, 419, 1169] +[:mouse_move, 247, 310, 2, 420, 1170] +[:mouse_move, 249, 299, 2, 421, 1171] +[:mouse_move, 250, 290, 2, 422, 1172] +[:mouse_move, 251, 283, 2, 423, 1173] +[:mouse_move, 251, 269, 2, 424, 1174] +[:mouse_move, 248, 263, 2, 425, 1175] +[:mouse_move, 237, 256, 2, 426, 1176] +[:mouse_move, 229, 254, 2, 427, 1177] +[:mouse_move, 210, 250, 2, 428, 1178] +[:mouse_move, 199, 249, 2, 429, 1179] +[:mouse_move, 184, 248, 2, 430, 1180] +[:mouse_move, 173, 248, 2, 431, 1181] +[:mouse_move, 153, 248, 2, 432, 1182] +[:mouse_move, 145, 249, 2, 433, 1183] +[:mouse_move, 138, 251, 2, 434, 1184] +[:mouse_move, 125, 257, 2, 435, 1185] +[:mouse_move, 121, 260, 2, 436, 1186] +[:mouse_move, 112, 267, 2, 437, 1187] +[:mouse_move, 101, 280, 2, 438, 1188] +[:mouse_move, 97, 287, 2, 439, 1189] +[:mouse_move, 86, 306, 2, 440, 1190] +[:mouse_move, 81, 316, 2, 441, 1191] +[:mouse_move, 79, 322, 2, 442, 1192] +[:mouse_move, 70, 345, 2, 443, 1193] +[:mouse_move, 63, 365, 2, 444, 1194] +[:mouse_move, 59, 389, 2, 445, 1195] +[:mouse_move, 59, 401, 2, 446, 1196] +[:mouse_move, 59, 416, 2, 447, 1197] +[:mouse_move, 59, 425, 2, 448, 1198] +[:mouse_move, 60, 439, 2, 449, 1199] +[:mouse_move, 60, 442, 2, 450, 1200] +[:mouse_move, 64, 454, 2, 451, 1201] +[:mouse_move, 66, 457, 2, 452, 1202] +[:mouse_move, 70, 462, 2, 453, 1203] +[:mouse_move, 74, 464, 2, 454, 1204] +[:mouse_move, 81, 467, 2, 455, 1205] +[:mouse_move, 85, 468, 2, 456, 1206] +[:mouse_move, 97, 469, 2, 457, 1207] +[:mouse_move, 107, 469, 2, 458, 1208] +[:mouse_move, 124, 471, 2, 459, 1209] +[:mouse_move, 134, 471, 2, 460, 1210] +[:mouse_move, 148, 471, 2, 461, 1211] +[:mouse_move, 161, 468, 2, 462, 1212] +[:mouse_move, 178, 457, 2, 463, 1213] +[:mouse_move, 186, 451, 2, 464, 1214] +[:mouse_move, 202, 434, 2, 465, 1215] +[:mouse_move, 210, 424, 2, 466, 1216] +[:mouse_move, 227, 400, 2, 467, 1217] +[:mouse_move, 234, 388, 2, 468, 1218] +[:mouse_move, 237, 383, 2, 469, 1219] +[:mouse_move, 250, 360, 2, 470, 1220] +[:mouse_move, 254, 351, 2, 471, 1221] +[:mouse_move, 261, 334, 2, 472, 1222] +[:mouse_move, 262, 326, 2, 473, 1223] +[:mouse_move, 264, 312, 2, 474, 1224] +[:mouse_move, 265, 305, 2, 475, 1225] +[:mouse_move, 265, 293, 2, 476, 1226] +[:mouse_move, 265, 287, 2, 477, 1227] +[:mouse_move, 259, 272, 2, 478, 1228] +[:mouse_move, 255, 267, 2, 479, 1229] +[:mouse_move, 246, 260, 2, 480, 1230] +[:mouse_move, 239, 257, 2, 481, 1231] +[:mouse_move, 226, 253, 2, 482, 1232] +[:mouse_move, 213, 251, 2, 483, 1233] +[:mouse_move, 194, 251, 2, 484, 1234] +[:mouse_move, 184, 252, 2, 485, 1235] +[:mouse_move, 163, 259, 2, 486, 1236] +[:mouse_move, 153, 263, 2, 487, 1237] +[:mouse_move, 133, 274, 2, 488, 1238] +[:mouse_move, 128, 278, 2, 489, 1239] +[:mouse_move, 107, 297, 2, 490, 1240] +[:mouse_move, 100, 305, 2, 491, 1241] +[:mouse_move, 86, 324, 2, 492, 1242] +[:mouse_move, 79, 335, 2, 493, 1243] +[:mouse_move, 74, 348, 2, 494, 1244] +[:mouse_move, 66, 388, 2, 495, 1245] +[:mouse_move, 66, 399, 2, 496, 1246] +[:mouse_move, 68, 429, 2, 497, 1247] +[:mouse_move, 73, 441, 2, 498, 1248] +[:mouse_move, 83, 452, 2, 499, 1249] +[:mouse_move, 89, 457, 2, 500, 1250] +[:mouse_move, 97, 462, 2, 501, 1251] +[:key_down_raw, 1073741906, 0, 2, 502, 1292] +[:key_up_raw, 1073741906, 0, 2, 503, 1296] +[:key_down_raw, 1073741906, 0, 2, 504, 1309] +[:key_up_raw, 1073741906, 0, 2, 505, 1314] +[:key_down_raw, 1073741906, 0, 2, 506, 1319] +[:key_up_raw, 1073741906, 0, 2, 507, 1322] +[:key_down_raw, 1073741906, 0, 2, 508, 1327] +[:key_up_raw, 1073741906, 0, 2, 509, 1331] +[:key_down_raw, 1073741906, 0, 2, 510, 1336] +[:key_up_raw, 1073741906, 0, 2, 511, 1339] +[:key_down_raw, 1073741906, 0, 2, 512, 1345] +[:key_up_raw, 1073741906, 0, 2, 513, 1348] +[:key_down_raw, 1073741906, 0, 2, 514, 1354] +[:key_up_raw, 1073741906, 0, 2, 515, 1358] +[:key_down_raw, 1073741906, 0, 2, 516, 1362] +[:key_up_raw, 1073741906, 0, 2, 517, 1370] +[:key_down_raw, 1073741903, 0, 2, 518, 1386] +[:key_up_raw, 1073741903, 0, 2, 519, 1392] +[:key_down_raw, 1073741903, 0, 2, 520, 1397] +[:key_up_raw, 1073741903, 0, 2, 521, 1401] +[:key_down_raw, 1073741903, 0, 2, 522, 1407] +[:key_up_raw, 1073741903, 0, 2, 523, 1412] +[:key_down_raw, 1073741903, 0, 2, 524, 1415] +[:key_up_raw, 1073741903, 0, 2, 525, 1421] +[:key_down_raw, 1073741903, 0, 2, 526, 1428] +[:key_up_raw, 1073741903, 0, 2, 527, 1436] +[:key_down_raw, 1073741905, 0, 2, 528, 1446] +[:key_up_raw, 1073741905, 0, 2, 529, 1458] +[:key_down_raw, 1073741905, 0, 2, 530, 1466] +[:key_up_raw, 1073741905, 0, 2, 531, 1472] +[:key_down_raw, 1073741903, 0, 2, 532, 1479] +[:key_up_raw, 1073741903, 0, 2, 533, 1489] +[:key_down_raw, 1073741905, 0, 2, 534, 1513] +[:key_up_raw, 1073741905, 0, 2, 535, 1517] +[:key_down_raw, 1073741905, 0, 2, 536, 1522] +[:key_up_raw, 1073741905, 0, 2, 537, 1526] +[:key_down_raw, 1073741905, 0, 2, 538, 1531] +[:key_up_raw, 1073741905, 0, 2, 539, 1535] +[:key_down_raw, 1073741905, 0, 2, 540, 1540] +[:key_up_raw, 1073741905, 0, 2, 541, 1544] +[:key_down_raw, 1073741905, 0, 2, 542, 1549] +[:key_up_raw, 1073741905, 0, 2, 543, 1554] +[:key_down_raw, 1073741905, 0, 2, 544, 1558] +[:key_up_raw, 1073741905, 0, 2, 545, 1564] +[:key_down_raw, 1073742051, 1024, 2, 546, 1663] +[:key_down_raw, 114, 1024, 2, 547, 1664] +[:key_up_raw, 114, 1024, 2, 548, 1669] +[:key_up_raw, 1073742051, 0, 2, 549, 1677] +[:key_down_raw, 1073742051, 1024, 2, 550, 1729] +[:key_down_raw, 113, 1024, 2, 551, 1730] diff --git a/samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb b/samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb new file mode 100644 index 0000000..b522ace --- /dev/null +++ b/samples/99_genre_rpg_tactical/hexagonal_grid/app/main.rb @@ -0,0 +1,68 @@ +class HexagonTileGame + attr_gtk + + def defaults + state.tile_scale = 1.3 + state.tile_size = 80 + state.tile_w = Math.sqrt(3) * state.tile_size.half + state.tile_h = state.tile_size * 3/4 + state.tiles_x_count = 1280.idiv(state.tile_w) - 1 + state.tiles_y_count = 720.idiv(state.tile_h) - 1 + state.world_width_px = state.tiles_x_count * state.tile_w + state.world_height_px = state.tiles_y_count * state.tile_h + state.world_x_offset = (1280 - state.world_width_px).half + state.world_y_offset = (720 - state.world_height_px).half + state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y| + { + ordinal_x: ordinal_x, + ordinal_y: ordinal_y, + offset_x: (ordinal_y.even?) ? + (state.world_x_offset + state.tile_w.half.half) : + (state.world_x_offset - state.tile_w.half.half), + offset_y: state.world_y_offset, + w: state.tile_w, + h: state.tile_h, + type: :blank, + path: "sprites/hexagon-gray.png", + a: 20 + }.associate do |h| + h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w], + y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale) + end.associate do |h| + h.merge(center: { + x: h[:x] + h[:w].half, + y: h[:y] + h[:h].half + }, radius: [h[:w].half, h[:h].half].max) + end + end + end + + def input + if inputs.click + tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] } + if tile + tile[:a] = 255 + tile[:path] = "sprites/hexagon-black.png" + end + end + end + + def tick + defaults + input + render + end + + def render + outputs.sprites << state.tiles + end +end + +$game = HexagonTileGame.new + +def tick args + $game.args = args + $game.tick +end + +$gtk.reset diff --git a/samples/99_genre_rpg_tactical/hexagonal_grid/license-for-sample.txt b/samples/99_genre_rpg_tactical/hexagonal_grid/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_tactical/hexagonal_grid/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_tactical/hexagonal_grid/replay.txt b/samples/99_genre_rpg_tactical/hexagonal_grid/replay.txt new file mode 100644 index 0000000..9e646bc --- /dev/null +++ b/samples/99_genre_rpg_tactical/hexagonal_grid/replay.txt @@ -0,0 +1,276 @@ +replay_version 2.0 +stopped_at 488 +seed 100 +recorded_at Sat Feb 01 20:02:13 2020 +[:mouse_move, 643, 259, 2, 1, 46] +[:mouse_move, 618, 246, 2, 2, 47] +[:mouse_move, 544, 211, 2, 3, 48] +[:mouse_move, 477, 179, 2, 4, 49] +[:mouse_move, 435, 158, 2, 5, 50] +[:mouse_move, 350, 117, 2, 6, 51] +[:mouse_move, 304, 96, 2, 7, 52] +[:mouse_move, 267, 84, 2, 8, 53] +[:mouse_move, 242, 76, 2, 9, 54] +[:mouse_move, 188, 72, 2, 10, 55] +[:mouse_move, 164, 75, 2, 11, 56] +[:mouse_move, 151, 81, 2, 12, 57] +[:mouse_move, 135, 89, 2, 13, 58] +[:mouse_move, 117, 102, 2, 14, 59] +[:mouse_move, 114, 105, 2, 15, 59] +[:mouse_move, 99, 116, 2, 16, 60] +[:mouse_move, 90, 121, 2, 17, 61] +[:mouse_move, 81, 130, 2, 18, 62] +[:mouse_move, 75, 136, 2, 19, 63] +[:mouse_move, 72, 149, 2, 20, 64] +[:mouse_move, 66, 183, 2, 21, 65] +[:mouse_move, 64, 218, 2, 22, 66] +[:mouse_move, 64, 273, 2, 23, 67] +[:mouse_move, 70, 305, 2, 24, 68] +[:mouse_move, 85, 347, 2, 25, 69] +[:mouse_move, 133, 418, 2, 26, 70] +[:mouse_move, 174, 441, 2, 27, 71] +[:mouse_move, 225, 453, 2, 28, 72] +[:mouse_move, 277, 453, 2, 29, 73] +[:mouse_move, 328, 448, 2, 30, 74] +[:mouse_move, 421, 434, 2, 31, 75] +[:mouse_move, 492, 433, 2, 32, 76] +[:mouse_move, 571, 433, 2, 33, 77] +[:mouse_move, 656, 432, 2, 34, 78] +[:mouse_move, 824, 403, 2, 35, 79] +[:mouse_move, 903, 386, 2, 36, 80] +[:mouse_move, 996, 373, 2, 37, 81] +[:mouse_move, 1053, 371, 2, 38, 82] +[:mouse_move, 1092, 371, 2, 39, 83] +[:mouse_move, 1098, 372, 2, 40, 84] +[:mouse_move, 1117, 368, 2, 41, 92] +[:mouse_move, 1148, 368, 2, 42, 93] +[:mouse_move, 1212, 381, 2, 43, 94] +[:mouse_move, 1246, 398, 2, 44, 95] +[:mouse_move, 1282, 423, 2, 45, 96] +[:mouse_move, 1303, 449, 2, 46, 97] +[:mouse_move, 1309, 465, 2, 47, 98] +[:mouse_move, 1314, 481, 2, 48, 99] +[:mouse_move, 1314, 497, 2, 49, 100] +[:mouse_move, 1301, 504, 2, 50, 101] +[:mouse_move, 1288, 507, 2, 51, 102] +[:mouse_move, 1259, 515, 2, 52, 103] +[:mouse_move, 1238, 523, 2, 53, 104] +[:mouse_move, 1225, 529, 2, 54, 105] +[:mouse_move, 1216, 531, 2, 55, 106] +[:mouse_move, 1207, 533, 2, 56, 107] +[:mouse_move, 1205, 532, 2, 57, 108] +[:mouse_move, 1207, 526, 2, 58, 109] +[:mouse_move, 1213, 518, 2, 59, 110] +[:mouse_move, 1222, 507, 2, 60, 111] +[:mouse_move, 1233, 493, 2, 61, 112] +[:mouse_move, 1237, 482, 2, 62, 113] +[:mouse_move, 1239, 468, 2, 63, 114] +[:mouse_move, 1239, 444, 2, 64, 115] +[:mouse_move, 1237, 413, 2, 65, 116] +[:mouse_move, 1235, 403, 2, 66, 117] +[:mouse_move, 1234, 395, 2, 67, 118] +[:mouse_move, 1234, 392, 2, 68, 119] +[:mouse_move, 1234, 390, 2, 69, 120] +[:mouse_move, 1234, 389, 2, 70, 122] +[:mouse_move, 1234, 386, 2, 71, 123] +[:mouse_move, 1233, 386, 2, 72, 125] +[:mouse_move, 1190, 395, 2, 73, 126] +[:mouse_move, 1054, 412, 2, 74, 127] +[:mouse_move, 862, 421, 2, 75, 128] +[:mouse_move, 720, 421, 2, 76, 129] +[:mouse_move, 616, 419, 2, 77, 130] +[:mouse_move, 580, 416, 2, 78, 131] +[:mouse_move, 567, 410, 2, 79, 140] +[:mouse_move, 518, 394, 2, 80, 141] +[:mouse_move, 422, 388, 2, 81, 142] +[:mouse_move, 292, 398, 2, 82, 143] +[:mouse_move, 217, 420, 2, 83, 144] +[:mouse_move, 139, 449, 2, 84, 145] +[:mouse_move, 116, 460, 2, 85, 146] +[:mouse_move, 99, 472, 2, 86, 147] +[:mouse_move, 91, 485, 2, 87, 148] +[:mouse_move, 91, 494, 2, 88, 149] +[:mouse_move, 94, 514, 2, 89, 150] +[:mouse_move, 99, 530, 2, 90, 151] +[:mouse_move, 101, 545, 2, 91, 152] +[:mouse_move, 102, 566, 2, 92, 153] +[:mouse_move, 98, 582, 2, 93, 154] +[:mouse_move, 89, 601, 2, 94, 155] +[:mouse_move, 87, 610, 2, 95, 156] +[:mouse_move, 84, 617, 2, 96, 157] +[:mouse_move, 83, 622, 2, 97, 158] +[:mouse_move, 83, 624, 2, 98, 159] +[:mouse_move, 83, 625, 2, 99, 160] +[:mouse_move, 82, 628, 2, 100, 165] +[:mouse_move, 81, 635, 2, 101, 166] +[:mouse_move, 78, 651, 2, 102, 167] +[:mouse_move, 76, 658, 2, 103, 168] +[:mouse_move, 75, 663, 2, 104, 169] +[:mouse_move, 74, 665, 2, 105, 170] +[:mouse_move, 73, 665, 2, 106, 171] +[:mouse_move, 73, 663, 2, 107, 173] +[:mouse_move, 73, 661, 2, 108, 174] +[:mouse_move, 73, 658, 2, 109, 175] +[:mouse_move, 74, 653, 2, 110, 176] +[:mouse_move, 74, 652, 2, 111, 177] +[:mouse_move, 75, 651, 2, 112, 178] +[:mouse_move, 75, 650, 2, 113, 180] +[:mouse_button_pressed, 1, 0, 1, 114, 184] +[:mouse_button_up, 1, 0, 1, 115, 187] +[:mouse_move, 77, 650, 2, 116, 194] +[:mouse_move, 86, 650, 2, 117, 195] +[:mouse_move, 117, 650, 2, 118, 196] +[:mouse_move, 136, 650, 2, 119, 197] +[:mouse_move, 156, 648, 2, 120, 198] +[:mouse_move, 164, 647, 2, 121, 199] +[:mouse_move, 167, 646, 2, 122, 200] +[:mouse_move, 168, 646, 2, 123, 201] +[:mouse_move, 167, 646, 2, 124, 202] +[:mouse_move, 165, 647, 2, 125, 203] +[:mouse_move, 164, 647, 2, 126, 205] +[:mouse_move, 163, 647, 2, 127, 206] +[:mouse_button_pressed, 1, 0, 1, 128, 210] +[:mouse_button_up, 1, 0, 1, 129, 214] +[:mouse_move, 170, 647, 2, 130, 224] +[:mouse_move, 179, 647, 2, 131, 225] +[:mouse_move, 200, 647, 2, 132, 226] +[:mouse_move, 215, 647, 2, 133, 227] +[:mouse_move, 222, 647, 2, 134, 228] +[:mouse_move, 227, 647, 2, 135, 229] +[:mouse_move, 228, 647, 2, 136, 230] +[:mouse_button_pressed, 1, 0, 1, 137, 232] +[:mouse_button_up, 1, 0, 1, 138, 237] +[:mouse_move, 236, 645, 2, 139, 250] +[:mouse_move, 246, 644, 2, 140, 251] +[:mouse_move, 260, 643, 2, 141, 252] +[:mouse_move, 274, 643, 2, 142, 253] +[:mouse_move, 286, 645, 2, 143, 254] +[:mouse_move, 291, 646, 2, 144, 255] +[:mouse_move, 293, 646, 2, 145, 256] +[:mouse_button_pressed, 1, 0, 1, 146, 257] +[:mouse_move, 294, 647, 2, 147, 257] +[:mouse_button_up, 1, 0, 1, 148, 262] +[:mouse_move, 293, 642, 2, 149, 279] +[:mouse_move, 285, 616, 2, 150, 280] +[:mouse_move, 233, 414, 2, 151, 281] +[:mouse_move, 177, 198, 2, 152, 282] +[:mouse_move, 158, 131, 2, 153, 283] +[:mouse_move, 148, 98, 2, 154, 284] +[:mouse_move, 135, 65, 2, 155, 285] +[:mouse_move, 130, 58, 2, 156, 286] +[:mouse_move, 126, 56, 2, 157, 287] +[:mouse_move, 122, 55, 2, 158, 288] +[:mouse_move, 120, 55, 2, 159, 289] +[:mouse_move, 117, 55, 2, 160, 290] +[:mouse_move, 113, 55, 2, 161, 291] +[:mouse_move, 109, 56, 2, 162, 292] +[:mouse_move, 105, 56, 2, 163, 293] +[:mouse_move, 101, 56, 2, 164, 294] +[:mouse_move, 92, 57, 2, 165, 295] +[:mouse_move, 89, 57, 2, 166, 296] +[:mouse_move, 86, 57, 2, 167, 297] +[:mouse_move, 85, 57, 2, 168, 298] +[:mouse_move, 84, 57, 2, 169, 299] +[:mouse_button_pressed, 1, 0, 1, 170, 299] +[:mouse_button_up, 1, 0, 1, 171, 302] +[:mouse_move, 85, 57, 2, 172, 305] +[:mouse_move, 90, 57, 2, 173, 306] +[:mouse_move, 98, 57, 2, 174, 307] +[:mouse_move, 117, 57, 2, 175, 308] +[:mouse_move, 124, 57, 2, 176, 309] +[:mouse_move, 131, 57, 2, 177, 310] +[:mouse_move, 133, 57, 2, 178, 311] +[:mouse_move, 134, 57, 2, 179, 312] +[:mouse_move, 135, 57, 2, 180, 314] +[:mouse_button_pressed, 1, 0, 1, 181, 314] +[:mouse_button_up, 1, 0, 1, 182, 318] +[:mouse_move, 137, 57, 2, 183, 320] +[:mouse_move, 146, 57, 2, 184, 321] +[:mouse_move, 155, 57, 2, 185, 322] +[:mouse_move, 169, 57, 2, 186, 323] +[:mouse_move, 184, 57, 2, 187, 324] +[:mouse_move, 190, 57, 2, 188, 324] +[:mouse_move, 200, 57, 2, 189, 325] +[:mouse_move, 206, 57, 2, 190, 326] +[:mouse_move, 211, 57, 2, 191, 327] +[:mouse_move, 216, 57, 2, 192, 328] +[:mouse_move, 217, 57, 2, 193, 330] +[:mouse_button_pressed, 1, 0, 1, 194, 332] +[:mouse_button_up, 1, 0, 1, 195, 335] +[:mouse_move, 220, 57, 2, 196, 337] +[:mouse_move, 243, 57, 2, 197, 338] +[:mouse_move, 267, 57, 2, 198, 339] +[:mouse_move, 283, 57, 2, 199, 340] +[:mouse_move, 292, 57, 2, 200, 341] +[:mouse_move, 299, 57, 2, 201, 342] +[:mouse_move, 298, 57, 2, 202, 346] +[:mouse_move, 297, 57, 2, 203, 348] +[:mouse_move, 296, 57, 2, 204, 350] +[:mouse_button_pressed, 1, 0, 1, 205, 352] +[:mouse_button_up, 1, 0, 1, 206, 355] +[:mouse_move, 298, 57, 2, 207, 364] +[:mouse_move, 405, 53, 2, 208, 365] +[:mouse_move, 681, 55, 2, 209, 366] +[:mouse_move, 983, 86, 2, 210, 367] +[:mouse_move, 1117, 92, 2, 211, 368] +[:mouse_move, 1249, 93, 2, 212, 369] +[:mouse_move, 1299, 89, 2, 213, 370] +[:mouse_move, 1321, 85, 2, 214, 371] +[:mouse_move, 1314, 72, 2, 215, 378] +[:mouse_move, 1277, 66, 2, 216, 379] +[:mouse_move, 1249, 61, 2, 217, 380] +[:mouse_move, 1223, 56, 2, 218, 381] +[:mouse_move, 1212, 54, 2, 219, 382] +[:mouse_move, 1203, 50, 2, 220, 383] +[:mouse_move, 1200, 49, 2, 221, 384] +[:mouse_move, 1195, 46, 2, 222, 385] +[:mouse_move, 1191, 44, 2, 223, 386] +[:mouse_move, 1186, 42, 2, 224, 387] +[:mouse_move, 1184, 41, 2, 225, 388] +[:mouse_move, 1181, 41, 2, 226, 389] +[:mouse_button_pressed, 1, 0, 1, 227, 390] +[:mouse_move, 1181, 40, 2, 228, 390] +[:mouse_button_up, 1, 0, 1, 229, 393] +[:mouse_move, 1157, 44, 2, 230, 400] +[:mouse_move, 1085, 71, 2, 231, 401] +[:mouse_move, 1011, 102, 2, 232, 402] +[:mouse_move, 928, 141, 2, 233, 403] +[:mouse_move, 763, 235, 2, 234, 404] +[:mouse_move, 702, 276, 2, 235, 405] +[:mouse_move, 644, 318, 2, 236, 406] +[:mouse_move, 620, 338, 2, 237, 407] +[:mouse_move, 599, 357, 2, 238, 408] +[:mouse_move, 592, 363, 2, 239, 409] +[:mouse_move, 589, 365, 2, 240, 410] +[:mouse_move, 588, 365, 2, 241, 411] +[:mouse_move, 588, 366, 2, 242, 412] +[:mouse_move, 588, 365, 2, 243, 415] +[:mouse_move, 590, 365, 2, 244, 417] +[:mouse_move, 592, 364, 2, 245, 418] +[:mouse_move, 592, 363, 2, 246, 420] +[:mouse_move, 593, 362, 2, 247, 421] +[:mouse_button_pressed, 1, 0, 1, 248, 422] +[:mouse_button_up, 1, 0, 1, 249, 427] +[:mouse_move, 587, 359, 2, 250, 454] +[:mouse_move, 554, 341, 2, 251, 455] +[:mouse_move, 325, 237, 2, 252, 456] +[:mouse_move, 196, 188, 2, 253, 457] +[:mouse_move, 141, 167, 2, 254, 458] +[:mouse_move, 94, 147, 2, 255, 459] +[:mouse_move, 56, 125, 2, 256, 460] +[:mouse_move, 46, 119, 2, 257, 461] +[:mouse_move, 39, 113, 2, 258, 462] +[:mouse_move, 37, 110, 2, 259, 463] +[:mouse_move, 35, 105, 2, 260, 464] +[:mouse_move, 33, 101, 2, 261, 465] +[:mouse_move, 28, 90, 2, 262, 466] +[:mouse_move, 26, 82, 2, 263, 467] +[:mouse_move, 20, 66, 2, 264, 468] +[:mouse_move, 9, 42, 2, 265, 469] +[:mouse_move, 3, 32, 2, 266, 470] +[:mouse_move, -4, 18, 2, 267, 471] +[:mouse_move, -8, 11, 2, 268, 472] +[:mouse_move, -11, 7, 2, 269, 473] +[:mouse_move, -13, 5, 2, 270, 474] +[:mouse_move, -17, 1, 2, 271, 475] +[:mouse_move, -19, 0, 2, 272, 476] diff --git a/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-black.png b/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-black.png new file mode 100644 index 0000000..f50c872 Binary files /dev/null and b/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-black.png differ diff --git a/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-gray.png b/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-gray.png new file mode 100644 index 0000000..e8c4c5a Binary files /dev/null and b/samples/99_genre_rpg_tactical/hexagonal_grid/sprites/hexagon-gray.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/app/main.rb b/samples/99_genre_rpg_tactical/isometric_grid/app/main.rb new file mode 100644 index 0000000..28bea32 --- /dev/null +++ b/samples/99_genre_rpg_tactical/isometric_grid/app/main.rb @@ -0,0 +1,262 @@ +class Isometric + attr_accessor :grid, :inputs, :state, :outputs + + def tick + defaults + render + calc + process_inputs + end + + def defaults + state.quantity ||= 6 #Size of grid + state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles + state.tileGrid ||= [] #Holds ordering of tiles + state.currentSpriteLocation ||= -1 #Current Sprite hovering location + state.tileCords ||= [] #Physical, rendering cordinates + state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0) + state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size + state.mode ||= :delete #Switches between :delete and :insert + state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2], + ['mountain', 0, 0, 262 / 2, 245 / 2], + ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information + #['name', deltaX, deltaY, sizeW, sizeH] + #^delta refers to distance from tile cords + + #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc + if state.tileGrid == [] + tempX = 0 + tempY = 0 + tempLeft = false + tempRight = false + count = 0 + (state.quantity * state.quantity).times do + if tempY == 0 + tempLeft = true + end + if tempX == (state.quantity - 1) + tempRight = true + end + state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count]) + #orderX, orderY, exists?, leftSide, rightSide, order + tempX += 1 + if tempX == state.quantity + tempX = 0 + tempY += 1 + end + tempLeft = false + tempRight = false + count += 1 + end + end + + #Calculates physical cordinates for tiles + if state.tileCords == [] + state.tileCords = state.tileGrid.map do + |val| + x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2) + y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2) + [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now + end + end + + end + + def render + renderBackground + renderLeft + renderRight + renderTiles + renderObjects + renderLabels + end + + def renderBackground + outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color + end + + def renderLeft + #Shows the pink left cube face + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered + [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], + state.sideSize[1], 'sprites/leftSide.png'] + end + end + end + + def renderRight + #Shows the green right cube face + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered + [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], + state.sideSize[1], 'sprites/rightSide.png'] + end + end + end + + def renderTiles + #Shows the tile itself. Important that it's rendered after the two above! + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true #Chcekcs if tile needs to be rendered + if val[5] == state.currentSpriteLocation + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png'] + else + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png'] + end + end + end + end + + def renderObjects + #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner + #to bottom corner. + a = (state.quantity * state.quantity) - state.quantity + iter = 0 + loop do + if state.tileCords[a][2] == true && state.tileCords[a][6] != -1 + outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1], + state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2], + state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4], + 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png'] + end + iter += 1 + a += 1 + a -= state.quantity * 2 if iter == state.quantity + iter = 0 if iter == state.quantity + break if a < 0 + end + end + + def renderLabels + #Labels + outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete + outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete + outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert + outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert + end + + def calc + calcCurrentHover + end + + def calcCurrentHover + #This determines what tile the mouse is hovering (or last hovering) over + x = inputs.mouse.position.x + y = inputs.mouse.position.y + m = (state.tileSize[1] / state.tileSize[0]) #slope + state.tileCords.map do + |val| + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) + next unless val[0] < x && x < val[0] + state.tileSize[0] + next unless val[1] < y && y < val[1] + state.tileSize[1] + next unless val[2] == true + tempBool = false + if x == val[0] + (state.tileSize[0] / 2) + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond + tempBool = true + elsif x < state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y < tempY1 && y > tempY2 + elsif x > state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y > tempY1 && y < tempY2 + end + + if tempBool == true + state.currentSpriteLocation = val[5] #Current sprite location set to the order value + end + end + end + + def process_inputs + #Makes development much faster and easier + if inputs.keyboard.key_up.r + $dragon.reset + end + checkTileSelected + switchModes + end + + def checkTileSelected + if inputs.mouse.down + x = inputs.mouse.down.point.x + y = inputs.mouse.down.point.y + m = (state.tileSize[1] / state.tileSize[0]) #slope + state.tileCords.map do + |val| + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) + next unless val[0] < x && x < val[0] + state.tileSize[0] + next unless val[1] < y && y < val[1] + state.tileSize[1] + next unless val[2] == true + tempBool = false + if x == val[0] + (state.tileSize[0] / 2) + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond + tempBool = true + elsif x < state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y < tempY1 && y > tempY2 + elsif x > state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y > tempY1 && y < tempY2 + end + + if tempBool == true + if state.mode == :delete + val[2] = false + state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency + state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered + unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered + state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing + state.tileCords[val[5] - 1][4] = true + end + unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side + state.tileGrid[val[5] + state.quantity][3] = true + state.tileCords[val[5] + state.quantity][3] = true + end + elsif state.mode == :insert + #adds the current sprite value selected to tileCords. (changes from the -1 earlier) + val[6] = rand(state.spriteSelection.length) + end + end + end + end + end + + def switchModes + #Switches between insert and delete modes + if inputs.keyboard.key_up.i && state.mode == :delete + state.mode = :insert + inputs.keyboard.clear + elsif inputs.keyboard.key_up.d && state.mode == :insert + state.mode = :delete + inputs.keyboard.clear + end + end + +end + +$isometric = Isometric.new + +def tick args + $isometric.grid = args.grid + $isometric.inputs = args.inputs + $isometric.state = args.state + $isometric.outputs = args.outputs + $isometric.tick +end diff --git a/samples/99_genre_rpg_tactical/isometric_grid/license-for-sample.txt b/samples/99_genre_rpg_tactical/isometric_grid/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_tactical/isometric_grid/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_tactical/isometric_grid/metadata/game_metadata.txt b/samples/99_genre_rpg_tactical/isometric_grid/metadata/game_metadata.txt new file mode 100644 index 0000000..1b03500 --- /dev/null +++ b/samples/99_genre_rpg_tactical/isometric_grid/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +#devid=myname +#devtitle=My Name +#gameid=mygame +#gametitle=My Game +#version=0.1 +#icon=metadata/icon.png diff --git a/samples/99_genre_rpg_tactical/isometric_grid/metadata/icon.png b/samples/99_genre_rpg_tactical/isometric_grid/metadata/icon.png new file mode 100644 index 0000000..e20e8c2 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/metadata/icon.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/replay.txt b/samples/99_genre_rpg_tactical/isometric_grid/replay.txt new file mode 100644 index 0000000..1cf14a2 --- /dev/null +++ b/samples/99_genre_rpg_tactical/isometric_grid/replay.txt @@ -0,0 +1,579 @@ +replay_version 2.0 +stopped_at 1116 +seed 100 +recorded_at Sat Feb 01 20:04:50 2020 +[:mouse_move, -27, 201, 2, 1, 76] +[:mouse_move, -23, 204, 2, 2, 77] +[:mouse_move, -12, 212, 2, 3, 78] +[:mouse_move, -5, 220, 2, 4, 79] +[:mouse_move, -2, 219, 2, 5, 96] +[:mouse_move, 4, 217, 2, 6, 97] +[:mouse_move, 24, 209, 2, 7, 98] +[:mouse_move, 38, 202, 2, 8, 99] +[:mouse_move, 66, 194, 2, 9, 100] +[:mouse_move, 71, 192, 2, 10, 101] +[:mouse_move, 86, 187, 2, 11, 102] +[:mouse_move, 92, 185, 2, 12, 103] +[:mouse_move, 99, 183, 2, 13, 104] +[:mouse_move, 100, 182, 2, 14, 105] +[:mouse_move, 101, 182, 2, 15, 106] +[:mouse_move, 102, 181, 2, 16, 107] +[:mouse_move, 102, 180, 2, 17, 112] +[:mouse_button_pressed, 1, 0, 1, 18, 114] +[:mouse_button_up, 1, 0, 1, 19, 120] +[:mouse_move, 103, 174, 2, 20, 135] +[:mouse_move, 105, 169, 2, 21, 136] +[:mouse_move, 107, 156, 2, 22, 137] +[:mouse_move, 108, 147, 2, 23, 138] +[:mouse_move, 108, 122, 2, 24, 139] +[:mouse_move, 104, 108, 2, 25, 140] +[:mouse_move, 101, 102, 2, 26, 141] +[:mouse_move, 94, 92, 2, 27, 142] +[:mouse_move, 90, 89, 2, 28, 143] +[:mouse_move, 83, 85, 2, 29, 144] +[:mouse_move, 78, 83, 2, 30, 145] +[:mouse_move, 72, 81, 2, 31, 146] +[:mouse_move, 69, 80, 2, 32, 147] +[:mouse_move, 66, 78, 2, 33, 148] +[:mouse_move, 65, 78, 2, 34, 149] +[:mouse_move, 64, 78, 2, 35, 150] +[:mouse_move, 64, 77, 2, 36, 151] +[:mouse_move, 69, 77, 2, 37, 154] +[:mouse_move, 74, 77, 2, 38, 155] +[:mouse_move, 96, 76, 2, 39, 156] +[:mouse_move, 118, 76, 2, 40, 157] +[:mouse_move, 145, 75, 2, 41, 158] +[:mouse_move, 162, 74, 2, 42, 159] +[:mouse_move, 183, 73, 2, 43, 160] +[:mouse_move, 196, 72, 2, 44, 161] +[:mouse_move, 215, 70, 2, 45, 162] +[:mouse_move, 218, 70, 2, 46, 163] +[:mouse_move, 228, 69, 2, 47, 164] +[:mouse_move, 232, 69, 2, 48, 165] +[:mouse_move, 233, 69, 2, 49, 166] +[:mouse_move, 236, 69, 2, 50, 167] +[:mouse_move, 237, 69, 2, 51, 168] +[:mouse_move, 243, 70, 2, 52, 169] +[:mouse_move, 244, 70, 2, 53, 170] +[:mouse_move, 247, 70, 2, 54, 171] +[:mouse_move, 249, 70, 2, 55, 172] +[:mouse_move, 250, 70, 2, 56, 173] +[:mouse_move, 251, 70, 2, 57, 175] +[:mouse_move, 249, 70, 2, 58, 184] +[:mouse_move, 236, 70, 2, 59, 185] +[:mouse_move, 222, 70, 2, 60, 186] +[:mouse_move, 170, 71, 2, 61, 187] +[:mouse_move, 138, 75, 2, 62, 188] +[:mouse_move, 70, 87, 2, 63, 189] +[:mouse_move, 56, 91, 2, 64, 190] +[:mouse_move, 21, 100, 2, 65, 191] +[:mouse_move, 1, 107, 2, 66, 192] +[:mouse_move, -7, 110, 2, 67, 193] +[:mouse_move, -14, 114, 2, 68, 194] +[:mouse_move, -17, 115, 2, 69, 195] +[:mouse_move, -17, 116, 2, 70, 196] +[:mouse_move, -9, 117, 2, 71, 197] +[:mouse_move, 22, 119, 2, 72, 198] +[:mouse_move, 44, 119, 2, 73, 199] +[:mouse_move, 84, 120, 2, 74, 200] +[:mouse_move, 107, 120, 2, 75, 201] +[:mouse_move, 120, 120, 2, 76, 202] +[:mouse_move, 132, 120, 2, 77, 203] +[:mouse_move, 145, 120, 2, 78, 204] +[:mouse_move, 148, 120, 2, 79, 205] +[:mouse_move, 150, 120, 2, 80, 206] +[:mouse_move, 151, 120, 2, 81, 207] +[:mouse_move, 152, 120, 2, 82, 220] +[:mouse_move, 153, 120, 2, 83, 301] +[:mouse_move, 156, 120, 2, 84, 302] +[:mouse_move, 158, 120, 2, 85, 303] +[:mouse_move, 163, 120, 2, 86, 304] +[:mouse_move, 165, 120, 2, 87, 305] +[:mouse_move, 168, 118, 2, 88, 306] +[:mouse_move, 170, 116, 2, 89, 307] +[:mouse_move, 172, 113, 2, 90, 308] +[:mouse_move, 173, 110, 2, 91, 309] +[:mouse_move, 176, 104, 2, 92, 310] +[:mouse_move, 176, 101, 2, 93, 311] +[:mouse_move, 176, 93, 2, 94, 312] +[:mouse_move, 176, 89, 2, 95, 313] +[:mouse_move, 173, 85, 2, 96, 314] +[:mouse_move, 172, 83, 2, 97, 315] +[:mouse_move, 171, 78, 2, 98, 316] +[:mouse_move, 170, 76, 2, 99, 317] +[:mouse_move, 169, 73, 2, 100, 318] +[:mouse_move, 168, 72, 2, 101, 319] +[:mouse_move, 164, 70, 2, 102, 320] +[:mouse_move, 161, 68, 2, 103, 321] +[:mouse_move, 152, 68, 2, 104, 322] +[:mouse_move, 147, 68, 2, 105, 323] +[:mouse_move, 140, 68, 2, 106, 324] +[:mouse_move, 134, 68, 2, 107, 325] +[:mouse_move, 126, 70, 2, 108, 326] +[:mouse_move, 123, 72, 2, 109, 327] +[:mouse_move, 118, 77, 2, 110, 328] +[:mouse_move, 116, 82, 2, 111, 329] +[:mouse_move, 112, 94, 2, 112, 330] +[:mouse_move, 110, 101, 2, 113, 331] +[:mouse_move, 110, 114, 2, 114, 332] +[:mouse_move, 110, 122, 2, 115, 333] +[:mouse_move, 114, 126, 2, 116, 334] +[:mouse_move, 120, 130, 2, 117, 335] +[:mouse_move, 125, 132, 2, 118, 336] +[:mouse_move, 139, 133, 2, 119, 337] +[:mouse_move, 147, 133, 2, 120, 338] +[:mouse_move, 162, 133, 2, 121, 339] +[:mouse_move, 168, 131, 2, 122, 340] +[:mouse_move, 178, 125, 2, 123, 341] +[:mouse_move, 179, 124, 2, 124, 342] +[:mouse_move, 186, 117, 2, 125, 343] +[:mouse_move, 188, 113, 2, 126, 344] +[:mouse_move, 189, 101, 2, 127, 345] +[:mouse_move, 189, 97, 2, 128, 346] +[:mouse_move, 186, 87, 2, 129, 347] +[:mouse_move, 183, 82, 2, 130, 348] +[:mouse_move, 176, 75, 2, 131, 349] +[:mouse_move, 167, 71, 2, 132, 350] +[:mouse_move, 155, 71, 2, 133, 351] +[:mouse_move, 149, 71, 2, 134, 352] +[:mouse_move, 140, 71, 2, 135, 353] +[:mouse_move, 137, 73, 2, 136, 354] +[:mouse_move, 134, 74, 2, 137, 355] +[:mouse_move, 131, 76, 2, 138, 356] +[:mouse_move, 130, 76, 2, 139, 357] +[:mouse_move, 130, 77, 2, 140, 358] +[:mouse_move, 130, 78, 2, 141, 360] +[:mouse_move, 131, 78, 2, 142, 362] +[:key_down_raw, 105, 0, 2, 143, 365] +[:key_up_raw, 105, 0, 2, 144, 370] +[:mouse_move, 135, 78, 2, 145, 391] +[:mouse_move, 141, 78, 2, 146, 392] +[:mouse_move, 176, 87, 2, 147, 393] +[:mouse_move, 216, 103, 2, 148, 394] +[:mouse_move, 384, 182, 2, 149, 395] +[:mouse_move, 464, 234, 2, 150, 396] +[:mouse_move, 574, 322, 2, 151, 397] +[:mouse_move, 599, 344, 2, 152, 398] +[:mouse_move, 649, 384, 2, 153, 399] +[:mouse_move, 648, 388, 2, 154, 413] +[:mouse_move, 646, 393, 2, 155, 414] +[:mouse_move, 641, 403, 2, 156, 415] +[:mouse_move, 635, 410, 2, 157, 416] +[:mouse_move, 626, 422, 2, 158, 417] +[:mouse_move, 614, 433, 2, 159, 418] +[:mouse_move, 613, 435, 2, 160, 419] +[:mouse_move, 608, 438, 2, 161, 420] +[:mouse_move, 605, 440, 2, 162, 421] +[:mouse_move, 604, 440, 2, 163, 422] +[:mouse_move, 603, 441, 2, 164, 423] +[:mouse_move, 602, 441, 2, 165, 431] +[:mouse_button_pressed, 1, 0, 1, 166, 433] +[:mouse_button_up, 1, 0, 1, 167, 439] +[:mouse_move, 603, 441, 2, 168, 444] +[:mouse_move, 606, 438, 2, 169, 445] +[:mouse_move, 613, 434, 2, 170, 446] +[:mouse_move, 622, 426, 2, 171, 447] +[:mouse_move, 624, 423, 2, 172, 448] +[:mouse_move, 634, 413, 2, 173, 449] +[:mouse_move, 635, 411, 2, 174, 450] +[:mouse_move, 641, 404, 2, 175, 451] +[:mouse_move, 642, 403, 2, 176, 452] +[:mouse_move, 644, 400, 2, 177, 453] +[:mouse_move, 645, 398, 2, 178, 454] +[:mouse_move, 646, 397, 2, 179, 455] +[:mouse_move, 646, 396, 2, 180, 457] +[:mouse_button_pressed, 1, 0, 1, 181, 459] +[:mouse_button_up, 1, 0, 1, 182, 465] +[:mouse_move, 649, 396, 2, 183, 468] +[:mouse_move, 653, 396, 2, 184, 469] +[:mouse_move, 664, 397, 2, 185, 470] +[:mouse_move, 666, 398, 2, 186, 471] +[:mouse_move, 676, 405, 2, 187, 472] +[:mouse_move, 679, 408, 2, 188, 473] +[:mouse_move, 684, 416, 2, 189, 474] +[:mouse_move, 685, 417, 2, 190, 475] +[:mouse_move, 688, 420, 2, 191, 476] +[:mouse_move, 688, 422, 2, 192, 477] +[:mouse_move, 689, 424, 2, 193, 478] +[:mouse_move, 690, 426, 2, 194, 479] +[:mouse_move, 692, 428, 2, 195, 480] +[:mouse_move, 693, 429, 2, 196, 481] +[:mouse_move, 694, 430, 2, 197, 482] +[:mouse_move, 695, 432, 2, 198, 483] +[:mouse_button_pressed, 1, 0, 1, 199, 485] +[:mouse_move, 696, 432, 2, 200, 485] +[:mouse_button_up, 1, 0, 1, 201, 492] +[:mouse_move, 699, 430, 2, 202, 496] +[:mouse_move, 705, 427, 2, 203, 497] +[:mouse_move, 709, 425, 2, 204, 498] +[:mouse_move, 718, 421, 2, 205, 499] +[:mouse_move, 725, 418, 2, 206, 500] +[:mouse_move, 736, 412, 2, 207, 501] +[:mouse_move, 742, 410, 2, 208, 502] +[:mouse_move, 750, 406, 2, 209, 503] +[:mouse_move, 753, 405, 2, 210, 504] +[:mouse_move, 759, 402, 2, 211, 505] +[:mouse_move, 761, 400, 2, 212, 506] +[:mouse_move, 764, 398, 2, 213, 507] +[:mouse_move, 765, 397, 2, 214, 508] +[:mouse_move, 768, 397, 2, 215, 509] +[:mouse_move, 769, 396, 2, 216, 510] +[:mouse_move, 770, 396, 2, 217, 512] +[:mouse_button_pressed, 1, 0, 1, 218, 514] +[:mouse_move, 770, 395, 2, 219, 514] +[:mouse_button_up, 1, 0, 1, 220, 523] +[:mouse_move, 770, 394, 2, 221, 528] +[:mouse_move, 770, 393, 2, 222, 530] +[:mouse_move, 762, 389, 2, 223, 532] +[:mouse_move, 757, 387, 2, 224, 533] +[:mouse_move, 741, 379, 2, 225, 534] +[:mouse_move, 737, 377, 2, 226, 535] +[:mouse_move, 718, 369, 2, 227, 536] +[:mouse_move, 711, 364, 2, 228, 537] +[:mouse_move, 701, 356, 2, 229, 538] +[:mouse_move, 699, 354, 2, 230, 539] +[:mouse_move, 694, 348, 2, 231, 540] +[:mouse_move, 692, 346, 2, 232, 541] +[:mouse_move, 690, 344, 2, 233, 542] +[:mouse_move, 690, 343, 2, 234, 543] +[:mouse_move, 689, 342, 2, 235, 544] +[:mouse_button_pressed, 1, 0, 1, 236, 546] +[:mouse_button_up, 1, 0, 1, 237, 554] +[:mouse_move, 689, 340, 2, 238, 555] +[:mouse_move, 689, 339, 2, 239, 556] +[:mouse_move, 686, 333, 2, 240, 557] +[:mouse_move, 684, 330, 2, 241, 558] +[:mouse_move, 681, 325, 2, 242, 559] +[:mouse_move, 678, 322, 2, 243, 560] +[:mouse_move, 673, 315, 2, 244, 561] +[:mouse_move, 669, 312, 2, 245, 562] +[:mouse_move, 665, 308, 2, 246, 563] +[:mouse_move, 664, 307, 2, 247, 564] +[:mouse_move, 660, 304, 2, 248, 565] +[:mouse_move, 659, 302, 2, 249, 566] +[:mouse_move, 656, 301, 2, 250, 567] +[:mouse_move, 653, 300, 2, 251, 568] +[:mouse_move, 651, 299, 2, 252, 569] +[:mouse_move, 650, 298, 2, 253, 570] +[:mouse_move, 649, 298, 2, 254, 571] +[:mouse_move, 648, 297, 2, 255, 572] +[:mouse_button_pressed, 1, 0, 1, 256, 573] +[:mouse_button_up, 1, 0, 1, 257, 580] +[:mouse_move, 645, 297, 2, 258, 582] +[:mouse_move, 641, 297, 2, 259, 583] +[:mouse_move, 628, 297, 2, 260, 584] +[:mouse_move, 620, 297, 2, 261, 585] +[:mouse_move, 606, 297, 2, 262, 586] +[:mouse_move, 590, 297, 2, 263, 587] +[:mouse_move, 571, 297, 2, 264, 588] +[:mouse_move, 567, 297, 2, 265, 589] +[:mouse_move, 550, 297, 2, 266, 590] +[:mouse_move, 544, 297, 2, 267, 591] +[:mouse_move, 535, 296, 2, 268, 592] +[:mouse_move, 531, 295, 2, 269, 593] +[:mouse_move, 526, 293, 2, 270, 594] +[:mouse_move, 525, 293, 2, 271, 595] +[:mouse_move, 523, 291, 2, 272, 596] +[:mouse_move, 522, 290, 2, 273, 598] +[:mouse_move, 522, 289, 2, 274, 599] +[:mouse_move, 522, 288, 2, 275, 601] +[:mouse_button_pressed, 1, 0, 1, 276, 604] +[:mouse_move, 521, 288, 2, 277, 604] +[:mouse_button_up, 1, 0, 1, 278, 612] +[:mouse_move, 514, 283, 2, 279, 652] +[:mouse_move, 505, 277, 2, 280, 653] +[:mouse_move, 477, 262, 2, 281, 654] +[:mouse_move, 443, 241, 2, 282, 655] +[:mouse_move, 348, 187, 2, 283, 656] +[:mouse_move, 288, 155, 2, 284, 657] +[:mouse_move, 169, 90, 2, 285, 658] +[:mouse_move, 147, 77, 2, 286, 659] +[:mouse_move, 118, 61, 2, 287, 660] +[:mouse_move, 94, 48, 2, 288, 661] +[:mouse_move, 62, 28, 2, 289, 662] +[:mouse_move, 51, 20, 2, 290, 663] +[:mouse_move, 44, 17, 2, 291, 664] +[:mouse_move, 39, 12, 2, 292, 665] +[:mouse_move, 38, 11, 2, 293, 666] +[:mouse_move, 36, 11, 2, 294, 667] +[:mouse_move, 36, 10, 2, 295, 668] +[:mouse_move, 38, 19, 2, 296, 671] +[:mouse_move, 41, 24, 2, 297, 672] +[:mouse_move, 45, 36, 2, 298, 673] +[:mouse_move, 48, 39, 2, 299, 674] +[:mouse_move, 51, 49, 2, 300, 675] +[:mouse_move, 53, 53, 2, 301, 676] +[:mouse_move, 56, 60, 2, 302, 677] +[:mouse_move, 57, 62, 2, 303, 678] +[:mouse_move, 60, 70, 2, 304, 679] +[:mouse_move, 65, 77, 2, 305, 680] +[:mouse_move, 73, 86, 2, 306, 681] +[:mouse_move, 77, 91, 2, 307, 682] +[:mouse_move, 89, 101, 2, 308, 683] +[:mouse_move, 97, 105, 2, 309, 684] +[:mouse_move, 117, 114, 2, 310, 685] +[:mouse_move, 122, 116, 2, 311, 686] +[:mouse_move, 137, 118, 2, 312, 687] +[:mouse_move, 150, 119, 2, 313, 688] +[:mouse_move, 155, 119, 2, 314, 689] +[:mouse_move, 165, 119, 2, 315, 690] +[:mouse_move, 170, 117, 2, 316, 691] +[:mouse_move, 174, 114, 2, 317, 692] +[:mouse_move, 177, 112, 2, 318, 693] +[:mouse_move, 180, 108, 2, 319, 694] +[:mouse_move, 181, 106, 2, 320, 695] +[:mouse_move, 182, 99, 2, 321, 696] +[:mouse_move, 182, 96, 2, 322, 697] +[:mouse_move, 180, 91, 2, 323, 698] +[:mouse_move, 179, 88, 2, 324, 699] +[:mouse_move, 173, 83, 2, 325, 700] +[:mouse_move, 168, 80, 2, 326, 701] +[:mouse_move, 154, 78, 2, 327, 702] +[:mouse_move, 150, 78, 2, 328, 703] +[:mouse_move, 141, 78, 2, 329, 704] +[:mouse_move, 138, 78, 2, 330, 705] +[:mouse_move, 132, 78, 2, 331, 706] +[:mouse_move, 130, 78, 2, 332, 707] +[:mouse_move, 128, 78, 2, 333, 708] +[:mouse_move, 126, 80, 2, 334, 709] +[:mouse_move, 124, 83, 2, 335, 710] +[:mouse_move, 124, 85, 2, 336, 711] +[:mouse_move, 123, 88, 2, 337, 712] +[:mouse_move, 122, 91, 2, 338, 713] +[:mouse_move, 122, 96, 2, 339, 714] +[:mouse_move, 122, 97, 2, 340, 715] +[:mouse_move, 122, 100, 2, 341, 716] +[:mouse_move, 122, 101, 2, 342, 717] +[:mouse_move, 125, 103, 2, 343, 718] +[:mouse_move, 128, 103, 2, 344, 719] +[:mouse_move, 135, 104, 2, 345, 720] +[:mouse_move, 146, 104, 2, 346, 721] +[:mouse_move, 152, 104, 2, 347, 722] +[:mouse_move, 160, 102, 2, 348, 723] +[:mouse_move, 164, 101, 2, 349, 724] +[:mouse_move, 169, 98, 2, 350, 725] +[:mouse_move, 171, 97, 2, 351, 726] +[:mouse_move, 173, 91, 2, 352, 727] +[:mouse_move, 173, 88, 2, 353, 728] +[:mouse_move, 172, 75, 2, 354, 729] +[:mouse_move, 167, 68, 2, 355, 730] +[:mouse_move, 153, 53, 2, 356, 731] +[:mouse_move, 146, 45, 2, 357, 732] +[:mouse_move, 122, 35, 2, 358, 733] +[:mouse_move, 109, 33, 2, 359, 734] +[:mouse_move, 83, 30, 2, 360, 735] +[:mouse_move, 70, 30, 2, 361, 736] +[:mouse_move, 54, 34, 2, 362, 737] +[:mouse_move, 45, 37, 2, 363, 738] +[:mouse_move, 35, 44, 2, 364, 739] +[:mouse_move, 26, 53, 2, 365, 740] +[:mouse_move, 21, 72, 2, 366, 741] +[:mouse_move, 20, 87, 2, 367, 742] +[:mouse_move, 20, 110, 2, 368, 743] +[:mouse_move, 20, 122, 2, 369, 744] +[:mouse_move, 32, 147, 2, 370, 745] +[:mouse_move, 46, 158, 2, 371, 746] +[:mouse_move, 76, 168, 2, 372, 747] +[:mouse_move, 122, 177, 2, 373, 748] +[:mouse_move, 149, 182, 2, 374, 749] +[:mouse_move, 186, 185, 2, 375, 750] +[:mouse_move, 208, 185, 2, 376, 751] +[:mouse_move, 228, 182, 2, 377, 752] +[:mouse_move, 240, 177, 2, 378, 753] +[:mouse_move, 259, 160, 2, 379, 754] +[:mouse_move, 264, 148, 2, 380, 755] +[:mouse_move, 268, 120, 2, 381, 756] +[:mouse_move, 269, 103, 2, 382, 757] +[:mouse_move, 268, 82, 2, 383, 758] +[:mouse_move, 261, 61, 2, 384, 759] +[:mouse_move, 237, 35, 2, 385, 760] +[:mouse_move, 221, 26, 2, 386, 761] +[:mouse_move, 174, 17, 2, 387, 762] +[:mouse_move, 161, 17, 2, 388, 763] +[:mouse_move, 107, 17, 2, 389, 764] +[:mouse_move, 84, 19, 2, 390, 765] +[:mouse_move, 59, 26, 2, 391, 766] +[:mouse_move, 48, 30, 2, 392, 767] +[:mouse_move, 23, 46, 2, 393, 768] +[:mouse_move, 18, 55, 2, 394, 769] +[:mouse_move, 13, 69, 2, 395, 770] +[:mouse_move, 12, 76, 2, 396, 771] +[:mouse_move, 12, 85, 2, 397, 772] +[:mouse_move, 13, 97, 2, 398, 773] +[:mouse_move, 19, 102, 2, 399, 774] +[:mouse_move, 36, 105, 2, 400, 775] +[:mouse_move, 46, 106, 2, 401, 776] +[:mouse_move, 62, 107, 2, 402, 777] +[:mouse_move, 73, 107, 2, 403, 778] +[:mouse_move, 83, 107, 2, 404, 779] +[:mouse_move, 112, 118, 2, 405, 818] +[:mouse_move, 141, 134, 2, 406, 819] +[:mouse_move, 230, 194, 2, 407, 820] +[:mouse_move, 324, 265, 2, 408, 821] +[:mouse_move, 423, 340, 2, 409, 822] +[:key_down_raw, 100, 0, 2, 410, 823] +[:key_up_raw, 100, 0, 2, 411, 823] +[:mouse_move, 452, 361, 2, 412, 823] +[:mouse_move, 473, 376, 2, 413, 823] +[:mouse_move, 487, 385, 2, 414, 824] +[:mouse_move, 490, 382, 2, 415, 837] +[:mouse_move, 497, 379, 2, 416, 838] +[:mouse_move, 509, 371, 2, 417, 839] +[:mouse_move, 517, 366, 2, 418, 840] +[:mouse_move, 528, 360, 2, 419, 841] +[:mouse_move, 532, 358, 2, 420, 842] +[:mouse_move, 538, 354, 2, 421, 843] +[:mouse_move, 541, 352, 2, 422, 844] +[:mouse_move, 545, 348, 2, 423, 845] +[:mouse_move, 546, 346, 2, 424, 846] +[:mouse_move, 548, 343, 2, 425, 847] +[:mouse_move, 549, 340, 2, 426, 848] +[:mouse_move, 552, 329, 2, 427, 849] +[:mouse_move, 554, 324, 2, 428, 850] +[:mouse_move, 558, 314, 2, 429, 851] +[:mouse_move, 562, 309, 2, 430, 852] +[:mouse_move, 567, 298, 2, 431, 853] +[:mouse_move, 568, 296, 2, 432, 854] +[:mouse_move, 571, 290, 2, 433, 855] +[:mouse_move, 572, 286, 2, 434, 856] +[:mouse_move, 573, 285, 2, 435, 857] +[:mouse_move, 574, 283, 2, 436, 858] +[:mouse_move, 574, 282, 2, 437, 860] +[:mouse_move, 574, 281, 2, 438, 861] +[:mouse_move, 576, 280, 2, 439, 863] +[:mouse_move, 576, 279, 2, 440, 864] +[:mouse_move, 576, 277, 2, 441, 865] +[:mouse_move, 577, 274, 2, 442, 866] +[:mouse_move, 577, 273, 2, 443, 867] +[:mouse_move, 578, 269, 2, 444, 868] +[:mouse_move, 579, 268, 2, 445, 869] +[:mouse_move, 580, 265, 2, 446, 870] +[:mouse_move, 581, 265, 2, 447, 871] +[:mouse_move, 583, 263, 2, 448, 872] +[:mouse_move, 585, 262, 2, 449, 873] +[:mouse_move, 589, 260, 2, 450, 874] +[:mouse_move, 593, 259, 2, 451, 875] +[:mouse_move, 599, 258, 2, 452, 876] +[:mouse_move, 603, 258, 2, 453, 877] +[:mouse_move, 606, 258, 2, 454, 878] +[:mouse_move, 610, 259, 2, 455, 879] +[:mouse_move, 613, 260, 2, 456, 880] +[:mouse_move, 614, 261, 2, 457, 881] +[:mouse_move, 616, 264, 2, 458, 882] +[:mouse_move, 617, 265, 2, 459, 883] +[:mouse_move, 618, 267, 2, 460, 884] +[:mouse_move, 618, 269, 2, 461, 885] +[:mouse_move, 619, 272, 2, 462, 886] +[:mouse_move, 619, 273, 2, 463, 887] +[:mouse_move, 620, 274, 2, 464, 888] +[:mouse_move, 620, 275, 2, 465, 889] +[:mouse_button_pressed, 1, 0, 1, 466, 893] +[:mouse_button_up, 1, 0, 1, 467, 899] +[:mouse_move, 618, 275, 2, 468, 906] +[:mouse_move, 603, 279, 2, 469, 907] +[:mouse_move, 595, 282, 2, 470, 908] +[:mouse_move, 568, 291, 2, 471, 909] +[:mouse_move, 553, 294, 2, 472, 910] +[:mouse_move, 533, 298, 2, 473, 911] +[:mouse_move, 522, 300, 2, 474, 912] +[:mouse_move, 512, 302, 2, 475, 913] +[:mouse_move, 503, 304, 2, 476, 914] +[:mouse_move, 502, 304, 2, 477, 915] +[:mouse_move, 500, 304, 2, 478, 916] +[:mouse_move, 499, 304, 2, 479, 917] +[:mouse_button_pressed, 1, 0, 1, 480, 921] +[:mouse_button_up, 1, 0, 1, 481, 926] +[:mouse_move, 499, 305, 2, 482, 930] +[:mouse_move, 499, 307, 2, 483, 931] +[:mouse_move, 506, 328, 2, 484, 932] +[:mouse_move, 513, 344, 2, 485, 933] +[:mouse_move, 525, 372, 2, 486, 934] +[:mouse_move, 528, 377, 2, 487, 935] +[:mouse_move, 535, 393, 2, 488, 936] +[:mouse_move, 545, 409, 2, 489, 937] +[:mouse_move, 549, 414, 2, 490, 938] +[:mouse_move, 552, 420, 2, 491, 939] +[:mouse_move, 554, 421, 2, 492, 940] +[:mouse_move, 556, 424, 2, 493, 941] +[:mouse_move, 558, 425, 2, 494, 942] +[:mouse_move, 560, 427, 2, 495, 943] +[:mouse_move, 561, 429, 2, 496, 944] +[:mouse_move, 563, 430, 2, 497, 945] +[:mouse_move, 564, 432, 2, 498, 946] +[:mouse_move, 564, 434, 2, 499, 947] +[:mouse_move, 565, 434, 2, 500, 948] +[:mouse_move, 565, 435, 2, 501, 949] +[:mouse_move, 566, 435, 2, 502, 950] +[:mouse_button_pressed, 1, 0, 1, 503, 953] +[:mouse_button_up, 1, 0, 1, 504, 959] +[:mouse_move, 566, 436, 2, 505, 963] +[:mouse_move, 566, 437, 2, 506, 964] +[:mouse_move, 570, 445, 2, 507, 965] +[:mouse_move, 576, 454, 2, 508, 966] +[:mouse_move, 579, 459, 2, 509, 967] +[:mouse_move, 584, 465, 2, 510, 968] +[:mouse_move, 586, 468, 2, 511, 969] +[:mouse_move, 590, 471, 2, 512, 970] +[:mouse_move, 593, 472, 2, 513, 971] +[:mouse_move, 597, 473, 2, 514, 972] +[:mouse_move, 598, 473, 2, 515, 973] +[:mouse_move, 602, 474, 2, 516, 974] +[:mouse_move, 603, 474, 2, 517, 975] +[:mouse_move, 609, 474, 2, 518, 976] +[:mouse_move, 610, 474, 2, 519, 977] +[:mouse_move, 613, 474, 2, 520, 978] +[:mouse_move, 614, 474, 2, 521, 979] +[:mouse_move, 615, 474, 2, 522, 980] +[:mouse_move, 616, 474, 2, 523, 981] +[:mouse_button_pressed, 1, 0, 1, 524, 982] +[:mouse_button_up, 1, 0, 1, 525, 988] +[:mouse_move, 617, 474, 2, 526, 991] +[:mouse_move, 625, 473, 2, 527, 992] +[:mouse_move, 632, 472, 2, 528, 993] +[:mouse_move, 653, 466, 2, 529, 994] +[:mouse_move, 663, 462, 2, 530, 995] +[:mouse_move, 696, 453, 2, 531, 996] +[:mouse_move, 713, 449, 2, 532, 997] +[:mouse_move, 723, 446, 2, 533, 998] +[:mouse_move, 730, 445, 2, 534, 999] +[:mouse_move, 732, 444, 2, 535, 1000] +[:mouse_move, 736, 444, 2, 536, 1001] +[:mouse_move, 734, 444, 2, 537, 1005] +[:mouse_button_pressed, 1, 0, 1, 538, 1009] +[:mouse_button_up, 1, 0, 1, 539, 1017] +[:mouse_move, 734, 442, 2, 540, 1020] +[:mouse_move, 734, 440, 2, 541, 1021] +[:mouse_move, 727, 434, 2, 542, 1022] +[:mouse_move, 715, 427, 2, 543, 1023] +[:mouse_move, 690, 418, 2, 544, 1024] +[:mouse_move, 682, 416, 2, 545, 1025] +[:mouse_move, 666, 408, 2, 546, 1026] +[:mouse_move, 663, 407, 2, 547, 1027] +[:mouse_move, 652, 401, 2, 548, 1028] +[:mouse_move, 649, 397, 2, 549, 1029] +[:mouse_move, 646, 394, 2, 550, 1030] +[:mouse_move, 645, 393, 2, 551, 1031] +[:mouse_move, 645, 390, 2, 552, 1032] +[:mouse_move, 645, 388, 2, 553, 1033] +[:mouse_move, 645, 387, 2, 554, 1034] +[:mouse_move, 645, 386, 2, 555, 1035] +[:mouse_button_pressed, 1, 0, 1, 556, 1037] +[:mouse_button_up, 1, 0, 1, 557, 1043] +[:mouse_move, 644, 386, 2, 558, 1063] +[:mouse_move, 638, 382, 2, 559, 1064] +[:mouse_move, 629, 376, 2, 560, 1065] +[:mouse_move, 617, 368, 2, 561, 1066] +[:mouse_move, 553, 329, 2, 562, 1067] +[:mouse_move, 507, 299, 2, 563, 1068] +[:mouse_move, 331, 208, 2, 564, 1069] +[:mouse_move, 288, 186, 2, 565, 1070] +[:mouse_move, 125, 107, 2, 566, 1071] +[:mouse_move, 98, 93, 2, 567, 1072] +[:mouse_move, 37, 55, 2, 568, 1073] +[:mouse_move, 5, 35, 2, 569, 1074] +[:mouse_move, -23, 10, 2, 570, 1075] +[:mouse_move, -23, 7, 2, 571, 1094] +[:mouse_move, -23, 5, 2, 572, 1095] +[:mouse_move, -24, 2, 2, 573, 1096] +[:mouse_move, -24, 0, 2, 574, 1097] +[:mouse_move, -24, 0, 2, 575, 1099] diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/leftSide.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/leftSide.png new file mode 100644 index 0000000..1fc0060 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/leftSide.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/mountain.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/mountain.png new file mode 100644 index 0000000..5794464 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/mountain.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/ocean.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/ocean.png new file mode 100644 index 0000000..fbf5fc1 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/ocean.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/rightSide.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/rightSide.png new file mode 100644 index 0000000..d74ff14 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/rightSide.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/river.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/river.png new file mode 100644 index 0000000..eb51890 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/river.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/selectedTile.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/selectedTile.png new file mode 100644 index 0000000..3719cac Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/selectedTile.png differ diff --git a/samples/99_genre_rpg_tactical/isometric_grid/sprites/tile.png b/samples/99_genre_rpg_tactical/isometric_grid/sprites/tile.png new file mode 100644 index 0000000..4a4f690 Binary files /dev/null and b/samples/99_genre_rpg_tactical/isometric_grid/sprites/tile.png differ diff --git a/samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb b/samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb new file mode 100644 index 0000000..c447940 --- /dev/null +++ b/samples/99_genre_rpg_topdown/topdown_starting_point/app/main.rb @@ -0,0 +1,108 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - reverse: Returns a new string with the characters from original string in reverse order. + For example, the command + "dragonruby".reverse + would return the string + "yburnogard". + Reverse is not only limited to strings, but can be applied to arrays and other collections. + + Reminders: + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + + - 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. + +=end + +# This code shows a maze and uses input from the keyboard to move the user around the screen. +# The objective is to reach the goal. + +# Sets values of tile size and player's movement speed +# Also creates tile or box for player and generates map +def tick args + args.state.tile_size = 80 + args.state.player_speed = 4 + args.state.player ||= tile(args, 7, 3, 0, 128, 180) + generate_map args + + # Adds walls, goal, and player to args.outputs.solids so they appear on screen + args.outputs.solids << args.state.walls + args.outputs.solids << args.state.goal + args.outputs.solids << args.state.player + + # If player's box intersects with goal, a label is output onto the screen + if args.state.player.intersect_rect? args.state.goal + args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen + end + + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed +end + +# Sets position, size, and color of the tile +def tile args, x, y, *color + [x * args.state.tile_size, # sets definition for array using method parameters + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values + args.state.tile_size, + args.state.tile_size, + *color] +end + +# Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) +def generate_map args + return if args.state.area + + # Creates the area of the map. There are 9 rows running horizontally across the screen + # and 16 columns running vertically on the screen. Any spot with a "1" is not + # open for the player to move into (and is green), and any spot with a "0" is available + # for the player to move in. + args.state.area = [ + [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal + [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + ].reverse # reverses the order of the area collection + + # By reversing the order, the way that the area appears above is how it appears + # on the screen in the game. If we did not reverse, the map would appear inverted. + + #The wall starts off with no tiles. + args.state.walls = [] + + # If v is 1, a green tile is added to args.state.walls. + # If v is 2, a black tile is created as the goal. + args.state.area.map_2d do |y, x, v| + if v == 1 + args.state.walls << tile(args, x, y, 0, 255, 0) # green tile + elsif v == 2 # notice there is only one "2" above because there is only one single goal + args.state.goal = tile(args, x, y, 0, 0, 0) # black tile + end + end +end + +# Allows the player to move their box around the screen +def move_player args, *vector + box = args.state.player.shift_rect(vector) # box is able to move at an angle + + # If the player's box hits a wall, it is not able to move further in that direction + return if args.state.walls + .any_intersect_rect?(box) + + # Player's box is able to move at angles (not just the four general directions) fast + args.state.player = + args.state.player + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then + vector.y * args.state.player_speed) # the box will move extremely slow +end diff --git a/samples/99_genre_rpg_topdown/topdown_starting_point/license-for-sample.txt b/samples/99_genre_rpg_topdown/topdown_starting_point/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_genre_rpg_topdown/topdown_starting_point/license-for-sample.txt @@ -0,0 +1,9 @@ +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/99_genre_rpg_topdown/topdown_starting_point/replay.txt b/samples/99_genre_rpg_topdown/topdown_starting_point/replay.txt new file mode 100644 index 0000000..f121bc6 --- /dev/null +++ b/samples/99_genre_rpg_topdown/topdown_starting_point/replay.txt @@ -0,0 +1,187 @@ +replay_version 2.0 +stopped_at 880 +seed 100 +recorded_at Sun Sep 29 22:31:22 2019 +[:key_down_raw, 1073741904, 0, 2, 1, 92] +[:key_down_raw, 1073741904, 0, 2, 2, 117] +[:key_down_raw, 1073741903, 0, 2, 3, 119] +[:key_up_raw, 1073741904, 0, 2, 4, 119] +[:key_down_raw, 1073741903, 0, 2, 5, 144] +[:key_down_raw, 1073741903, 0, 2, 6, 146] +[:key_down_raw, 1073741903, 0, 2, 7, 148] +[:key_down_raw, 1073741903, 0, 2, 8, 150] +[:key_down_raw, 1073741903, 0, 2, 9, 152] +[:key_down_raw, 1073741906, 0, 2, 10, 152] +[:key_down_raw, 1073741906, 0, 2, 11, 177] +[:key_down_raw, 1073741906, 0, 2, 12, 179] +[:key_down_raw, 1073741906, 0, 2, 13, 181] +[:key_down_raw, 1073741906, 0, 2, 14, 183] +[:key_down_raw, 1073741906, 0, 2, 15, 185] +[:key_down_raw, 1073741906, 0, 2, 16, 187] +[:key_down_raw, 1073741906, 0, 2, 17, 189] +[:key_down_raw, 1073741906, 0, 2, 18, 191] +[:key_down_raw, 1073741906, 0, 2, 19, 193] +[:key_down_raw, 1073741906, 0, 2, 20, 195] +[:key_down_raw, 1073741906, 0, 2, 21, 197] +[:key_down_raw, 1073741906, 0, 2, 22, 199] +[:key_down_raw, 1073741906, 0, 2, 23, 201] +[:key_down_raw, 1073741906, 0, 2, 24, 203] +[:key_down_raw, 1073741906, 0, 2, 25, 205] +[:key_down_raw, 1073741906, 0, 2, 26, 207] +[:key_down_raw, 1073741906, 0, 2, 27, 209] +[:key_down_raw, 1073741906, 0, 2, 28, 211] +[:key_down_raw, 1073741906, 0, 2, 29, 213] +[:key_down_raw, 1073741906, 0, 2, 30, 215] +[:key_down_raw, 1073741906, 0, 2, 31, 217] +[:key_down_raw, 1073741906, 0, 2, 32, 219] +[:key_down_raw, 1073741906, 0, 2, 33, 221] +[:key_down_raw, 1073741906, 0, 2, 34, 223] +[:key_down_raw, 1073741906, 0, 2, 35, 225] +[:key_down_raw, 1073741906, 0, 2, 36, 227] +[:key_down_raw, 1073741906, 0, 2, 37, 229] +[:key_down_raw, 1073741906, 0, 2, 38, 231] +[:key_down_raw, 1073741906, 0, 2, 39, 233] +[:key_down_raw, 1073741906, 0, 2, 40, 235] +[:key_down_raw, 1073741906, 0, 2, 41, 237] +[:key_down_raw, 1073741906, 0, 2, 42, 239] +[:key_down_raw, 1073741906, 0, 2, 43, 241] +[:key_down_raw, 1073741906, 0, 2, 44, 243] +[:key_down_raw, 1073741906, 0, 2, 45, 245] +[:key_down_raw, 1073741906, 0, 2, 46, 248] +[:key_down_raw, 1073741906, 0, 2, 47, 250] +[:key_down_raw, 1073741906, 0, 2, 48, 252] +[:key_down_raw, 1073741906, 0, 2, 49, 254] +[:key_down_raw, 1073741906, 0, 2, 50, 256] +[:key_down_raw, 1073741906, 0, 2, 51, 258] +[:key_down_raw, 1073741906, 0, 2, 52, 260] +[:key_down_raw, 1073741906, 0, 2, 53, 262] +[:key_down_raw, 1073741906, 0, 2, 54, 264] +[:key_down_raw, 1073741905, 0, 2, 55, 265] +[:key_up_raw, 1073741906, 0, 2, 56, 266] +[:key_up_raw, 1073741903, 0, 2, 57, 267] +[:key_down_raw, 1073741904, 0, 2, 58, 287] +[:key_up_raw, 1073741905, 0, 2, 59, 289] +[:key_down_raw, 1073741904, 0, 2, 60, 312] +[:key_down_raw, 1073741904, 0, 2, 61, 314] +[:key_down_raw, 1073741904, 0, 2, 62, 316] +[:key_down_raw, 1073741904, 0, 2, 63, 318] +[:key_down_raw, 1073741904, 0, 2, 64, 320] +[:key_down_raw, 1073741904, 0, 2, 65, 322] +[:key_down_raw, 1073741904, 0, 2, 66, 324] +[:key_down_raw, 1073741904, 0, 2, 67, 326] +[:key_down_raw, 1073741905, 0, 2, 68, 328] +[:key_up_raw, 1073741905, 0, 2, 69, 348] +[:key_down_raw, 1073741905, 0, 2, 70, 385] +[:key_down_raw, 1073741906, 0, 2, 71, 395] +[:key_up_raw, 1073741904, 0, 2, 72, 408] +[:key_up_raw, 1073741905, 0, 2, 73, 409] +[:key_down_raw, 1073741906, 0, 2, 74, 420] +[:key_down_raw, 1073741906, 0, 2, 75, 422] +[:key_down_raw, 1073741906, 0, 2, 76, 424] +[:key_down_raw, 1073741906, 0, 2, 77, 426] +[:key_down_raw, 1073741906, 0, 2, 78, 428] +[:key_down_raw, 1073741906, 0, 2, 79, 430] +[:key_down_raw, 1073741906, 0, 2, 80, 432] +[:key_down_raw, 1073741906, 0, 2, 81, 434] +[:key_down_raw, 1073741906, 0, 2, 82, 436] +[:key_down_raw, 1073741906, 0, 2, 83, 438] +[:key_down_raw, 1073741904, 0, 2, 84, 440] +[:key_down_raw, 1073741904, 0, 2, 85, 465] +[:key_down_raw, 1073741904, 0, 2, 86, 467] +[:key_down_raw, 1073741904, 0, 2, 87, 469] +[:key_down_raw, 1073741904, 0, 2, 88, 471] +[:key_down_raw, 1073741904, 0, 2, 89, 473] +[:key_down_raw, 1073741904, 0, 2, 90, 475] +[:key_down_raw, 1073741904, 0, 2, 91, 477] +[:key_down_raw, 1073741904, 0, 2, 92, 479] +[:key_down_raw, 1073741904, 0, 2, 93, 481] +[:key_down_raw, 1073741904, 0, 2, 94, 483] +[:key_down_raw, 1073741904, 0, 2, 95, 485] +[:key_down_raw, 1073741904, 0, 2, 96, 487] +[:key_down_raw, 1073741904, 0, 2, 97, 489] +[:key_down_raw, 1073741904, 0, 2, 98, 491] +[:key_up_raw, 1073741906, 0, 2, 99, 493] +[:key_down_raw, 1073741904, 0, 2, 100, 493] +[:key_down_raw, 1073741904, 0, 2, 101, 495] +[:key_down_raw, 1073741904, 0, 2, 102, 497] +[:key_down_raw, 1073741904, 0, 2, 103, 499] +[:key_down_raw, 1073741904, 0, 2, 104, 501] +[:key_down_raw, 1073741904, 0, 2, 105, 503] +[:key_down_raw, 1073741904, 0, 2, 106, 505] +[:key_down_raw, 1073741904, 0, 2, 107, 507] +[:key_down_raw, 1073741904, 0, 2, 108, 509] +[:key_down_raw, 1073741904, 0, 2, 109, 511] +[:key_down_raw, 1073741904, 0, 2, 110, 513] +[:key_down_raw, 1073741904, 0, 2, 111, 515] +[:key_down_raw, 1073741904, 0, 2, 112, 517] +[:key_down_raw, 1073741904, 0, 2, 113, 519] +[:key_down_raw, 1073741904, 0, 2, 114, 521] +[:key_down_raw, 1073741904, 0, 2, 115, 523] +[:key_down_raw, 1073741904, 0, 2, 116, 526] +[:key_down_raw, 1073741904, 0, 2, 117, 527] +[:key_down_raw, 1073741904, 0, 2, 118, 530] +[:key_down_raw, 1073741904, 0, 2, 119, 532] +[:key_down_raw, 1073741904, 0, 2, 120, 533] +[:key_down_raw, 1073741904, 0, 2, 121, 536] +[:key_up_raw, 1073741904, 0, 2, 122, 537] +[:key_down_raw, 1073741906, 0, 2, 123, 556] +[:key_down_raw, 1073741906, 0, 2, 124, 580] +[:key_down_raw, 1073741906, 0, 2, 125, 583] +[:key_down_raw, 1073741906, 0, 2, 126, 585] +[:key_down_raw, 1073741906, 0, 2, 127, 587] +[:key_down_raw, 1073741906, 0, 2, 128, 589] +[:key_up_raw, 1073741906, 0, 2, 129, 589] +[:key_down_raw, 1073741905, 0, 2, 130, 617] +[:key_down_raw, 1073741905, 0, 2, 131, 642] +[:key_down_raw, 1073741905, 0, 2, 132, 644] +[:key_down_raw, 1073741905, 0, 2, 133, 646] +[:key_down_raw, 1073741905, 0, 2, 134, 648] +[:key_down_raw, 1073741905, 0, 2, 135, 650] +[:key_down_raw, 1073741905, 0, 2, 136, 652] +[:key_down_raw, 1073741905, 0, 2, 137, 654] +[:key_up_raw, 1073741905, 0, 2, 138, 654] +[:key_down_raw, 1073741906, 0, 2, 139, 663] +[:key_down_raw, 1073741906, 0, 2, 140, 688] +[:key_down_raw, 1073741906, 0, 2, 141, 690] +[:key_down_raw, 1073741906, 0, 2, 142, 692] +[:key_down_raw, 1073741906, 0, 2, 143, 695] +[:key_down_raw, 1073741906, 0, 2, 144, 697] +[:key_down_raw, 1073741906, 0, 2, 145, 699] +[:key_down_raw, 1073741906, 0, 2, 146, 701] +[:key_down_raw, 1073741906, 0, 2, 147, 703] +[:key_down_raw, 1073741906, 0, 2, 148, 705] +[:key_down_raw, 1073741906, 0, 2, 149, 707] +[:key_up_raw, 1073741906, 0, 2, 150, 707] +[:key_down_raw, 1073741905, 0, 2, 151, 713] +[:key_down_raw, 1073741905, 0, 2, 152, 738] +[:key_down_raw, 1073741905, 0, 2, 153, 740] +[:key_down_raw, 1073741903, 0, 2, 154, 741] +[:key_down_raw, 1073741903, 0, 2, 155, 766] +[:key_down_raw, 1073741903, 0, 2, 156, 768] +[:key_down_raw, 1073741903, 0, 2, 157, 770] +[:key_down_raw, 1073741903, 0, 2, 158, 772] +[:key_up_raw, 1073741905, 0, 2, 159, 772] +[:key_down_raw, 1073741903, 0, 2, 160, 774] +[:key_down_raw, 1073741903, 0, 2, 161, 776] +[:key_down_raw, 1073741903, 0, 2, 162, 778] +[:key_down_raw, 1073741903, 0, 2, 163, 780] +[:key_down_raw, 1073741903, 0, 2, 164, 782] +[:key_down_raw, 1073741903, 0, 2, 165, 784] +[:key_down_raw, 1073741903, 0, 2, 166, 786] +[:key_down_raw, 1073741903, 0, 2, 167, 788] +[:key_down_raw, 1073741903, 0, 2, 168, 790] +[:key_down_raw, 1073741903, 0, 2, 169, 792] +[:key_down_raw, 1073741903, 0, 2, 170, 794] +[:key_down_raw, 1073741903, 0, 2, 171, 796] +[:key_down_raw, 1073741903, 0, 2, 172, 798] +[:key_down_raw, 1073741903, 0, 2, 173, 800] +[:key_down_raw, 1073741903, 0, 2, 174, 802] +[:key_down_raw, 1073741903, 0, 2, 175, 804] +[:key_down_raw, 1073741903, 0, 2, 176, 806] +[:key_down_raw, 1073741903, 0, 2, 177, 808] +[:key_down_raw, 1073741903, 0, 2, 178, 810] +[:key_down_raw, 1073741903, 0, 2, 179, 812] +[:key_down_raw, 1073741903, 0, 2, 180, 814] +[:key_up_raw, 1073741903, 0, 2, 181, 814] +[:key_down_raw, 1073742051, 1024, 2, 182, 879] +[:key_down_raw, 113, 1024, 2, 183, 879] diff --git a/samples/99_genre_tactical_rpg/hexagonal_grid/app/main.rb b/samples/99_genre_tactical_rpg/hexagonal_grid/app/main.rb deleted file mode 100644 index b522ace..0000000 --- a/samples/99_genre_tactical_rpg/hexagonal_grid/app/main.rb +++ /dev/null @@ -1,68 +0,0 @@ -class HexagonTileGame - attr_gtk - - def defaults - state.tile_scale = 1.3 - state.tile_size = 80 - state.tile_w = Math.sqrt(3) * state.tile_size.half - state.tile_h = state.tile_size * 3/4 - state.tiles_x_count = 1280.idiv(state.tile_w) - 1 - state.tiles_y_count = 720.idiv(state.tile_h) - 1 - state.world_width_px = state.tiles_x_count * state.tile_w - state.world_height_px = state.tiles_y_count * state.tile_h - state.world_x_offset = (1280 - state.world_width_px).half - state.world_y_offset = (720 - state.world_height_px).half - state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y| - { - ordinal_x: ordinal_x, - ordinal_y: ordinal_y, - offset_x: (ordinal_y.even?) ? - (state.world_x_offset + state.tile_w.half.half) : - (state.world_x_offset - state.tile_w.half.half), - offset_y: state.world_y_offset, - w: state.tile_w, - h: state.tile_h, - type: :blank, - path: "sprites/hexagon-gray.png", - a: 20 - }.associate do |h| - h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w], - y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale) - end.associate do |h| - h.merge(center: { - x: h[:x] + h[:w].half, - y: h[:y] + h[:h].half - }, radius: [h[:w].half, h[:h].half].max) - end - end - end - - def input - if inputs.click - tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] } - if tile - tile[:a] = 255 - tile[:path] = "sprites/hexagon-black.png" - end - end - end - - def tick - defaults - input - render - end - - def render - outputs.sprites << state.tiles - end -end - -$game = HexagonTileGame.new - -def tick args - $game.args = args - $game.tick -end - -$gtk.reset diff --git a/samples/99_genre_tactical_rpg/hexagonal_grid/license-for-sample.txt b/samples/99_genre_tactical_rpg/hexagonal_grid/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_tactical_rpg/hexagonal_grid/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/99_genre_tactical_rpg/hexagonal_grid/replay.txt b/samples/99_genre_tactical_rpg/hexagonal_grid/replay.txt deleted file mode 100644 index 9e646bc..0000000 --- a/samples/99_genre_tactical_rpg/hexagonal_grid/replay.txt +++ /dev/null @@ -1,276 +0,0 @@ -replay_version 2.0 -stopped_at 488 -seed 100 -recorded_at Sat Feb 01 20:02:13 2020 -[:mouse_move, 643, 259, 2, 1, 46] -[:mouse_move, 618, 246, 2, 2, 47] -[:mouse_move, 544, 211, 2, 3, 48] -[:mouse_move, 477, 179, 2, 4, 49] -[:mouse_move, 435, 158, 2, 5, 50] -[:mouse_move, 350, 117, 2, 6, 51] -[:mouse_move, 304, 96, 2, 7, 52] -[:mouse_move, 267, 84, 2, 8, 53] -[:mouse_move, 242, 76, 2, 9, 54] -[:mouse_move, 188, 72, 2, 10, 55] -[:mouse_move, 164, 75, 2, 11, 56] -[:mouse_move, 151, 81, 2, 12, 57] -[:mouse_move, 135, 89, 2, 13, 58] -[:mouse_move, 117, 102, 2, 14, 59] -[:mouse_move, 114, 105, 2, 15, 59] -[:mouse_move, 99, 116, 2, 16, 60] -[:mouse_move, 90, 121, 2, 17, 61] -[:mouse_move, 81, 130, 2, 18, 62] -[:mouse_move, 75, 136, 2, 19, 63] -[:mouse_move, 72, 149, 2, 20, 64] -[:mouse_move, 66, 183, 2, 21, 65] -[:mouse_move, 64, 218, 2, 22, 66] -[:mouse_move, 64, 273, 2, 23, 67] -[:mouse_move, 70, 305, 2, 24, 68] -[:mouse_move, 85, 347, 2, 25, 69] -[:mouse_move, 133, 418, 2, 26, 70] -[:mouse_move, 174, 441, 2, 27, 71] -[:mouse_move, 225, 453, 2, 28, 72] -[:mouse_move, 277, 453, 2, 29, 73] -[:mouse_move, 328, 448, 2, 30, 74] -[:mouse_move, 421, 434, 2, 31, 75] -[:mouse_move, 492, 433, 2, 32, 76] -[:mouse_move, 571, 433, 2, 33, 77] -[:mouse_move, 656, 432, 2, 34, 78] -[:mouse_move, 824, 403, 2, 35, 79] -[:mouse_move, 903, 386, 2, 36, 80] -[:mouse_move, 996, 373, 2, 37, 81] -[:mouse_move, 1053, 371, 2, 38, 82] -[:mouse_move, 1092, 371, 2, 39, 83] -[:mouse_move, 1098, 372, 2, 40, 84] -[:mouse_move, 1117, 368, 2, 41, 92] -[:mouse_move, 1148, 368, 2, 42, 93] -[:mouse_move, 1212, 381, 2, 43, 94] -[:mouse_move, 1246, 398, 2, 44, 95] -[:mouse_move, 1282, 423, 2, 45, 96] -[:mouse_move, 1303, 449, 2, 46, 97] -[:mouse_move, 1309, 465, 2, 47, 98] -[:mouse_move, 1314, 481, 2, 48, 99] -[:mouse_move, 1314, 497, 2, 49, 100] -[:mouse_move, 1301, 504, 2, 50, 101] -[:mouse_move, 1288, 507, 2, 51, 102] -[:mouse_move, 1259, 515, 2, 52, 103] -[:mouse_move, 1238, 523, 2, 53, 104] -[:mouse_move, 1225, 529, 2, 54, 105] -[:mouse_move, 1216, 531, 2, 55, 106] -[:mouse_move, 1207, 533, 2, 56, 107] -[:mouse_move, 1205, 532, 2, 57, 108] -[:mouse_move, 1207, 526, 2, 58, 109] -[:mouse_move, 1213, 518, 2, 59, 110] -[:mouse_move, 1222, 507, 2, 60, 111] -[:mouse_move, 1233, 493, 2, 61, 112] -[:mouse_move, 1237, 482, 2, 62, 113] -[:mouse_move, 1239, 468, 2, 63, 114] -[:mouse_move, 1239, 444, 2, 64, 115] -[:mouse_move, 1237, 413, 2, 65, 116] -[:mouse_move, 1235, 403, 2, 66, 117] -[:mouse_move, 1234, 395, 2, 67, 118] -[:mouse_move, 1234, 392, 2, 68, 119] -[:mouse_move, 1234, 390, 2, 69, 120] -[:mouse_move, 1234, 389, 2, 70, 122] -[:mouse_move, 1234, 386, 2, 71, 123] -[:mouse_move, 1233, 386, 2, 72, 125] -[:mouse_move, 1190, 395, 2, 73, 126] -[:mouse_move, 1054, 412, 2, 74, 127] -[:mouse_move, 862, 421, 2, 75, 128] -[:mouse_move, 720, 421, 2, 76, 129] -[:mouse_move, 616, 419, 2, 77, 130] -[:mouse_move, 580, 416, 2, 78, 131] -[:mouse_move, 567, 410, 2, 79, 140] -[:mouse_move, 518, 394, 2, 80, 141] -[:mouse_move, 422, 388, 2, 81, 142] -[:mouse_move, 292, 398, 2, 82, 143] -[:mouse_move, 217, 420, 2, 83, 144] -[:mouse_move, 139, 449, 2, 84, 145] -[:mouse_move, 116, 460, 2, 85, 146] -[:mouse_move, 99, 472, 2, 86, 147] -[:mouse_move, 91, 485, 2, 87, 148] -[:mouse_move, 91, 494, 2, 88, 149] -[:mouse_move, 94, 514, 2, 89, 150] -[:mouse_move, 99, 530, 2, 90, 151] -[:mouse_move, 101, 545, 2, 91, 152] -[:mouse_move, 102, 566, 2, 92, 153] -[:mouse_move, 98, 582, 2, 93, 154] -[:mouse_move, 89, 601, 2, 94, 155] -[:mouse_move, 87, 610, 2, 95, 156] -[:mouse_move, 84, 617, 2, 96, 157] -[:mouse_move, 83, 622, 2, 97, 158] -[:mouse_move, 83, 624, 2, 98, 159] -[:mouse_move, 83, 625, 2, 99, 160] -[:mouse_move, 82, 628, 2, 100, 165] -[:mouse_move, 81, 635, 2, 101, 166] -[:mouse_move, 78, 651, 2, 102, 167] -[:mouse_move, 76, 658, 2, 103, 168] -[:mouse_move, 75, 663, 2, 104, 169] -[:mouse_move, 74, 665, 2, 105, 170] -[:mouse_move, 73, 665, 2, 106, 171] -[:mouse_move, 73, 663, 2, 107, 173] -[:mouse_move, 73, 661, 2, 108, 174] -[:mouse_move, 73, 658, 2, 109, 175] -[:mouse_move, 74, 653, 2, 110, 176] -[:mouse_move, 74, 652, 2, 111, 177] -[:mouse_move, 75, 651, 2, 112, 178] -[:mouse_move, 75, 650, 2, 113, 180] -[:mouse_button_pressed, 1, 0, 1, 114, 184] -[:mouse_button_up, 1, 0, 1, 115, 187] -[:mouse_move, 77, 650, 2, 116, 194] -[:mouse_move, 86, 650, 2, 117, 195] -[:mouse_move, 117, 650, 2, 118, 196] -[:mouse_move, 136, 650, 2, 119, 197] -[:mouse_move, 156, 648, 2, 120, 198] -[:mouse_move, 164, 647, 2, 121, 199] -[:mouse_move, 167, 646, 2, 122, 200] -[:mouse_move, 168, 646, 2, 123, 201] -[:mouse_move, 167, 646, 2, 124, 202] -[:mouse_move, 165, 647, 2, 125, 203] -[:mouse_move, 164, 647, 2, 126, 205] -[:mouse_move, 163, 647, 2, 127, 206] -[:mouse_button_pressed, 1, 0, 1, 128, 210] -[:mouse_button_up, 1, 0, 1, 129, 214] -[:mouse_move, 170, 647, 2, 130, 224] -[:mouse_move, 179, 647, 2, 131, 225] -[:mouse_move, 200, 647, 2, 132, 226] -[:mouse_move, 215, 647, 2, 133, 227] -[:mouse_move, 222, 647, 2, 134, 228] -[:mouse_move, 227, 647, 2, 135, 229] -[:mouse_move, 228, 647, 2, 136, 230] -[:mouse_button_pressed, 1, 0, 1, 137, 232] -[:mouse_button_up, 1, 0, 1, 138, 237] -[:mouse_move, 236, 645, 2, 139, 250] -[:mouse_move, 246, 644, 2, 140, 251] -[:mouse_move, 260, 643, 2, 141, 252] -[:mouse_move, 274, 643, 2, 142, 253] -[:mouse_move, 286, 645, 2, 143, 254] -[:mouse_move, 291, 646, 2, 144, 255] -[:mouse_move, 293, 646, 2, 145, 256] -[:mouse_button_pressed, 1, 0, 1, 146, 257] -[:mouse_move, 294, 647, 2, 147, 257] -[:mouse_button_up, 1, 0, 1, 148, 262] -[:mouse_move, 293, 642, 2, 149, 279] -[:mouse_move, 285, 616, 2, 150, 280] -[:mouse_move, 233, 414, 2, 151, 281] -[:mouse_move, 177, 198, 2, 152, 282] -[:mouse_move, 158, 131, 2, 153, 283] -[:mouse_move, 148, 98, 2, 154, 284] -[:mouse_move, 135, 65, 2, 155, 285] -[:mouse_move, 130, 58, 2, 156, 286] -[:mouse_move, 126, 56, 2, 157, 287] -[:mouse_move, 122, 55, 2, 158, 288] -[:mouse_move, 120, 55, 2, 159, 289] -[:mouse_move, 117, 55, 2, 160, 290] -[:mouse_move, 113, 55, 2, 161, 291] -[:mouse_move, 109, 56, 2, 162, 292] -[:mouse_move, 105, 56, 2, 163, 293] -[:mouse_move, 101, 56, 2, 164, 294] -[:mouse_move, 92, 57, 2, 165, 295] -[:mouse_move, 89, 57, 2, 166, 296] -[:mouse_move, 86, 57, 2, 167, 297] -[:mouse_move, 85, 57, 2, 168, 298] -[:mouse_move, 84, 57, 2, 169, 299] -[:mouse_button_pressed, 1, 0, 1, 170, 299] -[:mouse_button_up, 1, 0, 1, 171, 302] -[:mouse_move, 85, 57, 2, 172, 305] -[:mouse_move, 90, 57, 2, 173, 306] -[:mouse_move, 98, 57, 2, 174, 307] -[:mouse_move, 117, 57, 2, 175, 308] -[:mouse_move, 124, 57, 2, 176, 309] -[:mouse_move, 131, 57, 2, 177, 310] -[:mouse_move, 133, 57, 2, 178, 311] -[:mouse_move, 134, 57, 2, 179, 312] -[:mouse_move, 135, 57, 2, 180, 314] -[:mouse_button_pressed, 1, 0, 1, 181, 314] -[:mouse_button_up, 1, 0, 1, 182, 318] -[:mouse_move, 137, 57, 2, 183, 320] -[:mouse_move, 146, 57, 2, 184, 321] -[:mouse_move, 155, 57, 2, 185, 322] -[:mouse_move, 169, 57, 2, 186, 323] -[:mouse_move, 184, 57, 2, 187, 324] -[:mouse_move, 190, 57, 2, 188, 324] -[:mouse_move, 200, 57, 2, 189, 325] -[:mouse_move, 206, 57, 2, 190, 326] -[:mouse_move, 211, 57, 2, 191, 327] -[:mouse_move, 216, 57, 2, 192, 328] -[:mouse_move, 217, 57, 2, 193, 330] -[:mouse_button_pressed, 1, 0, 1, 194, 332] -[:mouse_button_up, 1, 0, 1, 195, 335] -[:mouse_move, 220, 57, 2, 196, 337] -[:mouse_move, 243, 57, 2, 197, 338] -[:mouse_move, 267, 57, 2, 198, 339] -[:mouse_move, 283, 57, 2, 199, 340] -[:mouse_move, 292, 57, 2, 200, 341] -[:mouse_move, 299, 57, 2, 201, 342] -[:mouse_move, 298, 57, 2, 202, 346] -[:mouse_move, 297, 57, 2, 203, 348] -[:mouse_move, 296, 57, 2, 204, 350] -[:mouse_button_pressed, 1, 0, 1, 205, 352] -[:mouse_button_up, 1, 0, 1, 206, 355] -[:mouse_move, 298, 57, 2, 207, 364] -[:mouse_move, 405, 53, 2, 208, 365] -[:mouse_move, 681, 55, 2, 209, 366] -[:mouse_move, 983, 86, 2, 210, 367] -[:mouse_move, 1117, 92, 2, 211, 368] -[:mouse_move, 1249, 93, 2, 212, 369] -[:mouse_move, 1299, 89, 2, 213, 370] -[:mouse_move, 1321, 85, 2, 214, 371] -[:mouse_move, 1314, 72, 2, 215, 378] -[:mouse_move, 1277, 66, 2, 216, 379] -[:mouse_move, 1249, 61, 2, 217, 380] -[:mouse_move, 1223, 56, 2, 218, 381] -[:mouse_move, 1212, 54, 2, 219, 382] -[:mouse_move, 1203, 50, 2, 220, 383] -[:mouse_move, 1200, 49, 2, 221, 384] -[:mouse_move, 1195, 46, 2, 222, 385] -[:mouse_move, 1191, 44, 2, 223, 386] -[:mouse_move, 1186, 42, 2, 224, 387] -[:mouse_move, 1184, 41, 2, 225, 388] -[:mouse_move, 1181, 41, 2, 226, 389] -[:mouse_button_pressed, 1, 0, 1, 227, 390] -[:mouse_move, 1181, 40, 2, 228, 390] -[:mouse_button_up, 1, 0, 1, 229, 393] -[:mouse_move, 1157, 44, 2, 230, 400] -[:mouse_move, 1085, 71, 2, 231, 401] -[:mouse_move, 1011, 102, 2, 232, 402] -[:mouse_move, 928, 141, 2, 233, 403] -[:mouse_move, 763, 235, 2, 234, 404] -[:mouse_move, 702, 276, 2, 235, 405] -[:mouse_move, 644, 318, 2, 236, 406] -[:mouse_move, 620, 338, 2, 237, 407] -[:mouse_move, 599, 357, 2, 238, 408] -[:mouse_move, 592, 363, 2, 239, 409] -[:mouse_move, 589, 365, 2, 240, 410] -[:mouse_move, 588, 365, 2, 241, 411] -[:mouse_move, 588, 366, 2, 242, 412] -[:mouse_move, 588, 365, 2, 243, 415] -[:mouse_move, 590, 365, 2, 244, 417] -[:mouse_move, 592, 364, 2, 245, 418] -[:mouse_move, 592, 363, 2, 246, 420] -[:mouse_move, 593, 362, 2, 247, 421] -[:mouse_button_pressed, 1, 0, 1, 248, 422] -[:mouse_button_up, 1, 0, 1, 249, 427] -[:mouse_move, 587, 359, 2, 250, 454] -[:mouse_move, 554, 341, 2, 251, 455] -[:mouse_move, 325, 237, 2, 252, 456] -[:mouse_move, 196, 188, 2, 253, 457] -[:mouse_move, 141, 167, 2, 254, 458] -[:mouse_move, 94, 147, 2, 255, 459] -[:mouse_move, 56, 125, 2, 256, 460] -[:mouse_move, 46, 119, 2, 257, 461] -[:mouse_move, 39, 113, 2, 258, 462] -[:mouse_move, 37, 110, 2, 259, 463] -[:mouse_move, 35, 105, 2, 260, 464] -[:mouse_move, 33, 101, 2, 261, 465] -[:mouse_move, 28, 90, 2, 262, 466] -[:mouse_move, 26, 82, 2, 263, 467] -[:mouse_move, 20, 66, 2, 264, 468] -[:mouse_move, 9, 42, 2, 265, 469] -[:mouse_move, 3, 32, 2, 266, 470] -[:mouse_move, -4, 18, 2, 267, 471] -[:mouse_move, -8, 11, 2, 268, 472] -[:mouse_move, -11, 7, 2, 269, 473] -[:mouse_move, -13, 5, 2, 270, 474] -[:mouse_move, -17, 1, 2, 271, 475] -[:mouse_move, -19, 0, 2, 272, 476] diff --git a/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-black.png b/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-black.png deleted file mode 100644 index f50c872..0000000 Binary files a/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-black.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-gray.png b/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-gray.png deleted file mode 100644 index e8c4c5a..0000000 Binary files a/samples/99_genre_tactical_rpg/hexagonal_grid/sprites/hexagon-gray.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/app/main.rb b/samples/99_genre_tactical_rpg/isometric_grid/app/main.rb deleted file mode 100644 index 28bea32..0000000 --- a/samples/99_genre_tactical_rpg/isometric_grid/app/main.rb +++ /dev/null @@ -1,262 +0,0 @@ -class Isometric - attr_accessor :grid, :inputs, :state, :outputs - - def tick - defaults - render - calc - process_inputs - end - - def defaults - state.quantity ||= 6 #Size of grid - state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles - state.tileGrid ||= [] #Holds ordering of tiles - state.currentSpriteLocation ||= -1 #Current Sprite hovering location - state.tileCords ||= [] #Physical, rendering cordinates - state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0) - state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size - state.mode ||= :delete #Switches between :delete and :insert - state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2], - ['mountain', 0, 0, 262 / 2, 245 / 2], - ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information - #['name', deltaX, deltaY, sizeW, sizeH] - #^delta refers to distance from tile cords - - #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc - if state.tileGrid == [] - tempX = 0 - tempY = 0 - tempLeft = false - tempRight = false - count = 0 - (state.quantity * state.quantity).times do - if tempY == 0 - tempLeft = true - end - if tempX == (state.quantity - 1) - tempRight = true - end - state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count]) - #orderX, orderY, exists?, leftSide, rightSide, order - tempX += 1 - if tempX == state.quantity - tempX = 0 - tempY += 1 - end - tempLeft = false - tempRight = false - count += 1 - end - end - - #Calculates physical cordinates for tiles - if state.tileCords == [] - state.tileCords = state.tileGrid.map do - |val| - x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2) - y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2) - [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now - end - end - - end - - def render - renderBackground - renderLeft - renderRight - renderTiles - renderObjects - renderLabels - end - - def renderBackground - outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color - end - - def renderLeft - #Shows the pink left cube face - outputs.sprites << state.tileCords.map do - |val| - if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered - [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], - state.sideSize[1], 'sprites/leftSide.png'] - end - end - end - - def renderRight - #Shows the green right cube face - outputs.sprites << state.tileCords.map do - |val| - if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered - [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], - state.sideSize[1], 'sprites/rightSide.png'] - end - end - end - - def renderTiles - #Shows the tile itself. Important that it's rendered after the two above! - outputs.sprites << state.tileCords.map do - |val| - if val[2] == true #Chcekcs if tile needs to be rendered - if val[5] == state.currentSpriteLocation - [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png'] - else - [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png'] - end - end - end - end - - def renderObjects - #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner - #to bottom corner. - a = (state.quantity * state.quantity) - state.quantity - iter = 0 - loop do - if state.tileCords[a][2] == true && state.tileCords[a][6] != -1 - outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1], - state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2], - state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4], - 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png'] - end - iter += 1 - a += 1 - a -= state.quantity * 2 if iter == state.quantity - iter = 0 if iter == state.quantity - break if a < 0 - end - end - - def renderLabels - #Labels - outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete - outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete - outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert - outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert - end - - def calc - calcCurrentHover - end - - def calcCurrentHover - #This determines what tile the mouse is hovering (or last hovering) over - x = inputs.mouse.position.x - y = inputs.mouse.position.y - m = (state.tileSize[1] / state.tileSize[0]) #slope - state.tileCords.map do - |val| - #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) - next unless val[0] < x && x < val[0] + state.tileSize[0] - next unless val[1] < y && y < val[1] + state.tileSize[1] - next unless val[2] == true - tempBool = false - if x == val[0] + (state.tileSize[0] / 2) - #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond - tempBool = true - elsif x < state.tileSize[0] / 2 + val[0] - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond - tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) - tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) - #Checks to see if the mouse click y value is between those temp y values - tempBool = true if y < tempY1 && y > tempY2 - elsif x > state.tileSize[0] / 2 + val[0] - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond - tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] - tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] - #Checks to see if the mouse click y value is between those temp y values - tempBool = true if y > tempY1 && y < tempY2 - end - - if tempBool == true - state.currentSpriteLocation = val[5] #Current sprite location set to the order value - end - end - end - - def process_inputs - #Makes development much faster and easier - if inputs.keyboard.key_up.r - $dragon.reset - end - checkTileSelected - switchModes - end - - def checkTileSelected - if inputs.mouse.down - x = inputs.mouse.down.point.x - y = inputs.mouse.down.point.y - m = (state.tileSize[1] / state.tileSize[0]) #slope - state.tileCords.map do - |val| - #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) - next unless val[0] < x && x < val[0] + state.tileSize[0] - next unless val[1] < y && y < val[1] + state.tileSize[1] - next unless val[2] == true - tempBool = false - if x == val[0] + (state.tileSize[0] / 2) - #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond - tempBool = true - elsif x < state.tileSize[0] / 2 + val[0] - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond - tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) - tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) - #Checks to see if the mouse click y value is between those temp y values - tempBool = true if y < tempY1 && y > tempY2 - elsif x > state.tileSize[0] / 2 + val[0] - #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond - tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] - tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] - #Checks to see if the mouse click y value is between those temp y values - tempBool = true if y > tempY1 && y < tempY2 - end - - if tempBool == true - if state.mode == :delete - val[2] = false - state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency - state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered - unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered - state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing - state.tileCords[val[5] - 1][4] = true - end - unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side - state.tileGrid[val[5] + state.quantity][3] = true - state.tileCords[val[5] + state.quantity][3] = true - end - elsif state.mode == :insert - #adds the current sprite value selected to tileCords. (changes from the -1 earlier) - val[6] = rand(state.spriteSelection.length) - end - end - end - end - end - - def switchModes - #Switches between insert and delete modes - if inputs.keyboard.key_up.i && state.mode == :delete - state.mode = :insert - inputs.keyboard.clear - elsif inputs.keyboard.key_up.d && state.mode == :insert - state.mode = :delete - inputs.keyboard.clear - end - end - -end - -$isometric = Isometric.new - -def tick args - $isometric.grid = args.grid - $isometric.inputs = args.inputs - $isometric.state = args.state - $isometric.outputs = args.outputs - $isometric.tick -end diff --git a/samples/99_genre_tactical_rpg/isometric_grid/license-for-sample.txt b/samples/99_genre_tactical_rpg/isometric_grid/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_tactical_rpg/isometric_grid/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/99_genre_tactical_rpg/isometric_grid/metadata/game_metadata.txt b/samples/99_genre_tactical_rpg/isometric_grid/metadata/game_metadata.txt deleted file mode 100644 index 1b03500..0000000 --- a/samples/99_genre_tactical_rpg/isometric_grid/metadata/game_metadata.txt +++ /dev/null @@ -1,6 +0,0 @@ -#devid=myname -#devtitle=My Name -#gameid=mygame -#gametitle=My Game -#version=0.1 -#icon=metadata/icon.png diff --git a/samples/99_genre_tactical_rpg/isometric_grid/metadata/icon.png b/samples/99_genre_tactical_rpg/isometric_grid/metadata/icon.png deleted file mode 100644 index e20e8c2..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/metadata/icon.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/replay.txt b/samples/99_genre_tactical_rpg/isometric_grid/replay.txt deleted file mode 100644 index 1cf14a2..0000000 --- a/samples/99_genre_tactical_rpg/isometric_grid/replay.txt +++ /dev/null @@ -1,579 +0,0 @@ -replay_version 2.0 -stopped_at 1116 -seed 100 -recorded_at Sat Feb 01 20:04:50 2020 -[:mouse_move, -27, 201, 2, 1, 76] -[:mouse_move, -23, 204, 2, 2, 77] -[:mouse_move, -12, 212, 2, 3, 78] -[:mouse_move, -5, 220, 2, 4, 79] -[:mouse_move, -2, 219, 2, 5, 96] -[:mouse_move, 4, 217, 2, 6, 97] -[:mouse_move, 24, 209, 2, 7, 98] -[:mouse_move, 38, 202, 2, 8, 99] -[:mouse_move, 66, 194, 2, 9, 100] -[:mouse_move, 71, 192, 2, 10, 101] -[:mouse_move, 86, 187, 2, 11, 102] -[:mouse_move, 92, 185, 2, 12, 103] -[:mouse_move, 99, 183, 2, 13, 104] -[:mouse_move, 100, 182, 2, 14, 105] -[:mouse_move, 101, 182, 2, 15, 106] -[:mouse_move, 102, 181, 2, 16, 107] -[:mouse_move, 102, 180, 2, 17, 112] -[:mouse_button_pressed, 1, 0, 1, 18, 114] -[:mouse_button_up, 1, 0, 1, 19, 120] -[:mouse_move, 103, 174, 2, 20, 135] -[:mouse_move, 105, 169, 2, 21, 136] -[:mouse_move, 107, 156, 2, 22, 137] -[:mouse_move, 108, 147, 2, 23, 138] -[:mouse_move, 108, 122, 2, 24, 139] -[:mouse_move, 104, 108, 2, 25, 140] -[:mouse_move, 101, 102, 2, 26, 141] -[:mouse_move, 94, 92, 2, 27, 142] -[:mouse_move, 90, 89, 2, 28, 143] -[:mouse_move, 83, 85, 2, 29, 144] -[:mouse_move, 78, 83, 2, 30, 145] -[:mouse_move, 72, 81, 2, 31, 146] -[:mouse_move, 69, 80, 2, 32, 147] -[:mouse_move, 66, 78, 2, 33, 148] -[:mouse_move, 65, 78, 2, 34, 149] -[:mouse_move, 64, 78, 2, 35, 150] -[:mouse_move, 64, 77, 2, 36, 151] -[:mouse_move, 69, 77, 2, 37, 154] -[:mouse_move, 74, 77, 2, 38, 155] -[:mouse_move, 96, 76, 2, 39, 156] -[:mouse_move, 118, 76, 2, 40, 157] -[:mouse_move, 145, 75, 2, 41, 158] -[:mouse_move, 162, 74, 2, 42, 159] -[:mouse_move, 183, 73, 2, 43, 160] -[:mouse_move, 196, 72, 2, 44, 161] -[:mouse_move, 215, 70, 2, 45, 162] -[:mouse_move, 218, 70, 2, 46, 163] -[:mouse_move, 228, 69, 2, 47, 164] -[:mouse_move, 232, 69, 2, 48, 165] -[:mouse_move, 233, 69, 2, 49, 166] -[:mouse_move, 236, 69, 2, 50, 167] -[:mouse_move, 237, 69, 2, 51, 168] -[:mouse_move, 243, 70, 2, 52, 169] -[:mouse_move, 244, 70, 2, 53, 170] -[:mouse_move, 247, 70, 2, 54, 171] -[:mouse_move, 249, 70, 2, 55, 172] -[:mouse_move, 250, 70, 2, 56, 173] -[:mouse_move, 251, 70, 2, 57, 175] -[:mouse_move, 249, 70, 2, 58, 184] -[:mouse_move, 236, 70, 2, 59, 185] -[:mouse_move, 222, 70, 2, 60, 186] -[:mouse_move, 170, 71, 2, 61, 187] -[:mouse_move, 138, 75, 2, 62, 188] -[:mouse_move, 70, 87, 2, 63, 189] -[:mouse_move, 56, 91, 2, 64, 190] -[:mouse_move, 21, 100, 2, 65, 191] -[:mouse_move, 1, 107, 2, 66, 192] -[:mouse_move, -7, 110, 2, 67, 193] -[:mouse_move, -14, 114, 2, 68, 194] -[:mouse_move, -17, 115, 2, 69, 195] -[:mouse_move, -17, 116, 2, 70, 196] -[:mouse_move, -9, 117, 2, 71, 197] -[:mouse_move, 22, 119, 2, 72, 198] -[:mouse_move, 44, 119, 2, 73, 199] -[:mouse_move, 84, 120, 2, 74, 200] -[:mouse_move, 107, 120, 2, 75, 201] -[:mouse_move, 120, 120, 2, 76, 202] -[:mouse_move, 132, 120, 2, 77, 203] -[:mouse_move, 145, 120, 2, 78, 204] -[:mouse_move, 148, 120, 2, 79, 205] -[:mouse_move, 150, 120, 2, 80, 206] -[:mouse_move, 151, 120, 2, 81, 207] -[:mouse_move, 152, 120, 2, 82, 220] -[:mouse_move, 153, 120, 2, 83, 301] -[:mouse_move, 156, 120, 2, 84, 302] -[:mouse_move, 158, 120, 2, 85, 303] -[:mouse_move, 163, 120, 2, 86, 304] -[:mouse_move, 165, 120, 2, 87, 305] -[:mouse_move, 168, 118, 2, 88, 306] -[:mouse_move, 170, 116, 2, 89, 307] -[:mouse_move, 172, 113, 2, 90, 308] -[:mouse_move, 173, 110, 2, 91, 309] -[:mouse_move, 176, 104, 2, 92, 310] -[:mouse_move, 176, 101, 2, 93, 311] -[:mouse_move, 176, 93, 2, 94, 312] -[:mouse_move, 176, 89, 2, 95, 313] -[:mouse_move, 173, 85, 2, 96, 314] -[:mouse_move, 172, 83, 2, 97, 315] -[:mouse_move, 171, 78, 2, 98, 316] -[:mouse_move, 170, 76, 2, 99, 317] -[:mouse_move, 169, 73, 2, 100, 318] -[:mouse_move, 168, 72, 2, 101, 319] -[:mouse_move, 164, 70, 2, 102, 320] -[:mouse_move, 161, 68, 2, 103, 321] -[:mouse_move, 152, 68, 2, 104, 322] -[:mouse_move, 147, 68, 2, 105, 323] -[:mouse_move, 140, 68, 2, 106, 324] -[:mouse_move, 134, 68, 2, 107, 325] -[:mouse_move, 126, 70, 2, 108, 326] -[:mouse_move, 123, 72, 2, 109, 327] -[:mouse_move, 118, 77, 2, 110, 328] -[:mouse_move, 116, 82, 2, 111, 329] -[:mouse_move, 112, 94, 2, 112, 330] -[:mouse_move, 110, 101, 2, 113, 331] -[:mouse_move, 110, 114, 2, 114, 332] -[:mouse_move, 110, 122, 2, 115, 333] -[:mouse_move, 114, 126, 2, 116, 334] -[:mouse_move, 120, 130, 2, 117, 335] -[:mouse_move, 125, 132, 2, 118, 336] -[:mouse_move, 139, 133, 2, 119, 337] -[:mouse_move, 147, 133, 2, 120, 338] -[:mouse_move, 162, 133, 2, 121, 339] -[:mouse_move, 168, 131, 2, 122, 340] -[:mouse_move, 178, 125, 2, 123, 341] -[:mouse_move, 179, 124, 2, 124, 342] -[:mouse_move, 186, 117, 2, 125, 343] -[:mouse_move, 188, 113, 2, 126, 344] -[:mouse_move, 189, 101, 2, 127, 345] -[:mouse_move, 189, 97, 2, 128, 346] -[:mouse_move, 186, 87, 2, 129, 347] -[:mouse_move, 183, 82, 2, 130, 348] -[:mouse_move, 176, 75, 2, 131, 349] -[:mouse_move, 167, 71, 2, 132, 350] -[:mouse_move, 155, 71, 2, 133, 351] -[:mouse_move, 149, 71, 2, 134, 352] -[:mouse_move, 140, 71, 2, 135, 353] -[:mouse_move, 137, 73, 2, 136, 354] -[:mouse_move, 134, 74, 2, 137, 355] -[:mouse_move, 131, 76, 2, 138, 356] -[:mouse_move, 130, 76, 2, 139, 357] -[:mouse_move, 130, 77, 2, 140, 358] -[:mouse_move, 130, 78, 2, 141, 360] -[:mouse_move, 131, 78, 2, 142, 362] -[:key_down_raw, 105, 0, 2, 143, 365] -[:key_up_raw, 105, 0, 2, 144, 370] -[:mouse_move, 135, 78, 2, 145, 391] -[:mouse_move, 141, 78, 2, 146, 392] -[:mouse_move, 176, 87, 2, 147, 393] -[:mouse_move, 216, 103, 2, 148, 394] -[:mouse_move, 384, 182, 2, 149, 395] -[:mouse_move, 464, 234, 2, 150, 396] -[:mouse_move, 574, 322, 2, 151, 397] -[:mouse_move, 599, 344, 2, 152, 398] -[:mouse_move, 649, 384, 2, 153, 399] -[:mouse_move, 648, 388, 2, 154, 413] -[:mouse_move, 646, 393, 2, 155, 414] -[:mouse_move, 641, 403, 2, 156, 415] -[:mouse_move, 635, 410, 2, 157, 416] -[:mouse_move, 626, 422, 2, 158, 417] -[:mouse_move, 614, 433, 2, 159, 418] -[:mouse_move, 613, 435, 2, 160, 419] -[:mouse_move, 608, 438, 2, 161, 420] -[:mouse_move, 605, 440, 2, 162, 421] -[:mouse_move, 604, 440, 2, 163, 422] -[:mouse_move, 603, 441, 2, 164, 423] -[:mouse_move, 602, 441, 2, 165, 431] -[:mouse_button_pressed, 1, 0, 1, 166, 433] -[:mouse_button_up, 1, 0, 1, 167, 439] -[:mouse_move, 603, 441, 2, 168, 444] -[:mouse_move, 606, 438, 2, 169, 445] -[:mouse_move, 613, 434, 2, 170, 446] -[:mouse_move, 622, 426, 2, 171, 447] -[:mouse_move, 624, 423, 2, 172, 448] -[:mouse_move, 634, 413, 2, 173, 449] -[:mouse_move, 635, 411, 2, 174, 450] -[:mouse_move, 641, 404, 2, 175, 451] -[:mouse_move, 642, 403, 2, 176, 452] -[:mouse_move, 644, 400, 2, 177, 453] -[:mouse_move, 645, 398, 2, 178, 454] -[:mouse_move, 646, 397, 2, 179, 455] -[:mouse_move, 646, 396, 2, 180, 457] -[:mouse_button_pressed, 1, 0, 1, 181, 459] -[:mouse_button_up, 1, 0, 1, 182, 465] -[:mouse_move, 649, 396, 2, 183, 468] -[:mouse_move, 653, 396, 2, 184, 469] -[:mouse_move, 664, 397, 2, 185, 470] -[:mouse_move, 666, 398, 2, 186, 471] -[:mouse_move, 676, 405, 2, 187, 472] -[:mouse_move, 679, 408, 2, 188, 473] -[:mouse_move, 684, 416, 2, 189, 474] -[:mouse_move, 685, 417, 2, 190, 475] -[:mouse_move, 688, 420, 2, 191, 476] -[:mouse_move, 688, 422, 2, 192, 477] -[:mouse_move, 689, 424, 2, 193, 478] -[:mouse_move, 690, 426, 2, 194, 479] -[:mouse_move, 692, 428, 2, 195, 480] -[:mouse_move, 693, 429, 2, 196, 481] -[:mouse_move, 694, 430, 2, 197, 482] -[:mouse_move, 695, 432, 2, 198, 483] -[:mouse_button_pressed, 1, 0, 1, 199, 485] -[:mouse_move, 696, 432, 2, 200, 485] -[:mouse_button_up, 1, 0, 1, 201, 492] -[:mouse_move, 699, 430, 2, 202, 496] -[:mouse_move, 705, 427, 2, 203, 497] -[:mouse_move, 709, 425, 2, 204, 498] -[:mouse_move, 718, 421, 2, 205, 499] -[:mouse_move, 725, 418, 2, 206, 500] -[:mouse_move, 736, 412, 2, 207, 501] -[:mouse_move, 742, 410, 2, 208, 502] -[:mouse_move, 750, 406, 2, 209, 503] -[:mouse_move, 753, 405, 2, 210, 504] -[:mouse_move, 759, 402, 2, 211, 505] -[:mouse_move, 761, 400, 2, 212, 506] -[:mouse_move, 764, 398, 2, 213, 507] -[:mouse_move, 765, 397, 2, 214, 508] -[:mouse_move, 768, 397, 2, 215, 509] -[:mouse_move, 769, 396, 2, 216, 510] -[:mouse_move, 770, 396, 2, 217, 512] -[:mouse_button_pressed, 1, 0, 1, 218, 514] -[:mouse_move, 770, 395, 2, 219, 514] -[:mouse_button_up, 1, 0, 1, 220, 523] -[:mouse_move, 770, 394, 2, 221, 528] -[:mouse_move, 770, 393, 2, 222, 530] -[:mouse_move, 762, 389, 2, 223, 532] -[:mouse_move, 757, 387, 2, 224, 533] -[:mouse_move, 741, 379, 2, 225, 534] -[:mouse_move, 737, 377, 2, 226, 535] -[:mouse_move, 718, 369, 2, 227, 536] -[:mouse_move, 711, 364, 2, 228, 537] -[:mouse_move, 701, 356, 2, 229, 538] -[:mouse_move, 699, 354, 2, 230, 539] -[:mouse_move, 694, 348, 2, 231, 540] -[:mouse_move, 692, 346, 2, 232, 541] -[:mouse_move, 690, 344, 2, 233, 542] -[:mouse_move, 690, 343, 2, 234, 543] -[:mouse_move, 689, 342, 2, 235, 544] -[:mouse_button_pressed, 1, 0, 1, 236, 546] -[:mouse_button_up, 1, 0, 1, 237, 554] -[:mouse_move, 689, 340, 2, 238, 555] -[:mouse_move, 689, 339, 2, 239, 556] -[:mouse_move, 686, 333, 2, 240, 557] -[:mouse_move, 684, 330, 2, 241, 558] -[:mouse_move, 681, 325, 2, 242, 559] -[:mouse_move, 678, 322, 2, 243, 560] -[:mouse_move, 673, 315, 2, 244, 561] -[:mouse_move, 669, 312, 2, 245, 562] -[:mouse_move, 665, 308, 2, 246, 563] -[:mouse_move, 664, 307, 2, 247, 564] -[:mouse_move, 660, 304, 2, 248, 565] -[:mouse_move, 659, 302, 2, 249, 566] -[:mouse_move, 656, 301, 2, 250, 567] -[:mouse_move, 653, 300, 2, 251, 568] -[:mouse_move, 651, 299, 2, 252, 569] -[:mouse_move, 650, 298, 2, 253, 570] -[:mouse_move, 649, 298, 2, 254, 571] -[:mouse_move, 648, 297, 2, 255, 572] -[:mouse_button_pressed, 1, 0, 1, 256, 573] -[:mouse_button_up, 1, 0, 1, 257, 580] -[:mouse_move, 645, 297, 2, 258, 582] -[:mouse_move, 641, 297, 2, 259, 583] -[:mouse_move, 628, 297, 2, 260, 584] -[:mouse_move, 620, 297, 2, 261, 585] -[:mouse_move, 606, 297, 2, 262, 586] -[:mouse_move, 590, 297, 2, 263, 587] -[:mouse_move, 571, 297, 2, 264, 588] -[:mouse_move, 567, 297, 2, 265, 589] -[:mouse_move, 550, 297, 2, 266, 590] -[:mouse_move, 544, 297, 2, 267, 591] -[:mouse_move, 535, 296, 2, 268, 592] -[:mouse_move, 531, 295, 2, 269, 593] -[:mouse_move, 526, 293, 2, 270, 594] -[:mouse_move, 525, 293, 2, 271, 595] -[:mouse_move, 523, 291, 2, 272, 596] -[:mouse_move, 522, 290, 2, 273, 598] -[:mouse_move, 522, 289, 2, 274, 599] -[:mouse_move, 522, 288, 2, 275, 601] -[:mouse_button_pressed, 1, 0, 1, 276, 604] -[:mouse_move, 521, 288, 2, 277, 604] -[:mouse_button_up, 1, 0, 1, 278, 612] -[:mouse_move, 514, 283, 2, 279, 652] -[:mouse_move, 505, 277, 2, 280, 653] -[:mouse_move, 477, 262, 2, 281, 654] -[:mouse_move, 443, 241, 2, 282, 655] -[:mouse_move, 348, 187, 2, 283, 656] -[:mouse_move, 288, 155, 2, 284, 657] -[:mouse_move, 169, 90, 2, 285, 658] -[:mouse_move, 147, 77, 2, 286, 659] -[:mouse_move, 118, 61, 2, 287, 660] -[:mouse_move, 94, 48, 2, 288, 661] -[:mouse_move, 62, 28, 2, 289, 662] -[:mouse_move, 51, 20, 2, 290, 663] -[:mouse_move, 44, 17, 2, 291, 664] -[:mouse_move, 39, 12, 2, 292, 665] -[:mouse_move, 38, 11, 2, 293, 666] -[:mouse_move, 36, 11, 2, 294, 667] -[:mouse_move, 36, 10, 2, 295, 668] -[:mouse_move, 38, 19, 2, 296, 671] -[:mouse_move, 41, 24, 2, 297, 672] -[:mouse_move, 45, 36, 2, 298, 673] -[:mouse_move, 48, 39, 2, 299, 674] -[:mouse_move, 51, 49, 2, 300, 675] -[:mouse_move, 53, 53, 2, 301, 676] -[:mouse_move, 56, 60, 2, 302, 677] -[:mouse_move, 57, 62, 2, 303, 678] -[:mouse_move, 60, 70, 2, 304, 679] -[:mouse_move, 65, 77, 2, 305, 680] -[:mouse_move, 73, 86, 2, 306, 681] -[:mouse_move, 77, 91, 2, 307, 682] -[:mouse_move, 89, 101, 2, 308, 683] -[:mouse_move, 97, 105, 2, 309, 684] -[:mouse_move, 117, 114, 2, 310, 685] -[:mouse_move, 122, 116, 2, 311, 686] -[:mouse_move, 137, 118, 2, 312, 687] -[:mouse_move, 150, 119, 2, 313, 688] -[:mouse_move, 155, 119, 2, 314, 689] -[:mouse_move, 165, 119, 2, 315, 690] -[:mouse_move, 170, 117, 2, 316, 691] -[:mouse_move, 174, 114, 2, 317, 692] -[:mouse_move, 177, 112, 2, 318, 693] -[:mouse_move, 180, 108, 2, 319, 694] -[:mouse_move, 181, 106, 2, 320, 695] -[:mouse_move, 182, 99, 2, 321, 696] -[:mouse_move, 182, 96, 2, 322, 697] -[:mouse_move, 180, 91, 2, 323, 698] -[:mouse_move, 179, 88, 2, 324, 699] -[:mouse_move, 173, 83, 2, 325, 700] -[:mouse_move, 168, 80, 2, 326, 701] -[:mouse_move, 154, 78, 2, 327, 702] -[:mouse_move, 150, 78, 2, 328, 703] -[:mouse_move, 141, 78, 2, 329, 704] -[:mouse_move, 138, 78, 2, 330, 705] -[:mouse_move, 132, 78, 2, 331, 706] -[:mouse_move, 130, 78, 2, 332, 707] -[:mouse_move, 128, 78, 2, 333, 708] -[:mouse_move, 126, 80, 2, 334, 709] -[:mouse_move, 124, 83, 2, 335, 710] -[:mouse_move, 124, 85, 2, 336, 711] -[:mouse_move, 123, 88, 2, 337, 712] -[:mouse_move, 122, 91, 2, 338, 713] -[:mouse_move, 122, 96, 2, 339, 714] -[:mouse_move, 122, 97, 2, 340, 715] -[:mouse_move, 122, 100, 2, 341, 716] -[:mouse_move, 122, 101, 2, 342, 717] -[:mouse_move, 125, 103, 2, 343, 718] -[:mouse_move, 128, 103, 2, 344, 719] -[:mouse_move, 135, 104, 2, 345, 720] -[:mouse_move, 146, 104, 2, 346, 721] -[:mouse_move, 152, 104, 2, 347, 722] -[:mouse_move, 160, 102, 2, 348, 723] -[:mouse_move, 164, 101, 2, 349, 724] -[:mouse_move, 169, 98, 2, 350, 725] -[:mouse_move, 171, 97, 2, 351, 726] -[:mouse_move, 173, 91, 2, 352, 727] -[:mouse_move, 173, 88, 2, 353, 728] -[:mouse_move, 172, 75, 2, 354, 729] -[:mouse_move, 167, 68, 2, 355, 730] -[:mouse_move, 153, 53, 2, 356, 731] -[:mouse_move, 146, 45, 2, 357, 732] -[:mouse_move, 122, 35, 2, 358, 733] -[:mouse_move, 109, 33, 2, 359, 734] -[:mouse_move, 83, 30, 2, 360, 735] -[:mouse_move, 70, 30, 2, 361, 736] -[:mouse_move, 54, 34, 2, 362, 737] -[:mouse_move, 45, 37, 2, 363, 738] -[:mouse_move, 35, 44, 2, 364, 739] -[:mouse_move, 26, 53, 2, 365, 740] -[:mouse_move, 21, 72, 2, 366, 741] -[:mouse_move, 20, 87, 2, 367, 742] -[:mouse_move, 20, 110, 2, 368, 743] -[:mouse_move, 20, 122, 2, 369, 744] -[:mouse_move, 32, 147, 2, 370, 745] -[:mouse_move, 46, 158, 2, 371, 746] -[:mouse_move, 76, 168, 2, 372, 747] -[:mouse_move, 122, 177, 2, 373, 748] -[:mouse_move, 149, 182, 2, 374, 749] -[:mouse_move, 186, 185, 2, 375, 750] -[:mouse_move, 208, 185, 2, 376, 751] -[:mouse_move, 228, 182, 2, 377, 752] -[:mouse_move, 240, 177, 2, 378, 753] -[:mouse_move, 259, 160, 2, 379, 754] -[:mouse_move, 264, 148, 2, 380, 755] -[:mouse_move, 268, 120, 2, 381, 756] -[:mouse_move, 269, 103, 2, 382, 757] -[:mouse_move, 268, 82, 2, 383, 758] -[:mouse_move, 261, 61, 2, 384, 759] -[:mouse_move, 237, 35, 2, 385, 760] -[:mouse_move, 221, 26, 2, 386, 761] -[:mouse_move, 174, 17, 2, 387, 762] -[:mouse_move, 161, 17, 2, 388, 763] -[:mouse_move, 107, 17, 2, 389, 764] -[:mouse_move, 84, 19, 2, 390, 765] -[:mouse_move, 59, 26, 2, 391, 766] -[:mouse_move, 48, 30, 2, 392, 767] -[:mouse_move, 23, 46, 2, 393, 768] -[:mouse_move, 18, 55, 2, 394, 769] -[:mouse_move, 13, 69, 2, 395, 770] -[:mouse_move, 12, 76, 2, 396, 771] -[:mouse_move, 12, 85, 2, 397, 772] -[:mouse_move, 13, 97, 2, 398, 773] -[:mouse_move, 19, 102, 2, 399, 774] -[:mouse_move, 36, 105, 2, 400, 775] -[:mouse_move, 46, 106, 2, 401, 776] -[:mouse_move, 62, 107, 2, 402, 777] -[:mouse_move, 73, 107, 2, 403, 778] -[:mouse_move, 83, 107, 2, 404, 779] -[:mouse_move, 112, 118, 2, 405, 818] -[:mouse_move, 141, 134, 2, 406, 819] -[:mouse_move, 230, 194, 2, 407, 820] -[:mouse_move, 324, 265, 2, 408, 821] -[:mouse_move, 423, 340, 2, 409, 822] -[:key_down_raw, 100, 0, 2, 410, 823] -[:key_up_raw, 100, 0, 2, 411, 823] -[:mouse_move, 452, 361, 2, 412, 823] -[:mouse_move, 473, 376, 2, 413, 823] -[:mouse_move, 487, 385, 2, 414, 824] -[:mouse_move, 490, 382, 2, 415, 837] -[:mouse_move, 497, 379, 2, 416, 838] -[:mouse_move, 509, 371, 2, 417, 839] -[:mouse_move, 517, 366, 2, 418, 840] -[:mouse_move, 528, 360, 2, 419, 841] -[:mouse_move, 532, 358, 2, 420, 842] -[:mouse_move, 538, 354, 2, 421, 843] -[:mouse_move, 541, 352, 2, 422, 844] -[:mouse_move, 545, 348, 2, 423, 845] -[:mouse_move, 546, 346, 2, 424, 846] -[:mouse_move, 548, 343, 2, 425, 847] -[:mouse_move, 549, 340, 2, 426, 848] -[:mouse_move, 552, 329, 2, 427, 849] -[:mouse_move, 554, 324, 2, 428, 850] -[:mouse_move, 558, 314, 2, 429, 851] -[:mouse_move, 562, 309, 2, 430, 852] -[:mouse_move, 567, 298, 2, 431, 853] -[:mouse_move, 568, 296, 2, 432, 854] -[:mouse_move, 571, 290, 2, 433, 855] -[:mouse_move, 572, 286, 2, 434, 856] -[:mouse_move, 573, 285, 2, 435, 857] -[:mouse_move, 574, 283, 2, 436, 858] -[:mouse_move, 574, 282, 2, 437, 860] -[:mouse_move, 574, 281, 2, 438, 861] -[:mouse_move, 576, 280, 2, 439, 863] -[:mouse_move, 576, 279, 2, 440, 864] -[:mouse_move, 576, 277, 2, 441, 865] -[:mouse_move, 577, 274, 2, 442, 866] -[:mouse_move, 577, 273, 2, 443, 867] -[:mouse_move, 578, 269, 2, 444, 868] -[:mouse_move, 579, 268, 2, 445, 869] -[:mouse_move, 580, 265, 2, 446, 870] -[:mouse_move, 581, 265, 2, 447, 871] -[:mouse_move, 583, 263, 2, 448, 872] -[:mouse_move, 585, 262, 2, 449, 873] -[:mouse_move, 589, 260, 2, 450, 874] -[:mouse_move, 593, 259, 2, 451, 875] -[:mouse_move, 599, 258, 2, 452, 876] -[:mouse_move, 603, 258, 2, 453, 877] -[:mouse_move, 606, 258, 2, 454, 878] -[:mouse_move, 610, 259, 2, 455, 879] -[:mouse_move, 613, 260, 2, 456, 880] -[:mouse_move, 614, 261, 2, 457, 881] -[:mouse_move, 616, 264, 2, 458, 882] -[:mouse_move, 617, 265, 2, 459, 883] -[:mouse_move, 618, 267, 2, 460, 884] -[:mouse_move, 618, 269, 2, 461, 885] -[:mouse_move, 619, 272, 2, 462, 886] -[:mouse_move, 619, 273, 2, 463, 887] -[:mouse_move, 620, 274, 2, 464, 888] -[:mouse_move, 620, 275, 2, 465, 889] -[:mouse_button_pressed, 1, 0, 1, 466, 893] -[:mouse_button_up, 1, 0, 1, 467, 899] -[:mouse_move, 618, 275, 2, 468, 906] -[:mouse_move, 603, 279, 2, 469, 907] -[:mouse_move, 595, 282, 2, 470, 908] -[:mouse_move, 568, 291, 2, 471, 909] -[:mouse_move, 553, 294, 2, 472, 910] -[:mouse_move, 533, 298, 2, 473, 911] -[:mouse_move, 522, 300, 2, 474, 912] -[:mouse_move, 512, 302, 2, 475, 913] -[:mouse_move, 503, 304, 2, 476, 914] -[:mouse_move, 502, 304, 2, 477, 915] -[:mouse_move, 500, 304, 2, 478, 916] -[:mouse_move, 499, 304, 2, 479, 917] -[:mouse_button_pressed, 1, 0, 1, 480, 921] -[:mouse_button_up, 1, 0, 1, 481, 926] -[:mouse_move, 499, 305, 2, 482, 930] -[:mouse_move, 499, 307, 2, 483, 931] -[:mouse_move, 506, 328, 2, 484, 932] -[:mouse_move, 513, 344, 2, 485, 933] -[:mouse_move, 525, 372, 2, 486, 934] -[:mouse_move, 528, 377, 2, 487, 935] -[:mouse_move, 535, 393, 2, 488, 936] -[:mouse_move, 545, 409, 2, 489, 937] -[:mouse_move, 549, 414, 2, 490, 938] -[:mouse_move, 552, 420, 2, 491, 939] -[:mouse_move, 554, 421, 2, 492, 940] -[:mouse_move, 556, 424, 2, 493, 941] -[:mouse_move, 558, 425, 2, 494, 942] -[:mouse_move, 560, 427, 2, 495, 943] -[:mouse_move, 561, 429, 2, 496, 944] -[:mouse_move, 563, 430, 2, 497, 945] -[:mouse_move, 564, 432, 2, 498, 946] -[:mouse_move, 564, 434, 2, 499, 947] -[:mouse_move, 565, 434, 2, 500, 948] -[:mouse_move, 565, 435, 2, 501, 949] -[:mouse_move, 566, 435, 2, 502, 950] -[:mouse_button_pressed, 1, 0, 1, 503, 953] -[:mouse_button_up, 1, 0, 1, 504, 959] -[:mouse_move, 566, 436, 2, 505, 963] -[:mouse_move, 566, 437, 2, 506, 964] -[:mouse_move, 570, 445, 2, 507, 965] -[:mouse_move, 576, 454, 2, 508, 966] -[:mouse_move, 579, 459, 2, 509, 967] -[:mouse_move, 584, 465, 2, 510, 968] -[:mouse_move, 586, 468, 2, 511, 969] -[:mouse_move, 590, 471, 2, 512, 970] -[:mouse_move, 593, 472, 2, 513, 971] -[:mouse_move, 597, 473, 2, 514, 972] -[:mouse_move, 598, 473, 2, 515, 973] -[:mouse_move, 602, 474, 2, 516, 974] -[:mouse_move, 603, 474, 2, 517, 975] -[:mouse_move, 609, 474, 2, 518, 976] -[:mouse_move, 610, 474, 2, 519, 977] -[:mouse_move, 613, 474, 2, 520, 978] -[:mouse_move, 614, 474, 2, 521, 979] -[:mouse_move, 615, 474, 2, 522, 980] -[:mouse_move, 616, 474, 2, 523, 981] -[:mouse_button_pressed, 1, 0, 1, 524, 982] -[:mouse_button_up, 1, 0, 1, 525, 988] -[:mouse_move, 617, 474, 2, 526, 991] -[:mouse_move, 625, 473, 2, 527, 992] -[:mouse_move, 632, 472, 2, 528, 993] -[:mouse_move, 653, 466, 2, 529, 994] -[:mouse_move, 663, 462, 2, 530, 995] -[:mouse_move, 696, 453, 2, 531, 996] -[:mouse_move, 713, 449, 2, 532, 997] -[:mouse_move, 723, 446, 2, 533, 998] -[:mouse_move, 730, 445, 2, 534, 999] -[:mouse_move, 732, 444, 2, 535, 1000] -[:mouse_move, 736, 444, 2, 536, 1001] -[:mouse_move, 734, 444, 2, 537, 1005] -[:mouse_button_pressed, 1, 0, 1, 538, 1009] -[:mouse_button_up, 1, 0, 1, 539, 1017] -[:mouse_move, 734, 442, 2, 540, 1020] -[:mouse_move, 734, 440, 2, 541, 1021] -[:mouse_move, 727, 434, 2, 542, 1022] -[:mouse_move, 715, 427, 2, 543, 1023] -[:mouse_move, 690, 418, 2, 544, 1024] -[:mouse_move, 682, 416, 2, 545, 1025] -[:mouse_move, 666, 408, 2, 546, 1026] -[:mouse_move, 663, 407, 2, 547, 1027] -[:mouse_move, 652, 401, 2, 548, 1028] -[:mouse_move, 649, 397, 2, 549, 1029] -[:mouse_move, 646, 394, 2, 550, 1030] -[:mouse_move, 645, 393, 2, 551, 1031] -[:mouse_move, 645, 390, 2, 552, 1032] -[:mouse_move, 645, 388, 2, 553, 1033] -[:mouse_move, 645, 387, 2, 554, 1034] -[:mouse_move, 645, 386, 2, 555, 1035] -[:mouse_button_pressed, 1, 0, 1, 556, 1037] -[:mouse_button_up, 1, 0, 1, 557, 1043] -[:mouse_move, 644, 386, 2, 558, 1063] -[:mouse_move, 638, 382, 2, 559, 1064] -[:mouse_move, 629, 376, 2, 560, 1065] -[:mouse_move, 617, 368, 2, 561, 1066] -[:mouse_move, 553, 329, 2, 562, 1067] -[:mouse_move, 507, 299, 2, 563, 1068] -[:mouse_move, 331, 208, 2, 564, 1069] -[:mouse_move, 288, 186, 2, 565, 1070] -[:mouse_move, 125, 107, 2, 566, 1071] -[:mouse_move, 98, 93, 2, 567, 1072] -[:mouse_move, 37, 55, 2, 568, 1073] -[:mouse_move, 5, 35, 2, 569, 1074] -[:mouse_move, -23, 10, 2, 570, 1075] -[:mouse_move, -23, 7, 2, 571, 1094] -[:mouse_move, -23, 5, 2, 572, 1095] -[:mouse_move, -24, 2, 2, 573, 1096] -[:mouse_move, -24, 0, 2, 574, 1097] -[:mouse_move, -24, 0, 2, 575, 1099] diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/leftSide.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/leftSide.png deleted file mode 100644 index 1fc0060..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/leftSide.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/mountain.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/mountain.png deleted file mode 100644 index 5794464..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/mountain.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/ocean.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/ocean.png deleted file mode 100644 index fbf5fc1..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/ocean.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/rightSide.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/rightSide.png deleted file mode 100644 index d74ff14..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/rightSide.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/river.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/river.png deleted file mode 100644 index eb51890..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/river.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/selectedTile.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/selectedTile.png deleted file mode 100644 index 3719cac..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/selectedTile.png and /dev/null differ diff --git a/samples/99_genre_tactical_rpg/isometric_grid/sprites/tile.png b/samples/99_genre_tactical_rpg/isometric_grid/sprites/tile.png deleted file mode 100644 index 4a4f690..0000000 Binary files a/samples/99_genre_tactical_rpg/isometric_grid/sprites/tile.png and /dev/null differ diff --git a/samples/99_genre_topdown_rpg/topdown_starting_point/app/main.rb b/samples/99_genre_topdown_rpg/topdown_starting_point/app/main.rb deleted file mode 100644 index c447940..0000000 --- a/samples/99_genre_topdown_rpg/topdown_starting_point/app/main.rb +++ /dev/null @@ -1,108 +0,0 @@ -=begin - - APIs listing that haven't been encountered in previous sample apps: - - - reverse: Returns a new string with the characters from original string in reverse order. - For example, the command - "dragonruby".reverse - would return the string - "yburnogard". - Reverse is not only limited to strings, but can be applied to arrays and other collections. - - Reminders: - - - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. - - - 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. - -=end - -# This code shows a maze and uses input from the keyboard to move the user around the screen. -# The objective is to reach the goal. - -# Sets values of tile size and player's movement speed -# Also creates tile or box for player and generates map -def tick args - args.state.tile_size = 80 - args.state.player_speed = 4 - args.state.player ||= tile(args, 7, 3, 0, 128, 180) - generate_map args - - # Adds walls, goal, and player to args.outputs.solids so they appear on screen - args.outputs.solids << args.state.walls - args.outputs.solids << args.state.goal - args.outputs.solids << args.state.player - - # If player's box intersects with goal, a label is output onto the screen - if args.state.player.intersect_rect? args.state.goal - args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen - end - - move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed - move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed - move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed - move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed -end - -# Sets position, size, and color of the tile -def tile args, x, y, *color - [x * args.state.tile_size, # sets definition for array using method parameters - y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values - args.state.tile_size, - args.state.tile_size, - *color] -end - -# Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) -def generate_map args - return if args.state.area - - # Creates the area of the map. There are 9 rows running horizontally across the screen - # and 16 columns running vertically on the screen. Any spot with a "1" is not - # open for the player to move into (and is green), and any spot with a "0" is available - # for the player to move in. - args.state.area = [ - [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], - [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal - [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], - [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,], - [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], - [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], - [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], - ].reverse # reverses the order of the area collection - - # By reversing the order, the way that the area appears above is how it appears - # on the screen in the game. If we did not reverse, the map would appear inverted. - - #The wall starts off with no tiles. - args.state.walls = [] - - # If v is 1, a green tile is added to args.state.walls. - # If v is 2, a black tile is created as the goal. - args.state.area.map_2d do |y, x, v| - if v == 1 - args.state.walls << tile(args, x, y, 0, 255, 0) # green tile - elsif v == 2 # notice there is only one "2" above because there is only one single goal - args.state.goal = tile(args, x, y, 0, 0, 0) # black tile - end - end -end - -# Allows the player to move their box around the screen -def move_player args, *vector - box = args.state.player.shift_rect(vector) # box is able to move at an angle - - # If the player's box hits a wall, it is not able to move further in that direction - return if args.state.walls - .any_intersect_rect?(box) - - # Player's box is able to move at angles (not just the four general directions) fast - args.state.player = - args.state.player - .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then - vector.y * args.state.player_speed) # the box will move extremely slow -end diff --git a/samples/99_genre_topdown_rpg/topdown_starting_point/license-for-sample.txt b/samples/99_genre_topdown_rpg/topdown_starting_point/license-for-sample.txt deleted file mode 100644 index 100dcec..0000000 --- a/samples/99_genre_topdown_rpg/topdown_starting_point/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/99_genre_topdown_rpg/topdown_starting_point/replay.txt b/samples/99_genre_topdown_rpg/topdown_starting_point/replay.txt deleted file mode 100644 index f121bc6..0000000 --- a/samples/99_genre_topdown_rpg/topdown_starting_point/replay.txt +++ /dev/null @@ -1,187 +0,0 @@ -replay_version 2.0 -stopped_at 880 -seed 100 -recorded_at Sun Sep 29 22:31:22 2019 -[:key_down_raw, 1073741904, 0, 2, 1, 92] -[:key_down_raw, 1073741904, 0, 2, 2, 117] -[:key_down_raw, 1073741903, 0, 2, 3, 119] -[:key_up_raw, 1073741904, 0, 2, 4, 119] -[:key_down_raw, 1073741903, 0, 2, 5, 144] -[:key_down_raw, 1073741903, 0, 2, 6, 146] -[:key_down_raw, 1073741903, 0, 2, 7, 148] -[:key_down_raw, 1073741903, 0, 2, 8, 150] -[:key_down_raw, 1073741903, 0, 2, 9, 152] -[:key_down_raw, 1073741906, 0, 2, 10, 152] -[:key_down_raw, 1073741906, 0, 2, 11, 177] -[:key_down_raw, 1073741906, 0, 2, 12, 179] -[:key_down_raw, 1073741906, 0, 2, 13, 181] -[:key_down_raw, 1073741906, 0, 2, 14, 183] -[:key_down_raw, 1073741906, 0, 2, 15, 185] -[:key_down_raw, 1073741906, 0, 2, 16, 187] -[:key_down_raw, 1073741906, 0, 2, 17, 189] -[:key_down_raw, 1073741906, 0, 2, 18, 191] -[:key_down_raw, 1073741906, 0, 2, 19, 193] -[:key_down_raw, 1073741906, 0, 2, 20, 195] -[:key_down_raw, 1073741906, 0, 2, 21, 197] -[:key_down_raw, 1073741906, 0, 2, 22, 199] -[:key_down_raw, 1073741906, 0, 2, 23, 201] -[:key_down_raw, 1073741906, 0, 2, 24, 203] -[:key_down_raw, 1073741906, 0, 2, 25, 205] -[:key_down_raw, 1073741906, 0, 2, 26, 207] -[:key_down_raw, 1073741906, 0, 2, 27, 209] -[:key_down_raw, 1073741906, 0, 2, 28, 211] -[:key_down_raw, 1073741906, 0, 2, 29, 213] -[:key_down_raw, 1073741906, 0, 2, 30, 215] -[:key_down_raw, 1073741906, 0, 2, 31, 217] -[:key_down_raw, 1073741906, 0, 2, 32, 219] -[:key_down_raw, 1073741906, 0, 2, 33, 221] -[:key_down_raw, 1073741906, 0, 2, 34, 223] -[:key_down_raw, 1073741906, 0, 2, 35, 225] -[:key_down_raw, 1073741906, 0, 2, 36, 227] -[:key_down_raw, 1073741906, 0, 2, 37, 229] -[:key_down_raw, 1073741906, 0, 2, 38, 231] -[:key_down_raw, 1073741906, 0, 2, 39, 233] -[:key_down_raw, 1073741906, 0, 2, 40, 235] -[:key_down_raw, 1073741906, 0, 2, 41, 237] -[:key_down_raw, 1073741906, 0, 2, 42, 239] -[:key_down_raw, 1073741906, 0, 2, 43, 241] -[:key_down_raw, 1073741906, 0, 2, 44, 243] -[:key_down_raw, 1073741906, 0, 2, 45, 245] -[:key_down_raw, 1073741906, 0, 2, 46, 248] -[:key_down_raw, 1073741906, 0, 2, 47, 250] -[:key_down_raw, 1073741906, 0, 2, 48, 252] -[:key_down_raw, 1073741906, 0, 2, 49, 254] -[:key_down_raw, 1073741906, 0, 2, 50, 256] -[:key_down_raw, 1073741906, 0, 2, 51, 258] -[:key_down_raw, 1073741906, 0, 2, 52, 260] -[:key_down_raw, 1073741906, 0, 2, 53, 262] -[:key_down_raw, 1073741906, 0, 2, 54, 264] -[:key_down_raw, 1073741905, 0, 2, 55, 265] -[:key_up_raw, 1073741906, 0, 2, 56, 266] -[:key_up_raw, 1073741903, 0, 2, 57, 267] -[:key_down_raw, 1073741904, 0, 2, 58, 287] -[:key_up_raw, 1073741905, 0, 2, 59, 289] -[:key_down_raw, 1073741904, 0, 2, 60, 312] -[:key_down_raw, 1073741904, 0, 2, 61, 314] -[:key_down_raw, 1073741904, 0, 2, 62, 316] -[:key_down_raw, 1073741904, 0, 2, 63, 318] -[:key_down_raw, 1073741904, 0, 2, 64, 320] -[:key_down_raw, 1073741904, 0, 2, 65, 322] -[:key_down_raw, 1073741904, 0, 2, 66, 324] -[:key_down_raw, 1073741904, 0, 2, 67, 326] -[:key_down_raw, 1073741905, 0, 2, 68, 328] -[:key_up_raw, 1073741905, 0, 2, 69, 348] -[:key_down_raw, 1073741905, 0, 2, 70, 385] -[:key_down_raw, 1073741906, 0, 2, 71, 395] -[:key_up_raw, 1073741904, 0, 2, 72, 408] -[:key_up_raw, 1073741905, 0, 2, 73, 409] -[:key_down_raw, 1073741906, 0, 2, 74, 420] -[:key_down_raw, 1073741906, 0, 2, 75, 422] -[:key_down_raw, 1073741906, 0, 2, 76, 424] -[:key_down_raw, 1073741906, 0, 2, 77, 426] -[:key_down_raw, 1073741906, 0, 2, 78, 428] -[:key_down_raw, 1073741906, 0, 2, 79, 430] -[:key_down_raw, 1073741906, 0, 2, 80, 432] -[:key_down_raw, 1073741906, 0, 2, 81, 434] -[:key_down_raw, 1073741906, 0, 2, 82, 436] -[:key_down_raw, 1073741906, 0, 2, 83, 438] -[:key_down_raw, 1073741904, 0, 2, 84, 440] -[:key_down_raw, 1073741904, 0, 2, 85, 465] -[:key_down_raw, 1073741904, 0, 2, 86, 467] -[:key_down_raw, 1073741904, 0, 2, 87, 469] -[:key_down_raw, 1073741904, 0, 2, 88, 471] -[:key_down_raw, 1073741904, 0, 2, 89, 473] -[:key_down_raw, 1073741904, 0, 2, 90, 475] -[:key_down_raw, 1073741904, 0, 2, 91, 477] -[:key_down_raw, 1073741904, 0, 2, 92, 479] -[:key_down_raw, 1073741904, 0, 2, 93, 481] -[:key_down_raw, 1073741904, 0, 2, 94, 483] -[:key_down_raw, 1073741904, 0, 2, 95, 485] -[:key_down_raw, 1073741904, 0, 2, 96, 487] -[:key_down_raw, 1073741904, 0, 2, 97, 489] -[:key_down_raw, 1073741904, 0, 2, 98, 491] -[:key_up_raw, 1073741906, 0, 2, 99, 493] -[:key_down_raw, 1073741904, 0, 2, 100, 493] -[:key_down_raw, 1073741904, 0, 2, 101, 495] -[:key_down_raw, 1073741904, 0, 2, 102, 497] -[:key_down_raw, 1073741904, 0, 2, 103, 499] -[:key_down_raw, 1073741904, 0, 2, 104, 501] -[:key_down_raw, 1073741904, 0, 2, 105, 503] -[:key_down_raw, 1073741904, 0, 2, 106, 505] -[:key_down_raw, 1073741904, 0, 2, 107, 507] -[:key_down_raw, 1073741904, 0, 2, 108, 509] -[:key_down_raw, 1073741904, 0, 2, 109, 511] -[:key_down_raw, 1073741904, 0, 2, 110, 513] -[:key_down_raw, 1073741904, 0, 2, 111, 515] -[:key_down_raw, 1073741904, 0, 2, 112, 517] -[:key_down_raw, 1073741904, 0, 2, 113, 519] -[:key_down_raw, 1073741904, 0, 2, 114, 521] -[:key_down_raw, 1073741904, 0, 2, 115, 523] -[:key_down_raw, 1073741904, 0, 2, 116, 526] -[:key_down_raw, 1073741904, 0, 2, 117, 527] -[:key_down_raw, 1073741904, 0, 2, 118, 530] -[:key_down_raw, 1073741904, 0, 2, 119, 532] -[:key_down_raw, 1073741904, 0, 2, 120, 533] -[:key_down_raw, 1073741904, 0, 2, 121, 536] -[:key_up_raw, 1073741904, 0, 2, 122, 537] -[:key_down_raw, 1073741906, 0, 2, 123, 556] -[:key_down_raw, 1073741906, 0, 2, 124, 580] -[:key_down_raw, 1073741906, 0, 2, 125, 583] -[:key_down_raw, 1073741906, 0, 2, 126, 585] -[:key_down_raw, 1073741906, 0, 2, 127, 587] -[:key_down_raw, 1073741906, 0, 2, 128, 589] -[:key_up_raw, 1073741906, 0, 2, 129, 589] -[:key_down_raw, 1073741905, 0, 2, 130, 617] -[:key_down_raw, 1073741905, 0, 2, 131, 642] -[:key_down_raw, 1073741905, 0, 2, 132, 644] -[:key_down_raw, 1073741905, 0, 2, 133, 646] -[:key_down_raw, 1073741905, 0, 2, 134, 648] -[:key_down_raw, 1073741905, 0, 2, 135, 650] -[:key_down_raw, 1073741905, 0, 2, 136, 652] -[:key_down_raw, 1073741905, 0, 2, 137, 654] -[:key_up_raw, 1073741905, 0, 2, 138, 654] -[:key_down_raw, 1073741906, 0, 2, 139, 663] -[:key_down_raw, 1073741906, 0, 2, 140, 688] -[:key_down_raw, 1073741906, 0, 2, 141, 690] -[:key_down_raw, 1073741906, 0, 2, 142, 692] -[:key_down_raw, 1073741906, 0, 2, 143, 695] -[:key_down_raw, 1073741906, 0, 2, 144, 697] -[:key_down_raw, 1073741906, 0, 2, 145, 699] -[:key_down_raw, 1073741906, 0, 2, 146, 701] -[:key_down_raw, 1073741906, 0, 2, 147, 703] -[:key_down_raw, 1073741906, 0, 2, 148, 705] -[:key_down_raw, 1073741906, 0, 2, 149, 707] -[:key_up_raw, 1073741906, 0, 2, 150, 707] -[:key_down_raw, 1073741905, 0, 2, 151, 713] -[:key_down_raw, 1073741905, 0, 2, 152, 738] -[:key_down_raw, 1073741905, 0, 2, 153, 740] -[:key_down_raw, 1073741903, 0, 2, 154, 741] -[:key_down_raw, 1073741903, 0, 2, 155, 766] -[:key_down_raw, 1073741903, 0, 2, 156, 768] -[:key_down_raw, 1073741903, 0, 2, 157, 770] -[:key_down_raw, 1073741903, 0, 2, 158, 772] -[:key_up_raw, 1073741905, 0, 2, 159, 772] -[:key_down_raw, 1073741903, 0, 2, 160, 774] -[:key_down_raw, 1073741903, 0, 2, 161, 776] -[:key_down_raw, 1073741903, 0, 2, 162, 778] -[:key_down_raw, 1073741903, 0, 2, 163, 780] -[:key_down_raw, 1073741903, 0, 2, 164, 782] -[:key_down_raw, 1073741903, 0, 2, 165, 784] -[:key_down_raw, 1073741903, 0, 2, 166, 786] -[:key_down_raw, 1073741903, 0, 2, 167, 788] -[:key_down_raw, 1073741903, 0, 2, 168, 790] -[:key_down_raw, 1073741903, 0, 2, 169, 792] -[:key_down_raw, 1073741903, 0, 2, 170, 794] -[:key_down_raw, 1073741903, 0, 2, 171, 796] -[:key_down_raw, 1073741903, 0, 2, 172, 798] -[:key_down_raw, 1073741903, 0, 2, 173, 800] -[:key_down_raw, 1073741903, 0, 2, 174, 802] -[:key_down_raw, 1073741903, 0, 2, 175, 804] -[:key_down_raw, 1073741903, 0, 2, 176, 806] -[:key_down_raw, 1073741903, 0, 2, 177, 808] -[:key_down_raw, 1073741903, 0, 2, 178, 810] -[:key_down_raw, 1073741903, 0, 2, 179, 812] -[:key_down_raw, 1073741903, 0, 2, 180, 814] -[:key_up_raw, 1073741903, 0, 2, 181, 814] -[:key_down_raw, 1073742051, 1024, 2, 182, 879] -[:key_down_raw, 113, 1024, 2, 183, 879] -- cgit v1.2.3